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

Namespaces

namespace  bin
 
namespace  compiler
 
namespace  elf
 
namespace  embedder
 
namespace  internal
 
namespace  kernel
 
namespace  mach_o
 
namespace  observatory
 
namespace  pe
 
namespace  snapshot_analyzer
 

Classes

class  Aborted
 
class  AbstractCode
 
class  AbstractInstanceDeserializationCluster
 
class  AbstractType
 
class  AbstractTypeKeyValueTrait
 
class  AcqRelAtomic
 
struct  AcqRelStorageTraits
 
class  AcquiredData
 
class  ActionNode
 
class  ActivationFrame
 
class  ActiveIsolateScope
 
class  AliasedSet
 
class  AliasIdentity
 
struct  ALIGN16
 
class  AllocAndGCTask
 
struct  AllocateArrayABI
 
struct  AllocateBoxABI
 
struct  AllocateClosureABI
 
class  AllocateClosureInstr
 
class  AllocateContextInstr
 
class  AllocateGlobsOfMemoryTask
 
struct  AllocateMintABI
 
struct  AllocateObjectABI
 
class  AllocateObjectInstr
 
struct  AllocateRecordABI
 
class  AllocateRecordInstr
 
struct  AllocateSmallRecordABI
 
class  AllocateSmallRecordInstr
 
struct  AllocateTypedDataArrayABI
 
class  AllocateTypedDataInstr
 
class  AllocateUninitializedContextInstr
 
class  AllocationFilter
 
class  AllocationFinger
 
class  AllocationInstr
 
class  AllocationSampleFilter
 
class  AllocationSinking
 
class  AllocOnlyStackZone
 
class  AllStatic
 
struct  AlternativeGeneration
 
class  AlternativeGenerationList
 
class  Analysis
 
class  AotCallSpecializer
 
class  Api
 
class  ApiError
 
class  ApiGrowableArray
 
class  ApiLocalScope
 
class  ApiMessageDeserializer
 
class  ApiMessageSerializer
 
class  ApiNativeScope
 
class  ApiObjectConverter
 
class  ApiState
 
class  ApiZone
 
class  ArgumentsDescriptor
 
struct  ArgumentsInfo
 
class  Array
 
class  ArrayAllocationInstr
 
class  ArrayDeserializationCluster
 
class  ArrayKeyValueTrait
 
class  ArrayMessageDeserializationCluster
 
class  ArrayMessageSerializationCluster
 
class  ArrayOfTuplesView
 
class  ArraySerializationCluster
 
struct  ArrayStorageTraits
 
class  AssemblerTest
 
class  Assert
 
class  AssertAssignableInstr
 
struct  AssertAssignableStubABI
 
struct  AssertBooleanABI
 
class  AssertBooleanInstr
 
class  AssertionNode
 
class  AssertNoDeoptIdsAllocatedScope
 
struct  AssertSubtypeABI
 
class  AssertSubtypeInstr
 
class  AsThreadStackResource
 
struct  AsyncExceptionHandlerStubABI
 
class  AtomicBitFieldContainer
 
class  AtomicBitFieldContainerBase
 
class  BackgroundCompilationQueue
 
class  BackgroundCompiler
 
class  BackgroundCompilerTask
 
class  BackgroundGCTask
 
class  BackReferenceNode
 
class  BacktrackStack
 
class  BackwardInstructionIterator
 
class  BareSwitchableCallPattern
 
class  Base
 
struct  base_ptr_type
 
class  BaseCStringIntMap
 
class  BaseCStringSet
 
class  BaseDeserializer
 
class  BaseDirectChainedHashMap
 
class  BaseGrowableArray
 
class  BaseGrowableHandlePtrArray
 
class  BaseIsolate
 
class  BasePageIterator
 
class  BaseSerializer
 
class  BaseTextBuffer
 
class  BaseThread
 
class  BaseWriteStream
 
class  Become
 
class  Benchmark
 
class  BenchmarkIsolateScope
 
class  Bequest
 
class  BinaryDoubleOpInstr
 
class  BinaryFeedback
 
class  BinaryInt32OpInstr
 
class  BinaryInt64OpInstr
 
class  BinaryIntegerOpInstr
 
class  BinarySmiOpInstr
 
class  BinaryUint32OpInstr
 
class  BitCastInstr
 
class  BitField
 
class  BitField< S, T, position, size, false, typename std::enable_if< std::is_base_of< AtomicBitFieldContainerBase, S >::value, void >::type >
 
class  BitField< S, T, position, size, sign_extend, typename std::enable_if< std::is_base_of< AtomicBitFieldContainerBase, S >::value, void >::type >
 
class  BitmapBuilder
 
class  BitSet
 
class  BitVector
 
class  BlobImageWriter
 
class  BlockEntryInstr
 
class  BlockEntryWithInitialDefs
 
class  BlockIterator
 
class  BlockLabel
 Convenience wrapper around a BlockEntryInstr pointer. More...
 
class  BlockScheduler
 
class  BlockStack
 
class  BlockTraversalState
 
class  BlockWorkList
 
class  Bool
 
class  BoolCallable
 
class  BooleanNegateInstr
 
class  BoolField
 
class  BoolParameter
 
class  BoolToIntInstr
 
class  Bootstrap
 
struct  BootstrapLibProps
 
class  BootstrapNatives
 
class  BoundsCheckGeneralizer
 
class  BoxAllocationSlowPath
 
struct  BoxDoubleStubABI
 
struct  Boxing
 
class  BoxInstr
 
class  BoxInt32Instr
 
class  BoxInt64Instr
 
class  BoxInteger32Instr
 
class  BoxIntegerInstr
 
class  BoxLanesInstr
 
class  BoxSmallIntInstr
 
class  BoxUint32Instr
 
class  BoyerMooreLookahead
 
class  BoyerMoorePositionInfo
 
class  BranchInstr
 
struct  BranchLabels
 
class  BranchSimplifier
 
class  Breakpoint
 
class  BreakpointLocation
 
class  BSS
 
class  BufferFormatter
 
class  ByteBuffer
 
class  BytecodeRegExpMacroAssembler
 
class  CachableIdempotentCallInstr
 
class  CalculateElementAddressInstr
 
class  Call1ArgStubInstr
 
class  Callable
 
struct  CallbackTestData
 
class  CalleeGraphValidator
 
class  CallingConventions
 
class  CallPattern
 
class  CallSiteData
 
class  CallSiteInliner
 
class  CallSiteResetter
 
class  CallSites
 
class  CallSpecializer
 
class  CallTargets
 
struct  CanonicalFfiCallbackFunctionTraits
 
class  CanonicalFunctionTypeKey
 
class  CanonicalFunctionTypeTraits
 
class  CanonicalInstanceKey
 
class  CanonicalInstanceTraits
 
class  CanonicalRecordTypeKey
 
class  CanonicalRecordTypeTraits
 
class  CanonicalRegExpTraits
 
class  CanonicalSetDeserializationCluster
 
class  CanonicalSetSerializationCluster
 
class  CanonicalTypeArgumentsKey
 
class  CanonicalTypeArgumentsTraits
 
class  CanonicalTypeKey
 
class  CanonicalTypeParameterKey
 
class  CanonicalTypeParameterTraits
 
class  CanonicalTypeTraits
 
class  Capability
 
class  CapabilityMessageDeserializationCluster
 
class  CapabilityMessageSerializationCluster
 
class  CaseInsensitiveCompareInstr
 
class  CaseMapping
 
class  CatchBlockEntryInstr
 
class  CatchEntryMove
 
class  CatchEntryMoves
 
class  CatchEntryMovesMapBuilder
 
class  CatchEntryMovesMapReader
 
class  CatchEntryMovesRefPtr
 
class  CHA
 
class  CHACodeArray
 
struct  Chain
 
class  CharacterRange
 
class  CharacterSet
 
class  CharArray
 
class  CheckArrayBoundInstr
 
class  CheckBoundBaseInstr
 
class  CheckClassIdInstr
 
class  CheckClassInstr
 
class  CheckConditionInstr
 
class  CheckEitherNonSmiInstr
 
class  CheckinTask
 
class  CheckNullInstr
 
class  CheckSmiInstr
 
class  CheckStackOverflowElimination
 
class  CheckStackOverflowInstr
 
class  CheckStoreBufferVisitor
 
class  CheckWritableInstr
 
class  ChoiceNode
 
class  ChoiceTable
 
class  CidCheckerForRanges
 
struct  CidCount
 
class  CidCountingVisitor
 
class  CidIndexedTable
 
struct  CidRange
 
struct  CidRangeValue
 
class  CidRangeVectorUtils
 
class  CidRewriteVisitor
 
class  Cids
 
class  CInstr
 
class  Class
 
class  ClassAllocationSampleFilter
 
class  ClassDeserializationCluster
 
class  ClassDictionaryIterator
 
class  ClassFinalizer
 
class  ClassFunctionsTraits
 
class  ClassKeyValueTrait
 
class  ClassMapTraits
 
class  ClassMessageDeserializationCluster
 
class  ClassMessageSerializationCluster
 
class  ClassReasonForCancelling
 
class  ClassSerializationCluster
 
class  ClassTable
 
class  ClassTableAllocator
 
class  ClassVisitor
 
class  ClearProfileVisitor
 
class  ClearTypeHashVisitor
 
class  CloneContextInstr
 
struct  CloneSuspendStateStubABI
 
class  Closure
 
class  ClosureCallInstr
 
class  ClosureData
 
class  ClosureDataDeserializationCluster
 
class  ClosureDataSerializationCluster
 
class  ClosureDeserializationCluster
 
class  ClosureFunctionsCache
 
class  ClosureSerializationCluster
 
class  Code
 
class  CodeBreakpoint
 
class  CodeDescriptor
 
class  CodeDeserializationCluster
 
class  CodeLookupTable
 
class  CodeLookupTableBuilder
 
class  CodeObserver
 
class  CodeObservers
 
class  CodePatcher
 
class  CodeSerializationCluster
 
class  CodeSourceMap
 
class  CodeSourceMapBuilder
 
class  CodeSourceMapDeserializationCluster
 
class  CodeSourceMapKeyValueTrait
 
struct  CodeSourceMapOps
 
class  CodeSourceMapReader
 
class  CodeSourceMapSerializationCluster
 
class  CodeStatistics
 
class  CodeTestHelper
 
class  CodeTraits
 
class  CodeVisitor
 
class  CollectStoreBufferVisitor
 
class  CombinedCodeStatistics
 
class  CompactorTask
 
class  ComparisonInstr
 
class  CompilationPipeline
 
class  CompileParsedFunctionHelper
 
class  Compiler
 
class  CompilerDeoptInfo
 
class  CompilerDeoptInfoWithStub
 
class  CompilerPass
 
struct  CompilerPassState
 
class  CompilerState
 
class  CompilerTest
 
class  CompilerTimings
 
class  CompileType
 
class  CompressedStackMaps
 
class  CompressedStackMapsBuilder
 
class  CompressedStackMapsDeserializationCluster
 
class  CompressedStackMapsSerializationCluster
 
class  ConcatString
 
class  ConcurrentForceGrowthScopeTask
 
class  ConcurrentMarkTask
 
class  ConcurrentSweeperTask
 
struct  Cons
 
struct  ConstantAndRepresentation
 
class  ConstantInstr
 
struct  ConstantPoolTrait
 
class  ConstantPropagator
 
class  ConstantTemporaryAllocator
 
class  ConstClassFieldRemoved
 
class  ConstMap
 
class  ConstraintInstr
 
class  ConstSet
 
class  ConstToNonConstClass
 
class  Context
 
class  ContextDeserializationCluster
 
class  ContextScope
 
class  ContextScopeDeserializationCluster
 
class  ContextScopeSerializationCluster
 
class  ContextSerializationCluster
 
class  CounterVisitor
 
class  CPU
 
class  CpuId
 
class  CpuInfo
 
class  CreateArrayInstr
 
class  CSEInstructionSet
 
class  CStringIntMap
 
struct  CStringIntMapKeyValueTrait
 
class  CStringSetKeyValueTrait
 
class  Dart
 
struct  Dart_CodeLocation
 
struct  DartCallingConvention
 
class  DartCompilationPipeline
 
class  DartEntry
 
class  DartEntryScope
 
class  DartFrameIterator
 
class  DartInitializationState
 
class  DartLibraryCalls
 
class  DartListParameter
 
class  DartReturnInstr
 
class  DartStringParameter
 
class  DeadCodeElimination
 
class  DeadStoreElimination
 
class  Debugger
 
class  DebuggerKeyValueTrait
 
class  DebuggerSet
 
class  DebuggerStackTrace
 
class  DebugStepCheckInstr
 
class  Deduper
 
class  DeeplyImmutableChange
 
class  DefaultHashTraits
 
class  DeferredDouble
 
class  DeferredFloat32x4
 
class  DeferredFloat64x2
 
class  DeferredInt32x4
 
class  DeferredMint
 
class  DeferredObject
 
class  DeferredObjectRef
 
class  DeferredPcMarker
 
class  DeferredPp
 
class  DeferredRetAddr
 
class  DeferredSlot
 
class  Definition
 
class  DefinitionIndexPairTrait
 
class  DefinitionWorklist
 
class  DelayAllocations
 
class  DeltaEncodedTypedDataDeserializationCluster
 
class  DeltaEncodedTypedDataSerializationCluster
 
class  DeoptCallerFpInstr
 
class  DeoptCallerPcInstr
 
class  DeoptCallerPpInstr
 
class  DeoptConstantInstr
 
class  DeoptContext
 
class  DeoptFpuInstr
 
class  DeoptId
 
class  DeoptIdScope
 
class  DeoptimizeInstr
 
class  DeoptInfo
 
class  DeoptInfoBuilder
 
class  DeoptInstr
 
class  DeoptIntegerInstrBase
 
class  DeoptIntInstr
 
class  DeoptMaterializedObjectRefInstr
 
class  DeoptMaterializeObjectInstr
 
class  DeoptMintPairInstr
 
class  DeoptPcMarkerInstr
 
class  DeoptPpInstr
 
class  DeoptRetAddressInstr
 
class  DeoptSafepointOperationScope
 
class  DeoptTable
 
class  DeoptTask
 
class  DeoptWordInstr
 
class  DescriptorList
 
class  DeserializationCluster
 
class  DeserializationRoots
 
class  Deserializer
 
class  DictionaryIterator
 
class  DirectChainedHashMap
 
class  DisableBackgroundCompilationScope
 
class  DisableBreakpointsScope
 
class  DisableIdleTimerScope
 
class  DisableNativeProfileScope
 
class  DisableThreadInterruptsScope
 
class  Disassembler
 
class  DisassembleToJSONStream
 
class  DisassembleToMemory
 
class  DisassembleToStdout
 
class  DisassemblyFormatter
 
class  DispatcherKey
 
class  DispatcherTraits
 
class  DispatchTable
 
class  DispatchTableCallInstr
 
struct  DispatchTableNullErrorABI
 
class  DominatorBasedCSE
 
class  Double
 
class  DoubleDeserializationCluster
 
class  DoubleInternals
 
class  DoubleMessageDeserializationCluster
 
class  DoubleMessageSerializationCluster
 
class  DoubleSerializationCluster
 
class  DoubleTestOpInstr
 
class  DoubleToFloatInstr
 
class  DoubleToIntegerInstr
 
class  DoubleToIntegerSlowPath
 
struct  DoubleToIntegerStubABI
 
class  DoubleToSmiInstr
 
class  DropTempsInstr
 
class  DynamicAssertionHelper
 
class  DynamicLibrary
 
struct  Edge
 
class  EmbeddedArray
 
class  EmbeddedArray< T, 0 >
 
class  EmbedderServiceHandler
 
class  EndNode
 
class  EnsureFinalizedError
 
class  EnterCompilerScope
 
class  EnterIsolateGroupScope
 
class  EntryFrame
 
class  EnumClassConflict
 
class  EnumListParameter
 
class  EnumMapTraits
 
class  EnumParameter
 
class  Environment
 
class  EqualityCompareInstr
 
class  Error
 
class  Evaluator
 
class  Event
 
class  EventCounterRecorder
 
class  EventQueue
 
class  ExceptionHandlerFinder
 
struct  ExceptionHandlerInfo
 
class  ExceptionHandlerList
 
class  ExceptionHandlers
 
class  ExceptionHandlersDeserializationCluster
 
class  ExceptionHandlersSerializationCluster
 
class  Exceptions
 
class  ExclusiveCodePageIterator
 
class  ExclusivePageIterator
 
class  ExitFrame
 
class  Expect
 
class  ExternalCodeObserverAdapter
 
class  ExternalTypedData
 
class  ExternalTypedDataDeserializationCluster
 
class  ExternalTypedDataMessageDeserializationCluster
 
class  ExternalTypedDataMessageSerializationCluster
 
class  ExternalTypedDataSerializationCluster
 
class  ExtractNthOutputInstr
 
struct  ExtraLoopInfo
 
class  FactoryRecognizer
 
class  FakeMessageHandler
 
class  FakeSerializationCluster
 
class  FastForwardMap
 
class  FastFromTo
 
class  FastObjectCopy
 
class  FastObjectCopyBase
 
struct  FfiAsyncCallbackSendStubABI
 
class  FfiCallbackMetadata
 
class  FfiCallInstr
 
struct  FfiNativeEntries
 
class  FfiTrampolineData
 
class  FfiTrampolineDataDeserializationCluster
 
class  FfiTrampolineDataSerializationCluster
 
class  Field
 
class  FieldDependentArray
 
class  FieldDeserializationCluster
 
class  FieldGuardState
 
class  FieldGuardUpdater
 
class  FieldInvalidator
 
class  FieldKeyValueTrait
 
struct  FieldMapping
 
class  FieldSerializationCluster
 
class  FieldTable
 
struct  FinalizableData
 
class  FinalizablePersistentHandle
 
class  FinalizablePersistentHandles
 
class  Finalizer
 
class  FinalizerBase
 
class  FinalizerEntry
 
class  FinalizeVMIsolateVisitor
 
class  FinalizeWeakPersistentHandlesVisitor
 
struct  Fixed
 
class  FixedArray
 
class  FixedCache
 
class  FixedQRegisterView
 
class  Flag
 
class  Flags
 
union  float32_int32
 
class  Float32x4
 
class  Float64x2
 
class  FloatCompareInstr
 
class  FloatToDoubleInstr
 
class  FlowGraph
 
class  FlowGraphAllocator
 
class  FlowGraphBuilderHelper
 
class  FlowGraphCompiler
 
class  FlowGraphDeserializer
 
class  FlowGraphInliner
 
class  FlowGraphPrinter
 
class  FlowGraphSerializer
 
class  FlowGraphTypePropagator
 
class  FlowGraphVisitor
 
class  ForceGrowthSafepointOperationScope
 
class  ForceGrowthScope
 
class  ForwardHeapPointersHandleVisitor
 
class  ForwardHeapPointersVisitor
 
class  ForwardingBlock
 
class  ForwardingCorpse
 
class  ForwardingPage
 
class  ForwardInstructionIterator
 
class  ForwardMapBase
 
class  ForwardPointersVisitor
 
struct  FrameLayout
 
class  FreeList
 
class  FreeListElement
 
class  FrequencyCollator
 
class  FullSnapshotReader
 
class  FullSnapshotWriter
 
class  Function
 
class  FunctionDeserializationCluster
 
class  FunctionEntryInstr
 
class  FunctionHashMapTraits
 
struct  FunctionKeyTraits
 
class  FunctionName
 
class  FunctionSerializationCluster
 
class  FunctionsTraits
 
class  FunctionType
 
class  FunctionTypeDeserializationCluster
 
class  FunctionTypeKeyValueTrait
 
class  FunctionTypeMapping
 
class  FunctionTypeSerializationCluster
 
class  FunctionVisitor
 
class  FutureOr
 
class  FuzzTask
 
class  GCCompactor
 
class  GCLinkedList
 
struct  GCLinkedLists
 
class  GCMarker
 
class  GcSafepointOperationScope
 
class  GCSweeper
 
class  GcWithoutDeoptTask
 
class  GenericCheckBoundInstr
 
class  GetInstancesVisitor
 
class  GotoInstr
 
class  GraphEntryInstr
 
class  GraphInfoCollector
 
class  GraphIntrinsicCodeGenScope
 
class  GreedyLoopState
 
class  GroupDebugger
 
class  GrowableArray
 
class  GrowableHandlePtrArray
 
class  GrowableObjectArray
 
class  GrowableObjectArrayDeserializationCluster
 
class  GrowableObjectArrayMessageDeserializationCluster
 
class  GrowableObjectArrayMessageSerializationCluster
 
class  GrowableObjectArraySerializationCluster
 
class  Guard
 
class  GuardedAlternative
 
class  GuardFieldClassInstr
 
class  GuardFieldInstr
 
class  GuardFieldLengthInstr
 
class  GuardFieldTypeInstr
 
class  Handles
 
class  HandleScope
 
struct  HandleTypes
 
class  HandleVisitor
 
class  HashDoubleOpInstr
 
class  HashIntegerOpInstr
 
class  HashMap
 
class  HashSet
 
class  HashTable
 
class  HashTableBase
 
class  HashTables
 
class  Heap
 
class  HeapIterationScope
 
class  HeapLocker
 
class  HeapMapAsJSONVisitor
 
class  HeapProfileSampler
 
class  HeapTestHelper
 
struct  HelperThreadState
 
class  HierarchyInfo
 
class  HostCPUFeatures
 
class  ICCallPattern
 
class  ICData
 
class  ICDataDeserializationCluster
 
class  ICDataSerializationCluster
 
class  ICDataTestTask
 
class  IdentityMap
 
class  IdentitySetKeyValueTrait
 
class  IdleTimeHandler
 
class  IdParameter
 
class  IfConverter
 
class  IfThenElseInstr
 
class  ILMatcher
 
class  Image
 
class  ImageReader
 
class  ImageWriter
 
struct  ImageWriterCommand
 
class  ImmutableArray
 
class  ImmutableLinkedHashBase
 
class  IndirectEntryInstr
 
class  IndirectGotoInstr
 
class  InductionVar
 
class  InductionVarAnalysis
 
class  InfiniteLoopTask
 
struct  InitInstanceFieldABI
 
struct  InitLateInstanceFieldInternalRegs
 
struct  InitLateStaticFieldInternalRegs
 
struct  InitStaticFieldABI
 
struct  InitSuspendableFunctionStubABI
 
struct  InlinedCallData
 
class  InlinedFunctionsIterator
 
struct  InlinedInfo
 
class  InlineExitCollector
 
class  Instance
 
class  InstanceCallBaseInstr
 
class  InstanceCallInstr
 
class  InstanceDeserializationCluster
 
class  InstanceKeyValueTrait
 
class  InstanceMorpher
 
class  InstanceOfInstr
 
class  InstanceSerializationCluster
 
class  InstanceSizeConflict
 
struct  InstantiateTAVInternalRegs
 
struct  InstantiateTypeABI
 
class  InstantiateTypeArgumentsInstr
 
class  InstantiateTypeInstr
 
struct  InstantiationABI
 
class  Instr
 
struct  InstrAttrs
 
class  Instruction
 
class  InstructionIndexedPropertyIterable
 
class  InstructionPattern
 
class  Instructions
 
class  InstructionsKeyValueTrait
 
struct  InstructionSource
 
class  InstructionsSection
 
class  InstructionsTable
 
class  InstructionVisitor
 
class  Int32ToDoubleInstr
 
class  Int32x4
 
class  Int64Parameter
 
class  Int64ToDoubleInstr
 
class  IntConverterInstr
 
class  Integer
 
class  IntegerInstructionSelector
 
class  InterfaceFinder
 
class  InterruptChecker
 
struct  InterruptedThreadState
 
class  Interval
 
class  IntKeyRawPointerValueTrait
 
class  IntMap
 
class  IntptrPair
 
class  IntrusiveDList
 
class  IntrusiveDListEntry
 
class  IntSet
 
class  IntToBoolInstr
 
class  InvalidationCollector
 
class  InvocationMirror
 
class  InvokeMathCFunctionInstr
 
class  IrregexpCompilationPipeline
 
class  IrregexpInterpreter
 
class  IRRegExpMacroAssembler
 
struct  is_compressed_ptr
 
struct  is_double
 
struct  is_double< double >
 
struct  is_uncompressed_ptr
 
struct  is_uncompressed_ptr< T, typename std::enable_if< std::is_base_of< ObjectPtr, T >::value, void >::type >
 
struct  is_void
 
struct  is_void< void >
 
class  Isolate
 
class  IsolateExitScope
 
class  IsolateGroup
 
class  IsolateGroupReloadContext
 
class  IsolateGroupSource
 
class  IsolateKillerVisitor
 
class  IsolateLeaveScope
 
class  IsolateMessageHandler
 
class  IsolateObjectStore
 
class  IsolateSpawnState
 
class  IsolateVisitor
 
class  Item
 
class  JitCallSpecializer
 
class  JoinEntryInstr
 
class  JSONArray
 
class  JSONBase64String
 
class  JSONObject
 
class  JSONStream
 
class  JSONWriter
 
class  KernelBufferList
 
class  KernelCompilationRequest
 
class  KernelIsolate
 
class  KernelProgramInfo
 
class  KernelProgramInfoDeserializationCluster
 
class  KernelProgramInfoSerializationCluster
 
class  LambdaBoolCallable
 
class  LambdaCallable
 
class  LanguageError
 
class  LanguageErrorDeserializationCluster
 
class  LanguageErrorSerializationCluster
 
struct  LateInitializationErrorABI
 
class  LateInitializationErrorSlowPath
 
class  Latin1
 
class  LeafRuntimeCallInstr
 
class  LeaveCompilerScope
 
struct  LEB128Constants
 
class  Library
 
class  LibraryDeserializationCluster
 
class  LibraryLookupTraits
 
class  LibraryMapTraits
 
class  LibraryPrefix
 
class  LibraryPrefixDeserializationCluster
 
class  LibraryPrefixMapTraits
 
class  LibraryPrefixSerializationCluster
 
class  LibrarySerializationCluster
 
class  LICM
 
struct  Link
 
class  LinkedHashBase
 
struct  LinkRegister
 
class  LivenessAnalysis
 
class  LiveRange
 
class  LoadClassIdInstr
 
class  LoadCodeUnitsInstr
 
class  LoadFieldInstr
 
class  LoadIndexedInstr
 
class  LoadIndexedUnsafeInstr
 
class  LoadingUnit
 
class  LoadingUnitDeserializationCluster
 
class  LoadingUnitSerializationCluster
 
class  LoadingUnitSerializationData
 
class  LoadLocalInstr
 
class  LoadOptimizer
 
class  LoadStaticFieldInstr
 
class  LoadThreadInstr
 
class  LoadUntaggedInstr
 
class  LocalBlockWorkList
 
class  LocalHandle
 
class  LocalHandles
 
class  LocalScope
 
class  LocalVarDescriptors
 
class  LocalVarDescriptorsBuilder
 
class  LocalVariable
 
class  Location
 
class  LocationSummary
 
struct  LocationTrait
 
struct  LocationTrait< Fixed< R, reg > >
 
struct  LocationTrait< FixedQRegisterView< reg > >
 
struct  LocationTrait< FpuRegister >
 
struct  LocationTrait< NoLocation >
 
struct  LocationTrait< QRegisterView >
 
struct  LocationTrait< Register >
 
struct  LocationTrait< SameAsFirstInput >
 
struct  LocationTrait< Temp< RegisterType > >
 
class  Log
 
class  LogBlock
 
class  LogTestHelper
 
class  LongDeoptTask
 
class  LongJumpScope
 
class  LoopChoiceNode
 
class  LoopHierarchy
 
class  LoopInfo
 
class  MakePairInstr
 
class  MakeTempInstr
 
class  Malloc
 
class  MallocAllocated
 
class  MallocDirectChainedHashMap
 
class  MallocGrowableArray
 
class  MallocWriteStream
 
class  Map
 
class  MapDeserializationCluster
 
class  MapMessageDeserializationCluster
 
class  MapMessageSerializationCluster
 
class  MapSerializationCluster
 
class  MarkingStack
 
class  MarkingVisitorBase
 
class  MarkingWeakVisitor
 
class  MatchCode
 
class  MaterializeObjectInstr
 
class  MathMinMaxInstr
 
class  MaxMetric
 
class  MaxProfileDepthScope
 
class  MaybeOnStackBuffer
 
struct  MeasureCpu
 
struct  MeasureMonotonic
 
class  MegamorphicCache
 
class  MegamorphicCacheDeserializationCluster
 
class  MegamorphicCacheSerializationCluster
 
class  MegamorphicCacheTable
 
class  MemoryCopyInstr
 
class  MemoryRegion
 
class  Message
 
class  MessageDeserializationCluster
 
class  MessageDeserializer
 
class  MessageEvent
 
class  MessageFinalizableData
 
class  MessageHandler
 
class  MessageHandlerTask
 
class  MessageHandlerTestPeer
 
class  MessageQueue
 
class  MessageSerializationCluster
 
class  MessageSerializer
 
class  MetadataMapTraits
 
class  MethodParameter
 
class  MethodRecognizer
 
class  MethodTokenRecognizer
 
class  Metric
 
class  MetricCurrentRSS
 
class  MetricHeapNewCapacity
 
class  MetricHeapNewExternal
 
class  MetricHeapNewUsed
 
class  MetricHeapOldCapacity
 
class  MetricHeapOldExternal
 
class  MetricHeapOldUsed
 
class  MetricHeapUsed
 
class  MetricIsolateCount
 
class  MetricPeakRSS
 
class  MinMetric
 
class  Mint
 
class  MintDeserializationCluster
 
class  MintMessageDeserializationCluster
 
class  MintMessageSerializationCluster
 
class  MintSerializationCluster
 
class  MirrorReference
 
class  Mirrors
 
class  MockInstruction
 
class  Monitor
 
class  MonitorData
 
class  MonitorLeaveScope
 
class  MonitorLocker
 
class  MonomorphicSmiableCall
 
class  MoveArgumentInstr
 
class  MoveOperands
 
class  MoveSchedule
 
class  MutatorThreadPool
 
class  Mutex
 
class  MutexData
 
class  MutexLocker
 
class  MyMetric
 
struct  NamedArgument
 
struct  NameFormattingParams
 
class  Namespace
 
class  NamespaceDeserializationCluster
 
class  NamespaceSerializationCluster
 
class  NativeArguments
 
class  NativeAssetsMapTraits
 
class  NativeCallInstr
 
class  NativeCallPattern
 
struct  NativeEntries
 
class  NativeEntry
 
class  NativeEntryData
 
class  NativeEntryInstr
 
class  NativeFieldsConflict
 
class  NativeFinalizer
 
class  NativeMessageHandler
 
class  NativeParameterInstr
 
class  NativePointerMessageDeserializationCluster
 
class  NativePointerMessageSerializationCluster
 
class  NativeReturnInstr
 
class  NativeSymbolResolver
 
class  NegativeLookaroundChoiceNode
 
class  NegativeSubmatchSuccess
 
class  NoActiveIsolateScope
 
class  NoAllocationSampleFilter
 
class  NoBackgroundCompilerScope
 
struct  NoCSE
 
struct  NodeInfo
 
class  NodeVisitor
 
struct  NoLocation
 
class  NonStreamingWriteStream
 
class  NoReloadScope
 
class  NoSafepointScope
 
class  NoSuchParameter
 
class  NoTemporaryAllocator
 
struct  NoThrow
 
class  NullErrorSlowPath
 
class  Number
 
class  NumbersKeyValueTrait
 
class  Obfuscator
 
class  Object
 
class  ObjectAccumulator
 
struct  ObjectAlignment
 
class  ObjectCopy
 
class  ObjectCopyBase
 
class  ObjectCounter
 
class  ObjectGraphCopier
 
class  ObjectIdRing
 
class  ObjectIdRingClearPointerVisitor
 
class  ObjectIdRingTestHelper
 
class  ObjectLocator
 
struct  ObjectOffsetPair
 
class  ObjectOffsetTrait
 
class  ObjectPointerVisitor
 
class  ObjectPool
 
class  ObjectPoolDeserializationCluster
 
class  ObjectPoolSerializationCluster
 
class  ObjectPtr
 
class  ObjectSet
 
class  ObjectSetRegion
 
class  ObjectStore
 
class  ObjectVisitor
 
class  OffsetsExtractor
 
class  OffsetsTable
 
class  OneByteString
 
class  OneByteStringFromCharCodeInstr
 
class  OneByteStringMessageDeserializationCluster
 
class  OneByteStringMessageSerializationCluster
 
class  OS
 
class  OsrEntryInstr
 
class  OSThread
 
class  OSThreadIterator
 
class  OutSet
 
class  Page
 
class  PageSpace
 
class  PageSpaceController
 
class  PageSpaceGarbageCollectionHistory
 
class  PairLocation
 
class  ParallelMarkTask
 
class  ParallelMoveEmitter
 
class  ParallelMoveInstr
 
class  ParallelMoveResolver
 
class  ParallelScavengerTask
 
class  ParameterInstr
 
class  ParsedFunction
 
struct  ParsedUri
 
class  Parser
 
struct  Partition
 
class  PassiveObject
 
class  PatchableCallHandler
 
class  PatchClass
 
class  PatchClassDeserializationCluster
 
class  PatchClassSerializationCluster
 
class  PcDescriptors
 
class  PcDescriptorsDeserializationCluster
 
class  PcDescriptorsKeyValueTrait
 
class  PcDescriptorsSerializationCluster
 
class  PcRelativeCallPattern
 
class  PcRelativeCallPatternBase
 
class  PcRelativePatternBase
 
class  PcRelativeTailCallPattern
 
class  PcRelativeTrampolineJumpPattern
 
class  PendingCall
 
class  PendingDeopts
 
class  PendingLazyDeopt
 
class  PersistentHandle
 
class  PersistentHandles
 
class  PersistentHandleVisitor
 
class  PhiInstr
 
class  PhiIterator
 
class  PhiPlaceMoves
 
class  Place
 
class  Pointer
 
class  PointerBase
 
class  PointerBlock
 
class  PointerSetKeyValueTrait
 
class  PolymorphicInliner
 
class  PolymorphicInstanceCallInstr
 
class  PortMap
 
class  PortSet
 
class  PortTestMessageHandler
 
class  PreallocatedStackTraceBuilder
 
class  Precompiler
 
class  PredefinedCObjects
 
class  PreFinalizedConflict
 
struct  PreloadState
 
class  PrintObjectPointersVisitor
 
class  PrintTimeScope
 
class  PriorityQueue
 
class  ProcessedSample
 
class  ProcessedSampleBuffer
 
class  Profile
 
class  ProfileBuilder
 
class  ProfileCode
 
class  ProfileCodeAddress
 
class  ProfileCodeInlinedFunctionsCache
 
class  ProfileCodeTable
 
class  ProfileFunction
 
class  ProfileFunctionSourcePosition
 
class  ProfileFunctionTable
 
class  Profiler
 
struct  ProfilerCounters
 
class  ProfilerDartStackWalker
 
class  ProfilerNativeStackWalker
 
class  ProfilerService
 
class  ProfilerStackWalker
 
class  ProfileSampleBufferTestHelper
 
class  ProfileStackWalker
 
class  ProgramDeserializationRoots
 
class  ProgramElementKeyValueTrait
 
class  ProgramReloadContext
 
class  ProgramSerializationRoots
 
class  ProgramVisitor
 
class  ProgramWalker
 
struct  PrologueInfo
 
class  ProloguePattern
 
class  PromotionStack
 
struct  PtrTypes
 
struct  Pure
 
class  PureComparison
 
class  PureDefinition
 
class  PureInstruction
 
class  QRegisterView
 
class  QueueElement
 
class  QuickCheckDetails
 
class  Random
 
class  Range
 
class  RangeAnalysis
 
class  RangeBoundary
 
struct  RangeErrorABI
 
class  RangeErrorSlowPath
 
class  RangeUtils
 
class  RawPointerKeyValueTrait
 
class  RawReloadParticipationScope
 
class  RawTestCase
 
class  ReachabilityFenceInstr
 
class  ReachingDefs
 
struct  ReaderThreadState
 
class  ReadOnlyHandles
 
class  ReadRwLocker
 
class  ReadStream
 
class  ReasonForCancelling
 
class  ReceivePort
 
class  Record
 
class  RecordCoverageInstr
 
class  RecordDeserializationCluster
 
class  RecordFieldNamesMapTraits
 
class  RecordSerializationCluster
 
class  RecordShape
 
class  RecordType
 
class  RecordTypeDeserializationCluster
 
class  RecordTypeSerializationCluster
 
class  RecursionCheck
 
class  RedefinitionInstr
 
class  RegExp
 
class  RegExpAlternative
 
class  RegExpAssertion
 
class  RegExpAtom
 
class  RegExpBackReference
 
class  RegExpBuilder
 
class  RegExpCapture
 
class  RegExpCharacterClass
 
struct  RegExpCompileData
 
class  RegExpCompiler
 
class  RegExpDeserializationCluster
 
class  RegExpDisjunction
 
class  RegExpEmpty
 
class  RegExpEngine
 
class  RegExpExpansionLimiter
 
class  RegExpFlags
 
class  RegExpKey
 
class  RegExpLookaround
 
class  RegExpMacroAssembler
 
class  RegExpNode
 
class  RegExpParser
 
class  RegExpQuantifier
 
class  RegExpSerializationCluster
 
class  RegExpText
 
class  RegExpTree
 
class  RegExpUnparser
 
class  RegExpVisitor
 
class  RegisterNames
 
struct  RegisterReader
 
struct  RegisterReader< FpuRegister, double >
 
struct  RegisterReader< FpuRegister, float >
 
struct  RegisterReader< FpuRegister, simd128_value_t >
 
struct  RegisterReader< Register, T >
 
class  RegisterRunningIsolatesVisitor
 
class  RegisterSet
 
class  RegisterSource
 
class  RelationalOpInstr
 
class  RelaxedAtomic
 
class  ReloadSafepointOperationScope
 
class  ReloadTask
 
class  Report
 
struct  RepresentationUtils
 
class  Resolver
 
struct  Resource
 
class  RestoreWriteBarrierInvariantVisitor
 
struct  ResumeStubABI
 
class  RetainingPath
 
struct  ReThrowABI
 
class  ReThrowInstr
 
class  ReturnAddressLocator
 
class  ReturnBaseInstr
 
class  ReturnPattern
 
struct  ReturnStubABI
 
class  ReusableHandleStack
 
class  ReversePc
 
class  RingBuffer
 
class  RingServiceIdZone
 
class  RODataDeserializationCluster
 
class  RODataSerializationCluster
 
struct  RunInSafepointAndRWCodeArgs
 
class  RunKernelTask
 
struct  RunLoopData
 
class  RunnableIsolateParameter
 
class  RunServiceTask
 
class  RuntimeCallDeoptScope
 
class  RuntimeEntry
 
class  RwLock
 
class  SafepointHandler
 
class  SafepointMonitorLocker
 
class  SafepointMonitorUnlockScope
 
class  SafepointMutexLocker
 
class  SafepointOperationScope
 
class  SafepointPosition
 
class  SafepointReadRwLocker
 
class  SafepointRwLock
 
class  SafepointTestTask
 
class  SafepointWriteRwLocker
 
struct  SameAsFirstInput
 
class  Sample
 
class  SampleBlock
 
class  SampleBlockBuffer
 
class  SampleBlockBufferOverrideScope
 
class  SampleBlockCleanupVisitor
 
class  SampleBlockProcessor
 
class  SampleBuffer
 
class  SampleFilter
 
class  SampleVisitor
 
class  Scavenger
 
class  ScavengerVisitorBase
 
class  ScavengerWeakVisitor
 
class  ScavengeStats
 
class  Scheduler
 
class  ScopedHandle
 
class  ScopeTimer
 
class  Script
 
class  ScriptDeserializationCluster
 
class  ScriptSerializationCluster
 
class  ScriptUrlSetTraits
 
class  SemiSpace
 
class  SendAndExitMessagesHandler
 
class  SendPort
 
class  SendPortMessageDeserializationCluster
 
class  SendPortMessageSerializationCluster
 
class  Sentinel
 
class  SeqRegExpNode
 
class  SerializationCluster
 
class  SerializationRoots
 
class  SerializedObjectBuffer
 
class  Serializer
 
class  Service
 
class  ServiceEvent
 
class  ServiceIdZone
 
class  ServiceIsolate
 
class  ServiceIsolateVisitor
 
struct  ServiceMethodDescriptor
 
class  ServiceTestMessageHandler
 
class  Set
 
class  SetDeserializationCluster
 
class  SetFlagScope
 
class  SetFramePointerPattern
 
class  SetMessageDeserializationCluster
 
class  SetMessageSerializationCluster
 
class  SetSerializationCluster
 
struct  SharedSlowPathStubABI
 
class  ShiftInt64OpInstr
 
class  ShiftIntegerOpInstr
 
class  ShiftUint32OpInstr
 
class  SignalHandler
 
struct  SignatureTrait
 
struct  SignatureTrait< Cons< T0, Tx > >
 
struct  SignatureTrait< Nil >
 
struct  simd128_value_t
 
class  Simd128DeserializationCluster
 
class  Simd128MessageDeserializationCluster
 
class  Simd128MessageSerializationCluster
 
class  Simd128SerializationCluster
 
struct  simd_value_t
 
class  SimdLowering
 
struct  SimdOpInfo
 
class  SimdOpInstr
 
class  SimpleHashMap
 
class  SimpleTaskWithZoneAllocation
 
class  SimulateWork
 
class  SimulateWork2
 
class  Simulator
 
class  SingleTargetCache
 
class  SleepTask
 
class  Slot
 
class  SlotCache
 
class  SlowForwardMap
 
class  SlowFromTo
 
class  SlowObjectCopy
 
class  SlowObjectCopyBase
 
class  SlowPathCode
 
class  SmallSet
 
class  Smi
 
class  SmiMessageDeserializationCluster
 
class  SmiMessageSerializationCluster
 
class  SmiToDoubleInstr
 
class  SmiTraits
 
class  Snapshot
 
class  SnapshotHeaderReader
 
class  SourceReport
 
class  SpaceUsage
 
class  SpawnIsolateTask
 
class  SpawnTask
 
class  SpeculativeInliningPolicy
 
class  SpeculativeShiftInt64OpInstr
 
class  SpeculativeShiftUint32OpInstr
 
class  SplayTree
 
class  SSACompactor
 
class  SSALivenessAnalysis
 
class  StackFrame
 
class  StackFrameIterator
 
class  StackMapEntry
 
class  StackMapEntryKeyIntValueTrait
 
class  StackResource
 
class  StackTrace
 
class  StackTraceBuilder
 
class  StackTraceDeserializationCluster
 
class  StackTraceSerializationCluster
 
class  StackTraceUtils
 
class  StackZone
 
class  StartEvent
 
class  StartIsolateScope
 
class  StateMachineTask
 
class  StaticCallInstr
 
class  StaticTypeExactnessState
 
struct  STCInternalRegs
 
class  StickySpecialization
 
class  StopInstr
 
class  StoppedMutatorsScope
 
class  StoreBuffer
 
class  StoreFieldInstr
 
class  StoreIndexedInstr
 
class  StoreIndexedUnsafeInstr
 
class  StoreLocalInstr
 
class  StoreOptimizer
 
class  StoreStaticFieldInstr
 
class  StreamableSampleFilter
 
class  StreamInfo
 
class  StreamingWriteStream
 
class  StressTask
 
class  StrictCompareInstr
 
class  String
 
class  StringDeserializationCluster
 
class  StringHasher
 
class  StringParameter
 
class  StringSerializationCluster
 
class  StringSlice
 
class  StringSpecializationCid
 
class  StringToCharCodeInstr
 
struct  Struct1024BytesHomogeneousUint64
 
struct  Struct10BytesHomogeneousBool
 
struct  Struct10BytesInlineArrayBool
 
struct  Struct12BytesHomogeneousFloat
 
struct  Struct12BytesHomogeneousInt32
 
struct  Struct15BytesInlineArrayMixed
 
struct  Struct16BytesHomogeneousFloat
 
struct  Struct16BytesMixed
 
struct  Struct16BytesMixed2
 
struct  Struct16BytesNestedInt
 
struct  Struct17BytesInt
 
struct  Struct19BytesHomogeneousUint8
 
struct  Struct1ByteBool
 
struct  Struct1ByteInt
 
struct  Struct20BytesHomogeneousFloat
 
struct  Struct20BytesHomogeneousInt32
 
struct  Struct20BytesHomogeneousInt32Copy
 
struct  Struct2BytesInt
 
struct  Struct32BytesHomogeneousDouble
 
struct  Struct32BytesInlineArrayMultiDimensionalInt
 
struct  Struct32BytesNestedInt
 
struct  Struct3BytesHomogeneousUint8
 
struct  Struct3BytesInt2ByteAligned
 
struct  Struct3BytesPackedInt
 
struct  Struct3BytesPackedIntCopy
 
struct  Struct3BytesPackedIntMembersAligned
 
struct  Struct40BytesHomogeneousDouble
 
struct  Struct43693
 
struct  Struct46127
 
struct  Struct4BytesFloat
 
struct  Struct4BytesHomogeneousInt16
 
struct  Struct4BytesHomogeneousInt16Copy
 
struct  Struct4BytesInlineArrayMultiDimensionalInt
 
struct  Struct5BytesPackedMixed
 
struct  Struct64BytesInlineArrayMultiDimensionalInt
 
struct  Struct6BytesInlineArrayInt
 
struct  Struct7BytesHomogeneousUint8
 
struct  Struct7BytesInt4ByteAligned
 
struct  Struct8BytesFloat
 
struct  Struct8BytesHomogeneousFloat
 
struct  Struct8BytesInlineArrayInt
 
struct  Struct8BytesInlineArrayMultiDimensionalInt
 
struct  Struct8BytesInt
 
struct  Struct8BytesMixed
 
struct  Struct8BytesNestedFloat
 
struct  Struct8BytesNestedFloat2
 
struct  Struct8BytesNestedInt
 
struct  Struct8BytesNestedIntCopy
 
struct  Struct8BytesNestedMixed
 
struct  Struct8BytesPackedInt
 
struct  Struct9BytesHomogeneousUint8
 
struct  Struct9BytesInt4Or8ByteAligned
 
struct  Struct9BytesPackedMixed
 
struct  Struct9Uint8
 
struct  StructAlignmentInt16
 
struct  StructAlignmentInt32
 
struct  StructAlignmentInt64
 
struct  StructInlineArray100Bytes
 
struct  StructInlineArrayBig
 
struct  StructInlineArrayInt
 
struct  StructInlineArrayIrregular
 
struct  StructNestedAlignmentStruct5BytesPackedMixed
 
struct  StructNestedIntStructAlignmentInt16
 
struct  StructNestedIntStructAlignmentInt32
 
struct  StructNestedIntStructAlignmentInt64
 
struct  StructNestedIrregularBig
 
struct  StructNestedIrregularBigger
 
struct  StructNestedIrregularEvenBigger
 
struct  StructStruct16BytesHomogeneousFloat2
 
struct  StructStruct16BytesMixed3
 
struct  StructStruct32BytesHomogeneousDouble2
 
class  StubCode
 
class  SubtypeFinder
 
class  SubtypeTestCache
 
class  SubtypeTestCacheDeserializationCluster
 
class  SubtypeTestCacheSerializationCluster
 
class  SuspendInstr
 
class  SuspendState
 
struct  SuspendStubABI
 
class  SwitchableCallPattern
 
class  SwitchableCallPatternBase
 
class  Symbol
 
class  SymbolKeyValueTrait
 
class  Symbols
 
class  SymbolTraits
 
class  Syslog
 
class  SystemServiceIsolateVisitor
 
class  TableSelectorKeyValueTrait
 
class  TailCallInstr
 
class  TarArchive
 
class  TargetCPUFeatures
 
class  TargetEntryInstr
 
struct  TargetInfo
 
class  TaskWithZoneAllocation
 
class  Temp
 
class  TemplateAllocation
 
class  TemplateArrayAllocation
 
class  TemplateComparison
 
class  TemplateDartCall
 
class  TemplateDefinition
 
class  TemplateInstruction
 
class  TemplateLoadField
 
class  TemplateSlowPathCode
 
class  TemporaryRegisterAllocator
 
class  TestCase
 
class  TestCaseBase
 
struct  TestCaseMoves
 
class  TestCidsInstr
 
class  TesterState
 
class  TestIsolateScope
 
struct  TestLibEntry
 
class  TestMessageHandler
 
class  TestPipeline
 
class  TestRangeInstr
 
struct  TestResult
 
class  TestSmiInstr
 
class  TestStackedStackResource
 
class  TestStackResource
 
class  TestTask
 
class  TestTraits
 
class  TestValue
 
class  TestValueObject
 
class  TextBuffer
 
class  TextElement
 
class  TextNode
 
class  Thread
 
class  ThreadBarrier
 
class  ThreadInlineImpl
 
class  ThreadInterrupter
 
class  ThreadInterruptScope
 
struct  ThreadIteratorTestParams
 
class  ThreadLocalData
 
class  ThreadLocalEntry
 
class  ThreadPool
 
class  ThreadRegistry
 
class  ThreadSignalBlocker
 
class  ThreadStackResource
 
struct  ThreadStartInfo
 
class  ThreadState
 
struct  ThrowABI
 
class  ThrowErrorSlowPathCode
 
class  ThrowInstr
 
struct  Throws
 
class  TimelineRecorderOverride
 
class  TimelineStream
 
class  TimelineTestHelper
 
class  Timer
 
class  TimerImpl
 
class  TimerScope
 
class  ToggleBreakpointTask
 
class  Token
 
class  TokenPosition
 
class  Trace
 
class  TraceStubInvocationScope
 
class  TransferableTypedData
 
class  TransferableTypedDataMessageDeserializationCluster
 
class  TransferableTypedDataMessageSerializationCluster
 
class  TransferableTypedDataPeer
 
class  TransitionGeneratedToNative
 
class  TransitionGeneratedToVM
 
class  TransitionNativeToVM
 
class  TransitionSafepointState
 
class  TransitionToGenerated
 
class  TransitionToNative
 
class  TransitionToVM
 
class  TransitionVMToBlocked
 
class  TransitionVMToGenerated
 
class  TransitionVMToNative
 
class  TruncDivModInstr
 
class  TryCatchAnalyzer
 
struct  TsanUtils
 
struct  TTSInternalRegs
 
struct  TTSTestCase
 
class  TTSTestState
 
class  TwoByteString
 
class  TwoByteStringMessageDeserializationCluster
 
class  TwoByteStringMessageSerializationCluster
 
class  Type
 
class  TypeArguments
 
class  TypeArgumentsDeserializationCluster
 
class  TypeArgumentsKeyValueTrait
 
class  TypeArgumentsMessageDeserializationCluster
 
class  TypeArgumentsMessageSerializationCluster
 
class  TypeArgumentsSerializationCluster
 
class  TypedData
 
class  TypedDataBase
 
class  TypedDataDeduper
 
class  TypedDataDeserializationCluster
 
class  TypedDataKeyValueTrait
 
class  TypedDataMessageDeserializationCluster
 
class  TypedDataMessageSerializationCluster
 
class  TypedDataSerializationCluster
 
class  TypedDataSpecializer
 
class  TypedDataView
 
class  TypedDataViewDeserializationCluster
 
class  TypedDataViewMessageDeserializationCluster
 
class  TypedDataViewMessageSerializationCluster
 
class  TypedDataViewSerializationCluster
 
class  TypeDeserializationCluster
 
class  TypeMessageDeserializationCluster
 
class  TypeMessageSerializationCluster
 
class  TypeParameter
 
class  TypeParameterDeserializationCluster
 
class  TypeParameterKeyValueTrait
 
class  TypeParameters
 
class  TypeParametersChanged
 
class  TypeParametersDeserializationCluster
 
class  TypeParameterSerializationCluster
 
class  TypeParametersSerializationCluster
 
class  TypeSerializationCluster
 
struct  TypeTestABI
 
class  TypeTestingStubCallPattern
 
class  TypeTestingStubGenerator
 
class  TypeTestingStubNamer
 
class  TypeUsageInfo
 
class  UInt64Parameter
 
class  UIntParameter
 
class  UnaryDoubleOpInstr
 
class  UnaryInt64OpInstr
 
class  UnaryIntegerOpInstr
 
class  UnarySmiOpInstr
 
class  UnaryUint32OpInstr
 
class  UnboxedConstantInstr
 
class  UnboxedFieldBitmap
 
class  UnboxInstr
 
class  UnboxInt32Instr
 
class  UnboxInt64Instr
 
class  UnboxInteger32Instr
 
class  UnboxIntegerInstr
 
class  UnboxLaneInstr
 
class  UnboxUint32Instr
 
class  UnhandledException
 
class  UnhandledExceptionDeserializationCluster
 
class  UnhandledExceptionSerializationCluster
 
class  UnicodeRangeSplitter
 
union  Union16BytesNestedFloat
 
union  Union16BytesNestedInlineArrayFloat
 
union  Union2BytesInt
 
union  Union4BytesMixed
 
union  Union8BytesNestedFloat
 
union  Union9BytesNestedInt
 
class  UnitDeserializationRoots
 
class  UnitSerializationRoots
 
class  UnlinkedCall
 
class  UnlinkedCallDeserializationCluster
 
class  UnlinkedCallSerializationCluster
 
class  UnorderedHashMap
 
class  UnorderedHashSet
 
class  UnorderedHashTable
 
class  UnsafeExclusivePageIterator
 
class  UntaggedAbstractType
 
class  UntaggedApiError
 
class  UntaggedArray
 
class  UntaggedBool
 
class  UntaggedCallSiteData
 
class  UntaggedCapability
 
class  UntaggedClass
 
class  UntaggedClosure
 
class  UntaggedClosureData
 
class  UntaggedCode
 
class  UntaggedCodeSourceMap
 
class  UntaggedCompressedStackMaps
 
class  UntaggedConstMap
 
class  UntaggedConstSet
 
class  UntaggedContext
 
class  UntaggedContextScope
 
class  UntaggedDouble
 
class  UntaggedDynamicLibrary
 
class  UntaggedError
 
class  UntaggedExceptionHandlers
 
class  UntaggedExternalTypedData
 
class  UntaggedFfiTrampolineData
 
class  UntaggedField
 
class  UntaggedFinalizer
 
class  UntaggedFinalizerBase
 
class  UntaggedFinalizerEntry
 
class  UntaggedFloat32x4
 
class  UntaggedFloat64x2
 
class  UntaggedFunction
 
class  UntaggedFunctionType
 
class  UntaggedFutureOr
 
class  UntaggedGrowableObjectArray
 
class  UntaggedICData
 
class  UntaggedImmutableArray
 
class  UntaggedInstance
 
class  UntaggedInstructions
 
class  UntaggedInstructionsSection
 
class  UntaggedInstructionsTable
 
class  UntaggedInt32x4
 
class  UntaggedInteger
 
class  UntaggedKernelProgramInfo
 
class  UntaggedLanguageError
 
class  UntaggedLibrary
 
class  UntaggedLibraryPrefix
 
class  UntaggedLinkedHashBase
 
class  UntaggedLoadingUnit
 
class  UntaggedLocalVarDescriptors
 
class  UntaggedMap
 
class  UntaggedMegamorphicCache
 
class  UntaggedMint
 
class  UntaggedMirrorReference
 
class  UntaggedMonomorphicSmiableCall
 
class  UntaggedNamespace
 
class  UntaggedNativeFinalizer
 
class  UntaggedNumber
 
class  UntaggedObject
 
class  UntaggedObjectPool
 
class  UntaggedObjectPtrSetTraits
 
class  UntaggedOneByteString
 
class  UntaggedPatchClass
 
class  UntaggedPcDescriptors
 
class  UntaggedPointer
 
class  UntaggedPointerBase
 
class  UntaggedReceivePort
 
class  UntaggedRecord
 
class  UntaggedRecordType
 
class  UntaggedRegExp
 
class  UntaggedScript
 
class  UntaggedSendPort
 
class  UntaggedSentinel
 
class  UntaggedSet
 
class  UntaggedSingleTargetCache
 
class  UntaggedSmi
 
class  UntaggedStackTrace
 
class  UntaggedString
 
class  UntaggedSubtypeTestCache
 
class  UntaggedSuspendState
 
class  UntaggedTransferableTypedData
 
class  UntaggedTwoByteString
 
class  UntaggedType
 
class  UntaggedTypeArguments
 
class  UntaggedTypedData
 
class  UntaggedTypedDataBase
 
class  UntaggedTypedDataView
 
class  UntaggedTypeParameter
 
class  UntaggedTypeParameters
 
class  UntaggedUnhandledException
 
class  UntaggedUnlinkedCall
 
class  UntaggedUnwindError
 
class  UntaggedUserTag
 
class  UntaggedWeakArray
 
class  UntaggedWeakProperty
 
class  UntaggedWeakReference
 
class  UntaggedWeakSerializationReference
 
class  UnwindError
 
class  UnwindingRecords
 
class  UnwindingRecordsPlatform
 
struct  unwrap_enum
 
struct  unwrap_enum< T, false >
 
struct  unwrap_enum< T, true >
 
class  UriMappingTraits
 
class  UseInterval
 
class  UsePosition
 
class  UserTag
 
class  UserTagIsolatesVisitor
 
class  UserTags
 
class  Utf
 
class  Utf16
 
class  Utf8
 
class  Utf8ScanInstr
 
class  Utils
 
class  V8SnapshotProfileWriter
 
class  Value
 
class  ValueListIterable
 
class  ValueObject
 
struct  VarArgs
 
class  VariableIndex
 
class  VariableLivenessAnalysis
 
class  VariadicDefinition
 
class  VerifyAfterMarkingVisitor
 
class  VerifyObjectVisitor
 
class  VerifyPointersVisitor
 
class  VerifyWeakPointersVisitor
 
class  Version
 
struct  VeryLargeStruct
 
class  VirtualMemory
 
class  VisitMarker
 
class  VMDeserializationRoots
 
class  VMHandles
 
class  VMSerializationRoots
 
class  VMTag
 
class  VMTagCounters
 
class  VMTagScope
 
class  WaiterTask
 
struct  WeakAcqRelStorageTraits
 
class  WeakArray
 
class  WeakArrayDeserializationCluster
 
class  WeakArraySerializationCluster
 
struct  WeakArrayStorageTraits
 
class  WeakCodeReferences
 
class  WeakProperty
 
class  WeakPropertyDeserializationCluster
 
class  WeakPropertySerializationCluster
 
class  WeakReference
 
class  WeakSerializationReference
 
class  WeakTable
 
class  Worklist
 
class  WorklistElement
 
class  WritableCodeLiteralsScope
 
class  WritableCodePages
 
class  WritableVMIsolateScope
 
class  WriteBarrierElimination
 
class  WriteBarrierUpdateVisitor
 
class  WriteErrorSlowPath
 
class  WriteRwLocker
 
class  Zone
 
class  ZoneAllocated
 
class  ZoneCStringSet
 
class  ZoneDirectChainedHashMap
 
class  ZoneGrowableArray
 
class  ZoneGrowableHandlePtrArray
 
class  ZonePlace
 
class  ZoneSplayTree
 
class  ZoneTextBuffer
 
class  ZoneWriteStream
 

Typedefs

typedef Coord *(* CoordUnOp) (Coord *coord)
 
typedef intptr_t(* IntptrBinOp) (intptr_t a, intptr_t b)
 
typedef std::function< void()> Work
 
typedef uint32_t(* IntKeyHash) (uint32_t key)
 
typedef intptr_t word
 
typedef uintptr_t uword
 
typedef int32_t classid_t
 
typedef CharArray< uint8_t > Latin1Array
 
typedef CharArray< uint16_t > UTF16Array
 
typedef CharArray< int32_t > UTF32Array
 
typedef UnorderedHashSet< SymbolTraits, WeakAcqRelStorageTraitsCanonicalStringSet
 
typedef UnorderedHashSet< CanonicalTypeTraitsCanonicalTypeSet
 
typedef UnorderedHashSet< CanonicalFunctionTypeTraitsCanonicalFunctionTypeSet
 
typedef UnorderedHashSet< CanonicalRecordTypeTraitsCanonicalRecordTypeSet
 
typedef UnorderedHashSet< CanonicalTypeParameterTraitsCanonicalTypeParameterSet
 
typedef UnorderedHashSet< CanonicalTypeArgumentsTraitsCanonicalTypeArgumentsSet
 
typedef UnorderedHashMap< MetadataMapTraitsMetadataMap
 
typedef UnorderedHashSet< DispatcherTraits, AcqRelStorageTraitsDispatcherSet
 
typedef UnorderedHashSet< CanonicalInstanceTraitsCanonicalInstancesSet
 
using FfiCallbackFunctionSet = UnorderedHashSet< CanonicalFfiCallbackFunctionTraits >
 
typedef UnorderedHashSet< CanonicalRegExpTraits, WeakAcqRelStorageTraitsCanonicalRegExpSet
 
typedef int32_t ClassIdTagType
 
using FunctionHashMap = UnorderedHashMap< FunctionHashMapTraits >
 
typedef DirectChainedHashMap< TableSelectorKeyValueTraitTableSelectorSet
 
typedef DirectChainedHashMap< SymbolKeyValueTraitSymbolSet
 
typedef UnorderedHashSet< FunctionKeyTraitsFunctionSet
 
typedef DirectChainedHashMap< ClassKeyValueTraitClassSet
 
typedef DirectChainedHashMap< AbstractTypeKeyValueTraitAbstractTypeSet
 
typedef DirectChainedHashMap< FunctionTypeKeyValueTraitFunctionTypeSet
 
typedef DirectChainedHashMap< TypeParameterKeyValueTraitTypeParameterSet
 
typedef DirectChainedHashMap< TypeArgumentsKeyValueTraitTypeArgumentsSet
 
typedef DirectChainedHashMap< ProgramElementKeyValueTraitProgramElementSet
 
typedef DirectChainedHashMap< InstanceKeyValueTraitInstanceSet
 
typedef UnorderedHashMap< FunctionsTraitsUniqueFunctionsMap
 
typedef MallocGrowableArray< CidRangeValueCidRangeVector
 
template<typename T >
using serializable_type_t = typename unwrap_enum< std::remove_cv_t< T >, std::is_enum< T >::value >::type
 
typedef GrowableArray< Value * > InputsArray
 
typedef ZoneGrowableArray< MoveArgumentInstr * > MoveArgumentsArray
 
typedef ZoneGrowableArray< LocationLocationArray
 
typedef bool(* BoundaryOp) (RangeBoundary *)
 
using YieldPoints = ZoneGrowableArray< TokenPosition >
 
typedef DirectChainedHashMap< DefinitionIndexPairTraitDefinitionIndexMap
 
typedef QRegister FpuRegister
 
typedef simd128_value_t fpu_register_t
 
typedef uint16_t RegList
 
typedef uword(* invokestub) (uword target_code, uword arguments_descriptor, uword arguments, Thread *thread)
 
typedef struct _Dart_Breakpoint * Dart_Breakpoint
 
typedef struct _Dart_StackTrace * Dart_StackTrace
 
typedef struct _Dart_ActivationFrame * Dart_ActivationFrame
 
typedef Dart_Port Dart_IsolateId
 
typedef void Dart_ExceptionThrownHandler(Dart_IsolateId isolate_id, Dart_Handle exception_object, Dart_StackTrace stack_trace)
 
typedef void Dart_IsolateEventHandler(Dart_IsolateId isolate_id, Dart_IsolateEvent kind)
 
typedef void Dart_PausedEventHandler(Dart_IsolateId isolate_id, intptr_t bp_id, const Dart_CodeLocation &location)
 
typedef void Dart_BreakpointResolvedHandler(Dart_IsolateId isolate_id, intptr_t bp_id, const Dart_CodeLocation &location)
 
typedef DeoptIntInstr< DeoptInstr::kUint32, CatchEntryMove::SourceKind::kUint32Slot, uint32_t > DeoptUint32Instr
 
typedef DeoptIntInstr< DeoptInstr::kInt32, CatchEntryMove::SourceKind::kInt32Slot, int32_t > DeoptInt32Instr
 
typedef DeoptIntInstr< DeoptInstr::kMint, CatchEntryMove::SourceKind::kInt64Slot, int64_t > DeoptMintInstr
 
typedef DeoptFpuInstr< DeoptInstr::kFloat, CatchEntryMove::SourceKind::kFloatSlot, float, DoublePtr > DeoptFloatInstr
 
typedef DeoptFpuInstr< DeoptInstr::kDouble, CatchEntryMove::SourceKind::kDoubleSlot, double, DoublePtr > DeoptDoubleInstr
 
typedef DeoptFpuInstr< DeoptInstr::kFloat32x4, CatchEntryMove::SourceKind::kFloat32x4Slot, simd128_value_t, Float32x4Ptr > DeoptFloat32x4Instr
 
typedef DeoptFpuInstr< DeoptInstr::kFloat64x2, CatchEntryMove::SourceKind::kFloat64x2Slot, simd128_value_t, Float64x2Ptr > DeoptFloat64x2Instr
 
typedef DeoptFpuInstr< DeoptInstr::kInt32x4, CatchEntryMove::SourceKind::kInt32x4Slot, simd128_value_t, Int32x4Ptr > DeoptInt32x4Instr
 
typedef RegisterSource< RegisterCpuRegisterSource
 
typedef RegisterSource< FpuRegisterFpuRegisterSource
 
typedef UnorderedHashMap< NativeAssetsMapTraitsNativeAssetsMap
 
typedef void(* FlagHandler) (bool value)
 
typedef void(* OptionHandler) (const char *value)
 
typedef uintptr_t compressed_uword
 
typedef intptr_t compressed_word
 
typedef uword cpp_vtable
 
template<typename T >
using PointerSet = DirectChainedHashMap< PointerSetKeyValueTrait< T > >
 
typedef UnorderedHashMap< SmiTraitsIntHashMap
 
typedef MarkingVisitorBase< falseUnsyncMarkingVisitor
 
typedef MarkingVisitorBase< true > SyncMarkingVisitor
 
typedef StoreBuffer::Block StoreBufferBlock
 
typedef MarkingStack::Block MarkingStackBlock
 
typedef BlockWorkList< MarkingStackMarkerWorkList
 
typedef PromotionStack::Block PromotionStackBlock
 
typedef BlockWorkList< PromotionStackPromotionWorkList
 
typedef ScavengerVisitorBase< falseSerialScavengerVisitor
 
typedef ScavengerVisitorBase< true > ParallelScavengerVisitor
 
typedef UnorderedHashSet< CodeTraits, WeakArrayStorageTraitsWeakCodeSet
 
typedef DirectChainedHashMap< ObjectOffsetTraitObjectOffsetMap
 
typedef FixedCache< intptr_t, ExceptionHandlerInfo, 16 > HandlerInfoCache
 
typedef FixedCache< intptr_t, CatchEntryMovesRefPtr, 16 > CatchEntryMovesCache
 
using FieldMappingArray = ZoneGrowableArray< FieldMapping >
 
using FieldOffsetArray = ZoneGrowableArray< intptr_t >
 
typedef void(* LogPrinter) (const char *data)
 
typedef ObjectPtr(* BootstrapNativeFunction) (Thread *thread, Zone *zone, NativeArguments *arguments)
 
typedef void(* NativeFunction) (NativeArguments *arguments)
 
typedef void(* NativeFunctionWrapper) (Dart_NativeArguments args, Dart_NativeFunction func)
 
typedef UnorderedHashSet< ClassFunctionsTraitsClassFunctionsSet
 
typedef UnorderedHashMap< LibraryLookupTraitsLibraryLookupMap
 
typedef UnorderedHashMap< RecordFieldNamesMapTraitsRecordFieldNamesMap
 
typedef ZoneGrowableHandlePtrArray< const StringURIs
 
using StaticCallsTable = ArrayOfTuplesView< Code::SCallTableEntry, std::tuple< Smi, Object, Function > >
 
using StaticCallsTableEntry = StaticCallsTable::TupleView
 
using SubtypeTestCacheTable = ArrayOfTuplesView< SubtypeTestCache::Entries, std::tuple< Object, TypeArguments, TypeArguments, TypeArguments, TypeArguments, TypeArguments, AbstractType, Bool > >
 
using MegamorphicCacheEntries = ArrayOfTuplesView< MegamorphicCache::EntryType, std::tuple< Smi, Object > >
 
using InstantiationsCacheTable = ArrayOfTuplesView< TypeArguments::Cache::Entry, std::tuple< Object, TypeArguments, TypeArguments >, TypeArguments::Cache::kHeaderSize >
 
typedef pthread_key_t ThreadLocalKey
 
typedef pthread_t ThreadId
 
typedef pthread_t ThreadJoinId
 
typedef void(* ThreadDestructor) (void *parameter)
 
typedef DirectChainedHashMap< FieldKeyValueTraitFieldSet
 
using HostObjectAlignment = ObjectAlignment< kWordSize, kWordSizeLog2 >
 
typedef DirectChainedHashMap< StackMapEntryKeyIntValueTraitStackMapEntryIntMap
 
typedef bool EmitCharacterFunction(Zone *zone, RegExpCompiler *compiler, uint16_t c, BlockLabel *on_failure, intptr_t cp_offset, bool check, bool preloaded)
 
typedef unibrow::Mapping< unibrow::Ecma262CanonicalizeCanonicalize
 
using RegExpCaptureName = ZoneGrowableArray< uint16_t >
 
typedef double(* UnaryMathCFunction) (double x)
 
typedef double(* BinaryMathCFunction) (double x, double y)
 
typedef void *(* MemMoveCFunction) (void *dest, const void *src, size_t n)
 
typedef void(* RuntimeFunction) (NativeArguments arguments)
 
using BaseRuntimeEntry = compiler::RuntimeEntry
 
typedef void(* ServiceMethodEntry) (Thread *thread, JSONStream *js)
 
typedef UnorderedHashMap< UriMappingTraitsUriMapping
 
typedef void(* SignalAction) (int signal, siginfo_t *info, void *context)
 
typedef ObjectPtr CompressedObjectPtr
 
using ReloadParticipationScope = AsThreadStackResource< RawReloadParticipationScope >
 

Enumerations

enum  { kPathsUriOffset = 0 , kPathsSourceOffset = 1 , kPathsEntryLength = 2 }
 
enum  ClassId : intptr_t {
  kIllegalCid = 0 , kNativePointer , kFreeListElement , kForwardingCorpse ,
  kByteDataViewCid , kUnmodifiableByteDataViewCid , kByteBufferCid , kNullCid ,
  kDynamicCid , kVoidCid , kNeverCid , kNumPredefinedCids
}
 
enum class  CodeEntryKind { kNormal , kUnchecked , kMonomorphic , kMonomorphicUnchecked }
 
enum  TypeCheckMode { kTypeCheckFromLazySpecializeStub , kTypeCheckFromSlowStub , kTypeCheckFromInline }
 
enum  BlockAddressMode {
  DA = (0 | 0 | 0) << 21 , IA = (0 | 4 | 0) << 21 , DB = (8 | 0 | 0) << 21 , IB = (8 | 4 | 0) << 21 ,
  DA_W = (0 | 0 | 1) << 21 , IA_W = (0 | 4 | 1) << 21 , DB_W = (8 | 0 | 1) << 21 , IB_W = (8 | 4 | 1) << 21
}
 
enum class  InnerPointerAccess { kNotUntagged , kMayBeInnerPointer , kCannotBeInnerPointer }
 
enum  StoreBarrierType { kNoStoreBarrier , kEmitStoreBarrier }
 
enum  AlignmentType { kUnalignedAccess , kAlignedAccess }
 
enum  TypeDataField { TypedDataBase_length , TypedDataView_offset_in_bytes , TypedDataView_typed_data }
 
enum  MatchOpCode {
  kMatchAndMoveBranchTrue , kMatchAndMoveBranchFalse , kNop , kMoveAny ,
  kMoveParallelMoves , kMoveGlob , kMoveDebugStepChecks , kInvalidMatchOpCode
}
 
enum class  ParallelMovesHandling { kDefault , kSkip }
 
enum  Representation { kNumRepresentations }
 
enum  CSEMode { kOptimizeLoads , kOptimizeStores }
 
enum  NativeSlotsEnumeration { kNativeSlotsCount }
 
enum class  CompilerTracing { kOn , kOff }
 
enum  DeoptStubKind { kLazyDeoptFromReturn , kLazyDeoptFromThrow , kEagerDeopt }
 
enum  Register {
  R0 = 0 , R1 = 1 , R2 = 2 , R3 = 3 ,
  R4 = 4 , R5 = 5 , R6 = 6 , R7 = 7 ,
  R8 = 8 , R9 = 9 , R10 = 10 , R11 = 11 ,
  R12 = 12 , R13 = 13 , R14 = 14 , R15 = 15 ,
  kNumberOfCpuRegisters = 16 , kNoRegister = -1 , FP = R11 , NOTFP = R7 ,
  IP = R12 , SP = R13 , LR = R14 , PC = R15 ,
  R0 = 0 , R1 = 1 , R2 = 2 , R3 = 3 ,
  R4 = 4 , R5 = 5 , R6 = 6 , R7 = 7 ,
  R8 = 8 , R9 = 9 , R10 = 10 , R11 = 11 ,
  R12 = 12 , R13 = 13 , R14 = 14 , R15 = 15 ,
  R16 = 16 , R17 = 17 , R18 = 18 , R19 = 19 ,
  R20 = 20 , R21 = 21 , R22 = 22 , R23 = 23 ,
  R24 = 24 , R25 = 25 , R26 = 26 , R27 = 27 ,
  R28 = 28 , R29 = 29 , R30 = 30 , R31 = 31 ,
  kNumberOfCpuRegisters = 16 , kNoRegister = -1 , kNoRegister2 = -2 , CSP = 32 ,
  ZR = 33 , IP0 = R16 , IP1 = R17 , SP = R13 ,
  FP = R11 , LR = R14 , EAX = 0 , ECX = 1 ,
  EDX = 2 , EBX = 3 , ESP = 4 , EBP = 5 ,
  ESI = 6 , EDI = 7 , kNumberOfCpuRegisters = 16 , kNoRegister = -1 ,
  ZR = 33 , RA = 1 , SP = R13 , GP = 3 ,
  TP = 4 , T0 = 5 , T1 = 6 , T2 = 7 ,
  FP = R11 , S1 = 1 , A0 = 10 , A1 = 11 ,
  A2 = 12 , A3 = 13 , A4 = 14 , A5 = 15 ,
  A6 = 16 , A7 = 17 , S2 = 2 , S3 = 3 ,
  S4 = 4 , S5 = 5 , S6 = 6 , S7 = 7 ,
  S8 = 8 , S9 = 9 , S10 = 10 , S11 = 11 ,
  T3 = 28 , T4 = 29 , T5 = 30 , T6 = 31 ,
  kNumberOfCpuRegisters = 16 , kNoRegister = -1 , RA2 = T0 , S0 = 0 ,
  RAX = 0 , RCX = 1 , RDX = 2 , RBX = 3 ,
  RSP = 4 , RBP = 5 , RSI = 6 , RDI = 7 ,
  R8 = 8 , R9 = 9 , R10 = 10 , R11 = 11 ,
  R12 = 12 , R13 = 13 , R14 = 14 , R15 = 15 ,
  kNumberOfCpuRegisters = 16 , kNoRegister = -1
}
 
enum  SRegister {
  kNoSRegister = -1 , S0 = 0 , S1 = 1 , S2 = 2 ,
  S3 = 3 , S4 = 4 , S5 = 5 , S6 = 6 ,
  S7 = 7 , S8 = 8 , S9 = 9 , S10 = 10 ,
  S11 = 11 , S12 = 12 , S13 = 13 , S14 = 14 ,
  S15 = 15 , S16 = 16 , S17 = 17 , S18 = 18 ,
  S19 = 19 , S20 = 20 , S21 = 21 , S22 = 22 ,
  S23 = 23 , S24 = 24 , S25 = 25 , S26 = 26 ,
  S27 = 27 , S28 = 28 , S29 = 29 , S30 = 30 ,
  S31 = 31 , kNumberOfSRegisters = 32
}
 
enum  DRegister {
  kNoDRegister = -1 , D0 = 0 , D1 = 1 , D2 = 2 ,
  D3 = 3 , D4 = 4 , D5 = 5 , D6 = 6 ,
  D7 = 7 , D8 = 8 , D9 = 9 , D10 = 10 ,
  D11 = 11 , D12 = 12 , D13 = 13 , D14 = 14 ,
  D15 = 15 , D16 = 16 , D17 = 17 , D18 = 18 ,
  D19 = 19 , D20 = 20 , D21 = 21 , D22 = 22 ,
  D23 = 23 , D24 = 24 , D25 = 25 , D26 = 26 ,
  D27 = 27 , D28 = 28 , D29 = 29 , D30 = 30 ,
  D31 = 31 , kNumberOfDRegisters = 32 , kNumberOfOverlappingDRegisters = 16
}
 
enum  QRegister {
  kNoQRegister = -1 , Q0 = 0 , Q1 = 1 , Q2 = 2 ,
  Q3 = 3 , Q4 = 4 , Q5 = 5 , Q6 = 6 ,
  Q7 = 7 , Q8 = 8 , Q9 = 9 , Q10 = 10 ,
  Q11 = 11 , Q12 = 12 , Q13 = 13 , Q14 = 14 ,
  Q15 = 15 , kNumberOfQRegisters = 16 , kNumberOfOverlappingQRegisters = 8
}
 
enum  Condition {
  kNoCondition = -1 , EQ = 0 , NE = 1 , CS = 2 ,
  CC = 3 , MI = 4 , PL = 5 , VS = 6 ,
  VC = 7 , HI = 8 , LS = 9 , GE = 10 ,
  LT = 11 , GT = 12 , LE = 13 , AL = 14 ,
  kSpecialCondition = 15 , kNumberOfConditions = 16 , EQUAL = EQ , ZERO = EQUAL ,
  NOT_EQUAL = NE , NOT_ZERO = NOT_EQUAL , LESS = LT , LESS_EQUAL = LE ,
  GREATER_EQUAL = GE , GREATER = GT , UNSIGNED_LESS = CC , UNSIGNED_LESS_EQUAL = LS ,
  UNSIGNED_GREATER = HI , UNSIGNED_GREATER_EQUAL = CS , OVERFLOW = VS , NO_OVERFLOW = VC ,
  kInvalidCondition = 16 , kNoCondition = -1 , EQ = 0 , NE = 1 ,
  CS = 2 , CC = 3 , MI = 4 , PL = 5 ,
  VS = 6 , VC = 7 , HI = 8 , LS = 9 ,
  GE = 10 , LT = 11 , GT = 12 , LE = 13 ,
  AL = 14 , NV = 15 , kNumberOfConditions = 16 , EQUAL = EQ ,
  ZERO = EQUAL , NOT_EQUAL = NE , NOT_ZERO = NOT_EQUAL , LESS = LT ,
  LESS_EQUAL = LE , GREATER_EQUAL = GE , GREATER = GT , UNSIGNED_LESS = CC ,
  UNSIGNED_LESS_EQUAL = LS , UNSIGNED_GREATER = HI , UNSIGNED_GREATER_EQUAL = CS , OVERFLOW = VS ,
  NO_OVERFLOW = VC , kInvalidCondition = 16 , kNoCondition = -1 , EQ = 0 ,
  NE = 1 , CS = 2 , CC = 3 , MI = 4 ,
  PL = 5 , VS = 6 , VC = 7 , HI = 8 ,
  LS = 9 , GE = 10 , LT = 11 , GT = 12 ,
  LE = 13 , AL = 14 , NV = 15 , kNumberOfConditions = 16 ,
  EQUAL = EQ , ZERO = EQUAL , NOT_EQUAL = NE , NOT_ZERO = NOT_EQUAL ,
  LESS = LT , LESS_EQUAL = LE , GREATER_EQUAL = GE , GREATER = GT ,
  UNSIGNED_LESS = CC , UNSIGNED_LESS_EQUAL = LS , UNSIGNED_GREATER = HI , UNSIGNED_GREATER_EQUAL = CS ,
  OVERFLOW = VS , NO_OVERFLOW = VC , kInvalidCondition = 16 , OVERFLOW = VS ,
  NO_OVERFLOW = VC , BELOW = 2 , ABOVE_EQUAL = 3 , EQUAL = EQ ,
  NOT_EQUAL = NE , BELOW_EQUAL = 6 , ABOVE = 7 , SIGN = 8 ,
  NOT_SIGN = 9 , PARITY_EVEN = 10 , PARITY_ODD = 11 , LESS = LT ,
  GREATER_EQUAL = GE , LESS_EQUAL = LE , GREATER = GT , ZERO = EQUAL ,
  NOT_ZERO = NOT_EQUAL , NEGATIVE = SIGN , POSITIVE = NOT_SIGN , CARRY = BELOW ,
  NOT_CARRY = ABOVE_EQUAL , UNSIGNED_LESS = CC , UNSIGNED_LESS_EQUAL = LS , UNSIGNED_GREATER = HI ,
  UNSIGNED_GREATER_EQUAL = CS , kInvalidCondition = 16
}
 
enum  Opcode {
  kNoOperand = -1 , AND = 0 , EOR = 1 , SUB = 2 ,
  RSB = 3 , ADD = 4 , ADC = 5 , SBC = 6 ,
  RSC = 7 , TST = 8 , TEQ = 9 , CMP = 10 ,
  CMN = 11 , ORR = 12 , MOV = 13 , BIC = 14 ,
  MVN = 15 , kMaxOperand = 16 , LUI = 0b0110111 , AUIPC = 0b0010111 ,
  JAL = 0b1101111 , JALR = 0b1100111 , BRANCH = 0b1100011 , LOAD = 0b0000011 ,
  STORE = 0b0100011 , OPIMM = 0b0010011 , OP = 0b0110011 , MISCMEM = 0b0001111 ,
  SYSTEM = 0b1110011 , OP32 = 0b0111011 , OPIMM32 = 0b0011011 , AMO = 0b0101111 ,
  LOADFP = 0b0000111 , STOREFP = 0b0100111 , FMADD = 0b1000011 , FMSUB = 0b1000111 ,
  FNMSUB = 0b1001011 , FNMADD = 0b1001111 , OPFP = 0b1010011
}
 
enum  Shift {
  kNoShift = -1 , LSL = 0 , LSR = 1 , ASR = 2 ,
  ROR = 3 , kMaxShift = 4 , kNoShift = -1 , LSL = 0 ,
  LSR = 1 , ASR = 2 , ROR = 3 , kMaxShift = 4
}
 
enum  InstructionFields {
  kConditionShift = 28 , kConditionBits = 4 , kTypeShift = 25 , kTypeBits = 3 ,
  kLinkShift = 24 , kLinkBits = 1 , kUShift = 23 , kUBits = 1 ,
  kOpcodeShift = 21 , kOpcodeBits = 4 , kSShift = 20 , kSBits = 1 ,
  kRnShift = 16 , kRnBits = 4 , kRdShift = 12 , kRdBits = 4 ,
  kRsShift = 8 , kRsBits = 4 , kRmShift = 0 , kRmBits = 4 ,
  kRotateShift = 8 , kRotateBits = 4 , kImmed8Shift = 0 , kImmed8Bits = 8 ,
  kShiftImmShift = 7 , kShiftRegisterShift = 8 , kShiftImmBits = 5 , kShiftShift = 5 ,
  kShiftBits = 2 , kOffset12Shift = 0 , kOffset12Bits = 12 , kOffset12Mask = 0x00000fff ,
  kMulRdShift = 16 , kMulRdBits = 4 , kMulRnShift = 12 , kMulRnBits = 4 ,
  kLdrExRnShift = 16 , kLdrExRtShift = 12 , kStrExRnShift = 16 , kStrExRdShift = 12 ,
  kStrExRtShift = 0 , kMediaOp1Shift = 20 , kMediaOp1Bits = 5 , kMediaOp2Shift = 5 ,
  kMediaOp2Bits = 3 , kDivRdShift = 16 , kDivRdBits = 4 , kDivRmShift = 8 ,
  kDivRmBits = 4 , kDivRnShift = 0 , kDivRnBits = 4 , kBitFieldExtractWidthShift = 16 ,
  kBitFieldExtractWidthBits = 5 , kBitFieldExtractLSBShift = 7 , kBitFieldExtractLSBBits = 5 , kBitFieldExtractRnShift = 0 ,
  kBitFieldExtractRnBits = 4 , kCRmShift = 0 , kCRmBits = 4 , kOpc2Shift = 5 ,
  kOpc2Bits = 3 , kCoprocShift = 8 , kCoprocBits = 4 , kCRnShift = 16 ,
  kCRnBits = 4 , kOpc1Shift = 21 , kOpc1Bits = 3 , kBranchOffsetMask = 0x00ffffff ,
  kSShift = 20 , kSBits = 1 , kSFShift = 31 , kSFBits = 1 ,
  kSzShift = 30 , kSzBits = 2 , kRdShift = 12 , kRdBits = 4 ,
  kRnShift = 16 , kRnBits = 4 , kRaShift = 10 , kRaBits = 5 ,
  kRmShift = 0 , kRmBits = 4 , kRtShift = 0 , kRtBits = 5 ,
  kRt2Shift = 10 , kRt2Bits = 5 , kRsShift = 8 , kRsBits = 4 ,
  kVdShift = 0 , kVdBits = 5 , kVnShift = 5 , kVnBits = 5 ,
  kVmShift = 16 , kVmBits = 5 , kVtShift = 0 , kVtBits = 5 ,
  kVt2Shift = 10 , kVt2Bits = 5 , kImm3Shift = 10 , kImm3Bits = 3 ,
  kImm4Shift = 11 , kImm4Bits = 4 , kImm5Shift = 16 , kImm5Bits = 5 ,
  kImm6Shift = 10 , kImm6Bits = 6 , kImm7Shift = 15 , kImm7Bits = 7 ,
  kImm7Mask = 0x7f << kImm7Shift , kImm8Shift = 13 , kImm8Bits = 8 , kImm9Shift = 12 ,
  kImm9Bits = 9 , kImm12Shift = 10 , kImm12Bits = 12 , kImm12Mask = 0xfff << kImm12Shift ,
  kImm12ShiftShift = 22 , kImm12ShiftBits = 2 , kImm14Shift = 5 , kImm14Bits = 14 ,
  kImm14Mask = 0x3fff << kImm14Shift , kImm16Shift = 5 , kImm16Bits = 16 , kImm16Mask = 0xffff << kImm16Shift ,
  kImm19Shift = 5 , kImm19Bits = 19 , kImm19Mask = 0x7ffff << kImm19Shift , kImm26Shift = 0 ,
  kImm26Bits = 26 , kImm26Mask = 0x03ffffff << kImm26Shift , kCondShift = 0 , kCondBits = 4 ,
  kCondMask = 0xf << kCondShift , kSelCondShift = 12 , kSelCondBits = 4 , kNShift = 22 ,
  kNBits = 1 , kImmRShift = 16 , kImmRBits = 6 , kImmSShift = 10 ,
  kImmSBits = 6 , kHWShift = 21 , kHWBits = 2 , kAddShiftExtendShift = 21 ,
  kAddShiftExtendBits = 1 , kShiftTypeShift = 22 , kShiftTypeBits = 2 , kExtendTypeShift = 13 ,
  kExtendTypeBits = 3 , kHintCRmShift = 8 , kHintCRmBits = 4 , kHintOp2Shift = 5 ,
  kHintOp2Bits = 3
}
 
enum  ScaleFactor {
  TIMES_1 = 0 , TIMES_2 = 1 , TIMES_4 = 2 , TIMES_8 = 3 ,
  TIMES_16 = 4 , TIMES_COMPRESSED_WORD_SIZE = TIMES_WORD_SIZE , TIMES_COMPRESSED_HALF_WORD_SIZE = TIMES_COMPRESSED_WORD_SIZE - 1 , TIMES_1 = 0 ,
  TIMES_2 = 1 , TIMES_4 = 2 , TIMES_8 = 3 , TIMES_16 = 4 ,
  TIMES_COMPRESSED_WORD_SIZE = TIMES_WORD_SIZE , TIMES_COMPRESSED_HALF_WORD_SIZE = TIMES_COMPRESSED_WORD_SIZE - 1 , TIMES_1 = 0 , TIMES_2 = 1 ,
  TIMES_4 = 2 , TIMES_8 = 3 , TIMES_16 = 4 , TIMES_COMPRESSED_WORD_SIZE = TIMES_WORD_SIZE ,
  TIMES_COMPRESSED_HALF_WORD_SIZE = TIMES_COMPRESSED_WORD_SIZE - 1 , TIMES_1 = 0 , TIMES_2 = 1 , TIMES_4 = 2 ,
  TIMES_8 = 3 , TIMES_16 = 4 , TIMES_COMPRESSED_WORD_SIZE = TIMES_WORD_SIZE , TIMES_COMPRESSED_HALF_WORD_SIZE = TIMES_COMPRESSED_WORD_SIZE - 1 ,
  TIMES_1 = 0 , TIMES_2 = 1 , TIMES_4 = 2 , TIMES_8 = 3 ,
  TIMES_16 = 4 , TIMES_COMPRESSED_WORD_SIZE = TIMES_WORD_SIZE , TIMES_COMPRESSED_HALF_WORD_SIZE = TIMES_COMPRESSED_WORD_SIZE - 1
}
 
enum  Register {
  R0 = 0 , R1 = 1 , R2 = 2 , R3 = 3 ,
  R4 = 4 , R5 = 5 , R6 = 6 , R7 = 7 ,
  R8 = 8 , R9 = 9 , R10 = 10 , R11 = 11 ,
  R12 = 12 , R13 = 13 , R14 = 14 , R15 = 15 ,
  kNumberOfCpuRegisters = 16 , kNoRegister = -1 , FP = R11 , NOTFP = R7 ,
  IP = R12 , SP = R13 , LR = R14 , PC = R15 ,
  R0 = 0 , R1 = 1 , R2 = 2 , R3 = 3 ,
  R4 = 4 , R5 = 5 , R6 = 6 , R7 = 7 ,
  R8 = 8 , R9 = 9 , R10 = 10 , R11 = 11 ,
  R12 = 12 , R13 = 13 , R14 = 14 , R15 = 15 ,
  R16 = 16 , R17 = 17 , R18 = 18 , R19 = 19 ,
  R20 = 20 , R21 = 21 , R22 = 22 , R23 = 23 ,
  R24 = 24 , R25 = 25 , R26 = 26 , R27 = 27 ,
  R28 = 28 , R29 = 29 , R30 = 30 , R31 = 31 ,
  kNumberOfCpuRegisters = 16 , kNoRegister = -1 , kNoRegister2 = -2 , CSP = 32 ,
  ZR = 33 , IP0 = R16 , IP1 = R17 , SP = R13 ,
  FP = R11 , LR = R14 , EAX = 0 , ECX = 1 ,
  EDX = 2 , EBX = 3 , ESP = 4 , EBP = 5 ,
  ESI = 6 , EDI = 7 , kNumberOfCpuRegisters = 16 , kNoRegister = -1 ,
  ZR = 33 , RA = 1 , SP = R13 , GP = 3 ,
  TP = 4 , T0 = 5 , T1 = 6 , T2 = 7 ,
  FP = R11 , S1 = 1 , A0 = 10 , A1 = 11 ,
  A2 = 12 , A3 = 13 , A4 = 14 , A5 = 15 ,
  A6 = 16 , A7 = 17 , S2 = 2 , S3 = 3 ,
  S4 = 4 , S5 = 5 , S6 = 6 , S7 = 7 ,
  S8 = 8 , S9 = 9 , S10 = 10 , S11 = 11 ,
  T3 = 28 , T4 = 29 , T5 = 30 , T6 = 31 ,
  kNumberOfCpuRegisters = 16 , kNoRegister = -1 , RA2 = T0 , S0 = 0 ,
  RAX = 0 , RCX = 1 , RDX = 2 , RBX = 3 ,
  RSP = 4 , RBP = 5 , RSI = 6 , RDI = 7 ,
  R8 = 8 , R9 = 9 , R10 = 10 , R11 = 11 ,
  R12 = 12 , R13 = 13 , R14 = 14 , R15 = 15 ,
  kNumberOfCpuRegisters = 16 , kNoRegister = -1
}
 
enum  VRegister {
  V0 = 0 , V1 = 1 , V2 = 2 , V3 = 3 ,
  V4 = 4 , V5 = 5 , V6 = 6 , V7 = 7 ,
  V8 = 8 , V9 = 9 , V10 = 10 , V11 = 11 ,
  V12 = 12 , V13 = 13 , V14 = 14 , V15 = 15 ,
  V16 = 16 , V17 = 17 , V18 = 18 , V19 = 19 ,
  V20 = 20 , V21 = 21 , V22 = 22 , V23 = 23 ,
  V24 = 24 , V25 = 25 , V26 = 26 , V27 = 27 ,
  V28 = 28 , V29 = 29 , V30 = 30 , V31 = 31 ,
  kNumberOfVRegisters = 32 , kNoVRegister = -1
}
 
enum  Condition {
  kNoCondition = -1 , EQ = 0 , NE = 1 , CS = 2 ,
  CC = 3 , MI = 4 , PL = 5 , VS = 6 ,
  VC = 7 , HI = 8 , LS = 9 , GE = 10 ,
  LT = 11 , GT = 12 , LE = 13 , AL = 14 ,
  kSpecialCondition = 15 , kNumberOfConditions = 16 , EQUAL = EQ , ZERO = EQUAL ,
  NOT_EQUAL = NE , NOT_ZERO = NOT_EQUAL , LESS = LT , LESS_EQUAL = LE ,
  GREATER_EQUAL = GE , GREATER = GT , UNSIGNED_LESS = CC , UNSIGNED_LESS_EQUAL = LS ,
  UNSIGNED_GREATER = HI , UNSIGNED_GREATER_EQUAL = CS , OVERFLOW = VS , NO_OVERFLOW = VC ,
  kInvalidCondition = 16 , kNoCondition = -1 , EQ = 0 , NE = 1 ,
  CS = 2 , CC = 3 , MI = 4 , PL = 5 ,
  VS = 6 , VC = 7 , HI = 8 , LS = 9 ,
  GE = 10 , LT = 11 , GT = 12 , LE = 13 ,
  AL = 14 , NV = 15 , kNumberOfConditions = 16 , EQUAL = EQ ,
  ZERO = EQUAL , NOT_EQUAL = NE , NOT_ZERO = NOT_EQUAL , LESS = LT ,
  LESS_EQUAL = LE , GREATER_EQUAL = GE , GREATER = GT , UNSIGNED_LESS = CC ,
  UNSIGNED_LESS_EQUAL = LS , UNSIGNED_GREATER = HI , UNSIGNED_GREATER_EQUAL = CS , OVERFLOW = VS ,
  NO_OVERFLOW = VC , kInvalidCondition = 16 , kNoCondition = -1 , EQ = 0 ,
  NE = 1 , CS = 2 , CC = 3 , MI = 4 ,
  PL = 5 , VS = 6 , VC = 7 , HI = 8 ,
  LS = 9 , GE = 10 , LT = 11 , GT = 12 ,
  LE = 13 , AL = 14 , NV = 15 , kNumberOfConditions = 16 ,
  EQUAL = EQ , ZERO = EQUAL , NOT_EQUAL = NE , NOT_ZERO = NOT_EQUAL ,
  LESS = LT , LESS_EQUAL = LE , GREATER_EQUAL = GE , GREATER = GT ,
  UNSIGNED_LESS = CC , UNSIGNED_LESS_EQUAL = LS , UNSIGNED_GREATER = HI , UNSIGNED_GREATER_EQUAL = CS ,
  OVERFLOW = VS , NO_OVERFLOW = VC , kInvalidCondition = 16 , OVERFLOW = VS ,
  NO_OVERFLOW = VC , BELOW = 2 , ABOVE_EQUAL = 3 , EQUAL = EQ ,
  NOT_EQUAL = NE , BELOW_EQUAL = 6 , ABOVE = 7 , SIGN = 8 ,
  NOT_SIGN = 9 , PARITY_EVEN = 10 , PARITY_ODD = 11 , LESS = LT ,
  GREATER_EQUAL = GE , LESS_EQUAL = LE , GREATER = GT , ZERO = EQUAL ,
  NOT_ZERO = NOT_EQUAL , NEGATIVE = SIGN , POSITIVE = NOT_SIGN , CARRY = BELOW ,
  NOT_CARRY = ABOVE_EQUAL , UNSIGNED_LESS = CC , UNSIGNED_LESS_EQUAL = LS , UNSIGNED_GREATER = HI ,
  UNSIGNED_GREATER_EQUAL = CS , kInvalidCondition = 16
}
 
enum  Bits {
  B0 = (1 << 0) , 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) ,
  B28 = (1 << 28) , B29 = (1 << 29) , B30 = (1 << 30) , B31 = (1 << 31)
}
 
enum  MainOp {
  DPImmediateMask = 0x1c000000 , DPImmediateFixed = B28 , CompareBranchMask = 0x1c000000 , CompareBranchFixed = B28 | B26 ,
  LoadStoreMask = B27 | B25 , LoadStoreFixed = B27 , DPRegisterMask = 0x0e000000 , DPRegisterFixed = B27 | B25 ,
  DPSimd1Mask = 0x1e000000 , DPSimd1Fixed = B27 | B26 | B25 , DPSimd2Mask = 0x1e000000 , DPSimd2Fixed = B28 | DPSimd1Fixed ,
  FPMask = 0x5e000000 , FPFixed = B28 | B27 | B26 | B25
}
 
enum  CompareAndBranchOp { CompareAndBranchMask = 0x7e000000 , CompareAndBranchFixed = CompareBranchFixed | B29 , CBZ = CompareAndBranchFixed , CBNZ = CompareAndBranchFixed | B24 }
 
enum  ConditionalBranchOp { ConditionalBranchMask = 0xfe000000 , ConditionalBranchFixed = CompareBranchFixed | B30 , BCOND = ConditionalBranchFixed }
 
enum  ExceptionGenOp {
  ExceptionGenMask = 0xff000000 , ExceptionGenFixed = CompareBranchFixed | B31 | B30 , SVC = ExceptionGenFixed | B0 , BRK = ExceptionGenFixed | B21 ,
  HLT = ExceptionGenFixed | B22
}
 
enum  SystemOp { SystemMask = 0xffc00000 , SystemFixed = CompareBranchFixed | B31 | B30 | B24 , HINT = SystemFixed | B17 | B16 | B13 | B4 | B3 | B2 | B1 | B0 , CLREX }
 
enum  TestAndBranchOp { TestAndBranchMask = 0x7e000000 , TestAndBranchFixed = CompareBranchFixed | B29 | B25 , TBZ = TestAndBranchFixed , TBNZ = TestAndBranchFixed | B24 }
 
enum  UnconditionalBranchOp { UnconditionalBranchMask = 0x7c000000 , UnconditionalBranchFixed = CompareBranchFixed , B = UnconditionalBranchFixed , BL = UnconditionalBranchFixed | B31 }
 
enum  UnconditionalBranchRegOp {
  UnconditionalBranchRegMask = 0xfe000000 , UnconditionalBranchRegFixed = CompareBranchFixed | B31 | B30 | B25 , BR = UnconditionalBranchRegFixed | B20 | B19 | B18 | B17 | B16 , BLR = BR | B21 ,
  RET = BR | B22
}
 
enum  LoadRegLiteralOp { LoadRegLiteralMask = 0x3b000000 , LoadRegLiteralFixed = LoadStoreFixed | B28 , LDRpc = LoadRegLiteralFixed }
 
enum  LoadStoreExclusiveOp {
  LoadStoreExclusiveMask = 0x3f000000 , LoadStoreExclusiveFixed = B27 , LDXR = LoadStoreExclusiveFixed | B22 , STXR = LoadStoreExclusiveFixed ,
  LDAR = LoadStoreExclusiveFixed | B23 | B22 | B15 , STLR = LoadStoreExclusiveFixed | B23 | B15
}
 
enum  AtomicMemoryOp { AtomicMemoryMask = 0x3f200c00 , AtomicMemoryFixed = B29 | B28 | B27 | B21 , LDCLR = AtomicMemoryFixed | B12 , LDSET = AtomicMemoryFixed | B13 | B12 }
 
enum  LoadStoreRegOp {
  LoadStoreRegMask = 0x3a000000 , LoadStoreRegFixed = LoadStoreFixed | B29 | B28 , STR = LoadStoreRegFixed , LDR = LoadStoreRegFixed | B22 ,
  LDRS = LoadStoreRegFixed | B23 , FSTR = STR | B26 , FLDR = LDR | B26 , FSTRQ = STR | B26 | B23 ,
  FLDRQ = LDR | B26 | B23
}
 
enum  LoadStoreRegPairOp {
  LoadStoreRegPairMask = 0x3a000000 , LoadStoreRegPairFixed = LoadStoreFixed | B29 , STP = LoadStoreRegPairFixed , LDP = LoadStoreRegPairFixed | B22 ,
  FSTP = STP | B26 , FLDP = LDP | B26
}
 
enum  AddSubImmOp { AddSubImmMask = 0x1f000000 , AddSubImmFixed = DPImmediateFixed | B24 , ADDI = AddSubImmFixed , SUBI = AddSubImmFixed | B30 }
 
enum  BitfieldOp {
  BitfieldMask = 0x1f800000 , BitfieldFixed = 0x13000000 , SBFM = BitfieldFixed , BFM = BitfieldFixed | B29 ,
  UBFM = BitfieldFixed | B30 , Bitfield64 = B31 | B22
}
 
enum  LogicalImmOp {
  LogicalImmMask = 0x1f800000 , LogicalImmFixed = DPImmediateFixed | B25 , ANDI = LogicalImmFixed , ORRI = LogicalImmFixed | B29 ,
  EORI = LogicalImmFixed | B30 , ANDIS = LogicalImmFixed | B30 | B29
}
 
enum  MoveWideOp {
  MoveWideMask = 0x1f800000 , MoveWideFixed = DPImmediateFixed | B25 | B23 , MOVN = MoveWideFixed , MOVZ = MoveWideFixed | B30 ,
  MOVK = MoveWideFixed | B30 | B29
}
 
enum  PCRelOp { PCRelMask = 0x1f000000 , PCRelFixed = DPImmediateFixed , ADR = PCRelFixed , ADRP = PCRelFixed | B31 }
 
enum  AddSubShiftExtOp { AddSubShiftExtMask = 0x1f000000 , AddSubShiftExtFixed = DPRegisterFixed | B24 , ADD = 4 , SUB = 2 }
 
enum  AddSubWithCarryOp { AddSubWithCarryMask = 0x1fe00000 , AddSubWithCarryFixed = DPRegisterFixed | B28 , ADC = 5 , SBC = 6 }
 
enum  ConditionalSelectOp {
  ConditionalSelectMask = 0x1fe00000 , ConditionalSelectFixed = DPRegisterFixed | B28 | B23 , CSEL = ConditionalSelectFixed , CSINC = ConditionalSelectFixed | B10 ,
  CSINV = ConditionalSelectFixed | B30 , CSNEG = ConditionalSelectFixed | B10 | B30
}
 
enum  MiscDP1SourceOp { MiscDP1SourceMask = 0x5fe00000 , MiscDP1SourceFixed = DPRegisterFixed | B30 | B28 | B23 | B22 , CLZ = MiscDP1SourceFixed | B12 , RBIT = MiscDP1SourceFixed }
 
enum  MiscDP2SourceOp {
  MiscDP2SourceMask = 0x5fe00000 , MiscDP2SourceFixed = DPRegisterFixed | B28 | B23 | B22 , UDIV = MiscDP2SourceFixed | B11 , SDIV = MiscDP2SourceFixed | B11 | B10 ,
  LSLV = MiscDP2SourceFixed | B13 , LSRV = MiscDP2SourceFixed | B13 | B10 , ASRV = MiscDP2SourceFixed | B13 | B11
}
 
enum  MiscDP3SourceOp {
  MiscDP3SourceMask = 0x1f000000 , MiscDP3SourceFixed = DPRegisterFixed | B28 | B24 , MADDW = MiscDP3SourceFixed , MADD = MiscDP3SourceFixed | B31 ,
  MSUBW = MiscDP3SourceFixed | B15 , MSUB = MiscDP3SourceFixed | B31 | B15 , SMULH = MiscDP3SourceFixed | B31 | B22 , UMULH = MiscDP3SourceFixed | B31 | B23 | B22 ,
  SMADDL = MiscDP3SourceFixed | B31 | B21 , UMADDL = MiscDP3SourceFixed | B31 | B23 | B21 , SMSUBL = MiscDP3SourceFixed | B31 | B21 | B15 , UMSUBL = MiscDP3SourceFixed | B31 | B23 | B21 | B15
}
 
enum  LogicalShiftOp {
  LogicalShiftMask = 0x1f000000 , LogicalShiftFixed = DPRegisterFixed , AND = 0 , BIC = 14 ,
  ORR = 12 , ORN = LogicalShiftFixed | B29 | B21 , EOR = 1 , EON = LogicalShiftFixed | B30 | B21 ,
  ANDS = LogicalShiftFixed | B30 | B29 , BICS = LogicalShiftFixed | B30 | B29 | B21
}
 
enum  SIMDCopyOp {
  SIMDCopyMask = 0x9fe08400 , SIMDCopyFixed = DPSimd1Fixed | B10 , VDUPI = SIMDCopyFixed | B30 | B11 , VINSI = SIMDCopyFixed | B30 | B12 | B11 ,
  VMOVW = SIMDCopyFixed | B13 | B12 | B11 , VMOVX = SIMDCopyFixed | B30 | B13 | B12 | B11 , VDUP = SIMDCopyFixed | B30 , VINS = SIMDCopyFixed | B30 | B29
}
 
enum  SIMDThreeSameOp {
  SIMDThreeSameMask = 0x9f200400 , SIMDThreeSameFixed = DPSimd1Fixed | B21 | B10 , VAND = SIMDThreeSameFixed | B30 | B12 | B11 , VORR = SIMDThreeSameFixed | B30 | B23 | B12 | B11 ,
  VEOR = SIMDThreeSameFixed | B30 | B29 | B12 | B11 , VADDW = SIMDThreeSameFixed | B30 | B23 | B15 , VADDX = SIMDThreeSameFixed | B30 | B23 | B22 | B15 , VSUBW = SIMDThreeSameFixed | B30 | B29 | B23 | B15 ,
  VSUBX = SIMDThreeSameFixed | B30 | B29 | B23 | B22 | B15 , VADDS = SIMDThreeSameFixed | B30 | B15 | B14 | B12 , VADDD = SIMDThreeSameFixed | B30 | B22 | B15 | B14 | B12 , VSUBS = SIMDThreeSameFixed | B30 | B23 | B15 | B14 | B12 ,
  VSUBD = SIMDThreeSameFixed | B30 | B23 | B22 | B15 | B14 | B12 , VMULS = SIMDThreeSameFixed | B30 | B29 | B15 | B14 | B12 | B11 , VMULD = SIMDThreeSameFixed | B30 | B29 | B22 | B15 | B14 | B12 | B11 , VDIVS = SIMDThreeSameFixed | B30 | B29 | B15 | B14 | B13 | B12 | B11 ,
  VDIVD = SIMDThreeSameFixed | B30 | B29 | B22 | B15 | B14 | B13 | B12 | B11 , VCEQS = SIMDThreeSameFixed | B30 | B15 | B14 | B13 , VCEQD = SIMDThreeSameFixed | B30 | B22 | B15 | B14 | B13 , VCGES = SIMDThreeSameFixed | B30 | B29 | B15 | B14 | B13 ,
  VCGED = SIMDThreeSameFixed | B30 | B29 | B22 | B15 | B14 | B13 , VCGTS = SIMDThreeSameFixed | B30 | B29 | B23 | B15 | B14 | B13 , VCGTD = SIMDThreeSameFixed | B30 | B29 | B23 | B22 | B15 | B14 | B13 , VMAXS = SIMDThreeSameFixed | B30 | B15 | B14 | B13 | B12 ,
  VMAXD = SIMDThreeSameFixed | B30 | B22 | B15 | B14 | B13 | B12 , VMINS = SIMDThreeSameFixed | B30 | B23 | B15 | B14 | B13 | B12 , VMIND = SIMDThreeSameFixed | B30 | B23 | B22 | B15 | B14 | B13 | B12 , VRECPSS = SIMDThreeSameFixed | B30 | B15 | B14 | B13 | B12 | B11 ,
  VRSQRTSS = SIMDThreeSameFixed | B30 | B23 | B15 | B14 | B13 | B12 | B11
}
 
enum  SIMDTwoRegOp {
  SIMDTwoRegMask = 0x9f3e0c00 , SIMDTwoRegFixed = DPSimd1Fixed | B21 | B11 , VNOT = SIMDTwoRegFixed | B30 | B29 | B14 | B12 , VABSS = SIMDTwoRegFixed | B30 | B23 | B15 | B14 | B13 | B12 ,
  VNEGS = SIMDTwoRegFixed | B30 | B29 | B23 | B15 | B14 | B13 | B12 , VABSD = SIMDTwoRegFixed | B30 | B23 | B22 | B15 | B14 | B13 | B12 , VNEGD = SIMDTwoRegFixed | B30 | B29 | B23 | B22 | B15 | B14 | B13 | B12 , VSQRTS = SIMDTwoRegFixed | B30 | B29 | B23 | B16 | B15 | B14 | B13 | B12 ,
  VSQRTD , VRECPES = SIMDTwoRegFixed | B30 | B23 | B16 | B15 | B14 | B12 , VRSQRTES = SIMDTwoRegFixed | B30 | B29 | B23 | B16 | B15 | B14 | B12
}
 
enum  FPCompareOp { FPCompareMask = 0xffa0fc07 , FPCompareFixed = FPFixed | B21 | B13 , FCMPD = FPCompareFixed | B22 , FCMPZD = FPCompareFixed | B22 | B3 }
 
enum  FPOneSourceOp {
  FPOneSourceMask = 0x5f207c00 , FPOneSourceFixed = FPFixed | B21 | B14 , FMOVDD = FPOneSourceFixed | B22 , FABSD = FPOneSourceFixed | B22 | B15 ,
  FNEGD = FPOneSourceFixed | B22 | B16 , FSQRTD = FPOneSourceFixed | B22 | B16 | B15 , FCVTDS = FPOneSourceFixed | B15 | B17 , FCVTSD = FPOneSourceFixed | B22 | B17
}
 
enum  FPTwoSourceOp {
  FPTwoSourceMask = 0xff200c00 , FPTwoSourceFixed = FPFixed | B21 | B11 , FMULD = FPTwoSourceFixed | B22 , FDIVD = FPTwoSourceFixed | B22 | B12 ,
  FADDD = FPTwoSourceFixed | B22 | B13 , FSUBD = FPTwoSourceFixed | B22 | B13 | B12
}
 
enum  FPImmOp { FPImmMask = 0x5f201c00 , FPImmFixed = FPFixed | B21 | B12 , FMOVSI = FPImmFixed , FMOVDI = FPImmFixed | B22 }
 
enum  FPIntCvtOp {
  FPIntCvtMask = 0x5f00fc00 , FPIntCvtFixed = FPFixed | B21 , FMOVRS = FPIntCvtFixed | B18 | B17 , FMOVSR = FPIntCvtFixed | B18 | B17 | B16 ,
  FMOVRD = FPIntCvtFixed | B22 | B18 | B17 , FMOVDR = FPIntCvtFixed | B22 | B18 | B17 | B16 , FCVTZS_D = FPIntCvtFixed | B22 | B20 | B19 , FCVTMS_D = FPIntCvtFixed | B22 | B20 ,
  FCVTPS_D = FPIntCvtFixed | B22 | B19 , SCVTFD = FPIntCvtFixed | B22 | B17
}
 
enum  Shift {
  kNoShift = -1 , LSL = 0 , LSR = 1 , ASR = 2 ,
  ROR = 3 , kMaxShift = 4 , kNoShift = -1 , LSL = 0 ,
  LSR = 1 , ASR = 2 , ROR = 3 , kMaxShift = 4
}
 
enum  Extend {
  kNoExtend = -1 , UXTB = 0 , UXTH = 1 , UXTW = 2 ,
  UXTX = 3 , SXTB = 4 , SXTH = 5 , SXTW = 6 ,
  SXTX = 7 , kMaxExtend = 8
}
 
enum  R31Type { R31IsSP , R31IsZR }
 
enum  InstructionFields {
  kConditionShift = 28 , kConditionBits = 4 , kTypeShift = 25 , kTypeBits = 3 ,
  kLinkShift = 24 , kLinkBits = 1 , kUShift = 23 , kUBits = 1 ,
  kOpcodeShift = 21 , kOpcodeBits = 4 , kSShift = 20 , kSBits = 1 ,
  kRnShift = 16 , kRnBits = 4 , kRdShift = 12 , kRdBits = 4 ,
  kRsShift = 8 , kRsBits = 4 , kRmShift = 0 , kRmBits = 4 ,
  kRotateShift = 8 , kRotateBits = 4 , kImmed8Shift = 0 , kImmed8Bits = 8 ,
  kShiftImmShift = 7 , kShiftRegisterShift = 8 , kShiftImmBits = 5 , kShiftShift = 5 ,
  kShiftBits = 2 , kOffset12Shift = 0 , kOffset12Bits = 12 , kOffset12Mask = 0x00000fff ,
  kMulRdShift = 16 , kMulRdBits = 4 , kMulRnShift = 12 , kMulRnBits = 4 ,
  kLdrExRnShift = 16 , kLdrExRtShift = 12 , kStrExRnShift = 16 , kStrExRdShift = 12 ,
  kStrExRtShift = 0 , kMediaOp1Shift = 20 , kMediaOp1Bits = 5 , kMediaOp2Shift = 5 ,
  kMediaOp2Bits = 3 , kDivRdShift = 16 , kDivRdBits = 4 , kDivRmShift = 8 ,
  kDivRmBits = 4 , kDivRnShift = 0 , kDivRnBits = 4 , kBitFieldExtractWidthShift = 16 ,
  kBitFieldExtractWidthBits = 5 , kBitFieldExtractLSBShift = 7 , kBitFieldExtractLSBBits = 5 , kBitFieldExtractRnShift = 0 ,
  kBitFieldExtractRnBits = 4 , kCRmShift = 0 , kCRmBits = 4 , kOpc2Shift = 5 ,
  kOpc2Bits = 3 , kCoprocShift = 8 , kCoprocBits = 4 , kCRnShift = 16 ,
  kCRnBits = 4 , kOpc1Shift = 21 , kOpc1Bits = 3 , kBranchOffsetMask = 0x00ffffff ,
  kSShift = 20 , kSBits = 1 , kSFShift = 31 , kSFBits = 1 ,
  kSzShift = 30 , kSzBits = 2 , kRdShift = 12 , kRdBits = 4 ,
  kRnShift = 16 , kRnBits = 4 , kRaShift = 10 , kRaBits = 5 ,
  kRmShift = 0 , kRmBits = 4 , kRtShift = 0 , kRtBits = 5 ,
  kRt2Shift = 10 , kRt2Bits = 5 , kRsShift = 8 , kRsBits = 4 ,
  kVdShift = 0 , kVdBits = 5 , kVnShift = 5 , kVnBits = 5 ,
  kVmShift = 16 , kVmBits = 5 , kVtShift = 0 , kVtBits = 5 ,
  kVt2Shift = 10 , kVt2Bits = 5 , kImm3Shift = 10 , kImm3Bits = 3 ,
  kImm4Shift = 11 , kImm4Bits = 4 , kImm5Shift = 16 , kImm5Bits = 5 ,
  kImm6Shift = 10 , kImm6Bits = 6 , kImm7Shift = 15 , kImm7Bits = 7 ,
  kImm7Mask = 0x7f << kImm7Shift , kImm8Shift = 13 , kImm8Bits = 8 , kImm9Shift = 12 ,
  kImm9Bits = 9 , kImm12Shift = 10 , kImm12Bits = 12 , kImm12Mask = 0xfff << kImm12Shift ,
  kImm12ShiftShift = 22 , kImm12ShiftBits = 2 , kImm14Shift = 5 , kImm14Bits = 14 ,
  kImm14Mask = 0x3fff << kImm14Shift , kImm16Shift = 5 , kImm16Bits = 16 , kImm16Mask = 0xffff << kImm16Shift ,
  kImm19Shift = 5 , kImm19Bits = 19 , kImm19Mask = 0x7ffff << kImm19Shift , kImm26Shift = 0 ,
  kImm26Bits = 26 , kImm26Mask = 0x03ffffff << kImm26Shift , kCondShift = 0 , kCondBits = 4 ,
  kCondMask = 0xf << kCondShift , kSelCondShift = 12 , kSelCondBits = 4 , kNShift = 22 ,
  kNBits = 1 , kImmRShift = 16 , kImmRBits = 6 , kImmSShift = 10 ,
  kImmSBits = 6 , kHWShift = 21 , kHWBits = 2 , kAddShiftExtendShift = 21 ,
  kAddShiftExtendBits = 1 , kShiftTypeShift = 22 , kShiftTypeBits = 2 , kExtendTypeShift = 13 ,
  kExtendTypeBits = 3 , kHintCRmShift = 8 , kHintCRmBits = 4 , kHintOp2Shift = 5 ,
  kHintOp2Bits = 3
}
 
enum  ScaleFactor {
  TIMES_1 = 0 , TIMES_2 = 1 , TIMES_4 = 2 , TIMES_8 = 3 ,
  TIMES_16 = 4 , TIMES_COMPRESSED_WORD_SIZE = TIMES_WORD_SIZE , TIMES_COMPRESSED_HALF_WORD_SIZE = TIMES_COMPRESSED_WORD_SIZE - 1 , TIMES_1 = 0 ,
  TIMES_2 = 1 , TIMES_4 = 2 , TIMES_8 = 3 , TIMES_16 = 4 ,
  TIMES_COMPRESSED_WORD_SIZE = TIMES_WORD_SIZE , TIMES_COMPRESSED_HALF_WORD_SIZE = TIMES_COMPRESSED_WORD_SIZE - 1 , TIMES_1 = 0 , TIMES_2 = 1 ,
  TIMES_4 = 2 , TIMES_8 = 3 , TIMES_16 = 4 , TIMES_COMPRESSED_WORD_SIZE = TIMES_WORD_SIZE ,
  TIMES_COMPRESSED_HALF_WORD_SIZE = TIMES_COMPRESSED_WORD_SIZE - 1 , TIMES_1 = 0 , TIMES_2 = 1 , TIMES_4 = 2 ,
  TIMES_8 = 3 , TIMES_16 = 4 , TIMES_COMPRESSED_WORD_SIZE = TIMES_WORD_SIZE , TIMES_COMPRESSED_HALF_WORD_SIZE = TIMES_COMPRESSED_WORD_SIZE - 1 ,
  TIMES_1 = 0 , TIMES_2 = 1 , TIMES_4 = 2 , TIMES_8 = 3 ,
  TIMES_16 = 4 , TIMES_COMPRESSED_WORD_SIZE = TIMES_WORD_SIZE , TIMES_COMPRESSED_HALF_WORD_SIZE = TIMES_COMPRESSED_WORD_SIZE - 1
}
 
enum  AlignmentStrategy { kAlignedToValueSize , kAlignedToValueSizeBut8AlignedTo4 , kAlignedToWordSize , kAlignedToWordSizeAndValueSize }
 
enum  ExtensionStrategy { kNotExtended , kExtendedTo4 , kExtendedTo8 }
 
enum  Register {
  R0 = 0 , R1 = 1 , R2 = 2 , R3 = 3 ,
  R4 = 4 , R5 = 5 , R6 = 6 , R7 = 7 ,
  R8 = 8 , R9 = 9 , R10 = 10 , R11 = 11 ,
  R12 = 12 , R13 = 13 , R14 = 14 , R15 = 15 ,
  kNumberOfCpuRegisters = 16 , kNoRegister = -1 , FP = R11 , NOTFP = R7 ,
  IP = R12 , SP = R13 , LR = R14 , PC = R15 ,
  R0 = 0 , R1 = 1 , R2 = 2 , R3 = 3 ,
  R4 = 4 , R5 = 5 , R6 = 6 , R7 = 7 ,
  R8 = 8 , R9 = 9 , R10 = 10 , R11 = 11 ,
  R12 = 12 , R13 = 13 , R14 = 14 , R15 = 15 ,
  R16 = 16 , R17 = 17 , R18 = 18 , R19 = 19 ,
  R20 = 20 , R21 = 21 , R22 = 22 , R23 = 23 ,
  R24 = 24 , R25 = 25 , R26 = 26 , R27 = 27 ,
  R28 = 28 , R29 = 29 , R30 = 30 , R31 = 31 ,
  kNumberOfCpuRegisters = 16 , kNoRegister = -1 , kNoRegister2 = -2 , CSP = 32 ,
  ZR = 33 , IP0 = R16 , IP1 = R17 , SP = R13 ,
  FP = R11 , LR = R14 , EAX = 0 , ECX = 1 ,
  EDX = 2 , EBX = 3 , ESP = 4 , EBP = 5 ,
  ESI = 6 , EDI = 7 , kNumberOfCpuRegisters = 16 , kNoRegister = -1 ,
  ZR = 33 , RA = 1 , SP = R13 , GP = 3 ,
  TP = 4 , T0 = 5 , T1 = 6 , T2 = 7 ,
  FP = R11 , S1 = 1 , A0 = 10 , A1 = 11 ,
  A2 = 12 , A3 = 13 , A4 = 14 , A5 = 15 ,
  A6 = 16 , A7 = 17 , S2 = 2 , S3 = 3 ,
  S4 = 4 , S5 = 5 , S6 = 6 , S7 = 7 ,
  S8 = 8 , S9 = 9 , S10 = 10 , S11 = 11 ,
  T3 = 28 , T4 = 29 , T5 = 30 , T6 = 31 ,
  kNumberOfCpuRegisters = 16 , kNoRegister = -1 , RA2 = T0 , S0 = 0 ,
  RAX = 0 , RCX = 1 , RDX = 2 , RBX = 3 ,
  RSP = 4 , RBP = 5 , RSI = 6 , RDI = 7 ,
  R8 = 8 , R9 = 9 , R10 = 10 , R11 = 11 ,
  R12 = 12 , R13 = 13 , R14 = 14 , R15 = 15 ,
  kNumberOfCpuRegisters = 16 , kNoRegister = -1
}
 
enum  ByteRegister {
  AL = 14 , CL = 1 , DL = 2 , BL = UnconditionalBranchFixed | B31 ,
  AH = 4 , CH = 5 , DH = 6 , BH = 7 ,
  kNumberOfByteRegisters = 8 , kNoByteRegister = -1 , AL = 14 , CL = 1 ,
  DL = 2 , BL = UnconditionalBranchFixed | B31 , AH = 4 , CH = 5 ,
  DH = 6 , BH = 7 , SPL = 4 | 0x10 , BPL = 5 | 0x10 ,
  SIL = 6 | 0x10 , DIL = 7 | 0x10 , R8B = 8 , R9B = 9 ,
  R10B = 10 , R11B = 11 , R12B = 12 , R13B = 13 ,
  R14B = 14 , R15B = 15 , kNumberOfByteRegisters = 8 , kNoByteRegister = -1
}
 
enum  XmmRegister {
  XMM0 = 0 , XMM1 = 1 , XMM2 = 2 , XMM3 = 3 ,
  XMM4 = 4 , XMM5 = 5 , XMM6 = 6 , XMM7 = 7 ,
  kNumberOfXmmRegisters = 8 , kNoXmmRegister = -1 , XMM0 = 0 , XMM1 = 1 ,
  XMM2 = 2 , XMM3 = 3 , XMM4 = 4 , XMM5 = 5 ,
  XMM6 = 6 , XMM7 = 7 , XMM8 = 8 , XMM9 = 9 ,
  XMM10 = 10 , XMM11 = 11 , XMM12 = 12 , XMM13 = 13 ,
  XMM14 = 14 , XMM15 = 15 , kNumberOfXmmRegisters = 8 , kNoXmmRegister = -1
}
 
enum  ScaleFactor {
  TIMES_1 = 0 , TIMES_2 = 1 , TIMES_4 = 2 , TIMES_8 = 3 ,
  TIMES_16 = 4 , TIMES_COMPRESSED_WORD_SIZE = TIMES_WORD_SIZE , TIMES_COMPRESSED_HALF_WORD_SIZE = TIMES_COMPRESSED_WORD_SIZE - 1 , TIMES_1 = 0 ,
  TIMES_2 = 1 , TIMES_4 = 2 , TIMES_8 = 3 , TIMES_16 = 4 ,
  TIMES_COMPRESSED_WORD_SIZE = TIMES_WORD_SIZE , TIMES_COMPRESSED_HALF_WORD_SIZE = TIMES_COMPRESSED_WORD_SIZE - 1 , TIMES_1 = 0 , TIMES_2 = 1 ,
  TIMES_4 = 2 , TIMES_8 = 3 , TIMES_16 = 4 , TIMES_COMPRESSED_WORD_SIZE = TIMES_WORD_SIZE ,
  TIMES_COMPRESSED_HALF_WORD_SIZE = TIMES_COMPRESSED_WORD_SIZE - 1 , TIMES_1 = 0 , TIMES_2 = 1 , TIMES_4 = 2 ,
  TIMES_8 = 3 , TIMES_16 = 4 , TIMES_COMPRESSED_WORD_SIZE = TIMES_WORD_SIZE , TIMES_COMPRESSED_HALF_WORD_SIZE = TIMES_COMPRESSED_WORD_SIZE - 1 ,
  TIMES_1 = 0 , TIMES_2 = 1 , TIMES_4 = 2 , TIMES_8 = 3 ,
  TIMES_16 = 4 , TIMES_COMPRESSED_WORD_SIZE = TIMES_WORD_SIZE , TIMES_COMPRESSED_HALF_WORD_SIZE = TIMES_COMPRESSED_WORD_SIZE - 1
}
 
enum  Register {
  R0 = 0 , R1 = 1 , R2 = 2 , R3 = 3 ,
  R4 = 4 , R5 = 5 , R6 = 6 , R7 = 7 ,
  R8 = 8 , R9 = 9 , R10 = 10 , R11 = 11 ,
  R12 = 12 , R13 = 13 , R14 = 14 , R15 = 15 ,
  kNumberOfCpuRegisters = 16 , kNoRegister = -1 , FP = R11 , NOTFP = R7 ,
  IP = R12 , SP = R13 , LR = R14 , PC = R15 ,
  R0 = 0 , R1 = 1 , R2 = 2 , R3 = 3 ,
  R4 = 4 , R5 = 5 , R6 = 6 , R7 = 7 ,
  R8 = 8 , R9 = 9 , R10 = 10 , R11 = 11 ,
  R12 = 12 , R13 = 13 , R14 = 14 , R15 = 15 ,
  R16 = 16 , R17 = 17 , R18 = 18 , R19 = 19 ,
  R20 = 20 , R21 = 21 , R22 = 22 , R23 = 23 ,
  R24 = 24 , R25 = 25 , R26 = 26 , R27 = 27 ,
  R28 = 28 , R29 = 29 , R30 = 30 , R31 = 31 ,
  kNumberOfCpuRegisters = 16 , kNoRegister = -1 , kNoRegister2 = -2 , CSP = 32 ,
  ZR = 33 , IP0 = R16 , IP1 = R17 , SP = R13 ,
  FP = R11 , LR = R14 , EAX = 0 , ECX = 1 ,
  EDX = 2 , EBX = 3 , ESP = 4 , EBP = 5 ,
  ESI = 6 , EDI = 7 , kNumberOfCpuRegisters = 16 , kNoRegister = -1 ,
  ZR = 33 , RA = 1 , SP = R13 , GP = 3 ,
  TP = 4 , T0 = 5 , T1 = 6 , T2 = 7 ,
  FP = R11 , S1 = 1 , A0 = 10 , A1 = 11 ,
  A2 = 12 , A3 = 13 , A4 = 14 , A5 = 15 ,
  A6 = 16 , A7 = 17 , S2 = 2 , S3 = 3 ,
  S4 = 4 , S5 = 5 , S6 = 6 , S7 = 7 ,
  S8 = 8 , S9 = 9 , S10 = 10 , S11 = 11 ,
  T3 = 28 , T4 = 29 , T5 = 30 , T6 = 31 ,
  kNumberOfCpuRegisters = 16 , kNoRegister = -1 , RA2 = T0 , S0 = 0 ,
  RAX = 0 , RCX = 1 , RDX = 2 , RBX = 3 ,
  RSP = 4 , RBP = 5 , RSI = 6 , RDI = 7 ,
  R8 = 8 , R9 = 9 , R10 = 10 , R11 = 11 ,
  R12 = 12 , R13 = 13 , R14 = 14 , R15 = 15 ,
  kNumberOfCpuRegisters = 16 , kNoRegister = -1
}
 
enum  FRegister {
  FT0 = 0 , FT1 = 1 , FT2 = 2 , FT3 = 3 ,
  FT4 = 4 , FT5 = 5 , FT6 = 6 , FT7 = 7 ,
  FS0 = 8 , FS1 = 9 , FA0 = 10 , FA1 = 11 ,
  FA2 = 12 , FA3 = 13 , FA4 = 14 , FA5 = 15 ,
  FA6 = 16 , FA7 = 17 , FS2 = 18 , FS3 = 19 ,
  FS4 = 20 , FS5 = 21 , FS6 = 22 , FS7 = 23 ,
  FS8 = 24 , FS9 = 25 , FS10 = 26 , FS11 = 27 ,
  FT8 = 28 , FT9 = 29 , FT10 = 30 , FT11 = 31
}
 
enum  Condition {
  kNoCondition = -1 , EQ = 0 , NE = 1 , CS = 2 ,
  CC = 3 , MI = 4 , PL = 5 , VS = 6 ,
  VC = 7 , HI = 8 , LS = 9 , GE = 10 ,
  LT = 11 , GT = 12 , LE = 13 , AL = 14 ,
  kSpecialCondition = 15 , kNumberOfConditions = 16 , EQUAL = EQ , ZERO = EQUAL ,
  NOT_EQUAL = NE , NOT_ZERO = NOT_EQUAL , LESS = LT , LESS_EQUAL = LE ,
  GREATER_EQUAL = GE , GREATER = GT , UNSIGNED_LESS = CC , UNSIGNED_LESS_EQUAL = LS ,
  UNSIGNED_GREATER = HI , UNSIGNED_GREATER_EQUAL = CS , OVERFLOW = VS , NO_OVERFLOW = VC ,
  kInvalidCondition = 16 , kNoCondition = -1 , EQ = 0 , NE = 1 ,
  CS = 2 , CC = 3 , MI = 4 , PL = 5 ,
  VS = 6 , VC = 7 , HI = 8 , LS = 9 ,
  GE = 10 , LT = 11 , GT = 12 , LE = 13 ,
  AL = 14 , NV = 15 , kNumberOfConditions = 16 , EQUAL = EQ ,
  ZERO = EQUAL , NOT_EQUAL = NE , NOT_ZERO = NOT_EQUAL , LESS = LT ,
  LESS_EQUAL = LE , GREATER_EQUAL = GE , GREATER = GT , UNSIGNED_LESS = CC ,
  UNSIGNED_LESS_EQUAL = LS , UNSIGNED_GREATER = HI , UNSIGNED_GREATER_EQUAL = CS , OVERFLOW = VS ,
  NO_OVERFLOW = VC , kInvalidCondition = 16 , kNoCondition = -1 , EQ = 0 ,
  NE = 1 , CS = 2 , CC = 3 , MI = 4 ,
  PL = 5 , VS = 6 , VC = 7 , HI = 8 ,
  LS = 9 , GE = 10 , LT = 11 , GT = 12 ,
  LE = 13 , AL = 14 , NV = 15 , kNumberOfConditions = 16 ,
  EQUAL = EQ , ZERO = EQUAL , NOT_EQUAL = NE , NOT_ZERO = NOT_EQUAL ,
  LESS = LT , LESS_EQUAL = LE , GREATER_EQUAL = GE , GREATER = GT ,
  UNSIGNED_LESS = CC , UNSIGNED_LESS_EQUAL = LS , UNSIGNED_GREATER = HI , UNSIGNED_GREATER_EQUAL = CS ,
  OVERFLOW = VS , NO_OVERFLOW = VC , kInvalidCondition = 16 , OVERFLOW = VS ,
  NO_OVERFLOW = VC , BELOW = 2 , ABOVE_EQUAL = 3 , EQUAL = EQ ,
  NOT_EQUAL = NE , BELOW_EQUAL = 6 , ABOVE = 7 , SIGN = 8 ,
  NOT_SIGN = 9 , PARITY_EVEN = 10 , PARITY_ODD = 11 , LESS = LT ,
  GREATER_EQUAL = GE , LESS_EQUAL = LE , GREATER = GT , ZERO = EQUAL ,
  NOT_ZERO = NOT_EQUAL , NEGATIVE = SIGN , POSITIVE = NOT_SIGN , CARRY = BELOW ,
  NOT_CARRY = ABOVE_EQUAL , UNSIGNED_LESS = CC , UNSIGNED_LESS_EQUAL = LS , UNSIGNED_GREATER = HI ,
  UNSIGNED_GREATER_EQUAL = CS , kInvalidCondition = 16
}
 
enum  ScaleFactor {
  TIMES_1 = 0 , TIMES_2 = 1 , TIMES_4 = 2 , TIMES_8 = 3 ,
  TIMES_16 = 4 , TIMES_COMPRESSED_WORD_SIZE = TIMES_WORD_SIZE , TIMES_COMPRESSED_HALF_WORD_SIZE = TIMES_COMPRESSED_WORD_SIZE - 1 , TIMES_1 = 0 ,
  TIMES_2 = 1 , TIMES_4 = 2 , TIMES_8 = 3 , TIMES_16 = 4 ,
  TIMES_COMPRESSED_WORD_SIZE = TIMES_WORD_SIZE , TIMES_COMPRESSED_HALF_WORD_SIZE = TIMES_COMPRESSED_WORD_SIZE - 1 , TIMES_1 = 0 , TIMES_2 = 1 ,
  TIMES_4 = 2 , TIMES_8 = 3 , TIMES_16 = 4 , TIMES_COMPRESSED_WORD_SIZE = TIMES_WORD_SIZE ,
  TIMES_COMPRESSED_HALF_WORD_SIZE = TIMES_COMPRESSED_WORD_SIZE - 1 , TIMES_1 = 0 , TIMES_2 = 1 , TIMES_4 = 2 ,
  TIMES_8 = 3 , TIMES_16 = 4 , TIMES_COMPRESSED_WORD_SIZE = TIMES_WORD_SIZE , TIMES_COMPRESSED_HALF_WORD_SIZE = TIMES_COMPRESSED_WORD_SIZE - 1 ,
  TIMES_1 = 0 , TIMES_2 = 1 , TIMES_4 = 2 , TIMES_8 = 3 ,
  TIMES_16 = 4 , TIMES_COMPRESSED_WORD_SIZE = TIMES_WORD_SIZE , TIMES_COMPRESSED_HALF_WORD_SIZE = TIMES_COMPRESSED_WORD_SIZE - 1
}
 
enum  Opcode {
  kNoOperand = -1 , AND = 0 , EOR = 1 , SUB = 2 ,
  RSB = 3 , ADD = 4 , ADC = 5 , SBC = 6 ,
  RSC = 7 , TST = 8 , TEQ = 9 , CMP = 10 ,
  CMN = 11 , ORR = 12 , MOV = 13 , BIC = 14 ,
  MVN = 15 , kMaxOperand = 16 , LUI = 0b0110111 , AUIPC = 0b0010111 ,
  JAL = 0b1101111 , JALR = 0b1100111 , BRANCH = 0b1100011 , LOAD = 0b0000011 ,
  STORE = 0b0100011 , OPIMM = 0b0010011 , OP = 0b0110011 , MISCMEM = 0b0001111 ,
  SYSTEM = 0b1110011 , OP32 = 0b0111011 , OPIMM32 = 0b0011011 , AMO = 0b0101111 ,
  LOADFP = 0b0000111 , STOREFP = 0b0100111 , FMADD = 0b1000011 , FMSUB = 0b1000111 ,
  FNMSUB = 0b1001011 , FNMADD = 0b1001111 , OPFP = 0b1010011
}
 
enum  Funct12 { ECALL = 0 , EBREAK = 1 }
 
enum  Funct3 {
  F3_0 = 0 , F3_1 = 1 , BEQ = 0b000 , BNE = 0b001 ,
  BLT = 0b100 , BGE = 0b101 , BLTU = 0b110 , BGEU = 0b111 ,
  LB = 0b000 , LH = 0b001 , LW = 0b010 , LBU = 0b100 ,
  LHU = 0b101 , LWU = 0b110 , LD = 0b011 , SB = 0b000 ,
  SH = 0b001 , SW = 0b010 , SD = 0b011 , ADDI = AddSubImmFixed ,
  SLLI = 0b001 , SLTI = 0b010 , SLTIU = 0b011 , XORI = 0b100 ,
  SRI = 0b101 , ORI = 0b110 , ANDI = LogicalImmFixed , ADD = 4 ,
  SLL = 0b001 , SLT = 0b010 , SLTU = 0b011 , XOR = 0b100 ,
  SR = 0b101 , OR = 0b110 , AND = 0 , FENCE = 0b000 ,
  FENCEI = 0b001 , CSRRW = 0b001 , CSRRS = 0b010 , CSRRC = 0b011 ,
  CSRRWI = 0b101 , CSRRSI = 0b110 , CSRRCI = 0b111 , MUL = 0b000 ,
  MULH = 0b001 , MULHSU = 0b010 , MULHU = 0b011 , DIV = 0b100 ,
  DIVU = 0b101 , REM = 0b110 , REMU = 0b111 , MULW = 0b000 ,
  DIVW = 0b100 , DIVUW = 0b101 , REMW = 0b110 , REMUW = 0b111 ,
  WIDTH32 = 0b010 , WIDTH64 = 0b011 , S = 0b010 , D = 0b011 ,
  J = 0b000 , JN = 0b001 , JX = 0b010 , FMIN = 0b000 ,
  FMAX = 0b001 , FEQ = 0b010 , FLT = 0b001 , FLE = 0b000 ,
  SH1ADD = 0b010 , SH2ADD = 0b100 , SH3ADD = 0b110 , F3_COUNT = 0b001 ,
  MAX = 0b110 , MAXU = 0b111 , MIN = 0b100 , MINU = 0b101 ,
  CLMUL = 0b001 , CLMULH = 0b011 , CLMULR = 0b010 , SEXT = 0b001 ,
  ZEXT = 0b100 , ROL = 0b001 , ROR = 3 , BCLR = 0b001 ,
  BEXT = 0b101 , F3_BINV = 0b001 , F3_BSET = 0b001
}
 
enum  Funct7 {
  F7_0 = 0 , SRA = 0b0100000 , SUB = 2 , MULDIV = 0b0000001 ,
  FADDS = 0b0000000 , FSUBS = 0b0000100 , FMULS = 0b0001000 , FDIVS = 0b0001100 ,
  FSQRTS = 0b0101100 , FSGNJS = 0b0010000 , FMINMAXS = 0b0010100 , FCMPS = 0b1010000 ,
  FCLASSS = 0b1110000 , FCVTintS = 0b1100000 , FCVTSint = 0b1101000 , FMVXW = 0b1110000 ,
  FMVWX = 0b1111000 , FADDD = FPTwoSourceFixed | B22 | B13 , FSUBD = FPTwoSourceFixed | B22 | B13 | B12 , FMULD = FPTwoSourceFixed | B22 ,
  FDIVD = FPTwoSourceFixed | B22 | B12 , FSQRTD = FPOneSourceFixed | B22 | B16 | B15 , FSGNJD = 0b0010001 , FMINMAXD = 0b0010101 ,
  FCVTS = 0b0100000 , FCVTD = 0b0100001 , FCMPD = FPCompareFixed | B22 , FCLASSD = 0b1110001 ,
  FCVTintD = 0b1100001 , FCVTDint = 0b1101001 , FMVXD = 0b1110001 , FMVDX = 0b1111001 ,
  ADDUW = 0b0000100 , SHADD = 0b0010000 , SLLIUW = 0b0000100 , COUNT = 0b0110000 ,
  MINMAXCLMUL = 0b0000101 , ROTATE = 0b0110000 , BCLRBEXT = 0b0100100 , BINV = 0b0110100 ,
  BSET = 0b0010100
}
 
enum  Funct5 {
  LR = R14 , SC = 0b00011 , AMOSWAP = 0b00001 , AMOADD = 0b00000 ,
  AMOXOR = 0b00100 , AMOAND = 0b01100 , AMOOR = 0b01000 , AMOMIN = 0b10000 ,
  AMOMAX = 0b10100 , AMOMINU = 0b11000 , AMOMAXU = 0b11100
}
 
enum  Funct2 { F2_S = 0b00 , F2_D = 0b01 }
 
enum  RoundingMode {
  RNE = 0b000 , RTZ = 0b001 , RDN = 0b010 , RUP = 0b011 ,
  RMM = 0b100 , DYN = 0b111
}
 
enum  FcvtRs2 { W = 0b00000 , WU = 0b00001 , L = 0b00010 , LU = 0b00011 }
 
enum  FClass {
  kFClassNegInfinity = 1 << 0 , kFClassNegNormal = 1 << 1 , kFClassNegSubnormal = 1 << 2 , kFClassNegZero = 1 << 3 ,
  kFClassPosZero = 1 << 4 , kFClassPosSubnormal = 1 << 5 , kFClassPosNormal = 1 << 6 , kFClassPosInfinity = 1 << 7 ,
  kFClassSignallingNan = 1 << 8 , kFClassQuietNan = 1 << 9
}
 
enum  HartEffects {
  kWrite = 1 << 0 , kRead = 1 << 1 , kOutput = 1 << 2 , kInput = 1 << 3 ,
  kMemory = kWrite | kRead , kIO = kOutput | kInput , kAll = kMemory | kIO
}
 
enum  COpcode {
  C_OP_MASK = 0b1110000000000011 , C_ADDI4SPN = 0b0000000000000000 , C_FLD = 0b0010000000000000 , C_LW = 0b0100000000000000 ,
  C_FLW = 0b0110000000000000 , C_LD = 0b0110000000000000 , C_FSD = 0b1010000000000000 , C_SW = 0b1100000000000000 ,
  C_FSW = 0b1110000000000000 , C_SD = 0b1110000000000000 , C_ADDI = 0b0000000000000001 , C_JAL = 0b0010000000000001 ,
  C_ADDIW = 0b0010000000000001 , C_LI = 0b0100000000000001 , C_ADDI16SP = 0b0110000000000001 , C_LUI = 0b0110000000000001 ,
  C_MISCALU = 0b1000000000000001 , C_MISCALU_MASK = 0b1110110000000011 , C_SRLI = 0b1000000000000001 , C_SRAI = 0b1000010000000001 ,
  C_ANDI = 0b1000100000000001 , C_RR = 0b1000110000000001 , C_RR_MASK = 0b1111110001100011 , C_SUB = 0b1000110000000001 ,
  C_XOR = 0b1000110000100001 , C_OR = 0b1000110001000001 , C_AND = 0b1000110001100001 , C_SUBW = 0b1001110000000001 ,
  C_ADDW = 0b1001110000100001 , C_J = 0b1010000000000001 , C_BEQZ = 0b1100000000000001 , C_BNEZ = 0b1110000000000001 ,
  C_SLLI = 0b0000000000000010 , C_FLDSP = 0b0010000000000010 , C_LWSP = 0b0100000000000010 , C_FLWSP = 0b0110000000000010 ,
  C_LDSP = 0b0110000000000010 , C_JR = 0b1000000000000010 , C_MV = 0b1000000000000010 , C_JALR = 0b1001000000000010 ,
  C_ADD = 0b1001000000000010 , C_FSDSP = 0b1010000000000010 , C_SWSP = 0b1100000000000010 , C_FSWSP = 0b1110000000000010 ,
  C_SDSP = 0b1110000000000010 , C_NOP = 0b0000000000000001 , C_EBREAK = 0b1001000000000010
}
 
enum  Register {
  R0 = 0 , R1 = 1 , R2 = 2 , R3 = 3 ,
  R4 = 4 , R5 = 5 , R6 = 6 , R7 = 7 ,
  R8 = 8 , R9 = 9 , R10 = 10 , R11 = 11 ,
  R12 = 12 , R13 = 13 , R14 = 14 , R15 = 15 ,
  kNumberOfCpuRegisters = 16 , kNoRegister = -1 , FP = R11 , NOTFP = R7 ,
  IP = R12 , SP = R13 , LR = R14 , PC = R15 ,
  R0 = 0 , R1 = 1 , R2 = 2 , R3 = 3 ,
  R4 = 4 , R5 = 5 , R6 = 6 , R7 = 7 ,
  R8 = 8 , R9 = 9 , R10 = 10 , R11 = 11 ,
  R12 = 12 , R13 = 13 , R14 = 14 , R15 = 15 ,
  R16 = 16 , R17 = 17 , R18 = 18 , R19 = 19 ,
  R20 = 20 , R21 = 21 , R22 = 22 , R23 = 23 ,
  R24 = 24 , R25 = 25 , R26 = 26 , R27 = 27 ,
  R28 = 28 , R29 = 29 , R30 = 30 , R31 = 31 ,
  kNumberOfCpuRegisters = 16 , kNoRegister = -1 , kNoRegister2 = -2 , CSP = 32 ,
  ZR = 33 , IP0 = R16 , IP1 = R17 , SP = R13 ,
  FP = R11 , LR = R14 , EAX = 0 , ECX = 1 ,
  EDX = 2 , EBX = 3 , ESP = 4 , EBP = 5 ,
  ESI = 6 , EDI = 7 , kNumberOfCpuRegisters = 16 , kNoRegister = -1 ,
  ZR = 33 , RA = 1 , SP = R13 , GP = 3 ,
  TP = 4 , T0 = 5 , T1 = 6 , T2 = 7 ,
  FP = R11 , S1 = 1 , A0 = 10 , A1 = 11 ,
  A2 = 12 , A3 = 13 , A4 = 14 , A5 = 15 ,
  A6 = 16 , A7 = 17 , S2 = 2 , S3 = 3 ,
  S4 = 4 , S5 = 5 , S6 = 6 , S7 = 7 ,
  S8 = 8 , S9 = 9 , S10 = 10 , S11 = 11 ,
  T3 = 28 , T4 = 29 , T5 = 30 , T6 = 31 ,
  kNumberOfCpuRegisters = 16 , kNoRegister = -1 , RA2 = T0 , S0 = 0 ,
  RAX = 0 , RCX = 1 , RDX = 2 , RBX = 3 ,
  RSP = 4 , RBP = 5 , RSI = 6 , RDI = 7 ,
  R8 = 8 , R9 = 9 , R10 = 10 , R11 = 11 ,
  R12 = 12 , R13 = 13 , R14 = 14 , R15 = 15 ,
  kNumberOfCpuRegisters = 16 , kNoRegister = -1
}
 
enum  ByteRegister {
  AL = 14 , CL = 1 , DL = 2 , BL = UnconditionalBranchFixed | B31 ,
  AH = 4 , CH = 5 , DH = 6 , BH = 7 ,
  kNumberOfByteRegisters = 8 , kNoByteRegister = -1 , AL = 14 , CL = 1 ,
  DL = 2 , BL = UnconditionalBranchFixed | B31 , AH = 4 , CH = 5 ,
  DH = 6 , BH = 7 , SPL = 4 | 0x10 , BPL = 5 | 0x10 ,
  SIL = 6 | 0x10 , DIL = 7 | 0x10 , R8B = 8 , R9B = 9 ,
  R10B = 10 , R11B = 11 , R12B = 12 , R13B = 13 ,
  R14B = 14 , R15B = 15 , kNumberOfByteRegisters = 8 , kNoByteRegister = -1
}
 
enum  XmmRegister {
  XMM0 = 0 , XMM1 = 1 , XMM2 = 2 , XMM3 = 3 ,
  XMM4 = 4 , XMM5 = 5 , XMM6 = 6 , XMM7 = 7 ,
  kNumberOfXmmRegisters = 8 , kNoXmmRegister = -1 , XMM0 = 0 , XMM1 = 1 ,
  XMM2 = 2 , XMM3 = 3 , XMM4 = 4 , XMM5 = 5 ,
  XMM6 = 6 , XMM7 = 7 , XMM8 = 8 , XMM9 = 9 ,
  XMM10 = 10 , XMM11 = 11 , XMM12 = 12 , XMM13 = 13 ,
  XMM14 = 14 , XMM15 = 15 , kNumberOfXmmRegisters = 8 , kNoXmmRegister = -1
}
 
enum  RexBits {
  REX_NONE = 0 , REX_B = 1 << 0 , REX_X = 1 << 1 , REX_R = 1 << 2 ,
  REX_W = 1 << 3 , REX_PREFIX = 1 << 6
}
 
enum  ScaleFactor {
  TIMES_1 = 0 , TIMES_2 = 1 , TIMES_4 = 2 , TIMES_8 = 3 ,
  TIMES_16 = 4 , TIMES_COMPRESSED_WORD_SIZE = TIMES_WORD_SIZE , TIMES_COMPRESSED_HALF_WORD_SIZE = TIMES_COMPRESSED_WORD_SIZE - 1 , TIMES_1 = 0 ,
  TIMES_2 = 1 , TIMES_4 = 2 , TIMES_8 = 3 , TIMES_16 = 4 ,
  TIMES_COMPRESSED_WORD_SIZE = TIMES_WORD_SIZE , TIMES_COMPRESSED_HALF_WORD_SIZE = TIMES_COMPRESSED_WORD_SIZE - 1 , TIMES_1 = 0 , TIMES_2 = 1 ,
  TIMES_4 = 2 , TIMES_8 = 3 , TIMES_16 = 4 , TIMES_COMPRESSED_WORD_SIZE = TIMES_WORD_SIZE ,
  TIMES_COMPRESSED_HALF_WORD_SIZE = TIMES_COMPRESSED_WORD_SIZE - 1 , TIMES_1 = 0 , TIMES_2 = 1 , TIMES_4 = 2 ,
  TIMES_8 = 3 , TIMES_16 = 4 , TIMES_COMPRESSED_WORD_SIZE = TIMES_WORD_SIZE , TIMES_COMPRESSED_HALF_WORD_SIZE = TIMES_COMPRESSED_WORD_SIZE - 1 ,
  TIMES_1 = 0 , TIMES_2 = 1 , TIMES_4 = 2 , TIMES_8 = 3 ,
  TIMES_16 = 4 , TIMES_COMPRESSED_WORD_SIZE = TIMES_WORD_SIZE , TIMES_COMPRESSED_HALF_WORD_SIZE = TIMES_COMPRESSED_WORD_SIZE - 1
}
 
enum  Condition {
  kNoCondition = -1 , EQ = 0 , NE = 1 , CS = 2 ,
  CC = 3 , MI = 4 , PL = 5 , VS = 6 ,
  VC = 7 , HI = 8 , LS = 9 , GE = 10 ,
  LT = 11 , GT = 12 , LE = 13 , AL = 14 ,
  kSpecialCondition = 15 , kNumberOfConditions = 16 , EQUAL = EQ , ZERO = EQUAL ,
  NOT_EQUAL = NE , NOT_ZERO = NOT_EQUAL , LESS = LT , LESS_EQUAL = LE ,
  GREATER_EQUAL = GE , GREATER = GT , UNSIGNED_LESS = CC , UNSIGNED_LESS_EQUAL = LS ,
  UNSIGNED_GREATER = HI , UNSIGNED_GREATER_EQUAL = CS , OVERFLOW = VS , NO_OVERFLOW = VC ,
  kInvalidCondition = 16 , kNoCondition = -1 , EQ = 0 , NE = 1 ,
  CS = 2 , CC = 3 , MI = 4 , PL = 5 ,
  VS = 6 , VC = 7 , HI = 8 , LS = 9 ,
  GE = 10 , LT = 11 , GT = 12 , LE = 13 ,
  AL = 14 , NV = 15 , kNumberOfConditions = 16 , EQUAL = EQ ,
  ZERO = EQUAL , NOT_EQUAL = NE , NOT_ZERO = NOT_EQUAL , LESS = LT ,
  LESS_EQUAL = LE , GREATER_EQUAL = GE , GREATER = GT , UNSIGNED_LESS = CC ,
  UNSIGNED_LESS_EQUAL = LS , UNSIGNED_GREATER = HI , UNSIGNED_GREATER_EQUAL = CS , OVERFLOW = VS ,
  NO_OVERFLOW = VC , kInvalidCondition = 16 , kNoCondition = -1 , EQ = 0 ,
  NE = 1 , CS = 2 , CC = 3 , MI = 4 ,
  PL = 5 , VS = 6 , VC = 7 , HI = 8 ,
  LS = 9 , GE = 10 , LT = 11 , GT = 12 ,
  LE = 13 , AL = 14 , NV = 15 , kNumberOfConditions = 16 ,
  EQUAL = EQ , ZERO = EQUAL , NOT_EQUAL = NE , NOT_ZERO = NOT_EQUAL ,
  LESS = LT , LESS_EQUAL = LE , GREATER_EQUAL = GE , GREATER = GT ,
  UNSIGNED_LESS = CC , UNSIGNED_LESS_EQUAL = LS , UNSIGNED_GREATER = HI , UNSIGNED_GREATER_EQUAL = CS ,
  OVERFLOW = VS , NO_OVERFLOW = VC , kInvalidCondition = 16 , OVERFLOW = VS ,
  NO_OVERFLOW = VC , BELOW = 2 , ABOVE_EQUAL = 3 , EQUAL = EQ ,
  NOT_EQUAL = NE , BELOW_EQUAL = 6 , ABOVE = 7 , SIGN = 8 ,
  NOT_SIGN = 9 , PARITY_EVEN = 10 , PARITY_ODD = 11 , LESS = LT ,
  GREATER_EQUAL = GE , LESS_EQUAL = LE , GREATER = GT , ZERO = EQUAL ,
  NOT_ZERO = NOT_EQUAL , NEGATIVE = SIGN , POSITIVE = NOT_SIGN , CARRY = BELOW ,
  NOT_CARRY = ABOVE_EQUAL , UNSIGNED_LESS = CC , UNSIGNED_LESS_EQUAL = LS , UNSIGNED_GREATER = HI ,
  UNSIGNED_GREATER_EQUAL = CS , kInvalidCondition = 16
}
 
enum  CpuInfoIndices {
  kCpuInfoProcessor = 0 , kCpuInfoModel = 1 , kCpuInfoHardware = 2 , kCpuInfoFeatures = 3 ,
  kCpuInfoArchitecture = 4 , kCpuInfoMax = 5
}
 
enum  CpuInfoMethod { kCpuInfoCpuId , kCpuInfoSystem , kCpuInfoNone , kCpuInfoDefault }
 
enum  Dart_ExceptionPauseInfo { kNoPauseOnExceptions = 1 , kPauseOnUnhandledExceptions , kPauseOnAllExceptions , kInvalidExceptionPauseInfo }
 
enum  Dart_IsolateEvent { kCreated = 0 , kInterrupted , kShutdown }
 
enum class  ExperimentalFeature {
  inference_update_3 , inline_class , inference_update_2 , sealed_class ,
  class_modifiers , records , patterns , unnamed_libraries ,
  inference_update_1 , enhanced_enums , named_arguments_anywhere , super_parameters ,
  constructor_tearoffs , generic_metadata , triple_shift , nonfunction_type_aliases ,
  non_nullable , extension_methods , constant_update_2018 , control_flow_collections ,
  set_literals , spread_collections
}
 
enum  Generation { kNew , kOld , kImm }
 
enum  RootSlices {
  kIsolate = 0 , kNumFixedRootSlices = 1 , kIsolate = 0 , kObjectIdRing ,
  kStoreBuffer , kNumRootSlices
}
 
enum  WeakSlices {
  kWeakHandles = 0 , kWeakTables , kObjectIdRing , kRememberedSet ,
  kNumWeakSlices , kWeakHandles = 0 , kWeakTables , kProgressBars ,
  kRememberLiveTemporaries , kPruneWeak , kNumWeakSlices
}
 
enum  { kForwardingMask = 1 << UntaggedObject::kCardRememberedBit , kNotForwarded = 0 , kForwarded = kForwardingMask }
 
enum  RootSlices {
  kIsolate = 0 , kNumFixedRootSlices = 1 , kIsolate = 0 , kObjectIdRing ,
  kStoreBuffer , kNumRootSlices
}
 
enum  WeakSlices {
  kWeakHandles = 0 , kWeakTables , kObjectIdRing , kRememberedSet ,
  kNumWeakSlices , kWeakHandles = 0 , kWeakTables , kProgressBars ,
  kRememberLiveTemporaries , kPruneWeak , kNumWeakSlices
}
 
enum class  GCType {
  kScavenge , kEvacuate , kStartConcurrentMark , kMarkSweep ,
  kMarkCompact
}
 
enum class  GCReason {
  kNewSpace , kStoreBuffer , kPromotion , kOldSpace ,
  kFinalize , kFull , kExternal , kIdle ,
  kDestroyed , kDebugging , kCatchUp
}
 
enum  MarkExpectation { kForbidMarked , kAllowMarked , kRequireMarked }
 
enum  JSONRpcErrorCode {
  kParseError = -32700 , kInvalidRequest = -32600 , kMethodNotFound = -32601 , kInvalidParams = -32602 ,
  kInternalError = -32603 , kExtensionError = -32000 , kFeatureDisabled = 100 , kCannotAddBreakpoint = 102 ,
  kStreamAlreadySubscribed = 103 , kStreamNotSubscribed = 104 , kIsolateMustBeRunnable = 105 , kIsolateMustBePaused = 106 ,
  kCannotResume = 107 , kIsolateIsReloading = 108 , kIsolateReloadBarred = 109 , kIsolateMustHaveReloaded = 110 ,
  kServiceAlreadyRegistered = 111 , kServiceDisappeared = 112 , kExpressionCompilationError = 113 , kInvalidTimelineRequest = 114 ,
  kFileSystemAlreadyExists = 1001 , kFileSystemDoesNotExist = 1002 , kFileDoesNotExist = 1003
}
 
enum class  MessagePhase {
  kBeforeTypes = 0 , kTypes = 1 , kCanonicalInstances = 2 , kNonCanonicalInstances = 3 ,
  kNumPhases = 4
}
 
enum  TypedDataViewFormat { kTypedDataViewFromC , kTypedDataViewFromDart }
 
enum  QualifiedFunctionLibKind { kQualifiedFunctionLibKindLibUrl , kQualifiedFunctionLibKindLibName }
 
enum class  Nullability : uint8_t { kNullable = 0 , kNonNullable = 1 , kLegacy = 2 }
 
enum class  TypeEquality { kCanonical = 0 , kSyntactical = 1 , kInSubtypeTest = 2 }
 
enum class  NNBDCompiledMode { kStrong = 0 , kWeak = 1 , kAgnostic = 2 , kInvalid = 3 }
 
enum  Genericity { kAny , kCurrentClass , kFunctions }
 
enum  { kNoneFree = 0 , kCurrentAndEnclosingFree = kMaxInt32 - 1 , kAllFree = kMaxInt32 }
 
enum class  FfiCallbackKind : uint8_t { kIsolateLocalStaticCallback , kIsolateLocalClosureCallback , kAsyncCallback }
 
enum class  EntryPointPragma {
  kAlways , kNever , kGetterOnly , kSetterOnly ,
  kCallOnly
}
 
enum  TraversalRules { kInternalToIsolateGroup , kExternalBetweenIsolateGroups }
 
enum  {
  kSmiTag = 0 , kHeapObjectTag = 1 , kSmiTagSize = 1 , kSmiTagMask = 1 ,
  kSmiTagShift = 1
}
 
enum  TypedDataElementType
 
enum class  InstantiationMode : uint8_t { kNeedsInstantiation , kIsInstantiated , kSharesInstantiatorTypeArguments , kSharesFunctionTypeArguments }
 
enum  ContainedInLattice { kNotYet = 0 , kLatticeIn = 1 , kLatticeOut = 2 , kLatticeUnknown = 3 }
 
enum class  MissHandler { kInlineCacheMiss , kSwitchableCallMiss , kFixCallersTargetMonomorphic }
 
enum  SentinelType { kCollectedSentinel , kExpiredSentinel , kFreeSentinel }
 
enum  TimelineOrSamplesResponseFormat : bool { JSON = false , Perfetto = true }
 
enum class  ValidationPolicy { kValidateFrames = 0 , kDontValidateFrames = 1 }
 
enum class  RuntimeCallDeoptAbility { kCanLazyDeopt , kCannotLazyDeopt }
 
enum  SafepointLevel {
  kGC , kGCAndDeopt , kGCAndDeoptAndReload , kNumLevels ,
  kNoSafepoint
}
 
enum class  CheckType {
  kCannotBeChecked , kNotSubtype , kCidCheckOnly , kNeedsFinalization ,
  kInstanceTypeArgumentsAreSubtypes
}
 
enum  TTSTestResult {
  kFail , kTTS , kExistingSTCEntry , kNewSTCEntry ,
  kRuntimeCheck , kSpecialize , kRespecialize , kNumTestResults
}
 
enum class  IdSpace : uint8_t {
  kInvalid = 0 , kSnapshot = 1 , kVmText = 2 , kIsolateText = 3 ,
  kVmData = 4 , kIsolateData = 5 , kArtificial = 6
}
 

Functions

 VM_UNIT_TEST_CASE (DirectoryCurrentNoScope)
 
 TEST_CASE (DirectoryCurrent)
 
 TEST_CASE (DirectoryExists)
 
 TEST_CASE (DirectorySystemTemp)
 
 TEST_CASE (DirectorySystemTempExists)
 
 TEST_CASE (DirectoryCreateTemp)
 
 TEST_CASE (DirectorySetCurrent)
 
 TEST_CASE (DirectoryCreateDelete)
 
 TEST_CASE (DirectoryRename)
 
DART_EXPORT void InduceACrash ()
 
DART_EXPORT void SetGlobalVar (int32_t v)
 
DART_EXPORT int32_t GetGlobalVar ()
 
DART_EXPORT Coord GetGlobalStruct ()
 
DART_EXPORT int32_t SumPlus42 (int32_t a, int32_t b)
 
DART_EXPORT uint8_t ReturnMaxUint8 ()
 
DART_EXPORT uint16_t ReturnMaxUint16 ()
 
DART_EXPORT uint32_t ReturnMaxUint32 ()
 
DART_EXPORT int8_t ReturnMinInt8 ()
 
DART_EXPORT int16_t ReturnMinInt16 ()
 
DART_EXPORT int32_t ReturnMinInt32 ()
 
DART_EXPORT uint8_t ReturnMaxUint8v2 ()
 
DART_EXPORT uint16_t ReturnMaxUint16v2 ()
 
DART_EXPORT uint32_t ReturnMaxUint32v2 ()
 
DART_EXPORT int8_t ReturnMinInt8v2 ()
 
DART_EXPORT int16_t ReturnMinInt16v2 ()
 
DART_EXPORT int32_t ReturnMinInt32v2 ()
 
DART_EXPORT intptr_t TakeMaxUint8 (uint8_t x)
 
DART_EXPORT intptr_t TakeMaxUint16 (uint16_t x)
 
DART_EXPORT intptr_t TakeMaxUint32 (uint32_t x)
 
DART_EXPORT intptr_t TakeMinInt8 (int8_t x)
 
DART_EXPORT intptr_t TakeMinInt16 (int16_t x)
 
DART_EXPORT intptr_t TakeMinInt32 (int32_t x)
 
DART_EXPORT intptr_t TakeMaxUint8x10 (uint8_t a, uint8_t b, uint8_t c, uint8_t d, uint8_t e, uint8_t f, uint8_t g, uint8_t h, uint8_t i, uint8_t j)
 
DART_EXPORT int64_t IntComputation (int8_t a, int16_t b, int32_t c, int64_t d)
 
DART_EXPORT int64_t Regress39044 (int64_t a, int8_t b)
 
DART_EXPORT intptr_t Regress40537 (uint8_t x)
 
DART_EXPORT intptr_t Regress40537Variant2 (uint8_t x)
 
DART_EXPORT uint8_t Regress40537Variant3 (intptr_t x)
 
DART_EXPORT int64_t UintComputation (uint8_t a, uint16_t b, uint32_t c, uint64_t d)
 
DART_EXPORT intptr_t Times3 (intptr_t a)
 
DART_EXPORT double Times1_337Double (double a)
 
DART_EXPORT float Times1_337Float (float a)
 
DART_EXPORT intptr_t SumManyInts (intptr_t a, intptr_t b, intptr_t c, intptr_t d, intptr_t e, intptr_t f, intptr_t g, intptr_t h, intptr_t i, intptr_t j)
 
DART_EXPORT int16_t SumManySmallInts (int8_t a, int16_t b, int8_t c, int16_t d, int8_t e, int16_t f, int8_t g, int16_t h, int8_t i, int16_t j)
 
DART_EXPORT double SumFloatsAndDoubles (float a, double b, float c)
 
DART_EXPORT int16_t SumVeryManySmallInts (int8_t a01, int16_t a02, int8_t a03, int16_t a04, int8_t a05, int16_t a06, int8_t a07, int16_t a08, int8_t a09, int16_t a10, int8_t a11, int16_t a12, int8_t a13, int16_t a14, int8_t a15, int16_t a16, int8_t a17, int16_t a18, int8_t a19, int16_t a20, int8_t a21, int16_t a22, int8_t a23, int16_t a24, int8_t a25, int16_t a26, int8_t a27, int16_t a28, int8_t a29, int16_t a30, int8_t a31, int16_t a32, int8_t a33, int16_t a34, int8_t a35, int16_t a36, int8_t a37, int16_t a38, int8_t a39, int16_t a40)
 
DART_EXPORT double SumVeryManyFloatsDoubles (float a01, double a02, float a03, double a04, float a05, double a06, float a07, double a08, float a09, double a10, float a11, double a12, float a13, double a14, float a15, double a16, float a17, double a18, float a19, double a20, float a21, double a22, float a23, double a24, float a25, double a26, float a27, double a28, float a29, double a30, float a31, double a32, float a33, double a34, float a35, double a36, float a37, double a38, float a39, double a40)
 
DART_EXPORT intptr_t SumManyIntsOdd (intptr_t a, intptr_t b, intptr_t c, intptr_t d, intptr_t e, intptr_t f, intptr_t g, intptr_t h, intptr_t i, intptr_t j, intptr_t k)
 
DART_EXPORT double SumManyDoubles (double a, double b, double c, double d, double e, double f, double g, double h, double i, double j)
 
DART_EXPORT double SumManyNumbers (intptr_t a, float b, intptr_t c, double d, intptr_t e, float f, intptr_t g, double h, intptr_t i, float j, intptr_t k, double l, intptr_t m, float n, intptr_t o, double p, intptr_t q, float r, intptr_t s, double t)
 
DART_EXPORT int64_t * Assign1337Index1 (int64_t *a)
 
DART_EXPORT CoordTransposeCoordinate (Coord *coord)
 
DART_EXPORT CoordCoordinateElemAt1 (Coord *coord)
 
DART_EXPORT CoordCoordinateUnOpTrice (CoordUnOp unop, Coord *coord)
 
DART_EXPORT IntptrBinOp IntptrAdditionClosure ()
 
DART_EXPORT intptr_t ApplyTo42And74 (IntptrBinOp binop)
 
DART_EXPORT int64_t * NullableInt64ElemAt1 (int64_t *a)
 
DART_EXPORT int64_t SumVeryLargeStruct (VeryLargeStruct *vls)
 
DART_EXPORT int64_t SumStruct9Uint8 (Struct9Uint8 s9)
 
DART_EXPORT int64_t SumReturnStruct9Uint8 (Struct9Uint8(*callback)(Struct9Uint8 *), Struct9Uint8 *in)
 
DART_EXPORT Struct9Uint8AllocStruct9Uint8 ()
 
DART_EXPORT void FreeStruct9Uint8 (Struct9Uint8 *address)
 
DART_EXPORT int64_t SumSmallNumbers (int8_t a, int16_t b, int32_t c, uint8_t d, uint16_t e, uint32_t f)
 
DART_EXPORT uint8_t IsRoughly1337 (float *a)
 
DART_EXPORT void DevNullFloat (float a)
 
DART_EXPORT float InventFloatValue ()
 
DART_EXPORT Struct20BytesHomogeneousInt32Copy PassStructRecursive (int64_t recursionCounter, Struct20BytesHomogeneousInt32Copy a0, Struct20BytesHomogeneousInt32Copy(*f)(int64_t, Struct20BytesHomogeneousInt32Copy))
 
DART_EXPORT void CallbackWithStruct (void(*f)(Struct8BytesNestedIntCopy))
 
DART_EXPORT intptr_t TestSimpleAddition (intptr_t(*add)(int, int))
 
DART_EXPORT intptr_t TestIntComputation (int64_t(*fn)(int8_t, int16_t, int32_t, int64_t))
 
DART_EXPORT intptr_t TestUintComputation (uint64_t(*fn)(uint8_t, uint16_t, uint32_t, uint64_t))
 
DART_EXPORT intptr_t TestSimpleMultiply (double(*fn)(double))
 
DART_EXPORT intptr_t TestSimpleMultiplyFloat (float(*fn)(float))
 
DART_EXPORT intptr_t TestManyInts (intptr_t(*fn)(intptr_t, intptr_t, intptr_t, intptr_t, intptr_t, intptr_t, intptr_t, intptr_t, intptr_t, intptr_t))
 
DART_EXPORT intptr_t TestManyDoubles (double(*fn)(double, double, double, double, double, double, double, double, double, double))
 
DART_EXPORT intptr_t TestManyArgs (double(*fn)(intptr_t a, float b, intptr_t c, double d, intptr_t e, float f, intptr_t g, double h, intptr_t i, float j, intptr_t k, double l, intptr_t m, float n, intptr_t o, double p, intptr_t q, float r, intptr_t s, double t))
 
DART_EXPORT intptr_t TestSumFloatsAndDoubles (double(*fn)(float, double, float))
 
DART_EXPORT intptr_t TestSumVeryManySmallInts (int16_t(*fn)(int8_t, int16_t, int8_t, int16_t, int8_t, int16_t, int8_t, int16_t, int8_t, int16_t, int8_t, int16_t, int8_t, int16_t, int8_t, int16_t, int8_t, int16_t, int8_t, int16_t, int8_t, int16_t, int8_t, int16_t, int8_t, int16_t, int8_t, int16_t, int8_t, int16_t, int8_t, int16_t, int8_t, int16_t, int8_t, int16_t, int8_t, int16_t, int8_t, int16_t))
 
DART_EXPORT intptr_t TestSumVeryManyFloatsDoubles (double(*fn)(float, double, float, double, float, double, float, double, float, double, float, double, float, double, float, double, float, double, float, double, float, double, float, double, float, double, float, double, float, double, float, double, float, double, float, double, float, double, float, double))
 
DART_EXPORT intptr_t TestStore (int64_t *(*fn)(int64_t *a))
 
DART_EXPORT intptr_t TestReturnNull (int32_t(*fn)())
 
DART_EXPORT intptr_t TestNullPointers (int64_t *(*fn)(int64_t *ptr))
 
DART_EXPORT intptr_t TestReturnVoid (intptr_t(*return_void)())
 
DART_EXPORT intptr_t TestThrowExceptionDouble (double(*fn)())
 
DART_EXPORT intptr_t TestThrowExceptionPointer (void *(*fn)())
 
DART_EXPORT intptr_t TestThrowException (intptr_t(*fn)())
 
DART_EXPORT intptr_t TestTakeMaxUint8x10 (intptr_t(*fn)(uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t))
 
DART_EXPORT intptr_t TestReturnMaxUint8 (uint8_t(*fn)())
 
DART_EXPORT void NativeTypePointerParam (void *p)
 
DART_EXPORT void * NativeTypePointerReturn ()
 
DART_EXPORT void CallbackNativeTypePointerParam (void(*f)(void *))
 
DART_EXPORT void CallbackNativeTypePointerReturn (void *(*f)())
 
DART_EXPORT int32_t PassStruct (void *)
 
DART_EXPORT uint64_t Regress43693 (Struct43693 *my_struct)
 
DART_EXPORT Struct46127 Regress46127 ()
 
DART_EXPORT uint64_t SizeOfStruct3BytesPackedInt ()
 
DART_EXPORT int64_t WCharMinValue ()
 
DART_EXPORT int64_t WCharMaxValue ()
 
DART_EXPORT int64_t VariadicStructVarArgs (VarArgs a0,...)
 
DART_EXPORT void CallFunctionOnSameThread (int64_t response_id, void(*fn)(int64_t, int32_t))
 
DART_EXPORT void CallFunctionOnNewThreadBlocking (int64_t response_id, void(*fn)(int64_t, int32_t))
 
DART_EXPORT void CallFunctionOnNewThreadNonBlocking (int64_t response_id, void(*fn)(int64_t, int32_t))
 
DART_EXPORT int32_t CallTwoIntFunction (int32_t(*fn)(int32_t, int32_t), int32_t a, int32_t b)
 
DART_EXPORT void CallTwoIntVoidFunction (void(*fn)(int32_t, int32_t), int32_t a, int32_t b)
 
DART_EXPORT void * CallTwoIntPointerFunction (void *(*fn)(int32_t, int32_t), int32_t a, int32_t b)
 
DART_EXPORT int32_t CallTwoPointerIntFunction (int32_t(*fn)(void *, void *), void *a, void *b)
 
DART_EXPORT char TakeString (char *my_string)
 
DART_EXPORT int64_t PassStruct1ByteIntx10 (Struct1ByteInt a0, Struct1ByteInt a1, Struct1ByteInt a2, Struct1ByteInt a3, Struct1ByteInt a4, Struct1ByteInt a5, Struct1ByteInt a6, Struct1ByteInt a7, Struct1ByteInt a8, Struct1ByteInt a9)
 
DART_EXPORT int64_t PassStruct3BytesHomogeneousUint8x10 (Struct3BytesHomogeneousUint8 a0, Struct3BytesHomogeneousUint8 a1, Struct3BytesHomogeneousUint8 a2, Struct3BytesHomogeneousUint8 a3, Struct3BytesHomogeneousUint8 a4, Struct3BytesHomogeneousUint8 a5, Struct3BytesHomogeneousUint8 a6, Struct3BytesHomogeneousUint8 a7, Struct3BytesHomogeneousUint8 a8, Struct3BytesHomogeneousUint8 a9)
 
DART_EXPORT int64_t PassStruct3BytesInt2ByteAlignedx10 (Struct3BytesInt2ByteAligned a0, Struct3BytesInt2ByteAligned a1, Struct3BytesInt2ByteAligned a2, Struct3BytesInt2ByteAligned a3, Struct3BytesInt2ByteAligned a4, Struct3BytesInt2ByteAligned a5, Struct3BytesInt2ByteAligned a6, Struct3BytesInt2ByteAligned a7, Struct3BytesInt2ByteAligned a8, Struct3BytesInt2ByteAligned a9)
 
DART_EXPORT int64_t PassStruct4BytesHomogeneousInt16x10 (Struct4BytesHomogeneousInt16 a0, Struct4BytesHomogeneousInt16 a1, Struct4BytesHomogeneousInt16 a2, Struct4BytesHomogeneousInt16 a3, Struct4BytesHomogeneousInt16 a4, Struct4BytesHomogeneousInt16 a5, Struct4BytesHomogeneousInt16 a6, Struct4BytesHomogeneousInt16 a7, Struct4BytesHomogeneousInt16 a8, Struct4BytesHomogeneousInt16 a9)
 
DART_EXPORT int64_t PassStruct7BytesHomogeneousUint8x10 (Struct7BytesHomogeneousUint8 a0, Struct7BytesHomogeneousUint8 a1, Struct7BytesHomogeneousUint8 a2, Struct7BytesHomogeneousUint8 a3, Struct7BytesHomogeneousUint8 a4, Struct7BytesHomogeneousUint8 a5, Struct7BytesHomogeneousUint8 a6, Struct7BytesHomogeneousUint8 a7, Struct7BytesHomogeneousUint8 a8, Struct7BytesHomogeneousUint8 a9)
 
DART_EXPORT int64_t PassStruct7BytesInt4ByteAlignedx10 (Struct7BytesInt4ByteAligned a0, Struct7BytesInt4ByteAligned a1, Struct7BytesInt4ByteAligned a2, Struct7BytesInt4ByteAligned a3, Struct7BytesInt4ByteAligned a4, Struct7BytesInt4ByteAligned a5, Struct7BytesInt4ByteAligned a6, Struct7BytesInt4ByteAligned a7, Struct7BytesInt4ByteAligned a8, Struct7BytesInt4ByteAligned a9)
 
DART_EXPORT int64_t PassStruct8BytesIntx10 (Struct8BytesInt a0, Struct8BytesInt a1, Struct8BytesInt a2, Struct8BytesInt a3, Struct8BytesInt a4, Struct8BytesInt a5, Struct8BytesInt a6, Struct8BytesInt a7, Struct8BytesInt a8, Struct8BytesInt a9)
 
DART_EXPORT float PassStruct8BytesHomogeneousFloatx10 (Struct8BytesHomogeneousFloat a0, Struct8BytesHomogeneousFloat a1, Struct8BytesHomogeneousFloat a2, Struct8BytesHomogeneousFloat a3, Struct8BytesHomogeneousFloat a4, Struct8BytesHomogeneousFloat a5, Struct8BytesHomogeneousFloat a6, Struct8BytesHomogeneousFloat a7, Struct8BytesHomogeneousFloat a8, Struct8BytesHomogeneousFloat a9)
 
DART_EXPORT float PassStruct8BytesMixedx10 (Struct8BytesMixed a0, Struct8BytesMixed a1, Struct8BytesMixed a2, Struct8BytesMixed a3, Struct8BytesMixed a4, Struct8BytesMixed a5, Struct8BytesMixed a6, Struct8BytesMixed a7, Struct8BytesMixed a8, Struct8BytesMixed a9)
 
DART_EXPORT int64_t PassStruct9BytesHomogeneousUint8x10 (Struct9BytesHomogeneousUint8 a0, Struct9BytesHomogeneousUint8 a1, Struct9BytesHomogeneousUint8 a2, Struct9BytesHomogeneousUint8 a3, Struct9BytesHomogeneousUint8 a4, Struct9BytesHomogeneousUint8 a5, Struct9BytesHomogeneousUint8 a6, Struct9BytesHomogeneousUint8 a7, Struct9BytesHomogeneousUint8 a8, Struct9BytesHomogeneousUint8 a9)
 
DART_EXPORT int64_t PassStruct9BytesInt4Or8ByteAlignedx10 (Struct9BytesInt4Or8ByteAligned a0, Struct9BytesInt4Or8ByteAligned a1, Struct9BytesInt4Or8ByteAligned a2, Struct9BytesInt4Or8ByteAligned a3, Struct9BytesInt4Or8ByteAligned a4, Struct9BytesInt4Or8ByteAligned a5, Struct9BytesInt4Or8ByteAligned a6, Struct9BytesInt4Or8ByteAligned a7, Struct9BytesInt4Or8ByteAligned a8, Struct9BytesInt4Or8ByteAligned a9)
 
DART_EXPORT float PassStruct12BytesHomogeneousFloatx6 (Struct12BytesHomogeneousFloat a0, Struct12BytesHomogeneousFloat a1, Struct12BytesHomogeneousFloat a2, Struct12BytesHomogeneousFloat a3, Struct12BytesHomogeneousFloat a4, Struct12BytesHomogeneousFloat a5)
 
DART_EXPORT float PassStruct16BytesHomogeneousFloatx5 (Struct16BytesHomogeneousFloat a0, Struct16BytesHomogeneousFloat a1, Struct16BytesHomogeneousFloat a2, Struct16BytesHomogeneousFloat a3, Struct16BytesHomogeneousFloat a4)
 
DART_EXPORT double PassStruct16BytesMixedx10 (Struct16BytesMixed a0, Struct16BytesMixed a1, Struct16BytesMixed a2, Struct16BytesMixed a3, Struct16BytesMixed a4, Struct16BytesMixed a5, Struct16BytesMixed a6, Struct16BytesMixed a7, Struct16BytesMixed a8, Struct16BytesMixed a9)
 
DART_EXPORT float PassStruct16BytesMixed2x10 (Struct16BytesMixed2 a0, Struct16BytesMixed2 a1, Struct16BytesMixed2 a2, Struct16BytesMixed2 a3, Struct16BytesMixed2 a4, Struct16BytesMixed2 a5, Struct16BytesMixed2 a6, Struct16BytesMixed2 a7, Struct16BytesMixed2 a8, Struct16BytesMixed2 a9)
 
DART_EXPORT int64_t PassStruct17BytesIntx10 (Struct17BytesInt a0, Struct17BytesInt a1, Struct17BytesInt a2, Struct17BytesInt a3, Struct17BytesInt a4, Struct17BytesInt a5, Struct17BytesInt a6, Struct17BytesInt a7, Struct17BytesInt a8, Struct17BytesInt a9)
 
DART_EXPORT int64_t PassStruct19BytesHomogeneousUint8x10 (Struct19BytesHomogeneousUint8 a0, Struct19BytesHomogeneousUint8 a1, Struct19BytesHomogeneousUint8 a2, Struct19BytesHomogeneousUint8 a3, Struct19BytesHomogeneousUint8 a4, Struct19BytesHomogeneousUint8 a5, Struct19BytesHomogeneousUint8 a6, Struct19BytesHomogeneousUint8 a7, Struct19BytesHomogeneousUint8 a8, Struct19BytesHomogeneousUint8 a9)
 
DART_EXPORT int32_t PassStruct20BytesHomogeneousInt32x10 (Struct20BytesHomogeneousInt32 a0, Struct20BytesHomogeneousInt32 a1, Struct20BytesHomogeneousInt32 a2, Struct20BytesHomogeneousInt32 a3, Struct20BytesHomogeneousInt32 a4, Struct20BytesHomogeneousInt32 a5, Struct20BytesHomogeneousInt32 a6, Struct20BytesHomogeneousInt32 a7, Struct20BytesHomogeneousInt32 a8, Struct20BytesHomogeneousInt32 a9)
 
DART_EXPORT float PassStruct20BytesHomogeneousFloat (Struct20BytesHomogeneousFloat a0)
 
DART_EXPORT double PassStruct32BytesHomogeneousDoublex5 (Struct32BytesHomogeneousDouble a0, Struct32BytesHomogeneousDouble a1, Struct32BytesHomogeneousDouble a2, Struct32BytesHomogeneousDouble a3, Struct32BytesHomogeneousDouble a4)
 
DART_EXPORT double PassStruct40BytesHomogeneousDouble (Struct40BytesHomogeneousDouble a0)
 
DART_EXPORT uint64_t PassStruct1024BytesHomogeneousUint64 (Struct1024BytesHomogeneousUint64 a0)
 
DART_EXPORT float PassFloatStruct16BytesHomogeneousFloatFloatStruct1 (float a0, Struct16BytesHomogeneousFloat a1, float a2, Struct16BytesHomogeneousFloat a3, float a4, Struct16BytesHomogeneousFloat a5, float a6, Struct16BytesHomogeneousFloat a7, float a8)
 
DART_EXPORT double PassFloatStruct32BytesHomogeneousDoubleFloatStruct (float a0, Struct32BytesHomogeneousDouble a1, float a2, Struct32BytesHomogeneousDouble a3, float a4, Struct32BytesHomogeneousDouble a5, float a6, Struct32BytesHomogeneousDouble a7, float a8)
 
DART_EXPORT double PassInt8Struct16BytesMixedInt8Struct16BytesMixedIn (int8_t a0, Struct16BytesMixed a1, int8_t a2, Struct16BytesMixed a3, int8_t a4, Struct16BytesMixed a5, int8_t a6, Struct16BytesMixed a7, int8_t a8)
 
DART_EXPORT double PassDoublex6Struct16BytesMixedx4Int32 (double a0, double a1, double a2, double a3, double a4, double a5, Struct16BytesMixed a6, Struct16BytesMixed a7, Struct16BytesMixed a8, Struct16BytesMixed a9, int32_t a10)
 
DART_EXPORT double PassInt32x4Struct16BytesMixedx4Double (int32_t a0, int32_t a1, int32_t a2, int32_t a3, Struct16BytesMixed a4, Struct16BytesMixed a5, Struct16BytesMixed a6, Struct16BytesMixed a7, double a8)
 
DART_EXPORT double PassStruct40BytesHomogeneousDoubleStruct4BytesHomo (Struct40BytesHomogeneousDouble a0, Struct4BytesHomogeneousInt16 a1, Struct8BytesHomogeneousFloat a2)
 
DART_EXPORT double PassInt32x8Doublex8Int64Int8Struct1ByteIntInt64Int (int32_t a0, int32_t a1, int32_t a2, int32_t a3, int32_t a4, int32_t a5, int32_t a6, int32_t a7, double a8, double a9, double a10, double a11, double a12, double a13, double a14, double a15, int64_t a16, int8_t a17, Struct1ByteInt a18, int64_t a19, int8_t a20, Struct4BytesHomogeneousInt16 a21, int64_t a22, int8_t a23, Struct8BytesInt a24, int64_t a25, int8_t a26, Struct8BytesHomogeneousFloat a27, int64_t a28, int8_t a29, Struct8BytesMixed a30, int64_t a31, int8_t a32, StructAlignmentInt16 a33, int64_t a34, int8_t a35, StructAlignmentInt32 a36, int64_t a37, int8_t a38, StructAlignmentInt64 a39)
 
DART_EXPORT int64_t PassStructAlignmentInt16 (StructAlignmentInt16 a0)
 
DART_EXPORT int64_t PassStructAlignmentInt32 (StructAlignmentInt32 a0)
 
DART_EXPORT int64_t PassStructAlignmentInt64 (StructAlignmentInt64 a0)
 
DART_EXPORT int64_t PassStruct8BytesNestedIntx10 (Struct8BytesNestedInt a0, Struct8BytesNestedInt a1, Struct8BytesNestedInt a2, Struct8BytesNestedInt a3, Struct8BytesNestedInt a4, Struct8BytesNestedInt a5, Struct8BytesNestedInt a6, Struct8BytesNestedInt a7, Struct8BytesNestedInt a8, Struct8BytesNestedInt a9)
 
DART_EXPORT float PassStruct8BytesNestedFloatx10 (Struct8BytesNestedFloat a0, Struct8BytesNestedFloat a1, Struct8BytesNestedFloat a2, Struct8BytesNestedFloat a3, Struct8BytesNestedFloat a4, Struct8BytesNestedFloat a5, Struct8BytesNestedFloat a6, Struct8BytesNestedFloat a7, Struct8BytesNestedFloat a8, Struct8BytesNestedFloat a9)
 
DART_EXPORT float PassStruct8BytesNestedFloat2x10 (Struct8BytesNestedFloat2 a0, Struct8BytesNestedFloat2 a1, Struct8BytesNestedFloat2 a2, Struct8BytesNestedFloat2 a3, Struct8BytesNestedFloat2 a4, Struct8BytesNestedFloat2 a5, Struct8BytesNestedFloat2 a6, Struct8BytesNestedFloat2 a7, Struct8BytesNestedFloat2 a8, Struct8BytesNestedFloat2 a9)
 
DART_EXPORT double PassStruct8BytesNestedMixedx10 (Struct8BytesNestedMixed a0, Struct8BytesNestedMixed a1, Struct8BytesNestedMixed a2, Struct8BytesNestedMixed a3, Struct8BytesNestedMixed a4, Struct8BytesNestedMixed a5, Struct8BytesNestedMixed a6, Struct8BytesNestedMixed a7, Struct8BytesNestedMixed a8, Struct8BytesNestedMixed a9)
 
DART_EXPORT int64_t PassStruct16BytesNestedIntx2 (Struct16BytesNestedInt a0, Struct16BytesNestedInt a1)
 
DART_EXPORT int64_t PassStruct32BytesNestedIntx2 (Struct32BytesNestedInt a0, Struct32BytesNestedInt a1)
 
DART_EXPORT int64_t PassStructNestedIntStructAlignmentInt16 (StructNestedIntStructAlignmentInt16 a0)
 
DART_EXPORT int64_t PassStructNestedIntStructAlignmentInt32 (StructNestedIntStructAlignmentInt32 a0)
 
DART_EXPORT int64_t PassStructNestedIntStructAlignmentInt64 (StructNestedIntStructAlignmentInt64 a0)
 
DART_EXPORT double PassStructNestedIrregularEvenBiggerx4 (StructNestedIrregularEvenBigger a0, StructNestedIrregularEvenBigger a1, StructNestedIrregularEvenBigger a2, StructNestedIrregularEvenBigger a3)
 
DART_EXPORT int32_t PassStruct8BytesInlineArrayIntx4 (Struct8BytesInlineArrayInt a0, Struct8BytesInlineArrayInt a1, Struct8BytesInlineArrayInt a2, Struct8BytesInlineArrayInt a3)
 
DART_EXPORT int32_t PassStructInlineArrayIrregularx4 (StructInlineArrayIrregular a0, StructInlineArrayIrregular a1, StructInlineArrayIrregular a2, StructInlineArrayIrregular a3)
 
DART_EXPORT int32_t PassStructInlineArray100Bytes (StructInlineArray100Bytes a0)
 
DART_EXPORT float PassStructStruct16BytesHomogeneousFloat2x5 (StructStruct16BytesHomogeneousFloat2 a0, StructStruct16BytesHomogeneousFloat2 a1, StructStruct16BytesHomogeneousFloat2 a2, StructStruct16BytesHomogeneousFloat2 a3, StructStruct16BytesHomogeneousFloat2 a4)
 
DART_EXPORT double PassStructStruct32BytesHomogeneousDouble2x5 (StructStruct32BytesHomogeneousDouble2 a0, StructStruct32BytesHomogeneousDouble2 a1, StructStruct32BytesHomogeneousDouble2 a2, StructStruct32BytesHomogeneousDouble2 a3, StructStruct32BytesHomogeneousDouble2 a4)
 
DART_EXPORT float PassStructStruct16BytesMixed3x10 (StructStruct16BytesMixed3 a0, StructStruct16BytesMixed3 a1, StructStruct16BytesMixed3 a2, StructStruct16BytesMixed3 a3, StructStruct16BytesMixed3 a4, StructStruct16BytesMixed3 a5, StructStruct16BytesMixed3 a6, StructStruct16BytesMixed3 a7, StructStruct16BytesMixed3 a8, StructStruct16BytesMixed3 a9)
 
DART_EXPORT uint32_t PassUint8Struct32BytesInlineArrayMultiDimensionalI (uint8_t a0, Struct32BytesInlineArrayMultiDimensionalInt a1, uint8_t a2, Struct8BytesInlineArrayMultiDimensionalInt a3, uint8_t a4, Struct8BytesInlineArrayMultiDimensionalInt a5, uint8_t a6)
 
DART_EXPORT uint32_t PassUint8Struct4BytesInlineArrayMultiDimensionalIn (uint8_t a0, Struct4BytesInlineArrayMultiDimensionalInt a1, uint8_t a2)
 
DART_EXPORT int64_t PassStruct3BytesPackedIntx10 (Struct3BytesPackedInt a0, Struct3BytesPackedInt a1, Struct3BytesPackedInt a2, Struct3BytesPackedInt a3, Struct3BytesPackedInt a4, Struct3BytesPackedInt a5, Struct3BytesPackedInt a6, Struct3BytesPackedInt a7, Struct3BytesPackedInt a8, Struct3BytesPackedInt a9)
 
DART_EXPORT int64_t PassStruct8BytesPackedIntx10 (Struct8BytesPackedInt a0, Struct8BytesPackedInt a1, Struct8BytesPackedInt a2, Struct8BytesPackedInt a3, Struct8BytesPackedInt a4, Struct8BytesPackedInt a5, Struct8BytesPackedInt a6, Struct8BytesPackedInt a7, Struct8BytesPackedInt a8, Struct8BytesPackedInt a9)
 
DART_EXPORT double PassStruct9BytesPackedMixedx10DoubleInt32x2 (Struct9BytesPackedMixed a0, Struct9BytesPackedMixed a1, Struct9BytesPackedMixed a2, Struct9BytesPackedMixed a3, Struct9BytesPackedMixed a4, Struct9BytesPackedMixed a5, Struct9BytesPackedMixed a6, Struct9BytesPackedMixed a7, Struct9BytesPackedMixed a8, Struct9BytesPackedMixed a9, double a10, int32_t a11, int32_t a12)
 
DART_EXPORT double PassStruct5BytesPackedMixed (Struct5BytesPackedMixed a0)
 
DART_EXPORT double PassStructNestedAlignmentStruct5BytesPackedMixed (StructNestedAlignmentStruct5BytesPackedMixed a0)
 
DART_EXPORT double PassStruct6BytesInlineArrayInt (Struct6BytesInlineArrayInt a0)
 
DART_EXPORT double PassStruct15BytesInlineArrayMixed (Struct15BytesInlineArrayMixed a0)
 
DART_EXPORT double PassUnion4BytesMixedx10 (Union4BytesMixed a0, Union4BytesMixed a1, Union4BytesMixed a2, Union4BytesMixed a3, Union4BytesMixed a4, Union4BytesMixed a5, Union4BytesMixed a6, Union4BytesMixed a7, Union4BytesMixed a8, Union4BytesMixed a9)
 
DART_EXPORT double PassUnion8BytesNestedFloatx10 (Union8BytesNestedFloat a0, Union8BytesNestedFloat a1, Union8BytesNestedFloat a2, Union8BytesNestedFloat a3, Union8BytesNestedFloat a4, Union8BytesNestedFloat a5, Union8BytesNestedFloat a6, Union8BytesNestedFloat a7, Union8BytesNestedFloat a8, Union8BytesNestedFloat a9)
 
DART_EXPORT double PassUnion9BytesNestedIntx10 (Union9BytesNestedInt a0, Union9BytesNestedInt a1, Union9BytesNestedInt a2, Union9BytesNestedInt a3, Union9BytesNestedInt a4, Union9BytesNestedInt a5, Union9BytesNestedInt a6, Union9BytesNestedInt a7, Union9BytesNestedInt a8, Union9BytesNestedInt a9)
 
DART_EXPORT double PassUnion16BytesNestedInlineArrayFloatx10 (Union16BytesNestedInlineArrayFloat a0, Union16BytesNestedInlineArrayFloat a1, Union16BytesNestedInlineArrayFloat a2, Union16BytesNestedInlineArrayFloat a3, Union16BytesNestedInlineArrayFloat a4, Union16BytesNestedInlineArrayFloat a5, Union16BytesNestedInlineArrayFloat a6, Union16BytesNestedInlineArrayFloat a7, Union16BytesNestedInlineArrayFloat a8, Union16BytesNestedInlineArrayFloat a9)
 
DART_EXPORT double PassUnion16BytesNestedFloatx10 (Union16BytesNestedFloat a0, Union16BytesNestedFloat a1, Union16BytesNestedFloat a2, Union16BytesNestedFloat a3, Union16BytesNestedFloat a4, Union16BytesNestedFloat a5, Union16BytesNestedFloat a6, Union16BytesNestedFloat a7, Union16BytesNestedFloat a8, Union16BytesNestedFloat a9)
 
DART_EXPORT int32_t PassUint8Boolx9Struct10BytesHomogeneousBoolBool (uint8_t a0, bool a1, bool a2, bool a3, bool a4, bool a5, bool a6, bool a7, bool a8, bool a9, Struct10BytesHomogeneousBool a10, bool a11)
 
DART_EXPORT int32_t PassUint8Boolx9Struct10BytesInlineArrayBoolBool (uint8_t a0, bool a1, bool a2, bool a3, bool a4, bool a5, bool a6, bool a7, bool a8, bool a9, Struct10BytesInlineArrayBool a10, bool a11)
 
DART_EXPORT bool PassUint8Struct1ByteBool (uint8_t a0, Struct1ByteBool a1)
 
DART_EXPORT wchar_t PassWCharStructInlineArrayIntUintPtrx2LongUnsigned (wchar_t a0, StructInlineArrayInt a1, uintptr_t a2, uintptr_t a3, long a4, unsigned long a5)
 
DART_EXPORT int64_t PassInt64x7Struct12BytesHomogeneousInt32 (int64_t a0, int64_t a1, int64_t a2, int64_t a3, int64_t a4, int64_t a5, int64_t a6, Struct12BytesHomogeneousInt32 a7)
 
DART_EXPORT Struct1ByteInt ReturnStruct1ByteInt (int8_t a0)
 
DART_EXPORT Struct3BytesHomogeneousUint8 ReturnStruct3BytesHomogeneousUint8 (uint8_t a0, uint8_t a1, uint8_t a2)
 
DART_EXPORT Struct3BytesInt2ByteAligned ReturnStruct3BytesInt2ByteAligned (int16_t a0, int8_t a1)
 
DART_EXPORT Struct4BytesHomogeneousInt16 ReturnStruct4BytesHomogeneousInt16 (int16_t a0, int16_t a1)
 
DART_EXPORT Struct7BytesHomogeneousUint8 ReturnStruct7BytesHomogeneousUint8 (uint8_t a0, uint8_t a1, uint8_t a2, uint8_t a3, uint8_t a4, uint8_t a5, uint8_t a6)
 
DART_EXPORT Struct7BytesInt4ByteAligned ReturnStruct7BytesInt4ByteAligned (int32_t a0, int16_t a1, int8_t a2)
 
DART_EXPORT Struct8BytesInt ReturnStruct8BytesInt (int16_t a0, int16_t a1, int32_t a2)
 
DART_EXPORT Struct8BytesHomogeneousFloat ReturnStruct8BytesHomogeneousFloat (float a0, float a1)
 
DART_EXPORT Struct8BytesMixed ReturnStruct8BytesMixed (float a0, int16_t a1, int16_t a2)
 
DART_EXPORT Struct9BytesHomogeneousUint8 ReturnStruct9BytesHomogeneousUint8 (uint8_t a0, uint8_t a1, uint8_t a2, uint8_t a3, uint8_t a4, uint8_t a5, uint8_t a6, uint8_t a7, uint8_t a8)
 
DART_EXPORT Struct9BytesInt4Or8ByteAligned ReturnStruct9BytesInt4Or8ByteAligned (int64_t a0, int8_t a1)
 
DART_EXPORT Struct12BytesHomogeneousFloat ReturnStruct12BytesHomogeneousFloat (float a0, float a1, float a2)
 
DART_EXPORT Struct16BytesHomogeneousFloat ReturnStruct16BytesHomogeneousFloat (float a0, float a1, float a2, float a3)
 
DART_EXPORT Struct16BytesMixed ReturnStruct16BytesMixed (double a0, int64_t a1)
 
DART_EXPORT Struct16BytesMixed2 ReturnStruct16BytesMixed2 (float a0, float a1, float a2, int32_t a3)
 
DART_EXPORT Struct17BytesInt ReturnStruct17BytesInt (int64_t a0, int64_t a1, int8_t a2)
 
DART_EXPORT Struct19BytesHomogeneousUint8 ReturnStruct19BytesHomogeneousUint8 (uint8_t a0, uint8_t a1, uint8_t a2, uint8_t a3, uint8_t a4, uint8_t a5, uint8_t a6, uint8_t a7, uint8_t a8, uint8_t a9, uint8_t a10, uint8_t a11, uint8_t a12, uint8_t a13, uint8_t a14, uint8_t a15, uint8_t a16, uint8_t a17, uint8_t a18)
 
DART_EXPORT Struct20BytesHomogeneousInt32 ReturnStruct20BytesHomogeneousInt32 (int32_t a0, int32_t a1, int32_t a2, int32_t a3, int32_t a4)
 
DART_EXPORT Struct20BytesHomogeneousFloat ReturnStruct20BytesHomogeneousFloat (float a0, float a1, float a2, float a3, float a4)
 
DART_EXPORT Struct32BytesHomogeneousDouble ReturnStruct32BytesHomogeneousDouble (double a0, double a1, double a2, double a3)
 
DART_EXPORT Struct40BytesHomogeneousDouble ReturnStruct40BytesHomogeneousDouble (double a0, double a1, double a2, double a3, double a4)
 
DART_EXPORT Struct1024BytesHomogeneousUint64 ReturnStruct1024BytesHomogeneousUint64 (uint64_t a0, uint64_t a1, uint64_t a2, uint64_t a3, uint64_t a4, uint64_t a5, uint64_t a6, uint64_t a7, uint64_t a8, uint64_t a9, uint64_t a10, uint64_t a11, uint64_t a12, uint64_t a13, uint64_t a14, uint64_t a15, uint64_t a16, uint64_t a17, uint64_t a18, uint64_t a19, uint64_t a20, uint64_t a21, uint64_t a22, uint64_t a23, uint64_t a24, uint64_t a25, uint64_t a26, uint64_t a27, uint64_t a28, uint64_t a29, uint64_t a30, uint64_t a31, uint64_t a32, uint64_t a33, uint64_t a34, uint64_t a35, uint64_t a36, uint64_t a37, uint64_t a38, uint64_t a39, uint64_t a40, uint64_t a41, uint64_t a42, uint64_t a43, uint64_t a44, uint64_t a45, uint64_t a46, uint64_t a47, uint64_t a48, uint64_t a49, uint64_t a50, uint64_t a51, uint64_t a52, uint64_t a53, uint64_t a54, uint64_t a55, uint64_t a56, uint64_t a57, uint64_t a58, uint64_t a59, uint64_t a60, uint64_t a61, uint64_t a62, uint64_t a63, uint64_t a64, uint64_t a65, uint64_t a66, uint64_t a67, uint64_t a68, uint64_t a69, uint64_t a70, uint64_t a71, uint64_t a72, uint64_t a73, uint64_t a74, uint64_t a75, uint64_t a76, uint64_t a77, uint64_t a78, uint64_t a79, uint64_t a80, uint64_t a81, uint64_t a82, uint64_t a83, uint64_t a84, uint64_t a85, uint64_t a86, uint64_t a87, uint64_t a88, uint64_t a89, uint64_t a90, uint64_t a91, uint64_t a92, uint64_t a93, uint64_t a94, uint64_t a95, uint64_t a96, uint64_t a97, uint64_t a98, uint64_t a99, uint64_t a100, uint64_t a101, uint64_t a102, uint64_t a103, uint64_t a104, uint64_t a105, uint64_t a106, uint64_t a107, uint64_t a108, uint64_t a109, uint64_t a110, uint64_t a111, uint64_t a112, uint64_t a113, uint64_t a114, uint64_t a115, uint64_t a116, uint64_t a117, uint64_t a118, uint64_t a119, uint64_t a120, uint64_t a121, uint64_t a122, uint64_t a123, uint64_t a124, uint64_t a125, uint64_t a126, uint64_t a127)
 
DART_EXPORT Struct3BytesPackedInt ReturnStruct3BytesPackedInt (int8_t a0, int16_t a1)
 
DART_EXPORT Struct8BytesPackedInt ReturnStruct8BytesPackedInt (uint8_t a0, uint32_t a1, uint8_t a2, uint8_t a3, uint8_t a4)
 
DART_EXPORT Struct9BytesPackedMixed ReturnStruct9BytesPackedMixed (uint8_t a0, double a1)
 
DART_EXPORT Union4BytesMixed ReturnUnion4BytesMixed (uint32_t a0)
 
DART_EXPORT Union8BytesNestedFloat ReturnUnion8BytesNestedFloat (double a0)
 
DART_EXPORT Union9BytesNestedInt ReturnUnion9BytesNestedInt (Struct8BytesInt a0)
 
DART_EXPORT Union16BytesNestedFloat ReturnUnion16BytesNestedFloat (Struct8BytesHomogeneousFloat a0)
 
DART_EXPORT Struct1ByteInt ReturnStructArgumentStruct1ByteInt (Struct1ByteInt a0)
 
DART_EXPORT Struct1ByteInt ReturnStructArgumentInt32x8Struct1ByteInt (int32_t a0, int32_t a1, int32_t a2, int32_t a3, int32_t a4, int32_t a5, int32_t a6, int32_t a7, Struct1ByteInt a8)
 
DART_EXPORT Struct8BytesHomogeneousFloat ReturnStructArgumentStruct8BytesHomogeneousFloat (Struct8BytesHomogeneousFloat a0)
 
DART_EXPORT Struct20BytesHomogeneousInt32 ReturnStructArgumentStruct20BytesHomogeneousInt32 (Struct20BytesHomogeneousInt32 a0)
 
DART_EXPORT Struct20BytesHomogeneousInt32 ReturnStructArgumentInt32x8Struct20BytesHomogeneou (int32_t a0, int32_t a1, int32_t a2, int32_t a3, int32_t a4, int32_t a5, int32_t a6, int32_t a7, Struct20BytesHomogeneousInt32 a8)
 
DART_EXPORT Struct8BytesInlineArrayInt ReturnStructArgumentStruct8BytesInlineArrayInt (Struct8BytesInlineArrayInt a0)
 
DART_EXPORT StructStruct16BytesHomogeneousFloat2 ReturnStructArgumentStructStruct16BytesHomogeneous (StructStruct16BytesHomogeneousFloat2 a0)
 
DART_EXPORT StructStruct32BytesHomogeneousDouble2 ReturnStructArgumentStructStruct32BytesHomogeneous (StructStruct32BytesHomogeneousDouble2 a0)
 
DART_EXPORT StructStruct16BytesMixed3 ReturnStructArgumentStructStruct16BytesMixed3 (StructStruct16BytesMixed3 a0)
 
DART_EXPORT StructAlignmentInt16 ReturnStructAlignmentInt16 (int8_t a0, int16_t a1, int8_t a2)
 
DART_EXPORT StructAlignmentInt32 ReturnStructAlignmentInt32 (int8_t a0, int32_t a1, int8_t a2)
 
DART_EXPORT StructAlignmentInt64 ReturnStructAlignmentInt64 (int8_t a0, int64_t a1, int8_t a2)
 
DART_EXPORT Struct8BytesNestedInt ReturnStruct8BytesNestedInt (Struct4BytesHomogeneousInt16 a0, Struct4BytesHomogeneousInt16 a1)
 
DART_EXPORT Struct8BytesNestedFloat ReturnStruct8BytesNestedFloat (Struct4BytesFloat a0, Struct4BytesFloat a1)
 
DART_EXPORT Struct8BytesNestedFloat2 ReturnStruct8BytesNestedFloat2 (Struct4BytesFloat a0, float a1)
 
DART_EXPORT Struct8BytesNestedMixed ReturnStruct8BytesNestedMixed (Struct4BytesHomogeneousInt16 a0, Struct4BytesFloat a1)
 
DART_EXPORT Struct16BytesNestedInt ReturnStruct16BytesNestedInt (Struct8BytesNestedInt a0, Struct8BytesNestedInt a1)
 
DART_EXPORT Struct32BytesNestedInt ReturnStruct32BytesNestedInt (Struct16BytesNestedInt a0, Struct16BytesNestedInt a1)
 
DART_EXPORT StructNestedIntStructAlignmentInt16 ReturnStructNestedIntStructAlignmentInt16 (StructAlignmentInt16 a0, StructAlignmentInt16 a1)
 
DART_EXPORT StructNestedIntStructAlignmentInt32 ReturnStructNestedIntStructAlignmentInt32 (StructAlignmentInt32 a0, StructAlignmentInt32 a1)
 
DART_EXPORT StructNestedIntStructAlignmentInt64 ReturnStructNestedIntStructAlignmentInt64 (StructAlignmentInt64 a0, StructAlignmentInt64 a1)
 
DART_EXPORT StructNestedIrregularEvenBigger ReturnStructNestedIrregularEvenBigger (uint64_t a0, StructNestedIrregularBigger a1, StructNestedIrregularBigger a2, double a3)
 
DART_EXPORT intptr_t TestPassStruct1ByteIntx10 (int64_t(*f)(Struct1ByteInt a0, Struct1ByteInt a1, Struct1ByteInt a2, Struct1ByteInt a3, Struct1ByteInt a4, Struct1ByteInt a5, Struct1ByteInt a6, Struct1ByteInt a7, Struct1ByteInt a8, Struct1ByteInt a9))
 
DART_EXPORT intptr_t TestPassStruct3BytesHomogeneousUint8x10 (int64_t(*f)(Struct3BytesHomogeneousUint8 a0, Struct3BytesHomogeneousUint8 a1, Struct3BytesHomogeneousUint8 a2, Struct3BytesHomogeneousUint8 a3, Struct3BytesHomogeneousUint8 a4, Struct3BytesHomogeneousUint8 a5, Struct3BytesHomogeneousUint8 a6, Struct3BytesHomogeneousUint8 a7, Struct3BytesHomogeneousUint8 a8, Struct3BytesHomogeneousUint8 a9))
 
DART_EXPORT intptr_t TestPassStruct3BytesInt2ByteAlignedx10 (int64_t(*f)(Struct3BytesInt2ByteAligned a0, Struct3BytesInt2ByteAligned a1, Struct3BytesInt2ByteAligned a2, Struct3BytesInt2ByteAligned a3, Struct3BytesInt2ByteAligned a4, Struct3BytesInt2ByteAligned a5, Struct3BytesInt2ByteAligned a6, Struct3BytesInt2ByteAligned a7, Struct3BytesInt2ByteAligned a8, Struct3BytesInt2ByteAligned a9))
 
DART_EXPORT intptr_t TestPassStruct4BytesHomogeneousInt16x10 (int64_t(*f)(Struct4BytesHomogeneousInt16 a0, Struct4BytesHomogeneousInt16 a1, Struct4BytesHomogeneousInt16 a2, Struct4BytesHomogeneousInt16 a3, Struct4BytesHomogeneousInt16 a4, Struct4BytesHomogeneousInt16 a5, Struct4BytesHomogeneousInt16 a6, Struct4BytesHomogeneousInt16 a7, Struct4BytesHomogeneousInt16 a8, Struct4BytesHomogeneousInt16 a9))
 
DART_EXPORT intptr_t TestPassStruct7BytesHomogeneousUint8x10 (int64_t(*f)(Struct7BytesHomogeneousUint8 a0, Struct7BytesHomogeneousUint8 a1, Struct7BytesHomogeneousUint8 a2, Struct7BytesHomogeneousUint8 a3, Struct7BytesHomogeneousUint8 a4, Struct7BytesHomogeneousUint8 a5, Struct7BytesHomogeneousUint8 a6, Struct7BytesHomogeneousUint8 a7, Struct7BytesHomogeneousUint8 a8, Struct7BytesHomogeneousUint8 a9))
 
DART_EXPORT intptr_t TestPassStruct7BytesInt4ByteAlignedx10 (int64_t(*f)(Struct7BytesInt4ByteAligned a0, Struct7BytesInt4ByteAligned a1, Struct7BytesInt4ByteAligned a2, Struct7BytesInt4ByteAligned a3, Struct7BytesInt4ByteAligned a4, Struct7BytesInt4ByteAligned a5, Struct7BytesInt4ByteAligned a6, Struct7BytesInt4ByteAligned a7, Struct7BytesInt4ByteAligned a8, Struct7BytesInt4ByteAligned a9))
 
DART_EXPORT intptr_t TestPassStruct8BytesIntx10 (int64_t(*f)(Struct8BytesInt a0, Struct8BytesInt a1, Struct8BytesInt a2, Struct8BytesInt a3, Struct8BytesInt a4, Struct8BytesInt a5, Struct8BytesInt a6, Struct8BytesInt a7, Struct8BytesInt a8, Struct8BytesInt a9))
 
DART_EXPORT intptr_t TestPassStruct8BytesHomogeneousFloatx10 (float(*f)(Struct8BytesHomogeneousFloat a0, Struct8BytesHomogeneousFloat a1, Struct8BytesHomogeneousFloat a2, Struct8BytesHomogeneousFloat a3, Struct8BytesHomogeneousFloat a4, Struct8BytesHomogeneousFloat a5, Struct8BytesHomogeneousFloat a6, Struct8BytesHomogeneousFloat a7, Struct8BytesHomogeneousFloat a8, Struct8BytesHomogeneousFloat a9))
 
DART_EXPORT intptr_t TestPassStruct8BytesMixedx10 (float(*f)(Struct8BytesMixed a0, Struct8BytesMixed a1, Struct8BytesMixed a2, Struct8BytesMixed a3, Struct8BytesMixed a4, Struct8BytesMixed a5, Struct8BytesMixed a6, Struct8BytesMixed a7, Struct8BytesMixed a8, Struct8BytesMixed a9))
 
DART_EXPORT intptr_t TestPassStruct9BytesHomogeneousUint8x10 (int64_t(*f)(Struct9BytesHomogeneousUint8 a0, Struct9BytesHomogeneousUint8 a1, Struct9BytesHomogeneousUint8 a2, Struct9BytesHomogeneousUint8 a3, Struct9BytesHomogeneousUint8 a4, Struct9BytesHomogeneousUint8 a5, Struct9BytesHomogeneousUint8 a6, Struct9BytesHomogeneousUint8 a7, Struct9BytesHomogeneousUint8 a8, Struct9BytesHomogeneousUint8 a9))
 
DART_EXPORT intptr_t TestPassStruct9BytesInt4Or8ByteAlignedx10 (int64_t(*f)(Struct9BytesInt4Or8ByteAligned a0, Struct9BytesInt4Or8ByteAligned a1, Struct9BytesInt4Or8ByteAligned a2, Struct9BytesInt4Or8ByteAligned a3, Struct9BytesInt4Or8ByteAligned a4, Struct9BytesInt4Or8ByteAligned a5, Struct9BytesInt4Or8ByteAligned a6, Struct9BytesInt4Or8ByteAligned a7, Struct9BytesInt4Or8ByteAligned a8, Struct9BytesInt4Or8ByteAligned a9))
 
DART_EXPORT intptr_t TestPassStruct12BytesHomogeneousFloatx6 (float(*f)(Struct12BytesHomogeneousFloat a0, Struct12BytesHomogeneousFloat a1, Struct12BytesHomogeneousFloat a2, Struct12BytesHomogeneousFloat a3, Struct12BytesHomogeneousFloat a4, Struct12BytesHomogeneousFloat a5))
 
DART_EXPORT intptr_t TestPassStruct16BytesHomogeneousFloatx5 (float(*f)(Struct16BytesHomogeneousFloat a0, Struct16BytesHomogeneousFloat a1, Struct16BytesHomogeneousFloat a2, Struct16BytesHomogeneousFloat a3, Struct16BytesHomogeneousFloat a4))
 
DART_EXPORT intptr_t TestPassStruct16BytesMixedx10 (double(*f)(Struct16BytesMixed a0, Struct16BytesMixed a1, Struct16BytesMixed a2, Struct16BytesMixed a3, Struct16BytesMixed a4, Struct16BytesMixed a5, Struct16BytesMixed a6, Struct16BytesMixed a7, Struct16BytesMixed a8, Struct16BytesMixed a9))
 
DART_EXPORT intptr_t TestPassStruct16BytesMixed2x10 (float(*f)(Struct16BytesMixed2 a0, Struct16BytesMixed2 a1, Struct16BytesMixed2 a2, Struct16BytesMixed2 a3, Struct16BytesMixed2 a4, Struct16BytesMixed2 a5, Struct16BytesMixed2 a6, Struct16BytesMixed2 a7, Struct16BytesMixed2 a8, Struct16BytesMixed2 a9))
 
DART_EXPORT intptr_t TestPassStruct17BytesIntx10 (int64_t(*f)(Struct17BytesInt a0, Struct17BytesInt a1, Struct17BytesInt a2, Struct17BytesInt a3, Struct17BytesInt a4, Struct17BytesInt a5, Struct17BytesInt a6, Struct17BytesInt a7, Struct17BytesInt a8, Struct17BytesInt a9))
 
DART_EXPORT intptr_t TestPassStruct19BytesHomogeneousUint8x10 (int64_t(*f)(Struct19BytesHomogeneousUint8 a0, Struct19BytesHomogeneousUint8 a1, Struct19BytesHomogeneousUint8 a2, Struct19BytesHomogeneousUint8 a3, Struct19BytesHomogeneousUint8 a4, Struct19BytesHomogeneousUint8 a5, Struct19BytesHomogeneousUint8 a6, Struct19BytesHomogeneousUint8 a7, Struct19BytesHomogeneousUint8 a8, Struct19BytesHomogeneousUint8 a9))
 
DART_EXPORT intptr_t TestPassStruct20BytesHomogeneousInt32x10 (int32_t(*f)(Struct20BytesHomogeneousInt32 a0, Struct20BytesHomogeneousInt32 a1, Struct20BytesHomogeneousInt32 a2, Struct20BytesHomogeneousInt32 a3, Struct20BytesHomogeneousInt32 a4, Struct20BytesHomogeneousInt32 a5, Struct20BytesHomogeneousInt32 a6, Struct20BytesHomogeneousInt32 a7, Struct20BytesHomogeneousInt32 a8, Struct20BytesHomogeneousInt32 a9))
 
DART_EXPORT intptr_t TestPassStruct20BytesHomogeneousFloat (float(*f)(Struct20BytesHomogeneousFloat a0))
 
DART_EXPORT intptr_t TestPassStruct32BytesHomogeneousDoublex5 (double(*f)(Struct32BytesHomogeneousDouble a0, Struct32BytesHomogeneousDouble a1, Struct32BytesHomogeneousDouble a2, Struct32BytesHomogeneousDouble a3, Struct32BytesHomogeneousDouble a4))
 
DART_EXPORT intptr_t TestPassStruct40BytesHomogeneousDouble (double(*f)(Struct40BytesHomogeneousDouble a0))
 
DART_EXPORT intptr_t TestPassStruct1024BytesHomogeneousUint64 (uint64_t(*f)(Struct1024BytesHomogeneousUint64 a0))
 
DART_EXPORT intptr_t TestPassFloatStruct16BytesHomogeneousFloatFloatStruct1 (float(*f)(float a0, Struct16BytesHomogeneousFloat a1, float a2, Struct16BytesHomogeneousFloat a3, float a4, Struct16BytesHomogeneousFloat a5, float a6, Struct16BytesHomogeneousFloat a7, float a8))
 
DART_EXPORT intptr_t TestPassFloatStruct32BytesHomogeneousDoubleFloatStruct (double(*f)(float a0, Struct32BytesHomogeneousDouble a1, float a2, Struct32BytesHomogeneousDouble a3, float a4, Struct32BytesHomogeneousDouble a5, float a6, Struct32BytesHomogeneousDouble a7, float a8))
 
DART_EXPORT intptr_t TestPassInt8Struct16BytesMixedInt8Struct16BytesMixedIn (double(*f)(int8_t a0, Struct16BytesMixed a1, int8_t a2, Struct16BytesMixed a3, int8_t a4, Struct16BytesMixed a5, int8_t a6, Struct16BytesMixed a7, int8_t a8))
 
DART_EXPORT intptr_t TestPassDoublex6Struct16BytesMixedx4Int32 (double(*f)(double a0, double a1, double a2, double a3, double a4, double a5, Struct16BytesMixed a6, Struct16BytesMixed a7, Struct16BytesMixed a8, Struct16BytesMixed a9, int32_t a10))
 
DART_EXPORT intptr_t TestPassInt32x4Struct16BytesMixedx4Double (double(*f)(int32_t a0, int32_t a1, int32_t a2, int32_t a3, Struct16BytesMixed a4, Struct16BytesMixed a5, Struct16BytesMixed a6, Struct16BytesMixed a7, double a8))
 
DART_EXPORT intptr_t TestPassStruct40BytesHomogeneousDoubleStruct4BytesHomo (double(*f)(Struct40BytesHomogeneousDouble a0, Struct4BytesHomogeneousInt16 a1, Struct8BytesHomogeneousFloat a2))
 
DART_EXPORT intptr_t TestPassInt32x8Doublex8Int64Int8Struct1ByteIntInt64Int (double(*f)(int32_t a0, int32_t a1, int32_t a2, int32_t a3, int32_t a4, int32_t a5, int32_t a6, int32_t a7, double a8, double a9, double a10, double a11, double a12, double a13, double a14, double a15, int64_t a16, int8_t a17, Struct1ByteInt a18, int64_t a19, int8_t a20, Struct4BytesHomogeneousInt16 a21, int64_t a22, int8_t a23, Struct8BytesInt a24, int64_t a25, int8_t a26, Struct8BytesHomogeneousFloat a27, int64_t a28, int8_t a29, Struct8BytesMixed a30, int64_t a31, int8_t a32, StructAlignmentInt16 a33, int64_t a34, int8_t a35, StructAlignmentInt32 a36, int64_t a37, int8_t a38, StructAlignmentInt64 a39))
 
DART_EXPORT intptr_t TestPassStructAlignmentInt16 (int64_t(*f)(StructAlignmentInt16 a0))
 
DART_EXPORT intptr_t TestPassStructAlignmentInt32 (int64_t(*f)(StructAlignmentInt32 a0))
 
DART_EXPORT intptr_t TestPassStructAlignmentInt64 (int64_t(*f)(StructAlignmentInt64 a0))
 
DART_EXPORT intptr_t TestPassStruct8BytesNestedIntx10 (int64_t(*f)(Struct8BytesNestedInt a0, Struct8BytesNestedInt a1, Struct8BytesNestedInt a2, Struct8BytesNestedInt a3, Struct8BytesNestedInt a4, Struct8BytesNestedInt a5, Struct8BytesNestedInt a6, Struct8BytesNestedInt a7, Struct8BytesNestedInt a8, Struct8BytesNestedInt a9))
 
DART_EXPORT intptr_t TestPassStruct8BytesNestedFloatx10 (float(*f)(Struct8BytesNestedFloat a0, Struct8BytesNestedFloat a1, Struct8BytesNestedFloat a2, Struct8BytesNestedFloat a3, Struct8BytesNestedFloat a4, Struct8BytesNestedFloat a5, Struct8BytesNestedFloat a6, Struct8BytesNestedFloat a7, Struct8BytesNestedFloat a8, Struct8BytesNestedFloat a9))
 
DART_EXPORT intptr_t TestPassStruct8BytesNestedFloat2x10 (float(*f)(Struct8BytesNestedFloat2 a0, Struct8BytesNestedFloat2 a1, Struct8BytesNestedFloat2 a2, Struct8BytesNestedFloat2 a3, Struct8BytesNestedFloat2 a4, Struct8BytesNestedFloat2 a5, Struct8BytesNestedFloat2 a6, Struct8BytesNestedFloat2 a7, Struct8BytesNestedFloat2 a8, Struct8BytesNestedFloat2 a9))
 
DART_EXPORT intptr_t TestPassStruct8BytesNestedMixedx10 (double(*f)(Struct8BytesNestedMixed a0, Struct8BytesNestedMixed a1, Struct8BytesNestedMixed a2, Struct8BytesNestedMixed a3, Struct8BytesNestedMixed a4, Struct8BytesNestedMixed a5, Struct8BytesNestedMixed a6, Struct8BytesNestedMixed a7, Struct8BytesNestedMixed a8, Struct8BytesNestedMixed a9))
 
DART_EXPORT intptr_t TestPassStruct16BytesNestedIntx2 (int64_t(*f)(Struct16BytesNestedInt a0, Struct16BytesNestedInt a1))
 
DART_EXPORT intptr_t TestPassStruct32BytesNestedIntx2 (int64_t(*f)(Struct32BytesNestedInt a0, Struct32BytesNestedInt a1))
 
DART_EXPORT intptr_t TestPassStructNestedIntStructAlignmentInt16 (int64_t(*f)(StructNestedIntStructAlignmentInt16 a0))
 
DART_EXPORT intptr_t TestPassStructNestedIntStructAlignmentInt32 (int64_t(*f)(StructNestedIntStructAlignmentInt32 a0))
 
DART_EXPORT intptr_t TestPassStructNestedIntStructAlignmentInt64 (int64_t(*f)(StructNestedIntStructAlignmentInt64 a0))
 
DART_EXPORT intptr_t TestPassStructNestedIrregularEvenBiggerx4 (double(*f)(StructNestedIrregularEvenBigger a0, StructNestedIrregularEvenBigger a1, StructNestedIrregularEvenBigger a2, StructNestedIrregularEvenBigger a3))
 
DART_EXPORT intptr_t TestPassStruct8BytesInlineArrayIntx4 (int32_t(*f)(Struct8BytesInlineArrayInt a0, Struct8BytesInlineArrayInt a1, Struct8BytesInlineArrayInt a2, Struct8BytesInlineArrayInt a3))
 
DART_EXPORT intptr_t TestPassStructInlineArrayIrregularx4 (int32_t(*f)(StructInlineArrayIrregular a0, StructInlineArrayIrregular a1, StructInlineArrayIrregular a2, StructInlineArrayIrregular a3))
 
DART_EXPORT intptr_t TestPassStructInlineArray100Bytes (int32_t(*f)(StructInlineArray100Bytes a0))
 
DART_EXPORT intptr_t TestPassStructStruct16BytesHomogeneousFloat2x5 (float(*f)(StructStruct16BytesHomogeneousFloat2 a0, StructStruct16BytesHomogeneousFloat2 a1, StructStruct16BytesHomogeneousFloat2 a2, StructStruct16BytesHomogeneousFloat2 a3, StructStruct16BytesHomogeneousFloat2 a4))
 
DART_EXPORT intptr_t TestPassStructStruct32BytesHomogeneousDouble2x5 (double(*f)(StructStruct32BytesHomogeneousDouble2 a0, StructStruct32BytesHomogeneousDouble2 a1, StructStruct32BytesHomogeneousDouble2 a2, StructStruct32BytesHomogeneousDouble2 a3, StructStruct32BytesHomogeneousDouble2 a4))
 
DART_EXPORT intptr_t TestPassStructStruct16BytesMixed3x10 (float(*f)(StructStruct16BytesMixed3 a0, StructStruct16BytesMixed3 a1, StructStruct16BytesMixed3 a2, StructStruct16BytesMixed3 a3, StructStruct16BytesMixed3 a4, StructStruct16BytesMixed3 a5, StructStruct16BytesMixed3 a6, StructStruct16BytesMixed3 a7, StructStruct16BytesMixed3 a8, StructStruct16BytesMixed3 a9))
 
DART_EXPORT intptr_t TestPassUint8Struct32BytesInlineArrayMultiDimensionalI (uint32_t(*f)(uint8_t a0, Struct32BytesInlineArrayMultiDimensionalInt a1, uint8_t a2, Struct8BytesInlineArrayMultiDimensionalInt a3, uint8_t a4, Struct8BytesInlineArrayMultiDimensionalInt a5, uint8_t a6))
 
DART_EXPORT intptr_t TestPassUint8Struct4BytesInlineArrayMultiDimensionalIn (uint32_t(*f)(uint8_t a0, Struct4BytesInlineArrayMultiDimensionalInt a1, uint8_t a2))
 
DART_EXPORT intptr_t TestPassStruct3BytesPackedIntx10 (int64_t(*f)(Struct3BytesPackedInt a0, Struct3BytesPackedInt a1, Struct3BytesPackedInt a2, Struct3BytesPackedInt a3, Struct3BytesPackedInt a4, Struct3BytesPackedInt a5, Struct3BytesPackedInt a6, Struct3BytesPackedInt a7, Struct3BytesPackedInt a8, Struct3BytesPackedInt a9))
 
DART_EXPORT intptr_t TestPassStruct8BytesPackedIntx10 (int64_t(*f)(Struct8BytesPackedInt a0, Struct8BytesPackedInt a1, Struct8BytesPackedInt a2, Struct8BytesPackedInt a3, Struct8BytesPackedInt a4, Struct8BytesPackedInt a5, Struct8BytesPackedInt a6, Struct8BytesPackedInt a7, Struct8BytesPackedInt a8, Struct8BytesPackedInt a9))
 
DART_EXPORT intptr_t TestPassStruct9BytesPackedMixedx10DoubleInt32x2 (double(*f)(Struct9BytesPackedMixed a0, Struct9BytesPackedMixed a1, Struct9BytesPackedMixed a2, Struct9BytesPackedMixed a3, Struct9BytesPackedMixed a4, Struct9BytesPackedMixed a5, Struct9BytesPackedMixed a6, Struct9BytesPackedMixed a7, Struct9BytesPackedMixed a8, Struct9BytesPackedMixed a9, double a10, int32_t a11, int32_t a12))
 
DART_EXPORT intptr_t TestPassStruct5BytesPackedMixed (double(*f)(Struct5BytesPackedMixed a0))
 
DART_EXPORT intptr_t TestPassStructNestedAlignmentStruct5BytesPackedMixed (double(*f)(StructNestedAlignmentStruct5BytesPackedMixed a0))
 
DART_EXPORT intptr_t TestPassStruct6BytesInlineArrayInt (double(*f)(Struct6BytesInlineArrayInt a0))
 
DART_EXPORT intptr_t TestPassStruct15BytesInlineArrayMixed (double(*f)(Struct15BytesInlineArrayMixed a0))
 
DART_EXPORT intptr_t TestPassUnion4BytesMixedx10 (double(*f)(Union4BytesMixed a0, Union4BytesMixed a1, Union4BytesMixed a2, Union4BytesMixed a3, Union4BytesMixed a4, Union4BytesMixed a5, Union4BytesMixed a6, Union4BytesMixed a7, Union4BytesMixed a8, Union4BytesMixed a9))
 
DART_EXPORT intptr_t TestPassUnion8BytesNestedFloatx10 (double(*f)(Union8BytesNestedFloat a0, Union8BytesNestedFloat a1, Union8BytesNestedFloat a2, Union8BytesNestedFloat a3, Union8BytesNestedFloat a4, Union8BytesNestedFloat a5, Union8BytesNestedFloat a6, Union8BytesNestedFloat a7, Union8BytesNestedFloat a8, Union8BytesNestedFloat a9))
 
DART_EXPORT intptr_t TestPassUnion9BytesNestedIntx10 (double(*f)(Union9BytesNestedInt a0, Union9BytesNestedInt a1, Union9BytesNestedInt a2, Union9BytesNestedInt a3, Union9BytesNestedInt a4, Union9BytesNestedInt a5, Union9BytesNestedInt a6, Union9BytesNestedInt a7, Union9BytesNestedInt a8, Union9BytesNestedInt a9))
 
DART_EXPORT intptr_t TestPassUnion16BytesNestedInlineArrayFloatx10 (double(*f)(Union16BytesNestedInlineArrayFloat a0, Union16BytesNestedInlineArrayFloat a1, Union16BytesNestedInlineArrayFloat a2, Union16BytesNestedInlineArrayFloat a3, Union16BytesNestedInlineArrayFloat a4, Union16BytesNestedInlineArrayFloat a5, Union16BytesNestedInlineArrayFloat a6, Union16BytesNestedInlineArrayFloat a7, Union16BytesNestedInlineArrayFloat a8, Union16BytesNestedInlineArrayFloat a9))
 
DART_EXPORT intptr_t TestPassUnion16BytesNestedFloatx10 (double(*f)(Union16BytesNestedFloat a0, Union16BytesNestedFloat a1, Union16BytesNestedFloat a2, Union16BytesNestedFloat a3, Union16BytesNestedFloat a4, Union16BytesNestedFloat a5, Union16BytesNestedFloat a6, Union16BytesNestedFloat a7, Union16BytesNestedFloat a8, Union16BytesNestedFloat a9))
 
DART_EXPORT intptr_t TestPassUint8Boolx9Struct10BytesHomogeneousBoolBool (int32_t(*f)(uint8_t a0, bool a1, bool a2, bool a3, bool a4, bool a5, bool a6, bool a7, bool a8, bool a9, Struct10BytesHomogeneousBool a10, bool a11))
 
DART_EXPORT intptr_t TestPassUint8Boolx9Struct10BytesInlineArrayBoolBool (int32_t(*f)(uint8_t a0, bool a1, bool a2, bool a3, bool a4, bool a5, bool a6, bool a7, bool a8, bool a9, Struct10BytesInlineArrayBool a10, bool a11))
 
DART_EXPORT intptr_t TestPassUint8Struct1ByteBool (bool(*f)(uint8_t a0, Struct1ByteBool a1))
 
DART_EXPORT intptr_t TestPassWCharStructInlineArrayIntUintPtrx2LongUnsigned (wchar_t(*f)(wchar_t a0, StructInlineArrayInt a1, uintptr_t a2, uintptr_t a3, long a4, unsigned long a5))
 
DART_EXPORT intptr_t TestPassInt64x7Struct12BytesHomogeneousInt32 (int64_t(*f)(int64_t a0, int64_t a1, int64_t a2, int64_t a3, int64_t a4, int64_t a5, int64_t a6, Struct12BytesHomogeneousInt32 a7))
 
DART_EXPORT intptr_t TestReturnStruct1ByteInt (Struct1ByteInt(*f)(int8_t a0))
 
DART_EXPORT intptr_t TestReturnStruct3BytesHomogeneousUint8 (Struct3BytesHomogeneousUint8(*f)(uint8_t a0, uint8_t a1, uint8_t a2))
 
DART_EXPORT intptr_t TestReturnStruct3BytesInt2ByteAligned (Struct3BytesInt2ByteAligned(*f)(int16_t a0, int8_t a1))
 
DART_EXPORT intptr_t TestReturnStruct4BytesHomogeneousInt16 (Struct4BytesHomogeneousInt16(*f)(int16_t a0, int16_t a1))
 
DART_EXPORT intptr_t TestReturnStruct7BytesHomogeneousUint8 (Struct7BytesHomogeneousUint8(*f)(uint8_t a0, uint8_t a1, uint8_t a2, uint8_t a3, uint8_t a4, uint8_t a5, uint8_t a6))
 
DART_EXPORT intptr_t TestReturnStruct7BytesInt4ByteAligned (Struct7BytesInt4ByteAligned(*f)(int32_t a0, int16_t a1, int8_t a2))
 
DART_EXPORT intptr_t TestReturnStruct8BytesInt (Struct8BytesInt(*f)(int16_t a0, int16_t a1, int32_t a2))
 
DART_EXPORT intptr_t TestReturnStruct8BytesHomogeneousFloat (Struct8BytesHomogeneousFloat(*f)(float a0, float a1))
 
DART_EXPORT intptr_t TestReturnStruct8BytesMixed (Struct8BytesMixed(*f)(float a0, int16_t a1, int16_t a2))
 
DART_EXPORT intptr_t TestReturnStruct9BytesHomogeneousUint8 (Struct9BytesHomogeneousUint8(*f)(uint8_t a0, uint8_t a1, uint8_t a2, uint8_t a3, uint8_t a4, uint8_t a5, uint8_t a6, uint8_t a7, uint8_t a8))
 
DART_EXPORT intptr_t TestReturnStruct9BytesInt4Or8ByteAligned (Struct9BytesInt4Or8ByteAligned(*f)(int64_t a0, int8_t a1))
 
DART_EXPORT intptr_t TestReturnStruct12BytesHomogeneousFloat (Struct12BytesHomogeneousFloat(*f)(float a0, float a1, float a2))
 
DART_EXPORT intptr_t TestReturnStruct16BytesHomogeneousFloat (Struct16BytesHomogeneousFloat(*f)(float a0, float a1, float a2, float a3))
 
DART_EXPORT intptr_t TestReturnStruct16BytesMixed (Struct16BytesMixed(*f)(double a0, int64_t a1))
 
DART_EXPORT intptr_t TestReturnStruct16BytesMixed2 (Struct16BytesMixed2(*f)(float a0, float a1, float a2, int32_t a3))
 
DART_EXPORT intptr_t TestReturnStruct17BytesInt (Struct17BytesInt(*f)(int64_t a0, int64_t a1, int8_t a2))
 
DART_EXPORT intptr_t TestReturnStruct19BytesHomogeneousUint8 (Struct19BytesHomogeneousUint8(*f)(uint8_t a0, uint8_t a1, uint8_t a2, uint8_t a3, uint8_t a4, uint8_t a5, uint8_t a6, uint8_t a7, uint8_t a8, uint8_t a9, uint8_t a10, uint8_t a11, uint8_t a12, uint8_t a13, uint8_t a14, uint8_t a15, uint8_t a16, uint8_t a17, uint8_t a18))
 
DART_EXPORT intptr_t TestReturnStruct20BytesHomogeneousInt32 (Struct20BytesHomogeneousInt32(*f)(int32_t a0, int32_t a1, int32_t a2, int32_t a3, int32_t a4))
 
DART_EXPORT intptr_t TestReturnStruct20BytesHomogeneousFloat (Struct20BytesHomogeneousFloat(*f)(float a0, float a1, float a2, float a3, float a4))
 
DART_EXPORT intptr_t TestReturnStruct32BytesHomogeneousDouble (Struct32BytesHomogeneousDouble(*f)(double a0, double a1, double a2, double a3))
 
DART_EXPORT intptr_t TestReturnStruct40BytesHomogeneousDouble (Struct40BytesHomogeneousDouble(*f)(double a0, double a1, double a2, double a3, double a4))
 
DART_EXPORT intptr_t TestReturnStruct1024BytesHomogeneousUint64 (Struct1024BytesHomogeneousUint64(*f)(uint64_t a0, uint64_t a1, uint64_t a2, uint64_t a3, uint64_t a4, uint64_t a5, uint64_t a6, uint64_t a7, uint64_t a8, uint64_t a9, uint64_t a10, uint64_t a11, uint64_t a12, uint64_t a13, uint64_t a14, uint64_t a15, uint64_t a16, uint64_t a17, uint64_t a18, uint64_t a19, uint64_t a20, uint64_t a21, uint64_t a22, uint64_t a23, uint64_t a24, uint64_t a25, uint64_t a26, uint64_t a27, uint64_t a28, uint64_t a29, uint64_t a30, uint64_t a31, uint64_t a32, uint64_t a33, uint64_t a34, uint64_t a35, uint64_t a36, uint64_t a37, uint64_t a38, uint64_t a39, uint64_t a40, uint64_t a41, uint64_t a42, uint64_t a43, uint64_t a44, uint64_t a45, uint64_t a46, uint64_t a47, uint64_t a48, uint64_t a49, uint64_t a50, uint64_t a51, uint64_t a52, uint64_t a53, uint64_t a54, uint64_t a55, uint64_t a56, uint64_t a57, uint64_t a58, uint64_t a59, uint64_t a60, uint64_t a61, uint64_t a62, uint64_t a63, uint64_t a64, uint64_t a65, uint64_t a66, uint64_t a67, uint64_t a68, uint64_t a69, uint64_t a70, uint64_t a71, uint64_t a72, uint64_t a73, uint64_t a74, uint64_t a75, uint64_t a76, uint64_t a77, uint64_t a78, uint64_t a79, uint64_t a80, uint64_t a81, uint64_t a82, uint64_t a83, uint64_t a84, uint64_t a85, uint64_t a86, uint64_t a87, uint64_t a88, uint64_t a89, uint64_t a90, uint64_t a91, uint64_t a92, uint64_t a93, uint64_t a94, uint64_t a95, uint64_t a96, uint64_t a97, uint64_t a98, uint64_t a99, uint64_t a100, uint64_t a101, uint64_t a102, uint64_t a103, uint64_t a104, uint64_t a105, uint64_t a106, uint64_t a107, uint64_t a108, uint64_t a109, uint64_t a110, uint64_t a111, uint64_t a112, uint64_t a113, uint64_t a114, uint64_t a115, uint64_t a116, uint64_t a117, uint64_t a118, uint64_t a119, uint64_t a120, uint64_t a121, uint64_t a122, uint64_t a123, uint64_t a124, uint64_t a125, uint64_t a126, uint64_t a127))
 
DART_EXPORT intptr_t TestReturnStruct3BytesPackedInt (Struct3BytesPackedInt(*f)(int8_t a0, int16_t a1))
 
DART_EXPORT intptr_t TestReturnStruct8BytesPackedInt (Struct8BytesPackedInt(*f)(uint8_t a0, uint32_t a1, uint8_t a2, uint8_t a3, uint8_t a4))
 
DART_EXPORT intptr_t TestReturnStruct9BytesPackedMixed (Struct9BytesPackedMixed(*f)(uint8_t a0, double a1))
 
DART_EXPORT intptr_t TestReturnUnion4BytesMixed (Union4BytesMixed(*f)(uint32_t a0))
 
DART_EXPORT intptr_t TestReturnUnion8BytesNestedFloat (Union8BytesNestedFloat(*f)(double a0))
 
DART_EXPORT intptr_t TestReturnUnion9BytesNestedInt (Union9BytesNestedInt(*f)(Struct8BytesInt a0))
 
DART_EXPORT intptr_t TestReturnUnion16BytesNestedFloat (Union16BytesNestedFloat(*f)(Struct8BytesHomogeneousFloat a0))
 
DART_EXPORT intptr_t TestReturnStructArgumentStruct1ByteInt (Struct1ByteInt(*f)(Struct1ByteInt a0))
 
DART_EXPORT intptr_t TestReturnStructArgumentInt32x8Struct1ByteInt (Struct1ByteInt(*f)(int32_t a0, int32_t a1, int32_t a2, int32_t a3, int32_t a4, int32_t a5, int32_t a6, int32_t a7, Struct1ByteInt a8))
 
DART_EXPORT intptr_t TestReturnStructArgumentStruct8BytesHomogeneousFloat (Struct8BytesHomogeneousFloat(*f)(Struct8BytesHomogeneousFloat a0))
 
DART_EXPORT intptr_t TestReturnStructArgumentStruct20BytesHomogeneousInt32 (Struct20BytesHomogeneousInt32(*f)(Struct20BytesHomogeneousInt32 a0))
 
DART_EXPORT intptr_t TestReturnStructArgumentInt32x8Struct20BytesHomogeneou (Struct20BytesHomogeneousInt32(*f)(int32_t a0, int32_t a1, int32_t a2, int32_t a3, int32_t a4, int32_t a5, int32_t a6, int32_t a7, Struct20BytesHomogeneousInt32 a8))
 
DART_EXPORT intptr_t TestReturnStructArgumentStruct8BytesInlineArrayInt (Struct8BytesInlineArrayInt(*f)(Struct8BytesInlineArrayInt a0))
 
DART_EXPORT intptr_t TestReturnStructArgumentStructStruct16BytesHomogeneous (StructStruct16BytesHomogeneousFloat2(*f)(StructStruct16BytesHomogeneousFloat2 a0))
 
DART_EXPORT intptr_t TestReturnStructArgumentStructStruct32BytesHomogeneous (StructStruct32BytesHomogeneousDouble2(*f)(StructStruct32BytesHomogeneousDouble2 a0))
 
DART_EXPORT intptr_t TestReturnStructArgumentStructStruct16BytesMixed3 (StructStruct16BytesMixed3(*f)(StructStruct16BytesMixed3 a0))
 
DART_EXPORT intptr_t TestReturnStructAlignmentInt16 (StructAlignmentInt16(*f)(int8_t a0, int16_t a1, int8_t a2))
 
DART_EXPORT intptr_t TestReturnStructAlignmentInt32 (StructAlignmentInt32(*f)(int8_t a0, int32_t a1, int8_t a2))
 
DART_EXPORT intptr_t TestReturnStructAlignmentInt64 (StructAlignmentInt64(*f)(int8_t a0, int64_t a1, int8_t a2))
 
DART_EXPORT intptr_t TestReturnStruct8BytesNestedInt (Struct8BytesNestedInt(*f)(Struct4BytesHomogeneousInt16 a0, Struct4BytesHomogeneousInt16 a1))
 
DART_EXPORT intptr_t TestReturnStruct8BytesNestedFloat (Struct8BytesNestedFloat(*f)(Struct4BytesFloat a0, Struct4BytesFloat a1))
 
DART_EXPORT intptr_t TestReturnStruct8BytesNestedFloat2 (Struct8BytesNestedFloat2(*f)(Struct4BytesFloat a0, float a1))
 
DART_EXPORT intptr_t TestReturnStruct8BytesNestedMixed (Struct8BytesNestedMixed(*f)(Struct4BytesHomogeneousInt16 a0, Struct4BytesFloat a1))
 
DART_EXPORT intptr_t TestReturnStruct16BytesNestedInt (Struct16BytesNestedInt(*f)(Struct8BytesNestedInt a0, Struct8BytesNestedInt a1))
 
DART_EXPORT intptr_t TestReturnStruct32BytesNestedInt (Struct32BytesNestedInt(*f)(Struct16BytesNestedInt a0, Struct16BytesNestedInt a1))
 
DART_EXPORT intptr_t TestReturnStructNestedIntStructAlignmentInt16 (StructNestedIntStructAlignmentInt16(*f)(StructAlignmentInt16 a0, StructAlignmentInt16 a1))
 
DART_EXPORT intptr_t TestReturnStructNestedIntStructAlignmentInt32 (StructNestedIntStructAlignmentInt32(*f)(StructAlignmentInt32 a0, StructAlignmentInt32 a1))
 
DART_EXPORT intptr_t TestReturnStructNestedIntStructAlignmentInt64 (StructNestedIntStructAlignmentInt64(*f)(StructAlignmentInt64 a0, StructAlignmentInt64 a1))
 
DART_EXPORT intptr_t TestReturnStructNestedIrregularEvenBigger (StructNestedIrregularEvenBigger(*f)(uint64_t a0, StructNestedIrregularBigger a1, StructNestedIrregularBigger a2, double a3))
 
DART_EXPORT void TestAsyncPassStruct1ByteIntx10 (void(*f)(Struct1ByteInt a0, Struct1ByteInt a1, Struct1ByteInt a2, Struct1ByteInt a3, Struct1ByteInt a4, Struct1ByteInt a5, Struct1ByteInt a6, Struct1ByteInt a7, Struct1ByteInt a8, Struct1ByteInt a9))
 
DART_EXPORT void TestAsyncPassStruct3BytesHomogeneousUint8x10 (void(*f)(Struct3BytesHomogeneousUint8 a0, Struct3BytesHomogeneousUint8 a1, Struct3BytesHomogeneousUint8 a2, Struct3BytesHomogeneousUint8 a3, Struct3BytesHomogeneousUint8 a4, Struct3BytesHomogeneousUint8 a5, Struct3BytesHomogeneousUint8 a6, Struct3BytesHomogeneousUint8 a7, Struct3BytesHomogeneousUint8 a8, Struct3BytesHomogeneousUint8 a9))
 
DART_EXPORT void TestAsyncPassStruct3BytesInt2ByteAlignedx10 (void(*f)(Struct3BytesInt2ByteAligned a0, Struct3BytesInt2ByteAligned a1, Struct3BytesInt2ByteAligned a2, Struct3BytesInt2ByteAligned a3, Struct3BytesInt2ByteAligned a4, Struct3BytesInt2ByteAligned a5, Struct3BytesInt2ByteAligned a6, Struct3BytesInt2ByteAligned a7, Struct3BytesInt2ByteAligned a8, Struct3BytesInt2ByteAligned a9))
 
DART_EXPORT void TestAsyncPassStruct4BytesHomogeneousInt16x10 (void(*f)(Struct4BytesHomogeneousInt16 a0, Struct4BytesHomogeneousInt16 a1, Struct4BytesHomogeneousInt16 a2, Struct4BytesHomogeneousInt16 a3, Struct4BytesHomogeneousInt16 a4, Struct4BytesHomogeneousInt16 a5, Struct4BytesHomogeneousInt16 a6, Struct4BytesHomogeneousInt16 a7, Struct4BytesHomogeneousInt16 a8, Struct4BytesHomogeneousInt16 a9))
 
DART_EXPORT void TestAsyncPassStruct7BytesHomogeneousUint8x10 (void(*f)(Struct7BytesHomogeneousUint8 a0, Struct7BytesHomogeneousUint8 a1, Struct7BytesHomogeneousUint8 a2, Struct7BytesHomogeneousUint8 a3, Struct7BytesHomogeneousUint8 a4, Struct7BytesHomogeneousUint8 a5, Struct7BytesHomogeneousUint8 a6, Struct7BytesHomogeneousUint8 a7, Struct7BytesHomogeneousUint8 a8, Struct7BytesHomogeneousUint8 a9))
 
DART_EXPORT void TestAsyncPassStruct7BytesInt4ByteAlignedx10 (void(*f)(Struct7BytesInt4ByteAligned a0, Struct7BytesInt4ByteAligned a1, Struct7BytesInt4ByteAligned a2, Struct7BytesInt4ByteAligned a3, Struct7BytesInt4ByteAligned a4, Struct7BytesInt4ByteAligned a5, Struct7BytesInt4ByteAligned a6, Struct7BytesInt4ByteAligned a7, Struct7BytesInt4ByteAligned a8, Struct7BytesInt4ByteAligned a9))
 
DART_EXPORT void TestAsyncPassStruct8BytesIntx10 (void(*f)(Struct8BytesInt a0, Struct8BytesInt a1, Struct8BytesInt a2, Struct8BytesInt a3, Struct8BytesInt a4, Struct8BytesInt a5, Struct8BytesInt a6, Struct8BytesInt a7, Struct8BytesInt a8, Struct8BytesInt a9))
 
DART_EXPORT void TestAsyncPassStruct8BytesHomogeneousFloatx10 (void(*f)(Struct8BytesHomogeneousFloat a0, Struct8BytesHomogeneousFloat a1, Struct8BytesHomogeneousFloat a2, Struct8BytesHomogeneousFloat a3, Struct8BytesHomogeneousFloat a4, Struct8BytesHomogeneousFloat a5, Struct8BytesHomogeneousFloat a6, Struct8BytesHomogeneousFloat a7, Struct8BytesHomogeneousFloat a8, Struct8BytesHomogeneousFloat a9))
 
DART_EXPORT void TestAsyncPassStruct8BytesMixedx10 (void(*f)(Struct8BytesMixed a0, Struct8BytesMixed a1, Struct8BytesMixed a2, Struct8BytesMixed a3, Struct8BytesMixed a4, Struct8BytesMixed a5, Struct8BytesMixed a6, Struct8BytesMixed a7, Struct8BytesMixed a8, Struct8BytesMixed a9))
 
DART_EXPORT void TestAsyncPassStruct9BytesHomogeneousUint8x10 (void(*f)(Struct9BytesHomogeneousUint8 a0, Struct9BytesHomogeneousUint8 a1, Struct9BytesHomogeneousUint8 a2, Struct9BytesHomogeneousUint8 a3, Struct9BytesHomogeneousUint8 a4, Struct9BytesHomogeneousUint8 a5, Struct9BytesHomogeneousUint8 a6, Struct9BytesHomogeneousUint8 a7, Struct9BytesHomogeneousUint8 a8, Struct9BytesHomogeneousUint8 a9))
 
DART_EXPORT void TestAsyncPassStruct9BytesInt4Or8ByteAlignedx10 (void(*f)(Struct9BytesInt4Or8ByteAligned a0, Struct9BytesInt4Or8ByteAligned a1, Struct9BytesInt4Or8ByteAligned a2, Struct9BytesInt4Or8ByteAligned a3, Struct9BytesInt4Or8ByteAligned a4, Struct9BytesInt4Or8ByteAligned a5, Struct9BytesInt4Or8ByteAligned a6, Struct9BytesInt4Or8ByteAligned a7, Struct9BytesInt4Or8ByteAligned a8, Struct9BytesInt4Or8ByteAligned a9))
 
DART_EXPORT void TestAsyncPassStruct12BytesHomogeneousFloatx6 (void(*f)(Struct12BytesHomogeneousFloat a0, Struct12BytesHomogeneousFloat a1, Struct12BytesHomogeneousFloat a2, Struct12BytesHomogeneousFloat a3, Struct12BytesHomogeneousFloat a4, Struct12BytesHomogeneousFloat a5))
 
DART_EXPORT void TestAsyncPassStruct16BytesHomogeneousFloatx5 (void(*f)(Struct16BytesHomogeneousFloat a0, Struct16BytesHomogeneousFloat a1, Struct16BytesHomogeneousFloat a2, Struct16BytesHomogeneousFloat a3, Struct16BytesHomogeneousFloat a4))
 
DART_EXPORT void TestAsyncPassStruct16BytesMixedx10 (void(*f)(Struct16BytesMixed a0, Struct16BytesMixed a1, Struct16BytesMixed a2, Struct16BytesMixed a3, Struct16BytesMixed a4, Struct16BytesMixed a5, Struct16BytesMixed a6, Struct16BytesMixed a7, Struct16BytesMixed a8, Struct16BytesMixed a9))
 
DART_EXPORT void TestAsyncPassStruct16BytesMixed2x10 (void(*f)(Struct16BytesMixed2 a0, Struct16BytesMixed2 a1, Struct16BytesMixed2 a2, Struct16BytesMixed2 a3, Struct16BytesMixed2 a4, Struct16BytesMixed2 a5, Struct16BytesMixed2 a6, Struct16BytesMixed2 a7, Struct16BytesMixed2 a8, Struct16BytesMixed2 a9))
 
DART_EXPORT void TestAsyncPassStruct17BytesIntx10 (void(*f)(Struct17BytesInt a0, Struct17BytesInt a1, Struct17BytesInt a2, Struct17BytesInt a3, Struct17BytesInt a4, Struct17BytesInt a5, Struct17BytesInt a6, Struct17BytesInt a7, Struct17BytesInt a8, Struct17BytesInt a9))
 
DART_EXPORT void TestAsyncPassStruct19BytesHomogeneousUint8x10 (void(*f)(Struct19BytesHomogeneousUint8 a0, Struct19BytesHomogeneousUint8 a1, Struct19BytesHomogeneousUint8 a2, Struct19BytesHomogeneousUint8 a3, Struct19BytesHomogeneousUint8 a4, Struct19BytesHomogeneousUint8 a5, Struct19BytesHomogeneousUint8 a6, Struct19BytesHomogeneousUint8 a7, Struct19BytesHomogeneousUint8 a8, Struct19BytesHomogeneousUint8 a9))
 
DART_EXPORT void TestAsyncPassStruct20BytesHomogeneousInt32x10 (void(*f)(Struct20BytesHomogeneousInt32 a0, Struct20BytesHomogeneousInt32 a1, Struct20BytesHomogeneousInt32 a2, Struct20BytesHomogeneousInt32 a3, Struct20BytesHomogeneousInt32 a4, Struct20BytesHomogeneousInt32 a5, Struct20BytesHomogeneousInt32 a6, Struct20BytesHomogeneousInt32 a7, Struct20BytesHomogeneousInt32 a8, Struct20BytesHomogeneousInt32 a9))
 
DART_EXPORT void TestAsyncPassStruct20BytesHomogeneousFloat (void(*f)(Struct20BytesHomogeneousFloat a0))
 
DART_EXPORT void TestAsyncPassStruct32BytesHomogeneousDoublex5 (void(*f)(Struct32BytesHomogeneousDouble a0, Struct32BytesHomogeneousDouble a1, Struct32BytesHomogeneousDouble a2, Struct32BytesHomogeneousDouble a3, Struct32BytesHomogeneousDouble a4))
 
DART_EXPORT void TestAsyncPassStruct40BytesHomogeneousDouble (void(*f)(Struct40BytesHomogeneousDouble a0))
 
DART_EXPORT void TestAsyncPassStruct1024BytesHomogeneousUint64 (void(*f)(Struct1024BytesHomogeneousUint64 a0))
 
DART_EXPORT void TestAsyncPassFloatStruct16BytesHomogeneousFloatFloatStruct1 (void(*f)(float a0, Struct16BytesHomogeneousFloat a1, float a2, Struct16BytesHomogeneousFloat a3, float a4, Struct16BytesHomogeneousFloat a5, float a6, Struct16BytesHomogeneousFloat a7, float a8))
 
DART_EXPORT void TestAsyncPassFloatStruct32BytesHomogeneousDoubleFloatStruct (void(*f)(float a0, Struct32BytesHomogeneousDouble a1, float a2, Struct32BytesHomogeneousDouble a3, float a4, Struct32BytesHomogeneousDouble a5, float a6, Struct32BytesHomogeneousDouble a7, float a8))
 
DART_EXPORT void TestAsyncPassInt8Struct16BytesMixedInt8Struct16BytesMixedIn (void(*f)(int8_t a0, Struct16BytesMixed a1, int8_t a2, Struct16BytesMixed a3, int8_t a4, Struct16BytesMixed a5, int8_t a6, Struct16BytesMixed a7, int8_t a8))
 
DART_EXPORT void TestAsyncPassDoublex6Struct16BytesMixedx4Int32 (void(*f)(double a0, double a1, double a2, double a3, double a4, double a5, Struct16BytesMixed a6, Struct16BytesMixed a7, Struct16BytesMixed a8, Struct16BytesMixed a9, int32_t a10))
 
DART_EXPORT void TestAsyncPassInt32x4Struct16BytesMixedx4Double (void(*f)(int32_t a0, int32_t a1, int32_t a2, int32_t a3, Struct16BytesMixed a4, Struct16BytesMixed a5, Struct16BytesMixed a6, Struct16BytesMixed a7, double a8))
 
DART_EXPORT void TestAsyncPassStruct40BytesHomogeneousDoubleStruct4BytesHomo (void(*f)(Struct40BytesHomogeneousDouble a0, Struct4BytesHomogeneousInt16 a1, Struct8BytesHomogeneousFloat a2))
 
DART_EXPORT void TestAsyncPassInt32x8Doublex8Int64Int8Struct1ByteIntInt64Int (void(*f)(int32_t a0, int32_t a1, int32_t a2, int32_t a3, int32_t a4, int32_t a5, int32_t a6, int32_t a7, double a8, double a9, double a10, double a11, double a12, double a13, double a14, double a15, int64_t a16, int8_t a17, Struct1ByteInt a18, int64_t a19, int8_t a20, Struct4BytesHomogeneousInt16 a21, int64_t a22, int8_t a23, Struct8BytesInt a24, int64_t a25, int8_t a26, Struct8BytesHomogeneousFloat a27, int64_t a28, int8_t a29, Struct8BytesMixed a30, int64_t a31, int8_t a32, StructAlignmentInt16 a33, int64_t a34, int8_t a35, StructAlignmentInt32 a36, int64_t a37, int8_t a38, StructAlignmentInt64 a39))
 
DART_EXPORT void TestAsyncPassStructAlignmentInt16 (void(*f)(StructAlignmentInt16 a0))
 
DART_EXPORT void TestAsyncPassStructAlignmentInt32 (void(*f)(StructAlignmentInt32 a0))
 
DART_EXPORT void TestAsyncPassStructAlignmentInt64 (void(*f)(StructAlignmentInt64 a0))
 
DART_EXPORT void TestAsyncPassStruct8BytesNestedIntx10 (void(*f)(Struct8BytesNestedInt a0, Struct8BytesNestedInt a1, Struct8BytesNestedInt a2, Struct8BytesNestedInt a3, Struct8BytesNestedInt a4, Struct8BytesNestedInt a5, Struct8BytesNestedInt a6, Struct8BytesNestedInt a7, Struct8BytesNestedInt a8, Struct8BytesNestedInt a9))
 
DART_EXPORT void TestAsyncPassStruct8BytesNestedFloatx10 (void(*f)(Struct8BytesNestedFloat a0, Struct8BytesNestedFloat a1, Struct8BytesNestedFloat a2, Struct8BytesNestedFloat a3, Struct8BytesNestedFloat a4, Struct8BytesNestedFloat a5, Struct8BytesNestedFloat a6, Struct8BytesNestedFloat a7, Struct8BytesNestedFloat a8, Struct8BytesNestedFloat a9))
 
DART_EXPORT void TestAsyncPassStruct8BytesNestedFloat2x10 (void(*f)(Struct8BytesNestedFloat2 a0, Struct8BytesNestedFloat2 a1, Struct8BytesNestedFloat2 a2, Struct8BytesNestedFloat2 a3, Struct8BytesNestedFloat2 a4, Struct8BytesNestedFloat2 a5, Struct8BytesNestedFloat2 a6, Struct8BytesNestedFloat2 a7, Struct8BytesNestedFloat2 a8, Struct8BytesNestedFloat2 a9))
 
DART_EXPORT void TestAsyncPassStruct8BytesNestedMixedx10 (void(*f)(Struct8BytesNestedMixed a0, Struct8BytesNestedMixed a1, Struct8BytesNestedMixed a2, Struct8BytesNestedMixed a3, Struct8BytesNestedMixed a4, Struct8BytesNestedMixed a5, Struct8BytesNestedMixed a6, Struct8BytesNestedMixed a7, Struct8BytesNestedMixed a8, Struct8BytesNestedMixed a9))
 
DART_EXPORT void TestAsyncPassStruct16BytesNestedIntx2 (void(*f)(Struct16BytesNestedInt a0, Struct16BytesNestedInt a1))
 
DART_EXPORT void TestAsyncPassStruct32BytesNestedIntx2 (void(*f)(Struct32BytesNestedInt a0, Struct32BytesNestedInt a1))
 
DART_EXPORT void TestAsyncPassStructNestedIntStructAlignmentInt16 (void(*f)(StructNestedIntStructAlignmentInt16 a0))
 
DART_EXPORT void TestAsyncPassStructNestedIntStructAlignmentInt32 (void(*f)(StructNestedIntStructAlignmentInt32 a0))
 
DART_EXPORT void TestAsyncPassStructNestedIntStructAlignmentInt64 (void(*f)(StructNestedIntStructAlignmentInt64 a0))
 
DART_EXPORT void TestAsyncPassStructNestedIrregularEvenBiggerx4 (void(*f)(StructNestedIrregularEvenBigger a0, StructNestedIrregularEvenBigger a1, StructNestedIrregularEvenBigger a2, StructNestedIrregularEvenBigger a3))
 
DART_EXPORT void TestAsyncPassStruct8BytesInlineArrayIntx4 (void(*f)(Struct8BytesInlineArrayInt a0, Struct8BytesInlineArrayInt a1, Struct8BytesInlineArrayInt a2, Struct8BytesInlineArrayInt a3))
 
DART_EXPORT void TestAsyncPassStructInlineArrayIrregularx4 (void(*f)(StructInlineArrayIrregular a0, StructInlineArrayIrregular a1, StructInlineArrayIrregular a2, StructInlineArrayIrregular a3))
 
DART_EXPORT void TestAsyncPassStructInlineArray100Bytes (void(*f)(StructInlineArray100Bytes a0))
 
DART_EXPORT void TestAsyncPassStructStruct16BytesHomogeneousFloat2x5 (void(*f)(StructStruct16BytesHomogeneousFloat2 a0, StructStruct16BytesHomogeneousFloat2 a1, StructStruct16BytesHomogeneousFloat2 a2, StructStruct16BytesHomogeneousFloat2 a3, StructStruct16BytesHomogeneousFloat2 a4))
 
DART_EXPORT void TestAsyncPassStructStruct32BytesHomogeneousDouble2x5 (void(*f)(StructStruct32BytesHomogeneousDouble2 a0, StructStruct32BytesHomogeneousDouble2 a1, StructStruct32BytesHomogeneousDouble2 a2, StructStruct32BytesHomogeneousDouble2 a3, StructStruct32BytesHomogeneousDouble2 a4))
 
DART_EXPORT void TestAsyncPassStructStruct16BytesMixed3x10 (void(*f)(StructStruct16BytesMixed3 a0, StructStruct16BytesMixed3 a1, StructStruct16BytesMixed3 a2, StructStruct16BytesMixed3 a3, StructStruct16BytesMixed3 a4, StructStruct16BytesMixed3 a5, StructStruct16BytesMixed3 a6, StructStruct16BytesMixed3 a7, StructStruct16BytesMixed3 a8, StructStruct16BytesMixed3 a9))
 
DART_EXPORT void TestAsyncPassUint8Struct32BytesInlineArrayMultiDimensionalI (void(*f)(uint8_t a0, Struct32BytesInlineArrayMultiDimensionalInt a1, uint8_t a2, Struct8BytesInlineArrayMultiDimensionalInt a3, uint8_t a4, Struct8BytesInlineArrayMultiDimensionalInt a5, uint8_t a6))
 
DART_EXPORT void TestAsyncPassUint8Struct4BytesInlineArrayMultiDimensionalIn (void(*f)(uint8_t a0, Struct4BytesInlineArrayMultiDimensionalInt a1, uint8_t a2))
 
DART_EXPORT void TestAsyncPassStruct3BytesPackedIntx10 (void(*f)(Struct3BytesPackedInt a0, Struct3BytesPackedInt a1, Struct3BytesPackedInt a2, Struct3BytesPackedInt a3, Struct3BytesPackedInt a4, Struct3BytesPackedInt a5, Struct3BytesPackedInt a6, Struct3BytesPackedInt a7, Struct3BytesPackedInt a8, Struct3BytesPackedInt a9))
 
DART_EXPORT void TestAsyncPassStruct8BytesPackedIntx10 (void(*f)(Struct8BytesPackedInt a0, Struct8BytesPackedInt a1, Struct8BytesPackedInt a2, Struct8BytesPackedInt a3, Struct8BytesPackedInt a4, Struct8BytesPackedInt a5, Struct8BytesPackedInt a6, Struct8BytesPackedInt a7, Struct8BytesPackedInt a8, Struct8BytesPackedInt a9))
 
DART_EXPORT void TestAsyncPassStruct9BytesPackedMixedx10DoubleInt32x2 (void(*f)(Struct9BytesPackedMixed a0, Struct9BytesPackedMixed a1, Struct9BytesPackedMixed a2, Struct9BytesPackedMixed a3, Struct9BytesPackedMixed a4, Struct9BytesPackedMixed a5, Struct9BytesPackedMixed a6, Struct9BytesPackedMixed a7, Struct9BytesPackedMixed a8, Struct9BytesPackedMixed a9, double a10, int32_t a11, int32_t a12))
 
DART_EXPORT void TestAsyncPassStruct5BytesPackedMixed (void(*f)(Struct5BytesPackedMixed a0))
 
DART_EXPORT void TestAsyncPassStructNestedAlignmentStruct5BytesPackedMixed (void(*f)(StructNestedAlignmentStruct5BytesPackedMixed a0))
 
DART_EXPORT void TestAsyncPassStruct6BytesInlineArrayInt (void(*f)(Struct6BytesInlineArrayInt a0))
 
DART_EXPORT void TestAsyncPassStruct15BytesInlineArrayMixed (void(*f)(Struct15BytesInlineArrayMixed a0))
 
DART_EXPORT void TestAsyncPassUnion4BytesMixedx10 (void(*f)(Union4BytesMixed a0, Union4BytesMixed a1, Union4BytesMixed a2, Union4BytesMixed a3, Union4BytesMixed a4, Union4BytesMixed a5, Union4BytesMixed a6, Union4BytesMixed a7, Union4BytesMixed a8, Union4BytesMixed a9))
 
DART_EXPORT void TestAsyncPassUnion8BytesNestedFloatx10 (void(*f)(Union8BytesNestedFloat a0, Union8BytesNestedFloat a1, Union8BytesNestedFloat a2, Union8BytesNestedFloat a3, Union8BytesNestedFloat a4, Union8BytesNestedFloat a5, Union8BytesNestedFloat a6, Union8BytesNestedFloat a7, Union8BytesNestedFloat a8, Union8BytesNestedFloat a9))
 
DART_EXPORT void TestAsyncPassUnion9BytesNestedIntx10 (void(*f)(Union9BytesNestedInt a0, Union9BytesNestedInt a1, Union9BytesNestedInt a2, Union9BytesNestedInt a3, Union9BytesNestedInt a4, Union9BytesNestedInt a5, Union9BytesNestedInt a6, Union9BytesNestedInt a7, Union9BytesNestedInt a8, Union9BytesNestedInt a9))
 
DART_EXPORT void TestAsyncPassUnion16BytesNestedInlineArrayFloatx10 (void(*f)(Union16BytesNestedInlineArrayFloat a0, Union16BytesNestedInlineArrayFloat a1, Union16BytesNestedInlineArrayFloat a2, Union16BytesNestedInlineArrayFloat a3, Union16BytesNestedInlineArrayFloat a4, Union16BytesNestedInlineArrayFloat a5, Union16BytesNestedInlineArrayFloat a6, Union16BytesNestedInlineArrayFloat a7, Union16BytesNestedInlineArrayFloat a8, Union16BytesNestedInlineArrayFloat a9))
 
DART_EXPORT void TestAsyncPassUnion16BytesNestedFloatx10 (void(*f)(Union16BytesNestedFloat a0, Union16BytesNestedFloat a1, Union16BytesNestedFloat a2, Union16BytesNestedFloat a3, Union16BytesNestedFloat a4, Union16BytesNestedFloat a5, Union16BytesNestedFloat a6, Union16BytesNestedFloat a7, Union16BytesNestedFloat a8, Union16BytesNestedFloat a9))
 
DART_EXPORT void TestAsyncPassUint8Boolx9Struct10BytesHomogeneousBoolBool (void(*f)(uint8_t a0, bool a1, bool a2, bool a3, bool a4, bool a5, bool a6, bool a7, bool a8, bool a9, Struct10BytesHomogeneousBool a10, bool a11))
 
DART_EXPORT void TestAsyncPassUint8Boolx9Struct10BytesInlineArrayBoolBool (void(*f)(uint8_t a0, bool a1, bool a2, bool a3, bool a4, bool a5, bool a6, bool a7, bool a8, bool a9, Struct10BytesInlineArrayBool a10, bool a11))
 
DART_EXPORT void TestAsyncPassUint8Struct1ByteBool (void(*f)(uint8_t a0, Struct1ByteBool a1))
 
DART_EXPORT void TestAsyncPassWCharStructInlineArrayIntUintPtrx2LongUnsigned (void(*f)(wchar_t a0, StructInlineArrayInt a1, uintptr_t a2, uintptr_t a3, long a4, unsigned long a5))
 
DART_EXPORT void TestAsyncPassInt64x7Struct12BytesHomogeneousInt32 (void(*f)(int64_t a0, int64_t a1, int64_t a2, int64_t a3, int64_t a4, int64_t a5, int64_t a6, Struct12BytesHomogeneousInt32 a7))
 
DART_EXPORT void TestAsyncReturnStruct1ByteInt (void(*f)(int8_t a0))
 
DART_EXPORT void TestAsyncReturnStruct3BytesHomogeneousUint8 (void(*f)(uint8_t a0, uint8_t a1, uint8_t a2))
 
DART_EXPORT void TestAsyncReturnStruct3BytesInt2ByteAligned (void(*f)(int16_t a0, int8_t a1))
 
DART_EXPORT void TestAsyncReturnStruct4BytesHomogeneousInt16 (void(*f)(int16_t a0, int16_t a1))
 
DART_EXPORT void TestAsyncReturnStruct7BytesHomogeneousUint8 (void(*f)(uint8_t a0, uint8_t a1, uint8_t a2, uint8_t a3, uint8_t a4, uint8_t a5, uint8_t a6))
 
DART_EXPORT void TestAsyncReturnStruct7BytesInt4ByteAligned (void(*f)(int32_t a0, int16_t a1, int8_t a2))
 
DART_EXPORT void TestAsyncReturnStruct8BytesInt (void(*f)(int16_t a0, int16_t a1, int32_t a2))
 
DART_EXPORT void TestAsyncReturnStruct8BytesHomogeneousFloat (void(*f)(float a0, float a1))
 
DART_EXPORT void TestAsyncReturnStruct8BytesMixed (void(*f)(float a0, int16_t a1, int16_t a2))
 
DART_EXPORT void TestAsyncReturnStruct9BytesHomogeneousUint8 (void(*f)(uint8_t a0, uint8_t a1, uint8_t a2, uint8_t a3, uint8_t a4, uint8_t a5, uint8_t a6, uint8_t a7, uint8_t a8))
 
DART_EXPORT void TestAsyncReturnStruct9BytesInt4Or8ByteAligned (void(*f)(int64_t a0, int8_t a1))
 
DART_EXPORT void TestAsyncReturnStruct12BytesHomogeneousFloat (void(*f)(float a0, float a1, float a2))
 
DART_EXPORT void TestAsyncReturnStruct16BytesHomogeneousFloat (void(*f)(float a0, float a1, float a2, float a3))
 
DART_EXPORT void TestAsyncReturnStruct16BytesMixed (void(*f)(double a0, int64_t a1))
 
DART_EXPORT void TestAsyncReturnStruct16BytesMixed2 (void(*f)(float a0, float a1, float a2, int32_t a3))
 
DART_EXPORT void TestAsyncReturnStruct17BytesInt (void(*f)(int64_t a0, int64_t a1, int8_t a2))
 
DART_EXPORT void TestAsyncReturnStruct19BytesHomogeneousUint8 (void(*f)(uint8_t a0, uint8_t a1, uint8_t a2, uint8_t a3, uint8_t a4, uint8_t a5, uint8_t a6, uint8_t a7, uint8_t a8, uint8_t a9, uint8_t a10, uint8_t a11, uint8_t a12, uint8_t a13, uint8_t a14, uint8_t a15, uint8_t a16, uint8_t a17, uint8_t a18))
 
DART_EXPORT void TestAsyncReturnStruct20BytesHomogeneousInt32 (void(*f)(int32_t a0, int32_t a1, int32_t a2, int32_t a3, int32_t a4))
 
DART_EXPORT void TestAsyncReturnStruct20BytesHomogeneousFloat (void(*f)(float a0, float a1, float a2, float a3, float a4))
 
DART_EXPORT void TestAsyncReturnStruct32BytesHomogeneousDouble (void(*f)(double a0, double a1, double a2, double a3))
 
DART_EXPORT void TestAsyncReturnStruct40BytesHomogeneousDouble (void(*f)(double a0, double a1, double a2, double a3, double a4))
 
DART_EXPORT void TestAsyncReturnStruct1024BytesHomogeneousUint64 (void(*f)(uint64_t a0, uint64_t a1, uint64_t a2, uint64_t a3, uint64_t a4, uint64_t a5, uint64_t a6, uint64_t a7, uint64_t a8, uint64_t a9, uint64_t a10, uint64_t a11, uint64_t a12, uint64_t a13, uint64_t a14, uint64_t a15, uint64_t a16, uint64_t a17, uint64_t a18, uint64_t a19, uint64_t a20, uint64_t a21, uint64_t a22, uint64_t a23, uint64_t a24, uint64_t a25, uint64_t a26, uint64_t a27, uint64_t a28, uint64_t a29, uint64_t a30, uint64_t a31, uint64_t a32, uint64_t a33, uint64_t a34, uint64_t a35, uint64_t a36, uint64_t a37, uint64_t a38, uint64_t a39, uint64_t a40, uint64_t a41, uint64_t a42, uint64_t a43, uint64_t a44, uint64_t a45, uint64_t a46, uint64_t a47, uint64_t a48, uint64_t a49, uint64_t a50, uint64_t a51, uint64_t a52, uint64_t a53, uint64_t a54, uint64_t a55, uint64_t a56, uint64_t a57, uint64_t a58, uint64_t a59, uint64_t a60, uint64_t a61, uint64_t a62, uint64_t a63, uint64_t a64, uint64_t a65, uint64_t a66, uint64_t a67, uint64_t a68, uint64_t a69, uint64_t a70, uint64_t a71, uint64_t a72, uint64_t a73, uint64_t a74, uint64_t a75, uint64_t a76, uint64_t a77, uint64_t a78, uint64_t a79, uint64_t a80, uint64_t a81, uint64_t a82, uint64_t a83, uint64_t a84, uint64_t a85, uint64_t a86, uint64_t a87, uint64_t a88, uint64_t a89, uint64_t a90, uint64_t a91, uint64_t a92, uint64_t a93, uint64_t a94, uint64_t a95, uint64_t a96, uint64_t a97, uint64_t a98, uint64_t a99, uint64_t a100, uint64_t a101, uint64_t a102, uint64_t a103, uint64_t a104, uint64_t a105, uint64_t a106, uint64_t a107, uint64_t a108, uint64_t a109, uint64_t a110, uint64_t a111, uint64_t a112, uint64_t a113, uint64_t a114, uint64_t a115, uint64_t a116, uint64_t a117, uint64_t a118, uint64_t a119, uint64_t a120, uint64_t a121, uint64_t a122, uint64_t a123, uint64_t a124, uint64_t a125, uint64_t a126, uint64_t a127))
 
DART_EXPORT void TestAsyncReturnStruct3BytesPackedInt (void(*f)(int8_t a0, int16_t a1))
 
DART_EXPORT void TestAsyncReturnStruct8BytesPackedInt (void(*f)(uint8_t a0, uint32_t a1, uint8_t a2, uint8_t a3, uint8_t a4))
 
DART_EXPORT void TestAsyncReturnStruct9BytesPackedMixed (void(*f)(uint8_t a0, double a1))
 
DART_EXPORT void TestAsyncReturnUnion4BytesMixed (void(*f)(uint32_t a0))
 
DART_EXPORT void TestAsyncReturnUnion8BytesNestedFloat (void(*f)(double a0))
 
DART_EXPORT void TestAsyncReturnUnion9BytesNestedInt (void(*f)(Struct8BytesInt a0))
 
DART_EXPORT void TestAsyncReturnUnion16BytesNestedFloat (void(*f)(Struct8BytesHomogeneousFloat a0))
 
DART_EXPORT void TestAsyncReturnStructArgumentStruct1ByteInt (void(*f)(Struct1ByteInt a0))
 
DART_EXPORT void TestAsyncReturnStructArgumentInt32x8Struct1ByteInt (void(*f)(int32_t a0, int32_t a1, int32_t a2, int32_t a3, int32_t a4, int32_t a5, int32_t a6, int32_t a7, Struct1ByteInt a8))
 
DART_EXPORT void TestAsyncReturnStructArgumentStruct8BytesHomogeneousFloat (void(*f)(Struct8BytesHomogeneousFloat a0))
 
DART_EXPORT void TestAsyncReturnStructArgumentStruct20BytesHomogeneousInt32 (void(*f)(Struct20BytesHomogeneousInt32 a0))
 
DART_EXPORT void TestAsyncReturnStructArgumentInt32x8Struct20BytesHomogeneou (void(*f)(int32_t a0, int32_t a1, int32_t a2, int32_t a3, int32_t a4, int32_t a5, int32_t a6, int32_t a7, Struct20BytesHomogeneousInt32 a8))
 
DART_EXPORT void TestAsyncReturnStructArgumentStruct8BytesInlineArrayInt (void(*f)(Struct8BytesInlineArrayInt a0))
 
DART_EXPORT void TestAsyncReturnStructArgumentStructStruct16BytesHomogeneous (void(*f)(StructStruct16BytesHomogeneousFloat2 a0))
 
DART_EXPORT void TestAsyncReturnStructArgumentStructStruct32BytesHomogeneous (void(*f)(StructStruct32BytesHomogeneousDouble2 a0))
 
DART_EXPORT void TestAsyncReturnStructArgumentStructStruct16BytesMixed3 (void(*f)(StructStruct16BytesMixed3 a0))
 
DART_EXPORT void TestAsyncReturnStructAlignmentInt16 (void(*f)(int8_t a0, int16_t a1, int8_t a2))
 
DART_EXPORT void TestAsyncReturnStructAlignmentInt32 (void(*f)(int8_t a0, int32_t a1, int8_t a2))
 
DART_EXPORT void TestAsyncReturnStructAlignmentInt64 (void(*f)(int8_t a0, int64_t a1, int8_t a2))
 
DART_EXPORT void TestAsyncReturnStruct8BytesNestedInt (void(*f)(Struct4BytesHomogeneousInt16 a0, Struct4BytesHomogeneousInt16 a1))
 
DART_EXPORT void TestAsyncReturnStruct8BytesNestedFloat (void(*f)(Struct4BytesFloat a0, Struct4BytesFloat a1))
 
DART_EXPORT void TestAsyncReturnStruct8BytesNestedFloat2 (void(*f)(Struct4BytesFloat a0, float a1))
 
DART_EXPORT void TestAsyncReturnStruct8BytesNestedMixed (void(*f)(Struct4BytesHomogeneousInt16 a0, Struct4BytesFloat a1))
 
DART_EXPORT void TestAsyncReturnStruct16BytesNestedInt (void(*f)(Struct8BytesNestedInt a0, Struct8BytesNestedInt a1))
 
DART_EXPORT void TestAsyncReturnStruct32BytesNestedInt (void(*f)(Struct16BytesNestedInt a0, Struct16BytesNestedInt a1))
 
DART_EXPORT void TestAsyncReturnStructNestedIntStructAlignmentInt16 (void(*f)(StructAlignmentInt16 a0, StructAlignmentInt16 a1))
 
DART_EXPORT void TestAsyncReturnStructNestedIntStructAlignmentInt32 (void(*f)(StructAlignmentInt32 a0, StructAlignmentInt32 a1))
 
DART_EXPORT void TestAsyncReturnStructNestedIntStructAlignmentInt64 (void(*f)(StructAlignmentInt64 a0, StructAlignmentInt64 a1))
 
DART_EXPORT void TestAsyncReturnStructNestedIrregularEvenBigger (void(*f)(uint64_t a0, StructNestedIrregularBigger a1, StructNestedIrregularBigger a2, double a3))
 
DART_EXPORT int64_t VariadicAt1Int64x2 (int64_t a0,...)
 
DART_EXPORT double VariadicAt1Doublex2 (double a0,...)
 
DART_EXPORT int64_t VariadicAt1Int64x5 (int64_t a0,...)
 
DART_EXPORT double VariadicAt1Doublex5 (double a0,...)
 
DART_EXPORT int64_t VariadicAt1Int64x20 (int64_t a0,...)
 
DART_EXPORT double VariadicAt1Doublex20 (double a0,...)
 
DART_EXPORT int64_t VariadicAt1Int64x2Struct8BytesIntInt64 (int64_t a0,...)
 
DART_EXPORT double VariadicAt1Doublex2Struct32BytesHomogeneousDoubleD (double a0,...)
 
DART_EXPORT double VariadicAt1DoubleStruct12BytesHomogeneousFloatDoub (double a0,...)
 
DART_EXPORT int32_t VariadicAt1Int32Struct20BytesHomogeneousInt32Int32 (int32_t a0,...)
 
DART_EXPORT double VariadicAt1DoubleStruct20BytesHomogeneousFloatDoub (double a0,...)
 
DART_EXPORT int32_t VariadicAt2Int32Int64IntPtr (int32_t a0, int64_t a1,...)
 
DART_EXPORT double VariadicAt1DoubleInt64Int32DoubleInt64Int32 (double a0,...)
 
DART_EXPORT double VariadicAt1Int64Int32Struct12BytesHomogeneousFloat (int64_t a0,...)
 
DART_EXPORT double VariadicAt11Doublex8FloatStruct12BytesHomogeneousF (double a0, double a1, double a2, double a3, double a4, double a5, double a6, double a7, float a8, Struct12BytesHomogeneousFloat a9, int64_t a10,...)
 
DART_EXPORT double VariadicAt1DoubleInt64Int32Struct20BytesHomogeneou (double a0,...)
 
DART_EXPORT double VariadicAt5Doublex5 (double a0, double a1, double a2, double a3, double a4,...)
 
DART_EXPORT int64_t VariadicAt1Int64x7Struct12BytesHomogeneousInt32 (int64_t a0,...)
 
DART_EXPORT int32_t VariadicAt1Struct12BytesHomogeneousInt32Int32x4 (Struct12BytesHomogeneousInt32 a0,...)
 
DART_EXPORT intptr_t TestVariadicAt1Int64x2 (int64_t(*f)(int64_t a0,...))
 
DART_EXPORT intptr_t TestVariadicAt1Doublex2 (double(*f)(double a0,...))
 
DART_EXPORT intptr_t TestVariadicAt1Int64x5 (int64_t(*f)(int64_t a0,...))
 
DART_EXPORT intptr_t TestVariadicAt1Doublex5 (double(*f)(double a0,...))
 
DART_EXPORT intptr_t TestVariadicAt1Int64x20 (int64_t(*f)(int64_t a0,...))
 
DART_EXPORT intptr_t TestVariadicAt1Doublex20 (double(*f)(double a0,...))
 
DART_EXPORT intptr_t TestVariadicAt1Int64x2Struct8BytesIntInt64 (int64_t(*f)(int64_t a0,...))
 
DART_EXPORT intptr_t TestVariadicAt1Doublex2Struct32BytesHomogeneousDoubleD (double(*f)(double a0,...))
 
DART_EXPORT intptr_t TestVariadicAt1DoubleStruct12BytesHomogeneousFloatDoub (double(*f)(double a0,...))
 
DART_EXPORT intptr_t TestVariadicAt1Int32Struct20BytesHomogeneousInt32Int32 (int32_t(*f)(int32_t a0,...))
 
DART_EXPORT intptr_t TestVariadicAt1DoubleStruct20BytesHomogeneousFloatDoub (double(*f)(double a0,...))
 
DART_EXPORT intptr_t TestVariadicAt2Int32Int64IntPtr (int32_t(*f)(int32_t a0, int64_t a1,...))
 
DART_EXPORT intptr_t TestVariadicAt1DoubleInt64Int32DoubleInt64Int32 (double(*f)(double a0,...))
 
DART_EXPORT intptr_t TestVariadicAt1Int64Int32Struct12BytesHomogeneousFloat (double(*f)(int64_t a0,...))
 
DART_EXPORT intptr_t TestVariadicAt11Doublex8FloatStruct12BytesHomogeneousF (double(*f)(double a0, double a1, double a2, double a3, double a4, double a5, double a6, double a7, float a8, Struct12BytesHomogeneousFloat a9, int64_t a10,...))
 
DART_EXPORT intptr_t TestVariadicAt1DoubleInt64Int32Struct20BytesHomogeneou (double(*f)(double a0,...))
 
DART_EXPORT intptr_t TestVariadicAt5Doublex5 (double(*f)(double a0, double a1, double a2, double a3, double a4,...))
 
DART_EXPORT intptr_t TestVariadicAt1Int64x7Struct12BytesHomogeneousInt32 (int64_t(*f)(int64_t a0,...))
 
DART_EXPORT intptr_t TestVariadicAt1Struct12BytesHomogeneousInt32Int32x4 (int32_t(*f)(Struct12BytesHomogeneousInt32 a0,...))
 
DART_EXPORT int8_t TakeInt8Pointer (int8_t *data, size_t length)
 
DART_EXPORT int8_t TakeInt8PointerMany (int8_t *data0, int8_t *data1, int8_t *data2, int8_t *data3, int8_t *data4, int8_t *data5, int8_t *data6, int8_t *data7, int8_t *data8, int8_t *data9, int8_t *data10, int8_t *data11, int8_t *data12, int8_t *data13, int8_t *data14, int8_t *data15, int8_t *data16, int8_t *data17, int8_t *data18, int8_t *data19)
 
DART_EXPORT int16_t TakeInt16Pointer (int16_t *data, size_t length)
 
DART_EXPORT int16_t TakeInt16PointerMany (int16_t *data0, int16_t *data1, int16_t *data2, int16_t *data3, int16_t *data4, int16_t *data5, int16_t *data6, int16_t *data7, int16_t *data8, int16_t *data9, int16_t *data10, int16_t *data11, int16_t *data12, int16_t *data13, int16_t *data14, int16_t *data15, int16_t *data16, int16_t *data17, int16_t *data18, int16_t *data19)
 
DART_EXPORT int32_t TakeInt32Pointer (int32_t *data, size_t length)
 
DART_EXPORT int32_t TakeInt32PointerMany (int32_t *data0, int32_t *data1, int32_t *data2, int32_t *data3, int32_t *data4, int32_t *data5, int32_t *data6, int32_t *data7, int32_t *data8, int32_t *data9, int32_t *data10, int32_t *data11, int32_t *data12, int32_t *data13, int32_t *data14, int32_t *data15, int32_t *data16, int32_t *data17, int32_t *data18, int32_t *data19)
 
DART_EXPORT int64_t TakeInt64Pointer (int64_t *data, size_t length)
 
DART_EXPORT int64_t TakeInt64PointerMany (int64_t *data0, int64_t *data1, int64_t *data2, int64_t *data3, int64_t *data4, int64_t *data5, int64_t *data6, int64_t *data7, int64_t *data8, int64_t *data9, int64_t *data10, int64_t *data11, int64_t *data12, int64_t *data13, int64_t *data14, int64_t *data15, int64_t *data16, int64_t *data17, int64_t *data18, int64_t *data19)
 
DART_EXPORT uint8_t TakeUint8Pointer (uint8_t *data, size_t length)
 
DART_EXPORT uint8_t TakeUint8PointerMany (uint8_t *data0, uint8_t *data1, uint8_t *data2, uint8_t *data3, uint8_t *data4, uint8_t *data5, uint8_t *data6, uint8_t *data7, uint8_t *data8, uint8_t *data9, uint8_t *data10, uint8_t *data11, uint8_t *data12, uint8_t *data13, uint8_t *data14, uint8_t *data15, uint8_t *data16, uint8_t *data17, uint8_t *data18, uint8_t *data19)
 
DART_EXPORT uint16_t TakeUint16Pointer (uint16_t *data, size_t length)
 
DART_EXPORT uint16_t TakeUint16PointerMany (uint16_t *data0, uint16_t *data1, uint16_t *data2, uint16_t *data3, uint16_t *data4, uint16_t *data5, uint16_t *data6, uint16_t *data7, uint16_t *data8, uint16_t *data9, uint16_t *data10, uint16_t *data11, uint16_t *data12, uint16_t *data13, uint16_t *data14, uint16_t *data15, uint16_t *data16, uint16_t *data17, uint16_t *data18, uint16_t *data19)
 
DART_EXPORT uint32_t TakeUint32Pointer (uint32_t *data, size_t length)
 
DART_EXPORT uint32_t TakeUint32PointerMany (uint32_t *data0, uint32_t *data1, uint32_t *data2, uint32_t *data3, uint32_t *data4, uint32_t *data5, uint32_t *data6, uint32_t *data7, uint32_t *data8, uint32_t *data9, uint32_t *data10, uint32_t *data11, uint32_t *data12, uint32_t *data13, uint32_t *data14, uint32_t *data15, uint32_t *data16, uint32_t *data17, uint32_t *data18, uint32_t *data19)
 
DART_EXPORT uint64_t TakeUint64Pointer (uint64_t *data, size_t length)
 
DART_EXPORT uint64_t TakeUint64PointerMany (uint64_t *data0, uint64_t *data1, uint64_t *data2, uint64_t *data3, uint64_t *data4, uint64_t *data5, uint64_t *data6, uint64_t *data7, uint64_t *data8, uint64_t *data9, uint64_t *data10, uint64_t *data11, uint64_t *data12, uint64_t *data13, uint64_t *data14, uint64_t *data15, uint64_t *data16, uint64_t *data17, uint64_t *data18, uint64_t *data19)
 
DART_EXPORT float TakeFloatPointer (float *data, size_t length)
 
DART_EXPORT float TakeFloatPointerMany (float *data0, float *data1, float *data2, float *data3, float *data4, float *data5, float *data6, float *data7, float *data8, float *data9, float *data10, float *data11, float *data12, float *data13, float *data14, float *data15, float *data16, float *data17, float *data18, float *data19)
 
DART_EXPORT double TakeDoublePointer (double *data, size_t length)
 
DART_EXPORT double TakeDoublePointerMany (double *data0, double *data1, double *data2, double *data3, double *data4, double *data5, double *data6, double *data7, double *data8, double *data9, double *data10, double *data11, double *data12, double *data13, double *data14, double *data15, double *data16, double *data17, double *data18, double *data19)
 
DART_EXPORT bool TakeBoolPointer (bool *data, size_t length)
 
DART_EXPORT bool TakeBoolPointerMany (bool *data0, bool *data1, bool *data2, bool *data3, bool *data4, bool *data5, bool *data6, bool *data7, bool *data8, bool *data9, bool *data10, bool *data11, bool *data12, bool *data13, bool *data14, bool *data15, bool *data16, bool *data17, bool *data18, bool *data19)
 
DART_EXPORT int16_t TakeStruct2BytesIntPointerMany (Struct2BytesInt *data0, Struct2BytesInt *data1, Struct2BytesInt *data2, Struct2BytesInt *data3, Struct2BytesInt *data4, Struct2BytesInt *data5, Struct2BytesInt *data6, Struct2BytesInt *data7, Struct2BytesInt *data8, Struct2BytesInt *data9, Struct2BytesInt *data10, Struct2BytesInt *data11, Struct2BytesInt *data12, Struct2BytesInt *data13, Struct2BytesInt *data14, Struct2BytesInt *data15, Struct2BytesInt *data16, Struct2BytesInt *data17, Struct2BytesInt *data18, Struct2BytesInt *data19)
 
DART_EXPORT int16_t TakeUnion2BytesIntPointerMany (Union2BytesInt *data0, Union2BytesInt *data1, Union2BytesInt *data2, Union2BytesInt *data3, Union2BytesInt *data4, Union2BytesInt *data5, Union2BytesInt *data6, Union2BytesInt *data7, Union2BytesInt *data8, Union2BytesInt *data9, Union2BytesInt *data10, Union2BytesInt *data11, Union2BytesInt *data12, Union2BytesInt *data13, Union2BytesInt *data14, Union2BytesInt *data15, Union2BytesInt *data16, Union2BytesInt *data17, Union2BytesInt *data18, Union2BytesInt *data19)
 
DART_EXPORT int64_t MinInt64 ()
 
DART_EXPORT int64_t MinInt32 ()
 
DART_EXPORT double SmallDouble ()
 
DART_EXPORT void * LargePointer ()
 
DART_EXPORT void TriggerGC (uint64_t count)
 
DART_EXPORT void CollectOnNthAllocation (intptr_t num_allocations)
 
DART_EXPORT void Regress37069 (uint64_t a, uint64_t b, uint64_t c, uint64_t d, uint64_t e, uint64_t f, uint64_t g, uint64_t h, uint64_t i, uint64_t j, uint64_t k)
 
DART_EXPORT uint8_t IsThreadInGenerated ()
 
DART_EXPORT void * UnprotectCodeOtherThread (void *isolate, std::condition_variable *var, std::mutex *mut)
 
DART_EXPORT void * TestUnprotectCode (void(*fn)(void *))
 
DART_EXPORT void WaitForHelper (HelperThreadState *helper)
 
void ClobberAndCall (void(*fn)())
 
DART_EXPORT intptr_t TestGC (void(*do_gc)())
 
DART_EXPORT void RestoreSIGPIPEHandler ()
 
DART_EXPORT void IGH_MsanUnpoison (void *start, intptr_t length)
 
DART_EXPORT Dart_Isolate IGH_CreateIsolate (const char *name, void *peer)
 
DART_EXPORT void IGH_StartIsolate (Dart_Isolate child_isolate, int64_t main_isolate_port, const char *library_uri, const char *function_name, bool errors_are_fatal, Dart_Port on_error_port, Dart_Port on_exit_port)
 
DART_EXPORT intptr_t InitDartApiDL (void *data)
 
void Fatal (char const *file, int line, char const *error)
 
DART_EXPORT void SleepOnAnyOS (intptr_t seconds)
 
void NotifyDart (Dart_Port send_port, const Work *work)
 
intptr_t MyCallbackBlocking (intptr_t a)
 
void MyCallbackNonBlocking (intptr_t a)
 
void Work1 ()
 
void Work2 ()
 
DART_EXPORT void RegisterMyCallbackBlocking (Dart_Port send_port, intptr_t(*callback1)(intptr_t))
 
DART_EXPORT void RegisterMyCallbackNonBlocking (Dart_Port send_port, void(*callback)(intptr_t))
 
DART_EXPORT void StartWorkSimulator ()
 
DART_EXPORT void StopWorkSimulator ()
 
DART_EXPORT void ExecuteCallback (Work *work_ptr)
 
DART_EXPORT void * Calloc (size_t count, size_t size)
 
DART_EXPORT void FreeFinalizer (void *, void *value)
 
uint8_t MyCallback1 (uint8_t a)
 
void MyCallback2 (uint8_t a)
 
void Work1_2 ()
 
void Work2_2 ()
 
DART_EXPORT void RegisterSendPort (Dart_Port send_port)
 
DART_EXPORT void StartWorkSimulator2 ()
 
DART_EXPORT void StopWorkSimulator2 ()
 
DART_EXPORT void ThreadPoolTest_BarrierSync (Dart_Isolate(*dart_current_isolate)(), void(*dart_enter_isolate)(Dart_Isolate), void(*dart_exit_isolate)(), intptr_t num_threads)
 
DART_EXPORT void IsolateExitTest_LookupAndCallIsolateExit (int i)
 
static void RunFinalizer (void *isolate_callback_data, void *peer)
 
DART_EXPORT Dart_Handle PassObjectToC (Dart_Handle h)
 
DART_EXPORT void ClosureCallbackThroughHandle (void(*callback)(Dart_Handle), Dart_Handle closureHandle)
 
DART_EXPORT Dart_Handle ReturnHandleInCallback (Dart_Handle(*callback)())
 
DART_EXPORT Dart_Handle HandleRecursion (Dart_Handle object, Dart_Handle(*callback)(int64_t), int64_t i)
 
DART_EXPORT int64_t HandleReadFieldValue (Dart_Handle handle)
 
DART_EXPORT int64_t PropagateErrorWithoutHandle (Dart_Handle(*callback)())
 
DART_EXPORT Dart_Handle ThrowOnReturnOfError (Dart_Handle(*callback)())
 
DART_EXPORT Dart_Handle TrueHandle ()
 
DART_EXPORT Dart_Handle PassObjectToCUseDynamicLinking (Dart_Handle h)
 
DART_EXPORT void RegisterClosureCallbackFP (void(*callback)(Dart_Handle))
 
DART_EXPORT void RegisterClosureCallback (Dart_Handle h)
 
DART_EXPORT void InvokeClosureCallback ()
 
DART_EXPORT void ReleaseClosureCallback ()
 
DART_EXPORT void SetArgumentTo42 (void *token)
 
DART_EXPORT Dart_Handle GetRootLibraryUrl ()
 
intptr_t ReturnIntPtr (intptr_t x)
 
intptr_t PassAsHandle (Dart_Handle handle)
 
intptr_t PassAsPointer (void *ptr)
 
intptr_t PassAsPointerAndValue (void *ptr, intptr_t value)
 
intptr_t PassAsValueAndPointer (intptr_t value, void *ptr)
 
intptr_t * AllocateResource (intptr_t value)
 
void DeleteResource (intptr_t *resource)
 
intptr_t GetResourceValue (intptr_t *resource)
 
void DummyResourceFinalizer (void *isolate_peer, void *peer)
 
void SetResourceFinalizer (Dart_Handle handle, intptr_t *resource)
 
intptr_t AddPtrAndInt (void *self, intptr_t x)
 
intptr_t AddHandleFieldAndInt (Dart_Handle self, intptr_t x)
 
intptr_t AddPtrAndPtr (void *self, void *other)
 
intptr_t AddHandleFieldAndPtr (Dart_Handle self, void *other)
 
intptr_t AddHandleFieldAndHandleField (Dart_Handle self, Dart_Handle other)
 
intptr_t AddPtrAndHandleField (void *self, Dart_Handle other)
 
intptr_t ReturnIntPtrMethod (Dart_Handle self, intptr_t value)
 
static void * FfiNativeResolver (const char *name, uintptr_t args_n)
 
DART_EXPORT void SetFfiNativeResolverForTest (Dart_Handle url)
 
DART_EXPORT void WaitUntilNThreadsEnterBarrier (intptr_t num_threads)
 
DART_EXPORT bool IsNull (Dart_Handle object)
 
DART_EXPORT RefCountedResource * AllocateRefcountedResource ()
 
DART_EXPORT void IncreaseRefcount (RefCountedResource *peer)
 
DART_EXPORT void DecreaseRefcount (void *peer)
 
DART_EXPORT void TestDeprecatedSymbols ()
 
DART_EXPORT void SemanticsUpdateBuilderUpdateNode (void *this_, int id, int flags, int actions, int maxValueLength, int currentValueLength, int textSelectionBase, int textSelectionExtent, int platformViewId, int scrollChildren, int scrollIndex, double scrollPosition, double scrollExtentMax, double scrollExtentMin, double left, double top, double right, double bottom, double elevation, double thickness, Dart_Handle label, Dart_Handle labelAttributes, Dart_Handle value, Dart_Handle valueAttributes, Dart_Handle increasedValue, Dart_Handle increasedValueAttributes, Dart_Handle decreasedValue, Dart_Handle decreasedValueAttributes, Dart_Handle hint, Dart_Handle hintAttributes, Dart_Handle tooltip, int textDirection, Dart_Handle transform, Dart_Handle childrenInTraversalOrder, Dart_Handle childrenInHitTestOrder, Dart_Handle localContextActions)
 
DART_EXPORT void ManyHandles (Dart_Handle o0, Dart_Handle o1, Dart_Handle o2, Dart_Handle o3, Dart_Handle o4, Dart_Handle o5, Dart_Handle o6, Dart_Handle o7, Dart_Handle o8, Dart_Handle o9, Dart_Handle o10, Dart_Handle o11, Dart_Handle o12, Dart_Handle o13, Dart_Handle o14, Dart_Handle o15, Dart_Handle o16, Dart_Handle o17, Dart_Handle o18, Dart_Handle o19)
 
 TEST_CASE (Read)
 
 TEST_CASE (OpenUri_RelativeFilename)
 
 TEST_CASE (OpenUri_AbsoluteFilename)
 
static const char * Concat (const char *a, const char *b)
 
 TEST_CASE (OpenUri_ValidUri)
 
 TEST_CASE (OpenUri_UriWithSpaces)
 
 TEST_CASE (OpenUri_InvalidUriPercentEncoding)
 
 TEST_CASE (OpenUri_TruncatedUriPercentEncoding)
 
 TEST_CASE (FileLength)
 
 TEST_CASE (FilePosition)
 
static uint32_t WordHash (uint32_t key)
 
static uint32_t Hash (uint32_t key)
 
static uint32_t CollisionHash1 (uint32_t key)
 
static uint32_t CollisionHash2 (uint32_t key)
 
static uint32_t CollisionHash3 (uint32_t key)
 
static uint32_t CollisionHash4 (uint32_t key)
 
void TestSet (IntKeyHash hash, int size)
 
 VM_UNIT_TEST_CASE (SimpleHashMap_Basic)
 
 UNIT_TEST_CASE (PRIORITY_HEAP_WITH_INDEX__INCREASING)
 
 UNIT_TEST_CASE (PRIORITY_HEAP_WITH_INDEX__DECREASING)
 
 UNIT_TEST_CASE (PRIORITY_HEAP_WITH_INDEX__DELETE_BY_VALUES)
 
 UNIT_TEST_CASE (PRIORITY_HEAP_WITH_INDEX__GROW_SHRINK)
 
 UNIT_TEST_CASE (PRIORITY_HEAP_WITH_INDEX__CHANGE_PRIORITY)
 
static void PrintUsage ()
 
static Dart_Isolate CreateAndSetupServiceIsolate (const char *script_uri, const char *packages_config, Dart_IsolateFlags *flags, char **error)
 
static Dart_Isolate CreateIsolateAndSetup (const char *script_uri, const char *main, const char *package_root, const char *packages_config, Dart_IsolateFlags *flags, void *data, char **error)
 
static void CleanupIsolateGroup (void *callback_data)
 
static void EmbedderInformationCallback (Dart_EmbedderInformation *info)
 
void ShiftArgs (int *argc, const char **argv)
 
static int Main (int argc, const char **argv)
 
 DEFINE_NATIVE_ENTRY (List_allocate, 0, 2)
 
 DEFINE_NATIVE_ENTRY (List_setIndexed, 0, 3)
 
 DEFINE_NATIVE_ENTRY (List_getLength, 0, 1)
 
 DEFINE_NATIVE_ENTRY (List_slice, 0, 4)
 
 DEFINE_NATIVE_ENTRY (ImmutableList_from, 0, 4)
 
 DEFINE_NATIVE_ENTRY (AsyncStarMoveNext_debuggerStepCheck, 0, 1)
 
 DEFINE_NATIVE_ENTRY (SuspendState_instantiateClosureWithFutureTypeArgument, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Bool_fromEnvironment, 0, 3)
 
 DEFINE_NATIVE_ENTRY (Bool_hasEnvironment, 0, 2)
 
 DEFINE_NATIVE_ENTRY (DateTime_timeZoneName, 0, 1)
 
 DEFINE_NATIVE_ENTRY (DateTime_timeZoneOffsetInSeconds, 0, 1)
 
 DEFINE_NATIVE_ENTRY (DateTime_currentTimeMicros, 0, 0)
 
 DEFINE_NATIVE_ENTRY (Developer_debugger, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Developer_inspect, 0, 1)
 
 DEFINE_NATIVE_ENTRY (Developer_log, 0, 8)
 
 DEFINE_NATIVE_ENTRY (Developer_postEvent, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Developer_lookupExtension, 0, 1)
 
 DEFINE_NATIVE_ENTRY (Developer_registerExtension, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Developer_getServiceMajorVersion, 0, 0)
 
 DEFINE_NATIVE_ENTRY (Developer_getServiceMinorVersion, 0, 0)
 
static void SendNull (const SendPort &port)
 
 DEFINE_NATIVE_ENTRY (Developer_getServerInfo, 0, 1)
 
 DEFINE_NATIVE_ENTRY (Developer_webServerControl, 0, 3)
 
 DEFINE_NATIVE_ENTRY (Developer_getIsolateIdFromSendPort, 0, 1)
 
 DEFINE_NATIVE_ENTRY (Developer_getObjectId, 0, 1)
 
 DEFINE_NATIVE_ENTRY (Developer_reachability_barrier, 0, 0)
 
 DEFINE_NATIVE_ENTRY (Developer_NativeRuntime_buildId, 0, 0)
 
 DEFINE_NATIVE_ENTRY (Developer_NativeRuntime_writeHeapSnapshotToFile, 0, 1)
 
 DEFINE_NATIVE_ENTRY (Double_doubleFromInteger, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Double_add, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Double_sub, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Double_mul, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Double_div, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Double_modulo, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Double_remainder, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Double_greaterThan, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Double_greaterThanFromInteger, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Double_equal, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Double_equalToInteger, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Double_round, 0, 1)
 
 DEFINE_NATIVE_ENTRY (Double_floor, 0, 1)
 
 DEFINE_NATIVE_ENTRY (Double_ceil, 0, 1)
 
 DEFINE_NATIVE_ENTRY (Double_truncate, 0, 1)
 
 DEFINE_NATIVE_ENTRY (Double_toInt, 0, 1)
 
 DEFINE_NATIVE_ENTRY (Double_parse, 0, 3)
 
 DEFINE_NATIVE_ENTRY (Double_toString, 0, 1)
 
 DEFINE_NATIVE_ENTRY (Double_toStringAsFixed, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Double_toStringAsExponential, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Double_toStringAsPrecision, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Double_getIsInfinite, 0, 1)
 
 DEFINE_NATIVE_ENTRY (Double_getIsNaN, 0, 1)
 
 DEFINE_NATIVE_ENTRY (Double_getIsNegative, 0, 1)
 
 DEFINE_NATIVE_ENTRY (Double_flipSignBit, 0, 1)
 
static ScriptPtr FindScript (DartFrameIterator *iterator)
 
 DEFINE_NATIVE_ENTRY (AssertionError_throwNew, 0, 3)
 
 DEFINE_NATIVE_ENTRY (AssertionError_throwNewSource, 0, 5)
 
 DEFINE_NATIVE_ENTRY (TypeError_throwNew, 0, 4)
 
 DEFINE_NATIVE_ENTRY (Error_throwWithStackTrace, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Ffi_createNativeCallableListener, 1, 2)
 
 DEFINE_NATIVE_ENTRY (Ffi_createNativeCallableIsolateLocal, 1, 3)
 
 DEFINE_NATIVE_ENTRY (Ffi_deleteNativeCallable, 1, 1)
 
 DEFINE_NATIVE_ENTRY (Ffi_updateNativeCallableKeepIsolateAliveCounter, 1, 1)
 
 DEFINE_NATIVE_ENTRY (DartNativeApiFunctionPointer, 0, 1)
 
 DEFINE_NATIVE_ENTRY (DartApiDLMajorVersion, 0, 0)
 
 DEFINE_NATIVE_ENTRY (DartApiDLMinorVersion, 0, 0)
 
 DEFINE_NATIVE_ENTRY (DartApiDLInitializeData, 0, 0)
 
 DEFINE_FFI_NATIVE_ENTRY (FinalizerEntry_SetExternalSize, void,(Dart_Handle entry_handle, intptr_t external_size))
 
 DEFINE_FFI_NATIVE_ENTRY (Pointer_asTypedListFinalizerAllocateData, void *,())
 
void AsTypedListFinalizerCallback (void *peer)
 
 DEFINE_FFI_NATIVE_ENTRY (Pointer_asTypedListFinalizerCallbackPointer, void *,())
 
static void * LoadDynamicLibrary (const char *library_file, char **error=nullptr)
 
static void * ResolveSymbol (void *handle, const char *symbol, char **error)
 
static bool SymbolExists (void *handle, const char *symbol)
 
 DEFINE_NATIVE_ENTRY (Ffi_dl_open, 0, 1)
 
 DEFINE_NATIVE_ENTRY (Ffi_dl_processLibrary, 0, 0)
 
 DEFINE_NATIVE_ENTRY (Ffi_dl_executableLibrary, 0, 0)
 
 DEFINE_NATIVE_ENTRY (Ffi_dl_close, 0, 1)
 
 DEFINE_NATIVE_ENTRY (Ffi_dl_lookup, 1, 2)
 
 DEFINE_NATIVE_ENTRY (Ffi_dl_getHandle, 0, 1)
 
 DEFINE_NATIVE_ENTRY (Ffi_dl_providesSymbol, 0, 2)
 
static Dart_FfiNativeResolver GetFfiNativeResolver (Thread *const thread, const String &lib_url_str)
 
static void * FfiResolveWithFfiNativeResolver (Thread *const thread, Dart_FfiNativeResolver resolver, const String &symbol, intptr_t args_n, char **error)
 
static StringPtr GetPlatformScriptPath (Thread *thread)
 
static ArrayPtr GetAssetLocation (Thread *const thread, const String &asset)
 
static char * AvailableAssetsToCString (Thread *const thread)
 
static void * FfiResolveAsset (Thread *const thread, const Array &asset_location, const String &symbol, char **error)
 
static void ThrowFfiResolveError (const String &symbol, const String &asset, char *error)
 
intptr_t FfiResolveInternal (const String &asset, const String &symbol, uintptr_t args_n, char **error)
 
static intptr_t FfiResolve (Dart_Handle asset_handle, Dart_Handle symbol_handle, uintptr_t args_n)
 
 DEFINE_NATIVE_ENTRY (Ffi_GetFfiNativeResolver, 1, 0)
 
 DEFINE_NATIVE_ENTRY (Function_apply, 0, 2)
 
static bool ClosureEqualsHelper (Zone *zone, const Closure &receiver, const Object &other)
 
 DEFINE_NATIVE_ENTRY (Closure_equals, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Closure_computeHash, 0, 1)
 
 DEFINE_NATIVE_ENTRY (GrowableList_allocate, 0, 2)
 
 DEFINE_NATIVE_ENTRY (GrowableList_setIndexed, 0, 3)
 
 DEFINE_NATIVE_ENTRY (GrowableList_getLength, 0, 1)
 
 DEFINE_NATIVE_ENTRY (GrowableList_getCapacity, 0, 1)
 
 DEFINE_NATIVE_ENTRY (GrowableList_setLength, 0, 2)
 
 DEFINE_NATIVE_ENTRY (GrowableList_setData, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Internal_makeListFixedLength, 0, 1)
 
 DEFINE_NATIVE_ENTRY (Internal_makeFixedListUnmodifiable, 0, 1)
 
 DEFINE_NATIVE_ENTRY (Identical_comparison, 0, 2)
 
static bool CheckInteger (const Integer &i)
 
 DEFINE_NATIVE_ENTRY (Integer_bitAndFromInteger, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Integer_bitOrFromInteger, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Integer_bitXorFromInteger, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Integer_addFromInteger, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Integer_subFromInteger, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Integer_mulFromInteger, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Integer_truncDivFromInteger, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Integer_moduloFromInteger, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Integer_greaterThanFromInteger, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Integer_equalToInteger, 0, 2)
 
static IntegerPtr ParseInteger (const String &value)
 
 DEFINE_NATIVE_ENTRY (Integer_parse, 0, 1)
 
 DEFINE_NATIVE_ENTRY (Integer_fromEnvironment, 0, 3)
 
static IntegerPtr ShiftOperationHelper (Token::Kind kind, const Integer &value, const Integer &amount)
 
 DEFINE_NATIVE_ENTRY (Integer_shrFromInteger, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Integer_ushrFromInteger, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Integer_shlFromInteger, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Smi_bitNegate, 0, 1)
 
 DEFINE_NATIVE_ENTRY (Smi_bitLength, 0, 1)
 
uint32_t Multiply64Hash (int64_t ivalue)
 
 DEFINE_NATIVE_ENTRY (Mint_bitNegate, 0, 1)
 
 DEFINE_NATIVE_ENTRY (Mint_bitLength, 0, 1)
 
 DEFINE_NATIVE_ENTRY (Capability_factory, 0, 1)
 
 DEFINE_NATIVE_ENTRY (Capability_equals, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Capability_get_hashcode, 0, 1)
 
 DEFINE_NATIVE_ENTRY (RawReceivePort_factory, 0, 2)
 
 DEFINE_NATIVE_ENTRY (RawReceivePort_get_id, 0, 1)
 
 DEFINE_NATIVE_ENTRY (RawReceivePort_closeInternal, 0, 1)
 
 DEFINE_NATIVE_ENTRY (RawReceivePort_setActive, 0, 2)
 
 DEFINE_NATIVE_ENTRY (RawReceivePort_getActive, 0, 1)
 
 DEFINE_NATIVE_ENTRY (SendPort_get_id, 0, 1)
 
 DEFINE_NATIVE_ENTRY (SendPort_get_hashcode, 0, 1)
 
static bool InSameGroup (Isolate *sender, const SendPort &receiver)
 
 DEFINE_NATIVE_ENTRY (SendPort_sendInternal_, 0, 2)
 
static ObjectPtr ValidateMessageObject (Zone *zone, Isolate *isolate, const Object &obj)
 
 DEFINE_NATIVE_ENTRY (Isolate_exit_, 0, 2)
 
static const char * NewConstChar (const char *chars)
 
static ObjectPtr DeserializeMessage (Thread *thread, Message *message)
 
static void ThrowIsolateSpawnException (const String &message)
 
static const char * String2UTF8 (const String &str)
 
 DEFINE_NATIVE_ENTRY (Isolate_spawnFunction, 0, 10)
 
static const char * CanonicalizeUri (Thread *thread, const Library &library, const String &uri, char **error)
 
 DEFINE_NATIVE_ENTRY (Isolate_spawnUri, 0, 12)
 
 DEFINE_NATIVE_ENTRY (Isolate_getDebugName, 0, 1)
 
 DEFINE_NATIVE_ENTRY (Isolate_getPortAndCapabilitiesOfCurrentIsolate, 0, 0)
 
 DEFINE_NATIVE_ENTRY (Isolate_getCurrentRootUriStr, 0, 0)
 
 DEFINE_NATIVE_ENTRY (Isolate_registerKernelBlob, 0, 1)
 
 DEFINE_NATIVE_ENTRY (Isolate_unregisterKernelBlob, 0, 1)
 
 DEFINE_NATIVE_ENTRY (Isolate_sendOOB, 0, 2)
 
static void ExternalTypedDataFinalizer (void *isolate_callback_data, void *peer)
 
static intptr_t GetTypedDataSizeOrThrow (const Instance &instance)
 
 DEFINE_NATIVE_ENTRY (TransferableTypedData_factory, 0, 2)
 
 DEFINE_NATIVE_ENTRY (TransferableTypedData_materialize, 0, 1)
 
 DEFINE_NATIVE_ENTRY (Math_doublePow, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Random_initialSeed, 0, 0)
 
 DEFINE_NATIVE_ENTRY (SecureRandom_getBytes, 0, 1)
 
static InstancePtr CreateMirror (const String &mirror_class_name, const Array &constructor_arguments)
 
static void ThrowNoSuchMethod (const Instance &receiver, const String &function_name, const Array &arguments, const Array &argument_names, const InvocationMirror::Level level, const InvocationMirror::Kind kind)
 
static void EnsureConstructorsAreCompiled (const Function &func)
 
static InstancePtr CreateParameterMirrorList (const Function &func, const FunctionType &signature, const Instance &owner_mirror)
 
static InstancePtr CreateTypeVariableMirror (const TypeParameter &param, const Instance &owner_mirror)
 
static InstancePtr CreateTypeVariableList (const Class &cls)
 
static InstancePtr CreateFunctionTypeMirror (const AbstractType &type)
 
static InstancePtr CreateMethodMirror (const Function &func, const Instance &owner_mirror, const AbstractType &instantiator)
 
static InstancePtr CreateVariableMirror (const Field &field, const Instance &owner_mirror)
 
static InstancePtr CreateClassMirror (const Class &cls, const AbstractType &type, const Bool &is_declaration, const Instance &owner_mirror)
 
static bool IsCensoredLibrary (const String &url)
 
static InstancePtr CreateLibraryMirror (Thread *thread, const Library &lib)
 
static InstancePtr CreateCombinatorMirror (const Object &identifiers, bool is_show)
 
static InstancePtr CreateLibraryDependencyMirror (Thread *thread, const Instance &importer, const Library &importee, const Array &show_names, const Array &hide_names, const Object &metadata, const LibraryPrefix &prefix, const String &prefix_name, const bool is_import, const bool is_deferred)
 
static InstancePtr CreateLibraryDependencyMirror (Thread *thread, const Instance &importer, const Namespace &ns, const LibraryPrefix &prefix, const bool is_import, const bool is_deferred)
 
 DEFINE_NATIVE_ENTRY (LibraryMirror_fromPrefix, 0, 1)
 
 DEFINE_NATIVE_ENTRY (LibraryMirror_libraryDependencies, 0, 2)
 
static InstancePtr CreateTypeMirror (const AbstractType &type)
 
static InstancePtr CreateIsolateMirror ()
 
static void VerifyMethodKindShifts ()
 
static AbstractTypePtr InstantiateType (const AbstractType &type, const AbstractType &instantiator)
 
 DEFINE_NATIVE_ENTRY (MirrorSystem_libraries, 0, 0)
 
 DEFINE_NATIVE_ENTRY (MirrorSystem_isolate, 0, 0)
 
static void ThrowLanguageError (const char *message)
 
 DEFINE_NATIVE_ENTRY (IsolateMirror_loadUri, 0, 1)
 
 DEFINE_NATIVE_ENTRY (Mirrors_makeLocalClassMirror, 0, 1)
 
 DEFINE_NATIVE_ENTRY (Mirrors_makeLocalTypeMirror, 0, 1)
 
 DEFINE_NATIVE_ENTRY (Mirrors_instantiateGenericType, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Mirrors_mangleName, 0, 2)
 
 DEFINE_NATIVE_ENTRY (MirrorReference_equals, 0, 2)
 
 DEFINE_NATIVE_ENTRY (DeclarationMirror_metadata, 0, 1)
 
 DEFINE_NATIVE_ENTRY (FunctionTypeMirror_call_method, 0, 2)
 
 DEFINE_NATIVE_ENTRY (FunctionTypeMirror_parameters, 0, 2)
 
 DEFINE_NATIVE_ENTRY (FunctionTypeMirror_return_type, 0, 1)
 
 DEFINE_NATIVE_ENTRY (ClassMirror_libraryUri, 0, 1)
 
 DEFINE_NATIVE_ENTRY (ClassMirror_supertype, 0, 1)
 
 DEFINE_NATIVE_ENTRY (ClassMirror_supertype_instantiated, 0, 1)
 
 DEFINE_NATIVE_ENTRY (ClassMirror_interfaces, 0, 1)
 
 DEFINE_NATIVE_ENTRY (ClassMirror_interfaces_instantiated, 0, 1)
 
 DEFINE_NATIVE_ENTRY (ClassMirror_mixin, 0, 1)
 
 DEFINE_NATIVE_ENTRY (ClassMirror_mixin_instantiated, 0, 2)
 
 DEFINE_NATIVE_ENTRY (ClassMirror_members, 0, 3)
 
 DEFINE_NATIVE_ENTRY (ClassMirror_constructors, 0, 3)
 
 DEFINE_NATIVE_ENTRY (LibraryMirror_members, 0, 2)
 
 DEFINE_NATIVE_ENTRY (ClassMirror_type_variables, 0, 1)
 
 DEFINE_NATIVE_ENTRY (ClassMirror_type_arguments, 0, 1)
 
 DEFINE_NATIVE_ENTRY (TypeVariableMirror_owner, 0, 1)
 
 DEFINE_NATIVE_ENTRY (TypeVariableMirror_upper_bound, 0, 1)
 
 DEFINE_NATIVE_ENTRY (InstanceMirror_invoke, 0, 5)
 
 DEFINE_NATIVE_ENTRY (InstanceMirror_invokeGetter, 0, 3)
 
 DEFINE_NATIVE_ENTRY (InstanceMirror_invokeSetter, 0, 4)
 
 DEFINE_NATIVE_ENTRY (InstanceMirror_computeType, 0, 1)
 
 DEFINE_NATIVE_ENTRY (ClosureMirror_function, 0, 1)
 
 DEFINE_NATIVE_ENTRY (ClassMirror_invoke, 0, 5)
 
 DEFINE_NATIVE_ENTRY (ClassMirror_invokeGetter, 0, 3)
 
 DEFINE_NATIVE_ENTRY (ClassMirror_invokeSetter, 0, 4)
 
 DEFINE_NATIVE_ENTRY (ClassMirror_invokeConstructor, 0, 5)
 
 DEFINE_NATIVE_ENTRY (LibraryMirror_invoke, 0, 5)
 
 DEFINE_NATIVE_ENTRY (LibraryMirror_invokeGetter, 0, 3)
 
 DEFINE_NATIVE_ENTRY (LibraryMirror_invokeSetter, 0, 4)
 
 DEFINE_NATIVE_ENTRY (MethodMirror_owner, 0, 2)
 
 DEFINE_NATIVE_ENTRY (MethodMirror_parameters, 0, 2)
 
 DEFINE_NATIVE_ENTRY (MethodMirror_return_type, 0, 2)
 
 DEFINE_NATIVE_ENTRY (MethodMirror_source, 0, 1)
 
static InstancePtr CreateSourceLocation (const String &uri, intptr_t line, intptr_t column)
 
 DEFINE_NATIVE_ENTRY (DeclarationMirror_location, 0, 1)
 
 DEFINE_NATIVE_ENTRY (ParameterMirror_type, 0, 3)
 
 DEFINE_NATIVE_ENTRY (VariableMirror_type, 0, 2)
 
 DEFINE_NATIVE_ENTRY (TypeMirror_subtypeTest, 0, 2)
 
 DEFINE_NATIVE_ENTRY (DartAsync_fatal, 0, 1)
 
 DEFINE_NATIVE_ENTRY (Object_equals, 0, 1)
 
static intptr_t GetHash (Isolate *isolate, const ObjectPtr obj)
 
 DEFINE_NATIVE_ENTRY (Object_getHash, 0, 1)
 
 DEFINE_NATIVE_ENTRY (Object_toString, 0, 1)
 
 DEFINE_NATIVE_ENTRY (Object_runtimeType, 0, 1)
 
static bool HaveSameRuntimeTypeHelper (Zone *zone, const Instance &left, const Instance &right)
 
 DEFINE_NATIVE_ENTRY (Object_haveSameRuntimeType, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Object_instanceOf, 0, 4)
 
 DEFINE_NATIVE_ENTRY (Object_simpleInstanceOf, 0, 2)
 
 DEFINE_NATIVE_ENTRY (AbstractType_toString, 0, 1)
 
 DEFINE_NATIVE_ENTRY (AbstractType_getHashCode, 0, 1)
 
 DEFINE_NATIVE_ENTRY (AbstractType_equality, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Type_equality, 0, 2)
 
 DEFINE_NATIVE_ENTRY (LibraryPrefix_isLoaded, 0, 1)
 
 DEFINE_NATIVE_ENTRY (LibraryPrefix_setLoaded, 0, 1)
 
 DEFINE_NATIVE_ENTRY (LibraryPrefix_loadingUnit, 0, 1)
 
 DEFINE_NATIVE_ENTRY (LibraryPrefix_issueLoad, 0, 1)
 
 DEFINE_NATIVE_ENTRY (Internal_unsafeCast, 0, 1)
 
 DEFINE_NATIVE_ENTRY (Internal_nativeEffect, 0, 1)
 
 DEFINE_NATIVE_ENTRY (Internal_collectAllGarbage, 0, 0)
 
 DEFINE_NATIVE_ENTRY (Internal_deoptimizeFunctionsOnStack, 0, 0)
 
 DEFINE_NATIVE_ENTRY (Internal_allocateObjectInstructionsStart, 0, 0)
 
 DEFINE_NATIVE_ENTRY (Internal_allocateObjectInstructionsEnd, 0, 0)
 
static bool ExtractInterfaceTypeArgs (Zone *zone, const Class &instance_cls, const TypeArguments &instance_type_args, const Class &interface_cls, TypeArguments *interface_type_args)
 
 DEFINE_NATIVE_ENTRY (Internal_extractTypeArguments, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Internal_prependTypeArguments, 0, 4)
 
 DEFINE_NATIVE_ENTRY (Internal_boundsCheckForPartialInstantiation, 0, 2)
 
 DEFINE_NATIVE_ENTRY (InvocationMirror_unpackTypeArguments, 0, 2)
 
 DEFINE_NATIVE_ENTRY (NoSuchMethodError_existingMethodSignature, 0, 3)
 
 DEFINE_NATIVE_ENTRY (UserTag_new, 0, 2)
 
 DEFINE_NATIVE_ENTRY (UserTag_label, 0, 1)
 
 DEFINE_NATIVE_ENTRY (UserTag_makeCurrent, 0, 1)
 
 DEFINE_NATIVE_ENTRY (UserTag_defaultTag, 0, 0)
 
 DEFINE_NATIVE_ENTRY (Profiler_getCurrentTag, 0, 0)
 
 DEFINE_NATIVE_ENTRY (RegExp_factory, 0, 6)
 
 DEFINE_NATIVE_ENTRY (RegExp_getPattern, 0, 1)
 
 DEFINE_NATIVE_ENTRY (RegExp_getIsMultiLine, 0, 1)
 
 DEFINE_NATIVE_ENTRY (RegExp_getIsUnicode, 0, 1)
 
 DEFINE_NATIVE_ENTRY (RegExp_getIsDotAll, 0, 1)
 
 DEFINE_NATIVE_ENTRY (RegExp_getIsCaseSensitive, 0, 1)
 
 DEFINE_NATIVE_ENTRY (RegExp_getGroupCount, 0, 1)
 
 DEFINE_NATIVE_ENTRY (RegExp_getGroupNameMap, 0, 1)
 
static ObjectPtr ExecuteMatch (Zone *zone, NativeArguments *arguments, bool sticky)
 
 DEFINE_NATIVE_ENTRY (RegExp_ExecuteMatch, 0, 3)
 
 DEFINE_NATIVE_ENTRY (RegExp_ExecuteMatchSticky, 0, 3)
 
static void ThrowMaskRangeException (int64_t m)
 
 DEFINE_NATIVE_ENTRY (Float32x4_fromDoubles, 0, 4)
 
 DEFINE_NATIVE_ENTRY (Float32x4_splat, 0, 1)
 
 DEFINE_NATIVE_ENTRY (Float32x4_zero, 0, 1)
 
 DEFINE_NATIVE_ENTRY (Float32x4_fromInt32x4Bits, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Float32x4_fromFloat64x2, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Float32x4_add, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Float32x4_negate, 0, 1)
 
 DEFINE_NATIVE_ENTRY (Float32x4_sub, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Float32x4_mul, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Float32x4_div, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Float32x4_cmplt, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Float32x4_cmplte, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Float32x4_cmpgt, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Float32x4_cmpgte, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Float32x4_cmpequal, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Float32x4_cmpnequal, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Float32x4_scale, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Float32x4_abs, 0, 1)
 
 DEFINE_NATIVE_ENTRY (Float32x4_clamp, 0, 3)
 
 DEFINE_NATIVE_ENTRY (Float32x4_getX, 0, 1)
 
 DEFINE_NATIVE_ENTRY (Float32x4_getY, 0, 1)
 
 DEFINE_NATIVE_ENTRY (Float32x4_getZ, 0, 1)
 
 DEFINE_NATIVE_ENTRY (Float32x4_getW, 0, 1)
 
 DEFINE_NATIVE_ENTRY (Float32x4_getSignMask, 0, 1)
 
 DEFINE_NATIVE_ENTRY (Int32x4_getSignMask, 0, 1)
 
 DEFINE_NATIVE_ENTRY (Float32x4_shuffle, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Float32x4_shuffleMix, 0, 3)
 
 DEFINE_NATIVE_ENTRY (Float32x4_setX, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Float32x4_setY, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Float32x4_setZ, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Float32x4_setW, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Float32x4_min, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Float32x4_max, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Float32x4_sqrt, 0, 1)
 
 DEFINE_NATIVE_ENTRY (Float32x4_reciprocal, 0, 1)
 
 DEFINE_NATIVE_ENTRY (Float32x4_reciprocalSqrt, 0, 1)
 
 DEFINE_NATIVE_ENTRY (Int32x4_fromInts, 0, 4)
 
 DEFINE_NATIVE_ENTRY (Int32x4_fromBools, 0, 4)
 
 DEFINE_NATIVE_ENTRY (Int32x4_fromFloat32x4Bits, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Int32x4_or, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Int32x4_and, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Int32x4_xor, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Int32x4_add, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Int32x4_sub, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Int32x4_getX, 0, 1)
 
 DEFINE_NATIVE_ENTRY (Int32x4_getY, 0, 1)
 
 DEFINE_NATIVE_ENTRY (Int32x4_getZ, 0, 1)
 
 DEFINE_NATIVE_ENTRY (Int32x4_getW, 0, 1)
 
 DEFINE_NATIVE_ENTRY (Int32x4_shuffle, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Int32x4_shuffleMix, 0, 3)
 
 DEFINE_NATIVE_ENTRY (Int32x4_setX, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Int32x4_setY, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Int32x4_setZ, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Int32x4_setW, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Int32x4_getFlagX, 0, 1)
 
 DEFINE_NATIVE_ENTRY (Int32x4_getFlagY, 0, 1)
 
 DEFINE_NATIVE_ENTRY (Int32x4_getFlagZ, 0, 1)
 
 DEFINE_NATIVE_ENTRY (Int32x4_getFlagW, 0, 1)
 
 DEFINE_NATIVE_ENTRY (Int32x4_setFlagX, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Int32x4_setFlagY, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Int32x4_setFlagZ, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Int32x4_setFlagW, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Int32x4_select, 0, 3)
 
 DEFINE_NATIVE_ENTRY (Float64x2_fromDoubles, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Float64x2_splat, 0, 1)
 
 DEFINE_NATIVE_ENTRY (Float64x2_zero, 0, 1)
 
 DEFINE_NATIVE_ENTRY (Float64x2_fromFloat32x4, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Float64x2_add, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Float64x2_negate, 0, 1)
 
 DEFINE_NATIVE_ENTRY (Float64x2_sub, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Float64x2_mul, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Float64x2_div, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Float64x2_scale, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Float64x2_abs, 0, 1)
 
 DEFINE_NATIVE_ENTRY (Float64x2_clamp, 0, 3)
 
 DEFINE_NATIVE_ENTRY (Float64x2_getX, 0, 1)
 
 DEFINE_NATIVE_ENTRY (Float64x2_getY, 0, 1)
 
 DEFINE_NATIVE_ENTRY (Float64x2_getSignMask, 0, 1)
 
 DEFINE_NATIVE_ENTRY (Float64x2_setX, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Float64x2_setY, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Float64x2_min, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Float64x2_max, 0, 2)
 
 DEFINE_NATIVE_ENTRY (Float64x2_sqrt, 0, 1)
 
 DECLARE_FLAG (bool, show_invisible_frames)
 
static StackTracePtr CreateStackTraceObject (Zone *zone, const GrowableObjectArray &code_list, const GrowableArray< uword > &pc_offset_list)
 
static StackTracePtr CurrentStackTrace (Thread *thread, intptr_t skip_frames=1)
 
StackTracePtr GetStackTraceForException ()
 
 DEFINE_NATIVE_ENTRY (StackTrace_current, 0, 0)
 
static void AppendFrames (const GrowableObjectArray &code_list, GrowableArray< uword > *pc_offset_list, int skip_frames)
 
const StackTraceGetCurrentStackTrace (int skip_frames)
 
bool HasStack ()
 
 DEFINE_NATIVE_ENTRY (Stopwatch_now, 0, 0)
 
 DEFINE_NATIVE_ENTRY (Stopwatch_frequency, 0, 0)
 
 DEFINE_NATIVE_ENTRY (String_fromEnvironment, 0, 3)
 
 DEFINE_NATIVE_ENTRY (StringBase_createFromCodePoints, 0, 3)
 
 DEFINE_NATIVE_ENTRY (StringBase_substringUnchecked, 0, 3)
 
static uint16_t CharacterLimit (const String &string, intptr_t start, intptr_t end)
 
static bool CheckSlicesOneByte (const String &base, const Array &matches, const int len)
 
 DEFINE_NATIVE_ENTRY (StringBase_joinReplaceAllResult, 0, 4)
 
 DEFINE_NATIVE_ENTRY (StringBase_intern, 0, 1)
 
 DEFINE_NATIVE_ENTRY (OneByteString_substringUnchecked, 0, 3)
 
 DEFINE_NATIVE_ENTRY (Internal_allocateOneByteString, 0, 1)
 
 DEFINE_NATIVE_ENTRY (Internal_allocateTwoByteString, 0, 1)
 
 DEFINE_NATIVE_ENTRY (OneByteString_allocateFromOneByteList, 0, 3)
 
 DEFINE_NATIVE_ENTRY (Internal_writeIntoOneByteString, 0, 3)
 
 DEFINE_NATIVE_ENTRY (Internal_writeIntoTwoByteString, 0, 3)
 
 DEFINE_NATIVE_ENTRY (TwoByteString_allocateFromTwoByteList, 0, 3)
 
 DEFINE_NATIVE_ENTRY (String_getHashCode, 0, 1)
 
 DEFINE_NATIVE_ENTRY (String_getLength, 0, 1)
 
static uint16_t StringValueAt (const String &str, const Integer &index)
 
 DEFINE_NATIVE_ENTRY (String_charAt, 0, 2)
 
 DEFINE_NATIVE_ENTRY (String_concat, 0, 2)
 
 DEFINE_NATIVE_ENTRY (String_toLowerCase, 0, 1)
 
 DEFINE_NATIVE_ENTRY (String_toUpperCase, 0, 1)
 
 DEFINE_NATIVE_ENTRY (String_concatRange, 0, 3)
 
 DEFINE_NATIVE_ENTRY (StringBuffer_createStringFromUint16Array, 0, 3)
 
 DEFINE_NATIVE_ENTRY (Timeline_isDartStreamEnabled, 0, 0)
 
 DEFINE_NATIVE_ENTRY (Timeline_getNextTaskId, 0, 0)
 
 DEFINE_NATIVE_ENTRY (Timeline_getTraceClock, 0, 0)
 
 DEFINE_NATIVE_ENTRY (Timeline_reportTaskEvent, 0, 5)
 
 DEFINE_NATIVE_ENTRY (TypedDataBase_length, 0, 1)
 
 DEFINE_NATIVE_ENTRY (TypedDataView_offsetInBytes, 0, 1)
 
 DEFINE_NATIVE_ENTRY (TypedDataView_typedData, 0, 1)
 
static bool IsTypedDataUint8ArrayClassId (intptr_t cid)
 
 DEFINE_NATIVE_ENTRY (TypedDataBase_setClampedRange, 0, 5)
 
 DEFINE_NATIVE_ENTRY (Uri_isWindowsPlatform, 0, 0)
 
 DECLARE_FLAG (bool, trace_service)
 
 DEFINE_NATIVE_ENTRY (VMService_SendIsolateServiceMessage, 0, 2)
 
 DEFINE_NATIVE_ENTRY (VMService_SendRootServiceMessage, 0, 1)
 
 DEFINE_NATIVE_ENTRY (VMService_SendObjectRootServiceMessage, 0, 1)
 
 DEFINE_NATIVE_ENTRY (VMService_OnStart, 0, 0)
 
 DEFINE_NATIVE_ENTRY (VMService_OnExit, 0, 0)
 
 DEFINE_NATIVE_ENTRY (VMService_OnServerAddressChange, 0, 1)
 
 DEFINE_NATIVE_ENTRY (VMService_ListenStream, 0, 2)
 
 DEFINE_NATIVE_ENTRY (VMService_CancelStream, 0, 1)
 
 DEFINE_NATIVE_ENTRY (VMService_RequestAssets, 0, 0)
 
static void ContentsFinalizer (void *isolate_callback_data, void *peer)
 
 DEFINE_NATIVE_ENTRY (VMService_DecodeAssets, 0, 1)
 
 DEFINE_NATIVE_ENTRY (VMService_AddUserTagsToStreamableSampleList, 0, 1)
 
 DEFINE_NATIVE_ENTRY (VMService_RemoveUserTagsFromStreamableSampleList, 0, 1)
 
void * calloc (size_t n, size_t size)
 
void * malloc (size_t size)
 
void * realloc (void *ptr, size_t size)
 
template<typename T >
static T LoadRelaxed (const T *ptr)
 
constexpr intptr_t RoundWordsToKB (intptr_t size_in_words)
 
constexpr intptr_t RoundWordsToMB (intptr_t size_in_words)
 
constexpr intptr_t RoundWordsToGB (intptr_t size_in_words)
 
constexpr double WordsToMB (intptr_t size_in_words)
 
constexpr double MicrosecondsToSeconds (int64_t micros)
 
constexpr double MicrosecondsToMilliseconds (int64_t micros)
 
template<typename T >
static void USE (T &&)
 
template<class D , class S >
DART_FORCE_INLINE D bit_cast (const S &source)
 
template<class D , class S >
DART_FORCE_INLINE D bit_copy (const S &source)
 
static uint8_t Hex (uint8_t value)
 
template<typename T >
static T LoadUnaligned (const T *ptr)
 
template<typename T >
static void StoreUnaligned (T *ptr, T value)
 
static void GetLastErrorAsString (char **error)
 
sys::ComponentContext * ComponentContext ()
 
void SetDartVmNode (std::unique_ptr< inspect::Node > node)
 
std::unique_ptr< inspect::Node > TakeDartVmNode ()
 
char * CheckIsAtLeastMinRequiredMacOSVersion ()
 
static void * Allocate (uword size, Zone *zone)
 
static void StackAllocatedDestructionHelper (int *ptr)
 
 ISOLATE_UNIT_TEST_CASE (StackAllocatedDestruction)
 
static void StackAllocatedLongJumpHelper (int *ptr, LongJumpScope *jump)
 
 ISOLATE_UNIT_TEST_CASE (StackAllocatedLongJump)
 
static void StackedStackResourceDestructionHelper (int *ptr)
 
static void StackResourceDestructionHelper (int *ptr)
 
 ISOLATE_UNIT_TEST_CASE (StackResourceDestruction)
 
static void StackedStackResourceLongJumpHelper (int *ptr, LongJumpScope *jump)
 
static void StackResourceLongJumpHelper (int *ptr, LongJumpScope *jump)
 
 ISOLATE_UNIT_TEST_CASE (StackResourceLongJump)
 
 TEST_CASE (AMA_Test)
 
 DEFINE_FLAG (bool, print_cluster_information, false, "Print information about clusters written to snapshot")
 
 COMPILE_ASSERT (kUnreachableReference==WeakTable::kNoValue)
 
static constexpr bool IsAllocatedReference (intptr_t ref)
 
static constexpr bool IsArtificialReference (intptr_t ref)
 
static constexpr bool IsReachableReference (intptr_t ref)
 
static UnboxedFieldBitmap CalculateTargetUnboxedFieldsBitmap (Serializer *s, intptr_t class_id)
 
template<bool need_entry_point_for_non_discarded>
static DART_FORCE_INLINE CodePtr GetCodeAndEntryPointByIndex (const Deserializer *d, intptr_t code_index, uword *entry_point)
 
static int CompareClusters (SerializationCluster *const *a, SerializationCluster *const *b)
 
 VM_UNIT_TEST_CASE (FetchAndIncrement)
 
 VM_UNIT_TEST_CASE (FetchAndDecrement)
 
 VM_UNIT_TEST_CASE (FetchAndIncrementSigned)
 
 VM_UNIT_TEST_CASE (FetchAndDecrementSigned)
 
 VM_UNIT_TEST_CASE (IncrementBy)
 
 VM_UNIT_TEST_CASE (DecrementBy)
 
 VM_UNIT_TEST_CASE (FetchOrRelaxed)
 
 VM_UNIT_TEST_CASE (FetchAndRelaxed)
 
 VM_UNIT_TEST_CASE (LoadRelaxed)
 
 TEST_CASE (CompareAndSwapWord)
 
 TEST_CASE (CompareAndSwapUint32)
 
uint8_t * DecodeBase64 (const char *str, intptr_t *out_decoded_len)
 
 TEST_CASE (Base64Decode)
 
 TEST_CASE (Base64DecodeMalformed)
 
 TEST_CASE (Base64DecodeEmpty)
 
 BENCHMARK (CorelibCompileAll)
 
static char * ComputeKernelServicePath (const char *arg)
 
 BENCHMARK (CorelibIsolateStartup)
 
static void InitNativeFields (Dart_NativeArguments args)
 
static void UseDartApi (Dart_NativeArguments args)
 
static Dart_NativeFunction bm_uda_lookup (Dart_Handle name, int argument_count, bool *auto_setup_scope)
 
 BENCHMARK (UseDartApi)
 
static void vmservice_resolver (Dart_NativeArguments args)
 
static Dart_NativeFunction NativeResolver (Dart_Handle name, int arg_count, bool *auto_setup_scope)
 
 BENCHMARK (KernelServiceCompileAll)
 
static void StackFrame_accessFrame (Dart_NativeArguments args)
 
static Dart_NativeFunction StackFrameNativeResolver (Dart_Handle name, int arg_count, bool *auto_setup_scope)
 
 BENCHMARK (FrameLookup)
 
 BENCHMARK_SIZE (CoreSnapshotSize)
 
 BENCHMARK_SIZE (StandaloneSnapshotSize)
 
 BENCHMARK (CreateMirrorSystem)
 
 BENCHMARK (EnterExitIsolate)
 
 BENCHMARK (SerializeNull)
 
 BENCHMARK (SerializeSmi)
 
 BENCHMARK (SimpleMessage)
 
 BENCHMARK (LargeMap)
 
 BENCHMARK_MEMORY (InitialRSS)
 
 DECLARE_FLAG (int, code_heap_size)
 
 DECLARE_FLAG (int, old_gen_growth_space_ratio)
 
Dart_Handle NewString (const char *str)
 
template<intptr_t Size>
void TestBitSet ()
 
 TEST_CASE (BitSetBasic)
 
 TEST_CASE (BitVector)
 
 VM_UNIT_TEST_CASE (BitFields)
 
template<typename T >
static void TestSignExtendedBitField ()
 
template<typename T >
static void TestNotSignExtendedBitField ()
 
 VM_UNIT_TEST_CASE (BitFields_SignedField)
 
 VM_UNIT_TEST_CASE_WITH_EXPECTATION (BitFields_Assert, DEBUG_CRASH)
 
static CompressedStackMapsPtr MapsFromBuilder (Zone *zone, BitmapBuilder *bmap)
 
 ISOLATE_UNIT_TEST_CASE (BitmapBuilder)
 
 ISOLATE_UNIT_TEST_CASE (BitmapBuilder_Regress44946)
 
 VM_UNIT_TEST_CASE (BoolField)
 
static void Finish (Thread *thread)
 
static ErrorPtr BootstrapFromKernelSingleProgram (Thread *thread, std::unique_ptr< kernel::Program > program)
 
static ErrorPtr BootstrapFromKernel (Thread *thread, const uint8_t *kernel_buffer, intptr_t kernel_buffer_size)
 
static CatchEntryMove NewMove (intptr_t src, intptr_t dst)
 
void RunTestCaseWithPermutations (const TestCaseMoves *mapping, intptr_t *insert_permutation, intptr_t count)
 
void RunTestCase (const TestCaseMoves *mapping, intptr_t count)
 
 ISOLATE_UNIT_TEST_CASE (CatchEntryMoves)
 
 DEFINE_FLAG (bool, print_classes, false, "Prints details about loaded classes.")
 
 DEFINE_FLAG (bool, trace_class_finalization, false, "Trace class finalization.")
 
 DEFINE_FLAG (bool, trace_type_finalization, false, "Trace type finalization.")
 
static void RemoveCHAOptimizedCode (const Class &subclass, const GrowableArray< intptr_t > &added_subclass_to_cids)
 
static void AddSuperType (const AbstractType &type, GrowableArray< intptr_t > *finalized_super_classes)
 
static void CollectFinalizedSuperClasses (const Class &cls_, GrowableArray< intptr_t > *finalized_super_classes)
 
static void CollectImmediateSuperInterfaces (const Class &cls, GrowableArray< intptr_t > *cids)
 
static bool IsPotentialExactGeneric (const AbstractType &type)
 
static void MarkImplemented (Zone *zone, const Class &iface)
 
static ClassPtr CreateTestClass (const char *name)
 
 ISOLATE_UNIT_TEST_CASE (ClassFinalizer)
 
bool IsInternalOnlyClassId (intptr_t index)
 
bool IsErrorClassId (intptr_t index)
 
bool IsNumberClassId (intptr_t index)
 
bool IsIntegerClassId (intptr_t index)
 
bool IsStringClassId (intptr_t index)
 
bool IsOneByteStringClassId (intptr_t index)
 
bool IsBuiltinListClassId (intptr_t index)
 
bool IsTypeClassId (intptr_t index)
 
bool IsTypedDataBaseClassId (intptr_t index)
 
bool IsTypedDataClassId (intptr_t index)
 
bool IsTypedDataViewClassId (intptr_t index)
 
bool IsExternalTypedDataClassId (intptr_t index)
 
bool IsFfiPointerClassId (intptr_t index)
 
bool IsFfiTypeClassId (intptr_t index)
 
bool IsFfiDynamicLibraryClassId (intptr_t index)
 
bool IsInternalVMdefinedClassId (intptr_t index)
 
bool IsImplicitFieldClassId (intptr_t index)
 
 COMPILE_ASSERT (kFirstInternalOnlyCid==kObjectCid+1)
 
 COMPILE_ASSERT (kInstanceCid==kLastInternalOnlyCid+1)
 
 COMPILE_ASSERT (kFirstErrorCid==kErrorCid &&kApiErrorCid==kFirstErrorCid+1 &&kLanguageErrorCid==kFirstErrorCid+2 &&kUnhandledExceptionCid==kFirstErrorCid+3 &&kUnwindErrorCid==kFirstErrorCid+4 &&kLastErrorCid==kUnwindErrorCid &&kLastInternalOnlyCid==kLastErrorCid)
 
bool IsConcreteTypeClassId (intptr_t index)
 
 COMPILE_ASSERT (kOneByteStringCid==kStringCid+1 &&kTwoByteStringCid==kStringCid+2)
 
bool IsArrayClassId (intptr_t index)
 
 COMPILE_ASSERT (kTypedDataCidRemainderInternal==0)
 
 COMPILE_ASSERT (kTypedDataInt8ArrayCid+kTypedDataCidRemainderView==kTypedDataInt8ArrayViewCid)
 
 COMPILE_ASSERT (kFirstTypedDataCid==kTypedDataInt8ArrayCid)
 
 COMPILE_ASSERT (kFirstTypedDataCid+1 *kNumTypedDataCidRemainders==kTypedDataUint8ArrayCid)
 
 COMPILE_ASSERT (kFirstTypedDataCid+2 *kNumTypedDataCidRemainders==kTypedDataUint8ClampedArrayCid)
 
 COMPILE_ASSERT (kFirstTypedDataCid+3 *kNumTypedDataCidRemainders==kTypedDataInt16ArrayCid)
 
 COMPILE_ASSERT (kFirstTypedDataCid+4 *kNumTypedDataCidRemainders==kTypedDataUint16ArrayCid)
 
 COMPILE_ASSERT (kFirstTypedDataCid+5 *kNumTypedDataCidRemainders==kTypedDataInt32ArrayCid)
 
 COMPILE_ASSERT (kFirstTypedDataCid+6 *kNumTypedDataCidRemainders==kTypedDataUint32ArrayCid)
 
 COMPILE_ASSERT (kFirstTypedDataCid+7 *kNumTypedDataCidRemainders==kTypedDataInt64ArrayCid)
 
 COMPILE_ASSERT (kFirstTypedDataCid+8 *kNumTypedDataCidRemainders==kTypedDataUint64ArrayCid)
 
 COMPILE_ASSERT (kFirstTypedDataCid+9 *kNumTypedDataCidRemainders==kTypedDataFloat32ArrayCid)
 
 COMPILE_ASSERT (kFirstTypedDataCid+10 *kNumTypedDataCidRemainders==kTypedDataFloat64ArrayCid)
 
 COMPILE_ASSERT (kFirstTypedDataCid+11 *kNumTypedDataCidRemainders==kTypedDataFloat32x4ArrayCid)
 
 COMPILE_ASSERT (kFirstTypedDataCid+12 *kNumTypedDataCidRemainders==kTypedDataInt32x4ArrayCid)
 
 COMPILE_ASSERT (kFirstTypedDataCid+13 *kNumTypedDataCidRemainders==kTypedDataFloat64x2ArrayCid)
 
 COMPILE_ASSERT (kFirstTypedDataCid+13 *kNumTypedDataCidRemainders+kTypedDataCidRemainderUnmodifiable==kLastTypedDataCid)
 
 COMPILE_ASSERT (kFfiStructCid+1==kFirstTypedDataCid)
 
 COMPILE_ASSERT (kLastTypedDataCid+1==kByteDataViewCid)
 
bool IsUnmodifiableTypedDataViewClassId (intptr_t index)
 
bool IsClampedTypedDataBaseClassId (intptr_t index)
 
bool IsExternalPayloadClassId (classid_t cid)
 
bool IsDeeplyImmutableCid (intptr_t predefined_cid)
 
bool IsShallowlyImmutableCid (intptr_t predefined_cid)
 
bool ShouldHaveImmutabilityBitSetCid (intptr_t predefined_cid)
 
bool IsFfiPredefinedClassId (classid_t class_id)
 
 COMPILE_ASSERT (kByteBufferCid+1==kNullCid)
 
 DEFINE_FLAG (bool, print_class_table, false, "Print initial class table.")
 
static void NativeFunc (Dart_NativeArguments args)
 
static Dart_NativeFunction native_resolver (Dart_Handle name, int argument_count, bool *auto_setup_scope)
 
 TEST_CASE (StackMapGC)
 
 ISOLATE_UNIT_TEST_CASE (DescriptorList_TokenPositions)
 
 DEFINE_FLAG (bool, write_protect_code, kShouldWriteProtectCodeByDefault, "Write protect jitted code")
 
bool MatchesPattern (uword end, const int16_t *pattern, intptr_t size)
 
 DEFINE_FLAG (int, max_exhaustive_polymorphic_checks, 5, "If a call receiver is known to be of at most this many classes, " "generate exhaustive class tests instead of a megamorphic call")
 
 DEFINE_FLAG (bool, print_precompiler_timings, false, "Print per-phase breakdown of time spent precompiling")
 
 DEFINE_FLAG (bool, print_unique_targets, false, "Print unique dynamic targets")
 
 DEFINE_FLAG (charp, print_object_layout_to, nullptr, "Print layout of Dart objects to the given file")
 
 DEFINE_FLAG (bool, trace_precompiler, false, "Trace precompiler.")
 
 DEFINE_FLAG (int, max_speculative_inlining_attempts, 1, "Max number of attempts with speculative inlining (precompilation only)")
 
 DEFINE_FLAG (charp, write_retained_reasons_to, nullptr, "Print reasons for retaining objects to the given file")
 
 DECLARE_FLAG (bool, print_flow_graph)
 
 DECLARE_FLAG (bool, print_flow_graph_optimized)
 
 DECLARE_FLAG (bool, trace_compiler)
 
 DECLARE_FLAG (bool, trace_optimizing_compiler)
 
 DECLARE_FLAG (bool, trace_bailout)
 
 DECLARE_FLAG (bool, trace_failed_optimization_attempts)
 
 DECLARE_FLAG (bool, trace_inlining_intervals)
 
 DECLARE_FLAG (int, inlining_hotness)
 
 DECLARE_FLAG (int, inlining_size_threshold)
 
 DECLARE_FLAG (int, inlining_callee_size_threshold)
 
 DECLARE_FLAG (int, inline_getters_setters_smaller_than)
 
 DECLARE_FLAG (int, inlining_depth_threshold)
 
 DECLARE_FLAG (int, inlining_caller_size_threshold)
 
 DECLARE_FLAG (int, inlining_constant_arguments_max_size_threshold)
 
 DECLARE_FLAG (int, inlining_constant_arguments_min_size_threshold)
 
 DECLARE_FLAG (bool, print_instruction_stats)
 
 DEFINE_FLAG (bool, check_code_pointer, false, "Verify instructions offset in code object." "NOTE: This breaks the profiler.")
 
 ASSEMBLER_TEST_RUN (StoreIntoObject, test)
 
 ASSEMBLER_TEST_RUN (InstantiateTypeArgumentsHashKeys, test)
 
 DEFINE_FLAG (bool, trace_source_positions, false, "Source position diagnostics")
 
 DEFINE_FLAG (bool, include_inlining_info_in_disassembly, true, "Include inlining information when printing disassembly") void DisassembleToStdout
 
 ISOLATE_UNIT_TEST_CASE (Disassembler)
 
 ISOLATE_UNIT_TEST_CASE (Disassembler_InvalidInput)
 
static intptr_t CountBoundChecks (FlowGraph *flow_graph)
 
static std::pair< intptr_t, intptr_t > ApplyBCE (const char *script_chars, CompilerPass::PipelineMode mode)
 
static void TestScriptJIT (const char *script_chars, intptr_t expected_before, intptr_t expected_after)
 
 ISOLATE_UNIT_TEST_CASE (BCECannotRemove)
 
 ISOLATE_UNIT_TEST_CASE (BCERemoveOne)
 
 ISOLATE_UNIT_TEST_CASE (BCESimpleLoops)
 
 ISOLATE_UNIT_TEST_CASE (BCESimpleLoopsDown)
 
 ISOLATE_UNIT_TEST_CASE (BCEModulo)
 
 ISOLATE_UNIT_TEST_CASE (BCELowerTriangular)
 
 ISOLATE_UNIT_TEST_CASE (BCEUpperTriangular)
 
 ISOLATE_UNIT_TEST_CASE (BCETriangularDown)
 
 ISOLATE_UNIT_TEST_CASE (BCENamedLength)
 
 ISOLATE_UNIT_TEST_CASE (BCEBubbleSort)
 
 ISOLATE_UNIT_TEST_CASE (BCEArithmeticWrapAround)
 
 ISOLATE_UNIT_TEST_CASE (BCEListNamedAndPlainLength)
 
static intptr_t GetEdgeCount (const Array &edge_counters, intptr_t edge_id)
 
static void SetEdgeWeight (BlockEntryInstr *block, BlockEntryInstr *successor, const Array &edge_counters, intptr_t entry_count)
 
static void Union (GrowableArray< Chain * > *chains, Chain *source_chain, Chain *target_chain)
 
static bool PhiHasSingleUse (PhiInstr *phi, Value *use)
 
static bool IsTrivialBlock (BlockEntryInstr *block, Definition *defn)
 
static void EliminateTrivialBlock (BlockEntryInstr *block, Definition *instr, IfThenElseInstr *before)
 
 DEFINE_FLAG (bool, remove_redundant_phis, true, "Remove redundant phis.")
 
 DEFINE_FLAG (bool, trace_constant_propagation, false, "Print constant propagation and useless code elimination.")
 
static bool IsIdenticalConstants (const Object &left, const Object &right)
 
static bool CompareIntegers (Token::Kind kind, const Integer &left, const Integer &right)
 
static bool IsIntegerOrDouble (const Object &value)
 
static double ToDouble (const Object &value)
 
static RedefinitionInstrInsertRedefinition (FlowGraph *graph, BlockEntryInstr *dom, Definition *original, const Object &constant_value)
 
static bool HasPhis (BlockEntryInstr *block)
 
static bool IsEmptyBlock (BlockEntryInstr *block)
 
static BlockEntryInstrFindFirstNonEmptySuccessor (TargetEntryInstr *block, BitVector *empty_blocks)
 
 ISOLATE_UNIT_TEST_CASE (ConstantPropagation_PhiUnwrappingAndConvergence)
 
void StrictCompareSentinel (Thread *thread, bool negate, bool non_sentinel_on_left)
 
 ISOLATE_UNIT_TEST_CASE (ConstantPropagator_StrictCompareEqualsSentinelLeft)
 
 ISOLATE_UNIT_TEST_CASE (ConstantPropagator_StrictCompareEqualsSentinelRightt)
 
 ISOLATE_UNIT_TEST_CASE (ConstantPropagator_StrictCompareNotEqualsSentinelLeft)
 
 ISOLATE_UNIT_TEST_CASE (ConstantPropagator_StrictCompareNotEqualsSentinelRight)
 
static IntegerPtr BinaryIntegerEvaluateRaw (const Integer &left, const Integer &right, Token::Kind token_kind)
 
static IntegerPtr UnaryIntegerEvaluateRaw (const Integer &value, Token::Kind token_kind, Zone *zone)
 
static IntegerPtr BitLengthEvaluateRaw (const Integer &value, Zone *zone)
 
 DEFINE_FLAG (bool, prune_dead_locals, true, "optimize dead locals away")
 
static bool ShouldReorderBlocks (const Function &function, FlowGraph::CompilationMode mode)
 
static bool IsMarkedWithNoBoundsChecks (const Function &function)
 
static void PrintBitVector (const char *tag, BitVector *v)
 
static Location EnvIndexToStackLocation (intptr_t num_direct_parameters, intptr_t env_index)
 
static bool IsUnboxedInteger (Representation rep)
 
static bool ShouldInlineSimd ()
 
static bool CanUnboxDouble ()
 
static bool CanConvertInt64ToDouble ()
 
static bool NeedsRecordBoxing (Definition *def)
 
static bool IsDominatedUse (Instruction *dom, Value *use)
 
static bool IsPositiveOrZeroSmiConst (Definition *d)
 
static BinarySmiOpInstrAsSmiShiftLeftInstruction (Definition *d)
 
static TargetEntryInstrNewTarget (FlowGraph *graph, Instruction *inherit)
 
static JoinEntryInstrNewJoin (FlowGraph *graph, Instruction *inherit)
 
static GotoInstrNewGoto (FlowGraph *graph, JoinEntryInstr *target, Instruction *inherit)
 
static BranchInstrNewBranch (FlowGraph *graph, ComparisonInstr *cmp, Instruction *inherit)
 
 DEFINE_FLAG (bool, trace_inlining_intervals, false, "Inlining interval diagnostics")
 
 DEFINE_FLAG (bool, enable_peephole, true, "Enable peephole optimization")
 
 DEFINE_FLAG (bool, enable_simd_inline, true, "Enable inlining of SIMD related method calls.")
 
 DEFINE_FLAG (int, min_optimization_counter_threshold, 5000, "The minimum invocation count for a function.")
 
 DEFINE_FLAG (int, optimization_counter_scale, 2000, "The scale of invocation count, by size of the function.")
 
 DEFINE_FLAG (bool, source_lines, false, "Emit source line as assembly comment.")
 
 DEFINE_FLAG (bool, force_indirect_calls, false, "Do not emit PC relative calls.")
 
 DECLARE_FLAG (charp, deoptimize_filter)
 
 DECLARE_FLAG (bool, intrinsify)
 
 DECLARE_FLAG (int, regexp_optimization_counter_threshold)
 
 DECLARE_FLAG (int, reoptimization_counter_threshold)
 
 DECLARE_FLAG (int, stacktrace_every)
 
 DECLARE_FLAG (charp, stacktrace_filter)
 
 DECLARE_FLAG (int, gc_every)
 
 DEFINE_FLAG (bool, align_all_loops, false, "Align all loop headers to 32 byte boundary")
 
static bool IsPusher (Instruction *instr)
 
static bool IsPopper (Instruction *instr)
 
static const CodeStubEntryFor (const ICData &ic_data, bool optimized)
 
static Register AllocateFreeRegister (bool *blocked_registers)
 
static FpuRegister AllocateFreeFpuRegister (bool *blocked_registers)
 
 ISOLATE_UNIT_TEST_CASE (FlowGraph_LateVariablePhiUnboxing)
 
 ISOLATE_UNIT_TEST_CASE (FlowGraph_UnboxedFloatPhi)
 
void TestLargeFrame (const char *type, const char *zero, const char *one, const char *main)
 
 ISOLATE_UNIT_TEST_CASE (FlowGraph_LargeFrame_Int)
 
 ISOLATE_UNIT_TEST_CASE (FlowGraph_LargeFrame_Double)
 
 ISOLATE_UNIT_TEST_CASE (FlowGraph_LargeFrame_Int32x4)
 
 ISOLATE_UNIT_TEST_CASE (FlowGraph_LargeFrame_Float32x4)
 
 ISOLATE_UNIT_TEST_CASE (FlowGraph_LargeFrame_Float64x2)
 
 ISOLATE_UNIT_TEST_CASE (FlowGraph_PhiUnboxingHeuristic_Double)
 
static void TestPhiUnboxingHeuristicSimd (const char *script)
 
 ISOLATE_UNIT_TEST_CASE (FlowGraph_PhiUnboxingHeuristic_Float32x4)
 
 ISOLATE_UNIT_TEST_CASE (FlowGraph_PhiUnboxingHeuristic_Float64x2)
 
 ISOLATE_UNIT_TEST_CASE (FlowGraph_PhiUnboxingHeuristic_Int32x4)
 
 DEFINE_FLAG (bool, propagate_ic_data, true, "Propagate IC data from unoptimized to optimized IC calls.")
 
 DEFINE_FLAG (bool, two_args_smi_icd, true, "Generate special IC stubs for two args Smi operations")
 
 DECLARE_FLAG (bool, inline_alloc)
 
 DECLARE_FLAG (bool, use_slow_path)
 
static int OrderById (CidRange *const *a, CidRange *const *b)
 
static int OrderByFrequencyThenId (CidRange *const *a, CidRange *const *b)
 
static intptr_t Usage (Thread *thread, const Function &function)
 
static bool IsMarked (BlockEntryInstr *block, GrowableArray< BlockEntryInstr * > *preorder)
 
static intptr_t RepresentationBits (Representation r)
 
static int64_t RepresentationMask (Representation r)
 
static DefinitionCanonicalizeCommutativeDoubleArithmetic (Token::Kind op, Value *left, Value *right)
 
static bool IsCommutative (Token::Kind op)
 
static bool IsFpCompare (ComparisonInstr *comp)
 
static bool MayBeBoxableNumber (intptr_t cid)
 
static bool MayBeNumber (CompileType *type)
 
static DefinitionCanonicalizeStrictCompare (StrictCompareInstr *compare, bool *negated, bool is_branch)
 
static bool BindsToGivenConstant (Value *v, intptr_t expected)
 
static bool RecognizeTestPattern (Value *left, Value *right, bool *negate)
 
static bool IsSingleUseUnboxOrConstant (Value *use)
 
static CodePtr TwoArgsSmiOpInlineCacheEntry (Token::Kind kind)
 
static FunctionPtr FindBinarySmiOp (Zone *zone, const String &name)
 
static const StringEvaluateToString (Zone *zone, Definition *defn)
 
static DefinitionCanonicalizeStringInterpolate (StaticCallInstr *call, FlowGraph *flow_graph)
 
static DefinitionCanonicalizeStringInterpolateSingle (StaticCallInstr *call, FlowGraph *flow_graph)
 
static bool AllInputsAreRedefinitions (PhiInstr *phi)
 
static AlignmentType StrengthenAlignment (intptr_t cid, AlignmentType alignment)
 
 DEFINE_BACKEND (LoadThread,(Register out))
 
static constexpr Representation SimdRepresentation (Representation rep)
 
 ISOLATE_UNIT_TEST_CASE (InstructionTests)
 
 ISOLATE_UNIT_TEST_CASE (OptimizationTests)
 
 ISOLATE_UNIT_TEST_CASE (IRTest_EliminateWriteBarrier)
 
static void ExpectStores (FlowGraph *flow_graph, const std::vector< const char * > &expected_stores)
 
static void RunInitializingStoresTest (const Library &root_library, const char *function_name, CompilerPass::PipelineMode mode, const std::vector< const char * > &expected_stores)
 
 ISOLATE_UNIT_TEST_CASE (IRTest_InitializingStores)
 
bool TestIntConverterCanonicalizationRule (Thread *thread, int64_t min_value, int64_t max_value, Representation initial, Representation intermediate, Representation final)
 
 ISOLATE_UNIT_TEST_CASE (IL_IntConverterCanonicalization)
 
 ISOLATE_UNIT_TEST_CASE (IL_PhiCanonicalization)
 
 ISOLATE_UNIT_TEST_CASE (IL_UnboxIntegerCanonicalization)
 
static void WriteCidTo (intptr_t cid, BaseTextBuffer *buffer)
 
static void TestNullAwareEqualityCompareCanonicalization (Thread *thread, bool allow_representation_change)
 
 ISOLATE_UNIT_TEST_CASE (IL_Canonicalize_EqualityCompare)
 
static void WriteCidRangeVectorTo (const CidRangeVector &ranges, BaseTextBuffer *buffer)
 
static bool ExpectRangesContainCid (const Expect &expect, const CidRangeVector &ranges, intptr_t expected)
 
static void RangesContainExpectedCids (const Expect &expect, const CidRangeVector &ranges, const GrowableArray< intptr_t > &expected)
 
 ISOLATE_UNIT_TEST_CASE (HierarchyInfo_Object_Subtype)
 
 ISOLATE_UNIT_TEST_CASE (HierarchyInfo_Function_Subtype)
 
 ISOLATE_UNIT_TEST_CASE (HierarchyInfo_Num_Subtype)
 
 ISOLATE_UNIT_TEST_CASE (HierarchyInfo_Int_Subtype)
 
 ISOLATE_UNIT_TEST_CASE (HierarchyInfo_String_Subtype)
 
 ISOLATE_UNIT_TEST_CASE (IRTest_DoubleEqualsSmi)
 
 ISOLATE_UNIT_TEST_CASE (IRTest_LoadThread)
 
 ISOLATE_UNIT_TEST_CASE (IRTest_CachableIdempotentCall)
 
FlowGraphSetupFfiFlowgraph (TestPipeline *pipeline, const compiler::ffi::CallMarshaller &marshaller, uword native_entry, bool is_leaf)
 
 ISOLATE_UNIT_TEST_CASE (IRTest_FfiCallInstrLeafDoesntSpill)
 
static void TestConstantFoldToSmi (const Library &root_library, const char *function_name, CompilerPass::PipelineMode mode, intptr_t expected_value)
 
 ISOLATE_UNIT_TEST_CASE (ConstantFold_bitLength)
 
static void TestRepresentationChangeDuringCanonicalization (Thread *thread, bool allow_representation_change)
 
 ISOLATE_UNIT_TEST_CASE (IL_Canonicalize_RepresentationChange)
 
static void TestCanonicalizationOfTypedDataViewFieldLoads (Thread *thread, TypeDataField field_kind)
 
 ISOLATE_UNIT_TEST_CASE (IL_Canonicalize_TypedDataViewFactory)
 
 ISOLATE_UNIT_TEST_CASE (IL_Canonicalize_InstanceCallWithNoICDataInAOT)
 
static void TestTestRangeCanonicalize (const AbstractType &type, uword lower, uword upper, bool result)
 
 ISOLATE_UNIT_TEST_CASE (IL_Canonicalize_TestRange)
 
void TestStaticFieldForwarding (Thread *thread, const Class &test_cls, const Field &field, intptr_t num_stores, bool expected_to_forward)
 
 ISOLATE_UNIT_TEST_CASE (IL_Canonicalize_FinalFieldForwarding)
 
LibraryPtr LoadTestScript (const char *script, Dart_NativeEntryResolver resolver, const char *lib_uri)
 
LibraryPtr ReloadTestScript (const char *script)
 
FunctionPtr GetFunction (const Library &lib, const char *name)
 
ClassPtr GetClass (const Library &lib, const char *name)
 
TypeParameterPtr GetClassTypeParameter (const Class &klass, intptr_t index)
 
TypeParameterPtr GetFunctionTypeParameter (const Function &fun, intptr_t index)
 
ObjectPtr Invoke (const Library &lib, const char *name)
 
InstructionsPtr BuildInstructions (std::function< void(compiler::Assembler *assembler)> fun)
 
 NOT_IN_PRODUCT (LibraryPtr ReloadTestScript(const char *script))
 
 DEFINE_FLAG (int, deoptimization_counter_inlining_threshold, 12, "How many times we allow deoptimization before we stop inlining.")
 
 DEFINE_FLAG (bool, trace_inlining, false, "Trace inlining")
 
 DEFINE_FLAG (charp, inlining_filter, nullptr, "Inline only in named function")
 
 DEFINE_FLAG (int, inline_getters_setters_smaller_than, 10, "Always inline getters and setters that have fewer instructions")
 
 DEFINE_FLAG (int, inlining_depth_threshold, 6, "Inline function calls up to threshold nesting depth")
 
 DEFINE_FLAG (int, inlining_size_threshold, 25, "Always inline functions that have threshold or fewer instructions")
 
 DEFINE_FLAG (int, inlining_callee_call_sites_threshold, 1, "Always inline functions containing threshold or fewer calls.")
 
 DEFINE_FLAG (int, inlining_callee_size_threshold, 160, "Do not inline callees larger than threshold")
 
 DEFINE_FLAG (int, inlining_small_leaf_size_threshold, 50, "Do not inline leaf callees larger than threshold")
 
 DEFINE_FLAG (int, inlining_caller_size_threshold, 50000, "Stop inlining once caller reaches the threshold.")
 
 DEFINE_FLAG (int, inlining_hotness, 10, "Inline only hotter calls, in percents (0 .. 100); " "default 10%: calls above-equal 10% of max-count are inlined.")
 
 DEFINE_FLAG (int, inlining_recursion_depth_threshold, 1, "Inline recursive function calls up to threshold recursion depth.")
 
 DEFINE_FLAG (int, max_inlined_per_depth, 500, "Max. number of inlined calls per depth")
 
 DEFINE_FLAG (bool, print_inlining_tree, false, "Print inlining tree")
 
 DECLARE_FLAG (int, max_deoptimization_counter_threshold)
 
static bool IsCallRecursive (const Function &function, Definition *call)
 
static intptr_t AotCallCountApproximation (intptr_t nesting_depth)
 
static bool IsSmallLeafOrReduction (int inlining_depth, intptr_t call_site_instructions, FlowGraph *graph)
 
static bool IsAThisCallThroughAnUncheckedEntryPoint (Definition *call)
 
static bool CalleeParameterTypeMightBeMoreSpecific (BitVector *is_generic_covariant_impl, const FunctionType &interface_target_signature, const FunctionType &callee_signature, intptr_t first_arg_index, intptr_t arg_index)
 
static void ReplaceParameterStubs (Zone *zone, FlowGraph *caller_graph, InlinedCallData *call_data, const TargetInfo *target_info)
 
static InstructionAppendInstruction (Instruction *first, Instruction *second)
 
static void TracePolyInlining (const CallTargets &targets, intptr_t idx, intptr_t total, const char *message)
 
static bool IsInlineableOperator (const Function &function)
 
 ISOLATE_UNIT_TEST_CASE (Inliner_PolyInliningRedefinition)
 
 ISOLATE_UNIT_TEST_CASE (Inliner_TypedData_Regress7551)
 
 ISOLATE_UNIT_TEST_CASE (Inliner_InlineForceOptimized)
 
static void TestPrint (Dart_NativeArguments args)
 
void InspectStack (Dart_NativeArguments args)
 
static Dart_NativeFunction PrintAndInspectResolver (Dart_Handle name, int argument_count, bool *auto_setup_scope)
 
 TEST_CASE (Inliner_InlineAndRunForceOptimized)
 
static intptr_t MinPosition (intptr_t a, intptr_t b)
 
static bool IsInstructionStartPosition (intptr_t pos)
 
static bool IsInstructionEndPosition (intptr_t pos)
 
static intptr_t ToInstructionStart (intptr_t pos)
 
static intptr_t ToInstructionEnd (intptr_t pos)
 
static ExtraLoopInfoComputeExtraLoopInfo (Zone *zone, LoopInfo *loop_info)
 
static const GrowableArray< BlockEntryInstr * > & BlockOrderForAllocation (const FlowGraph &flow_graph)
 
static void DeepLiveness (MaterializeObjectInstr *mat, BitVector *live_in)
 
static bool HasOnlyUnconstrainedUsesInLoop (LiveRange *range, intptr_t boundary)
 
static bool HasOnlyUnconstrainedUses (LiveRange *range)
 
static Location::Kind RegisterKindFromPolicy (Location loc)
 
static ParallelMoveInstrCreateParallelMoveBefore (Instruction *instr, intptr_t pos)
 
static ParallelMoveInstrCreateParallelMoveAfter (Instruction *instr, intptr_t pos)
 
static UsePositionFirstUseAfter (UsePosition *use, intptr_t after)
 
static intptr_t FirstIntersection (UseInterval *a, UseInterval *u)
 
template<typename PositionType >
PositionType * SplitListOfPositions (PositionType **head, intptr_t split_pos, bool split_at_start)
 
static bool ShouldBeAllocatedBefore (LiveRange *a, LiveRange *b)
 
static void AddToSortedListOfRanges (GrowableArray< LiveRange * > *list, LiveRange *range)
 
static LiveRangeFindCover (LiveRange *parent, intptr_t pos)
 
static bool AreLocationsAllTheSame (const GrowableArray< Location > &locs)
 
static void EmitMoveOnEdge (BlockEntryInstr *succ, BlockEntryInstr *pred, const MoveOperands &move)
 
static Representation RepresentationForRange (Representation definition_rep)
 
static bool ValidOutputForAlwaysCalls (const Location &loc)
 
Location LocationRegisterOrConstant (Value *value)
 
Location LocationRegisterOrSmiConstant (Value *value, intptr_t min_value, intptr_t max_value)
 
Location LocationWritableRegisterOrConstant (Value *value)
 
Location LocationWritableRegisterOrSmiConstant (Value *value, intptr_t min_value, intptr_t max_value)
 
Location LocationFixedRegisterOrConstant (Value *value, Register reg)
 
Location LocationFixedRegisterOrSmiConstant (Value *value, Register reg)
 
Location LocationAnyOrConstant (Value *value)
 
compiler::Address LocationToStackSlotAddress (Location loc)
 
Location LocationArgumentsDescriptorLocation ()
 
Location LocationExceptionLocation ()
 
Location LocationStackTraceLocation ()
 
Location LocationRemapForSlowPath (Location loc, Definition *def, intptr_t *cpu_reg_slots, intptr_t *fpu_reg_slots)
 
intptr_t LocationCount (Representation rep)
 
template<typename Instr , typename Out >
LocationSummaryMakeLocationSummaryFromEmitter (Zone *zone, const Instr *instr, void(*Emit)(FlowGraphCompiler *, Instr *, Out))
 
template<typename Instr , typename Out , typename T0 >
 DEFINE_MAKE_LOCATION_SUMMARY_SPECIALIZATION (1,(T0))
 
template<typename Instr , typename Out , typename T0 , typename T1 >
 DEFINE_MAKE_LOCATION_SUMMARY_SPECIALIZATION (2,(T0, T1))
 
template<typename Instr , typename Out , typename T0 , typename T1 , typename T2 >
 DEFINE_MAKE_LOCATION_SUMMARY_SPECIALIZATION (3,(T0, T1, T2))
 
template<typename Instr , typename Out , typename T0 , typename T1 , typename T2 , typename T3 >
 DEFINE_MAKE_LOCATION_SUMMARY_SPECIALIZATION (4,(T0, T1, T2, T3))
 
template<typename Instr , typename Out , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 >
 DEFINE_MAKE_LOCATION_SUMMARY_SPECIALIZATION (5,(T0, T1, T2, T3, T4))
 
template<typename Instr , typename Out >
void InvokeEmitter (FlowGraphCompiler *compiler, Instr *instr, void(*Emit)(FlowGraphCompiler *, Instr *, Out))
 
template<typename Instr , typename Out , typename T0 >
void InvokeEmitter (FlowGraphCompiler *compiler, Instr *instr, void(*Emit)(FlowGraphCompiler *, Instr *, Out, T0))
 
template<typename Instr , typename Out , typename T0 , typename T1 >
void InvokeEmitter (FlowGraphCompiler *compiler, Instr *instr, void(*Emit)(FlowGraphCompiler *, Instr *, Out, T0, T1))
 
template<typename Instr , typename Out , typename T0 , typename T1 , typename T2 >
void InvokeEmitter (FlowGraphCompiler *compiler, Instr *instr, void(*Emit)(FlowGraphCompiler *, Instr *, Out, T0, T1, T2))
 
template<typename Instr , typename Out , typename T0 , typename T1 , typename T2 , typename T3 >
void InvokeEmitter (FlowGraphCompiler *compiler, Instr *instr, void(*Emit)(FlowGraphCompiler *, Instr *, Out, T0, T1, T2, T3))
 
template<typename Instr , typename Out , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 >
void InvokeEmitter (FlowGraphCompiler *compiler, Instr *instr, void(*Emit)(FlowGraphCompiler *, Instr *, Out, T0, T1, T2, T3, T4))
 
static LocationArrayMakeLocationArray ()
 
static LocationArrayMakeLocationArray (Location loc0)
 
static LocationArrayMakeLocationArray (Location loc0, Location loc1)
 
static void ValidateSummary (LocationSummary *locs, Location expected_output, const LocationArray *expected_inputs, const LocationArray *expected_temps)
 
static void FillSummary (LocationSummary *locs, Location expected_output, const LocationArray *expected_inputs, const LocationArray *expected_temps)
 
 INSTRUCTION_TEST (Unary, 1,(Register out, Register in), ReqReg,(ReqReg),(), RegLoc(0),(RegLoc(1)),())
 
 INSTRUCTION_TEST (Binary1, 2,(Register out, Register in0, FpuRegister in1), ReqReg,(ReqReg, Location::RequiresFpuRegister()),(), RegLoc(0),(RegLoc(1), FpuLoc(2)),())
 
 INSTRUCTION_TEST (Binary2, 2,(Register out, FpuRegister in0, Register in1), ReqReg,(ReqFpu, ReqReg),(), RegLoc(0),(FpuLoc(1), RegLoc(2)),())
 
 INSTRUCTION_TEST (FixedOutput, 0,(Fixed< Register, Reg(3)> out), RegLoc(3),(),(), RegLoc(3),(),())
 
 INSTRUCTION_TEST (FixedInput, 1,(FpuRegister out, Fixed< FpuRegister, Fpu(3)> in), ReqFpu,(FpuLoc(3)),(), FpuLoc(0),(FpuLoc(3)),())
 
 INSTRUCTION_TEST (SameAsFirstInput, 2,(SameAsFirstInput, Register in0, Register in1), Location::SameAsFirstInput(),(ReqReg, ReqReg),(), RegLoc(0),(RegLoc(0), RegLoc(1)),())
 
 INSTRUCTION_TEST (Temps, 2,(Register out, Register in0, FpuRegister in1, Temp< FpuRegister > temp0, Temp< Register > temp1), ReqReg,(ReqReg, ReqFpu),(ReqFpu, ReqReg), RegLoc(0),(RegLoc(1), FpuLoc(2)),(FpuLoc(3), RegLoc(4)))
 
 INSTRUCTION_TEST (FixedTemp, 0,(FpuRegister out, Temp< Fixed< FpuRegister, Fpu(3)> > temp), ReqFpu,(),(FpuLoc(3)), FpuLoc(4),(),(FpuLoc(3)))
 
static intptr_t InitIndex (LoopInfo *loop)
 
static bool IsConstant (Definition *def, int64_t *val)
 
static bool CanBeMadeExclusive (LoopInfo *loop, InductionVar *x, Instruction *branch, bool is_lower)
 
static bool SafelyAdjust (Zone *zone, InductionVar *lower_bound, int64_t lower_bound_offset, InductionVar *upper_bound, int64_t upper_bound_offset, InductionVar **min, InductionVar **max)
 
void TestString (BaseTextBuffer *f, LoopInfo *loop, const GrowableArray< BlockEntryInstr * > &preorder)
 
static const char * ComputeInduction (Thread *thread, const char *script_chars)
 
 ISOLATE_UNIT_TEST_CASE (BasicInductionUp)
 
 ISOLATE_UNIT_TEST_CASE (BasicInductionDown)
 
 ISOLATE_UNIT_TEST_CASE (BasicInductionStepUp)
 
 ISOLATE_UNIT_TEST_CASE (BasicInductionStepDown)
 
 ISOLATE_UNIT_TEST_CASE (BasicInductionLoopNest)
 
 ISOLATE_UNIT_TEST_CASE (ChainInduction)
 
 ISOLATE_UNIT_TEST_CASE (TwoWayInduction)
 
 ISOLATE_UNIT_TEST_CASE (DerivedInduction)
 
 ISOLATE_UNIT_TEST_CASE (WrapAroundAndDerived)
 
 ISOLATE_UNIT_TEST_CASE (PeriodicAndDerived)
 
 ISOLATE_UNIT_TEST_CASE (NonStrictConditionUp)
 
 ISOLATE_UNIT_TEST_CASE (NonStrictConditionUpWrap)
 
 ISOLATE_UNIT_TEST_CASE (NonStrictConditionDown)
 
 ISOLATE_UNIT_TEST_CASE (NonStrictConditionDownWrap)
 
 ISOLATE_UNIT_TEST_CASE (NotEqualConditionUp)
 
 ISOLATE_UNIT_TEST_CASE (NotEqualConditionDown)
 
 ISOLATE_UNIT_TEST_CASE (SecondExitUp)
 
 ISOLATE_UNIT_TEST_CASE (SecondExitDown)
 
static classid_t TypedDataCidForElementSize (intptr_t elem_size)
 
static intptr_t ExpectedValue (intptr_t i)
 
static void InitializeMemory (uint8_t *input, uint8_t *output)
 
static bool CheckMemory (Expect expect, const uint8_t *input, const uint8_t *output, intptr_t dest_start, intptr_t src_start, intptr_t length, intptr_t elem_size)
 
static void RunMemoryCopyInstrTest (intptr_t src_start, intptr_t dest_start, intptr_t length, intptr_t elem_size, bool unboxed_inputs, bool use_same_buffer)
 
static uword RegMaskBit (Register reg)
 
 DEFINE_FLAG (bool, array_bounds_check_elimination, true, "Eliminate redundant bounds checks.")
 
 DEFINE_FLAG (bool, trace_range_analysis, false, "Trace range analysis progress")
 
 DEFINE_FLAG (bool, trace_integer_ir_selection, false, "Print integer IR selection optimization pass.")
 
 DECLARE_FLAG (bool, trace_constant_propagation)
 
static DefinitionUnwrapConstraint (Definition *defn)
 
static bool AreEqualDefinitions (Definition *a, Definition *b)
 
static bool DependOnSameSymbol (const RangeBoundary &a, const RangeBoundary &b)
 
static RangeBoundary WidenMin (const Range *range, const Range *new_range, RangeBoundary::RangeSize size)
 
static RangeBoundary WidenMax (const Range *range, const Range *new_range, RangeBoundary::RangeSize size)
 
static RangeBoundary NarrowMin (const Range *range, const Range *new_range, RangeBoundary::RangeSize size)
 
static RangeBoundary NarrowMax (const Range *range, const Range *new_range, RangeBoundary::RangeSize size)
 
static RangeBoundary::RangeSize RangeSizeForPhi (Definition *phi)
 
static void NarrowBinaryInt64Op (BinaryInt64OpInstr *int64_op)
 
static void NarrowShiftInt64Op (ShiftIntegerOpInstr *int64_op)
 
static RangeBoundary CanonicalizeBoundary (const RangeBoundary &a, const RangeBoundary &overflow)
 
static bool CanonicalizeMaxBoundary (RangeBoundary *a)
 
static bool CanonicalizeMinBoundary (RangeBoundary *a)
 
static bool CanonicalizeForComparison (RangeBoundary *a, RangeBoundary *b, BoundaryOp op, const RangeBoundary &overflow)
 
static RangeBoundary::RangeSize RepresentationToRangeSize (Representation r)
 
static void ConvertRangeToUnsigned (int64_t a, int64_t b, uint64_t *ua, uint64_t *ub)
 
static void ConvertRangeToSigned (uint64_t a, uint64_t b, int64_t *sa, int64_t *sb)
 
static int BitSize (const Range *range)
 
static bool DependsOnSymbol (const RangeBoundary &a, Definition *symbol)
 
static void Join (Range *range, Definition *defn, const Range *defn_range, RangeBoundary::RangeSize size)
 
static bool DominatesPhi (BlockEntryInstr *a, BlockEntryInstr *phi_block)
 
static RangeBoundary EnsureAcyclicSymbol (BlockEntryInstr *phi_block, const RangeBoundary &a, const RangeBoundary &limit)
 
static const RangeGetInputRange (RangeAnalysis *analysis, RangeBoundary::RangeSize size, Value *input)
 
static void CacheRange (Range **slot, const Range *range, RangeBoundary::RangeSize size)
 
static bool IsRedundantBasedOnRangeInformation (Value *index, Value *length)
 
 TEST_CASE (RangeTests)
 
 TEST_CASE (RangeTestsInt64Range)
 
 TEST_CASE (RangeUtils)
 
 TEST_CASE (RangeBinaryOp)
 
 TEST_CASE (RangeAdd)
 
 TEST_CASE (RangeSub)
 
 TEST_CASE (RangeAnd)
 
 TEST_CASE (RangeIntersectionMinMax)
 
 TEST_CASE (RangeJoinMinMax)
 
 ISOLATE_UNIT_TEST_CASE (RangeAnalysis_LoadClassId)
 
 ISOLATE_UNIT_TEST_CASE (ReachabilityFence_Simple)
 
 ISOLATE_UNIT_TEST_CASE (ReachabilityFence_Loop)
 
 ISOLATE_UNIT_TEST_CASE (ReachabilityFence_NoCanonicalize)
 
 DEFINE_FLAG (bool, dead_store_elimination, true, "Eliminate dead stores")
 
 DEFINE_FLAG (bool, load_cse, true, "Use redundant load elimination.")
 
 DEFINE_FLAG (bool, optimize_lazy_initializer_calls, true, "Eliminate redundant lazy initializer calls.")
 
 DEFINE_FLAG (bool, trace_load_optimization, false, "Print live sets for load optimization pass.")
 
static DefinitionGetStoredValue (Instruction *instr)
 
static bool IsPhiDependentPlace (Place *place)
 
static PhiPlaceMovesComputePhiMoves (PointerSet< Place > *map, ZoneGrowableArray< Place * > *places, bool print_traces)
 
static DART_FORCE_INLINE void SetPlaceId (Instruction *instr, intptr_t id)
 
static DART_FORCE_INLINE bool HasPlaceId (const Instruction *instr)
 
static DART_FORCE_INLINE intptr_t GetPlaceId (const Instruction *instr)
 
static AliasedSetNumberPlaces (FlowGraph *graph, PointerSet< Place > *map, CSEMode mode)
 
static bool IsLoadEliminationCandidate (Instruction *instr)
 
static bool IsLoopInvariantLoad (ZoneGrowableArray< BitVector * > *sets, intptr_t loop_header_index, Instruction *instr)
 
static bool IsValidLengthForAllocationSinking (ArrayAllocationInstr *array_alloc)
 
static bool IsSupportedAllocation (Instruction *instr)
 
static DefinitionStoreDestination (Value *use)
 
static DefinitionLoadSource (Definition *instr)
 
static void AddSlot (ZoneGrowableArray< const Slot * > *slots, const Slot &slot)
 
static InstructionExitForMaterialization (MaterializeObjectInstr *mat)
 
static InstructionFirstMaterializationAt (Instruction *exit)
 
static InnerPointerAccess AccessForSlotInAllocatedObject (Definition *alloc, const Slot &slot)
 
template<typename T >
void AddInstruction (GrowableArray< T * > *list, T *value)
 
static bool IsDataFieldOfTypedDataView (Definition *alloc, const Slot &slot)
 
void OptimizeCatchEntryStates (FlowGraph *flow_graph, bool is_aot)
 
static bool HasRealUse (Definition *def)
 
static bool IsMarkedWithNoInterrupts (const Function &function)
 
static void NoopNative (Dart_NativeArguments args)
 
static Dart_NativeFunction NoopNativeLookup (Dart_Handle name, int argument_count, bool *auto_setup_scope)
 
static void FlattenScopeIntoEnvironment (FlowGraph *graph, LocalScope *scope, GrowableArray< LocalVariable * > *env)
 
static void TryCatchOptimizerTest (Thread *thread, const char *script_chars, std::initializer_list< const char * > synchronized)
 
 ISOLATE_UNIT_TEST_CASE (TryCatchOptimizer_DeadParameterElimination_Simple1)
 
 ISOLATE_UNIT_TEST_CASE (TryCatchOptimizer_DeadParameterElimination_Simple2)
 
 ISOLATE_UNIT_TEST_CASE (TryCatchOptimizer_DeadParameterElimination_Cyclic1)
 
 ISOLATE_UNIT_TEST_CASE (TryCatchOptimizer_DeadParameterElimination_Cyclic2)
 
static void TestAliasingViaRedefinition (Thread *thread, bool make_it_escape, std::function< Definition *(CompilerState *S, FlowGraph *, Definition *)> make_redefinition)
 
static DefinitionMakeCheckNull (CompilerState *S, FlowGraph *flow_graph, Definition *defn)
 
static DefinitionMakeRedefinition (CompilerState *S, FlowGraph *flow_graph, Definition *defn)
 
static DefinitionMakeAssertAssignable (CompilerState *S, FlowGraph *flow_graph, Definition *defn)
 
 ISOLATE_UNIT_TEST_CASE (LoadOptimizer_RedefinitionAliasing_CheckNull_NoEscape)
 
 ISOLATE_UNIT_TEST_CASE (LoadOptimizer_RedefinitionAliasing_CheckNull_Escape)
 
 ISOLATE_UNIT_TEST_CASE (LoadOptimizer_RedefinitionAliasing_Redefinition_NoEscape)
 
 ISOLATE_UNIT_TEST_CASE (LoadOptimizer_RedefinitionAliasing_Redefinition_Escape)
 
 ISOLATE_UNIT_TEST_CASE (LoadOptimizer_RedefinitionAliasing_AssertAssignable_NoEscape)
 
 ISOLATE_UNIT_TEST_CASE (LoadOptimizer_RedefinitionAliasing_AssertAssignable_Escape)
 
static void TestAliasingViaStore (Thread *thread, bool make_it_escape, bool make_host_escape, std::function< Definition *(CompilerState *S, FlowGraph *, Definition *)> make_redefinition)
 
 ISOLATE_UNIT_TEST_CASE (LoadOptimizer_AliasingViaStore_CheckNull_NoEscape)
 
 ISOLATE_UNIT_TEST_CASE (LoadOptimizer_AliasingViaStore_CheckNull_Escape)
 
 ISOLATE_UNIT_TEST_CASE (LoadOptimizer_AliasingViaStore_CheckNull_EscapeViaHost)
 
 ISOLATE_UNIT_TEST_CASE (LoadOptimizer_AliasingViaStore_Redefinition_NoEscape)
 
 ISOLATE_UNIT_TEST_CASE (LoadOptimizer_AliasingViaStore_Redefinition_Escape)
 
 ISOLATE_UNIT_TEST_CASE (LoadOptimizer_AliasingViaStore_Redefinition_EscapeViaHost)
 
 ISOLATE_UNIT_TEST_CASE (LoadOptimizer_AliasingViaStore_AssertAssignable_NoEscape)
 
 ISOLATE_UNIT_TEST_CASE (LoadOptimizer_AliasingViaStore_AssertAssignable_Escape)
 
 ISOLATE_UNIT_TEST_CASE (LoadOptimizer_AliasingViaStore_AssertAssignable_EscapeViaHost)
 
 ISOLATE_UNIT_TEST_CASE (LoadOptimizer_AliasingViaTypedDataAndUntaggedTypedData)
 
 ISOLATE_UNIT_TEST_CASE (LoadOptimizer_LoadDataFieldOfNewTypedData)
 
 ISOLATE_UNIT_TEST_CASE (LoadOptimizer_TypedArrayViewAliasing)
 
static void CountLoadsStores (FlowGraph *flow_graph, intptr_t *loads, intptr_t *stores)
 
 ISOLATE_UNIT_TEST_CASE (LoadOptimizer_RedundantStoresAndLoads)
 
 ISOLATE_UNIT_TEST_CASE (LoadOptimizer_RedundantStaticFieldInitialization)
 
 ISOLATE_UNIT_TEST_CASE (LoadOptimizer_RedundantInitializerCallAfterIf)
 
 ISOLATE_UNIT_TEST_CASE (LoadOptimizer_RedundantInitializerCallInLoop)
 
 ISOLATE_UNIT_TEST_CASE (LoadOptimizer_RedundantInitializingStoreAOT)
 
 ISOLATE_UNIT_TEST_CASE (LoadOptimizer_RedundantStoreAOT)
 
 ISOLATE_UNIT_TEST_CASE (AllocationSinking_Arrays)
 
 ISOLATE_UNIT_TEST_CASE (AllocationSinking_Records)
 
 ISOLATE_UNIT_TEST_CASE (DelayAllocations_DelayAcrossCalls)
 
 ISOLATE_UNIT_TEST_CASE (DelayAllocations_DontDelayIntoLoop)
 
 ISOLATE_UNIT_TEST_CASE (CheckStackOverflowElimination_NoInterruptsPragma)
 
 ISOLATE_UNIT_TEST_CASE (BoundsCheckElimination_Pragma)
 
 ISOLATE_UNIT_TEST_CASE (CSE_Redefinitions)
 
 ISOLATE_UNIT_TEST_CASE (AllocationSinking_NoViewDataMaterialization)
 
 ISOLATE_UNIT_TEST_CASE (LICM_Deopt_Regress51220)
 
 ISOLATE_UNIT_TEST_CASE (LICM_Deopt_Regress50245)
 
 TEST_CASE (SlotFromGuardedField)
 
 DEFINE_FLAG (bool, trace_type_propagation, false, "Trace flow graph type propagation")
 
static void TraceStrongModeType (const Instruction *instr, const AbstractType &type)
 
static void TraceStrongModeType (const Instruction *instr, CompileType *compileType)
 
static bool CanPotentiallyBeSmi (const AbstractType &type, bool recurse)
 
static CompileType ComputeListFactoryType (CompileType *inferred_type, Value *type_args_value)
 
static AbstractTypePtr ExtractElementTypeFromArrayType (const AbstractType &array_type)
 
static AbstractTypePtr GetElementTypeFromArray (Value *array)
 
static CompileType ComputeArrayElementType (Value *array)
 
 ISOLATE_UNIT_TEST_CASE (TypePropagator_RedefinitionAfterStrictCompareWithNull)
 
 ISOLATE_UNIT_TEST_CASE (TypePropagator_RedefinitionAfterStrictCompareWithLoadClassId)
 
 ISOLATE_UNIT_TEST_CASE (TypePropagator_Refinement)
 
 ISOLATE_UNIT_TEST_CASE (TypePropagator_Regress36156)
 
 ISOLATE_UNIT_TEST_CASE (CompileType_CanBeSmi)
 
 ISOLATE_UNIT_TEST_CASE (TypePropagator_RegressFlutter76919)
 
 ISOLATE_UNIT_TEST_CASE (TypePropagator_RecordFieldAccess)
 
int LowestFirst (const TokenPosition *a, const TokenPosition *b)
 
static YieldPointsGetYieldPointsFromGraph (FlowGraph *flow_graph)
 
static YieldPointsGetYieldPointsFromCode (const Code &code)
 
void RunTestInMode (CompilerPass::PipelineMode mode)
 
 ISOLATE_UNIT_TEST_CASE (IRTest_YieldIndexAvailableJIT)
 
 ISOLATE_UNIT_TEST_CASE (IRTest_YieldIndexAvailableAOT)
 
 DECLARE_FLAG (bool, enable_simd_inline)
 
static void RefineUseTypes (Definition *instr)
 
static bool ShouldInlineSimd ()
 
static bool CanUnboxDouble ()
 
static bool CanConvertInt64ToDouble ()
 
static bool IsNumberCid (intptr_t cid)
 
static bool ShouldSpecializeForDouble (const BinaryFeedback &binary_feedback)
 
static bool IsLengthOneString (Definition *d)
 
static bool SmiFitsInDouble ()
 
static bool CidTestResultsContains (const ZoneGrowableArray< intptr_t > &results, intptr_t test_cid)
 
static void TryAddTest (ZoneGrowableArray< intptr_t > *results, intptr_t test_cid, bool result)
 
static void PurgeNegativeTestCidsEntries (ZoneGrowableArray< intptr_t > *results)
 
static bool IsSmiValue (Value *val, intptr_t *int_val)
 
static CompileTypeResultType (Definition *call)
 
static bool InlineTypedDataIndexCheck (FlowGraph *flow_graph, Instruction *call, Definition *receiver, GraphEntryInstr *graph_entry, FunctionEntryInstr **entry, Instruction **last, Definition **result, const String &symbol)
 
static intptr_t PrepareInlineIndexedOp (FlowGraph *flow_graph, Instruction *call, intptr_t array_cid, Definition **array, Definition **index, Instruction **cursor)
 
static bool InlineGetIndexed (FlowGraph *flow_graph, bool can_speculate, bool is_dynamic_call, MethodRecognizer::Kind kind, Definition *call, Definition *receiver, GraphEntryInstr *graph_entry, FunctionEntryInstr **entry, Instruction **last, Definition **result)
 
static bool InlineSetIndexed (FlowGraph *flow_graph, MethodRecognizer::Kind kind, const Function &target, Instruction *call, Definition *receiver, const InstructionSource &source, CallSpecializer::ExactnessInfo *exactness, GraphEntryInstr *graph_entry, FunctionEntryInstr **entry, Instruction **last, Definition **result)
 
static bool InlineDoubleOp (FlowGraph *flow_graph, Token::Kind op_kind, Instruction *call, Definition *receiver, GraphEntryInstr *graph_entry, FunctionEntryInstr **entry, Instruction **last, Definition **result)
 
static bool InlineDoubleTestOp (FlowGraph *flow_graph, Instruction *call, Definition *receiver, MethodRecognizer::Kind kind, GraphEntryInstr *graph_entry, FunctionEntryInstr **entry, Instruction **last, Definition **result)
 
static bool InlineGrowableArraySetter (FlowGraph *flow_graph, const Slot &field, StoreBarrierType store_barrier_type, Instruction *call, Definition *receiver, GraphEntryInstr *graph_entry, FunctionEntryInstr **entry, Instruction **last, Definition **result)
 
static bool InlineLoadClassId (FlowGraph *flow_graph, Instruction *call, GraphEntryInstr *graph_entry, FunctionEntryInstr **entry, Instruction **last, Definition **result)
 
static DefinitionPrepareInlineStringIndexOp (FlowGraph *flow_graph, Instruction *call, intptr_t cid, Definition *str, Definition *index, Instruction *cursor)
 
static bool InlineStringBaseCharAt (FlowGraph *flow_graph, Instruction *call, Definition *receiver, intptr_t cid, GraphEntryInstr *graph_entry, FunctionEntryInstr **entry, Instruction **last, Definition **result)
 
static bool InlineStringBaseCodeUnitAt (FlowGraph *flow_graph, Instruction *call, Definition *receiver, intptr_t cid, GraphEntryInstr *graph_entry, FunctionEntryInstr **entry, Instruction **last, Definition **result)
 
static bool CheckMask (Definition *definition, intptr_t *mask_ptr)
 
static bool InlineSimdOp (FlowGraph *flow_graph, bool is_dynamic_call, Instruction *call, Definition *receiver, MethodRecognizer::Kind kind, GraphEntryInstr *graph_entry, FunctionEntryInstr **entry, Instruction **last, Definition **result)
 
static InstructionInlineMul (FlowGraph *flow_graph, Instruction *cursor, Definition *x, Definition *y)
 
static bool InlineMathIntPow (FlowGraph *flow_graph, Instruction *call, GraphEntryInstr *graph_entry, FunctionEntryInstr **entry, Instruction **last, Definition **result)
 
static intptr_t CountFinalizedSubclasses (Thread *thread, const Class &cls)
 
 TEST_CASE (ClassHierarchyAnalysis)
 
 DEFINE_OPTION_HANDLER (CompilerPass::ParseFiltersFromFlag, compiler_passes, "List of comma separated compilation passes flags. " "Use -Name to disable a pass, Name to print IL after it. " "Do --compiler-passes=help for more information.")
 
 DEFINE_FLAG (bool, test_il_serialization, false, "Test IL serialization.")
 
 COMPILER_PASS (ComputeSSA, { flow_graph->ComputeSSA(nullptr);})
 
 COMPILER_PASS (ApplyICData, { state->call_specializer->ApplyICData();})
 
 COMPILER_PASS (TryOptimizePatterns, { flow_graph->TryOptimizePatterns();})
 
 COMPILER_PASS (SetOuterInliningId, { FlowGraphInliner::SetInliningId(flow_graph, 0);})
 
 COMPILER_PASS (Inlining, { FlowGraphInliner inliner(flow_graph, &state->inline_id_to_function, &state->inline_id_to_token_pos, &state->caller_inline_id, state->speculative_policy, state->precompiler);state->inlining_depth=inliner.Inline();})
 
 COMPILER_PASS (TypePropagation, { FlowGraphTypePropagator::Propagate(flow_graph);})
 
 COMPILER_PASS (ApplyClassIds, { state->call_specializer->ApplyClassIds();})
 
 COMPILER_PASS (EliminateStackOverflowChecks, { if(!flow_graph->IsCompiledForOsr()) { CheckStackOverflowElimination::EliminateStackOverflow(flow_graph);} })
 
 COMPILER_PASS (Canonicalize, { if(flow_graph->Canonicalize()) { flow_graph->Canonicalize();} })
 
 COMPILER_PASS (BranchSimplify, { BranchSimplifier::Simplify(flow_graph);})
 
 COMPILER_PASS (IfConvert, { IfConverter::Simplify(flow_graph);})
 
 COMPILER_PASS_REPEAT (ConstantPropagation, { ConstantPropagator::Optimize(flow_graph);return true;})
 
 COMPILER_PASS (OptimisticallySpecializeSmiPhis, { LICM licm(flow_graph);licm.OptimisticallySpecializeSmiPhis();})
 
 COMPILER_PASS (WidenSmiToInt32, { flow_graph->WidenSmiToInt32();})
 
 COMPILER_PASS (SelectRepresentations, { flow_graph->SelectRepresentations();})
 
 COMPILER_PASS (SelectRepresentations_Final, { flow_graph->SelectRepresentations();flow_graph->disallow_unmatched_representations();})
 
 COMPILER_PASS (UseTableDispatch, { state->call_specializer->ReplaceInstanceCallsWithDispatchTableCalls();})
 
 COMPILER_PASS_REPEAT (CSE, { return DominatorBasedCSE::Optimize(flow_graph);})
 
 COMPILER_PASS (LICM, { flow_graph->RenameUsesDominatedByRedefinitions();DEBUG_ASSERT(flow_graph->VerifyRedefinitions());LICM licm(flow_graph);licm.Optimize();flow_graph->RemoveRedefinitions(true);})
 
 COMPILER_PASS (DSE, { DeadStoreElimination::Optimize(flow_graph);})
 
 COMPILER_PASS (RangeAnalysis, { RangeAnalysis range_analysis(flow_graph);range_analysis.Analyze();})
 
 COMPILER_PASS (OptimizeBranches, { ConstantPropagator::OptimizeBranches(flow_graph);})
 
 COMPILER_PASS (OptimizeTypedDataAccesses, { TypedDataSpecializer::Optimize(flow_graph);})
 
 COMPILER_PASS (TryCatchOptimization, { OptimizeCatchEntryStates(flow_graph, CompilerState::Current().is_aot());})
 
 COMPILER_PASS (EliminateEnvironments, { flow_graph->EliminateEnvironments();})
 
 COMPILER_PASS (EliminateDeadPhis, { DeadCodeElimination::EliminateDeadPhis(flow_graph);})
 
 COMPILER_PASS (DCE, { DeadCodeElimination::EliminateDeadCode(flow_graph);})
 
 COMPILER_PASS (DelayAllocations, { DelayAllocations::Optimize(flow_graph);})
 
 COMPILER_PASS (AllocationSinking_Sink, { if(flow_graph->graph_entry() ->catch_entries().is_empty()) { state->sinking=new AllocationSinking(flow_graph);state->sinking->Optimize();} })
 
 COMPILER_PASS (AllocationSinking_DetachMaterializations, { if(state->sinking !=nullptr) { state->sinking->DetachMaterializations();} })
 
 COMPILER_PASS (AllocateRegisters, { flow_graph->InsertMoveArguments();flow_graph->GetLoopHierarchy();FlowGraphAllocator allocator(*flow_graph);allocator.AllocateRegisters();})
 
 COMPILER_PASS (AllocateRegistersForGraphIntrinsic, { flow_graph->set_max_argument_slot_count(0);flow_graph->GetLoopHierarchy();FlowGraphAllocator allocator(*flow_graph, true);allocator.AllocateRegisters();})
 
 COMPILER_PASS (ReorderBlocks, { BlockScheduler::ReorderBlocks(flow_graph);})
 
 COMPILER_PASS (EliminateWriteBarriers, { EliminateWriteBarriers(flow_graph);})
 
 COMPILER_PASS (FinalizeGraph, { intptr_t instruction_count=0;intptr_t call_site_count=0;FlowGraphInliner::CollectGraphInfo(flow_graph, 0, true, &instruction_count, &call_site_count);flow_graph->function().set_inlining_depth(state->inlining_depth);flow_graph->RemoveRedefinitions();})
 
 COMPILER_PASS (TestILSerialization, { if(FLAG_test_il_serialization &&CompilerState::Current().is_aot()) { Zone *zone=flow_graph->zone();auto *detached_defs=new(zone) ZoneGrowableArray< Definition * >(zone, 0);flow_graph->CompactSSA(detached_defs);ZoneWriteStream write_stream(flow_graph->zone(), 1024);FlowGraphSerializer serializer(&write_stream);serializer.WriteFlowGraph(*flow_graph, *detached_defs);ReadStream read_stream(write_stream.buffer(), write_stream.bytes_written());FlowGraphDeserializer deserializer(flow_graph->parsed_function(), &read_stream);state->set_flow_graph(deserializer.ReadFlowGraph());} })
 
 COMPILER_PASS (LoweringAfterCodeMotionDisabled, { flow_graph->ExtractNonInternalTypedDataPayloads();})
 
 COMPILER_PASS (GenerateCode, { state->graph_compiler->CompileGraph();})
 
template<typename T >
TPutIfAbsent (Thread *thread, ZoneGrowableArray< T * > **array_slot, intptr_t index, std::function< T *()> create)
 
DART_EXPORT void Dart_PrepareToAbort ()
 
DART_EXPORT void Dart_DumpNativeStackTrace (void *context)
 
uword FindDoubleConstant (double value)
 
bool SimpleInstanceOfType (const AbstractType &type)
 
 ISOLATE_UNIT_TEST_CASE (StreamingFlowGraphBuilder_ConstFoldStringConcats)
 
 ISOLATE_UNIT_TEST_CASE (StreamingFlowGraphBuilder_FlattenNestedStringInterp)
 
 ISOLATE_UNIT_TEST_CASE (StreamingFlowGraphBuilder_DropEmptyStringInterp)
 
 ISOLATE_UNIT_TEST_CASE (StreamingFlowGraphBuilder_ConcatStringLits)
 
 ISOLATE_UNIT_TEST_CASE (StreamingFlowGraphBuilder_InvariantFlagInListLiterals)
 
 ISOLATE_UNIT_TEST_CASE (StreamingFlowGraphBuilder_TypedClosureCall)
 
 ISOLATE_UNIT_TEST_CASE (StreamingFlowGraphBuilder_StaticGetFinalFieldWithTrivialInitializer)
 
 DEFINE_FLAG (bool, print_huge_methods, false, "Print huge methods (less optimized)")
 
 DEFINE_FLAG (int, force_switch_dispatch_type, -1, "Force switch statements to use a particular dispatch type: " "-1=auto, 0=linear scan, 1=binary search, 2=jump table")
 
 DEFINE_FLAG (bool, intrinsify, true, "Instrinsify when possible")
 
 DEFINE_FLAG (bool, trace_intrinsifier, false, "Trace intrinsifier")
 
 DEFINE_FLAG (int, max_deoptimization_counter_threshold, 16, "How many times we allow deoptimization before we disallow optimization.")
 
 DEFINE_FLAG (charp, optimization_filter, nullptr, "Optimize only named function")
 
 DEFINE_FLAG (bool, print_flow_graph, false, "Print the IR flow graph.")
 
 DEFINE_FLAG (bool, print_flow_graph_optimized, false, "Print the IR flow graph when optimizing.")
 
 DEFINE_FLAG (bool, print_ic_data_map, false, "Print the deopt-id to ICData map in optimizing compiler.")
 
 DEFINE_FLAG (bool, print_code_source_map, false, "Print code source map.")
 
 DEFINE_FLAG (bool, stress_test_background_compilation, false, "Keep background compiler running all the time")
 
 DEFINE_FLAG (bool, stop_on_excessive_deoptimization, false, "Debugging: stops program if deoptimizing same function too often")
 
 DEFINE_FLAG (bool, trace_compiler, false, "Trace compiler operations.")
 
 DEFINE_FLAG (bool, trace_failed_optimization_attempts, false, "Traces all failed optimization attempts")
 
 DEFINE_FLAG (bool, trace_optimizing_compiler, false, "Trace only optimizing compiler operations.")
 
 DEFINE_FLAG (bool, trace_bailout, false, "Print bailout from ssa compiler.")
 
static void PrecompilationModeHandler (bool value)
 
 DEFINE_FLAG_HANDLER (PrecompilationModeHandler, precompilation, "Precompilation mode")
 
 DEFINE_RUNTIME_ENTRY (CompileFunction, 1)
 
static ObjectPtr CompileFunctionHelper (CompilationPipeline *pipeline, const Function &function, volatile bool optimized, intptr_t osr_id)
 
static Token::Kind RecognizeTokenKindHelper (const String &name)
 
static bool IsCreateLargeArray (Definition *defn)
 
void EliminateWriteBarriers (FlowGraph *flow_graph)
 
 ISOLATE_UNIT_TEST_CASE (IRTest_WriteBarrierElimination_JoinSuccessors)
 
 ISOLATE_UNIT_TEST_CASE (IRTest_WriteBarrierElimination_AtLeastOnce)
 
static void TestWBEForArrays (int length)
 
 ISOLATE_UNIT_TEST_CASE (IRTest_WriteBarrierElimination_Arrays)
 
 ISOLATE_UNIT_TEST_CASE (IRTest_WriteBarrierElimination_Regress43786)
 
 ISOLATE_UNIT_TEST_CASE (IRTest_WriteBarrierElimination_LoadLateField)
 
 ISOLATE_UNIT_TEST_CASE (IRTest_WriteBarrierElimination_LoadLateStaticField)
 
 ISOLATE_UNIT_TEST_CASE (CompileFunction)
 
 ISOLATE_UNIT_TEST_CASE (OptimizeCompileFunctionOnHelperThread)
 
 ISOLATE_UNIT_TEST_CASE (CompileFunctionOnHelperThread)
 
 ISOLATE_UNIT_TEST_CASE (RegenerateAllocStubs)
 
 TEST_CASE (EvalExpression)
 
 ISOLATE_UNIT_TEST_CASE (EvalExpressionWithLazyCompile)
 
 ISOLATE_UNIT_TEST_CASE (EvalExpressionExhaustCIDs)
 
 TEST_CASE (ManyClasses)
 
static constexpr bool IsArgumentRegister (Register reg)
 
static constexpr bool IsFpuArgumentRegister (FpuRegister reg)
 
static constexpr bool IsCalleeSavedRegister (Register reg)
 
constexpr bool IsAbiPreservedRegister (Register reg)
 
static ScaleFactor ToScaleFactor (intptr_t index_scale, bool index_unboxed)
 
static Utils::BitsRange< RegisterRegisterRange (uint32_t regs)
 
static DRegister EvenDRegisterOf (QRegister q)
 
static DRegister OddDRegisterOf (QRegister q)
 
static SRegister EvenSRegisterOf (DRegister d)
 
static SRegister OddSRegisterOf (DRegister d)
 
static QRegister QRegisterOf (DRegister d)
 
static QRegister QRegisterOf (SRegister s)
 
static DRegister DRegisterOf (SRegister s)
 
static Condition InvertCondition (Condition c)
 
float ReciprocalEstimate (float op)
 
float ReciprocalStep (float op1, float op2)
 
float ReciprocalSqrtEstimate (float op)
 
float ReciprocalSqrtStep (float op1, float op2)
 
constexpr bool operator== (Register r, LinkRegister)
 
constexpr bool operator!= (Register r, LinkRegister lr)
 
Register ConcreteRegister (LinkRegister)
 
static Register ConcreteRegister (Register r)
 
static Condition InvertCondition (Condition c)
 
static uint64_t RotateRight (uint64_t value, uint8_t rotate, uint8_t width)
 
static uint64_t RepeatBitsAcrossReg (uint8_t reg_size, uint64_t value, uint8_t width)
 
ByteRegister ByteRegisterOf (Register reg)
 
 DECLARE_FLAG (bool, use_compressed_instructions)
 
static Condition InvertCondition (Condition c)
 
int32_t SignExtend (int N, int32_t value)
 
intx_t sign_extend (int32_t x)
 
intx_t sign_extend (int64_t x)
 
intx_t sign_extend (uint32_t x)
 
intx_t sign_extend (uint64_t x)
 
intx_t ImmLo (intx_t imm)
 
intx_t ImmHi (intx_t imm)
 
bool IsBTypeImm (intptr_t imm)
 
uint32_t EncodeBTypeImm (intptr_t imm)
 
intptr_t DecodeBTypeImm (uint32_t encoded)
 
bool IsJTypeImm (intptr_t imm)
 
uint32_t EncodeJTypeImm (intptr_t imm)
 
intptr_t DecodeJTypeImm (uint32_t encoded)
 
bool IsITypeImm (intptr_t imm)
 
uint32_t EncodeITypeImm (intptr_t imm)
 
intptr_t DecodeITypeImm (uint32_t encoded)
 
bool IsUTypeImm (intptr_t imm)
 
uint32_t EncodeUTypeImm (intptr_t imm)
 
intptr_t DecodeUTypeImm (uint32_t encoded)
 
bool IsSTypeImm (intptr_t imm)
 
uint32_t EncodeSTypeImm (intptr_t imm)
 
intptr_t DecodeSTypeImm (uint32_t encoded)
 
bool IsCInstruction (uint16_t parcel)
 
bool IsCSPLoad4Imm (intptr_t imm)
 
uint32_t EncodeCSPLoad4Imm (intptr_t imm)
 
intx_t DecodeCSPLoad4Imm (uint32_t encoding)
 
bool IsCSPLoad8Imm (intptr_t imm)
 
uint32_t EncodeCSPLoad8Imm (intptr_t imm)
 
intx_t DecodeCSPLoad8Imm (uint32_t encoding)
 
bool IsCSPStore4Imm (intptr_t imm)
 
uint32_t EncodeCSPStore4Imm (intptr_t imm)
 
intx_t DecodeCSPStore4Imm (uint32_t encoding)
 
bool IsCSPStore8Imm (intptr_t imm)
 
uint32_t EncodeCSPStore8Imm (intptr_t imm)
 
intx_t DecodeCSPStore8Imm (uint32_t encoding)
 
bool IsCMem4Imm (intptr_t imm)
 
uint32_t EncodeCMem4Imm (intptr_t imm)
 
intx_t DecodeCMem4Imm (uint32_t encoding)
 
bool IsCMem8Imm (intptr_t imm)
 
uint32_t EncodeCMem8Imm (intptr_t imm)
 
intx_t DecodeCMem8Imm (uint32_t encoding)
 
bool IsCJImm (intptr_t imm)
 
uint32_t EncodeCJImm (intptr_t imm)
 
intx_t DecodeCJImm (uint32_t encoding)
 
bool IsCBImm (intptr_t imm)
 
uint32_t EncodeCBImm (intptr_t imm)
 
intx_t DecodeCBImm (uint32_t encoding)
 
bool IsCIImm (intptr_t imm)
 
uint32_t EncodeCIImm (intptr_t imm)
 
intx_t DecodeCIImm (uint32_t encoding)
 
bool IsCUImm (intptr_t imm)
 
uint32_t EncodeCUImm (intptr_t imm)
 
intx_t DecodeCUImm (uint32_t encoding)
 
bool IsCI16Imm (intptr_t imm)
 
uint32_t EncodeCI16Imm (intptr_t imm)
 
intx_t DecodeCI16Imm (uint32_t encoding)
 
bool IsCI4SPNImm (intptr_t imm)
 
uint32_t EncodeCI4SPNImm (intptr_t imm)
 
intx_t DecodeCI4SPNImm (uint32_t encoding)
 
static constexpr Extension RV_I (0)
 
static constexpr Extension RV_M (1)
 
static constexpr Extension RV_A (2)
 
static constexpr Extension RV_F (3)
 
static constexpr Extension RV_D (4)
 
static constexpr Extension RV_C (5)
 
static constexpr Extension RV_Zba (6)
 
static constexpr Extension RV_Zbb (7)
 
static constexpr Extension RV_Zbc (8)
 
static constexpr Extension RV_Zbs (9)
 
static Condition InvertCondition (Condition c)
 
 DECLARE_FLAG (bool, use_sse41)
 
 VM_UNIT_TEST_CASE (Id)
 
 VM_UNIT_TEST_CASE (GetCpuModelTest)
 
 DECLARE_FLAG (bool, trace_shutdown)
 
static void native_echo (Dart_NativeArguments args)
 
static void CustomIsolateImpl_start (Dart_NativeArguments args)
 
static Dart_NativeFunction NativeLookup (Dart_Handle name, int argc, bool *auto_setup_scope)
 
static void NotifyMessage (Dart_Isolate dest_isolate)
 
 VM_UNIT_TEST_CASE (CustomIsolates)
 
 DECLARE_FLAG (bool, print_class_table)
 
 DEFINE_FLAG (bool, trace_shutdown, false, "Trace VM shutdown on stderr")
 
static void DumpAliveIsolates (intptr_t num_attempts, bool only_application_isolates)
 
static bool OnlyVmIsolateLeft ()
 
static void FinalizeBuiltinClasses (Thread *thread)
 
 DEFINE_FLAG (bool, verify_acquired_data, false, "Verify correct API acquire/release of typed data.")
 
 DEFINE_FLAG (bool, dump_tables, false, "Dump common hash tables before snapshotting.")
 
 DEFINE_FLAG (bool, enable_deprecated_wait_for, false, "Enable deprecated dart:cli waitFor. " "This feature will be fully removed in Dart 3.4 release. " "See https://dartbug.com/52121.")
 
const char * CanonicalFunction (const char *func)
 
static InstancePtr GetListInstance (Zone *zone, const Object &obj)
 
static InstancePtr GetMapInstance (Zone *zone, const Object &obj)
 
static bool IsCompiletimeErrorObject (Zone *zone, const Object &obj)
 
static bool GetNativeStringArgument (NativeArguments *arguments, int arg_index, Dart_Handle *str, void **peer)
 
static bool GetNativeIntegerArgument (NativeArguments *arguments, int arg_index, int64_t *value)
 
static bool GetNativeUnsignedIntegerArgument (NativeArguments *arguments, int arg_index, uint64_t *value)
 
static bool GetNativeDoubleArgument (NativeArguments *arguments, int arg_index, double *value)
 
static Dart_Handle GetNativeFieldsOfArgument (NativeArguments *arguments, int arg_index, int num_fields, intptr_t *field_values, const char *current_func)
 
static FunctionPtr FindCoreLibPrivateFunction (Zone *zone, const String &name)
 
static ObjectPtr CallStatic1Arg (Zone *zone, const String &name, const Instance &arg0)
 
static ObjectPtr CallStatic2Args (Zone *zone, const String &name, const Instance &arg0, const Instance &arg1)
 
static ObjectPtr CallStatic3Args (Zone *zone, const String &name, const Instance &arg0, const Instance &arg1, const Instance &arg2)
 
static const char * GetErrorString (Thread *thread, const Object &obj)
 
static Dart_Handle InitNewReadOnlyApiHandle (ObjectPtr raw)
 
DART_EXPORT bool Dart_IsError (Dart_Handle handle)
 
DART_EXPORT void Dart_KillIsolate (Dart_Isolate handle)
 
DART_EXPORT bool Dart_IsApiError (Dart_Handle object)
 
DART_EXPORT bool Dart_IsUnhandledExceptionError (Dart_Handle object)
 
DART_EXPORT bool Dart_IsCompilationError (Dart_Handle object)
 
DART_EXPORT bool Dart_IsFatalError (Dart_Handle object)
 
DART_EXPORT const char * Dart_GetError (Dart_Handle handle)
 
DART_EXPORT bool Dart_ErrorHasException (Dart_Handle handle)
 
DART_EXPORT Dart_Handle Dart_ErrorGetException (Dart_Handle handle)
 
DART_EXPORT Dart_Handle Dart_ErrorGetStackTrace (Dart_Handle handle)
 
DART_EXPORT Dart_Handle Dart_NewApiError (const char *error)
 
DART_EXPORT Dart_Handle Dart_NewCompilationError (const char *error)
 
DART_EXPORT Dart_Handle Dart_NewUnhandledExceptionError (Dart_Handle exception)
 
DART_EXPORT void Dart_PropagateError (Dart_Handle handle)
 
DART_EXPORT Dart_Handle Dart_ToString (Dart_Handle object)
 
DART_EXPORT bool Dart_IdentityEquals (Dart_Handle obj1, Dart_Handle obj2)
 
DART_EXPORT Dart_Handle Dart_HandleFromPersistent (Dart_PersistentHandle object)
 
DART_EXPORT Dart_Handle Dart_HandleFromWeakPersistent (Dart_WeakPersistentHandle object)
 
static Dart_Handle HandleFromFinalizable (Dart_FinalizableHandle object)
 
DART_EXPORT Dart_PersistentHandle Dart_NewPersistentHandle (Dart_Handle object)
 
DART_EXPORT void Dart_SetPersistentHandle (Dart_PersistentHandle obj1, Dart_Handle obj2)
 
static bool IsFfiCompound (Thread *T, const Object &obj)
 
static Dart_WeakPersistentHandle AllocateWeakPersistentHandle (Thread *thread, const Object &ref, void *peer, intptr_t external_allocation_size, Dart_HandleFinalizer callback)
 
static Dart_WeakPersistentHandle AllocateWeakPersistentHandle (Thread *T, Dart_Handle object, void *peer, intptr_t external_allocation_size, Dart_HandleFinalizer callback)
 
static Dart_FinalizableHandle AllocateFinalizableHandle (Thread *thread, const Object &ref, void *peer, intptr_t external_allocation_size, Dart_HandleFinalizer callback)
 
static Dart_FinalizableHandle AllocateFinalizableHandle (Thread *T, Dart_Handle object, void *peer, intptr_t external_allocation_size, Dart_HandleFinalizer callback)
 
DART_EXPORT Dart_WeakPersistentHandle Dart_NewWeakPersistentHandle (Dart_Handle object, void *peer, intptr_t external_allocation_size, Dart_HandleFinalizer callback)
 
DART_EXPORT Dart_FinalizableHandle Dart_NewFinalizableHandle (Dart_Handle object, void *peer, intptr_t external_allocation_size, Dart_HandleFinalizer callback)
 
DART_EXPORT void Dart_DeletePersistentHandle (Dart_PersistentHandle object)
 
DART_EXPORT void Dart_DeleteWeakPersistentHandle (Dart_WeakPersistentHandle object)
 
DART_EXPORT void Dart_DeleteFinalizableHandle (Dart_FinalizableHandle object, Dart_Handle strong_ref_to_object)
 
DART_EXPORT const char * Dart_VersionString ()
 
DART_EXPORT char * Dart_Initialize (Dart_InitializeParams *params)
 
DART_EXPORT char * Dart_Cleanup ()
 
DART_EXPORT char * Dart_SetVMFlags (int argc, const char **argv)
 
DART_EXPORT bool Dart_IsVMFlagSet (const char *flag_name)
 
static Dart_Isolate CreateIsolate (IsolateGroup *group, bool is_new_group, const char *name, void *isolate_data, char **error)
 
IsolateCreateWithinExistingIsolateGroup (IsolateGroup *group, const char *name, char **error)
 
DART_EXPORT void Dart_IsolateFlagsInitialize (Dart_IsolateFlags *flags)
 
DART_EXPORT Dart_Isolate Dart_CreateIsolateGroup (const char *script_uri, const char *name, const uint8_t *snapshot_data, const uint8_t *snapshot_instructions, Dart_IsolateFlags *flags, void *isolate_group_data, void *isolate_data, char **error)
 
DART_EXPORT Dart_Isolate Dart_CreateIsolateGroupFromKernel (const char *script_uri, const char *name, const uint8_t *kernel_buffer, intptr_t kernel_buffer_size, Dart_IsolateFlags *flags, void *isolate_group_data, void *isolate_data, char **error)
 
DART_EXPORT Dart_Isolate Dart_CreateIsolateInGroup (Dart_Isolate group_member, const char *name, Dart_IsolateShutdownCallback shutdown_callback, Dart_IsolateCleanupCallback cleanup_callback, void *child_isolate_data, char **error)
 
DART_EXPORT void Dart_ShutdownIsolate ()
 
DART_EXPORT Dart_Isolate Dart_CurrentIsolate ()
 
DART_EXPORT void * Dart_CurrentIsolateData ()
 
DART_EXPORT void * Dart_IsolateData (Dart_Isolate isolate)
 
DART_EXPORT Dart_IsolateGroup Dart_CurrentIsolateGroup ()
 
DART_EXPORT void * Dart_CurrentIsolateGroupData ()
 
DART_EXPORT Dart_IsolateGroupId Dart_CurrentIsolateGroupId ()
 
DART_EXPORT void * Dart_IsolateGroupData (Dart_Isolate isolate)
 
DART_EXPORT Dart_Handle Dart_DebugName ()
 
DART_EXPORT const char * Dart_DebugNameToCString ()
 
DART_EXPORT const char * Dart_IsolateServiceId (Dart_Isolate isolate)
 
DART_EXPORT void Dart_EnterIsolate (Dart_Isolate isolate)
 
DART_EXPORT void Dart_StartProfiling ()
 
DART_EXPORT void Dart_StopProfiling ()
 
DART_EXPORT void Dart_ThreadDisableProfiling ()
 
DART_EXPORT void Dart_ThreadEnableProfiling ()
 
DART_EXPORT void Dart_AddSymbols (const char *dso_name, void *buffer, intptr_t buffer_size)
 
DART_EXPORT bool Dart_WriteProfileToTimeline (Dart_Port main_port, char **error)
 
DART_EXPORT bool Dart_ShouldPauseOnStart ()
 
DART_EXPORT void Dart_SetShouldPauseOnStart (bool should_pause)
 
DART_EXPORT bool Dart_IsPausedOnStart ()
 
DART_EXPORT void Dart_SetPausedOnStart (bool paused)
 
DART_EXPORT bool Dart_ShouldPauseOnExit ()
 
DART_EXPORT void Dart_SetShouldPauseOnExit (bool should_pause)
 
DART_EXPORT bool Dart_IsPausedOnExit ()
 
DART_EXPORT void Dart_SetPausedOnExit (bool paused)
 
DART_EXPORT void Dart_SetStickyError (Dart_Handle error)
 
DART_EXPORT bool Dart_HasStickyError ()
 
DART_EXPORT Dart_Handle Dart_GetStickyError ()
 
DART_EXPORT void Dart_NotifyIdle (int64_t deadline)
 
DART_EXPORT void Dart_NotifyDestroyed ()
 
DART_EXPORT void Dart_EnableHeapSampling ()
 
DART_EXPORT void Dart_DisableHeapSampling ()
 
DART_EXPORT void Dart_RegisterHeapSamplingCallback (Dart_HeapSamplingCreateCallback create_callback, Dart_HeapSamplingDeleteCallback delete_callback)
 
DART_EXPORT void Dart_ReportSurvivingAllocations (Dart_HeapSamplingReportCallback callback, void *context, bool force_gc)
 
DART_EXPORT void Dart_SetHeapSamplingPeriod (intptr_t bytes)
 
DART_EXPORT void Dart_NotifyLowMemory ()
 
DART_EXPORT Dart_PerformanceMode Dart_SetPerformanceMode (Dart_PerformanceMode mode)
 
DART_EXPORT void Dart_ExitIsolate ()
 
DART_EXPORT Dart_Handle Dart_CreateSnapshot (uint8_t **vm_snapshot_data_buffer, intptr_t *vm_snapshot_data_size, uint8_t **isolate_snapshot_data_buffer, intptr_t *isolate_snapshot_data_size, bool is_core)
 
DART_EXPORT bool Dart_IsKernel (const uint8_t *buffer, intptr_t buffer_size)
 
DART_EXPORT char * Dart_IsolateMakeRunnable (Dart_Isolate isolate)
 
DART_EXPORT void Dart_SetMessageNotifyCallback (Dart_MessageNotifyCallback message_notify_callback)
 
DART_EXPORT Dart_MessageNotifyCallback Dart_GetMessageNotifyCallback ()
 
static void RunLoopDone (uword param)
 
DART_EXPORT Dart_Handle Dart_RunLoop ()
 
DART_EXPORT bool Dart_RunLoopAsync (bool errors_are_fatal, Dart_Port on_error_port, Dart_Port on_exit_port, char **error)
 
DART_EXPORT Dart_Handle Dart_HandleMessage ()
 
DART_EXPORT bool Dart_HandleServiceMessages ()
 
DART_EXPORT bool Dart_HasServiceMessages ()
 
DART_EXPORT bool Dart_HasLivePorts ()
 
DART_EXPORT bool Dart_Post (Dart_Port port_id, Dart_Handle handle)
 
DART_EXPORT Dart_Handle Dart_NewSendPort (Dart_Port port_id)
 
DART_EXPORT Dart_Handle Dart_SendPortGetId (Dart_Handle port, Dart_Port *port_id)
 
DART_EXPORT Dart_Port Dart_GetMainPortId ()
 
DART_EXPORT void Dart_EnterScope ()
 
DART_EXPORT void Dart_ExitScope ()
 
DART_EXPORT uint8_t * Dart_ScopeAllocate (intptr_t size)
 
DART_EXPORT Dart_Handle Dart_Null ()
 
DART_EXPORT bool Dart_IsNull (Dart_Handle object)
 
DART_EXPORT Dart_Handle Dart_EmptyString ()
 
DART_EXPORT Dart_Handle Dart_TypeDynamic ()
 
DART_EXPORT Dart_Handle Dart_TypeVoid ()
 
DART_EXPORT Dart_Handle Dart_TypeNever ()
 
DART_EXPORT Dart_Handle Dart_ObjectEquals (Dart_Handle obj1, Dart_Handle obj2, bool *value)
 
static bool InstanceIsType (const Thread *thread, const Instance &instance, const Type &type)
 
DART_EXPORT Dart_Handle Dart_ObjectIsType (Dart_Handle object, Dart_Handle type, bool *value)
 
DART_EXPORT bool Dart_IsInstance (Dart_Handle object)
 
DART_EXPORT bool Dart_IsNumber (Dart_Handle object)
 
DART_EXPORT bool Dart_IsInteger (Dart_Handle object)
 
DART_EXPORT bool Dart_IsDouble (Dart_Handle object)
 
DART_EXPORT bool Dart_IsBoolean (Dart_Handle object)
 
DART_EXPORT bool Dart_IsString (Dart_Handle object)
 
DART_EXPORT bool Dart_IsStringLatin1 (Dart_Handle object)
 
DART_EXPORT bool Dart_IsList (Dart_Handle object)
 
DART_EXPORT bool Dart_IsMap (Dart_Handle object)
 
DART_EXPORT bool Dart_IsLibrary (Dart_Handle object)
 
DART_EXPORT bool Dart_IsType (Dart_Handle handle)
 
DART_EXPORT bool Dart_IsFunction (Dart_Handle handle)
 
DART_EXPORT bool Dart_IsVariable (Dart_Handle handle)
 
DART_EXPORT bool Dart_IsTypeVariable (Dart_Handle handle)
 
DART_EXPORT bool Dart_IsClosure (Dart_Handle object)
 
DART_EXPORT bool Dart_IsTearOff (Dart_Handle object)
 
DART_EXPORT bool Dart_IsTypedData (Dart_Handle handle)
 
DART_EXPORT bool Dart_IsByteBuffer (Dart_Handle handle)
 
DART_EXPORT bool Dart_IsFuture (Dart_Handle handle)
 
DART_EXPORT Dart_Handle Dart_InstanceGetType (Dart_Handle instance)
 
DART_EXPORT Dart_Handle Dart_FunctionName (Dart_Handle function)
 
DART_EXPORT Dart_Handle Dart_ClassName (Dart_Handle cls_type)
 
DART_EXPORT Dart_Handle Dart_FunctionOwner (Dart_Handle function)
 
DART_EXPORT Dart_Handle Dart_FunctionIsStatic (Dart_Handle function, bool *is_static)
 
DART_EXPORT Dart_Handle Dart_ClosureFunction (Dart_Handle closure)
 
DART_EXPORT Dart_Handle Dart_ClassLibrary (Dart_Handle cls_type)
 
DART_EXPORT Dart_Handle Dart_IntegerFitsIntoInt64 (Dart_Handle integer, bool *fits)
 
DART_EXPORT Dart_Handle Dart_IntegerFitsIntoUint64 (Dart_Handle integer, bool *fits)
 
DART_EXPORT Dart_Handle Dart_NewInteger (int64_t value)
 
DART_EXPORT Dart_Handle Dart_NewIntegerFromUint64 (uint64_t value)
 
DART_EXPORT Dart_Handle Dart_NewIntegerFromHexCString (const char *str)
 
DART_EXPORT Dart_Handle Dart_IntegerToInt64 (Dart_Handle integer, int64_t *value)
 
DART_EXPORT Dart_Handle Dart_IntegerToUint64 (Dart_Handle integer, uint64_t *value)
 
DART_EXPORT Dart_Handle Dart_IntegerToHexCString (Dart_Handle integer, const char **value)
 
DART_EXPORT Dart_Handle Dart_NewDouble (double value)
 
DART_EXPORT Dart_Handle Dart_DoubleValue (Dart_Handle double_obj, double *value)
 
DART_EXPORT Dart_Handle Dart_GetStaticMethodClosure (Dart_Handle library, Dart_Handle cls_type, Dart_Handle function_name)
 
DART_EXPORT Dart_Handle Dart_True ()
 
DART_EXPORT Dart_Handle Dart_False ()
 
DART_EXPORT Dart_Handle Dart_NewBoolean (bool value)
 
DART_EXPORT Dart_Handle Dart_BooleanValue (Dart_Handle boolean_obj, bool *value)
 
DART_EXPORT Dart_Handle Dart_StringLength (Dart_Handle str, intptr_t *len)
 
DART_EXPORT Dart_Handle Dart_StringUTF8Length (Dart_Handle str, intptr_t *len)
 
DART_EXPORT Dart_Handle Dart_NewStringFromCString (const char *str)
 
DART_EXPORT Dart_Handle Dart_NewStringFromUTF8 (const uint8_t *utf8_array, intptr_t length)
 
DART_EXPORT Dart_Handle Dart_NewStringFromUTF16 (const uint16_t *utf16_array, intptr_t length)
 
DART_EXPORT Dart_Handle Dart_NewStringFromUTF32 (const int32_t *utf32_array, intptr_t length)
 
DART_EXPORT Dart_Handle Dart_StringToCString (Dart_Handle object, const char **cstr)
 
DART_EXPORT Dart_Handle Dart_StringToUTF8 (Dart_Handle str, uint8_t **utf8_array, intptr_t *length)
 
DART_EXPORT Dart_Handle Dart_CopyUTF8EncodingOfString (Dart_Handle str, uint8_t *utf8_array, intptr_t length)
 
DART_EXPORT Dart_Handle Dart_StringToLatin1 (Dart_Handle str, uint8_t *latin1_array, intptr_t *length)
 
DART_EXPORT Dart_Handle Dart_StringToUTF16 (Dart_Handle str, uint16_t *utf16_array, intptr_t *length)
 
DART_EXPORT Dart_Handle Dart_StringStorageSize (Dart_Handle str, intptr_t *size)
 
DART_EXPORT Dart_Handle Dart_StringGetProperties (Dart_Handle object, intptr_t *char_size, intptr_t *str_len, void **peer)
 
DART_EXPORT Dart_Handle Dart_NewList (intptr_t length)
 
static TypeArgumentsPtr TypeArgumentsForElementType (ObjectStore *store, Dart_CoreType_Id element_type_id)
 
DART_EXPORT Dart_Handle Dart_NewListOf (Dart_CoreType_Id element_type_id, intptr_t length)
 
static bool CanTypeContainNull (const Type &type)
 
DART_EXPORT Dart_Handle Dart_NewListOfType (Dart_Handle element_type, intptr_t length)
 
DART_EXPORT Dart_Handle Dart_NewListOfTypeFilled (Dart_Handle element_type, Dart_Handle fill_object, intptr_t length)
 
DART_EXPORT Dart_Handle Dart_ListLength (Dart_Handle list, intptr_t *len)
 
DART_EXPORT Dart_Handle Dart_ListGetAt (Dart_Handle list, intptr_t index)
 
DART_EXPORT Dart_Handle Dart_ListGetRange (Dart_Handle list, intptr_t offset, intptr_t length, Dart_Handle *result)
 
DART_EXPORT Dart_Handle Dart_ListSetAt (Dart_Handle list, intptr_t index, Dart_Handle value)
 
static ObjectPtr ResolveConstructor (const char *current_func, const Class &cls, const String &class_name, const String &dotted_name, int num_args)
 
static ObjectPtr ThrowArgumentError (const char *exception_message)
 
DART_EXPORT Dart_Handle Dart_ListGetAsBytes (Dart_Handle list, intptr_t offset, uint8_t *native_array, intptr_t length)
 
DART_EXPORT Dart_Handle Dart_ListSetAsBytes (Dart_Handle list, intptr_t offset, const uint8_t *native_array, intptr_t length)
 
DART_EXPORT Dart_Handle Dart_MapGetAt (Dart_Handle map, Dart_Handle key)
 
DART_EXPORT Dart_Handle Dart_MapContainsKey (Dart_Handle map, Dart_Handle key)
 
DART_EXPORT Dart_Handle Dart_MapKeys (Dart_Handle map)
 
static Dart_TypedData_Type GetType (intptr_t class_id)
 
DART_EXPORT Dart_TypedData_Type Dart_GetTypeOfTypedData (Dart_Handle object)
 
DART_EXPORT Dart_TypedData_Type Dart_GetTypeOfExternalTypedData (Dart_Handle object)
 
static Dart_Handle NewByteData (Thread *thread, intptr_t length)
 
static Dart_Handle NewTypedData (Thread *thread, intptr_t cid, intptr_t length)
 
static Dart_Handle NewExternalTypedData (Thread *thread, intptr_t cid, void *data, intptr_t length, void *peer, intptr_t external_allocation_size, Dart_HandleFinalizer callback, bool unmodifiable)
 
static Dart_Handle NewExternalByteData (Thread *thread, void *data, intptr_t length, void *peer, intptr_t external_allocation_size, Dart_HandleFinalizer callback, bool unmodifiable)
 
DART_EXPORT Dart_Handle Dart_NewTypedData (Dart_TypedData_Type type, intptr_t length)
 
static Dart_Handle NewExternalTypedDataWithFinalizer (Dart_TypedData_Type type, void *data, intptr_t length, void *peer, intptr_t external_allocation_size, Dart_HandleFinalizer callback, bool unmodifiable)
 
DART_EXPORT Dart_Handle Dart_NewExternalTypedData (Dart_TypedData_Type type, void *data, intptr_t length)
 
DART_EXPORT Dart_Handle Dart_NewExternalTypedDataWithFinalizer (Dart_TypedData_Type type, void *data, intptr_t length, void *peer, intptr_t external_allocation_size, Dart_HandleFinalizer callback)
 
DART_EXPORT Dart_Handle Dart_NewUnmodifiableExternalTypedDataWithFinalizer (Dart_TypedData_Type type, const void *data, intptr_t length, void *peer, intptr_t external_allocation_size, Dart_HandleFinalizer callback)
 
static ObjectPtr GetByteBufferConstructor (Thread *thread, const String &class_name, const String &constructor_name, intptr_t num_args)
 
DART_EXPORT Dart_Handle Dart_NewByteBuffer (Dart_Handle typed_data)
 
DART_EXPORT Dart_Handle Dart_TypedDataAcquireData (Dart_Handle object, Dart_TypedData_Type *type, void **data, intptr_t *len)
 
DART_EXPORT Dart_Handle Dart_TypedDataReleaseData (Dart_Handle object)
 
DART_EXPORT Dart_Handle Dart_GetDataFromByteBuffer (Dart_Handle object)
 
DART_EXPORT Dart_Handle Dart_New (Dart_Handle type, Dart_Handle constructor_name, int number_of_arguments, Dart_Handle *arguments)
 
static InstancePtr AllocateObject (Thread *thread, const Class &cls)
 
DART_EXPORT Dart_Handle Dart_Allocate (Dart_Handle type)
 
DART_EXPORT Dart_Handle Dart_AllocateWithNativeFields (Dart_Handle type, intptr_t num_native_fields, const intptr_t *native_fields)
 
static Dart_Handle SetupArguments (Thread *thread, int num_args, Dart_Handle *arguments, int extra_args, Array *args)
 
DART_EXPORT Dart_Handle Dart_InvokeConstructor (Dart_Handle object, Dart_Handle name, int number_of_arguments, Dart_Handle *arguments)
 
DART_EXPORT Dart_Handle Dart_Invoke (Dart_Handle target, Dart_Handle name, int number_of_arguments, Dart_Handle *arguments)
 
DART_EXPORT Dart_Handle Dart_InvokeClosure (Dart_Handle closure, int number_of_arguments, Dart_Handle *arguments)
 
DART_EXPORT Dart_Handle Dart_GetField (Dart_Handle container, Dart_Handle name)
 
DART_EXPORT Dart_Handle Dart_SetField (Dart_Handle container, Dart_Handle name, Dart_Handle value)
 
DART_EXPORT Dart_Handle Dart_ThrowException (Dart_Handle exception)
 
DART_EXPORT Dart_Handle Dart_ReThrowException (Dart_Handle exception, Dart_Handle stacktrace)
 
DART_EXPORT Dart_Handle Dart_GetNativeInstanceFieldCount (Dart_Handle obj, int *count)
 
DART_EXPORT Dart_Handle Dart_GetNativeInstanceField (Dart_Handle obj, int index, intptr_t *value)
 
DART_EXPORT Dart_Handle Dart_SetNativeInstanceField (Dart_Handle obj, int index, intptr_t value)
 
DART_EXPORT void * Dart_GetNativeIsolateGroupData (Dart_NativeArguments args)
 
DART_EXPORT Dart_Handle Dart_GetNativeArguments (Dart_NativeArguments args, int num_arguments, const Dart_NativeArgument_Descriptor *argument_descriptors, Dart_NativeArgument_Value *arg_values)
 
DART_EXPORT Dart_Handle Dart_GetNativeArgument (Dart_NativeArguments args, int index)
 
DART_EXPORT int Dart_GetNativeArgumentCount (Dart_NativeArguments args)
 
DART_EXPORT Dart_Handle Dart_GetNativeFieldsOfArgument (Dart_NativeArguments args, int arg_index, int num_fields, intptr_t *field_values)
 
DART_EXPORT Dart_Handle Dart_GetNativeReceiver (Dart_NativeArguments args, intptr_t *value)
 
DART_EXPORT Dart_Handle Dart_GetNativeStringArgument (Dart_NativeArguments args, int arg_index, void **peer)
 
DART_EXPORT Dart_Handle Dart_GetNativeIntegerArgument (Dart_NativeArguments args, int index, int64_t *value)
 
DART_EXPORT Dart_Handle Dart_GetNativeBooleanArgument (Dart_NativeArguments args, int index, bool *value)
 
DART_EXPORT Dart_Handle Dart_GetNativeDoubleArgument (Dart_NativeArguments args, int index, double *value)
 
DART_EXPORT void Dart_SetReturnValue (Dart_NativeArguments args, Dart_Handle retval)
 
DART_EXPORT void Dart_SetWeakHandleReturnValue (Dart_NativeArguments args, Dart_WeakPersistentHandle rval)
 
DART_EXPORT Dart_Handle Dart_SetEnvironmentCallback (Dart_EnvironmentCallback callback)
 
DART_EXPORT void Dart_SetBooleanReturnValue (Dart_NativeArguments args, bool retval)
 
DART_EXPORT void Dart_SetIntegerReturnValue (Dart_NativeArguments args, int64_t retval)
 
DART_EXPORT void Dart_SetDoubleReturnValue (Dart_NativeArguments args, double retval)
 
DART_EXPORT Dart_Handle Dart_SetLibraryTagHandler (Dart_LibraryTagHandler handler)
 
DART_EXPORT Dart_Handle Dart_DefaultCanonicalizeUrl (Dart_Handle base_url, Dart_Handle url)
 
DART_EXPORT Dart_Handle Dart_SetDeferredLoadHandler (Dart_DeferredLoadHandler handler)
 
DART_EXPORT Dart_Handle Dart_LoadScriptFromKernel (const uint8_t *buffer, intptr_t buffer_size)
 
DART_EXPORT Dart_Handle Dart_RootLibrary ()
 
DART_EXPORT Dart_Handle Dart_SetRootLibrary (Dart_Handle library)
 
DART_EXPORT Dart_Handle Dart_GetClass (Dart_Handle library, Dart_Handle class_name)
 
static Dart_Handle GetTypeCommon (Dart_Handle library, Dart_Handle class_name, intptr_t number_of_type_arguments, Dart_Handle *type_arguments, Nullability nullability)
 
DART_EXPORT Dart_Handle Dart_GetType (Dart_Handle library, Dart_Handle class_name, intptr_t number_of_type_arguments, Dart_Handle *type_arguments)
 
DART_EXPORT Dart_Handle Dart_GetNullableType (Dart_Handle library, Dart_Handle class_name, intptr_t number_of_type_arguments, Dart_Handle *type_arguments)
 
DART_EXPORT Dart_Handle Dart_GetNonNullableType (Dart_Handle library, Dart_Handle class_name, intptr_t number_of_type_arguments, Dart_Handle *type_arguments)
 
static Dart_Handle TypeToHelper (Dart_Handle type, Nullability nullability)
 
DART_EXPORT Dart_Handle Dart_TypeToNullableType (Dart_Handle type)
 
DART_EXPORT Dart_Handle Dart_TypeToNonNullableType (Dart_Handle type)
 
static Dart_Handle IsOfTypeNullabilityHelper (Dart_Handle type, Nullability nullability, bool *result)
 
DART_EXPORT Dart_Handle Dart_IsNullableType (Dart_Handle type, bool *result)
 
DART_EXPORT Dart_Handle Dart_IsNonNullableType (Dart_Handle type, bool *result)
 
DART_EXPORT Dart_Handle Dart_IsLegacyType (Dart_Handle type, bool *result)
 
DART_EXPORT Dart_Handle Dart_LibraryUrl (Dart_Handle library)
 
DART_EXPORT Dart_Handle Dart_LibraryResolvedUrl (Dart_Handle library)
 
DART_EXPORT Dart_Handle Dart_GetLoadedLibraries ()
 
DART_EXPORT Dart_Handle Dart_LookupLibrary (Dart_Handle url)
 
DART_EXPORT Dart_Handle Dart_LibraryHandleError (Dart_Handle library_in, Dart_Handle error_in)
 
static Dart_Handle LoadLibrary (Thread *T, const ExternalTypedData &td)
 
DART_EXPORT Dart_Handle Dart_LoadLibraryFromKernel (const uint8_t *buffer, intptr_t buffer_size)
 
DART_EXPORT Dart_Handle Dart_LoadLibrary (Dart_Handle kernel_buffer)
 
DART_EXPORT Dart_Handle Dart_FinalizeLoading (bool complete_futures)
 
static Dart_Handle DeferredLoadComplete (intptr_t loading_unit_id, bool error, const uint8_t *snapshot_data, const uint8_t *snapshot_instructions, const char *error_message, bool transient_error)
 
DART_EXPORT Dart_Handle Dart_DeferredLoadComplete (intptr_t loading_unit_id, const uint8_t *snapshot_data, const uint8_t *snapshot_instructions)
 
DART_EXPORT Dart_Handle Dart_DeferredLoadCompleteError (intptr_t loading_unit_id, const char *error_message, bool transient)
 
DART_EXPORT Dart_Handle Dart_SetNativeResolver (Dart_Handle library, Dart_NativeEntryResolver resolver, Dart_NativeEntrySymbol symbol)
 
DART_EXPORT Dart_Handle Dart_GetNativeResolver (Dart_Handle library, Dart_NativeEntryResolver *resolver)
 
DART_EXPORT Dart_Handle Dart_GetNativeSymbol (Dart_Handle library, Dart_NativeEntrySymbol *resolver)
 
DART_EXPORT Dart_Handle Dart_SetFfiNativeResolver (Dart_Handle library, Dart_FfiNativeResolver resolver)
 
DART_EXPORT Dart_Handle Dart_GetPeer (Dart_Handle object, void **peer)
 
DART_EXPORT Dart_Handle Dart_SetPeer (Dart_Handle object, void *peer)
 
DART_EXPORT bool Dart_IsKernelIsolate (Dart_Isolate isolate)
 
DART_EXPORT bool Dart_KernelIsolateIsRunning ()
 
DART_EXPORT Dart_Port Dart_KernelPort ()
 
DART_EXPORT Dart_KernelCompilationResult Dart_CompileToKernel (const char *script_uri, const uint8_t *platform_kernel, intptr_t platform_kernel_size, bool incremental_compile, bool for_snapshot, bool embed_sources, const char *package_config, Dart_KernelCompilationVerbosityLevel verbosity)
 
DART_EXPORT Dart_KernelCompilationResult Dart_KernelListDependencies ()
 
DART_EXPORT void Dart_SetDartLibrarySourcesKernel (const uint8_t *platform_kernel, const intptr_t platform_kernel_size)
 
DART_EXPORT bool Dart_DetectNullSafety (const char *script_uri, const char *package_config, const char *original_working_directory, const uint8_t *snapshot_data, const uint8_t *snapshot_instructions, const uint8_t *kernel_buffer, intptr_t kernel_buffer_size)
 
DART_EXPORT bool Dart_IsServiceIsolate (Dart_Isolate isolate)
 
DART_EXPORT void Dart_RegisterIsolateServiceRequestCallback (const char *name, Dart_ServiceRequestCallback callback, void *user_data)
 
DART_EXPORT void Dart_RegisterRootServiceRequestCallback (const char *name, Dart_ServiceRequestCallback callback, void *user_data)
 
DART_EXPORT void Dart_SetEmbedderInformationCallback (Dart_EmbedderInformationCallback callback)
 
DART_EXPORT char * Dart_SetServiceStreamCallbacks (Dart_ServiceStreamListenCallback listen_callback, Dart_ServiceStreamCancelCallback cancel_callback)
 
DART_EXPORT char * Dart_ServiceSendDataEvent (const char *stream_id, const char *event_kind, const uint8_t *bytes, intptr_t bytes_length)
 
DART_EXPORT void Dart_SetDwarfStackTraceFootnoteCallback (Dart_DwarfStackTraceFootnoteCallback callback)
 
DART_EXPORT char * Dart_SetFileModifiedCallback (Dart_FileModifiedCallback file_modified_callback)
 
DART_EXPORT bool Dart_IsReloading ()
 
DART_EXPORT bool Dart_SetEnabledTimelineCategory (const char *categories)
 
DART_EXPORT int64_t Dart_TimelineGetMicros ()
 
DART_EXPORT int64_t Dart_TimelineGetTicks ()
 
DART_EXPORT int64_t Dart_TimelineGetTicksFrequency ()
 
DART_EXPORT void Dart_RecordTimelineEvent (const char *label, int64_t timestamp0, int64_t timestamp1_or_id, intptr_t flow_id_count, const int64_t *flow_ids, Dart_Timeline_Event_Type type, intptr_t argument_count, const char **argument_names, const char **argument_values)
 
DART_EXPORT void Dart_SetTimelineRecorderCallback (Dart_TimelineRecorderCallback callback)
 
DART_EXPORT void Dart_SetThreadName (const char *name)
 
DART_EXPORT Dart_Handle Dart_SortClasses ()
 
DART_EXPORT Dart_Handle Dart_Precompile ()
 
DART_EXPORT Dart_Handle Dart_CreateAppAOTSnapshotAsAssembly (Dart_StreamingWriteCallback callback, void *callback_data, bool strip, void *debug_callback_data)
 
DART_EXPORT Dart_Handle Dart_CreateAppAOTSnapshotAsAssemblies (Dart_CreateLoadingUnitCallback next_callback, void *next_callback_data, bool strip, Dart_StreamingWriteCallback write_callback, Dart_StreamingCloseCallback close_callback)
 
DART_EXPORT Dart_Handle Dart_CreateVMAOTSnapshotAsAssembly (Dart_StreamingWriteCallback callback, void *callback_data)
 
DART_EXPORT Dart_Handle Dart_CreateAppAOTSnapshotAsElf (Dart_StreamingWriteCallback callback, void *callback_data, bool strip, void *debug_callback_data)
 
DART_EXPORT Dart_Handle Dart_CreateAppAOTSnapshotAsElfs (Dart_CreateLoadingUnitCallback next_callback, void *next_callback_data, bool strip, Dart_StreamingWriteCallback write_callback, Dart_StreamingCloseCallback close_callback)
 
DART_EXPORT Dart_Handle Dart_LoadingUnitLibraryUris (intptr_t loading_unit_id)
 
static void DropRegExpMatchCode (Zone *zone)
 
static void KillNonMainIsolatesSlow (Thread *thread, Isolate *main_isolate)
 
DART_EXPORT Dart_Handle Dart_CreateAppJITSnapshotAsBlobs (uint8_t **isolate_snapshot_data_buffer, intptr_t *isolate_snapshot_data_size, uint8_t **isolate_snapshot_instructions_buffer, intptr_t *isolate_snapshot_instructions_size)
 
DART_EXPORT Dart_Handle Dart_GetObfuscationMap (uint8_t **buffer, intptr_t *buffer_length)
 
DART_EXPORT bool Dart_IsPrecompiledRuntime ()
 
DART_EXPORT Dart_Handle Dart_GetCurrentUserTag ()
 
DART_EXPORT Dart_Handle Dart_GetDefaultUserTag ()
 
DART_EXPORT Dart_Handle Dart_NewUserTag (const char *label)
 
DART_EXPORT Dart_Handle Dart_SetCurrentUserTag (Dart_Handle user_tag)
 
DART_EXPORT char * Dart_GetUserTagLabel (Dart_Handle user_tag)
 
DART_EXPORT char * Dart_WriteHeapSnapshot (Dart_HeapSnapshotWriteChunkCallback write, void *context)
 
 DECLARE_FLAG (bool, verify_acquired_data)
 
 DECLARE_FLAG (bool, complete_timeline)
 
 UNIT_TEST_CASE (DartAPI_DartInitializeAfterCleanup)
 
 UNIT_TEST_CASE (DartAPI_DartInitializeCallsCodeObserver)
 
 UNIT_TEST_CASE (DartAPI_DartInitializeHeapSizes)
 
 TEST_CASE (Dart_KillIsolate)
 
 TEST_CASE (Dart_KillIsolatePriority)
 
 TEST_CASE (DartAPI_ErrorHandleBasics)
 
 TEST_CASE (DartAPI_StackTraceInfo)
 
 TEST_CASE (DartAPI_DeepStackTraceInfo)
 
void VerifyStackOverflowStackTraceInfo (const char *script, const char *top_frame_func_name, const char *entry_func_name, int expected_line_number, int expected_column_number)
 
 TEST_CASE (DartAPI_StackOverflowStackTraceInfoBraceFunction1)
 
 TEST_CASE (DartAPI_StackOverflowStackTraceInfoBraceFunction2)
 
 TEST_CASE (DartAPI_StackOverflowStackTraceInfoArrowFunction)
 
 TEST_CASE (DartAPI_OutOfMemoryStackTraceInfo)
 
void CurrentStackTraceNative (Dart_NativeArguments args)
 
static Dart_NativeFunction CurrentStackTraceNativeLookup (Dart_Handle name, int argument_count, bool *auto_setup_scope)
 
 TEST_CASE (DartAPI_CurrentStackTraceInfo)
 
 TEST_CASE (DartAPI_ErrorHandleTypes)
 
 TEST_CASE (DartAPI_UnhandleExceptionError)
 
void JustPropagateErrorNative (Dart_NativeArguments args)
 
static Dart_NativeFunction JustPropagateError_lookup (Dart_Handle name, int argument_count, bool *auto_setup_scope)
 
 TEST_CASE (DartAPI_EnsureUnwindErrorHandled_WhenKilled)
 
 TEST_CASE (DartAPI_EnsureUnwindErrorHandled_WhenSendAndExit)
 
void PropagateErrorNative (Dart_NativeArguments args)
 
static Dart_NativeFunction PropagateError_native_lookup (Dart_Handle name, int argument_count, bool *auto_setup_scope)
 
 TEST_CASE (DartAPI_PropagateCompileTimeError)
 
 TEST_CASE (DartAPI_PropagateError)
 
 TEST_CASE (DartAPI_Error)
 
 TEST_CASE (DartAPI_Null)
 
 TEST_CASE (DartAPI_EmptyString)
 
 TEST_CASE (DartAPI_TypeDynamic)
 
 TEST_CASE (DartAPI_TypeVoid)
 
 TEST_CASE (DartAPI_TypeNever)
 
 TEST_CASE (DartAPI_IdentityEquals)
 
 TEST_CASE (DartAPI_ObjectEquals)
 
 TEST_CASE (DartAPI_InstanceValues)
 
 TEST_CASE (DartAPI_InstanceGetType)
 
 TEST_CASE (DartAPI_FunctionName)
 
 TEST_CASE (DartAPI_FunctionOwner)
 
 TEST_CASE (DartAPI_IsTearOff)
 
 TEST_CASE (DartAPI_FunctionIsStatic)
 
 TEST_CASE (DartAPI_ClosureFunction)
 
 TEST_CASE (DartAPI_GetStaticMethodClosure)
 
 TEST_CASE (DartAPI_ClassLibrary)
 
 TEST_CASE (DartAPI_BooleanValues)
 
 TEST_CASE (DartAPI_BooleanConstants)
 
 TEST_CASE (DartAPI_DoubleValues)
 
 TEST_CASE (DartAPI_NumberValues)
 
 TEST_CASE (DartAPI_IntegerValues)
 
 TEST_CASE (DartAPI_IntegerToHexCString)
 
 TEST_CASE (DartAPI_IntegerFitsIntoInt64)
 
 TEST_CASE (DartAPI_IntegerFitsIntoUint64)
 
 TEST_CASE (DartAPI_ArrayValues)
 
 TEST_CASE (DartAPI_IsString)
 
 TEST_CASE (DartAPI_NewString)
 
 TEST_CASE (DartAPI_MalformedStringToUTF8)
 
 TEST_CASE (DartAPI_CopyUTF8EncodingOfString)
 
 TEST_CASE (DartAPI_ExternalTypedDataPretenure)
 
 TEST_CASE (DartAPI_ListAccess)
 
 TEST_CASE (DartAPI_MapAccess)
 
 TEST_CASE (DartAPI_IsFuture)
 
 TEST_CASE (DartAPI_TypedDataViewListGetAsBytes)
 
 TEST_CASE (DartAPI_TypedDataViewListIsTypedData)
 
 TEST_CASE (DartAPI_UnmodifiableTypedDataViewListIsTypedData)
 
 TEST_CASE (DartAPI_TypedDataAccess)
 
 TEST_CASE (DartAPI_ByteBufferAccess)
 
static void ByteDataNativeFunction (Dart_NativeArguments args)
 
static Dart_NativeFunction ByteDataNativeResolver (Dart_Handle name, int arg_count, bool *auto_setup_scope)
 
 TEST_CASE (DartAPI_ByteDataAccess)
 
static void ExternalByteDataNativeFunction (Dart_NativeArguments args)
 
static Dart_NativeFunction ExternalByteDataNativeResolver (Dart_Handle name, int arg_count, bool *auto_setup_scope)
 
 TEST_CASE (DartAPI_ExternalByteDataAccess)
 
void ByteDataFinalizer (void *isolate_data, void *peer)
 
 TEST_CASE (DartAPI_ExternalByteDataFinalizer)
 
static void OptExternalByteDataNativeFunction (Dart_NativeArguments args)
 
static Dart_NativeFunction OptExternalByteDataNativeResolver (Dart_Handle name, int arg_count, bool *auto_setup_scope)
 
 TEST_CASE (DartAPI_OptimizedExternalByteDataAccess)
 
static void TestTypedDataDirectAccess ()
 
 TEST_CASE (DartAPI_TypedDataDirectAccessUnverified)
 
 TEST_CASE (DartAPI_TypedDataDirectAccessVerified)
 
static void TestDirectAccess (Dart_Handle lib, Dart_Handle array, Dart_TypedData_Type expected_type, bool is_external)
 
static void TestTypedDataDirectAccess1 ()
 
 TEST_CASE (DartAPI_TypedDataDirectAccess1Unverified)
 
 TEST_CASE (DartAPI_TypedDataDirectAccess1Verified)
 
static void TestTypedDataViewDirectAccess ()
 
 TEST_CASE (DartAPI_TypedDataViewDirectAccessUnverified)
 
 TEST_CASE (DartAPI_TypedDataViewDirectAccessVerified)
 
static void TestUnmodifiableTypedDataViewDirectAccess ()
 
 TEST_CASE (DartAPI_UnmodifiableTypedDataViewDirectAccessUnverified)
 
 TEST_CASE (DartAPI_UnmodifiableTypedDataViewDirectAccessVerified)
 
static void TestByteDataDirectAccess ()
 
 TEST_CASE (DartAPI_ByteDataDirectAccessUnverified)
 
 TEST_CASE (DartAPI_ByteDataDirectAccessVerified)
 
 TEST_CASE (DartAPI_NewUnmodifiableExternalTypedDataWithFinalizer)
 
 TEST_CASE (DartAPI_UnmodifiableTypedData_PassByReference)
 
static void NopCallback (void *isolate_callback_data, void *peer)
 
 TEST_CASE (DartAPI_ExternalAllocationDuringNoCallbackScope)
 
static void ExternalTypedDataAccessTests (Dart_Handle obj, Dart_TypedData_Type expected_type, uint8_t data[], intptr_t data_length)
 
 TEST_CASE (DartAPI_ExternalTypedDataAccess)
 
 TEST_CASE (DartAPI_ExternalClampedTypedDataAccess)
 
 TEST_CASE (DartAPI_ExternalUint8ClampedArrayAccess)
 
static void UnreachedCallback (void *isolate_callback_data, void *peer)
 
static void ExternalTypedDataFinalizer (void *isolate_callback_data, void *peer)
 
 TEST_CASE (DartAPI_ExternalTypedDataCallback)
 
static void SlowFinalizer (void *isolate_callback_data, void *peer)
 
 TEST_CASE (DartAPI_SlowFinalizer)
 
static void SlowWeakPersistentHandle (void *isolate_callback_data, void *peer)
 
 TEST_CASE (DartAPI_SlowWeakPersistentHandle)
 
static void CheckFloat32x4Data (Dart_Handle obj)
 
 TEST_CASE (DartAPI_Float32x4List)
 
 VM_UNIT_TEST_CASE (DartAPI_EnterExitScope)
 
 VM_UNIT_TEST_CASE (DartAPI_PersistentHandles)
 
 VM_UNIT_TEST_CASE (DartAPI_NewPersistentHandle_FromPersistentHandle)
 
 VM_UNIT_TEST_CASE (DartAPI_AssignToPersistentHandle)
 
static Dart_Handle AllocateNewString (const char *c_str)
 
static Dart_Handle AllocateOldString (const char *c_str)
 
static Dart_Handle AsHandle (Dart_PersistentHandle weak)
 
static Dart_Handle AsHandle (Dart_WeakPersistentHandle weak)
 
 TEST_CASE (DartAPI_WeakPersistentHandle)
 
static void FinalizableHandleCallback (void *isolate_callback_data, void *peer)
 
 TEST_CASE (DartAPI_FinalizableHandle)
 
 TEST_CASE (DartAPI_WeakPersistentHandleErrors)
 
 TEST_CASE (DartAPI_FinalizableHandleErrors)
 
static void WeakPersistentHandlePeerCleanupEnsuresIGFinalizer (void *isolate_callback_data, void *peer)
 
 TEST_CASE (DartAPI_WeakPersistentHandleCleanupFinalizerAtShutdown)
 
static void WeakPersistentHandlePeerCleanupFinalizer (void *isolate_callback_data, void *peer)
 
 TEST_CASE (DartAPI_WeakPersistentHandleCleanupFinalizer)
 
static void FinalizableHandlePeerCleanupFinalizer (void *isolate_callback_data, void *peer)
 
 TEST_CASE (DartAPI_FinalizableHandleCleanupFinalizer)
 
static void WeakPersistentHandlePeerFinalizer (void *isolate_callback_data, void *peer)
 
 TEST_CASE (DartAPI_WeakPersistentHandleCallback)
 
static void FinalizableHandlePeerFinalizer (void *isolate_callback_data, void *peer)
 
 TEST_CASE (DartAPI_FinalizableHandleCallback)
 
 TEST_CASE (DartAPI_WeakPersistentHandleNoCallback)
 
 TEST_CASE (DartAPI_FinalizableHandleNoCallback)
 
static void DeleteWeakHandleOnFinalization (void *isolate_callback_data, void *peer)
 
static void DontDeleteWeakHandleOnFinalization (void *isolate_callback_data, void *peer)
 
 TEST_CASE (DartAPI_WeakPersistentHandleCallbackSelfDelete)
 
 VM_UNIT_TEST_CASE (DartAPI_WeakPersistentHandlesCallbackShutdown)
 
 VM_UNIT_TEST_CASE (DartAPI_FinalizableHandlesCallbackShutdown)
 
 TEST_CASE (DartAPI_WeakPersistentHandleExternalAllocationSize)
 
 TEST_CASE (DartAPI_FinalizableHandleExternalAllocationSize)
 
 TEST_CASE (DartAPI_WeakPersistentHandleExternalAllocationSizeNewspaceGC)
 
 TEST_CASE (DartAPI_FinalizableHandleExternalAllocationSizeNewspaceGC)
 
 TEST_CASE (DartAPI_WeakPersistentHandleExternalAllocationSizeOldspaceGC)
 
 TEST_CASE (DartAPI_FinalizableHandleExternalAllocationSizeOldspaceGC)
 
 TEST_CASE (DartAPI_WeakPersistentHandleExternalAllocationSizeOddReferents)
 
 TEST_CASE (DartAPI_FinalizableHandleExternalAllocationSizeOddReferents)
 
void FUNCTION_NAME() SecretKeeper_KeepSecret (Dart_NativeArguments native_args)
 
static Dart_NativeFunction SecretKeeperNativeResolver (Dart_Handle name, int argument_count, bool *auto_setup_scope)
 
static intptr_t ReturnPtrAsInt (void *ptr)
 
static void * SecretKeeperFfiNativeResolver (const char *name, uintptr_t argn)
 
 TEST_CASE (DartAPI_NativeFieldAccess)
 
 TEST_CASE (DartAPI_NativeFieldAccess_Throws)
 
static void ImplicitReferencesCallback (void *isolate_callback_data, void *peer)
 
 TEST_CASE (DartAPI_ImplicitReferencesOldSpace)
 
 TEST_CASE (DartAPI_ImplicitReferencesNewSpace)
 
 VM_UNIT_TEST_CASE (DartAPI_LocalHandles)
 
 VM_UNIT_TEST_CASE (DartAPI_LocalZoneMemory)
 
 VM_UNIT_TEST_CASE (DartAPI_Isolates)
 
 VM_UNIT_TEST_CASE (DartAPI_IsolateGroups)
 
 VM_UNIT_TEST_CASE (DartAPI_CurrentIsolateData)
 
static Dart_Handle LoadScript (const char *url_str, const char *source)
 
 TEST_CASE (DartAPI_DebugName)
 
 TEST_CASE (DartAPI_IsolateServiceID)
 
static void MyMessageNotifyCallback (Dart_Isolate dest_isolate)
 
 VM_UNIT_TEST_CASE (DartAPI_SetMessageCallbacks)
 
 TEST_CASE (DartAPI_SetStickyError)
 
 TEST_CASE (DartAPI_TypeGetNonParametricTypes)
 
 TEST_CASE (DartAPI_TypeGetParameterizedTypes)
 
static void TestFieldOk (Dart_Handle container, Dart_Handle name, bool final, const char *initial_value)
 
static void TestFieldNotFound (Dart_Handle container, Dart_Handle name)
 
 TEST_CASE (DartAPI_FieldAccess)
 
 TEST_CASE (DartAPI_SetField_FunnyValue)
 
 TEST_CASE (DartAPI_SetField_BadType)
 
void NativeFieldLookup (Dart_NativeArguments args)
 
static Dart_NativeFunction native_field_lookup (Dart_Handle name, int argument_count, bool *auto_setup_scope)
 
 TEST_CASE (DartAPI_InjectNativeFields2)
 
 TEST_CASE (DartAPI_InjectNativeFields3)
 
 TEST_CASE (DartAPI_InjectNativeFields4)
 
void TestNativeFieldsAccess_init (Dart_NativeArguments args)
 
void TestNativeFieldsAccess_access (Dart_NativeArguments args)
 
void TestNativeFieldsAccess_invalidAccess (Dart_NativeArguments args)
 
static Dart_NativeFunction TestNativeFieldsAccess_lookup (Dart_Handle name, int argument_count, bool *auto_scope)
 
 TEST_CASE (DartAPI_TestNativeFieldsAccess)
 
 TEST_CASE (DartAPI_InjectNativeFieldsSuperClass)
 
static void TestNativeFields (Dart_Handle retobj)
 
 TEST_CASE (DartAPI_ImplicitNativeFieldAccess)
 
 TEST_CASE (DartAPI_NegativeNativeFieldAccess)
 
 TEST_CASE (DartAPI_GetStaticField_RunsInitializer)
 
 TEST_CASE (DartAPI_GetField_CheckIsolate)
 
 TEST_CASE (DartAPI_SetField_CheckIsolate)
 
 TEST_CASE (DartAPI_New)
 
 TEST_CASE (DartAPI_New_Issue42939)
 
 TEST_CASE (DartAPI_New_Issue44205)
 
 TEST_CASE (DartAPI_InvokeConstructor_Issue44205)
 
 TEST_CASE (DartAPI_InvokeClosure_Issue44205)
 
 TEST_CASE (DartAPI_NewListOf)
 
 TEST_CASE (DartAPI_NewListOfType)
 
 TEST_CASE (DartAPI_NewListOfTypeFilled)
 
static Dart_Handle PrivateLibName (Dart_Handle lib, const char *str)
 
 TEST_CASE (DartAPI_Invoke)
 
 TEST_CASE (DartAPI_Invoke_PrivateStatic)
 
 TEST_CASE (DartAPI_Invoke_FunnyArgs)
 
 TEST_CASE (DartAPI_Invoke_BadArgs)
 
 TEST_CASE (DartAPI_Invoke_Null)
 
 TEST_CASE (DartAPI_InvokeNoSuchMethod)
 
 TEST_CASE (DartAPI_InvokeClosure)
 
void ExceptionNative (Dart_NativeArguments args)
 
static Dart_NativeFunction native_lookup (Dart_Handle name, int argument_count, bool *auto_setup_scope)
 
 TEST_CASE (DartAPI_ThrowException)
 
static void NativeArgumentCreate (Dart_NativeArguments args)
 
static void NativeArgumentAccess (Dart_NativeArguments args)
 
static Dart_NativeFunction native_args_lookup (Dart_Handle name, int argument_count, bool *auto_scope_setup)
 
 TEST_CASE (DartAPI_GetNativeArguments)
 
static void NativeArgumentCounter (Dart_NativeArguments args)
 
static Dart_NativeFunction gnac_lookup (Dart_Handle name, int argument_count, bool *auto_setup_scope)
 
 TEST_CASE (DartAPI_GetNativeArgumentCount)
 
 TEST_CASE (DartAPI_TypeToNullability)
 
 TEST_CASE (DartAPI_GetNullableType)
 
 TEST_CASE (DartAPI_GetNonNullableType)
 
 TEST_CASE (DartAPI_InstanceOf)
 
 TEST_CASE (DartAPI_RootLibrary)
 
 TEST_CASE (DartAPI_LookupLibrary)
 
 TEST_CASE (DartAPI_LibraryUrl)
 
static void MyNativeFunction1 (Dart_NativeArguments args)
 
static void MyNativeFunction2 (Dart_NativeArguments args)
 
static Dart_NativeFunction MyNativeResolver1 (Dart_Handle name, int arg_count, bool *auto_setup_scope)
 
static Dart_NativeFunction MyNativeResolver2 (Dart_Handle name, int arg_count, bool *auto_setup_scope)
 
 TEST_CASE (DartAPI_SetNativeResolver)
 
 TEST_CASE (DartAPI_ImportLibrary2)
 
 TEST_CASE (DartAPI_ImportLibrary3)
 
 TEST_CASE (DartAPI_ImportLibrary4)
 
 TEST_CASE (DartAPI_ImportLibrary5)
 
 TEST_CASE (DartAPI_Multiroot_Valid)
 
 TEST_CASE (DartAPI_Multiroot_FailWhenUriIsWrong)
 
static void NewNativePort_send123 (Dart_Port dest_port_id, Dart_CObject *message)
 
static void NewNativePort_send321 (Dart_Port dest_port_id, Dart_CObject *message)
 
 TEST_CASE (DartAPI_IllegalNewSendPort)
 
 TEST_CASE (DartAPI_IllegalPost)
 
static void UnreachableFinalizer (void *isolate_callback_data, void *peer)
 
 TEST_CASE (DartAPI_PostCObject_DoesNotRunFinalizerOnFailure)
 
 VM_UNIT_TEST_CASE (DartAPI_NewNativePort)
 
static void NewNativePort_sendInteger123 (Dart_Port dest_port_id, Dart_CObject *message)
 
static void NewNativePort_sendInteger321 (Dart_Port dest_port_id, Dart_CObject *message)
 
 TEST_CASE (DartAPI_NativePortPostInteger)
 
static void NewNativePort_Transferrable1 (Dart_Port dest_port_id, Dart_CObject *message)
 
static void NewNativePort_Transferrable2 (Dart_Port dest_port_id, Dart_CObject *message)
 
 TEST_CASE (DartAPI_NativePortPostTransferrableTypedData)
 
static void NewNativePort_ExternalTypedData (Dart_Port dest_port_id, Dart_CObject *message)
 
static void FinalizeTypedData (void *isolate_callback_data, void *peer)
 
 TEST_CASE (DartAPI_NativePortPostExternalTypedData)
 
static void UnreachableMessageHandler (Dart_Port dest_port_id, Dart_CObject *message)
 
 TEST_CASE (DartAPI_NativePortPostUserClass)
 
static void NewNativePort_nativeReceiveNull (Dart_Port dest_port_id, Dart_CObject *message)
 
 TEST_CASE (DartAPI_NativePortReceiveNull)
 
static void NewNativePort_nativeReceiveInteger (Dart_Port dest_port_id, Dart_CObject *message)
 
 TEST_CASE (DartAPI_NativePortReceiveInteger)
 
static Dart_Isolate RunLoopTestCallback (const char *script_name, const char *main, const char *package_root, const char *package_config, Dart_IsolateFlags *flags, void *data, char **error)
 
static void RunLoopTest (bool throw_exception)
 
 VM_UNIT_TEST_CASE (DartAPI_RunLoop_Success)
 
 VM_UNIT_TEST_CASE (DartAPI_RunLoop_Exception)
 
static void IsolateShutdownTestCallback (void *group_data, void *isolate_data)
 
static void IsolateCleanupTestCallback (void *group_data, void *isolate_data)
 
static void IsolateGroupCleanupTestCallback (void *callback_data)
 
 VM_UNIT_TEST_CASE (DartAPI_IsolateShutdownAndCleanup)
 
static void IsolateShutdownRunDartCodeTestCallback (void *isolate_group_data, void *isolate_data)
 
 VM_UNIT_TEST_CASE (DartAPI_IsolateShutdownRunDartCode)
 
static int64_t GetValue (Dart_Handle arg)
 
static void NativeFoo1 (Dart_NativeArguments args)
 
static void NativeFoo2 (Dart_NativeArguments args)
 
static void NativeFoo3 (Dart_NativeArguments args)
 
static void NativeFoo4 (Dart_NativeArguments args)
 
static Dart_NativeFunction MyNativeClosureResolver (Dart_Handle name, int arg_count, bool *auto_setup_scope)
 
 TEST_CASE (DartAPI_NativeFunctionClosure)
 
static void StaticNativeFoo1 (Dart_NativeArguments args)
 
static void StaticNativeFoo2 (Dart_NativeArguments args)
 
static void StaticNativeFoo3 (Dart_NativeArguments args)
 
static void StaticNativeFoo4 (Dart_NativeArguments args)
 
static Dart_NativeFunction MyStaticNativeClosureResolver (Dart_Handle name, int arg_count, bool *auto_setup_scope)
 
 TEST_CASE (DartAPI_NativeStaticFunctionClosure)
 
 TEST_CASE (DartAPI_RangeLimits)
 
 TEST_CASE (DartAPI_NewString_Null)
 
 TEST_CASE (DartAPI_InvalidGetSetPeer)
 
 TEST_CASE (DartAPI_OneNewSpacePeer)
 
 TEST_CASE (DartAPI_CollectOneNewSpacePeer)
 
 TEST_CASE (DartAPI_TwoNewSpacePeers)
 
 TEST_CASE (DartAPI_CollectTwoNewSpacePeers)
 
 TEST_CASE (DartAPI_CopyNewSpacePeers)
 
 TEST_CASE (DartAPI_OnePromotedPeer)
 
 TEST_CASE (DartAPI_OneOldSpacePeer)
 
 TEST_CASE (DartAPI_CollectOneOldSpacePeer)
 
 TEST_CASE (DartAPI_TwoOldSpacePeers)
 
 TEST_CASE (DartAPI_CollectTwoOldSpacePeers)
 
 TEST_CASE (DartAPI_StringFromExternalTypedData)
 
 TEST_CASE (DartAPI_TimelineDuration)
 
 TEST_CASE (DartAPI_TimelineBegin)
 
 TEST_CASE (DartAPI_TimelineEnd)
 
 TEST_CASE (DartAPI_TimelineInstant)
 
 TEST_CASE (DartAPI_TimelineAsyncDisabled)
 
 TEST_CASE (DartAPI_TimelineAsync)
 
 TEST_CASE (DartAPI_TimelineClock)
 
 TEST_CASE (DartAPI_TimelineCategories)
 
static void NotifyIdleShortNative (Dart_NativeArguments args)
 
static Dart_NativeFunction NotifyIdleShort_native_lookup (Dart_Handle name, int argument_count, bool *auto_setup_scope)
 
 TEST_CASE (DartAPI_NotifyIdleShort)
 
static void NotifyIdleLongNative (Dart_NativeArguments args)
 
static Dart_NativeFunction NotifyIdleLong_native_lookup (Dart_Handle name, int argument_count, bool *auto_setup_scope)
 
 TEST_CASE (DartAPI_NotifyIdleLong)
 
static void NotifyDestroyedNative (Dart_NativeArguments args)
 
static Dart_NativeFunction NotifyDestroyed_native_lookup (Dart_Handle name, int argument_count, bool *auto_setup_scope)
 
 TEST_CASE (DartAPI_NotifyDestroyed)
 
static void SetPerformanceModeDefault (Dart_NativeArguments args)
 
static void SetPerformanceModeLatency (Dart_NativeArguments args)
 
static Dart_NativeFunction SetMode_native_lookup (Dart_Handle name, int argument_count, bool *auto_setup_scope)
 
 TEST_CASE (DartAPI_SetPerformanceMode)
 
static void NotifyLowMemoryNative (Dart_NativeArguments args)
 
static Dart_NativeFunction NotifyLowMemory_native_lookup (Dart_Handle name, int argument_count, bool *auto_setup_scope)
 
 TEST_CASE (DartAPI_NotifyLowMemory)
 
 TEST_CASE (DartAPI_InvokeImportedFunction)
 
 TEST_CASE (DartAPI_InvokeVMServiceMethod)
 
static void InvokeServiceMessages (uword param)
 
 TEST_CASE (DartAPI_InvokeVMServiceMethod_Loop)
 
static void HandleResponse (Dart_Port dest_port_id, Dart_CObject *message)
 
static void CreateNativePorts (uword param)
 
 TEST_CASE (DartAPI_NativePort_Loop)
 
static void ReportTimelineEvents ()
 
 TEST_CASE (DartAPI_TimelineEvents_Serialization)
 
static void CreateTimelineEvents (uword param)
 
 UNIT_TEST_CASE (DartAPI_TimelineEvents_Loop)
 
 UNIT_TEST_CASE (DartAPI_TimelineEvents_NullFlowIdsHandledGracefully)
 
static intptr_t EchoInt (double x)
 
static void * FfiNativeResolver (const char *name, uintptr_t args_n)
 
 TEST_CASE (Dart_SetFfiNativeResolver)
 
 TEST_CASE (Dart_SetFfiNativeResolver_MissingResolver)
 
static void * NopResolver (const char *name, uintptr_t args_n)
 
 TEST_CASE (Dart_SetFfiNativeResolver_DoesNotResolve)
 
 TEST_CASE (DartAPI_UserTags)
 
static void * HeapSamplingCreate (Dart_Isolate isolate, Dart_IsolateGroup isolate_group, const char *cls_name, intptr_t heap_size)
 
static void HeapSamplingDelete (void *data)
 
void HeapSamplingReport (void *context, void *data)
 
void ResetHeapSamplingState (const char *expected_cls=nullptr)
 
void HandleInterrupts (Thread *thread)
 
void InitHeapSampling (Thread *thread, const char *expected_cls)
 
 TEST_CASE (DartAPI_HeapSampling_UserDefinedClass)
 
 TEST_CASE (DartAPI_HeapSampling_APIAllocations)
 
 TEST_CASE (DartAPI_HeapSampling_NonTrivialSamplingPeriod)
 
 VM_UNIT_TEST_CASE (DartAPI_HeapSampling_CorrectSamplingIntervalForOldSpaceAllocations)
 
void ProtectedHandleCallback (void *peer)
 
 DECLARE_FLAG (bool, precompiled_mode)
 
static void DebuggerSetResumeIfStepping (Isolate *isolate)
 
static ObjectPtr RehashObjects (Zone *zone, const Library &library, const Object &array_or_growable_array)
 
 TEST_CASE (BaseWriteStream_Write)
 
 TEST_CASE (BaseWriteStream_WriteUnsigned)
 
template<typename T >
void TestRaw ()
 
 TEST_CASE (ReadStream_Read16)
 
 TEST_CASE (ReadStream_Read32)
 
 TEST_CASE (ReadStream_Read64)
 
 TEST_CASE (BaseWriteStream_WriteLEB128)
 
 TEST_CASE (BaseWriteStream_WriteSLEB128)
 
 DEFINE_FLAG (bool, trace_debugger_stacktrace, false, "Trace debugger stacktrace collection")
 
 DEFINE_FLAG (bool, trace_rewind, false, "Trace frame rewind")
 
 DEFINE_FLAG (bool, verbose_debug, false, "Verbose debugger messages")
 
 DECLARE_FLAG (bool, trace_deoptimization)
 
 DECLARE_FLAG (bool, warn_on_pause_with_no_debugger)
 
static void InvokeEventHandler (ServiceEvent *event)
 
static const char * QualifiedFunctionName (const Function &func)
 
static bool FunctionOverlaps (const Function &func, const String &script_url, TokenPosition token_pos, TokenPosition end_token_pos)
 
static bool IsImplicitFunction (const Function &func)
 
static DART_FORCE_INLINE ObjectPtr GetVariableValue (uword addr)
 
static bool IsSyntheticVariableName (const String &var_name)
 
static bool IsPrivateVariableName (const String &var_name)
 
static bool IsFunctionVisible (const Function &function)
 
static ActivationFrameTopDartFrame ()
 
static bool IsAtAsyncJump (ActivationFrame *top_frame)
 
static bool CanRewindFrame (intptr_t frame_index, const char **error)
 
static ActivationFrameCollectDartFrame (uword pc, StackFrame *frame, const Code &code, const Array &deopt_frame, intptr_t deopt_frame_offset)
 
static ArrayPtr DeoptimizeToArray (Thread *thread, StackFrame *frame, const Code &code)
 
static void RefineBreakpointPos (const Script &script, TokenPosition pos, TokenPosition next_closest_token_position, TokenPosition requested_token_pos, TokenPosition last_token_pos, intptr_t requested_column, TokenPosition exact_token_pos, TokenPosition *best_fit_pos, intptr_t *best_column, intptr_t *best_line)
 
static TokenPosition ResolveBreakpointPos (const Function &func, TokenPosition requested_token_pos, TokenPosition last_token_pos, intptr_t requested_column, TokenPosition exact_token_pos)
 
static void UpdateBestFit (Function *best_fit, const Function &func)
 
static TokenPosition FindExactTokenPosition (const Script &script, TokenPosition start_of_line, intptr_t column_number)
 
static FunctionPtr FindInnermostClosure (Zone *zone, const Function &function, TokenPosition token_pos)
 
static intptr_t FindNextRewindFrameIndex (DebuggerStackTrace *stack, intptr_t frame_index)
 
static uword LookupRewindPc (const Code &code, uword return_address)
 
Dart_Handle Dart_StackTraceLength (Dart_StackTrace trace, intptr_t *length)
 
Dart_Handle Dart_GetActivationFrame (Dart_StackTrace trace, int frame_index, Dart_ActivationFrame *frame)
 
Dart_Handle Dart_GetStackTrace (Dart_StackTrace *trace)
 
Dart_Handle Dart_GetStackTraceFromError (Dart_Handle handle, Dart_StackTrace *trace)
 
Dart_Handle Dart_ActivationFrameInfo (Dart_ActivationFrame activation_frame, Dart_Handle *function_name, Dart_Handle *script_url, intptr_t *line_number, intptr_t *column_number)
 
Dart_Handle Dart_SetBreakpoint (Dart_Handle script_url_in, intptr_t line_number)
 
Dart_Handle Dart_RemoveBreakpoint (Dart_Handle breakpoint_id_in)
 
Dart_Handle Dart_EvaluateStaticExpr (Dart_Handle lib_handle, Dart_Handle expr_in)
 
Dart_Handle Dart_LibraryId (Dart_Handle library, intptr_t *library_id)
 
Dart_Handle Dart_GetLibraryDebuggable (intptr_t library_id, bool *is_debuggable)
 
Dart_Handle Dart_SetLibraryDebuggable (intptr_t library_id, bool is_debuggable)
 
 DECLARE_FLAG (bool, trace_deoptimization_verbose)
 
static intptr_t ToContextIndex (intptr_t offset_in_bytes)
 
 DEFINE_FLAG (bool, compress_deopt_info, true, "Compress the size of the deoptimization info for optimized code.")
 
static bool IsObjectInstruction (DeoptInstr::Kind kind)
 
static void FillDeferredSlots (DeoptContext *deopt_context, DeferredSlot **slot_list)
 
void DoubleToCString (double d, char *buffer, int buffer_size)
 
StringPtr DoubleToStringAsFixed (double d, int fraction_digits)
 
StringPtr DoubleToStringAsExponential (double d, int fraction_digits)
 
StringPtr DoubleToStringAsPrecision (double d, int precision)
 
bool CStringToDouble (const char *str, intptr_t length, double *result)
 
IntegerPtr DoubleToInteger (Zone *zone, double val)
 
static uint64_t double_to_uint64 (double d)
 
 DEFINE_FLAG (bool, print_stacktrace_at_throw, false, "Prints a stack trace everytime a throw occurs.")
 
static void BuildStackTrace (StackTraceBuilder *builder)
 
static intptr_t SlotIndexToFrameIndex (intptr_t slot)
 
static intptr_t SlotIndexToFpRelativeOffset (intptr_t slot)
 
static void FindErrorHandler (uword *handler_pc, uword *handler_sp, uword *handler_fp)
 
static void ClearLazyDeopts (Thread *thread, uword frame_pointer)
 
static void JumpToExceptionHandler (Thread *thread, uword program_counter, uword stack_pointer, uword frame_pointer, const Object &exception_object, const Object &stacktrace_object)
 
static FieldPtr LookupStackTraceField (const Instance &instance)
 
static DART_NORETURN void ThrowExceptionHelper (Thread *thread, const Instance &incoming_exception, const Instance &existing_stacktrace, const bool is_rethrow, const bool bypass_debugger)
 
void FUNCTION_NAME() Unhandled_equals (Dart_NativeArguments args)
 
void FUNCTION_NAME() Unhandled_invoke (Dart_NativeArguments args)
 
void FUNCTION_NAME() Unhandled_invoke2 (Dart_NativeArguments args)
 
static Dart_NativeFunction native_lookup (Dart_Handle name, int argument_count, bool *auto_setup_scope)
 
 TEST_CASE (UnhandledExceptions)
 
bool GetExperimentalFeatureDefault (ExperimentalFeature feature)
 
const char * GetExperimentalFeatureName (ExperimentalFeature feature)
 
ArrayPtr GetNativeAssetsMap (Thread *thread)
 
FunctionPtr CreateTestFunction (FfiCallbackKind kind)
 
 VM_UNIT_TEST_CASE (FfiCallbackMetadata_CreateSyncFfiCallback)
 
 VM_UNIT_TEST_CASE (FfiCallbackMetadata_CreateAsyncFfiCallback)
 
 VM_UNIT_TEST_CASE (FfiCallbackMetadata_CreateIsolateLocalFfiCallback)
 
 ISOLATE_UNIT_TEST_CASE (FfiCallbackMetadata_TrampolineRecycling)
 
 VM_UNIT_TEST_CASE (FfiCallbackMetadata_DeleteTrampolines)
 
static void RunBigRandomMultithreadedTest (uint64_t seed)
 
 ISOLATE_UNIT_TEST_CASE (FfiCallbackMetadata_BigRandomMultithreadedTest)
 
 UNIT_TEST_CASE (FixedCacheEmpty)
 
 UNIT_TEST_CASE (FixedCacheHalfFull)
 
 UNIT_TEST_CASE (FixedCacheFullResource)
 
 DEFINE_FLAG (bool, print_flags, false, "Print flags as they are being parsed.")
 
 DEFINE_FLAG (bool, ignore_unrecognized_flags, false, "Ignore unrecognized flags.")
 
static void Normalize (char *s)
 
static bool IsValidFlag (const char *name, const char *prefix, intptr_t prefix_length)
 
 DEFINE_FLAG (bool, basic_flag, true, "Testing of a basic boolean flag.")
 
 DECLARE_FLAG (bool, print_flags)
 
 VM_UNIT_TEST_CASE (BasicFlags)
 
 DEFINE_FLAG (bool, parse_flag_bool_test, true, "Flags::Parse (bool) testing")
 
 DEFINE_FLAG (charp, string_opt_test, nullptr, "Testing: string option.")
 
 DEFINE_FLAG (charp, entrypoint_test, "main", "Testing: entrypoint")
 
 DEFINE_FLAG (int, counter, 100, "Testing: int flag")
 
 VM_UNIT_TEST_CASE (ParseFlags)
 
GDB_HELPER void * _currentThread ()
 
GDB_HELPER void _printObjectPtr (uword object)
 
GDB_HELPER Object_handle (uword object)
 
GDB_HELPER void _disassemble (uword pc)
 
GDB_HELPER void _printDartStackTrace ()
 
GDB_HELPER void _printStackTrace ()
 
GDB_HELPER void _printGeneratedStackTrace (uword fp, uword sp, uword pc)
 
GDB_HELPER void _printStackTraceWithLocals ()
 
template<class GrowableArrayInt , class GrowableArrayInt64 >
void TestGrowableArray ()
 
 TEST_CASE (GrowableArray)
 
 TEST_CASE (MallocGrowableArray)
 
static int greatestFirst (const int *a, const int *b)
 
 TEST_CASE (GrowableArraySort)
 
 ISOLATE_UNIT_TEST_CASE (GrowableHandlePtr)
 
 TEST_CASE (GrowableArrayMoveCtor)
 
 TEST_CASE (GrowableArrayMoveAssign)
 
FieldPtr LookupField (Dart_Handle library, const char *class_name, const char *field_name)
 
 TEST_CASE (GuardFieldSimpleTest)
 
 TEST_CASE (GuardFieldFinalListTest)
 
 TEST_CASE (GuardFieldFinalVariableLengthListTest)
 
 TEST_CASE (GuardFieldConstructorTest)
 
 TEST_CASE (GuardFieldConstructor2Test)
 
 ISOLATE_UNIT_TEST_CASE (AllocateZoneHandle)
 
 ISOLATE_UNIT_TEST_CASE (AllocateScopeHandle)
 
static void NoopCallback (void *isolate_callback_data, void *peer)
 
 TEST_CASE (CheckHandleValidity)
 
uint32_t CombineHashes (uint32_t hash, uint32_t other_hash)
 
uint32_t FinalizeHash (uint32_t hash, intptr_t hashbits=kBitsPerInt32)
 
uint32_t HashBytes (const uint8_t *bytes, intptr_t size)
 
 TEST_CASE (DirectChainedHashMap)
 
 TEST_CASE (DirectChainedHashMapInsertRemove)
 
 TEST_CASE (MallocDirectChainedHashMap)
 
 TEST_CASE (ZoneDirectChainedHashMap)
 
 TEST_CASE (DirectChainedHashMapIterator)
 
 TEST_CASE (DirectChainedHashMapIteratorWithCollisionInLastBucket)
 
 TEST_CASE (ZoneCStringSet)
 
 TEST_CASE (CStringIntMap)
 
 TEST_CASE (CStringIntMapUpdate)
 
template<typename Table >
void Validate (const Table &table)
 
 ISOLATE_UNIT_TEST_CASE (HashTable)
 
std::string ToStdString (const String &str)
 
template<typename Set >
void VerifyStringSetsEqual (const std::set< std::string > &expected, const Set &actual, bool ordered)
 
template<typename Map >
void VerifyStringMapsEqual (const std::map< std::string, int > &expected, const Map &actual, bool ordered)
 
template<typename Set >
void TestSet (intptr_t initial_capacity, bool ordered)
 
template<typename Map >
void TestMap (intptr_t initial_capacity, bool ordered)
 
 ISOLATE_UNIT_TEST_CASE (Sets)
 
 ISOLATE_UNIT_TEST_CASE (Maps)
 
static bool IsForwardingObject (ObjectPtr object)
 
static ObjectPtr GetForwardedObject (ObjectPtr object)
 
static void ForwardObjectTo (ObjectPtr before_obj, ObjectPtr after_obj)
 
static bool IsDummyObject (ObjectPtr object)
 
DART_NOINLINE static DART_NORETURN void InvalidForwarding (ObjectPtr before, ObjectPtr after, const char *message)
 
void TestBecomeForward (Heap::Space before_space, Heap::Space after_space)
 
 ISOLATE_UNIT_TEST_CASE (BecomeForwardOldToOld)
 
 ISOLATE_UNIT_TEST_CASE (BecomeForwardNewToNew)
 
 ISOLATE_UNIT_TEST_CASE (BecomeForwardOldToNew)
 
 ISOLATE_UNIT_TEST_CASE (BecomeForwardNewToOld)
 
 ISOLATE_UNIT_TEST_CASE (BecomeForwardPeer)
 
 ISOLATE_UNIT_TEST_CASE (BecomeForwardObjectId)
 
 ISOLATE_UNIT_TEST_CASE (BecomeForwardMessageId)
 
 ISOLATE_UNIT_TEST_CASE (BecomeForwardRememberedObject)
 
 ISOLATE_UNIT_TEST_CASE (BecomeForwardRememberedCards)
 
 DEFINE_FLAG (bool, force_evacuation, false, "Force compaction to move every movable object")
 
static uword Allocate (FreeList *free_list, intptr_t size, bool is_protected)
 
static void Free (FreeList *free_list, uword address, intptr_t size, bool is_protected)
 
static void TestFreeList (VirtualMemory *region, FreeList *free_list, bool is_protected)
 
 TEST_CASE (FreeList)
 
 TEST_CASE (FreeListProtected)
 
 TEST_CASE (FreeListProtectedTinyObjects)
 
 TEST_CASE (FreeListProtectedVariableSizeObjects)
 
static void TestRegress38528 (intptr_t header_overlap)
 
 TEST_CASE (Regress38528)
 
Heap::Space SpaceForExternal (FinalizerEntryPtr raw_entry)
 
template<typename GCVisitorType >
void RunNativeFinalizerCallback (NativeFinalizerPtr raw_finalizer, FinalizerEntryPtr raw_entry, Heap::Space before_gc_space, GCVisitorType *visitor)
 
template<typename GCVisitorType >
void MournFinalizerEntry (GCVisitorType *visitor, FinalizerEntryPtr current_entry)
 
 DEFINE_FLAG (bool, write_protect_vm_isolate, true, "Write protect vm_isolate.")
 
 DEFINE_FLAG (bool, disable_heap_verification, false, "Explicitly disable heap verification.")
 
 DECLARE_FLAG (int, early_tenuring_threshold)
 
 TEST_CASE (OldGC)
 
 TEST_CASE (OldGC_Unsync)
 
 TEST_CASE (LargeSweep)
 
 TEST_CASE (ClassHeapStats)
 
 ISOLATE_UNIT_TEST_CASE (IterateReadOnly)
 
 ISOLATE_UNIT_TEST_CASE (CollectAllGarbage_DeadOldToNew)
 
 ISOLATE_UNIT_TEST_CASE (CollectAllGarbage_DeadNewToOld)
 
 ISOLATE_UNIT_TEST_CASE (CollectAllGarbage_DeadGenCycle)
 
 ISOLATE_UNIT_TEST_CASE (CollectAllGarbage_LiveNewToOld)
 
 ISOLATE_UNIT_TEST_CASE (CollectAllGarbage_LiveOldToNew)
 
 ISOLATE_UNIT_TEST_CASE (CollectAllGarbage_LiveOldDeadNew)
 
 ISOLATE_UNIT_TEST_CASE (CollectAllGarbage_LiveNewDeadOld)
 
 ISOLATE_UNIT_TEST_CASE (CollectAllGarbage_LiveNewToOldChain)
 
 ISOLATE_UNIT_TEST_CASE (CollectAllGarbage_LiveOldToNewChain)
 
static void NoopFinalizer (void *isolate_callback_data, void *peer)
 
 ISOLATE_UNIT_TEST_CASE (ExternalPromotion)
 
 VM_UNIT_TEST_CASE (CleanupBequestNeverReceived)
 
 VM_UNIT_TEST_CASE (ReceivesSendAndExitMessage)
 
 ISOLATE_UNIT_TEST_CASE (ExternalAllocationStats)
 
 ISOLATE_UNIT_TEST_CASE (ExternalSizeLimit)
 
 ISOLATE_UNIT_TEST_CASE (ArrayTruncationRaces)
 
 ISOLATE_UNIT_TEST_CASE (ArrayTruncationPadding)
 
 ISOLATE_UNIT_TEST_CASE (ConcurrentForceGrowthScope)
 
 ISOLATE_UNIT_TEST_CASE (WeakSmi)
 
static void WeakProperty_Generations (Generation property_space, Generation key_space, Generation value_space, bool cleared_after_minor, bool cleared_after_major, bool cleared_after_all)
 
 ISOLATE_UNIT_TEST_CASE (WeakProperty_Generations)
 
static void WeakReference_Generations (Generation reference_space, Generation target_space, bool cleared_after_minor, bool cleared_after_major, bool cleared_after_all)
 
 ISOLATE_UNIT_TEST_CASE (WeakReference_Generations)
 
static void WeakArray_Generations (intptr_t length, Generation array_space, Generation element_space, bool cleared_after_minor, bool cleared_after_major, bool cleared_after_all)
 
 ISOLATE_UNIT_TEST_CASE (WeakArray_Generations)
 
 ISOLATE_UNIT_TEST_CASE (WeakArray_Large_Generations)
 
static void FinalizerEntry_Generations (Generation entry_space, Generation value_space, bool cleared_after_minor, bool cleared_after_major, bool cleared_after_all)
 
 ISOLATE_UNIT_TEST_CASE (FinalizerEntry_Generations)
 
static void TestCardRememberedArray (bool immutable, bool compact)
 
static void TestCardRememberedWeakArray (bool compact)
 
 ISOLATE_UNIT_TEST_CASE (CardRememberedArray)
 
 ISOLATE_UNIT_TEST_CASE (CardRememberedImmutableArray)
 
 ISOLATE_UNIT_TEST_CASE (CardRememberedWeakArray)
 
static bool IsUnreachable (const ObjectPtr obj)
 
static bool CanUseCache (uword flags)
 
 DEFINE_FLAG (int, old_gen_growth_space_ratio, 20, "The desired maximum percentage of free space after old gen GC")
 
 DEFINE_FLAG (int, old_gen_growth_time_ratio, 3, "The desired maximum percentage of time spent in old gen GC")
 
 DEFINE_FLAG (int, old_gen_growth_rate, 280, "The max number of pages the old generation can grow at a time")
 
 DEFINE_FLAG (bool, print_free_list_before_gc, false, "Print free list statistics before a GC")
 
 DEFINE_FLAG (bool, print_free_list_after_gc, false, "Print free list statistics after a GC")
 
 DEFINE_FLAG (bool, log_growth, false, "Log PageSpace growth policy decisions.")
 
 DECLARE_FLAG (bool, write_protect_code)
 
 DEFINE_LEAF_RUNTIME_ENTRY (void, StoreBufferBlockProcess, 1, Thread *thread)
 
END_LEAF_RUNTIME_ENTRY DEFINE_LEAF_RUNTIME_ENTRY (void, MarkingStackBlockProcess, 1, Thread *thread)
 
 DEFINE_FLAG (bool, trace_safepoint, false, "Trace Safepoint logic.")
 
 ISOLATE_UNIT_TEST_CASE (SafepointOperation_SafepointOpWhileDeoptSafepointOpBlocked)
 
 ISOLATE_UNIT_TEST_CASE (SafepointOperation_SafepointOpBlockedWhileDeoptSafepointOp)
 
 ISOLATE_UNIT_TEST_CASE (SafepointOperation_SafepointPointTest)
 
 ISOLATE_UNIT_TEST_CASE (SafepointOperation_StressTest)
 
 ISOLATE_UNIT_TEST_CASE (SafepointOperation_DeoptAndNonDeoptNesting)
 
 ISOLATE_UNIT_TEST_CASE_WITH_EXPECTATION (SafepointOperation_NonDeoptAndDeoptNesting, "Crash")
 
 ISOLATE_UNIT_TEST_CASE (ReloadScopes_Test)
 
 ISOLATE_UNIT_TEST_CASE (Reload_AtReloadSafepoint)
 
static void EnsureValidOOBMessage (Thread *thread, Isolate *isolate, std::unique_ptr< Message > message)
 
 ISOLATE_UNIT_TEST_CASE (Reload_NotAtSafepoint)
 
 ISOLATE_UNIT_TEST_CASE (Reload_AtNonReloadSafepoint)
 
 DEFINE_FLAG (int, early_tenuring_threshold, 66, "When more than this percentage of promotion candidates survive, " "promote all survivors of next scavenge.")
 
 DEFINE_FLAG (int, new_gen_garbage_threshold, 90, "Grow new gen when less than this percentage is garbage.")
 
 DEFINE_FLAG (int, new_gen_growth_factor, 2, "Grow new gen by this factor.")
 
 COMPILE_ASSERT (static_cast< uword >(kForwarded)==static_cast< uword >(kHeapObjectTag))
 
static DART_FORCE_INLINE bool IsForwarding (uword header)
 
static DART_FORCE_INLINE ObjectPtr ForwardedObj (uword header)
 
static DART_FORCE_INLINE uword ForwardingHeader (ObjectPtr target)
 
static NO_SANITIZE_THREAD void objcpy (void *dst, const void *src, size_t size)
 
static DART_FORCE_INLINE uword ReadHeaderRelaxed (ObjectPtr obj)
 
static DART_FORCE_INLINE void WriteHeaderRelaxed (ObjectPtr obj, uword header)
 
static bool IsUnreachable (ObjectPtr *ptr)
 
static bool IsScavengeSurvivor (ObjectPtr obj)
 
bool IsAllocatableInNewSpace (intptr_t size)
 
bool IsAllocatableViaFreeLists (intptr_t size)
 
 ISOLATE_UNIT_TEST_CASE (WeakTables)
 
bool ObjectAtPoolIndex (const Code &code, intptr_t index, Object *obj)
 
bool DecodeLoadObjectFromPoolOrThread (uword pc, const Code &code, Object *obj)
 
intptr_t IndexFromPPLoadDisp8 (uword start)
 
intptr_t IndexFromPPLoadDisp32 (uword start)
 
 UNIT_TEST_CASE (IntrusiveDListMultiEntryTest)
 
 UNIT_TEST_CASE (IntrusiveDListRemoveFirstTest)
 
 UNIT_TEST_CASE (IntrusiveDListRemoveLastTest)
 
 UNIT_TEST_CASE (IntrusiveDListIsInList)
 
 UNIT_TEST_CASE (IntrusiveDListEraseIterator)
 
 UNIT_TEST_CASE (IntrusiveDListAppendListTest)
 
 DECLARE_FLAG (bool, print_metrics)
 
 DECLARE_FLAG (int, old_gen_growth_time_ratio)
 
 DECLARE_FLAG (int, reload_every)
 
 DECLARE_FLAG (bool, check_reloaded)
 
 DECLARE_FLAG (bool, reload_every_back_off)
 
 DECLARE_FLAG (bool, trace_reload)
 
static void DeterministicModeHandler (bool value)
 
 DEFINE_FLAG_HANDLER (DeterministicModeHandler, deterministic, "Enable deterministic mode.")
 
 DEFINE_FLAG (bool, disable_thread_pool_limit, false, "Disables the limit of the thread pool (simulates custom embedder " "with custom message handler on unlimited number of threads).")
 
static std::unique_ptr< MessageSerializeMessage (Dart_Port dest_port, const Instance &obj)
 
static std::unique_ptr< MessageSerializeMessage (Zone *zone, Dart_Port dest_port, Dart_CObject *obj)
 
static MessageHandler::MessageStatus StoreError (Thread *thread, const Error &error)
 
static void ShutdownIsolate (uword parameter)
 
static const char * ExceptionPauseInfoToServiceEnum (Dart_ExceptionPauseInfo pi)
 
static ServiceEvent IsolatePauseEvent (Isolate *isolate)
 
 DEFINE_FLAG (int, reload_every, 0, "Reload every N stack overflow checks.")
 
 DEFINE_FLAG (bool, trace_reload, false, "Trace isolate reloading")
 
 DEFINE_FLAG (bool, trace_reload_verbose, false, "trace isolate reloading verbose")
 
 DEFINE_FLAG (bool, identity_reload, false, "Enable checks for identity reload.")
 
 DEFINE_FLAG (bool, reload_every_optimized, true, "Only from optimized code.")
 
 DEFINE_FLAG (bool, reload_every_back_off, false, "Double the --reload-every value after each reload.")
 
 DEFINE_FLAG (bool, reload_force_rollback, false, "Force all reloads to fail and rollback.")
 
 DEFINE_FLAG (bool, check_reloaded, false, "Assert that an isolate has reloaded at least once.") DEFINE_FLAG(bool
 
static bool HasNoTasks (Heap *heap)
 
static const char * BoxCidToCString (intptr_t box_cid)
 
static intptr_t CommonSuffixLength (const char *a, const char *b)
 
static ObjectPtr AcceptCompilation (Thread *thread)
 
static ObjectPtr RejectCompilation (Thread *thread)
 
static void PropagateLibraryModified (const ZoneGrowableArray< ZoneGrowableArray< intptr_t > * > *imported_by, intptr_t lib_index, BitVector *modified_libs)
 Copied in from https://dart-review.googlesource.com/c/sdk/+/77722.
 
static bool ContainsScriptUri (const GrowableArray< const char * > &seen_uris, const char *uri)
 
int64_t SimpleInvoke (Dart_Handle lib, const char *method)
 
const char * SimpleInvokeStr (Dart_Handle lib, const char *method)
 
Dart_Handle SimpleInvokeError (Dart_Handle lib, const char *method)
 
 TEST_CASE (IsolateReload_FunctionReplacement)
 
 TEST_CASE (IsolateReload_IncrementalCompile)
 
 TEST_CASE (IsolateReload_KernelIncrementalCompile)
 
 TEST_CASE (IsolateReload_KernelIncrementalCompileAppAndLib)
 
 TEST_CASE (IsolateReload_KernelIncrementalCompileGenerics)
 
 TEST_CASE (IsolateReload_KernelIncrementalCompileBaseClass)
 
 TEST_CASE (IsolateReload_BadClass)
 
 TEST_CASE (IsolateReload_StaticValuePreserved)
 
 TEST_CASE (IsolateReload_SavedClosure)
 
 TEST_CASE (IsolateReload_TopLevelFieldAdded)
 
 TEST_CASE (IsolateReload_ClassFieldAdded)
 
 TEST_CASE (IsolateReload_ClassFieldAdded2)
 
 TEST_CASE (IsolateReload_ClassFieldRemoved)
 
 TEST_CASE (IsolateReload_ClassAdded)
 
 TEST_CASE (IsolateReload_ClassRemoved)
 
 TEST_CASE (IsolateReload_LibraryImportAdded)
 
 TEST_CASE (IsolateReload_LibraryImportRemoved)
 
 TEST_CASE (IsolateReload_LibraryDebuggable)
 
 TEST_CASE (IsolateReload_ImplicitConstructorChanged)
 
 TEST_CASE (IsolateReload_ConstructorChanged)
 
 TEST_CASE (IsolateReload_SuperClassChanged)
 
 TEST_CASE (IsolateReload_Generics)
 
 TEST_CASE (IsolateReload_TypeIdentity)
 
 TEST_CASE (IsolateReload_TypeIdentityGeneric)
 
 TEST_CASE (IsolateReload_TypeIdentityParameter)
 
 TEST_CASE (IsolateReload_MixinChanged)
 
 TEST_CASE (IsolateReload_ComplexInheritanceChange)
 
 TEST_CASE (IsolateReload_LiveStack)
 
 TEST_CASE (IsolateReload_LibraryLookup)
 
 TEST_CASE (IsolateReload_LibraryHide)
 
 TEST_CASE (IsolateReload_LibraryShow)
 
 TEST_CASE (IsolateReload_SmiFastPathStubs)
 
 TEST_CASE (IsolateReload_ImportedMixinFunction)
 
 TEST_CASE (IsolateReload_TopLevelParseError)
 
 TEST_CASE (IsolateReload_PendingUnqualifiedCall_StaticToInstance)
 
 TEST_CASE (IsolateReload_PendingUnqualifiedCall_InstanceToStatic)
 
 TEST_CASE (IsolateReload_PendingConstructorCall_AbstractToConcrete)
 
 TEST_CASE (IsolateReload_PendingConstructorCall_ConcreteToAbstract)
 
 TEST_CASE (IsolateReload_PendingStaticCall_DefinedToNSM)
 
 TEST_CASE (IsolateReload_PendingStaticCall_NSMToDefined)
 
 TEST_CASE (IsolateReload_PendingSuperCall)
 
 TEST_CASE (IsolateReload_TearOff_Instance_Equality)
 
 TEST_CASE (IsolateReload_TearOff_Parameter_Count_Mismatch)
 
 TEST_CASE (IsolateReload_TearOff_Remove)
 
 TEST_CASE (IsolateReload_TearOff_Class_Identity)
 
 TEST_CASE (IsolateReload_TearOff_Library_Identity)
 
 TEST_CASE (IsolateReload_TearOff_List_Set)
 
 TEST_CASE (IsolateReload_TearOff_AddArguments)
 
 TEST_CASE (IsolateReload_TearOff_AddArguments2)
 
 TEST_CASE (IsolateReload_EnumEquality)
 
 TEST_CASE (IsolateReload_EnumIdentical)
 
 TEST_CASE (IsolateReload_EnumReorderIdentical)
 
 TEST_CASE (IsolateReload_EnumAddition)
 
 TEST_CASE (IsolateReload_EnumToNotEnum)
 
 TEST_CASE (IsolateReload_NotEnumToEnum)
 
 TEST_CASE (IsolateReload_EnumDelete)
 
 TEST_CASE (IsolateReload_EnumIdentityReload)
 
 TEST_CASE (IsolateReload_EnumShapeChange)
 
 TEST_CASE (IsolateReload_EnumShapeChangeAdd)
 
 TEST_CASE (IsolateReload_EnumShapeChangeRemove)
 
 TEST_CASE (IsolateReload_EnumReferentShapeChangeAdd)
 
 TEST_CASE (IsolateReload_ConstantIdentical)
 
 TEST_CASE (IsolateReload_CallDeleted_TopLevelFunction)
 
 TEST_CASE (IsolateReload_CallDeleted_TopLevelFunctionArityChange)
 
 TEST_CASE (IsolateReload_CallDeleted_TopLevelAddTypeArguments)
 
 TEST_CASE (IsolateReload_CallDeleted_TopLevelRemoveTypeArguments)
 
 TEST_CASE (IsolateReload_CallDeleted_TopLevelMissingPassingTypeArguments)
 
 TEST_CASE (IsolateReload_CallDeleted_TopLevelFunctionEvaluationOrder)
 
 TEST_CASE (IsolateReload_CallDeleted_TopLevelFunctionLibraryDeleted)
 
 TEST_CASE (IsolateReload_CallDeleted_TopLevelGetter)
 
 TEST_CASE (IsolateReload_CallDeleted_TopLevelSetter)
 
 TEST_CASE (IsolateReload_CallDeleted_TopLevelSetterEvaluationOrder)
 
 TEST_CASE (IsolateReload_CallDeleted_ClassFunction)
 
 TEST_CASE (IsolateReload_CallDeleted_ClassFunctionArityChange)
 
 TEST_CASE (IsolateReload_CallDeleted_ClassFunctionEvaluationOrder)
 
 TEST_CASE (IsolateReload_CallDeleted_ClassGetter)
 
 TEST_CASE (IsolateReload_CallDeleted_ClassSetter)
 
 TEST_CASE (IsolateReload_CallDeleted_ClassSetterEvaluationOrder)
 
 TEST_CASE (IsolateReload_CallDeleted_ClassGenerativeConstructor)
 
 TEST_CASE (IsolateReload_CallDeleted_ClassGenerativeConstructorArityChange)
 
 TEST_CASE (IsolateReload_CallDeleted_ClassGenerativeConstructorClassDeleted)
 
 TEST_CASE (IsolateReload_CallDeleted_ClassFactoryConstructor)
 
 TEST_CASE (IsolateReload_CallDeleted_ClassFactoryConstructorArityChange)
 
 TEST_CASE (IsolateReload_CallDeleted_ClassFactoryConstructorClassDeleted)
 
 TEST_CASE (IsolateReload_CallDeleted_SuperFunction)
 
 TEST_CASE (IsolateReload_CallDeleted_SuperFunctionArityChange)
 
 TEST_CASE (IsolateReload_CallDeleted_SuperGetter)
 
 TEST_CASE (IsolateReload_CallDeleted_SuperSetter)
 
 TEST_CASE (IsolateReload_CallDeleted_SuperFieldGetter)
 
 TEST_CASE (IsolateReload_CallDeleted_SuperFieldSetter)
 
 TEST_CASE (IsolateReload_EnumValuesToString)
 
 ISOLATE_UNIT_TEST_CASE (IsolateReload_DirectSubclasses_Success)
 
 ISOLATE_UNIT_TEST_CASE (IsolateReload_DirectSubclasses_GhostSubclass)
 
 ISOLATE_UNIT_TEST_CASE (IsolateReload_DirectSubclasses_Failure)
 
 TEST_CASE (IsolateReload_ChangeInstanceFormat0)
 
 TEST_CASE (IsolateReload_ChangeInstanceFormat1)
 
 TEST_CASE (IsolateReload_ChangeInstanceFormat2)
 
 TEST_CASE (IsolateReload_ChangeInstanceFormat3)
 
 TEST_CASE (IsolateReload_ChangeInstanceFormat4)
 
 TEST_CASE (IsolateReload_ChangeInstanceFormat5)
 
 TEST_CASE (IsolateReload_ChangeInstanceFormat6)
 
 TEST_CASE (IsolateReload_ChangeInstanceFormat7)
 
 TEST_CASE (IsolateReload_ChangeInstanceFormat8)
 
 TEST_CASE (IsolateReload_ChangeInstanceFormat9)
 
 TEST_CASE (IsolateReload_ShapeChangeMutualReference)
 
 TEST_CASE (IsolateReload_ShapeChangeRetainsHash)
 
 TEST_CASE (IsolateReload_ShapeChangeRetainsHash_Const)
 
 TEST_CASE (IsolateReload_ShapeChange_Const_AddSlot)
 
 TEST_CASE (IsolateReload_ShapeChange_Const_RemoveSlot)
 
 TEST_CASE (IsolateReload_DeeplyImmutableChange)
 
 TEST_CASE (IsolateReload_DeeplyImmutableChange_2)
 
 TEST_CASE (IsolateReload_DeeplyImmutableChange_MultiLib)
 
 TEST_CASE (IsolateReload_DeeplyImmutableChange_TypeBound)
 
 TEST_CASE (IsolateReload_ConstToNonConstClass)
 
 TEST_CASE (IsolateReload_ConstToNonConstClass_Empty)
 
 TEST_CASE (IsolateReload_StaticTearOffRetainsHash)
 
static bool NothingModifiedCallback (const char *url, int64_t since)
 
 TEST_CASE (IsolateReload_NoLibsModified)
 
static bool MainModifiedCallback (const char *url, int64_t since)
 
 TEST_CASE (IsolateReload_MainLibModified)
 
static bool ImportModifiedCallback (const char *url, int64_t since)
 
 TEST_CASE (IsolateReload_ImportedLibModified)
 
 TEST_CASE (IsolateReload_PrefixImportedLibModified)
 
static bool ExportModifiedCallback (const char *url, int64_t since)
 
 TEST_CASE (IsolateReload_ExportedLibModified)
 
 TEST_CASE (IsolateReload_SimpleConstFieldUpdate)
 
 TEST_CASE (IsolateReload_ConstFieldUpdate)
 
 TEST_CASE (IsolateReload_RunNewFieldInitializers)
 
 TEST_CASE (IsolateReload_RunNewFieldInitializersReferenceStaticField)
 
 TEST_CASE (IsolateReload_RunNewFieldInitializersLazy)
 
 TEST_CASE (IsolateReload_RunNewFieldInitializersLazyConst)
 
 TEST_CASE (IsolateReload_RunNewFieldInitializersLazyTransitive)
 
 TEST_CASE (IsolateReload_RunNewFieldInitializersThrows)
 
 TEST_CASE (IsolateReload_RunNewFieldInitializersCyclicInitialization)
 
 TEST_CASE (IsolateReload_RunNewFieldInitializersSyntaxError)
 
 TEST_CASE (IsolateReload_RunNewFieldInitializersSyntaxError2)
 
 TEST_CASE (IsolateReload_RunNewFieldInitializersSyntaxError3)
 
 TEST_CASE (IsolateReload_RunNewFieldInitializersSuperClass)
 
 TEST_CASE (IsolateReload_RunNewFieldInitializersWithConsts)
 
 TEST_CASE (IsolateReload_RunNewFieldInitializersWithGenerics)
 
 TEST_CASE (IsolateReload_AddNewStaticField)
 
 TEST_CASE (IsolateReload_StaticFieldInitialValueDoesnotChange)
 
 TEST_CASE (IsolateReload_DeleteStaticField)
 
static void TestReloadWithFieldChange (const char *prefix, const char *suffix, const char *verify, const char *from_type, const char *from_init, const char *to_type, const char *to_init)
 
 TEST_CASE (IsolateReload_ExistingFieldChangesType)
 
 TEST_CASE (IsolateReload_ExistingFieldChangesTypeWithOtherUnboxedFields)
 
 TEST_CASE (IsolateReload_ExistingFieldUnboxedToBoxed)
 
 TEST_CASE (IsolateReload_ExistingFieldBoxedToUnboxed)
 
 TEST_CASE (IsolateReload_ExistingFieldUnboxedToUnboxed)
 
 TEST_CASE (IsolateReload_ExistingStaticFieldChangesType)
 
 TEST_CASE (IsolateReload_ExistingFieldChangesTypeIndirect)
 
 TEST_CASE (IsolateReload_ExistingStaticFieldChangesTypeIndirect)
 
 TEST_CASE (IsolateReload_ExistingFieldChangesTypeIndirectGeneric)
 
 TEST_CASE (IsolateReload_ExistingStaticFieldChangesTypeIndirectGeneric)
 
 TEST_CASE (IsolateReload_ExistingFieldChangesTypeIndirectFunction)
 
 TEST_CASE (IsolateReload_ExistingStaticFieldChangesTypeIndirectFunction)
 
 TEST_CASE (IsolateReload_TypedefToNotTypedef)
 
 TEST_CASE (IsolateReload_NotTypedefToTypedef)
 
 TEST_CASE (IsolateReload_TypedefAddParameter)
 
 TEST_CASE (IsolateReload_PatchStaticInitializerWithClosure)
 
 TEST_CASE (IsolateReload_StaticTargetArityChange)
 
 TEST_CASE (IsolateReload_SuperGetterReboundToMethod)
 
 TEST_CASE (IsolateReload_RegressB179030011)
 
 TEST_CASE (IsolateReload_GenericConstructorTearOff)
 
 TEST_CASE (IsolateReload_ImplicitGetterWithLoadGuard)
 
 TEST_CASE (IsolateReload_EnumInMainLibraryModified)
 
 TEST_CASE (IsolateReload_KeepPragma1)
 
 TEST_CASE (IsolateReload_EnumWithSet)
 
 TEST_CASE (IsolateReload_KeepPragma2)
 
 TEST_CASE (IsolateReload_KeepPragma3)
 
 VM_UNIT_TEST_CASE (IsolateCurrent)
 
void IsolateSpawn (const char *platform_script_value)
 
 TEST_CASE (IsolateSpawn_FileUri)
 
 TEST_CASE (IsolateSpawn_PackageUri)
 
 TEST_CASE (StackLimitInterrupts)
 
 ISOLATE_UNIT_TEST_CASE (Isolate_Ports)
 
 ISOLATE_UNIT_TEST_CASE (Isolate_MayExit_True)
 
 ISOLATE_UNIT_TEST_CASE (Isolate_MayExit_False)
 
static const char * GetJSONRpcErrorMessage (intptr_t code)
 
static void PrintRequest (JSONObject *obj, JSONStream *js)
 
static void Finalizer (void *isolate_callback_data, void *buffer)
 
 TEST_CASE (JSON_TextBuffer)
 
 TEST_CASE (JSON_JSONStream_Primitives)
 
 TEST_CASE (JSON_JSONStream_Array)
 
 TEST_CASE (JSON_JSONStream_Base64String)
 
 TEST_CASE (JSON_JSONStream_Object)
 
 TEST_CASE (JSON_JSONStream_NestedObject)
 
 TEST_CASE (JSON_JSONStream_ObjectArray)
 
 TEST_CASE (JSON_JSONStream_ArrayArray)
 
 TEST_CASE (JSON_JSONStream_Printf)
 
 TEST_CASE (JSON_JSONStream_ObjectPrintf)
 
 ISOLATE_UNIT_TEST_CASE (JSON_JSONStream_DartObject)
 
 TEST_CASE (JSON_JSONStream_EscapedString)
 
 TEST_CASE (JSON_JSONStream_DartString)
 
 TEST_CASE (JSON_JSONStream_Params)
 
 DEFINE_FLAG (bool, trace_kernel, false, "Trace Kernel service requests.")
 
 DEFINE_FLAG (charp, kernel_multiroot_filepaths, nullptr, "Comma-separated list of file paths that should be treated as roots" " by frontend compiler.")
 
 DEFINE_FLAG (charp, kernel_multiroot_scheme, nullptr, "URI scheme that replaces filepaths prefixes specified" " by kernel_multiroot_filepaths option")
 
static Dart_CObject BuildFilesPairs (int source_files_count, Dart_SourceFile source_files[])
 
static void ReleaseFilesPairs (const Dart_CObject &files)
 
static void PassThroughFinalizer (void *isolate_callback_data, void *peer)
 
 DEFINE_OPTION_HANDLER (KernelIsolate::AddExperimentalFlag, enable_experiment, "Comma separated list of experimental features.")
 
const dart::TypedDataCreateLineStartsData ()
 
 ISOLATE_UNIT_TEST_CASE (KernelLineStartsReader_MaxPosition)
 
void ExpectLocationForPosition (const kernel::KernelLineStartsReader &reader, intptr_t position, intptr_t expected_line, intptr_t expected_col)
 
 ISOLATE_UNIT_TEST_CASE (KernelLineStartsReader_LocationForPosition)
 
void ExpectTokenRangeAtLine (const kernel::KernelLineStartsReader &reader, intptr_t line, intptr_t expected_first_token, intptr_t expected_last_token)
 
 ISOLATE_UNIT_TEST_CASE (KernelLineStartsReader_TokenRangeAtLine)
 
 DEFINE_FLAG (bool, force_log_flush, false, "Always flush log messages.")
 
 DEFINE_FLAG (int, force_log_flush_at_size, 0, "Flush log messages when buffer exceeds given size (disabled when 0).")
 
 DEFINE_FLAG (charp, isolate_log_filter, nullptr, "Log isolates whose name include the filter. " "Default: service isolate log messages are suppressed " "(specify 'vm-service' to log them).")
 
 DEFINE_FLAG (charp, redirect_isolate_log_to, nullptr, "Log isolate messages into the given file.")
 
static void TestPrinter (const char *buffer)
 
 TEST_CASE (Log_Macro)
 
 TEST_CASE (Log_Basic)
 
 TEST_CASE (Log_Block)
 
static void LongJumpHelper (LongJumpScope *jump)
 
 ISOLATE_UNIT_TEST_CASE (LongJump)
 
static void * NewRegion (uword size)
 
static void DeleteRegion (const MemoryRegion &region)
 
 VM_UNIT_TEST_CASE (NullRegion)
 
 VM_UNIT_TEST_CASE (NewRegion)
 
 VM_UNIT_TEST_CASE (Subregion)
 
 VM_UNIT_TEST_CASE (ExtendedRegion)
 
 DECLARE_FLAG (bool, trace_service_pause_events)
 
MessageHandler::MessageStatus TestStartFunction (uword data)
 
void TestEndFunction (uword data)
 
static std::unique_ptr< MessageBlankMessage (Dart_Port dest, Message::Priority priority)
 
 VM_UNIT_TEST_CASE (MessageHandler_PostMessage)
 
 VM_UNIT_TEST_CASE (MessageHandler_HasOOBMessages)
 
 VM_UNIT_TEST_CASE (MessageHandler_ClosePort)
 
 VM_UNIT_TEST_CASE (MessageHandler_CloseAllPorts)
 
 VM_UNIT_TEST_CASE (MessageHandler_HandleNextMessage)
 
 VM_UNIT_TEST_CASE (MessageHandler_HandleNextMessage_ProcessOOBAfterError)
 
 VM_UNIT_TEST_CASE (MessageHandler_HandleNextMessage_Shutdown)
 
 VM_UNIT_TEST_CASE (MessageHandler_HandleOOBMessages)
 
static void SendMessages (uword param)
 
 VM_UNIT_TEST_CASE (MessageHandler_Run)
 
static void IsolateMessageTypedDataFinalizer (void *isolate_callback_data, void *buffer)
 
std::unique_ptr< MessageWriteMessage (bool same_group, const Object &obj, Dart_Port dest_port, Message::Priority priority)
 
std::unique_ptr< MessageWriteApiMessage (Zone *zone, Dart_CObject *obj, Dart_Port dest_port, Message::Priority priority)
 
ObjectPtr ReadObjectGraphCopyMessage (Thread *thread, PersistentHandle *handle)
 
ObjectPtr ReadMessage (Thread *thread, Message *message)
 
Dart_CObjectReadApiMessage (Zone *zone, Message *message)
 
static uint8_t * AllocMsg (const char *str)
 
 TEST_CASE (MessageQueue_BasicOperations)
 
 TEST_CASE (MessageQueue_Clear)
 
 DEFINE_FLAG (bool, print_metrics, false, "Print metrics when isolates (and the VM) are shutdown.")
 
static const char * UnitString (intptr_t unit)
 
 VM_UNIT_TEST_CASE (Metric_Simple)
 
 VM_UNIT_TEST_CASE (Metric_OnDemand)
 
 ISOLATE_UNIT_TEST_CASE (Metric_EmbedderAPI)
 
 TEST_CASE (Mixin_PrivateSuperResolution)
 
 TEST_CASE (Mixin_PrivateSuperResolutionCrossLibraryShouldFail)
 
static bool PostCObjectHelper (Dart_Port port_id, Dart_CObject *message)
 
DART_EXPORT bool Dart_PostCObject (Dart_Port port_id, Dart_CObject *message)
 
DART_EXPORT bool Dart_PostInteger (Dart_Port port_id, int64_t message)
 
DART_EXPORT Dart_Port Dart_NewNativePort (const char *name, Dart_NativeMessageHandler handler, bool handle_concurrently)
 
DART_EXPORT bool Dart_CloseNativePort (Dart_Port native_port_id)
 
DART_EXPORT bool Dart_InvokeVMServiceMethod (uint8_t *request_json, intptr_t request_json_length, uint8_t **response_json, intptr_t *response_json_length, char **error)
 
DART_EXPORT Dart_Handle Dart_CompileAll ()
 
DART_EXPORT Dart_Handle Dart_FinalizeAllClasses ()
 
DART_EXPORT void * Dart_ExecuteInternalCommand (const char *command, void *arg)
 
void DartNativeThrowTypeArgumentCountException (int num_type_args, int num_type_args_expected)
 
void DartNativeThrowArgumentException (const Instance &instance)
 
static NativeFunction ResolveNativeFunction (Zone *zone, const Function &func, bool *is_bootstrap_native, bool *is_auto_scope)
 
void TestSmiSub (Dart_NativeArguments args)
 
void TestSmiSum (Dart_NativeArguments args)
 
void TestNonNullSmiSum (Dart_NativeArguments args)
 
 DEFINE_FLAG (uint64_t, huge_method_cutoff_in_code_size, 200000, "Huge method cutoff in unoptimized code size (in bytes).")
 
 DEFINE_FLAG (bool, show_internal_names, false, "Show names of internal classes (e.g. \"OneByteString\") in error messages " "instead of showing the corresponding interface names (e.g. \"String\"). " "Also show legacy nullability in type names.")
 
 DEFINE_FLAG (bool, remove_script_timestamps_for_test, false, "Remove script timestamps to allow for deterministic testing.")
 
 DEFINE_FLAG (bool, use_register_cc, true, "Use register calling conventions")
 
 DECLARE_FLAG (int, max_polymorphic_checks)
 
static void AppendSubString (BaseTextBuffer *buffer, const char *name, intptr_t start_pos, intptr_t len)
 
template<typename type >
static bool IsSpecialCharacter (type value)
 
static bool IsAsciiNonprintable (int32_t c)
 
static int32_t EscapeOverhead (int32_t c)
 
template<typename type >
static type SpecialCharacter (type value)
 
static void ReportTooManyTypeArguments (const Class &cls)
 
bool FindPragmaInMetadata (Thread *T, const Object &metadata_obj, const String &pragma_name, bool multiple, Object *options)
 
static ObjectPtr ThrowNoSuchMethod (const Instance &receiver, const String &function_name, const Array &arguments, const Array &argument_names, const InvocationMirror::Level level, const InvocationMirror::Kind kind)
 
static ObjectPtr ThrowTypeError (const TokenPosition token_pos, const Instance &src_value, const AbstractType &dst_type, const String &dst_name)
 
static ArrayPtr CreateCallableArgumentsFromStatic (Zone *zone, const Instance &receiver, const Array &static_args, const Array &arg_names, const ArgumentsDescriptor &static_args_descriptor)
 
static ObjectPtr LoadExpressionEvaluationFunction (Zone *zone, const ExternalTypedData &kernel_buffer, const String &library_url, const String &klass)
 
static bool EvaluationFunctionNeedsReceiver (Thread *thread, Zone *zone, const Function &eval_function)
 
static ObjectPtr EvaluateCompiledExpressionHelper (Zone *zone, const Function &eval_function, const Array &type_definitions, const Array &arguments, const TypeArguments &type_arguments)
 
static bool MatchesAccessorName (const String &name, const char *prefix, intptr_t prefix_length, const String &accessor_name)
 
static uword Hash64To32 (uint64_t v)
 
static void ReportTooManyTypeParameters (const FunctionType &sig)
 
static bool InVmTests (const Function &function)
 
static TypeArgumentsPtr RetrieveFunctionTypeArguments (Thread *thread, Zone *zone, const Function &function, const Instance &receiver, const TypeArguments &instantiator_type_args, const Array &args, const ArgumentsDescriptor &args_desc)
 
static TypeArgumentsPtr RetrieveInstantiatorTypeArguments (Zone *zone, const Function &function, const Instance &receiver)
 
static intptr_t ConstructFunctionFullyQualifiedCString (const Function &function, char **chars, intptr_t reserve_len, bool with_lib, QualifiedFunctionLibKind lib_kind)
 
static void FunctionPrintNameHelper (const Function &fun, const NameFormattingParams &params, BaseTextBuffer *printer)
 
static intptr_t GetListLength (const Object &value)
 
static intptr_t GetListLengthOffset (intptr_t cid)
 
static StaticTypeExactnessState TrivialTypeExactnessFor (const Class &cls)
 
static const char * SafeTypeArgumentsToCString (const TypeArguments &args)
 
static bool IsLetter (int32_t c)
 
static bool IsDecimalDigit (int32_t c)
 
static bool IsIdentStartChar (int32_t c)
 
static bool IsIdentChar (int32_t c)
 
static intptr_t GetRelativeSourceIndex (const String &src, intptr_t line, intptr_t line_offset=0, intptr_t column=1, intptr_t column_offset=0, intptr_t starting_index=0)
 
static void ReportTooManyImports (const Library &lib)
 
static bool HasPragma (const Object &declaration)
 
static bool ShouldBePrivate (const String &name)
 
static void AddScriptIfUnique (const GrowableObjectArray &scripts, const Script &candidate)
 
static ArrayPtr NewDictionary (intptr_t initial_size)
 
static ObjectPtr InvokeInstanceFunction (Thread *thread, const Instance &receiver, const Function &function, const String &target_name, const Array &args, const Array &args_descriptor_array, bool respect_reflectable, const TypeArguments &instantiator_type_args)
 
static int PrintVarInfo (char *buffer, int len, intptr_t i, const String &var_name, const UntaggedLocalVarDescriptors::VarInfo &info)
 
static void IndentN (int count)
 
static bool SubtypeTestCacheEntryMatches (const SubtypeTestCacheTable::TupleView &t, intptr_t num_inputs, const Object &instance_class_id_or_signature, const AbstractType &destination_type, const TypeArguments &instance_type_arguments, const TypeArguments &instantiator_type_arguments, const TypeArguments &function_type_arguments, const TypeArguments &instance_parent_function_type_arguments, const TypeArguments &instance_delayed_type_arguments)
 
static classid_t NormalizeClassIdForSyntacticalTypeEquality (classid_t cid)
 
static bool IsPercent (int32_t c)
 
static bool IsHexCharacter (int32_t c)
 
static bool IsURISafeCharacter (int32_t c)
 
static int32_t GetHexCharacter (int32_t c)
 
static int32_t GetHexValue (int32_t c)
 
static int32_t MergeHexCharacters (int32_t c1, int32_t c2)
 
static FinalizablePersistentHandleAddFinalizer (const Object &referent, void *peer, Dart_HandleFinalizer callback, intptr_t external_size)
 
template<typename T1 , typename T2 >
static bool EqualsIgnoringPrivateKey (const String &str1, const String &str2)
 
static void TransferableTypedDataFinalizer (void *isolate_callback_data, void *peer)
 
static void PrintSymbolicStackFrameIndex (BaseTextBuffer *buffer, intptr_t frame_index)
 
static void PrintSymbolicStackFrameBody (BaseTextBuffer *buffer, const char *function_name, const char *url, intptr_t line=-1, intptr_t column=-1)
 
static void PrintSymbolicStackFrame (Zone *zone, BaseTextBuffer *buffer, const Function &function, TokenPosition token_pos_or_line, intptr_t frame_index, bool is_line=false)
 
static bool IsVisibleAsFutureListener (const Function &function)
 
static void DwarfStackTracesHandler (bool value)
 
 DEFINE_FLAG_HANDLER (DwarfStackTracesHandler, dwarf_stack_traces, "Omit CodeSourceMaps in precompiled snapshots and don't " "symbolize stack traces in the precompiled runtime.")
 
void DumpTypeTable (Isolate *isolate)
 
void DumpFunctionTypeTable (Isolate *isolate)
 
void DumpRecordTypeTable (Isolate *isolate)
 
void DumpTypeParameterTable (Isolate *isolate)
 
void DumpTypeArgumentsTable (Isolate *isolate)
 
EntryPointPragma FindEntryPointPragma (IsolateGroup *IG, const Array &metadata, Field *reusable_field_handle, Object *pragma)
 
DART_WARN_UNUSED_RESULT ErrorPtr VerifyEntryPoint (const Library &lib, const Object &member, const Object &annotated, std::initializer_list< EntryPointPragma > allowed_kinds)
 
DART_WARN_UNUSED_RESULT ErrorPtr EntryPointFieldInvocationError (const String &getter_name)
 
DART_WARN_UNUSED_RESULT ErrorPtr EntryPointMemberInvocationError (const Object &member)
 
void DFLRT_ExitSafepoint (NativeArguments __unusable_)
 
 DEFINE_FLAG (bool, enable_fast_object_copy, true, "Enable fast path for fast object copy.")
 
 DEFINE_FLAG (bool, gc_on_foc_slow_path, false, "Cause a GC when falling off the fast path for fast object copy.")
 
static DART_FORCE_INLINE ObjectPtr Marker ()
 
static DART_FORCE_INLINE bool CanShareObject (ObjectPtr obj, uword tags)
 
bool CanShareObjectAcrossIsolates (ObjectPtr obj)
 
static DART_FORCE_INLINE bool MightNeedReHashing (ObjectPtr object)
 
DART_FORCE_INLINE uword TagsFromUntaggedObject (UntaggedObject *obj)
 
DART_FORCE_INLINE void SetNewSpaceTaggingWord (ObjectPtr to, classid_t cid, uint32_t size)
 
DART_FORCE_INLINE ObjectPtr AllocateObject (intptr_t cid, intptr_t size, intptr_t allocated_bytes)
 
DART_FORCE_INLINE void UpdateLengthField (intptr_t cid, ObjectPtr from, ObjectPtr to)
 
void InitializeExternalTypedData (intptr_t cid, ExternalTypedDataPtr from, ExternalTypedDataPtr to)
 
template<typename T >
void CopyTypedDataBaseWithSafepointChecks (Thread *thread, const T &from, const T &to, intptr_t length)
 
void InitializeExternalTypedDataWithSafepointChecks (Thread *thread, intptr_t cid, const ExternalTypedData &from, const ExternalTypedData &to)
 
void InitializeTypedDataView (TypedDataViewPtr obj)
 
void FreeExternalTypedData (void *isolate_callback_data, void *buffer)
 
void FreeTransferablePeer (void *isolate_callback_data, void *peer)
 
static ObjectPtr Ptr (ObjectPtr obj)
 
static ObjectPtr Ptr (const Object &obj)
 
const char * FindRetainingPath (Zone *zone_, Isolate *isolate, const Object &from, const Object &to, TraversalRules traversal_rules)
 
ObjectPtr CopyMutableObjectGraph (const Object &object)
 
 ISOLATE_UNIT_TEST_CASE (ObjectGraph)
 
static void WeakHandleFinalizer (void *isolate_callback_data, void *peer)
 
 ISOLATE_UNIT_TEST_CASE (RetainingPathGCRoot)
 
 ISOLATE_UNIT_TEST_CASE (ObjectIdRingSerialWrapTest)
 
 TEST_CASE (ObjectIdRingScavengeMoveTest)
 
 ISOLATE_UNIT_TEST_CASE (ObjectIdRingOldGCTest)
 
 ISOLATE_UNIT_TEST_CASE (ObjectIdRingExpiredEntryTest)
 
 DECLARE_FLAG (bool, trace_reload_verbose)
 
 DECLARE_FLAG (bool, two_args_smi_icd)
 
static void FindICData (const Array &ic_data_array, intptr_t deopt_id, ICData *ic_data)
 
static void AddNameProperties (JSONObject *jsobj, const char *name, const char *vm_name)
 
static void PrintShowHideNamesToJSON (JSONObject *jsobj, const Namespace &ns)
 
static StackTracePtr CreatePreallocatedStackTrace (Zone *zone)
 
static InstancePtr AllocateObjectByClassName (const Library &library, const String &class_name)
 
static ClassPtr CreateDummyClass (const String &class_name, const Script &script)
 
 ISOLATE_UNIT_TEST_CASE (Class)
 
 ISOLATE_UNIT_TEST_CASE (SixtyThousandDartClasses)
 
 ISOLATE_UNIT_TEST_CASE (TypeArguments)
 
 TEST_CASE (Class_EndTokenPos)
 
 ISOLATE_UNIT_TEST_CASE (InstanceClass)
 
 ISOLATE_UNIT_TEST_CASE (Smi)
 
 ISOLATE_UNIT_TEST_CASE (StringCompareTo)
 
 ISOLATE_UNIT_TEST_CASE (StringEncodeIRI)
 
 ISOLATE_UNIT_TEST_CASE (StringDecodeIRI)
 
 ISOLATE_UNIT_TEST_CASE (StringDecodeIRIInvalid)
 
 ISOLATE_UNIT_TEST_CASE (StringIRITwoByte)
 
 ISOLATE_UNIT_TEST_CASE (Mint)
 
 ISOLATE_UNIT_TEST_CASE (Double)
 
 ISOLATE_UNIT_TEST_CASE (Integer)
 
 ISOLATE_UNIT_TEST_CASE (String)
 
 ISOLATE_UNIT_TEST_CASE (StringFormat)
 
 ISOLATE_UNIT_TEST_CASE (StringConcat)
 
 ISOLATE_UNIT_TEST_CASE (StringHashConcat)
 
 ISOLATE_UNIT_TEST_CASE (StringSubStringDifferentWidth)
 
 ISOLATE_UNIT_TEST_CASE (StringFromUtf8Literal)
 
 ISOLATE_UNIT_TEST_CASE (StringEqualsUtf8)
 
 ISOLATE_UNIT_TEST_CASE (StringEqualsUTF32)
 
 ISOLATE_UNIT_TEST_CASE (EscapeSpecialCharactersOneByteString)
 
 ISOLATE_UNIT_TEST_CASE (EscapeSpecialCharactersTwoByteString)
 
 ISOLATE_UNIT_TEST_CASE (Symbol)
 
 ISOLATE_UNIT_TEST_CASE (SymbolUnicode)
 
 ISOLATE_UNIT_TEST_CASE (Bool)
 
 ISOLATE_UNIT_TEST_CASE (Array)
 
 ISOLATE_UNIT_TEST_CASE (Array_Grow)
 
 ISOLATE_UNIT_TEST_CASE (EmptyInstantiationsCacheArray)
 
static void TestIllegalArrayLength (intptr_t length)
 
 TEST_CASE (ArrayLengthNegativeOne)
 
 TEST_CASE (ArrayLengthSmiMin)
 
 TEST_CASE (ArrayLengthOneTooMany)
 
 TEST_CASE (ArrayLengthMaxElements)
 
static void TestIllegalTypedDataLength (const char *class_name, intptr_t length)
 
 TEST_CASE (Int8ListLengthNegativeOne)
 
 TEST_CASE (Int8ListLengthSmiMin)
 
 TEST_CASE (Int8ListLengthOneTooMany)
 
 TEST_CASE (Int8ListLengthMaxElements)
 
 ISOLATE_UNIT_TEST_CASE (StringCodePointIterator)
 
 ISOLATE_UNIT_TEST_CASE (StringCodePointIteratorRange)
 
 ISOLATE_UNIT_TEST_CASE (GrowableObjectArray)
 
 ISOLATE_UNIT_TEST_CASE (TypedData_Grow)
 
 ISOLATE_UNIT_TEST_CASE (InternalTypedData)
 
 ISOLATE_UNIT_TEST_CASE (ExternalTypedData)
 
 ISOLATE_UNIT_TEST_CASE (Script)
 
 ISOLATE_UNIT_TEST_CASE (Context)
 
 ISOLATE_UNIT_TEST_CASE (ContextScope)
 
 ISOLATE_UNIT_TEST_CASE (Closure)
 
 ISOLATE_UNIT_TEST_CASE (ObjectPrinting)
 
 ISOLATE_UNIT_TEST_CASE (CheckedHandle)
 
static LibraryPtr CreateDummyLibrary (const String &library_name)
 
static FunctionPtr CreateFunction (const char *name)
 
 ISOLATE_UNIT_TEST_CASE (Code)
 
 ISOLATE_UNIT_TEST_CASE_WITH_EXPECTATION (CodeImmutability, "Crash")
 
 ISOLATE_UNIT_TEST_CASE (EmbedStringInCode)
 
 ISOLATE_UNIT_TEST_CASE (EmbedSmiInCode)
 
 ISOLATE_UNIT_TEST_CASE (ExceptionHandlers)
 
 ISOLATE_UNIT_TEST_CASE (PcDescriptors)
 
 ISOLATE_UNIT_TEST_CASE (PcDescriptorsLargeDeltas)
 
static ClassPtr CreateTestClass (const char *name)
 
static FieldPtr CreateTestField (const char *name)
 
 ISOLATE_UNIT_TEST_CASE (ClassDictionaryIterator)
 
static FunctionPtr GetDummyTarget (const char *name)
 
 ISOLATE_UNIT_TEST_CASE (ICData)
 
 ISOLATE_UNIT_TEST_CASE (SubtypeTestCache)
 
 ISOLATE_UNIT_TEST_CASE (MegamorphicCache)
 
 ISOLATE_UNIT_TEST_CASE (FieldTests)
 
bool EqualsIgnoringPrivate (const String &name, const String &private_name)
 
 ISOLATE_UNIT_TEST_CASE (EqualsIgnoringPrivate)
 
 ISOLATE_UNIT_TEST_CASE_WITH_EXPECTATION (ArrayNew_Overflow_Crash, "Crash")
 
 TEST_CASE (StackTraceFormat)
 
 ISOLATE_UNIT_TEST_CASE (WeakProperty_PreserveRecurse)
 
 ISOLATE_UNIT_TEST_CASE (WeakProperty_PreserveOne_NewSpace)
 
 ISOLATE_UNIT_TEST_CASE (WeakProperty_PreserveTwo_NewSpace)
 
 ISOLATE_UNIT_TEST_CASE (WeakProperty_PreserveTwoShared_NewSpace)
 
 ISOLATE_UNIT_TEST_CASE (WeakProperty_PreserveOne_OldSpace)
 
 ISOLATE_UNIT_TEST_CASE (WeakProperty_PreserveTwo_OldSpace)
 
 ISOLATE_UNIT_TEST_CASE (WeakProperty_PreserveTwoShared_OldSpace)
 
 ISOLATE_UNIT_TEST_CASE (WeakProperty_ClearOne_NewSpace)
 
 ISOLATE_UNIT_TEST_CASE (WeakProperty_ClearTwoShared_NewSpace)
 
 ISOLATE_UNIT_TEST_CASE (WeakProperty_ClearOne_OldSpace)
 
 ISOLATE_UNIT_TEST_CASE (WeakProperty_ClearTwoShared_OldSpace)
 
static void WeakReference_PreserveOne (Thread *thread, Heap::Space space)
 
 ISOLATE_UNIT_TEST_CASE (WeakReference_PreserveOne_NewSpace)
 
 ISOLATE_UNIT_TEST_CASE (WeakReference_PreserveOne_OldSpace)
 
static void WeakReference_ClearOne (Thread *thread, Heap::Space space)
 
 ISOLATE_UNIT_TEST_CASE (WeakReference_ClearOne_NewSpace)
 
 ISOLATE_UNIT_TEST_CASE (WeakReference_ClearOne_OldSpace)
 
static void WeakReference_Clear_ReachableThroughWeakProperty (Thread *thread, Heap::Space space)
 
 ISOLATE_UNIT_TEST_CASE (WeakReference_Clear_ReachableThroughWeakProperty_NewSpace)
 
 ISOLATE_UNIT_TEST_CASE (WeakReference_Clear_ReachableThroughWeakProperty_OldSpace)
 
static void WeakReference_Preserve_ReachableThroughWeakProperty (Thread *thread, Heap::Space space)
 
 ISOLATE_UNIT_TEST_CASE (WeakReference_Preserve_ReachableThroughWeakProperty_NewSpace)
 
 ISOLATE_UNIT_TEST_CASE (WeakReference_Preserve_ReachableThroughWeakProperty_OldSpace)
 
 ISOLATE_UNIT_TEST_CASE (WeakArray_New)
 
 ISOLATE_UNIT_TEST_CASE (WeakArray_Old)
 
static int NumEntries (const FinalizerEntry &entry, intptr_t acc=0)
 
static void Finalizer_PreserveOne (Thread *thread, Heap::Space space, bool with_detach)
 
 ISOLATE_UNIT_TEST_CASE (Finalizer_PreserveNoDetachOne_NewSpace)
 
 ISOLATE_UNIT_TEST_CASE (Finalizer_PreserveNoDetachOne_OldSpace)
 
 ISOLATE_UNIT_TEST_CASE (Finalizer_PreserveWithDetachOne_NewSpace)
 
 ISOLATE_UNIT_TEST_CASE (Finalizer_PreserveWithDetachOne_OldSpace)
 
static void Finalizer_ClearDetachOne (Thread *thread, Heap::Space space)
 
 ISOLATE_UNIT_TEST_CASE (Finalizer_ClearDetachOne_NewSpace)
 
 ISOLATE_UNIT_TEST_CASE (Finalizer_ClearDetachOne_OldSpace)
 
static void Finalizer_ClearValueOne (Thread *thread, Heap::Space space, bool null_token)
 
 ISOLATE_UNIT_TEST_CASE (Finalizer_ClearValueOne_NewSpace)
 
 ISOLATE_UNIT_TEST_CASE (Finalizer_ClearValueOne_OldSpace)
 
 ISOLATE_UNIT_TEST_CASE (Finalizer_ClearValueNullTokenOne_NewSpace)
 
 ISOLATE_UNIT_TEST_CASE (Finalizer_ClearValueNullTokenOne_OldSpace)
 
static void Finalizer_DetachOne (Thread *thread, Heap::Space space, bool clear_value)
 
 ISOLATE_UNIT_TEST_CASE (Finalizer_DetachOne_NewSpace)
 
 ISOLATE_UNIT_TEST_CASE (Finalizer_DetachOne_OldSpace)
 
 ISOLATE_UNIT_TEST_CASE (Finalizer_DetachAndClearValueOne_NewSpace)
 
 ISOLATE_UNIT_TEST_CASE (Finalizer_DetachAndClearValueOne_OldSpace)
 
static void Finalizer_GcFinalizer (Thread *thread, Heap::Space space)
 
 ISOLATE_UNIT_TEST_CASE (Finalizer_GcFinalizer_NewSpace)
 
 ISOLATE_UNIT_TEST_CASE (Finalizer_GcFinalizer_OldSpace)
 
static void Finalizer_TwoEntriesCrossGen (Thread *thread, Heap::Space *spaces, bool collect_old_space, bool collect_new_space, bool evacuate_new_space_and_collect_old_space, bool clear_value_1, bool clear_value_2, bool clear_detach_1, bool clear_detach_2)
 
static void Finalizer_TwoEntries (Thread *thread, Heap::Space space, bool clear_value_1, bool clear_value_2, bool clear_detach_1, bool clear_detach_2)
 
 ISOLATE_UNIT_TEST_CASE (Finalizer_ClearValueTwo_NewSpace)
 
 ISOLATE_UNIT_TEST_CASE (Finalizer_ClearValueTwo_OldSpace)
 
 ISOLATE_UNIT_TEST_CASE (Finalizer_ClearFirstValue_NewSpace)
 
 ISOLATE_UNIT_TEST_CASE (Finalizer_ClearFirstValue_OldSpace)
 
 ISOLATE_UNIT_TEST_CASE (Finalizer_ClearSecondValue_NewSpace)
 
 ISOLATE_UNIT_TEST_CASE (Finalizer_ClearSecondValue_OldSpace)
 
 ISOLATE_UNIT_TEST_CASE (Finalizer_PreserveTwo_NewSpace)
 
 ISOLATE_UNIT_TEST_CASE (Finalizer_PreserveTwo_OldSpace)
 
 ISOLATE_UNIT_TEST_CASE (Finalizer_ClearDetachTwo_NewSpace)
 
 ISOLATE_UNIT_TEST_CASE (Finalizer_ClearDetachTwo_OldSpace)
 
static void Finalizer_TwoEntriesCrossGen (Thread *thread, intptr_t test_i)
 
 ISOLATE_UNIT_TEST_CASE (Finalizer_Regress_48843)
 
void NativeFinalizer_TwoEntriesCrossGen_Finalizer (void *peer)
 
static void NativeFinalizer_TwoEntriesCrossGen (Thread *thread, Heap::Space *spaces, bool collect_new_space, bool evacuate_new_space_and_collect_old_space, bool clear_value_1, bool clear_value_2, bool clear_detach_1, bool clear_detach_2)
 
static void NativeFinalizer_TwoEntriesCrossGen (Thread *thread, intptr_t test_i)
 
 TEST_CASE (IsIsolateUnsendable)
 
 TEST_CASE (ImplementorCid)
 
 ISOLATE_UNIT_TEST_CASE (MirrorReference)
 
static FunctionPtr GetFunction (const Class &cls, const char *name)
 
static FunctionPtr GetStaticFunction (const Class &cls, const char *name)
 
static FieldPtr GetField (const Class &cls, const char *name)
 
 ISOLATE_UNIT_TEST_CASE (FindClosureIndex)
 
 ISOLATE_UNIT_TEST_CASE (FindInvocationDispatcherFunctionIndex)
 
static void PrintMetadata (const char *name, const Object &data)
 
 TEST_CASE (Metadata)
 
 TEST_CASE (FunctionSourceFingerprint)
 
 TEST_CASE (FunctionWithBreakpointNotInlined)
 
void SetBreakpoint (Dart_NativeArguments args)
 
static Dart_NativeFunction SetBreakpointResolver (Dart_Handle name, int argument_count, bool *auto_setup_scope)
 
 TEST_CASE (DeoptimizeFramesWhenSettingBreakpoint)
 
 TEST_CASE (DartAPI_BreakpointLockRace)
 
 ISOLATE_UNIT_TEST_CASE (SpecialClassesHaveEmptyArrays)
 
 ISOLATE_UNIT_TEST_CASE (ToCString)
 
 ISOLATE_UNIT_TEST_CASE (PrintJSON)
 
 ISOLATE_UNIT_TEST_CASE (PrintJSONPrimitives)
 
 TEST_CASE (InstanceEquality)
 
 TEST_CASE (HashCode)
 
static bool HashCodeEqualsCanonicalizeHash (const char *value_script, uint32_t hashcode_canonicalize_vm=kCalculateCanonicalizeHash, bool check_identity=true, bool check_hashcode=true)
 
 TEST_CASE (HashCode_Double)
 
 TEST_CASE (HashCode_Mint)
 
 TEST_CASE (HashCode_Null)
 
 TEST_CASE (HashCode_Smi)
 
 TEST_CASE (HashCode_String)
 
 TEST_CASE (HashCode_Symbol)
 
 TEST_CASE (HashCode_True)
 
 TEST_CASE (HashCode_Type_Dynamic)
 
 TEST_CASE (HashCode_Type_Int)
 
 TEST_CASE (Map_iteration)
 
template<class LinkedHashBase >
static bool LinkedHashBaseEqual (const LinkedHashBase &map1, const LinkedHashBase &map2, bool print_diff, bool check_data=true)
 
static MapPtr ConstructImmutableMap (const Array &input_data, intptr_t used_data, const TypeArguments &type_arguments)
 
 TEST_CASE (ConstMap_vm)
 
static bool IsLinkedHashBase (const Object &object)
 
template<class LinkedHashBase , int kMutableCid, int kImmutableCid>
static void HashBaseNonConstEqualsConst (const char *script, bool check_data=true)
 
static void HashMapNonConstEqualsConst (const char *script, bool check_data=true)
 
static void HashSetNonConstEqualsConst (const char *script, bool check_data=true)
 
 TEST_CASE (ConstMap_small)
 
 TEST_CASE (ConstMap_null)
 
 TEST_CASE (ConstMap_larger)
 
 TEST_CASE (ConstMap_nested)
 
 TEST_CASE (Set_iteration)
 
static SetPtr ConstructImmutableSet (const Array &input_data, intptr_t used_data, const TypeArguments &type_arguments)
 
 TEST_CASE (ConstSet_vm)
 
 TEST_CASE (ConstSet_small)
 
 TEST_CASE (ConstSet_larger)
 
static void CheckConcatAll (const String *data[], intptr_t n)
 
 ISOLATE_UNIT_TEST_CASE (Symbols_FromConcatAll)
 
 ISOLATE_UNIT_TEST_CASE (String_ScrubName)
 
 ISOLATE_UNIT_TEST_CASE (String_EqualsUTF32)
 
 TEST_CASE (TypeParameterTypeRef)
 
static void FinalizeAndCanonicalize (AbstractType *type)
 
static void CheckSubtypeRelation (const Expect &expect, const AbstractType &sub, const AbstractType &super, bool is_subtype)
 
 ISOLATE_UNIT_TEST_CASE (ClosureType_SubtypeOfFunctionType)
 
 ISOLATE_UNIT_TEST_CASE (FunctionType_IsSubtypeOfNonNullableObject)
 
static void ExpectTypesEquivalent (const Expect &expect, const AbstractType &expected, const AbstractType &got, TypeEquality kind)
 
 TEST_CASE (Class_GetInstantiationOf)
 
static TypePtr CreateFutureOrType (const AbstractType &param, Nullability nullability)
 
static TypePtr CreateFutureType (const AbstractType &param, Nullability nullability)
 
 ISOLATE_UNIT_TEST_CASE (AbstractType_NormalizeFutureOrType)
 
 TEST_CASE (AbstractType_InstantiatedFutureOrIsNormalized)
 
static void GenerateInvokeInstantiateTAVStub (compiler::Assembler *assembler)
 
static CodePtr CreateInvokeInstantiateTypeArgumentsStub (Thread *thread)
 
static void TypeArgumentsHashCacheTest (Thread *thread, intptr_t num_classes)
 
 TEST_CASE (TypeArguments_Cache_SomeInstantiations)
 
 TEST_CASE (TypeArguments_Cache_ManyInstantiations)
 
static void SubtypeTestCacheCheckContents (Zone *zone, const SubtypeTestCache &cache)
 
static void SubtypeTestCacheEntryTest (Thread *thread, const SubtypeTestCache &cache, const Object &instance_class_id_or_signature, const AbstractType &destination_type, const TypeArguments &instance_type_arguments, const TypeArguments &instantiator_type_arguments, const TypeArguments &function_type_arguments, const TypeArguments &parent_function_type_arguments, const TypeArguments &delayed_type_arguments, const Bool &expected_result, Bool *got_result)
 
static void SubtypeTestCacheTest (Thread *thread, intptr_t num_classes, bool expect_hash)
 
 TEST_CASE (STC_LinearLookup)
 
 TEST_CASE (STC_HashLookup)
 
 VM_UNIT_TEST_CASE (SNPrint)
 
 VM_UNIT_TEST_CASE (OsFuncs)
 
static void DeleteThread (void *thread)
 
 COMPILE_ASSERT (kObjectStartAlignment >=kObjectAlignment)
 
 COMPILE_ASSERT (kObjectStartAlignment >=2 *kBoolValueMask)
 
 TEST_CASE (PortMap_CreateAndCloseOnePort)
 
 TEST_CASE (PortMap_CreateAndCloseTwoPorts)
 
 TEST_CASE (PortMap_ClosePorts)
 
 TEST_CASE (PortMap_CreateManyPorts)
 
 TEST_CASE (PortMap_PostMessage)
 
 TEST_CASE (PortMap_PostIntegerMessage)
 
 TEST_CASE (PortMap_PostNullMessage)
 
 TEST_CASE (PortMap_PostMessageClosedPort)
 
 DEFINE_FLAG (bool, trace_profiled_isolates, false, "Trace profiled isolates.")
 
 DEFINE_FLAG (int, profile_period, 1000, "Time between profiler samples in microseconds. Minimum 50.")
 
 DEFINE_FLAG (int, max_profile_depth, Sample::kPCArraySizeInWords *kMaxSamplesPerTick, "Maximum number stack frames walked. Minimum 1. Maximum 255.")
 
 DEFINE_FLAG (bool, profile_vm, false, "Always collect native stack traces.")
 
 DEFINE_FLAG (bool, profile_vm_allocation, false, "Collect native stack traces when tracing Dart allocations.")
 
 DEFINE_FLAG (int, sample_buffer_duration, 0, "Defines the size of the profiler sample buffer to contain at least " "N seconds of samples at a given sample rate. If not provided, the " "default is ~4 seconds. Large values will greatly increase memory " "consumption.")
 
static void DumpStackFrame (uword pc, uword fp, const char *name, uword offset)
 
void DumpStackFrame (intptr_t frame_index, uword pc, uword fp)
 
static bool ValidateThreadStackBounds (uintptr_t fp, uintptr_t sp, uword stack_lower, uword stack_upper)
 
static bool GetAndValidateThreadStackBounds (OSThread *os_thread, Thread *thread, uintptr_t fp, uintptr_t sp, uword *stack_lower, uword *stack_upper)
 
static void DumpCompilerState (Thread *thread)
 
static intptr_t SamplesPerSecond ()
 
static void FlushSampleBlocks (Isolate *isolate)
 
static void CopyStackBuffer (Sample *sample, uword sp_addr)
 
static void CollectSample (Isolate *isolate, bool exited_dart_code, bool in_dart_code, Sample *sample, ProfilerNativeStackWalker *native_stack_walker, ProfilerDartStackWalker *dart_stack_walker, uword pc, uword fp, uword sp, ProfilerCounters *counters)
 
static SampleSetupSample (Thread *thread, bool allocation_sample, ThreadId tid)
 
static bool CheckIsolate (Isolate *isolate)
 
 DECLARE_FLAG (int, max_profile_depth)
 
 DECLARE_FLAG (int, profile_period)
 
 DECLARE_FLAG (bool, profile_vm)
 
 DECLARE_FLAG (bool, profile_vm_allocation)
 
 DECLARE_FLAG (int, optimization_counter_threshold)
 
static void VisitSamples (SampleBlockBuffer *buffer, SampleVisitor *visitor)
 
 TEST_CASE (Profiler_SampleBufferWrapTest)
 
 TEST_CASE (Profiler_SampleBufferIterateTest)
 
 TEST_CASE (Profiler_AllocationSampleTest)
 
static LibraryPtr LoadTestScript (const char *script)
 
static void Invoke (const Library &lib, const char *name, intptr_t argc=0, Dart_Handle *argv=nullptr)
 
static void EnableProfiler ()
 
 ISOLATE_UNIT_TEST_CASE (Profiler_TrivialRecordAllocation)
 
 ISOLATE_UNIT_TEST_CASE (Profiler_NullSampleBuffer)
 
 ISOLATE_UNIT_TEST_CASE (Profiler_ToggleRecordAllocation)
 
 ISOLATE_UNIT_TEST_CASE (Profiler_CodeTicks)
 
 ISOLATE_UNIT_TEST_CASE (Profiler_FunctionTicks)
 
 ISOLATE_UNIT_TEST_CASE (Profiler_IntrinsicAllocation)
 
 ISOLATE_UNIT_TEST_CASE (Profiler_ArrayAllocation)
 
 ISOLATE_UNIT_TEST_CASE (Profiler_ContextAllocation)
 
 ISOLATE_UNIT_TEST_CASE (Profiler_ClosureAllocation)
 
 ISOLATE_UNIT_TEST_CASE (Profiler_TypedArrayAllocation)
 
 ISOLATE_UNIT_TEST_CASE (Profiler_StringAllocation)
 
 ISOLATE_UNIT_TEST_CASE (Profiler_StringInterpolation)
 
 ISOLATE_UNIT_TEST_CASE (Profiler_FunctionInline)
 
 ISOLATE_UNIT_TEST_CASE (Profiler_InliningIntervalBoundary)
 
 ISOLATE_UNIT_TEST_CASE (Profiler_ChainedSamples)
 
 ISOLATE_UNIT_TEST_CASE (Profiler_BasicSourcePosition)
 
 ISOLATE_UNIT_TEST_CASE (Profiler_BasicSourcePositionOptimized)
 
 ISOLATE_UNIT_TEST_CASE (Profiler_SourcePosition)
 
 ISOLATE_UNIT_TEST_CASE (Profiler_SourcePositionOptimized)
 
 ISOLATE_UNIT_TEST_CASE (Profiler_BinaryOperatorSourcePosition)
 
 ISOLATE_UNIT_TEST_CASE (Profiler_BinaryOperatorSourcePositionOptimized)
 
static void InsertFakeSample (uword *pc_offsets)
 
static uword FindPCForTokenPosition (const Code &code, TokenPosition tp)
 
 ISOLATE_UNIT_TEST_CASE (Profiler_GetSourceReport)
 
 ISOLATE_UNIT_TEST_CASE (Profiler_ProfileCodeTableTest)
 
 ISOLATE_UNIT_TEST_CASE (Profiler_EnterExitIsolate)
 
 DECLARE_FLAG (charp, trace_precompiler_to)
 
 DECLARE_FLAG (charp, write_v8_snapshot_profile_to)
 
 DEFINE_FLAG (uint64_t, random_seed, 0, "Override the random seed for debugging.")
 
 DECLARE_FLAG (uint64_t, random_seed)
 
 VARIABLE_COMPRESSED_VISITOR (WeakArray, Smi::Value(raw_obj->untag() ->length())) VARIABLE_COMPRESSED_VISITOR(TypeArguments
 
raw_obj untag () -> num_entries()) VARIABLE_COMPRESSED_VISITOR(Array, Smi::Value(raw_obj->untag() ->length())) VARIABLE_COMPRESSED_VISITOR(TypedData, TypedData::ElementSizeInBytes(raw_obj->GetClassId()) *Smi::Value(raw_obj->untag() ->length())) VARIABLE_COMPRESSED_VISITOR(Record, RecordShape(raw_obj->untag() ->shape()).num_fields()) VARIABLE_NULL_VISITOR(CompressedStackMaps, CompressedStackMaps::PayloadSizeOf(raw_obj)) VARIABLE_NULL_VISITOR(OneByteString, Smi::Value(raw_obj->untag() ->length())) VARIABLE_NULL_VISITOR(TwoByteString, Smi::Value(raw_obj->untag() ->length())) intptr_t UntaggedField::VisitFieldPointers(FieldPtr raw_obj, ObjectPointerVisitor *visitor)
 
 DEFINE_LEAF_RUNTIME_ENTRY (void, RememberCard, 2, uword object_in, ObjectPtr *slot)
 
 COMPILE_ASSERT (sizeof(UntaggedMint)==16)
 
 COMPILE_ASSERT (sizeof(UntaggedDouble)==16)
 
 COMPILE_ASSERT (sizeof(UntaggedFloat32x4)==24)
 
 COMPILE_ASSERT (sizeof(UntaggedInt32x4)==24)
 
 COMPILE_ASSERT (sizeof(UntaggedFloat64x2)==24)
 
ContainedInLattice AddRange (ContainedInLattice containment, const int32_t *ranges, intptr_t ranges_length, Interval new_range)
 
static RegExpEngine::CompilationResult IrregexpRegExpTooBig ()
 
static intptr_t GetCaseIndependentLetters (uint16_t character, bool one_byte_subject, int32_t *letters)
 
static bool EmitSimpleCharacter (Zone *zone, RegExpCompiler *compiler, uint16_t c, BlockLabel *on_failure, intptr_t cp_offset, bool check, bool preloaded)
 
static bool EmitAtomNonLetter (Zone *zone, RegExpCompiler *compiler, uint16_t c, BlockLabel *on_failure, intptr_t cp_offset, bool check, bool preloaded)
 
static bool ShortCutEmitCharacterPair (RegExpMacroAssembler *macro_assembler, bool one_byte, uint16_t c1, uint16_t c2, BlockLabel *on_failure)
 
static bool EmitAtomLetter (Zone *zone, RegExpCompiler *compiler, uint16_t c, BlockLabel *on_failure, intptr_t cp_offset, bool check, bool preloaded)
 
static void EmitBoundaryTest (RegExpMacroAssembler *masm, uint16_t border, BlockLabel *fall_through, BlockLabel *above_or_equal, BlockLabel *below)
 
static void EmitDoubleBoundaryTest (RegExpMacroAssembler *masm, uint16_t first, uint16_t last, BlockLabel *fall_through, BlockLabel *in_range, BlockLabel *out_of_range)
 
static void EmitUseLookupTable (RegExpMacroAssembler *masm, ZoneGrowableArray< uint16_t > *ranges, intptr_t start_index, intptr_t end_index, uint16_t min_char, BlockLabel *fall_through, BlockLabel *even_label, BlockLabel *odd_label)
 
static void CutOutRange (RegExpMacroAssembler *masm, ZoneGrowableArray< uint16_t > *ranges, intptr_t start_index, intptr_t end_index, intptr_t cut_index, BlockLabel *even_label, BlockLabel *odd_label)
 
static void SplitSearchSpace (ZoneGrowableArray< uint16_t > *ranges, intptr_t start_index, intptr_t end_index, intptr_t *new_start_index, intptr_t *new_end_index, uint16_t *border)
 
static void GenerateBranches (RegExpMacroAssembler *masm, ZoneGrowableArray< uint16_t > *ranges, intptr_t start_index, intptr_t end_index, uint16_t min_char, uint16_t max_char, BlockLabel *fall_through, BlockLabel *even_label, BlockLabel *odd_label)
 
static void EmitCharClass (RegExpMacroAssembler *macro_assembler, RegExpCharacterClass *cc, bool one_byte, BlockLabel *on_failure, intptr_t cp_offset, bool check_offset, bool preloaded, Zone *zone)
 
static uint32_t SmearBitsRight (uint32_t v)
 
static bool RangeContainsLatin1Equivalents (CharacterRange range)
 
static bool RangesContainLatin1Equivalents (ZoneGrowableArray< CharacterRange > *ranges)
 
static uint16_t ConvertNonLatin1ToLatin1 (uint16_t c)
 
static void EmitWordCheck (RegExpMacroAssembler *assembler, BlockLabel *word, BlockLabel *non_word, bool fall_through_on_word)
 
static void EmitHat (RegExpCompiler *compiler, RegExpNode *on_success, Trace *trace)
 
static bool DeterminedAlready (QuickCheckDetails *quick_check, intptr_t offset)
 
static void UpdateBoundsCheck (intptr_t index, intptr_t *checked_up_to)
 
static bool CompareInverseRanges (ZoneGrowableArray< CharacterRange > *ranges, const int32_t *special_class, intptr_t length)
 
static bool CompareRanges (ZoneGrowableArray< CharacterRange > *ranges, const int32_t *special_class, intptr_t length)
 
void AddBmpCharacters (RegExpCompiler *compiler, ChoiceNode *result, RegExpNode *on_success, UnicodeRangeSplitter *splitter)
 
void AddNonBmpSurrogatePairs (RegExpCompiler *compiler, ChoiceNode *result, RegExpNode *on_success, UnicodeRangeSplitter *splitter)
 
RegExpNodeNegativeLookaroundAgainstReadDirectionAndMatch (RegExpCompiler *compiler, ZoneGrowableArray< CharacterRange > *lookbehind, ZoneGrowableArray< CharacterRange > *match, RegExpNode *on_success, bool read_backward, RegExpFlags flags)
 
RegExpNodeMatchAndNegativeLookaroundInReadDirection (RegExpCompiler *compiler, ZoneGrowableArray< CharacterRange > *match, ZoneGrowableArray< CharacterRange > *lookahead, RegExpNode *on_success, bool read_backward, RegExpFlags flags)
 
void AddLoneLeadSurrogates (RegExpCompiler *compiler, ChoiceNode *result, RegExpNode *on_success, UnicodeRangeSplitter *splitter)
 
void AddLoneTrailSurrogates (RegExpCompiler *compiler, ChoiceNode *result, RegExpNode *on_success, UnicodeRangeSplitter *splitter)
 
RegExpNodeUnanchoredAdvance (RegExpCompiler *compiler, RegExpNode *on_success)
 
void AddUnicodeCaseEquivalents (ZoneGrowableArray< CharacterRange > *ranges)
 
static void AddClass (const int32_t *elmv, intptr_t elmc, ZoneGrowableArray< CharacterRange > *ranges)
 
static void AddClassNegated (const int32_t *elmv, intptr_t elmc, ZoneGrowableArray< CharacterRange > *ranges)
 
static void MoveRanges (ZoneGrowableArray< CharacterRange > *list, intptr_t from, intptr_t to, intptr_t count)
 
static intptr_t InsertRangeInCanonicalList (ZoneGrowableArray< CharacterRange > *list, intptr_t count, CharacterRange insert)
 
static bool ArrayContains (ZoneGrowableArray< unsigned > *array, unsigned value)
 
 COMPILE_ASSERT (BoyerMoorePositionInfo::kMapSize==RegExpMacroAssembler::kTableSize)
 
RegExpNodeOptionallyStepBackToLeadSurrogate (RegExpCompiler *compiler, RegExpNode *on_success, RegExpFlags flags)
 
void CreateSpecializedFunction (Thread *thread, Zone *zone, const RegExp &regexp, intptr_t specialization_cid, bool sticky, const Object &owner)
 
ContainedInLattice Combine (ContainedInLattice a, ContainedInLattice b)
 
ContainedInLattice AddRange (ContainedInLattice a, const intptr_t *ranges, intptr_t ranges_size, Interval new_range)
 
void PrintUtf16 (uint16_t c)
 
uword CaseInsensitiveCompareUCS2 (uword str_raw, uword lhs_index_raw, uword rhs_index_raw, uword length_raw)
 
uword CaseInsensitiveCompareUTF16 (uword str_raw, uword lhs_index_raw, uword rhs_index_raw, uword length_raw)
 
 DEFINE_RAW_LEAF_RUNTIME_ENTRY (CaseInsensitiveCompareUCS2, 4, false, CaseInsensitiveCompareUCS2)
 
 DEFINE_RAW_LEAF_RUNTIME_ENTRY (CaseInsensitiveCompareUTF16, 4, false, CaseInsensitiveCompareUTF16)
 
static intptr_t Prepare (const RegExp &regexp, const String &subject, bool sticky, Zone *zone)
 
static ObjectPtr ExecRaw (const RegExp &regexp, const String &subject, int32_t index, bool sticky, int32_t *output, intptr_t output_size, Zone *zone)
 
static Interval ListCaptureRegisters (ZoneGrowableArray< RegExpTree * > *children)
 
static intptr_t IncreaseBy (intptr_t previous, intptr_t increase)
 
 DEFINE_FLAG (bool, trace_regexp_bytecodes, false, "trace_regexp_bytecodes")
 
 DEFINE_FLAG (int, regexp_backtrack_stack_size_kb, 256, "Size of backtracking stack")
 
template<typename Char >
static bool BackRefMatchesNoCase (Canonicalize *interp_canonicalize, intptr_t from, intptr_t current, intptr_t len, const String &subject, bool unicode)
 
template<>
bool BackRefMatchesNoCase< uint16_t > (Canonicalize *interp_canonicalize, intptr_t from, intptr_t current, intptr_t len, const String &subject, bool unicode)
 
template<>
bool BackRefMatchesNoCase< uint8_t > (Canonicalize *interp_canonicalize, intptr_t from, intptr_t current, intptr_t len, const String &subject, bool unicode)
 
static int32_t Load32Aligned (const uint8_t *pc)
 
static int32_t Load16Aligned (const uint8_t *pc)
 
template<typename Char >
static ObjectPtr RawMatch (const TypedData &bytecode, const String &subject, int32_t *registers, int32_t current, uint32_t current_char)
 
static void PushCodeUnit (RegExpCaptureName *v, uint32_t code_unit)
 
static intptr_t HexValue (uint32_t c)
 
static ArrayPtr Match (const String &pat, const String &str)
 
 ISOLATE_UNIT_TEST_CASE (RegExp_OneByteString)
 
 ISOLATE_UNIT_TEST_CASE (RegExp_TwoByteString)
 
 DEFINE_FLAG (bool, silent_warnings, false, "Silence warnings.")
 
 DEFINE_FLAG (bool, warning_as_error, false, "Treat warnings as errors.")
 
 DEFINE_FLAG (bool, trace_resolving, false, "Trace resolving.")
 
static FunctionPtr ResolveDynamicAnyArgsWithCustomLookup (Zone *zone, const Class &receiver_class, const String &function_name, bool allow_add, std::function< FunctionPtr(Class &, const String &)> lookup)
 
static FunctionPtr ResolveDynamicForReceiverClassWithCustomLookup (const Class &receiver_class, const String &function_name, const ArgumentsDescriptor &args_desc, bool allow_add, std::function< FunctionPtr(Class &, const String &)> lookup)
 
 TEST_CASE (RingBuffer)
 
 DEFINE_FLAG (int, max_subtype_cache_entries, kDefaultMaxSubtypeCacheEntries, "Maximum number of subtype cache entries (number of checks cached).")
 
 DEFINE_FLAG (int, regexp_optimization_counter_threshold, 1000, "RegExp's usage-counter value before it is optimized, -1 means never")
 
 DEFINE_FLAG (int, reoptimization_counter_threshold, 4000, "Counter threshold before a function gets reoptimized.")
 
 DEFINE_FLAG (bool, runtime_allocate_old, false, "Use old-space for allocation via runtime calls.")
 
 DEFINE_FLAG (bool, runtime_allocate_spill_tlab, false, "Ensure results of allocation via runtime calls are not in an " "active TLAB.")
 
 DEFINE_FLAG (bool, trace_deoptimization, false, "Trace deoptimization")
 
 DEFINE_FLAG (bool, trace_deoptimization_verbose, false, "Trace deoptimization verbose")
 
 DEFINE_FLAG (bool, trace_osr, false, "Trace attempts at on-stack replacement.")
 
 DEFINE_FLAG (int, gc_every, 0, "Run major GC on every N stack overflow checks")
 
 DEFINE_FLAG (int, stacktrace_every, 0, "Compute debugger stacktrace on every N stack overflow checks")
 
 DEFINE_FLAG (charp, stacktrace_filter, nullptr, "Compute stacktrace in named function on stack overflow checks")
 
 DEFINE_FLAG (charp, deoptimize_filter, nullptr, "Deoptimize in named function on stack overflow checks")
 
 DEFINE_FLAG (charp, deoptimize_on_runtime_call_name_filter, nullptr, "Runtime call name filter for --deoptimize-on-runtime-call-every.")
 
 DEFINE_FLAG (bool, unopt_monomorphic_calls, true, "Enable specializing monomorphic calls from unoptimized code.")
 
 DEFINE_FLAG (bool, unopt_megamorphic_calls, true, "Enable specializing megamorphic calls from unoptimized code.")
 
 DEFINE_FLAG (bool, verbose_stack_overflow, false, "Print additional details about stack overflow.")
 
 DECLARE_FLAG (bool, reload_every_optimized)
 
 DEFINE_RUNTIME_ENTRY (RangeError, 2)
 
 DEFINE_RUNTIME_ENTRY (RangeErrorUnboxedInt64, 0)
 
 DEFINE_RUNTIME_ENTRY (WriteError, 2)
 
static void NullErrorHelper (Zone *zone, const String &selector, bool is_param_name=false)
 
static void DoThrowNullError (Isolate *isolate, Thread *thread, Zone *zone, bool is_param)
 
 DEFINE_RUNTIME_ENTRY (NullError, 0)
 
void ReportImpossibleNullError (intptr_t cid, StackFrame *caller_frame, Thread *thread)
 
 DEFINE_RUNTIME_ENTRY (DispatchTableNullError, 1)
 
 DEFINE_RUNTIME_ENTRY (NullErrorWithSelector, 1)
 
 DEFINE_RUNTIME_ENTRY (NullCastError, 0)
 
 DEFINE_RUNTIME_ENTRY (ArgumentNullError, 0)
 
 DEFINE_RUNTIME_ENTRY (ArgumentError, 1)
 
 DEFINE_RUNTIME_ENTRY (ArgumentErrorUnboxedInt64, 0)
 
 DEFINE_RUNTIME_ENTRY (DoubleToInteger, 1)
 
 DEFINE_RUNTIME_ENTRY (IntegerDivisionByZeroException, 0)
 
static Heap::Space SpaceForRuntimeAllocation ()
 
static void RuntimeAllocationEpilogue (Thread *thread)
 
 DEFINE_RUNTIME_ENTRY (AllocateArray, 2)
 
 DEFINE_RUNTIME_ENTRY_NO_LAZY_DEOPT (AllocateDouble, 0)
 
 DEFINE_RUNTIME_ENTRY_NO_LAZY_DEOPT (BoxDouble, 0)
 
 DEFINE_RUNTIME_ENTRY_NO_LAZY_DEOPT (BoxFloat32x4, 0)
 
 DEFINE_RUNTIME_ENTRY_NO_LAZY_DEOPT (BoxFloat64x2, 0)
 
 DEFINE_RUNTIME_ENTRY_NO_LAZY_DEOPT (AllocateMint, 0)
 
 DEFINE_RUNTIME_ENTRY_NO_LAZY_DEOPT (AllocateFloat32x4, 0)
 
 DEFINE_RUNTIME_ENTRY_NO_LAZY_DEOPT (AllocateFloat64x2, 0)
 
 DEFINE_RUNTIME_ENTRY_NO_LAZY_DEOPT (AllocateInt32x4, 0)
 
 DEFINE_RUNTIME_ENTRY (AllocateTypedData, 2)
 
static TokenPosition GetCallerLocation ()
 
static void ThrowIfError (const Object &result)
 
 DEFINE_RUNTIME_ENTRY (AllocateObject, 2)
 
 DEFINE_LEAF_RUNTIME_ENTRY (uword, EnsureRememberedAndMarkingDeferred, 2, uword object_in, Thread *thread)
 
END_LEAF_RUNTIME_ENTRY DEFINE_RUNTIME_ENTRY (InstantiateType, 3)
 
 DEFINE_RUNTIME_ENTRY (InstantiateTypeArguments, 3)
 
static void PrintSubtypeCheck (const AbstractType &subtype, const AbstractType &supertype, const bool result)
 
 DEFINE_RUNTIME_ENTRY (SubtypeCheck, 5)
 
 DEFINE_RUNTIME_ENTRY (AllocateClosure, 4)
 
 DEFINE_RUNTIME_ENTRY (AllocateContext, 1)
 
 DEFINE_RUNTIME_ENTRY (CloneContext, 1)
 
 DEFINE_RUNTIME_ENTRY (AllocateRecord, 1)
 
 DEFINE_RUNTIME_ENTRY (AllocateSmallRecord, 4)
 
 DEFINE_RUNTIME_ENTRY (AllocateSuspendState, 2)
 
 DEFINE_RUNTIME_ENTRY (CloneSuspendState, 1)
 
static void PrintTypeCheck (const char *message, const Instance &instance, const AbstractType &type, const TypeArguments &instantiator_type_arguments, const TypeArguments &function_type_arguments, const Bool &result)
 
static void UpdateTypeTestCache (Zone *zone, Thread *thread, const Instance &instance, const AbstractType &destination_type, const TypeArguments &instantiator_type_arguments, const TypeArguments &function_type_arguments, const Bool &result, const SubtypeTestCache &new_cache)
 
 DEFINE_RUNTIME_ENTRY (Instanceof, 5)
 
 DEFINE_RUNTIME_ENTRY (TypeCheck, 7)
 
 DEFINE_RUNTIME_ENTRY (NonBoolTypeError, 1)
 
 DEFINE_RUNTIME_ENTRY (Throw, 1)
 
 DEFINE_RUNTIME_ENTRY (ReThrow, 3)
 
 DEFINE_RUNTIME_ENTRY (PatchStaticCall, 0)
 
 DEFINE_RUNTIME_ENTRY (BreakpointRuntimeHandler, 0)
 
 DEFINE_RUNTIME_ENTRY (SingleStepHandler, 0)
 
static bool ResolveCallThroughGetter (const Class &receiver_class, const String &target_name, const String &demangled, const Array &arguments_descriptor, Function *result)
 
FunctionPtr InlineCacheMissHelper (const Class &receiver_class, const Array &args_descriptor, const String &target_name)
 
static void TrySwitchInstanceCall (Thread *thread, StackFrame *caller_frame, const Code &caller_code, const Function &caller_function, const ICData &ic_data, const Function &target_function)
 
static FunctionPtr ComputeTypeCheckTarget (const Instance &receiver, const AbstractType &type, const ArgumentsDescriptor &desc)
 
static FunctionPtr Resolve (Thread *thread, Zone *zone, const GrowableArray< const Instance * > &caller_arguments, const Class &receiver_class, const String &name, const Array &descriptor)
 
 DEFINE_RUNTIME_ENTRY (StaticCallMissHandlerOneArg, 2)
 
 DEFINE_RUNTIME_ENTRY (StaticCallMissHandlerTwoArgs, 3)
 
static void InlineCacheMissHandler (Thread *thread, Zone *zone, const GrowableArray< const Instance * > &args, const ICData &ic_data, NativeArguments native_arguments)
 
 DEFINE_RUNTIME_ENTRY (InlineCacheMissHandlerOneArg, 2)
 
 DEFINE_RUNTIME_ENTRY (InlineCacheMissHandlerTwoArgs, 3)
 
 DEFINE_RUNTIME_ENTRY (SwitchableCallMiss, 2)
 
static ObjectPtr InvokeCallThroughGetterOrNoSuchMethod (Thread *thread, Zone *zone, const Instance &receiver, const String &target_name, const Array &orig_arguments, const Array &orig_arguments_desc)
 
 DEFINE_RUNTIME_ENTRY (NoSuchMethodFromCallStub, 4)
 
 DEFINE_RUNTIME_ENTRY (NoSuchMethodFromPrologue, 4)
 
static void HandleStackOverflowTestCases (Thread *thread)
 
static void HandleOSRRequest (Thread *thread)
 
 DEFINE_RUNTIME_ENTRY (InterruptOrStackOverflow, 0)
 
 DEFINE_RUNTIME_ENTRY (TraceICCall, 2)
 
 DEFINE_RUNTIME_ENTRY (OptimizeInvokedFunction, 1)
 
 DEFINE_RUNTIME_ENTRY (FixCallersTarget, 0)
 
 DEFINE_RUNTIME_ENTRY (FixCallersTargetMonomorphic, 2)
 
 DEFINE_RUNTIME_ENTRY (FixAllocationStubTarget, 0)
 
const char * DeoptReasonToCString (ICData::DeoptReasonId deopt_reason)
 
static bool IsSuspendedFrame (Zone *zone, const Function &function, StackFrame *frame)
 
void DeoptimizeAt (Thread *mutator_thread, const Code &optimized_code, StackFrame *frame)
 
void DeoptimizeFunctionsOnStack ()
 
static void DeoptimizeLastDartFrameIfOptimized ()
 
static void CopySavedRegisters (uword saved_registers_address, fpu_register_t **fpu_registers, intptr_t **cpu_registers)
 
 DEFINE_LEAF_RUNTIME_ENTRY (bool, TryDoubleAsInteger, 1, Thread *thread)
 
END_LEAF_RUNTIME_ENTRY DEFINE_LEAF_RUNTIME_ENTRY (intptr_t, DeoptimizeCopyFrame, 2, uword saved_registers_address, uword is_lazy_deopt)
 
END_LEAF_RUNTIME_ENTRY DEFINE_LEAF_RUNTIME_ENTRY (void, DeoptimizeFillFrame, 1, uword last_fp)
 
END_LEAF_RUNTIME_ENTRY DEFINE_RUNTIME_ENTRY (DeoptimizeMaterialize, 0)
 
 DEFINE_RUNTIME_ENTRY (RewindPostDeopt, 0)
 
 DEFINE_RUNTIME_ENTRY (ResumeFrame, 2)
 
void OnEveryRuntimeEntryCall (Thread *thread, const char *runtime_call_name, bool can_lazy_deopt)
 
double DartModulo (double left, double right)
 
 DEFINE_RUNTIME_ENTRY (UpdateFieldCid, 2)
 
 DEFINE_RUNTIME_ENTRY (InitInstanceField, 2)
 
 DEFINE_RUNTIME_ENTRY (InitStaticField, 1)
 
 DEFINE_RUNTIME_ENTRY (LateFieldAssignedDuringInitializationError, 1)
 
 DEFINE_RUNTIME_ENTRY (LateFieldNotInitializedError, 1)
 
 DEFINE_RUNTIME_ENTRY (NotLoaded, 0)
 
 DEFINE_RUNTIME_ENTRY (FfiAsyncCallbackSend, 1)
 
 DEFINE_RAW_LEAF_RUNTIME_ENTRY (LibcPow, 2, true, static_cast< BinaryMathCFunction >(pow))
 
 DEFINE_RAW_LEAF_RUNTIME_ENTRY (DartModulo, 2, true, static_cast< BinaryMathCFunction >(DartModulo))
 
 DEFINE_RAW_LEAF_RUNTIME_ENTRY (LibcAtan2, 2, true, static_cast< BinaryMathCFunction >(atan2_ieee))
 
 DEFINE_RAW_LEAF_RUNTIME_ENTRY (LibcFloor, 1, true, static_cast< UnaryMathCFunction >(floor))
 
 DEFINE_RAW_LEAF_RUNTIME_ENTRY (LibcCeil, 1, true, static_cast< UnaryMathCFunction >(ceil))
 
 DEFINE_RAW_LEAF_RUNTIME_ENTRY (LibcTrunc, 1, true, static_cast< UnaryMathCFunction >(trunc))
 
 DEFINE_RAW_LEAF_RUNTIME_ENTRY (LibcRound, 1, true, static_cast< UnaryMathCFunction >(round))
 
 DEFINE_RAW_LEAF_RUNTIME_ENTRY (LibcCos, 1, true, static_cast< UnaryMathCFunction >(cos))
 
 DEFINE_RAW_LEAF_RUNTIME_ENTRY (LibcSin, 1, true, static_cast< UnaryMathCFunction >(sin))
 
 DEFINE_RAW_LEAF_RUNTIME_ENTRY (LibcAsin, 1, true, static_cast< UnaryMathCFunction >(asin))
 
 DEFINE_RAW_LEAF_RUNTIME_ENTRY (LibcAcos, 1, true, static_cast< UnaryMathCFunction >(acos))
 
 DEFINE_RAW_LEAF_RUNTIME_ENTRY (LibcTan, 1, true, static_cast< UnaryMathCFunction >(tan))
 
 DEFINE_RAW_LEAF_RUNTIME_ENTRY (LibcAtan, 1, true, static_cast< UnaryMathCFunction >(atan))
 
 DEFINE_RAW_LEAF_RUNTIME_ENTRY (LibcExp, 1, true, static_cast< UnaryMathCFunction >(exp))
 
 DEFINE_RAW_LEAF_RUNTIME_ENTRY (LibcLog, 1, true, static_cast< UnaryMathCFunction >(log))
 
 DEFINE_RAW_LEAF_RUNTIME_ENTRY (MemoryMove, 3, false, static_cast< MemMoveCFunction >(memmove))
 
void DFLRT_EnterSafepoint (NativeArguments __unusable_)
 
 DEFINE_RAW_LEAF_RUNTIME_ENTRY (EnterSafepoint, 0, false, DFLRT_EnterSafepoint)
 
 DEFINE_RAW_LEAF_RUNTIME_ENTRY (ExitSafepoint, 0, false, DFLRT_ExitSafepoint)
 
void DFLRT_ExitSafepointIgnoreUnwindInProgress (NativeArguments __unusable_)
 
 DEFINE_RAW_LEAF_RUNTIME_ENTRY (ExitSafepointIgnoreUnwindInProgress, 0, false, DFLRT_ExitSafepointIgnoreUnwindInProgress)
 
ThreadDLRT_GetFfiCallbackMetadata (FfiCallbackMetadata::Trampoline trampoline, uword *out_entry_point, uword *out_trampoline_type)
 
void DLRT_ExitTemporaryIsolate ()
 
ApiLocalScopeDLRT_EnterHandleScope (Thread *thread)
 
 DEFINE_RAW_LEAF_RUNTIME_ENTRY (EnterHandleScope, 1, false, DLRT_EnterHandleScope)
 
void DLRT_ExitHandleScope (Thread *thread)
 
 DEFINE_RAW_LEAF_RUNTIME_ENTRY (ExitHandleScope, 1, false, DLRT_ExitHandleScope)
 
LocalHandleDLRT_AllocateHandle (ApiLocalScope *scope)
 
 DEFINE_RAW_LEAF_RUNTIME_ENTRY (AllocateHandle, 1, false, DLRT_AllocateHandle)
 
void DLRT_PropagateError (Dart_Handle handle)
 
 DEFINE_RAW_LEAF_RUNTIME_ENTRY (PropagateError, 1, false, DLRT_PropagateError)
 
void __msan_unpoison (const volatile void *, size_t)
 
void __msan_unpoison_param (size_t)
 
void __tsan_acquire (void *addr)
 
void __tsan_release (void *addr)
 
 DEFINE_RAW_LEAF_RUNTIME_ENTRY (MsanUnpoison, 2, false, __msan_unpoison)
 
 DEFINE_RAW_LEAF_RUNTIME_ENTRY (MsanUnpoisonParam, 1, false, __msan_unpoison_param)
 
 DEFINE_RAW_LEAF_RUNTIME_ENTRY (TsanLoadAcquire, 1, false, __tsan_acquire)
 
 DEFINE_RAW_LEAF_RUNTIME_ENTRY (TsanStoreRelease, 1, false, __tsan_release)
 
 DEFINE_FLAG (bool, share_enclosing_context, true, "Allocate captured variables in the existing context of an " "enclosing scope (up to innermost loop) and spare the allocation " "of a local context.")
 
 ISOLATE_UNIT_TEST_CASE (LocalScope)
 
 DEFINE_FLAG (charp, vm_name, "vm", "The default name of this vm as reported by the VM service " "protocol")
 
 DEFINE_FLAG (bool, warn_on_pause_with_no_debugger, false, "Print a message when an isolate is paused but there is no " "debugger attached.")
 
 DEFINE_FLAG (charp, log_service_response_sizes, nullptr, "Log sizes of service responses and events to a file in CSV format.")
 
static void PrintInvalidParamError (JSONStream *js, const char *param)
 
static const char * GetVMName ()
 
const ServiceMethodDescriptorFindMethod (const char *method_name)
 
static void PrintSuccess (JSONStream *js)
 
static bool CheckDebuggerDisabled (Thread *thread, JSONStream *js)
 
static bool CheckProfilerDisabled (Thread *thread, JSONStream *js)
 
static bool GetIntegerId (const char *s, intptr_t *id, int base=10)
 
static bool GetUnsignedIntegerId (const char *s, uintptr_t *id, int base=10)
 
static bool GetInteger64Id (const char *s, int64_t *id, int base=10)
 
static const char * ScanUntilDash (const char *s)
 
static bool GetCodeId (const char *s, int64_t *timestamp, uword *address)
 
static bool GetPrefixedIntegerId (const char *s, const char *prefix, intptr_t *service_id)
 
static bool IsValidClassId (Isolate *isolate, intptr_t cid)
 
static ClassPtr GetClassForId (Isolate *isolate, intptr_t cid)
 
template<typename T >
T EnumMapper (const char *value, const char *const *enums, T *values)
 
static void PrintMissingParamError (JSONStream *js, const char *param)
 
static void PrintUnrecognizedMethodError (JSONStream *js)
 
static bool ValidateParameters (const MethodParameter *const *parameters, JSONStream *js)
 
static void Finalizer (void *isolate_callback_data, void *buffer)
 
static void ReportPauseOnConsole (ServiceEvent *event)
 
static void GetIsolate (Thread *thread, JSONStream *js)
 
static void PrintSentinel (JSONStream *js, SentinelType sentinel_type)
 
static void SetStreamIncludePrivateMembers (Thread *thread, JSONStream *js)
 
static void ActOnIsolateGroup (JSONStream *js, std::function< void(IsolateGroup *)> visitor)
 
static void GetIsolateGroup (Thread *thread, JSONStream *js)
 
static void GetMemoryUsage (Thread *thread, JSONStream *js)
 
static void GetIsolateGroupMemoryUsage (Thread *thread, JSONStream *js)
 
static void GetIsolatePauseEvent (Thread *thread, JSONStream *js)
 
static void GetScripts (Thread *thread, JSONStream *js)
 
static void GetStack (Thread *thread, JSONStream *js)
 
static void HandleCommonEcho (JSONObject *jsobj, JSONStream *js)
 
static void TriggerEchoEvent (Thread *thread, JSONStream *js)
 
static void Echo (Thread *thread, JSONStream *js)
 
static bool ContainsNonInstance (const Object &obj)
 
static ObjectPtr LookupObjectId (Thread *thread, const char *arg, ObjectIdRing::LookupResult *kind)
 
static ObjectPtr LookupClassMembers (Thread *thread, const Class &klass, char **parts, int num_parts)
 
static ObjectPtr LookupHeapObjectLibraries (IsolateGroup *isolate_group, char **parts, int num_parts)
 
static ObjectPtr LookupHeapObjectClasses (Thread *thread, char **parts, int num_parts)
 
static ObjectPtr LookupHeapObjectTypeArguments (Thread *thread, char **parts, int num_parts)
 
static ObjectPtr LookupHeapObjectCode (char **parts, int num_parts)
 
static ObjectPtr LookupHeapObjectMessage (Thread *thread, char **parts, int num_parts)
 
static ObjectPtr LookupHeapObject (Thread *thread, const char *id_original, ObjectIdRing::LookupResult *result)
 
static BreakpointLookupBreakpoint (Isolate *isolate, const char *id, ObjectIdRing::LookupResult *result)
 
static void AddParentFieldToResponseBasedOnRecord (Thread *thread, Array *field_names_handle, String *name_handle, const JSONObject &jsresponse, const Record &record, const intptr_t field_slot_offset)
 
static void PrintInboundReferences (Thread *thread, Object *target, intptr_t limit, JSONStream *js)
 
static void GetInboundReferences (Thread *thread, JSONStream *js)
 
static void PrintRetainingPath (Thread *thread, Object *obj, intptr_t limit, JSONStream *js)
 
static void GetRetainingPath (Thread *thread, JSONStream *js)
 
static void GetRetainedSize (Thread *thread, JSONStream *js)
 
static void GetReachableSize (Thread *thread, JSONStream *js)
 
static void Invoke (Thread *thread, JSONStream *js)
 
static bool IsAlpha (char c)
 
static bool IsAlphaOrDollar (char c)
 
static bool IsAlphaNum (char c)
 
static bool IsAlphaNumOrDollar (char c)
 
static bool IsWhitespace (char c)
 
static bool IsObjectIdChar (char c)
 
static bool ParseScope (const char *scope, GrowableArray< const char * > *names, GrowableArray< const char * > *ids)
 
static bool BuildScope (Thread *thread, JSONStream *js, const GrowableObjectArray &names, const GrowableObjectArray &values)
 
static void Evaluate (Thread *thread, JSONStream *js)
 
static void CollectStringifiedType (Thread *thread, Zone *zone, const AbstractType &type, const GrowableObjectArray &output)
 
static void BuildExpressionEvaluationScope (Thread *thread, JSONStream *js)
 
static bool ParseCSVList (const char *csv_list, const GrowableObjectArray &values)
 
static void CompileExpression (Thread *thread, JSONStream *js)
 
ExternalTypedDataPtr DecodeKernelBuffer (const char *kernel_buffer_base64)
 
static void EvaluateCompiledExpression (Thread *thread, JSONStream *js)
 
static void EvaluateInFrame (Thread *thread, JSONStream *js)
 
static void MarkClasses (const Class &root, bool include_subclasses, bool include_implementors)
 
static void UnmarkClasses ()
 
static void GetInstances (Thread *thread, JSONStream *js)
 
static void GetInstancesAsList (Thread *thread, JSONStream *js)
 
template<typename Adder >
static intptr_t ParseJSONCollection (Thread *thread, const char *str, const Adder &add)
 
intptr_t ParseJSONArray (Thread *thread, const char *str, const GrowableObjectArray &elements)
 
static intptr_t ParseJSONSet (Thread *thread, const char *str, ZoneCStringSet *elements)
 
static void GetPorts (Thread *thread, JSONStream *js)
 
static void GetSourceReport (Thread *thread, JSONStream *js)
 
static void ReloadSources (Thread *thread, JSONStream *js)
 
static void AddBreakpointCommon (Thread *thread, JSONStream *js, const String &script_uri)
 
static void AddBreakpoint (Thread *thread, JSONStream *js)
 
static void AddBreakpointWithScriptUri (Thread *thread, JSONStream *js)
 
static void AddBreakpointAtEntry (Thread *thread, JSONStream *js)
 
static void AddBreakpointAtActivation (Thread *thread, JSONStream *js)
 
static void RemoveBreakpoint (Thread *thread, JSONStream *js)
 
static void HandleNativeMetricsList (Thread *thread, JSONStream *js)
 
static void HandleNativeMetric (Thread *thread, JSONStream *js, const char *id)
 
static void GetIsolateMetricList (Thread *thread, JSONStream *js)
 
static void GetIsolateMetric (Thread *thread, JSONStream *js)
 
static void GetCpuSamplesCommon (TimelineOrSamplesResponseFormat format, Thread *thread, JSONStream *js)
 
void GetVMTimelineCommon (TimelineOrSamplesResponseFormat format, Thread *thread, JSONStream *js)
 
static void SetVMTimelineFlags (Thread *thread, JSONStream *js)
 
static void GetVMTimelineFlags (Thread *thread, JSONStream *js)
 
static void GetVMTimelineMicros (Thread *thread, JSONStream *js)
 
static void ClearVMTimeline (Thread *thread, JSONStream *js)
 
static void GetVMTimeline (Thread *thread, JSONStream *js)
 
static void Resume (Thread *thread, JSONStream *js)
 
static void Kill (Thread *thread, JSONStream *js)
 
static void Pause (Thread *thread, JSONStream *js)
 
static void EnableProfiler (Thread *thread, JSONStream *js)
 
static void GetTagProfile (Thread *thread, JSONStream *js)
 
static void GetCpuSamples (Thread *thread, JSONStream *js)
 
static void GetAllocationTraces (Thread *thread, JSONStream *js)
 
static void ClearCpuSamples (Thread *thread, JSONStream *js)
 
static void GetAllocationProfileImpl (Thread *thread, JSONStream *js, bool internal)
 
static void GetAllocationProfilePublic (Thread *thread, JSONStream *js)
 
static void GetAllocationProfile (Thread *thread, JSONStream *js)
 
static void CollectAllGarbage (Thread *thread, JSONStream *js)
 
static void GetHeapMap (Thread *thread, JSONStream *js)
 
static void RequestHeapSnapshot (Thread *thread, JSONStream *js)
 
static intptr_t GetProcessMemoryUsageHelper (JSONStream *js)
 
static void GetProcessMemoryUsage (Thread *thread, JSONStream *js)
 
static void GetPersistentHandles (Thread *thread, JSONStream *js)
 
static void GetPortsPrivate (Thread *thread, JSONStream *js)
 
static void RespondWithMalformedJson (Thread *thread, JSONStream *js)
 
static void RespondWithMalformedObject (Thread *thread, JSONStream *js)
 
static bool GetHeapObjectCommon (Thread *thread, JSONStream *js, const char *id, Object *obj, ObjectIdRing::LookupResult *lookup_result)
 
static void GetObject (Thread *thread, JSONStream *js)
 
static void GetImplementationFields (Thread *thread, JSONStream *js)
 
static void GetObjectStore (Thread *thread, JSONStream *js)
 
static void GetIsolateObjectStore (Thread *thread, JSONStream *js)
 
static void GetClassList (Thread *thread, JSONStream *js)
 
static void GetTypeArgumentsList (Thread *thread, JSONStream *js)
 
static void GetVersion (Thread *thread, JSONStream *js)
 
static void GetVM (Thread *thread, JSONStream *js)
 
static void PopulateUriMappings (Thread *thread)
 
static void LookupScriptUrisImpl (Thread *thread, JSONStream *js, bool lookup_resolved)
 
static void LookupResolvedPackageUris (Thread *thread, JSONStream *js)
 
static void LookupPackageUris (Thread *thread, JSONStream *js)
 
static void SetExceptionPauseMode (Thread *thread, JSONStream *js)
 
static void SetIsolatePauseMode (Thread *thread, JSONStream *js)
 
static void SetBreakpointState (Thread *thread, JSONStream *js)
 
static void GetFlagList (Thread *thread, JSONStream *js)
 
static void SetFlag (Thread *thread, JSONStream *js)
 
static void SetLibraryDebuggable (Thread *thread, JSONStream *js)
 
static void SetName (Thread *thread, JSONStream *js)
 
static void SetVMName (Thread *thread, JSONStream *js)
 
static void SetTraceClassAllocation (Thread *thread, JSONStream *js)
 
static void GetDefaultClassesAliases (Thread *thread, JSONStream *js)
 
 DEFINE_FLAG (bool, trace_service, false, "Trace VM service requests.")
 
 DEFINE_FLAG (bool, trace_service_pause_events, false, "Trace VM service isolate pause events.")
 
 DEFINE_FLAG (bool, trace_service_verbose, false, "Provide extra service tracing information.")
 
static ArrayPtr MakeServerControlMessage (const SendPort &sp, intptr_t code, bool enable, const Bool &silenceOutput)
 
 DEFINE_FLAG (bool, service_testing_flag, false, "Comment")
 
static ArrayPtr Eval (Dart_Handle lib, const char *expr)
 
static ArrayPtr EvalF (Dart_Handle lib, const char *fmt,...)
 
static FunctionPtr GetFunction (const Class &cls, const char *name)
 
static void HandleIsolateMessage (Isolate *isolate, const Array &msg)
 
static void HandleRootMessage (const Array &message)
 
 ISOLATE_UNIT_TEST_CASE (Service_IsolateStickyError)
 
 ISOLATE_UNIT_TEST_CASE (Service_IdZones)
 
 ISOLATE_UNIT_TEST_CASE (Service_Code)
 
 ISOLATE_UNIT_TEST_CASE (Service_PcDescriptors)
 
 ISOLATE_UNIT_TEST_CASE (Service_LocalVarDescriptors)
 
static void WeakHandleFinalizer (void *isolate_callback_data, void *peer)
 
 ISOLATE_UNIT_TEST_CASE (Service_PersistentHandles)
 
static bool alpha_callback (const char *name, const char **option_keys, const char **option_values, intptr_t num_options, void *user_data, const char **result)
 
static bool beta_callback (const char *name, const char **option_keys, const char **option_values, intptr_t num_options, void *user_data, const char **result)
 
 ISOLATE_UNIT_TEST_CASE (Service_EmbedderRootHandler)
 
 ISOLATE_UNIT_TEST_CASE (Service_EmbedderIsolateHandler)
 
static void EnableProfiler ()
 
 ISOLATE_UNIT_TEST_CASE (Service_Profile)
 
 ISOLATE_UNIT_TEST_CASE (Service_ParseJSONArray)
 
static bool IsSnapshotCompatible (Snapshot::Kind vm_kind, Snapshot::Kind isolate_kind)
 
static bool Equals (const Object &expected, const Object &actual)
 
static void CompareDartCObjects (Dart_CObject *first, Dart_CObject *second)
 
static void CheckEncodeDecodeMessage (Zone *zone, Dart_CObject *root)
 
static void ExpectEncodeFail (Zone *zone, Dart_CObject *root)
 
 ISOLATE_UNIT_TEST_CASE (SerializeNull)
 
 ISOLATE_UNIT_TEST_CASE (SerializeSmi1)
 
 ISOLATE_UNIT_TEST_CASE (SerializeSmi2)
 
Dart_CObjectSerializeAndDeserializeMint (Zone *zone, const Mint &mint)
 
void CheckMint (int64_t value)
 
 ISOLATE_UNIT_TEST_CASE (SerializeMints)
 
 ISOLATE_UNIT_TEST_CASE (SerializeDouble)
 
 ISOLATE_UNIT_TEST_CASE (SerializeTrue)
 
 ISOLATE_UNIT_TEST_CASE (SerializeFalse)
 
 ISOLATE_UNIT_TEST_CASE (SerializeCapability)
 
 ISOLATE_UNIT_TEST_CASE (SerializeSingletons)
 
static void TestString (const char *cstr)
 
 ISOLATE_UNIT_TEST_CASE (SerializeString)
 
 ISOLATE_UNIT_TEST_CASE (SerializeArray)
 
 ISOLATE_UNIT_TEST_CASE (SerializeArrayWithTypeArgument)
 
 TEST_CASE (FailSerializeLargeArray)
 
 TEST_CASE (FailSerializeLargeNestedArray)
 
 TEST_CASE (FailSerializeLargeTypedDataInt8)
 
 TEST_CASE (FailSerializeLargeTypedDataUint8)
 
 TEST_CASE (FailSerializeLargeExternalTypedData)
 
 TEST_CASE (FailSerializeLargeUnmodifiableExternalTypedData)
 
 ISOLATE_UNIT_TEST_CASE (SerializeEmptyArray)
 
 ISOLATE_UNIT_TEST_CASE (SerializeByteArray)
 
 ISOLATE_UNIT_TEST_CASE (SerializeTypedArray)
 
 ISOLATE_UNIT_TEST_CASE (SerializeExternalTypedArray)
 
 ISOLATE_UNIT_TEST_CASE (SerializeUnmodifiableExternalTypedArray)
 
 ISOLATE_UNIT_TEST_CASE (SerializeEmptyByteArray)
 
 VM_UNIT_TEST_CASE (FullSnapshot)
 
static std::unique_ptr< MessageGetSerialized (Dart_Handle lib, const char *dart_function)
 
static void CheckString (Dart_Handle dart_string, const char *expected)
 
static void CheckStringInvalid (Dart_Handle dart_string)
 
 VM_UNIT_TEST_CASE (DartGeneratedMessages)
 
 VM_UNIT_TEST_CASE (DartGeneratedListMessages)
 
 VM_UNIT_TEST_CASE (DartGeneratedArrayLiteralMessages)
 
 VM_UNIT_TEST_CASE (DartGeneratedListMessagesWithBackref)
 
 VM_UNIT_TEST_CASE (DartGeneratedArrayLiteralMessagesWithBackref)
 
static void CheckTypedData (Dart_CObject *object, Dart_TypedData_Type typed_data_type, int len)
 
 VM_UNIT_TEST_CASE (DartGeneratedListMessagesWithTypedData)
 
static void MallocFinalizer (void *isolate_callback_data, void *peer)
 
static void NoopFinalizer (void *isolate_callback_data, void *peer)
 
 VM_UNIT_TEST_CASE (PostCObject)
 
 TEST_CASE (IsKernelNegative)
 
static ObjectPtr ExecuteScript (const char *script, bool allow_errors=false)
 
 ISOLATE_UNIT_TEST_CASE (SourceReport_Coverage_NoCalls)
 
 ISOLATE_UNIT_TEST_CASE (SourceReport_Coverage_Filters_single)
 
 ISOLATE_UNIT_TEST_CASE (SourceReport_Coverage_Filters_empty)
 
 ISOLATE_UNIT_TEST_CASE (SourceReport_Coverage_SimpleCall)
 
 ISOLATE_UNIT_TEST_CASE (SourceReport_Coverage_ForceCompile)
 
 ISOLATE_UNIT_TEST_CASE (SourceReport_Coverage_UnusedClass_NoForceCompile)
 
 ISOLATE_UNIT_TEST_CASE (SourceReport_Coverage_UnusedClass_ForceCompile)
 
 ISOLATE_UNIT_TEST_CASE (SourceReport_Coverage_UnusedClass_ForceCompileError)
 
 ISOLATE_UNIT_TEST_CASE (SourceReport_Coverage_LibrariesAlreadyCompiled)
 
 ISOLATE_UNIT_TEST_CASE (SourceReport_Coverage_NestedFunctions)
 
 ISOLATE_UNIT_TEST_CASE (SourceReport_Coverage_RestrictedRange)
 
 ISOLATE_UNIT_TEST_CASE (SourceReport_Coverage_AllFunctions)
 
 ISOLATE_UNIT_TEST_CASE (SourceReport_Coverage_AllFunctions_ForceCompile)
 
 ISOLATE_UNIT_TEST_CASE (SourceReport_CallSites_SimpleCall)
 
 ISOLATE_UNIT_TEST_CASE (SourceReport_CallSites_PolymorphicCall)
 
 ISOLATE_UNIT_TEST_CASE (SourceReport_MultipleReports)
 
 ISOLATE_UNIT_TEST_CASE (SourceReport_PossibleBreakpoints_Simple)
 
 ISOLATE_UNIT_TEST_CASE (SourceReport_Coverage_Issue35453_NoSuchMethod)
 
 ISOLATE_UNIT_TEST_CASE (SourceReport_Coverage_Issue47017_Assert)
 
 ISOLATE_UNIT_TEST_CASE (SourceReport_Coverage_Issue47021_StaticOnlyClasses)
 
 ISOLATE_UNIT_TEST_CASE (SourceReport_Coverage_IssueCov341_LateFinalVars)
 
 ISOLATE_UNIT_TEST_CASE (SourceReport_Coverage_IssueCov386_EnhancedEnums)
 
 ISOLATE_UNIT_TEST_CASE (SourceReport_Regress95008_RedirectingFactory)
 
 ISOLATE_UNIT_TEST_CASE (SourceReport_Regress53519_Destructuring)
 
 ISOLATE_UNIT_TEST_CASE (SourceReport_BranchCoverage_if)
 
 ISOLATE_UNIT_TEST_CASE (SourceReport_BranchCoverage_loops)
 
 ISOLATE_UNIT_TEST_CASE (SourceReport_BranchCoverage_switch)
 
 ISOLATE_UNIT_TEST_CASE (SourceReport_BranchCoverage_try)
 
static DART_FORCE_INLINE intptr_t LocalVarIndex (intptr_t fp_offset, intptr_t var_index)
 
static DART_FORCE_INLINE uword ParamAddress (uword fp, intptr_t reverse_index)
 
static DART_FORCE_INLINE bool IsCalleeFrameOf (uword fp, uword other_fp)
 
static DART_FORCE_INLINE uword LocalVarAddress (uword fp, intptr_t index)
 
 COMPILE_ASSERT (kAbiPreservedCpuRegCount==7)
 
 COMPILE_ASSERT (kAbiPreservedFpuRegCount==4)
 
 ISOLATE_UNIT_TEST_CASE (EmptyStackFrameIteration)
 
 ISOLATE_UNIT_TEST_CASE (EmptyDartStackFrameIteration)
 
void FUNCTION_NAME() StackFrame_equals (Dart_NativeArguments args)
 
void FUNCTION_NAME() StackFrame_frameCount (Dart_NativeArguments args)
 
void FUNCTION_NAME() StackFrame_dartFrameCount (Dart_NativeArguments args)
 
void FUNCTION_NAME() StackFrame_validateFrame (Dart_NativeArguments args)
 
static Dart_NativeFunction native_lookup (Dart_Handle name, int argument_count, bool *auto_setup_scope)
 
 TEST_CASE (ValidateStackFrameIteration)
 
 TEST_CASE (ValidateNoSuchMethodStackFrameIteration)
 
const FunctionRegisterFakeFunction (const char *name, const Code &code)
 
StringPtr StringFrom (const uint8_t *data, intptr_t len, Heap::Space space)
 
StringPtr StringFrom (const uint16_t *data, intptr_t len, Heap::Space space)
 
intptr_t RawSmiValue (const SmiPtr raw_value)
 
 DECLARE_FLAG (bool, trace_service_verbose)
 
static bool ShouldSuspend (bool isolate_shutdown, Thread *thread)
 
static bool IsInterruptLimit (uword limit)
 
 VM_UNIT_TEST_CASE (ThreadBarrier)
 
 DEFINE_FLAG (bool, trace_thread_interrupter, false, "Trace thread interrupter")
 
 DEFINE_FLAG (int, worker_timeout_millis, 5000, "Free workers when they have been idle for this amount of time.")
 
static int64_t ComputeTimeout (int64_t idle_start)
 
 DECLARE_FLAG (int, worker_timeout_millis)
 
 THREAD_POOL_UNIT_TEST_CASE (ThreadPool_Create)
 
 THREAD_POOL_UNIT_TEST_CASE (ThreadPool_RunOne)
 
 THREAD_POOL_UNIT_TEST_CASE (ThreadPool_RunMany)
 
 THREAD_POOL_UNIT_TEST_CASE (ThreadPool_WorkerShutdown)
 
 THREAD_POOL_UNIT_TEST_CASE (ThreadPool_WorkerTimeout)
 
 THREAD_POOL_UNIT_TEST_CASE (ThreadPool_RecursiveSpawn)
 
 VM_UNIT_TEST_CASE (Mutex)
 
 VM_UNIT_TEST_CASE (Monitor)
 
 ISOLATE_UNIT_TEST_CASE (ManyTasksWithZones)
 
 ISOLATE_UNIT_TEST_CASE (ManySimpleTasksWithZones)
 
 TEST_CASE (ThreadRegistry)
 
static FunctionCreateFunction (const char *name)
 
 ISOLATE_UNIT_TEST_CASE (ICDataTest)
 
 TEST_CASE (SafepointTestDart)
 
 ISOLATE_UNIT_TEST_CASE (SafepointTestVM)
 
 ISOLATE_UNIT_TEST_CASE (RecursiveSafepointTest1)
 
 ISOLATE_UNIT_TEST_CASE (ThreadIterator_Count)
 
 ISOLATE_UNIT_TEST_CASE (ThreadIterator_FindSelf)
 
void ThreadIteratorTestMain (uword parameter)
 
 TEST_CASE (ThreadIterator_AddFindRemove)
 
 ISOLATE_UNIT_TEST_CASE (SafepointTestVM2)
 
 ISOLATE_UNIT_TEST_CASE (RecursiveSafepointTest2)
 
 ISOLATE_UNIT_TEST_CASE (HelperAllocAndGC)
 
 ISOLATE_UNIT_TEST_CASE (ExerciseTLABs)
 
 ISOLATE_UNIT_TEST_CASE (SafepointRwLockWithReadLock)
 
 ISOLATE_UNIT_TEST_CASE (SafepointRwLockWithWriteLock)
 
 ISOLATE_UNIT_TEST_CASE (SafepointRwLockWithoutAnyLocks)
 
 ISOLATE_UNIT_TEST_CASE (SafepointRwLockReentrantReadLock)
 
 ISOLATE_UNIT_TEST_CASE (SafepointRwLockReentrantWriteLock)
 
 ISOLATE_UNIT_TEST_CASE (SafepointRwLockWriteToReadLock)
 
template<typename LockType , typename LockerType >
static void RunLockerWithLongJumpTest ()
 
 ISOLATE_UNIT_TEST_CASE (SafepointRwLockWriteWithLongJmp)
 
 ISOLATE_UNIT_TEST_CASE (SafepointRwLockReadWithLongJmp)
 
 ISOLATE_UNIT_TEST_CASE (SafepointMutexLockerWithLongJmp)
 
void Helper (uword arg)
 
 ISOLATE_UNIT_TEST_CASE (SafepointRwLockExclusiveNestedWriter_Regress44000)
 
 ISOLATE_UNIT_TEST_CASE (SafepointMonitorUnlockScope)
 
 TEST_CASE (TimelineEventIsValid)
 
 TEST_CASE (TimelineEventDuration)
 
 TEST_CASE (TimelineEventDurationPrintJSON)
 
 TEST_CASE (TimelineEventArguments)
 
 TEST_CASE (TimelineEventArgumentsPrintJSON)
 
 TEST_CASE (TimelineEventBufferPrintJSON)
 
 TEST_CASE (TimelineEventCallbackRecorderBasic)
 
 TEST_CASE (TimelineRingRecorderJSONOrder)
 
 TEST_CASE (TimelineRingRecorderRace)
 
 TEST_CASE (TimelineTrackMetadataRace)
 
 SENTINEL_TOKEN_DESCRIPTORS (DEFINE_VALUES)
 
static CodePtr RetryCompilationWithFarBranches (Thread *thread, std::function< CodePtr(compiler::Assembler &)> fun)
 
static void CommentCheckedClasses (compiler::Assembler *assembler, const CidRangeVector &ranges)
 
static CheckType SubtypeChecksForClass (Zone *zone, const Type &type, const Class &type_class, const Class &to_check)
 
static void CommentSkippedClasses (compiler::Assembler *assembler, const Type &type, const Class &type_class, const CidRangeVector &ranges)
 
static void SplitByTypeArgumentsFieldOffset (Thread *T, const Class &type_class, const CidRangeVector &ranges, GrowableArray< CidRangeVector * > *output)
 
static void SplitOnTypeArgumentTests (HierarchyInfo *hi, const Type &type, const Class &type_class, const CidRangeVector &ranges, CidRangeVector *cid_check_only, CidRangeVector *type_argument_checks, CidRangeVector *not_checked)
 
void RegisterTypeArgumentsUse (const Function &function, TypeUsageInfo *type_usage_info, const Class &klass, Definition *type_arguments)
 
void DeoptimizeTypeTestingStubs ()
 
 DECLARE_FLAG (int, max_subtype_cache_entries)
 
 DEFINE_FLAG (bool, trace_type_testing_stub_tests, false, "Trace type testing stub tests")
 
 DEFINE_FLAG (bool, print_type_testing_stub_test_headers, true, "Print headers for executed type testing stub tests")
 
static void GenerateInvokeTTSStub (compiler::Assembler *assembler)
 
static void FinalizeAndCanonicalize (AbstractType *type)
 
static void CanonicalizeTAV (TypeArguments *tav)
 
static TTSTestCase Failure (const TTSTestCase &original)
 
static TTSTestCase STCCheck (const TTSTestCase &original)
 
static TTSTestCase FalseNegative (const TTSTestCase &original)
 
static TTSTestCase RuntimeCheck (const TTSTestCase &original)
 
static TTSTestCase Respecialization (const TTSTestCase &original)
 
static void RunTTSTest (const AbstractType &dst_type, const TTSTestCase &test_case, bool should_specialize=true)
 
 ISOLATE_UNIT_TEST_CASE (TTS_SubtypeRangeCheck)
 
 ISOLATE_UNIT_TEST_CASE (TTS_GenericSubtypeRangeCheck)
 
 ISOLATE_UNIT_TEST_CASE (TTS_RecordSubtypeRangeCheck)
 
 ISOLATE_UNIT_TEST_CASE (TTS_Generic_Implements_Instantiated_Interface)
 
 ISOLATE_UNIT_TEST_CASE (TTS_Future)
 
 ISOLATE_UNIT_TEST_CASE (TTS_Regress40964)
 
 ISOLATE_UNIT_TEST_CASE (TTS_TypeParameter)
 
 ISOLATE_UNIT_TEST_CASE (TTS_Smi)
 
 ISOLATE_UNIT_TEST_CASE (TTS_Int)
 
 ISOLATE_UNIT_TEST_CASE (TTS_Num)
 
 ISOLATE_UNIT_TEST_CASE (TTS_Double)
 
 ISOLATE_UNIT_TEST_CASE (TTS_Object)
 
 ISOLATE_UNIT_TEST_CASE (TTS_Function)
 
 ISOLATE_UNIT_TEST_CASE (TTS_Partial)
 
 ISOLATE_UNIT_TEST_CASE (TTS_Partial_Incremental)
 
 ISOLATE_UNIT_TEST_CASE (Utf8Encode)
 
 ISOLATE_UNIT_TEST_CASE (Utf8InvalidByte)
 
 ISOLATE_UNIT_TEST_CASE (Utf8Decode)
 
 DECLARE_FLAG (bool, gc_during_reload)
 
 DECLARE_FLAG (bool, force_evacuation)
 
void SetupCoreLibrariesForUnitTest ()
 
static const char * IsolateReloadTestLibUri ()
 
 RELOAD_NATIVE_LIST (DECLARE_FUNCTION)
 
static Dart_NativeFunction IsolateReloadTestNativeResolver (Dart_Handle name, int argument_count, bool *auto_setup_scope)
 
void FUNCTION_NAME() Test_Reload (Dart_NativeArguments native_args)
 
void FUNCTION_NAME() Test_CollectNewSpace (Dart_NativeArguments native_args)
 
void FUNCTION_NAME() Test_CollectOldSpace (Dart_NativeArguments native_args)
 
static void LoadIsolateReloadTestLibIfNeeded (const char *script)
 
static Dart_Handle LibraryTagHandler (Dart_LibraryTag tag, Dart_Handle library, Dart_Handle url)
 
static intptr_t BuildSourceFilesArray (Dart_SourceFile **sourcefiles, const char *script, const char *script_url=RESOLVED_USER_TEST_URI)
 
static void MallocFinalizer (void *isolate_callback_data, void *peer)
 
void ElideJSONSubstring (const char *prefix, const char *in, char *out, const char *postfix)
 
void StripTokenPositions (char *buffer)
 
static bool IsUnreservedChar (intptr_t value)
 
static bool IsDelimiter (intptr_t value)
 
static bool IsHexDigit (char value)
 
static int HexValue (char digit)
 
static int GetEscapedValue (const char *str, intptr_t pos, intptr_t len)
 
static char * NormalizeEscapes (const char *str, intptr_t len)
 
static void StringLower (char *str)
 
static void ClearParsedUri (ParsedUri *parsed_uri)
 
static intptr_t ParseAuthority (const char *authority, ParsedUri *parsed_uri)
 
bool ParseUri (const char *uri, ParsedUri *parsed_uri)
 
static char * RemoveLastSegment (char *current, char *base)
 
static intptr_t SegmentLength (const char *input)
 
static const char * RemoveDotSegments (const char *path)
 
static const char * MergePaths (const char *base_path, const char *ref_path)
 
static char * BuildUri (const ParsedUri &uri)
 
bool ResolveUri (const char *ref_uri, const char *base_uri, const char **target_uri)
 
 TEST_CASE (ParseUri_WithScheme_NoQueryNoUser)
 
 TEST_CASE (ParseUri_WithScheme_WithQuery)
 
 TEST_CASE (ParseUri_WithScheme_WithFragment)
 
 TEST_CASE (ParseUri_WithScheme_WithQueryWithFragment)
 
 TEST_CASE (ParseUri_WithScheme_WithUser)
 
 TEST_CASE (ParseUri_WithScheme_ShortPath)
 
 TEST_CASE (ParseUri_WithScheme_EmptyPath)
 
 TEST_CASE (ParseUri_WithScheme_Rootless1)
 
 TEST_CASE (ParseUri_WithScheme_Rootless2)
 
 TEST_CASE (ParseUri_NoScheme_AbsPath_WithAuthority)
 
 TEST_CASE (ParseUri_NoScheme_AbsPath_NoAuthority)
 
 TEST_CASE (ParseUri_NoScheme_AbsPath_StrayColon)
 
 TEST_CASE (ParseUri_NoScheme_Rootless1)
 
 TEST_CASE (ParseUri_NoScheme_Rootless2)
 
 TEST_CASE (ParseUri_NoScheme_Empty)
 
 TEST_CASE (ParseUri_NoScheme_QueryOnly)
 
 TEST_CASE (ParseUri_NoScheme_FragmentOnly)
 
 TEST_CASE (ParseUri_LowerCaseScheme)
 
 TEST_CASE (ParseUri_NormalizeEscapes_PathQueryFragment)
 
 TEST_CASE (ParseUri_NormalizeEscapes_UppercaseEscapesPreferred)
 
 TEST_CASE (ParseUri_NormalizeEscapes_Authority)
 
 TEST_CASE (ParseUri_NormalizeEscapes_UppercaseEscapeInHost)
 
 TEST_CASE (ParseUri_BrokenEscapeSequence)
 
 TEST_CASE (ResolveUri_WithScheme_NoAuthorityNoQuery)
 
 TEST_CASE (ResolveUri_WithScheme_WithAuthorityWithQuery)
 
 TEST_CASE (ResolveUri_NoScheme_WithAuthority)
 
 TEST_CASE (ResolveUri_NoSchemeNoAuthority_AbsolutePath)
 
 TEST_CASE (ResolveUri_NoSchemeNoAuthority_RelativePath)
 
 TEST_CASE (ResolveUri_NoSchemeNoAuthority_RelativePathEmptyBasePath)
 
 TEST_CASE (ResolveUri_NoSchemeNoAuthority_RelativePathWeirdBasePath)
 
 TEST_CASE (ResolveUri_NoSchemeNoAuthority_EmptyPath)
 
 TEST_CASE (ResolveUri_NoSchemeNoAuthority_EmptyPathWithQuery)
 
 TEST_CASE (ResolveUri_NoSchemeNoAuthority_EmptyPathWithFragment)
 
 TEST_CASE (ResolveUri_RemoveDots_RemoveOneDotSegment)
 
 TEST_CASE (ResolveUri_RemoveDots_RemoveTwoDotSegments)
 
 TEST_CASE (ResolveUri_RemoveDots_RemoveOneDotDotSegment)
 
 TEST_CASE (ResolveUri_RemoveDots_RemoveTwoDotDotSegments)
 
 TEST_CASE (ResolveUri_RemoveDots_RemoveTooManyDotDotSegments)
 
 TEST_CASE (ResolveUri_RemoveDots_RemoveDotSegmentsNothingLeft1)
 
 TEST_CASE (ResolveUri_RemoveDots_RemoveDotSegmentsNothingLeft2)
 
 TEST_CASE (ResolveUri_RemoveDots_RemoveDotSegmentsInitialPrefix)
 
 TEST_CASE (ResolveUri_RemoveDots_RemoveDotSegmentsMixed)
 
 TEST_CASE (ResolveUri_NormalizeEscapes_PathQueryFragment)
 
 TEST_CASE (ResolveUri_NormalizeEscapes_UppercaseHexPreferred)
 
 TEST_CASE (ResolveUri_NormalizeEscapes_Authority)
 
 TEST_CASE (ResolveUri_NormalizeEscapes_BrokenEscapeSequence)
 
 TEST_CASE (ResolveUri_DataUri)
 
 TEST_CASE (ResolveUri_RelativeBase_NotImplemented)
 
static const char * TestResolve (const char *base_uri, const char *uri)
 
 TEST_CASE (ResolveUri_TestUriPerRFCs)
 
 TEST_CASE (ResolveUri_MoreDotSegmentTests)
 
 TEST_CASE (ResolveUri_WindowsPaths_Forwardslash_NoScheme)
 
 TEST_CASE (ResolveUri_WindowsPaths_Forwardslash_FileScheme)
 
 TEST_CASE (ResolveUri_WindowsPaths_Backslash)
 
 VM_UNIT_TEST_CASE (StringHash)
 
 VM_UNIT_TEST_CASE (Minimum)
 
 VM_UNIT_TEST_CASE (Maximum)
 
 VM_UNIT_TEST_CASE (IsPowerOfTwo)
 
 VM_UNIT_TEST_CASE (ShiftForPowerOfTwo)
 
 VM_UNIT_TEST_CASE (IsAligned)
 
 VM_UNIT_TEST_CASE (RoundDown)
 
 VM_UNIT_TEST_CASE (RoundUp)
 
 VM_UNIT_TEST_CASE (RoundUpToPowerOfTwo)
 
 VM_UNIT_TEST_CASE (CountOneBits32)
 
 VM_UNIT_TEST_CASE (CountOneBits64)
 
 VM_UNIT_TEST_CASE (CountOneBitsWord)
 
 VM_UNIT_TEST_CASE (CountTrailingZeros32)
 
 VM_UNIT_TEST_CASE (CountTrailingZeros64)
 
 VM_UNIT_TEST_CASE (CountLeadingZeros32)
 
 VM_UNIT_TEST_CASE (CountLeadingZeros64)
 
 VM_UNIT_TEST_CASE (CountZerosWord)
 
 VM_UNIT_TEST_CASE (ReverseBits32)
 
 VM_UNIT_TEST_CASE (ReverseBits64)
 
 VM_UNIT_TEST_CASE (ReverseBitsWord)
 
 VM_UNIT_TEST_CASE (IsInt)
 
 VM_UNIT_TEST_CASE (IsUint)
 
 VM_UNIT_TEST_CASE (MagnitudeIsUint)
 
 VM_UNIT_TEST_CASE (LowBits)
 
 VM_UNIT_TEST_CASE (Endianity)
 
 VM_UNIT_TEST_CASE (DoublesBitEqual)
 
 VM_UNIT_TEST_CASE (NBitMask)
 
bool IsZero (char *begin, char *end)
 
 VM_UNIT_TEST_CASE (AllocateVirtualMemory)
 
 VM_UNIT_TEST_CASE (AllocateAlignedVirtualMemory)
 
 VM_UNIT_TEST_CASE (FreeVirtualMemory)
 
static int testFunction (int x)
 
 VM_UNIT_TEST_CASE (DuplicateRXVirtualMemory)
 
 VM_UNIT_TEST_CASE (AllocateZone)
 
 VM_UNIT_TEST_CASE (AllocGeneric_Success)
 
 VM_UNIT_TEST_CASE_WITH_EXPECTATION (AllocGeneric_Overflow, "Crash")
 
 VM_UNIT_TEST_CASE (ZoneRealloc)
 
 VM_UNIT_TEST_CASE (ZoneAllocated)
 
 TEST_CASE (PrintToString)
 
 TEST_CASE (StressMallocDirectly)
 
 ISOLATE_UNIT_TEST_CASE (StressMallocThroughZones)
 
 ISOLATE_UNIT_TEST_CASE (ZoneVerificationScaling)
 

Variables

intptr_t(* my_callback_blocking_fp_ )(intptr_t)
 
Dart_Port my_callback_blocking_send_port_
 
void(* my_callback_non_blocking_fp_ )(intptr_t)
 
Dart_Port my_callback_non_blocking_send_port_
 
Dart_Port send_port_
 
void(* callback_ )(Dart_Handle)
 
Dart_PersistentHandle closure_to_callback_
 
std::mutex ref_counted_resource_mutex
 
static intptr_t kInitialSize = 8
 
static constexpr const char * kNone = "No Test or Benchmarks"
 
static constexpr const char * kList = "List all Tests and Benchmarks"
 
static constexpr const char * kAllBenchmarks = "All Benchmarks"
 
static const char * run_filter = kNone
 
static const char * kernel_snapshot = nullptr
 
static int run_matches = 0
 
static int64_t kMaxAllowedSeconds = kMaxInt32
 
static const DartApiEntry dart_api_entries []
 
static const DartApi dart_api_data
 
const char * file_schema = "file://"
 
const int file_schema_length = 7
 
static constexpr intptr_t kDefaultStackAllocation = 8
 
static constexpr intptr_t kLengthSize = 11
 
static constexpr intptr_t kLengthMask = (1 << kLengthSize) - 1
 
constexpr intptr_t kInt8SizeLog2 = 0
 
constexpr intptr_t kInt8Size = 1 << kInt8SizeLog2
 
constexpr intptr_t kInt16SizeLog2 = 1
 
constexpr intptr_t kInt16Size = 1 << kInt16SizeLog2
 
constexpr intptr_t kInt32SizeLog2 = 2
 
constexpr intptr_t kInt32Size = 1 << kInt32SizeLog2
 
constexpr intptr_t kInt64SizeLog2 = 3
 
constexpr intptr_t kInt64Size = 1 << kInt64SizeLog2
 
constexpr intptr_t kDoubleSize = sizeof(double)
 
constexpr intptr_t kFloatSize = sizeof(float)
 
constexpr intptr_t kQuadSize = 4 * kFloatSize
 
constexpr intptr_t kSimd128Size = sizeof(simd128_value_t)
 
constexpr intptr_t kBitsPerByteLog2 = 3
 
constexpr intptr_t kBitsPerByte = 1 << kBitsPerByteLog2
 
constexpr intptr_t kBitsPerInt8 = kInt8Size * kBitsPerByte
 
constexpr intptr_t kBitsPerInt16 = kInt16Size * kBitsPerByte
 
constexpr intptr_t kBitsPerInt32 = kInt32Size * kBitsPerByte
 
constexpr intptr_t kBitsPerInt64 = kInt64Size * kBitsPerByte
 
constexpr int8_t kMinInt8 = 0x80
 
constexpr int8_t kMaxInt8 = 0x7F
 
constexpr uint8_t kMaxUint8 = 0xFF
 
constexpr int16_t kMinInt16 = 0x8000
 
constexpr int16_t kMaxInt16 = 0x7FFF
 
constexpr uint16_t kMaxUint16 = 0xFFFF
 
constexpr int32_t kMinInt32 = 0x80000000
 
constexpr int32_t kMaxInt32 = 0x7FFFFFFF
 
constexpr uint32_t kMaxUint32 = 0xFFFFFFFF
 
constexpr int64_t kMinInt64 = DART_INT64_C(0x8000000000000000)
 
constexpr int64_t kMaxInt64 = DART_INT64_C(0x7FFFFFFFFFFFFFFF)
 
constexpr uint64_t kMaxUint64 = DART_2PART_UINT64_C(0xFFFFFFFF, FFFFFFFF)
 
constexpr int kMinInt = INT_MIN
 
constexpr int kMaxInt = INT_MAX
 
constexpr int kMaxUint = UINT_MAX
 
constexpr int64_t kMinInt64RepresentableAsDouble = kMinInt64
 
constexpr int64_t kMaxInt64RepresentableAsDouble
 
constexpr int64_t kSignBitDouble = DART_INT64_C(0x8000000000000000)
 
constexpr intptr_t kWordSizeLog2 = kInt64SizeLog2
 
constexpr intptr_t kWordSize = 1 << kWordSizeLog2
 
constexpr intptr_t kBitsPerWordLog2 = kWordSizeLog2 + kBitsPerByteLog2
 
constexpr intptr_t kBitsPerWord = 1 << kBitsPerWordLog2
 
constexpr word kWordMin = static_cast<uword>(1) << (kBitsPerWord - 1)
 
constexpr word kWordMax = (static_cast<uword>(1) << (kBitsPerWord - 1)) - 1
 
constexpr uword kUwordMax = static_cast<uword>(-1)
 
constexpr intptr_t KBLog2 = 10
 
constexpr intptr_t KB = 1 << KBLog2
 
constexpr intptr_t MBLog2 = KBLog2 + KBLog2
 
constexpr intptr_t MB = 1 << MBLog2
 
constexpr intptr_t GBLog2 = MBLog2 + KBLog2
 
constexpr intptr_t GB = 1 << GBLog2
 
constexpr intptr_t KBInWordsLog2 = KBLog2 - kWordSizeLog2
 
constexpr intptr_t KBInWords = 1 << KBInWordsLog2
 
constexpr intptr_t MBInWordsLog2 = KBLog2 + KBInWordsLog2
 
constexpr intptr_t MBInWords = 1 << MBInWordsLog2
 
constexpr intptr_t GBInWordsLog2 = MBLog2 + KBInWordsLog2
 
constexpr intptr_t GBInWords = 1 << GBInWordsLog2
 
constexpr intptr_t kIntptrOne = 1
 
constexpr intptr_t kIntptrMin = (kIntptrOne << (kBitsPerWord - 1))
 
constexpr intptr_t kIntptrMax = ~kIntptrMin
 
constexpr intptr_t kMillisecondsPerSecond = 1000
 
constexpr intptr_t kMicrosecondsPerMillisecond = 1000
 
constexpr intptr_t kMicrosecondsPerSecond
 
constexpr intptr_t kNanosecondsPerMicrosecond = 1000
 
constexpr intptr_t kNanosecondsPerMillisecond
 
constexpr intptr_t kNanosecondsPerSecond
 
static constexpr uint32_t kStringHashM = 0x5bd1e995
 
static constexpr int kStringHashR = 24
 
static constexpr intptr_t kUnreachableReference = 0
 
static constexpr intptr_t kFirstReference = 1
 
static constexpr intptr_t kUnallocatedReference = -1
 
static const char *const kObjectStoreFieldNames []
 
static const int8_t decode_table []
 
static const char PAD = '='
 
static constexpr uword kUwordOne = 1U
 
static constexpr uint32_t kTestPcOffset = 0x4
 
static constexpr intptr_t kTestSpillSlotBitCount = 0
 
static const BootstrapLibProps bootstrap_libraries []
 
static constexpr intptr_t kBootstrapLibraryCount
 
static const struct dart::NativeEntries BootStrapEntries []
 
static const struct dart::FfiNativeEntries BootStrapFfiEntries []
 
const auto kA = NewMove(1, 10)
 
const auto kB = NewMove(2, 20)
 
const auto kC = NewMove(3, 30)
 
const auto kD = NewMove(4, 40)
 
const auto kE = NewMove(5, 50)
 
const auto kX = NewMove(-1, -10)
 
const CatchEntryMove abcde [] = {kA, kB, kC, kD, kE}
 
const CatchEntryMove abcdx [] = {kA, kB, kC, kD, kX}
 
const CatchEntryMove xbcde [] = {kX, kB, kC, kD, kE}
 
const CatchEntryMove abxde [] = {kA, kB, kX, kD, kE}
 
const CatchEntryMove ab [] = {kA, kB}
 
const CatchEntryMove de [] = {kD, kE}
 
static constexpr intptr_t kClassIdTagMax = (1 << 20) - 1
 
const int kTypedDataCidRemainderInternal = 0
 
const int kTypedDataCidRemainderView = 1
 
const int kTypedDataCidRemainderExternal = 2
 
const int kTypedDataCidRemainderUnmodifiable = 3
 
const int kNumTypedDataCidRemainders = kTypedDataCidRemainderUnmodifiable + 1
 
constexpr intptr_t kFirstInternalOnlyCid = kClassCid
 
constexpr intptr_t kLastInternalOnlyCid = kUnwindErrorCid
 
static const ClassId kFirstErrorCid = kErrorCid
 
static const ClassId kLastErrorCid = kUnwindErrorCid
 
static const ClassId kFirstTypedDataCid = kTypedDataInt8ArrayCid
 
static const ClassId kLastTypedDataCid
 
static constexpr intptr_t kInvalidTryIndex = -1
 
static constexpr bool kShouldWriteProtectCodeByDefault = false
 
const Register kArg1Reg = CallingConventions::ArgumentRegisters[0]
 
const Register kArg2Reg = CallingConventions::ArgumentRegisters[1]
 
static const intptr_t kMaxElementSizeForEfficientCopy
 
static const Representation kUnboxedBool = kTagged
 
static const SimdOpInfo simd_op_information []
 
static constexpr intptr_t kNoVirtualRegister = -1
 
static constexpr intptr_t kTempVirtualRegister = -2
 
static constexpr intptr_t kIllegalPosition = -1
 
static constexpr intptr_t kMaxPosition = 0x7FFFFFFF
 
static constexpr intptr_t kMaxLocationCount = 2
 
static constexpr Representation kUnboxedWord
 
static constexpr Representation kUnboxedUword
 
static constexpr Representation kUnboxedIntPtr = kUnboxedWord
 
static constexpr Representation kUnboxedAddress = kUnboxedUword
 
const char * pointer_prefix = ""
 
static constexpr intptr_t kMemoryTestLength = 1024
 
static constexpr uint8_t kUnInitialized = 0xFE
 
static const intptr_t simd_op_result_cids []
 
static const char * kCompilerPassesUsage
 
const double kCommonDoubleConstants []
 
struct { 
 
   const char *const   dart::class_name 
 
   const char *const   dart::function_name 
 
   const char *const   dart::enum_name 
 
   const uint32_t   dart::fp 
 
recognized_methods [MethodRecognizer::kNumRecognizedMethods
 
struct { 
 
   const intptr_t   dart::symbol_id 
 
   const intptr_t   dart::cid 
 
   const uint32_t   dart::finger_print 
 
   const char *const   dart::name 
 
factory_recognizer_list [] 
 
static constexpr uword kZapCodeReg = 0xf1f1f1f1
 
static constexpr uword kZapReturnAddress = 0xe1e1e1e1
 
const QRegister QTMP = Q7
 
const DRegister DTMP = EvenDRegisterOf(QTMP)
 
const SRegister STMP DART_USED = EvenSRegisterOf(DTMP)
 
const FpuRegister FpuTMP = QTMP
 
const int kFpuRegisterSize = 16
 
const int kNumberOfFpuRegisters = kNumberOfQRegisters
 
const FpuRegister kNoFpuRegister = kNoQRegister
 
const char *const cpu_reg_names [kNumberOfCpuRegisters]
 
const char *const cpu_reg_abi_names [kNumberOfCpuRegisters]
 
const char *const fpu_reg_names [kNumberOfFpuRegisters]
 
const char *const fpu_s_reg_names [kNumberOfSRegisters]
 
const char *const fpu_d_reg_names [kNumberOfDRegisters]
 
const Register TMP = IP
 
const Register TMP2 = kNoRegister
 
const Register PP = R5
 
const Register DISPATCH_TABLE_REG = NOTFP
 
const Register SPREG = SP
 
const Register FPREG = FP
 
const Register IC_DATA_REG = R9
 
const Register ARGS_DESC_REG = R4
 
const Register CODE_REG = R6
 
const Register FUNCTION_REG = R0
 
const Register THR = R10
 
const Register CALLEE_SAVED_TEMP = R8
 
const Register APSR = R15
 
const Register kExceptionObjectReg = R0
 
const Register kStackTraceObjectReg = R1
 
const Register kWriteBarrierObjectReg = R1
 
const Register kWriteBarrierValueReg = R0
 
const Register kWriteBarrierSlotReg = R9
 
const RegList kAllCpuRegistersList = 0xFFFF
 
const RegList kAllFpuRegistersList = (1 << kNumberOfFpuRegisters) - 1
 
const RegList kAbiArgumentCpuRegs
 
const RegList kAbiVolatileCpuRegs = kAbiArgumentCpuRegs | (1 << IP) | (1 << LR)
 
const RegList kAbiPreservedCpuRegs
 
const int kAbiPreservedCpuRegCount = 7
 
const QRegister kAbiFirstPreservedFpuReg = Q4
 
const QRegister kAbiLastPreservedFpuReg = Q7
 
const int kAbiPreservedFpuRegCount = 4
 
const RegList kReservedCpuRegisters
 
constexpr intptr_t kNumberOfReservedCpuRegisters
 
constexpr RegList kDartAvailableCpuRegs
 
constexpr int kNumberOfDartAvailableCpuRegs
 
constexpr int kRegisterAllocationBias = 0
 
const intptr_t kStoreBufferWrapperSize = 24
 
const RegList kDartVolatileCpuRegs
 
const int kDartVolatileCpuRegCount = 5
 
const RegList kAbiVolatileFpuRegs = R(Q0) | R(Q1) | R(Q2) | R(Q3)
 
const RegList kFpuRegistersWithoutSOverlap
 
constexpr uword kBreakInstructionFiller = 0xE1200070
 
constexpr uword kDataMemoryBarrier = 0xf57ff050 | 0xb
 
const intptr_t kPreferredLoopAlignment = 1
 
const VRegister VTMP = V31
 
const Register CALLEE_SAVED_TEMP2 = R20
 
const Register HEAP_BITS = R28
 
const Register NULL_REG = R22
 
const int kXRegSizeInBits = 64
 
const int kWRegSizeInBits = 32
 
const int64_t kXRegMask = 0xffffffffffffffffL
 
const int64_t kWRegMask = 0x00000000ffffffffL
 
const Register kAbiFirstPreservedCpuReg = R19
 
const Register kAbiLastPreservedCpuReg = R28
 
const Register kDartFirstVolatileCpuReg = R0
 
const Register kDartLastVolatileCpuReg = R14
 
const int kDartVolatileFpuRegCount = 24
 
const char *const cpu_reg_byte_names [kNumberOfByteRegisters]
 
const int MAX_NOP_SIZE = 8
 
const FRegister FTMP = FT11
 
constexpr Register FAR_TMP = S8
 
constexpr Register WRITE_BARRIER_STATE = S11
 
constexpr RegList kAbiArgumentFpuRegs
 
constexpr RegList kAbiPreservedFpuRegs
 
constexpr intptr_t kReservedFpuRegisters = 0
 
constexpr intptr_t kNumberOfReservedFpuRegisters = 0
 
const intptr_t kReleaseShift = 25
 
const intptr_t kAcquireShift = 26
 
static constexpr ExtensionSet RV_G = RV_I | RV_M | RV_A | RV_F | RV_D
 
static constexpr ExtensionSet RV_GC = RV_G | RV_C
 
static constexpr ExtensionSet RV_B = RV_Zba | RV_Zbb | RV_Zbc | RV_Zbs
 
static constexpr ExtensionSet RV_GCB = RV_GC | RV_B
 
static const char * kCustomIsolateScriptChars
 
EventQueueevent_queue
 
char * saved_echo = nullptr
 
static bool use_set_return = false
 
static bool use_throw_exception = false
 
static int kLength = 16
 
static constexpr intptr_t kExtLength = 16
 
static int8_t data [kExtLength]
 
static bool byte_data_finalizer_run = false
 
static constexpr intptr_t kOptExtLength = 16
 
static int8_t opt_data [kOptExtLength]
 
static Dart_FinalizableHandle finalizable_new_ref = nullptr
 
static void * finalizable_new_ref_peer = 0
 
static Dart_FinalizableHandle finalizable_old_ref = nullptr
 
static void * finalizable_old_ref_peer = 0
 
static Dart_PersistentHandle persistent_handle1
 
static Dart_WeakPersistentHandle weak_persistent_handle2
 
static Dart_WeakPersistentHandle weak_persistent_handle3
 
static Dart_FinalizableHandle finalizable_handle3
 
Dart_WeakPersistentHandle delete_on_finalization
 
static Dart_WeakPersistentHandle weak1 = nullptr
 
static Dart_WeakPersistentHandle weak2 = nullptr
 
static Dart_WeakPersistentHandle weak3 = nullptr
 
static constexpr int kTestNumNativeFields = 2
 
static constexpr intptr_t kNativeField1Value = 30
 
static constexpr intptr_t kNativeField2Value = 40
 
static intptr_t kNativeArgumentNativeField1Value = 30
 
static intptr_t kNativeArgumentNativeField2Value = 40
 
static constexpr intptr_t kSendLength = 16
 
static void * shutdown_isolate_group_data
 
static void * shutdown_isolate_data
 
static void * cleanup_isolate_group_data
 
static void * cleanup_isolate_data
 
static void * cleanup_group_callback_data
 
static int64_t add_result = 0
 
static Monitorloop_test_lock = new Monitor()
 
static bool loop_test_exit = false
 
static bool loop_reset_count = false
 
static void * last_allocation_context = nullptr
 
static const char * last_allocation_cls = nullptr
 
static intptr_t heap_samples = 0
 
static const char * expected_allocation_cls = nullptr
 
static bool found_allocation = false
 
static constexpr int kLocalHandleSizeInWords = sizeof(LocalHandle) / kWordSize
 
static constexpr int kLocalHandlesPerChunk = 64
 
static constexpr int kOffsetOfRawPtrInLocalHandle = 0
 
static constexpr int kPersistentHandleSizeInWords
 
static constexpr int kPersistentHandlesPerChunk = 64
 
static constexpr int kOffsetOfRawPtrInPersistentHandle = 0
 
static constexpr int kFinalizablePersistentHandleSizeInWords
 
static constexpr int kFinalizablePersistentHandlesPerChunk = 64
 
static constexpr int kOffsetOfRawPtrInFinalizablePersistentHandle = 0
 
static constexpr int8_t kDataBitsPerByte = 7
 
static constexpr int8_t kByteMask = (1 << kDataBitsPerByte) - 1
 
static constexpr int8_t kMaxUnsignedDataPerByte = kByteMask
 
static constexpr int8_t kMinDataPerByte = -(1 << (kDataBitsPerByte - 1))
 
static constexpr int8_t kMaxDataPerByte
 
static constexpr uint8_t kEndByteMarker = (255 - kMaxDataPerByte)
 
static constexpr uint8_t kEndUnsignedByteMarker
 
static constexpr intptr_t kUnsignedEnd = kMaxUint16
 
static constexpr intptr_t kSignedStart = kMinInt16
 
static constexpr intptr_t kSignedEnd = kMaxInt16
 
const uint8_t kSafepointKind
 
static constexpr char kExponentChar = 'e'
 
static constexpr const char * kInfinitySymbol = "Infinity"
 
static constexpr const char * kNaNSymbol = "NaN"
 
static constexpr intptr_t kElfPageSize = 16 * KB
 
static struct dart::NativeEntries BuiltinEntries [] = {UNHANDLED_NATIVE_LIST(REGISTER_FUNCTION)}
 
const intptr_t kSmiBits = kBitsPerWord - 2
 
const intptr_t kSmiMax = (static_cast<intptr_t>(1) << kSmiBits) - 1
 
const intptr_t kSmiMin = -(static_cast<intptr_t>(1) << kSmiBits)
 
const intptr_t kSmiBits32 = kBitsPerInt32 - 2
 
const intptr_t kSmiMax32 = (static_cast<intptr_t>(1) << kSmiBits32) - 1
 
const intptr_t kSmiMin32 = -(static_cast<intptr_t>(1) << kSmiBits32)
 
static constexpr intptr_t kCompressedWordSize = kWordSize
 
static constexpr intptr_t kCompressedWordSizeLog2 = kWordSizeLog2
 
const intptr_t kMaxAddrSpaceMB = (kWordSize <= 4) ? 4096 : 268435456
 
const intptr_t kMaxAddrSpaceInWords
 
const intptr_t kBytesPerBigIntDigit = 4
 
const intptr_t kDefaultMaxOldGenHeapSize = (kWordSize <= 4) ? 1536 : 30720
 
const intptr_t kDefaultNewGenSemiMaxSize = (kWordSize <= 4) ? 8 : 16
 
const intptr_t kOffsetOfPtr = 32
 
static constexpr uword kZapUninitializedWord = 0xabababababababab
 
static constexpr intptr_t kAllocationCanary = 123
 
static constexpr int kVMHandleSizeInWords = 2
 
static constexpr int kVMHandlesPerChunk = 63
 
static constexpr int kOffsetOfRawPtr = kWordSize
 
static constexpr intptr_t kPageCacheCapacity = 8 * kWordSize
 
static Mutexpage_cache_mutex = nullptr
 
static VirtualMemorypage_cache [kPageCacheCapacity] = {nullptr}
 
static intptr_t page_cache_size = 0
 
static constexpr intptr_t kPageSize = 512 * KB
 
static constexpr intptr_t kPageSizeInWords = kPageSize / kWordSize
 
static constexpr intptr_t kPageMask = ~(kPageSize - 1)
 
static constexpr intptr_t kBitVectorWordsPerBlock = 1
 
static constexpr intptr_t kBlockSize
 
static constexpr intptr_t kBlockMask = ~(kBlockSize - 1)
 
static constexpr intptr_t kBlocksPerPage = kPageSize / kBlockSize
 
static constexpr intptr_t kAllocationRedZoneSize = kObjectAlignment
 
static constexpr intptr_t kConservativeInitialMarkSpeed = 20
 
static constexpr int kStoreBufferBlockSize = 1024
 
static constexpr int kMarkingStackBlockSize = 64
 
static constexpr int kPromotionStackBlockSize = 64
 
static constexpr intptr_t kConservativeInitialScavengeSpeed = 40
 
static constexpr intptr_t kNewAllocatableSize = 256 * KB
 
static constexpr intptr_t kAllocatablePageSize = 64 * KB
 
static constexpr uword kReadOnlyGCBits
 
 gc_during_reload
 
 false
 
Cause GC during reload
 
static const char base64_digits [65]
 
static const char base64_pad = '='
 
const bool kNoSafepointScope = true
 
const bool kDontAssertNoSafepointScope = false
 
static const char * test_output_ = nullptr
 
static Dart_CObject cobj_sentinel = {Dart_CObject_kUnsupported, {false}}
 
static Dart_CObject cobj_transition_sentinel
 
static Dart_CObject cobj_dynamic_type = {Dart_CObject_kUnsupported, {false}}
 
static Dart_CObject cobj_void_type = {Dart_CObject_kUnsupported, {false}}
 
static Dart_CObject cobj_empty_type_arguments
 
static Dart_CObject cobj_true = {Dart_CObject_kBool, {true}}
 
static Dart_CObject cobj_false = {Dart_CObject_kBool, {false}}
 
static constexpr intptr_t kFirstReference = 1
 
static constexpr intptr_t kUnallocatedReference = -1
 
static const char *const kGetterPrefix = "get:"
 
static const intptr_t kGetterPrefixLength = strlen(kGetterPrefix)
 
static const char *const kSetterPrefix = "set:"
 
static const intptr_t kSetterPrefixLength = strlen(kSetterPrefix)
 
static const char *const kInitPrefix = "init:"
 
static const intptr_t kInitPrefixLength = strlen(kInitPrefix)
 
bool TESTING_runtime_fail_on_existing_cache_entry = false
 
static constexpr intptr_t kNullIdentityHash = 2011
 
static constexpr intptr_t kTrueIdentityHash = 1231
 
static constexpr intptr_t kFalseIdentityHash = 1237
 
const char * kFastAllocationFailed = "fast allocation failed"
 
const intptr_t kFinalizerTwoEntriesNumObjects = 9
 
const uint32_t kCalculateCanonicalizeHash = 0
 
static const ThreadLocalKey kUnsetThreadLocalKey
 
static const ThreadLocalKey kUnsetThreadLocalKey
 
static const ThreadLocalKey kUnsetThreadLocalKey
 
static const ThreadLocalKey kUnsetThreadLocalKey
 
static const ThreadLocalKey kUnsetThreadLocalKey
 
static const ThreadLocalKey kUnsetThreadLocalKey = TLS_OUT_OF_INDEXES
 
static constexpr intptr_t kNewObjectAlignmentOffset
 
static constexpr intptr_t kOldObjectAlignmentOffset
 
static constexpr intptr_t kNewObjectBitPosition
 
static constexpr intptr_t kObjectAlignment
 
static constexpr intptr_t kObjectAlignmentLog2
 
static constexpr intptr_t kObjectAlignmentMask
 
static constexpr intptr_t kBoolValueBitPosition
 
static constexpr intptr_t kBoolValueMask = HostObjectAlignment::kBoolValueMask
 
static constexpr intptr_t kBoolVsNullBitPosition
 
static constexpr intptr_t kBoolVsNullMask
 
static constexpr intptr_t kTrueOffsetFromNull
 
static constexpr intptr_t kFalseOffsetFromNull
 
static constexpr intptr_t kObjectStartAlignment = 64
 
static constexpr uintptr_t kHeapBaseMask = 0
 
static constexpr intptr_t kMaxSamplesPerTick = 4
 
const int64_t kValidTimeStamp = 1
 
const uword kValidPc = 0xFF
 
static Randomglobal_random = nullptr
 
static Mutexglobal_random_mutex = nullptr
 
static constexpr bool kRegexpOptimization = true
 
static constexpr intptr_t kMaxLookaheadForBoyerMoore = 8
 
static constexpr int32_t kRangeEndMarker = Utf::kMaxCodePoint + 1
 
static constexpr int32_t kSpaceRanges []
 
static constexpr intptr_t kSpaceRangeCount = ARRAY_SIZE(kSpaceRanges)
 
static constexpr int32_t kWordRanges []
 
static constexpr intptr_t kWordRangeCount = ARRAY_SIZE(kWordRanges)
 
static constexpr int32_t kDigitRanges [] = {'0', '9' + 1, kRangeEndMarker}
 
static constexpr intptr_t kDigitRangeCount = ARRAY_SIZE(kDigitRanges)
 
static constexpr int32_t kSurrogateRanges [] = {0xd800, 0xe000, kRangeEndMarker}
 
static constexpr intptr_t kSurrogateRangeCount = ARRAY_SIZE(kSurrogateRanges)
 
static constexpr int32_t kLineTerminatorRanges []
 
static constexpr intptr_t kLineTerminatorRangeCount
 
const int BYTECODE_MASK = 0xff
 
const unsigned int MAX_FIRST_ARG = 0x7fffffu
 
const int BYTECODE_SHIFT = 8
 
static constexpr bool FLAG_regexp_possessive_quantifier = false
 
static const char * kUnicodeIdentity
 
static constexpr intptr_t kDefaultMaxSubtypeCacheEntries
 
static constexpr intptr_t kNumberOfSavedCpuRegisters = kNumberOfCpuRegisters
 
static constexpr intptr_t kNumberOfSavedFpuRegisters = kNumberOfFpuRegisters
 
static char * vm_name = nullptr
 
static StreamInfo *const streams_ []
 
static const MethodParameter *const get_isolate_params []
 
static const MethodParameter *const get_isolate_group_params []
 
static const MethodParameter *const set_stream_include_private_members_params []
 
static const MethodParameter *const get_memory_usage_params []
 
static const MethodParameter *const get_isolate_group_memory_usage_params []
 
static const MethodParameter *const get_isolate_pause_event_params []
 
static const MethodParameter *const get_scripts_params []
 
static const MethodParameter *const get_stack_params []
 
static const MethodParameter *const get_inbound_references_params []
 
static const MethodParameter *const get_retaining_path_params []
 
static const MethodParameter *const get_retained_size_params []
 
static const MethodParameter *const get_reachable_size_params []
 
static const MethodParameter *const invoke_params []
 
static const MethodParameter *const evaluate_params []
 
static const MethodParameter *const build_expression_evaluation_scope_params []
 
static const MethodParameter *const compile_expression_params []
 
static const MethodParameter *const evaluate_compiled_expression_params []
 
static const MethodParameter *const evaluate_in_frame_params []
 
static const MethodParameter *const get_instances_params []
 
static const MethodParameter *const get_instances_as_list_params []
 
static const MethodParameter *const get_ports_params []
 
static const char *const report_enum_names []
 
static const MethodParameter *const get_source_report_params []
 
static const MethodParameter *const reload_sources_params []
 
static const MethodParameter *const add_breakpoint_params []
 
static const MethodParameter *const add_breakpoint_with_script_uri_params []
 
static const MethodParameter *const add_breakpoint_at_entry_params []
 
static const MethodParameter *const add_breakpoint_at_activation_params []
 
static const MethodParameter *const remove_breakpoint_params []
 
static const MethodParameter *const get_isolate_metric_list_params []
 
static const MethodParameter *const get_isolate_metric_params []
 
static const MethodParameter *const get_vm_timeline_flags_params []
 
static const MethodParameter *const get_vm_timeline_micros_params []
 
static const MethodParameter *const clear_vm_timeline_params []
 
static const MethodParameter *const get_vm_timeline_params []
 
static const char *const step_enum_names []
 
static const Debugger::ResumeAction step_enum_values []
 
static const MethodParameter *const resume_params []
 
static const MethodParameter *const kill_params []
 
static const MethodParameter *const pause_params []
 
static const MethodParameter *const enable_profiler_params []
 
static const MethodParameter *const get_tag_profile_params []
 
static const MethodParameter *const get_cpu_samples_params []
 
static const MethodParameter *const get_allocation_traces_params []
 
static const MethodParameter *const clear_cpu_samples_params []
 
static const MethodParameter *const get_allocation_profile_params []
 
static const MethodParameter *const collect_all_garbage_params []
 
static const MethodParameter *const get_heap_map_params []
 
static const MethodParameter *const request_heap_snapshot_params []
 
static const MethodParameter *const get_process_memory_usage_params []
 
static const MethodParameter *const get_persistent_handles_params []
 
static const MethodParameter *const get_ports_private_params []
 
static const MethodParameter *const get_object_params []
 
static const MethodParameter *const get_implementation_fields_params []
 
static const MethodParameter *const get_object_store_params []
 
static const MethodParameter *const get_isolate_object_store_params []
 
static const MethodParameter *const get_class_list_params []
 
static const MethodParameter *const get_type_arguments_list_params []
 
static const MethodParameter *const get_version_params []
 
static const MethodParameter *const get_vm_params []
 
static const MethodParameter *const lookup_resolved_package_uris_params []
 
static const MethodParameter *const lookup_package_uris_params []
 
static const char *const exception_pause_mode_names []
 
static Dart_ExceptionPauseInfo exception_pause_mode_values []
 
static const MethodParameter *const set_exception_pause_mode_params []
 
static const MethodParameter *const set_isolate_pause_mode_params []
 
static const MethodParameter *const set_breakpoint_state_params []
 
static const MethodParameter *const get_flag_list_params []
 
static const MethodParameter *const set_flags_params []
 
static const MethodParameter *const set_library_debuggable_params []
 
static const MethodParameter *const set_name_params []
 
static const MethodParameter *const set_vm_name_params []
 
static const MethodParameter *const set_trace_class_allocation_params []
 
static const MethodParameter *const get_default_classes_aliases_params []
 
static const ServiceMethodDescriptor service_methods_ []
 
const FrameLayout invalid_frame_layout
 
const FrameLayout default_frame_layout
 
const FrameLayout bare_instructions_frame_layout
 
FrameLayout runtime_frame_layout = invalid_frame_layout
 
static constexpr uword kInterruptStackLimit = ~static_cast<uword>(0)
 
static constexpr int kDartFrameFixedSize = 4
 
static constexpr int kSavedPcSlotFromSp = -1
 
static constexpr int kFirstObjectSlotFromFp
 
static constexpr int kLastFixedObjectSlotFromFp = -2
 
static constexpr int kFirstLocalSlotFromFp = -3
 
static constexpr int kSavedCallerPpSlotFromFp = -2
 
static constexpr int kPcMarkerSlotFromFp = -1
 
static constexpr int kSavedCallerFpSlotFromFp = 0
 
static constexpr int kSavedCallerPcSlotFromFp = 1
 
static constexpr int kParamEndSlotFromFp = 1
 
static constexpr int kCallerSpSlotFromFp = 2
 
static constexpr int kLastParamSlotFromEntrySp = 0
 
static constexpr int kExitLinkSlotFromEntryFp = -28
 
constexpr intptr_t kCallbackSlotsBeforeSavedArguments = 2
 
static constexpr int kFfiCallerTypedDataSlotFromFp = kCallerSpSlotFromFp + 1
 
static constexpr int kDartFrameFixedSize = 4
 
static constexpr int kSavedPcSlotFromSp = -1
 
static constexpr int kFirstObjectSlotFromFp
 
static constexpr int kLastFixedObjectSlotFromFp = -2
 
static constexpr int kFirstLocalSlotFromFp = -3
 
static constexpr int kSavedCallerPpSlotFromFp = -2
 
static constexpr int kPcMarkerSlotFromFp = -1
 
static constexpr int kSavedCallerFpSlotFromFp = 0
 
static constexpr int kSavedCallerPcSlotFromFp = 1
 
static constexpr int kParamEndSlotFromFp = 1
 
static constexpr int kCallerSpSlotFromFp = 2
 
static constexpr int kLastParamSlotFromEntrySp = 0
 
static constexpr int kExitLinkSlotFromEntryFp = -23
 
static constexpr int kFfiCallerTypedDataSlotFromFp = kCallerSpSlotFromFp
 
static constexpr int kDartFrameFixedSize = 3
 
static constexpr int kSavedPcSlotFromSp = -1
 
static constexpr int kFirstObjectSlotFromFp
 
static constexpr int kLastFixedObjectSlotFromFp = -1
 
static constexpr int kFirstLocalSlotFromFp = -2
 
static constexpr int kPcMarkerSlotFromFp = -1
 
static constexpr int kSavedCallerFpSlotFromFp = 0
 
static constexpr int kSavedCallerPcSlotFromFp = 1
 
static constexpr int kParamEndSlotFromFp = 1
 
static constexpr int kCallerSpSlotFromFp = 2
 
static constexpr int kLastParamSlotFromEntrySp = 1
 
static constexpr int kSavedCallerPpSlotFromFp = kSavedCallerFpSlotFromFp
 
static constexpr int kExitLinkSlotFromEntryFp = -8
 
static constexpr int kFfiCallerTypedDataSlotFromFp = kCallerSpSlotFromFp
 
static constexpr int kDartFrameFixedSize = 4
 
static constexpr int kSavedPcSlotFromSp = -1
 
static constexpr int kFirstObjectSlotFromFp
 
static constexpr int kLastFixedObjectSlotFromFp = -4
 
static constexpr int kFirstLocalSlotFromFp = -5
 
static constexpr int kSavedCallerPpSlotFromFp = -4
 
static constexpr int kPcMarkerSlotFromFp = -3
 
static constexpr int kSavedCallerFpSlotFromFp = -2
 
static constexpr int kSavedCallerPcSlotFromFp = -1
 
static constexpr int kParamEndSlotFromFp = -1
 
static constexpr int kCallerSpSlotFromFp = 0
 
static constexpr int kLastParamSlotFromEntrySp = 0
 
static constexpr int kFfiCallerTypedDataSlotFromFp = kCallerSpSlotFromFp
 
static struct dart::NativeEntries BuiltinEntries [] = {STACKFRAME_NATIVE_LIST(REGISTER_FUNCTION)}
 
static constexpr int kDartFrameFixedSize = 4
 
static constexpr int kSavedPcSlotFromSp = -1
 
static constexpr int kFirstObjectSlotFromFp
 
static constexpr int kLastFixedObjectSlotFromFp = -2
 
static constexpr int kFirstLocalSlotFromFp = -3
 
static constexpr int kSavedCallerPpSlotFromFp = -2
 
static constexpr int kPcMarkerSlotFromFp = -1
 
static constexpr int kSavedCallerFpSlotFromFp = 0
 
static constexpr int kSavedCallerPcSlotFromFp = 1
 
static constexpr int kParamEndSlotFromFp = 1
 
static constexpr int kCallerSpSlotFromFp = 2
 
static constexpr int kLastParamSlotFromEntrySp = 1
 
static constexpr int kExitLinkSlotFromEntryFp = -11
 
static constexpr int kFfiCallerTypedDataSlotFromFp = kCallerSpSlotFromFp
 
static const char *const names []
 
static const double double_nan_constant = NAN
 
static const struct dart::ALIGN16 double_negate_constant = {0x8000000000000000ULL, 0x8000000000000000ULL}
 
static const struct dart::ALIGN16 double_abs_constant = {0x7FFFFFFFFFFFFFFFULL, 0x7FFFFFFFFFFFFFFFULL}
 
static const struct dart::ALIGN16 float_not_constant = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF}
 
static const struct dart::ALIGN16 float_negate_constant = {0x80000000, 0x80000000, 0x80000000, 0x80000000}
 
static const struct dart::ALIGN16 float_absolute_constant = {0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF}
 
static const struct dart::ALIGN16 float_zerow_constant = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000}
 
static const char * kTestResultStrings []
 
const char * kSubtypeRangeCheckScript
 
const char * kRecordSubtypeRangeCheckScript
 
static constexpr uintptr_t kAsciiWordMask = 0x80808080u
 
const uint8_t * platform_strong_dill = kPlatformStrongDill
 
const intptr_t platform_strong_dill_size = kPlatformStrongDillSize
 
static MallocGrowableArray< TestLibEntry > * test_libs_ = nullptr
 
static const char * kIsolateReloadTestLibSource
 
static struct dart::NativeEntries ReloadEntries [] = {RELOAD_NATIVE_LIST(REGISTER_FUNCTION)}
 
static constexpr intptr_t kSegmentCacheCapacity = 16
 
static Mutexsegment_cache_mutex = nullptr
 
static VirtualMemorysegment_cache [kSegmentCacheCapacity] = {nullptr}
 
static intptr_t segment_cache_size = 0
 
static constexpr int64_t kRssSlack = 20 * MB
 
static const size_t kSizes []
 

Typedef Documentation

◆ AbstractTypeSet

Definition at line 125 of file precompiler.h.

◆ BaseRuntimeEntry

Definition at line 23 of file runtime_entry.h.

◆ BinaryMathCFunction

typedef double(* dart::BinaryMathCFunction) (double x, double y)

Definition at line 3876 of file runtime_entry.cc.

◆ BootstrapNativeFunction

typedef ObjectPtr(* dart::BootstrapNativeFunction) (Thread *thread, Zone *zone, NativeArguments *arguments)

Definition at line 35 of file native_entry.h.

◆ BoundaryOp

typedef bool(* dart::BoundaryOp) (RangeBoundary *)

Definition at line 1959 of file range_analysis.cc.

◆ CanonicalFunctionTypeSet

Definition at line 214 of file canonical_tables.h.

◆ CanonicalInstancesSet

Definition at line 416 of file canonical_tables.h.

◆ Canonicalize

Definition at line 28 of file regexp_interpreter.cc.

◆ CanonicalRecordTypeSet

Definition at line 253 of file canonical_tables.h.

◆ CanonicalRegExpSet

Definition at line 475 of file canonical_tables.h.

◆ CanonicalStringSet

Definition at line 136 of file canonical_tables.h.

◆ CanonicalTypeArgumentsSet

Definition at line 335 of file canonical_tables.h.

◆ CanonicalTypeParameterSet

Definition at line 293 of file canonical_tables.h.

◆ CanonicalTypeSet

Definition at line 175 of file canonical_tables.h.

◆ CatchEntryMovesCache

Definition at line 130 of file isolate.h.

◆ CidRangeVector

Definition at line 253 of file il.h.

◆ ClassFunctionsSet

Definition at line 3312 of file object.cc.

◆ classid_t

typedef int32_t dart::classid_t

Definition at line 524 of file globals.h.

◆ ClassIdTagType

typedef int32_t dart::ClassIdTagType

Definition at line 20 of file class_id.h.

◆ ClassSet

Definition at line 105 of file precompiler.h.

◆ compressed_uword

typedef uintptr_t dart::compressed_uword

Definition at line 44 of file globals.h.

◆ compressed_word

typedef intptr_t dart::compressed_word

Definition at line 45 of file globals.h.

◆ CompressedObjectPtr

Definition at line 265 of file tagged_pointer.h.

◆ CoordUnOp

typedef Coord *(* dart::CoordUnOp) (Coord *coord)

Definition at line 576 of file ffi_test_functions.cc.

◆ cpp_vtable

Definition at line 163 of file globals.h.

◆ CpuRegisterSource

Definition at line 466 of file deopt_instructions.h.

◆ Dart_ActivationFrame

typedef struct _Dart_ActivationFrame* dart::Dart_ActivationFrame

Definition at line 17 of file debugger_api_impl_test.h.

◆ Dart_Breakpoint

typedef struct _Dart_Breakpoint* dart::Dart_Breakpoint

Definition at line 13 of file debugger_api_impl_test.h.

◆ Dart_BreakpointResolvedHandler

typedef void dart::Dart_BreakpointResolvedHandler(Dart_IsolateId isolate_id, intptr_t bp_id, const Dart_CodeLocation &location)

Definition at line 63 of file debugger_api_impl_test.h.

◆ Dart_ExceptionThrownHandler

typedef void dart::Dart_ExceptionThrownHandler(Dart_IsolateId isolate_id, Dart_Handle exception_object, Dart_StackTrace stack_trace)

Definition at line 37 of file debugger_api_impl_test.h.

◆ Dart_IsolateEventHandler

typedef void dart::Dart_IsolateEventHandler(Dart_IsolateId isolate_id, Dart_IsolateEvent kind)

Definition at line 56 of file debugger_api_impl_test.h.

◆ Dart_IsolateId

An id used to uniquely represent an Isolate in the debugger wire protocol messages.

Definition at line 23 of file debugger_api_impl_test.h.

◆ Dart_PausedEventHandler

typedef void dart::Dart_PausedEventHandler(Dart_IsolateId isolate_id, intptr_t bp_id, const Dart_CodeLocation &location)

Definition at line 59 of file debugger_api_impl_test.h.

◆ Dart_StackTrace

typedef struct _Dart_StackTrace* dart::Dart_StackTrace

Definition at line 15 of file debugger_api_impl_test.h.

◆ DefinitionIndexMap

Definition at line 40 of file write_barrier_elimination.cc.

◆ DeoptDoubleInstr

Definition at line 680 of file deopt_instructions.cc.

◆ DeoptFloat32x4Instr

Definition at line 687 of file deopt_instructions.cc.

◆ DeoptFloat64x2Instr

Definition at line 692 of file deopt_instructions.cc.

◆ DeoptFloatInstr

Definition at line 674 of file deopt_instructions.cc.

◆ DeoptInt32Instr

Definition at line 631 of file deopt_instructions.cc.

◆ DeoptInt32x4Instr

Definition at line 697 of file deopt_instructions.cc.

◆ DeoptMintInstr

Definition at line 635 of file deopt_instructions.cc.

◆ DeoptUint32Instr

Definition at line 627 of file deopt_instructions.cc.

◆ DispatcherSet

Definition at line 389 of file canonical_tables.h.

◆ EmitCharacterFunction

typedef bool dart::EmitCharacterFunction(Zone *zone, RegExpCompiler *compiler, uint16_t c, BlockLabel *on_failure, intptr_t cp_offset, bool check, bool preloaded)

Definition at line 971 of file regexp.cc.

◆ FfiCallbackFunctionSet

Definition at line 433 of file canonical_tables.h.

◆ FieldMappingArray

Definition at line 62 of file isolate_reload.h.

◆ FieldOffsetArray

using dart::FieldOffsetArray = typedef ZoneGrowableArray<intptr_t>

Definition at line 63 of file isolate_reload.h.

◆ FieldSet

Definition at line 66 of file parser.h.

◆ FlagHandler

typedef void(* dart::FlagHandler) (bool value)

Definition at line 28 of file flags.h.

◆ fpu_register_t

Definition at line 299 of file constants_arm.h.

◆ FpuRegister

Definition at line 295 of file constants_arm.h.

◆ FpuRegisterSource

Definition at line 467 of file deopt_instructions.h.

◆ FunctionHashMap

Definition at line 24 of file closure_functions_cache.cc.

◆ FunctionSet

Definition at line 83 of file precompiler.h.

◆ FunctionTypeSet

Definition at line 145 of file precompiler.h.

◆ HandlerInfoCache

Definition at line 128 of file isolate.h.

◆ HostObjectAlignment

Definition at line 48 of file pointer_tagging.h.

◆ InputsArray

Definition at line 895 of file il.h.

◆ InstanceSet

Definition at line 240 of file precompiler.h.

◆ InstantiationsCacheTable

Definition at line 13537 of file object.h.

◆ IntHashMap

Definition at line 902 of file hash_table.h.

◆ IntKeyHash

typedef uint32_t(* dart::IntKeyHash) (uint32_t key)

Definition at line 15 of file hashmap_test.cc.

◆ IntptrBinOp

typedef intptr_t(* dart::IntptrBinOp) (intptr_t a, intptr_t b)

Definition at line 588 of file ffi_test_functions.cc.

◆ invokestub

typedef uword(* dart::invokestub) (uword target_code, uword arguments_descriptor, uword arguments, Thread *thread)

Definition at line 75 of file dart_entry.cc.

◆ Latin1Array

typedef CharArray<uint8_t> dart::Latin1Array

Definition at line 40 of file canonical_tables.h.

◆ LibraryLookupMap

Definition at line 14643 of file object.cc.

◆ LocationArray

Definition at line 20 of file locations_helpers_test.cc.

◆ LogPrinter

typedef void(* dart::LogPrinter) (const char *data)

Definition at line 25 of file log.h.

◆ MarkerWorkList

Definition at line 294 of file pointer_block.h.

◆ MarkingStackBlock

Definition at line 293 of file pointer_block.h.

◆ MegamorphicCacheEntries

Definition at line 13534 of file object.h.

◆ MemMoveCFunction

typedef void *(* dart::MemMoveCFunction) (void *dest, const void *src, size_t n)

Definition at line 3877 of file runtime_entry.cc.

◆ MetadataMap

Definition at line 344 of file canonical_tables.h.

◆ MoveArgumentsArray

Definition at line 896 of file il.h.

◆ NativeAssetsMap

Definition at line 31 of file native_assets.h.

◆ NativeFunction

typedef void(* dart::NativeFunction) (NativeArguments *arguments)

Definition at line 29 of file native_function.h.

◆ NativeFunctionWrapper

typedef void(* dart::NativeFunctionWrapper) (Dart_NativeArguments args, Dart_NativeFunction func)

Definition at line 30 of file native_function.h.

◆ ObjectOffsetMap

Definition at line 192 of file image_snapshot.h.

◆ OptionHandler

typedef void(* dart::OptionHandler) (const char *value)

Definition at line 29 of file flags.h.

◆ ParallelScavengerVisitor

Definition at line 586 of file scavenger.cc.

◆ PointerSet

template<typename T >
using dart::PointerSet = typedef DirectChainedHashMap<PointerSetKeyValueTrait<T> >

Definition at line 382 of file hash_map.h.

◆ ProgramElementSet

Definition at line 220 of file precompiler.h.

◆ PromotionStackBlock

Definition at line 305 of file pointer_block.h.

◆ PromotionWorkList

Definition at line 306 of file pointer_block.h.

◆ RecordFieldNamesMap

Definition at line 27978 of file object.cc.

◆ RegExpCaptureName

using dart::RegExpCaptureName = typedef ZoneGrowableArray<uint16_t>

Definition at line 73 of file regexp_parser.h.

◆ RegList

typedef uint32_t dart::RegList

Definition at line 642 of file constants_arm.h.

◆ ReloadParticipationScope

Definition at line 1611 of file thread.h.

◆ RuntimeFunction

typedef void(* dart::RuntimeFunction) (NativeArguments arguments)

Definition at line 20 of file runtime_entry.h.

◆ serializable_type_t

template<typename T >
using dart::serializable_type_t = typedef typename unwrap_enum<std::remove_cv_t<T>, std::is_enum<T>::value>::type

Definition at line 632 of file il.h.

◆ SerialScavengerVisitor

Definition at line 585 of file scavenger.cc.

◆ ServiceMethodEntry

typedef void(* dart::ServiceMethodEntry) (Thread *thread, JSONStream *js)

Definition at line 877 of file service.cc.

◆ SignalAction

typedef void(* dart::SignalAction) (int signal, siginfo_t *info, void *context)

Definition at line 43 of file signal_handler.h.

◆ StackMapEntryIntMap

Definition at line 561 of file program_visitor.cc.

◆ StaticCallsTable

Definition at line 13519 of file object.h.

◆ StaticCallsTableEntry

Definition at line 13522 of file object.h.

◆ StoreBufferBlock

Definition at line 282 of file pointer_block.h.

◆ SubtypeTestCacheTable

Definition at line 13524 of file object.h.

◆ SymbolSet

Definition at line 71 of file precompiler.h.

◆ SyncMarkingVisitor

Definition at line 545 of file marker.cc.

◆ TableSelectorSet

Definition at line 51 of file precompiler.h.

◆ ThreadDestructor

typedef void(* dart::ThreadDestructor) (void *parameter)

Definition at line 69 of file os_thread_win.h.

◆ ThreadId

Definition at line 21 of file os_thread_absl.h.

◆ ThreadJoinId

Definition at line 22 of file os_thread_absl.h.

◆ ThreadLocalKey

Definition at line 20 of file os_thread_absl.h.

◆ TypeArgumentsSet

Definition at line 185 of file precompiler.h.

◆ TypeParameterSet

Definition at line 165 of file precompiler.h.

◆ UnaryMathCFunction

typedef double(* dart::UnaryMathCFunction) (double x)

Definition at line 3875 of file runtime_entry.cc.

◆ UniqueFunctionsMap

Definition at line 430 of file precompiler.h.

◆ UnsyncMarkingVisitor

Definition at line 544 of file marker.cc.

◆ UriMapping

Definition at line 5359 of file service.cc.

◆ URIs

Definition at line 1110 of file object.h.

◆ UTF16Array

typedef CharArray<uint16_t> dart::UTF16Array

Definition at line 41 of file canonical_tables.h.

◆ UTF32Array

typedef CharArray<int32_t> dart::UTF32Array

Definition at line 42 of file canonical_tables.h.

◆ uword

typedef uintptr_t dart::uword

Definition at line 501 of file globals.h.

◆ WeakCodeSet

Definition at line 27 of file weak_code.cc.

◆ word

typedef intptr_t dart::word

Definition at line 500 of file globals.h.

◆ Work

typedef std::function<void()> dart::Work

Definition at line 451 of file ffi_test_functions_vmspecific.cc.

◆ YieldPoints

Definition at line 15 of file yield_position_test.cc.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
kForwardingMask 
kNotForwarded 
kForwarded 

Definition at line 54 of file scavenger.cc.

54 {
55 kForwardingMask = 1 << UntaggedObject::kCardRememberedBit,
56 kNotForwarded = 0,
58};
@ kNotForwarded
Definition scavenger.cc:56
@ kForwardingMask
Definition scavenger.cc:55
@ kForwarded
Definition scavenger.cc:57

◆ anonymous enum

anonymous enum
Enumerator
kNoneFree 
kCurrentAndEnclosingFree 
kAllFree 

Definition at line 2905 of file object.h.

2905 {
2906 kNoneFree = 0,
2907
2908 // 'kCurrentAndEnclosingFree' is used when partially applying a signature
2909 // function to a set of type arguments. It indicates that the set of type
2910 // parameters declared by the current function and enclosing functions should
2911 // be considered free, and the current function type parameters should be
2912 // substituted as well.
2913 //
2914 // For instance, if the signature "<T>(T, R) => T" is instantiated with
2915 // function type arguments [int, String] and kCurrentAndEnclosingFree is
2916 // supplied, the result of the instantiation will be "(String, int) => int".
2918
2919 // Only parameters declared by enclosing functions are free.
2921};
@ kCurrentAndEnclosingFree
Definition object.h:2917
@ kAllFree
Definition object.h:2920
@ kNoneFree
Definition object.h:2906
constexpr int32_t kMaxInt32
Definition globals.h:483

◆ anonymous enum

anonymous enum
Enumerator
kSmiTag 
kHeapObjectTag 
kSmiTagSize 
kSmiTagMask 
kSmiTagShift 

Definition at line 88 of file pointer_tagging.h.

88 {
89 kSmiTag = 0,
91 kSmiTagSize = 1,
92 kSmiTagMask = 1,
93 kSmiTagShift = 1,
94};
@ kHeapObjectTag

◆ anonymous enum

anonymous enum
Enumerator
kPathsUriOffset 
kPathsSourceOffset 
kPathsEntryLength 

Definition at line 31 of file bootstrap.cc.

@ kPathsUriOffset
Definition bootstrap.cc:31
@ kPathsSourceOffset
Definition bootstrap.cc:31
@ kPathsEntryLength
Definition bootstrap.cc:31

◆ AddSubImmOp

Enumerator
AddSubImmMask 
AddSubImmFixed 
ADDI 
SUBI 

Definition at line 860 of file constants_arm64.h.

860 {
861 AddSubImmMask = 0x1f000000,
865};
@ DPImmediateFixed

◆ AddSubShiftExtOp

Enumerator
AddSubShiftExtMask 
AddSubShiftExtFixed 
ADD 
SUB 

Definition at line 905 of file constants_arm64.h.

905 {
906 AddSubShiftExtMask = 0x1f000000,
910};
@ DPRegisterFixed
@ AddSubShiftExtMask
@ AddSubShiftExtFixed

◆ AddSubWithCarryOp

Enumerator
AddSubWithCarryMask 
AddSubWithCarryFixed 
ADC 
SBC 

Definition at line 913 of file constants_arm64.h.

◆ AlignmentStrategy

Enumerator
kAlignedToValueSize 
kAlignedToValueSizeBut8AlignedTo4 
kAlignedToWordSize 
kAlignedToWordSizeAndValueSize 

Definition at line 11 of file constants_base.h.

11 {
12 // Align to the size of the value.
14 // Align to the size of the value, but align 8 byte-sized values to 4 bytes.
15 // Both double and int64.
17 // Align to the architecture size.
19 // Align to the greater of architecture size or value size.
21};
@ kAlignedToWordSizeAndValueSize
@ kAlignedToValueSizeBut8AlignedTo4
@ kAlignedToValueSize
@ kAlignedToWordSize

◆ AlignmentType

Enumerator
kUnalignedAccess 
kAlignedAccess 

Definition at line 6720 of file il.h.

6720 {
6723};
@ kUnalignedAccess
Definition il.h:6721
@ kAlignedAccess
Definition il.h:6722

◆ AtomicMemoryOp

Enumerator
AtomicMemoryMask 
AtomicMemoryFixed 
LDCLR 
LDSET 

Definition at line 829 of file constants_arm64.h.

829 {
830 AtomicMemoryMask = 0x3f200c00,
831 AtomicMemoryFixed = B29 | B28 | B27 | B21,
832 LDCLR = AtomicMemoryFixed | B12,
833 LDSET = AtomicMemoryFixed | B13 | B12,
834};
@ AtomicMemoryFixed
@ AtomicMemoryMask

◆ BitfieldOp

Enumerator
BitfieldMask 
BitfieldFixed 
SBFM 
BFM 
UBFM 
Bitfield64 

Definition at line 868 of file constants_arm64.h.

868 {
869 BitfieldMask = 0x1f800000,
870 BitfieldFixed = 0x13000000,
874 Bitfield64 = B31 | B22,
875};

◆ Bits

enum dart::Bits
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 
B28 
B29 
B30 
B31 

Definition at line 694 of file constants_arm64.h.

694 {
695 B0 = (1 << 0),
696 B1 = (1 << 1),
697 B2 = (1 << 2),
698 B3 = (1 << 3),
699 B4 = (1 << 4),
700 B5 = (1 << 5),
701 B6 = (1 << 6),
702 B7 = (1 << 7),
703 B8 = (1 << 8),
704 B9 = (1 << 9),
705 B10 = (1 << 10),
706 B11 = (1 << 11),
707 B12 = (1 << 12),
708 B13 = (1 << 13),
709 B14 = (1 << 14),
710 B15 = (1 << 15),
711 B16 = (1 << 16),
712 B17 = (1 << 17),
713 B18 = (1 << 18),
714 B19 = (1 << 19),
715 B20 = (1 << 20),
716 B21 = (1 << 21),
717 B22 = (1 << 22),
718 B23 = (1 << 23),
719 B24 = (1 << 24),
720 B25 = (1 << 25),
721 B26 = (1 << 26),
722 B27 = (1 << 27),
723 B28 = (1 << 28),
724 B29 = (1 << 29),
725 B30 = (1 << 30),
726 B31 = (1 << 31),
727};
static void B2(DFData *curr, int width)
static void B1(DFData *curr, int width)

◆ BlockAddressMode

Enumerator
DA 
IA 
DB 
IB 
DA_W 
IA_W 
DB_W 
IB_W 

Definition at line 37 of file assembler_arm.h.

37 {
38 // bit encoding P U W
39 DA = (0 | 0 | 0) << 21, // decrement after
40 IA = (0 | 4 | 0) << 21, // increment after
41 DB = (8 | 0 | 0) << 21, // decrement before
42 IB = (8 | 4 | 0) << 21, // increment before
43 DA_W = (0 | 0 | 1) << 21, // decrement after with writeback to base
44 IA_W = (0 | 4 | 1) << 21, // increment after with writeback to base
45 DB_W = (8 | 0 | 1) << 21, // decrement before with writeback to base
46 IB_W = (8 | 4 | 1) << 21 // increment before with writeback to base
47};

◆ ByteRegister [1/2]

Enumerator
AL 
CL 
DL 
BL 
AH 
CH 
DH 
BH 
kNumberOfByteRegisters 
kNoByteRegister 
AL 
CL 
DL 
BL 
AH 
CH 
DH 
BH 
SPL 
BPL 
SIL 
DIL 
R8B 
R9B 
R10B 
R11B 
R12B 
R13B 
R14B 
R15B 
kNumberOfByteRegisters 
kNoByteRegister 

Definition at line 37 of file constants_ia32.h.

37 {
38 AL = 0,
39 CL = 1,
40 DL = 2,
41 BL = 3,
42 AH = 4,
43 CH = 5,
44 DH = 6,
45 BH = 7,
47 kNoByteRegister = -1 // Signals an illegal register.
48};
@ kNoByteRegister
@ kNumberOfByteRegisters

◆ ByteRegister [2/2]

Enumerator
AL 
CL 
DL 
BL 
AH 
CH 
DH 
BH 
kNumberOfByteRegisters 
kNoByteRegister 
AL 
CL 
DL 
BL 
AH 
CH 
DH 
BH 
SPL 
BPL 
SIL 
DIL 
R8B 
R9B 
R10B 
R11B 
R12B 
R13B 
R14B 
R15B 
kNumberOfByteRegisters 
kNoByteRegister 

Definition at line 43 of file constants_x64.h.

43 {
44 AL = 0,
45 CL = 1,
46 DL = 2,
47 BL = 3,
48 AH = 4,
49 CH = 5,
50 DH = 6,
51 BH = 7,
52 SPL = 4 | 0x10,
53 BPL = 5 | 0x10,
54 SIL = 6 | 0x10,
55 DIL = 7 | 0x10,
56 R8B = 8,
57 R9B = 9,
58 R10B = 10,
59 R11B = 11,
60 R12B = 12,
61 R13B = 13,
62 R14B = 14,
63 R15B = 15,
65 kNoByteRegister = -1 // Signals an illegal register.
66};

◆ CheckType

enum class dart::CheckType
strong
Enumerator
kCannotBeChecked 
kNotSubtype 
kCidCheckOnly 
kNeedsFinalization 
kInstanceTypeArgumentsAreSubtypes 

Definition at line 464 of file type_testing_stubs.cc.

◆ ClassId

enum dart::ClassId : intptr_t
Enumerator
kIllegalCid 
kNativePointer 
kFreeListElement 
kForwardingCorpse 
kByteDataViewCid 
kUnmodifiableByteDataViewCid 
kByteBufferCid 
kNullCid 
kDynamicCid 
kVoidCid 
kNeverCid 
kNumPredefinedCids 

Definition at line 212 of file class_id.h.

212 : intptr_t {
213 // Illegal class id.
214 kIllegalCid = 0,
215
216 // Pseudo class id for native pointers, the heap should never see an
217 // object with this class id.
219
220 // The following entries describes classes for pseudo-objects in the heap
221 // that should never be reachable from live objects. Free list elements
222 // maintain the free list for old space, and forwarding corpses are used to
223 // implement one-way become.
226
227// List of Ids for predefined classes.
228#define DEFINE_OBJECT_KIND(clazz) k##clazz##Cid,
230#undef DEFINE_OBJECT_KIND
231
232// clang-format off
233#define DEFINE_OBJECT_KIND(clazz) kFfi##clazz##Cid,
235#undef DEFINE_OBJECT_KIND
236
237#define DEFINE_OBJECT_KIND(clazz) \
238 kTypedData##clazz##Cid, \
239 kTypedData##clazz##ViewCid, \
240 kExternalTypedData##clazz##Cid, \
241 kUnmodifiableTypedData##clazz##ViewCid,
243#undef DEFINE_OBJECT_KIND
246
248 // clang-format on
249
250 // The following entries do not describe a predefined class, but instead
251 // are class indexes for pre-allocated instances (Null, dynamic, void, Never).
252 kNullCid,
254 kVoidCid,
255 kNeverCid,
256
258};
#define DEFINE_OBJECT_KIND(clazz)
Definition class_id.h:228
#define CLASS_LIST_FFI(V)
Definition class_id.h:171
#define CLASS_LIST_TYPED_DATA(V)
Definition class_id.h:137
#define CLASS_LIST(V)
Definition class_id.h:208
@ kForwardingCorpse
Definition class_id.h:225
@ kIllegalCid
Definition class_id.h:214
@ kNullCid
Definition class_id.h:252
@ kNumPredefinedCids
Definition class_id.h:257
@ kNativePointer
Definition class_id.h:218
@ kByteDataViewCid
Definition class_id.h:244
@ kVoidCid
Definition class_id.h:254
@ kByteBufferCid
Definition class_id.h:247
@ kDynamicCid
Definition class_id.h:253
@ kNeverCid
Definition class_id.h:255
@ kFreeListElement
Definition class_id.h:224
@ kUnmodifiableByteDataViewCid
Definition class_id.h:245

◆ CodeEntryKind

enum class dart::CodeEntryKind
strong
Enumerator
kNormal 
kUnchecked 
kMonomorphic 
kMonomorphicUnchecked 

Definition at line 15 of file code_entry_kind.h.

15 {
16 // Normal entry into the function.
17 //
18 // Usually such entries perform type checks for all parameters which are not
19 // guaranteed to be type checked on the callee side. This can happen if
20 // parameter type depends on the type parameter of an enclosing class.
21 kNormal,
22
23 // Unchecked entry into the function.
24 //
25 // These entries usually skip most of the type checks that normal entries
26 // perform and are used when optimizing compiler can prove that those
27 // checks are not needed at a specific call site.
29
30 // Monomorphic entry into the function.
31 //
32 // In AOT mode we might patch call-site to directly invoke target function,
33 // which would then validate that it is invoked with the expected type of
34 // the receiver. This validation is handled by monomorphic entry, which then
35 // falls through to the normal entry.
37
38 // Similar to monomorphic entry but with a fallthrough into unchecked entry.
40};
@ kNormal
Default priority level.
Definition embedder.h:260

◆ CompareAndBranchOp

Enumerator
CompareAndBranchMask 
CompareAndBranchFixed 
CBZ 
CBNZ 

Definition at line 755 of file constants_arm64.h.

◆ CompilerTracing

enum class dart::CompilerTracing
strong
Enumerator
kOn 
kOff 

Definition at line 28 of file compiler_state.h.

◆ Condition [1/4]

Enumerator
kNoCondition 
EQ 
NE 
CS 
CC 
MI 
PL 
VS 
VC 
HI 
LS 
GE 
LT 
GT 
LE 
AL 
kSpecialCondition 
kNumberOfConditions 
EQUAL 
ZERO 
NOT_EQUAL 
NOT_ZERO 
LESS 
LESS_EQUAL 
GREATER_EQUAL 
GREATER 
UNSIGNED_LESS 
UNSIGNED_LESS_EQUAL 
UNSIGNED_GREATER 
UNSIGNED_GREATER_EQUAL 
OVERFLOW 
NO_OVERFLOW 
kInvalidCondition 
kNoCondition 
EQ 
NE 
CS 
CC 
MI 
PL 
VS 
VC 
HI 
LS 
GE 
LT 
GT 
LE 
AL 
NV 
kNumberOfConditions 
EQUAL 
ZERO 
NOT_EQUAL 
NOT_ZERO 
LESS 
LESS_EQUAL 
GREATER_EQUAL 
GREATER 
UNSIGNED_LESS 
UNSIGNED_LESS_EQUAL 
UNSIGNED_GREATER 
UNSIGNED_GREATER_EQUAL 
OVERFLOW 
NO_OVERFLOW 
kInvalidCondition 
kNoCondition 
EQ 
NE 
CS 
CC 
MI 
PL 
VS 
VC 
HI 
LS 
GE 
LT 
GT 
LE 
AL 
NV 
kNumberOfConditions 
EQUAL 
ZERO 
NOT_EQUAL 
NOT_ZERO 
LESS 
LESS_EQUAL 
GREATER_EQUAL 
GREATER 
UNSIGNED_LESS 
UNSIGNED_LESS_EQUAL 
UNSIGNED_GREATER 
UNSIGNED_GREATER_EQUAL 
OVERFLOW 
NO_OVERFLOW 
kInvalidCondition 
OVERFLOW 
NO_OVERFLOW 
BELOW 
ABOVE_EQUAL 
EQUAL 
NOT_EQUAL 
BELOW_EQUAL 
ABOVE 
SIGN 
NOT_SIGN 
PARITY_EVEN 
PARITY_ODD 
LESS 
GREATER_EQUAL 
LESS_EQUAL 
GREATER 
ZERO 
NOT_ZERO 
NEGATIVE 
POSITIVE 
CARRY 
NOT_CARRY 
UNSIGNED_LESS 
UNSIGNED_LESS_EQUAL 
UNSIGNED_GREATER 
UNSIGNED_GREATER_EQUAL 
kInvalidCondition 

Definition at line 765 of file constants_arm.h.

765 {
766 kNoCondition = -1,
767 EQ = 0, // equal
768 NE = 1, // not equal
769 CS = 2, // carry set/unsigned higher or same
770 CC = 3, // carry clear/unsigned lower
771 MI = 4, // minus/negative
772 PL = 5, // plus/positive or zero
773 VS = 6, // overflow
774 VC = 7, // no overflow
775 HI = 8, // unsigned higher
776 LS = 9, // unsigned lower or same
777 GE = 10, // signed greater than or equal
778 LT = 11, // signed less than
779 GT = 12, // signed greater than
780 LE = 13, // signed less than or equal
781 AL = 14, // always (unconditional)
782 kSpecialCondition = 15, // special condition (refer to section A3.2.1)
784
785 // Platform-independent variants declared for all platforms
786 EQUAL = EQ,
787 ZERO = EQUAL,
788 NOT_EQUAL = NE,
790 LESS = LT,
791 LESS_EQUAL = LE,
793 GREATER = GT,
798 OVERFLOW = VS,
799 NO_OVERFLOW = VC,
800
802};
#define EQUAL(field)
@ kNoCondition
@ GREATER_EQUAL
@ UNSIGNED_GREATER
@ kInvalidCondition
@ UNSIGNED_GREATER_EQUAL
@ kSpecialCondition
@ NO_OVERFLOW
@ UNSIGNED_LESS
@ kNumberOfConditions
@ UNSIGNED_LESS_EQUAL

◆ Condition [2/4]

Enumerator
kNoCondition 
EQ 
NE 
CS 
CC 
MI 
PL 
VS 
VC 
HI 
LS 
GE 
LT 
GT 
LE 
AL 
kSpecialCondition 
kNumberOfConditions 
EQUAL 
ZERO 
NOT_EQUAL 
NOT_ZERO 
LESS 
LESS_EQUAL 
GREATER_EQUAL 
GREATER 
UNSIGNED_LESS 
UNSIGNED_LESS_EQUAL 
UNSIGNED_GREATER 
UNSIGNED_GREATER_EQUAL 
OVERFLOW 
NO_OVERFLOW 
kInvalidCondition 
kNoCondition 
EQ 
NE 
CS 
CC 
MI 
PL 
VS 
VC 
HI 
LS 
GE 
LT 
GT 
LE 
AL 
NV 
kNumberOfConditions 
EQUAL 
ZERO 
NOT_EQUAL 
NOT_ZERO 
LESS 
LESS_EQUAL 
GREATER_EQUAL 
GREATER 
UNSIGNED_LESS 
UNSIGNED_LESS_EQUAL 
UNSIGNED_GREATER 
UNSIGNED_GREATER_EQUAL 
OVERFLOW 
NO_OVERFLOW 
kInvalidCondition 
kNoCondition 
EQ 
NE 
CS 
CC 
MI 
PL 
VS 
VC 
HI 
LS 
GE 
LT 
GT 
LE 
AL 
NV 
kNumberOfConditions 
EQUAL 
ZERO 
NOT_EQUAL 
NOT_ZERO 
LESS 
LESS_EQUAL 
GREATER_EQUAL 
GREATER 
UNSIGNED_LESS 
UNSIGNED_LESS_EQUAL 
UNSIGNED_GREATER 
UNSIGNED_GREATER_EQUAL 
OVERFLOW 
NO_OVERFLOW 
kInvalidCondition 
OVERFLOW 
NO_OVERFLOW 
BELOW 
ABOVE_EQUAL 
EQUAL 
NOT_EQUAL 
BELOW_EQUAL 
ABOVE 
SIGN 
NOT_SIGN 
PARITY_EVEN 
PARITY_ODD 
LESS 
GREATER_EQUAL 
LESS_EQUAL 
GREATER 
ZERO 
NOT_ZERO 
NEGATIVE 
POSITIVE 
CARRY 
NOT_CARRY 
UNSIGNED_LESS 
UNSIGNED_LESS_EQUAL 
UNSIGNED_GREATER 
UNSIGNED_GREATER_EQUAL 
kInvalidCondition 

Definition at line 641 of file constants_arm64.h.

641 {
642 kNoCondition = -1,
643 EQ = 0, // equal
644 NE = 1, // not equal
645 CS = 2, // carry set/unsigned higher or same
646 CC = 3, // carry clear/unsigned lower
647 MI = 4, // minus/negative
648 PL = 5, // plus/positive or zero
649 VS = 6, // overflow
650 VC = 7, // no overflow
651 HI = 8, // unsigned higher
652 LS = 9, // unsigned lower or same
653 GE = 10, // signed greater than or equal
654 LT = 11, // signed less than
655 GT = 12, // signed greater than
656 LE = 13, // signed less than or equal
657 AL = 14, // always (unconditional)
658 NV = 15, // special condition (refer to section C1.2.3)
660
661 // Platform-independent variants declared for all platforms
662 EQUAL = EQ,
663 ZERO = EQUAL,
664 NOT_EQUAL = NE,
666 LESS = LT,
667 LESS_EQUAL = LE,
669 GREATER = GT,
674 OVERFLOW = VS,
675 NO_OVERFLOW = VC,
676
678};

◆ Condition [3/4]

Enumerator
kNoCondition 
EQ 
NE 
CS 
CC 
MI 
PL 
VS 
VC 
HI 
LS 
GE 
LT 
GT 
LE 
AL 
kSpecialCondition 
kNumberOfConditions 
EQUAL 
ZERO 
NOT_EQUAL 
NOT_ZERO 
LESS 
LESS_EQUAL 
GREATER_EQUAL 
GREATER 
UNSIGNED_LESS 
UNSIGNED_LESS_EQUAL 
UNSIGNED_GREATER 
UNSIGNED_GREATER_EQUAL 
OVERFLOW 
NO_OVERFLOW 
kInvalidCondition 
kNoCondition 
EQ 
NE 
CS 
CC 
MI 
PL 
VS 
VC 
HI 
LS 
GE 
LT 
GT 
LE 
AL 
NV 
kNumberOfConditions 
EQUAL 
ZERO 
NOT_EQUAL 
NOT_ZERO 
LESS 
LESS_EQUAL 
GREATER_EQUAL 
GREATER 
UNSIGNED_LESS 
UNSIGNED_LESS_EQUAL 
UNSIGNED_GREATER 
UNSIGNED_GREATER_EQUAL 
OVERFLOW 
NO_OVERFLOW 
kInvalidCondition 
kNoCondition 
EQ 
NE 
CS 
CC 
MI 
PL 
VS 
VC 
HI 
LS 
GE 
LT 
GT 
LE 
AL 
NV 
kNumberOfConditions 
EQUAL 
ZERO 
NOT_EQUAL 
NOT_ZERO 
LESS 
LESS_EQUAL 
GREATER_EQUAL 
GREATER 
UNSIGNED_LESS 
UNSIGNED_LESS_EQUAL 
UNSIGNED_GREATER 
UNSIGNED_GREATER_EQUAL 
OVERFLOW 
NO_OVERFLOW 
kInvalidCondition 
OVERFLOW 
NO_OVERFLOW 
BELOW 
ABOVE_EQUAL 
EQUAL 
NOT_EQUAL 
BELOW_EQUAL 
ABOVE 
SIGN 
NOT_SIGN 
PARITY_EVEN 
PARITY_ODD 
LESS 
GREATER_EQUAL 
LESS_EQUAL 
GREATER 
ZERO 
NOT_ZERO 
NEGATIVE 
POSITIVE 
CARRY 
NOT_CARRY 
UNSIGNED_LESS 
UNSIGNED_LESS_EQUAL 
UNSIGNED_GREATER 
UNSIGNED_GREATER_EQUAL 
kInvalidCondition 

Definition at line 603 of file constants_riscv.h.

603 {
604 kNoCondition = -1,
605 EQ = 0, // equal
606 NE = 1, // not equal
607 CS = 2, // carry set/unsigned higher or same
608 CC = 3, // carry clear/unsigned lower
609 MI = 4, // minus/negative
610 PL = 5, // plus/positive or zero
611 VS = 6, // overflow
612 VC = 7, // no overflow
613 HI = 8, // unsigned higher
614 LS = 9, // unsigned lower or same
615 GE = 10, // signed greater than or equal
616 LT = 11, // signed less than
617 GT = 12, // signed greater than
618 LE = 13, // signed less than or equal
619 AL = 14, // always (unconditional)
620 NV = 15, // special condition (refer to section C1.2.3)
622
623 // Platform-independent variants declared for all platforms
624 EQUAL = EQ,
625 ZERO = EQUAL,
626 NOT_EQUAL = NE,
628 LESS = LT,
629 LESS_EQUAL = LE,
631 GREATER = GT,
636 OVERFLOW = VS,
637 NO_OVERFLOW = VC,
638
640};

◆ Condition [4/4]

Enumerator
kNoCondition 
EQ 
NE 
CS 
CC 
MI 
PL 
VS 
VC 
HI 
LS 
GE 
LT 
GT 
LE 
AL 
kSpecialCondition 
kNumberOfConditions 
EQUAL 
ZERO 
NOT_EQUAL 
NOT_ZERO 
LESS 
LESS_EQUAL 
GREATER_EQUAL 
GREATER 
UNSIGNED_LESS 
UNSIGNED_LESS_EQUAL 
UNSIGNED_GREATER 
UNSIGNED_GREATER_EQUAL 
OVERFLOW 
NO_OVERFLOW 
kInvalidCondition 
kNoCondition 
EQ 
NE 
CS 
CC 
MI 
PL 
VS 
VC 
HI 
LS 
GE 
LT 
GT 
LE 
AL 
NV 
kNumberOfConditions 
EQUAL 
ZERO 
NOT_EQUAL 
NOT_ZERO 
LESS 
LESS_EQUAL 
GREATER_EQUAL 
GREATER 
UNSIGNED_LESS 
UNSIGNED_LESS_EQUAL 
UNSIGNED_GREATER 
UNSIGNED_GREATER_EQUAL 
OVERFLOW 
NO_OVERFLOW 
kInvalidCondition 
kNoCondition 
EQ 
NE 
CS 
CC 
MI 
PL 
VS 
VC 
HI 
LS 
GE 
LT 
GT 
LE 
AL 
NV 
kNumberOfConditions 
EQUAL 
ZERO 
NOT_EQUAL 
NOT_ZERO 
LESS 
LESS_EQUAL 
GREATER_EQUAL 
GREATER 
UNSIGNED_LESS 
UNSIGNED_LESS_EQUAL 
UNSIGNED_GREATER 
UNSIGNED_GREATER_EQUAL 
OVERFLOW 
NO_OVERFLOW 
kInvalidCondition 
OVERFLOW 
NO_OVERFLOW 
BELOW 
ABOVE_EQUAL 
EQUAL 
NOT_EQUAL 
BELOW_EQUAL 
ABOVE 
SIGN 
NOT_SIGN 
PARITY_EVEN 
PARITY_ODD 
LESS 
GREATER_EQUAL 
LESS_EQUAL 
GREATER 
ZERO 
NOT_ZERO 
NEGATIVE 
POSITIVE 
CARRY 
NOT_CARRY 
UNSIGNED_LESS 
UNSIGNED_LESS_EQUAL 
UNSIGNED_GREATER 
UNSIGNED_GREATER_EQUAL 
kInvalidCondition 

Definition at line 12 of file constants_x86.h.

12 {
13 OVERFLOW = 0,
14 NO_OVERFLOW = 1,
15 BELOW = 2,
16 ABOVE_EQUAL = 3,
17 EQUAL = 4,
18 NOT_EQUAL = 5,
19 BELOW_EQUAL = 6,
20 ABOVE = 7,
21 SIGN = 8,
22 NOT_SIGN = 9,
23 PARITY_EVEN = 10,
24 PARITY_ODD = 11,
25 LESS = 12,
26 GREATER_EQUAL = 13,
27 LESS_EQUAL = 14,
28 GREATER = 15,
29
30 ZERO = EQUAL,
32 NEGATIVE = SIGN,
34 CARRY = BELOW,
36
37 // Platform-independent variants declared for all platforms
38 // EQUAL,
39 // NOT_EQUAL,
40 // LESS,
41 // LESS_EQUAL,
42 // GREATER_EQUAL,
43 // GREATER,
48
50};
@ NOT_CARRY
@ BELOW_EQUAL
@ PARITY_ODD
@ ABOVE_EQUAL
@ PARITY_EVEN

◆ ConditionalBranchOp

Enumerator
ConditionalBranchMask 
ConditionalBranchFixed 
BCOND 

Definition at line 763 of file constants_arm64.h.

◆ ConditionalSelectOp

Enumerator
ConditionalSelectMask 
ConditionalSelectFixed 
CSEL 
CSINC 
CSINV 
CSNEG 

Definition at line 921 of file constants_arm64.h.

◆ ContainedInLattice

Enumerator
kNotYet 
kLatticeIn 
kLatticeOut 
kLatticeUnknown 

Definition at line 1080 of file regexp.h.

1080 {
1081 kNotYet = 0,
1082 kLatticeIn = 1,
1083 kLatticeOut = 2,
1084 kLatticeUnknown = 3 // Can also mean both in and out.
1085};
@ kLatticeOut
Definition regexp.h:1083
@ kLatticeUnknown
Definition regexp.h:1084
@ kNotYet
Definition regexp.h:1081
@ kLatticeIn
Definition regexp.h:1082

◆ COpcode

Enumerator
C_OP_MASK 
C_ADDI4SPN 
C_FLD 
C_LW 
C_FLW 
C_LD 
C_FSD 
C_SW 
C_FSW 
C_SD 
C_ADDI 
C_JAL 
C_ADDIW 
C_LI 
C_ADDI16SP 
C_LUI 
C_MISCALU 
C_MISCALU_MASK 
C_SRLI 
C_SRAI 
C_ANDI 
C_RR 
C_RR_MASK 
C_SUB 
C_XOR 
C_OR 
C_AND 
C_SUBW 
C_ADDW 
C_J 
C_BEQZ 
C_BNEZ 
C_SLLI 
C_FLDSP 
C_LWSP 
C_FLWSP 
C_LDSP 
C_JR 
C_MV 
C_JALR 
C_ADD 
C_FSDSP 
C_SWSP 
C_FSWSP 
C_SDSP 
C_NOP 
C_EBREAK 

Definition at line 1424 of file constants_riscv.h.

1424 {
1425 C_OP_MASK = 0b1110000000000011,
1426
1427 C_ADDI4SPN = 0b0000000000000000,
1428 C_FLD = 0b0010000000000000,
1429 C_LW = 0b0100000000000000,
1430 C_FLW = 0b0110000000000000,
1431 C_LD = 0b0110000000000000,
1432 C_FSD = 0b1010000000000000,
1433 C_SW = 0b1100000000000000,
1434 C_FSW = 0b1110000000000000,
1435 C_SD = 0b1110000000000000,
1436
1437 C_ADDI = 0b0000000000000001,
1438 C_JAL = 0b0010000000000001,
1439 C_ADDIW = 0b0010000000000001,
1440 C_LI = 0b0100000000000001,
1441 C_ADDI16SP = 0b0110000000000001,
1442 C_LUI = 0b0110000000000001,
1443
1444 C_MISCALU = 0b1000000000000001,
1445 C_MISCALU_MASK = 0b1110110000000011,
1446 C_SRLI = 0b1000000000000001,
1447 C_SRAI = 0b1000010000000001,
1448 C_ANDI = 0b1000100000000001,
1449 C_RR = 0b1000110000000001,
1450 C_RR_MASK = 0b1111110001100011,
1451 C_SUB = 0b1000110000000001,
1452 C_XOR = 0b1000110000100001,
1453 C_OR = 0b1000110001000001,
1454 C_AND = 0b1000110001100001,
1455 C_SUBW = 0b1001110000000001,
1456 C_ADDW = 0b1001110000100001,
1457
1458 C_J = 0b1010000000000001,
1459 C_BEQZ = 0b1100000000000001,
1460 C_BNEZ = 0b1110000000000001,
1461
1462 C_SLLI = 0b0000000000000010,
1463 C_FLDSP = 0b0010000000000010,
1464 C_LWSP = 0b0100000000000010,
1465 C_FLWSP = 0b0110000000000010,
1466 C_LDSP = 0b0110000000000010,
1467 C_JR = 0b1000000000000010,
1468 C_MV = 0b1000000000000010,
1469 C_JALR = 0b1001000000000010,
1470 C_ADD = 0b1001000000000010,
1471 C_FSDSP = 0b1010000000000010,
1472 C_SWSP = 0b1100000000000010,
1473 C_FSWSP = 0b1110000000000010,
1474 C_SDSP = 0b1110000000000010,
1475
1476 C_NOP = 0b0000000000000001,
1477 C_EBREAK = 0b1001000000000010,
1478};

◆ CpuInfoIndices

Enumerator
kCpuInfoProcessor 
kCpuInfoModel 
kCpuInfoHardware 
kCpuInfoFeatures 
kCpuInfoArchitecture 
kCpuInfoMax 

Definition at line 15 of file cpuinfo.h.

15 {
17 kCpuInfoModel = 1,
21 kCpuInfoMax = 5,
22};
@ kCpuInfoFeatures
Definition cpuinfo.h:19
@ kCpuInfoArchitecture
Definition cpuinfo.h:20
@ kCpuInfoProcessor
Definition cpuinfo.h:16
@ kCpuInfoHardware
Definition cpuinfo.h:18
@ kCpuInfoMax
Definition cpuinfo.h:21
@ kCpuInfoModel
Definition cpuinfo.h:17

◆ CpuInfoMethod

Enumerator
kCpuInfoCpuId 
kCpuInfoSystem 
kCpuInfoNone 
kCpuInfoDefault 

Definition at line 25 of file cpuinfo.h.

25 {
26 // Use the cpuid instruction.
28
29 // Use system calls.
31
32 // Don't query anything.
34
35 // Use whatever the default is for a particular OS:
36 // Linux, Windows -> CpuId,
37 // Android, MacOS -> System.
39};
@ kCpuInfoNone
Definition cpuinfo.h:33
@ kCpuInfoDefault
Definition cpuinfo.h:38
@ kCpuInfoCpuId
Definition cpuinfo.h:27
@ kCpuInfoSystem
Definition cpuinfo.h:30

◆ CSEMode

Enumerator
kOptimizeLoads 
kOptimizeStores 

Definition at line 1369 of file redundancy_elimination.cc.

◆ Dart_ExceptionPauseInfo

Enumerator
kNoPauseOnExceptions 
kPauseOnUnhandledExceptions 
kPauseOnAllExceptions 
kInvalidExceptionPauseInfo 

Definition at line 502 of file debugger.h.

502 {
507} Dart_ExceptionPauseInfo;
@ kInvalidExceptionPauseInfo
Definition debugger.h:506
@ kPauseOnUnhandledExceptions
Definition debugger.h:504
@ kNoPauseOnExceptions
Definition debugger.h:503
@ kPauseOnAllExceptions
Definition debugger.h:505

◆ Dart_IsolateEvent

Enumerator
kCreated 
kInterrupted 
kShutdown 

Definition at line 41 of file debugger_api_impl_test.h.

41 {
42 kCreated = 0,
45} Dart_IsolateEvent;

◆ DeoptStubKind

Enumerator
kLazyDeoptFromReturn 
kLazyDeoptFromThrow 
kEagerDeopt 

Definition at line 255 of file stub_code_compiler.h.

◆ DRegister

Enumerator
kNoDRegister 
D0 
D1 
D2 
D3 
D4 
D5 
D6 
D7 
D8 
D9 
D10 
D11 
D12 
D13 
D14 
D15 
D16 
D17 
D18 
D19 
D20 
D21 
D22 
D23 
D24 
D25 
D26 
D27 
D28 
D29 
D30 
D31 
kNumberOfDRegisters 
kNumberOfOverlappingDRegisters 

Definition at line 154 of file constants_arm.h.

154 {
155 kNoDRegister = -1,
156 D0 = 0,
157 D1 = 1,
158 D2 = 2,
159 D3 = 3,
160 D4 = 4,
161 D5 = 5,
162 D6 = 6,
163 D7 = 7,
164 D8 = 8,
165 D9 = 9,
166 D10 = 10,
167 D11 = 11,
168 D12 = 12,
169 D13 = 13,
170 D14 = 14,
171 D15 = 15,
172#if defined(VFPv3_D16)
174 // Leaving these defined, but marking them as kNoDRegister to avoid polluting
175 // other parts of the code with #ifdef's. Instead, query kNumberOfDRegisters
176 // to see which registers are valid.
193#else
194 D16 = 16,
195 D17 = 17,
196 D18 = 18,
197 D19 = 19,
198 D20 = 20,
199 D21 = 21,
200 D22 = 22,
201 D23 = 23,
202 D24 = 24,
203 D25 = 25,
204 D26 = 26,
205 D27 = 27,
206 D28 = 28,
207 D29 = 29,
208 D30 = 30,
209 D31 = 31,
211#endif
212 // Number of D registers that overlap S registers.
213 // One D register overlaps two S registers, so regardless of the numbers of D
214 // registers, there are only 32 S registers that are overlapped.
216};
@ kNumberOfDRegisters
@ kNoDRegister
@ kNumberOfOverlappingDRegisters

◆ EntryPointPragma

enum class dart::EntryPointPragma
strong
Enumerator
kAlways 
kNever 
kGetterOnly 
kSetterOnly 
kCallOnly 

Definition at line 4344 of file object.h.

4344 {
4345 kAlways,
4346 kNever,
4349 kCallOnly
4350};
constexpr auto kNever
Definition SkSLTest.cpp:958

◆ ExceptionGenOp

Enumerator
ExceptionGenMask 
ExceptionGenFixed 
SVC 
BRK 
HLT 

Definition at line 770 of file constants_arm64.h.

770 {
771 ExceptionGenMask = 0xff000000,
773 SVC = ExceptionGenFixed | B0,
774 BRK = ExceptionGenFixed | B21,
775 HLT = ExceptionGenFixed | B22,
776};
@ ExceptionGenFixed
@ ExceptionGenMask

◆ ExperimentalFeature

enum class dart::ExperimentalFeature
strong
Enumerator
inference_update_3 
inline_class 
inference_update_2 
sealed_class 
class_modifiers 
records 
patterns 
unnamed_libraries 
inference_update_1 
enhanced_enums 
named_arguments_anywhere 
super_parameters 
constructor_tearoffs 
generic_metadata 
triple_shift 
nonfunction_type_aliases 
non_nullable 
extension_methods 
constant_update_2018 
control_flow_collections 
set_literals 
spread_collections 

Definition at line 14 of file experimental_features.h.

14 {
20 records,
21 patterns,
37};

◆ Extend

Enumerator
kNoExtend 
UXTB 
UXTH 
UXTW 
UXTX 
SXTB 
SXTH 
SXTW 
SXTX 
kMaxExtend 

Definition at line 1142 of file constants_arm64.h.

1142 {
1143 kNoExtend = -1,
1144 UXTB = 0, // Zero extend byte.
1145 UXTH = 1, // Zero extend halfword (16 bits).
1146 UXTW = 2, // Zero extend word (32 bits).
1147 UXTX = 3, // Zero extend doubleword (64 bits).
1148 SXTB = 4, // Sign extend byte.
1149 SXTH = 5, // Sign extend halfword (16 bits).
1150 SXTW = 6, // Sign extend word (32 bits).
1151 SXTX = 7, // Sign extend doubleword (64 bits).
1152 kMaxExtend = 8,
1153};

◆ ExtensionStrategy

Enumerator
kNotExtended 
kExtendedTo4 
kExtendedTo8 

Definition at line 24 of file constants_base.h.

24 {
25 // Values can have arbitrary small size with the upper bits undefined.
26 kNotExtended,
27 // Values smaller than 4 bytes are passed around zero- or sign-extended to
28 // 4 bytes.
30 // Values smaller than 8 bytes are passed around zero- or sign-extended to
31 // 8 bytes.
33};
@ kExtendedTo4
@ kExtendedTo8

◆ FClass

Enumerator
kFClassNegInfinity 
kFClassNegNormal 
kFClassNegSubnormal 
kFClassNegZero 
kFClassPosZero 
kFClassPosSubnormal 
kFClassPosNormal 
kFClassPosInfinity 
kFClassSignallingNan 
kFClassQuietNan 

Definition at line 924 of file constants_riscv.h.

924 {
925 kFClassNegInfinity = 1 << 0,
926 kFClassNegNormal = 1 << 1,
927 kFClassNegSubnormal = 1 << 2,
928 kFClassNegZero = 1 << 3,
929 kFClassPosZero = 1 << 4,
930 kFClassPosSubnormal = 1 << 5,
931 kFClassPosNormal = 1 << 6,
932 kFClassPosInfinity = 1 << 7,
933 kFClassSignallingNan = 1 << 8,
934 kFClassQuietNan = 1 << 9,
935};
@ kFClassNegSubnormal
@ kFClassPosInfinity
@ kFClassQuietNan
@ kFClassSignallingNan
@ kFClassNegNormal
@ kFClassNegInfinity
@ kFClassPosSubnormal
@ kFClassPosNormal

◆ FcvtRs2

Enumerator
WU 
LU 

Definition at line 917 of file constants_riscv.h.

917 {
918 W = 0b00000,
919 WU = 0b00001,
920 L = 0b00010,
921 LU = 0b00011,
922};
#define W
Definition aaa.cpp:17

◆ FfiCallbackKind

enum class dart::FfiCallbackKind : uint8_t
strong
Enumerator
kIsolateLocalStaticCallback 
kIsolateLocalClosureCallback 
kAsyncCallback 

Definition at line 2964 of file object.h.

◆ FPCompareOp

Enumerator
FPCompareMask 
FPCompareFixed 
FCMPD 
FCMPZD 

Definition at line 1041 of file constants_arm64.h.

1041 {
1042 FPCompareMask = 0xffa0fc07,
1043 FPCompareFixed = FPFixed | B21 | B13,
1044 FCMPD = FPCompareFixed | B22,
1045 FCMPZD = FPCompareFixed | B22 | B3,
1046};

◆ FPImmOp

Enumerator
FPImmMask 
FPImmFixed 
FMOVSI 
FMOVDI 

Definition at line 1071 of file constants_arm64.h.

1071 {
1072 FPImmMask = 0x5f201c00,
1073 FPImmFixed = FPFixed | B21 | B12,
1075 FMOVDI = FPImmFixed | B22,
1076};

◆ FPIntCvtOp

Enumerator
FPIntCvtMask 
FPIntCvtFixed 
FMOVRS 
FMOVSR 
FMOVRD 
FMOVDR 
FCVTZS_D 
FCVTMS_D 
FCVTPS_D 
SCVTFD 

Definition at line 1079 of file constants_arm64.h.

1079 {
1080 FPIntCvtMask = 0x5f00fc00,
1081 FPIntCvtFixed = FPFixed | B21,
1082 FMOVRS = FPIntCvtFixed | B18 | B17,
1083 FMOVSR = FPIntCvtFixed | B18 | B17 | B16,
1084 FMOVRD = FPIntCvtFixed | B22 | B18 | B17,
1085 FMOVDR = FPIntCvtFixed | B22 | B18 | B17 | B16,
1086 FCVTZS_D = FPIntCvtFixed | B22 | B20 | B19,
1087 FCVTMS_D = FPIntCvtFixed | B22 | B20,
1088 FCVTPS_D = FPIntCvtFixed | B22 | B19,
1089 SCVTFD = FPIntCvtFixed | B22 | B17,
1090};

◆ FPOneSourceOp

Enumerator
FPOneSourceMask 
FPOneSourceFixed 
FMOVDD 
FABSD 
FNEGD 
FSQRTD 
FCVTDS 
FCVTSD 

Definition at line 1049 of file constants_arm64.h.

1049 {
1050 FPOneSourceMask = 0x5f207c00,
1051 FPOneSourceFixed = FPFixed | B21 | B14,
1052 FMOVDD = FPOneSourceFixed | B22,
1053 FABSD = FPOneSourceFixed | B22 | B15,
1054 FNEGD = FPOneSourceFixed | B22 | B16,
1055 FSQRTD = FPOneSourceFixed | B22 | B16 | B15,
1056 FCVTDS = FPOneSourceFixed | B15 | B17,
1057 FCVTSD = FPOneSourceFixed | B22 | B17,
1058};

◆ FPTwoSourceOp

Enumerator
FPTwoSourceMask 
FPTwoSourceFixed 
FMULD 
FDIVD 
FADDD 
FSUBD 

Definition at line 1061 of file constants_arm64.h.

1061 {
1062 FPTwoSourceMask = 0xff200c00,
1063 FPTwoSourceFixed = FPFixed | B21 | B11,
1064 FMULD = FPTwoSourceFixed | B22,
1065 FDIVD = FPTwoSourceFixed | B22 | B12,
1066 FADDD = FPTwoSourceFixed | B22 | B13,
1067 FSUBD = FPTwoSourceFixed | B22 | B13 | B12,
1068};

◆ FRegister

Enumerator
FT0 
FT1 
FT2 
FT3 
FT4 
FT5 
FT6 
FT7 
FS0 
FS1 
FA0 
FA1 
FA2 
FA3 
FA4 
FA5 
FA6 
FA7 
FS2 
FS3 
FS4 
FS5 
FS6 
FS7 
FS8 
FS9 
FS10 
FS11 
FT8 
FT9 
FT10 
FT11 

Definition at line 99 of file constants_riscv.h.

99 {
100 FT0 = 0,
101 FT1 = 1,
102 FT2 = 2,
103 FT3 = 3,
104 FT4 = 4,
105 FT5 = 5,
106 FT6 = 6,
107 FT7 = 7,
108 FS0 = 8,
109 FS1 = 9,
110 FA0 = 10,
111 FA1 = 11,
112 FA2 = 12,
113 FA3 = 13,
114 FA4 = 14,
115 FA5 = 15,
116 FA6 = 16,
117 FA7 = 17,
118 FS2 = 18,
119 FS3 = 19,
120 FS4 = 20,
121 FS5 = 21,
122 FS6 = 22,
123 FS7 = 23,
124 FS8 = 24,
125 FS9 = 25,
126 FS10 = 26,
127 FS11 = 27,
128 FT8 = 28,
129 FT9 = 29,
130 FT10 = 30,
131 FT11 = 31,
133 kNoFpuRegister = -1,
134};
const int kNumberOfFpuRegisters

◆ Funct12

Enumerator
ECALL 
EBREAK 

Definition at line 730 of file constants_riscv.h.

730 {
731 ECALL = 0,
732 EBREAK = 1,
733};

◆ Funct2

Enumerator
F2_S 
F2_D 

Definition at line 903 of file constants_riscv.h.

903 {
904 F2_S = 0b00,
905 F2_D = 0b01,
906};

◆ Funct3

Enumerator
F3_0 
F3_1 
BEQ 
BNE 
BLT 
BGE 
BLTU 
BGEU 
LB 
LH 
LW 
LBU 
LHU 
LWU 
LD 
SB 
SH 
SW 
SD 
ADDI 
SLLI 
SLTI 
SLTIU 
XORI 
SRI 
ORI 
ANDI 
ADD 
SLL 
SLT 
SLTU 
XOR 
SR 
OR 
AND 
FENCE 
FENCEI 
CSRRW 
CSRRS 
CSRRC 
CSRRWI 
CSRRSI 
CSRRCI 
MUL 
MULH 
MULHSU 
MULHU 
DIV 
DIVU 
REM 
REMU 
MULW 
DIVW 
DIVUW 
REMW 
REMUW 
WIDTH32 
WIDTH64 
JN 
JX 
FMIN 
FMAX 
FEQ 
FLT 
FLE 
SH1ADD 
SH2ADD 
SH3ADD 
F3_COUNT 
MAX 
MAXU 
MIN 
MINU 
CLMUL 
CLMULH 
CLMULR 
SEXT 
ZEXT 
ROL 
ROR 
BCLR 
BEXT 
F3_BINV 
F3_BSET 

Definition at line 735 of file constants_riscv.h.

735 {
736 F3_0 = 0,
737 F3_1 = 1,
738
739 BEQ = 0b000,
740 BNE = 0b001,
741 BLT = 0b100,
742 BGE = 0b101,
743 BLTU = 0b110,
744 BGEU = 0b111,
745
746 LB = 0b000,
747 LH = 0b001,
748 LW = 0b010,
749 LBU = 0b100,
750 LHU = 0b101,
751 LWU = 0b110,
752 LD = 0b011,
753
754 SB = 0b000,
755 SH = 0b001,
756 SW = 0b010,
757 SD = 0b011,
758
759 ADDI = 0b000,
760 SLLI = 0b001,
761 SLTI = 0b010,
762 SLTIU = 0b011,
763 XORI = 0b100,
764 SRI = 0b101,
765 ORI = 0b110,
766 ANDI = 0b111,
767
768 ADD = 0b000,
769 SLL = 0b001,
770 SLT = 0b010,
771 SLTU = 0b011,
772 XOR = 0b100,
773 SR = 0b101,
774 OR = 0b110,
775 AND = 0b111,
776
777 FENCE = 0b000,
778 FENCEI = 0b001,
779
780 CSRRW = 0b001,
781 CSRRS = 0b010,
782 CSRRC = 0b011,
783 CSRRWI = 0b101,
784 CSRRSI = 0b110,
785 CSRRCI = 0b111,
786
787 MUL = 0b000,
788 MULH = 0b001,
789 MULHSU = 0b010,
790 MULHU = 0b011,
791 DIV = 0b100,
792 DIVU = 0b101,
793 REM = 0b110,
794 REMU = 0b111,
795
796 MULW = 0b000,
797 DIVW = 0b100,
798 DIVUW = 0b101,
799 REMW = 0b110,
800 REMUW = 0b111,
801
802 WIDTH32 = 0b010,
803 WIDTH64 = 0b011,
804
805 S = 0b010,
806 D = 0b011,
807 J = 0b000,
808 JN = 0b001,
809 JX = 0b010,
810 FMIN = 0b000,
811 FMAX = 0b001,
812 FEQ = 0b010,
813 FLT = 0b001,
814 FLE = 0b000,
815
816 SH1ADD = 0b010,
817 SH2ADD = 0b100,
818 SH3ADD = 0b110,
819
820 F3_COUNT = 0b001,
821
822 MAX = 0b110,
823 MAXU = 0b111,
824 MIN = 0b100,
825 MINU = 0b101,
826 CLMUL = 0b001,
827 CLMULH = 0b011,
828 CLMULR = 0b010,
829
830 SEXT = 0b001,
831 ZEXT = 0b100,
832
833 ROL = 0b001,
834 ROR = 0b101,
835
836 BCLR = 0b001,
837 BEXT = 0b101,
838 F3_BINV = 0b001,
839 F3_BSET = 0b001,
840};
static const double J
constexpr SkScalar SH
Definition beziers.cpp:21
constexpr SkScalar SW
Definition strokes.cpp:37
#define LH

◆ Funct5

Enumerator
LR 
SC 
AMOSWAP 
AMOADD 
AMOXOR 
AMOAND 
AMOOR 
AMOMIN 
AMOMAX 
AMOMINU 
AMOMAXU 

Definition at line 889 of file constants_riscv.h.

889 {
890 LR = 0b00010,
891 SC = 0b00011,
892 AMOSWAP = 0b00001,
893 AMOADD = 0b00000,
894 AMOXOR = 0b00100,
895 AMOAND = 0b01100,
896 AMOOR = 0b01000,
897 AMOMIN = 0b10000,
898 AMOMAX = 0b10100,
899 AMOMINU = 0b11000,
900 AMOMAXU = 0b11100,
901};
#define LR

◆ Funct7

Enumerator
F7_0 
SRA 
SUB 
MULDIV 
FADDS 
FSUBS 
FMULS 
FDIVS 
FSQRTS 
FSGNJS 
FMINMAXS 
FCMPS 
FCLASSS 
FCVTintS 
FCVTSint 
FMVXW 
FMVWX 
FADDD 
FSUBD 
FMULD 
FDIVD 
FSQRTD 
FSGNJD 
FMINMAXD 
FCVTS 
FCVTD 
FCMPD 
FCLASSD 
FCVTintD 
FCVTDint 
FMVXD 
FMVDX 
ADDUW 
SHADD 
SLLIUW 
COUNT 
MINMAXCLMUL 
ROTATE 
BCLRBEXT 
BINV 
BSET 

Definition at line 842 of file constants_riscv.h.

842 {
843 F7_0 = 0,
844 SRA = 0b0100000,
845 SUB = 0b0100000,
846 MULDIV = 0b0000001,
847
848 FADDS = 0b0000000,
849 FSUBS = 0b0000100,
850 FMULS = 0b0001000,
851 FDIVS = 0b0001100,
852 FSQRTS = 0b0101100,
853 FSGNJS = 0b0010000,
854 FMINMAXS = 0b0010100,
855 FCMPS = 0b1010000,
856 FCLASSS = 0b1110000,
857 FCVTintS = 0b1100000,
858 FCVTSint = 0b1101000,
859 FMVXW = 0b1110000,
860 FMVWX = 0b1111000,
861
862 FADDD = 0b0000001,
863 FSUBD = 0b0000101,
864 FMULD = 0b0001001,
865 FDIVD = 0b0001101,
866 FSQRTD = 0b0101101,
867 FSGNJD = 0b0010001,
868 FMINMAXD = 0b0010101,
869 FCVTS = 0b0100000,
870 FCVTD = 0b0100001,
871 FCMPD = 0b1010001,
872 FCLASSD = 0b1110001,
873 FCVTintD = 0b1100001,
874 FCVTDint = 0b1101001,
875 FMVXD = 0b1110001,
876 FMVDX = 0b1111001,
877
878 ADDUW = 0b0000100,
879 SHADD = 0b0010000,
880 SLLIUW = 0b0000100,
881 COUNT = 0b0110000,
882 MINMAXCLMUL = 0b0000101,
883 ROTATE = 0b0110000,
884 BCLRBEXT = 0b0100100,
885 BINV = 0b0110100,
886 BSET = 0b0010100,
887};
#define COUNT(T)
@ ROTATE

◆ GCReason

enum class dart::GCReason
strong
Enumerator
kNewSpace 
kStoreBuffer 
kPromotion 
kOldSpace 
kFinalize 
kFull 
kExternal 
kIdle 
kDestroyed 
kDebugging 
kCatchUp 

Definition at line 40 of file spaces.h.

40 {
41 kNewSpace, // New space is full.
42 kStoreBuffer, // Store buffer is too big.
43 kPromotion, // Old space limit crossed after a scavenge.
44 kOldSpace, // Old space limit crossed, or old space allocation failed.
45 kFinalize, // Concurrent marking finished.
46 kFull, // Heap::CollectAllGarbage
47 kExternal, // Dart_NewFinalizableHandle Dart_NewWeakPersistentHandle
48 kIdle, // Dart_NotifyIdle
49 kDestroyed, // Dart_NotifyDestroyed
50 kDebugging, // service request, etc.
51 kCatchUp, // End of ForceGrowthScope or Dart_PerformanceMode_Latency.
52};
@ kFull
modifies glyph outlines for maximum constrast
@ kStoreBuffer

◆ GCType

enum class dart::GCType
strong
Enumerator
kScavenge 
kEvacuate 
kStartConcurrentMark 
kMarkSweep 
kMarkCompact 

Definition at line 32 of file spaces.h.

◆ Generation

Enumerator
kNew 
kOld 
kImm 

Definition at line 890 of file heap_test.cc.

890 {
891 kNew,
892 kOld,
893 kImm,
894};

◆ Genericity

Enumerator
kAny 
kCurrentClass 
kFunctions 

Definition at line 2228 of file object.h.

2228 {
2229 kAny, // Consider type params of current class and functions.
2230 kCurrentClass, // Consider type params of current class only.
2231 kFunctions, // Consider type params of current and parent functions.
2232};
@ kFunctions
Definition object.h:2231
@ kCurrentClass
Definition object.h:2230
@ kAny
Definition object.h:2229

◆ HartEffects

Enumerator
kWrite 
kRead 
kOutput 
kInput 
kMemory 
kIO 
kAll 

Definition at line 937 of file constants_riscv.h.

937 {
938 kWrite = 1 << 0,
939 kRead = 1 << 1,
940 kOutput = 1 << 2,
941 kInput = 1 << 3,
942 kMemory = kWrite | kRead,
943 kIO = kOutput | kInput,
944 kAll = kMemory | kIO,
945};

◆ IdSpace

enum class dart::IdSpace : uint8_t
strong
Enumerator
kInvalid 
kSnapshot 
kVmText 
kIsolateText 
kVmData 
kIsolateData 
kArtificial 

Definition at line 19 of file v8_snapshot_writer.h.

19 : uint8_t {
20 kInvalid = 0, // So default-constructed ObjectIds are invalid.
21 kSnapshot = 1, // Can be VM or Isolate heap, they share ids.
22 kVmText = 2,
23 kIsolateText = 3,
24 kVmData = 4,
25 kIsolateData = 5,
26 kArtificial = 6, // Artificial objects (e.g. the global root).
27 // Change ObjectId::kIdSpaceBits to use last entry if more are added.
28};
@ kInvalid

◆ InnerPointerAccess

enum class dart::InnerPointerAccess
strong
Enumerator
kNotUntagged 
kMayBeInnerPointer 
kCannotBeInnerPointer 

Definition at line 6246 of file il.h.

◆ InstantiationMode

enum class dart::InstantiationMode : uint8_t
strong
Enumerator
kNeedsInstantiation 
kIsInstantiated 
kSharesInstantiatorTypeArguments 
kSharesFunctionTypeArguments 

Definition at line 1446 of file raw_object.h.

1446 : uint8_t {
1447 // Must instantiate the type arguments normally.
1449 // The type arguments are already instantiated.
1451 // Use the instantiator type arguments that would be used to instantiate
1452 // the default type arguments, as instantiating produces the same result.
1454 // Use the function type arguments that would be used to instantiate
1455 // the default type arguments, as instantiating produces the same result.
1457};

◆ InstructionFields [1/2]

Enumerator
kConditionShift 
kConditionBits 
kTypeShift 
kTypeBits 
kLinkShift 
kLinkBits 
kUShift 
kUBits 
kOpcodeShift 
kOpcodeBits 
kSShift 
kSBits 
kRnShift 
kRnBits 
kRdShift 
kRdBits 
kRsShift 
kRsBits 
kRmShift 
kRmBits 
kRotateShift 
kRotateBits 
kImmed8Shift 
kImmed8Bits 
kShiftImmShift 
kShiftRegisterShift 
kShiftImmBits 
kShiftShift 
kShiftBits 
kOffset12Shift 
kOffset12Bits 
kOffset12Mask 
kMulRdShift 
kMulRdBits 
kMulRnShift 
kMulRnBits 
kLdrExRnShift 
kLdrExRtShift 
kStrExRnShift 
kStrExRdShift 
kStrExRtShift 
kMediaOp1Shift 
kMediaOp1Bits 
kMediaOp2Shift 
kMediaOp2Bits 
kDivRdShift 
kDivRdBits 
kDivRmShift 
kDivRmBits 
kDivRnShift 
kDivRnBits 
kBitFieldExtractWidthShift 
kBitFieldExtractWidthBits 
kBitFieldExtractLSBShift 
kBitFieldExtractLSBBits 
kBitFieldExtractRnShift 
kBitFieldExtractRnBits 
kCRmShift 
kCRmBits 
kOpc2Shift 
kOpc2Bits 
kCoprocShift 
kCoprocBits 
kCRnShift 
kCRnBits 
kOpc1Shift 
kOpc1Bits 
kBranchOffsetMask 
kSShift 
kSBits 
kSFShift 
kSFBits 
kSzShift 
kSzBits 
kRdShift 
kRdBits 
kRnShift 
kRnBits 
kRaShift 
kRaBits 
kRmShift 
kRmBits 
kRtShift 
kRtBits 
kRt2Shift 
kRt2Bits 
kRsShift 
kRsBits 
kVdShift 
kVdBits 
kVnShift 
kVnBits 
kVmShift 
kVmBits 
kVtShift 
kVtBits 
kVt2Shift 
kVt2Bits 
kImm3Shift 
kImm3Bits 
kImm4Shift 
kImm4Bits 
kImm5Shift 
kImm5Bits 
kImm6Shift 
kImm6Bits 
kImm7Shift 
kImm7Bits 
kImm7Mask 
kImm8Shift 
kImm8Bits 
kImm9Shift 
kImm9Bits 
kImm12Shift 
kImm12Bits 
kImm12Mask 
kImm12ShiftShift 
kImm12ShiftBits 
kImm14Shift 
kImm14Bits 
kImm14Mask 
kImm16Shift 
kImm16Bits 
kImm16Mask 
kImm19Shift 
kImm19Bits 
kImm19Mask 
kImm26Shift 
kImm26Bits 
kImm26Mask 
kCondShift 
kCondBits 
kCondMask 
kSelCondShift 
kSelCondBits 
kNShift 
kNBits 
kImmRShift 
kImmRBits 
kImmSShift 
kImmSBits 
kHWShift 
kHWBits 
kAddShiftExtendShift 
kAddShiftExtendBits 
kShiftTypeShift 
kShiftTypeBits 
kExtendTypeShift 
kExtendTypeBits 
kHintCRmShift 
kHintCRmBits 
kHintOp2Shift 
kHintOp2Bits 

Definition at line 853 of file constants_arm.h.

853 {
854 kConditionShift = 28,
855 kConditionBits = 4,
856 kTypeShift = 25,
857 kTypeBits = 3,
858 kLinkShift = 24,
859 kLinkBits = 1,
860 kUShift = 23,
861 kUBits = 1,
862 kOpcodeShift = 21,
863 kOpcodeBits = 4,
864 kSShift = 20,
865 kSBits = 1,
866 kRnShift = 16,
867 kRnBits = 4,
868 kRdShift = 12,
869 kRdBits = 4,
870 kRsShift = 8,
871 kRsBits = 4,
872 kRmShift = 0,
873 kRmBits = 4,
874
875 // Immediate instruction fields encoding.
876 kRotateShift = 8,
877 kRotateBits = 4,
878 kImmed8Shift = 0,
879 kImmed8Bits = 8,
880
881 // Shift instruction register fields encodings.
882 kShiftImmShift = 7,
884 kShiftImmBits = 5,
885 kShiftShift = 5,
886 kShiftBits = 2,
887
888 // Load/store instruction offset field encoding.
889 kOffset12Shift = 0,
890 kOffset12Bits = 12,
891 kOffset12Mask = 0x00000fff,
892
893 // Mul instruction register field encodings.
894 kMulRdShift = 16,
895 kMulRdBits = 4,
896 kMulRnShift = 12,
897 kMulRnBits = 4,
898
899 // ldrex/strex register field encodings.
900 kLdrExRnShift = 16,
901 kLdrExRtShift = 12,
902 kStrExRnShift = 16,
903 kStrExRdShift = 12,
904 kStrExRtShift = 0,
905
906 // Media operation field encodings.
907 kMediaOp1Shift = 20,
908 kMediaOp1Bits = 5,
909 kMediaOp2Shift = 5,
910 kMediaOp2Bits = 3,
911
912 // udiv/sdiv instruction register field encodings.
913 kDivRdShift = 16,
914 kDivRdBits = 4,
915 kDivRmShift = 8,
916 kDivRmBits = 4,
917 kDivRnShift = 0,
918 kDivRnBits = 4,
919
920 // sbfx/ubfx instruction register and immediate field encodings.
927
928 // MRC instruction offset field encoding.
929 kCRmShift = 0,
930 kCRmBits = 4,
931 kOpc2Shift = 5,
932 kOpc2Bits = 3,
933 kCoprocShift = 8,
934 kCoprocBits = 4,
935 kCRnShift = 16,
936 kCRnBits = 4,
937 kOpc1Shift = 21,
938 kOpc1Bits = 3,
939
940 kBranchOffsetMask = 0x00ffffff
941};
@ kBitFieldExtractLSBBits
@ kShiftImmShift
@ kConditionShift
@ kConditionBits
@ kMediaOp1Shift
@ kOffset12Bits
@ kBranchOffsetMask
@ kRotateBits
@ kDivRmShift
@ kShiftImmBits
@ kMulRnShift
@ kBitFieldExtractWidthBits
@ kMediaOp2Shift
@ kLdrExRnShift
@ kLdrExRtShift
@ kBitFieldExtractLSBShift
@ kStrExRnShift
@ kImmed8Shift
@ kMediaOp1Bits
@ kImmed8Bits
@ kCoprocShift
@ kStrExRtShift
@ kOffset12Mask
@ kMediaOp2Bits
@ kStrExRdShift
@ kDivRnShift
@ kBitFieldExtractWidthShift
@ kOpcodeBits
@ kRotateShift
@ kBitFieldExtractRnShift
@ kOffset12Shift
@ kMulRdShift
@ kDivRdShift
@ kShiftRegisterShift
@ kCoprocBits
@ kShiftShift
@ kOpcodeShift
@ kBitFieldExtractRnBits

◆ InstructionFields [2/2]

Enumerator
kConditionShift 
kConditionBits 
kTypeShift 
kTypeBits 
kLinkShift 
kLinkBits 
kUShift 
kUBits 
kOpcodeShift 
kOpcodeBits 
kSShift 
kSBits 
kRnShift 
kRnBits 
kRdShift 
kRdBits 
kRsShift 
kRsBits 
kRmShift 
kRmBits 
kRotateShift 
kRotateBits 
kImmed8Shift 
kImmed8Bits 
kShiftImmShift 
kShiftRegisterShift 
kShiftImmBits 
kShiftShift 
kShiftBits 
kOffset12Shift 
kOffset12Bits 
kOffset12Mask 
kMulRdShift 
kMulRdBits 
kMulRnShift 
kMulRnBits 
kLdrExRnShift 
kLdrExRtShift 
kStrExRnShift 
kStrExRdShift 
kStrExRtShift 
kMediaOp1Shift 
kMediaOp1Bits 
kMediaOp2Shift 
kMediaOp2Bits 
kDivRdShift 
kDivRdBits 
kDivRmShift 
kDivRmBits 
kDivRnShift 
kDivRnBits 
kBitFieldExtractWidthShift 
kBitFieldExtractWidthBits 
kBitFieldExtractLSBShift 
kBitFieldExtractLSBBits 
kBitFieldExtractRnShift 
kBitFieldExtractRnBits 
kCRmShift 
kCRmBits 
kOpc2Shift 
kOpc2Bits 
kCoprocShift 
kCoprocBits 
kCRnShift 
kCRnBits 
kOpc1Shift 
kOpc1Bits 
kBranchOffsetMask 
kSShift 
kSBits 
kSFShift 
kSFBits 
kSzShift 
kSzBits 
kRdShift 
kRdBits 
kRnShift 
kRnBits 
kRaShift 
kRaBits 
kRmShift 
kRmBits 
kRtShift 
kRtBits 
kRt2Shift 
kRt2Bits 
kRsShift 
kRsBits 
kVdShift 
kVdBits 
kVnShift 
kVnBits 
kVmShift 
kVmBits 
kVtShift 
kVtBits 
kVt2Shift 
kVt2Bits 
kImm3Shift 
kImm3Bits 
kImm4Shift 
kImm4Bits 
kImm5Shift 
kImm5Bits 
kImm6Shift 
kImm6Bits 
kImm7Shift 
kImm7Bits 
kImm7Mask 
kImm8Shift 
kImm8Bits 
kImm9Shift 
kImm9Bits 
kImm12Shift 
kImm12Bits 
kImm12Mask 
kImm12ShiftShift 
kImm12ShiftBits 
kImm14Shift 
kImm14Bits 
kImm14Mask 
kImm16Shift 
kImm16Bits 
kImm16Mask 
kImm19Shift 
kImm19Bits 
kImm19Mask 
kImm26Shift 
kImm26Bits 
kImm26Mask 
kCondShift 
kCondBits 
kCondMask 
kSelCondShift 
kSelCondBits 
kNShift 
kNBits 
kImmRShift 
kImmRBits 
kImmSShift 
kImmSBits 
kHWShift 
kHWBits 
kAddShiftExtendShift 
kAddShiftExtendBits 
kShiftTypeShift 
kShiftTypeBits 
kExtendTypeShift 
kExtendTypeBits 
kHintCRmShift 
kHintCRmBits 
kHintOp2Shift 
kHintOp2Bits 

Definition at line 1162 of file constants_arm64.h.

1162 {
1163 // S-bit (modify condition register)
1164 kSShift = 29,
1165 kSBits = 1,
1166
1167 // sf field.
1168 kSFShift = 31,
1169 kSFBits = 1,
1170
1171 // size field,
1172 kSzShift = 30,
1173 kSzBits = 2,
1174
1175 // Registers.
1176 kRdShift = 0,
1177 kRdBits = 5,
1178 kRnShift = 5,
1179 kRnBits = 5,
1180 kRaShift = 10,
1181 kRaBits = 5,
1182 kRmShift = 16,
1183 kRmBits = 5,
1184 kRtShift = 0,
1185 kRtBits = 5,
1186 kRt2Shift = 10,
1187 kRt2Bits = 5,
1188 kRsShift = 16,
1189 kRsBits = 5,
1190
1191 // V Registers.
1192 kVdShift = 0,
1193 kVdBits = 5,
1194 kVnShift = 5,
1195 kVnBits = 5,
1196 kVmShift = 16,
1197 kVmBits = 5,
1198 kVtShift = 0,
1199 kVtBits = 5,
1200 kVt2Shift = 10,
1201 kVt2Bits = 5,
1202
1203 // Immediates.
1204 kImm3Shift = 10,
1205 kImm3Bits = 3,
1206 kImm4Shift = 11,
1207 kImm4Bits = 4,
1208 kImm5Shift = 16,
1209 kImm5Bits = 5,
1210 kImm6Shift = 10,
1211 kImm6Bits = 6,
1212 kImm7Shift = 15,
1213 kImm7Bits = 7,
1214 kImm7Mask = 0x7f << kImm7Shift,
1215 kImm8Shift = 13,
1216 kImm8Bits = 8,
1217 kImm9Shift = 12,
1218 kImm9Bits = 9,
1219 kImm12Shift = 10,
1220 kImm12Bits = 12,
1221 kImm12Mask = 0xfff << kImm12Shift,
1222 kImm12ShiftShift = 22,
1223 kImm12ShiftBits = 2,
1224 kImm14Shift = 5,
1225 kImm14Bits = 14,
1226 kImm14Mask = 0x3fff << kImm14Shift,
1227 kImm16Shift = 5,
1228 kImm16Bits = 16,
1229 kImm16Mask = 0xffff << kImm16Shift,
1230 kImm19Shift = 5,
1231 kImm19Bits = 19,
1232 kImm19Mask = 0x7ffff << kImm19Shift,
1233 kImm26Shift = 0,
1234 kImm26Bits = 26,
1235 kImm26Mask = 0x03ffffff << kImm26Shift,
1236
1237 kCondShift = 0,
1238 kCondBits = 4,
1239 kCondMask = 0xf << kCondShift,
1240
1241 kSelCondShift = 12,
1242 kSelCondBits = 4,
1243
1244 // Bitfield immediates.
1245 kNShift = 22,
1246 kNBits = 1,
1247 kImmRShift = 16,
1248 kImmRBits = 6,
1249 kImmSShift = 10,
1250 kImmSBits = 6,
1251
1252 kHWShift = 21,
1253 kHWBits = 2,
1254
1255 // Shift and Extend.
1258 kShiftTypeShift = 22,
1259 kShiftTypeBits = 2,
1260 kExtendTypeShift = 13,
1261 kExtendTypeBits = 3,
1262
1263 // Hint Fields.
1264 kHintCRmShift = 8,
1265 kHintCRmBits = 4,
1266 kHintOp2Shift = 5,
1267 kHintOp2Bits = 3,
1268};
@ kAddShiftExtendBits
@ kAddShiftExtendShift

◆ JSONRpcErrorCode

Enumerator
kParseError 
kInvalidRequest 
kMethodNotFound 
kInvalidParams 
kInternalError 
kExtensionError 
kFeatureDisabled 
kCannotAddBreakpoint 
kStreamAlreadySubscribed 
kStreamNotSubscribed 
kIsolateMustBeRunnable 
kIsolateMustBePaused 
kCannotResume 
kIsolateIsReloading 
kIsolateReloadBarred 
kIsolateMustHaveReloaded 
kServiceAlreadyRegistered 
kServiceDisappeared 
kExpressionCompilationError 
kInvalidTimelineRequest 
kFileSystemAlreadyExists 
kFileSystemDoesNotExist 
kFileDoesNotExist 

Definition at line 44 of file json_stream.h.

44 {
45 kParseError = -32700,
46 kInvalidRequest = -32600,
47 kMethodNotFound = -32601,
48 kInvalidParams = -32602,
49 kInternalError = -32603,
50
51 kExtensionError = -32000,
52
53 kFeatureDisabled = 100,
59 kCannotResume = 107,
67
68 // Experimental (used in private rpcs).
71 kFileDoesNotExist = 1003,
72};
@ kExpressionCompilationError
Definition json_stream.h:65
@ kParseError
Definition json_stream.h:45
@ kCannotAddBreakpoint
Definition json_stream.h:54
@ kFileDoesNotExist
Definition json_stream.h:71
@ kExtensionError
Definition json_stream.h:51
@ kStreamNotSubscribed
Definition json_stream.h:56
@ kCannotResume
Definition json_stream.h:59
@ kInternalError
Definition json_stream.h:49
@ kServiceAlreadyRegistered
Definition json_stream.h:63
@ kMethodNotFound
Definition json_stream.h:47
@ kFeatureDisabled
Definition json_stream.h:53
@ kIsolateMustHaveReloaded
Definition json_stream.h:62
@ kIsolateIsReloading
Definition json_stream.h:60
@ kStreamAlreadySubscribed
Definition json_stream.h:55
@ kFileSystemDoesNotExist
Definition json_stream.h:70
@ kIsolateMustBePaused
Definition json_stream.h:58
@ kInvalidRequest
Definition json_stream.h:46
@ kIsolateMustBeRunnable
Definition json_stream.h:57
@ kFileSystemAlreadyExists
Definition json_stream.h:69
@ kInvalidTimelineRequest
Definition json_stream.h:66
@ kInvalidParams
Definition json_stream.h:48
@ kServiceDisappeared
Definition json_stream.h:64
@ kIsolateReloadBarred
Definition json_stream.h:61

◆ LoadRegLiteralOp

Enumerator
LoadRegLiteralMask 
LoadRegLiteralFixed 
LDRpc 

Definition at line 813 of file constants_arm64.h.

813 {
814 LoadRegLiteralMask = 0x3b000000,
817};
@ LoadRegLiteralFixed
@ LoadRegLiteralMask

◆ LoadStoreExclusiveOp

Enumerator
LoadStoreExclusiveMask 
LoadStoreExclusiveFixed 
LDXR 
STXR 
LDAR 
STLR 

Definition at line 820 of file constants_arm64.h.

820 {
821 LoadStoreExclusiveMask = 0x3f000000,
825 LDAR = LoadStoreExclusiveFixed | B23 | B22 | B15,
826 STLR = LoadStoreExclusiveFixed | B23 | B15,
827};
@ LoadStoreExclusiveFixed
@ LoadStoreExclusiveMask

◆ LoadStoreRegOp

Enumerator
LoadStoreRegMask 
LoadStoreRegFixed 
STR 
LDR 
LDRS 
FSTR 
FLDR 
FSTRQ 
FLDRQ 

Definition at line 837 of file constants_arm64.h.

837 {
838 LoadStoreRegMask = 0x3a000000,
841 LDR = LoadStoreRegFixed | B22,
842 LDRS = LoadStoreRegFixed | B23,
843 FSTR = STR | B26,
844 FLDR = LDR | B26,
845 FSTRQ = STR | B26 | B23,
846 FLDRQ = LDR | B26 | B23,
847};
@ LoadStoreRegMask
@ LoadStoreRegFixed
#define STR(s)

◆ LoadStoreRegPairOp

Enumerator
LoadStoreRegPairMask 
LoadStoreRegPairFixed 
STP 
LDP 
FSTP 
FLDP 

Definition at line 850 of file constants_arm64.h.

850 {
851 LoadStoreRegPairMask = 0x3a000000,
855 FSTP = STP | B26,
856 FLDP = LDP | B26,
857};
@ LoadStoreRegPairFixed
@ LoadStoreRegPairMask

◆ LogicalImmOp

Enumerator
LogicalImmMask 
LogicalImmFixed 
ANDI 
ORRI 
EORI 
ANDIS 

Definition at line 878 of file constants_arm64.h.

◆ LogicalShiftOp

Enumerator
LogicalShiftMask 
LogicalShiftFixed 
AND 
BIC 
ORR 
ORN 
EOR 
EON 
ANDS 
BICS 

Definition at line 966 of file constants_arm64.h.

◆ MainOp

Enumerator
DPImmediateMask 
DPImmediateFixed 
CompareBranchMask 
CompareBranchFixed 
LoadStoreMask 
LoadStoreFixed 
DPRegisterMask 
DPRegisterFixed 
DPSimd1Mask 
DPSimd1Fixed 
DPSimd2Mask 
DPSimd2Fixed 
FPMask 
FPFixed 

Definition at line 731 of file constants_arm64.h.

731 {
732 DPImmediateMask = 0x1c000000,
734
735 CompareBranchMask = 0x1c000000,
736 CompareBranchFixed = B28 | B26,
737
738 LoadStoreMask = B27 | B25,
739 LoadStoreFixed = B27,
740
741 DPRegisterMask = 0x0e000000,
742 DPRegisterFixed = B27 | B25,
743
744 DPSimd1Mask = 0x1e000000,
745 DPSimd1Fixed = B27 | B26 | B25,
746
747 DPSimd2Mask = 0x1e000000,
749
750 FPMask = 0x5e000000,
751 FPFixed = B28 | B27 | B26 | B25,
752};
@ DPImmediateMask
@ CompareBranchMask

◆ MarkExpectation

Enumerator
kForbidMarked 
kAllowMarked 
kRequireMarked 

Definition at line 21 of file verifier.h.

@ kAllowMarked
Definition verifier.h:21
@ kRequireMarked
Definition verifier.h:21
@ kForbidMarked
Definition verifier.h:21

◆ MatchOpCode

Enumerator
kMatchAndMoveBranchTrue 
kMatchAndMoveBranchFalse 
kNop 
kMoveAny 
kMoveParallelMoves 
kMoveGlob 
kMoveDebugStepChecks 
kInvalidMatchOpCode 

Definition at line 117 of file il_test_helper.h.

117 {
118// Emit a match and match-and-move code for every instruction.
119#define DEFINE_MATCH_OPCODES(Instruction, _) \
120 kMatch##Instruction, kMatchAndMove##Instruction, \
121 kMatchAndMoveOptional##Instruction,
124#undef DEFINE_MATCH_OPCODES
125
126 // Matches a branch and moves left.
128
129 // Matches a branch and moves right.
131
132 // Is ignored.
133 kNop,
134
135 // Moves forward across any instruction.
136 kMoveAny,
137
138 // Moves over all parallel moves.
140
141 // Moves forward until the next match code matches.
142 kMoveGlob,
143
144 // Moves over any DebugStepChecks.
146
147 // Invalid match opcode used as default [insert_before] argument to TryMatch
148 // to signal that no insertions should occur.
150};
#define FOR_EACH_INSTRUCTION(M)
Definition il.h:405
#define FOR_EACH_ABSTRACT_INSTRUCTION(M)
Definition il.h:553
#define DEFINE_MATCH_OPCODES(Instruction, _)
@ kMatchAndMoveBranchFalse
@ kMoveDebugStepChecks
@ kInvalidMatchOpCode
@ kMatchAndMoveBranchTrue
@ kMoveParallelMoves

◆ MessagePhase

enum class dart::MessagePhase
strong
Enumerator
kBeforeTypes 
kTypes 
kCanonicalInstances 
kNonCanonicalInstances 
kNumPhases 

Definition at line 66 of file message_snapshot.cc.

66 {
67 kBeforeTypes = 0,
68 kTypes = 1,
71
72 kNumPhases = 4,
73};
static constexpr SkSLType kTypes[]

◆ MiscDP1SourceOp

Enumerator
MiscDP1SourceMask 
MiscDP1SourceFixed 
CLZ 
RBIT 

Definition at line 931 of file constants_arm64.h.

931 {
932 MiscDP1SourceMask = 0x5fe00000,
933 MiscDP1SourceFixed = DPRegisterFixed | B30 | B28 | B23 | B22,
934 CLZ = MiscDP1SourceFixed | B12,
935 RBIT = MiscDP1SourceFixed, // opc = '00'
936};
@ MiscDP1SourceFixed
@ MiscDP1SourceMask

◆ MiscDP2SourceOp

Enumerator
MiscDP2SourceMask 
MiscDP2SourceFixed 
UDIV 
SDIV 
LSLV 
LSRV 
ASRV 

Definition at line 939 of file constants_arm64.h.

939 {
940 MiscDP2SourceMask = 0x5fe00000,
941 MiscDP2SourceFixed = DPRegisterFixed | B28 | B23 | B22,
942 UDIV = MiscDP2SourceFixed | B11,
943 SDIV = MiscDP2SourceFixed | B11 | B10,
944 LSLV = MiscDP2SourceFixed | B13,
945 LSRV = MiscDP2SourceFixed | B13 | B10,
946 ASRV = MiscDP2SourceFixed | B13 | B11,
947};
@ MiscDP2SourceMask
@ MiscDP2SourceFixed

◆ MiscDP3SourceOp

Enumerator
MiscDP3SourceMask 
MiscDP3SourceFixed 
MADDW 
MADD 
MSUBW 
MSUB 
SMULH 
UMULH 
SMADDL 
UMADDL 
SMSUBL 
UMSUBL 

Definition at line 950 of file constants_arm64.h.

950 {
951 MiscDP3SourceMask = 0x1f000000,
956 MSUB = MiscDP3SourceFixed | B31 | B15,
957 SMULH = MiscDP3SourceFixed | B31 | B22,
958 UMULH = MiscDP3SourceFixed | B31 | B23 | B22,
959 SMADDL = MiscDP3SourceFixed | B31 | B21,
960 UMADDL = MiscDP3SourceFixed | B31 | B23 | B21,
961 SMSUBL = MiscDP3SourceFixed | B31 | B21 | B15,
962 UMSUBL = MiscDP3SourceFixed | B31 | B23 | B21 | B15,
963};
@ MiscDP3SourceFixed
@ MiscDP3SourceMask

◆ MissHandler

enum class dart::MissHandler
strong
Enumerator
kInlineCacheMiss 
kSwitchableCallMiss 
kFixCallersTargetMonomorphic 

Definition at line 1919 of file runtime_entry.cc.

◆ MoveWideOp

Enumerator
MoveWideMask 
MoveWideFixed 
MOVN 
MOVZ 
MOVK 

Definition at line 888 of file constants_arm64.h.

888 {
889 MoveWideMask = 0x1f800000,
890 MoveWideFixed = DPImmediateFixed | B25 | B23,
894};

◆ NativeSlotsEnumeration

Enumerator
kNativeSlotsCount 

Definition at line 16 of file slot.cc.

16 {
17#define DECLARE_KIND(CN, __, FN, ___, ____) k##CN##_##FN,
19#undef DECLARE_KIND
21};
@ kNativeSlotsCount
Definition slot.cc:20
#define DECLARE_KIND(CN, __, FN, ___, ____)
Definition slot.cc:17
#define NATIVE_SLOTS_LIST(V)
Definition slot.h:366

◆ NNBDCompiledMode

enum class dart::NNBDCompiledMode
strong
Enumerator
kStrong 
kWeak 
kAgnostic 
kInvalid 

Definition at line 1128 of file object.h.

1128 {
1129 kStrong = 0,
1130 kWeak = 1,
1131 kAgnostic = 2,
1132 kInvalid = 3,
1133};

◆ Nullability

enum class dart::Nullability : uint8_t
strong
Enumerator
kNullable 
kNonNullable 
kLegacy 

Definition at line 1112 of file object.h.

1112 : uint8_t {
1113 kNullable = 0,
1114 kNonNullable = 1,
1115 kLegacy = 2,
1116 // Adjust kNullabilityBitSize in app_snapshot.cc if adding new values.
1117};

◆ Opcode [1/2]

Enumerator
kNoOperand 
AND 
EOR 
SUB 
RSB 
ADD 
ADC 
SBC 
RSC 
TST 
TEQ 
CMP 
CMN 
ORR 
MOV 
BIC 
MVN 
kMaxOperand 
LUI 
AUIPC 
JAL 
JALR 
BRANCH 
LOAD 
STORE 
OPIMM 
OP 
MISCMEM 
SYSTEM 
OP32 
OPIMM32 
AMO 
LOADFP 
STOREFP 
FMADD 
FMSUB 
FNMSUB 
FNMADD 
OPFP 

Definition at line 820 of file constants_arm.h.

820 {
821 kNoOperand = -1,
822 AND = 0, // Logical AND
823 EOR = 1, // Logical Exclusive OR
824 SUB = 2, // Subtract
825 RSB = 3, // Reverse Subtract
826 ADD = 4, // Add
827 ADC = 5, // Add with Carry
828 SBC = 6, // Subtract with Carry
829 RSC = 7, // Reverse Subtract with Carry
830 TST = 8, // Test
831 TEQ = 9, // Test Equivalence
832 CMP = 10, // Compare
833 CMN = 11, // Compare Negated
834 ORR = 12, // Logical (inclusive) OR
835 MOV = 13, // Move
836 BIC = 14, // Bit Clear
837 MVN = 15, // Move Not
838 kMaxOperand = 16
839};
@ kMaxOperand

◆ Opcode [2/2]

Enumerator
kNoOperand 
AND 
EOR 
SUB 
RSB 
ADD 
ADC 
SBC 
RSC 
TST 
TEQ 
CMP 
CMN 
ORR 
MOV 
BIC 
MVN 
kMaxOperand 
LUI 
AUIPC 
JAL 
JALR 
BRANCH 
LOAD 
STORE 
OPIMM 
OP 
MISCMEM 
SYSTEM 
OP32 
OPIMM32 
AMO 
LOADFP 
STOREFP 
FMADD 
FMSUB 
FNMSUB 
FNMADD 
OPFP 

Definition at line 706 of file constants_riscv.h.

706 {
707 LUI = 0b0110111,
708 AUIPC = 0b0010111,
709 JAL = 0b1101111,
710 JALR = 0b1100111,
711 BRANCH = 0b1100011,
712 LOAD = 0b0000011,
713 STORE = 0b0100011,
714 OPIMM = 0b0010011,
715 OP = 0b0110011,
716 MISCMEM = 0b0001111,
717 SYSTEM = 0b1110011,
718 OP32 = 0b0111011,
719 OPIMM32 = 0b0011011,
720 AMO = 0b0101111,
721 LOADFP = 0b0000111,
722 STOREFP = 0b0100111,
723 FMADD = 0b1000011,
724 FMSUB = 0b1000111,
725 FNMSUB = 0b1001011,
726 FNMADD = 0b1001111,
727 OPFP = 0b1010011,
728};

◆ ParallelMovesHandling

enum class dart::ParallelMovesHandling
strong
Enumerator
kDefault 
kSkip 

Definition at line 179 of file il_test_helper.h.

179 {
180 // Matcher doesn't do anything special with ParallelMove instructions.
181 kDefault,
182 // All ParallelMove instructions are skipped.
183 // This mode is useful when matching a flow graph after the whole
184 // compiler pipeline, as it may have ParallelMove instructions
185 // at arbitrary architecture-dependent places.
186 kSkip,
187};

◆ PCRelOp

Enumerator
PCRelMask 
PCRelFixed 
ADR 
ADRP 

Definition at line 897 of file constants_arm64.h.

897 {
898 PCRelMask = 0x1f000000,
900 ADR = PCRelFixed,
901 ADRP = PCRelFixed | B31,
902};

◆ QRegister

Enumerator
kNoQRegister 
Q0 
Q1 
Q2 
Q3 
Q4 
Q5 
Q6 
Q7 
Q8 
Q9 
Q10 
Q11 
Q12 
Q13 
Q14 
Q15 
kNumberOfQRegisters 
kNumberOfOverlappingQRegisters 

Definition at line 218 of file constants_arm.h.

218 {
219 kNoQRegister = -1,
220 Q0 = 0,
221 Q1 = 1,
222 Q2 = 2,
223 Q3 = 3,
224 Q4 = 4,
225 Q5 = 5,
226 Q6 = 6,
227 Q7 = 7,
228#if defined(VFPv3_D16)
238#else
239 Q8 = 8,
240 Q9 = 9,
241 Q10 = 10,
242 Q11 = 11,
243 Q12 = 12,
244 Q13 = 13,
245 Q14 = 14,
246 Q15 = 15,
248#endif
249 // Number of Q registers that overlap S registers.
250 // One Q register overlaps four S registers, so regardless of the numbers of Q
251 // registers, there are only 32 S registers that are overlapped.
253};
V< 8, uint16_t > Q15
@ kNoQRegister
@ kNumberOfQRegisters
@ kNumberOfOverlappingQRegisters

◆ QualifiedFunctionLibKind

Enumerator
kQualifiedFunctionLibKindLibUrl 
kQualifiedFunctionLibKindLibName 

Definition at line 9754 of file object.cc.

9754 {
9757};
@ kQualifiedFunctionLibKindLibUrl
Definition object.cc:9755
@ kQualifiedFunctionLibKindLibName
Definition object.cc:9756

◆ R31Type

Enumerator
R31IsSP 
R31IsZR 

Definition at line 1155 of file constants_arm64.h.

1155 {
1156 R31IsSP,
1157 R31IsZR,
1158};

◆ Register [1/5]

Enumerator
R0 
R1 
R2 
R3 
R4 
R5 
R6 
R7 
R8 
R9 
R10 
R11 
R12 
R13 
R14 
R15 
kNumberOfCpuRegisters 
kNoRegister 
FP 
NOTFP 
IP 
SP 
LR 
PC 
R0 
R1 
R2 
R3 
R4 
R5 
R6 
R7 
R8 
R9 
R10 
R11 
R12 
R13 
R14 
R15 
R16 
R17 
R18 
R19 
R20 
R21 
R22 
R23 
R24 
R25 
R26 
R27 
R28 
R29 
R30 
R31 
kNumberOfCpuRegisters 
kNoRegister 
kNoRegister2 
CSP 
ZR 
IP0 
IP1 
SP 
FP 
LR 
EAX 
ECX 
EDX 
EBX 
ESP 
EBP 
ESI 
EDI 
kNumberOfCpuRegisters 
kNoRegister 
ZR 
RA 
SP 
GP 
TP 
T0 
T1 
T2 
FP 
S1 
A0 
A1 
A2 
A3 
A4 
A5 
A6 
A7 
S2 
S3 
S4 
S5 
S6 
S7 
S8 
S9 
S10 
S11 
T3 
T4 
T5 
T6 
kNumberOfCpuRegisters 
kNoRegister 
RA2 
S0 
RAX 
RCX 
RDX 
RBX 
RSP 
RBP 
RSI 
RDI 
R8 
R9 
R10 
R11 
R12 
R13 
R14 
R15 
kNumberOfCpuRegisters 
kNoRegister 

Definition at line 81 of file constants_arm.h.

81 {
82 R0 = 0,
83 R1 = 1,
84 R2 = 2,
85 R3 = 3,
86 R4 = 4,
87 R5 = 5, // PP
88 R6 = 6, // CODE_REG
89 R7 = 7, // FP on iOS, DISPATCH_TABLE_REG on non-iOS (AOT only)
90 R8 = 8,
91 R9 = 9,
92 R10 = 10, // THR
93 R11 = 11, // FP on non-iOS, DISPATCH_TABLE_REG on iOS (AOT only)
94 R12 = 12, // IP aka TMP
95 R13 = 13, // SP
96 R14 = 14, // LR
97 R15 = 15, // PC
99 kNoRegister = -1, // Signals an illegal register.
100
101// Aliases.
102#if defined(DART_TARGET_OS_MACOS) || defined(DART_TARGET_OS_MACOS_IOS)
103 FP = R7,
104 NOTFP = R11,
105#else
106 FP = R11,
107 NOTFP = R7,
108#endif
109 IP = R12,
110 SP = R13,
111 LR = R14, // Note: direct access to this constant is not allowed. See above.
112 PC = R15,
113};
@ kNumberOfCpuRegisters
@ kNoRegister

◆ Register [2/5]

Enumerator
R0 
R1 
R2 
R3 
R4 
R5 
R6 
R7 
R8 
R9 
R10 
R11 
R12 
R13 
R14 
R15 
kNumberOfCpuRegisters 
kNoRegister 
FP 
NOTFP 
IP 
SP 
LR 
PC 
R0 
R1 
R2 
R3 
R4 
R5 
R6 
R7 
R8 
R9 
R10 
R11 
R12 
R13 
R14 
R15 
R16 
R17 
R18 
R19 
R20 
R21 
R22 
R23 
R24 
R25 
R26 
R27 
R28 
R29 
R30 
R31 
kNumberOfCpuRegisters 
kNoRegister 
kNoRegister2 
CSP 
ZR 
IP0 
IP1 
SP 
FP 
LR 
EAX 
ECX 
EDX 
EBX 
ESP 
EBP 
ESI 
EDI 
kNumberOfCpuRegisters 
kNoRegister 
ZR 
RA 
SP 
GP 
TP 
T0 
T1 
T2 
FP 
S1 
A0 
A1 
A2 
A3 
A4 
A5 
A6 
A7 
S2 
S3 
S4 
S5 
S6 
S7 
S8 
S9 
S10 
S11 
T3 
T4 
T5 
T6 
kNumberOfCpuRegisters 
kNoRegister 
RA2 
S0 
RAX 
RCX 
RDX 
RBX 
RSP 
RBP 
RSI 
RDI 
R8 
R9 
R10 
R11 
R12 
R13 
R14 
R15 
kNumberOfCpuRegisters 
kNoRegister 

Definition at line 34 of file constants_arm64.h.

34 {
35 R0 = 0,
36 R1 = 1,
37 R2 = 2,
38 R3 = 3,
39 R4 = 4,
40 R5 = 5,
41 R6 = 6,
42 R7 = 7,
43 R8 = 8,
44 R9 = 9,
45 R10 = 10,
46 R11 = 11,
47 R12 = 12,
48 R13 = 13,
49 R14 = 14,
50 R15 = 15, // SP in Dart code.
51 R16 = 16, // IP0 aka TMP
52 R17 = 17, // IP1 aka TMP2
53 R18 = 18, // reserved on iOS, shadow call stack on Fuchsia, TEB on Windows.
54 R19 = 19,
55 R20 = 20,
56 R21 = 21, // DISPATCH_TABLE_REG (AOT only)
57 R22 = 22, // NULL_REG
58 R23 = 23,
59 R24 = 24, // CODE_REG
60 R25 = 25,
61 R26 = 26, // THR
62 R27 = 27, // PP
63 R28 = 28, // HEAP_BITS
64 R29 = 29, // FP
65 R30 = 30, // LR
66 R31 = 31, // ZR, CSP
68 kNoRegister = -1,
69 kNoRegister2 = -2,
70
71 // These registers both use the encoding R31, but to avoid mistakes we give
72 // them different values, and then translate before encoding.
73 CSP = 32,
74 ZR = 33,
75
76 // Aliases.
77 IP0 = R16,
78 IP1 = R17,
79 SP = R15,
80 FP = R29,
81 LR = R30, // Note: direct access to this constant is not allowed. See above.
82};
#define LR

◆ Register [3/5]

Enumerator
R0 
R1 
R2 
R3 
R4 
R5 
R6 
R7 
R8 
R9 
R10 
R11 
R12 
R13 
R14 
R15 
kNumberOfCpuRegisters 
kNoRegister 
FP 
NOTFP 
IP 
SP 
LR 
PC 
R0 
R1 
R2 
R3 
R4 
R5 
R6 
R7 
R8 
R9 
R10 
R11 
R12 
R13 
R14 
R15 
R16 
R17 
R18 
R19 
R20 
R21 
R22 
R23 
R24 
R25 
R26 
R27 
R28 
R29 
R30 
R31 
kNumberOfCpuRegisters 
kNoRegister 
kNoRegister2 
CSP 
ZR 
IP0 
IP1 
SP 
FP 
LR 
EAX 
ECX 
EDX 
EBX 
ESP 
EBP 
ESI 
EDI 
kNumberOfCpuRegisters 
kNoRegister 
ZR 
RA 
SP 
GP 
TP 
T0 
T1 
T2 
FP 
S1 
A0 
A1 
A2 
A3 
A4 
A5 
A6 
A7 
S2 
S3 
S4 
S5 
S6 
S7 
S8 
S9 
S10 
S11 
T3 
T4 
T5 
T6 
kNumberOfCpuRegisters 
kNoRegister 
RA2 
S0 
RAX 
RCX 
RDX 
RBX 
RSP 
RBP 
RSI 
RDI 
R8 
R9 
R10 
R11 
R12 
R13 
R14 
R15 
kNumberOfCpuRegisters 
kNoRegister 

Definition at line 22 of file constants_ia32.h.

22 {
23 EAX = 0,
24 ECX = 1,
25 EDX = 2,
26 EBX = 3,
27 ESP = 4, // SP
28 EBP = 5, // FP
29 ESI = 6, // THR
30 EDI = 7,
32 kNoRegister = -1, // Signals an illegal register.
33};

◆ Register [4/5]

Enumerator
R0 
R1 
R2 
R3 
R4 
R5 
R6 
R7 
R8 
R9 
R10 
R11 
R12 
R13 
R14 
R15 
kNumberOfCpuRegisters 
kNoRegister 
FP 
NOTFP 
IP 
SP 
LR 
PC 
R0 
R1 
R2 
R3 
R4 
R5 
R6 
R7 
R8 
R9 
R10 
R11 
R12 
R13 
R14 
R15 
R16 
R17 
R18 
R19 
R20 
R21 
R22 
R23 
R24 
R25 
R26 
R27 
R28 
R29 
R30 
R31 
kNumberOfCpuRegisters 
kNoRegister 
kNoRegister2 
CSP 
ZR 
IP0 
IP1 
SP 
FP 
LR 
EAX 
ECX 
EDX 
EBX 
ESP 
EBP 
ESI 
EDI 
kNumberOfCpuRegisters 
kNoRegister 
ZR 
RA 
SP 
GP 
TP 
T0 
T1 
T2 
FP 
S1 
A0 
A1 
A2 
A3 
A4 
A5 
A6 
A7 
S2 
S3 
S4 
S5 
S6 
S7 
S8 
S9 
S10 
S11 
T3 
T4 
T5 
T6 
kNumberOfCpuRegisters 
kNoRegister 
RA2 
S0 
RAX 
RCX 
RDX 
RBX 
RSP 
RBP 
RSI 
RDI 
R8 
R9 
R10 
R11 
R12 
R13 
R14 
R15 
kNumberOfCpuRegisters 
kNoRegister 

Definition at line 43 of file constants_riscv.h.

43 {
44 // The correct name for this register is ZERO, but this conflicts with other
45 // globals.
46 ZR = 0,
47 RA = 1,
48 SP = 2,
49 GP = 3, // Shadow call stack on Fuchsia and Android
50 TP = 4,
51 T0 = 5,
52 T1 = 6,
53 T2 = 7,
54 FP = 8,
55 S1 = 9, // THR
56 A0 = 10,
57 A1 = 11,
58 A2 = 12, // CODE_REG
59 A3 = 13, // TMP
60 A4 = 14, // TMP2
61 A5 = 15, // PP, untagged
62 A6 = 16,
63 A7 = 17,
64 S2 = 18,
65 S3 = 19,
66 S4 = 20, // ARGS_DESC_REG
67 S5 = 21, // IC_DATA_REG
68 S6 = 22,
69 S7 = 23, // CALLEE_SAVED_TEMP2
70 S8 = 24, // CALLEE_SAVED_TEMP / FAR_TMP
71 S9 = 25, // DISPATCH_TABLE_REG
72 S10 = 26, // nullptr
73 S11 = 27, // WRITE_BARRIER_STATE
74 T3 = 28,
75 T4 = 29,
76 T5 = 30,
77 T6 = 31,
79 kNoRegister = -1,
80
81 RA2 = T0,
82 S0 = FP,
83
84 // Note that some compressed instructions can only take registers x8-x15 for
85 // some of their operands, so to reduce code size we assign the most popular
86 // uses to these registers.
87
88 // If the base register of a load/store is not SP, both the base register and
89 // source/destination register must be in x8-x15 and the offset must be
90 // aligned to make use a compressed instruction. So either,
91 // - PP, CODE_REG and IC_DATA_REG should all be assigned to x8-x15 and we
92 // should hold PP untagged like on ARM64. This makes the loads in the call
93 // sequence shorter, but adds extra PP tagging/untagging on entry and
94 // return.
95 // - PP should be assigned to a C-preserved register to avoid spilling it on
96 // leaf runtime calls.
97};
#define RA(width, name,...)

◆ Register [5/5]

Enumerator
R0 
R1 
R2 
R3 
R4 
R5 
R6 
R7 
R8 
R9 
R10 
R11 
R12 
R13 
R14 
R15 
kNumberOfCpuRegisters 
kNoRegister 
FP 
NOTFP 
IP 
SP 
LR 
PC 
R0 
R1 
R2 
R3 
R4 
R5 
R6 
R7 
R8 
R9 
R10 
R11 
R12 
R13 
R14 
R15 
R16 
R17 
R18 
R19 
R20 
R21 
R22 
R23 
R24 
R25 
R26 
R27 
R28 
R29 
R30 
R31 
kNumberOfCpuRegisters 
kNoRegister 
kNoRegister2 
CSP 
ZR 
IP0 
IP1 
SP 
FP 
LR 
EAX 
ECX 
EDX 
EBX 
ESP 
EBP 
ESI 
EDI 
kNumberOfCpuRegisters 
kNoRegister 
ZR 
RA 
SP 
GP 
TP 
T0 
T1 
T2 
FP 
S1 
A0 
A1 
A2 
A3 
A4 
A5 
A6 
A7 
S2 
S3 
S4 
S5 
S6 
S7 
S8 
S9 
S10 
S11 
T3 
T4 
T5 
T6 
kNumberOfCpuRegisters 
kNoRegister 
RA2 
S0 
RAX 
RCX 
RDX 
RBX 
RSP 
RBP 
RSI 
RDI 
R8 
R9 
R10 
R11 
R12 
R13 
R14 
R15 
kNumberOfCpuRegisters 
kNoRegister 

Definition at line 22 of file constants_x64.h.

22 {
23 RAX = 0,
24 RCX = 1,
25 RDX = 2,
26 RBX = 3,
27 RSP = 4, // SP
28 RBP = 5, // FP
29 RSI = 6,
30 RDI = 7,
31 R8 = 8,
32 R9 = 9,
33 R10 = 10,
34 R11 = 11, // TMP
35 R12 = 12, // CODE_REG
36 R13 = 13,
37 R14 = 14, // THR
38 R15 = 15, // PP
40 kNoRegister = -1, // Signals an illegal register.
41};

◆ Representation

Enumerator
kNumRepresentations 

Definition at line 66 of file locations.h.

66 {
67#define DECLARE_REPRESENTATION(name, __, ___, ____) k##name,
69#undef DECLARE_REPRESENTATION
71};
#define FOR_EACH_REPRESENTATION_KIND(M)
Definition locations.h:61
#define DECLARE_REPRESENTATION(name, __, ___, ____)
Definition locations.h:67
@ kNumRepresentations
Definition locations.h:70

◆ RexBits

Enumerator
REX_NONE 
REX_B 
REX_X 
REX_R 
REX_W 
REX_PREFIX 

Definition at line 110 of file constants_x64.h.

110 {
111 REX_NONE = 0,
112 REX_B = 1 << 0,
113 REX_X = 1 << 1,
114 REX_R = 1 << 2,
115 REX_W = 1 << 3,
116 REX_PREFIX = 1 << 6
117};

◆ RootSlices [1/2]

Enumerator
kIsolate 
kNumFixedRootSlices 
kIsolate 
kObjectIdRing 
kStoreBuffer 
kNumRootSlices 

Definition at line 578 of file marker.cc.

578 {
579 kIsolate = 0,
581};
@ kNumFixedRootSlices
Definition marker.cc:580
@ kIsolate
Definition marker.cc:579

◆ RootSlices [2/2]

Enumerator
kIsolate 
kNumFixedRootSlices 
kIsolate 
kObjectIdRing 
kStoreBuffer 
kNumRootSlices 

Definition at line 1180 of file scavenger.cc.

1180 {
1181 kIsolate = 0,
1185};
@ kObjectIdRing
Definition marker.cc:621
@ kNumRootSlices

◆ RoundingMode

Enumerator
RNE 
RTZ 
RDN 
RUP 
RMM 
DYN 

Definition at line 908 of file constants_riscv.h.

908 {
909 RNE = 0b000, // Round to Nearest, ties to Even
910 RTZ = 0b001, // Round toward Zero
911 RDN = 0b010, // Round Down (toward negative infinity)
912 RUP = 0b011, // Round Up (toward positive infinity)
913 RMM = 0b100, // Round to nearest, ties to Max Magnitude
914 DYN = 0b111, // Dynamic rounding mode
915};

◆ RuntimeCallDeoptAbility

enum class dart::RuntimeCallDeoptAbility
strong
Enumerator
kCanLazyDeopt 
kCannotLazyDeopt 

Definition at line 276 of file thread.h.

276 {
277 // There was no leaf call or a leaf call that can cause deoptimization
278 // after-call.
280 // There was a leaf call and the VM cannot cause deoptimize after-call.
282};

◆ SafepointLevel

Enumerator
kGC 
kGCAndDeopt 
kGCAndDeoptAndReload 
kNumLevels 
kNoSafepoint 

Definition at line 289 of file thread.h.

289 {
290 // Safe to GC
291 kGC,
292 // Safe to GC as well as Deopt.
294 // Safe to GC, Deopt as well as Reload.
296 // Number of levels.
298
299 // No safepoint.
301};
@ kGC
Definition thread.h:291
@ kNumLevels
Definition thread.h:297
@ kNoSafepoint
Definition thread.h:300
@ kGCAndDeoptAndReload
Definition thread.h:295
@ kGCAndDeopt
Definition thread.h:293

◆ ScaleFactor [1/5]

Enumerator
TIMES_1 
TIMES_2 
TIMES_4 
TIMES_8 
TIMES_16 
TIMES_COMPRESSED_WORD_SIZE 
TIMES_COMPRESSED_HALF_WORD_SIZE 
TIMES_1 
TIMES_2 
TIMES_4 
TIMES_8 
TIMES_16 
TIMES_COMPRESSED_WORD_SIZE 
TIMES_COMPRESSED_HALF_WORD_SIZE 
TIMES_1 
TIMES_2 
TIMES_4 
TIMES_8 
TIMES_16 
TIMES_COMPRESSED_WORD_SIZE 
TIMES_COMPRESSED_HALF_WORD_SIZE 
TIMES_1 
TIMES_2 
TIMES_4 
TIMES_8 
TIMES_16 
TIMES_COMPRESSED_WORD_SIZE 
TIMES_COMPRESSED_HALF_WORD_SIZE 
TIMES_1 
TIMES_2 
TIMES_4 
TIMES_8 
TIMES_16 
TIMES_COMPRESSED_WORD_SIZE 
TIMES_COMPRESSED_HALF_WORD_SIZE 

Definition at line 943 of file constants_arm.h.

943 {
944 TIMES_1 = 0,
945 TIMES_2 = 1,
946 TIMES_4 = 2,
947 TIMES_8 = 3,
948 TIMES_16 = 4,
949// Don't use (dart::)kWordSizeLog2, as this needs to work for crossword as
950// well. If this is included, we know the target is 32 bit.
951#if defined(TARGET_ARCH_IS_32_BIT)
952 // Used for Smi-boxed indices.
953 TIMES_HALF_WORD_SIZE = kInt32SizeLog2 - 1,
954 // Used for unboxed indices.
955 TIMES_WORD_SIZE = kInt32SizeLog2,
956#else
957#error "Unexpected word size"
958#endif
959#if !defined(DART_COMPRESSED_POINTERS)
960 TIMES_COMPRESSED_WORD_SIZE = TIMES_WORD_SIZE,
961#else
962#error Cannot compress ARM32
963#endif
964 // Used for Smi-boxed indices.
966};
@ TIMES_COMPRESSED_HALF_WORD_SIZE
@ TIMES_COMPRESSED_WORD_SIZE
constexpr intptr_t kInt32SizeLog2
Definition globals.h:449

◆ ScaleFactor [2/5]

Enumerator
TIMES_1 
TIMES_2 
TIMES_4 
TIMES_8 
TIMES_16 
TIMES_COMPRESSED_WORD_SIZE 
TIMES_COMPRESSED_HALF_WORD_SIZE 
TIMES_1 
TIMES_2 
TIMES_4 
TIMES_8 
TIMES_16 
TIMES_COMPRESSED_WORD_SIZE 
TIMES_COMPRESSED_HALF_WORD_SIZE 
TIMES_1 
TIMES_2 
TIMES_4 
TIMES_8 
TIMES_16 
TIMES_COMPRESSED_WORD_SIZE 
TIMES_COMPRESSED_HALF_WORD_SIZE 
TIMES_1 
TIMES_2 
TIMES_4 
TIMES_8 
TIMES_16 
TIMES_COMPRESSED_WORD_SIZE 
TIMES_COMPRESSED_HALF_WORD_SIZE 
TIMES_1 
TIMES_2 
TIMES_4 
TIMES_8 
TIMES_16 
TIMES_COMPRESSED_WORD_SIZE 
TIMES_COMPRESSED_HALF_WORD_SIZE 

Definition at line 1293 of file constants_arm64.h.

1293 {
1294 TIMES_1 = 0,
1295 TIMES_2 = 1,
1296 TIMES_4 = 2,
1297 TIMES_8 = 3,
1298 TIMES_16 = 4,
1299// We can't include vm/compiler/runtime_api.h, so just be explicit instead
1300// of using (dart::)kWordSizeLog2.
1301#if defined(TARGET_ARCH_IS_64_BIT)
1302 // Used for Smi-boxed indices.
1303 TIMES_HALF_WORD_SIZE = kInt64SizeLog2 - 1,
1304 // Used for unboxed indices.
1305 TIMES_WORD_SIZE = kInt64SizeLog2,
1306#else
1307#error "Unexpected word size"
1308#endif
1309#if !defined(DART_COMPRESSED_POINTERS)
1310 TIMES_COMPRESSED_WORD_SIZE = TIMES_WORD_SIZE,
1311#else
1312 TIMES_COMPRESSED_WORD_SIZE = TIMES_HALF_WORD_SIZE,
1313#endif
1314 // Used for Smi-boxed indices.
1316};
constexpr intptr_t kInt64SizeLog2
Definition globals.h:452

◆ ScaleFactor [3/5]

Enumerator
TIMES_1 
TIMES_2 
TIMES_4 
TIMES_8 
TIMES_16 
TIMES_COMPRESSED_WORD_SIZE 
TIMES_COMPRESSED_HALF_WORD_SIZE 
TIMES_1 
TIMES_2 
TIMES_4 
TIMES_8 
TIMES_16 
TIMES_COMPRESSED_WORD_SIZE 
TIMES_COMPRESSED_HALF_WORD_SIZE 
TIMES_1 
TIMES_2 
TIMES_4 
TIMES_8 
TIMES_16 
TIMES_COMPRESSED_WORD_SIZE 
TIMES_COMPRESSED_HALF_WORD_SIZE 
TIMES_1 
TIMES_2 
TIMES_4 
TIMES_8 
TIMES_16 
TIMES_COMPRESSED_WORD_SIZE 
TIMES_COMPRESSED_HALF_WORD_SIZE 
TIMES_1 
TIMES_2 
TIMES_4 
TIMES_8 
TIMES_16 
TIMES_COMPRESSED_WORD_SIZE 
TIMES_COMPRESSED_HALF_WORD_SIZE 

Definition at line 404 of file constants_ia32.h.

404 {
405 TIMES_1 = 0,
406 TIMES_2 = 1,
407 TIMES_4 = 2,
408 TIMES_8 = 3,
409 TIMES_16 = 4,
410// We can't include vm/compiler/runtime_api.h, so just be explicit instead
411// of using (dart::)kWordSizeLog2.
412#if defined(TARGET_ARCH_IS_32_BIT)
413 // Used for Smi-boxed indices.
414 TIMES_HALF_WORD_SIZE = kInt32SizeLog2 - 1,
415 // Used for unboxed indices.
416 TIMES_WORD_SIZE = kInt32SizeLog2,
417#else
418#error "Unexpected word size"
419#endif
420#if !defined(DART_COMPRESSED_POINTERS)
421 TIMES_COMPRESSED_WORD_SIZE = TIMES_WORD_SIZE,
422#else
423#error Cannot compress IA32
424#endif
425 // Used for Smi-boxed indices.
427};

◆ ScaleFactor [4/5]

Enumerator
TIMES_1 
TIMES_2 
TIMES_4 
TIMES_8 
TIMES_16 
TIMES_COMPRESSED_WORD_SIZE 
TIMES_COMPRESSED_HALF_WORD_SIZE 
TIMES_1 
TIMES_2 
TIMES_4 
TIMES_8 
TIMES_16 
TIMES_COMPRESSED_WORD_SIZE 
TIMES_COMPRESSED_HALF_WORD_SIZE 
TIMES_1 
TIMES_2 
TIMES_4 
TIMES_8 
TIMES_16 
TIMES_COMPRESSED_WORD_SIZE 
TIMES_COMPRESSED_HALF_WORD_SIZE 
TIMES_1 
TIMES_2 
TIMES_4 
TIMES_8 
TIMES_16 
TIMES_COMPRESSED_WORD_SIZE 
TIMES_COMPRESSED_HALF_WORD_SIZE 
TIMES_1 
TIMES_2 
TIMES_4 
TIMES_8 
TIMES_16 
TIMES_COMPRESSED_WORD_SIZE 
TIMES_COMPRESSED_HALF_WORD_SIZE 

Definition at line 656 of file constants_riscv.h.

656 {
657 TIMES_1 = 0,
658 TIMES_2 = 1,
659 TIMES_4 = 2,
660 TIMES_8 = 3,
661 TIMES_16 = 4,
662// We can't include vm/compiler/runtime_api.h, so just be explicit instead
663// of using (dart::)kWordSizeLog2.
664#if defined(TARGET_ARCH_IS_64_BIT)
665 // Used for Smi-boxed indices.
666 TIMES_HALF_WORD_SIZE = kInt64SizeLog2 - 1,
667 // Used for unboxed indices.
668 TIMES_WORD_SIZE = kInt64SizeLog2,
669#elif defined(TARGET_ARCH_IS_32_BIT)
670 // Used for Smi-boxed indices.
671 TIMES_HALF_WORD_SIZE = kInt32SizeLog2 - 1,
672 // Used for unboxed indices.
673 TIMES_WORD_SIZE = kInt32SizeLog2,
674#else
675#error "Unexpected word size"
676#endif
677#if !defined(DART_COMPRESSED_POINTERS)
678 TIMES_COMPRESSED_WORD_SIZE = TIMES_WORD_SIZE,
679#else
680 TIMES_COMPRESSED_WORD_SIZE = TIMES_HALF_WORD_SIZE,
681#endif
682 // Used for Smi-boxed indices.
684};

◆ ScaleFactor [5/5]

Enumerator
TIMES_1 
TIMES_2 
TIMES_4 
TIMES_8 
TIMES_16 
TIMES_COMPRESSED_WORD_SIZE 
TIMES_COMPRESSED_HALF_WORD_SIZE 
TIMES_1 
TIMES_2 
TIMES_4 
TIMES_8 
TIMES_16 
TIMES_COMPRESSED_WORD_SIZE 
TIMES_COMPRESSED_HALF_WORD_SIZE 
TIMES_1 
TIMES_2 
TIMES_4 
TIMES_8 
TIMES_16 
TIMES_COMPRESSED_WORD_SIZE 
TIMES_COMPRESSED_HALF_WORD_SIZE 
TIMES_1 
TIMES_2 
TIMES_4 
TIMES_8 
TIMES_16 
TIMES_COMPRESSED_WORD_SIZE 
TIMES_COMPRESSED_HALF_WORD_SIZE 
TIMES_1 
TIMES_2 
TIMES_4 
TIMES_8 
TIMES_16 
TIMES_COMPRESSED_WORD_SIZE 
TIMES_COMPRESSED_HALF_WORD_SIZE 

Definition at line 478 of file constants_x64.h.

478 {
479 TIMES_1 = 0,
480 TIMES_2 = 1,
481 TIMES_4 = 2,
482 TIMES_8 = 3,
483 // Note that Intel addressing does not support this addressing.
484 // > Scale factor — A value of 2, 4, or 8 that is multiplied by the index
485 // > value.
486 // https://software.intel.com/en-us/download/intel-64-and-ia-32-architectures-sdm-combined-volumes-1-2a-2b-2c-2d-3a-3b-3c-3d-and-4
487 // 3.7.5 Specifying an Offset
488 TIMES_16 = 4,
489// We can't include vm/compiler/runtime_api.h, so just be explicit instead
490// of using (dart::)kWordSizeLog2.
491#if defined(TARGET_ARCH_IS_64_BIT)
492 // Used for Smi-boxed indices.
493 TIMES_HALF_WORD_SIZE = kInt64SizeLog2 - 1,
494 // Used for unboxed indices.
495 TIMES_WORD_SIZE = kInt64SizeLog2,
496#else
497#error "Unexpected word size"
498#endif
499#if !defined(DART_COMPRESSED_POINTERS)
500 TIMES_COMPRESSED_WORD_SIZE = TIMES_WORD_SIZE,
501#else
502 TIMES_COMPRESSED_WORD_SIZE = TIMES_HALF_WORD_SIZE,
503#endif
504 // Used for Smi-boxed indices.
506};

◆ SentinelType

Enumerator
kCollectedSentinel 
kExpiredSentinel 
kFreeSentinel 

Definition at line 1529 of file service.cc.

1529 {
1533};
@ kExpiredSentinel
Definition service.cc:1531
@ kFreeSentinel
Definition service.cc:1532
@ kCollectedSentinel
Definition service.cc:1530

◆ Shift [1/2]

Enumerator
kNoShift 
LSL 
LSR 
ASR 
ROR 
kMaxShift 
kNoShift 
LSL 
LSR 
ASR 
ROR 
kMaxShift 

Definition at line 842 of file constants_arm.h.

842 {
843 kNoShift = -1,
844 LSL = 0, // Logical shift left
845 LSR = 1, // Logical shift right
846 ASR = 2, // Arithmetic shift right
847 ROR = 3, // Rotate right
848 kMaxShift = 4
849};

◆ Shift [2/2]

Enumerator
kNoShift 
LSL 
LSR 
ASR 
ROR 
kMaxShift 
kNoShift 
LSL 
LSR 
ASR 
ROR 
kMaxShift 

Definition at line 1133 of file constants_arm64.h.

1133 {
1134 kNoShift = -1,
1135 LSL = 0, // Logical shift left
1136 LSR = 1, // Logical shift right
1137 ASR = 2, // Arithmetic shift right
1138 ROR = 3, // Rotate right
1139 kMaxShift = 4,
1140};

◆ SIMDCopyOp

Enumerator
SIMDCopyMask 
SIMDCopyFixed 
VDUPI 
VINSI 
VMOVW 
VMOVX 
VDUP 
VINS 

Definition at line 980 of file constants_arm64.h.

980 {
981 SIMDCopyMask = 0x9fe08400,
983 VDUPI = SIMDCopyFixed | B30 | B11,
984 VINSI = SIMDCopyFixed | B30 | B12 | B11,
985 VMOVW = SIMDCopyFixed | B13 | B12 | B11,
986 VMOVX = SIMDCopyFixed | B30 | B13 | B12 | B11,
989};

◆ SIMDThreeSameOp

Enumerator
SIMDThreeSameMask 
SIMDThreeSameFixed 
VAND 
VORR 
VEOR 
VADDW 
VADDX 
VSUBW 
VSUBX 
VADDS 
VADDD 
VSUBS 
VSUBD 
VMULS 
VMULD 
VDIVS 
VDIVD 
VCEQS 
VCEQD 
VCGES 
VCGED 
VCGTS 
VCGTD 
VMAXS 
VMAXD 
VMINS 
VMIND 
VRECPSS 
VRSQRTSS 

Definition at line 992 of file constants_arm64.h.

992 {
993 SIMDThreeSameMask = 0x9f200400,
994 SIMDThreeSameFixed = DPSimd1Fixed | B21 | B10,
995 VAND = SIMDThreeSameFixed | B30 | B12 | B11,
996 VORR = SIMDThreeSameFixed | B30 | B23 | B12 | B11,
997 VEOR = SIMDThreeSameFixed | B30 | B29 | B12 | B11,
998 VADDW = SIMDThreeSameFixed | B30 | B23 | B15,
999 VADDX = SIMDThreeSameFixed | B30 | B23 | B22 | B15,
1000 VSUBW = SIMDThreeSameFixed | B30 | B29 | B23 | B15,
1001 VSUBX = SIMDThreeSameFixed | B30 | B29 | B23 | B22 | B15,
1002 VADDS = SIMDThreeSameFixed | B30 | B15 | B14 | B12,
1003 VADDD = SIMDThreeSameFixed | B30 | B22 | B15 | B14 | B12,
1004 VSUBS = SIMDThreeSameFixed | B30 | B23 | B15 | B14 | B12,
1005 VSUBD = SIMDThreeSameFixed | B30 | B23 | B22 | B15 | B14 | B12,
1006 VMULS = SIMDThreeSameFixed | B30 | B29 | B15 | B14 | B12 | B11,
1007 VMULD = SIMDThreeSameFixed | B30 | B29 | B22 | B15 | B14 | B12 | B11,
1008 VDIVS = SIMDThreeSameFixed | B30 | B29 | B15 | B14 | B13 | B12 | B11,
1009 VDIVD = SIMDThreeSameFixed | B30 | B29 | B22 | B15 | B14 | B13 | B12 | B11,
1010 VCEQS = SIMDThreeSameFixed | B30 | B15 | B14 | B13,
1011 VCEQD = SIMDThreeSameFixed | B30 | B22 | B15 | B14 | B13,
1012 VCGES = SIMDThreeSameFixed | B30 | B29 | B15 | B14 | B13,
1013 VCGED = SIMDThreeSameFixed | B30 | B29 | B22 | B15 | B14 | B13,
1014 VCGTS = SIMDThreeSameFixed | B30 | B29 | B23 | B15 | B14 | B13,
1015 VCGTD = SIMDThreeSameFixed | B30 | B29 | B23 | B22 | B15 | B14 | B13,
1016 VMAXS = SIMDThreeSameFixed | B30 | B15 | B14 | B13 | B12,
1017 VMAXD = SIMDThreeSameFixed | B30 | B22 | B15 | B14 | B13 | B12,
1018 VMINS = SIMDThreeSameFixed | B30 | B23 | B15 | B14 | B13 | B12,
1019 VMIND = SIMDThreeSameFixed | B30 | B23 | B22 | B15 | B14 | B13 | B12,
1020 VRECPSS = SIMDThreeSameFixed | B30 | B15 | B14 | B13 | B12 | B11,
1021 VRSQRTSS = SIMDThreeSameFixed | B30 | B23 | B15 | B14 | B13 | B12 | B11,
1022};
@ SIMDThreeSameFixed
@ SIMDThreeSameMask

◆ SIMDTwoRegOp

Enumerator
SIMDTwoRegMask 
SIMDTwoRegFixed 
VNOT 
VABSS 
VNEGS 
VABSD 
VNEGD 
VSQRTS 
VSQRTD 
VRECPES 
VRSQRTES 

Definition at line 1025 of file constants_arm64.h.

1025 {
1026 SIMDTwoRegMask = 0x9f3e0c00,
1027 SIMDTwoRegFixed = DPSimd1Fixed | B21 | B11,
1028 VNOT = SIMDTwoRegFixed | B30 | B29 | B14 | B12,
1029 VABSS = SIMDTwoRegFixed | B30 | B23 | B15 | B14 | B13 | B12,
1030 VNEGS = SIMDTwoRegFixed | B30 | B29 | B23 | B15 | B14 | B13 | B12,
1031 VABSD = SIMDTwoRegFixed | B30 | B23 | B22 | B15 | B14 | B13 | B12,
1032 VNEGD = SIMDTwoRegFixed | B30 | B29 | B23 | B22 | B15 | B14 | B13 | B12,
1033 VSQRTS = SIMDTwoRegFixed | B30 | B29 | B23 | B16 | B15 | B14 | B13 | B12,
1034 VSQRTD =
1035 SIMDTwoRegFixed | B30 | B29 | B23 | B22 | B16 | B15 | B14 | B13 | B12,
1036 VRECPES = SIMDTwoRegFixed | B30 | B23 | B16 | B15 | B14 | B12,
1037 VRSQRTES = SIMDTwoRegFixed | B30 | B29 | B23 | B16 | B15 | B14 | B12,
1038};

◆ SRegister

Enumerator
kNoSRegister 
S0 
S1 
S2 
S3 
S4 
S5 
S6 
S7 
S8 
S9 
S10 
S11 
S12 
S13 
S14 
S15 
S16 
S17 
S18 
S19 
S20 
S21 
S22 
S23 
S24 
S25 
S26 
S27 
S28 
S29 
S30 
S31 
kNumberOfSRegisters 

Definition at line 116 of file constants_arm.h.

116 {
117 kNoSRegister = -1,
118 S0 = 0,
119 S1 = 1,
120 S2 = 2,
121 S3 = 3,
122 S4 = 4,
123 S5 = 5,
124 S6 = 6,
125 S7 = 7,
126 S8 = 8,
127 S9 = 9,
128 S10 = 10,
129 S11 = 11,
130 S12 = 12,
131 S13 = 13,
132 S14 = 14,
133 S15 = 15,
134 S16 = 16,
135 S17 = 17,
136 S18 = 18,
137 S19 = 19,
138 S20 = 20,
139 S21 = 21,
140 S22 = 22,
141 S23 = 23,
142 S24 = 24,
143 S25 = 25,
144 S26 = 26,
145 S27 = 27,
146 S28 = 28,
147 S29 = 29,
148 S30 = 30,
149 S31 = 31,
151};
@ kNoSRegister
@ kNumberOfSRegisters

◆ StoreBarrierType

Enumerator
kNoStoreBarrier 
kEmitStoreBarrier 

Definition at line 6252 of file il.h.

@ kNoStoreBarrier
Definition il.h:6252
@ kEmitStoreBarrier
Definition il.h:6252

◆ SystemOp

Enumerator
SystemMask 
SystemFixed 
HINT 
CLREX 

Definition at line 779 of file constants_arm64.h.

779 {
780 SystemMask = 0xffc00000,
782 HINT = SystemFixed | B17 | B16 | B13 | B4 | B3 | B2 | B1 | B0,
783 CLREX = SystemFixed | B17 | B16 | B13 | B12 | B11 | B10 | B9 | B8 | B6 | B4 |
784 B3 | B2 | B1 | B0,
785};

◆ TestAndBranchOp

Enumerator
TestAndBranchMask 
TestAndBranchFixed 
TBZ 
TBNZ 

Definition at line 788 of file constants_arm64.h.

788 {
789 TestAndBranchMask = 0x7e000000,
792 TBNZ = TestAndBranchFixed | B24,
793};
@ TestAndBranchMask
@ TestAndBranchFixed

◆ TimelineOrSamplesResponseFormat

Enumerator
JSON 
Perfetto 

Definition at line 4146 of file service.cc.

4146: bool { JSON = false, Perfetto = true };
@ JSON
Definition service.cc:4146
@ Perfetto
Definition service.cc:4146

◆ TraversalRules

Enumerator
kInternalToIsolateGroup 
kExternalBetweenIsolateGroups 

Definition at line 34 of file object_graph_copy.h.

34 {
37} TraversalRules;
@ kInternalToIsolateGroup
@ kExternalBetweenIsolateGroups

◆ TTSTestResult

Enumerator
kFail 
kTTS 
kExistingSTCEntry 
kNewSTCEntry 
kRuntimeCheck 
kSpecialize 
kRespecialize 
kNumTestResults 

Definition at line 205 of file type_testing_stubs_test.cc.

205 {
206 // The TTS invocation should enter the runtime and trigger a TypeError.
207 kFail,
208 // The TTS invocation should return a result from the TTS stub without
209 // entering the runtime and without an associated STC entry.
210 kTTS,
211 // The TTS invocation should return a result from checking the STC without
212 // entering the runtime. The STC prior to invocation should be non-null and
213 // include a matching entry for the test case.
215 // The TTS invocation should enter the runtime and add a new entry to the
216 // STC, creating a new STC if necessary.
218 // The TTS invocation should enter the runtime and return a successful check
219 // but without adding an entry to the STC. This should only happen when the
220 // STC has hit the limit described by FLAG_max_subtype_cache_entries prior
221 // to the invocation.
223 // The TTS invocation should enter the runtime and the TTS is specialized
224 // after this test case. This test case should not create a new STC or modify
225 // an existing STC.
226 //
227 // Used only within TTSTestState::InvokeLazilySpecializedStub. This is
228 // needed because there is a single special case for updating the STC that
229 // happens only when specializing the lazy specialization stub, and so we
230 // need to distinguish specialization and respecialization.
232 // The TTS invocation should enter the runtime and the TTS is respecialized
233 // after this test case. This test case should not create a new STC or modify
234 // an existing STC.
235 //
236 // Used only when calling TTSTestState::InvokeExistingStub.
238 // Used for static assert below only.
240};

◆ TypeCheckMode

Enumerator
kTypeCheckFromLazySpecializeStub 
kTypeCheckFromSlowStub 
kTypeCheckFromInline 

Definition at line 12 of file type_check_mode.h.

12 {
13 // TypeCheck is invoked from LazySpecializeTypeTest stub.
14 // It should replace stub on the type with a specialized version.
16
17 // TypeCheck is invoked from the SlowTypeTest stub.
18 // This means that cache can be lazily created (if needed)
19 // and dst_name can be fetched from the pool.
21
22 // TypeCheck is invoked from normal inline AssertAssignable.
23 // Both cache and dst_name must be already populated.
25};
@ kTypeCheckFromLazySpecializeStub
@ kTypeCheckFromInline
@ kTypeCheckFromSlowStub

◆ TypeDataField

Enumerator
TypedDataBase_length 
TypedDataView_offset_in_bytes 
TypedDataView_typed_data 

Definition at line 1249 of file il_test.cc.

1249 {
1253};
@ TypedDataView_offset_in_bytes
Definition il_test.cc:1251
@ TypedDataBase_length
Definition il_test.cc:1250
@ TypedDataView_typed_data
Definition il_test.cc:1252

◆ TypedDataElementType

Definition at line 123 of file raw_object.h.

123 {
124#define V(name) k##name##Element,
126#undef V
127};
T __attribute__((ext_vector_type(N))) V

◆ TypedDataViewFormat

Enumerator
kTypedDataViewFromC 
kTypedDataViewFromDart 

Definition at line 1497 of file message_snapshot.cc.

1497 {
1500};
@ kTypedDataViewFromDart

◆ TypeEquality

enum class dart::TypeEquality
strong
Enumerator
kCanonical 
kSyntactical 
kInSubtypeTest 

Definition at line 1120 of file object.h.

1120 {
1121 kCanonical = 0,
1122 kSyntactical = 1,
1123 kInSubtypeTest = 2,
1124};

◆ UnconditionalBranchOp

Enumerator
UnconditionalBranchMask 
UnconditionalBranchFixed 
BL 

Definition at line 796 of file constants_arm64.h.

◆ UnconditionalBranchRegOp

Enumerator
UnconditionalBranchRegMask 
UnconditionalBranchRegFixed 
BR 
BLR 
RET 

Definition at line 804 of file constants_arm64.h.

804 {
805 UnconditionalBranchRegMask = 0xfe000000,
807 BR = UnconditionalBranchRegFixed | B20 | B19 | B18 | B17 | B16,
808 BLR = BR | B21,
809 RET = BR | B22,
810};
@ UnconditionalBranchRegFixed
@ UnconditionalBranchRegMask

◆ ValidationPolicy

enum class dart::ValidationPolicy
strong
Enumerator
kValidateFrames 
kDontValidateFrames 

Definition at line 271 of file thread.h.

◆ VRegister

Enumerator
V0 
V1 
V2 
V3 
V4 
V5 
V6 
V7 
V8 
V9 
V10 
V11 
V12 
V13 
V14 
V15 
V16 
V17 
V18 
V19 
V20 
V21 
V22 
V23 
V24 
V25 
V26 
V27 
V28 
V29 
V30 
V31 
kNumberOfVRegisters 
kNoVRegister 

Definition at line 84 of file constants_arm64.h.

84 {
85 // v0 Volatile; Parameter/scratch register, result register.
86 V0 = 0,
87 // v1-v7 Volatile; Parameter/scratch register.
88 V1 = 1,
89 V2 = 2,
90 V3 = 3,
91 V4 = 4,
92 V5 = 5,
93 V6 = 6,
94 V7 = 7,
95 // v8-v15 Non-volatile; Scratch registers
96 // Only the bottom 64 bits are non-volatile! [ARM IHI 0055B, 5.1.2]
97 V8 = 8,
98 V9 = 9,
99 V10 = 10,
100 V11 = 11,
101 V12 = 12,
102 V13 = 13,
103 V14 = 14,
104 V15 = 15,
105 // v16-v31 Volatile; Scratch registers.
106 V16 = 16,
107 V17 = 17,
108 V18 = 18,
109 V19 = 19,
110 V20 = 20,
111 V21 = 21,
112 V22 = 22,
113 V23 = 23,
114 V24 = 24,
115 V25 = 25,
116 V26 = 26,
117 V27 = 27,
118 V28 = 28,
119 V29 = 29,
120 V30 = 30,
121 V31 = 31,
123 kNoVRegister = -1,
124};
@ kNumberOfVRegisters

◆ WeakSlices [1/2]

Enumerator
kWeakHandles 
kWeakTables 
kObjectIdRing 
kRememberedSet 
kNumWeakSlices 
kWeakHandles 
kWeakTables 
kProgressBars 
kRememberLiveTemporaries 
kPruneWeak 
kNumWeakSlices 

Definition at line 618 of file marker.cc.

618 {
619 kWeakHandles = 0,
624};
@ kRememberedSet
Definition marker.cc:622
@ kWeakTables
Definition marker.cc:620
@ kNumWeakSlices
Definition marker.cc:623
@ kWeakHandles
Definition marker.cc:619

◆ WeakSlices [2/2]

Enumerator
kWeakHandles 
kWeakTables 
kObjectIdRing 
kRememberedSet 
kNumWeakSlices 
kWeakHandles 
kWeakTables 
kProgressBars 
kRememberLiveTemporaries 
kPruneWeak 
kNumWeakSlices 

Definition at line 1213 of file scavenger.cc.

1213 {
1214 kWeakHandles = 0,
1218 kPruneWeak,
1220};
@ kPruneWeak
@ kProgressBars
@ kRememberLiveTemporaries

◆ XmmRegister [1/2]

Enumerator
XMM0 
XMM1 
XMM2 
XMM3 
XMM4 
XMM5 
XMM6 
XMM7 
kNumberOfXmmRegisters 
kNoXmmRegister 
XMM0 
XMM1 
XMM2 
XMM3 
XMM4 
XMM5 
XMM6 
XMM7 
XMM8 
XMM9 
XMM10 
XMM11 
XMM12 
XMM13 
XMM14 
XMM15 
kNumberOfXmmRegisters 
kNoXmmRegister 

Definition at line 58 of file constants_ia32.h.

58 {
59 XMM0 = 0,
60 XMM1 = 1,
61 XMM2 = 2,
62 XMM3 = 3,
63 XMM4 = 4,
64 XMM5 = 5,
65 XMM6 = 6,
66 XMM7 = 7,
68 kNoXmmRegister = -1 // Signals an illegal register.
69};
@ kNumberOfXmmRegisters
@ kNoXmmRegister

◆ XmmRegister [2/2]

Enumerator
XMM0 
XMM1 
XMM2 
XMM3 
XMM4 
XMM5 
XMM6 
XMM7 
kNumberOfXmmRegisters 
kNoXmmRegister 
XMM0 
XMM1 
XMM2 
XMM3 
XMM4 
XMM5 
XMM6 
XMM7 
XMM8 
XMM9 
XMM10 
XMM11 
XMM12 
XMM13 
XMM14 
XMM15 
kNumberOfXmmRegisters 
kNoXmmRegister 

Definition at line 76 of file constants_x64.h.

76 {
77 XMM0 = 0,
78 XMM1 = 1,
79 XMM2 = 2,
80 XMM3 = 3,
81 XMM4 = 4,
82 XMM5 = 5,
83 XMM6 = 6,
84 XMM7 = 7,
85 XMM8 = 8,
86 XMM9 = 9,
87 XMM10 = 10,
88 XMM11 = 11,
89 XMM12 = 12,
90 XMM13 = 13,
91 XMM14 = 14,
92 XMM15 = 15,
94 kNoXmmRegister = -1 // Signals an illegal register.
95};

Function Documentation

◆ __msan_unpoison()

void dart::__msan_unpoison ( const volatile void *  ,
size_t   
)

Definition at line 4220 of file runtime_entry.cc.

4220 {
4221 UNREACHABLE();
4222}
#define UNREACHABLE()
Definition assert.h:248

◆ __msan_unpoison_param()

void dart::__msan_unpoison_param ( size_t  )

Definition at line 4223 of file runtime_entry.cc.

4223 {
4224 UNREACHABLE();
4225}

◆ __tsan_acquire()

void dart::__tsan_acquire ( void *  addr)

Definition at line 4229 of file runtime_entry.cc.

4229 {
4230 UNREACHABLE();
4231}

◆ __tsan_release()

void dart::__tsan_release ( void *  addr)

Definition at line 4232 of file runtime_entry.cc.

4232 {
4233 UNREACHABLE();
4234}

◆ _currentThread()

GDB_HELPER void * dart::_currentThread ( )

Definition at line 25 of file gdb_helpers.cc.

25 {
26 return OSThread::CurrentVMThread();
27}

◆ _disassemble()

GDB_HELPER void dart::_disassemble ( uword  pc)

Definition at line 41 of file gdb_helpers.cc.

41 {
42 Code& code = Code::Handle(Code::FindCodeUnsafe(pc));
43 if (code.IsNull()) {
44 OS::PrintErr("No code found\n");
45 } else {
46 Object& owner = Object::Handle(code.owner());
47 if (owner.IsFunction()) {
48 Disassembler::DisassembleCode(Function::Cast(owner), code,
49 code.is_optimized());
50 } else {
51 Disassembler::DisassembleStub(code.Name(), code);
52 }
53 }
54}

◆ _handle()

GDB_HELPER Object * dart::_handle ( uword  object)

Definition at line 36 of file gdb_helpers.cc.

36 {
37 return &Object::Handle(static_cast<ObjectPtr>(object));
38}

◆ _printDartStackTrace()

GDB_HELPER void dart::_printDartStackTrace ( )

Definition at line 62 of file gdb_helpers.cc.

62 {
63 const StackTrace& stacktrace = GetCurrentStackTrace(0);
64 OS::PrintErr("=== Current Trace:\n%s===\n", stacktrace.ToCString());
65}
virtual const char * ToCString() const
Definition object.h:366
const StackTrace & GetCurrentStackTrace(int skip_frames)
Definition stacktrace.cc:94

◆ _printGeneratedStackTrace()

GDB_HELPER void dart::_printGeneratedStackTrace ( uword  fp,
uword  sp,
uword  pc 
)

Definition at line 79 of file gdb_helpers.cc.

79 {
80 StackFrameIterator frames(fp, sp, pc, ValidationPolicy::kDontValidateFrames,
81 Thread::Current(),
82 StackFrameIterator::kNoCrossThreadIteration);
83 StackFrame* frame = frames.NextFrame();
84 while (frame != nullptr) {
85 OS::PrintErr("%s\n", frame->ToCString());
86 frame = frames.NextFrame();
87 }
88}
double frame
Definition examples.cpp:31

◆ _printObjectPtr()

GDB_HELPER void dart::_printObjectPtr ( uword  object)

Definition at line 30 of file gdb_helpers.cc.

30 {
31 OS::PrintErr("%s\n",
32 Object::Handle(static_cast<ObjectPtr>(object)).ToCString());
33}

◆ _printStackTrace()

GDB_HELPER void dart::_printStackTrace ( )

Definition at line 70 of file gdb_helpers.cc.

70 {
71 StackFrame::DumpCurrentTrace();
72}

◆ _printStackTraceWithLocals()

GDB_HELPER void dart::_printStackTraceWithLocals ( )

Definition at line 115 of file gdb_helpers.cc.

115 {
117 StackFrameIterator frames(ValidationPolicy::kDontValidateFrames,
118 Thread::Current(),
119 StackFrameIterator::kNoCrossThreadIteration);
120 StackFrame* frame = frames.NextFrame();
121 while (frame != nullptr) {
122 OS::PrintErr("%s\n", frame->ToCString());
123 frame->VisitObjectPointers(&visitor);
124 frame = frames.NextFrame();
125 }
126}

◆ AcceptCompilation()

static ObjectPtr dart::AcceptCompilation ( Thread thread)
static

Definition at line 641 of file isolate_reload.cc.

641 {
642 TransitionVMToNative transition(thread);
643 Dart_KernelCompilationResult result = KernelIsolate::AcceptCompilation();
646 FATAL(
647 "An error occurred while accepting the most recent"
648 " compilation results: %s",
649 result.error);
650 }
651 TIR_Print(
652 "An error occurred while accepting the most recent"
653 " compilation results: %s",
654 result.error);
655 Zone* zone = thread->zone();
656 const auto& error_str = String::Handle(zone, String::New(result.error));
657 free(result.error);
658 return ApiError::New(error_str);
659 }
660 return Object::null();
661}
Zone * zone() const
@ Dart_KernelCompilationStatus_MsgFailed
Definition dart_api.h:3731
@ Dart_KernelCompilationStatus_Ok
Definition dart_api.h:3728
#define FATAL(error)
GAsyncResult * result
#define TIR_Print(format,...)

◆ AccessForSlotInAllocatedObject()

static InnerPointerAccess dart::AccessForSlotInAllocatedObject ( Definition alloc,
const Slot slot 
)
static

Definition at line 3801 of file redundancy_elimination.cc.

3802 {
3803 if (slot.representation() != kUntagged) {
3804 return InnerPointerAccess::kNotUntagged;
3805 }
3806 if (!slot.may_contain_inner_pointer()) {
3807 return InnerPointerAccess::kCannotBeInnerPointer;
3808 }
3809 if (slot.IsIdentical(Slot::PointerBase_data())) {
3810 // The data field of external arrays is not unsafe, as it never contains
3811 // a GC-movable address.
3812 if (alloc->IsAllocateObject() &&
3813 IsExternalPayloadClassId(alloc->AsAllocateObject()->cls().id())) {
3814 return InnerPointerAccess::kCannotBeInnerPointer;
3815 }
3816 }
3817 return InnerPointerAccess::kMayBeInnerPointer;
3818}
bool IsIdentical(const Slot &other) const
Definition slot.h:549
Representation representation() const
Definition slot.h:519
bool may_contain_inner_pointer() const
Definition slot.h:533
bool IsExternalPayloadClassId(classid_t cid)
Definition class_id.h:472

◆ ActOnIsolateGroup()

static void dart::ActOnIsolateGroup ( JSONStream js,
std::function< void(IsolateGroup *)>  visitor 
)
static

Definition at line 1582 of file service.cc.

1583 {
1584 const String& prefix =
1585 String::Handle(String::New(ISOLATE_GROUP_SERVICE_ID_PREFIX));
1586
1587 const String& s =
1588 String::Handle(String::New(js->LookupParam("isolateGroupId")));
1589 if (!s.StartsWith(prefix)) {
1590 PrintInvalidParamError(js, "isolateGroupId");
1591 return;
1592 }
1593 uint64_t isolate_group_id = UInt64Parameter::Parse(
1594 String::Handle(String::SubString(s, prefix.Length())).ToCString());
1595 IsolateGroup::RunWithIsolateGroup(
1596 isolate_group_id,
1597 [&visitor](IsolateGroup* isolate_group) { visitor(isolate_group); },
1598 /*if_not_found=*/[&js]() { PrintSentinel(js, kExpiredSentinel); });
1599}
struct MyStruct s
static void PrintSentinel(JSONStream *js, SentinelType sentinel_type)
Definition service.cc:1535
static void PrintInvalidParamError(JSONStream *js, const char *param)
Definition service.cc:128
#define ISOLATE_GROUP_SERVICE_ID_PREFIX
Definition service.h:49

◆ AddBmpCharacters()

void dart::AddBmpCharacters ( RegExpCompiler compiler,
ChoiceNode result,
RegExpNode on_success,
UnicodeRangeSplitter splitter 
)

Definition at line 3959 of file regexp.cc.

3962 {
3963 ZoneGrowableArray<CharacterRange>* bmp = splitter->bmp();
3964 if (bmp == nullptr) return;
3965 result->AddAlternative(GuardedAlternative(TextNode::CreateForCharacterRanges(
3966 bmp, compiler->read_backward(), on_success, RegExpFlags())));
3967}
ZoneGrowableArray< CharacterRange > * bmp()
Definition regexp.h:185

◆ AddBreakpoint()

static void dart::AddBreakpoint ( Thread thread,
JSONStream js 
)
static

Definition at line 3942 of file service.cc.

3942 {
3943 if (CheckDebuggerDisabled(thread, js)) {
3944 return;
3945 }
3946
3947 const char* script_id_param = js->LookupParam("scriptId");
3948 Object& obj =
3949 Object::Handle(LookupHeapObject(thread, script_id_param, nullptr));
3950 if (obj.ptr() == Object::sentinel().ptr() || !obj.IsScript()) {
3951 PrintInvalidParamError(js, "scriptId");
3952 return;
3953 }
3954 const Script& script = Script::Cast(obj);
3955 const String& script_uri = String::Handle(script.url());
3956 ASSERT(!script_uri.IsNull());
3957 AddBreakpointCommon(thread, js, script_uri);
3958}
#define ASSERT(E)
static void AddBreakpointCommon(Thread *thread, JSONStream *js, const String &script_uri)
Definition service.cc:3902
static bool CheckDebuggerDisabled(Thread *thread, JSONStream *js)
Definition service.cc:512

◆ AddBreakpointAtActivation()

static void dart::AddBreakpointAtActivation ( Thread thread,
JSONStream js 
)
static

Definition at line 4013 of file service.cc.

4013 {
4014 if (CheckDebuggerDisabled(thread, js)) {
4015 return;
4016 }
4017
4018 const char* object_id = js->LookupParam("objectId");
4019 Object& obj = Object::Handle(LookupHeapObject(thread, object_id, nullptr));
4020 if (obj.ptr() == Object::sentinel().ptr() || !obj.IsInstance()) {
4021 PrintInvalidParamError(js, "objectId");
4022 return;
4023 }
4024 const Instance& closure = Instance::Cast(obj);
4025 Breakpoint* bpt = thread->isolate()->debugger()->SetBreakpointAtActivation(
4026 closure, /*single_shot=*/false);
4027 if (bpt == nullptr) {
4028 js->PrintError(kCannotAddBreakpoint,
4029 "%s: Cannot add breakpoint at activation", js->method());
4030 return;
4031 }
4032 bpt->PrintJSON(js);
4033}
Breakpoint * SetBreakpointAtActivation(const Instance &closure, bool single_shot)
Definition debugger.cc:2720
Debugger * debugger() const
Definition isolate.h:1061
Isolate * isolate() const
Definition thread.h:533
std::function< void()> closure
Definition closure.h:14

◆ AddBreakpointAtEntry()

static void dart::AddBreakpointAtEntry ( Thread thread,
JSONStream js 
)
static

Definition at line 3984 of file service.cc.

3984 {
3985 if (CheckDebuggerDisabled(thread, js)) {
3986 return;
3987 }
3988
3989 const char* function_id = js->LookupParam("functionId");
3990 Object& obj = Object::Handle(LookupHeapObject(thread, function_id, nullptr));
3991 if (obj.ptr() == Object::sentinel().ptr() || !obj.IsFunction()) {
3992 PrintInvalidParamError(js, "functionId");
3993 return;
3994 }
3995 const Function& function = Function::Cast(obj);
3996 Breakpoint* bpt =
3997 thread->isolate()->debugger()->SetBreakpointAtEntry(function, false);
3998 if (bpt == nullptr) {
3999 js->PrintError(kCannotAddBreakpoint,
4000 "%s: Cannot add breakpoint at function '%s'", js->method(),
4001 function.ToCString());
4002 return;
4003 }
4004 bpt->PrintJSON(js);
4005}
Breakpoint * SetBreakpointAtEntry(const Function &target_function, bool single_shot)
Definition debugger.cc:2699
Dart_NativeFunction function
Definition fuchsia.cc:51

◆ AddBreakpointCommon()

static void dart::AddBreakpointCommon ( Thread thread,
JSONStream js,
const String script_uri 
)
static

Definition at line 3902 of file service.cc.

3904 {
3905 if (CheckDebuggerDisabled(thread, js)) {
3906 return;
3907 }
3908
3909 const char* line_param = js->LookupParam("line");
3910 intptr_t line = UIntParameter::Parse(line_param);
3911 const char* col_param = js->LookupParam("column");
3912 intptr_t col = -1;
3913 if (col_param != nullptr) {
3914 col = UIntParameter::Parse(col_param);
3915 if (col == 0) {
3916 // Column number is 1-based.
3917 PrintInvalidParamError(js, "column");
3918 return;
3919 }
3920 }
3921 ASSERT(!script_uri.IsNull());
3922 Breakpoint* bpt = nullptr;
3923 bpt = thread->isolate()->debugger()->SetBreakpointAtLineCol(script_uri, line,
3924 col);
3925 if (bpt == nullptr) {
3926 js->PrintError(kCannotAddBreakpoint,
3927 "%s: Cannot add breakpoint at line '%s'", js->method(),
3928 line_param);
3929 return;
3930 }
3931 bpt->PrintJSON(js);
3932}
Breakpoint * SetBreakpointAtLineCol(const String &script_url, intptr_t line_number, intptr_t column_number)
Definition debugger.cc:2801
bool IsNull() const
Definition object.h:363

◆ AddBreakpointWithScriptUri()

static void dart::AddBreakpointWithScriptUri ( Thread thread,
JSONStream js 
)
static

Definition at line 3968 of file service.cc.

3968 {
3969 if (CheckDebuggerDisabled(thread, js)) {
3970 return;
3971 }
3972
3973 const char* script_uri_param = js->LookupParam("scriptUri");
3974 const String& script_uri = String::Handle(String::New(script_uri_param));
3975 AddBreakpointCommon(thread, js, script_uri);
3976}

◆ AddClass()

static void dart::AddClass ( const int32_t *  elmv,
intptr_t  elmc,
ZoneGrowableArray< CharacterRange > *  ranges 
)
static

Definition at line 4600 of file regexp.cc.

4602 {
4603 elmc--;
4604 ASSERT(elmv[elmc] == kRangeEndMarker);
4605 for (intptr_t i = 0; i < elmc; i += 2) {
4606 ASSERT(elmv[i] < elmv[i + 1]);
4607 ranges->Add(CharacterRange(elmv[i], elmv[i + 1] - 1));
4608 }
4609}
void Add(const T &value)

◆ AddClassNegated()

static void dart::AddClassNegated ( const int32_t *  elmv,
intptr_t  elmc,
ZoneGrowableArray< CharacterRange > *  ranges 
)
static

Definition at line 4611 of file regexp.cc.

4613 {
4614 elmc--;
4615 ASSERT(elmv[elmc] == kRangeEndMarker);
4616 ASSERT(elmv[0] != 0x0000);
4617 ASSERT(elmv[elmc - 1] != Utf::kMaxCodePoint);
4618 uint16_t last = 0x0000;
4619 for (intptr_t i = 0; i < elmc; i += 2) {
4620 ASSERT(last <= elmv[i] - 1);
4621 ASSERT(elmv[i] < elmv[i + 1]);
4622 ranges->Add(CharacterRange(last, elmv[i] - 1));
4623 last = elmv[i + 1];
4624 }
4625 ranges->Add(CharacterRange(last, Utf::kMaxCodePoint));
4626}

◆ AddFinalizer()

static FinalizablePersistentHandle * dart::AddFinalizer ( const Object referent,
void *  peer,
Dart_HandleFinalizer  callback,
intptr_t  external_size 
)
static

Definition at line 24238 of file object.cc.

24241 {
24242 ASSERT(callback != nullptr);
24243 FinalizablePersistentHandle* finalizable_ref =
24244 FinalizablePersistentHandle::New(IsolateGroup::Current(), referent, peer,
24245 callback, external_size,
24246 /*auto_delete=*/true);
24247 ASSERT(finalizable_ref != nullptr);
24248 return finalizable_ref;
24249}
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback

◆ AddHandleFieldAndHandleField()

intptr_t dart::AddHandleFieldAndHandleField ( Dart_Handle  self,
Dart_Handle  other 
)

Definition at line 1204 of file ffi_test_functions_vmspecific.cc.

1204 {
1205 intptr_t field1 = 0;
1207 intptr_t field2 = 0;
1208 ENSURE(!Dart_IsError(Dart_GetNativeInstanceField(other, 0, &field2)));
1209 return field1 + field2;
1210}
DART_EXPORT Dart_Handle Dart_GetNativeInstanceField(Dart_Handle obj, int index, intptr_t *value)
DART_EXPORT bool Dart_IsError(Dart_Handle handle)
#define ENSURE(X)

◆ AddHandleFieldAndInt()

intptr_t dart::AddHandleFieldAndInt ( Dart_Handle  self,
intptr_t  x 
)

Definition at line 1188 of file ffi_test_functions_vmspecific.cc.

1188 {
1189 intptr_t field = 0;
1191 return field + x;
1192}
double x

◆ AddHandleFieldAndPtr()

intptr_t dart::AddHandleFieldAndPtr ( Dart_Handle  self,
void *  other 
)

Definition at line 1198 of file ffi_test_functions_vmspecific.cc.

1198 {
1199 intptr_t field = 0;
1201 return field + reinterpret_cast<intptr_t>(other);
1202}

◆ AddInstruction()

template<typename T >
void dart::AddInstruction ( GrowableArray< T * > *  list,
T value 
)

Definition at line 3923 of file redundancy_elimination.cc.

3923 {
3924 ASSERT(!value->IsGraphEntry() && !value->IsFunctionEntry());
3925 for (intptr_t i = 0; i < list->length(); i++) {
3926 if ((*list)[i] == value) {
3927 return;
3928 }
3929 }
3930 list->Add(value);
3931}
intptr_t length() const
uint8_t value

◆ AddLoneLeadSurrogates()

void dart::AddLoneLeadSurrogates ( RegExpCompiler compiler,
ChoiceNode result,
RegExpNode on_success,
UnicodeRangeSplitter splitter 
)

Definition at line 4065 of file regexp.cc.

4068 {
4069 auto lead_surrogates = splitter->lead_surrogates();
4070 if (lead_surrogates == nullptr) return;
4071 // E.g. \ud801 becomes \ud801(?![\udc00-\udfff]).
4072 auto trail_surrogates = CharacterRange::List(
4073 on_success->zone(), CharacterRange::Range(Utf16::kTrailSurrogateStart,
4074 Utf16::kTrailSurrogateEnd));
4075
4077 if (compiler->read_backward()) {
4078 // Reading backward. Assert that reading forward, there is no trail
4079 // surrogate, and then backward match the lead surrogate.
4081 compiler, trail_surrogates, lead_surrogates, on_success, true,
4082 RegExpFlags());
4083 } else {
4084 // Reading forward. Forward match the lead surrogate and assert that
4085 // no trail surrogate follows.
4086 match = MatchAndNegativeLookaroundInReadDirection(
4087 compiler, lead_surrogates, trail_surrogates, on_success, false,
4088 RegExpFlags());
4089 }
4090 result->AddAlternative(GuardedAlternative(match));
4091}
static bool match(const char *needle, const char *haystack)
Definition DM.cpp:1132
Zone * zone() const
Definition regexp.h:483
ZoneGrowableArray< CharacterRange > * lead_surrogates()
Definition regexp.h:186
RegExpNode * NegativeLookaroundAgainstReadDirectionAndMatch(RegExpCompiler *compiler, ZoneGrowableArray< CharacterRange > *lookbehind, ZoneGrowableArray< CharacterRange > *match, RegExpNode *on_success, bool read_backward, RegExpFlags flags)
Definition regexp.cc:4030

◆ AddLoneTrailSurrogates()

void dart::AddLoneTrailSurrogates ( RegExpCompiler compiler,
ChoiceNode result,
RegExpNode on_success,
UnicodeRangeSplitter splitter 
)

Definition at line 4093 of file regexp.cc.

4096 {
4097 auto trail_surrogates = splitter->trail_surrogates();
4098 if (trail_surrogates == nullptr) return;
4099 // E.g. \udc01 becomes (?<![\ud800-\udbff])\udc01
4100 auto lead_surrogates = CharacterRange::List(
4101 on_success->zone(), CharacterRange::Range(Utf16::kLeadSurrogateStart,
4102 Utf16::kLeadSurrogateEnd));
4103
4105 if (compiler->read_backward()) {
4106 // Reading backward. Backward match the trail surrogate and assert that no
4107 // lead surrogate precedes it.
4109 compiler, trail_surrogates, lead_surrogates, on_success, true,
4110 RegExpFlags());
4111 } else {
4112 // Reading forward. Assert that reading backward, there is no lead
4113 // surrogate, and then forward match the trail surrogate.
4114 match = NegativeLookaroundAgainstReadDirectionAndMatch(
4115 compiler, lead_surrogates, trail_surrogates, on_success, false,
4116 RegExpFlags());
4117 }
4118 result->AddAlternative(GuardedAlternative(match));
4119}
ZoneGrowableArray< CharacterRange > * trail_surrogates()
Definition regexp.h:189
RegExpNode * MatchAndNegativeLookaroundInReadDirection(RegExpCompiler *compiler, ZoneGrowableArray< CharacterRange > *match, ZoneGrowableArray< CharacterRange > *lookahead, RegExpNode *on_success, bool read_backward, RegExpFlags flags)
Definition regexp.cc:4048

◆ AddNameProperties()

static void dart::AddNameProperties ( JSONObject jsobj,
const char *  name,
const char *  vm_name 
)
static

Definition at line 20 of file object_service.cc.

22 {
23 jsobj->AddProperty("name", name);
24 if (strcmp(name, vm_name) != 0) {
25 jsobj->AddProperty("_vmName", vm_name);
26 }
27}
void AddProperty(const char *name, bool b) const
const char * name
Definition fuchsia.cc:50

◆ AddNonBmpSurrogatePairs()

void dart::AddNonBmpSurrogatePairs ( RegExpCompiler compiler,
ChoiceNode result,
RegExpNode on_success,
UnicodeRangeSplitter splitter 
)

Definition at line 3969 of file regexp.cc.

3972 {
3973 ZoneGrowableArray<CharacterRange>* non_bmp = splitter->non_bmp();
3974 if (non_bmp == nullptr) return;
3975 ASSERT(!compiler->one_byte());
3976 CharacterRange::Canonicalize(non_bmp);
3977 for (int i = 0; i < non_bmp->length(); i++) {
3978 // Match surrogate pair.
3979 // E.g. [\u10005-\u11005] becomes
3980 // \ud800[\udc05-\udfff]|
3981 // [\ud801-\ud803][\udc00-\udfff]|
3982 // \ud804[\udc00-\udc05]
3983 uint32_t from = non_bmp->At(i).from();
3984 uint32_t to = non_bmp->At(i).to();
3985 uint16_t from_points[2];
3986 Utf16::Encode(from, from_points);
3987 uint16_t to_points[2];
3988 Utf16::Encode(to, to_points);
3989 if (from_points[0] == to_points[0]) {
3990 // The lead surrogate is the same.
3991 result->AddAlternative(
3992 GuardedAlternative(TextNode::CreateForSurrogatePair(
3993 CharacterRange::Singleton(from_points[0]),
3994 CharacterRange::Range(from_points[1], to_points[1]),
3995 compiler->read_backward(), on_success, RegExpFlags())));
3996 } else {
3997 if (from_points[1] != Utf16::kTrailSurrogateStart) {
3998 // Add [from_l][from_t-\udfff]
3999 result->AddAlternative(
4000 GuardedAlternative(TextNode::CreateForSurrogatePair(
4001 CharacterRange::Singleton(from_points[0]),
4002 CharacterRange::Range(from_points[1],
4003 Utf16::kTrailSurrogateEnd),
4004 compiler->read_backward(), on_success, RegExpFlags())));
4005 from_points[0]++;
4006 }
4007 if (to_points[1] != Utf16::kTrailSurrogateEnd) {
4008 // Add [to_l][\udc00-to_t]
4009 result->AddAlternative(
4010 GuardedAlternative(TextNode::CreateForSurrogatePair(
4011 CharacterRange::Singleton(to_points[0]),
4012 CharacterRange::Range(Utf16::kTrailSurrogateStart,
4013 to_points[1]),
4014 compiler->read_backward(), on_success, RegExpFlags())));
4015 to_points[0]--;
4016 }
4017 if (from_points[0] <= to_points[0]) {
4018 // Add [from_l-to_l][\udc00-\udfff]
4019 result->AddAlternative(
4020 GuardedAlternative(TextNode::CreateForSurrogatePair(
4021 CharacterRange::Range(from_points[0], to_points[0]),
4022 CharacterRange::Range(Utf16::kTrailSurrogateStart,
4023 Utf16::kTrailSurrogateEnd),
4024 compiler->read_backward(), on_success, RegExpFlags())));
4025 }
4026 }
4027 }
4028}
const T & At(intptr_t index) const
ZoneGrowableArray< CharacterRange > * non_bmp() const
Definition regexp.h:192

◆ AddParentFieldToResponseBasedOnRecord()

static void dart::AddParentFieldToResponseBasedOnRecord ( Thread thread,
Array field_names_handle,
String name_handle,
const JSONObject jsresponse,
const Record record,
const intptr_t  field_slot_offset 
)
inlinestatic

Definition at line 2265 of file service.cc.

2271 {
2272 *field_names_handle = record.GetFieldNames(thread);
2273 const intptr_t num_positional_fields =
2274 record.num_fields() - field_names_handle->Length();
2275 const intptr_t field_index =
2276 (field_slot_offset - Record::field_offset(0)) / Record::kBytesPerElement;
2277 if (field_index < num_positional_fields) {
2278 jsresponse.AddProperty("parentField", field_index);
2279 } else {
2280 *name_handle ^= field_names_handle->At(field_index - num_positional_fields);
2281 jsresponse.AddProperty("parentField", name_handle->ToCString());
2282 }
2283}
ObjectPtr At(intptr_t index) const
Definition object.h:10854
intptr_t Length() const
Definition object.h:10808
ArrayPtr GetFieldNames(Thread *thread) const
Definition object.h:11467
intptr_t num_fields() const
Definition object.h:11399
static const char * ToCString(Thread *thread, StringPtr ptr)
Definition object.cc:24205

◆ AddPtrAndHandleField()

intptr_t dart::AddPtrAndHandleField ( void *  self,
Dart_Handle  other 
)

Definition at line 1212 of file ffi_test_functions_vmspecific.cc.

1212 {
1213 intptr_t field = 0;
1214 ENSURE(!Dart_IsError(Dart_GetNativeInstanceField(other, 0, &field)));
1215 return reinterpret_cast<intptr_t>(self) + field;
1216}

◆ AddPtrAndInt()

intptr_t dart::AddPtrAndInt ( void *  self,
intptr_t  x 
)

Definition at line 1184 of file ffi_test_functions_vmspecific.cc.

1184 {
1185 return reinterpret_cast<intptr_t>(self) + x;
1186}

◆ AddPtrAndPtr()

intptr_t dart::AddPtrAndPtr ( void *  self,
void *  other 
)

Definition at line 1194 of file ffi_test_functions_vmspecific.cc.

1194 {
1195 return reinterpret_cast<intptr_t>(self) + reinterpret_cast<intptr_t>(other);
1196}

◆ AddRange() [1/2]

ContainedInLattice dart::AddRange ( ContainedInLattice  a,
const intptr_t *  ranges,
intptr_t  ranges_size,
Interval  new_range 
)

◆ AddRange() [2/2]

ContainedInLattice dart::AddRange ( ContainedInLattice  containment,
const int32_t *  ranges,
intptr_t  ranges_length,
Interval  new_range 
)

Definition at line 36 of file regexp.cc.

39 {
40 ASSERT((ranges_length & 1) == 1);
41 ASSERT(ranges[ranges_length - 1] == Utf::kMaxCodePoint + 1);
42 if (containment == kLatticeUnknown) return containment;
43 bool inside = false;
44 int32_t last = 0;
45 for (intptr_t i = 0; i < ranges_length;
46 inside = !inside, last = ranges[i], i++) {
47 // Consider the range from last to ranges[i].
48 // We haven't got to the new range yet.
49 if (ranges[i] <= new_range.from()) continue;
50 // New range is wholly inside last-ranges[i]. Note that new_range.to() is
51 // inclusive, but the values in ranges are not.
52 if (last <= new_range.from() && new_range.to() < ranges[i]) {
53 return Combine(containment, inside ? kLatticeIn : kLatticeOut);
54 }
55 return kLatticeUnknown;
56 }
57 return containment;
58}
intptr_t to() const
Definition regexp.h:529
intptr_t from() const
Definition regexp.h:528
ContainedInLattice Combine(ContainedInLattice a, ContainedInLattice b)
Definition regexp.h:1087

◆ AddScriptIfUnique()

static void dart::AddScriptIfUnique ( const GrowableObjectArray scripts,
const Script candidate 
)
static

Definition at line 13969 of file object.cc.

13970 {
13971 if (candidate.IsNull()) {
13972 return;
13973 }
13974 Script& script_obj = Script::Handle();
13975
13976 for (int i = 0; i < scripts.Length(); i++) {
13977 script_obj ^= scripts.At(i);
13978 if (script_obj.ptr() == candidate.ptr()) {
13979 // We already have a reference to this script.
13980 return;
13981 }
13982 }
13983 // Add script to the list of scripts.
13984 scripts.Add(candidate);
13985}
ObjectPtr ptr() const
Definition object.h:332

◆ AddSlot()

static void dart::AddSlot ( ZoneGrowableArray< const Slot * > *  slots,
const Slot slot 
)
static

Definition at line 3757 of file redundancy_elimination.cc.

3757 {
3758 if (!slots->Contains(&slot)) {
3759 slots->Add(&slot);
3760 }
3761}
bool Contains(const T &other, bool isEqual(const T &, const T &)=nullptr) const

◆ AddSuperType()

static void dart::AddSuperType ( const AbstractType type,
GrowableArray< intptr_t > *  finalized_super_classes 
)
static

Definition at line 71 of file class_finalizer.cc.

72 {
73 ASSERT(type.HasTypeClass());
74 ASSERT(!type.IsDynamicType());
75 if (type.IsObjectType()) {
76 return;
77 }
78 const Class& cls = Class::Handle(type.type_class());
79 ASSERT(cls.is_finalized());
80 const intptr_t cid = cls.id();
81 for (intptr_t i = 0; i < finalized_super_classes->length(); i++) {
82 if ((*finalized_super_classes)[i] == cid) {
83 // Already added.
84 return;
85 }
86 }
87 finalized_super_classes->Add(cid);
88 const AbstractType& super_type = AbstractType::Handle(cls.super_type());
89 AddSuperType(super_type, finalized_super_classes);
90}
static void AddSuperType(const AbstractType &type, GrowableArray< intptr_t > *finalized_super_classes)

◆ AddToSortedListOfRanges()

static void dart::AddToSortedListOfRanges ( GrowableArray< LiveRange * > *  list,
LiveRange range 
)
static

Definition at line 2842 of file linearscan.cc.

2843 {
2844 range->finger()->Initialize(range);
2845
2846 if (list->is_empty()) {
2847 list->Add(range);
2848 return;
2849 }
2850
2851 for (intptr_t i = list->length() - 1; i >= 0; i--) {
2852 if (ShouldBeAllocatedBefore(range, (*list)[i])) {
2853 list->InsertAt(i + 1, range);
2854 return;
2855 }
2856 }
2857 list->InsertAt(0, range);
2858}
void Initialize(LiveRange *range)
void InsertAt(intptr_t idx, const T &value)
AllocationFinger * finger()
Definition linearscan.h:543

◆ AddUnicodeCaseEquivalents()

void dart::AddUnicodeCaseEquivalents ( ZoneGrowableArray< CharacterRange > *  ranges)

Definition at line 4135 of file regexp.cc.

4135 {
4136 ASSERT(CharacterRange::IsCanonical(ranges));
4137
4138 // Micro-optimization to avoid passing large ranges to UnicodeSet::closeOver.
4139 // See also https://crbug.com/v8/6727.
4140 // TODO(sstrickl): This only covers the special case of the {0,0x10FFFF}
4141 // range, which we use frequently internally. But large ranges can also easily
4142 // be created by the user. We might want to have a more general caching
4143 // mechanism for such ranges.
4144 if (ranges->length() == 1 && ranges->At(0).IsEverything(Utf::kMaxCodePoint)) {
4145 return;
4146 }
4147
4148 icu::UnicodeSet set;
4149 for (int i = 0; i < ranges->length(); i++) {
4150 set.add(ranges->At(i).from(), ranges->At(i).to());
4151 }
4152 ranges->Clear();
4153 set.closeOver(USET_CASE_INSENSITIVE);
4154 // Full case mapping map single characters to multiple characters.
4155 // Those are represented as strings in the set. Remove them so that
4156 // we end up with only simple and common case mappings.
4157 set.removeAllStrings();
4158 for (int i = 0; i < set.getRangeCount(); i++) {
4159 ranges->Add(
4160 CharacterRange::Range(set.getRangeStart(i), set.getRangeEnd(i)));
4161 }
4162 // No errors and everything we collected have been ranges.
4163 CharacterRange::Canonicalize(ranges);
4164}
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 set
Definition switches.h:76

◆ AllInputsAreRedefinitions()

static bool dart::AllInputsAreRedefinitions ( PhiInstr phi)
static

Definition at line 6691 of file il.cc.

6691 {
6692 for (intptr_t i = 0; i < phi->InputCount(); i++) {
6693 if (phi->InputAt(i)->definition()->RedefinedValue() == nullptr) {
6694 return false;
6695 }
6696 }
6697 return true;
6698}
virtual Value * RedefinedValue() const
Definition il.cc:539
Definition * definition() const
Definition il.h:103
intptr_t InputCount() const
Definition il.h:2776
Value * InputAt(intptr_t i) const
Definition il.h:2777

◆ Allocate() [1/2]

static uword dart::Allocate ( FreeList free_list,
intptr_t  size,
bool  is_protected 
)
static

Definition at line 14 of file freelist_test.cc.

14 {
15 uword result = free_list->TryAllocate(size, is_protected);
16 if ((result != 0u) && is_protected) {
17 VirtualMemory::Protect(reinterpret_cast<void*>(result), size,
18 VirtualMemory::kReadExecute);
19 }
20 return result;
21}
uword TryAllocate(intptr_t size, bool is_protected)
Definition freelist.cc:82
uintptr_t uword
Definition globals.h:501

◆ Allocate() [2/2]

static void * dart::Allocate ( uword  size,
Zone zone 
)
static

Definition at line 14 of file allocation.cc.

14 {
15 ASSERT(zone != nullptr);
16 if (size > static_cast<uword>(kIntptrMax)) {
17 FATAL("ZoneAllocated object has unexpectedly large size %" Pu "", size);
18 }
19 return reinterpret_cast<void*>(zone->AllocUnsafe(size));
20}
void * AllocUnsafe(intptr_t size)
#define Pu
Definition globals.h:409

◆ AllocateFinalizableHandle() [1/2]

static Dart_FinalizableHandle dart::AllocateFinalizableHandle ( Thread T,
Dart_Handle  object,
void *  peer,
intptr_t  external_allocation_size,
Dart_HandleFinalizer  callback 
)
static

Definition at line 1075 of file dart_api_impl.cc.

1080 {
1081 const auto& ref = Object::Handle(Z, Api::UnwrapHandle(object));
1082 return AllocateFinalizableHandle(T, ref, peer, external_allocation_size,
1083 callback);
1084}
#define Z
static Dart_FinalizableHandle AllocateFinalizableHandle(Thread *thread, const Object &ref, void *peer, intptr_t external_allocation_size, Dart_HandleFinalizer callback)
#define T

◆ AllocateFinalizableHandle() [2/2]

static Dart_FinalizableHandle dart::AllocateFinalizableHandle ( Thread thread,
const Object ref,
void *  peer,
intptr_t  external_allocation_size,
Dart_HandleFinalizer  callback 
)
static

Definition at line 1051 of file dart_api_impl.cc.

1056 {
1057 if (!ref.ptr()->IsHeapObject()) {
1058 return nullptr;
1059 }
1060 if (ref.IsPointer()) {
1061 return nullptr;
1062 }
1063 if (IsFfiCompound(thread, ref)) {
1064 return nullptr;
1065 }
1066
1067 FinalizablePersistentHandle* finalizable_ref =
1068 FinalizablePersistentHandle::New(thread->isolate_group(), ref, peer,
1069 callback, external_allocation_size,
1070 /*auto_delete=*/true);
1071 return finalizable_ref == nullptr ? nullptr
1072 : finalizable_ref->ApiFinalizableHandle();
1073}
IsolateGroup * isolate_group() const
Definition thread.h:540
static bool IsFfiCompound(Thread *T, const Object &obj)

◆ AllocateFreeFpuRegister()

static FpuRegister dart::AllocateFreeFpuRegister ( bool *  blocked_registers)
static

Definition at line 1651 of file flow_graph_compiler.cc.

1651 {
1652 for (intptr_t regno = 0; regno < kNumberOfFpuRegisters; regno++) {
1653 if (!blocked_registers[regno]) {
1654 blocked_registers[regno] = true;
1655 return static_cast<FpuRegister>(regno);
1656 }
1657 }
1658 UNREACHABLE();
1659 return kNoFpuRegister;
1660}

◆ AllocateFreeRegister()

static Register dart::AllocateFreeRegister ( bool *  blocked_registers)
static

Definition at line 1638 of file flow_graph_compiler.cc.

1638 {
1639 for (intptr_t i = 0; i < kNumberOfCpuRegisters; i++) {
1640 intptr_t regno = (i + kRegisterAllocationBias) % kNumberOfCpuRegisters;
1641 if (!blocked_registers[regno]) {
1642 blocked_registers[regno] = true;
1643 return static_cast<Register>(regno);
1644 }
1645 }
1646 UNREACHABLE();
1647 return kNoRegister;
1648}
constexpr int kRegisterAllocationBias

◆ AllocateNewString()

static Dart_Handle dart::AllocateNewString ( const char *  c_str)
static

Definition at line 3448 of file dart_api_impl_test.cc.

3448 {
3449 Thread* thread = Thread::Current();
3450 TransitionNativeToVM transition(thread);
3451 return Api::NewHandle(thread, String::New(c_str, Heap::kNew));
3452}

◆ AllocateObject() [1/2]

DART_FORCE_INLINE ObjectPtr dart::AllocateObject ( intptr_t  cid,
intptr_t  size,
intptr_t  allocated_bytes 
)

Definition at line 248 of file object_graph_copy.cc.

250 {
251#if defined(DART_COMPRESSED_POINTERS)
252 const bool compressed = true;
253#else
254 const bool compressed = false;
255#endif
256 const intptr_t kLargeMessageThreshold = 16 * MB;
257 const Heap::Space space =
258 allocated_bytes > kLargeMessageThreshold ? Heap::kOld : Heap::kNew;
259 // Mimic the old initialization behavior of Object::InitializeObject where
260 // the contents are initialized to Object::null(), except for TypedDataBase
261 // subclasses which are initialized to 0, as the contents of the original
262 // are translated and copied over prior to returning the object graph root.
263 if (IsTypedDataBaseClassId(cid)) {
264 return Object::Allocate(cid, size, space, compressed,
265 Object::from_offset<TypedDataBase>(),
266 Object::to_offset<TypedDataBase>());
267
268 } else {
269 // Remember that ptr_field_end_offset is the offset to the last Ptr
270 // field, not the offset just past it.
271 const uword ptr_field_end_offset =
272 size - (compressed ? kCompressedWordSize : kWordSize);
273 return Object::Allocate(cid, size, space, compressed,
274 Object::from_offset<Object>(),
275 ptr_field_end_offset);
276 }
277}
constexpr intptr_t MB
Definition globals.h:530
bool IsTypedDataBaseClassId(intptr_t index)
Definition class_id.h:429

◆ AllocateObject() [2/2]

static InstancePtr dart::AllocateObject ( Thread thread,
const Class cls 
)
static

Definition at line 4348 of file dart_api_impl.cc.

4348 {
4349 if (!cls.is_fields_marked_nullable()) {
4350 // Mark all fields as nullable.
4351 Zone* zone = thread->zone();
4352 Class& iterate_cls = Class::Handle(zone, cls.ptr());
4353 Field& field = Field::Handle(zone);
4354 Array& fields = Array::Handle(zone);
4355 SafepointWriteRwLocker ml(thread, thread->isolate_group()->program_lock());
4356 if (!cls.is_fields_marked_nullable()) {
4357 while (!iterate_cls.IsNull()) {
4358 ASSERT(iterate_cls.is_finalized());
4359 iterate_cls.set_is_fields_marked_nullable();
4360 fields = iterate_cls.fields();
4361 iterate_cls = iterate_cls.SuperClass();
4362 for (int field_num = 0; field_num < fields.Length(); field_num++) {
4363 field ^= fields.At(field_num);
4364 if (field.is_static()) {
4365 continue;
4366 }
4367 field.RecordStore(Object::null_object());
4368 }
4369 }
4370 }
4371 }
4372
4373 // Allocate an object for the given class.
4374 return Instance::New(cls);
4375}
void set_is_fields_marked_nullable() const
Definition object.cc:5750
ArrayPtr fields() const
Definition object.h:1617
bool is_fields_marked_nullable() const
Definition object.h:1778
ClassPtr SuperClass(ClassTable *class_table=nullptr) const
Definition object.cc:3715
bool is_finalized() const
Definition object.h:1725
bool is_static() const
Definition object.h:4418
void RecordStore(const Object &value) const
Definition object.cc:13074
SafepointRwLock * program_lock()
Definition isolate.h:532

◆ AllocateObjectByClassName()

static InstancePtr dart::AllocateObjectByClassName ( const Library library,
const String class_name 
)
static

Definition at line 163 of file object_store.cc.

164 {
165 const Class& cls = Class::Handle(library.LookupClassAllowPrivate(class_name));
166 ASSERT(!cls.IsNull());
167 return Instance::New(cls);
168}
ClassPtr LookupClassAllowPrivate(const String &name) const
Definition object.cc:14160

◆ AllocateOldString()

static Dart_Handle dart::AllocateOldString ( const char *  c_str)
static

Definition at line 3454 of file dart_api_impl_test.cc.

3454 {
3455 Thread* thread = Thread::Current();
3456 TransitionNativeToVM transition(thread);
3457 return Api::NewHandle(thread, String::New(c_str, Heap::kOld));
3458}

◆ AllocateRefcountedResource()

DART_EXPORT RefCountedResource * dart::AllocateRefcountedResource ( )

Definition at line 1335 of file ffi_test_functions_vmspecific.cc.

1335 {
1336 auto peer =
1337 static_cast<RefCountedResource*>(malloc(sizeof(RefCountedResource)));
1338 auto resource = malloc(128);
1339 memset(resource, 0, 128);
1340 peer->resource = resource;
1341 peer->refcount = 0; // We're not going to count the reference here.
1342 return peer;
1343}
void * malloc(size_t size)
Definition allocation.cc:19

◆ AllocateResource()

intptr_t * dart::AllocateResource ( intptr_t  value)

Definition at line 1163 of file ffi_test_functions_vmspecific.cc.

1163 {
1164 return new intptr_t(value);
1165}

◆ AllocateWeakPersistentHandle() [1/2]

static Dart_WeakPersistentHandle dart::AllocateWeakPersistentHandle ( Thread T,
Dart_Handle  object,
void *  peer,
intptr_t  external_allocation_size,
Dart_HandleFinalizer  callback 
)
static

Definition at line 1040 of file dart_api_impl.cc.

1045 {
1046 const auto& ref = Object::Handle(Z, Api::UnwrapHandle(object));
1047 return AllocateWeakPersistentHandle(T, ref, peer, external_allocation_size,
1048 callback);
1049}
static Dart_WeakPersistentHandle AllocateWeakPersistentHandle(Thread *thread, const Object &ref, void *peer, intptr_t external_allocation_size, Dart_HandleFinalizer callback)

◆ AllocateWeakPersistentHandle() [2/2]

static Dart_WeakPersistentHandle dart::AllocateWeakPersistentHandle ( Thread thread,
const Object ref,
void *  peer,
intptr_t  external_allocation_size,
Dart_HandleFinalizer  callback 
)
static

Definition at line 1015 of file dart_api_impl.cc.

1020 {
1021 if (!ref.ptr()->IsHeapObject()) {
1022 return nullptr;
1023 }
1024 if (ref.IsPointer()) {
1025 return nullptr;
1026 }
1027 if (IsFfiCompound(thread, ref)) {
1028 return nullptr;
1029 }
1030
1031 FinalizablePersistentHandle* finalizable_ref =
1032 FinalizablePersistentHandle::New(thread->isolate_group(), ref, peer,
1033 callback, external_allocation_size,
1034 /*auto_delete=*/false);
1035 return finalizable_ref == nullptr
1036 ? nullptr
1037 : finalizable_ref->ApiWeakPersistentHandle();
1038}

◆ AllocMsg()

static uint8_t * dart::AllocMsg ( const char *  str)
static

Definition at line 11 of file message_test.cc.

11 {
12 return reinterpret_cast<uint8_t*>(Utils::StrDup(str));
13}

◆ AllocStruct9Uint8()

DART_EXPORT Struct9Uint8 * dart::AllocStruct9Uint8 ( )

Definition at line 756 of file ffi_test_functions.cc.

756 {
757 size_t size = sizeof(Struct9Uint8) * 64 * 1024;
758#if defined(_WIN32)
759 void* result =
760 VirtualAlloc(nullptr, size * 2, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE);
761 void* guard_page =
762 reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(result) + size);
763 DWORD old_prot;
764 if (VirtualProtect(guard_page, size, PAGE_NOACCESS, &old_prot) == 0) {
765 fprintf(stderr, "VirtualProtect failed\n");
766 abort();
767 }
768#else
769 void* result = mmap(nullptr, size * 2, PROT_READ | PROT_WRITE,
770 MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
771 void* guard_page =
772 reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(result) + size);
773 if (mprotect(guard_page, size, PROT_NONE) != 0) {
774 fprintf(stderr, "mprotect failed\n");
775 abort();
776 }
777#endif
778 return reinterpret_cast<Struct9Uint8*>(result);
779}
unsigned long DWORD

◆ alpha_callback()

static bool dart::alpha_callback ( const char *  name,
const char **  option_keys,
const char **  option_values,
intptr_t  num_options,
void *  user_data,
const char **  result 
)
static

Definition at line 563 of file service_test.cc.

568 {
569 *result = Utils::StrDup("alpha");
570 return true;
571}

◆ AotCallCountApproximation()

static intptr_t dart::AotCallCountApproximation ( intptr_t  nesting_depth)
static

Definition at line 244 of file inliner.cc.

244 {
245 switch (nesting_depth) {
246 case 0:
247 // The value 1 makes most sense, but it may give a high ratio to call
248 // sites outside loops. Therefore, such call sites are subject to
249 // subsequent stricter heuristic to limit code size increase.
250 return 1;
251 case 1:
252 return 10;
253 case 2:
254 return 10 * 10;
255 default:
256 return 10 * 10 * 10;
257 }
258}

◆ AppendFrames()

static void dart::AppendFrames ( const GrowableObjectArray code_list,
GrowableArray< uword > *  pc_offset_list,
int  skip_frames 
)
static

Definition at line 65 of file stacktrace.cc.

67 {
68 Thread* thread = Thread::Current();
69 Zone* zone = thread->zone();
70 StackFrameIterator frames(ValidationPolicy::kDontValidateFrames, thread,
71 StackFrameIterator::kNoCrossThreadIteration);
72 StackFrame* frame = frames.NextFrame();
73 ASSERT(frame != nullptr); // We expect to find a dart invocation frame.
74 Code& code = Code::Handle(zone);
75 for (; frame != nullptr; frame = frames.NextFrame()) {
76 if (!frame->IsDartFrame()) {
77 continue;
78 }
79 if (skip_frames > 0) {
80 skip_frames--;
81 continue;
82 }
83
84 code = frame->LookupDartCode();
85 const intptr_t pc_offset = frame->pc() - code.PayloadStart();
86 code_list.Add(code);
87 pc_offset_list->Add(pc_offset);
88 }
89}
void Add(const Object &value, Heap::Space space=Heap::kNew) const
Definition object.cc:25070

◆ AppendInstruction()

static Instruction * dart::AppendInstruction ( Instruction first,
Instruction second 
)
static

Definition at line 2099 of file inliner.cc.

2099 {
2100 for (intptr_t i = second->InputCount() - 1; i >= 0; --i) {
2101 Value* input = second->InputAt(i);
2102 input->definition()->AddInputUse(input);
2103 }
2104 first->LinkTo(second);
2105 return second;
2106}
void AddInputUse(Value *value)
Definition il.h:2567
virtual intptr_t InputCount() const =0
void LinkTo(Instruction *next)
Definition il.h:1102
virtual Value * InputAt(intptr_t i) const =0

◆ AppendSubString()

static void dart::AppendSubString ( BaseTextBuffer buffer,
const char *  name,
intptr_t  start_pos,
intptr_t  len 
)
static

Definition at line 193 of file object.cc.

196 {
197 buffer->Printf("%.*s", static_cast<int>(len), &name[start_pos]);
198}
static const uint8_t buffer[]

◆ ApplyBCE()

static std::pair< intptr_t, intptr_t > dart::ApplyBCE ( const char *  script_chars,
CompilerPass::PipelineMode  mode 
)
static

Definition at line 36 of file bce_test.cc.

37 {
38 // Load the script and exercise the code once
39 // while exercising the given compiler passes.
40 const auto& root_library = Library::Handle(LoadTestScript(script_chars));
41 Invoke(root_library, "main");
42 std::initializer_list<CompilerPass::Id> passes = {
43 CompilerPass::kComputeSSA,
44 CompilerPass::kTypePropagation,
45 CompilerPass::kApplyICData,
46 CompilerPass::kInlining,
47 CompilerPass::kTypePropagation,
48 CompilerPass::kApplyICData,
49 CompilerPass::kSelectRepresentations,
50 CompilerPass::kCanonicalize,
51 CompilerPass::kConstantPropagation,
52 CompilerPass::kCSE,
53 CompilerPass::kLICM,
54 };
55 const auto& function = Function::Handle(GetFunction(root_library, "foo"));
56 TestPipeline pipeline(function, mode);
57 FlowGraph* flow_graph = pipeline.RunPasses(passes);
58 // Count the number of before/after bounds checks.
59 const intptr_t num_bc_before = CountBoundChecks(flow_graph);
60 RangeAnalysis range_analysis(flow_graph);
61 range_analysis.Analyze();
62 const intptr_t num_bc_after = CountBoundChecks(flow_graph);
63 return {num_bc_before, num_bc_after};
64}
LibraryPtr LoadTestScript(const char *script, Dart_NativeEntryResolver resolver, const char *lib_uri)
ObjectPtr Invoke(const Library &lib, const char *name)

◆ ApplyTo42And74()

DART_EXPORT intptr_t dart::ApplyTo42And74 ( IntptrBinOp  binop)

Definition at line 602 of file ffi_test_functions.cc.

602 {
603 std::cout << "ApplyTo42And74()\n";
604 intptr_t retval = binop(42, 74);
605 std::cout << "returning " << retval << "\n";
606 return retval;
607}

◆ AreEqualDefinitions()

static bool dart::AreEqualDefinitions ( Definition a,
Definition b 
)
static

Definition at line 320 of file range_analysis.cc.

320 {
323 return (a == b) || (a->AllowsCSE() && b->AllowsCSE() && a->Equals(*b));
324}
static bool b
struct MyStruct a[10]
static Definition * UnwrapConstraint(Definition *defn)

◆ AreLocationsAllTheSame()

static bool dart::AreLocationsAllTheSame ( const GrowableArray< Location > &  locs)
static

Definition at line 2974 of file linearscan.cc.

2974 {
2975 for (intptr_t j = 1; j < locs.length(); j++) {
2976 if (!locs[j].Equals(locs[0])) {
2977 return false;
2978 }
2979 }
2980 return true;
2981}
bool Equals(const SkPath &a, const SkPath &b)

◆ ArrayContains()

static bool dart::ArrayContains ( ZoneGrowableArray< unsigned > *  array,
unsigned  value 
)
static

Definition at line 4938 of file regexp.cc.

4938 {
4939 for (intptr_t i = 0; i < array->length(); i++) {
4940 if (array->At(i) == value) {
4941 return true;
4942 }
4943 }
4944 return false;
4945}

◆ AsHandle() [1/2]

static Dart_Handle dart::AsHandle ( Dart_PersistentHandle  weak)
static

Definition at line 3460 of file dart_api_impl_test.cc.

3460 {
3461 return Dart_HandleFromPersistent(weak);
3462}
DART_EXPORT Dart_Handle Dart_HandleFromPersistent(Dart_PersistentHandle object)

◆ AsHandle() [2/2]

static Dart_Handle dart::AsHandle ( Dart_WeakPersistentHandle  weak)
static

Definition at line 3464 of file dart_api_impl_test.cc.

3464 {
3465 return Dart_HandleFromWeakPersistent(weak);
3466}
DART_EXPORT Dart_Handle Dart_HandleFromWeakPersistent(Dart_WeakPersistentHandle object)

◆ ASSEMBLER_TEST_RUN() [1/2]

dart::ASSEMBLER_TEST_RUN ( InstantiateTypeArgumentsHashKeys  ,
test   
)

Definition at line 92 of file assembler_test.cc.

92 {
93 typedef uint32_t (*HashKeysCode)(uword hash, uword other) DART_UNUSED;
94
95 auto hash_test = [&](const Expect& expect, uword hash1, uword hash2) {
96 const uint32_t expected = FinalizeHash(CombineHashes(hash1, hash2));
97 const uint32_t got = EXECUTE_TEST_CODE_UWORD_UWORD_UINT32(
98 HashKeysCode, test->entry(), hash1, hash2);
99 if (got == expected) return;
100 TextBuffer buffer(128);
101 buffer.Printf("For hash1 = %" Pu " and hash2 = %" Pu
102 ": expected result %u, got result %u",
103 hash1, hash2, expected, got);
104 expect.Fail("%s", buffer.buffer());
105 };
106
107#define HASH_TEST(hash1, hash2) \
108 hash_test(Expect(__FILE__, __LINE__), hash1, hash2)
109
110 const intptr_t kNumRandomTests = 500;
111 Random random;
112
113 // First, fixed and random 32 bit tests for all architectures.
114 HASH_TEST(1, 1);
115 HASH_TEST(10, 20);
116 HASH_TEST(20, 10);
117 HASH_TEST(kMaxUint16, kMaxUint32 - kMaxUint16);
118 HASH_TEST(kMaxUint32 - kMaxUint16, kMaxUint16);
119
120 for (intptr_t i = 0; i < kNumRandomTests; i++) {
121 const uword hash1 = random.NextUInt32();
122 const uword hash2 = random.NextUInt32();
123 HASH_TEST(hash1, hash2);
124 }
125
126#if defined(TARGET_ARCH_IS_64_BIT)
127 // Now 64-bit tests on 64-bit architectures.
128 HASH_TEST(kMaxUint16, kMaxUint64 - kMaxUint16);
129 HASH_TEST(kMaxUint64 - kMaxUint16, kMaxUint16);
130
131 for (intptr_t i = 0; i < kNumRandomTests; i++) {
132 const uword hash1 = random.NextUInt64();
133 const uword hash2 = random.NextUInt64();
134 HASH_TEST(hash1, hash2);
135 }
136#endif
137#undef HASH_TEST
138}
static uint32_t hash(const SkShaderBase::GradientInfo &v)
#define HASH_TEST(hash1, hash2)
void Fail(const char *format,...) const PRINTF_ATTRIBUTE(2
Definition assert.cc:58
uint32_t CombineHashes(uint32_t hash, uint32_t other_hash)
Definition hash.h:12
uint32_t FinalizeHash(uint32_t hash, intptr_t hashbits=kBitsPerInt32)
Definition hash.h:20
#define DART_UNUSED
Definition globals.h:269

◆ ASSEMBLER_TEST_RUN() [2/2]

dart::ASSEMBLER_TEST_RUN ( StoreIntoObject  ,
test   
)

Definition at line 21 of file assembler_test.cc.

21 {
22#define TEST_CODE(value, growable_array, thread) \
23 test->Invoke<void, ObjectPtr, ObjectPtr, Thread*>(value, growable_array, \
24 thread)
25
26 const Array& old_array = Array::Handle(Array::New(3, Heap::kOld));
27 const Array& new_array = Array::Handle(Array::New(3, Heap::kNew));
28 const GrowableObjectArray& grow_old_array = GrowableObjectArray::Handle(
29 GrowableObjectArray::New(old_array, Heap::kOld));
30 const GrowableObjectArray& grow_new_array = GrowableObjectArray::Handle(
31 GrowableObjectArray::New(old_array, Heap::kNew));
32 Smi& smi = Smi::Handle();
33 Thread* thread = Thread::Current();
34
35 EXPECT(old_array.ptr() == grow_old_array.data());
36 EXPECT(!thread->StoreBufferContains(grow_old_array.ptr()));
37 EXPECT(old_array.ptr() == grow_new_array.data());
38 EXPECT(!thread->StoreBufferContains(grow_new_array.ptr()));
39
40 // Store Smis into the old object.
41 for (int i = -128; i < 128; i++) {
42 smi = Smi::New(i);
43 TEST_CODE(smi.ptr(), grow_old_array.ptr(), thread);
44 EXPECT(static_cast<CompressedObjectPtr>(smi.ptr()) ==
45 static_cast<CompressedObjectPtr>(grow_old_array.data()));
46 EXPECT(!thread->StoreBufferContains(grow_old_array.ptr()));
47 }
48
49 // Store an old object into the old object.
50 TEST_CODE(old_array.ptr(), grow_old_array.ptr(), thread);
51 EXPECT(old_array.ptr() == grow_old_array.data());
52 EXPECT(!thread->StoreBufferContains(grow_old_array.ptr()));
53
54 // Store a new object into the old object.
55 TEST_CODE(new_array.ptr(), grow_old_array.ptr(), thread);
56 EXPECT(new_array.ptr() == grow_old_array.data());
57 EXPECT(thread->StoreBufferContains(grow_old_array.ptr()));
58
59 // Store a new object into the new object.
60 TEST_CODE(new_array.ptr(), grow_new_array.ptr(), thread);
61 EXPECT(new_array.ptr() == grow_new_array.data());
62 EXPECT(!thread->StoreBufferContains(grow_new_array.ptr()));
63
64 // Store an old object into the new object.
65 TEST_CODE(old_array.ptr(), grow_new_array.ptr(), thread);
66 EXPECT(old_array.ptr() == grow_new_array.data());
67 EXPECT(!thread->StoreBufferContains(grow_new_array.ptr()));
68}
#define EXPECT(type, expectedAlignment, expectedSize)
#define TEST_CODE(value, growable_array, thread)
ArrayPtr data() const
Definition object.h:11056

◆ Assign1337Index1()

DART_EXPORT int64_t * dart::Assign1337Index1 ( int64_t *  a)

Definition at line 538 of file ffi_test_functions.cc.

538 {
539 std::cout << "Assign1337Index1(" << a << ")\n";
540 std::cout << "val[0] = " << a[0] << "\n";
541 std::cout << "val[1] = " << a[1] << "\n";
542 a[1] = 1337;
543 std::cout << "val[1] = " << a[1] << "\n";
544 int64_t* retval = a + 1;
545 std::cout << "returning " << retval << "\n";
546 return retval;
547}

◆ AsSmiShiftLeftInstruction()

static BinarySmiOpInstr * dart::AsSmiShiftLeftInstruction ( Definition d)
static

Definition at line 2915 of file flow_graph.cc.

2915 {
2916 BinarySmiOpInstr* instr = d->AsBinarySmiOp();
2917 if ((instr != nullptr) && (instr->op_kind() == Token::kSHL)) {
2918 return instr;
2919 }
2920 return nullptr;
2921}
Token::Kind op_kind() const
Definition il.h:9348
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE auto & d
Definition main.cc:19

◆ AsTypedListFinalizerCallback()

void dart::AsTypedListFinalizerCallback ( void *  peer)

Definition at line 152 of file ffi.cc.

152 {
153 const auto* data = reinterpret_cast<AsTypedListFinalizerData*>(peer);
154 data->callback(data->token);
155 free(peer);
156}

◆ AvailableAssetsToCString()

static char * dart::AvailableAssetsToCString ( Thread *const  thread)
static

Definition at line 350 of file ffi_dynamic_library.cc.

350 {
351 Zone* const zone = thread->zone();
352
353 const auto& native_assets_map =
354 Array::Handle(zone, GetNativeAssetsMap(thread));
355 ZoneTextBuffer buffer(zone, 1024);
356
357 if (native_assets_map.IsNull()) {
358 buffer.Printf("No available native assets.");
359 } else {
360 bool first = true;
361 buffer.Printf("Available native assets: ");
362 NativeAssetsMap map(native_assets_map.ptr());
363 NativeAssetsMap::Iterator it(&map);
364 auto& asset_id = String::Handle(zone);
365 while (it.MoveNext()) {
366 if (!first) {
367 buffer.Printf(" ,");
368 }
369 auto entry = it.Current();
370 asset_id ^= map.GetKey(entry);
371 buffer.Printf("%s", asset_id.ToCString());
372 }
373 buffer.Printf(".");
374 map.Release();
375 }
376 return buffer.buffer();
377}
ArrayPtr GetNativeAssetsMap(Thread *thread)
SI auto map(std::index_sequence< I... >, Fn &&fn, const Args &... args) -> skvx::Vec< sizeof...(I), decltype(fn(args[0]...))>
Definition SkVx.h:680

◆ BackRefMatchesNoCase()

template<typename Char >
static bool dart::BackRefMatchesNoCase ( Canonicalize interp_canonicalize,
intptr_t  from,
intptr_t  current,
intptr_t  len,
const String subject,
bool  unicode 
)
static

◆ BackRefMatchesNoCase< uint16_t >()

template<>
bool dart::BackRefMatchesNoCase< uint16_t > ( Canonicalize interp_canonicalize,
intptr_t  from,
intptr_t  current,
intptr_t  len,
const String subject,
bool  unicode 
)

Definition at line 39 of file regexp_interpreter.cc.

44 {
45 Bool& ret = Bool::Handle();
46 if (unicode) {
47 ret = static_cast<BoolPtr>(CaseInsensitiveCompareUTF16(
48 static_cast<uword>(subject.ptr()), static_cast<uword>(Smi::New(from)),
49 static_cast<uword>(Smi::New(current)),
50 static_cast<uword>(Smi::New(len))));
51 } else {
52 ret = static_cast<BoolPtr>(CaseInsensitiveCompareUCS2(
53 static_cast<uword>(subject.ptr()), static_cast<uword>(Smi::New(from)),
54 static_cast<uword>(Smi::New(current)),
55 static_cast<uword>(Smi::New(len))));
56 }
57 return ret.value();
58}
bool value() const
Definition object.h:10770
uword CaseInsensitiveCompareUTF16(uword str_raw, uword lhs_index_raw, uword rhs_index_raw, uword length_raw)

◆ BackRefMatchesNoCase< uint8_t >()

template<>
bool dart::BackRefMatchesNoCase< uint8_t > ( Canonicalize interp_canonicalize,
intptr_t  from,
intptr_t  current,
intptr_t  len,
const String subject,
bool  unicode 
)

Definition at line 61 of file regexp_interpreter.cc.

66 {
67 // For Latin1 characters the unicode flag makes no difference.
68 for (int i = 0; i < len; i++) {
69 unsigned int old_char = subject.CharAt(from++);
70 unsigned int new_char = subject.CharAt(current++);
71 if (old_char == new_char) continue;
72 // Convert both characters to lower case.
73 old_char |= 0x20;
74 new_char |= 0x20;
75 if (old_char != new_char) return false;
76 // Not letters in the ASCII range and Latin-1 range.
77 if (!(old_char - 'a' <= 'z' - 'a') &&
78 !(old_char - 224 <= 254 - 224 && old_char != 247)) {
79 return false;
80 }
81 }
82 return true;
83}
uint16_t CharAt(intptr_t index) const
Definition object.h:10238

◆ BENCHMARK() [1/11]

dart::BENCHMARK ( CorelibCompileAll  )

Definition at line 45 of file benchmark_test.cc.

45 {
46 bin::Builtin::SetNativeResolver(bin::Builtin::kBuiltinLibrary);
47 bin::Builtin::SetNativeResolver(bin::Builtin::kIOLibrary);
48 bin::Builtin::SetNativeResolver(bin::Builtin::kCLILibrary);
49 TransitionNativeToVM transition(thread);
50 StackZone zone(thread);
51 Timer timer;
52 timer.Start();
53 const Error& error =
54 Error::Handle(Library::CompileAll(/*ignore_error=*/true));
55 if (!error.IsNull()) {
56 OS::PrintErr("Unexpected error in CorelibCompileAll benchmark:\n%s",
57 error.ToErrorCString());
58 }
59 timer.Stop();
60 int64_t elapsed_time = timer.TotalElapsedTime();
61 benchmark->set_score(elapsed_time);
62}
void Stop()
Definition timer.h:117
void Start()
Definition timer.h:111
int64_t TotalElapsedTime() const
Definition timer.h:123
const uint8_t uint32_t uint32_t GError ** error

◆ BENCHMARK() [2/11]

dart::BENCHMARK ( CorelibIsolateStartup  )

Definition at line 94 of file benchmark_test.cc.

94 {
95 const int kNumIterations = 1000;
96 Timer timer;
97 Isolate* isolate = thread->isolate();
99 for (int i = 0; i < kNumIterations; i++) {
100 timer.Start();
101 TestCase::CreateTestIsolate();
102 timer.Stop();
104 }
105 benchmark->set_score(timer.TotalElapsedTime() / kNumIterations);
106 Dart_EnterIsolate(reinterpret_cast<Dart_Isolate>(isolate));
107}
DART_EXPORT void Dart_ShutdownIsolate(void)
struct _Dart_Isolate * Dart_Isolate
Definition dart_api.h:88
DART_EXPORT void Dart_EnterIsolate(Dart_Isolate isolate)
DART_EXPORT void Dart_ExitIsolate(void)

◆ BENCHMARK() [3/11]

dart::BENCHMARK ( CreateMirrorSystem  )

Definition at line 389 of file benchmark_test.cc.

391 {
392 const char* kScriptChars =
393 "import 'dart:async';\n"
394 "import 'dart:core';\n"
395 "import 'dart:collection';\n"
396 "import 'dart:convert';\n"
397 "import 'dart:math';\n"
398 "import 'dart:isolate';\n"
399 "import 'dart:mirrors';\n"
400 "import 'dart:typed_data';\n"
401 "import 'dart:io';\n"
402 "import 'dart:cli';\n"
403 "\n";
404
405 // Start an Isolate, load a script and create a full snapshot.
406 // Need to load the script into the dart: core library due to

◆ BENCHMARK() [4/11]

dart::BENCHMARK ( EnterExitIsolate  )

Definition at line 408 of file benchmark_test.cc.

428 {
429 const char* kScriptChars =

◆ BENCHMARK() [5/11]

dart::BENCHMARK ( FrameLookup  )

Definition at line 303 of file benchmark_test.cc.

303 {
304 const char* kScriptChars =
305 R"(
306 class StackFrame {
307 @pragma('vm:external-name', 'StackFrame_accessFrame')
308 external static int accessFrame();
309 }
310 class First {
311 First() { }
312 int method1(int param) {
313 if (param == 1) {
314 param = method2(200);
315 } else {

◆ BENCHMARK() [6/11]

dart::BENCHMARK ( KernelServiceCompileAll  )

Definition at line 221 of file benchmark_test.cc.

221 {
222 // kernel_service.dill is built with sound null safety.
223 bin::Builtin::SetNativeResolver(bin::Builtin::kBuiltinLibrary);
224 bin::Builtin::SetNativeResolver(bin::Builtin::kIOLibrary);
225 bin::Builtin::SetNativeResolver(bin::Builtin::kCLILibrary);
226 char* dill_path = ComputeKernelServicePath(Benchmark::Executable());
227 File* file = File::Open(nullptr, dill_path, File::kRead);
228 EXPECT(file != nullptr);
230 intptr_t kernel_buffer_size = file->Length();
231 uint8_t* kernel_buffer =
232 reinterpret_cast<uint8_t*>(malloc(kernel_buffer_size));
233 bool read_fully = file->ReadFully(kernel_buffer, kernel_buffer_size);
234 EXPECT(read_fully);
236 Dart_LoadScriptFromKernel(kernel_buffer, kernel_buffer_size);
238 Dart_Handle service_lib = Dart_LookupLibrary(NewString("dart:vmservice_io"));
239 ASSERT(!Dart_IsError(service_lib));
240 Dart_SetNativeResolver(service_lib, NativeResolver, nullptr);
243
244 Timer timer;
245 timer.Start();
246#if !defined(PRODUCT)
247 const bool old_flag = FLAG_background_compilation;
248 FLAG_background_compilation = false;
249#endif
251#if !defined(PRODUCT)
252 FLAG_background_compilation = old_flag;
253#endif
255 timer.Stop();
256 int64_t elapsed_time = timer.TotalElapsedTime();
257 benchmark->set_score(elapsed_time);
258 free(dill_path);
259 free(kernel_buffer);
260}
static File * Open(Namespace *namespc, const char *path, FileOpenMode mode)
DART_EXPORT Dart_Handle Dart_SetNativeResolver(Dart_Handle library, Dart_NativeEntryResolver resolver, Dart_NativeEntrySymbol symbol)
struct _Dart_Handle * Dart_Handle
Definition dart_api.h:258
DART_EXPORT Dart_Handle Dart_LookupLibrary(Dart_Handle url)
DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_FinalizeLoading(bool complete_futures)
DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_LoadScriptFromKernel(const uint8_t *kernel_buffer, intptr_t kernel_size)
DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_CompileAll(void)
static char * ComputeKernelServicePath(const char *arg)
Dart_Handle NewString(const char *str)
Definition unit_test.h:229
#define EXPECT_VALID(handle)
Definition unit_test.h:650

◆ BENCHMARK() [7/11]

dart::BENCHMARK ( LargeMap  )

Definition at line 496 of file benchmark_test.cc.

498 {
499 StackZone zone(thread);
500 std::unique_ptr<Message> message =
501 WriteMessage(/* same_group */ false, smi_object, ILLEGAL_PORT,
502 Message::kNormalPriority);
503
504 // Read object back from the snapshot.
505 ReadMessage(thread, message.get());
506 }
507 timer.Stop();
508 int64_t elapsed_time = timer.TotalElapsedTime();
509 benchmark->set_score(elapsed_time);
510}
511
512BENCHMARK(SimpleMessage) {
513 TransitionNativeToVM transition(thread);
514 StackZone zone(thread);
515 const Array& array_object = Array::Handle(Array::New(2));
516 array_object.SetAt(0, Integer::Handle(Smi::New(42)));
517 array_object.SetAt(1, Object::Handle());
518 const intptr_t kLoopCount = 1000000;
519 Timer timer;
520 timer.Start();
521 for (intptr_t i = 0; i < kLoopCount; i++) {
522 StackZone zone(thread);
523 std::unique_ptr<Message> message =
524 WriteMessage(/* same_group */ false, array_object, ILLEGAL_PORT,
525 Message::kNormalPriority);
#define BENCHMARK(name)
#define ILLEGAL_PORT
Definition dart_api.h:1530
Win32Message message
ObjectPtr ReadMessage(Thread *thread, Message *message)
std::unique_ptr< Message > WriteMessage(bool same_group, const Object &obj, Dart_Port dest_port, Message::Priority priority)

◆ BENCHMARK() [8/11]

dart::BENCHMARK ( SerializeNull  )

Definition at line 431 of file benchmark_test.cc.

432 {\n"
433 " currentMirrorSystem();\n"
434 "}\n";
435
436 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
437
438 Timer timer;
439 timer.Start();
440 Dart_Handle result = Dart_Invoke(lib, NewString("benchmark"), 0, nullptr);
441 EXPECT_VALID(result);
442 timer.Stop();
443 int64_t elapsed_time = timer.TotalElapsedTime();
444 benchmark->set_score(elapsed_time);
445}
446
447BENCHMARK(EnterExitIsolate) {
448 const char* kScriptChars =
449 "import 'dart:core';\n"
450 "\n";

◆ BENCHMARK() [9/11]

dart::BENCHMARK ( SerializeSmi  )

Definition at line 452 of file benchmark_test.cc.

453 {
454 TransitionNativeToVM transition(thread);
455 StackZone zone(thread);
456 Api::CheckAndFinalizePendingClasses(thread);
457 }
459 Timer timer;
460 timer.Start();
461 for (intptr_t i = 0; i < kLoopCount; i++) {
463 Dart_EnterIsolate(isolate);
464 }
465 timer.Stop();
466 int64_t elapsed_time = timer.TotalElapsedTime();
467 benchmark->set_score(elapsed_time);
468}
469
470BENCHMARK(SerializeNull) {
471 TransitionNativeToVM transition(thread);
DART_EXPORT Dart_Isolate Dart_CurrentIsolate(void)

◆ BENCHMARK() [10/11]

dart::BENCHMARK ( SimpleMessage  )

Definition at line 473 of file benchmark_test.cc.

477 {
478 StackZone zone(thread);
479 std::unique_ptr<Message> message =
480 WriteMessage(/* same_group */ false, null_object, ILLEGAL_PORT,
481 Message::kNormalPriority);
482
483 // Read object back from the snapshot.
484 ReadMessage(thread, message.get());
485 }
486 timer.Stop();
487 int64_t elapsed_time = timer.TotalElapsedTime();
488 benchmark->set_score(elapsed_time);
489}
490
491BENCHMARK(SerializeSmi) {
492 TransitionNativeToVM transition(thread);
493 StackZone zone(thread);
494 const Integer& smi_object = Integer::Handle(Smi::New(42));

◆ BENCHMARK() [11/11]

dart::BENCHMARK ( UseDartApi  )

Definition at line 167 of file benchmark_test.cc.

167 {
168 const int kNumIterations = 1000000;
169 const char* kScriptChars = R"(
170import 'dart:nativewrappers';
171
172base class Class extends NativeFieldWrapperClass1 {
173 @pragma("vm:external-name", "init")
174 external void init();
175 @pragma("vm:external-name", "method")
176 external int method(int param1, int param2);
177}
178
179void benchmark(int count) {
180 Class c = Class();
181 c.init();
182 for (int i = 0; i < count; i++) {
183 c.method(i,7);
184 }
185})";
186
187 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, bm_uda_lookup,
191
192 Dart_Handle args[1];
193 args[0] = Dart_NewInteger(kNumIterations);
194
195 // Warmup first to avoid compilation jitters.
196 result = Dart_Invoke(lib, NewString("benchmark"), 1, args);
198
199 Timer timer;
200 timer.Start();
201 result = Dart_Invoke(lib, NewString("benchmark"), 1, args);
203 timer.Stop();
204 int64_t elapsed_time = timer.TotalElapsedTime();
205 benchmark->set_score(elapsed_time);
206}
DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_Invoke(Dart_Handle target, Dart_Handle name, int number_of_arguments, Dart_Handle *arguments)
DART_EXPORT Dart_Handle Dart_NewInteger(int64_t value)
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
#define RESOLVED_USER_TEST_URI
Definition unit_test.h:317

◆ BENCHMARK_MEMORY()

dart::BENCHMARK_MEMORY ( InitialRSS  )

Definition at line 527 of file benchmark_test.cc.

◆ BENCHMARK_SIZE() [1/2]

dart::BENCHMARK_SIZE ( CoreSnapshotSize  )

Definition at line 317 of file benchmark_test.cc.

320 {
321 if (param == 200) {
322 return First.staticmethod(this, param);
323 } else {
324 return First.staticmethod(this, 10);
325 }
326 }
327 static int staticmethod(First obj, int param) {
328 if (param == 10) {
329 return obj.method3(10);
330 } else {
331 return obj.method3(200);
332 }
333 }
334 int method3(int param) {
335 return StackFrame.accessFrame();
336 }
337 }
338 class StackFrameTest {
339 static int testMain() {
340 First obj = new First();
341 return obj.method1(1);
342 }
343 }
344 )";
345 Dart_Handle lib =
346 TestCase::LoadTestScript(kScriptChars, StackFrameNativeResolver);
347 Dart_Handle cls = Dart_GetClass(lib, NewString("StackFrameTest"));
348 Dart_Handle result = Dart_Invoke(cls, NewString("testMain"), 0, nullptr);
349 EXPECT_VALID(result);
350 int64_t elapsed_time = 0;

◆ BENCHMARK_SIZE() [2/2]

dart::BENCHMARK_SIZE ( StandaloneSnapshotSize  )

Definition at line 352 of file benchmark_test.cc.

356 {
357 const char* kScriptChars =
358 "import 'dart:async';\n"
359 "import 'dart:core';\n"
360 "import 'dart:collection';\n"
361 "import 'dart:_internal';\n"
362 "import 'dart:math';\n"
363 "import 'dart:isolate';\n"
364 "import 'dart:mirrors';\n"
365 "import 'dart:typed_data';\n"
366 "\n";
367
368 // Start an Isolate, load a script and create a full snapshot.
369 // Need to load the script into the dart: core library due to
370 // the import of dart:_internal.
371 TestCase::LoadCoreTestScript(kScriptChars, nullptr);
372
373 TransitionNativeToVM transition(thread);
374 StackZone zone(thread);
375
376 Api::CheckAndFinalizePendingClasses(thread);
377
378 // Write snapshot with object content.
379 MallocWriteStream vm_snapshot_data(FullSnapshotWriter::kInitialSize);
380 MallocWriteStream isolate_snapshot_data(FullSnapshotWriter::kInitialSize);
381 FullSnapshotWriter writer(
382 Snapshot::kFullCore, &vm_snapshot_data, &isolate_snapshot_data,
383 /*vm_image_writer=*/nullptr, /*iso_image_writer=*/nullptr);
384 writer.WriteFullSnapshot();
385 const Snapshot* snapshot =
386 Snapshot::SetupFromBuffer(isolate_snapshot_data.buffer());
387 ASSERT(snapshot->kind() == Snapshot::kFullCore);
Kind kind() const
Definition snapshot.h:60

◆ beta_callback()

static bool dart::beta_callback ( const char *  name,
const char **  option_keys,
const char **  option_values,
intptr_t  num_options,
void *  user_data,
const char **  result 
)
static

Definition at line 573 of file service_test.cc.

578 {
579 *result = Utils::StrDup("beta");
580 return false;
581}

◆ BinaryIntegerEvaluateRaw()

static IntegerPtr dart::BinaryIntegerEvaluateRaw ( const Integer left,
const Integer right,
Token::Kind  token_kind 
)
static

Definition at line 9 of file evaluator.cc.

11 {
12 switch (token_kind) {
13 case Token::kTRUNCDIV:
15 case Token::kMOD:
16 // Check right value for zero.
17 if (right.AsInt64Value() == 0) {
18 break; // Will throw.
19 }
21 case Token::kADD:
23 case Token::kSUB:
25 case Token::kMUL:
26 return left.ArithmeticOp(token_kind, right, Heap::kOld);
27 case Token::kSHL:
29 case Token::kSHR:
31 case Token::kUSHR:
32 if (right.AsInt64Value() >= 0) {
33 return left.ShiftOp(token_kind, right, Heap::kOld);
34 }
35 break;
36 case Token::kBIT_AND:
38 case Token::kBIT_OR:
40 case Token::kBIT_XOR:
41 return left.BitOp(token_kind, right, Heap::kOld);
42 case Token::kDIV:
43 break;
44 default:
46 }
47
48 return Integer::null();
49}
static bool left(const SkPoint &p0, const SkPoint &p1)
static bool right(const SkPoint &p0, const SkPoint &p1)
#define FALL_THROUGH
Definition globals.h:15

◆ BindsToGivenConstant()

static bool dart::BindsToGivenConstant ( Value v,
intptr_t  expected 
)
static

Definition at line 3605 of file il.cc.

3605 {
3606 return v->BindsToConstant() && v->BoundConstant().IsSmi() &&
3607 (Smi::Cast(v->BoundConstant()).Value() == expected);
3608}
bool BindsToConstant() const
Definition il.cc:1181
const Object & BoundConstant() const
Definition il.cc:1199

◆ bit_cast()

template<class D , class S >
DART_FORCE_INLINE D dart::bit_cast ( const S source)

Definition at line 646 of file globals.h.

646 {
647 static_assert(sizeof(D) == sizeof(S),
648 "Source and destination must have the same size");
649
650 D destination;
651 // This use of memcpy is safe: source and destination cannot overlap.
652 memcpy(&destination, &source, sizeof(destination));
653 return destination;
654}
SkBitmap source
Definition examples.cpp:28

◆ bit_copy()

template<class D , class S >
DART_FORCE_INLINE D dart::bit_copy ( const S source)

Definition at line 662 of file globals.h.

662 {
663 D destination;
664 // This use of memcpy is safe: source and destination cannot overlap.
665 memcpy(&destination, reinterpret_cast<const void*>(&source),
666 sizeof(destination));
667 return destination;
668}

◆ BitLengthEvaluateRaw()

static IntegerPtr dart::BitLengthEvaluateRaw ( const Integer value,
Zone zone 
)
static

Definition at line 71 of file evaluator.cc.

71 {
72 if (value.IsSmi()) {
73 return Integer::New(Utils::BitLength(Smi::Cast(value).Value()), Heap::kOld);
74 } else if (value.IsMint()) {
75 return Integer::New(Utils::BitLength(Mint::Cast(value).value()),
76 Heap::kOld);
77 }
78 return Integer::null();
79}

◆ BitSize()

static int dart::BitSize ( const Range range)
static

Definition at line 2342 of file range_analysis.cc.

2342 {
2343 const int64_t min = Range::ConstantMin(range).ConstantValue();
2344 const int64_t max = Range::ConstantMax(range).ConstantValue();
2345 return Utils::Maximum(Utils::BitLength(min), Utils::BitLength(max));
2346}
static float max(float r, float g, float b)
Definition hsl.cpp:49
static float min(float r, float g, float b)
Definition hsl.cpp:48

◆ BlankMessage()

static std::unique_ptr< Message > dart::BlankMessage ( Dart_Port  dest,
Message::Priority  priority 
)
static

Definition at line 131 of file message_handler_test.cc.

132 {
133 return Message::New(dest, reinterpret_cast<uint8_t*>(malloc(1)), 1, nullptr,
134 priority);
135}

◆ BlockOrderForAllocation()

static const GrowableArray< BlockEntryInstr * > & dart::BlockOrderForAllocation ( const FlowGraph flow_graph)
static

Definition at line 80 of file linearscan.cc.

81 {
82 // Currently CodegenBlockOrder is not topologically sorted in JIT and can't
83 // be used for register allocation.
84 return CompilerState::Current().is_aot() ? *flow_graph.CodegenBlockOrder()
85 : flow_graph.reverse_postorder();
86}
const GrowableArray< BlockEntryInstr * > & reverse_postorder() const
Definition flow_graph.h:207
GrowableArray< BlockEntryInstr * > * CodegenBlockOrder()

◆ bm_uda_lookup()

static Dart_NativeFunction dart::bm_uda_lookup ( Dart_Handle  name,
int  argument_count,
bool *  auto_setup_scope 
)
static

Definition at line 152 of file benchmark_test.cc.

154 {
155 ASSERT(auto_setup_scope != nullptr);
156 *auto_setup_scope = true;
157 const char* cstr = nullptr;
160 if (strcmp(cstr, "init") == 0) {
161 return InitNativeFields;
162 } else {
163 return UseDartApi;
164 }
165}
DART_EXPORT Dart_Handle Dart_StringToCString(Dart_Handle str, const char **cstr)
static void InitNativeFields(Dart_NativeArguments args)

◆ BootstrapFromKernel()

static ErrorPtr dart::BootstrapFromKernel ( Thread thread,
const uint8_t *  kernel_buffer,
intptr_t  kernel_buffer_size 
)
static

Definition at line 159 of file bootstrap.cc.

161 {
162 Zone* zone = thread->zone();
163 const char* error = nullptr;
164 std::unique_ptr<kernel::Program> program = kernel::Program::ReadFromBuffer(
165 kernel_buffer, kernel_buffer_size, &error);
166 if (program == nullptr) {
167 const intptr_t kMessageBufferSize = 512;
168 char message_buffer[kMessageBufferSize];
169 Utils::SNPrint(message_buffer, kMessageBufferSize,
170 "Can't load Kernel binary: %s.", error);
171 const String& msg = String::Handle(String::New(message_buffer, Heap::kOld));
172 return ApiError::New(msg, Heap::kOld);
173 }
174
175 if (program->is_single_program()) {
176 return BootstrapFromKernelSingleProgram(thread, std::move(program));
177 }
178
179 GrowableArray<intptr_t> subprogram_file_starts;
180 {
181 kernel::Reader reader(program->binary());
182 kernel::KernelLoader::index_programs(&reader, &subprogram_file_starts);
183 }
184 intptr_t subprogram_count = subprogram_file_starts.length() - 1;
185
186 // Create "fake programs" for each sub-program.
187 auto& load_result = Error::Handle(zone);
188 for (intptr_t i = 0; i < subprogram_count; i++) {
189 intptr_t subprogram_start = subprogram_file_starts.At(i);
190 intptr_t subprogram_end = subprogram_file_starts.At(i + 1);
191 const auto& component = TypedDataBase::Handle(
192 program->binary().ViewFromTo(subprogram_start, subprogram_end));
193 kernel::Reader reader(component);
194 const char* error = nullptr;
195 std::unique_ptr<kernel::Program> subprogram =
196 kernel::Program::ReadFrom(&reader, &error);
197 if (subprogram == nullptr) {
198 FATAL("Failed to load kernel file: %s", error);
199 }
200 ASSERT(subprogram->is_single_program());
201 if (i == 0) {
202 // The first subprogram must be the main Dart program.
203 load_result ^=
204 BootstrapFromKernelSingleProgram(thread, std::move(subprogram));
205 } else {
206 // Restrictions on the subsequent programs: Must contain only
207 // contain dummy libraries with VM recognized classes (or classes kept
208 // fully intact by tree-shaking).
209 // Currently only used for concatenating native assets mappings.
210 kernel::KernelLoader loader(subprogram.get(),
211 /*uri_to_source_table=*/nullptr);
212 load_result ^= loader.LoadProgram(false);
213 }
214 if (load_result.IsError()) return load_result.ptr();
215 }
216 return Error::null();
217}
static ErrorPtr BootstrapFromKernelSingleProgram(Thread *thread, std::unique_ptr< kernel::Program > program)
Definition bootstrap.cc:112

◆ BootstrapFromKernelSingleProgram()

static ErrorPtr dart::BootstrapFromKernelSingleProgram ( Thread thread,
std::unique_ptr< kernel::Program >  program 
)
static

Definition at line 112 of file bootstrap.cc.

114 {
115 Zone* zone = thread->zone();
116 LongJumpScope jump;
117 if (setjmp(*jump.Set()) == 0) {
118 kernel::KernelLoader loader(program.get(), /*uri_to_source_table=*/nullptr);
119
120 auto isolate_group = thread->isolate_group();
121
122 if (isolate_group->obfuscate()) {
123 loader.ReadObfuscationProhibitions();
124 }
125
126 // Load the bootstrap libraries in order (see object_store.h).
127 Library& library = Library::Handle(zone);
128 for (intptr_t i = 0; i < kBootstrapLibraryCount; ++i) {
129 ObjectStore::BootstrapLibraryId id = bootstrap_libraries[i].index;
130 library = isolate_group->object_store()->bootstrap_library(id);
131 loader.LoadLibrary(library);
132 }
133
134 // Finish bootstrapping, including class finalization.
135 Finish(thread);
136
137 isolate_group->object_store()->InitKnownObjects();
138
139 // The platform binary may contain other libraries (e.g., dart:_builtin or
140 // dart:io) that will not be bundled with application. Load them now.
141 const Object& result = Object::Handle(zone, loader.LoadProgram());
142 program.reset();
143 if (result.IsError()) {
144 return Error::Cast(result).ptr();
145 }
146
147 if (FLAG_precompiled_mode) {
148 loader.ReadLoadingUnits();
149 }
150
151 return Error::null();
152 }
153
154 // Either class finalization failed or we caught a compile-time error.
155 // In both cases sticky error would be set.
156 return Thread::Current()->StealStickyError();
157}
jmp_buf * Set()
Definition longjump.cc:16
static void Finish(Thread *thread)
Definition bootstrap.cc:44
ObjectStore::BootstrapLibraryId index
Definition bootstrap.cc:27

◆ BoxCidToCString()

static const char * dart::BoxCidToCString ( intptr_t  box_cid)
static

Definition at line 364 of file isolate_reload.cc.

364 {
365 switch (box_cid) {
366 case kDoubleCid:
367 return "double";
368 case kFloat32x4Cid:
369 return "float32x4";
370 case kFloat64x2Cid:
371 return "float64x2";
372 case kIntegerCid:
373 return "int64";
374 }
375 return "?";
376}

◆ BuildExpressionEvaluationScope()

static void dart::BuildExpressionEvaluationScope ( Thread thread,
JSONStream js 
)
static

Definition at line 2955 of file service.cc.

2955 {
2956 if (CheckDebuggerDisabled(thread, js)) {
2957 return;
2958 }
2959
2960 Isolate* isolate = thread->isolate();
2961 DebuggerStackTrace* stack = isolate->debugger()->StackTrace();
2962 intptr_t framePos = UIntParameter::Parse(js->LookupParam("frameIndex"));
2963 if (framePos >= stack->Length()) {
2964 PrintInvalidParamError(js, "frameIndex");
2965 return;
2966 }
2967
2968 Zone* zone = thread->zone();
2969 const GrowableObjectArray& param_names =
2970 GrowableObjectArray::Handle(zone, GrowableObjectArray::New());
2971 const GrowableObjectArray& param_values =
2972 GrowableObjectArray::Handle(zone, GrowableObjectArray::New());
2973 const GrowableObjectArray& type_params_names =
2974 GrowableObjectArray::Handle(zone, GrowableObjectArray::New());
2975 const GrowableObjectArray& type_params_bounds =
2976 GrowableObjectArray::Handle(zone, GrowableObjectArray::New());
2977 const GrowableObjectArray& type_params_defaults =
2978 GrowableObjectArray::Handle(zone, GrowableObjectArray::New());
2979 String& klass_name = String::Handle(zone);
2980 String& method_name = String::Handle(zone);
2981 String& library_uri = String::Handle(zone);
2982 bool isStatic = false;
2983 String& script_uri = String::Handle(zone);
2984 TokenPosition token_pos = TokenPosition::kNoSource;
2985
2986 if (BuildScope(thread, js, param_names, param_values)) {
2987 return;
2988 }
2989
2990 if (js->HasParam("frameIndex")) {
2991 // building scope in the context of a given frame
2992 DebuggerStackTrace* stack = isolate->debugger()->StackTrace();
2993 intptr_t framePos = UIntParameter::Parse(js->LookupParam("frameIndex"));
2994 if (framePos >= stack->Length()) {
2995 PrintInvalidParamError(js, "frameIndex");
2996 return;
2997 }
2998
2999 ActivationFrame* frame = stack->FrameAt(framePos);
3000 script_uri = frame->SourceUrl();
3001 token_pos = frame->TokenPos();
3002 frame->BuildParameters(param_names, param_values, type_params_names,
3003 type_params_bounds, type_params_defaults);
3004
3005 if (frame->function().is_static()) {
3006 const Class& cls = Class::Handle(zone, frame->function().Owner());
3007 if (!cls.IsTopLevel()) {
3008 klass_name = cls.UserVisibleName();
3009 }
3010 library_uri = Library::Handle(zone, cls.library()).url();
3011 method_name = frame->function().UserVisibleName();
3012 isStatic = true;
3013 } else {
3014 Class& method_cls = Class::Handle(zone, frame->function().Owner());
3015 method_cls = method_cls.Mixin();
3016 library_uri = Library::Handle(zone, method_cls.library()).url();
3017 klass_name = method_cls.UserVisibleName();
3018 method_name = frame->function().UserVisibleName();
3019 isStatic = false;
3020 }
3021 } else {
3022 // building scope in the context of a given object
3023 if (!js->HasParam("targetId")) {
3024 js->PrintError(kInvalidParams,
3025 "Either targetId or frameIndex has to be provided.");
3026 return;
3027 }
3028 const char* target_id = js->LookupParam("targetId");
3029
3030 ObjectIdRing::LookupResult lookup_result;
3031 Object& obj = Object::Handle(
3032 zone, LookupHeapObject(thread, target_id, &lookup_result));
3033 if (obj.ptr() == Object::sentinel().ptr()) {
3034 PrintInvalidParamError(js, "targetId");
3035 return;
3036 }
3037 if (obj.IsLibrary()) {
3038 const Library& lib = Library::Cast(obj);
3039 library_uri = lib.url();
3040 isStatic = true;
3041 } else if (obj.IsClass() || ((obj.IsInstance() || obj.IsNull()) &&
3042 !ContainsNonInstance(obj))) {
3043 Class& cls = Class::Handle(zone);
3044 if (obj.IsClass()) {
3045 cls ^= obj.ptr();
3046 isStatic = true;
3047 } else {
3048 Instance& instance = Instance::Handle(zone);
3049 instance ^= obj.ptr();
3050 cls = instance.clazz();
3051 cls = cls.Mixin();
3052 isStatic = false;
3053 }
3054 if (!cls.IsTopLevel() &&
3055 (IsInternalOnlyClassId(cls.id()) || cls.id() == kTypeArgumentsCid)) {
3056 js->PrintError(
3057 kInvalidParams,
3058 "Expressions can be evaluated only with regular Dart instances");
3059 return;
3060 }
3061
3062 if (!cls.IsTopLevel()) {
3063 klass_name = cls.UserVisibleName();
3064 }
3065 library_uri = Library::Handle(zone, cls.library()).url();
3066 } else {
3067 js->PrintError(kInvalidParams,
3068 "%s: invalid 'targetId' parameter: "
3069 "Cannot evaluate against a VM-internal object",
3070 js->method());
3071 return;
3072 }
3073 }
3074
3075 JSONObject report(js);
3076 {
3077 JSONArray jsonParamNames(&report, "param_names");
3078
3079 String& param_name = String::Handle(zone);
3080 for (intptr_t i = 0; i < param_names.Length(); i++) {
3081 param_name ^= param_names.At(i);
3082 jsonParamNames.AddValue(param_name.ToCString());
3083 }
3084 }
3085 {
3086 const JSONArray jsonParamTypes(&report, "param_types");
3087 Object& obj = Object::Handle();
3088 Instance& instance = Instance::Handle();
3089 const GrowableObjectArray& param_types =
3090 GrowableObjectArray::Handle(zone, GrowableObjectArray::New());
3091 AbstractType& type = AbstractType::Handle();
3092 for (intptr_t i = 0; i < param_names.Length(); i++) {
3093 obj = param_values.At(i);
3094 if (obj.IsNull()) {
3095 param_types.Add(obj);
3096 } else if (obj.IsInstance()) {
3097 instance ^= param_values.At(i);
3098 type = instance.GetType(Heap::kNew);
3099 CollectStringifiedType(thread, zone, type, param_types);
3100 }
3101 }
3102 for (intptr_t i = 0; i < param_types.Length(); i++) {
3103 instance ^= param_types.At(i);
3104 jsonParamTypes.AddValue(instance.ToCString());
3105 }
3106 }
3107
3108 {
3109 JSONArray jsonTypeParamsNames(&report, "type_params_names");
3110 String& type_param_name = String::Handle(zone);
3111 for (intptr_t i = 0; i < type_params_names.Length(); i++) {
3112 type_param_name ^= type_params_names.At(i);
3113 jsonTypeParamsNames.AddValue(type_param_name.ToCString());
3114 }
3115 }
3116 {
3117 const JSONArray jsonParamTypes(&report, "type_params_bounds");
3118 const GrowableObjectArray& type_params_bounds_strings =
3119 GrowableObjectArray::Handle(zone, GrowableObjectArray::New());
3120 AbstractType& type = AbstractType::Handle();
3121 for (intptr_t i = 0; i < type_params_bounds.Length(); i++) {
3122 type ^= type_params_bounds.At(i);
3123 CollectStringifiedType(thread, zone, type, type_params_bounds_strings);
3124 }
3125 Instance& instance = Instance::Handle();
3126 for (intptr_t i = 0; i < type_params_bounds_strings.Length(); i++) {
3127 instance ^= type_params_bounds_strings.At(i);
3128 jsonParamTypes.AddValue(instance.ToCString());
3129 }
3130 }
3131 {
3132 const JSONArray jsonParamTypes(&report, "type_params_defaults");
3133 const GrowableObjectArray& type_params_defaults_strings =
3134 GrowableObjectArray::Handle(zone, GrowableObjectArray::New());
3135 AbstractType& type = AbstractType::Handle();
3136 for (intptr_t i = 0; i < type_params_defaults.Length(); i++) {
3137 type ^= type_params_defaults.At(i);
3138 CollectStringifiedType(thread, zone, type, type_params_defaults_strings);
3139 }
3140 Instance& instance = Instance::Handle();
3141 for (intptr_t i = 0; i < type_params_defaults_strings.Length(); i++) {
3142 instance ^= type_params_defaults_strings.At(i);
3143 jsonParamTypes.AddValue(instance.ToCString());
3144 }
3145 }
3146 report.AddProperty("libraryUri", library_uri.ToCString());
3147 if (!klass_name.IsNull()) {
3148 report.AddProperty("klass", klass_name.ToCString());
3149 }
3150 if (!method_name.IsNull()) {
3151 report.AddProperty("method", method_name.ToCString());
3152 }
3153 report.AddProperty("tokenPos", token_pos);
3154 if (!script_uri.IsNull()) {
3155 report.AddProperty("scriptUri", script_uri.ToCString());
3156 }
3157 report.AddProperty("isStatic", isStatic);
3158}
DebuggerStackTrace * StackTrace()
Definition debugger.cc:1797
VkInstance instance
Definition main.cc:48
static bool BuildScope(Thread *thread, JSONStream *js, const GrowableObjectArray &names, const GrowableObjectArray &values)
Definition service.cc:2830
static ObjectPtr LookupHeapObject(Thread *thread, const char *id_original, ObjectIdRing::LookupResult *result)
Definition service.cc:2177
static void CollectStringifiedType(Thread *thread, Zone *zone, const AbstractType &type, const GrowableObjectArray &output)
Definition service.cc:2889
bool IsInternalOnlyClassId(intptr_t index)
Definition class_id.h:299
static bool ContainsNonInstance(const Object &obj)
Definition service.cc:1790

◆ BuildFilesPairs()

static Dart_CObject dart::BuildFilesPairs ( int  source_files_count,
Dart_SourceFile  source_files[] 
)
static

Definition at line 330 of file kernel_isolate.cc.

331 {
332 Dart_CObject files;
334 files.value.as_array.length = source_files_count * 2;
335 // typedef Dart_CObject* Dart_CObjectPtr;
336 Dart_CObject** fileNamePairs = new Dart_CObject*[source_files_count * 2];
337 for (int i = 0; i < source_files_count; i++) {
338 Dart_CObject* source_uri = new Dart_CObject();
339 source_uri->type = Dart_CObject_kString;
340 source_uri->value.as_string = const_cast<char*>(source_files[i].uri);
341 fileNamePairs[i * 2] = source_uri;
342 Dart_CObject* source_code = new Dart_CObject();
343
344 if (source_files[i].source != nullptr) {
345 source_code->type = Dart_CObject_kTypedData;
347 source_code->value.as_typed_data.length = strlen(source_files[i].source);
348 source_code->value.as_typed_data.values =
349 reinterpret_cast<const uint8_t*>(source_files[i].source);
350 } else {
351 source_code->type = Dart_CObject_kNull;
352 }
353 fileNamePairs[(i * 2) + 1] = source_code;
354 }
355 files.value.as_array.values = fileNamePairs;
356 return files;
357}
@ Dart_TypedData_kUint8
Definition dart_api.h:2606
@ Dart_CObject_kTypedData
@ Dart_CObject_kString
@ Dart_CObject_kArray
@ Dart_CObject_kNull
struct _Dart_CObject Dart_CObject
const char * uri
Definition dart_api.h:3793
const char * source
Definition dart_api.h:3794
union _Dart_CObject::@86 value
Dart_CObject_Type type
struct _Dart_CObject::@86::@90 as_typed_data
const char * as_string
struct _Dart_CObject::@86::@89 as_array
struct _Dart_CObject ** values

◆ BuildInstructions()

InstructionsPtr dart::BuildInstructions ( std::function< void(compiler::Assembler *assembler)>  fun)

Definition at line 97 of file il_test_helper.cc.

98 {
99 auto thread = Thread::Current();
100 compiler::Assembler assembler(nullptr);
101
102 fun(&assembler);
103
104 auto& code = Code::Handle();
105 auto install_code_fun = [&] {
106 code = Code::FinalizeCode(nullptr, &assembler,
107 Code::PoolAttachment::kNotAttachPool,
108 /*optimized=*/false, /*stats=*/nullptr);
109 };
110 SafepointWriteRwLocker ml(thread, thread->isolate_group()->program_lock());
111 thread->isolate_group()->RunWithStoppedMutators(install_code_fun,
112 /*use_force_growth=*/true);
113 return code.instructions();
114}

◆ BuildScope()

static bool dart::BuildScope ( Thread thread,
JSONStream js,
const GrowableObjectArray names,
const GrowableObjectArray values 
)
static

Definition at line 2830 of file service.cc.

2833 {
2834 const char* scope = js->LookupParam("scope");
2837 if (scope != nullptr) {
2838 if (!ParseScope(scope, &cnames, &cids)) {
2839 PrintInvalidParamError(js, "scope");
2840 return true;
2841 }
2842 String& name = String::Handle();
2843 Object& obj = Object::Handle();
2844 for (intptr_t i = 0; i < cids.length(); i++) {
2845 ObjectIdRing::LookupResult lookup_result;
2846 obj = LookupHeapObject(thread, cids[i], &lookup_result);
2847 if (obj.ptr() == Object::sentinel().ptr()) {
2848 if (lookup_result == ObjectIdRing::kCollected) {
2849 PrintSentinel(js, kCollectedSentinel);
2850 } else if (lookup_result == ObjectIdRing::kExpired) {
2851 PrintSentinel(js, kExpiredSentinel);
2852 } else {
2853 PrintInvalidParamError(js, "targetId");
2854 }
2855 return true;
2856 }
2857 if ((!obj.IsInstance() && !obj.IsNull()) || ContainsNonInstance(obj)) {
2858 js->PrintError(kInvalidParams,
2859 "%s: invalid scope 'targetId' parameter: "
2860 "Cannot evaluate against a VM-internal object",
2861 js->method());
2862 return true;
2863 }
2864 name = String::New(cnames[i]);
2865 names.Add(name);
2866 values.Add(obj);
2867 }
2868 }
2869 return false;
2870}
static bool ParseScope(const char *scope, GrowableArray< const char * > *names, GrowableArray< const char * > *ids)
Definition service.cc:2783

◆ BuildSourceFilesArray()

static intptr_t dart::BuildSourceFilesArray ( Dart_SourceFile **  sourcefiles,
const char *  script,
const char *  script_url = RESOLVED_USER_TEST_URI 
)
static

Definition at line 392 of file unit_test.cc.

395 {
396 ASSERT(sourcefiles != nullptr);
397 ASSERT(script != nullptr);
398
399 intptr_t num_test_libs = 0;
400 if (test_libs_ != nullptr) {
401 num_test_libs = test_libs_->length();
402 }
403
404 *sourcefiles = new Dart_SourceFile[num_test_libs + 1];
405 (*sourcefiles)[0].uri = script_url;
406 (*sourcefiles)[0].source = script;
407 for (intptr_t i = 0; i < num_test_libs; ++i) {
408 (*sourcefiles)[i + 1].uri = test_libs_->At(i).url;
409 (*sourcefiles)[i + 1].source = test_libs_->At(i).source;
410 }
411 return num_test_libs + 1;
412}
static MallocGrowableArray< TestLibEntry > * test_libs_
Definition unit_test.cc:182

◆ BuildStackTrace()

static void dart::BuildStackTrace ( StackTraceBuilder builder)
static

Definition at line 101 of file exceptions.cc.

101 {
102 StackFrameIterator frames(ValidationPolicy::kDontValidateFrames,
103 Thread::Current(),
104 StackFrameIterator::kNoCrossThreadIteration);
105 StackFrame* frame = frames.NextFrame();
106 ASSERT(frame != nullptr); // We expect to find a dart invocation frame.
107 Code& code = Code::Handle();
108 for (; frame != nullptr; frame = frames.NextFrame()) {
109 if (!frame->IsDartFrame()) {
110 continue;
111 }
112 code = frame->LookupDartCode();
113 ASSERT(code.ContainsInstructionAt(frame->pc()));
114 const uword pc_offset = frame->pc() - code.PayloadStart();
115 builder->AddFrame(code, pc_offset);
116 }
117}

◆ BuildUri()

static char * dart::BuildUri ( const ParsedUri uri)
static

Definition at line 377 of file uri.cc.

377 {
378 Zone* zone = ThreadState::Current()->zone();
379 ASSERT(uri.path != nullptr);
380
381 const char* fragment = uri.fragment == nullptr ? "" : uri.fragment;
382 const char* fragment_separator = uri.fragment == nullptr ? "" : "#";
383 const char* query = uri.query == nullptr ? "" : uri.query;
384 const char* query_separator = uri.query == nullptr ? "" : "?";
385
386 // If there is no scheme for this uri, just build a relative uri of
387 // the form: "path[?query][#fragment]". This occurs when we resolve
388 // relative urls inside a "dart:" library.
389 if (uri.scheme == nullptr) {
390 ASSERT(uri.userinfo == nullptr && uri.host == nullptr &&
391 uri.port == nullptr);
392 return zone->PrintToString("%s%s%s%s%s", uri.path, query_separator, query,
393 fragment_separator, fragment);
394 }
395
396 // Uri with no authority: "scheme:path[?query][#fragment]"
397 if (uri.host == nullptr) {
398 ASSERT(uri.userinfo == nullptr && uri.port == nullptr);
399 return zone->PrintToString("%s:%s%s%s%s%s", uri.scheme, uri.path,
400 query_separator, query, fragment_separator,
401 fragment);
402 }
403
404 const char* user = uri.userinfo == nullptr ? "" : uri.userinfo;
405 const char* user_separator = uri.userinfo == nullptr ? "" : "@";
406 const char* port = uri.port == nullptr ? "" : uri.port;
407 const char* port_separator = uri.port == nullptr ? "" : ":";
408
409 // If the path doesn't start with a '/', add one. We need it to
410 // separate the path from the authority.
411 const char* path_separator =
412 ((uri.path[0] == '\0' || uri.path[0] == '/') ? "" : "/");
413
414 // Uri with authority:
415 // "scheme://[userinfo@]host[:port][/]path[?query][#fragment]"
416 return zone->PrintToString(
417 "%s://%s%s%s%s%s%s%s%s%s%s%s", // There is *nothing* wrong with this.
418 uri.scheme, user, user_separator, uri.host, port_separator, port,
419 path_separator, uri.path, query_separator, query, fragment_separator,
420 fragment);
421}
char * PrintToString(const char *format,...) PRINTF_ATTRIBUTE(2
Definition zone.cc:313
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 port
Definition switches.h:87
const char * query
Definition uri.h:19
const char * path
Definition uri.h:18
const char * userinfo
Definition uri.h:15
const char * scheme
Definition uri.h:14
const char * host
Definition uri.h:16
const char * port
Definition uri.h:17
const char * fragment
Definition uri.h:20

◆ ByteDataFinalizer()

void dart::ByteDataFinalizer ( void *  isolate_data,
void *  peer 
)

Definition at line 2330 of file dart_api_impl_test.cc.

2330 {
2331 ASSERT(!byte_data_finalizer_run);
2332 free(peer);
2334}
static bool byte_data_finalizer_run

◆ ByteDataNativeFunction()

static void dart::ByteDataNativeFunction ( Dart_NativeArguments  args)
static

Definition at line 2201 of file dart_api_impl_test.cc.

2201 {
2204 EXPECT_VALID(byte_data);
2206 Dart_SetReturnValue(args, byte_data);
2208}
DART_EXPORT void Dart_EnterScope(void)
DART_EXPORT void Dart_ExitScope(void)
@ Dart_TypedData_kByteData
Definition dart_api.h:2604
DART_EXPORT Dart_Handle Dart_NewTypedData(Dart_TypedData_Type type, intptr_t length)
DART_EXPORT void Dart_SetReturnValue(Dart_NativeArguments args, Dart_Handle retval)
DART_EXPORT Dart_TypedData_Type Dart_GetTypeOfTypedData(Dart_Handle object)

◆ ByteDataNativeResolver()

static Dart_NativeFunction dart::ByteDataNativeResolver ( Dart_Handle  name,
int  arg_count,
bool *  auto_setup_scope 
)
static

Definition at line 2210 of file dart_api_impl_test.cc.

2212 {
2213 ASSERT(auto_setup_scope != nullptr);
2214 *auto_setup_scope = true;
2215 return &ByteDataNativeFunction;
2216}
static void ByteDataNativeFunction(Dart_NativeArguments args)

◆ ByteRegisterOf()

ByteRegister dart::ByteRegisterOf ( Register  reg)
inline

Definition at line 50 of file constants_ia32.h.

50 {
51 // This only works for EAX, ECX, EDX, EBX.
52 // Remaining Register values map to high byte of the above registers.
53 RELEASE_ASSERT(reg == Register::EAX || reg == Register::ECX ||
54 reg == Register::EDX || reg == Register::EBX);
55 return static_cast<ByteRegister>(reg);
56}
#define RELEASE_ASSERT(cond)
Definition assert.h:327

◆ CacheRange()

static void dart::CacheRange ( Range **  slot,
const Range range,
RangeBoundary::RangeSize  size 
)
static

Definition at line 3018 of file range_analysis.cc.

3020 {
3021 if (range != nullptr) {
3022 if (*slot == nullptr) {
3023 *slot = new Range();
3024 }
3025 **slot = *range;
3026
3027 // Eliminate any symbolic dependencies from the range information.
3028 (*slot)->ClampToConstant(size);
3029 } else if (*slot != nullptr) {
3030 **slot = Range(); // Clear cached range information.
3031 }
3032}
void ClampToConstant(RangeBoundary::RangeSize size)

◆ CalculateTargetUnboxedFieldsBitmap()

static UnboxedFieldBitmap dart::CalculateTargetUnboxedFieldsBitmap ( Serializer s,
intptr_t  class_id 
)
static

Definition at line 952 of file app_snapshot.cc.

954 {
955 const auto unboxed_fields_bitmap_host =
956 s->isolate_group()->class_table()->GetUnboxedFieldsMapAt(class_id);
957
958 UnboxedFieldBitmap unboxed_fields_bitmap;
959 if (unboxed_fields_bitmap_host.IsEmpty() ||
960 kWordSize == compiler::target::kWordSize) {
961 unboxed_fields_bitmap = unboxed_fields_bitmap_host;
962 } else {
963 ASSERT(kWordSize == 8 && compiler::target::kWordSize == 4);
964 // A new bitmap is built if the word sizes in the target and
965 // host are different
966 unboxed_fields_bitmap.Reset();
967 intptr_t target_i = 0, host_i = 0;
968
969 while (host_i < UnboxedFieldBitmap::Length()) {
970 // Each unboxed field has constant length, therefore the number of
971 // words used by it should double when compiling from 64-bit to 32-bit.
972 if (unboxed_fields_bitmap_host.Get(host_i++)) {
973 unboxed_fields_bitmap.Set(target_i++);
974 unboxed_fields_bitmap.Set(target_i++);
975 } else {
976 // For object pointers, the field is always one word length
977 target_i++;
978 }
979 }
980 }
981
982 return unboxed_fields_bitmap;
983}
DART_FORCE_INLINE void Reset()
Definition class_table.h:65
DART_FORCE_INLINE void Set(intptr_t position)
Definition class_table.h:55

◆ CallbackNativeTypePointerParam()

DART_EXPORT void dart::CallbackNativeTypePointerParam ( void(*)(void *)  f)

Definition at line 1172 of file ffi_test_functions.cc.

1172 {
1173 void* pointer = malloc(sizeof(int64_t));
1174 f(pointer);
1175 free(pointer);
1176}

◆ CallbackNativeTypePointerReturn()

DART_EXPORT void dart::CallbackNativeTypePointerReturn ( void *(*)()  f)

Definition at line 1180 of file ffi_test_functions.cc.

1180 {
1181 void* p = f();
1182 uint8_t* p2 = reinterpret_cast<uint8_t*>(p);
1183 p2[0] = 42;
1184}

◆ CallbackWithStruct()

DART_EXPORT void dart::CallbackWithStruct ( void(*)(Struct8BytesNestedIntCopy f)

Definition at line 882 of file ffi_test_functions.cc.

882 {
883 std::cout << "CallbackWithStruct" << "(" << reinterpret_cast<void*>(f)
884 << ")\n";
885
887 arg.a0.a0 = 10;
888 arg.a0.a1 = 11;
889 arg.a1.a0 = 12;
890 arg.a1.a1 = 13;
891
892 f(arg);
893}
Struct4BytesHomogeneousInt16Copy a0

◆ CalleeParameterTypeMightBeMoreSpecific()

static bool dart::CalleeParameterTypeMightBeMoreSpecific ( BitVector is_generic_covariant_impl,
const FunctionType interface_target_signature,
const FunctionType callee_signature,
intptr_t  first_arg_index,
intptr_t  arg_index 
)
static

Definition at line 786 of file inliner.cc.

791 {
792 if (arg_index > first_arg_index && is_generic_covariant_impl != nullptr &&
793 is_generic_covariant_impl->Contains(arg_index - first_arg_index)) {
794 const intptr_t param_index = arg_index - first_arg_index;
795 const intptr_t num_named_params =
796 callee_signature.NumOptionalNamedParameters();
797 const intptr_t num_params = callee_signature.NumParameters();
798 if (num_named_params == 0 &&
799 param_index >= interface_target_signature.NumParameters()) {
800 // An optional positional parameter which was added in the callee but
801 // not present in the interface target.
802 return false;
803 }
804
805 // Check if this argument corresponds to a named parameter. In this case
806 // we need to find correct index based on the name.
807 intptr_t interface_target_param_index = param_index;
808 if (num_named_params > 0 &&
809 (num_params - num_named_params) <= param_index) {
810 // This is a named parameter.
811 const String& name =
812 String::Handle(callee_signature.ParameterNameAt(param_index));
813 interface_target_param_index = -1;
814 for (intptr_t i = interface_target_signature.NumParameters() -
815 interface_target_signature.NumOptionalNamedParameters(),
816 n = interface_target_signature.NumParameters();
817 i < n; i++) {
818 if (interface_target_signature.ParameterNameAt(i) == name.ptr()) {
819 interface_target_param_index = i;
820 break;
821 }
822 }
823
824 // This is a named parameter which was added in the callee.
825 if (interface_target_param_index == -1) {
826 return false;
827 }
828 }
829 const AbstractType& callee_parameter_type =
830 AbstractType::Handle(callee_signature.ParameterTypeAt(param_index));
831 const AbstractType& interface_target_parameter_type =
832 AbstractType::Handle(interface_target_signature.ParameterTypeAt(
833 interface_target_param_index));
834 if (interface_target_parameter_type.ptr() != callee_parameter_type.ptr()) {
835 // This a conservative approximation.
836 return true;
837 }
838 }
839 return false;
840}
bool Contains(intptr_t i) const
Definition bit_vector.h:91
intptr_t NumOptionalNamedParameters() const
Definition object.h:9621
AbstractTypePtr ParameterTypeAt(intptr_t index) const
Definition object.cc:8643
StringPtr ParameterNameAt(intptr_t index) const
Definition object.cc:8703
intptr_t NumParameters() const
Definition object.h:9628

◆ CallFunctionOnNewThreadBlocking()

DART_EXPORT void dart::CallFunctionOnNewThreadBlocking ( int64_t  response_id,
void(*)(int64_t, int32_t)  fn 
)

Definition at line 1294 of file ffi_test_functions.cc.

1295 {
1296 std::thread thread(fn, response_id, 123);
1297 thread.join();
1298}

◆ CallFunctionOnNewThreadNonBlocking()

DART_EXPORT void dart::CallFunctionOnNewThreadNonBlocking ( int64_t  response_id,
void(*)(int64_t, int32_t)  fn 
)

Definition at line 1300 of file ffi_test_functions.cc.

1302 {
1303 std::thread thread(fn, response_id, 123);
1304 thread.detach();
1305}

◆ CallFunctionOnSameThread()

DART_EXPORT void dart::CallFunctionOnSameThread ( int64_t  response_id,
void(*)(int64_t, int32_t)  fn 
)

Definition at line 1289 of file ffi_test_functions.cc.

1290 {
1291 fn(response_id, 123);
1292}

◆ Calloc()

DART_EXPORT void * dart::Calloc ( size_t  count,
size_t  size 
)

Definition at line 620 of file ffi_test_functions_vmspecific.cc.

620 {
621 return calloc(count, size);
622}
int count
void * calloc(size_t n, size_t size)
Definition allocation.cc:11

◆ calloc()

void * dart::calloc ( size_t  n,
size_t  size 
)

Definition at line 11 of file allocation.cc.

11 {
12 void* result = ::calloc(n, size);
13 if (result == nullptr) {
15 }
16 return result;
17}
#define OUT_OF_MEMORY()
Definition assert.h:250

◆ CallStatic1Arg()

static ObjectPtr dart::CallStatic1Arg ( Zone zone,
const String name,
const Instance arg0 
)
static

Definition at line 296 of file dart_api_impl.cc.

298 {
299 const intptr_t kNumArgs = 1;
300 const Function& function =
301 Function::Handle(zone, FindCoreLibPrivateFunction(zone, name));
302 const Array& args = Array::Handle(zone, Array::New(kNumArgs));
303 args.SetAt(0, arg0);
304 return DartEntry::InvokeFunction(function, args);
305}
static FunctionPtr FindCoreLibPrivateFunction(Zone *zone, const String &name)

◆ CallStatic2Args()

static ObjectPtr dart::CallStatic2Args ( Zone zone,
const String name,
const Instance arg0,
const Instance arg1 
)
static

Definition at line 307 of file dart_api_impl.cc.

310 {
311 const intptr_t kNumArgs = 2;
312 const Function& function =
313 Function::Handle(zone, FindCoreLibPrivateFunction(zone, name));
314 const Array& args = Array::Handle(zone, Array::New(kNumArgs));
315 args.SetAt(0, arg0);
316 args.SetAt(1, arg1);
317 return DartEntry::InvokeFunction(function, args);
318}

◆ CallStatic3Args()

static ObjectPtr dart::CallStatic3Args ( Zone zone,
const String name,
const Instance arg0,
const Instance arg1,
const Instance arg2 
)
static

Definition at line 320 of file dart_api_impl.cc.

324 {
325 const intptr_t kNumArgs = 3;
326 const Function& function =
327 Function::Handle(zone, FindCoreLibPrivateFunction(zone, name));
328 const Array& args = Array::Handle(Array::New(kNumArgs));
329 args.SetAt(0, arg0);
330 args.SetAt(1, arg1);
331 args.SetAt(2, arg2);
332 return DartEntry::InvokeFunction(function, args);
333}

◆ CallTwoIntFunction()

DART_EXPORT int32_t dart::CallTwoIntFunction ( int32_t(*)(int32_t, int32_t)  fn,
int32_t  a,
int32_t  b 
)

Definition at line 1310 of file ffi_test_functions.cc.

1312 {
1313 return fn(a, b);
1314}

◆ CallTwoIntPointerFunction()

DART_EXPORT void * dart::CallTwoIntPointerFunction ( void *(*)(int32_t, int32_t)  fn,
int32_t  a,
int32_t  b 
)

Definition at line 1322 of file ffi_test_functions.cc.

1324 {
1325 return fn(a, b);
1326}

◆ CallTwoIntVoidFunction()

DART_EXPORT void dart::CallTwoIntVoidFunction ( void(*)(int32_t, int32_t)  fn,
int32_t  a,
int32_t  b 
)

Definition at line 1316 of file ffi_test_functions.cc.

1318 {
1319 fn(a, b);
1320}

◆ CallTwoPointerIntFunction()

DART_EXPORT int32_t dart::CallTwoPointerIntFunction ( int32_t(*)(void *, void *)  fn,
void *  a,
void *  b 
)

Definition at line 1328 of file ffi_test_functions.cc.

1330 {
1331 return fn(a, b);
1332}

◆ CanBeMadeExclusive()

static bool dart::CanBeMadeExclusive ( LoopInfo loop,
InductionVar x,
Instruction branch,
bool  is_lower 
)
static

Definition at line 137 of file loops.cc.

140 {
141 InductionVar* min = nullptr;
142 InductionVar* max = nullptr;
143 if (x->CanComputeBounds(loop, branch, &min, &max)) {
144 int64_t end = 0;
145 if (is_lower) {
146 if (InductionVar::IsConstant(min, &end)) {
147 return kMinInt64 < end;
148 }
149 } else if (InductionVar::IsConstant(max, &end)) {
150 return end < kMaxInt64;
151 } else if (InductionVar::IsInvariant(max) && max->mult() == 1 &&
152 Definition::IsArrayLength(max->def())) {
153 return max->offset() < 0; // a.length - C, C > 0
154 }
155 }
156 return false;
157}
static bool is_lower(int c)
glong glong end
constexpr int64_t kMaxInt64
Definition globals.h:486
constexpr int64_t kMinInt64
Definition globals.h:485

◆ CanConvertInt64ToDouble() [1/2]

static bool dart::CanConvertInt64ToDouble ( )
static

Definition at line 1940 of file flow_graph.cc.

1940 {
1941 return FlowGraphCompiler::CanConvertInt64ToDouble();
1942}

◆ CanConvertInt64ToDouble() [2/2]

static bool dart::CanConvertInt64ToDouble ( )
static

Definition at line 37 of file call_specializer.cc.

37 {
38 return FlowGraphCompiler::CanConvertInt64ToDouble();
39}

◆ CanonicalFunction()

const char * dart::CanonicalFunction ( const char *  func)

Definition at line 108 of file dart_api_impl.cc.

108 {
109 if (strncmp(func, "dart::", 6) == 0) {
110 return func + 6;
111 } else {
112 return func;
113 }
114}

◆ CanonicalizeBoundary()

static RangeBoundary dart::CanonicalizeBoundary ( const RangeBoundary a,
const RangeBoundary overflow 
)
static

Definition at line 1844 of file range_analysis.cc.

1845 {
1846 if (a.IsConstant()) {
1847 return a;
1848 }
1849
1850 int64_t offset = a.offset();
1851 Definition* symbol = a.symbol();
1852
1853 bool changed;
1854 do {
1855 changed = false;
1856 if (symbol->IsConstraint()) {
1857 symbol = symbol->AsConstraint()->value()->definition();
1858 changed = true;
1859 } else if (symbol->IsBinarySmiOp()) {
1860 BinarySmiOpInstr* op = symbol->AsBinarySmiOp();
1861 Definition* left = op->left()->definition();
1862 Definition* right = op->right()->definition();
1863 switch (op->op_kind()) {
1864 case Token::kADD:
1865 if (right->IsConstant()) {
1866 int64_t rhs = Smi::Cast(right->AsConstant()->value()).Value();
1867 if (Utils::WillAddOverflow(offset, rhs)) {
1868 return overflow;
1869 }
1870 offset += rhs;
1871 symbol = left;
1872 changed = true;
1873 } else if (left->IsConstant()) {
1874 int64_t rhs = Smi::Cast(left->AsConstant()->value()).Value();
1875 if (Utils::WillAddOverflow(offset, rhs)) {
1876 return overflow;
1877 }
1878 offset += rhs;
1879 symbol = right;
1880 changed = true;
1881 }
1882 break;
1883
1884 case Token::kSUB:
1885 if (right->IsConstant()) {
1886 int64_t rhs = Smi::Cast(right->AsConstant()->value()).Value();
1887 if (Utils::WillSubOverflow(offset, rhs)) {
1888 return overflow;
1889 }
1890 offset -= rhs;
1891 symbol = left;
1892 changed = true;
1893 }
1894 break;
1895
1896 default:
1897 break;
1898 }
1899 }
1900 } while (changed);
1901
1902 if (!RangeBoundary::IsValidOffsetForSymbolicRangeBoundary(offset)) {
1903 return overflow;
1904 }
1905
1906 return RangeBoundary::FromDefinition(symbol, offset);
1907}
Point offset

◆ CanonicalizeCommutativeDoubleArithmetic()

static Definition * dart::CanonicalizeCommutativeDoubleArithmetic ( Token::Kind  op,
Value left,
Value right 
)
static

Definition at line 2145 of file il.cc.

2147 {
2148 int64_t left_value;
2149 if (!Evaluator::ToIntegerConstant(left, &left_value)) {
2150 return nullptr;
2151 }
2152
2153 // Can't apply 0.0 * x -> 0.0 equivalence to double operation because
2154 // 0.0 * NaN is NaN not 0.0.
2155 // Can't apply 0.0 + x -> x to double because 0.0 + (-0.0) is 0.0 not -0.0.
2156 switch (op) {
2157 case Token::kMUL:
2158 if (left_value == 1) {
2159 if (right->definition()->representation() != kUnboxedDouble) {
2160 // Can't yet apply the equivalence because representation selection
2161 // did not run yet. We need it to guarantee that right value is
2162 // correctly coerced to double. The second canonicalization pass
2163 // will apply this equivalence.
2164 return nullptr;
2165 } else {
2166 return right->definition();
2167 }
2168 }
2169 break;
2170 default:
2171 break;
2172 }
2173
2174 return nullptr;
2175}

◆ CanonicalizeForComparison()

static bool dart::CanonicalizeForComparison ( RangeBoundary a,
RangeBoundary b,
BoundaryOp  op,
const RangeBoundary overflow 
)
static

Definition at line 1961 of file range_analysis.cc.

1964 {
1965 if (!a->IsSymbol() || !b->IsSymbol()) {
1966 return false;
1967 }
1968
1969 RangeBoundary canonical_a = *a;
1970 RangeBoundary canonical_b = *b;
1971
1972 do {
1973 if (DependOnSameSymbol(canonical_a, canonical_b)) {
1974 *a = canonical_a;
1975 *b = canonical_b;
1976 return true;
1977 }
1978 } while (op(&canonical_a) || op(&canonical_b));
1979
1980 return false;
1981}

◆ CanonicalizeMaxBoundary()

static bool dart::CanonicalizeMaxBoundary ( RangeBoundary a)
static

Definition at line 1909 of file range_analysis.cc.

1909 {
1910 if (!a->IsSymbol()) return false;
1911
1912 Range* range = a->symbol()->range();
1913 if ((range == nullptr) || !range->max().IsSymbol()) return false;
1914
1915 if (Utils::WillAddOverflow(range->max().offset(), a->offset())) {
1916 *a = RangeBoundary::MaxConstant(RangeBoundary::kRangeBoundaryInt64);
1917 return true;
1918 }
1919
1920 const int64_t offset = range->max().offset() + a->offset();
1921
1922 if (!RangeBoundary::IsValidOffsetForSymbolicRangeBoundary(offset)) {
1923 *a = RangeBoundary::MaxConstant(RangeBoundary::kRangeBoundaryInt64);
1924 return true;
1925 }
1926
1928 RangeBoundary::FromDefinition(range->max().symbol(), offset),
1929 RangeBoundary::MaxConstant(RangeBoundary::kRangeBoundaryInt64));
1930
1931 return true;
1932}
int64_t offset() const
Definition * symbol() const
const RangeBoundary & max() const
static RangeBoundary CanonicalizeBoundary(const RangeBoundary &a, const RangeBoundary &overflow)

◆ CanonicalizeMinBoundary()

static bool dart::CanonicalizeMinBoundary ( RangeBoundary a)
static

Definition at line 1934 of file range_analysis.cc.

1934 {
1935 if (!a->IsSymbol()) return false;
1936
1937 Range* range = a->symbol()->range();
1938 if ((range == nullptr) || !range->min().IsSymbol()) return false;
1939
1940 if (Utils::WillAddOverflow(range->min().offset(), a->offset())) {
1941 *a = RangeBoundary::MinConstant(RangeBoundary::kRangeBoundaryInt64);
1942 return true;
1943 }
1944
1945 const int64_t offset = range->min().offset() + a->offset();
1946
1947 if (!RangeBoundary::IsValidOffsetForSymbolicRangeBoundary(offset)) {
1948 *a = RangeBoundary::MinConstant(RangeBoundary::kRangeBoundaryInt64);
1949 return true;
1950 }
1951
1953 RangeBoundary::FromDefinition(range->min().symbol(), offset),
1954 RangeBoundary::MinConstant(RangeBoundary::kRangeBoundaryInt64));
1955
1956 return true;
1957}
const RangeBoundary & min() const

◆ CanonicalizeStrictCompare()

static Definition * dart::CanonicalizeStrictCompare ( StrictCompareInstr compare,
bool *  negated,
bool  is_branch 
)
static

Definition at line 3553 of file il.cc.

3555 {
3556 // Use propagated cid and type information to eliminate number checks.
3557 // If one of the inputs is not a boxable number (Mint, Double), or
3558 // is not a subtype of num, no need for number checks.
3559 if (compare->needs_number_check()) {
3560 if (!MayBeBoxableNumber(compare->left()->Type()->ToCid()) ||
3561 !MayBeBoxableNumber(compare->right()->Type()->ToCid())) {
3562 compare->set_needs_number_check(false);
3563 } else if (!MayBeNumber(compare->left()->Type()) ||
3564 !MayBeNumber(compare->right()->Type())) {
3565 compare->set_needs_number_check(false);
3566 }
3567 }
3568 *negated = false;
3569 ConstantInstr* constant_defn = nullptr;
3570 Value* other = nullptr;
3571
3572 if (!compare->IsComparisonWithConstant(&other, &constant_defn)) {
3573 return compare;
3574 }
3575
3576 const Object& constant = constant_defn->value();
3577 const bool can_merge = is_branch || (other->Type()->ToCid() == kBoolCid);
3578 Definition* other_defn = other->definition();
3579 Token::Kind kind = compare->kind();
3580
3581 if (!constant.IsBool() || !can_merge) {
3582 return compare;
3583 }
3584
3585 const bool constant_value = Bool::Cast(constant).value();
3586
3587 // Handle `e === true` and `e !== false`: these cases don't require
3588 // negation and allow direct merge.
3589 if ((kind == Token::kEQ_STRICT) == constant_value) {
3590 return other_defn;
3591 }
3592
3593 // We now have `e !== true` or `e === false`: these cases require
3594 // negation.
3595 if (auto comp = other_defn->AsComparison()) {
3596 if (other_defn->HasOnlyUse(other) && !IsFpCompare(comp)) {
3597 *negated = true;
3598 return other_defn;
3599 }
3600 }
3601
3602 return compare;
3603}
static bool compare(const SkBitmap &ref, const SkIRect &iref, const SkBitmap &test, const SkIRect &itest)
Definition BlurTest.cpp:100
static bool MayBeBoxableNumber(intptr_t cid)
Definition il.cc:3534
static bool IsFpCompare(ComparisonInstr *comp)
Definition il.cc:3513

◆ CanonicalizeStringInterpolate()

static Definition * dart::CanonicalizeStringInterpolate ( StaticCallInstr call,
FlowGraph flow_graph 
)
static

Definition at line 5711 of file il.cc.

5712 {
5713 auto arg0 = call->ArgumentValueAt(0)->definition();
5714 auto create_array = arg0->AsCreateArray();
5715 if (create_array == nullptr) {
5716 // Do not try to fold interpolate if array is an OSR argument.
5717 ASSERT(flow_graph->IsCompiledForOsr());
5718 ASSERT(arg0->IsPhi() || arg0->IsParameter());
5719 return call;
5720 }
5721 // Check if the string interpolation has only constant inputs.
5722 Value* num_elements = create_array->num_elements();
5723 if (!num_elements->BindsToConstant() ||
5724 !num_elements->BoundConstant().IsSmi()) {
5725 return call;
5726 }
5727 const intptr_t length = Smi::Cast(num_elements->BoundConstant()).Value();
5728 Thread* thread = Thread::Current();
5729 Zone* zone = thread->zone();
5730 GrowableHandlePtrArray<const String> pieces(zone, length);
5731 for (intptr_t i = 0; i < length; i++) {
5732 pieces.Add(Object::null_string());
5733 }
5734
5735 for (Value::Iterator it(create_array->input_use_list()); !it.Done();
5736 it.Advance()) {
5737 auto current = it.Current()->instruction();
5738 if (current == call) {
5739 continue;
5740 }
5741 auto store = current->AsStoreIndexed();
5742 if (store == nullptr || !store->index()->BindsToConstant() ||
5743 !store->index()->BoundConstant().IsSmi()) {
5744 return call;
5745 }
5746 intptr_t store_index = Smi::Cast(store->index()->BoundConstant()).Value();
5747 ASSERT(store_index < length);
5748 const String& piece =
5749 EvaluateToString(flow_graph->zone(), store->value()->definition());
5750 if (!piece.IsNull()) {
5751 pieces.SetAt(store_index, piece);
5752 } else {
5753 return call;
5754 }
5755 }
5756
5757 const String& concatenated =
5758 String::ZoneHandle(zone, Symbols::FromConcatAll(thread, pieces));
5759 return flow_graph->GetConstant(concatenated);
5760}
SI void store(P *ptr, const T &val)
ConstantInstr * GetConstant(const Object &object, Representation representation=kTagged)
bool IsCompiledForOsr() const
Definition flow_graph.h:460
Zone * zone() const
Definition flow_graph.h:261
size_t length
static const String & EvaluateToString(Zone *zone, Definition *defn)
Definition il.cc:5694
call(args)
Definition dom.py:159

◆ CanonicalizeStringInterpolateSingle()

static Definition * dart::CanonicalizeStringInterpolateSingle ( StaticCallInstr call,
FlowGraph flow_graph 
)
static

Definition at line 5762 of file il.cc.

5763 {
5764 auto arg0 = call->ArgumentValueAt(0)->definition();
5765 const auto& result = EvaluateToString(flow_graph->zone(), arg0);
5766 if (!result.IsNull()) {
5767 return flow_graph->GetConstant(String::ZoneHandle(
5768 flow_graph->zone(), Symbols::New(flow_graph->thread(), result)));
5769 }
5770 return call;
5771}
Thread * thread() const
Definition flow_graph.h:260

◆ CanonicalizeTAV()

static void dart::CanonicalizeTAV ( TypeArguments tav)
static

Definition at line 195 of file type_testing_stubs_test.cc.

195 {
196 *tav = tav->Canonicalize(Thread::Current());
197}
TypeArgumentsPtr Canonicalize(Thread *thread) const
Definition object.cc:7761

◆ CanonicalizeUri()

static const char * dart::CanonicalizeUri ( Thread thread,
const Library library,
const String uri,
char **  error 
)
static

Definition at line 921 of file isolate.cc.

924 {
925 const char* result = nullptr;
926 Zone* zone = thread->zone();
927 auto isolate_group = thread->isolate_group();
928 if (isolate_group->HasTagHandler()) {
929 const Object& obj = Object::Handle(
930 isolate_group->CallTagHandler(Dart_kCanonicalizeUrl, library, uri));
931 if (obj.IsString()) {
932 result = String2UTF8(String::Cast(obj));
933 } else if (obj.IsError()) {
934 Error& error_obj = Error::Handle();
935 error_obj ^= obj.ptr();
936 *error = zone->PrintToString("Unable to canonicalize uri '%s': %s",
937 uri.ToCString(), error_obj.ToErrorCString());
938 } else {
939 *error = zone->PrintToString(
940 "Unable to canonicalize uri '%s': "
941 "library tag handler returned wrong type",
942 uri.ToCString());
943 }
944 } else {
945 *error = zone->PrintToString(
946 "Unable to canonicalize uri '%s': no library tag handler found.",
947 uri.ToCString());
948 }
949 return result;
950}
@ Dart_kCanonicalizeUrl
Definition dart_api.h:3340
static const char * String2UTF8(const String &str)
Definition isolate.cc:857

◆ CanPotentiallyBeSmi()

static bool dart::CanPotentiallyBeSmi ( const AbstractType type,
bool  recurse 
)
static

Definition at line 946 of file type_propagator.cc.

946 {
947 if (type.IsInstantiated()) {
948 return CompileType::Smi().IsAssignableTo(type);
949 } else if (type.IsTypeParameter()) {
950 // For type parameters look at their bounds (if recurse allows us).
951 const auto& param = TypeParameter::Cast(type);
952 return !recurse || CanPotentiallyBeSmi(AbstractType::Handle(param.bound()),
953 /*recurse=*/false);
954 } else if (type.HasTypeClass()) {
955 // If this is an uninstantiated type then it can only potentially be a super
956 // type of a Smi if it is either FutureOr<...> or Comparable<...>.
957 // In which case we need to look at the type argument to determine whether
958 // this location can contain a smi.
959 //
960 // Note: we are making a simplification here. This approach will yield
961 // true for Comparable<T> where T extends int - while in reality Smi is
962 // *not* assignable to it (because int implements Comparable<num> and not
963 // Comparable<int>).
964 if (type.IsFutureOrType() ||
965 type.type_class() == CompilerState::Current().ComparableClass().ptr()) {
966 const auto& args = TypeArguments::Handle(type.arguments());
967 const auto& arg0 = AbstractType::Handle(args.TypeAt(0));
968 return !recurse || CanPotentiallyBeSmi(arg0, /*recurse=*/true);
969 }
970 return false;
971 }
972 return false;
973}
static bool CanPotentiallyBeSmi(const AbstractType &type, bool recurse)

◆ CanRewindFrame()

static bool dart::CanRewindFrame ( intptr_t  frame_index,
const char **  error 
)
static

Definition at line 3192 of file debugger.cc.

3192 {
3193 // check rewind pc is found
3194 DebuggerStackTrace* stack = Isolate::Current()->debugger()->StackTrace();
3195 intptr_t num_frames = stack->Length();
3196 if (frame_index < 1 || frame_index >= num_frames) {
3197 if (error != nullptr) {
3198 *error = Thread::Current()->zone()->PrintToString(
3199 "Frame must be in bounds [1..%" Pd
3200 "]: "
3201 "saw %" Pd "",
3202 num_frames - 1, frame_index);
3203 }
3204 return false;
3205 }
3206 ActivationFrame* frame = stack->FrameAt(frame_index);
3207 if (!frame->IsRewindable()) {
3208 intptr_t next_index = FindNextRewindFrameIndex(stack, frame_index);
3209 if (next_index > 0) {
3210 *error = Thread::Current()->zone()->PrintToString(
3211 "Cannot rewind to frame %" Pd
3212 " due to conflicting compiler "
3213 "optimizations. "
3214 "Run the vm with --no-prune-dead-locals to disallow these "
3215 "optimizations. "
3216 "Next valid rewind frame is %" Pd ".",
3217 frame_index, next_index);
3218 } else {
3219 *error = Thread::Current()->zone()->PrintToString(
3220 "Cannot rewind to frame %" Pd
3221 " due to conflicting compiler "
3222 "optimizations. "
3223 "Run the vm with --no-prune-dead-locals to disallow these "
3224 "optimizations.",
3225 frame_index);
3226 }
3227 return false;
3228 }
3229 return true;
3230}
intptr_t Length() const
Definition debugger.h:463
ActivationFrame * FrameAt(int i) const
Definition debugger.h:465
static intptr_t FindNextRewindFrameIndex(DebuggerStackTrace *stack, intptr_t frame_index)
Definition debugger.cc:3180
#define Pd
Definition globals.h:408

◆ CanShareObject()

static DART_FORCE_INLINE bool dart::CanShareObject ( ObjectPtr  obj,
uword  tags 
)
static

Definition at line 149 of file object_graph_copy.cc.

149 {
150 if ((tags & UntaggedObject::CanonicalBit::mask_in_place()) != 0) {
151 return true;
152 }
153 const auto cid = UntaggedObject::ClassIdTag::decode(tags);
154 if ((tags & UntaggedObject::ImmutableBit::mask_in_place()) != 0) {
155 if (IsUnmodifiableTypedDataViewClassId(cid)) {
156 // Unmodifiable typed data views may have mutable backing stores.
157 return TypedDataView::RawCast(obj)
158 ->untag()
159 ->typed_data()
160 ->untag()
161 ->IsImmutable();
162 }
163
164 // All other objects that have immutability bit set are deeply immutable.
165 return true;
166 }
167
168 // TODO(https://dartbug.com/55136): Mark Closures as shallowly imutable.
169 // And move this into the if above.
170 if (cid == kClosureCid) {
171 // We can share a closure iff it doesn't close over any state.
172 return Closure::RawCast(obj)->untag()->context() == Object::null();
173 }
174
175 return false;
176}

◆ CanShareObjectAcrossIsolates()

bool dart::CanShareObjectAcrossIsolates ( ObjectPtr  obj)

Definition at line 178 of file object_graph_copy.cc.

178 {
179 if (!obj->IsHeapObject()) return true;
180 const uword tags = TagsFromUntaggedObject(obj.untag());
181 return CanShareObject(obj, tags);
182}
UntaggedObject * untag() const
static DART_FORCE_INLINE bool CanShareObject(ObjectPtr obj, uword tags)
DART_FORCE_INLINE uword TagsFromUntaggedObject(UntaggedObject *obj)

◆ CanTypeContainNull()

static bool dart::CanTypeContainNull ( const Type type)
static

Definition at line 3088 of file dart_api_impl.cc.

3088 {
3089 return (type.nullability() == Nullability::kLegacy) ||
3090 (type.nullability() == Nullability::kNullable);
3091}

◆ CanUnboxDouble() [1/2]

static bool dart::CanUnboxDouble ( )
static

Definition at line 1936 of file flow_graph.cc.

1936 {
1937 return FlowGraphCompiler::SupportsUnboxedDoubles();
1938}

◆ CanUnboxDouble() [2/2]

static bool dart::CanUnboxDouble ( )
static

Definition at line 33 of file call_specializer.cc.

33 {
34 return FlowGraphCompiler::SupportsUnboxedDoubles();
35}

◆ CanUseCache()

static bool dart::CanUseCache ( uword  flags)
static

Definition at line 56 of file page.cc.

56 {
57 return (flags & (Page::kExecutable | Page::kImage | Page::kLarge |
58 Page::kVMIsolate)) == 0;
59}
FlutterSemanticsFlag flags

◆ CaseInsensitiveCompareUCS2()

uword dart::CaseInsensitiveCompareUCS2 ( uword  str_raw,
uword  lhs_index_raw,
uword  rhs_index_raw,
uword  length_raw 
)

Definition at line 25 of file regexp_assembler.cc.

28 {
29 const String& str = String::Handle(static_cast<StringPtr>(str_raw));
30 const Smi& lhs_index = Smi::Handle(static_cast<SmiPtr>(lhs_index_raw));
31 const Smi& rhs_index = Smi::Handle(static_cast<SmiPtr>(rhs_index_raw));
32 const Smi& length = Smi::Handle(static_cast<SmiPtr>(length_raw));
33
34 // TODO(zerny): Optimize as single instance. V8 has this as an
35 // isolate member.
37
38 for (intptr_t i = 0; i < length.Value(); i++) {
39 int32_t c1 = str.CharAt(lhs_index.Value() + i);
40 int32_t c2 = str.CharAt(rhs_index.Value() + i);
41 if (c1 != c2) {
42 int32_t s1[1] = {c1};
43 canonicalize.get(c1, '\0', s1);
44 if (s1[0] != c2) {
45 int32_t s2[1] = {c2};
46 canonicalize.get(c2, '\0', s2);
47 if (s1[0] != s2[0]) {
48 return static_cast<uword>(Bool::False().ptr());
49 }
50 }
51 }
52 }
53 return static_cast<uword>(Bool::True().ptr());
54}
intptr_t Value() const
Definition object.h:9969
intptr_t get(int32_t c, int32_t n, int32_t *result)
Definition unibrow-inl.h:15

◆ CaseInsensitiveCompareUTF16()

uword dart::CaseInsensitiveCompareUTF16 ( uword  str_raw,
uword  lhs_index_raw,
uword  rhs_index_raw,
uword  length_raw 
)

Definition at line 56 of file regexp_assembler.cc.

59 {
60 const String& str = String::Handle(static_cast<StringPtr>(str_raw));
61 const Smi& lhs_index = Smi::Handle(static_cast<SmiPtr>(lhs_index_raw));
62 const Smi& rhs_index = Smi::Handle(static_cast<SmiPtr>(rhs_index_raw));
63 const Smi& length = Smi::Handle(static_cast<SmiPtr>(length_raw));
64
65 for (intptr_t i = 0; i < length.Value(); i++) {
66 int32_t c1 = str.CharAt(lhs_index.Value() + i);
67 int32_t c2 = str.CharAt(rhs_index.Value() + i);
68 if (Utf16::IsLeadSurrogate(c1)) {
69 // Non-BMP characters do not have case-equivalents in the BMP.
70 // Both have to be non-BMP for them to be able to match.
71 if (!Utf16::IsLeadSurrogate(c2))
72 return static_cast<uword>(Bool::False().ptr());
73 if (i + 1 < length.Value()) {
74 uint16_t c1t = str.CharAt(lhs_index.Value() + i + 1);
75 uint16_t c2t = str.CharAt(rhs_index.Value() + i + 1);
76 if (Utf16::IsTrailSurrogate(c1t) && Utf16::IsTrailSurrogate(c2t)) {
77 c1 = Utf16::Decode(c1, c1t);
78 c2 = Utf16::Decode(c2, c2t);
79 i++;
80 }
81 }
82 }
83 c1 = u_foldCase(c1, U_FOLD_CASE_DEFAULT);
84 c2 = u_foldCase(c2, U_FOLD_CASE_DEFAULT);
85 if (c1 != c2) return static_cast<uword>(Bool::False().ptr());
86 }
87 return static_cast<uword>(Bool::True().ptr());
88}

◆ CharacterLimit()

static uint16_t dart::CharacterLimit ( const String string,
intptr_t  start,
intptr_t  end 
)
static

Definition at line 104 of file string.cc.

106 {
107 ASSERT(string.IsTwoByteString());
108 // Maybe do loop unrolling, and handle two uint16_t in a single uint32_t
109 // operation.
110 NoSafepointScope no_safepoint;
111 uint16_t result = 0;
112 for (intptr_t i = start; i < end; i++) {
113 result |= TwoByteString::CharAt(string, i);
114 }
115 return result;
116}

◆ CheckConcatAll()

static void dart::CheckConcatAll ( const String data[],
intptr_t  n 
)
static

Definition at line 7293 of file object_test.cc.

7297 {
7298 constValue().contains(null);
7299}
7300)";
7301 HashSetNonConstEqualsConst(kScript);
7302}
7303
7304static void CheckConcatAll(const String* data[], intptr_t n) {
7305 Thread* thread = Thread::Current();
7306 Zone* zone = thread->zone();

◆ CheckDebuggerDisabled()

static bool dart::CheckDebuggerDisabled ( Thread thread,
JSONStream js 
)
static

Definition at line 512 of file service.cc.

512 {
513#if defined(DART_PRECOMPILED_RUNTIME)
514 js->PrintError(kFeatureDisabled, "Debugger is disabled in AOT mode.");
515 return true;
516#else
517 if (thread->isolate()->debugger() == nullptr) {
518 js->PrintError(kFeatureDisabled, "Debugger is disabled.");
519 return true;
520 }
521 return false;
522#endif
523}

◆ CheckEncodeDecodeMessage()

static void dart::CheckEncodeDecodeMessage ( Zone zone,
Dart_CObject root 
)
static

Definition at line 108 of file snapshot_test.cc.

108 {
109 // Encode and decode the message.
110 std::unique_ptr<Message> message =
111 WriteApiMessage(zone, root, ILLEGAL_PORT, Message::kNormalPriority);
112
113 Dart_CObject* new_root = ReadApiMessage(zone, message.get());
114
115 // Check that the two messages are the same.
116 CompareDartCObjects(root, new_root);
117}
static void CompareDartCObjects(Dart_CObject *first, Dart_CObject *second)
Dart_CObject * ReadApiMessage(Zone *zone, Message *message)
std::unique_ptr< Message > WriteApiMessage(Zone *zone, Dart_CObject *obj, Dart_Port dest_port, Message::Priority priority)

◆ CheckFloat32x4Data()

static void dart::CheckFloat32x4Data ( Dart_Handle  obj)
static

Definition at line 3232 of file dart_api_impl_test.cc.

3232 {
3233 void* raw_data = nullptr;
3234 intptr_t len;
3236 EXPECT_VALID(Dart_TypedDataAcquireData(obj, &type, &raw_data, &len));
3237 EXPECT_EQ(Dart_TypedData_kFloat32x4, type);
3238 EXPECT_EQ(len, 10);
3239 float* float_data = reinterpret_cast<float*>(raw_data);
3240 for (int i = 0; i < len * 4; i++) {
3241 EXPECT_EQ(0.0, float_data[i]);
3242 }
3244}
DART_EXPORT Dart_Handle Dart_TypedDataReleaseData(Dart_Handle object)
DART_EXPORT Dart_Handle Dart_TypedDataAcquireData(Dart_Handle object, Dart_TypedData_Type *type, void **data, intptr_t *len)
Dart_TypedData_Type
Definition dart_api.h:2603
@ Dart_TypedData_kFloat32x4
Definition dart_api.h:2617

◆ CheckInteger()

static bool dart::CheckInteger ( const Integer i)
static

Definition at line 24 of file integers.cc.

24 {
25 if (i.IsMint()) {
26 const Mint& mint = Mint::Cast(i);
27 return !Smi::IsValid(mint.value());
28 }
29 return true;
30}
int64_t value() const
Definition object.h:10052

◆ CheckIsAtLeastMinRequiredMacOSVersion()

char * dart::CheckIsAtLeastMinRequiredMacOSVersion ( )

◆ CheckIsolate()

static bool dart::CheckIsolate ( Isolate isolate)
static

Definition at line 1257 of file profiler.cc.

1257 {
1258 if ((isolate == nullptr) || (Dart::vm_isolate() == nullptr)) {
1259 // No isolate.
1260 return false;
1261 }
1262 return isolate != Dart::vm_isolate();
1263}

◆ CheckMask()

static bool dart::CheckMask ( Definition definition,
intptr_t *  mask_ptr 
)
static

Definition at line 2329 of file call_specializer.cc.

2329 {
2330 if (!definition->IsConstant()) return false;
2331 ConstantInstr* constant_instruction = definition->AsConstant();
2332 const Object& constant_mask = constant_instruction->value();
2333 if (!constant_mask.IsSmi()) return false;
2334 const intptr_t mask = Smi::Cast(constant_mask).Value();
2335 if ((mask < 0) || (mask > 255)) {
2336 return false; // Not a valid mask.
2337 }
2338 *mask_ptr = mask;
2339 return true;
2340}
const Object & value() const
Definition il.h:4212

◆ CheckMemory()

static bool dart::CheckMemory ( Expect  expect,
const uint8_t *  input,
const uint8_t *  output,
intptr_t  dest_start,
intptr_t  src_start,
intptr_t  length,
intptr_t  elem_size 
)
static

Definition at line 58 of file memory_copy_test.cc.

64 {
65 ASSERT(Utils::IsPowerOfTwo(kMemoryTestLength));
66 expect.LessThan<intptr_t>(0, elem_size);
67 if (!Utils::IsPowerOfTwo(elem_size)) {
68 expect.Fail("Expected %" Pd " to be a power of two", elem_size);
69 }
70 expect.LessEqual<intptr_t>(0, length);
71 expect.LessEqual<intptr_t>(0, dest_start);
72 expect.LessEqual<intptr_t>(dest_start + length,
73 kMemoryTestLength / elem_size);
74 expect.LessEqual<intptr_t>(0, src_start);
75 expect.LessEqual<intptr_t>(src_start + length, kMemoryTestLength / elem_size);
76 const bool use_same_buffer = input == output;
77 const intptr_t dest_start_in_bytes = dest_start * elem_size;
78 const intptr_t dest_end_in_bytes = dest_start_in_bytes + length * elem_size;
79 const intptr_t index_diff = dest_start_in_bytes - src_start * elem_size;
80 for (intptr_t i = 0; i < kMemoryTestLength; i++) {
81 if (!use_same_buffer) {
82 const intptr_t expected = ExpectedValue(i);
83 const intptr_t got = input[i];
84 if (expected != got) {
85 expect.Fail("Unexpected change to input buffer at index %" Pd
86 ", expected %" Pd ", got %" Pd "",
87 i, expected, got);
88 }
89 }
90 const intptr_t unchanged =
91 use_same_buffer ? ExpectedValue(i) : kUnInitialized;
92 const intptr_t got = output[i];
93 if (dest_start_in_bytes <= i && i < dest_end_in_bytes) {
94 // Copied.
95 const intptr_t expected = ExpectedValue(i - index_diff);
96 if (expected != got) {
97 if (got == unchanged) {
98 expect.Fail("No change to output buffer at index %" Pd
99 ", expected %" Pd ", got %" Pd "",
100 i, expected, got);
101 } else {
102 expect.Fail("Incorrect change to output buffer at index %" Pd
103 ", expected %" Pd ", got %" Pd "",
104 i, expected, got);
105 }
106 }
107 } else {
108 // Untouched.
109 if (got != unchanged) {
110 expect.Fail("Unexpected change to input buffer at index %" Pd
111 ", expected %" Pd ", got %" Pd "",
112 i, unchanged, got);
113 }
114 }
115 }
116 return expect.failed();
117}
void static bool failed()
Definition assert.h:94
static constexpr uint8_t kUnInitialized
static intptr_t ExpectedValue(intptr_t i)

◆ CheckMint()

void dart::CheckMint ( int64_t  value)

Definition at line 213 of file snapshot_test.cc.

213 {
214 ApiNativeScope scope;
215 StackZone zone(Thread::Current());
216
217 Mint& mint = Mint::Handle();
218 mint ^= Integer::New(value);
219 Dart_CObject* mint_cobject =
220 SerializeAndDeserializeMint(zone.GetZone(), mint);
221// On 64-bit platforms mints always require 64-bits as the smi range
222// here covers most of the 64-bit range. On 32-bit platforms the smi
223// range covers most of the 32-bit range and values outside that
224// range are also represented as mints.
225#if defined(ARCH_IS_64_BIT) && !defined(DART_COMPRESSED_POINTERS)
226 EXPECT_EQ(Dart_CObject_kInt64, mint_cobject->type);
227 EXPECT_EQ(value, mint_cobject->value.as_int64);
228#else
229 if (kMinInt32 < value && value < kMaxInt32) {
230 EXPECT_EQ(Dart_CObject_kInt32, mint_cobject->type);
231 EXPECT_EQ(value, mint_cobject->value.as_int32);
232 } else {
233 EXPECT_EQ(Dart_CObject_kInt64, mint_cobject->type);
234 EXPECT_EQ(value, mint_cobject->value.as_int64);
235 }
236#endif
237}
@ Dart_CObject_kInt64
@ Dart_CObject_kInt32
Dart_CObject * SerializeAndDeserializeMint(Zone *zone, const Mint &mint)

◆ CheckProfilerDisabled()

static bool dart::CheckProfilerDisabled ( Thread thread,
JSONStream js 
)
static

Definition at line 525 of file service.cc.

525 {
526 if (!FLAG_profiler) {
527 js->PrintError(kFeatureDisabled, "Profiler is disabled.");
528 return true;
529 }
530 return false;
531}

◆ CheckSlicesOneByte()

static bool dart::CheckSlicesOneByte ( const String base,
const Array matches,
const int  len 
)
static

Definition at line 121 of file string.cc.

123 {
124 Instance& object = Instance::Handle();
125 // Check each slice for one-bytedness.
126 for (intptr_t i = 0; i < len; i++) {
127 object ^= matches.At(i);
128 if (object.IsSmi()) {
129 intptr_t slice_start = Smi::Cast(object).Value();
130 intptr_t slice_end;
131 if (slice_start < 0) {
132 intptr_t bits = -slice_start;
133 slice_start = bits >> kLengthSize;
134 slice_end = slice_start + (bits & kLengthMask);
135 } else {
136 i++;
137 if (i >= len) {
138 // Bad format, handled later.
139 return false;
140 }
141 object ^= matches.At(i);
142 if (!object.IsSmi()) {
143 // Bad format, handled later.
144 return false;
145 }
146 slice_end = Smi::Cast(object).Value();
147 }
148 uint16_t char_limit = CharacterLimit(base, slice_start, slice_end);
149 if (char_limit > 0xff) {
150 return false;
151 }
152 }
153 }
154 return true;
155}
bool IsSmi(int64_t v)
static constexpr intptr_t kLengthSize
Definition string.cc:118
static uint16_t CharacterLimit(const String &string, intptr_t start, intptr_t end)
Definition string.cc:104
static constexpr intptr_t kLengthMask
Definition string.cc:119

◆ CheckString()

static void dart::CheckString ( Dart_Handle  dart_string,
const char *  expected 
)
static

Definition at line 812 of file snapshot_test.cc.

812 {
813 StackZone zone(Thread::Current());
814 String& str = String::Handle();
815 str ^= Api::UnwrapHandle(dart_string);
816 std::unique_ptr<Message> message = WriteMessage(
817 /* same_group */ false, str, ILLEGAL_PORT, Message::kNormalPriority);
818
819 // Read object back from the snapshot into a C structure.
820 ApiNativeScope scope;
821 Dart_CObject* root = ReadApiMessage(zone.GetZone(), message.get());
822 EXPECT_NOTNULL(root);
823 EXPECT_EQ(Dart_CObject_kString, root->type);
824 EXPECT_STREQ(expected, root->value.as_string);
825 CheckEncodeDecodeMessage(zone.GetZone(), root);
826}
static void CheckEncodeDecodeMessage(Zone *zone, Dart_CObject *root)

◆ CheckStringInvalid()

static void dart::CheckStringInvalid ( Dart_Handle  dart_string)
static

Definition at line 828 of file snapshot_test.cc.

828 {
829 StackZone zone(Thread::Current());
830 String& str = String::Handle();
831 str ^= Api::UnwrapHandle(dart_string);
832 std::unique_ptr<Message> message = WriteMessage(
833 /* same_group */ false, str, ILLEGAL_PORT, Message::kNormalPriority);
834
835 // Read object back from the snapshot into a C structure.
836 ApiNativeScope scope;
837 Dart_CObject* root = ReadApiMessage(zone.GetZone(), message.get());
838 EXPECT_NOTNULL(root);
839 EXPECT_EQ(Dart_CObject_kUnsupported, root->type);
840}
@ Dart_CObject_kUnsupported

◆ CheckSubtypeRelation()

static void dart::CheckSubtypeRelation ( const Expect expect,
const AbstractType sub,
const AbstractType super,
bool  is_subtype 
)
static

Definition at line 7403 of file object_test.cc.

7409 {
7410 *type ^= ClassFinalizer::FinalizeType(*type);
7411 ASSERT(type->IsCanonical());
7412}
7413
7414static void CheckSubtypeRelation(const Expect& expect,
7415 const AbstractType& sub,

◆ CheckTypedData()

static void dart::CheckTypedData ( Dart_CObject object,
Dart_TypedData_Type  typed_data_type,
int  len 
)
static

Definition at line 1686 of file snapshot_test.cc.

1688 {
1689 EXPECT_EQ(Dart_CObject_kTypedData, object->type);
1690 EXPECT_EQ(typed_data_type, object->value.as_typed_data.type);
1691 EXPECT_EQ(len, object->value.as_typed_data.length);
1692}

◆ CidTestResultsContains()

static bool dart::CidTestResultsContains ( const ZoneGrowableArray< intptr_t > &  results,
intptr_t  test_cid 
)
static

Definition at line 1362 of file call_specializer.cc.

1363 {
1364 for (intptr_t i = 0; i < results.length(); i += 2) {
1365 if (results[i] == test_cid) return true;
1366 }
1367 return false;
1368}

◆ CleanupIsolateGroup()

static void dart::CleanupIsolateGroup ( void *  callback_data)
static

Definition at line 278 of file run_vm_tests.cc.

278 {
279 bin::IsolateGroupData* isolate_data =
280 reinterpret_cast<bin::IsolateGroupData*>(callback_data);
281 delete isolate_data;
282}

◆ ClearCpuSamples()

static void dart::ClearCpuSamples ( Thread thread,
JSONStream js 
)
static

Definition at line 4504 of file service.cc.

4504 {
4505 ProfilerService::ClearSamples();
4506 PrintSuccess(js);
4507}
static void PrintSuccess(JSONStream *js)
Definition service.cc:507

◆ ClearLazyDeopts()

static void dart::ClearLazyDeopts ( Thread thread,
uword  frame_pointer 
)
static

Definition at line 580 of file exceptions.cc.

580 {
581 if (thread->pending_deopts().HasPendingDeopts()) {
582 // We may be jumping over frames scheduled for lazy deopt. Remove these
583 // frames from the pending deopt table, but only after unmarking them so
584 // any stack walk that happens before the stack is unwound will still work.
585 {
586 DartFrameIterator frames(thread,
587 StackFrameIterator::kNoCrossThreadIteration);
588 for (StackFrame* frame = frames.NextFrame(); frame != nullptr;
589 frame = frames.NextFrame()) {
590 if (frame->fp() >= frame_pointer) {
591 break;
592 }
593 if (frame->IsMarkedForLazyDeopt()) {
594 frame->UnmarkForLazyDeopt();
595 }
596 }
597 }
598
599#if defined(DEBUG)
600 ValidateFrames();
601#endif
602
604 frame_pointer, PendingDeopts::kClearDueToThrow);
605
606#if defined(DEBUG)
607 ValidateFrames();
608#endif
609 }
610}
void ClearPendingDeoptsBelow(uword fp, ClearReason reason)
PendingDeopts & pending_deopts()
Definition thread.h:1131

◆ ClearParsedUri()

static void dart::ClearParsedUri ( ParsedUri parsed_uri)
static

Definition at line 148 of file uri.cc.

148 {
149 parsed_uri->scheme = nullptr;
150 parsed_uri->userinfo = nullptr;
151 parsed_uri->host = nullptr;
152 parsed_uri->port = nullptr;
153 parsed_uri->path = nullptr;
154 parsed_uri->query = nullptr;
155 parsed_uri->fragment = nullptr;
156}

◆ ClearVMTimeline()

static void dart::ClearVMTimeline ( Thread thread,
JSONStream js 
)
static

Definition at line 4290 of file service.cc.

4290 {
4291 Isolate* isolate = thread->isolate();
4292 ASSERT(isolate != nullptr);
4293 StackZone zone(thread);
4294
4295 Timeline::Clear();
4296
4297 PrintSuccess(js);
4298}

◆ ClobberAndCall()

void dart::ClobberAndCall ( void(*)()  fn)

◆ ClosureCallbackThroughHandle()

DART_EXPORT void dart::ClosureCallbackThroughHandle ( void(*)(Dart_Handle callback,
Dart_Handle  closureHandle 
)

Definition at line 984 of file ffi_test_functions_vmspecific.cc.

985 {
986 printf("ClosureCallbackThroughHandle %p %p\n", callback, closureHandle);
987 callback(closureHandle);
988}

◆ ClosureEqualsHelper()

static bool dart::ClosureEqualsHelper ( Zone zone,
const Closure receiver,
const Object other 
)
static

Definition at line 33 of file function.cc.

35 {
36 if (receiver.ptr() == other.ptr()) {
37 return true;
38 }
39 if (!other.IsClosure()) {
40 return false;
41 }
42 const auto& other_closure = Closure::Cast(other);
43 const auto& func_a = Function::Handle(zone, receiver.function());
44 const auto& func_b = Function::Handle(zone, other_closure.function());
45 // Check that functions match.
46 if (func_a.ptr() != func_b.ptr()) {
47 // Non-implicit closures taken from different functions are not equal.
48 if (!func_a.IsImplicitClosureFunction() ||
49 !func_b.IsImplicitClosureFunction()) {
50 return false;
51 }
52 // If the closure functions are not the same, check the function's name and
53 // owner, as multiple function objects could exist for the same function due
54 // to hot reload.
55 if ((func_a.name() != func_b.name() || func_a.Owner() != func_b.Owner() ||
56 func_a.is_static() != func_b.is_static())) {
57 return false;
58 }
59 }
60 // Check that the delayed type argument vectors match.
61 if (receiver.delayed_type_arguments() !=
62 other_closure.delayed_type_arguments()) {
63 // Mismatches should only happen when a generic function is involved.
64 ASSERT(func_a.IsGeneric() || func_b.IsGeneric());
65 const auto& type_args_a =
66 TypeArguments::Handle(zone, receiver.delayed_type_arguments());
67 const auto& type_args_b =
68 TypeArguments::Handle(zone, other_closure.delayed_type_arguments());
69 if (type_args_a.IsNull() || type_args_b.IsNull() ||
70 (type_args_a.Length() != type_args_b.Length()) ||
71 !type_args_a.IsEquivalent(type_args_b, TypeEquality::kSyntactical)) {
72 return false;
73 }
74 }
75 if (func_a.IsImplicitClosureFunction()) {
76 ASSERT(func_b.IsImplicitClosureFunction());
77 if (!func_a.is_static()) {
78 ASSERT(!func_b.is_static());
79 // Check that the both receiver instances are the same.
80 const Instance& receiver_a =
81 Instance::Handle(zone, receiver.GetImplicitClosureReceiver());
82 const Instance& receiver_b =
83 Instance::Handle(zone, other_closure.GetImplicitClosureReceiver());
84 return receiver_a.ptr() == receiver_b.ptr();
85 }
86 } else {
87 ASSERT(!func_b.IsImplicitClosureFunction());
88 if (func_a.IsGeneric()) {
89 // Additional constraints for closures of generic functions:
90 // (1) Different instantiations of the same generic closure
91 // with the same type arguments should be equal.
92 // This means that instantiated generic closures are not unique
93 // and equality of instantiated generic closures should not be
94 // based on identity.
95 // (2) Instantiations of non-equal generic closures should be non-equal.
96 // This means that equality of non-instantiated generic closures
97 // should not be based on identity too as it won't match equality
98 // after instantiation.
99 if ((receiver.GetContext() != other_closure.GetContext()) ||
100 (receiver.instantiator_type_arguments() !=
101 other_closure.instantiator_type_arguments()) ||
102 (receiver.function_type_arguments() !=
103 other_closure.function_type_arguments())) {
104 return false;
105 }
106 } else {
107 // Closures of non-generic functions are unique.
108 return false;
109 }
110 }
111 return true;
112}
ContextPtr GetContext() const
Definition object.h:12334
TypeArgumentsPtr instantiator_type_arguments() const
Definition object.h:12294
TypeArgumentsPtr delayed_type_arguments() const
Definition object.h:12314
TypeArgumentsPtr function_type_arguments() const
Definition object.h:12304
InstancePtr GetImplicitClosureReceiver() const
Definition object.h:12339
FunctionPtr function() const
Definition object.h:12324

◆ CollectAllGarbage()

static void dart::CollectAllGarbage ( Thread thread,
JSONStream js 
)
static

Definition at line 4559 of file service.cc.

4559 {
4560 auto heap = thread->isolate_group()->heap();
4561 heap->CollectAllGarbage(GCReason::kDebugging);
4562 PrintSuccess(js);
4563}
void CollectAllGarbage(GCReason reason=GCReason::kFull, bool compact=false)
Definition heap.cc:562
Heap * heap() const
Definition isolate.h:295

◆ CollectDartFrame()

static ActivationFrame * dart::CollectDartFrame ( uword  pc,
StackFrame frame,
const Code code,
const Array deopt_frame,
intptr_t  deopt_frame_offset 
)
static

Definition at line 1631 of file debugger.cc.

1635 {
1636 ASSERT(code.ContainsInstructionAt(pc));
1637 ActivationFrame* activation = new ActivationFrame(
1638 pc, frame->fp(), frame->sp(), code, deopt_frame, deopt_frame_offset);
1639 if (FLAG_trace_debugger_stacktrace) {
1640 const Context& ctx = activation->GetSavedCurrentContext();
1641 OS::PrintErr("\tUsing saved context: %s\n", ctx.ToCString());
1642 OS::PrintErr("\tLine number: %" Pd "\n", activation->LineNumber());
1643 }
1644 return activation;
1645}
const Context & GetSavedCurrentContext()
Definition debugger.cc:700
intptr_t LineNumber()
Definition debugger.cc:552

◆ CollectFinalizedSuperClasses()

static void dart::CollectFinalizedSuperClasses ( const Class cls_,
GrowableArray< intptr_t > *  finalized_super_classes 
)
static

Definition at line 94 of file class_finalizer.cc.

96 {
97 Class& cls = Class::Handle(cls_.ptr());
98 AbstractType& super_type = Type::Handle();
99 super_type = cls.super_type();
100 if (!super_type.IsNull()) {
101 if (super_type.HasTypeClass()) {
102 cls = super_type.type_class();
103 if (cls.is_finalized()) {
104 AddSuperType(super_type, finalized_super_classes);
105 }
106 }
107 }
108}
virtual bool HasTypeClass() const
Definition object.h:9063
virtual ClassPtr type_class() const
Definition object.cc:21083
TypePtr super_type() const
Definition object.h:1433

◆ CollectImmediateSuperInterfaces()

static void dart::CollectImmediateSuperInterfaces ( const Class cls,
GrowableArray< intptr_t > *  cids 
)
static

Definition at line 163 of file class_finalizer.cc.

164 {
165 const Array& interfaces = Array::Handle(cls.interfaces());
166 Class& ifc = Class::Handle();
167 AbstractType& type = AbstractType::Handle();
168 for (intptr_t i = 0; i < interfaces.Length(); ++i) {
169 type ^= interfaces.At(i);
170 if (!type.HasTypeClass()) continue;
171 ifc = type.type_class();
172 for (intptr_t j = 0; j < cids->length(); ++j) {
173 if ((*cids)[j] == ifc.id()) {
174 // Already added.
175 return;
176 }
177 }
178 cids->Add(ifc.id());
179 }
180}
intptr_t id() const
Definition object.h:1235
ArrayPtr interfaces() const
Definition object.h:1449

◆ CollectOnNthAllocation()

DART_EXPORT void dart::CollectOnNthAllocation ( intptr_t  num_allocations)

Definition at line 94 of file ffi_test_functions_vmspecific.cc.

94 {
95 Dart_ExecuteInternalCommand("gc-on-nth-allocation",
96 reinterpret_cast<void*>(num_allocations));
97}
DART_EXPORT void * Dart_ExecuteInternalCommand(const char *command, void *arg)

◆ CollectSample()

static void dart::CollectSample ( Isolate isolate,
bool  exited_dart_code,
bool  in_dart_code,
Sample sample,
ProfilerNativeStackWalker native_stack_walker,
ProfilerDartStackWalker dart_stack_walker,
uword  pc,
uword  fp,
uword  sp,
ProfilerCounters counters 
)
static

Definition at line 1169 of file profiler.cc.

1178 {
1179 ASSERT(counters != nullptr);
1180#if defined(DART_HOST_OS_WINDOWS)
1181 // Use structured exception handling to trap guard page access on Windows.
1182 __try {
1183#endif
1184
1185 if (in_dart_code) {
1186 // We can only trust the stack pointer if we are executing Dart code.
1187 // See http://dartbug.com/20421 for details.
1188 CopyStackBuffer(sample, sp);
1189 }
1190
1191 if (FLAG_profile_vm) {
1192 // Always walk the native stack collecting both native and Dart frames.
1193 counters->stack_walker_native.fetch_add(1);
1194 native_stack_walker->walk();
1195 } else if (StubCode::HasBeenInitialized() && exited_dart_code) {
1196 counters->stack_walker_dart_exit.fetch_add(1);
1197 // We have a valid exit frame info, use the Dart stack walker.
1198 dart_stack_walker->walk();
1199 } else if (StubCode::HasBeenInitialized() && in_dart_code) {
1200 counters->stack_walker_dart.fetch_add(1);
1201 // We are executing Dart code. We have frame pointers.
1202 dart_stack_walker->walk();
1203 } else {
1204 counters->stack_walker_none.fetch_add(1);
1205 sample->SetAt(0, pc);
1206 }
1207
1208#if defined(DART_HOST_OS_WINDOWS)
1209 // Use structured exception handling to trap guard page access.
1210 } __except (GuardPageExceptionFilter(GetExceptionInformation())) { // NOLINT
1211 // Sample collection triggered a guard page fault:
1212 // 1) discard entire sample.
1213 sample->set_ignore_sample(true);
1214
1215 // 2) Reenable guard bit on page that triggered the fault.
1216 // https://goo.gl/5mCsXW
1217 DWORD new_protect = PAGE_READWRITE | PAGE_GUARD;
1218 DWORD old_protect = 0;
1219 BOOL success =
1220 VirtualProtect(reinterpret_cast<void*>(fault_address),
1221 sizeof(fault_address), new_protect, &old_protect);
1222 USE(success);
1223 ASSERT(success);
1224 ASSERT(old_protect == PAGE_READWRITE);
1225 }
1226#endif
1227}
void set_ignore_sample(bool ignore_sample)
Definition profiler.h:282
void SetAt(intptr_t i, uword pc)
Definition profiler.h:244
static void CopyStackBuffer(Sample *sample, uword sp_addr)
Definition profiler.cc:1137
int BOOL

◆ CollectStringifiedType()

static void dart::CollectStringifiedType ( Thread thread,
Zone zone,
const AbstractType type,
const GrowableObjectArray output 
)
static

Definition at line 2889 of file service.cc.

2892 {
2893 Instance& instance = Instance::Handle(zone);
2894 if (type.IsFunctionType()) {
2895 // The closure class
2896 // (IsolateGroup::Current()->object_store()->closure_class())
2897 // is statically typed weird (the call method redirects to itself)
2898 // and the type is therefore not useful for the CFE. We use null instead.
2899 output.Add(instance);
2900 return;
2901 }
2902 if (type.IsRecordType()) {
2903 // _Record class is not useful for the CFE. We use null instead.
2904 output.Add(instance);
2905 return;
2906 }
2907 if (type.IsDynamicType()) {
2908 // Dynamic is weird in that it seems to have a class with no name and a
2909 // library called something like '7189777121420'. We use null instead.
2910 output.Add(instance);
2911 return;
2912 }
2913 if (type.IsTypeParameter()) {
2914 // Calling type_class on a type parameter will crash the VM.
2915 // We use null instead.
2916 output.Add(instance);
2917 return;
2918 }
2919 ASSERT(type.IsType());
2920
2921 const Class& cls = Class::Handle(type.type_class());
2922 const Library& lib = Library::Handle(zone, cls.library());
2923
2924 instance ^= lib.url();
2925 output.Add(instance);
2926
2927 instance ^= cls.ScrubbedName();
2928 output.Add(instance);
2929
2930 instance ^= Smi::New((intptr_t)type.nullability());
2931 output.Add(instance);
2932
2933 const TypeArguments& type_arguments =
2934 TypeArguments::Handle(Type::Cast(type).arguments());
2935 if (!type_arguments.IsNull()) {
2936 instance ^= Smi::New(type_arguments.Length());
2937 output.Add(instance);
2938 AbstractType& src_type = AbstractType::Handle();
2939 for (intptr_t i = 0; i < type_arguments.Length(); i++) {
2940 src_type = type_arguments.TypeAt(i);
2941 CollectStringifiedType(thread, zone, src_type, output);
2942 }
2943 } else {
2944 const intptr_t num_type_parameters = cls.NumTypeParameters(thread);
2945 instance ^= Smi::New(num_type_parameters);
2946 output.Add(instance);
2947 const AbstractType& dynamic_type =
2948 AbstractType::Handle(Type::DynamicType());
2949 for (intptr_t i = 0; i < num_type_parameters; i++) {
2950 CollectStringifiedType(thread, zone, dynamic_type, output);
2951 }
2952 }
2953}

◆ CollisionHash1()

static uint32_t dart::CollisionHash1 ( uint32_t  key)
static

Definition at line 68 of file hashmap_test.cc.

68 {
69 return key & 0x3;
70}

◆ CollisionHash2()

static uint32_t dart::CollisionHash2 ( uint32_t  key)
static

Definition at line 71 of file hashmap_test.cc.

71 {
72 return kInitialSize - 1;
73}
static intptr_t kInitialSize

◆ CollisionHash3()

static uint32_t dart::CollisionHash3 ( uint32_t  key)
static

Definition at line 74 of file hashmap_test.cc.

74 {
75 return kInitialSize - 2;
76}

◆ CollisionHash4()

static uint32_t dart::CollisionHash4 ( uint32_t  key)
static

Definition at line 77 of file hashmap_test.cc.

77 {
78 return kInitialSize - 2;
79}

◆ Combine()

ContainedInLattice dart::Combine ( ContainedInLattice  a,
ContainedInLattice  b 
)
inline

Definition at line 1087 of file regexp.h.

1087 {
1088 return static_cast<ContainedInLattice>(a | b);
1089}
ContainedInLattice
Definition regexp.h:1080

◆ CombineHashes()

uint32_t dart::CombineHashes ( uint32_t  hash,
uint32_t  other_hash 
)
inline

Definition at line 12 of file hash.h.

12 {
13 // Keep in sync with AssemblerBase::CombineHashes.
14 hash += other_hash;
15 hash += hash << 10;
16 hash ^= hash >> 6; // Logical shift, unsigned hash.
17 return hash;
18}

◆ CommentCheckedClasses()

static void dart::CommentCheckedClasses ( compiler::Assembler assembler,
const CidRangeVector ranges 
)
static

Definition at line 414 of file type_testing_stubs.cc.

415 {
416 if (!assembler->EmittingComments()) return;
417 Thread* const thread = Thread::Current();
418 ClassTable* const class_table = thread->isolate_group()->class_table();
419 Zone* const zone = thread->zone();
420 if (ranges.is_empty()) {
421 __ Comment("No valid cids to check");
422 return;
423 }
424 if ((ranges.length() == 1) && ranges[0].IsSingleCid()) {
425 const auto& cls = Class::Handle(zone, class_table->At(ranges[0].cid_start));
426 __ Comment("Checking for cid %" Pd " (%s)", cls.id(),
427 cls.ScrubbedNameCString());
428 return;
429 }
430 __ Comment("Checking for concrete finalized classes:");
431 auto& cls = Class::Handle(zone);
432 for (const auto& range : ranges) {
433 ASSERT(!range.IsIllegalRange());
434 for (classid_t cid = range.cid_start; cid <= range.cid_end; cid++) {
435 // Invalid entries can be included to keep range count low.
436 if (!class_table->HasValidClassAt(cid)) continue;
437 cls = class_table->At(cid);
438 if (cls.is_abstract()) continue; // Only output concrete classes.
439 __ Comment(" * %" Pd32 " (%s)", cid, cls.ScrubbedNameCString());
440 }
441 }
442}
ClassPtr At(intptr_t cid) const
bool HasValidClassAt(intptr_t cid) const
ClassTable * class_table() const
Definition isolate.h:491
void static bool EmittingComments()
const intptr_t cid
#define Pd32
Definition globals.h:412
#define __

◆ CommentSkippedClasses()

static void dart::CommentSkippedClasses ( compiler::Assembler assembler,
const Type type,
const Class type_class,
const CidRangeVector ranges 
)
static

Definition at line 535 of file type_testing_stubs.cc.

538 {
539 if (!assembler->EmittingComments() || ranges.is_empty()) return;
540 if (ranges.is_empty()) return;
541 ASSERT(type_class.is_implemented());
542 __ Comment("Not checking the following concrete implementors of %s:",
543 type_class.ScrubbedNameCString());
544 Thread* const thread = Thread::Current();
545 auto* const class_table = thread->isolate_group()->class_table();
546 Zone* const zone = thread->zone();
547 auto& cls = Class::Handle(zone);
548 auto& calculated_type = Type::Handle(zone);
549 for (const auto& range : ranges) {
550 ASSERT(!range.IsIllegalRange());
551 for (classid_t cid = range.cid_start; cid <= range.cid_end; cid++) {
552 // Invalid entries can be included to keep range count low.
553 if (!class_table->HasValidClassAt(cid)) continue;
554 cls = class_table->At(cid);
555 if (cls.is_abstract()) continue; // Only output concrete classes.
556 ASSERT(cls.is_type_finalized());
557 TextBuffer buffer(128);
558 buffer.Printf(" * %" Pd32 "(%s): ", cid, cls.ScrubbedNameCString());
559 switch (SubtypeChecksForClass(zone, type, type_class, cls)) {
560 case CheckType::kCannotBeChecked:
561 calculated_type = cls.GetInstantiationOf(zone, type_class);
562 buffer.AddString("cannot check that ");
563 calculated_type.PrintName(Object::kScrubbedName, &buffer);
564 buffer.AddString(" is a subtype of ");
565 type.PrintName(Object::kScrubbedName, &buffer);
566 break;
567 case CheckType::kNotSubtype:
568 calculated_type = cls.GetInstantiationOf(zone, type_class);
569 calculated_type.PrintName(Object::kScrubbedName, &buffer);
570 buffer.AddString(" is not a subtype of ");
571 type.PrintName(Object::kScrubbedName, &buffer);
572 break;
573 case CheckType::kNeedsFinalization:
574 buffer.AddString("is not finalized");
575 break;
576 case CheckType::kInstanceTypeArgumentsAreSubtypes:
577 buffer.AddString("was not finalized during class splitting");
578 break;
579 default:
580 // Either the CheckType was kCidCheckOnly, which should never happen
581 // since it only requires type finalization, or a new CheckType has
582 // been added.
583 UNREACHABLE();
584 break;
585 }
586 __ Comment("%s", buffer.buffer());
587 }
588 }
589}
const char * ScrubbedNameCString() const
Definition object.cc:3046
bool is_implemented() const
Definition object.h:1694
static CheckType SubtypeChecksForClass(Zone *zone, const Type &type, const Class &type_class, const Class &to_check)
int32_t classid_t
Definition globals.h:524

◆ CommonSuffixLength()

static intptr_t dart::CommonSuffixLength ( const char *  a,
const char *  b 
)
static

Definition at line 623 of file isolate_reload.cc.

623 {
624 const intptr_t a_length = strlen(a);
625 const intptr_t b_length = strlen(b);
626 intptr_t a_cursor = a_length;
627 intptr_t b_cursor = b_length;
628
629 while ((a_cursor >= 0) && (b_cursor >= 0)) {
630 if (a[a_cursor] != b[b_cursor]) {
631 break;
632 }
633 a_cursor--;
634 b_cursor--;
635 }
636
637 ASSERT((a_length - a_cursor) == (b_length - b_cursor));
638 return (a_length - a_cursor);
639}

◆ CompareClusters()

static int dart::CompareClusters ( SerializationCluster *const *  a,
SerializationCluster *const *  b 
)
static

Definition at line 8506 of file app_snapshot.cc.

8507 {
8508 if ((*a)->size() > (*b)->size()) {
8509 return -1;
8510 } else if ((*a)->size() < (*b)->size()) {
8511 return 1;
8512 } else {
8513 return 0;
8514 }
8515}

◆ CompareDartCObjects()

static void dart::CompareDartCObjects ( Dart_CObject first,
Dart_CObject second 
)
static

Definition at line 58 of file snapshot_test.cc.

58 {
59 // Return immediately if entering a cycle.
60 if (second->type == Dart_CObject_kNumberOfTypes) return;
61
62 EXPECT_EQ(first->type, second->type);
63 switch (first->type) {
65 // Nothing more to compare.
66 break;
68 EXPECT_EQ(first->value.as_bool, second->value.as_bool);
69 break;
71 EXPECT_EQ(first->value.as_int32, second->value.as_int32);
72 break;
74 EXPECT_EQ(first->value.as_int64, second->value.as_int64);
75 break;
77 EXPECT_EQ(first->value.as_double, second->value.as_double);
78 break;
80 EXPECT_STREQ(first->value.as_string, second->value.as_string);
81 break;
83 EXPECT_EQ(first->value.as_typed_data.length,
84 second->value.as_typed_data.length);
85 for (int i = 0; i < first->value.as_typed_data.length; i++) {
86 EXPECT_EQ(first->value.as_typed_data.values[i],
87 second->value.as_typed_data.values[i]);
88 }
89 break;
91 // Use invalid type as a visited marker to avoid infinite
92 // recursion on graphs with cycles.
94 EXPECT_EQ(first->value.as_array.length, second->value.as_array.length);
95 for (int i = 0; i < first->value.as_array.length; i++) {
96 CompareDartCObjects(first->value.as_array.values[i],
97 second->value.as_array.values[i]);
98 }
99 break;
101 EXPECT_EQ(first->value.as_capability.id, second->value.as_capability.id);
102 break;
103 default:
104 EXPECT(false);
105 }
106}
@ Dart_CObject_kNumberOfTypes
@ Dart_CObject_kDouble
@ Dart_CObject_kBool
@ Dart_CObject_kCapability
struct _Dart_CObject::@86::@88 as_capability

◆ CompareIntegers()

static bool dart::CompareIntegers ( Token::Kind  kind,
const Integer left,
const Integer right 
)
static

Definition at line 648 of file constant_propagator.cc.

650 {
651 const int result = left.CompareWith(right);
652 switch (kind) {
653 case Token::kEQ:
654 return (result == 0);
655 case Token::kNE:
656 return (result != 0);
657 case Token::kLT:
658 return (result < 0);
659 case Token::kGT:
660 return (result > 0);
661 case Token::kLTE:
662 return (result <= 0);
663 case Token::kGTE:
664 return (result >= 0);
665 default:
666 UNREACHABLE();
667 return false;
668 }
669}

◆ CompareInverseRanges()

static bool dart::CompareInverseRanges ( ZoneGrowableArray< CharacterRange > *  ranges,
const int32_t *  special_class,
intptr_t  length 
)
static

Definition at line 3813 of file regexp.cc.

3815 {
3816 length--; // Remove final kRangeEndMarker.
3817 ASSERT(special_class[length] == kRangeEndMarker);
3818 ASSERT(ranges->length() != 0);
3819 ASSERT(length != 0);
3820 ASSERT(special_class[0] != 0);
3821 if (ranges->length() != (length >> 1) + 1) {
3822 return false;
3823 }
3824 CharacterRange range = ranges->At(0);
3825 if (range.from() != 0) {
3826 return false;
3827 }
3828 for (intptr_t i = 0; i < length; i += 2) {
3829 if (special_class[i] != (range.to() + 1)) {
3830 return false;
3831 }
3832 range = ranges->At((i >> 1) + 1);
3833 if (special_class[i + 1] != range.from()) {
3834 return false;
3835 }
3836 }
3837 if (range.to() != Utf::kMaxCodePoint) {
3838 return false;
3839 }
3840 return true;
3841}

◆ CompareRanges()

static bool dart::CompareRanges ( ZoneGrowableArray< CharacterRange > *  ranges,
const int32_t *  special_class,
intptr_t  length 
)
static

Definition at line 3843 of file regexp.cc.

3845 {
3846 length--; // Remove final kRangeEndMarker.
3847 ASSERT(special_class[length] == kRangeEndMarker);
3848 if (ranges->length() * 2 != length) {
3849 return false;
3850 }
3851 for (intptr_t i = 0; i < length; i += 2) {
3852 CharacterRange range = ranges->At(i >> 1);
3853 if (range.from() != special_class[i] ||
3854 range.to() != special_class[i + 1] - 1) {
3855 return false;
3856 }
3857 }
3858 return true;
3859}

◆ COMPILE_ASSERT() [1/36]

◆ COMPILE_ASSERT() [2/36]

dart::COMPILE_ASSERT ( kAbiPreservedCpuRegCount  = =7)

◆ COMPILE_ASSERT() [3/36]

dart::COMPILE_ASSERT ( kAbiPreservedFpuRegCount  = =4)

◆ COMPILE_ASSERT() [4/36]

dart::COMPILE_ASSERT ( kByteBufferCid 1 = =kNullCid)

◆ COMPILE_ASSERT() [5/36]

dart::COMPILE_ASSERT ( kFfiStructCid+  1 = =kFirstTypedDataCid)

◆ COMPILE_ASSERT() [6/36]

dart::COMPILE_ASSERT ( kFirstErrorCid  = =kErrorCid &&kApiErrorCid==kFirstErrorCid+1 &&kLanguageErrorCid==kFirstErrorCid+2 &&kUnhandledExceptionCid==kFirstErrorCid+3 &&kUnwindErrorCid==kFirstErrorCid+4 &&kLastErrorCid==kUnwindErrorCid &&kLastInternalOnlyCid==kLastErrorCid)

◆ COMPILE_ASSERT() [7/36]

dart::COMPILE_ASSERT ( kFirstInternalOnlyCid  = =kObjectCid+1)

◆ COMPILE_ASSERT() [8/36]

dart::COMPILE_ASSERT ( kFirstTypedDataCid+1 *  kNumTypedDataCidRemainders = =kTypedDataUint8ArrayCid)

◆ COMPILE_ASSERT() [9/36]

dart::COMPILE_ASSERT ( kFirstTypedDataCid+10 *  kNumTypedDataCidRemainders = =kTypedDataFloat64ArrayCid)

◆ COMPILE_ASSERT() [10/36]

dart::COMPILE_ASSERT ( kFirstTypedDataCid+11 *  kNumTypedDataCidRemainders = =kTypedDataFloat32x4ArrayCid)

◆ COMPILE_ASSERT() [11/36]

dart::COMPILE_ASSERT ( kFirstTypedDataCid+12 *  kNumTypedDataCidRemainders = =kTypedDataInt32x4ArrayCid)

◆ COMPILE_ASSERT() [12/36]

dart::COMPILE_ASSERT ( kFirstTypedDataCid+13 *kNumTypedDataCidRemainders kTypedDataCidRemainderUnmodifiable = =kLastTypedDataCid)

◆ COMPILE_ASSERT() [13/36]

dart::COMPILE_ASSERT ( kFirstTypedDataCid+13 *  kNumTypedDataCidRemainders = =kTypedDataFloat64x2ArrayCid)

◆ COMPILE_ASSERT() [14/36]

dart::COMPILE_ASSERT ( kFirstTypedDataCid+2 *  kNumTypedDataCidRemainders = =kTypedDataUint8ClampedArrayCid)

◆ COMPILE_ASSERT() [15/36]

dart::COMPILE_ASSERT ( kFirstTypedDataCid+3 *  kNumTypedDataCidRemainders = =kTypedDataInt16ArrayCid)

◆ COMPILE_ASSERT() [16/36]

dart::COMPILE_ASSERT ( kFirstTypedDataCid+4 *  kNumTypedDataCidRemainders = =kTypedDataUint16ArrayCid)

◆ COMPILE_ASSERT() [17/36]

dart::COMPILE_ASSERT ( kFirstTypedDataCid+5 *  kNumTypedDataCidRemainders = =kTypedDataInt32ArrayCid)

◆ COMPILE_ASSERT() [18/36]

dart::COMPILE_ASSERT ( kFirstTypedDataCid+6 *  kNumTypedDataCidRemainders = =kTypedDataUint32ArrayCid)

◆ COMPILE_ASSERT() [19/36]

dart::COMPILE_ASSERT ( kFirstTypedDataCid+7 *  kNumTypedDataCidRemainders = =kTypedDataInt64ArrayCid)

◆ COMPILE_ASSERT() [20/36]

dart::COMPILE_ASSERT ( kFirstTypedDataCid+8 *  kNumTypedDataCidRemainders = =kTypedDataUint64ArrayCid)

◆ COMPILE_ASSERT() [21/36]

dart::COMPILE_ASSERT ( kFirstTypedDataCid+9 *  kNumTypedDataCidRemainders = =kTypedDataFloat32ArrayCid)

◆ COMPILE_ASSERT() [22/36]

dart::COMPILE_ASSERT ( kFirstTypedDataCid  = =kTypedDataInt8ArrayCid)

◆ COMPILE_ASSERT() [23/36]

dart::COMPILE_ASSERT ( kInstanceCid  = =kLastInternalOnlyCid+1)

◆ COMPILE_ASSERT() [24/36]

dart::COMPILE_ASSERT ( kLastTypedDataCid 1 = =kByteDataViewCid)

◆ COMPILE_ASSERT() [25/36]

dart::COMPILE_ASSERT ( kObjectStartAlignment >=2 *  kBoolValueMask)

◆ COMPILE_ASSERT() [26/36]

dart::COMPILE_ASSERT ( kObjectStartAlignment >=  kObjectAlignment)

◆ COMPILE_ASSERT() [27/36]

dart::COMPILE_ASSERT ( kOneByteStringCid  = =kStringCid+1 &&kTwoByteStringCid==kStringCid+2)

◆ COMPILE_ASSERT() [28/36]

dart::COMPILE_ASSERT ( kTypedDataCidRemainderInternal  = =0)

◆ COMPILE_ASSERT() [29/36]

dart::COMPILE_ASSERT ( kTypedDataInt8ArrayCid+  kTypedDataCidRemainderView = =kTypedDataInt8ArrayViewCid)

◆ COMPILE_ASSERT() [30/36]

dart::COMPILE_ASSERT ( kUnreachableReference  = =WeakTable::kNoValue)

◆ COMPILE_ASSERT() [31/36]

dart::COMPILE_ASSERT ( sizeof(UntaggedDouble = =16)

◆ COMPILE_ASSERT() [32/36]

dart::COMPILE_ASSERT ( sizeof(UntaggedFloat32x4 = =24)

◆ COMPILE_ASSERT() [33/36]

dart::COMPILE_ASSERT ( sizeof(UntaggedFloat64x2 = =24)

◆ COMPILE_ASSERT() [34/36]

dart::COMPILE_ASSERT ( sizeof(UntaggedInt32x4 = =24)

◆ COMPILE_ASSERT() [35/36]

dart::COMPILE_ASSERT ( sizeof(UntaggedMint = =16)

◆ COMPILE_ASSERT() [36/36]

dart::COMPILE_ASSERT ( static_cast< uword kForwarded = =static_cast< uword >(kHeapObjectTag))

◆ CompileExpression()

static void dart::CompileExpression ( Thread thread,
JSONStream js 
)
static

Definition at line 3216 of file service.cc.

3216 {
3217#if defined(DART_PRECOMPILED_RUNTIME)
3218 js->PrintError(kFeatureDisabled, "Debugger is disabled in AOT mode.");
3219#else
3220 if (CheckDebuggerDisabled(thread, js)) {
3221 return;
3222 }
3223
3224 if (!KernelIsolate::IsRunning() && !KernelIsolate::Start()) {
3225 js->PrintError(
3226 kExpressionCompilationError,
3227 "%s: No compilation service available; cannot evaluate from source.",
3228 js->method());
3229 return;
3230 }
3231
3232 const char* klass = js->LookupParam("klass");
3233 bool is_static =
3234 BoolParameter::Parse(js->LookupParam("isStatic"), (klass == nullptr));
3235 int64_t token_pos = Int64Parameter::Parse(js->LookupParam("tokenPos"));
3236
3237 const GrowableObjectArray& params =
3238 GrowableObjectArray::Handle(thread->zone(), GrowableObjectArray::New());
3239 if (!ParseCSVList(js->LookupParam("definitions"), params)) {
3240 PrintInvalidParamError(js, "definitions");
3241 return;
3242 }
3243 const GrowableObjectArray& param_types =
3244 GrowableObjectArray::Handle(thread->zone(), GrowableObjectArray::New());
3245 if (!ParseCSVList(js->LookupParam("definitionTypes"), param_types)) {
3246 PrintInvalidParamError(js, "definitionTypes");
3247 return;
3248 }
3249
3250 const GrowableObjectArray& type_params =
3251 GrowableObjectArray::Handle(thread->zone(), GrowableObjectArray::New());
3252 if (!ParseCSVList(js->LookupParam("typeDefinitions"), type_params)) {
3253 PrintInvalidParamError(js, "typedDefinitions");
3254 return;
3255 }
3256 const GrowableObjectArray& type_bounds =
3257 GrowableObjectArray::Handle(thread->zone(), GrowableObjectArray::New());
3258 if (!ParseCSVList(js->LookupParam("typeBounds"), type_bounds)) {
3259 PrintInvalidParamError(js, "typeBounds");
3260 return;
3261 }
3262 const GrowableObjectArray& type_defaults =
3263 GrowableObjectArray::Handle(thread->zone(), GrowableObjectArray::New());
3264 if (!ParseCSVList(js->LookupParam("typeDefaults"), type_defaults)) {
3265 PrintInvalidParamError(js, "typeDefaults");
3266 return;
3267 }
3268
3269 const uint8_t* kernel_buffer = Service::dart_library_kernel();
3270 const intptr_t kernel_buffer_len = Service::dart_library_kernel_length();
3271
3272 Dart_KernelCompilationResult compilation_result =
3273 KernelIsolate::CompileExpressionToKernel(
3274 kernel_buffer, kernel_buffer_len, js->LookupParam("expression"),
3275 Array::Handle(Array::MakeFixedLength(params)),
3276 Array::Handle(Array::MakeFixedLength(param_types)),
3277 Array::Handle(Array::MakeFixedLength(type_params)),
3278 Array::Handle(Array::MakeFixedLength(type_bounds)),
3279 Array::Handle(Array::MakeFixedLength(type_defaults)),
3280 js->LookupParam("libraryUri"), js->LookupParam("klass"),
3281 js->LookupParam("method"), TokenPosition::Deserialize(token_pos),
3282 js->LookupParam("scriptUri"), is_static);
3283
3284 if (compilation_result.status != Dart_KernelCompilationStatus_Ok) {
3285 js->PrintError(kExpressionCompilationError, "%s", compilation_result.error);
3286 free(compilation_result.error);
3287 return;
3288 }
3289
3290 const uint8_t* kernel_bytes = compilation_result.kernel;
3291 intptr_t kernel_length = compilation_result.kernel_size;
3292 ASSERT(kernel_bytes != nullptr);
3293
3294 JSONObject report(js);
3295 report.AddPropertyBase64("kernelBytes", kernel_bytes, kernel_length);
3296#endif
3297}
const EmbeddedViewParams * params
static bool ParseCSVList(const char *csv_list, const GrowableObjectArray &values)
Definition service.cc:3162
Dart_KernelCompilationStatus status
Definition dart_api.h:3735

◆ CompileFunctionHelper()

static ObjectPtr dart::CompileFunctionHelper ( CompilationPipeline pipeline,
const Function function,
volatile bool  optimized,
intptr_t  osr_id 
)
static

Definition at line 683 of file compiler.cc.

686 {
687 Thread* const thread = Thread::Current();
688 NoActiveIsolateScope no_active_isolate(thread);
689
690 ASSERT(!FLAG_precompiled_mode);
691 ASSERT(!optimized || function.WasCompiled() || function.ForceOptimize());
692 if (function.ForceOptimize()) optimized = true;
693 LongJumpScope jump;
694 if (setjmp(*jump.Set()) == 0) {
695 StackZone stack_zone(thread);
696 Zone* const zone = stack_zone.GetZone();
697 const bool trace_compiler =
698 FLAG_trace_compiler || (FLAG_trace_optimizing_compiler && optimized);
699 Timer per_compile_timer;
700 per_compile_timer.Start();
701
702 ParsedFunction* parsed_function = new (zone)
703 ParsedFunction(thread, Function::ZoneHandle(zone, function.ptr()));
704 if (trace_compiler) {
705 const intptr_t token_size = function.SourceSize();
706 THR_Print("Compiling %s%sfunction %s: '%s' @ token %s, size %" Pd "\n",
707 (osr_id == Compiler::kNoOSRDeoptId ? "" : "osr "),
708 (optimized ? "optimized " : ""),
709 (Compiler::IsBackgroundCompilation() ? "(background)" : ""),
710 function.ToFullyQualifiedCString(),
711 function.token_pos().ToCString(), token_size);
712 }
713 // Makes sure no classes are loaded during parsing in background.
714 {
715 HANDLESCOPE(thread);
716 pipeline->ParseFunction(parsed_function);
717 }
718
719 CompileParsedFunctionHelper helper(parsed_function, optimized, osr_id);
720
721 const Code& result = Code::Handle(helper.Compile(pipeline));
722
723 if (result.IsNull()) {
724 const Error& error = Error::Handle(thread->StealStickyError());
725
726 if (Compiler::IsBackgroundCompilation()) {
727 // Try again later, background compilation may abort because of
728 // state change during compilation.
729 if (FLAG_trace_compiler) {
730 THR_Print("Aborted background compilation: %s\n",
731 function.ToFullyQualifiedCString());
732 }
733
734 // We got an error during compilation.
735 // If it was a bailout, then disable optimization.
736 if (error.ptr() == Object::background_compilation_error().ptr()) {
737 if (FLAG_trace_compiler) {
738 THR_Print(
739 "--> discarding background compilation for '%s' (will "
740 "try to re-compile again later)\n",
741 function.ToFullyQualifiedCString());
742 }
743
744 // Trigger another optimization pass soon.
745 function.SetUsageCounter(
747 return Error::null();
748 } else if (error.IsLanguageError() &&
749 LanguageError::Cast(error).kind() == Report::kBailout) {
750 if (FLAG_trace_compiler) {
751 THR_Print("--> disabling optimizations for '%s'\n",
752 function.ToFullyQualifiedCString());
753 }
754 function.SetIsOptimizable(false);
755 return Error::null();
756 } else {
757 // The background compiler does not execute Dart code or handle
758 // isolate messages.
759 ASSERT(!error.IsUnwindError());
760 return error.ptr();
761 }
762 }
763 if (optimized) {
764 if (error.IsLanguageError() &&
765 LanguageError::Cast(error).kind() == Report::kBailout) {
766 // Functions which cannot deoptimize should never bail out.
767 ASSERT(!function.ForceOptimize());
768 // Optimizer bailed out. Disable optimizations and never try again.
769 if (trace_compiler) {
770 THR_Print("--> disabling optimizations for '%s'\n",
771 function.ToFullyQualifiedCString());
772 } else if (FLAG_trace_failed_optimization_attempts) {
773 THR_Print("Cannot optimize: %s\n",
774 function.ToFullyQualifiedCString());
775 }
776 function.SetIsOptimizable(false);
777 return Error::null();
778 }
779 return error.ptr();
780 } else {
781 ASSERT(!optimized);
782 // The non-optimizing compiler can get an unhandled exception
783 // due to OOM or Stack overflow errors, it should not however
784 // bail out.
785 ASSERT(error.IsUnhandledException() || error.IsUnwindError() ||
786 (error.IsLanguageError() &&
787 LanguageError::Cast(error).kind() != Report::kBailout));
788 return error.ptr();
789 }
790 UNREACHABLE();
791 }
792
793 per_compile_timer.Stop();
794
795 if (trace_compiler) {
796 const auto& code = Code::Handle(function.CurrentCode());
797 THR_Print("--> '%s' entry: %#" Px " size: %" Pd " time: %" Pd64 " us\n",
798 function.ToFullyQualifiedCString(), code.PayloadStart(),
799 code.Size(), per_compile_timer.TotalElapsedTime());
800 }
801
802 return result.ptr();
803 } else {
804 Thread* const thread = Thread::Current();
805 StackZone stack_zone(thread);
806 // We got an error during compilation or it is a bailout from background
807 // compilation (e.g., during parsing with EnsureIsFinalized).
808 const Error& error = Error::Handle(thread->StealStickyError());
809 if (error.ptr() == Object::background_compilation_error().ptr()) {
810 // Exit compilation, retry it later.
811 if (FLAG_trace_bailout) {
812 THR_Print("Aborted background compilation: %s\n",
813 function.ToFullyQualifiedCString());
814 }
815 return Object::null();
816 }
817 // Do not attempt to optimize functions that can cause errors.
818 function.set_is_optimizable(false);
819 return error.ptr();
820 }
821 UNREACHABLE();
822 return Object::null();
823}
virtual void ParseFunction(ParsedFunction *parsed_function)=0
intptr_t optimization_counter_threshold() const
Definition isolate.h:305
DART_WARN_UNUSED_RESULT ErrorPtr StealStickyError()
Definition thread.cc:243
#define THR_Print(format,...)
Definition log.h:20
#define HANDLESCOPE(thread)
Definition handles.h:321
#define Px
Definition globals.h:410
#define Pd64
Definition globals.h:416

◆ COMPILER_PASS() [1/36]

dart::COMPILER_PASS ( AllocateRegisters  ,
{ flow_graph->InsertMoveArguments();flow_graph->GetLoopHierarchy();FlowGraphAllocator allocator(*flow_graph);allocator.AllocateRegisters();}   
)

◆ COMPILER_PASS() [2/36]

dart::COMPILER_PASS ( AllocateRegistersForGraphIntrinsic  ,
{ flow_graph->set_max_argument_slot_count(0);flow_graph->GetLoopHierarchy();FlowGraphAllocator allocator(*flow_graph, true);allocator.AllocateRegisters();}   
)

◆ COMPILER_PASS() [3/36]

dart::COMPILER_PASS ( AllocationSinking_DetachMaterializations  ,
{ if(state->sinking !=nullptr) { state->sinking->DetachMaterializations();} }   
)

◆ COMPILER_PASS() [4/36]

dart::COMPILER_PASS ( AllocationSinking_Sink  ,
{ if(flow_graph->graph_entry() ->catch_entries().is_empty()) { state->sinking=new AllocationSinking(flow_graph);state->sinking->Optimize();} }   
)

◆ COMPILER_PASS() [5/36]

dart::COMPILER_PASS ( ApplyClassIds  ,
{ state->call_specializer->ApplyClassIds();}   
)

◆ COMPILER_PASS() [6/36]

dart::COMPILER_PASS ( ApplyICData  ,
{ state->call_specializer->ApplyICData();}   
)

◆ COMPILER_PASS() [7/36]

dart::COMPILER_PASS ( BranchSimplify  ,
{ BranchSimplifier::Simplify(flow_graph);}   
)

◆ COMPILER_PASS() [8/36]

dart::COMPILER_PASS ( Canonicalize  ,
{ if(flow_graph->Canonicalize()) { flow_graph->Canonicalize();} }   
)

◆ COMPILER_PASS() [9/36]

dart::COMPILER_PASS ( ComputeSSA  ,
{ flow_graph->ComputeSSA(nullptr);}   
)

◆ COMPILER_PASS() [10/36]

dart::COMPILER_PASS ( DCE  ,
{ DeadCodeElimination::EliminateDeadCode(flow_graph);}   
)

◆ COMPILER_PASS() [11/36]

dart::COMPILER_PASS ( DelayAllocations  ,
{ DelayAllocations::Optimize(flow_graph);}   
)

◆ COMPILER_PASS() [12/36]

dart::COMPILER_PASS ( DSE  ,
{ DeadStoreElimination::Optimize(flow_graph);}   
)

◆ COMPILER_PASS() [13/36]

dart::COMPILER_PASS ( EliminateDeadPhis  ,
{ DeadCodeElimination::EliminateDeadPhis(flow_graph);}   
)

◆ COMPILER_PASS() [14/36]

dart::COMPILER_PASS ( EliminateEnvironments  ,
{ flow_graph->EliminateEnvironments();}   
)

◆ COMPILER_PASS() [15/36]

dart::COMPILER_PASS ( EliminateStackOverflowChecks  ,
{ if(!flow_graph->IsCompiledForOsr()) { CheckStackOverflowElimination::EliminateStackOverflow(flow_graph);} }   
)

◆ COMPILER_PASS() [16/36]

dart::COMPILER_PASS ( EliminateWriteBarriers  ,
{ EliminateWriteBarriers(flow_graph);}   
)

◆ COMPILER_PASS() [17/36]

dart::COMPILER_PASS ( FinalizeGraph  ,
{ intptr_t instruction_count=0;intptr_t call_site_count=0;FlowGraphInliner::CollectGraphInfo(flow_graph, 0, true, &instruction_count, &call_site_count);flow_graph->function().set_inlining_depth(state->inlining_depth);flow_graph->RemoveRedefinitions();}   
)

◆ COMPILER_PASS() [18/36]

dart::COMPILER_PASS ( GenerateCode  ,
{ state->graph_compiler->CompileGraph();}   
)

◆ COMPILER_PASS() [19/36]

dart::COMPILER_PASS ( IfConvert  ,
{ IfConverter::Simplify(flow_graph);}   
)

◆ COMPILER_PASS() [20/36]

dart::COMPILER_PASS ( Inlining  ,
{ FlowGraphInliner inliner(flow_graph, &state->inline_id_to_function, &state->inline_id_to_token_pos, &state->caller_inline_id, state->speculative_policy, state->precompiler);state->inlining_depth=inliner.Inline();}   
)

◆ COMPILER_PASS() [21/36]

dart::COMPILER_PASS ( LICM  ,
{ flow_graph->RenameUsesDominatedByRedefinitions();DEBUG_ASSERT(flow_graph->VerifyRedefinitions());LICM licm(flow_graph);licm.Optimize();flow_graph->RemoveRedefinitions(true);}   
)

◆ COMPILER_PASS() [22/36]

dart::COMPILER_PASS ( LoweringAfterCodeMotionDisabled  ,
{ flow_graph->ExtractNonInternalTypedDataPayloads();}   
)

◆ COMPILER_PASS() [23/36]

dart::COMPILER_PASS ( OptimisticallySpecializeSmiPhis  ,
{ LICM licm(flow_graph);licm.OptimisticallySpecializeSmiPhis();}   
)

◆ COMPILER_PASS() [24/36]

dart::COMPILER_PASS ( OptimizeBranches  ,
{ ConstantPropagator::OptimizeBranches(flow_graph);}   
)

◆ COMPILER_PASS() [25/36]

dart::COMPILER_PASS ( OptimizeTypedDataAccesses  ,
{ TypedDataSpecializer::Optimize(flow_graph);}   
)

◆ COMPILER_PASS() [26/36]

dart::COMPILER_PASS ( RangeAnalysis  ,
{ RangeAnalysis range_analysis(flow_graph);range_analysis.Analyze();}   
)

◆ COMPILER_PASS() [27/36]

dart::COMPILER_PASS ( ReorderBlocks  ,
{ BlockScheduler::ReorderBlocks(flow_graph);}   
)

◆ COMPILER_PASS() [28/36]

dart::COMPILER_PASS ( SelectRepresentations  ,
{ flow_graph->SelectRepresentations();}   
)

◆ COMPILER_PASS() [29/36]

dart::COMPILER_PASS ( SelectRepresentations_Final  ,
{ flow_graph->SelectRepresentations();flow_graph->disallow_unmatched_representations();}   
)

◆ COMPILER_PASS() [30/36]

dart::COMPILER_PASS ( SetOuterInliningId  ,
{ FlowGraphInliner::SetInliningId(flow_graph, 0);}   
)

◆ COMPILER_PASS() [31/36]

dart::COMPILER_PASS ( TestILSerialization  ,
{ if(FLAG_test_il_serialization &&CompilerState::Current().is_aot()) { Zone *zone=flow_graph->zone();auto *detached_defs=new(zone) ZoneGrowableArray< Definition * >(zone, 0);flow_graph->CompactSSA(detached_defs);ZoneWriteStream write_stream(flow_graph->zone(), 1024);FlowGraphSerializer serializer(&write_stream);serializer.WriteFlowGraph(*flow_graph, *detached_defs);ReadStream read_stream(write_stream.buffer(), write_stream.bytes_written());FlowGraphDeserializer deserializer(flow_graph->parsed_function(), &read_stream);state->set_flow_graph(deserializer.ReadFlowGraph());} }   
)

◆ COMPILER_PASS() [32/36]

dart::COMPILER_PASS ( TryCatchOptimization  ,
{ OptimizeCatchEntryStates(flow_graph, CompilerState::Current().is_aot());}   
)

◆ COMPILER_PASS() [33/36]

dart::COMPILER_PASS ( TryOptimizePatterns  ,
{ flow_graph->TryOptimizePatterns();}   
)

◆ COMPILER_PASS() [34/36]

dart::COMPILER_PASS ( TypePropagation  ,
{ FlowGraphTypePropagator::Propagate(flow_graph);}   
)

◆ COMPILER_PASS() [35/36]

dart::COMPILER_PASS ( UseTableDispatch  ,
{ state->call_specializer->ReplaceInstanceCallsWithDispatchTableCalls();}   
)

◆ COMPILER_PASS() [36/36]

dart::COMPILER_PASS ( WidenSmiToInt32  ,
{ flow_graph->WidenSmiToInt32();}   
)

◆ COMPILER_PASS_REPEAT() [1/2]

dart::COMPILER_PASS_REPEAT ( ConstantPropagation  ,
{ ConstantPropagator::Optimize(flow_graph);return true;}   
)

◆ COMPILER_PASS_REPEAT() [2/2]

dart::COMPILER_PASS_REPEAT ( CSE  ,
{ return DominatorBasedCSE::Optimize(flow_graph);}   
)

◆ ComponentContext()

sys::ComponentContext * dart::ComponentContext ( )

◆ ComputeArrayElementType()

static CompileType dart::ComputeArrayElementType ( Value array)
static

Definition at line 1864 of file type_propagator.cc.

1864 {
1865 // 1. Try to extract element type from array value.
1866 auto& elem_type = AbstractType::Handle(GetElementTypeFromArray(array));
1867 if (!elem_type.IsDynamicType()) {
1868 return CompileType::FromAbstractType(elem_type, CompileType::kCanBeNull,
1869 CompileType::kCannotBeSentinel);
1870 }
1871
1872 // 2. Array value may be loaded from GrowableObjectArray.data.
1873 // Unwrap and try again.
1874 if (auto* load_field = array->definition()->AsLoadField()) {
1875 if (load_field->slot().IsIdentical(Slot::GrowableObjectArray_data())) {
1876 array = load_field->instance();
1877 elem_type = GetElementTypeFromArray(array);
1878 if (!elem_type.IsDynamicType()) {
1879 return CompileType::FromAbstractType(elem_type, CompileType::kCanBeNull,
1880 CompileType::kCannotBeSentinel);
1881 }
1882 }
1883 }
1884
1885 // 3. If array was loaded from a Dart field, use field's static type.
1886 // Unlike propagated type (which could be cid), static type may contain
1887 // type arguments which can be used to figure out element type.
1888 if (auto* load_field = array->definition()->AsLoadField()) {
1889 if (load_field->slot().IsDartField()) {
1890 elem_type = load_field->slot().field().type();
1891 elem_type = ExtractElementTypeFromArrayType(elem_type);
1892 }
1893 }
1894
1895 return CompileType::FromAbstractType(elem_type, CompileType::kCanBeNull,
1896 CompileType::kCannotBeSentinel);
1897}
static AbstractTypePtr GetElementTypeFromArray(Value *array)
static AbstractTypePtr ExtractElementTypeFromArrayType(const AbstractType &array_type)

◆ ComputeExtraLoopInfo()

static ExtraLoopInfo * dart::ComputeExtraLoopInfo ( Zone zone,
LoopInfo loop_info 
)
static

Definition at line 68 of file linearscan.cc.

68 {
69 intptr_t start = loop_info->header()->start_pos();
70 intptr_t end = start;
71 for (auto back_edge : loop_info->back_edges()) {
72 intptr_t end_pos = back_edge->end_pos();
73 if (end_pos > end) {
74 end = end_pos;
75 }
76 }
77 return new (zone) ExtraLoopInfo(start, end);
78}
intptr_t start_pos() const
Definition il.h:1660
BlockEntryInstr * header() const
Definition loops.h:252

◆ ComputeInduction()

static const char * dart::ComputeInduction ( Thread thread,
const char *  script_chars 
)
static

Definition at line 65 of file loops_test.cc.

65 {
66 // Load the script and exercise the code once.
67 const auto& root_library = Library::Handle(LoadTestScript(script_chars));
68 Invoke(root_library, "main");
69
70 std::initializer_list<CompilerPass::Id> passes = {
71 CompilerPass::kComputeSSA,
72 CompilerPass::kTypePropagation,
73 CompilerPass::kApplyICData,
74 CompilerPass::kTypePropagation,
75 CompilerPass::kSelectRepresentations,
76 CompilerPass::kTypePropagation,
77 CompilerPass::kCanonicalize,
78 };
79 const auto& function = Function::Handle(GetFunction(root_library, "foo"));
80 TestPipeline pipeline(function, CompilerPass::kJIT);
81 FlowGraph* flow_graph = pipeline.RunPasses(passes);
82
83 // Build loop hierarchy and find induction.
84 const LoopHierarchy& hierarchy = flow_graph->GetLoopHierarchy();
85 hierarchy.ComputeInduction();
86 flow_graph->RemoveRedefinitions(); // don't query later
87
88 // Construct and return a debug string for testing.
89 char buffer[1024];
90 BufferFormatter f(buffer, sizeof(buffer));
91 TestString(&f, hierarchy.top(), flow_graph->preorder());
92 return Thread::Current()->zone()->MakeCopyOfString(buffer);
93}

◆ ComputeKernelServicePath()

static char * dart::ComputeKernelServicePath ( const char *  arg)
static

Definition at line 66 of file benchmark_test.cc.

66 {
67 char buffer[2048];
68 char* kernel_service_path =
69 Utils::StrDup(File::GetCanonicalPath(nullptr, arg));
70 EXPECT(kernel_service_path != nullptr);
71 const char* compiler_path = "%s%sgen%skernel_service.dill";
72 const char* path_separator = File::PathSeparator();
73 ASSERT(path_separator != nullptr && strlen(path_separator) == 1);
74 char* ptr = strrchr(kernel_service_path, *path_separator);
75 while (ptr != nullptr) {
76 *ptr = '\0';
77 Utils::SNPrint(buffer, ARRAY_SIZE(buffer), compiler_path,
78 kernel_service_path, path_separator, path_separator);
79 if (File::Exists(nullptr, buffer)) {
80 break;
81 }
82 ptr = strrchr(kernel_service_path, *path_separator);
83 }
84 free(kernel_service_path);
85 if (ptr == nullptr) {
86 return nullptr;
87 }
88 return Utils::StrDup(buffer);
89}
static const char * GetCanonicalPath(Namespace *namespc, const char *path, char *dest=nullptr, int dest_size=0)
static const char * PathSeparator()
static bool Exists(Namespace *namespc, const char *path)
#define ARRAY_SIZE(array)
Definition globals.h:72

◆ ComputeListFactoryType()

static CompileType dart::ComputeListFactoryType ( CompileType inferred_type,
Value type_args_value 
)
static

Definition at line 1547 of file type_propagator.cc.

1548 {
1549 ASSERT(inferred_type != nullptr);
1550 const intptr_t cid = inferred_type->ToNullableCid();
1551 ASSERT(cid != kDynamicCid);
1552 if ((cid == kGrowableObjectArrayCid || cid == kArrayCid ||
1553 cid == kImmutableArrayCid) &&
1554 type_args_value->BindsToConstant()) {
1555 Thread* thread = Thread::Current();
1556 Zone* zone = thread->zone();
1557 const Class& cls =
1558 Class::Handle(zone, thread->isolate_group()->class_table()->At(cid));
1559 auto& type_args = TypeArguments::Handle(zone);
1560 if (!type_args_value->BoundConstant().IsNull()) {
1561 type_args ^= type_args_value->BoundConstant().ptr();
1562 ASSERT(type_args.Length() >= cls.NumTypeArguments());
1563 type_args = type_args.FromInstanceTypeArguments(thread, cls);
1564 }
1565 Type& type = Type::ZoneHandle(
1566 zone, Type::New(cls, type_args, Nullability::kNonNullable));
1567 ASSERT(type.IsInstantiated());
1568 type.SetIsFinalized();
1569 return CompileType(CompileType::kCannotBeNull,
1570 CompileType::kCannotBeSentinel, cid, &type);
1571 }
1572 return *inferred_type;
1573}
intptr_t NumTypeArguments() const
Definition object.cc:3690

◆ ComputePhiMoves()

static PhiPlaceMoves * dart::ComputePhiMoves ( PointerSet< Place > *  map,
ZoneGrowableArray< Place * > *  places,
bool  print_traces 
)
static

Definition at line 1315 of file redundancy_elimination.cc.

1317 {
1318 Thread* thread = Thread::Current();
1319 Zone* zone = thread->zone();
1320 PhiPlaceMoves* phi_moves = new (zone) PhiPlaceMoves();
1321
1322 for (intptr_t i = 0; i < places->length(); i++) {
1323 Place* place = (*places)[i];
1324
1325 if (IsPhiDependentPlace(place)) {
1326 PhiInstr* phi = place->instance()->AsPhi();
1327 BlockEntryInstr* block = phi->GetBlock();
1328
1329 if (FLAG_trace_optimization && print_traces) {
1330 THR_Print("phi dependent place %s\n", place->ToCString());
1331 }
1332
1333 Place input_place(*place);
1334 for (intptr_t j = 0; j < phi->InputCount(); j++) {
1335 input_place.set_instance(phi->InputAt(j)->definition());
1336
1337 Place* result = map->LookupValue(&input_place);
1338 if (result == nullptr) {
1339 result = Place::Wrap(zone, input_place, places->length());
1340 map->Insert(result);
1341 places->Add(result);
1342 if (FLAG_trace_optimization && print_traces) {
1343 THR_Print(" adding place %s as %" Pd "\n", result->ToCString(),
1344 result->id());
1345 }
1346 }
1347 phi_moves->CreateOutgoingMove(zone, block->PredecessorAt(j),
1348 result->id(), place->id());
1349 }
1350 }
1351 }
1352
1353 return phi_moves;
1354}
virtual BlockEntryInstr * PredecessorAt(intptr_t index) const =0
virtual BlockEntryInstr * GetBlock()
Definition il.h:2798
void CreateOutgoingMove(Zone *zone, BlockEntryInstr *block, intptr_t from, intptr_t to)
Definition * instance() const
const char * ToCString() const
intptr_t id() const
static bool IsPhiDependentPlace(Place *place)

◆ ComputeTimeout()

static int64_t dart::ComputeTimeout ( int64_t  idle_start)
static

Definition at line 18 of file thread_pool.cc.

18 {
19 int64_t worker_timeout_micros =
20 FLAG_worker_timeout_millis * kMicrosecondsPerMillisecond;
21 if (worker_timeout_micros <= 0) {
22 // No timeout.
23 return 0;
24 } else {
25 int64_t waited = OS::GetCurrentMonotonicMicros() - idle_start;
26 if (waited >= worker_timeout_micros) {
27 // We must have gotten a spurious wakeup just before we timed
28 // out. Give the worker one last desperate chance to live. We
29 // are merciful.
30 return 1;
31 } else {
32 return worker_timeout_micros - waited;
33 }
34 }
35}
constexpr uint64_t kMicrosecondsPerMillisecond

◆ ComputeTypeCheckTarget()

static FunctionPtr dart::ComputeTypeCheckTarget ( const Instance receiver,
const AbstractType type,
const ArgumentsDescriptor desc 
)
static

Definition at line 1720 of file runtime_entry.cc.

1722 {
1723 const bool result = receiver.IsInstanceOf(type, Object::null_type_arguments(),
1724 Object::null_type_arguments());
1725 const ObjectStore* store = IsolateGroup::Current()->object_store();
1726 const Function& target =
1727 Function::Handle(result ? store->simple_instance_of_true_function()
1728 : store->simple_instance_of_false_function());
1729 ASSERT(!target.IsNull());
1730 return target.ptr();
1731}
bool IsInstanceOf(const AbstractType &other, const TypeArguments &other_instantiator_type_arguments, const TypeArguments &other_function_type_arguments) const
Definition object.cc:20655
uint32_t * target

◆ Concat()

static const char * dart::Concat ( const char *  a,
const char *  b 
)
static

Definition at line 86 of file file_test.cc.

86 {
87 const intptr_t len = strlen(a) + strlen(b);
88 char* c = bin::DartUtils::ScopedCString(len + 1);
89 EXPECT_NOTNULL(c);
90 snprintf(c, len + 1, "%s%s", a, b);
91 return c;
92}

◆ ConcreteRegister() [1/2]

Register dart::ConcreteRegister ( LinkRegister  )
inline

Definition at line 1332 of file constants_arm.h.

1332 {
1333 return LR;
1334}

◆ ConcreteRegister() [2/2]

static Register dart::ConcreteRegister ( Register  r)
inlinestatic

Definition at line 636 of file constants_arm64.h.

636 {
637 return ((r == ZR) || (r == CSP)) ? R31 : r;
638}

◆ ConstructFunctionFullyQualifiedCString()

static intptr_t dart::ConstructFunctionFullyQualifiedCString ( const Function function,
char **  chars,
intptr_t  reserve_len,
bool  with_lib,
QualifiedFunctionLibKind  lib_kind 
)
static

Definition at line 9759 of file object.cc.

9764 {
9765 Zone* zone = Thread::Current()->zone();
9766 const char* name = String::Handle(zone, function.name()).ToCString();
9767 const char* function_format = (reserve_len == 0) ? "%s" : "%s_";
9768 reserve_len += Utils::SNPrint(nullptr, 0, function_format, name);
9769 const Function& parent = Function::Handle(zone, function.parent_function());
9770 intptr_t written = 0;
9771 if (parent.IsNull()) {
9772 const Class& function_class = Class::Handle(zone, function.Owner());
9773 ASSERT(!function_class.IsNull());
9774 const char* class_name =
9775 String::Handle(zone, function_class.Name()).ToCString();
9776 ASSERT(class_name != nullptr);
9777 const char* library_name = nullptr;
9778 const char* lib_class_format = nullptr;
9779 if (with_lib) {
9780 const Library& library = Library::Handle(zone, function_class.library());
9781 ASSERT(!library.IsNull());
9782 switch (lib_kind) {
9784 library_name = String::Handle(zone, library.url()).ToCString();
9785 break;
9787 library_name = String::Handle(zone, library.name()).ToCString();
9788 break;
9789 default:
9790 UNREACHABLE();
9791 }
9792 ASSERT(library_name != nullptr);
9793 lib_class_format = (library_name[0] == '\0') ? "%s%s_" : "%s_%s_";
9794 } else {
9795 library_name = "";
9796 lib_class_format = "%s%s.";
9797 }
9798 reserve_len +=
9799 Utils::SNPrint(nullptr, 0, lib_class_format, library_name, class_name);
9800 ASSERT(chars != nullptr);
9801 *chars = zone->Alloc<char>(reserve_len + 1);
9802 written = Utils::SNPrint(*chars, reserve_len + 1, lib_class_format,
9803 library_name, class_name);
9804 } else {
9805 written = ConstructFunctionFullyQualifiedCString(parent, chars, reserve_len,
9806 with_lib, lib_kind);
9807 }
9808 ASSERT(*chars != nullptr);
9809 char* next = *chars + written;
9810 written += Utils::SNPrint(next, reserve_len + 1, function_format, name);
9811 // Replace ":" with "_".
9812 while (true) {
9813 next = strchr(next, ':');
9814 if (next == nullptr) break;
9815 *next = '_';
9816 }
9817 return written;
9818}
static float next(float f)
LibraryPtr library() const
Definition object.h:1335
StringPtr Name() const
Definition object.cc:3038
StringPtr name() const
Definition object.h:5065
StringPtr url() const
Definition object.h:5068
ElementType * Alloc(intptr_t length)
const char *const class_name
static intptr_t ConstructFunctionFullyQualifiedCString(const Function &function, char **chars, intptr_t reserve_len, bool with_lib, QualifiedFunctionLibKind lib_kind)
Definition object.cc:9759

◆ ConstructImmutableMap()

static MapPtr dart::ConstructImmutableMap ( const Array input_data,
intptr_t  used_data,
const TypeArguments type_arguments 
)
static

Definition at line 6749 of file object_test.cc.

6750 {
6751 const uint32_t index_val = index2.GetUint32(i * kElementSize);
6752 THR_Print("LinkedHashBaseEqual index2[%" Pd "] %" Px32 "\n", i,
6753 index_val);
6754 }
6755 }
6756 return index_equal;
6757}
6758
6759// Copies elements from data.
6760static MapPtr ConstructImmutableMap(const Array& input_data,
6761 intptr_t used_data,
6762 const TypeArguments& type_arguments) {
6763 auto& map = Map::Handle(ConstMap::NewUninitialized());
6764
6765 const auto& data = Array::Handle(Array::New(used_data));
6766 for (intptr_t i = 0; i < used_data; i++) {
static MapPtr ConstructImmutableMap(const Array &input_data, intptr_t used_data, const TypeArguments &type_arguments)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot data
Definition switches.h:41
#define Px32
Definition globals.h:414

◆ ConstructImmutableSet()

static SetPtr dart::ConstructImmutableSet ( const Array input_data,
intptr_t  used_data,
const TypeArguments type_arguments 
)
static

Definition at line 7138 of file object_test.cc.

7151 {
7152 auto& set = Set::Handle(ConstSet::NewUninitialized());
7153
7154 const auto& data = Array::Handle(Array::New(used_data));
7155 for (intptr_t i = 0; i < used_data; i++) {

◆ ContainsNonInstance()

static bool dart::ContainsNonInstance ( const Object obj)
static

Definition at line 1790 of file service.cc.

1790 {
1791 if (obj.IsArray()) {
1792 const Array& array = Array::Cast(obj);
1793 Object& element = Object::Handle();
1794 for (intptr_t i = 0; i < array.Length(); ++i) {
1795 element = array.At(i);
1796 if (!(element.IsInstance() || element.IsNull())) {
1797 return true;
1798 }
1799 }
1800 return false;
1801 } else if (obj.IsGrowableObjectArray()) {
1802 const GrowableObjectArray& array = GrowableObjectArray::Cast(obj);
1803 Object& element = Object::Handle();
1804 for (intptr_t i = 0; i < array.Length(); ++i) {
1805 element = array.At(i);
1806 if (!(element.IsInstance() || element.IsNull())) {
1807 return true;
1808 }
1809 }
1810 return false;
1811 } else {
1812 return !(obj.IsInstance() || obj.IsNull());
1813 }
1814}

◆ ContainsScriptUri()

static bool dart::ContainsScriptUri ( const GrowableArray< const char * > &  seen_uris,
const char *  uri 
)
static

Definition at line 1450 of file isolate_reload.cc.

1451 {
1452 for (intptr_t i = 0; i < seen_uris.length(); i++) {
1453 const char* seen_uri = seen_uris.At(i);
1454 size_t seen_len = strlen(seen_uri);
1455 if (seen_len != strlen(uri)) {
1456 continue;
1457 } else if (strncmp(seen_uri, uri, seen_len) == 0) {
1458 return true;
1459 }
1460 }
1461 return false;
1462}

◆ ContentsFinalizer()

static void dart::ContentsFinalizer ( void *  isolate_callback_data,
void *  peer 
)
static

Definition at line 322 of file vmservice.cc.

322 {
323 uint8_t* data = reinterpret_cast<uint8_t*>(peer);
324 delete[] data;
325}

◆ ConvertNonLatin1ToLatin1()

static uint16_t dart::ConvertNonLatin1ToLatin1 ( uint16_t  c)
static

Definition at line 1962 of file regexp.cc.

1962 {
1963 ASSERT(c > Symbols::kMaxOneCharCodeSymbol);
1964 switch (c) {
1965 // This are equivalent characters in unicode.
1966 case 0x39c:
1967 case 0x3bc:
1968 return 0xb5;
1969 // This is an uppercase of a Latin-1 character
1970 // outside of Latin-1.
1971 case 0x178:
1972 return 0xff;
1973 }
1974 return 0;
1975}

◆ ConvertRangeToSigned()

static void dart::ConvertRangeToSigned ( uint64_t  a,
uint64_t  b,
int64_t *  sa,
int64_t *  sb 
)
static

Definition at line 2266 of file range_analysis.cc.

2269 {
2270 ASSERT(a <= b);
2271 if ((a <= static_cast<uint64_t>(kMaxInt64)) &&
2272 (b >= static_cast<uint64_t>(kMinInt64))) {
2273 // Range contains kMinInt64 and kMaxInt64 and wraps-around as signed.
2274 *sa = kMinInt64;
2275 *sb = kMaxInt64;
2276 } else {
2277 // Range is fully in the negative or non-negative part
2278 // and doesn't wrap-around if interpreted as signed.
2279 *sa = static_cast<int64_t>(a);
2280 *sb = static_cast<int64_t>(b);
2281 }
2282}

◆ ConvertRangeToUnsigned()

static void dart::ConvertRangeToUnsigned ( int64_t  a,
int64_t  b,
uint64_t *  ua,
uint64_t *  ub 
)
static

Definition at line 2249 of file range_analysis.cc.

2252 {
2253 ASSERT(a <= b);
2254 if ((a < 0) && (b >= 0)) {
2255 // Range contains -1 and 0 and wraps-around as unsigned.
2256 *ua = 0;
2257 *ub = kMaxUint64;
2258 } else {
2259 // Range is fully in the negative or non-negative part
2260 // and doesn't wrap-around if interpreted as unsigned.
2261 *ua = static_cast<uint64_t>(a);
2262 *ub = static_cast<uint64_t>(b);
2263 }
2264}
constexpr uint64_t kMaxUint64
Definition globals.h:487

◆ CoordinateElemAt1()

DART_EXPORT Coord * dart::CoordinateElemAt1 ( Coord coord)

Definition at line 564 of file ffi_test_functions.cc.

564 {
565 std::cout << "CoordinateElemAt1(" << coord << ")\n";
566 std::cout << "sizeof(Coord): " << sizeof(Coord) << "\n";
567 std::cout << "coord[0] = {" << coord[0].x << ", " << coord[0].y << ", "
568 << coord[0].next << "}\n";
569 std::cout << "coord[1] = {" << coord[1].x << ", " << coord[1].y << ", "
570 << coord[1].next << "}\n";
571 Coord* retval = coord + 1;
572 std::cout << "returning " << retval << "\n";
573 return retval;
574}
double x

◆ CoordinateUnOpTrice()

DART_EXPORT Coord * dart::CoordinateUnOpTrice ( CoordUnOp  unop,
Coord coord 
)

Definition at line 581 of file ffi_test_functions.cc.

581 {
582 std::cout << "CoordinateUnOpTrice(" << &unop << ", " << coord << ")\n";
583 Coord* retval = unop(unop(unop(coord)));
584 std::cout << "returning " << retval << "\n";
585 return retval;
586}

◆ CopyMutableObjectGraph()

ObjectPtr dart::CopyMutableObjectGraph ( const Object object)

Definition at line 2722 of file object_graph_copy.cc.

2722 {
2723 auto thread = Thread::Current();
2724 TIMELINE_DURATION(thread, Isolate, "CopyMutableObjectGraph");
2725 ObjectGraphCopier copier(thread);
2726 ObjectPtr result = copier.CopyObjectGraph(object);
2727#if defined(SUPPORT_TIMELINE)
2728 if (tbes.enabled()) {
2729 tbes.SetNumArguments(2);
2730 tbes.FormatArgument(0, "CopiedObjects", "%" Pd, copier.copied_objects());
2731 tbes.FormatArgument(1, "AllocatedBytes", "%" Pd, copier.allocated_bytes());
2732 }
2733#endif
2734 return result;
2735}
#define TIMELINE_DURATION(thread, stream, name)
Definition timeline.h:39

◆ CopySavedRegisters()

static void dart::CopySavedRegisters ( uword  saved_registers_address,
fpu_register_t **  fpu_registers,
intptr_t **  cpu_registers 
)
static

Definition at line 3515 of file runtime_entry.cc.

3517 {
3518 // Tell MemorySanitizer this region is initialized by generated code. This
3519 // region isn't already (fully) unpoisoned by FrameSetIterator::Unpoison
3520 // because it is in an exit frame and stack frame iteration doesn't have
3521 // access to true SP for exit frames.
3522 MSAN_UNPOISON(reinterpret_cast<void*>(saved_registers_address),
3523 kNumberOfSavedFpuRegisters * kFpuRegisterSize +
3524 kNumberOfSavedCpuRegisters * kWordSize);
3525
3526 ASSERT(sizeof(fpu_register_t) == kFpuRegisterSize);
3527 fpu_register_t* fpu_registers_copy =
3529 ASSERT(fpu_registers_copy != nullptr);
3530 for (intptr_t i = 0; i < kNumberOfSavedFpuRegisters; i++) {
3531 fpu_registers_copy[i] =
3532 *reinterpret_cast<fpu_register_t*>(saved_registers_address);
3533 saved_registers_address += kFpuRegisterSize;
3534 }
3535 *fpu_registers = fpu_registers_copy;
3536
3537 ASSERT(sizeof(intptr_t) == kWordSize);
3538 intptr_t* cpu_registers_copy = new intptr_t[kNumberOfSavedCpuRegisters];
3539 ASSERT(cpu_registers_copy != nullptr);
3540 for (intptr_t i = 0; i < kNumberOfSavedCpuRegisters; i++) {
3541 cpu_registers_copy[i] =
3542 *reinterpret_cast<intptr_t*>(saved_registers_address);
3543 saved_registers_address += kWordSize;
3544 }
3545 *cpu_registers = cpu_registers_copy;
3546}
#define MSAN_UNPOISON(ptr, len)
static constexpr intptr_t kNumberOfSavedFpuRegisters
const int kFpuRegisterSize

◆ CopyStackBuffer()

static void dart::CopyStackBuffer ( Sample sample,
uword  sp_addr 
)
static

Definition at line 1137 of file profiler.cc.

1137 {
1138 ASSERT(sample != nullptr);
1139 uword* sp = reinterpret_cast<uword*>(sp_addr);
1140 uword* buffer = sample->GetStackBuffer();
1141 if (sp != nullptr) {
1142 for (intptr_t i = 0; i < Sample::kStackBufferSizeInWords; i++) {
1143 MSAN_UNPOISON(sp, kWordSize);
1144 ASAN_UNPOISON(sp, kWordSize);
1145 buffer[i] = *sp;
1146 sp++;
1147 }
1148 }
1149}
#define ASAN_UNPOISON(ptr, len)
uword * GetStackBuffer()
Definition profiler.h:366

◆ CopyTypedDataBaseWithSafepointChecks()

template<typename T >
void dart::CopyTypedDataBaseWithSafepointChecks ( Thread thread,
const T from,
const T to,
intptr_t  length 
)

Definition at line 316 of file object_graph_copy.cc.

319 {
320 constexpr intptr_t kChunkSize = 100 * 1024;
321
322 const intptr_t chunks = length / kChunkSize;
323 const intptr_t remainder = length % kChunkSize;
324
325 // Notice we re-load the data pointer, since T may be TypedData in which case
326 // the interior pointer may change after checking into safepoints.
327 for (intptr_t i = 0; i < chunks; ++i) {
328 memmove(to.ptr().untag()->data_ + i * kChunkSize,
329 from.ptr().untag()->data_ + i * kChunkSize, kChunkSize);
330
331 thread->CheckForSafepoint();
332 }
333 if (remainder > 0) {
334 memmove(to.ptr().untag()->data_ + chunks * kChunkSize,
335 from.ptr().untag()->data_ + chunks * kChunkSize, remainder);
336 }
337}
void CheckForSafepoint()
Definition thread.h:1091

◆ CountBoundChecks()

static intptr_t dart::CountBoundChecks ( FlowGraph flow_graph)
static

Definition at line 20 of file bce_test.cc.

20 {
21 intptr_t count = 0;
22 for (BlockIterator block_it = flow_graph->reverse_postorder_iterator();
23 !block_it.Done(); block_it.Advance()) {
24 for (ForwardInstructionIterator it(block_it.Current()); !it.Done();
25 it.Advance()) {
26 if (it.Current()->IsCheckBoundBase()) {
27 count++;
28 }
29 }
30 }
31 return count;
32}
BlockIterator reverse_postorder_iterator() const
Definition flow_graph.h:219

◆ CountFinalizedSubclasses()

static intptr_t dart::CountFinalizedSubclasses ( Thread thread,
const Class cls 
)
static

Definition at line 177 of file cha.cc.

177 {
178 intptr_t count = 0;
179 const GrowableObjectArray& cls_direct_subclasses =
180 GrowableObjectArray::Handle(thread->zone(), cls.direct_subclasses());
181 if (cls_direct_subclasses.IsNull()) return count;
182 Class& direct_subclass = Class::Handle(thread->zone());
183 for (intptr_t i = 0; i < cls_direct_subclasses.Length(); i++) {
184 direct_subclass ^= cls_direct_subclasses.At(i);
185 // Unfinalized classes are treated as nonexistent for CHA purposes,
186 // as that means that no instance of that class exists at runtime.
187 if (!direct_subclass.is_finalized()) {
188 continue;
189 }
190
191 count += 1 + CountFinalizedSubclasses(thread, direct_subclass);
192 }
193 return count;
194}
GrowableObjectArrayPtr direct_subclasses() const
Definition object.h:1539
intptr_t Length() const
Definition object.h:11046
ObjectPtr At(intptr_t index) const
Definition object.h:11059

◆ CountLoadsStores()

static void dart::CountLoadsStores ( FlowGraph flow_graph,
intptr_t *  loads,
intptr_t *  stores 
)
static

Definition at line 861 of file redundancy_elimination_test.cc.

863 {
864 for (BlockIterator block_it = flow_graph->reverse_postorder_iterator();
865 !block_it.Done(); block_it.Advance()) {
866 for (ForwardInstructionIterator it(block_it.Current()); !it.Done();
867 it.Advance()) {
868 if (it.Current()->IsLoadField()) {
869 (*loads)++;
870 } else if (it.Current()->IsStoreField()) {
871 (*stores)++;
872 }
873 }
874 }
875}

◆ CreateAndSetupServiceIsolate()

static Dart_Isolate dart::CreateAndSetupServiceIsolate ( const char *  script_uri,
const char *  packages_config,
Dart_IsolateFlags flags,
char **  error 
)
static

Definition at line 104 of file run_vm_tests.cc.

107 {
108 // We only enable the vm-service for this particular test.
109 // The vm-service seems to have some shutdown race which would cause other
110 // vm/cc tests to randomly time out due to inability to shut service-isolate
111 // down.
112 // Issue(https://dartbug.com/37741):
113 if ((strcmp(run_filter, "DartAPI_InvokeVMServiceMethod") != 0) &&
114 (strcmp(run_filter, "DartAPI_InvokeVMServiceMethod_Loop") != 0)) {
115 return nullptr;
116 }
117
118 ASSERT(script_uri != nullptr);
119 Dart_Isolate isolate = nullptr;
120 auto isolate_group_data = new bin::IsolateGroupData(
121 script_uri, packages_config, /*app_snapshot=*/nullptr,
122 /*isolate_run_app_snapshot=*/false);
123
124 const uint8_t* kernel_buffer = nullptr;
125 intptr_t kernel_buffer_size = 0;
126
127 bin::dfe.Init();
128 bin::dfe.LoadPlatform(&kernel_buffer, &kernel_buffer_size);
129 RELEASE_ASSERT(kernel_buffer != nullptr);
130
131 flags->load_vmservice_library = true;
132 flags->is_service_isolate = true;
133 isolate_group_data->SetKernelBufferUnowned(
134 const_cast<uint8_t*>(kernel_buffer), kernel_buffer_size);
136 script_uri, DART_VM_SERVICE_ISOLATE_NAME, kernel_buffer,
137 kernel_buffer_size, flags, isolate_group_data, /*isolate_data=*/nullptr,
138 error);
139 if (isolate == nullptr) {
140 delete isolate_group_data;
141 return nullptr;
142 }
143
145
147 Dart_SetLibraryTagHandler(bin::Loader::LibraryTagHandler);
149
150 // Load embedder specific bits and return.
151 if (!bin::VmService::Setup("127.0.0.1", 0,
152 /*dev_mode=*/false, /*auth_disabled=*/true,
153 /*write_service_info_filename=*/"",
154 /*trace_loading=*/false, /*deterministic=*/true,
155 /*enable_service_port_fallback=*/false,
156 /*wait_for_dds_to_advertise_service=*/false,
157 /*serve_devtools=*/false,
158 /*serve_observatory=*/true,
159 /*print_dtd=*/false)) {
160 *error = Utils::StrDup(bin::VmService::GetErrorMessage());
161 return nullptr;
162 }
163 result = Dart_SetEnvironmentCallback(bin::DartUtils::EnvironmentCallback);
167 return isolate;
168}
DART_EXPORT Dart_Handle Dart_SetEnvironmentCallback(Dart_EnvironmentCallback callback)
DART_EXPORT Dart_Isolate Dart_CreateIsolateGroupFromKernel(const char *script_uri, const char *name, const uint8_t *kernel_buffer, intptr_t kernel_buffer_size, Dart_IsolateFlags *flags, void *isolate_group_data, void *isolate_data, char **error)
#define DART_VM_SERVICE_ISOLATE_NAME
Definition dart_api.h:3831
DART_EXPORT Dart_Handle Dart_SetLibraryTagHandler(Dart_LibraryTagHandler handler)
#define CHECK_RESULT(result)

◆ CreateCallableArgumentsFromStatic()

static ArrayPtr dart::CreateCallableArgumentsFromStatic ( Zone zone,
const Instance receiver,
const Array static_args,
const Array arg_names,
const ArgumentsDescriptor static_args_descriptor 
)
static

Definition at line 4707 of file object.cc.

4712 {
4713 const intptr_t num_static_type_args = static_args_descriptor.TypeArgsLen();
4714 const intptr_t num_static_args = static_args_descriptor.Count();
4715 // Double check that the static args descriptor expects boxed arguments
4716 // and the static args descriptor is consistent with the static arguments.
4717 ASSERT_EQUAL(static_args_descriptor.Size(), num_static_args);
4718 ASSERT_EQUAL(static_args.Length(),
4719 num_static_args + (num_static_type_args > 0 ? 1 : 0));
4720 // Add an additional slot to store the callable as the receiver.
4721 const auto& callable_args =
4722 Array::Handle(zone, Array::New(static_args.Length() + 1));
4723 const intptr_t first_arg_index = static_args_descriptor.FirstArgIndex();
4724 auto& temp = Object::Handle(zone);
4725 // Copy the static args into the corresponding slots of the callable args.
4726 if (num_static_type_args > 0) {
4727 temp = static_args.At(0);
4728 callable_args.SetAt(0, temp);
4729 }
4730 for (intptr_t i = first_arg_index; i < static_args.Length(); i++) {
4731 temp = static_args.At(i);
4732 callable_args.SetAt(i + 1, temp);
4733 }
4734 // Set the receiver slot in the callable args.
4735 callable_args.SetAt(first_arg_index, receiver);
4736 return callable_args.ptr();
4737}
#define ASSERT_EQUAL(expected, actual)
Definition assert.h:309
intptr_t Count() const
intptr_t FirstArgIndex() const
Definition dart_entry.h:37
intptr_t Size() const
intptr_t TypeArgsLen() const

◆ CreateClassMirror()

static InstancePtr dart::CreateClassMirror ( const Class cls,
const AbstractType type,
const Bool is_declaration,
const Instance owner_mirror 
)
static

Definition at line 305 of file mirrors.cc.

308 {
309 ASSERT(!cls.IsDynamicClass());
310 ASSERT(!cls.IsVoidClass());
311 ASSERT(!cls.IsNeverClass());
312 ASSERT(!type.IsNull());
313 ASSERT(type.IsFinalized());
314 ASSERT(type.IsCanonical());
315 const Array& args = Array::Handle(Array::New(9));
316 args.SetAt(0, MirrorReference::Handle(MirrorReference::New(cls)));
317 args.SetAt(1, type);
318 args.SetAt(2, String::Handle(cls.Name()));
319 args.SetAt(3, owner_mirror);
320 args.SetAt(4, Bool::Get(cls.is_abstract()));
321 args.SetAt(5, Bool::Get(cls.IsGeneric()));
322 args.SetAt(6, Bool::Get(cls.is_transformed_mixin_application()));
323 args.SetAt(7, cls.NumTypeParameters() == 0 ? Bool::False() : is_declaration);
324 args.SetAt(8, Bool::Get(cls.is_enum_class()));
325 return CreateMirror(Symbols::_ClassMirror(), args);
326}
bool is_abstract() const
Definition object.h:1698
bool IsDynamicClass() const
Definition object.h:1558
bool IsGeneric() const
Definition object.h:1360
bool IsVoidClass() const
Definition object.h:1561
bool is_enum_class() const
Definition object.h:1722
bool IsNeverClass() const
Definition object.h:1564
bool is_transformed_mixin_application() const
Definition object.h:1756
intptr_t NumTypeParameters(Thread *thread) const
Definition object.cc:3605
static InstancePtr CreateMirror(const String &mirror_class_name, const Array &constructor_arguments)
Definition mirrors.cc:31

◆ CreateCombinatorMirror()

static InstancePtr dart::CreateCombinatorMirror ( const Object identifiers,
bool  is_show 
)
static

Definition at line 362 of file mirrors.cc.

363 {
364 const Array& args = Array::Handle(Array::New(2));
365 args.SetAt(0, identifiers);
366 args.SetAt(1, Bool::Get(is_show));
367 return CreateMirror(Symbols::_CombinatorMirror(), args);
368}

◆ CreateDummyClass()

static ClassPtr dart::CreateDummyClass ( const String class_name,
const Script script 
)
static

Definition at line 44 of file object_test.cc.

45 {
46 const Class& cls = Class::Handle(Class::New(
47 Library::Handle(), class_name, script, TokenPosition::kNoSource));
48 cls.set_is_synthesized_class_unsafe(); // Dummy class for testing.
50 return cls.ptr();
51}
void set_is_declaration_loaded_unsafe() const
Definition object.cc:5687
void set_is_synthesized_class_unsafe() const
Definition object.cc:5706

◆ CreateDummyLibrary()

static LibraryPtr dart::CreateDummyLibrary ( const String library_name)
static

Definition at line 2637 of file object_test.cc.

2637 {
2638 return Library::New(library_name);
2639}

◆ CreateFunction() [1/2]

static FunctionPtr dart::CreateFunction ( const char *  name)
static

Definition at line 2641 of file object_test.cc.

2641 {
2642 Thread* thread = Thread::Current();
2643 const String& class_name = String::Handle(Symbols::New(thread, "ownerClass"));
2644 const String& lib_name = String::Handle(Symbols::New(thread, "ownerLibrary"));
2645 const Script& script = Script::Handle();
2646 const Class& owner_class =
2647 Class::Handle(CreateDummyClass(class_name, script));
2648 const Library& owner_library = Library::Handle(CreateDummyLibrary(lib_name));
2649 owner_class.set_library(owner_library);
2650 const String& function_name = String::ZoneHandle(Symbols::New(thread, name));
2651 const FunctionType& signature = FunctionType::ZoneHandle(FunctionType::New());
2652 return Function::New(signature, function_name,
2653 UntaggedFunction::kRegularFunction, true, false, false,
2654 false, false, owner_class, TokenPosition::kMinSource);
2655}
void set_library(const Library &value) const
Definition object.cc:3488
static ClassPtr CreateDummyClass(const String &class_name, const Script &script)
static LibraryPtr CreateDummyLibrary(const String &library_name)
const char *const function_name

◆ CreateFunction() [2/2]

static Function * dart::CreateFunction ( const char *  name)
static

Definition at line 447 of file thread_test.cc.

447 {
448 const String& class_name =
449 String::Handle(Symbols::New(Thread::Current(), "ownerClass"));
450 const Script& script = Script::Handle();
451 const Library& lib = Library::Handle(Library::New(class_name));
452 const Class& owner_class = Class::Handle(
453 Class::New(lib, class_name, script, TokenPosition::kNoSource));
454 const String& function_name =
455 String::ZoneHandle(Symbols::New(Thread::Current(), name));
456 const FunctionType& signature = FunctionType::ZoneHandle(FunctionType::New());
457 Function& function = Function::ZoneHandle(Function::New(
458 signature, function_name, UntaggedFunction::kRegularFunction, true, false,
459 false, false, false, owner_class, TokenPosition::kNoSource));
460 return &function;
461}

◆ CreateFunctionTypeMirror()

static InstancePtr dart::CreateFunctionTypeMirror ( const AbstractType type)
static

Definition at line 228 of file mirrors.cc.

228 {
229 ASSERT(type.IsFunctionType());
230 const Class& closure_class =
231 Class::Handle(IsolateGroup::Current()->object_store()->closure_class());
232 const FunctionType& sig = FunctionType::Cast(type);
233 const Array& args = Array::Handle(Array::New(3));
234 args.SetAt(0, MirrorReference::Handle(MirrorReference::New(closure_class)));
235 args.SetAt(1, MirrorReference::Handle(MirrorReference::New(sig)));
236 args.SetAt(2, type);
237 return CreateMirror(Symbols::_FunctionTypeMirror(), args);
238}

◆ CreateFutureOrType()

static TypePtr dart::CreateFutureOrType ( const AbstractType param,
Nullability  nullability 
)
static

Definition at line 7619 of file object_test.cc.

◆ CreateFutureType()

static TypePtr dart::CreateFutureType ( const AbstractType param,
Nullability  nullability 
)
static

Definition at line 7632 of file object_test.cc.

◆ CreateInvokeInstantiateTypeArgumentsStub()

static CodePtr dart::CreateInvokeInstantiateTypeArgumentsStub ( Thread thread)
static

Definition at line 7976 of file object_test.cc.

7987 {
7988 Zone* const zone = thread->zone();
7989 const auto& klass = Class::Handle(
7990 zone, thread->isolate_group()->class_table()->At(kInstanceCid));
7991 const auto& symbol = String::Handle(
7992 zone, Symbols::New(thread, OS::SCreate(zone, "InstantiateTAVTest")));
7993 const auto& signature = FunctionType::Handle(zone, FunctionType::New());
7994 const auto& function = Function::Handle(
7995 zone, Function::New(signature, symbol, UntaggedFunction::kRegularFunction,
7996 false, false, false, false, false, klass,
7997 TokenPosition::kNoSource));
7998
7999 compiler::ObjectPoolBuilder pool_builder;
8000 SafepointWriteRwLocker ml(thread, thread->isolate_group()->program_lock());
8001 compiler::Assembler assembler(&pool_builder);
8003 const Code& invoke_instantiate_tav = Code::Handle(
8004 Code::FinalizeCodeAndNotify("InstantiateTAV", nullptr, &assembler,
8005 Code::PoolAttachment::kNotAttachPool,
8006 /*optimized=*/false));
8007
8008 const auto& pool =
8009 ObjectPool::Handle(zone, ObjectPool::NewFromBuilder(pool_builder));
AutoreleasePool pool
static void GenerateInvokeInstantiateTAVStub(compiler::Assembler *assembler)

◆ CreateIsolate()

static Dart_Isolate dart::CreateIsolate ( IsolateGroup group,
bool  is_new_group,
const char *  name,
void *  isolate_data,
char **  error 
)
static

Definition at line 1229 of file dart_api_impl.cc.

1233 {
1234 CHECK_NO_ISOLATE(Isolate::Current());
1235
1236 auto source = group->source();
1237 Isolate* I = Dart::CreateIsolate(name, source->flags, group);
1238 if (I == nullptr) {
1239 if (error != nullptr) {
1240 *error = Utils::StrDup("Isolate creation failed");
1241 }
1242 return static_cast<Dart_Isolate>(nullptr);
1243 }
1244
1245 Thread* T = Thread::Current();
1246 bool success = false;
1247 {
1248 StackZone zone(T);
1249 HandleScope handle_scope(T);
1250
1251#if defined(SUPPORT_TIMELINE)
1252 TimelineBeginEndScope tbes(T, Timeline::GetIsolateStream(),
1253 "InitializeIsolate");
1254 tbes.SetNumArguments(1);
1255 tbes.CopyArgument(0, "isolateName", I->name());
1256#endif
1257
1258 // We enter an API scope here as InitializeIsolate could compile some
1259 // bootstrap library files which call out to a tag handler that may create
1260 // Api Handles when an error is encountered.
1261 T->EnterApiScope();
1262 auto& error_obj = Error::Handle(Z);
1263 if (is_new_group) {
1264 error_obj = Dart::InitializeIsolateGroup(
1265 T, source->snapshot_data, source->snapshot_instructions,
1266 source->kernel_buffer, source->kernel_buffer_size);
1267 }
1268 if (error_obj.IsNull()) {
1269 error_obj = Dart::InitializeIsolate(T, is_new_group, isolate_data);
1270 }
1271 if (error_obj.IsNull()) {
1272#if defined(DEBUG) && !defined(DART_PRECOMPILED_RUNTIME)
1273 if (FLAG_check_function_fingerprints && !FLAG_precompiled_mode) {
1274 Library::CheckFunctionFingerprints();
1275 }
1276#endif // defined(DEBUG) && !defined(DART_PRECOMPILED_RUNTIME).
1277 success = true;
1278 } else if (error != nullptr) {
1279 *error = Utils::StrDup(error_obj.ToErrorCString());
1280 }
1281 // We exit the API scope entered above.
1282 T->ExitApiScope();
1283 }
1284
1285 if (success) {
1286 // A Thread structure has been associated to the thread, we do the
1287 // safepoint transition explicitly here instead of using the
1288 // TransitionXXX scope objects as the reverse transition happens
1289 // outside this scope in Dart_ShutdownIsolate/Dart_ExitIsolate.
1290 T->set_execution_state(Thread::kThreadInNative);
1291 T->EnterSafepoint();
1292 if (error != nullptr) {
1293 *error = nullptr;
1294 }
1295 return Api::CastIsolate(I);
1296 }
1297
1298 Dart::ShutdownIsolate(T);
1299 return static_cast<Dart_Isolate>(nullptr);
1300}
#define CHECK_NO_ISOLATE(isolate)
Definition SkMD5.cpp:134

◆ CreateIsolateAndSetup()

static Dart_Isolate dart::CreateIsolateAndSetup ( const char *  script_uri,
const char *  main,
const char *  package_root,
const char *  packages_config,
Dart_IsolateFlags flags,
void *  data,
char **  error 
)
static

Definition at line 170 of file run_vm_tests.cc.

176 {
177 ASSERT(script_uri != nullptr);
178 ASSERT(package_root == nullptr);
179 if (strcmp(script_uri, DART_VM_SERVICE_ISOLATE_NAME) == 0) {
180 return CreateAndSetupServiceIsolate(script_uri, packages_config, flags,
181 error);
182 }
183 const bool is_kernel_isolate =
184 strcmp(script_uri, DART_KERNEL_ISOLATE_NAME) == 0;
185 if (!is_kernel_isolate) {
186 *error = Utils::StrDup(
187 "Spawning of only Kernel isolate is supported in run_vm_tests.");
188 return nullptr;
189 }
190 Dart_Isolate isolate = nullptr;
191 bin::IsolateGroupData* isolate_group_data = nullptr;
192 const uint8_t* kernel_service_buffer = nullptr;
193 intptr_t kernel_service_buffer_size = 0;
194
195 // Kernel isolate uses an app snapshot or the kernel service dill file.
196 if (kernel_snapshot != nullptr &&
197 (bin::DartUtils::SniffForMagicNumber(kernel_snapshot) ==
198 bin::DartUtils::kAppJITMagicNumber)) {
199 script_uri = kernel_snapshot;
200 bin::AppSnapshot* app_snapshot =
201 bin::Snapshot::TryReadAppSnapshot(script_uri);
202 ASSERT(app_snapshot != nullptr);
203 const uint8_t* ignore_vm_snapshot_data;
204 const uint8_t* ignore_vm_snapshot_instructions;
205 const uint8_t* isolate_snapshot_data;
206 const uint8_t* isolate_snapshot_instructions;
207 app_snapshot->SetBuffers(
208 &ignore_vm_snapshot_data, &ignore_vm_snapshot_instructions,
209 &isolate_snapshot_data, &isolate_snapshot_instructions);
210 isolate_group_data = new bin::IsolateGroupData(
211 script_uri, packages_config, app_snapshot, app_snapshot != nullptr);
212 isolate = Dart_CreateIsolateGroup(
214 isolate_snapshot_data, isolate_snapshot_instructions, flags,
215 isolate_group_data, /*isolate_data=*/nullptr, error);
216 if (*error != nullptr) {
217 OS::PrintErr("Error creating isolate group: %s\n", *error);
218 free(*error);
219 *error = nullptr;
220 }
221 // If a test does not actually require the kernel isolate the main thead can
222 // start calling Dart::Cleanup() while the kernel isolate is booting up.
223 // This can cause the isolate to be killed early which will return `nullptr`
224 // here.
225 if (isolate == nullptr) {
226 delete isolate_group_data;
227 return nullptr;
228 }
229 }
230 if (isolate == nullptr) {
231 delete isolate_group_data;
232 isolate_group_data = nullptr;
233
234 bin::dfe.Init();
235 bin::dfe.LoadKernelService(&kernel_service_buffer,
236 &kernel_service_buffer_size);
237 ASSERT(kernel_service_buffer != nullptr);
238 isolate_group_data =
239 new bin::IsolateGroupData(script_uri, packages_config, nullptr, false);
240 isolate_group_data->SetKernelBufferUnowned(
241 const_cast<uint8_t*>(kernel_service_buffer),
242 kernel_service_buffer_size);
244 script_uri, main, kernel_service_buffer, kernel_service_buffer_size,
245 flags, isolate_group_data, /*isolate_data=*/nullptr, error);
246 }
247 if (isolate == nullptr) {
248 delete isolate_group_data;
249 return nullptr;
250 }
251
253
254 bin::DartUtils::SetOriginalWorkingDirectory();
255 Dart_Handle result = bin::DartUtils::PrepareForScriptLoading(
256 /*is_service_isolate=*/false, /*trace_loading=*/false);
258
259 // Setup kernel service as the main script for this isolate.
260 if (kernel_service_buffer != nullptr) {
261 result = Dart_LoadScriptFromKernel(kernel_service_buffer,
262 kernel_service_buffer_size);
264 }
265
269 if (*error != nullptr) {
270 Dart_EnterIsolate(isolate);
272 return nullptr;
273 }
274
275 return isolate;
276}
DART_EXPORT Dart_Isolate Dart_CreateIsolateGroup(const char *script_uri, const char *name, const uint8_t *isolate_snapshot_data, const uint8_t *isolate_snapshot_instructions, Dart_IsolateFlags *flags, void *isolate_group_data, void *isolate_data, char **error)
DART_EXPORT DART_WARN_UNUSED_RESULT char * Dart_IsolateMakeRunnable(Dart_Isolate isolate)
#define DART_KERNEL_ISOLATE_NAME
Definition dart_api.h:3823
const uint8_t * isolate_snapshot_data
const uint8_t * isolate_snapshot_instructions
static const char * kernel_snapshot
static Dart_Isolate CreateAndSetupServiceIsolate(const char *script_uri, const char *packages_config, Dart_IsolateFlags *flags, char **error)
Definition main.py:1

◆ CreateIsolateMirror()

static InstancePtr dart::CreateIsolateMirror ( )
static

Definition at line 569 of file mirrors.cc.

569 {
570 Thread* thread = Thread::Current();
571 Isolate* isolate = thread->isolate();
572 const String& debug_name = String::Handle(String::New(isolate->name()));
573 const Library& root_library = Library::Handle(
574 thread->zone(), isolate->group()->object_store()->root_library());
575 const Instance& root_library_mirror =
576 Instance::Handle(CreateLibraryMirror(thread, root_library));
577
578 const Array& args = Array::Handle(Array::New(2));
579 args.SetAt(0, debug_name);
580 args.SetAt(1, root_library_mirror);
581 return CreateMirror(Symbols::_IsolateMirror(), args);
582}
ObjectStore * object_store() const
Definition isolate.h:505
IsolateGroup * group() const
Definition isolate.h:990
const char * name() const
Definition isolate.h:996
static InstancePtr CreateLibraryMirror(Thread *thread, const Library &lib)
Definition mirrors.cc:345

◆ CreateLibraryDependencyMirror() [1/2]

static InstancePtr dart::CreateLibraryDependencyMirror ( Thread thread,
const Instance importer,
const Library importee,
const Array show_names,
const Array hide_names,
const Object metadata,
const LibraryPrefix prefix,
const String prefix_name,
const bool  is_import,
const bool  is_deferred 
)
static

Definition at line 370 of file mirrors.cc.

379 {
380 const Instance& importee_mirror =
381 Instance::Handle(CreateLibraryMirror(thread, importee));
382 if (importee_mirror.IsNull()) {
383 // Imported library is censored: censor the import.
384 return Instance::null();
385 }
386
387 intptr_t n = show_names.IsNull() ? 0 : show_names.Length();
388 intptr_t m = hide_names.IsNull() ? 0 : hide_names.Length();
389 const Array& combinators = Array::Handle(Array::New(n + m));
390 Object& t = Object::Handle();
391 intptr_t i = 0;
392 for (intptr_t j = 0; j < n; j++) {
393 t = show_names.At(j);
394 t = CreateCombinatorMirror(t, true);
395 combinators.SetAt(i++, t);
396 }
397 for (intptr_t j = 0; j < m; j++) {
398 t = hide_names.At(j);
399 t = CreateCombinatorMirror(t, false);
400 combinators.SetAt(i++, t);
401 }
402
403 const Array& args = Array::Handle(Array::New(7));
404 args.SetAt(0, importer);
405 if (importee.Loaded() || prefix.IsNull()) {
406 // A native extension is never "loaded" by the embedder. Use the fact that
407 // it doesn't have an prefix where asa deferred import does to distinguish
408 // it from a deferred import. It will appear like an empty library.
409 args.SetAt(1, importee_mirror);
410 } else {
411 args.SetAt(1, prefix);
412 }
413 args.SetAt(2, combinators);
414 args.SetAt(3, prefix_name);
415 args.SetAt(4, Bool::Get(is_import));
416 args.SetAt(5, Bool::Get(is_deferred));
417 args.SetAt(6, metadata);
418 return CreateMirror(Symbols::_LibraryDependencyMirror(), args);
419}
bool Loaded() const
Definition object.h:5082
static InstancePtr CreateCombinatorMirror(const Object &identifiers, bool is_show)
Definition mirrors.cc:362

◆ CreateLibraryDependencyMirror() [2/2]

static InstancePtr dart::CreateLibraryDependencyMirror ( Thread thread,
const Instance importer,
const Namespace ns,
const LibraryPrefix prefix,
const bool  is_import,
const bool  is_deferred 
)
static

Definition at line 421 of file mirrors.cc.

426 {
427 const Library& importee = Library::Handle(ns.target());
428 const Array& show_names = Array::Handle(ns.show_names());
429 const Array& hide_names = Array::Handle(ns.hide_names());
430
431 const Library& owner = Library::Handle(ns.owner());
432 Object& metadata = Object::Handle(owner.GetMetadata(ns));
433 if (metadata.IsError()) {
434 Exceptions::PropagateError(Error::Cast(metadata));
435 UNREACHABLE();
436 }
437
438 auto& prefix_name = String::Handle();
439 if (!prefix.IsNull()) {
440 prefix_name = prefix.name();
441 }
442
443 return CreateLibraryDependencyMirror(thread, importer, importee, show_names,
444 hide_names, metadata, prefix,
445 prefix_name, is_import, is_deferred);
446}
ObjectPtr GetMetadata(const Object &declaration) const
Definition object.cc:13701
ArrayPtr hide_names() const
Definition object.h:5421
ArrayPtr show_names() const
Definition object.h:5420
LibraryPtr target() const
Definition object.h:5419
LibraryPtr owner() const
Definition object.h:5422
static InstancePtr CreateLibraryDependencyMirror(Thread *thread, const Instance &importer, const Library &importee, const Array &show_names, const Array &hide_names, const Object &metadata, const LibraryPrefix &prefix, const String &prefix_name, const bool is_import, const bool is_deferred)
Definition mirrors.cc:370

◆ CreateLibraryMirror()

static InstancePtr dart::CreateLibraryMirror ( Thread thread,
const Library lib 
)
static

Definition at line 345 of file mirrors.cc.

345 {
346 Zone* zone = thread->zone();
347 ASSERT(!lib.IsNull());
348 const Array& args = Array::Handle(zone, Array::New(3));
349 args.SetAt(0, MirrorReference::Handle(zone, MirrorReference::New(lib)));
350 String& str = String::Handle(zone);
351 str = lib.name();
352 args.SetAt(1, str);
353 str = lib.url();
354 if (IsCensoredLibrary(str)) {
355 // Censored library (grumble).
356 return Instance::null();
357 }
358 args.SetAt(2, str);
359 return CreateMirror(Symbols::_LibraryMirror(), args);
360}
static bool IsCensoredLibrary(const String &url)
Definition mirrors.cc:328

◆ CreateLineStartsData()

const dart::TypedData & dart::CreateLineStartsData ( )

Definition at line 15 of file kernel_test.cc.

15 {
16 const intptr_t raw_line_starts_data[] = {
17 0, 8, 12, 17, 18, 20, 23, 30, 31, 33,
18 };
19 const intptr_t length = std::extent<decltype(raw_line_starts_data)>::value;
20 ASSERT(length > 0);
21 const TypedData& line_starts_data = TypedData::Handle(
22 TypedData::New(kTypedDataUint16ArrayCid, length, Heap::kOld));
23 for (intptr_t i = 0; i < length; ++i) {
24 line_starts_data.SetUint16(i << 1,
25 static_cast<int16_t>(raw_line_starts_data[i]));
26 }
27 return line_starts_data;
28}

◆ CreateMethodMirror()

static InstancePtr dart::CreateMethodMirror ( const Function func,
const Instance owner_mirror,
const AbstractType instantiator 
)
static

Definition at line 240 of file mirrors.cc.

242 {
243 const Array& args = Array::Handle(Array::New(6));
244 args.SetAt(0, MirrorReference::Handle(MirrorReference::New(func)));
245
246 String& name = String::Handle(func.name());
247 name = String::ScrubNameRetainPrivate(
248 name, func.is_extension_member() || func.is_extension_type_member());
249 args.SetAt(1, name);
250 args.SetAt(2, owner_mirror);
251 args.SetAt(3, instantiator);
252 args.SetAt(4, Bool::Get(func.is_static()));
253
254 intptr_t kind_flags = 0;
255 kind_flags |=
256 (static_cast<intptr_t>(func.is_abstract()) << Mirrors::kAbstract);
257 kind_flags |=
258 (static_cast<intptr_t>(func.IsGetterFunction()) << Mirrors::kGetter);
259 kind_flags |=
260 (static_cast<intptr_t>(func.IsSetterFunction()) << Mirrors::kSetter);
261 bool is_ctor = (func.kind() == UntaggedFunction::kConstructor);
262 kind_flags |= (static_cast<intptr_t>(is_ctor) << Mirrors::kConstructor);
263 kind_flags |= (static_cast<intptr_t>(is_ctor && func.is_const())
264 << Mirrors::kConstCtor);
265 kind_flags |=
266 (static_cast<intptr_t>(is_ctor && func.IsGenerativeConstructor())
267 << Mirrors::kGenerativeCtor);
268 kind_flags |= (static_cast<intptr_t>(false) << Mirrors::kRedirectingCtor);
269 kind_flags |= (static_cast<intptr_t>(is_ctor && func.IsFactory())
270 << Mirrors::kFactoryCtor);
271 kind_flags |=
272 (static_cast<intptr_t>(func.is_external()) << Mirrors::kExternal);
273 bool is_synthetic = func.is_synthetic();
274 kind_flags |= (static_cast<intptr_t>(is_synthetic) << Mirrors::kSynthetic);
275 kind_flags |= (static_cast<intptr_t>(func.is_extension_member())
276 << Mirrors::kExtensionMember);
277 kind_flags |= (static_cast<intptr_t>(func.is_extension_type_member())
278 << Mirrors::kExtensionTypeMember);
279 args.SetAt(5, Smi::Handle(Smi::New(kind_flags)));
280
281 return CreateMirror(Symbols::_MethodMirror(), args);
282}
bool IsGetterFunction() const
Definition object.h:3837
StringPtr name() const
Definition object.h:2972
bool IsFactory() const
Definition object.h:3347
bool IsGenerativeConstructor() const
Definition object.h:3343
UntaggedFunction::Kind kind() const
Definition object.h:3329
bool IsSetterFunction() const
Definition object.h:3853

◆ CreateMirror()

static InstancePtr dart::CreateMirror ( const String mirror_class_name,
const Array constructor_arguments 
)
static

Definition at line 31 of file mirrors.cc.

32 {
33 const Library& mirrors_lib = Library::Handle(Library::MirrorsLibrary());
34 const String& constructor_name = Symbols::DotUnder();
35
36 const Object& result = Object::Handle(DartLibraryCalls::InstanceCreate(
37 mirrors_lib, mirror_class_name, constructor_name, constructor_arguments));
38 if (result.IsError()) {
39 Exceptions::PropagateError(Error::Cast(result));
40 }
41 return Instance::Cast(result).ptr();
42}

◆ CreateNativePorts()

static void dart::CreateNativePorts ( uword  param)
static

Definition at line 9948 of file dart_api_impl_test.cc.

9949 :isolate';
9950@pragma("vm:external-name", "Test_nativeFunc")
9951external void notifyLowMemory();
9952void main() {
9953 var v;
9954 for (var i = 0; i < 100; i++) {
9955 var t = [];
9956 for (var j = 0; j < 10000; j++) {
9957 t.add(List.filled(100, null));
9958 }
9959 v = t;
9960 notifyLowMemory();
9961 }
9962})";

◆ CreateParallelMoveAfter()

static ParallelMoveInstr * dart::CreateParallelMoveAfter ( Instruction instr,
intptr_t  pos 
)
static

Definition at line 1677 of file linearscan.cc.

1678 {
1679 Instruction* next = instr->next();
1680 if (next->IsParallelMove() &&
1681 (FlowGraphAllocator::GetLifetimePosition(next) == pos)) {
1682 return next->AsParallelMove();
1683 }
1684 return CreateParallelMoveBefore(next, pos);
1685}
SkPoint pos
Instruction * next() const
Definition il.h:1087

◆ CreateParallelMoveBefore()

static ParallelMoveInstr * dart::CreateParallelMoveBefore ( Instruction instr,
intptr_t  pos 
)
static

Definition at line 1662 of file linearscan.cc.

1663 {
1664 ASSERT(pos > 0);
1665 Instruction* prev = instr->previous();
1666 ParallelMoveInstr* move = prev->AsParallelMove();
1667 if ((move == nullptr) ||
1668 (FlowGraphAllocator::GetLifetimePosition(move) != pos)) {
1669 move = new ParallelMoveInstr();
1670 prev->LinkTo(move);
1671 move->LinkTo(instr);
1672 FlowGraphAllocator::SetLifetimePosition(move, pos);
1673 }
1674 return move;
1675}
static float prev(float f)
Instruction * previous() const
Definition il.h:1081

◆ CreateParameterMirrorList()

static InstancePtr dart::CreateParameterMirrorList ( const Function func,
const FunctionType signature,
const Instance owner_mirror 
)
static

Definition at line 96 of file mirrors.cc.

98 {
99 Thread* const T = Thread::Current();
100 Zone* const Z = T->zone();
101 HANDLESCOPE(T);
102 const intptr_t implicit_param_count = signature.num_implicit_parameters();
103 const intptr_t non_implicit_param_count =
104 signature.NumParameters() - implicit_param_count;
105 const intptr_t index_of_first_optional_param =
106 non_implicit_param_count - signature.NumOptionalParameters();
107 const intptr_t index_of_first_named_param =
108 non_implicit_param_count - signature.NumOptionalNamedParameters();
109 const Array& results = Array::Handle(Z, Array::New(non_implicit_param_count));
110 const Array& args = Array::Handle(Z, Array::New(9));
111
112 Smi& pos = Smi::Handle(Z);
113 String& name = String::Handle(Z);
114 Instance& param = Instance::Handle(Z);
115 Bool& is_final = Bool::Handle(Z);
116 Object& default_value = Object::Handle(Z);
117 Object& metadata = Object::Handle(Z);
118
119 // We force compilation of constructors to ensure the types of initializing
120 // formals have been corrected. We do not force the compilation of all types
121 // of functions because some have no body, e.g. signature functions.
122 if (!func.IsNull()) {
124 }
125
126 bool has_extra_parameter_info = true;
127 if (non_implicit_param_count == 0) {
128 has_extra_parameter_info = false;
129 }
130 if (func.IsNull() || func.IsImplicitConstructor()) {
131 // This covers the default constructor and forwarding constructors.
132 has_extra_parameter_info = false;
133 }
134 Array& param_descriptor = Array::Handle();
135 if (has_extra_parameter_info) {
136 // Reparse the function for the following information:
137 // * The default value of a parameter.
138 // * Whether a parameters has been declared as final.
139 // * Any metadata associated with the parameter.
140 Object& result = Object::Handle(kernel::BuildParameterDescriptor(func));
141 if (result.IsError()) {
142 Exceptions::PropagateError(Error::Cast(result));
143 UNREACHABLE();
144 }
145 param_descriptor ^= result.ptr();
146 ASSERT(param_descriptor.Length() ==
147 (Parser::kParameterEntrySize * non_implicit_param_count));
148 }
149
150 args.SetAt(0, MirrorReference::Handle(MirrorReference::New(signature)));
151 args.SetAt(2, owner_mirror);
152
153 if (!has_extra_parameter_info) {
154 is_final = Bool::True().ptr();
155 default_value = Object::null();
156 metadata = Object::null();
157 }
158
159 for (intptr_t i = 0; i < non_implicit_param_count; i++) {
160 pos = Smi::New(i);
161 if (i >= index_of_first_named_param) {
162 // Named parameters are stored in the signature.
163 name = signature.ParameterNameAt(implicit_param_count + i);
164 } else if (!func.IsNull()) {
165 // Positional parameters are stored in the function.
166 name = func.ParameterNameAt(implicit_param_count + i);
167 } else {
168 // We were not given a function, only the type, so create placeholder
169 // names for the positional parameters.
170 const char* const placeholder = OS::SCreate(Z, ":param%" Pd "", i);
171 name = String::New(placeholder);
172 }
173 if (has_extra_parameter_info) {
174 is_final ^= param_descriptor.At(i * Parser::kParameterEntrySize +
175 Parser::kParameterIsFinalOffset);
176 default_value = param_descriptor.At(i * Parser::kParameterEntrySize +
177 Parser::kParameterDefaultValueOffset);
178 metadata = param_descriptor.At(i * Parser::kParameterEntrySize +
179 Parser::kParameterMetadataOffset);
180 }
181 ASSERT(default_value.IsNull() || default_value.IsInstance());
182
183 // Arguments 0 (referent) and 2 (owner) are the same for all parameters. See
184 // above.
185 args.SetAt(1, name);
186 args.SetAt(3, pos);
187 args.SetAt(4, Bool::Get(i >= index_of_first_optional_param));
188 args.SetAt(5, Bool::Get(i >= index_of_first_named_param));
189 args.SetAt(6, is_final);
190 args.SetAt(7, default_value);
191 args.SetAt(8, metadata);
192 param = CreateMirror(Symbols::_ParameterMirror(), args);
193 results.SetAt(i, param);
194 }
195 results.MakeImmutable();
196 return results.ptr();
197}
#define Z
void MakeImmutable() const
Definition object.cc:24916
void SetAt(intptr_t index, const Object &value) const
Definition object.h:10858
intptr_t num_implicit_parameters() const
Definition object.h:9565
intptr_t NumOptionalParameters() const
Definition object.h:9605
StringPtr ParameterNameAt(intptr_t index) const
Definition object.cc:8660
bool IsImplicitConstructor() const
Definition object.cc:10276
static void EnsureConstructorsAreCompiled(const Function &func)
Definition mirrors.cc:81

◆ CreatePreallocatedStackTrace()

static StackTracePtr dart::CreatePreallocatedStackTrace ( Zone zone)
static

Definition at line 58 of file object_store.cc.

58 {
59 const Array& code_array = Array::Handle(
60 zone, Array::New(StackTrace::kPreallocatedStackdepth, Heap::kOld));
61 const TypedData& pc_offset_array = TypedData::Handle(
62 zone, TypedData::New(kUintPtrCid, StackTrace::kPreallocatedStackdepth,
63 Heap::kOld));
64 const StackTrace& stack_trace =
65 StackTrace::Handle(zone, StackTrace::New(code_array, pc_offset_array));
66 // Expansion of inlined functions requires additional memory at run time,
67 // avoid it.
68 stack_trace.set_expand_inlined(false);
69 return stack_trace.ptr();
70}
void set_expand_inlined(bool value) const
Definition object.cc:26140

◆ CreateSourceLocation()

static InstancePtr dart::CreateSourceLocation ( const String uri,
intptr_t  line,
intptr_t  column 
)
static

Definition at line 1558 of file mirrors.cc.

1560 {
1561 const Array& args = Array::Handle(Array::New(3));
1562 args.SetAt(0, uri);
1563 args.SetAt(1, Smi::Handle(Smi::New(line)));
1564 args.SetAt(2, Smi::Handle(Smi::New(column)));
1565 return CreateMirror(Symbols::_SourceLocation(), args);
1566}

◆ CreateSpecializedFunction()

void dart::CreateSpecializedFunction ( Thread thread,
Zone zone,
const RegExp regexp,
intptr_t  specialization_cid,
bool  sticky,
const Object owner 
)

Definition at line 5523 of file regexp.cc.

5528 {
5529 const intptr_t kParamCount = RegExpMacroAssembler::kParamCount;
5530
5531 const FunctionType& signature =
5532 FunctionType::Handle(zone, FunctionType::New());
5533 const String& pattern = String::Handle(zone, regexp.pattern());
5534 Function& fn =
5535 Function::Handle(zone, Function::New(signature, pattern,
5536 UntaggedFunction::kIrregexpFunction,
5537 true, // Static.
5538 false, // Not const.
5539 false, // Not abstract.
5540 false, // Not external.
5541 false, // Not native.
5542 owner, TokenPosition::kMinSource));
5543
5544 // TODO(zerny): Share these arrays between all irregexp functions.
5545 // TODO(regis): Better, share a common signature.
5546 signature.set_num_fixed_parameters(kParamCount);
5547 signature.set_parameter_types(
5548 Array::Handle(zone, Array::New(kParamCount, Heap::kOld)));
5549 fn.CreateNameArray();
5550 signature.SetParameterTypeAt(RegExpMacroAssembler::kParamRegExpIndex,
5551 Object::dynamic_type());
5552 fn.SetParameterNameAt(RegExpMacroAssembler::kParamRegExpIndex,
5553 Symbols::This());
5554 signature.SetParameterTypeAt(RegExpMacroAssembler::kParamStringIndex,
5555 Object::dynamic_type());
5556 fn.SetParameterNameAt(RegExpMacroAssembler::kParamStringIndex,
5557 Symbols::string_param());
5558 signature.SetParameterTypeAt(RegExpMacroAssembler::kParamStartOffsetIndex,
5559 Object::dynamic_type());
5560 fn.SetParameterNameAt(RegExpMacroAssembler::kParamStartOffsetIndex,
5561 Symbols::start_index_param());
5562 signature.set_result_type(Type::Handle(zone, Type::ArrayType()));
5563
5564 // Cache the result.
5565 regexp.set_function(specialization_cid, sticky, fn);
5566
5567 fn.SetRegExpData(regexp, specialization_cid, sticky);
5568 fn.set_is_debuggable(false);
5569
5570 // The function is compiled lazily during the first call.
5571}
void set_result_type(const AbstractType &value) const
Definition object.cc:8633
void SetParameterTypeAt(intptr_t index, const AbstractType &value) const
Definition object.cc:8648
void set_num_fixed_parameters(intptr_t value) const
Definition object.cc:11659
void set_parameter_types(const Array &value) const
Definition object.cc:8655
void CreateNameArray(Heap::Space space=Heap::kOld) const
Definition object.cc:8735
void SetParameterNameAt(intptr_t index, const String &value) const
Definition object.cc:8681
void SetRegExpData(const RegExp &regexp, intptr_t string_specialization_cid, bool sticky) const
Definition object.cc:8550
StringPtr pattern() const
Definition object.h:12771
void set_function(intptr_t cid, bool sticky, const Function &value) const
Definition object.cc:26695

◆ CreateStackTraceObject()

static StackTracePtr dart::CreateStackTraceObject ( Zone zone,
const GrowableObjectArray code_list,
const GrowableArray< uword > &  pc_offset_list 
)
static

Definition at line 21 of file stacktrace.cc.

24 {
25 const auto& code_array =
26 Array::Handle(zone, Array::MakeFixedLength(code_list));
27 const auto& pc_offset_array = TypedData::Handle(
28 zone, TypedData::New(kUintPtrCid, pc_offset_list.length()));
29 {
30 NoSafepointScope no_safepoint;
31 memmove(pc_offset_array.DataAddr(0), pc_offset_list.data(),
32 pc_offset_list.length() * kWordSize);
33 }
34 return StackTrace::New(code_array, pc_offset_array);
35}

◆ CreateTestClass() [1/2]

static ClassPtr dart::CreateTestClass ( const char *  name)
static

Definition at line 12 of file class_finalizer_test.cc.

12 {
13 Thread* thread = Thread::Current();
14 const String& class_name = String::Handle(Symbols::New(thread, name));
15 const Script& script = Script::Handle();
16 const Class& cls = Class::Handle(Class::New(
17 Library::Handle(), class_name, script, TokenPosition::kNoSource));
18 cls.set_interfaces(Object::empty_array());
19 SafepointWriteRwLocker ml(thread, thread->isolate_group()->program_lock());
21 cls.SetFunctions(Object::empty_array());
22 cls.SetFields(Object::empty_array());
23 return cls.ptr();
24}
void SetFields(const Array &value) const
Definition object.cc:5039
void set_is_declaration_loaded() const
Definition object.cc:5682
void set_interfaces(const Array &value) const
Definition object.cc:5794
void SetFunctions(const Array &value) const
Definition object.cc:3314

◆ CreateTestClass() [2/2]

static ClassPtr dart::CreateTestClass ( const char *  name)
static

Definition at line 2966 of file object_test.cc.

2966 {
2967 const String& class_name =
2968 String::Handle(Symbols::New(Thread::Current(), name));
2969 const Class& cls =
2970 Class::Handle(CreateDummyClass(class_name, Script::Handle()));
2971 return cls.ptr();
2972}

◆ CreateTestField()

static FieldPtr dart::CreateTestField ( const char *  name)
static

Definition at line 2974 of file object_test.cc.

2974 {
2975 auto thread = Thread::Current();
2976 const Class& cls = Class::Handle(CreateTestClass("global:"));
2977 const String& field_name = String::Handle(Symbols::New(thread, name));
2978 const Field& field = Field::Handle(Field::New(
2979 field_name, true, false, false, true, false, cls, Object::dynamic_type(),
2980 TokenPosition::kMinSource, TokenPosition::kMinSource));
2981 {
2982 SafepointWriteRwLocker locker(thread,
2983 thread->isolate_group()->program_lock());
2984 thread->isolate_group()->RegisterStaticField(field, Object::sentinel());
2985 }
2986 return field.ptr();
2987}
static ClassPtr CreateTestClass(const char *name)

◆ CreateTestFunction()

FunctionPtr dart::CreateTestFunction ( FfiCallbackKind  kind)

Definition at line 25 of file ffi_callback_metadata_test.cc.

25 {
26 const auto& ffi_lib = Library::Handle(Library::FfiLibrary());
27 const auto& ffi_void = Class::Handle(ffi_lib.LookupClass(Symbols::FfiVoid()));
28 const auto& ffi_void_type =
29 Type::Handle(Type::NewNonParameterizedType(ffi_void));
30
31 auto* thread = Thread::Current();
32 const char* kScriptChars =
33 R"(
34 void testFunction() {
35 }
36 )";
37 Dart_Handle library;
38 {
39 TransitionVMToNative transition(thread);
40 library = TestCase::LoadTestScript(kScriptChars, nullptr);
41 EXPECT_VALID(library);
42 }
43
44 const auto& lib =
45 Library::Handle(Library::RawCast(Api::UnwrapHandle(library)));
46 EXPECT(ClassFinalizer::ProcessPendingClasses());
47 const auto& cls = Class::Handle(lib.toplevel_class());
48 EXPECT(!cls.IsNull());
49 const auto& error = cls.EnsureIsFinalized(thread);
50 EXPECT(error == Error::null());
51
52 auto& function_name = String::Handle(String::New("testFunction"));
53 const auto& func = Function::Handle(cls.LookupStaticFunction(function_name));
54 EXPECT(!func.IsNull());
55
56 FunctionType& signature = FunctionType::Handle(FunctionType::New());
57 signature.set_result_type(ffi_void_type);
58 signature.SetIsFinalized();
59 signature ^= signature.Canonicalize(thread);
60
61 const auto& callback = Function::Handle(compiler::ffi::NativeCallbackFunction(
62 signature, func, Instance::Handle(Instance::null()), kind));
63
64 const auto& result = Object::Handle(
65 thread->zone(), Compiler::CompileFunction(thread, callback));
66 EXPECT(!result.IsError());

◆ CreateTimelineEvents()

static void dart::CreateTimelineEvents ( uword  param)
static

Definition at line 10061 of file dart_api_impl_test.cc.

10062 {
10063 "jsonrpc": 2.0,
10064 "id": "foo",
10065 "method": "getVM",
10066 "params": { }
10067 })");
10068 uint8_t* response_json = nullptr;
10069 intptr_t response_json_length = 0;
10070 char* error = nullptr;

◆ CreateTypeMirror()

static InstancePtr dart::CreateTypeMirror ( const AbstractType type)
static

Definition at line 518 of file mirrors.cc.

518 {
519 ASSERT(type.IsFinalized());
520 ASSERT(type.IsCanonical());
521
522 if (type.IsFunctionType()) {
524 }
525 if (type.IsRecordType()) {
526 const Class& cls =
527 Class::Handle(IsolateGroup::Current()->object_store()->record_class());
528 return CreateClassMirror(cls, AbstractType::Handle(cls.DeclarationType()),
529 Bool::False(), Object::null_instance());
530 }
531 if (type.HasTypeClass()) {
532 const Class& cls = Class::Handle(type.type_class());
533 // Handle void and dynamic types.
534 if (cls.IsVoidClass()) {
535 Array& args = Array::Handle(Array::New(1));
536 args.SetAt(0, Symbols::Void());
537 return CreateMirror(Symbols::_SpecialTypeMirror(), args);
538 } else if (cls.IsDynamicClass()) {
539 Array& args = Array::Handle(Array::New(1));
540 args.SetAt(0, Symbols::Dynamic());
541 return CreateMirror(Symbols::_SpecialTypeMirror(), args);
542 } else if (cls.IsNeverClass()) {
543 Array& args = Array::Handle(Array::New(1));
544 args.SetAt(0, Symbols::Never());
545 return CreateMirror(Symbols::_SpecialTypeMirror(), args);
546 }
547 // TODO(regis): Until mirrors reflect nullability, force kLegacy, except for
548 // Null type, which should remain nullable.
549 if (!type.IsNullType()) {
550 Type& legacy_type = Type::Handle(
551 Type::Cast(type).ToNullability(Nullability::kLegacy, Heap::kOld));
552 legacy_type ^= legacy_type.Canonicalize(Thread::Current());
553 return CreateClassMirror(cls, legacy_type, Bool::False(),
554 Object::null_instance());
555 }
556 return CreateClassMirror(cls, type, Bool::False(), Object::null_instance());
557 } else if (type.IsTypeParameter()) {
558 // TODO(regis): Until mirrors reflect nullability, force kLegacy.
559 TypeParameter& legacy_type =
560 TypeParameter::Handle(TypeParameter::Cast(type).ToNullability(
561 Nullability::kLegacy, Heap::kOld));
562 legacy_type ^= legacy_type.Canonicalize(Thread::Current());
563 return CreateTypeVariableMirror(legacy_type, Object::null_instance());
564 }
565 UNREACHABLE();
566 return Instance::null();
567}
static InstancePtr CreateFunctionTypeMirror(const AbstractType &type)
Definition mirrors.cc:228
static InstancePtr CreateClassMirror(const Class &cls, const AbstractType &type, const Bool &is_declaration, const Instance &owner_mirror)
Definition mirrors.cc:305
static InstancePtr CreateTypeVariableMirror(const TypeParameter &param, const Instance &owner_mirror)
Definition mirrors.cc:199

◆ CreateTypeVariableList()

static InstancePtr dart::CreateTypeVariableList ( const Class cls)
static

Definition at line 210 of file mirrors.cc.

210 {
211 const intptr_t num_type_params = cls.NumTypeParameters();
212 if (num_type_params == 0) {
213 return Object::empty_array().ptr();
214 }
215 const Array& result = Array::Handle(Array::New(num_type_params * 2));
216 TypeParameter& type = TypeParameter::Handle();
217 String& name = String::Handle();
218 for (intptr_t i = 0; i < num_type_params; i++) {
219 type = cls.TypeParameterAt(i, Nullability::kLegacy);
220 ASSERT(type.IsFinalized());
221 name = type.UserVisibleName();
222 result.SetAt(2 * i, name);
223 result.SetAt(2 * i + 1, type);
224 }
225 return result.ptr();
226}
TypeParameterPtr TypeParameterAt(intptr_t index, Nullability nullability=Nullability::kNonNullable) const
Definition object.cc:3739

◆ CreateTypeVariableMirror()

static InstancePtr dart::CreateTypeVariableMirror ( const TypeParameter param,
const Instance owner_mirror 
)
static

Definition at line 199 of file mirrors.cc.

200 {
201 const Array& args = Array::Handle(Array::New(3));
202 args.SetAt(0, param);
203 args.SetAt(1, String::Handle(param.UserVisibleName()));
204 args.SetAt(2, owner_mirror);
205 return CreateMirror(Symbols::_TypeVariableMirror(), args);
206}
StringPtr UserVisibleName() const
Definition object.cc:21392

◆ CreateVariableMirror()

static InstancePtr dart::CreateVariableMirror ( const Field field,
const Instance owner_mirror 
)
static

Definition at line 284 of file mirrors.cc.

285 {
286 const MirrorReference& field_ref =
287 MirrorReference::Handle(MirrorReference::New(field));
288
289 const String& name = String::Handle(field.name());
290
291 const Array& args = Array::Handle(Array::New(9));
292 args.SetAt(0, field_ref);
293 args.SetAt(1, name);
294 args.SetAt(2, owner_mirror);
295 args.SetAt(3, Object::null_instance()); // Null for type.
296 args.SetAt(4, Bool::Get(field.is_static()));
297 args.SetAt(5, Bool::Get(field.is_final()));
298 args.SetAt(6, Bool::Get(field.is_const()));
299 args.SetAt(7, Bool::Get(field.is_extension_member()));
300 args.SetAt(8, Bool::Get(field.is_extension_type_member()));
301
302 return CreateMirror(Symbols::_VariableMirror(), args);
303}
bool is_final() const
Definition object.h:4420
bool is_extension_member() const
Definition object.h:4423
StringPtr name() const
Definition object.h:4408
bool is_extension_type_member() const
Definition object.h:4426
bool is_const() const
Definition object.h:4421

◆ CreateWithinExistingIsolateGroup()

Isolate * dart::CreateWithinExistingIsolateGroup ( IsolateGroup group,
const char *  name,
char **  error 
)

Definition at line 1302 of file dart_api_impl.cc.

1304 {
1305 API_TIMELINE_DURATION(Thread::Current());
1306 CHECK_NO_ISOLATE(Isolate::Current());
1307
1308 auto spawning_group = group;
1309
1310 Isolate* isolate = reinterpret_cast<Isolate*>(
1311 CreateIsolate(spawning_group, /*is_new_group=*/false, name,
1312 /*isolate_data=*/nullptr, error));
1313 if (isolate == nullptr) return nullptr;
1314
1315 auto source = spawning_group->source();
1316 ASSERT(isolate->source() == source);
1317
1318 return isolate;
1319}
IsolateGroupSource * source() const
Definition isolate.h:989
#define API_TIMELINE_DURATION(thread)
static Dart_Isolate CreateIsolate(IsolateGroup *group, bool is_new_group, const char *name, void *isolate_data, char **error)

◆ CStringToDouble()

bool dart::CStringToDouble ( const char *  str,
intptr_t  length,
double *  result 
)

Definition at line 155 of file double_conversion.cc.

155 {
156 if (length == 0) {
157 return false;
158 }
159
162 kInfinitySymbol, kNaNSymbol);
163
164 int parsed_count = 0;
165 *result =
166 converter.StringToDouble(str, static_cast<int>(length), &parsed_count);
167 return (parsed_count == length);
168}

◆ CurrentStackTrace()

static StackTracePtr dart::CurrentStackTrace ( Thread thread,
intptr_t  skip_frames = 1 
)
static

Definition at line 38 of file stacktrace.cc.

39 {
40 Zone* zone = thread->zone();
41
42 const auto& code_array = GrowableObjectArray::ZoneHandle(
43 zone, GrowableObjectArray::New(kDefaultStackAllocation));
44 GrowableArray<uword> pc_offset_array(kDefaultStackAllocation);
45
46 // Collect the frames.
47 StackTraceUtils::CollectFrames(thread, skip_frames,
48 [&](const StackTraceUtils::Frame& frame) {
49 code_array.Add(frame.code);
50 pc_offset_array.Add(frame.pc_offset);
51 });
52
53 return CreateStackTraceObject(zone, code_array, pc_offset_array);
54}

◆ CurrentStackTraceNative()

void dart::CurrentStackTraceNative ( Dart_NativeArguments  args)

Definition at line 494 of file dart_api_impl_test.cc.

494 {
496
497 Dart_StackTrace stacktrace;
500
501 intptr_t frame_count = 0;
502 result = Dart_StackTraceLength(stacktrace, &frame_count);
504 EXPECT_EQ(102, frame_count);
505 // Test something bigger than the preallocated size to verify nothing was
506 // truncated.
507 EXPECT(102 > StackTrace::kPreallocatedStackdepth);
508
510 Dart_Handle script_url;
511 intptr_t line_number = 0;
512 intptr_t column_number = 0;
513 const char* cstr = "";
514 const char* test_lib = "file:///test-lib";
515
516 // Top frame is inspectStack().
518 result = Dart_GetActivationFrame(stacktrace, 0, &frame);
520 result = Dart_ActivationFrameInfo(frame, &function_name, &script_url,
521 &line_number, &column_number);
523 Dart_StringToCString(function_name, &cstr);
524 EXPECT_STREQ("inspectStack", cstr);
525 Dart_StringToCString(script_url, &cstr);
526 EXPECT_STREQ(test_lib, cstr);
527 EXPECT_EQ(3, line_number);
528 EXPECT_EQ(24, column_number);
529
530 // Second frame is foo() positioned at call to inspectStack().
531 result = Dart_GetActivationFrame(stacktrace, 1, &frame);
533 result = Dart_ActivationFrameInfo(frame, &function_name, &script_url,
534 &line_number, &column_number);
536 Dart_StringToCString(function_name, &cstr);
537 EXPECT_STREQ("foo", cstr);
538 Dart_StringToCString(script_url, &cstr);
539 EXPECT_STREQ(test_lib, cstr);
540 EXPECT_EQ(4, line_number);
541 EXPECT_EQ(20, column_number);
542
543 // Middle frames positioned at the recursive call.
544 for (intptr_t frame_index = 2; frame_index < (frame_count - 1);
545 frame_index++) {
546 result = Dart_GetActivationFrame(stacktrace, frame_index, &frame);
548 result = Dart_ActivationFrameInfo(frame, &function_name, &script_url,
549 &line_number, &column_number);
551 Dart_StringToCString(function_name, &cstr);
552 EXPECT_STREQ("foo", cstr);
553 Dart_StringToCString(script_url, &cstr);
554 EXPECT_STREQ(test_lib, cstr);
555 EXPECT_EQ(4, line_number);
556 EXPECT_EQ(37, column_number);
557 }
558
559 // Bottom frame positioned at testMain().
560 result = Dart_GetActivationFrame(stacktrace, frame_count - 1, &frame);
562 result = Dart_ActivationFrameInfo(frame, &function_name, &script_url,
563 &line_number, &column_number);
565 Dart_StringToCString(function_name, &cstr);
566 EXPECT_STREQ("testMain", cstr);
567 Dart_StringToCString(script_url, &cstr);
568 EXPECT_STREQ(test_lib, cstr);
569 EXPECT_EQ(5, line_number);
570 EXPECT_EQ(15, column_number);
571
572 // Out-of-bounds frames.
573 result = Dart_GetActivationFrame(stacktrace, frame_count, &frame);
575 result = Dart_GetActivationFrame(stacktrace, -1, &frame);
577
580}
Dart_Handle Dart_StackTraceLength(Dart_StackTrace trace, intptr_t *length)
Dart_Handle Dart_ActivationFrameInfo(Dart_ActivationFrame activation_frame, Dart_Handle *function_name, Dart_Handle *script_url, intptr_t *line_number, intptr_t *column_number)
Dart_Handle Dart_GetStackTrace(Dart_StackTrace *trace)
struct _Dart_ActivationFrame * Dart_ActivationFrame
Dart_Handle Dart_GetActivationFrame(Dart_StackTrace trace, int frame_index, Dart_ActivationFrame *frame)
struct _Dart_StackTrace * Dart_StackTrace

◆ CurrentStackTraceNativeLookup()

static Dart_NativeFunction dart::CurrentStackTraceNativeLookup ( Dart_Handle  name,
int  argument_count,
bool *  auto_setup_scope 
)
static

Definition at line 582 of file dart_api_impl_test.cc.

585 {
586 ASSERT(auto_setup_scope != nullptr);
587 *auto_setup_scope = true;
589}
void CurrentStackTraceNative(Dart_NativeArguments args)

◆ CustomIsolateImpl_start()

static void dart::CustomIsolateImpl_start ( Dart_NativeArguments  args)
static

Definition at line 256 of file custom_isolate_test.cc.

256 {
257 OS::PrintErr("-- Enter: CustomIsolateImpl_start --\n");
258
259 // We would probably want to pass in the this pointer too, so we
260 // could associate the CustomIsolateImpl instance with the
261 // Dart_Isolate by storing it in a native field.
262 EXPECT_EQ(1, Dart_GetNativeArgumentCount(args));
264 EXPECT_VALID(param);
265 EXPECT(Dart_IsString(param));
266 const char* isolate_main = nullptr;
267 EXPECT_VALID(Dart_StringToCString(param, &isolate_main));
268 isolate_main = Utils::StrDup(isolate_main);
269
270 // Save current isolate.
271 Dart_Isolate saved_isolate = Dart_CurrentIsolate();
273
274 // Create a new Dart_Isolate.
275 Dart_Isolate new_isolate = TestCase::CreateTestIsolate();
276 EXPECT(new_isolate != nullptr);
277 Dart_SetMessageNotifyCallback(&NotifyMessage);
279 // Reload all the test classes here.
280 //
281 // TODO(turnidge): Use the create isolate callback instead?
282 Dart_Handle lib =
283 TestCase::LoadTestScript(kCustomIsolateScriptChars, NativeLookup);
284 EXPECT_VALID(lib);
285
286 Dart_Handle main_send_port = Dart_GetField(lib, NewString("mainSendPort"));
287 EXPECT_VALID(main_send_port);
288 Dart_Port main_port_id;
289 Dart_Handle err = Dart_SendPortGetId(main_send_port, &main_port_id);
290 EXPECT_VALID(err);
291
292 OS::PrintErr("-- Adding StartEvent to queue --\n");
293 event_queue->Add(new StartEvent(new_isolate, isolate_main));
294
295 // Restore the original isolate.
298 Dart_EnterIsolate(saved_isolate);
300
301 Dart_Handle send_port = Dart_NewSendPort(main_port_id);
302 EXPECT_VALID(send_port);
303 Dart_SetReturnValue(args, send_port);
304
305 OS::PrintErr("-- Exit: CustomIsolateImpl_start --\n");
307}
void Add(Event *event)
DART_EXPORT Dart_Handle Dart_NewSendPort(Dart_Port port_id)
int64_t Dart_Port
Definition dart_api.h:1524
DART_EXPORT Dart_Handle Dart_GetNativeArgument(Dart_NativeArguments args, int index)
DART_EXPORT int Dart_GetNativeArgumentCount(Dart_NativeArguments args)
DART_EXPORT Dart_Handle Dart_SendPortGetId(Dart_Handle port, Dart_Port *port_id)
DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_GetField(Dart_Handle container, Dart_Handle name)
DART_EXPORT void Dart_SetMessageNotifyCallback(Dart_MessageNotifyCallback message_notify_callback)
DART_EXPORT bool Dart_IsString(Dart_Handle object)
EventQueue * event_queue

◆ CutOutRange()

static void dart::CutOutRange ( RegExpMacroAssembler masm,
ZoneGrowableArray< uint16_t > *  ranges,
intptr_t  start_index,
intptr_t  end_index,
intptr_t  cut_index,
BlockLabel even_label,
BlockLabel odd_label 
)
static

Definition at line 1121 of file regexp.cc.

1127 {
1128 bool odd = (((cut_index - start_index) & 1) == 1);
1129 BlockLabel* in_range_label = odd ? odd_label : even_label;
1130 BlockLabel dummy;
1131 EmitDoubleBoundaryTest(masm, ranges->At(cut_index),
1132 ranges->At(cut_index + 1) - 1, &dummy, in_range_label,
1133 &dummy);
1134 ASSERT(!dummy.is_linked());
1135 // Cut out the single range by rewriting the array. This creates a new
1136 // range that is a merger of the two ranges on either side of the one we
1137 // are cutting out. The oddity of the labels is preserved.
1138 for (intptr_t j = cut_index; j > start_index; j--) {
1139 (*ranges)[j] = ranges->At(j - 1);
1140 }
1141 for (intptr_t j = cut_index + 1; j < end_index; j++) {
1142 (*ranges)[j] = ranges->At(j + 1);
1143 }
1144}
Convenience wrapper around a BlockEntryInstr pointer.
bool is_linked() const
static void EmitDoubleBoundaryTest(RegExpMacroAssembler *masm, uint16_t first, uint16_t last, BlockLabel *fall_through, BlockLabel *in_range, BlockLabel *out_of_range)
Definition regexp.cc:1040

◆ Dart_ActivationFrameInfo()

Dart_Handle dart::Dart_ActivationFrameInfo ( Dart_ActivationFrame  activation_frame,
Dart_Handle function_name,
Dart_Handle script_url,
intptr_t *  line_number,
intptr_t *  column_number 
)

Returns information about the given activation frame. \function_name receives a string handle with the qualified function name. \script_url receives a string handle with the url of the source script that contains the frame's function. \line_number receives the line number in the script. \col_number receives the column number in the script, or -1 if column information is not available

Any or all of the out parameters above may be nullptr.

Requires there to be a current isolate.

Returns
A valid handle if no error occurs during the operation.

Definition at line 118 of file debugger_api_impl_test.cc.

122 {
123 DARTSCOPE(Thread::Current());
124 CHECK_AND_CAST(ActivationFrame, frame, activation_frame);
125 if (function_name != nullptr) {
126 *function_name = Api::NewHandle(T, frame->QualifiedFunctionName());
127 }
128 if (script_url != nullptr) {
129 *script_url = Api::NewHandle(T, frame->SourceUrl());
130 }
131 if (line_number != nullptr) {
132 *line_number = frame->LineNumber();
133 }
134 if (column_number != nullptr) {
135 *column_number = frame->ColumnNumber();
136 }
137 return Api::Success();
138}
#define DARTSCOPE(thread)
#define CHECK_AND_CAST(type, var, param)

◆ Dart_AddSymbols()

DART_EXPORT void dart::Dart_AddSymbols ( const char *  dso_name,
void *  buffer,
intptr_t  buffer_size 
)

Definition at line 1593 of file dart_api_impl.cc.

1595 {
1596 NativeSymbolResolver::AddSymbols(dso_name, buffer, buffer_size);
1597}
static uint32_t buffer_size(uint32_t offset, uint32_t maxAlignment)

◆ Dart_Allocate()

DART_EXPORT Dart_Handle dart::Dart_Allocate ( Dart_Handle  type)

Definition at line 4377 of file dart_api_impl.cc.

4377 {
4378 DARTSCOPE(Thread::Current());
4380
4381 const Type& type_obj = Api::UnwrapTypeHandle(Z, type);
4382 // Get the class to instantiate.
4383 if (type_obj.IsNull()) {
4385 }
4386
4387 if (!type_obj.IsFinalized()) {
4388 return Api::NewError(
4389 "%s expects argument 'type' to be a fully resolved type.",
4390 CURRENT_FUNC);
4391 }
4392
4393 const Class& cls = Class::Handle(Z, type_obj.type_class());
4394 const TypeArguments& type_arguments =
4395 TypeArguments::Handle(Z, type_obj.GetInstanceTypeArguments(T));
4396
4397 CHECK_ERROR_HANDLE(cls.VerifyEntryPoint());
4398#if defined(DEBUG)
4399 if (!cls.is_allocated() && (Dart::vm_snapshot_kind() == Snapshot::kFullAOT)) {
4400 return Api::NewError("Precompilation dropped '%s'", cls.ToCString());
4401 }
4402#endif
4403 CHECK_ERROR_HANDLE(cls.EnsureIsAllocateFinalized(T));
4404 const Instance& new_obj = Instance::Handle(Z, AllocateObject(T, cls));
4405 if (!type_arguments.IsNull()) {
4406 new_obj.SetTypeArguments(type_arguments);
4407 }
4408 return Api::NewHandle(T, new_obj.ptr());
4409}
bool IsFinalized() const
Definition object.h:9030
TypeArgumentsPtr GetInstanceTypeArguments(Thread *thread, bool canonicalize=true) const
Definition object.cc:22480
virtual ClassPtr type_class() const
Definition object.cc:22028
#define CHECK_ERROR_HANDLE(error)
#define RETURN_TYPE_ERROR(zone, dart_handle, type)
#define CHECK_CALLBACK_STATE(thread)
#define CURRENT_FUNC
static InstancePtr AllocateObject(Thread *thread, const Class &cls)

◆ Dart_AllocateWithNativeFields()

DART_EXPORT Dart_Handle dart::Dart_AllocateWithNativeFields ( Dart_Handle  type,
intptr_t  num_native_fields,
const intptr_t *  native_fields 
)

Definition at line 4412 of file dart_api_impl.cc.

4414 {
4415 DARTSCOPE(Thread::Current());
4417
4418 const Type& type_obj = Api::UnwrapTypeHandle(Z, type);
4419 // Get the class to instantiate.
4420 if (type_obj.IsNull()) {
4422 }
4423 if (native_fields == nullptr) {
4424 RETURN_NULL_ERROR(native_fields);
4425 }
4426 const Class& cls = Class::Handle(Z, type_obj.type_class());
4427 CHECK_ERROR_HANDLE(cls.VerifyEntryPoint());
4428#if defined(DEBUG)
4429 if (!cls.is_allocated() && (Dart::vm_snapshot_kind() == Snapshot::kFullAOT)) {
4430 return Api::NewError("Precompilation dropped '%s'", cls.ToCString());
4431 }
4432#endif
4433 CHECK_ERROR_HANDLE(cls.EnsureIsAllocateFinalized(T));
4434 if (num_native_fields != cls.num_native_fields()) {
4435 return Api::NewError(
4436 "%s: invalid number of native fields %" Pd " passed in, expected %d",
4437 CURRENT_FUNC, num_native_fields, cls.num_native_fields());
4438 }
4439 const Instance& instance = Instance::Handle(Z, AllocateObject(T, cls));
4440 instance.SetNativeFields(num_native_fields, native_fields);
4441 return Api::NewHandle(T, instance.ptr());
4442}
#define RETURN_NULL_ERROR(parameter)

◆ Dart_BooleanValue()

DART_EXPORT Dart_Handle dart::Dart_BooleanValue ( Dart_Handle  boolean_obj,
bool *  value 
)

Definition at line 2803 of file dart_api_impl.cc.

2804 {
2805 DARTSCOPE(Thread::Current());
2806 const Bool& obj = Api::UnwrapBoolHandle(Z, boolean_obj);
2807 if (obj.IsNull()) {
2808 RETURN_TYPE_ERROR(Z, boolean_obj, Bool);
2809 }
2810 *value = obj.value();
2811 return Api::Success();
2812}

◆ Dart_ClassLibrary()

DART_EXPORT Dart_Handle dart::Dart_ClassLibrary ( Dart_Handle  cls_type)

Definition at line 2554 of file dart_api_impl.cc.

2554 {
2555 DARTSCOPE(Thread::Current());
2556 const Type& type_obj = Api::UnwrapTypeHandle(Z, cls_type);
2557 const Class& klass = Class::Handle(Z, type_obj.type_class());
2558 if (klass.IsNull()) {
2559 return Api::NewError(
2560 "cls_type must be a Type object which represents a Class.");
2561 }
2562 const Library& library = Library::Handle(klass.library());
2563 if (library.IsNull()) {
2564 return Dart_Null();
2565 }
2566 return Api::NewHandle(Thread::Current(), library.ptr());
2567}
DART_EXPORT Dart_Handle Dart_Null(void)

◆ Dart_ClassName()

DART_EXPORT Dart_Handle dart::Dart_ClassName ( Dart_Handle  cls_type)

Definition at line 2485 of file dart_api_impl.cc.

2485 {
2486 DARTSCOPE(Thread::Current());
2487 const Type& type_obj = Api::UnwrapTypeHandle(Z, cls_type);
2488 if (type_obj.IsNull()) {
2489 RETURN_TYPE_ERROR(Z, cls_type, Type);
2490 }
2491 const Class& klass = Class::Handle(Z, type_obj.type_class());
2492 if (klass.IsNull()) {
2493 return Api::NewError(
2494 "cls_type must be a Type object which represents a Class.");
2495 }
2496 return Api::NewHandle(T, klass.UserVisibleName());
2497}

◆ Dart_Cleanup()

DART_EXPORT char * dart::Dart_Cleanup ( void  )

Definition at line 1181 of file dart_api_impl.cc.

1181 {
1182 CHECK_NO_ISOLATE(Isolate::Current());
1183 return Dart::Cleanup();
1184}

◆ Dart_CloseNativePort()

DART_EXPORT bool dart::Dart_CloseNativePort ( Dart_Port  native_port_id)

Definition at line 104 of file native_api_impl.cc.

104 {
105 // Close the native port without a current isolate.
106 IsolateLeaveScope saver(Isolate::Current());
107
108 MessageHandler* handler = nullptr;
109 const bool was_closed = PortMap::ClosePort(native_port_id, &handler);
110 if (was_closed) {
111 handler->RequestDeletion();
112 }
113 return was_closed;
114}

◆ Dart_ClosureFunction()

DART_EXPORT Dart_Handle dart::Dart_ClosureFunction ( Dart_Handle  closure)

Definition at line 2541 of file dart_api_impl.cc.

2541 {
2542 DARTSCOPE(Thread::Current());
2543 const Instance& closure_obj = Api::UnwrapInstanceHandle(Z, closure);
2544 if (closure_obj.IsNull() || !closure_obj.IsClosure()) {
2545 RETURN_TYPE_ERROR(Z, closure, Instance);
2546 }
2547
2548 ASSERT(ClassFinalizer::AllClassesFinalized());
2549
2550 FunctionPtr rf = Closure::Cast(closure_obj).function();
2551 return Api::NewHandle(T, rf);
2552}

◆ Dart_CompileAll()

DART_EXPORT Dart_Handle dart::Dart_CompileAll ( void  )

Definition at line 221 of file native_api_impl.cc.

221 {
222#if defined(DART_PRECOMPILED_RUNTIME)
223 return Api::NewError("%s: Cannot compile on an AOT runtime.", CURRENT_FUNC);
224#else
225 DARTSCOPE(Thread::Current());
227 Dart_Handle result = Api::CheckAndFinalizePendingClasses(T);
228 if (Api::IsError(result)) {
229 return result;
230 }
232 const Error& error = Error::Handle(T->zone(), Library::CompileAll());
233 if (!error.IsNull()) {
234 return Api::NewHandle(T, error.ptr());
235 }
236 return Api::Success();
237#endif // defined(DART_PRECOMPILED_RUNTIME)
238}

◆ Dart_CompileToKernel()

DART_EXPORT Dart_KernelCompilationResult dart::Dart_CompileToKernel ( const char *  script_uri,
const uint8_t *  platform_kernel,
intptr_t  platform_kernel_size,
bool  incremental_compile,
bool  for_snapshot,
bool  embed_sources,
const char *  package_config,
Dart_KernelCompilationVerbosityLevel  verbosity 
)

Definition at line 6049 of file dart_api_impl.cc.

6056 {
6057 API_TIMELINE_DURATION(Thread::Current());
6058
6060#if defined(DART_PRECOMPILED_RUNTIME)
6062 result.error = Utils::StrDup("Dart_CompileToKernel is unsupported.");
6063#else
6064 result = KernelIsolate::CompileToKernel(
6065 script_uri, platform_kernel, platform_kernel_size, 0, nullptr,
6066 incremental_compile, for_snapshot, embed_sources, package_config, nullptr,
6067 nullptr, verbosity);
6068 if (incremental_compile) {
6069 Dart_KernelCompilationResult ack_result =
6071 ? KernelIsolate::AcceptCompilation()
6072 : KernelIsolate::RejectCompilation();
6073 if (ack_result.status != Dart_KernelCompilationStatus_Ok) {
6074 FATAL(
6075 "An error occurred in the CFE while acking the most recent"
6076 " compilation results: %s",
6077 ack_result.error);
6078 }
6079 }
6080#endif
6081 return result;
6082}
@ Dart_KernelCompilationStatus_Unknown
Definition dart_api.h:3727

◆ Dart_CopyUTF8EncodingOfString()

DART_EXPORT Dart_Handle dart::Dart_CopyUTF8EncodingOfString ( Dart_Handle  str,
uint8_t *  utf8_array,
intptr_t  length 
)

Definition at line 2941 of file dart_api_impl.cc.

2943 {
2944 DARTSCOPE(Thread::Current());
2946 if (utf8_array == nullptr) {
2947 RETURN_NULL_ERROR(utf8_array);
2948 }
2949 const String& str_obj = Api::UnwrapStringHandle(Z, str);
2950 if (str_obj.IsNull()) {
2951 RETURN_TYPE_ERROR(Z, str, String);
2952 }
2953 intptr_t str_len = Utf8::Length(str_obj);
2954 if (length < str_len) {
2955 return Api::NewError(
2956 "Provided buffer is not large enough to hold "
2957 "the UTF-8 representation of the string");
2958 }
2959 str_obj.ToUTF8(utf8_array, str_len);
2960 return Api::Success();
2961}

◆ Dart_CreateAppAOTSnapshotAsAssemblies()

DART_EXPORT Dart_Handle dart::Dart_CreateAppAOTSnapshotAsAssemblies ( Dart_CreateLoadingUnitCallback  next_callback,
void *  next_callback_data,
bool  strip,
Dart_StreamingWriteCallback  write_callback,
Dart_StreamingCloseCallback  close_callback 
)

Definition at line 6586 of file dart_api_impl.cc.

6591 {
6592#if defined(TARGET_ARCH_IA32)
6593 return Api::NewError("AOT compilation is not supported on IA32.");
6594#elif defined(DART_TARGET_OS_WINDOWS)
6595 return Api::NewError("Assembly generation is not implemented for Windows.");
6596#elif !defined(DART_PRECOMPILER)
6597 return Api::NewError(
6598 "This VM was built without support for AOT compilation.");
6599#else
6600 DARTSCOPE(Thread::Current());
6602 CHECK_NULL(next_callback);
6603 CHECK_NULL(write_callback);
6604 CHECK_NULL(close_callback);
6605
6606 Split(next_callback, next_callback_data, strip, /*as_elf*/ false,
6607 write_callback, close_callback);
6608
6609 return Api::Success();
6610#endif
6611}
#define CHECK_NULL(parameter)

◆ Dart_CreateAppAOTSnapshotAsAssembly()

DART_EXPORT Dart_Handle dart::Dart_CreateAppAOTSnapshotAsAssembly ( Dart_StreamingWriteCallback  callback,
void *  callback_data,
bool  strip,
void *  debug_callback_data 
)

Definition at line 6560 of file dart_api_impl.cc.

6563 {
6564#if defined(TARGET_ARCH_IA32)
6565 return Api::NewError("AOT compilation is not supported on IA32.");
6566#elif defined(DART_TARGET_OS_WINDOWS)
6567 return Api::NewError("Assembly generation is not implemented for Windows.");
6568#elif !defined(DART_PRECOMPILER)
6569 return Api::NewError(
6570 "This VM was built without support for AOT compilation.");
6571#else
6572 DARTSCOPE(Thread::Current());
6575
6576 // Mark as not split.
6577 T->isolate_group()->object_store()->set_loading_units(Object::null_array());
6578
6579 CreateAppAOTSnapshot(callback, callback_data, strip, /*as_elf*/ false,
6580 debug_callback_data, nullptr, nullptr, 0);
6581
6582 return Api::Success();
6583#endif
6584}

◆ Dart_CreateAppAOTSnapshotAsElf()

DART_EXPORT Dart_Handle dart::Dart_CreateAppAOTSnapshotAsElf ( Dart_StreamingWriteCallback  callback,
void *  callback_data,
bool  strip,
void *  debug_callback_data 
)

Definition at line 6643 of file dart_api_impl.cc.

6646 {
6647#if defined(TARGET_ARCH_IA32)
6648 return Api::NewError("AOT compilation is not supported on IA32.");
6649#elif !defined(DART_PRECOMPILER)
6650 return Api::NewError(
6651 "This VM was built without support for AOT compilation.");
6652#else
6653 DARTSCOPE(Thread::Current());
6656
6657 // Mark as not split.
6658 T->isolate_group()->object_store()->set_loading_units(Object::null_array());
6659
6660 CreateAppAOTSnapshot(callback, callback_data, strip, /*as_elf*/ true,
6661 debug_callback_data, nullptr, nullptr, 0);
6662
6663 return Api::Success();
6664#endif
6665}

◆ Dart_CreateAppAOTSnapshotAsElfs()

DART_EXPORT Dart_Handle dart::Dart_CreateAppAOTSnapshotAsElfs ( Dart_CreateLoadingUnitCallback  next_callback,
void *  next_callback_data,
bool  strip,
Dart_StreamingWriteCallback  write_callback,
Dart_StreamingCloseCallback  close_callback 
)

Definition at line 6668 of file dart_api_impl.cc.

6672 {
6673#if defined(TARGET_ARCH_IA32)
6674 return Api::NewError("AOT compilation is not supported on IA32.");
6675#elif !defined(DART_PRECOMPILER)
6676 return Api::NewError(
6677 "This VM was built without support for AOT compilation.");
6678#else
6679 DARTSCOPE(Thread::Current());
6681 CHECK_NULL(next_callback);
6682 CHECK_NULL(write_callback);
6683 CHECK_NULL(close_callback);
6684
6685 Split(next_callback, next_callback_data, strip, /*as_elf*/ true,
6686 write_callback, close_callback);
6687
6688 return Api::Success();
6689#endif
6690}

◆ Dart_CreateAppJITSnapshotAsBlobs()

DART_EXPORT Dart_Handle dart::Dart_CreateAppJITSnapshotAsBlobs ( uint8_t **  isolate_snapshot_data_buffer,
intptr_t *  isolate_snapshot_data_size,
uint8_t **  isolate_snapshot_instructions_buffer,
intptr_t *  isolate_snapshot_instructions_size 
)

Definition at line 6784 of file dart_api_impl.cc.

6787 {
6788#if defined(TARGET_ARCH_IA32)
6789 return Api::NewError("Snapshots with code are not supported on IA32.");
6790#elif defined(DART_PRECOMPILED_RUNTIME)
6791 return Api::NewError("JIT app snapshots cannot be taken from an AOT runtime");
6792#else
6793 DARTSCOPE(Thread::Current());
6795 auto I = T->isolate();
6796 auto IG = T->isolate_group();
6797 CHECK_NULL(isolate_snapshot_data_buffer);
6798 CHECK_NULL(isolate_snapshot_data_size);
6799 CHECK_NULL(isolate_snapshot_instructions_buffer);
6800 CHECK_NULL(isolate_snapshot_instructions_size);
6801
6802 // Finalize all classes if needed.
6803 Dart_Handle state = Api::CheckAndFinalizePendingClasses(T);
6804 if (Api::IsError(state)) {
6805 return state;
6806 }
6807
6808 // Kill off any auxiliary isolates before starting with deduping.
6809 KillNonMainIsolatesSlow(T, I);
6810
6811 NoBackgroundCompilerScope no_bg_compiler(T);
6812 DropRegExpMatchCode(Z);
6813
6814 ProgramVisitor::Dedup(T);
6815
6816 if (FLAG_dump_tables) {
6817 Symbols::DumpTable(IG);
6818 DumpTypeTable(I);
6819 DumpTypeParameterTable(I);
6820 DumpTypeArgumentsTable(I);
6821 }
6822
6823 TIMELINE_DURATION(T, Isolate, "WriteAppJITSnapshot");
6824 ZoneWriteStream isolate_snapshot_data(Api::TopScope(T)->zone(),
6825 FullSnapshotWriter::kInitialSize);
6826 ZoneWriteStream isolate_snapshot_instructions(
6827 Api::TopScope(T)->zone(), FullSnapshotWriter::kInitialSize);
6828 BlobImageWriter image_writer(T, /*vm_instructions=*/nullptr,
6829 &isolate_snapshot_instructions);
6830 FullSnapshotWriter writer(Snapshot::kFullJIT, nullptr, &isolate_snapshot_data,
6831 nullptr, &image_writer);
6832 writer.WriteFullSnapshot();
6833
6834 *isolate_snapshot_data_buffer = isolate_snapshot_data.buffer();
6835 *isolate_snapshot_data_size = isolate_snapshot_data.bytes_written();
6836 *isolate_snapshot_instructions_buffer =
6838 *isolate_snapshot_instructions_size =
6839 isolate_snapshot_instructions.bytes_written();
6840
6841 return Api::Success();
6842#endif
6843}
#define IG
AtkStateType state

◆ Dart_CreateIsolateGroup()

DART_EXPORT Dart_Isolate dart::Dart_CreateIsolateGroup ( const char *  script_uri,
const char *  name,
const uint8_t *  snapshot_data,
const uint8_t *  snapshot_instructions,
Dart_IsolateFlags flags,
void *  isolate_group_data,
void *  isolate_data,
char **  error 
)

Definition at line 1326 of file dart_api_impl.cc.

1333 {
1334 API_TIMELINE_DURATION(Thread::Current());
1335
1336 Dart_IsolateFlags api_flags;
1337 if (flags == nullptr) {
1338 Isolate::FlagsInitialize(&api_flags);
1339 flags = &api_flags;
1340 }
1341
1342 const char* non_null_name = name == nullptr ? "isolate" : name;
1343 std::unique_ptr<IsolateGroupSource> source(
1344 new IsolateGroupSource(script_uri, non_null_name, snapshot_data,
1345 snapshot_instructions, nullptr, -1, *flags));
1346 auto group = new IsolateGroup(std::move(source), isolate_group_data, *flags,
1347 /*is_vm_isolate=*/false);
1348 group->CreateHeap(
1349 /*is_vm_isolate=*/false,
1350 flags->is_service_isolate || flags->is_kernel_isolate);
1351 IsolateGroup::RegisterIsolateGroup(group);
1352 Dart_Isolate isolate = CreateIsolate(group, /*is_new_group=*/true,
1353 non_null_name, isolate_data, error);
1354 if (isolate != nullptr) {
1355 group->set_initial_spawn_successful();
1356 }
1357 return isolate;
1358}

◆ Dart_CreateIsolateGroupFromKernel()

DART_EXPORT Dart_Isolate dart::Dart_CreateIsolateGroupFromKernel ( const char *  script_uri,
const char *  name,
const uint8_t *  kernel_buffer,
intptr_t  kernel_buffer_size,
Dart_IsolateFlags flags,
void *  isolate_group_data,
void *  isolate_data,
char **  error 
)

Definition at line 1361 of file dart_api_impl.cc.

1368 {
1369 API_TIMELINE_DURATION(Thread::Current());
1370
1371 Dart_IsolateFlags api_flags;
1372 if (flags == nullptr) {
1373 Isolate::FlagsInitialize(&api_flags);
1374 flags = &api_flags;
1375 }
1376
1377 const char* non_null_name = name == nullptr ? "isolate" : name;
1378 std::shared_ptr<IsolateGroupSource> source(
1379 new IsolateGroupSource(script_uri, non_null_name, nullptr, nullptr,
1380 kernel_buffer, kernel_buffer_size, *flags));
1381 auto group = new IsolateGroup(source, isolate_group_data, *flags,
1382 /*is_vm_isolate=*/false);
1383 IsolateGroup::RegisterIsolateGroup(group);
1384 group->CreateHeap(
1385 /*is_vm_isolate=*/false,
1386 flags->is_service_isolate || flags->is_kernel_isolate);
1387 Dart_Isolate isolate = CreateIsolate(group, /*is_new_group=*/true,
1388 non_null_name, isolate_data, error);
1389 if (isolate != nullptr) {
1390 group->set_initial_spawn_successful();
1391 }
1392 return isolate;
1393}

◆ Dart_CreateIsolateInGroup()

DART_EXPORT Dart_Isolate dart::Dart_CreateIsolateInGroup ( Dart_Isolate  group_member,
const char *  name,
Dart_IsolateShutdownCallback  shutdown_callback,
Dart_IsolateCleanupCallback  cleanup_callback,
void *  child_isolate_data,
char **  error 
)

Definition at line 1396 of file dart_api_impl.cc.

1401 {
1402 CHECK_NO_ISOLATE(Isolate::Current());
1403 auto member = reinterpret_cast<Isolate*>(group_member);
1404 if (member->IsScheduled()) {
1405 FATAL("The given member isolate (%s) must not have been entered.",
1406 member->name());
1407 }
1408
1409 *error = nullptr;
1410
1411 Isolate* isolate;
1412 isolate = CreateWithinExistingIsolateGroup(member->group(), name, error);
1413 if (isolate != nullptr) {
1414 isolate->set_origin_id(member->origin_id());
1415 isolate->set_init_callback_data(child_isolate_data);
1416 isolate->set_on_shutdown_callback(shutdown_callback);
1417 isolate->set_on_cleanup_callback(cleanup_callback);
1418 }
1419
1420 return Api::CastIsolate(isolate);
1421}

◆ Dart_CreateSnapshot()

DART_EXPORT Dart_Handle dart::Dart_CreateSnapshot ( uint8_t **  vm_snapshot_data_buffer,
intptr_t *  vm_snapshot_data_size,
uint8_t **  isolate_snapshot_data_buffer,
intptr_t *  isolate_snapshot_data_size,
bool  is_core 
)

Definition at line 1878 of file dart_api_impl.cc.

1882 {
1883#if defined(DART_PRECOMPILED_RUNTIME)
1884 return Api::NewError("Cannot create snapshots on an AOT runtime.");
1885#else
1886 DARTSCOPE(Thread::Current());
1888 if (vm_snapshot_data_buffer != nullptr) {
1889 CHECK_NULL(vm_snapshot_data_size);
1890 }
1891 CHECK_NULL(isolate_snapshot_data_buffer);
1892 CHECK_NULL(isolate_snapshot_data_size);
1893 // Finalize all classes if needed.
1894 Dart_Handle state = Api::CheckAndFinalizePendingClasses(T);
1895 if (Api::IsError(state)) {
1896 return state;
1897 }
1898 NoBackgroundCompilerScope no_bg_compiler(T);
1899
1900#if defined(DEBUG)
1901 T->isolate_group()->heap()->CollectAllGarbage(GCReason::kDebugging);
1902 {
1903 HeapIterationScope iteration(T);
1904 CheckFunctionTypesVisitor check_canonical(T);
1905 iteration.IterateObjects(&check_canonical);
1906 }
1907#endif // #if defined(DEBUG)
1908
1909 ZoneWriteStream vm_snapshot_data(Api::TopScope(T)->zone(),
1910 FullSnapshotWriter::kInitialSize);
1911 ZoneWriteStream isolate_snapshot_data(Api::TopScope(T)->zone(),
1912 FullSnapshotWriter::kInitialSize);
1913 const Snapshot::Kind snapshot_kind =
1914 is_core ? Snapshot::kFullCore : Snapshot::kFull;
1915 FullSnapshotWriter writer(
1916 snapshot_kind, &vm_snapshot_data, &isolate_snapshot_data,
1917 nullptr /* vm_image_writer */, nullptr /* isolate_image_writer */);
1918 writer.WriteFullSnapshot();
1919 if (vm_snapshot_data_buffer != nullptr) {
1920 *vm_snapshot_data_buffer = vm_snapshot_data.buffer();
1921 *vm_snapshot_data_size = writer.VmIsolateSnapshotSize();
1922 }
1923 *isolate_snapshot_data_buffer = isolate_snapshot_data.buffer();
1924 *isolate_snapshot_data_size = writer.IsolateSnapshotSize();
1925 return Api::Success();
1926#endif
1927}
const uint8_t * vm_snapshot_data
Definition main_impl.cc:56

◆ Dart_CreateVMAOTSnapshotAsAssembly()

DART_EXPORT Dart_Handle dart::Dart_CreateVMAOTSnapshotAsAssembly ( Dart_StreamingWriteCallback  callback,
void *  callback_data 
)

Definition at line 6614 of file dart_api_impl.cc.

6615 {
6616#if defined(TARGET_ARCH_IA32)
6617 return Api::NewError("AOT compilation is not supported on IA32.");
6618#elif defined(DART_TARGET_OS_WINDOWS)
6619 return Api::NewError("Assembly generation is not implemented for Windows.");
6620#elif !defined(DART_PRECOMPILER)
6621 return Api::NewError(
6622 "This VM was built without support for AOT compilation.");
6623#else
6624 DARTSCOPE(Thread::Current());
6627
6628 TIMELINE_DURATION(T, Isolate, "WriteVMAOTSnapshot");
6629 StreamingWriteStream assembly_stream(kAssemblyInitialSize, callback,
6630 callback_data);
6631 AssemblyImageWriter image_writer(T, &assembly_stream);
6632 ZoneWriteStream vm_snapshot_data(T->zone(), FullSnapshotWriter::kInitialSize);
6633 FullSnapshotWriter writer(Snapshot::kFullAOT, &vm_snapshot_data, nullptr,
6634 &image_writer, nullptr);
6635
6636 writer.WriteFullSnapshot();
6637
6638 return Api::Success();
6639#endif
6640}

◆ Dart_CurrentIsolate()

DART_EXPORT Dart_Isolate dart::Dart_CurrentIsolate ( void  )

Definition at line 1455 of file dart_api_impl.cc.

1455 {
1456 return Api::CastIsolate(Isolate::Current());
1457}

◆ Dart_CurrentIsolateData()

DART_EXPORT void * dart::Dart_CurrentIsolateData ( void  )

Definition at line 1459 of file dart_api_impl.cc.

1459 {
1460 Isolate* isolate = Isolate::Current();
1461 CHECK_ISOLATE(isolate);
1462 NoSafepointScope no_safepoint_scope;
1463 return isolate->init_callback_data();
1464}
void * init_callback_data() const
Definition isolate.h:1021
#define CHECK_ISOLATE(isolate)

◆ Dart_CurrentIsolateGroup()

DART_EXPORT Dart_IsolateGroup dart::Dart_CurrentIsolateGroup ( void  )

Definition at line 1474 of file dart_api_impl.cc.

1474 {
1475 return Api::CastIsolateGroup(IsolateGroup::Current());
1476}

◆ Dart_CurrentIsolateGroupData()

DART_EXPORT void * dart::Dart_CurrentIsolateGroupData ( void  )

Definition at line 1478 of file dart_api_impl.cc.

1478 {
1479 IsolateGroup* isolate_group = IsolateGroup::Current();
1480 CHECK_ISOLATE_GROUP(isolate_group);
1481 NoSafepointScope no_safepoint_scope;
1482 return isolate_group->embedder_data();
1483}
void * embedder_data() const
Definition isolate.h:290
#define CHECK_ISOLATE_GROUP(isolate_group)

◆ Dart_CurrentIsolateGroupId()

DART_EXPORT Dart_IsolateGroupId dart::Dart_CurrentIsolateGroupId ( void  )

Definition at line 1485 of file dart_api_impl.cc.

1485 {
1486 IsolateGroup* isolate_group = IsolateGroup::Current();
1487 CHECK_ISOLATE_GROUP(isolate_group);
1488 return isolate_group->id();
1489}
uint64_t id() const
Definition isolate.h:673

◆ Dart_DebugName()

DART_EXPORT Dart_Handle dart::Dart_DebugName ( void  )

Definition at line 1499 of file dart_api_impl.cc.

1499 {
1500 DARTSCOPE(Thread::Current());
1501 Isolate* I = T->isolate();
1502 return Api::NewHandle(
1503 T, String::NewFormatted("(%" Pd64 ") '%s'",
1504 static_cast<int64_t>(I->main_port()), I->name()));
1505}

◆ Dart_DebugNameToCString()

DART_EXPORT const char * dart::Dart_DebugNameToCString ( void  )

Definition at line 1507 of file dart_api_impl.cc.

1507 {
1508 Thread* thread = Thread::Current();
1509 if (thread == nullptr) {
1510 return nullptr;
1511 }
1512 Isolate* I = thread->isolate();
1513 if (I == nullptr) {
1514 return nullptr;
1515 }
1516 int64_t main_port = static_cast<int64_t>(I->main_port());
1517 const char* fmt = "%s (%" Pd64 ")";
1518 int length = snprintf(nullptr, 0, fmt, I->name(), main_port) + 1;
1519 char* res = Api::TopScope(thread)->zone()->Alloc<char>(length);
1520 snprintf(res, length, fmt, I->name(), main_port);
1521 return res;
1522}
static SkString fmt(SkColor4f c)
Definition p3.cpp:43

◆ Dart_DefaultCanonicalizeUrl()

DART_EXPORT Dart_Handle dart::Dart_DefaultCanonicalizeUrl ( Dart_Handle  base_url,
Dart_Handle  url 
)

Definition at line 5393 of file dart_api_impl.cc.

5394 {
5395 DARTSCOPE(Thread::Current());
5398
5399 const String& base_uri = Api::UnwrapStringHandle(Z, base_url);
5400 if (base_uri.IsNull()) {
5401 RETURN_TYPE_ERROR(Z, base_url, String);
5402 }
5403 const String& uri = Api::UnwrapStringHandle(Z, url);
5404 if (uri.IsNull()) {
5405 RETURN_TYPE_ERROR(Z, url, String);
5406 }
5407
5408 const char* resolved_uri;
5409 if (!ResolveUri(uri.ToCString(), base_uri.ToCString(), &resolved_uri)) {
5410 return Api::NewError("%s: Unable to canonicalize uri '%s'.", CURRENT_FUNC,
5411 uri.ToCString());
5412 }
5413 return Api::NewHandle(T, String::New(resolved_uri));
5414}
bool ResolveUri(const char *ref_uri, const char *base_uri, const char **target_uri)
Definition uri.cc:424

◆ Dart_DeferredLoadComplete()

DART_EXPORT Dart_Handle dart::Dart_DeferredLoadComplete ( intptr_t  loading_unit_id,
const uint8_t *  snapshot_data,
const uint8_t *  snapshot_instructions 
)

Definition at line 5904 of file dart_api_impl.cc.

5906 {
5907 return DeferredLoadComplete(loading_unit_id, false, snapshot_data,
5908 snapshot_instructions, nullptr, false);
5909}
static Dart_Handle DeferredLoadComplete(intptr_t loading_unit_id, bool error, const uint8_t *snapshot_data, const uint8_t *snapshot_instructions, const char *error_message, bool transient_error)

◆ Dart_DeferredLoadCompleteError()

DART_EXPORT Dart_Handle dart::Dart_DeferredLoadCompleteError ( intptr_t  loading_unit_id,
const char *  error_message,
bool  transient 
)

Definition at line 5912 of file dart_api_impl.cc.

5914 {
5915 return DeferredLoadComplete(loading_unit_id, true, nullptr, nullptr,
5916 error_message, transient);
5917}

◆ Dart_DeleteFinalizableHandle()

DART_EXPORT void dart::Dart_DeleteFinalizableHandle ( Dart_FinalizableHandle  object,
Dart_Handle  strong_ref_to_object 
)

Definition at line 1143 of file dart_api_impl.cc.

1145 {
1146 if (!::Dart_IdentityEquals(strong_ref_to_object,
1147 HandleFromFinalizable(object))) {
1148 FATAL(
1149 "%s expects arguments 'object' and 'strong_ref_to_object' to point to "
1150 "the same object.",
1151 CURRENT_FUNC);
1152 }
1153
1154 auto wph_object = reinterpret_cast<Dart_WeakPersistentHandle>(object);
1155
1157}
DART_EXPORT void Dart_DeleteWeakPersistentHandle(Dart_WeakPersistentHandle object)
DART_EXPORT bool Dart_IdentityEquals(Dart_Handle obj1, Dart_Handle obj2)
struct _Dart_WeakPersistentHandle * Dart_WeakPersistentHandle
Definition dart_api.h:260
static Dart_Handle HandleFromFinalizable(Dart_FinalizableHandle object)

◆ Dart_DeletePersistentHandle()

DART_EXPORT void dart::Dart_DeletePersistentHandle ( Dart_PersistentHandle  object)

Definition at line 1114 of file dart_api_impl.cc.

1114 {
1115 Thread* T = Thread::Current();
1116 IsolateGroup* isolate_group = T->isolate_group();
1117 CHECK_ISOLATE_GROUP(isolate_group);
1118 TransitionToVM transition(T);
1119 ApiState* state = isolate_group->api_state();
1120 ASSERT(state != nullptr);
1121 ASSERT(state->IsActivePersistentHandle(object));
1122 ASSERT(!Api::IsProtectedHandle(object));
1123 if (!Api::IsProtectedHandle(object)) {
1124 PersistentHandle* ref = PersistentHandle::Cast(object);
1125 state->FreePersistentHandle(ref);
1126 }
1127}
ApiState * api_state() const
Definition isolate.h:693

◆ Dart_DeleteWeakPersistentHandle()

DART_EXPORT void dart::Dart_DeleteWeakPersistentHandle ( Dart_WeakPersistentHandle  object)

Definition at line 1129 of file dart_api_impl.cc.

1130 {
1131 Thread* T = Thread::Current();
1132 IsolateGroup* isolate_group = T->isolate_group();
1133 CHECK_ISOLATE_GROUP(isolate_group);
1134 TransitionToVM transition(T);
1135 ApiState* state = isolate_group->api_state();
1136 ASSERT(state != nullptr);
1137 ASSERT(state->IsActiveWeakPersistentHandle(object));
1138 auto weak_ref = FinalizablePersistentHandle::Cast(object);
1139 weak_ref->EnsureFreedExternal(isolate_group);
1140 state->FreeWeakPersistentHandle(weak_ref);
1141}

◆ Dart_DetectNullSafety()

DART_EXPORT bool dart::Dart_DetectNullSafety ( const char *  script_uri,
const char *  package_config,
const char *  original_working_directory,
const uint8_t *  snapshot_data,
const uint8_t *  snapshot_instructions,
const uint8_t *  kernel_buffer,
intptr_t  kernel_buffer_size 
)

Definition at line 6104 of file dart_api_impl.cc.

6110 {
6111 return true;
6112}

◆ Dart_DisableHeapSampling()

DART_EXPORT void dart::Dart_DisableHeapSampling ( void  )

Definition at line 1804 of file dart_api_impl.cc.

1804 {
1805#if !defined(PRODUCT) || defined(FORCE_INCLUDE_SAMPLING_HEAP_PROFILER)
1806 HeapProfileSampler::Enable(false);
1807#endif
1808}

◆ Dart_DoubleValue()

DART_EXPORT Dart_Handle dart::Dart_DoubleValue ( Dart_Handle  double_obj,
double *  value 
)

Definition at line 2722 of file dart_api_impl.cc.

2723 {
2724 DARTSCOPE(Thread::Current());
2725 const Double& obj = Api::UnwrapDoubleHandle(Z, double_obj);
2726 if (obj.IsNull()) {
2727 RETURN_TYPE_ERROR(Z, double_obj, Double);
2728 }
2729 *value = obj.value();
2730 return Api::Success();
2731}
double value() const
Definition object.h:10094

◆ Dart_DumpNativeStackTrace()

DART_EXPORT void dart::Dart_DumpNativeStackTrace ( void *  context)

Definition at line 40 of file unit_test_custom_zone.cc.

40 {
41 fprintf(stderr, "Dart_DumpNativeStackTrace() not implemented!\n");
42 exit(1);
43}

◆ Dart_EmptyString()

DART_EXPORT Dart_Handle dart::Dart_EmptyString ( void  )

Definition at line 2225 of file dart_api_impl.cc.

2225 {
2226 ASSERT(Isolate::Current() != nullptr);
2227 return Api::EmptyString();
2228}

◆ Dart_EnableHeapSampling()

DART_EXPORT void dart::Dart_EnableHeapSampling ( void  )

Definition at line 1798 of file dart_api_impl.cc.

1798 {
1799#if !defined(PRODUCT) || defined(FORCE_INCLUDE_SAMPLING_HEAP_PROFILER)
1800 HeapProfileSampler::Enable(true);
1801#endif
1802}

◆ Dart_EnterIsolate()

DART_EXPORT void dart::Dart_EnterIsolate ( Dart_Isolate  isolate)

Definition at line 1534 of file dart_api_impl.cc.

1534 {
1535 CHECK_NO_ISOLATE(Isolate::Current());
1536 // TODO(http://dartbug.com/16615): Validate isolate parameter.
1537 Isolate* iso = reinterpret_cast<Isolate*>(isolate);
1538 if (iso->IsScheduled()) {
1539 FATAL(
1540 "Isolate %s is already scheduled on mutator thread %p, "
1541 "failed to schedule from os thread 0x%" Px "\n",
1542 iso->name(), iso->scheduled_mutator_thread(),
1543 OSThread::ThreadIdToIntPtr(OSThread::GetCurrentThreadId()));
1544 }
1545 Thread::EnterIsolate(iso);
1546 // A Thread structure has been associated to the thread, we do the
1547 // safepoint transition explicitly here instead of using the
1548 // TransitionXXX scope objects as the reverse transition happens
1549 // outside this scope in Dart_ExitIsolate/Dart_ShutdownIsolate.
1550 Thread* T = Thread::Current();
1551 T->set_execution_state(Thread::kThreadInNative);
1552 T->EnterSafepoint();
1553}
Thread * scheduled_mutator_thread() const
Definition isolate.h:945
bool IsScheduled()
Definition isolate.h:944

◆ Dart_EnterScope()

DART_EXPORT void dart::Dart_EnterScope ( void  )

Definition at line 2184 of file dart_api_impl.cc.

2184 {
2185 Thread* thread = Thread::Current();
2186 Isolate* isolate = thread->isolate();
2187 CHECK_ISOLATE(isolate);
2188 TransitionNativeToVM transition(thread);
2189 thread->EnterApiScope();
2190}
void EnterApiScope()
Definition thread.cc:1235

◆ Dart_ErrorGetException()

DART_EXPORT Dart_Handle dart::Dart_ErrorGetException ( Dart_Handle  handle)

Definition at line 801 of file dart_api_impl.cc.

801 {
802 DARTSCOPE(Thread::Current());
803 const Object& obj = Object::Handle(Z, Api::UnwrapHandle(handle));
804 if (obj.IsUnhandledException()) {
805 const UnhandledException& error = UnhandledException::Cast(obj);
806 return Api::NewHandle(T, error.exception());
807 } else if (obj.IsError()) {
808 return Api::NewError("This error is not an unhandled exception error.");
809 } else {
810 return Api::NewError("Can only get exceptions from error handles.");
811 }
812}

◆ Dart_ErrorGetStackTrace()

DART_EXPORT Dart_Handle dart::Dart_ErrorGetStackTrace ( Dart_Handle  handle)

Definition at line 814 of file dart_api_impl.cc.

814 {
815 DARTSCOPE(Thread::Current());
816 const Object& obj = Object::Handle(Z, Api::UnwrapHandle(handle));
817 if (obj.IsUnhandledException()) {
818 const UnhandledException& error = UnhandledException::Cast(obj);
819 return Api::NewHandle(T, error.stacktrace());
820 } else if (obj.IsError()) {
821 return Api::NewError("This error is not an unhandled exception error.");
822 } else {
823 return Api::NewError("Can only get stacktraces from error handles.");
824 }
825}

◆ Dart_ErrorHasException()

DART_EXPORT bool dart::Dart_ErrorHasException ( Dart_Handle  handle)

Definition at line 795 of file dart_api_impl.cc.

795 {
796 DARTSCOPE(Thread::Current());
797 const Object& obj = Object::Handle(Z, Api::UnwrapHandle(handle));
798 return obj.IsUnhandledException();
799}

◆ Dart_EvaluateStaticExpr()

Dart_Handle dart::Dart_EvaluateStaticExpr ( Dart_Handle  lib_handle,
Dart_Handle  expr 
)

Execute the expression given in string \expr in the context of \lib_handle library, as if it were a top-level function in it.

Requires there to be a current isolate.

Returns
A handle to the computed value, or an error object if the compilation of the expression fails, or if the evaluation throws an error.

Definition at line 169 of file debugger_api_impl_test.cc.

170 {
171 DARTSCOPE(Thread::Current());
172 CHECK_DEBUGGER(T->isolate());
173
174 const Object& target = Object::Handle(Z, Api::UnwrapHandle(lib_handle));
175 if (target.IsError()) return lib_handle;
176 if (target.IsNull()) {
177 return Api::NewError("%s expects argument 'target' to be non-null",
179 }
180 const Library& lib = Library::Cast(target);
181 UNWRAP_AND_CHECK_PARAM(String, expr, expr_in);
182
183 if (!KernelIsolate::IsRunning()) {
184 UNREACHABLE();
185 } else {
186 Dart_KernelCompilationResult compilation_result =
187 KernelIsolate::CompileExpressionToKernel(
188 /* platform_kernel= */ nullptr, /* platform_kernel_size= */ 0,
189 expr.ToCString(),
190 /* definitions= */ Array::empty_array(),
191 /* definition_types= */ Array::empty_array(),
192 /* type_definitions= */ Array::empty_array(),
193 /* type_bounds= */ Array::empty_array(),
194 /* type_defaults= */ Array::empty_array(),
195 String::Handle(lib.url()).ToCString(),
196 /* klass= */ nullptr,
197 /* method= */ nullptr,
198 /* token_pos= */ TokenPosition::kNoSource,
199 /* script_uri= */ String::Handle(lib.url()).ToCString(),
200 /* is_static= */ true);
201 if (compilation_result.status != Dart_KernelCompilationStatus_Ok) {
202 return Api::NewError("Failed to compile expression.");
203 }
204
205 const ExternalTypedData& kernel_buffer =
206 ExternalTypedData::Handle(ExternalTypedData::NewFinalizeWithFree(
207 const_cast<uint8_t*>(compilation_result.kernel),
208 compilation_result.kernel_size));
209
210 Dart_Handle result = Api::NewHandle(
211 T,
212 lib.EvaluateCompiledExpression(kernel_buffer,
213 /* type_definitions= */
214 Array::empty_array(),
215 /* param_values= */
216 Array::empty_array(),
217 /* type_param_values= */
218 TypeArguments::null_type_arguments()));
219 return result;
220 }
221}
#define UNWRAP_AND_CHECK_PARAM(type, var, param)
#define Z
#define CHECK_DEBUGGER(isolate)

◆ Dart_ExecuteInternalCommand()

DART_EXPORT void * dart::Dart_ExecuteInternalCommand ( const char *  command,
void *  arg 
)

Definition at line 265 of file native_api_impl.cc.

265 {
266 if (strcmp(command, "gc-on-nth-allocation") == 0) {
267 Thread* const thread = Thread::Current();
268 Isolate* isolate = (thread == nullptr) ? nullptr : thread->isolate();
269 CHECK_ISOLATE(isolate);
270 TransitionNativeToVM _(thread);
271 intptr_t argument = reinterpret_cast<intptr_t>(arg);
272 ASSERT(argument > 0);
273 IsolateGroup::Current()->heap()->CollectOnNthAllocation(argument);
274 return nullptr;
275
276 } else if (strcmp(command, "gc-now") == 0) {
277 ASSERT(arg == nullptr); // Don't pass an argument to this command.
278 Thread* const thread = Thread::Current();
279 Isolate* isolate = (thread == nullptr) ? nullptr : thread->isolate();
280 CHECK_ISOLATE(isolate);
281 TransitionNativeToVM _(thread);
282 IsolateGroup::Current()->heap()->CollectAllGarbage(GCReason::kDebugging);
283 return nullptr;
284
285 } else if (strcmp(command, "is-thread-in-generated") == 0) {
286 if (Thread::Current()->execution_state() == Thread::kThreadInGenerated) {
287 return reinterpret_cast<void*>(1);
288 }
289 return nullptr;
290
291 } else if (strcmp(command, "is-mutator-in-native") == 0) {
292 Isolate* const isolate = reinterpret_cast<Isolate*>(arg);
293 CHECK_ISOLATE(isolate);
294 if (isolate->mutator_thread()->execution_state_cross_thread_for_testing() ==
295 Thread::kThreadInNative) {
296 return arg;
297 } else {
298 return nullptr;
299 }
300
301 } else if (strcmp(command, "run-in-safepoint-and-rw-code") == 0) {
302 const RunInSafepointAndRWCodeArgs* const args =
303 reinterpret_cast<RunInSafepointAndRWCodeArgs*>(arg);
304 Isolate* const isolate = args->isolate;
305 CHECK_ISOLATE(isolate);
306 auto isolate_group = isolate->group();
307 const bool kBypassSafepoint = false;
308 Thread::EnterIsolateGroupAsHelper(isolate_group, Thread::kUnknownTask,
309 kBypassSafepoint);
310 Thread* const thread = Thread::Current();
311 {
312 GcSafepointOperationScope scope(thread);
313 isolate_group->heap()->WriteProtectCode(/*read_only=*/false);
314 (*args->callback)();
315 isolate_group->heap()->WriteProtectCode(/*read_only=*/true);
316 }
317 Thread::ExitIsolateGroupAsHelper(kBypassSafepoint);
318 return nullptr;
319
320 } else {
321 UNREACHABLE();
322 }
323}

◆ Dart_ExitIsolate()

DART_EXPORT void dart::Dart_ExitIsolate ( void  )

Definition at line 1864 of file dart_api_impl.cc.

1864 {
1865 Thread* T = Thread::Current();
1866 CHECK_ISOLATE(T->isolate());
1867 // The Thread structure is disassociated from the isolate, we do the
1868 // safepoint transition explicitly here instead of using the TransitionXXX
1869 // scope objects as the original transition happened outside this scope in
1870 // Dart_EnterIsolate/Dart_CreateIsolateGroup.
1871 ASSERT(T->execution_state() == Thread::kThreadInNative);
1872 T->ExitSafepoint();
1873 T->set_execution_state(Thread::kThreadInVM);
1874 Thread::ExitIsolate();
1875}

◆ Dart_ExitScope()

DART_EXPORT void dart::Dart_ExitScope ( void  )

Definition at line 2192 of file dart_api_impl.cc.

2192 {
2193 Thread* thread = Thread::Current();
2194 CHECK_API_SCOPE(thread);
2195 TransitionNativeToVM transition(thread);
2196 thread->ExitApiScope();
2197}
void ExitApiScope()
Definition thread.cc:1248
#define CHECK_API_SCOPE(thread)

◆ Dart_False()

DART_EXPORT Dart_Handle dart::Dart_False ( void  )

Definition at line 2792 of file dart_api_impl.cc.

2792 {
2793 ASSERT(Isolate::Current() != nullptr);
2794 return Api::False();
2795}

◆ Dart_FinalizeAllClasses()

DART_EXPORT Dart_Handle dart::Dart_FinalizeAllClasses ( void  )

Definition at line 240 of file native_api_impl.cc.

240 {
241#if defined(DART_PRECOMPILED_RUNTIME)
242 return Api::NewError("%s: All classes are already finalized in AOT runtime.",
244#else
245 DARTSCOPE(Thread::Current());
247 Dart_Handle result = Api::CheckAndFinalizePendingClasses(T);
248 if (Api::IsError(result)) {
249 return result;
250 }
252 const Error& error = Error::Handle(T->zone(), Library::FinalizeAllClasses());
253 if (!error.IsNull()) {
254 return Api::NewHandle(T, error.ptr());
255 }
256 return Api::Success();
257#endif // defined(DART_PRECOMPILED_RUNTIME)
258}

◆ Dart_FinalizeLoading()

DART_EXPORT Dart_Handle dart::Dart_FinalizeLoading ( bool  complete_futures)

Definition at line 5804 of file dart_api_impl.cc.

5804 {
5805 DARTSCOPE(Thread::Current());
5807 Isolate* I = T->isolate();
5809
5810 // Finalize all classes if needed.
5811 Dart_Handle state = Api::CheckAndFinalizePendingClasses(T);
5812 if (Api::IsError(state)) {
5813 return state;
5814 }
5815
5816#if !defined(PRODUCT)
5817 // Now that the newly loaded classes are finalized, notify the debugger
5818 // that new code has been loaded. If there are latent breakpoints in
5819 // the new code, the debugger convert them to unresolved source breakpoints.
5820 // The code that completes the futures (invoked below) may call into the
5821 // newly loaded code and trigger one of these breakpoints.
5822 I->debugger()->NotifyDoneLoading();
5823#endif
5824
5825 // After having loaded all the code, we can let the GC set reasonable limits
5826 // for the heap growth.
5827 // If this is an auxiliary isolate inside a larger isolate group, we will not
5828 // re-initialize the growth policy.
5829 if (I->group()->ContainsOnlyOneIsolate()) {
5830 I->group()->heap()->old_space()->EvaluateAfterLoading();
5831 }
5832
5833#if !defined(DART_PRECOMPILED_RUNTIME)
5834 if (FLAG_enable_mirrors) {
5835 // Notify mirrors that MirrorSystem.libraries needs to be recomputed.
5836 const Library& libmirrors = Library::Handle(Z, Library::MirrorsLibrary());
5837 const Field& dirty_bit =
5838 Field::Handle(Z, libmirrors.LookupFieldAllowPrivate(
5839 String::Handle(String::New("_dirty"))));
5840 ASSERT(!dirty_bit.IsNull() && dirty_bit.is_static());
5841 dirty_bit.SetStaticValue(Bool::True());
5842 }
5843#endif
5844
5845 return Api::Success();
5846}

◆ Dart_FunctionIsStatic()

DART_EXPORT Dart_Handle dart::Dart_FunctionIsStatic ( Dart_Handle  function,
bool *  is_static 
)

Definition at line 2527 of file dart_api_impl.cc.

2528 {
2529 DARTSCOPE(Thread::Current());
2530 if (is_static == nullptr) {
2531 RETURN_NULL_ERROR(is_static);
2532 }
2533 const Function& func = Api::UnwrapFunctionHandle(Z, function);
2534 if (func.IsNull()) {
2535 RETURN_TYPE_ERROR(Z, function, Function);
2536 }
2537 *is_static = func.is_static();
2538 return Api::Success();
2539}

◆ Dart_FunctionName()

DART_EXPORT Dart_Handle dart::Dart_FunctionName ( Dart_Handle  function)

Definition at line 2476 of file dart_api_impl.cc.

2476 {
2477 DARTSCOPE(Thread::Current());
2478 const Function& func = Api::UnwrapFunctionHandle(Z, function);
2479 if (func.IsNull()) {
2481 }
2482 return Api::NewHandle(T, func.UserVisibleName());
2483}
StringPtr UserVisibleName() const
Definition object.cc:11057

◆ Dart_FunctionOwner()

DART_EXPORT Dart_Handle dart::Dart_FunctionOwner ( Dart_Handle  function)

Definition at line 2499 of file dart_api_impl.cc.

2499 {
2500 DARTSCOPE(Thread::Current());
2501 const Function& func = Api::UnwrapFunctionHandle(Z, function);
2502 if (func.IsNull()) {
2504 }
2505 if (func.IsNonImplicitClosureFunction()) {
2506 FunctionPtr parent_function = func.parent_function();
2507 return Api::NewHandle(T, parent_function);
2508 }
2509 const Class& owner = Class::Handle(Z, func.Owner());
2510 ASSERT(!owner.IsNull());
2511 if (owner.IsTopLevel()) {
2512// Top-level functions are implemented as members of a hidden class. We hide
2513// that class here and instead answer the library.
2514#if defined(DEBUG)
2515 const Library& lib = Library::Handle(Z, owner.library());
2516 if (lib.IsNull()) {
2517 ASSERT(owner.IsDynamicClass() || owner.IsVoidClass() ||
2518 owner.IsNeverClass());
2519 }
2520#endif
2521 return Api::NewHandle(T, owner.library());
2522 } else {
2523 return Api::NewHandle(T, owner.RareType());
2524 }
2525}
FunctionPtr parent_function() const
Definition object.cc:8225
bool IsNonImplicitClosureFunction() const
Definition object.h:3891
ClassPtr Owner() const
Definition object.cc:10899

◆ Dart_GetActivationFrame()

Dart_Handle dart::Dart_GetActivationFrame ( Dart_StackTrace  trace,
int  frame_index,
Dart_ActivationFrame frame 
)

Returns in \frame the activation frame with index \frame_index. The activation frame at the top of stack has index 0.

Requires there to be a current isolate.

Returns
A handle to the True object if no error occurs.

Definition at line 70 of file debugger_api_impl_test.cc.

72 {
73 DARTSCOPE(Thread::Current());
75 CHECK_AND_CAST(DebuggerStackTrace, stack_trace, trace);
76 if ((frame_index < 0) || (frame_index >= stack_trace->Length())) {
77 return Api::NewError("argument 'frame_index' is out of range for %s",
79 }
80 *frame =
81 reinterpret_cast<Dart_ActivationFrame>(stack_trace->FrameAt(frame_index));
82 return Api::Success();
83}
#define CHECK_NOT_NULL(param)

◆ Dart_GetClass()

DART_EXPORT Dart_Handle dart::Dart_GetClass ( Dart_Handle  library,
Dart_Handle  class_name 
)

Definition at line 5500 of file dart_api_impl.cc.

5501 {
5502 DARTSCOPE(Thread::Current());
5503 const Library& lib = Api::UnwrapLibraryHandle(Z, library);
5504 if (lib.IsNull()) {
5505 RETURN_TYPE_ERROR(Z, library, Library);
5506 }
5507 const String& cls_name = Api::UnwrapStringHandle(Z, class_name);
5508 if (cls_name.IsNull()) {
5509 RETURN_TYPE_ERROR(Z, class_name, String);
5510 }
5511 const Class& cls = Class::Handle(Z, lib.LookupClassAllowPrivate(cls_name));
5512 if (cls.IsNull()) {
5513 // TODO(turnidge): Return null or error in this case?
5514 const String& lib_name = String::Handle(Z, lib.name());
5515 return Api::NewError("Class '%s' not found in library '%s'.",
5516 cls_name.ToCString(), lib_name.ToCString());
5517 }
5518 cls.EnsureDeclarationLoaded();
5519 CHECK_ERROR_HANDLE(cls.VerifyEntryPoint());
5520 return Api::NewHandle(T, cls.RareType());
5521}

◆ Dart_GetCurrentUserTag()

DART_EXPORT Dart_Handle dart::Dart_GetCurrentUserTag ( )

Definition at line 6904 of file dart_api_impl.cc.

6904 {
6905 Thread* thread = Thread::Current();
6906 CHECK_ISOLATE(thread->isolate());
6907 DARTSCOPE(thread);
6908 Isolate* isolate = thread->isolate();
6909 return Api::NewHandle(thread, isolate->current_tag());
6910}
UserTagPtr current_tag() const
Definition isolate.h:1301

◆ Dart_GetDataFromByteBuffer()

DART_EXPORT Dart_Handle dart::Dart_GetDataFromByteBuffer ( Dart_Handle  object)

Definition at line 4156 of file dart_api_impl.cc.

4156 {
4157 Thread* thread = Thread::Current();
4158 Zone* zone = thread->zone();
4159 Isolate* isolate = thread->isolate();
4160 CHECK_ISOLATE(isolate);
4161 TransitionNativeToVM transition(thread);
4162 intptr_t class_id = Api::ClassId(object);
4163 if (class_id != kByteBufferCid) {
4164 RETURN_TYPE_ERROR(zone, object, 'ByteBuffer');
4165 }
4166 const Instance& instance = Api::UnwrapInstanceHandle(zone, object);
4167 ASSERT(!instance.IsNull());
4168 return Api::NewHandle(thread, ByteBuffer::Data(instance));
4169}

◆ Dart_GetDefaultUserTag()

DART_EXPORT Dart_Handle dart::Dart_GetDefaultUserTag ( )

Definition at line 6912 of file dart_api_impl.cc.

6912 {
6913 Thread* thread = Thread::Current();
6914 CHECK_ISOLATE(thread->isolate());
6915 DARTSCOPE(thread);
6916 Isolate* isolate = thread->isolate();
6917 return Api::NewHandle(thread, isolate->default_tag());
6918}
UserTagPtr default_tag() const
Definition isolate.h:1304

◆ Dart_GetError()

DART_EXPORT const char * dart::Dart_GetError ( Dart_Handle  handle)

Definition at line 788 of file dart_api_impl.cc.

788 {
789 DARTSCOPE(Thread::Current());
791 const Object& obj = Object::Handle(Z, Api::UnwrapHandle(handle));
792 return GetErrorString(T, obj);
793}
static const char * GetErrorString(Thread *thread, const Object &obj)

◆ Dart_GetField()

DART_EXPORT Dart_Handle dart::Dart_GetField ( Dart_Handle  container,
Dart_Handle  name 
)

Definition at line 4678 of file dart_api_impl.cc.

4678 {
4679 DARTSCOPE(Thread::Current());
4682
4683 String& field_name =
4684 String::Handle(Z, Api::UnwrapStringHandle(Z, name).ptr());
4685 if (field_name.IsNull()) {
4687 }
4688 const Object& obj = Object::Handle(Z, Api::UnwrapHandle(container));
4689 const bool throw_nsm_if_absent = true;
4690 const bool respect_reflectable = false;
4691 const bool check_is_entrypoint = FLAG_verify_entry_points;
4692
4693 if (obj.IsType()) {
4694 if (!Type::Cast(obj).IsFinalized()) {
4695 return Api::NewError(
4696 "%s expects argument 'container' to be a fully resolved type.",
4697 CURRENT_FUNC);
4698 }
4699 Class& cls = Class::Handle(Z, Type::Cast(obj).type_class());
4700 if (Library::IsPrivate(field_name)) {
4701 const Library& lib = Library::Handle(Z, cls.library());
4702 field_name = lib.PrivateName(field_name);
4703 }
4704 return Api::NewHandle(
4705 T, cls.InvokeGetter(field_name, throw_nsm_if_absent,
4706 respect_reflectable, check_is_entrypoint));
4707 } else if (obj.IsNull() || obj.IsInstance()) {
4708 Instance& instance = Instance::Handle(Z);
4709 instance ^= obj.ptr();
4710 if (Library::IsPrivate(field_name)) {
4711 const Class& cls = Class::Handle(Z, instance.clazz());
4712 const Library& lib = Library::Handle(Z, cls.library());
4713 field_name = lib.PrivateName(field_name);
4714 }
4715 return Api::NewHandle(T,
4716 instance.InvokeGetter(field_name, respect_reflectable,
4717 check_is_entrypoint));
4718 } else if (obj.IsLibrary()) {
4719 const Library& lib = Library::Cast(obj);
4720 // Check that the library is loaded.
4721 if (!lib.Loaded()) {
4722 return Api::NewError(
4723 "%s expects library argument 'container' to be loaded.",
4724 CURRENT_FUNC);
4725 }
4726 if (Library::IsPrivate(field_name)) {
4727 field_name = lib.PrivateName(field_name);
4728 }
4729 return Api::NewHandle(
4730 T, lib.InvokeGetter(field_name, throw_nsm_if_absent,
4731 respect_reflectable, check_is_entrypoint));
4732 } else if (obj.IsError()) {
4733 return container;
4734 } else {
4735 return Api::NewError(
4736 "%s expects argument 'container' to be an object, type, or library.",
4737 CURRENT_FUNC);
4738 }
4739}

◆ Dart_GetLibraryDebuggable()

Dart_Handle dart::Dart_GetLibraryDebuggable ( intptr_t  library_id,
bool *  is_debuggable 
)

Returns true if the debugger can step into code of the given library.

Requires there to be a current isolate.

Returns
A handle to the True object if no error occurs.

Definition at line 236 of file debugger_api_impl_test.cc.

237 {
238 DARTSCOPE(Thread::Current());
239 CHECK_NOT_NULL(is_debuggable);
240 const Library& lib = Library::Handle(Library::GetLibrary(library_id));
241 if (lib.IsNull()) {
242 return Api::NewError("%s: %" Pd " is not a valid library id", CURRENT_FUNC,
243 library_id);
244 }
245 *is_debuggable = lib.IsDebuggable();
246 return Api::Success();
247}
bool IsDebuggable() const
Definition object.h:5252

◆ Dart_GetLoadedLibraries()

DART_EXPORT Dart_Handle dart::Dart_GetLoadedLibraries ( void  )

Definition at line 5697 of file dart_api_impl.cc.

5697 {
5698 DARTSCOPE(Thread::Current());
5699 auto IG = T->isolate_group();
5700
5701 const GrowableObjectArray& libs =
5702 GrowableObjectArray::Handle(Z, IG->object_store()->libraries());
5703 int num_libs = libs.Length();
5704
5705 // Create new list and populate with the loaded libraries.
5706 Library& lib = Library::Handle();
5707 const Array& library_list = Array::Handle(Z, Array::New(num_libs));
5708 for (int i = 0; i < num_libs; i++) {
5709 lib ^= libs.At(i);
5710 ASSERT(!lib.IsNull());
5711 library_list.SetAt(i, lib);
5712 }
5713 return Api::NewHandle(T, library_list.ptr());
5714}

◆ Dart_GetMainPortId()

DART_EXPORT Dart_Port dart::Dart_GetMainPortId ( void  )

Definition at line 2176 of file dart_api_impl.cc.

2176 {
2177 Isolate* isolate = Isolate::Current();
2178 CHECK_ISOLATE(isolate);
2179 return isolate->main_port();
2180}
Dart_Port main_port() const
Definition isolate.h:1001

◆ Dart_GetMessageNotifyCallback()

DART_EXPORT Dart_MessageNotifyCallback dart::Dart_GetMessageNotifyCallback ( void  )

Definition at line 1976 of file dart_api_impl.cc.

1976 {
1977 Isolate* isolate = Isolate::Current();
1978 CHECK_ISOLATE(isolate);
1979 NoSafepointScope no_safepoint_scope;
1980 return isolate->message_notify_callback();
1981}
Dart_MessageNotifyCallback message_notify_callback() const
Definition isolate.h:964

◆ Dart_GetNativeArgument()

DART_EXPORT Dart_Handle dart::Dart_GetNativeArgument ( Dart_NativeArguments  args,
int  index 
)

Definition at line 5101 of file dart_api_impl.cc.

5102 {
5103 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args);
5104 if ((index < 0) || (index >= arguments->NativeArgCount())) {
5105 return Api::NewError(
5106 "%s: argument 'index' out of range. Expected 0..%d but saw %d.",
5107 CURRENT_FUNC, arguments->NativeArgCount() - 1, index);
5108 }
5109 TransitionNativeToVM transition(arguments->thread());
5110 return Api::NewHandle(arguments->thread(), arguments->NativeArgAt(index));
5111}
Thread * thread() const
ObjectPtr NativeArgAt(int index) const

◆ Dart_GetNativeArgumentCount()

DART_EXPORT int dart::Dart_GetNativeArgumentCount ( Dart_NativeArguments  args)

Definition at line 5113 of file dart_api_impl.cc.

5113 {
5114 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args);
5115 return arguments->NativeArgCount();
5116}

◆ Dart_GetNativeArguments()

DART_EXPORT Dart_Handle dart::Dart_GetNativeArguments ( Dart_NativeArguments  args,
int  num_arguments,
const Dart_NativeArgument_Descriptor argument_descriptors,
Dart_NativeArgument_Value arg_values 
)

Definition at line 4967 of file dart_api_impl.cc.

4971 {
4972 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args);
4973 TransitionNativeToVM transition(arguments->thread());
4974 ASSERT(arguments->thread()->isolate() == Isolate::Current());
4975 if (arg_values == nullptr) {
4976 RETURN_NULL_ERROR(arg_values);
4977 }
4978 for (int i = 0; i < num_arguments; i++) {
4979 Dart_NativeArgument_Descriptor desc = argument_descriptors[i];
4980 Dart_NativeArgument_Type arg_type =
4981 static_cast<Dart_NativeArgument_Type>(desc.type);
4982 int arg_index = desc.index;
4983 ASSERT(arg_index >= 0 && arg_index < arguments->NativeArgCount());
4984 Dart_NativeArgument_Value* native_value = &(arg_values[i]);
4985 switch (arg_type) {
4987 if (!Api::GetNativeBooleanArgument(arguments, arg_index,
4988 &(native_value->as_bool))) {
4989 return Api::NewArgumentError(
4990 "%s: expects argument at index %d to be of"
4991 " type Boolean.",
4992 CURRENT_FUNC, i);
4993 }
4994 break;
4995
4997 int64_t value = 0;
4998 if (!GetNativeIntegerArgument(arguments, arg_index, &value)) {
4999 return Api::NewArgumentError(
5000 "%s: expects argument at index %d to be of"
5001 " type Integer.",
5002 CURRENT_FUNC, i);
5003 }
5004 if (value < INT32_MIN || value > INT32_MAX) {
5005 return Api::NewArgumentError(
5006 "%s: argument value at index %d is out of range", CURRENT_FUNC,
5007 i);
5008 }
5009 native_value->as_int32 = static_cast<int32_t>(value);
5010 break;
5011 }
5012
5014 int64_t value = 0;
5015 if (!GetNativeIntegerArgument(arguments, arg_index, &value)) {
5016 return Api::NewArgumentError(
5017 "%s: expects argument at index %d to be of"
5018 " type Integer.",
5019 CURRENT_FUNC, i);
5020 }
5021 if (value < 0 || value > UINT32_MAX) {
5022 return Api::NewArgumentError(
5023 "%s: argument value at index %d is out of range", CURRENT_FUNC,
5024 i);
5025 }
5026 native_value->as_uint32 = static_cast<uint32_t>(value);
5027 break;
5028 }
5029
5031 int64_t value = 0;
5032 if (!GetNativeIntegerArgument(arguments, arg_index, &value)) {
5033 return Api::NewArgumentError(
5034 "%s: expects argument at index %d to be of"
5035 " type Integer.",
5036 CURRENT_FUNC, i);
5037 }
5038 native_value->as_int64 = value;
5039 break;
5040 }
5041
5043 uint64_t value = 0;
5044 if (!GetNativeUnsignedIntegerArgument(arguments, arg_index, &value)) {
5045 return Api::NewArgumentError(
5046 "%s: expects argument at index %d to be of"
5047 " type Integer.",
5048 CURRENT_FUNC, i);
5049 }
5050 native_value->as_uint64 = value;
5051 break;
5052 }
5053
5055 if (!GetNativeDoubleArgument(arguments, arg_index,
5056 &(native_value->as_double))) {
5057 return Api::NewArgumentError(
5058 "%s: expects argument at index %d to be of"
5059 " type Double.",
5060 CURRENT_FUNC, i);
5061 }
5062 break;
5063
5065 if (!GetNativeStringArgument(arguments, arg_index,
5066 &(native_value->as_string.dart_str),
5067 &(native_value->as_string.peer))) {
5068 return Api::NewArgumentError(
5069 "%s: expects argument at index %d to be of"
5070 " type String.",
5071 CURRENT_FUNC, i);
5072 }
5073 break;
5074
5077 arguments, arg_index, native_value->as_native_fields.num_fields,
5078 native_value->as_native_fields.values, CURRENT_FUNC);
5079 if (result != Api::Success()) {
5080 return result;
5081 }
5082 break;
5083 }
5084
5086 ASSERT(arguments->thread() == Thread::Current());
5087 ASSERT(arguments->thread()->api_top_scope() != nullptr);
5088 native_value->as_instance = Api::NewHandle(
5089 arguments->thread(), arguments->NativeArgAt(arg_index));
5090 break;
5091 }
5092
5093 default:
5094 return Api::NewArgumentError("%s: invalid argument type %d.",
5095 CURRENT_FUNC, arg_type);
5096 }
5097 }
5098 return Api::Success();
5099}
ApiLocalScope * api_top_scope() const
Definition thread.h:512
Dart_NativeArgument_Type
Definition dart_api.h:3017
@ Dart_NativeArgument_kString
Definition dart_api.h:3024
@ Dart_NativeArgument_kInt64
Definition dart_api.h:3021
@ Dart_NativeArgument_kNativeFields
Definition dart_api.h:3026
@ Dart_NativeArgument_kInstance
Definition dart_api.h:3025
@ Dart_NativeArgument_kInt32
Definition dart_api.h:3019
@ Dart_NativeArgument_kUint64
Definition dart_api.h:3022
@ Dart_NativeArgument_kUint32
Definition dart_api.h:3020
@ Dart_NativeArgument_kDouble
Definition dart_api.h:3023
@ Dart_NativeArgument_kBool
Definition dart_api.h:3018
static bool GetNativeStringArgument(NativeArguments *arguments, int arg_index, Dart_Handle *str, void **peer)
static bool GetNativeIntegerArgument(NativeArguments *arguments, int arg_index, int64_t *value)
static Dart_Handle GetNativeFieldsOfArgument(NativeArguments *arguments, int arg_index, int num_fields, intptr_t *field_values, const char *current_func)
static bool GetNativeDoubleArgument(NativeArguments *arguments, int arg_index, double *value)
static bool GetNativeUnsignedIntegerArgument(NativeArguments *arguments, int arg_index, uint64_t *value)
struct _Dart_NativeArgument_Value::@83 as_string
struct _Dart_NativeArgument_Value::@84 as_native_fields

◆ Dart_GetNativeBooleanArgument()

DART_EXPORT Dart_Handle dart::Dart_GetNativeBooleanArgument ( Dart_NativeArguments  args,
int  index,
bool *  value 
)

Definition at line 5186 of file dart_api_impl.cc.

5188 {
5189 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args);
5190 if ((index < 0) || (index >= arguments->NativeArgCount())) {
5191 return Api::NewError(
5192 "%s: argument 'index' out of range. Expected 0..%d but saw %d.",
5193 CURRENT_FUNC, arguments->NativeArgCount() - 1, index);
5194 }
5195 if (!Api::GetNativeBooleanArgument(arguments, index, value)) {
5196 return Api::NewArgumentError(
5197 "%s: expects argument at %d to be of type Boolean.", CURRENT_FUNC,
5198 index);
5199 }
5200 return Api::Success();
5201}

◆ Dart_GetNativeDoubleArgument()

DART_EXPORT Dart_Handle dart::Dart_GetNativeDoubleArgument ( Dart_NativeArguments  args,
int  index,
double *  value 
)

Definition at line 5203 of file dart_api_impl.cc.

5205 {
5206 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args);
5207 if ((index < 0) || (index >= arguments->NativeArgCount())) {
5208 return Api::NewError(
5209 "%s: argument 'index' out of range. Expected 0..%d but saw %d.",
5210 CURRENT_FUNC, arguments->NativeArgCount() - 1, index);
5211 }
5212 if (!GetNativeDoubleArgument(arguments, index, value)) {
5213 return Api::NewArgumentError(
5214 "%s: expects argument at %d to be of"
5215 " type Double.",
5216 CURRENT_FUNC, index);
5217 }
5218 return Api::Success();
5219}

◆ Dart_GetNativeFieldsOfArgument()

DART_EXPORT Dart_Handle dart::Dart_GetNativeFieldsOfArgument ( Dart_NativeArguments  args,
int  arg_index,
int  num_fields,
intptr_t *  field_values 
)

Definition at line 5119 of file dart_api_impl.cc.

5122 {
5123 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args);
5124 if ((arg_index < 0) || (arg_index >= arguments->NativeArgCount())) {
5125 return Api::NewError(
5126 "%s: argument 'arg_index' out of range. Expected 0..%d but saw %d.",
5127 CURRENT_FUNC, arguments->NativeArgCount() - 1, arg_index);
5128 }
5129 if (field_values == nullptr) {
5130 RETURN_NULL_ERROR(field_values);
5131 }
5132 return GetNativeFieldsOfArgument(arguments, arg_index, num_fields,
5133 field_values, CURRENT_FUNC);
5134}

◆ Dart_GetNativeInstanceField()

DART_EXPORT Dart_Handle dart::Dart_GetNativeInstanceField ( Dart_Handle  obj,
int  index,
intptr_t *  value 
)

Definition at line 4915 of file dart_api_impl.cc.

4917 {
4918 Thread* thread = Thread::Current();
4919 CHECK_ISOLATE(thread->isolate());
4920 TransitionNativeToVM transition(thread);
4921 bool is_null = false;
4922 {
4923 ReusableObjectHandleScope reused_obj_handle(thread);
4924 const Instance& instance =
4925 Api::UnwrapInstanceHandle(reused_obj_handle, obj);
4926 if (!instance.IsNull()) {
4927 if (instance.IsValidNativeIndex(index)) {
4928 *value = instance.GetNativeField(index);
4929 return Api::Success();
4930 }
4931 } else {
4932 is_null = true;
4933 }
4934 }
4935 if (is_null) {
4936 RETURN_TYPE_ERROR(thread->zone(), obj, Instance);
4937 }
4938 return Api::NewError(
4939 "%s: invalid index %d passed into access native instance field",
4940 CURRENT_FUNC, index);
4941}

◆ Dart_GetNativeInstanceFieldCount()

DART_EXPORT Dart_Handle dart::Dart_GetNativeInstanceFieldCount ( Dart_Handle  obj,
int count 
)

Definition at line 4898 of file dart_api_impl.cc.

4899 {
4900 Thread* thread = Thread::Current();
4901 CHECK_ISOLATE(thread->isolate());
4902 TransitionNativeToVM transition(thread);
4903 {
4904 ReusableObjectHandleScope reused_obj_handle(thread);
4905 const Instance& instance =
4906 Api::UnwrapInstanceHandle(reused_obj_handle, obj);
4907 if (!instance.IsNull()) {
4908 *count = instance.NumNativeFields();
4909 return Api::Success();
4910 }
4911 }
4912 RETURN_TYPE_ERROR(thread->zone(), obj, Instance);
4913}

◆ Dart_GetNativeIntegerArgument()

DART_EXPORT Dart_Handle dart::Dart_GetNativeIntegerArgument ( Dart_NativeArguments  args,
int  index,
int64_t *  value 
)

Definition at line 5168 of file dart_api_impl.cc.

5170 {
5171 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args);
5172 if ((index < 0) || (index >= arguments->NativeArgCount())) {
5173 return Api::NewError(
5174 "%s: argument 'index' out of range. Expected 0..%d but saw %d.",
5175 CURRENT_FUNC, arguments->NativeArgCount() - 1, index);
5176 }
5177 if (!GetNativeIntegerArgument(arguments, index, value)) {
5178 return Api::NewArgumentError(
5179 "%s: expects argument at %d to be of"
5180 " type Integer.",
5181 CURRENT_FUNC, index);
5182 }
5183 return Api::Success();
5184}

◆ Dart_GetNativeIsolateGroupData()

DART_EXPORT void * dart::Dart_GetNativeIsolateGroupData ( Dart_NativeArguments  args)

Definition at line 4960 of file dart_api_impl.cc.

4960 {
4961 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args);
4962 Isolate* isolate = arguments->thread()->isolate();
4963 ASSERT(isolate == Isolate::Current());
4964 return isolate->init_callback_data();
4965}

◆ Dart_GetNativeReceiver()

DART_EXPORT Dart_Handle dart::Dart_GetNativeReceiver ( Dart_NativeArguments  args,
intptr_t *  value 
)

Definition at line 5136 of file dart_api_impl.cc.

5137 {
5138 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args);
5139 TransitionNativeToVM transition(arguments->thread());
5140 ASSERT(arguments->thread()->isolate() == Isolate::Current());
5141 if (value == nullptr) {
5142 RETURN_NULL_ERROR(value);
5143 }
5144 if (Api::GetNativeReceiver(arguments, value)) {
5145 return Api::Success();
5146 }
5147 return Api::NewError(
5148 "%s expects receiver argument to be non-null and of"
5149 " type Instance.",
5150 CURRENT_FUNC);
5151}

◆ Dart_GetNativeResolver()

DART_EXPORT Dart_Handle dart::Dart_GetNativeResolver ( Dart_Handle  library,
Dart_NativeEntryResolver resolver 
)

Definition at line 5934 of file dart_api_impl.cc.

5935 {
5936 if (resolver == nullptr) {
5937 RETURN_NULL_ERROR(resolver);
5938 }
5939 *resolver = nullptr;
5940 DARTSCOPE(Thread::Current());
5941 const Library& lib = Api::UnwrapLibraryHandle(Z, library);
5942 if (lib.IsNull()) {
5943 RETURN_TYPE_ERROR(Z, library, Library);
5944 }
5945 *resolver = lib.native_entry_resolver();
5946 return Api::Success();
5947}

◆ Dart_GetNativeStringArgument()

DART_EXPORT Dart_Handle dart::Dart_GetNativeStringArgument ( Dart_NativeArguments  args,
int  arg_index,
void **  peer 
)

Definition at line 5153 of file dart_api_impl.cc.

5155 {
5156 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args);
5157 TransitionNativeToVM transition(arguments->thread());
5158 Dart_Handle result = Api::Null();
5159 if (!GetNativeStringArgument(arguments, arg_index, &result, peer)) {
5160 return Api::NewArgumentError(
5161 "%s expects argument at %d to be of"
5162 " type String.",
5163 CURRENT_FUNC, arg_index);
5164 }
5165 return result;
5166}

◆ Dart_GetNativeSymbol()

DART_EXPORT Dart_Handle dart::Dart_GetNativeSymbol ( Dart_Handle  library,
Dart_NativeEntrySymbol resolver 
)

Definition at line 5949 of file dart_api_impl.cc.

5950 {
5951 if (resolver == nullptr) {
5952 RETURN_NULL_ERROR(resolver);
5953 }
5954 *resolver = nullptr;
5955 DARTSCOPE(Thread::Current());
5956 const Library& lib = Api::UnwrapLibraryHandle(Z, library);
5957 if (lib.IsNull()) {
5958 RETURN_TYPE_ERROR(Z, library, Library);
5959 }
5960 *resolver = lib.native_entry_symbol_resolver();
5961 return Api::Success();
5962}

◆ Dart_GetNonNullableType()

DART_EXPORT Dart_Handle dart::Dart_GetNonNullableType ( Dart_Handle  library,
Dart_Handle  class_name,
intptr_t  number_of_type_arguments,
Dart_Handle type_arguments 
)

Definition at line 5618 of file dart_api_impl.cc.

5621 {
5622 return GetTypeCommon(library, class_name, number_of_type_arguments,
5623 type_arguments, Nullability::kNonNullable);
5624}
static Dart_Handle GetTypeCommon(Dart_Handle library, Dart_Handle class_name, intptr_t number_of_type_arguments, Dart_Handle *type_arguments, Nullability nullability)

◆ Dart_GetNullableType()

DART_EXPORT Dart_Handle dart::Dart_GetNullableType ( Dart_Handle  library,
Dart_Handle  class_name,
intptr_t  number_of_type_arguments,
Dart_Handle type_arguments 
)

Definition at line 5609 of file dart_api_impl.cc.

5612 {
5613 return GetTypeCommon(library, class_name, number_of_type_arguments,
5614 type_arguments, Nullability::kNullable);
5615}

◆ Dart_GetObfuscationMap()

DART_EXPORT Dart_Handle dart::Dart_GetObfuscationMap ( uint8_t **  buffer,
intptr_t *  buffer_length 
)

Definition at line 6845 of file dart_api_impl.cc.

6846 {
6847#if defined(DART_PRECOMPILED_RUNTIME)
6848 return Api::NewError("No obfuscation map to save on an AOT runtime.");
6849#elif !defined(DART_PRECOMPILER)
6850 return Api::NewError("Obfuscation is only supported for AOT compiler.");
6851#else
6852 Thread* thread = Thread::Current();
6853 DARTSCOPE(thread);
6854 auto isolate_group = thread->isolate_group();
6855
6856 if (buffer == nullptr) {
6858 }
6859 if (buffer_length == nullptr) {
6860 RETURN_NULL_ERROR(buffer_length);
6861 }
6862
6863 // Note: can't use JSONStream in PRODUCT builds.
6864 const intptr_t kInitialBufferSize = 1 * MB;
6865 ZoneTextBuffer text_buffer(Api::TopScope(T)->zone(), kInitialBufferSize);
6866
6867 text_buffer.AddChar('[');
6868 if (isolate_group->obfuscation_map() != nullptr) {
6869 for (intptr_t i = 0; isolate_group->obfuscation_map()[i] != nullptr; i++) {
6870 if (i > 0) {
6871 text_buffer.AddChar(',');
6872 }
6873 text_buffer.AddChar('"');
6874 text_buffer.AddEscapedString(isolate_group->obfuscation_map()[i]);
6875 text_buffer.AddChar('"');
6876 }
6877 }
6878 text_buffer.AddChar(']');
6879
6880 *buffer_length = text_buffer.length();
6881 *reinterpret_cast<char**>(buffer) = text_buffer.buffer();
6882 return Api::Success();
6883#endif
6884}

◆ Dart_GetPeer()

DART_EXPORT Dart_Handle dart::Dart_GetPeer ( Dart_Handle  object,
void **  peer 
)

Definition at line 5978 of file dart_api_impl.cc.

5978 {
5979 if (peer == nullptr) {
5980 RETURN_NULL_ERROR(peer);
5981 }
5982 Thread* thread = Thread::Current();
5983 CHECK_ISOLATE(thread->isolate());
5984 TransitionNativeToVM transition(thread);
5986 Object& obj = thread->ObjectHandle();
5987 obj = Api::UnwrapHandle(object);
5988 if (obj.IsNull() || obj.IsNumber() || obj.IsBool()) {
5989 const char* msg =
5990 "%s: argument 'object' cannot be a subtype of Null, num, or bool";
5991 return Api::NewError(msg, CURRENT_FUNC);
5992 }
5993 {
5994 NoSafepointScope no_safepoint;
5995 ObjectPtr raw_obj = obj.ptr();
5996 *peer = thread->heap()->GetPeer(raw_obj);
5997 }
5998 return Api::Success();
5999}
#define REUSABLE_OBJECT_HANDLESCOPE(thread)

◆ Dart_GetStackTrace()

Dart_Handle dart::Dart_GetStackTrace ( Dart_StackTrace trace)

Returns in \trace the current stack trace, or nullptr if the VM is not paused.

Requires there to be a current isolate.

Returns
A valid handle if no error occurs during the operation.

Definition at line 85 of file debugger_api_impl_test.cc.

85 {
86 DARTSCOPE(Thread::Current());
87 Isolate* I = T->isolate();
89 CHECK_NOT_NULL(trace);
90 *trace = reinterpret_cast<Dart_StackTrace>(DebuggerStackTrace::Collect());
91 return Api::Success();
92}

◆ Dart_GetStackTraceFromError()

Dart_Handle dart::Dart_GetStackTraceFromError ( Dart_Handle  error,
Dart_StackTrace trace 
)

Returns in \trace the stack trace associated with the error given in \handle.

Requires there to be a current isolate.

Returns
A valid handle if no error occurs during the operation.

Definition at line 94 of file debugger_api_impl_test.cc.

95 {
96 DARTSCOPE(Thread::Current());
97 CHECK_DEBUGGER(T->isolate());
98 CHECK_NOT_NULL(trace);
99 const Object& obj = Object::Handle(Z, Api::UnwrapHandle(handle));
100 if (obj.IsUnhandledException()) {
101 const UnhandledException& error = UnhandledException::Cast(obj);
102 StackTrace& dart_stacktrace = StackTrace::Handle(Z);
103 dart_stacktrace ^= error.stacktrace();
104 if (dart_stacktrace.IsNull()) {
105 *trace = nullptr;
106 } else {
107 *trace = reinterpret_cast<Dart_StackTrace>(
108 DebuggerStackTrace::From(dart_stacktrace));
109 }
110 return Api::Success();
111 } else {
112 return Api::NewError(
113 "Can only get stacktraces from error handles or "
114 "instances of Error.");
115 }
116}

◆ Dart_GetStaticMethodClosure()

DART_EXPORT Dart_Handle dart::Dart_GetStaticMethodClosure ( Dart_Handle  library,
Dart_Handle  cls_type,
Dart_Handle  function_name 
)

Definition at line 2733 of file dart_api_impl.cc.

2735 {
2736 DARTSCOPE(Thread::Current());
2737 const Library& lib = Api::UnwrapLibraryHandle(Z, library);
2738 if (lib.IsNull()) {
2739 RETURN_TYPE_ERROR(Z, library, Library);
2740 }
2741
2742 const Type& type_obj = Api::UnwrapTypeHandle(Z, cls_type);
2743 if (type_obj.IsNull()) {
2744 RETURN_TYPE_ERROR(Z, cls_type, Type);
2745 }
2746
2747 const Class& klass = Class::Handle(Z, type_obj.type_class());
2748 if (klass.IsNull()) {
2749 return Api::NewError(
2750 "cls_type must be a Type object which represents a Class");
2751 }
2752
2753 const auto& error = klass.EnsureIsFinalized(Thread::Current());
2754 if (error != Error::null()) {
2755 return Api::NewHandle(T, error);
2756 }
2757
2758 const String& func_name = Api::UnwrapStringHandle(Z, function_name);
2759 if (func_name.IsNull()) {
2760 RETURN_TYPE_ERROR(Z, function_name, String);
2761 }
2762
2763 Function& func =
2764 Function::Handle(Z, klass.LookupStaticFunctionAllowPrivate(func_name));
2765 if (func.IsNull()) {
2766 return Dart_Null();
2767 }
2768
2769 if (!func.is_static()) {
2770 return Api::NewError("function_name must refer to a static method.");
2771 }
2772
2773 if (func.kind() != UntaggedFunction::kRegularFunction) {
2774 return Api::NewError(
2775 "function_name must be the name of a regular function.");
2776 }
2777 func = func.ImplicitClosureFunction();
2778 if (func.IsNull()) {
2779 return Dart_Null();
2780 }
2781
2782 return Api::NewHandle(T, func.ImplicitStaticClosure());
2783}

◆ Dart_GetStickyError()

DART_EXPORT Dart_Handle dart::Dart_GetStickyError ( void  )

Definition at line 1768 of file dart_api_impl.cc.

1768 {
1769 Thread* T = Thread::Current();
1770 Isolate* I = T->isolate();
1772 {
1773 NoSafepointScope no_safepoint_scope;
1774 if (I->sticky_error() == Error::null()) {
1775 return Api::Null();
1776 }
1777 }
1778 TransitionNativeToVM transition(T);
1779 return Api::NewHandle(T, I->sticky_error());
1780}

◆ Dart_GetType()

DART_EXPORT Dart_Handle dart::Dart_GetType ( Dart_Handle  library,
Dart_Handle  class_name,
intptr_t  number_of_type_arguments,
Dart_Handle type_arguments 
)

Definition at line 5600 of file dart_api_impl.cc.

5603 {
5604 return Api::NewError(
5605 "Cannot use legacy types with --sound-null-safety enabled. "
5606 "Use Dart_GetNullableType or Dart_GetNonNullableType instead.");
5607}

◆ Dart_GetTypeOfExternalTypedData()

DART_EXPORT Dart_TypedData_Type dart::Dart_GetTypeOfExternalTypedData ( Dart_Handle  object)

Definition at line 3710 of file dart_api_impl.cc.

3710 {
3711 Thread* thread = Thread::Current();
3712 API_TIMELINE_DURATION(thread);
3713 TransitionNativeToVM transition(thread);
3714 intptr_t class_id = Api::ClassId(object);
3715 if (IsExternalTypedDataClassId(class_id)) {
3716 return GetType(class_id);
3717 }
3718 if (IsTypedDataViewClassId(class_id) ||
3719 IsUnmodifiableTypedDataViewClassId(class_id)) {
3720 // Check if data object of the view is external.
3721 Zone* zone = thread->zone();
3722 const auto& view_obj = Api::UnwrapTypedDataViewHandle(zone, object);
3723 ASSERT(!view_obj.IsNull());
3724 const auto& data_obj = Instance::Handle(zone, view_obj.typed_data());
3725 if (ExternalTypedData::IsExternalTypedData(data_obj)) {
3726 return GetType(class_id);
3727 }
3728 }
3730}
@ Dart_TypedData_kInvalid
Definition dart_api.h:2619
static Dart_TypedData_Type GetType(intptr_t class_id)
bool IsExternalTypedDataClassId(intptr_t index)
Definition class_id.h:447

◆ Dart_GetTypeOfTypedData()

DART_EXPORT Dart_TypedData_Type dart::Dart_GetTypeOfTypedData ( Dart_Handle  object)

Definition at line 3697 of file dart_api_impl.cc.

3697 {
3698 Thread* thread = Thread::Current();
3699 API_TIMELINE_DURATION(thread);
3700 TransitionNativeToVM transition(thread);
3701 intptr_t class_id = Api::ClassId(object);
3702 if (IsTypedDataClassId(class_id) || IsTypedDataViewClassId(class_id) ||
3704 return GetType(class_id);
3705 }
3707}
bool IsTypedDataViewClassId(intptr_t index)
Definition class_id.h:439
bool IsTypedDataClassId(intptr_t index)
Definition class_id.h:433
bool IsUnmodifiableTypedDataViewClassId(intptr_t index)
Definition class_id.h:453

◆ Dart_GetUserTagLabel()

DART_EXPORT char * dart::Dart_GetUserTagLabel ( Dart_Handle  user_tag)

Definition at line 6943 of file dart_api_impl.cc.

6943 {
6944 DARTSCOPE(Thread::Current());
6945 const UserTag& tag = Api::UnwrapUserTagHandle(Z, user_tag);
6946 if (tag.IsNull()) {
6947 return nullptr;
6948 }
6949 const String& label = String::Handle(Z, tag.label());
6950 return Utils::StrDup(label.ToCString());
6951}
StringPtr label() const
Definition object.h:13142

◆ Dart_HandleFromPersistent()

DART_EXPORT Dart_Handle dart::Dart_HandleFromPersistent ( Dart_PersistentHandle  object)

Definition at line 929 of file dart_api_impl.cc.

929 {
930 Thread* thread = Thread::Current();
931 Isolate* isolate = thread->isolate();
932 CHECK_ISOLATE(isolate);
933 ApiState* state = isolate->group()->api_state();
934 ASSERT(state != nullptr);
935 TransitionNativeToVM transition(thread);
936 NoSafepointScope no_safepoint_scope;
937 PersistentHandle* ref = PersistentHandle::Cast(object);
938 return Api::NewHandle(thread, ref->ptr());
939}
ObjectPtr ptr() const

◆ Dart_HandleFromWeakPersistent()

DART_EXPORT Dart_Handle dart::Dart_HandleFromWeakPersistent ( Dart_WeakPersistentHandle  object)

Definition at line 942 of file dart_api_impl.cc.

942 {
943 Thread* thread = Thread::Current();
944 Isolate* isolate = thread->isolate();
945 CHECK_ISOLATE(isolate);
946 ApiState* state = isolate->group()->api_state();
947 ASSERT(state != nullptr);
948 TransitionNativeToVM transition(thread);
949 NoSafepointScope no_safepoint_scope;
951 FinalizablePersistentHandle::Cast(object);
952 if (weak_ref->IsFinalizedNotFreed()) {
953 return Dart_Null();
954 }
955 return Api::NewHandle(thread, weak_ref->ptr());
956}

◆ Dart_HandleMessage()

DART_EXPORT Dart_Handle dart::Dart_HandleMessage ( void  )

Definition at line 2087 of file dart_api_impl.cc.

2087 {
2088 Thread* T = Thread::Current();
2089 Isolate* I = T->isolate();
2093 TransitionNativeToVM transition(T);
2094 if (I->message_handler()->HandleNextMessage() != MessageHandler::kOK) {
2095 return Api::NewHandle(T, T->StealStickyError());
2096 }
2097 return Api::Success();
2098}
#define API_TIMELINE_BEGIN_END(thread)

◆ Dart_HandleServiceMessages()

DART_EXPORT bool dart::Dart_HandleServiceMessages ( void  )

Definition at line 2100 of file dart_api_impl.cc.

2100 {
2101#if defined(PRODUCT)
2102 return true;
2103#else
2104 Thread* T = Thread::Current();
2105 Isolate* I = T->isolate();
2109 TransitionNativeToVM transition(T);
2110 ASSERT(I->GetAndClearResumeRequest() == false);
2112 I->message_handler()->HandleOOBMessages();
2113 bool resume = I->GetAndClearResumeRequest();
2114 return (status != MessageHandler::kOK) || resume;
2115#endif
2116}

◆ Dart_HasLivePorts()

DART_EXPORT bool dart::Dart_HasLivePorts ( void  )

Definition at line 2129 of file dart_api_impl.cc.

2129 {
2130 Isolate* isolate = Isolate::Current();
2131 ASSERT(isolate);
2132 NoSafepointScope no_safepoint_scope;
2133 return isolate->HasLivePorts();
2134}
bool HasLivePorts()
Definition isolate.cc:3706

◆ Dart_HasServiceMessages()

DART_EXPORT bool dart::Dart_HasServiceMessages ( void  )

Definition at line 2118 of file dart_api_impl.cc.

2118 {
2119#if defined(PRODUCT)
2120 return false;
2121#else
2122 Isolate* isolate = Isolate::Current();
2123 ASSERT(isolate);
2124 NoSafepointScope no_safepoint_scope;
2125 return isolate->message_handler()->HasOOBMessages();
2126#endif
2127}
MessageHandler * message_handler() const
Definition isolate.cc:2380

◆ Dart_HasStickyError()

DART_EXPORT bool dart::Dart_HasStickyError ( void  )

Definition at line 1760 of file dart_api_impl.cc.

1760 {
1761 Thread* T = Thread::Current();
1762 Isolate* isolate = T->isolate();
1763 CHECK_ISOLATE(isolate);
1764 NoSafepointScope no_safepoint_scope;
1765 return isolate->sticky_error() != Error::null();
1766}
ErrorPtr sticky_error() const
Definition isolate.h:1310

◆ Dart_IdentityEquals()

DART_EXPORT bool dart::Dart_IdentityEquals ( Dart_Handle  obj1,
Dart_Handle  obj2 
)

Definition at line 912 of file dart_api_impl.cc.

912 {
913 DARTSCOPE(Thread::Current());
914 {
915 NoSafepointScope no_safepoint_scope;
916 if (Api::UnwrapHandle(obj1) == Api::UnwrapHandle(obj2)) {
917 return true;
918 }
919 }
920 const Object& object1 = Object::Handle(Z, Api::UnwrapHandle(obj1));
921 const Object& object2 = Object::Handle(Z, Api::UnwrapHandle(obj2));
922 if (object1.IsInstance() && object2.IsInstance()) {
923 return Instance::Cast(object1).IsIdenticalTo(Instance::Cast(object2));
924 }
925 return false;
926}

◆ Dart_Initialize()

DART_EXPORT char * dart::Dart_Initialize ( Dart_InitializeParams params)

Definition at line 1165 of file dart_api_impl.cc.

1165 {
1166 if (params == nullptr) {
1167 return Utils::StrDup(
1168 "Dart_Initialize: "
1169 "Dart_InitializeParams is null.");
1170 }
1171
1173 return Utils::StrDup(
1174 "Dart_Initialize: "
1175 "Invalid Dart_InitializeParams version.");
1176 }
1177
1178 return Dart::Init(params);
1179}
#define DART_INITIALIZE_PARAMS_CURRENT_VERSION
Definition dart_api.h:839

◆ Dart_InstanceGetType()

DART_EXPORT Dart_Handle dart::Dart_InstanceGetType ( Dart_Handle  instance)

Definition at line 2460 of file dart_api_impl.cc.

2460 {
2461 DARTSCOPE(Thread::Current());
2463 auto isolate_group = T->isolate_group();
2464 const Object& obj = Object::Handle(Z, Api::UnwrapHandle(instance));
2465 if (obj.IsNull()) {
2466 return Api::NewHandle(T, isolate_group->object_store()->null_type());
2467 }
2468 if (!obj.IsInstance()) {
2469 RETURN_TYPE_ERROR(Z, instance, Instance);
2470 }
2471 const AbstractType& type =
2472 AbstractType::Handle(Instance::Cast(obj).GetType(Heap::kNew));
2473 return Api::NewHandle(T, type.Canonicalize(T));
2474}

◆ Dart_IntegerFitsIntoInt64()

DART_EXPORT Dart_Handle dart::Dart_IntegerFitsIntoInt64 ( Dart_Handle  integer,
bool *  fits 
)

Definition at line 2571 of file dart_api_impl.cc.

2572 {
2573 // Fast path for Smis and Mints.
2574 Thread* thread = Thread::Current();
2575 API_TIMELINE_DURATION(thread);
2576 Isolate* isolate = thread->isolate();
2577 CHECK_ISOLATE(isolate);
2578 if (Api::IsSmi(integer)) {
2579 *fits = true;
2580 return Api::Success();
2581 }
2582 // Slow path for mints and type error.
2583 DARTSCOPE(thread);
2584 if (Api::ClassId(integer) == kMintCid) {
2585 *fits = true;
2586 return Api::Success();
2587 }
2588 const Integer& int_obj = Api::UnwrapIntegerHandle(Z, integer);
2589 ASSERT(int_obj.IsNull());
2590 RETURN_TYPE_ERROR(Z, integer, Integer);
2591}

◆ Dart_IntegerFitsIntoUint64()

DART_EXPORT Dart_Handle dart::Dart_IntegerFitsIntoUint64 ( Dart_Handle  integer,
bool *  fits 
)

Definition at line 2593 of file dart_api_impl.cc.

2594 {
2595 // Fast path for Smis.
2596 Thread* thread = Thread::Current();
2597 Isolate* isolate = thread->isolate();
2598 CHECK_ISOLATE(isolate);
2599 API_TIMELINE_DURATION(thread);
2600 if (Api::IsSmi(integer)) {
2601 *fits = (Api::SmiValue(integer) >= 0);
2602 return Api::Success();
2603 }
2604 // Slow path for Mints.
2605 DARTSCOPE(thread);
2606 const Integer& int_obj = Api::UnwrapIntegerHandle(Z, integer);
2607 if (int_obj.IsNull()) {
2608 RETURN_TYPE_ERROR(Z, integer, Integer);
2609 }
2610 ASSERT(int_obj.IsMint());
2611 *fits = !int_obj.IsNegative();
2612 return Api::Success();
2613}

◆ Dart_IntegerToHexCString()

DART_EXPORT Dart_Handle dart::Dart_IntegerToHexCString ( Dart_Handle  integer,
const char **  value 
)

Definition at line 2703 of file dart_api_impl.cc.

2704 {
2705 DARTSCOPE(Thread::Current());
2707 const Integer& int_obj = Api::UnwrapIntegerHandle(Z, integer);
2708 if (int_obj.IsNull()) {
2709 RETURN_TYPE_ERROR(Z, integer, Integer);
2710 }
2711 Zone* scope_zone = Api::TopScope(Thread::Current())->zone();
2712 *value = int_obj.ToHexCString(scope_zone);
2713 return Api::Success();
2714}
const char * ToHexCString(Zone *zone) const
Definition object.cc:23179

◆ Dart_IntegerToInt64()

DART_EXPORT Dart_Handle dart::Dart_IntegerToInt64 ( Dart_Handle  integer,
int64_t *  value 
)

Definition at line 2650 of file dart_api_impl.cc.

2651 {
2652 // Fast path for Smis.
2653 Thread* thread = Thread::Current();
2654 Isolate* isolate = thread->isolate();
2655 CHECK_ISOLATE(isolate);
2656 if (Api::IsSmi(integer)) {
2657 *value = Api::SmiValue(integer);
2658 return Api::Success();
2659 }
2660 // Slow path for Mints.
2661 DARTSCOPE(thread);
2662 const Integer& int_obj = Api::UnwrapIntegerHandle(Z, integer);
2663 if (int_obj.IsNull()) {
2664 RETURN_TYPE_ERROR(Z, integer, Integer);
2665 }
2666 ASSERT(int_obj.IsMint());
2667 *value = int_obj.AsInt64Value();
2668 return Api::Success();
2669}

◆ Dart_IntegerToUint64()

DART_EXPORT Dart_Handle dart::Dart_IntegerToUint64 ( Dart_Handle  integer,
uint64_t *  value 
)

Definition at line 2671 of file dart_api_impl.cc.

2672 {
2673 // Fast path for Smis.
2674 Thread* thread = Thread::Current();
2675 Isolate* isolate = thread->isolate();
2676 CHECK_ISOLATE(isolate);
2677 if (Api::IsSmi(integer)) {
2678 intptr_t smi_value = Api::SmiValue(integer);
2679 if (smi_value >= 0) {
2680 *value = smi_value;
2681 return Api::Success();
2682 }
2683 }
2684 // Slow path for Mints.
2685 DARTSCOPE(thread);
2686 const Integer& int_obj = Api::UnwrapIntegerHandle(Z, integer);
2687 if (int_obj.IsNull()) {
2688 RETURN_TYPE_ERROR(Z, integer, Integer);
2689 }
2690 if (int_obj.IsSmi()) {
2691 ASSERT(int_obj.IsNegative());
2692 } else {
2693 ASSERT(int_obj.IsMint());
2694 if (!int_obj.IsNegative()) {
2695 *value = int_obj.AsInt64Value();
2696 return Api::Success();
2697 }
2698 }
2699 return Api::NewError("%s: Integer %s cannot be represented as a uint64_t.",
2700 CURRENT_FUNC, int_obj.ToCString());
2701}

◆ Dart_Invoke()

DART_EXPORT Dart_Handle dart::Dart_Invoke ( Dart_Handle  target,
Dart_Handle  name,
int  number_of_arguments,
Dart_Handle arguments 
)

Definition at line 4552 of file dart_api_impl.cc.

4555 {
4556 DARTSCOPE(Thread::Current());
4559
4561 String::Handle(Z, Api::UnwrapStringHandle(Z, name).ptr());
4562 if (function_name.IsNull()) {
4564 }
4565 if (number_of_arguments < 0) {
4566 return Api::NewError(
4567 "%s expects argument 'number_of_arguments' to be non-negative.",
4568 CURRENT_FUNC);
4569 }
4570 const Object& obj = Object::Handle(Z, Api::UnwrapHandle(target));
4571 if (obj.IsError()) {
4572 return target;
4573 }
4575 Array& args = Array::Handle(Z);
4576 // This API does not provide a way to pass named parameters.
4577 const Array& arg_names = Object::empty_array();
4578 const bool respect_reflectable = false;
4579 const bool check_is_entrypoint = FLAG_verify_entry_points;
4580 if (obj.IsType()) {
4581 if (!Type::Cast(obj).IsFinalized()) {
4582 return Api::NewError(
4583 "%s expects argument 'target' to be a fully resolved type.",
4584 CURRENT_FUNC);
4585 }
4586
4587 const Class& cls = Class::Handle(Z, Type::Cast(obj).type_class());
4588 if (Library::IsPrivate(function_name)) {
4589 const Library& lib = Library::Handle(Z, cls.library());
4590 function_name = lib.PrivateName(function_name);
4591 }
4592
4593 // Setup args and check for malformed arguments in the arguments list.
4594 result = SetupArguments(T, number_of_arguments, arguments, 0, &args);
4595 if (Api::IsError(result)) {
4596 return result;
4597 }
4598 return Api::NewHandle(
4599 T, cls.Invoke(function_name, args, arg_names, respect_reflectable,
4600 check_is_entrypoint));
4601 } else if (obj.IsNull() || obj.IsInstance()) {
4602 // Since we have allocated an object it would mean that the type of the
4603 // receiver is already resolved and finalized, hence it is not necessary
4604 // to check here.
4605 Instance& instance = Instance::Handle(Z);
4606 instance ^= obj.ptr();
4607
4608 // Setup args and check for malformed arguments in the arguments list.
4609 result = SetupArguments(T, number_of_arguments, arguments, 1, &args);
4610 if (Api::IsError(result)) {
4611 return result;
4612 }
4613 args.SetAt(0, instance);
4614 return Api::NewHandle(
4615 T, instance.Invoke(function_name, args, arg_names, respect_reflectable,
4616 check_is_entrypoint));
4617 } else if (obj.IsLibrary()) {
4618 // Check whether class finalization is needed.
4619 const Library& lib = Library::Cast(obj);
4620
4621 // Check that the library is loaded.
4622 if (!lib.Loaded()) {
4623 return Api::NewError("%s expects library argument 'target' to be loaded.",
4624 CURRENT_FUNC);
4625 }
4626
4627 if (Library::IsPrivate(function_name)) {
4628 function_name = lib.PrivateName(function_name);
4629 }
4630
4631 // Setup args and check for malformed arguments in the arguments list.
4632 result = SetupArguments(T, number_of_arguments, arguments, 0, &args);
4633 if (Api::IsError(result)) {
4634 return result;
4635 }
4636
4637 return Api::NewHandle(
4638 T, lib.Invoke(function_name, args, arg_names, respect_reflectable,
4639 check_is_entrypoint));
4640 } else {
4641 return Api::NewError(
4642 "%s expects argument 'target' to be an object, type, or library.",
4643 CURRENT_FUNC);
4644 }
4645}
static Dart_Handle SetupArguments(Thread *thread, int num_args, Dart_Handle *arguments, int extra_args, Array *args)

◆ Dart_InvokeClosure()

DART_EXPORT Dart_Handle dart::Dart_InvokeClosure ( Dart_Handle  closure,
int  number_of_arguments,
Dart_Handle arguments 
)

Definition at line 4647 of file dart_api_impl.cc.

4649 {
4650 DARTSCOPE(Thread::Current());
4653 const Instance& closure_obj = Api::UnwrapInstanceHandle(Z, closure);
4654 if (closure_obj.IsNull() || !closure_obj.IsCallable(nullptr)) {
4655 RETURN_TYPE_ERROR(Z, closure, Instance);
4656 }
4657 if (number_of_arguments < 0) {
4658 return Api::NewError(
4659 "%s expects argument 'number_of_arguments' to be non-negative.",
4660 CURRENT_FUNC);
4661 }
4662
4663 // Set up arguments to include the closure as the first argument.
4664 const Array& args = Array::Handle(Z, Array::New(number_of_arguments + 1));
4665 Object& obj = Object::Handle(Z);
4666 args.SetAt(0, closure_obj);
4667 for (int i = 0; i < number_of_arguments; i++) {
4668 obj = Api::UnwrapHandle(arguments[i]);
4669 if (!obj.IsNull() && !obj.IsInstance()) {
4670 RETURN_TYPE_ERROR(Z, arguments[i], Instance);
4671 }
4672 args.SetAt(i + 1, obj);
4673 }
4674 // Now try to invoke the closure.
4675 return Api::NewHandle(T, DartEntry::InvokeClosure(T, args));
4676}
bool IsCallable(Function *function) const
Definition object.cc:20954

◆ Dart_InvokeConstructor()

DART_EXPORT Dart_Handle dart::Dart_InvokeConstructor ( Dart_Handle  object,
Dart_Handle  name,
int  number_of_arguments,
Dart_Handle arguments 
)

Definition at line 4470 of file dart_api_impl.cc.

4473 {
4474 DARTSCOPE(Thread::Current());
4477
4478 if (number_of_arguments < 0) {
4479 return Api::NewError(
4480 "%s expects argument 'number_of_arguments' to be non-negative.",
4481 CURRENT_FUNC);
4482 }
4483 const Instance& instance = Api::UnwrapInstanceHandle(Z, object);
4484 if (instance.IsNull()) {
4485 RETURN_TYPE_ERROR(Z, object, Instance);
4486 }
4487
4488 // Since we have allocated an object it would mean that the type
4489 // is finalized.
4490 // TODO(asiva): How do we ensure that a constructor is not called more than
4491 // once for the same object.
4492
4493 // Construct name of the constructor to invoke.
4494 const String& constructor_name = Api::UnwrapStringHandle(Z, name);
4495 AbstractType& type_obj =
4496 AbstractType::Handle(Z, instance.GetType(Heap::kNew));
4497 const Class& cls = Class::Handle(Z, type_obj.type_class());
4498 const String& class_name = String::Handle(Z, cls.Name());
4499 const Array& strings = Array::Handle(Z, Array::New(3));
4500 strings.SetAt(0, class_name);
4501 strings.SetAt(1, Symbols::Dot());
4502 if (constructor_name.IsNull()) {
4503 strings.SetAt(2, Symbols::Empty());
4504 } else {
4505 strings.SetAt(2, constructor_name);
4506 }
4507 const String& dot_name = String::Handle(Z, String::ConcatAll(strings));
4508 TypeArguments& type_arguments = TypeArguments::Handle(Z);
4509 if (type_obj.IsType()) {
4510 type_arguments = Type::Cast(type_obj).GetInstanceTypeArguments(T);
4511 }
4512 const Function& constructor =
4513 Function::Handle(Z, cls.LookupFunctionAllowPrivate(dot_name));
4514 const int kTypeArgsLen = 0;
4515 const int extra_args = 1;
4516 if (!constructor.IsNull() && constructor.IsGenerativeConstructor() &&
4517 constructor.AreValidArgumentCounts(
4518 kTypeArgsLen, number_of_arguments + extra_args, 0, nullptr)) {
4519 CHECK_ERROR_HANDLE(constructor.VerifyCallEntryPoint());
4520 // Create the argument list.
4522 Array& args = Array::Handle(Z);
4523 result =
4524 SetupArguments(T, number_of_arguments, arguments, extra_args, &args);
4525 if (!Api::IsError(result)) {
4526 args.SetAt(0, instance);
4527
4528 const int kTypeArgsLen = 0;
4529 const Array& args_descriptor_array = Array::Handle(
4530 Z, ArgumentsDescriptor::NewBoxed(kTypeArgsLen, args.Length()));
4531 ArgumentsDescriptor args_descriptor(args_descriptor_array);
4532 ObjectPtr type_error = constructor.DoArgumentTypesMatch(
4533 args, args_descriptor, type_arguments);
4534 if (type_error != Error::null()) {
4535 return Api::NewHandle(T, type_error);
4536 }
4537
4538 const Object& retval =
4539 Object::Handle(Z, DartEntry::InvokeFunction(constructor, args));
4540 if (retval.IsError()) {
4541 result = Api::NewHandle(T, retval.ptr());
4542 } else {
4543 result = Api::NewHandle(T, instance.ptr());
4544 }
4545 }
4546 return result;
4547 }
4548 return Api::NewError("%s expects argument 'name' to be a valid constructor.",
4549 CURRENT_FUNC);
4550}

◆ Dart_InvokeVMServiceMethod()

DART_EXPORT bool dart::Dart_InvokeVMServiceMethod ( uint8_t *  request_json,
intptr_t  request_json_length,
uint8_t **  response_json,
intptr_t *  response_json_length,
char **  error 
)

Definition at line 116 of file native_api_impl.cc.

120 {
121#if !defined(PRODUCT)
122 Isolate* isolate = Isolate::Current();
123 ASSERT(isolate == nullptr || !isolate->is_service_isolate());
124 IsolateLeaveScope saver(isolate);
125
126 if (!Dart::IsInitialized()) {
127 *error = ::dart::Utils::StrDup("VM Service is not active.");
128 return false;
129 }
130
131 // We only allow one isolate reload at a time. If this turns out to be on the
132 // critical path, we can change it to have a global datastructure which is
133 // mapping the reply ports to receive buffers.
134 static Monitor* vm_service_calls_monitor = new Monitor();
135 MonitorLocker _(vm_service_calls_monitor);
136
137 static Monitor* vm_service_call_monitor = new Monitor();
138 static uint8_t* result_bytes = nullptr;
139 static intptr_t result_length = 0;
140
141 ASSERT(result_bytes == nullptr);
142 ASSERT(result_length == 0);
143
144 struct Utils {
145 static void HandleResponse(Dart_Port dest_port_id, Dart_CObject* message) {
146 MonitorLocker monitor(vm_service_call_monitor);
147
149 RELEASE_ASSERT(message->value.as_typed_data.type ==
151 result_length = message->value.as_typed_data.length;
152 result_bytes = reinterpret_cast<uint8_t*>(malloc(result_length));
153 memmove(result_bytes, message->value.as_typed_data.values, result_length);
154
155 monitor.Notify();
156 }
157 };
158
159 auto port =
160 ::Dart_NewNativePort("service-rpc", &Utils::HandleResponse, false);
161 if (port == ILLEGAL_PORT) {
162 if (error != nullptr) {
163 *error = ::dart::Utils::StrDup("Was unable to create native port.");
164 }
165 return false;
166 }
167
168 // Before sending the message we'll lock the monitor, which the receiver
169 // will later on notify once the answer has been received.
170 MonitorLocker monitor(vm_service_call_monitor);
171
172 if (ServiceIsolate::SendServiceRpc(request_json, request_json_length, port,
173 error)) {
174 // We posted successfully and expect the vm-service to send the reply, so
175 // we will wait for it now. Since the service isolate could have shutdown
176 // after we sent the message we make sure to wake up periodically and
177 // check to see if the service isolate has shutdown.
178 do {
179 auto wait_result = monitor.Wait(1000); /* milliseconds */
180 if (wait_result == Monitor::kNotified) {
181 break;
182 }
183 if (!ServiceIsolate::IsRunning()) {
184 // Service Isolate has shutdown while we were waiting for a reply,
185 // We will not get a reply anymore, cleanup and return an error.
187 return false;
188 }
189 } while (true);
190
191 // The caller takes ownership of the data.
192 *response_json = result_bytes;
193 *response_json_length = result_length;
194
195 // Reset global data, which can be used by the next call (after the mutex
196 // has been released).
197 result_bytes = nullptr;
198 result_length = 0;
199
200 // After the data has been received, we will not get any more messages on
201 // this port and can safely close it now.
203
204 return true;
205 } else {
206 // We couldn't post the message and will not receive any reply. Therefore we
207 // clean up the port and return an error.
209 return false;
210 }
211#else // !defined(PRODUCT)
212 if (error != nullptr) {
213 *error = Utils::StrDup("VM Service is not supported in PRODUCT mode.");
214 }
215 return false;
216#endif // !defined(PRODUCT)
217}
static char * StrDup(const char *s)
DART_EXPORT Dart_Port Dart_NewNativePort(const char *name, Dart_NativeMessageHandler handler, bool handle_concurrently)
DART_EXPORT bool Dart_CloseNativePort(Dart_Port native_port_id)

◆ Dart_IsApiError()

DART_EXPORT bool dart::Dart_IsApiError ( Dart_Handle  object)

Definition at line 756 of file dart_api_impl.cc.

756 {
757 Thread* thread = Thread::Current();
758 TransitionNativeToVM transition(thread);
759 return Api::ClassId(object) == kApiErrorCid;
760}

◆ Dart_IsBoolean()

DART_EXPORT bool dart::Dart_IsBoolean ( Dart_Handle  object)

Definition at line 2340 of file dart_api_impl.cc.

2340 {
2341 Thread* thread = Thread::Current();
2342 CHECK_ISOLATE(thread->isolate());
2343 TransitionNativeToVM transition(thread);
2344 return Api::ClassId(object) == kBoolCid;
2345}

◆ Dart_IsByteBuffer()

DART_EXPORT bool dart::Dart_IsByteBuffer ( Dart_Handle  handle)

Definition at line 2440 of file dart_api_impl.cc.

2440 {
2441 Thread* thread = Thread::Current();
2442 CHECK_ISOLATE(thread->isolate());
2443 TransitionNativeToVM transition(thread);
2444 return Api::ClassId(handle) == kByteBufferCid;
2445}

◆ Dart_IsClosure()

DART_EXPORT bool dart::Dart_IsClosure ( Dart_Handle  object)

Definition at line 2412 of file dart_api_impl.cc.

2412 {
2413 Thread* thread = Thread::Current();
2414 CHECK_ISOLATE(thread->isolate());
2415 TransitionNativeToVM transition(thread);
2416 return Api::ClassId(object) == kClosureCid;
2417}

◆ Dart_IsCompilationError()

DART_EXPORT bool dart::Dart_IsCompilationError ( Dart_Handle  object)

Definition at line 768 of file dart_api_impl.cc.

768 {
770 DARTSCOPE(Thread::Current());
772 UnhandledException::Cast(Object::Handle(Z, Api::UnwrapHandle(object)));
773 const Instance& exc = Instance::Handle(Z, error.exception());
774 return IsCompiletimeErrorObject(Z, exc);
775 }
776
777 Thread* thread = Thread::Current();
778 TransitionNativeToVM transition(thread);
779 return Api::ClassId(object) == kLanguageErrorCid;
780}
DART_EXPORT bool Dart_IsUnhandledExceptionError(Dart_Handle handle)
static bool IsCompiletimeErrorObject(Zone *zone, const Object &obj)

◆ Dart_IsDouble()

DART_EXPORT bool dart::Dart_IsDouble ( Dart_Handle  object)

Definition at line 2333 of file dart_api_impl.cc.

2333 {
2334 Thread* thread = Thread::Current();
2335 CHECK_ISOLATE(thread->isolate());
2336 TransitionNativeToVM transition(thread);
2337 return Api::ClassId(object) == kDoubleCid;
2338}

◆ Dart_IsError()

DART_EXPORT bool dart::Dart_IsError ( Dart_Handle  handle)

Definition at line 744 of file dart_api_impl.cc.

744 {
745 Thread* thread = Thread::Current();
746 TransitionNativeToVM transition(thread);
747 return Api::IsError(handle);
748}

◆ Dart_IsFatalError()

DART_EXPORT bool dart::Dart_IsFatalError ( Dart_Handle  object)

Definition at line 782 of file dart_api_impl.cc.

782 {
783 Thread* thread = Thread::Current();
784 TransitionNativeToVM transition(thread);
785 return Api::ClassId(object) == kUnwindErrorCid;
786}

◆ Dart_IsFunction()

DART_EXPORT bool dart::Dart_IsFunction ( Dart_Handle  handle)

Definition at line 2391 of file dart_api_impl.cc.

2391 {
2392 Thread* thread = Thread::Current();
2393 CHECK_ISOLATE(thread->isolate());
2394 TransitionNativeToVM transition(thread);
2395 return Api::ClassId(handle) == kFunctionCid;
2396}

◆ Dart_IsFuture()

DART_EXPORT bool dart::Dart_IsFuture ( Dart_Handle  handle)

Definition at line 2447 of file dart_api_impl.cc.

2447 {
2448 DARTSCOPE(Thread::Current());
2450 const Object& obj = Object::Handle(Z, Api::UnwrapHandle(handle));
2451 if (obj.IsInstance()) {
2452 const Class& obj_class = Class::Handle(Z, obj.clazz());
2453 return obj_class.is_future_subtype();
2454 }
2455 return false;
2456}
bool is_future_subtype() const
Definition object.h:2172
ClassPtr clazz() const
Definition object.h:13192

◆ Dart_IsInstance()

DART_EXPORT bool dart::Dart_IsInstance ( Dart_Handle  object)

Definition at line 2309 of file dart_api_impl.cc.

2309 {
2310 Thread* thread = Thread::Current();
2311 CHECK_ISOLATE(thread->isolate());
2312 TransitionNativeToVM transition(thread);
2314 Object& ref = thread->ObjectHandle();
2315 ref = Api::UnwrapHandle(object);
2316 return ref.IsInstance();
2317}

◆ Dart_IsInteger()

DART_EXPORT bool dart::Dart_IsInteger ( Dart_Handle  object)

Definition at line 2326 of file dart_api_impl.cc.

2326 {
2327 Thread* thread = Thread::Current();
2328 CHECK_ISOLATE(thread->isolate());
2329 TransitionNativeToVM transition(thread);
2330 return IsIntegerClassId(Api::ClassId(object));
2331}
bool IsIntegerClassId(intptr_t index)
Definition class_id.h:340

◆ Dart_IsKernel()

DART_EXPORT bool dart::Dart_IsKernel ( const uint8_t *  buffer,
intptr_t  buffer_size 
)

Definition at line 1929 of file dart_api_impl.cc.

1929 {
1930 if (buffer_size < 4) {
1931 return false;
1932 }
1933 return (buffer[0] == 0x90) && (buffer[1] == 0xab) && (buffer[2] == 0xcd) &&
1934 (buffer[3] == 0xef);
1935}

◆ Dart_IsKernelIsolate()

DART_EXPORT bool dart::Dart_IsKernelIsolate ( Dart_Isolate  isolate)

Definition at line 6023 of file dart_api_impl.cc.

6023 {
6024#if defined(DART_PRECOMPILED_RUNTIME)
6025 return false;
6026#else
6027 Isolate* iso = reinterpret_cast<Isolate*>(isolate);
6028 return iso->is_kernel_isolate();
6029#endif
6030}

◆ Dart_IsLegacyType()

DART_EXPORT Dart_Handle dart::Dart_IsLegacyType ( Dart_Handle  type,
bool *  result 
)

Definition at line 5667 of file dart_api_impl.cc.

5667 {
5668 return IsOfTypeNullabilityHelper(type, Nullability::kLegacy, result);
5669}
static Dart_Handle IsOfTypeNullabilityHelper(Dart_Handle type, Nullability nullability, bool *result)

◆ Dart_IsLibrary()

DART_EXPORT bool dart::Dart_IsLibrary ( Dart_Handle  object)

Definition at line 2377 of file dart_api_impl.cc.

2377 {
2378 Thread* thread = Thread::Current();
2379 CHECK_ISOLATE(thread->isolate());
2380 TransitionNativeToVM transition(thread);
2381 return Api::ClassId(object) == kLibraryCid;
2382}

◆ Dart_IsList()

DART_EXPORT bool dart::Dart_IsList ( Dart_Handle  object)

Definition at line 2361 of file dart_api_impl.cc.

2361 {
2362 DARTSCOPE(Thread::Current());
2363 if (IsBuiltinListClassId(Api::ClassId(object))) {
2364 return true;
2365 }
2366
2367 const Object& obj = Object::Handle(Z, Api::UnwrapHandle(object));
2368 return GetListInstance(Z, obj) != Instance::null();
2369}
bool IsBuiltinListClassId(intptr_t index)
Definition class_id.h:364

◆ Dart_IsMap()

DART_EXPORT bool dart::Dart_IsMap ( Dart_Handle  object)

Definition at line 2371 of file dart_api_impl.cc.

2371 {
2372 DARTSCOPE(Thread::Current());
2373 const Object& obj = Object::Handle(Z, Api::UnwrapHandle(object));
2374 return GetMapInstance(Z, obj) != Instance::null();
2375}
static InstancePtr GetMapInstance(Zone *zone, const Object &obj)

◆ Dart_IsNonNullableType()

DART_EXPORT Dart_Handle dart::Dart_IsNonNullableType ( Dart_Handle  type,
bool *  result 
)

Definition at line 5663 of file dart_api_impl.cc.

5663 {
5664 return IsOfTypeNullabilityHelper(type, Nullability::kNonNullable, result);
5665}

◆ Dart_IsNull()

DART_EXPORT bool dart::Dart_IsNull ( Dart_Handle  object)

Definition at line 2220 of file dart_api_impl.cc.

2220 {
2221 TransitionNativeToVM transition(Thread::Current());
2222 return Api::UnwrapHandle(object) == Object::null();
2223}

◆ Dart_IsNullableType()

DART_EXPORT Dart_Handle dart::Dart_IsNullableType ( Dart_Handle  type,
bool *  result 
)

Definition at line 5659 of file dart_api_impl.cc.

5659 {
5660 return IsOfTypeNullabilityHelper(type, Nullability::kNullable, result);
5661}

◆ Dart_IsNumber()

DART_EXPORT bool dart::Dart_IsNumber ( Dart_Handle  object)

Definition at line 2319 of file dart_api_impl.cc.

2319 {
2320 Thread* thread = Thread::Current();
2321 CHECK_ISOLATE(thread->isolate());
2322 TransitionNativeToVM transition(thread);
2323 return IsNumberClassId(Api::ClassId(object));
2324}
bool IsNumberClassId(intptr_t index)
Definition class_id.h:333

◆ Dart_IsolateData()

DART_EXPORT void * dart::Dart_IsolateData ( Dart_Isolate  isolate)

Definition at line 1466 of file dart_api_impl.cc.

1466 {
1467 if (isolate == nullptr) {
1468 FATAL("%s expects argument 'isolate' to be non-null.", CURRENT_FUNC);
1469 }
1470 // TODO(http://dartbug.com/16615): Validate isolate parameter.
1471 return reinterpret_cast<Isolate*>(isolate)->init_callback_data();
1472}

◆ Dart_IsolateFlagsInitialize()

DART_EXPORT void dart::Dart_IsolateFlagsInitialize ( Dart_IsolateFlags flags)

Definition at line 1321 of file dart_api_impl.cc.

1321 {
1322 Isolate::FlagsInitialize(flags);
1323}

◆ Dart_IsolateGroupData()

DART_EXPORT void * dart::Dart_IsolateGroupData ( Dart_Isolate  isolate)

Definition at line 1491 of file dart_api_impl.cc.

1491 {
1492 if (isolate == nullptr) {
1493 FATAL("%s expects argument 'isolate' to be non-null.", CURRENT_FUNC);
1494 }
1495 // TODO(http://dartbug.com/16615): Validate isolate parameter.
1496 return reinterpret_cast<Isolate*>(isolate)->group()->embedder_data();
1497}

◆ Dart_IsolateMakeRunnable()

DART_EXPORT char * dart::Dart_IsolateMakeRunnable ( Dart_Isolate  isolate)

Definition at line 1937 of file dart_api_impl.cc.

1937 {
1938 CHECK_NO_ISOLATE(Isolate::Current());
1939 API_TIMELINE_DURATION(Thread::Current());
1940 if (isolate == nullptr) {
1941 FATAL("%s expects argument 'isolate' to be non-null.", CURRENT_FUNC);
1942 }
1943 // TODO(16615): Validate isolate parameter.
1944 const char* error = reinterpret_cast<Isolate*>(isolate)->MakeRunnable();
1945 if (error != nullptr) {
1946 return Utils::StrDup(error);
1947 }
1948 return nullptr;
1949}

◆ Dart_IsolateServiceId()

DART_EXPORT const char * dart::Dart_IsolateServiceId ( Dart_Isolate  isolate)

Definition at line 1524 of file dart_api_impl.cc.

1524 {
1525 if (isolate == nullptr) {
1526 FATAL("%s expects argument 'isolate' to be non-null.", CURRENT_FUNC);
1527 }
1528 // TODO(http://dartbug.com/16615): Validate isolate parameter.
1529 Isolate* I = reinterpret_cast<Isolate*>(isolate);
1530 int64_t main_port = static_cast<int64_t>(I->main_port());
1531 return OS::SCreate(nullptr, "isolates/%" Pd64, main_port);
1532}

◆ Dart_IsPausedOnExit()

DART_EXPORT bool dart::Dart_IsPausedOnExit ( void  )

Definition at line 1715 of file dart_api_impl.cc.

1715 {
1716#if defined(PRODUCT)
1717 return false;
1718#else
1719 Isolate* isolate = Isolate::Current();
1720 CHECK_ISOLATE(isolate);
1721 NoSafepointScope no_safepoint_scope;
1722 return isolate->message_handler()->is_paused_on_exit();
1723#endif
1724}
bool is_paused_on_exit() const

◆ Dart_IsPausedOnStart()

DART_EXPORT bool dart::Dart_IsPausedOnStart ( void  )

Definition at line 1665 of file dart_api_impl.cc.

1665 {
1666#if defined(PRODUCT)
1667 return false;
1668#else
1669 Isolate* isolate = Isolate::Current();
1670 CHECK_ISOLATE(isolate);
1671 NoSafepointScope no_safepoint_scope;
1672 return isolate->message_handler()->is_paused_on_start();
1673#endif
1674}
bool is_paused_on_start() const

◆ Dart_IsPrecompiledRuntime()

DART_EXPORT bool dart::Dart_IsPrecompiledRuntime ( void  )

Definition at line 6886 of file dart_api_impl.cc.

6886 {
6887#if defined(DART_PRECOMPILED_RUNTIME)
6888 return true;
6889#else
6890 return false;
6891#endif
6892}

◆ Dart_IsReloading()

DART_EXPORT bool dart::Dart_IsReloading ( )

Definition at line 6244 of file dart_api_impl.cc.

6244 {
6245#if defined(PRODUCT) || defined(DART_PRECOMPILED_RUNTIME)
6246 return false;
6247#else
6248 Thread* thread = Thread::Current();
6249 Isolate* isolate = thread->isolate();
6250 CHECK_ISOLATE(isolate);
6251 return isolate->group()->IsReloading();
6252#endif
6253}
bool IsReloading() const
Definition isolate.h:662

◆ Dart_IsServiceIsolate()

DART_EXPORT bool dart::Dart_IsServiceIsolate ( Dart_Isolate  isolate)

Definition at line 6116 of file dart_api_impl.cc.

6116 {
6117 Isolate* iso = reinterpret_cast<Isolate*>(isolate);
6118 return iso->is_service_isolate();
6119}

◆ Dart_IsString()

DART_EXPORT bool dart::Dart_IsString ( Dart_Handle  object)

Definition at line 2347 of file dart_api_impl.cc.

2347 {
2348 Thread* thread = Thread::Current();
2349 CHECK_ISOLATE(thread->isolate());
2350 TransitionNativeToVM transition(thread);
2351 return IsStringClassId(Api::ClassId(object));
2352}
bool IsStringClassId(intptr_t index)
Definition class_id.h:350

◆ Dart_IsStringLatin1()

DART_EXPORT bool dart::Dart_IsStringLatin1 ( Dart_Handle  object)

Definition at line 2354 of file dart_api_impl.cc.

2354 {
2355 Thread* thread = Thread::Current();
2356 CHECK_ISOLATE(thread->isolate());
2357 TransitionNativeToVM transition(thread);
2358 return IsOneByteStringClassId(Api::ClassId(object));
2359}
bool IsOneByteStringClassId(intptr_t index)
Definition class_id.h:354

◆ Dart_IsTearOff()

DART_EXPORT bool dart::Dart_IsTearOff ( Dart_Handle  object)

Definition at line 2419 of file dart_api_impl.cc.

2419 {
2420 DARTSCOPE(Thread::Current());
2422 const Object& obj = Object::Handle(Z, Api::UnwrapHandle(object));
2423 if (obj.IsClosure()) {
2424 const Closure& closure = Closure::Cast(obj);
2425 const Function& func = Function::Handle(Z, closure.function());
2426 return func.IsImplicitClosureFunction();
2427 }
2428 return false;
2429}
bool IsImplicitClosureFunction() const
Definition object.h:3883

◆ Dart_IsType()

DART_EXPORT bool dart::Dart_IsType ( Dart_Handle  handle)

Definition at line 2384 of file dart_api_impl.cc.

2384 {
2385 Thread* thread = Thread::Current();
2386 CHECK_ISOLATE(thread->isolate());
2387 TransitionNativeToVM transition(thread);
2388 return IsTypeClassId(Api::ClassId(handle));
2389}
bool IsTypeClassId(intptr_t index)
Definition class_id.h:370

◆ Dart_IsTypedData()

DART_EXPORT bool dart::Dart_IsTypedData ( Dart_Handle  handle)

Definition at line 2431 of file dart_api_impl.cc.

2431 {
2432 Thread* thread = Thread::Current();
2433 CHECK_ISOLATE(thread->isolate());
2434 TransitionNativeToVM transition(thread);
2435 intptr_t cid = Api::ClassId(handle);
2436 return IsTypedDataClassId(cid) || IsExternalTypedDataClassId(cid) ||
2438}

◆ Dart_IsTypeVariable()

DART_EXPORT bool dart::Dart_IsTypeVariable ( Dart_Handle  handle)

Definition at line 2405 of file dart_api_impl.cc.

2405 {
2406 Thread* thread = Thread::Current();
2407 CHECK_ISOLATE(thread->isolate());
2408 TransitionNativeToVM transition(thread);
2409 return Api::ClassId(handle) == kTypeParameterCid;
2410}

◆ Dart_IsUnhandledExceptionError()

DART_EXPORT bool dart::Dart_IsUnhandledExceptionError ( Dart_Handle  object)

Definition at line 762 of file dart_api_impl.cc.

762 {
763 Thread* thread = Thread::Current();
764 TransitionNativeToVM transition(thread);
765 return Api::ClassId(object) == kUnhandledExceptionCid;
766}

◆ Dart_IsVariable()

DART_EXPORT bool dart::Dart_IsVariable ( Dart_Handle  handle)

Definition at line 2398 of file dart_api_impl.cc.

2398 {
2399 Thread* thread = Thread::Current();
2400 CHECK_ISOLATE(thread->isolate());
2401 TransitionNativeToVM transition(thread);
2402 return Api::ClassId(handle) == kFieldCid;
2403}

◆ Dart_IsVMFlagSet()

DART_EXPORT bool dart::Dart_IsVMFlagSet ( const char *  flag_name)

Definition at line 1190 of file dart_api_impl.cc.

1190 {
1191 return Flags::IsSet(flag_name);
1192}

◆ Dart_KernelIsolateIsRunning()

DART_EXPORT bool dart::Dart_KernelIsolateIsRunning ( void  )

Definition at line 6032 of file dart_api_impl.cc.

6032 {
6033#if defined(DART_PRECOMPILED_RUNTIME)
6034 return false;
6035#else
6036 return KernelIsolate::IsRunning();
6037#endif
6038}

◆ Dart_KernelListDependencies()

DART_EXPORT Dart_KernelCompilationResult dart::Dart_KernelListDependencies ( void  )

Definition at line 6084 of file dart_api_impl.cc.

6084 {
6086#if defined(DART_PRECOMPILED_RUNTIME)
6088 result.error = Utils::StrDup("Dart_KernelListDependencies is unsupported.");
6089#else
6090 result = KernelIsolate::ListDependencies();
6091#endif
6092 return result;
6093}

◆ Dart_KernelPort()

DART_EXPORT Dart_Port dart::Dart_KernelPort ( void  )

Definition at line 6040 of file dart_api_impl.cc.

6040 {
6041#if defined(DART_PRECOMPILED_RUNTIME)
6042 return false;
6043#else
6044 return KernelIsolate::KernelPort();
6045#endif
6046}

◆ Dart_KillIsolate()

DART_EXPORT void dart::Dart_KillIsolate ( Dart_Isolate  handle)

Definition at line 750 of file dart_api_impl.cc.

750 {
751 Isolate* isolate = reinterpret_cast<Isolate*>(handle);
752 CHECK_ISOLATE(isolate);
753 Isolate::KillIfExists(isolate, Isolate::kKillMsg);
754}

◆ Dart_LibraryHandleError()

DART_EXPORT Dart_Handle dart::Dart_LibraryHandleError ( Dart_Handle  library_in,
Dart_Handle  error_in 
)

Definition at line 5732 of file dart_api_impl.cc.

5733 {
5734 DARTSCOPE(Thread::Current());
5735
5736 const Library& lib = Api::UnwrapLibraryHandle(Z, library_in);
5737 if (lib.IsNull()) {
5738 RETURN_TYPE_ERROR(Z, library_in, Library);
5739 }
5740 const Instance& err = Api::UnwrapInstanceHandle(Z, error_in);
5741 if (err.IsNull()) {
5742 RETURN_TYPE_ERROR(Z, error_in, Instance);
5743 }
5745
5746 return error_in;
5747}

◆ Dart_LibraryId()

Dart_Handle dart::Dart_LibraryId ( Dart_Handle  library,
intptr_t *  library_id 
)

Returns in \library_id the library id of the given \library.

Returns
A valid handle if no error occurs during the operation.

Definition at line 223 of file debugger_api_impl_test.cc.

223 {
224 DARTSCOPE(Thread::Current());
225 const Library& lib = Api::UnwrapLibraryHandle(Z, library);
226 if (lib.IsNull()) {
227 RETURN_TYPE_ERROR(Z, library, Library);
228 }
229 if (library_id == nullptr) {
230 RETURN_NULL_ERROR(library_id);
231 }
232 *library_id = lib.index();
233 return Api::Success();
234}
intptr_t index() const
Definition object.h:5241

◆ Dart_LibraryResolvedUrl()

DART_EXPORT Dart_Handle dart::Dart_LibraryResolvedUrl ( Dart_Handle  library)

Definition at line 5682 of file dart_api_impl.cc.

5682 {
5683 DARTSCOPE(Thread::Current());
5684 const Library& lib = Api::UnwrapLibraryHandle(Z, library);
5685 if (lib.IsNull()) {
5686 RETURN_TYPE_ERROR(Z, library, Library);
5687 }
5688 const Class& toplevel = Class::Handle(lib.toplevel_class());
5689 ASSERT(!toplevel.IsNull());
5690 const Script& script = Script::Handle(toplevel.script());
5691 ASSERT(!script.IsNull());
5692 const String& url = String::Handle(script.resolved_url());
5693 ASSERT(!url.IsNull());
5694 return Api::NewHandle(T, url.ptr());
5695}
ClassPtr toplevel_class() const
Definition object.h:5179

◆ Dart_LibraryUrl()

DART_EXPORT Dart_Handle dart::Dart_LibraryUrl ( Dart_Handle  library)

Definition at line 5671 of file dart_api_impl.cc.

5671 {
5672 DARTSCOPE(Thread::Current());
5673 const Library& lib = Api::UnwrapLibraryHandle(Z, library);
5674 if (lib.IsNull()) {
5675 RETURN_TYPE_ERROR(Z, library, Library);
5676 }
5677 const String& url = String::Handle(Z, lib.url());
5678 ASSERT(!url.IsNull());
5679 return Api::NewHandle(T, url.ptr());
5680}

◆ Dart_ListGetAsBytes()

DART_EXPORT Dart_Handle dart::Dart_ListGetAsBytes ( Dart_Handle  list,
intptr_t  offset,
uint8_t *  native_array,
intptr_t  length 
)

Definition at line 3412 of file dart_api_impl.cc.

3415 {
3416 DARTSCOPE(Thread::Current());
3417 const Object& obj = Object::Handle(Z, Api::UnwrapHandle(list));
3418 if (obj.IsTypedDataBase()) {
3419 const TypedDataBase& array = TypedDataBase::Cast(obj);
3420 if (array.ElementSizeInBytes() == 1) {
3421 if (Utils::RangeCheck(offset, length, array.Length())) {
3422 NoSafepointScope no_safepoint;
3423 memmove(native_array,
3424 reinterpret_cast<uint8_t*>(array.DataAddr(offset)), length);
3425 return Api::Success();
3426 }
3427 return Api::NewError("Invalid length passed into access list elements");
3428 }
3429 }
3430 if (obj.IsArray()) {
3431 GET_LIST_ELEMENT_AS_BYTES(Array, obj, native_array, offset, length);
3432 }
3433 if (obj.IsGrowableObjectArray()) {
3434 GET_LIST_ELEMENT_AS_BYTES(GrowableObjectArray, obj, native_array, offset,
3435 length);
3436 }
3437 if (obj.IsError()) {
3438 return list;
3439 }
3441
3442 // Check and handle a dart object that implements the List interface.
3443 const Instance& instance = Instance::Handle(Z, GetListInstance(Z, obj));
3444 if (!instance.IsNull()) {
3445 const int kNumArgs = 2;
3446 const Function& function = Function::Handle(
3447 Z, FindCoreLibPrivateFunction(Z, Symbols::_listGetAt()));
3448 Object& result = Object::Handle(Z);
3449 Integer& intobj = Integer::Handle(Z);
3450 const Array& args = Array::Handle(Z, Array::New(kNumArgs));
3451 args.SetAt(0, instance); // Set up the receiver as the first argument.
3452 for (int i = 0; i < length; i++) {
3453 HANDLESCOPE(T);
3454 intobj = Integer::New(offset + i);
3455 args.SetAt(1, intobj);
3456 result = DartEntry::InvokeFunction(function, args);
3457 if (result.IsError()) {
3458 return Api::NewHandle(T, result.ptr());
3459 }
3460 if (!result.IsInteger()) {
3461 return Api::NewError(
3462 "%s expects the argument 'list' to be "
3463 "a List of int",
3464 CURRENT_FUNC);
3465 }
3466 const Integer& integer_result = Integer::Cast(result);
3467 ASSERT(integer_result.AsInt64Value() <= 0xff);
3468 // TODO(hpayer): value should always be smaller then 0xff. Add error
3469 // handling.
3470 native_array[i] =
3471 static_cast<uint8_t>(integer_result.AsInt64Value() & 0xff);
3472 }
3473 return Api::Success();
3474 }
3475 return Api::NewArgumentError(
3476 "Object does not implement the 'List' interface");
3477}
intptr_t Length() const
Definition object.h:11492
intptr_t ElementSizeInBytes() const
Definition object.h:11505
void * DataAddr(intptr_t byte_offset) const
Definition object.h:11545
#define GET_LIST_ELEMENT_AS_BYTES(type, obj, native_array, offset, length)
static InstancePtr GetListInstance(Zone *zone, const Object &obj)

◆ Dart_ListGetAt()

DART_EXPORT Dart_Handle dart::Dart_ListGetAt ( Dart_Handle  list,
intptr_t  index 
)

Definition at line 3207 of file dart_api_impl.cc.

3207 {
3208 DARTSCOPE(Thread::Current());
3209 const Object& obj = Object::Handle(Z, Api::UnwrapHandle(list));
3210 if (obj.IsArray()) {
3211 GET_LIST_ELEMENT(T, Array, obj, index);
3212 } else if (obj.IsGrowableObjectArray()) {
3213 GET_LIST_ELEMENT(T, GrowableObjectArray, obj, index);
3214 } else if (obj.IsError()) {
3215 return list;
3216 } else {
3218 // Check and handle a dart object that implements the List interface.
3219 const Instance& instance = Instance::Handle(Z, GetListInstance(Z, obj));
3220 if (!instance.IsNull()) {
3221 return Api::NewHandle(
3222 T, CallStatic2Args(Z, Symbols::_listGetAt(), instance,
3223 Instance::Handle(Z, Integer::New(index))));
3224 }
3225 return Api::NewArgumentError(
3226 "Object does not implement the 'List' interface");
3227 }
3228}
#define GET_LIST_ELEMENT(thread, type, obj, index)
static ObjectPtr CallStatic2Args(Zone *zone, const String &name, const Instance &arg0, const Instance &arg1)

◆ Dart_ListGetRange()

DART_EXPORT Dart_Handle dart::Dart_ListGetRange ( Dart_Handle  list,
intptr_t  offset,
intptr_t  length,
Dart_Handle result 
)

Definition at line 3240 of file dart_api_impl.cc.

3243 {
3244 DARTSCOPE(Thread::Current());
3245 if (result == nullptr) {
3247 }
3248 const Object& obj = Object::Handle(Z, Api::UnwrapHandle(list));
3249 if (obj.IsArray()) {
3250 GET_LIST_RANGE(T, Array, obj, offset, length);
3251 } else if (obj.IsGrowableObjectArray()) {
3252 GET_LIST_RANGE(T, GrowableObjectArray, obj, offset, length);
3253 } else if (obj.IsError()) {
3254 return list;
3255 } else {
3257 // Check and handle a dart object that implements the List interface.
3258 const Instance& instance = Instance::Handle(Z, GetListInstance(Z, obj));
3259 if (!instance.IsNull()) {
3260 const intptr_t kNumArgs = 2;
3261 const Function& function = Function::Handle(
3262 Z, FindCoreLibPrivateFunction(Z, Symbols::_listGetAt()));
3263 const Array& args = Array::Handle(Z, Array::New(kNumArgs));
3264 args.SetAt(0, instance);
3265 Instance& index = Instance::Handle(Z);
3266 for (intptr_t i = 0; i < length; ++i) {
3267 index = Integer::New(i);
3268 args.SetAt(1, index);
3270 Api::NewHandle(T, DartEntry::InvokeFunction(function, args));
3271 if (Api::IsError(value)) return value;
3272 result[i] = value;
3273 }
3274 return Api::Success();
3275 }
3276 return Api::NewArgumentError(
3277 "Object does not implement the 'List' interface");
3278 }
3279}
#define GET_LIST_RANGE(thread, type, obj, offset, length)

◆ Dart_ListLength()

DART_EXPORT Dart_Handle dart::Dart_ListLength ( Dart_Handle  list,
intptr_t *  len 
)

Definition at line 3155 of file dart_api_impl.cc.

3155 {
3156 DARTSCOPE(Thread::Current());
3157 const Object& obj = Object::Handle(Z, Api::UnwrapHandle(list));
3158 if (obj.IsError()) {
3159 // Pass through errors.
3160 return list;
3161 }
3162 if (obj.IsTypedDataBase()) {
3163 GET_LIST_LENGTH(Z, TypedDataBase, obj, len);
3164 }
3165 if (obj.IsArray()) {
3166 GET_LIST_LENGTH(Z, Array, obj, len);
3167 }
3168 if (obj.IsGrowableObjectArray()) {
3169 GET_LIST_LENGTH(Z, GrowableObjectArray, obj, len);
3170 }
3172
3173 // Now check and handle a dart object that implements the List interface.
3174 const Instance& instance = Instance::Handle(Z, GetListInstance(Z, obj));
3175 if (instance.IsNull()) {
3176 return Api::NewArgumentError(
3177 "Object does not implement the List interface");
3178 }
3179 const Object& retval =
3180 Object::Handle(Z, CallStatic1Arg(Z, Symbols::_listLength(), instance));
3181 if (retval.IsSmi()) {
3182 *len = Smi::Cast(retval).Value();
3183 return Api::Success();
3184 } else if (retval.IsMint()) {
3185 int64_t mint_value = Mint::Cast(retval).value();
3186 if (mint_value >= kIntptrMin && mint_value <= kIntptrMax) {
3187 *len = static_cast<intptr_t>(mint_value);
3188 return Api::Success();
3189 }
3190 return Api::NewError(
3191 "Length of List object is greater than the "
3192 "maximum value that 'len' parameter can hold");
3193 } else if (retval.IsError()) {
3194 return Api::NewHandle(T, retval.ptr());
3195 } else {
3196 return Api::NewError("Length of List object is not an integer");
3197 }
3198}
#define GET_LIST_LENGTH(zone, type, obj, len)
static ObjectPtr CallStatic1Arg(Zone *zone, const String &name, const Instance &arg0)

◆ Dart_ListSetAsBytes()

DART_EXPORT Dart_Handle dart::Dart_ListSetAsBytes ( Dart_Handle  list,
intptr_t  offset,
const uint8_t *  native_array,
intptr_t  length 
)

Definition at line 3491 of file dart_api_impl.cc.

3494 {
3495 DARTSCOPE(Thread::Current());
3496 const Object& obj = Object::Handle(Z, Api::UnwrapHandle(list));
3497 if (obj.IsTypedDataBase()) {
3498 const TypedDataBase& array = TypedDataBase::Cast(obj);
3499 if (array.ElementSizeInBytes() == 1) {
3500 if (Utils::RangeCheck(offset, length, array.Length())) {
3501 NoSafepointScope no_safepoint;
3502 memmove(reinterpret_cast<uint8_t*>(array.DataAddr(offset)),
3503 native_array, length);
3504 return Api::Success();
3505 }
3506 return Api::NewError("Invalid length passed into access list elements");
3507 }
3508 }
3509 if (obj.IsArray() && !Array::Cast(obj).IsImmutable()) {
3510 // If the list is immutable we call into Dart for the indexed setter to
3511 // get the unsupported operation exception as the result.
3512 SET_LIST_ELEMENT_AS_BYTES(Array, obj, native_array, offset, length);
3513 }
3514 if (obj.IsGrowableObjectArray()) {
3515 SET_LIST_ELEMENT_AS_BYTES(GrowableObjectArray, obj, native_array, offset,
3516 length);
3517 }
3518 if (obj.IsError()) {
3519 return list;
3520 }
3522
3523 // Check and handle a dart object that implements the List interface.
3524 const Instance& instance = Instance::Handle(Z, GetListInstance(Z, obj));
3525 if (!instance.IsNull()) {
3526 const int kNumArgs = 3;
3527 const Function& function = Function::Handle(
3528 Z, FindCoreLibPrivateFunction(Z, Symbols::_listSetAt()));
3529 Integer& indexobj = Integer::Handle(Z);
3530 Integer& valueobj = Integer::Handle(Z);
3531 const Array& args = Array::Handle(Z, Array::New(kNumArgs));
3532 args.SetAt(0, instance); // Set up the receiver as the first argument.
3533 for (int i = 0; i < length; i++) {
3534 indexobj = Integer::New(offset + i);
3535 valueobj = Integer::New(native_array[i]);
3536 args.SetAt(1, indexobj);
3537 args.SetAt(2, valueobj);
3538 const Object& result =
3539 Object::Handle(Z, DartEntry::InvokeFunction(function, args));
3540 if (result.IsError()) {
3541 return Api::NewHandle(T, result.ptr());
3542 }
3543 }
3544 return Api::Success();
3545 }
3546 return Api::NewArgumentError(
3547 "Object does not implement the 'List' interface");
3548}
bool IsImmutable() const
Definition object.h:338
#define SET_LIST_ELEMENT_AS_BYTES(type, obj, native_array, offset, length)

◆ Dart_ListSetAt()

DART_EXPORT Dart_Handle dart::Dart_ListSetAt ( Dart_Handle  list,
intptr_t  index,
Dart_Handle  value 
)

Definition at line 3293 of file dart_api_impl.cc.

3295 {
3296 DARTSCOPE(Thread::Current());
3297 const Object& obj = Object::Handle(Z, Api::UnwrapHandle(list));
3298 // If the list is immutable we call into Dart for the indexed setter to
3299 // get the unsupported operation exception as the result.
3300 if (obj.IsArray() && !Array::Cast(obj).IsImmutable()) {
3301 SET_LIST_ELEMENT(Array, obj, index, value);
3302 } else if (obj.IsGrowableObjectArray()) {
3303 SET_LIST_ELEMENT(GrowableObjectArray, obj, index, value);
3304 } else if (obj.IsError()) {
3305 return list;
3306 } else {
3308
3309 // Check and handle a dart object that implements the List interface.
3310 const Instance& instance = Instance::Handle(Z, GetListInstance(Z, obj));
3311 if (!instance.IsNull()) {
3312 const Integer& index_obj = Integer::Handle(Z, Integer::New(index));
3313 const Object& value_obj = Object::Handle(Z, Api::UnwrapHandle(value));
3314 if (!value_obj.IsNull() && !value_obj.IsInstance()) {
3315 RETURN_TYPE_ERROR(Z, value, Instance);
3316 }
3317 return Api::NewHandle(
3318 T, CallStatic3Args(Z, Symbols::_listSetAt(), instance, index_obj,
3319 Instance::Cast(value_obj)));
3320 }
3321 return Api::NewArgumentError(
3322 "Object does not implement the 'List' interface");
3323 }
3324}
#define SET_LIST_ELEMENT(type, obj, index, value)
static ObjectPtr CallStatic3Args(Zone *zone, const String &name, const Instance &arg0, const Instance &arg1, const Instance &arg2)

◆ Dart_LoadingUnitLibraryUris()

DART_EXPORT Dart_Handle dart::Dart_LoadingUnitLibraryUris ( intptr_t  loading_unit_id)

Definition at line 6692 of file dart_api_impl.cc.

6692 {
6693#if defined(TARGET_ARCH_IA32)
6694 return Api::NewError("AOT compilation is not supported on IA32.");
6695#elif !defined(DART_PRECOMPILER)
6696 return Api::NewError(
6697 "This VM was built without support for AOT compilation.");
6698#else
6699 DARTSCOPE(Thread::Current());
6701
6702 const Array& loading_units =
6703 Array::Handle(Z, T->isolate_group()->object_store()->loading_unit_uris());
6704 if (loading_unit_id >= 0 && loading_unit_id < loading_units.Length()) {
6705 return Api::NewHandle(T, loading_units.At(loading_unit_id));
6706 }
6707 return Api::NewError("Invalid loading_unit_id");
6708#endif
6709}

◆ Dart_LoadLibrary()

DART_EXPORT Dart_Handle dart::Dart_LoadLibrary ( Dart_Handle  kernel_buffer)

Definition at line 5788 of file dart_api_impl.cc.

5788 {
5789#if defined(DART_PRECOMPILED_RUNTIME)
5790 return Api::NewError("%s: Cannot compile on an AOT runtime.", CURRENT_FUNC);
5791#else
5792 DARTSCOPE(Thread::Current());
5793 const ExternalTypedData& td =
5794 Api::UnwrapExternalTypedDataHandle(Z, kernel_buffer);
5795 if (td.IsNull()) {
5796 RETURN_TYPE_ERROR(Z, kernel_buffer, ExternalTypedData);
5797 }
5798 return LoadLibrary(T, td);
5799#endif // defined(DART_PRECOMPILED_RUNTIME)
5800}

◆ Dart_LoadLibraryFromKernel()

DART_EXPORT Dart_Handle dart::Dart_LoadLibraryFromKernel ( const uint8_t *  buffer,
intptr_t  buffer_size 
)

Definition at line 5768 of file dart_api_impl.cc.

5769 {
5770#if defined(DART_PRECOMPILED_RUNTIME)
5771 return Api::NewError("%s: Cannot compile on an AOT runtime.", CURRENT_FUNC);
5772#else
5773 DARTSCOPE(Thread::Current());
5775 StackZone zone(T);
5776
5778
5779 // NOTE: We do not attach a finalizer for this object, because the embedder
5780 // will/should free it once the isolate group has shutdown.
5781 const auto& td = ExternalTypedData::Handle(ExternalTypedData::New(
5782 kExternalTypedDataUint8ArrayCid, const_cast<uint8_t*>(buffer),
5783 buffer_size, Heap::kOld));
5784 return LoadLibrary(T, td);
5785#endif // defined(DART_PRECOMPILED_RUNTIME)
5786}
static Dart_Handle LoadLibrary(Thread *T, const ExternalTypedData &td)

◆ Dart_LoadScriptFromKernel()

DART_EXPORT Dart_Handle dart::Dart_LoadScriptFromKernel ( const uint8_t *  buffer,
intptr_t  buffer_size 
)

Definition at line 5424 of file dart_api_impl.cc.

5425 {
5426#if defined(DART_PRECOMPILED_RUNTIME)
5427 return Api::NewError("%s: Cannot compile on an AOT runtime.", CURRENT_FUNC);
5428#else
5429 DARTSCOPE(Thread::Current());
5431 StackZone zone(T);
5432 IsolateGroup* IG = T->isolate_group();
5433
5434 Library& library = Library::Handle(Z, IG->object_store()->root_library());
5435 if (!library.IsNull()) {
5436 const String& library_url = String::Handle(Z, library.url());
5437 return Api::NewError("%s: A script has already been loaded from '%s'.",
5438 CURRENT_FUNC, library_url.ToCString());
5439 }
5441
5442 // NOTE: We do not attach a finalizer for this object, because the embedder
5443 // will free it once the isolate group has shutdown.
5444 const auto& td = ExternalTypedData::Handle(ExternalTypedData::New(
5445 kExternalTypedDataUint8ArrayCid, const_cast<uint8_t*>(buffer),
5446 buffer_size, Heap::kOld));
5447
5448 const char* error = nullptr;
5449 std::unique_ptr<kernel::Program> program =
5450 kernel::Program::ReadFromTypedData(td, &error);
5451 if (program == nullptr) {
5452 return Api::NewError("Can't load Kernel binary: %s.", error);
5453 }
5454 const Object& tmp = kernel::KernelLoader::LoadEntireProgram(program.get());
5455 program.reset();
5456
5457 if (tmp.IsError()) {
5458 return Api::NewHandle(T, tmp.ptr());
5459 }
5460
5461 IG->source()->script_kernel_size = buffer_size;
5462 IG->source()->script_kernel_buffer = buffer;
5463
5464 // TODO(32618): Setting root library based on whether it has 'main' or not
5465 // is not correct because main can be in the exported namespace of a library
5466 // or it could be a getter.
5467 if (tmp.IsNull()) {
5468 return Api::NewError(
5469 "Invoked Dart programs must have a 'main' function defined:\n"
5470 "https://dart.dev/guides/language/"
5471 "language-tour#a-basic-dart-program");
5472 }
5473 library ^= tmp.ptr();
5474 IG->object_store()->set_root_library(library);
5475 return Api::NewHandle(T, library.ptr());
5476#endif // defined(DART_PRECOMPILED_RUNTIME)
5477}

◆ Dart_LookupLibrary()

DART_EXPORT Dart_Handle dart::Dart_LookupLibrary ( Dart_Handle  url)

Definition at line 5716 of file dart_api_impl.cc.

5716 {
5717 DARTSCOPE(Thread::Current());
5718 const String& url_str = Api::UnwrapStringHandle(Z, url);
5719 if (url_str.IsNull()) {
5720 RETURN_TYPE_ERROR(Z, url, String);
5721 }
5722 const Library& library =
5723 Library::Handle(Z, Library::LookupLibrary(T, url_str));
5724 if (library.IsNull()) {
5725 return Api::NewError("%s: library '%s' not found.", CURRENT_FUNC,
5726 url_str.ToCString());
5727 } else {
5728 return Api::NewHandle(T, library.ptr());
5729 }
5730}

◆ Dart_MapContainsKey()

DART_EXPORT Dart_Handle dart::Dart_MapContainsKey ( Dart_Handle  map,
Dart_Handle  key 
)

Definition at line 3568 of file dart_api_impl.cc.

3568 {
3569 DARTSCOPE(Thread::Current());
3571 const Object& obj = Object::Handle(Z, Api::UnwrapHandle(map));
3572 const Instance& instance = Instance::Handle(Z, GetMapInstance(Z, obj));
3573 if (!instance.IsNull()) {
3574 const Object& key_obj = Object::Handle(Z, Api::UnwrapHandle(key));
3575 if (!(key_obj.IsInstance() || key_obj.IsNull())) {
3576 return Api::NewError("Key is not an instance");
3577 }
3578 return Api::NewHandle(
3579 T, CallStatic2Args(Z, Symbols::_mapContainsKey(), instance,
3580 Instance::Cast(key_obj)));
3581 }
3582 return Api::NewArgumentError("Object does not implement the 'Map' interface");
3583}

◆ Dart_MapGetAt()

DART_EXPORT Dart_Handle dart::Dart_MapGetAt ( Dart_Handle  map,
Dart_Handle  key 
)

Definition at line 3552 of file dart_api_impl.cc.

3552 {
3553 DARTSCOPE(Thread::Current());
3555 const Object& obj = Object::Handle(Z, Api::UnwrapHandle(map));
3556 const Instance& instance = Instance::Handle(Z, GetMapInstance(Z, obj));
3557 if (!instance.IsNull()) {
3558 const Object& key_obj = Object::Handle(Api::UnwrapHandle(key));
3559 if (!(key_obj.IsInstance() || key_obj.IsNull())) {
3560 return Api::NewError("Key is not an instance");
3561 }
3562 return Api::NewHandle(T, CallStatic2Args(Z, Symbols::_mapGet(), instance,
3563 Instance::Cast(key_obj)));
3564 }
3565 return Api::NewArgumentError("Object does not implement the 'Map' interface");
3566}

◆ Dart_MapKeys()

DART_EXPORT Dart_Handle dart::Dart_MapKeys ( Dart_Handle  map)

Definition at line 3585 of file dart_api_impl.cc.

3585 {
3586 DARTSCOPE(Thread::Current());
3588 Object& obj = Object::Handle(Z, Api::UnwrapHandle(map));
3589 Instance& instance = Instance::Handle(Z, GetMapInstance(Z, obj));
3590 if (!instance.IsNull()) {
3591 return Api::NewHandle(T, CallStatic1Arg(Z, Symbols::_mapKeys(), instance));
3592 }
3593 return Api::NewArgumentError("Object does not implement the 'Map' interface");
3594}

◆ Dart_New()

DART_EXPORT Dart_Handle dart::Dart_New ( Dart_Handle  type,
Dart_Handle  constructor_name,
int  number_of_arguments,
Dart_Handle arguments 
)

Definition at line 4219 of file dart_api_impl.cc.

4222 {
4223 DARTSCOPE(Thread::Current());
4225 Object& result = Object::Handle(Z);
4226
4227 if (number_of_arguments < 0) {
4228 return Api::NewError(
4229 "%s expects argument 'number_of_arguments' to be non-negative.",
4230 CURRENT_FUNC);
4231 }
4232
4233 // Get the class to instantiate.
4234 Object& unchecked_type = Object::Handle(Api::UnwrapHandle(type));
4235 if (unchecked_type.IsNull() || !unchecked_type.IsType()) {
4237 }
4238 Type& type_obj = Type::Handle();
4239 type_obj ^= unchecked_type.ptr();
4240 if (!type_obj.IsFinalized()) {
4241 return Api::NewError(
4242 "%s expects argument 'type' to be a fully resolved type.",
4243 CURRENT_FUNC);
4244 }
4245 Class& cls = Class::Handle(Z, type_obj.type_class());
4246 CHECK_ERROR_HANDLE(cls.EnsureIsAllocateFinalized(T));
4247
4248 TypeArguments& type_arguments =
4249 TypeArguments::Handle(Z, type_obj.GetInstanceTypeArguments(T));
4250
4251 const String& base_constructor_name = String::Handle(Z, cls.Name());
4252
4253 // And get the name of the constructor to invoke.
4254 String& dot_name = String::Handle(Z);
4255 result = Api::UnwrapHandle(constructor_name);
4256 if (result.IsNull()) {
4257 dot_name = Symbols::Dot().ptr();
4258 } else if (result.IsString()) {
4259 dot_name = String::Concat(Symbols::Dot(), String::Cast(result));
4260 } else {
4261 RETURN_TYPE_ERROR(Z, constructor_name, String);
4262 }
4263
4264 // Resolve the constructor.
4265 String& constr_name =
4266 String::Handle(String::Concat(base_constructor_name, dot_name));
4267 result = ResolveConstructor("Dart_New", cls, base_constructor_name,
4268 constr_name, number_of_arguments);
4269 if (result.IsError()) {
4270 return Api::NewHandle(T, result.ptr());
4271 }
4272 ASSERT(result.IsFunction());
4273 Function& constructor = Function::Handle(Z);
4274 constructor ^= result.ptr();
4275
4276 Instance& new_object = Instance::Handle(Z);
4277 if (constructor.IsGenerativeConstructor()) {
4278 CHECK_ERROR_HANDLE(cls.VerifyEntryPoint());
4279#if defined(DEBUG)
4280 if (!cls.is_allocated() &&
4281 (Dart::vm_snapshot_kind() == Snapshot::kFullAOT)) {
4282 return Api::NewError("Precompilation dropped '%s'", cls.ToCString());
4283 }
4284#endif
4285 // Create the new object.
4286 new_object = Instance::New(cls);
4287 }
4288
4289 // Create the argument list.
4290 intptr_t arg_index = 0;
4291 int extra_args = 1;
4292 const Array& args =
4293 Array::Handle(Z, Array::New(number_of_arguments + extra_args));
4294 if (constructor.IsGenerativeConstructor()) {
4295 // Constructors get the uninitialized object.
4296 if (!type_arguments.IsNull()) {
4297 // The type arguments will be null if the class has no type parameters, in
4298 // which case the following call would fail because there is no slot
4299 // reserved in the object for the type vector.
4300 new_object.SetTypeArguments(type_arguments);
4301 }
4302 args.SetAt(arg_index++, new_object);
4303 } else {
4304 // Factories get type arguments.
4305 args.SetAt(arg_index++, type_arguments);
4306 }
4307 Object& argument = Object::Handle(Z);
4308 for (int i = 0; i < number_of_arguments; i++) {
4309 argument = Api::UnwrapHandle(arguments[i]);
4310 if (!argument.IsNull() && !argument.IsInstance()) {
4311 if (argument.IsError()) {
4312 return Api::NewHandle(T, argument.ptr());
4313 } else {
4314 return Api::NewError(
4315 "%s expects arguments[%d] to be an Instance handle.", CURRENT_FUNC,
4316 i);
4317 }
4318 }
4319 args.SetAt(arg_index++, argument);
4320 }
4321
4322 const int kTypeArgsLen = 0;
4323 Array& args_descriptor_array = Array::Handle(
4324 Z, ArgumentsDescriptor::NewBoxed(kTypeArgsLen, args.Length()));
4325
4326 ArgumentsDescriptor args_descriptor(args_descriptor_array);
4327 ObjectPtr type_error = constructor.DoArgumentTypesMatch(
4328 args, args_descriptor, type_arguments, Object::empty_type_arguments());
4329 if (type_error != Error::null()) {
4330 return Api::NewHandle(T, type_error);
4331 }
4332
4333 // Invoke the constructor and return the new object.
4334 result = DartEntry::InvokeFunction(constructor, args);
4335 if (result.IsError()) {
4336 return Api::NewHandle(T, result.ptr());
4337 }
4338
4339 if (constructor.IsGenerativeConstructor()) {
4340 ASSERT(result.IsNull());
4341 } else {
4342 ASSERT(result.IsNull() || result.IsInstance());
4343 new_object ^= result.ptr();
4344 }
4345 return Api::NewHandle(T, new_object.ptr());
4346}
static ObjectPtr ResolveConstructor(const char *current_func, const Class &cls, const String &class_name, const String &dotted_name, int num_args)

◆ Dart_NewApiError()

DART_EXPORT Dart_Handle dart::Dart_NewApiError ( const char *  error)

Definition at line 827 of file dart_api_impl.cc.

827 {
828 DARTSCOPE(Thread::Current());
830
831 const String& message = String::Handle(Z, String::New(error));
832 return Api::NewHandle(T, ApiError::New(message));
833}

◆ Dart_NewBoolean()

DART_EXPORT Dart_Handle dart::Dart_NewBoolean ( bool  value)

Definition at line 2797 of file dart_api_impl.cc.

2797 {
2798 Isolate* isolate = Isolate::Current();
2799 CHECK_ISOLATE(isolate);
2800 return value ? Api::True() : Api::False();
2801}

◆ Dart_NewByteBuffer()

DART_EXPORT Dart_Handle dart::Dart_NewByteBuffer ( Dart_Handle  typed_data)

Definition at line 3970 of file dart_api_impl.cc.

3970 {
3971 DARTSCOPE(Thread::Current());
3972 intptr_t class_id = Api::ClassId(typed_data);
3973 if (!IsExternalTypedDataClassId(class_id) &&
3974 !IsTypedDataViewClassId(class_id) && !IsTypedDataClassId(class_id)) {
3975 RETURN_TYPE_ERROR(Z, typed_data, 'TypedData');
3976 }
3977 Object& result = Object::Handle(Z);
3978 result = GetByteBufferConstructor(T, Symbols::_ByteBuffer(),
3979 Symbols::_ByteBufferDot_New(), 1);
3980 ASSERT(!result.IsNull());
3981 ASSERT(result.IsFunction());
3982 const Function& factory = Function::Cast(result);
3983 ASSERT(!factory.IsGenerativeConstructor());
3984
3985 // Create the argument list.
3986 const Array& args = Array::Handle(Z, Array::New(2));
3987 // Factories get type arguments.
3988 args.SetAt(0, Object::null_type_arguments());
3989 const Object& obj = Object::Handle(Z, Api::UnwrapHandle(typed_data));
3990 args.SetAt(1, obj);
3991
3992 // Invoke the factory constructor and return the new object.
3993 result = DartEntry::InvokeFunction(factory, args);
3994 ASSERT(result.IsInstance() || result.IsNull() || result.IsError());
3995 return Api::NewHandle(T, result.ptr());
3996}

◆ Dart_NewCompilationError()

DART_EXPORT Dart_Handle dart::Dart_NewCompilationError ( const char *  error)

Definition at line 835 of file dart_api_impl.cc.

835 {
836 DARTSCOPE(Thread::Current());
838
839 const String& message = String::Handle(Z, String::New(error));
840 return Api::NewHandle(T, LanguageError::New(message));
841}

◆ Dart_NewDouble()

DART_EXPORT Dart_Handle dart::Dart_NewDouble ( double  value)

Definition at line 2716 of file dart_api_impl.cc.

2716 {
2717 DARTSCOPE(Thread::Current());
2719 return Api::NewHandle(T, Double::New(value));
2720}

◆ Dart_NewExternalTypedData()

DART_EXPORT Dart_Handle dart::Dart_NewExternalTypedData ( Dart_TypedData_Type  type,
void *  data,
intptr_t  length 
)

Definition at line 3926 of file dart_api_impl.cc.

3928 {
3929 return NewExternalTypedDataWithFinalizer(type, data, length, nullptr, 0,
3930 nullptr, false);
3931}
static Dart_Handle NewExternalTypedDataWithFinalizer(Dart_TypedData_Type type, void *data, intptr_t length, void *peer, intptr_t external_allocation_size, Dart_HandleFinalizer callback, bool unmodifiable)

◆ Dart_NewExternalTypedDataWithFinalizer()

DART_EXPORT Dart_Handle dart::Dart_NewExternalTypedDataWithFinalizer ( Dart_TypedData_Type  type,
void *  data,
intptr_t  length,
void *  peer,
intptr_t  external_allocation_size,
Dart_HandleFinalizer  callback 
)

Definition at line 3934 of file dart_api_impl.cc.

3939 {
3941 type, data, length, peer, external_allocation_size, callback, false);
3942}

◆ Dart_NewFinalizableHandle()

DART_EXPORT Dart_FinalizableHandle dart::Dart_NewFinalizableHandle ( Dart_Handle  object,
void *  peer,
intptr_t  external_allocation_size,
Dart_HandleFinalizer  callback 
)

Definition at line 1101 of file dart_api_impl.cc.

1104 {
1105 DARTSCOPE(Thread::Current());
1106 if (callback == nullptr) {
1107 return nullptr;
1108 }
1109
1110 return AllocateFinalizableHandle(T, object, peer, external_allocation_size,
1111 callback);
1112}

◆ Dart_NewInteger()

DART_EXPORT Dart_Handle dart::Dart_NewInteger ( int64_t  value)

Definition at line 2615 of file dart_api_impl.cc.

2615 {
2616 // Fast path for Smis.
2617 Thread* thread = Thread::Current();
2618 Isolate* isolate = thread->isolate();
2619 CHECK_ISOLATE(isolate);
2620 API_TIMELINE_DURATION(thread);
2621 DARTSCOPE(thread);
2622 CHECK_CALLBACK_STATE(thread);
2623 return Api::NewHandle(thread, Integer::New(value));
2624}

◆ Dart_NewIntegerFromHexCString()

DART_EXPORT Dart_Handle dart::Dart_NewIntegerFromHexCString ( const char *  str)

Definition at line 2637 of file dart_api_impl.cc.

2637 {
2638 DARTSCOPE(Thread::Current());
2641 const String& str_obj = String::Handle(Z, String::New(str));
2642 IntegerPtr integer = Integer::New(str_obj);
2643 if (integer == Integer::null()) {
2644 return Api::NewError("%s: Cannot create Dart integer from string %s",
2645 CURRENT_FUNC, str);
2646 }
2647 return Api::NewHandle(T, integer);
2648}

◆ Dart_NewIntegerFromUint64()

DART_EXPORT Dart_Handle dart::Dart_NewIntegerFromUint64 ( uint64_t  value)

Definition at line 2626 of file dart_api_impl.cc.

2626 {
2627 DARTSCOPE(Thread::Current());
2630 if (Integer::IsValueInRange(value)) {
2631 return Api::NewHandle(T, Integer::NewFromUint64(value));
2632 }
2633 return Api::NewError("%s: Cannot create Dart integer from value %" Pu64,
2634 CURRENT_FUNC, value);
2635}
#define Pu64
Definition globals.h:417

◆ Dart_NewList()

DART_EXPORT Dart_Handle dart::Dart_NewList ( intptr_t  length)

Definition at line 3050 of file dart_api_impl.cc.

3050 {
3052}
@ Dart_CoreType_Dynamic
Definition dart_api.h:2424
DART_EXPORT Dart_Handle Dart_NewListOf(Dart_CoreType_Id element_type_id, intptr_t length)

◆ Dart_NewListOf()

DART_EXPORT Dart_Handle dart::Dart_NewListOf ( Dart_CoreType_Id  element_type_id,
intptr_t  length 
)

Definition at line 3069 of file dart_api_impl.cc.

3070 {
3071 DARTSCOPE(Thread::Current());
3072 if (element_type_id != Dart_CoreType_Dynamic) {
3073 return Api::NewError(
3074 "Cannot use legacy types with --sound-null-safety enabled. "
3075 "Use Dart_NewListOfType or Dart_NewListOfTypeFilled instead.");
3076 }
3077 CHECK_LENGTH(length, Array::kMaxElements);
3079 const Array& arr = Array::Handle(Z, Array::New(length));
3080 if (element_type_id != Dart_CoreType_Dynamic) {
3081 arr.SetTypeArguments(TypeArguments::Handle(
3082 Z, TypeArgumentsForElementType(T->isolate_group()->object_store(),
3083 element_type_id)));
3084 }
3085 return Api::NewHandle(T, arr.ptr());
3086}
#define CHECK_LENGTH(length, max_elements)

◆ Dart_NewListOfType()

DART_EXPORT Dart_Handle dart::Dart_NewListOfType ( Dart_Handle  element_type,
intptr_t  length 
)

Definition at line 3093 of file dart_api_impl.cc.

3094 {
3095 DARTSCOPE(Thread::Current());
3096 CHECK_LENGTH(length, Array::kMaxElements);
3098 const Type& type = Api::UnwrapTypeHandle(Z, element_type);
3099 if (type.IsNull()) {
3100 RETURN_TYPE_ERROR(Z, element_type, Type);
3101 }
3102 if (!type.IsFinalized()) {
3103 return Api::NewError(
3104 "%s expects argument 'type' to be a fully resolved type.",
3105 CURRENT_FUNC);
3106 }
3107 if ((length > 0) && !CanTypeContainNull(type)) {
3108 return Api::NewError("%s expects argument 'type' to be a nullable type.",
3109 CURRENT_FUNC);
3110 }
3111 return Api::NewHandle(T, Array::New(length, type));
3112}
static bool CanTypeContainNull(const Type &type)

◆ Dart_NewListOfTypeFilled()

DART_EXPORT Dart_Handle dart::Dart_NewListOfTypeFilled ( Dart_Handle  element_type,
Dart_Handle  fill_object,
intptr_t  length 
)

Definition at line 3114 of file dart_api_impl.cc.

3116 {
3117 DARTSCOPE(Thread::Current());
3118 CHECK_LENGTH(length, Array::kMaxElements);
3120 const Type& type = Api::UnwrapTypeHandle(Z, element_type);
3121 if (type.IsNull()) {
3122 RETURN_TYPE_ERROR(Z, element_type, Type);
3123 }
3124 if (!type.IsFinalized()) {
3125 return Api::NewError(
3126 "%s expects argument 'type' to be a fully resolved type.",
3127 CURRENT_FUNC);
3128 }
3129 const Instance& instance = Api::UnwrapInstanceHandle(Z, fill_object);
3130 if (!instance.IsNull() && !InstanceIsType(T, instance, type)) {
3131 return Api::NewError(
3132 "%s expects argument 'fill_object' to have the same type as "
3133 "'element_type'.",
3134 CURRENT_FUNC);
3135 }
3136 if ((length > 0) && instance.IsNull() && !CanTypeContainNull(type)) {
3137 return Api::NewError(
3138 "%s expects argument 'fill_object' to be non-null for a non-nullable "
3139 "'element_type'.",
3140 CURRENT_FUNC);
3141 }
3142 Array& arr = Array::Handle(Z, Array::New(length, type));
3143 for (intptr_t i = 0; i < arr.Length(); ++i) {
3144 arr.SetAt(i, instance);
3145 }
3146 return Api::NewHandle(T, arr.ptr());
3147}
static bool InstanceIsType(const Thread *thread, const Instance &instance, const Type &type)

◆ Dart_NewNativePort()

DART_EXPORT Dart_Port dart::Dart_NewNativePort ( const char *  name,
Dart_NativeMessageHandler  handler,
bool  handle_concurrently 
)

Definition at line 74 of file native_api_impl.cc.

76 {
77 if (name == nullptr) {
78 name = "<UnnamedNativePort>";
79 }
80 if (handler == nullptr) {
81 OS::PrintErr("%s expects argument 'handler' to be non-null.\n",
83 return ILLEGAL_PORT;
84 }
85 if (!Dart::SetActiveApiCall()) {
86 return ILLEGAL_PORT;
87 }
88 // Start the native port without a current isolate.
89 IsolateLeaveScope saver(Isolate::Current());
90
91 NativeMessageHandler* nmh = new NativeMessageHandler(name, handler);
92 Dart_Port port_id = PortMap::CreatePort(nmh);
93 if (port_id != ILLEGAL_PORT) {
94 if (!nmh->Run(Dart::thread_pool(), nullptr, nullptr, 0)) {
95 PortMap::ClosePort(port_id);
96 nmh->RequestDeletion();
97 port_id = ILLEGAL_PORT;
98 }
99 }
100 Dart::ResetActiveApiCall();
101 return port_id;
102}

◆ Dart_NewPersistentHandle()

DART_EXPORT Dart_PersistentHandle dart::Dart_NewPersistentHandle ( Dart_Handle  object)

Definition at line 971 of file dart_api_impl.cc.

971 {
972 DARTSCOPE(Thread::Current());
973 Isolate* I = T->isolate();
974 ApiState* state = I->group()->api_state();
975 ASSERT(state != nullptr);
976 const Object& old_ref = Object::Handle(Z, Api::UnwrapHandle(object));
977 PersistentHandle* new_ref = state->AllocatePersistentHandle();
978 new_ref->set_ptr(old_ref);
979 return new_ref->apiHandle();
980}
Dart_PersistentHandle apiHandle()
void set_ptr(ObjectPtr ref)

◆ Dart_NewSendPort()

DART_EXPORT Dart_Handle dart::Dart_NewSendPort ( Dart_Port  port_id)

Definition at line 2149 of file dart_api_impl.cc.

2149 {
2150 DARTSCOPE(Thread::Current());
2152 if (port_id == ILLEGAL_PORT) {
2153 return Api::NewError("%s: illegal port_id %" Pd64 ".", CURRENT_FUNC,
2154 port_id);
2155 }
2156 int64_t origin_id = PortMap::GetOriginId(port_id);
2157 return Api::NewHandle(T, SendPort::New(port_id, origin_id));
2158}

◆ Dart_NewStringFromCString()

DART_EXPORT Dart_Handle dart::Dart_NewStringFromCString ( const char *  str)

Definition at line 2844 of file dart_api_impl.cc.

2844 {
2845 DARTSCOPE(Thread::Current());
2847 if (str == nullptr) {
2848 RETURN_NULL_ERROR(str);
2849 }
2851 return Api::NewHandle(T, String::New(str));
2852}

◆ Dart_NewStringFromUTF16()

DART_EXPORT Dart_Handle dart::Dart_NewStringFromUTF16 ( const uint16_t *  utf16_array,
intptr_t  length 
)

Definition at line 2870 of file dart_api_impl.cc.

2871 {
2872 DARTSCOPE(Thread::Current());
2873 if (utf16_array == nullptr && length != 0) {
2874 RETURN_NULL_ERROR(utf16_array);
2875 }
2876 CHECK_LENGTH(length, String::kMaxElements);
2878 return Api::NewHandle(T, String::FromUTF16(utf16_array, length));
2879}

◆ Dart_NewStringFromUTF32()

DART_EXPORT Dart_Handle dart::Dart_NewStringFromUTF32 ( const int32_t *  utf32_array,
intptr_t  length 
)

Definition at line 2881 of file dart_api_impl.cc.

2882 {
2883 DARTSCOPE(Thread::Current());
2885 if (utf32_array == nullptr && length != 0) {
2886 RETURN_NULL_ERROR(utf32_array);
2887 }
2888 CHECK_LENGTH(length, String::kMaxElements);
2890 return Api::NewHandle(T, String::FromUTF32(utf32_array, length));
2891}

◆ Dart_NewStringFromUTF8()

DART_EXPORT Dart_Handle dart::Dart_NewStringFromUTF8 ( const uint8_t *  utf8_array,
intptr_t  length 
)

Definition at line 2854 of file dart_api_impl.cc.

2855 {
2856 DARTSCOPE(Thread::Current());
2858 if (utf8_array == nullptr && length != 0) {
2859 RETURN_NULL_ERROR(utf8_array);
2860 }
2861 CHECK_LENGTH(length, String::kMaxElements);
2862 if (!Utf8::IsValid(utf8_array, length)) {
2863 return Api::NewError("%s expects argument 'str' to be valid UTF-8.",
2864 CURRENT_FUNC);
2865 }
2867 return Api::NewHandle(T, String::FromUTF8(utf8_array, length));
2868}

◆ Dart_NewTypedData()

DART_EXPORT Dart_Handle dart::Dart_NewTypedData ( Dart_TypedData_Type  type,
intptr_t  length 
)

Definition at line 3799 of file dart_api_impl.cc.

3800 {
3801 DARTSCOPE(Thread::Current());
3803 switch (type) {
3805 return NewByteData(T, length);
3807 return NewTypedData(T, kTypedDataInt8ArrayCid, length);
3809 return NewTypedData(T, kTypedDataUint8ArrayCid, length);
3811 return NewTypedData(T, kTypedDataUint8ClampedArrayCid, length);
3813 return NewTypedData(T, kTypedDataInt16ArrayCid, length);
3815 return NewTypedData(T, kTypedDataUint16ArrayCid, length);
3817 return NewTypedData(T, kTypedDataInt32ArrayCid, length);
3819 return NewTypedData(T, kTypedDataUint32ArrayCid, length);
3821 return NewTypedData(T, kTypedDataInt64ArrayCid, length);
3823 return NewTypedData(T, kTypedDataUint64ArrayCid, length);
3825 return NewTypedData(T, kTypedDataFloat32ArrayCid, length);
3827 return NewTypedData(T, kTypedDataFloat64ArrayCid, length);
3829 return NewTypedData(T, kTypedDataInt32x4ArrayCid, length);
3831 return NewTypedData(T, kTypedDataFloat32x4ArrayCid, length);
3833 return NewTypedData(T, kTypedDataFloat64x2ArrayCid, length);
3834 default:
3835 return Api::NewError("%s expects argument 'type' to be of 'TypedData'",
3836 CURRENT_FUNC);
3837 }
3838 UNREACHABLE();
3839 return Api::Null();
3840}
@ Dart_TypedData_kInt32x4
Definition dart_api.h:2616
@ Dart_TypedData_kUint32
Definition dart_api.h:2611
@ Dart_TypedData_kInt32
Definition dart_api.h:2610
@ Dart_TypedData_kUint16
Definition dart_api.h:2609
@ Dart_TypedData_kFloat64x2
Definition dart_api.h:2618
@ Dart_TypedData_kUint64
Definition dart_api.h:2613
@ Dart_TypedData_kFloat32
Definition dart_api.h:2614
@ Dart_TypedData_kInt16
Definition dart_api.h:2608
@ Dart_TypedData_kFloat64
Definition dart_api.h:2615
@ Dart_TypedData_kUint8Clamped
Definition dart_api.h:2607
@ Dart_TypedData_kInt8
Definition dart_api.h:2605
@ Dart_TypedData_kInt64
Definition dart_api.h:2612
static Dart_Handle NewTypedData(Thread *thread, intptr_t cid, intptr_t length)
static Dart_Handle NewByteData(Thread *thread, intptr_t length)

◆ Dart_NewUnhandledExceptionError()

DART_EXPORT Dart_Handle dart::Dart_NewUnhandledExceptionError ( Dart_Handle  exception)

Definition at line 843 of file dart_api_impl.cc.

843 {
844 DARTSCOPE(Thread::Current());
846
847 Instance& obj = Instance::Handle(Z);
848 intptr_t class_id = Api::ClassId(exception);
849 if ((class_id == kApiErrorCid) || (class_id == kLanguageErrorCid)) {
850 const Object& excp = Object::Handle(Z, Api::UnwrapHandle(exception));
851 obj = String::New(GetErrorString(T, excp));
852 } else {
853 obj = Api::UnwrapInstanceHandle(Z, exception).ptr();
854 if (obj.IsNull()) {
855 RETURN_TYPE_ERROR(Z, exception, Instance);
856 }
857 }
858 const StackTrace& stacktrace = StackTrace::Handle(Z);
859 return Api::NewHandle(T, UnhandledException::New(obj, stacktrace));
860}

◆ Dart_NewUnmodifiableExternalTypedDataWithFinalizer()

DART_EXPORT Dart_Handle dart::Dart_NewUnmodifiableExternalTypedDataWithFinalizer ( Dart_TypedData_Type  type,
const void *  data,
intptr_t  length,
void *  peer,
intptr_t  external_allocation_size,
Dart_HandleFinalizer  callback 
)

Definition at line 3944 of file dart_api_impl.cc.

3950 {
3952 type, const_cast<void*>(data), length, peer, external_allocation_size,
3953 callback, true);
3954}

◆ Dart_NewUserTag()

DART_EXPORT Dart_Handle dart::Dart_NewUserTag ( const char *  label)

Definition at line 6920 of file dart_api_impl.cc.

6920 {
6921 Thread* thread = Thread::Current();
6922 CHECK_ISOLATE(thread->isolate());
6923 DARTSCOPE(thread);
6924 if (label == nullptr) {
6925 return Api::NewError(
6926 "Dart_NewUserTag expects argument 'label' to be non-null");
6927 }
6928 const String& value = String::Handle(String::New(label));
6929 return Api::NewHandle(thread, UserTag::New(value));
6930}

◆ Dart_NewWeakPersistentHandle()

DART_EXPORT Dart_WeakPersistentHandle dart::Dart_NewWeakPersistentHandle ( Dart_Handle  object,
void *  peer,
intptr_t  external_allocation_size,
Dart_HandleFinalizer  callback 
)

Definition at line 1087 of file dart_api_impl.cc.

1090 {
1091 DARTSCOPE(Thread::Current());
1092 if (callback == nullptr) {
1093 return nullptr;
1094 }
1095
1096 return AllocateWeakPersistentHandle(T, object, peer, external_allocation_size,
1097 callback);
1098}

◆ Dart_NotifyDestroyed()

DART_EXPORT void dart::Dart_NotifyDestroyed ( void  )

Definition at line 1790 of file dart_api_impl.cc.

1790 {
1791 Thread* T = Thread::Current();
1792 CHECK_ISOLATE(T->isolate());
1794 TransitionNativeToVM transition(T);
1795 T->heap()->NotifyDestroyed();
1796}

◆ Dart_NotifyIdle()

DART_EXPORT void dart::Dart_NotifyIdle ( int64_t  deadline)

Definition at line 1782 of file dart_api_impl.cc.

1782 {
1783 Thread* T = Thread::Current();
1784 CHECK_ISOLATE(T->isolate());
1786 TransitionNativeToVM transition(T);
1787 T->isolate()->group()->idle_time_handler()->NotifyIdle(deadline);
1788}

◆ Dart_NotifyLowMemory()

DART_EXPORT void dart::Dart_NotifyLowMemory ( void  )

Definition at line 1842 of file dart_api_impl.cc.

1842 {
1843 API_TIMELINE_BEGIN_END(Thread::Current());
1844 Page::ClearCache();
1845 Zone::ClearCache();
1846
1847 // For each isolate's global variables, we might also clear:
1848 // - RegExp backtracking stack (both bytecode and compiled versions)
1849 // - String -> RegExp cache
1850 // - BigInt division/remainder cache
1851 // - double.toString cache
1852 // But cache invalidation code might be larger than the expected size of some
1853 // caches.
1854}

◆ Dart_Null()

DART_EXPORT Dart_Handle dart::Dart_Null ( void  )

Definition at line 2215 of file dart_api_impl.cc.

2215 {
2216 ASSERT(Isolate::Current() != nullptr);
2217 return Api::Null();
2218}

◆ Dart_ObjectEquals()

DART_EXPORT Dart_Handle dart::Dart_ObjectEquals ( Dart_Handle  obj1,
Dart_Handle  obj2,
bool *  value 
)

Definition at line 2251 of file dart_api_impl.cc.

2253 {
2254 DARTSCOPE(Thread::Current());
2256 const Instance& expected =
2257 Instance::CheckedHandle(Z, Api::UnwrapHandle(obj1));
2258 const Instance& actual = Instance::CheckedHandle(Z, Api::UnwrapHandle(obj2));
2259 const Object& result =
2260 Object::Handle(Z, DartLibraryCalls::Equals(expected, actual));
2261 if (result.IsBool()) {
2262 *value = Bool::Cast(result).value();
2263 return Api::Success();
2264 } else if (result.IsError()) {
2265 return Api::NewHandle(T, result.ptr());
2266 } else {
2267 return Api::NewError("Expected boolean result from ==");
2268 }
2269}

◆ Dart_ObjectIsType()

DART_EXPORT Dart_Handle dart::Dart_ObjectIsType ( Dart_Handle  object,
Dart_Handle  type,
bool *  value 
)

Definition at line 2281 of file dart_api_impl.cc.

2283 {
2284 DARTSCOPE(Thread::Current());
2285
2286 const Type& type_obj = Api::UnwrapTypeHandle(Z, type);
2287 if (type_obj.IsNull()) {
2288 *value = false;
2290 }
2291 if (!type_obj.IsFinalized()) {
2292 return Api::NewError(
2293 "%s expects argument 'type' to be a fully resolved type.",
2294 CURRENT_FUNC);
2295 }
2296 if (object == Api::Null()) {
2297 *value = false;
2298 return Api::Success();
2299 }
2300 const Instance& instance = Api::UnwrapInstanceHandle(Z, object);
2301 if (instance.IsNull()) {
2302 *value = false;
2303 RETURN_TYPE_ERROR(Z, object, Instance);
2304 }
2305 *value = InstanceIsType(T, instance, type_obj);
2306 return Api::Success();
2307}

◆ Dart_Post()

DART_EXPORT bool dart::Dart_Post ( Dart_Port  port_id,
Dart_Handle  handle 
)

Definition at line 2136 of file dart_api_impl.cc.

2136 {
2137 DARTSCOPE(Thread::Current());
2139 NoSafepointScope no_safepoint_scope;
2140 if (port_id == ILLEGAL_PORT) {
2141 return false;
2142 }
2143
2144 const Object& object = Object::Handle(Z, Api::UnwrapHandle(handle));
2145 return PortMap::PostMessage(WriteMessage(/* same_group */ false, object,
2146 port_id, Message::kNormalPriority));
2147}

◆ Dart_PostCObject()

DART_EXPORT bool dart::Dart_PostCObject ( Dart_Port  port_id,
Dart_CObject message 
)

Definition at line 59 of file native_api_impl.cc.

59 {
60 return PostCObjectHelper(port_id, message);
61}
static bool PostCObjectHelper(Dart_Port port_id, Dart_CObject *message)

◆ Dart_PostInteger()

DART_EXPORT bool dart::Dart_PostInteger ( Dart_Port  port_id,
int64_t  message 
)

Definition at line 63 of file native_api_impl.cc.

63 {
64 if (Smi::IsValid(message)) {
65 return PortMap::PostMessage(
66 Message::New(port_id, Smi::New(message), Message::kNormalPriority));
67 }
68 Dart_CObject cobj;
70 cobj.value.as_int64 = message;
71 return PostCObjectHelper(port_id, &cobj);
72}

◆ Dart_Precompile()

DART_EXPORT Dart_Handle dart::Dart_Precompile ( void  )

Definition at line 6397 of file dart_api_impl.cc.

6397 {
6398#if defined(TARGET_ARCH_IA32)
6399 return Api::NewError("AOT compilation is not supported on IA32.");
6400#elif !defined(DART_PRECOMPILER)
6401 return Api::NewError(
6402 "This VM was built without support for AOT compilation.");
6403#else
6404 DARTSCOPE(Thread::Current());
6406 if (!FLAG_precompiled_mode) {
6407 return Api::NewError("Flag --precompilation was not specified.");
6408 }
6409 Dart_Handle result = Api::CheckAndFinalizePendingClasses(T);
6410 if (Api::IsError(result)) {
6411 return result;
6412 }
6414 CompilerState state(Thread::Current(), /*is_aot=*/true,
6415 /*is_optimizing=*/true);
6416 CHECK_ERROR_HANDLE(Precompiler::CompileAll());
6417 return Api::Success();
6418#endif
6419}

◆ Dart_PrepareToAbort()

DART_EXPORT void dart::Dart_PrepareToAbort ( void  )

Definition at line 35 of file unit_test_custom_zone.cc.

35 {
36 fprintf(stderr, "Dart_PrepareToAbort() not implemented!\n");
37 exit(1);
38}

◆ Dart_PropagateError()

DART_EXPORT void dart::Dart_PropagateError ( Dart_Handle  handle)

Definition at line 862 of file dart_api_impl.cc.

862 {
863 Thread* thread = Thread::Current();
864 CHECK_ISOLATE(thread->isolate());
865 TransitionNativeToVM transition(thread);
866 const Object& obj = Object::Handle(thread->zone(), Api::UnwrapHandle(handle));
867 if (!obj.IsError()) {
868 FATAL(
869 "%s expects argument 'handle' to be an error handle. "
870 "Did you forget to check Dart_IsError first?",
872 }
873 if (thread->top_exit_frame_info() == 0) {
874 // There are no dart frames on the stack so it would be illegal to
875 // propagate an error here.
876 FATAL("No Dart frames on stack, cannot propagate error.");
877 }
878 // Unwind all the API scopes till the exit frame before propagating.
879 const Error* error;
880 {
881 // We need to preserve the error object across the destruction of zones
882 // when the ApiScopes are unwound. By using NoSafepointScope, we can ensure
883 // that GC won't touch the raw error object before creating a valid
884 // handle for it in the surviving zone.
885 NoSafepointScope no_safepoint;
886 ErrorPtr raw_error = Api::UnwrapErrorHandle(thread->zone(), handle).ptr();
887 thread->UnwindScopes(thread->top_exit_frame_info());
888 // Note that thread's zone is different here than at the beginning of this
889 // function.
890 error = &Error::Handle(thread->zone(), raw_error);
891 }
892 Exceptions::PropagateError(*error);
893 UNREACHABLE();
894}
void UnwindScopes(uword stack_marker)
Definition thread.cc:1262
uword top_exit_frame_info() const
Definition thread.h:678

◆ Dart_RecordTimelineEvent()

DART_EXPORT void dart::Dart_RecordTimelineEvent ( const char *  label,
int64_t  timestamp0,
int64_t  timestamp1_or_id,
intptr_t  flow_id_count,
const int64_t *  flow_ids,
Dart_Timeline_Event_Type  type,
intptr_t  argument_count,
const char **  argument_names,
const char **  argument_values 
)

Definition at line 6281 of file dart_api_impl.cc.

6289 {
6290#if defined(SUPPORT_TIMELINE)
6292 return;
6293 }
6295 return;
6296 }
6297 if (!Dart::SetActiveApiCall()) {
6298 return;
6299 }
6300 TimelineStream* stream = Timeline::GetEmbedderStream();
6301 ASSERT(stream != nullptr);
6302 TimelineEvent* event = stream->StartEvent();
6303 if (event != nullptr) {
6304 switch (type) {
6306 event->Begin(label, timestamp1_or_id, timestamp0);
6307 break;
6309 event->End(label, timestamp1_or_id, timestamp0);
6310 break;
6312 event->Instant(label, timestamp0);
6313 break;
6315 event->Duration(label, timestamp0, timestamp1_or_id);
6316 break;
6318 event->AsyncBegin(label, timestamp1_or_id, timestamp0);
6319 break;
6321 event->AsyncEnd(label, timestamp1_or_id, timestamp0);
6322 break;
6324 event->AsyncInstant(label, timestamp1_or_id, timestamp0);
6325 break;
6327 event->Counter(label, timestamp0);
6328 break;
6330 event->FlowBegin(label, timestamp1_or_id, timestamp0);
6331 break;
6333 event->FlowStep(label, timestamp1_or_id, timestamp0);
6334 break;
6336 event->FlowEnd(label, timestamp1_or_id, timestamp0);
6337 break;
6338 default:
6339 FATAL("Unknown Dart_Timeline_Event_Type");
6340 }
6341 if (flow_id_count > 0 && flow_ids != nullptr) {
6342 std::unique_ptr<const int64_t[]> flow_ids_copy;
6343 int64_t* flow_ids_internal = new int64_t[flow_id_count];
6344 for (intptr_t i = 0; i < flow_id_count; ++i) {
6345 flow_ids_internal[i] = flow_ids[i];
6346 }
6347 flow_ids_copy = std::unique_ptr<const int64_t[]>(flow_ids_internal);
6348 event->SetFlowIds(flow_id_count, flow_ids_copy);
6349 }
6350 event->SetNumArguments(argument_count);
6351 for (intptr_t i = 0; i < argument_count; i++) {
6352 event->CopyArgument(i, argument_names[i], argument_values[i]);
6353 }
6354 event->Complete();
6355 }
6356 Dart::ResetActiveApiCall();
6357#endif
6358}
@ Dart_Timeline_Event_Async_Begin
@ Dart_Timeline_Event_Async_End
@ Dart_Timeline_Event_Begin
@ Dart_Timeline_Event_Counter
@ Dart_Timeline_Event_Flow_End
@ Dart_Timeline_Event_Duration
@ Dart_Timeline_Event_Flow_Begin
@ Dart_Timeline_Event_End
@ Dart_Timeline_Event_Instant
@ Dart_Timeline_Event_Async_Instant
@ Dart_Timeline_Event_Flow_Step
FlKeyEvent * event
int argument_count
Definition fuchsia.cc:52

◆ Dart_RegisterHeapSamplingCallback()

DART_EXPORT void dart::Dart_RegisterHeapSamplingCallback ( Dart_HeapSamplingCreateCallback  create_callback,
Dart_HeapSamplingDeleteCallback  delete_callback 
)

Definition at line 1810 of file dart_api_impl.cc.

1812 {
1813#if !defined(PRODUCT) || defined(FORCE_INCLUDE_SAMPLING_HEAP_PROFILER)
1814 HeapProfileSampler::SetSamplingCallback(create_callback, delete_callback);
1815#endif
1816}

◆ Dart_RegisterIsolateServiceRequestCallback()

DART_EXPORT void dart::Dart_RegisterIsolateServiceRequestCallback ( const char *  name,
Dart_ServiceRequestCallback  callback,
void *  user_data 
)

Definition at line 6121 of file dart_api_impl.cc.

6124 {
6125#if !defined(PRODUCT)
6126 Service::RegisterIsolateEmbedderCallback(name, callback, user_data);
6127#endif
6128}

◆ Dart_RegisterRootServiceRequestCallback()

DART_EXPORT void dart::Dart_RegisterRootServiceRequestCallback ( const char *  name,
Dart_ServiceRequestCallback  callback,
void *  user_data 
)

Definition at line 6130 of file dart_api_impl.cc.

6133 {
6134#if !defined(PRODUCT)
6135 Service::RegisterRootEmbedderCallback(name, callback, user_data);
6136#endif
6137}

◆ Dart_RemoveBreakpoint()

Dart_Handle dart::Dart_RemoveBreakpoint ( Dart_Handle  breakpoint_id)

Remove breakpoint with provided id.

Requires there to be a current isolate.

Definition at line 160 of file debugger_api_impl_test.cc.

160 {
161 DARTSCOPE(Thread::Current());
162 Isolate* I = T->isolate();
164 UNWRAP_AND_CHECK_PARAM(Integer, breakpoint_id, breakpoint_id_in);
165 I->debugger()->RemoveBreakpoint(breakpoint_id.AsInt64Value());
166 return Api::Success();
167}

◆ Dart_ReportSurvivingAllocations()

DART_EXPORT void dart::Dart_ReportSurvivingAllocations ( Dart_HeapSamplingReportCallback  callback,
void *  context,
bool  force_gc 
)

Definition at line 1818 of file dart_api_impl.cc.

1821 {
1822#if !defined(PRODUCT) || defined(FORCE_INCLUDE_SAMPLING_HEAP_PROFILER)
1823 CHECK_NO_ISOLATE(Thread::Current());
1824 IsolateGroup::ForEach([&](IsolateGroup* group) {
1825 Thread::EnterIsolateGroupAsHelper(group, Thread::kUnknownTask,
1826 /*bypass_safepoint=*/false);
1827 if (force_gc) {
1828 group->heap()->CollectAllGarbage(GCReason::kDebugging);
1829 }
1830 group->heap()->ReportSurvivingAllocations(callback, context);
1831 Thread::ExitIsolateGroupAsHelper(/*bypass_safepoint=*/false);
1832 });
1833#endif
1834}

◆ Dart_ReThrowException()

DART_EXPORT Dart_Handle dart::Dart_ReThrowException ( Dart_Handle  exception,
Dart_Handle  stacktrace 
)

Definition at line 4855 of file dart_api_impl.cc.

4856 {
4857 Thread* thread = Thread::Current();
4858 Zone* zone = thread->zone();
4859 Isolate* isolate = thread->isolate();
4860 CHECK_ISOLATE(isolate);
4861 CHECK_CALLBACK_STATE(thread);
4862 TransitionNativeToVM transition(thread);
4863 {
4864 const Instance& excp = Api::UnwrapInstanceHandle(zone, exception);
4865 if (excp.IsNull()) {
4866 RETURN_TYPE_ERROR(zone, exception, Instance);
4867 }
4868 const Instance& stk = Api::UnwrapInstanceHandle(zone, stacktrace);
4869 if (stk.IsNull()) {
4870 RETURN_TYPE_ERROR(zone, stacktrace, Instance);
4871 }
4872 }
4873 if (thread->top_exit_frame_info() == 0) {
4874 // There are no dart frames on the stack so it would be illegal to
4875 // throw an exception here.
4876 return Api::NewError("No Dart frames on stack, cannot throw exception");
4877 }
4878 // Unwind all the API scopes till the exit frame before throwing an
4879 // exception.
4880 const Instance* saved_exception;
4881 const StackTrace* saved_stacktrace;
4882 {
4883 NoSafepointScope no_safepoint;
4884 InstancePtr raw_exception =
4885 Api::UnwrapInstanceHandle(zone, exception).ptr();
4886 StackTracePtr raw_stacktrace =
4887 Api::UnwrapStackTraceHandle(zone, stacktrace).ptr();
4888 thread->UnwindScopes(thread->top_exit_frame_info());
4889 saved_exception = &Instance::Handle(raw_exception);
4890 saved_stacktrace = &StackTrace::Handle(raw_stacktrace);
4891 }
4892 Exceptions::ReThrow(thread, *saved_exception, *saved_stacktrace);
4893 return Api::NewError("Exception was not re thrown, internal error");
4894}

◆ Dart_RootLibrary()

DART_EXPORT Dart_Handle dart::Dart_RootLibrary ( void  )

Definition at line 5479 of file dart_api_impl.cc.

5479 {
5480 Thread* thread = Thread::Current();
5481 Isolate* isolate = thread->isolate();
5482 CHECK_ISOLATE(isolate);
5483 TransitionNativeToVM transition(thread);
5484 return Api::NewHandle(thread,
5485 isolate->group()->object_store()->root_library());
5486}

◆ Dart_RunLoop()

DART_EXPORT Dart_Handle dart::Dart_RunLoop ( void  )

Definition at line 1996 of file dart_api_impl.cc.

1996 {
1997 Isolate* I;
1998 bool result;
1999 {
2000 Thread* T = Thread::Current();
2001 I = T->isolate();
2004 }
2005 API_TIMELINE_BEGIN_END(Thread::Current());
2006 // The message handler run loop does not expect to have a current isolate
2007 // so we exit the isolate here and enter it again after the runloop is done.
2009 {
2010 Monitor monitor;
2011 MonitorLocker ml(&monitor);
2012 RunLoopData data;
2013 data.monitor = &monitor;
2014 data.done = false;
2015 result =
2016 I->message_handler()->Run(I->group()->thread_pool(), nullptr,
2017 RunLoopDone, reinterpret_cast<uword>(&data));
2018 if (result) {
2019 while (!data.done) {
2020 ml.Wait();
2021 }
2022 }
2023 }
2024 ::Dart_EnterIsolate(Api::CastIsolate(I));
2025 if (!result) {
2026 Thread* T = Thread::Current();
2027 TransitionNativeToVM transition(T);
2028 return Api::NewError("Run method in isolate message handler failed");
2029 } else if (I->sticky_error() != Object::null()) {
2030 Thread* T = Thread::Current();
2031 TransitionNativeToVM transition(T);
2032 return Api::NewHandle(T, I->StealStickyError());
2033 }
2034 if (FLAG_print_class_table) {
2035 HANDLESCOPE(Thread::Current());
2036 I->group()->class_table()->Print();
2037 }
2038 return Api::Success();
2039}
#define I

◆ Dart_RunLoopAsync()

DART_EXPORT bool dart::Dart_RunLoopAsync ( bool  errors_are_fatal,
Dart_Port  on_error_port,
Dart_Port  on_exit_port,
char **  error 
)

Definition at line 2041 of file dart_api_impl.cc.

2044 {
2045 auto thread = Thread::Current();
2046 auto isolate = thread->isolate();
2047 CHECK_ISOLATE(isolate);
2048 *error = nullptr;
2049
2050 if (thread->api_top_scope() != nullptr) {
2051 *error = Utils::StrDup("There must not be an active api scope.");
2052 return false;
2053 }
2054
2055 if (!isolate->is_runnable()) {
2056 const char* error_msg = isolate->MakeRunnable();
2057 if (error_msg != nullptr) {
2058 *error = Utils::StrDup(error_msg);
2059 return false;
2060 }
2061 }
2062
2063 isolate->SetErrorsFatal(errors_are_fatal);
2064
2065 if (on_error_port != ILLEGAL_PORT || on_exit_port != ILLEGAL_PORT) {
2066 auto thread = Thread::Current();
2067 TransitionNativeToVM transition(thread);
2068 StackZone zone(thread);
2069
2070 if (on_error_port != ILLEGAL_PORT) {
2071 const auto& port =
2072 SendPort::Handle(thread->zone(), SendPort::New(on_error_port));
2073 isolate->AddErrorListener(port);
2074 }
2075 if (on_exit_port != ILLEGAL_PORT) {
2076 const auto& port =
2077 SendPort::Handle(thread->zone(), SendPort::New(on_exit_port));
2078 isolate->AddExitListener(port, Instance::null_instance());
2079 }
2080 }
2081
2083 isolate->Run();
2084 return true;
2085}

◆ Dart_ScopeAllocate()

DART_EXPORT uint8_t * dart::Dart_ScopeAllocate ( intptr_t  size)

Definition at line 2199 of file dart_api_impl.cc.

2199 {
2200 Zone* zone;
2201 Thread* thread = Thread::Current();
2202 if (thread != nullptr) {
2203 ApiLocalScope* scope = thread->api_top_scope();
2204 zone = scope->zone();
2205 } else {
2206 ApiNativeScope* scope = ApiNativeScope::Current();
2207 if (scope == nullptr) return nullptr;
2208 zone = scope->zone();
2209 }
2210 return reinterpret_cast<uint8_t*>(zone->AllocUnsafe(size));
2211}

◆ Dart_SendPortGetId()

DART_EXPORT Dart_Handle dart::Dart_SendPortGetId ( Dart_Handle  port,
Dart_Port port_id 
)

Definition at line 2160 of file dart_api_impl.cc.

2161 {
2162 DARTSCOPE(Thread::Current());
2165 const SendPort& send_port = Api::UnwrapSendPortHandle(Z, port);
2166 if (send_port.IsNull()) {
2168 }
2169 if (port_id == nullptr) {
2170 RETURN_NULL_ERROR(port_id);
2171 }
2172 *port_id = send_port.Id();
2173 return Api::Success();
2174}
Dart_Port Id() const
Definition object.h:12464

◆ Dart_ServiceSendDataEvent()

DART_EXPORT char * dart::Dart_ServiceSendDataEvent ( const char *  stream_id,
const char *  event_kind,
const uint8_t *  bytes,
intptr_t  bytes_length 
)

Definition at line 6185 of file dart_api_impl.cc.

6188 {
6189#if !defined(PRODUCT)
6190 if (stream_id == nullptr) {
6191 return Utils::StrDup(
6192 "Dart_ServiceSendDataEvent expects argument 'stream_id' to be "
6193 "non-null.");
6194 }
6195 if (event_kind == nullptr) {
6196 return Utils::StrDup(
6197 "Dart_ServiceSendDataEvent expects argument 'event_kind' to be "
6198 "non-null.");
6199 }
6200 if (bytes == nullptr) {
6201 return Utils::StrDup(
6202 "Dart_ServiceSendDataEvent expects argument 'bytes' to be non-null.");
6203 }
6204 if (bytes_length < 0) {
6205 return Utils::StrDup(
6206 "Dart_ServiceSendDataEvent expects argument 'bytes_length' to be >= "
6207 "0.");
6208 }
6209 Service::SendEmbedderEvent(Isolate::Current(), // May be nullptr
6210 stream_id, event_kind, bytes, bytes_length);
6211#endif
6212 return nullptr;
6213}

◆ Dart_SetBooleanReturnValue()

DART_EXPORT void dart::Dart_SetBooleanReturnValue ( Dart_NativeArguments  args,
bool  retval 
)

Definition at line 5351 of file dart_api_impl.cc.

5352 {
5353 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args);
5354 TransitionNativeToVM transition(arguments->thread());
5355 ASSERT(arguments->thread()->isolate() == Isolate::Current());
5356 ASSERT_CALLBACK_STATE(arguments->thread());
5357 arguments->SetReturn(Bool::Get(retval));
5358}
void SetReturn(const Object &value) const
#define ASSERT_CALLBACK_STATE(thread)

◆ Dart_SetBreakpoint()

Dart_Handle dart::Dart_SetBreakpoint ( Dart_Handle  script_url,
intptr_t  line_number 
)

Sets a breakpoint at line \line_number in \script_url, or the closest following line (within the same function) where a breakpoint can be set.

Requires there to be a current isolate.

Returns
A handle containing the breakpoint id, which is an integer value, or an error object if a breakpoint could not be set.

Definition at line 140 of file debugger_api_impl_test.cc.

141 {
142 Breakpoint* bpt;
143 {
144 DARTSCOPE(Thread::Current());
145 Isolate* I = T->isolate();
147 UNWRAP_AND_CHECK_PARAM(String, script_url, script_url_in);
148
149 Debugger* debugger = I->debugger();
150 bpt = debugger->SetBreakpointAtLineCol(script_url, line_number, -1);
151 if (bpt == nullptr) {
152 return Api::NewError("%s: could not set breakpoint at line %" Pd
153 " in '%s'",
154 CURRENT_FUNC, line_number, script_url.ToCString());
155 }
156 }
157 return Dart_NewInteger(bpt->id());
158}
intptr_t id() const
Definition debugger.h:60

◆ Dart_SetCurrentUserTag()

DART_EXPORT Dart_Handle dart::Dart_SetCurrentUserTag ( Dart_Handle  user_tag)

Definition at line 6932 of file dart_api_impl.cc.

6932 {
6933 Thread* thread = Thread::Current();
6934 CHECK_ISOLATE(thread->isolate());
6935 DARTSCOPE(thread);
6936 const UserTag& tag = Api::UnwrapUserTagHandle(Z, user_tag);
6937 if (tag.IsNull()) {
6938 RETURN_TYPE_ERROR(Z, user_tag, UserTag);
6939 }
6940 return Api::NewHandle(thread, tag.MakeActive());
6941}
UserTagPtr MakeActive() const
Definition object.cc:27007

◆ Dart_SetDartLibrarySourcesKernel()

DART_EXPORT void dart::Dart_SetDartLibrarySourcesKernel ( const uint8_t *  platform_kernel,
const intptr_t  platform_kernel_size 
)

Definition at line 6095 of file dart_api_impl.cc.

6097 {
6098#if !defined(PRODUCT)
6099 Service::SetDartLibraryKernelForSources(platform_kernel,
6100 platform_kernel_size);
6101#endif
6102}

◆ Dart_SetDeferredLoadHandler()

DART_EXPORT Dart_Handle dart::Dart_SetDeferredLoadHandler ( Dart_DeferredLoadHandler  handler)

Definition at line 5417 of file dart_api_impl.cc.

5417 {
5418 Isolate* isolate = Isolate::Current();
5419 CHECK_ISOLATE(isolate);
5420 isolate->group()->set_deferred_load_handler(handler);
5421 return Api::Success();
5422}
void set_deferred_load_handler(Dart_DeferredLoadHandler handler)
Definition isolate.h:559

◆ Dart_SetDoubleReturnValue()

DART_EXPORT void dart::Dart_SetDoubleReturnValue ( Dart_NativeArguments  args,
double  retval 
)

Definition at line 5374 of file dart_api_impl.cc.

5375 {
5376 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args);
5377 ASSERT(arguments->thread()->isolate() == Isolate::Current());
5378 ASSERT_CALLBACK_STATE(arguments->thread());
5379 TransitionNativeToVM transition(arguments->thread());
5380 Api::SetDoubleReturnValue(arguments, retval);
5381}

◆ Dart_SetDwarfStackTraceFootnoteCallback()

DART_EXPORT void dart::Dart_SetDwarfStackTraceFootnoteCallback ( Dart_DwarfStackTraceFootnoteCallback  callback)

Definition at line 6215 of file dart_api_impl.cc.

6216 {
6217 Dart::set_dwarf_stacktrace_footnote_callback(callback);
6218}

◆ Dart_SetEmbedderInformationCallback()

DART_EXPORT void dart::Dart_SetEmbedderInformationCallback ( Dart_EmbedderInformationCallback  callback)

Definition at line 6139 of file dart_api_impl.cc.

6140 {
6141#if !defined(PRODUCT)
6142 Service::SetEmbedderInformationCallback(callback);
6143#endif
6144}

◆ Dart_SetEnabledTimelineCategory()

DART_EXPORT bool dart::Dart_SetEnabledTimelineCategory ( const char *  categories)

Definition at line 6255 of file dart_api_impl.cc.

6255 {
6256#if defined(SUPPORT_TIMELINE)
6257 bool result = false;
6258 if (categories != nullptr) {
6259 char* carray = Utils::SCreate("[%s]", categories);
6260 result = Service::EnableTimelineStreams(carray);
6261 free(carray);
6262 }
6263 return result;
6264#else
6265 return false;
6266#endif
6267}

◆ Dart_SetEnvironmentCallback()

DART_EXPORT Dart_Handle dart::Dart_SetEnvironmentCallback ( Dart_EnvironmentCallback  callback)

Definition at line 5343 of file dart_api_impl.cc.

5343 {
5344 Isolate* isolate = Isolate::Current();
5345 CHECK_ISOLATE(isolate);
5347 return Api::Success();
5348}
void set_environment_callback(Dart_EnvironmentCallback value)
Definition isolate.h:1031

◆ Dart_SetFfiNativeResolver()

DART_EXPORT Dart_Handle dart::Dart_SetFfiNativeResolver ( Dart_Handle  library,
Dart_FfiNativeResolver  resolver 
)

Definition at line 5965 of file dart_api_impl.cc.

5966 {
5967 DARTSCOPE(Thread::Current());
5968 const Library& lib = Api::UnwrapLibraryHandle(Z, library);
5969 if (lib.IsNull()) {
5970 RETURN_TYPE_ERROR(Z, library, Library);
5971 }
5972 lib.set_ffi_native_resolver(resolver);
5973 return Api::Success();
5974}
void set_ffi_native_resolver(Dart_FfiNativeResolver value) const
Definition object.h:5225

◆ Dart_SetField()

DART_EXPORT Dart_Handle dart::Dart_SetField ( Dart_Handle  container,
Dart_Handle  name,
Dart_Handle  value 
)

Definition at line 4741 of file dart_api_impl.cc.

4743 {
4744 DARTSCOPE(Thread::Current());
4747
4748 String& field_name =
4749 String::Handle(Z, Api::UnwrapStringHandle(Z, name).ptr());
4750 if (field_name.IsNull()) {
4752 }
4753
4754 // Since null is allowed for value, we don't use UnwrapInstanceHandle.
4755 const Object& value_obj = Object::Handle(Z, Api::UnwrapHandle(value));
4756 if (!value_obj.IsNull() && !value_obj.IsInstance()) {
4757 RETURN_TYPE_ERROR(Z, value, Instance);
4758 }
4759 Instance& value_instance = Instance::Handle(Z);
4760 value_instance ^= value_obj.ptr();
4761
4762 const Object& obj = Object::Handle(Z, Api::UnwrapHandle(container));
4763 const bool respect_reflectable = false;
4764 const bool check_is_entrypoint = FLAG_verify_entry_points;
4765
4766 if (obj.IsType()) {
4767 if (!Type::Cast(obj).IsFinalized()) {
4768 return Api::NewError(
4769 "%s expects argument 'container' to be a fully resolved type.",
4770 CURRENT_FUNC);
4771 }
4772
4773 // To access a static field we may need to use the Field or the
4774 // setter Function.
4775 Class& cls = Class::Handle(Z, Type::Cast(obj).type_class());
4776 if (Library::IsPrivate(field_name)) {
4777 const Library& lib = Library::Handle(Z, cls.library());
4778 field_name = lib.PrivateName(field_name);
4779 }
4780 return Api::NewHandle(
4781 T, cls.InvokeSetter(field_name, value_instance, respect_reflectable,
4782 check_is_entrypoint));
4783 } else if (obj.IsNull() || obj.IsInstance()) {
4784 Instance& instance = Instance::Handle(Z);
4785 instance ^= obj.ptr();
4786 if (Library::IsPrivate(field_name)) {
4787 const Class& cls = Class::Handle(Z, instance.clazz());
4788 const Library& lib = Library::Handle(Z, cls.library());
4789 field_name = lib.PrivateName(field_name);
4790 }
4791 return Api::NewHandle(
4792 T, instance.InvokeSetter(field_name, value_instance,
4793 respect_reflectable, check_is_entrypoint));
4794 } else if (obj.IsLibrary()) {
4795 // To access a top-level we may need to use the Field or the
4796 // setter Function. The setter function may either be in the
4797 // library or in the field's owner class, depending.
4798 const Library& lib = Library::Cast(obj);
4799 // Check that the library is loaded.
4800 if (!lib.Loaded()) {
4801 return Api::NewError(
4802 "%s expects library argument 'container' to be loaded.",
4803 CURRENT_FUNC);
4804 }
4805
4806 if (Library::IsPrivate(field_name)) {
4807 field_name = lib.PrivateName(field_name);
4808 }
4809 return Api::NewHandle(
4810 T, lib.InvokeSetter(field_name, value_instance, respect_reflectable,
4811 check_is_entrypoint));
4812 } else if (obj.IsError()) {
4813 return container;
4814 }
4815 return Api::NewError(
4816 "%s expects argument 'container' to be an object, type, or library.",
4817 CURRENT_FUNC);
4818}

◆ Dart_SetFileModifiedCallback()

DART_EXPORT char * dart::Dart_SetFileModifiedCallback ( Dart_FileModifiedCallback  file_modified_callback)

Definition at line 6220 of file dart_api_impl.cc.

6221 {
6222#if !defined(PRODUCT)
6223#if !defined(DART_PRECOMPILED_RUNTIME)
6224 if (file_modified_callback != nullptr) {
6225 if (IsolateGroupReloadContext::file_modified_callback() != nullptr) {
6226 return Utils::StrDup(
6227 "Dart_SetFileModifiedCallback permits only one callback to be"
6228 " registered, please remove the existing callback and then add"
6229 " this callback");
6230 }
6231 } else {
6232 if (IsolateGroupReloadContext::file_modified_callback() == nullptr) {
6233 return Utils::StrDup(
6234 "Dart_SetFileModifiedCallback expects 'file_modified_callback' to"
6235 " be set before it is cleared.");
6236 }
6237 }
6238 IsolateGroupReloadContext::SetFileModifiedCallback(file_modified_callback);
6239#endif // !defined(DART_PRECOMPILED_RUNTIME)
6240#endif // !defined(PRODUCT)
6241 return nullptr;
6242}

◆ Dart_SetHeapSamplingPeriod()

DART_EXPORT void dart::Dart_SetHeapSamplingPeriod ( intptr_t  bytes)

Definition at line 1836 of file dart_api_impl.cc.

1836 {
1837#if !defined(PRODUCT) || defined(FORCE_INCLUDE_SAMPLING_HEAP_PROFILER)
1838 HeapProfileSampler::SetSamplingInterval(bytes);
1839#endif
1840}

◆ Dart_SetIntegerReturnValue()

DART_EXPORT void dart::Dart_SetIntegerReturnValue ( Dart_NativeArguments  args,
int64_t  retval 
)

Definition at line 5360 of file dart_api_impl.cc.

5361 {
5362 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args);
5363 TransitionNativeToVM transition(arguments->thread());
5364 ASSERT(arguments->thread()->isolate() == Isolate::Current());
5365 ASSERT_CALLBACK_STATE(arguments->thread());
5366 if (Smi::IsValid(retval)) {
5367 Api::SetSmiReturnValue(arguments, static_cast<intptr_t>(retval));
5368 } else {
5369 // Slow path for Mints.
5370 Api::SetIntegerReturnValue(arguments, retval);
5371 }
5372}

◆ Dart_SetLibraryDebuggable()

Dart_Handle dart::Dart_SetLibraryDebuggable ( intptr_t  library_id,
bool  is_debuggable 
)

Requests that debugging be enabled for the given library.

Requires there to be a current isolate.

Returns
A handle to the True object if no error occurs.

Definition at line 249 of file debugger_api_impl_test.cc.

249 {
250 DARTSCOPE(Thread::Current());
251 const Library& lib = Library::Handle(Z, Library::GetLibrary(library_id));
252 if (lib.IsNull()) {
253 return Api::NewError("%s: %" Pd " is not a valid library id", CURRENT_FUNC,
254 library_id);
255 }
256 lib.set_debuggable(is_debuggable);
257 return Api::Success();
258}
void set_debuggable(bool value) const
Definition object.h:5255

◆ Dart_SetLibraryTagHandler()

DART_EXPORT Dart_Handle dart::Dart_SetLibraryTagHandler ( Dart_LibraryTagHandler  handler)

Definition at line 5386 of file dart_api_impl.cc.

5386 {
5387 Isolate* isolate = Isolate::Current();
5388 CHECK_ISOLATE(isolate);
5389 isolate->group()->set_library_tag_handler(handler);
5390 return Api::Success();
5391}
void set_library_tag_handler(Dart_LibraryTagHandler handler)
Definition isolate.h:553

◆ Dart_SetMessageNotifyCallback()

DART_EXPORT void dart::Dart_SetMessageNotifyCallback ( Dart_MessageNotifyCallback  message_notify_callback)

Definition at line 1953 of file dart_api_impl.cc.

1954 {
1955 Isolate* isolate = Isolate::Current();
1956 CHECK_ISOLATE(isolate);
1957
1958 {
1959 NoSafepointScope no_safepoint_scope;
1960 isolate->set_message_notify_callback(message_notify_callback);
1961 }
1962
1963 if (message_notify_callback != nullptr && isolate->HasPendingMessages()) {
1965
1966 // If a new handler gets installed and there are pending messages in the
1967 // queue (e.g. OOB messages for doing vm service work) we need to notify
1968 // the newly registered callback, otherwise the embedder might never get
1969 // notified about the pending messages.
1970 message_notify_callback(Api::CastIsolate(isolate));
1971
1972 ::Dart_EnterIsolate(Api::CastIsolate(isolate));
1973 }
1974}
bool HasPendingMessages()
Definition isolate.cc:1320
void set_message_notify_callback(Dart_MessageNotifyCallback value)
Definition isolate.h:968

◆ Dart_SetNativeInstanceField()

DART_EXPORT Dart_Handle dart::Dart_SetNativeInstanceField ( Dart_Handle  obj,
int  index,
intptr_t  value 
)

Definition at line 4943 of file dart_api_impl.cc.

4945 {
4946 DARTSCOPE(Thread::Current());
4947 const Instance& instance = Api::UnwrapInstanceHandle(Z, obj);
4948 if (instance.IsNull()) {
4950 }
4951 if (!instance.IsValidNativeIndex(index)) {
4952 return Api::NewError(
4953 "%s: invalid index %d passed into set native instance field",
4954 CURRENT_FUNC, index);
4955 }
4956 instance.SetNativeField(index, value);
4957 return Api::Success();
4958}

◆ Dart_SetNativeResolver()

DART_EXPORT Dart_Handle dart::Dart_SetNativeResolver ( Dart_Handle  library,
Dart_NativeEntryResolver  resolver,
Dart_NativeEntrySymbol  symbol 
)

Definition at line 5920 of file dart_api_impl.cc.

5922 {
5923 DARTSCOPE(Thread::Current());
5924 const Library& lib = Api::UnwrapLibraryHandle(Z, library);
5925 if (lib.IsNull()) {
5926 RETURN_TYPE_ERROR(Z, library, Library);
5927 }
5928 lib.set_native_entry_resolver(resolver);
5930 return Api::Success();
5931}
void set_native_entry_symbol_resolver(Dart_NativeEntrySymbol native_symbol_resolver) const
Definition object.h:5213
void set_native_entry_resolver(Dart_NativeEntryResolver value) const
Definition object.h:5204

◆ Dart_SetPausedOnExit()

DART_EXPORT void dart::Dart_SetPausedOnExit ( bool  paused)

Definition at line 1726 of file dart_api_impl.cc.

1726 {
1727#if defined(PRODUCT)
1728 if (paused) {
1729 FATAL("%s(true) is not supported in a PRODUCT build", CURRENT_FUNC);
1730 }
1731#else
1732 Isolate* isolate = Isolate::Current();
1733 CHECK_ISOLATE(isolate);
1734 NoSafepointScope no_safepoint_scope;
1735 if (isolate->message_handler()->is_paused_on_exit() != paused) {
1736 isolate->message_handler()->PausedOnExit(paused);
1737 }
1738#endif
1739}

◆ Dart_SetPausedOnStart()

DART_EXPORT void dart::Dart_SetPausedOnStart ( bool  paused)

Definition at line 1676 of file dart_api_impl.cc.

1676 {
1677#if defined(PRODUCT)
1678 if (paused) {
1679 FATAL("%s(true) is not supported in a PRODUCT build", CURRENT_FUNC);
1680 }
1681#else
1682 Isolate* isolate = Isolate::Current();
1683 CHECK_ISOLATE(isolate);
1684 NoSafepointScope no_safepoint_scope;
1685 if (isolate->message_handler()->is_paused_on_start() != paused) {
1686 isolate->message_handler()->PausedOnStart(paused);
1687 }
1688#endif
1689}

◆ Dart_SetPeer()

DART_EXPORT Dart_Handle dart::Dart_SetPeer ( Dart_Handle  object,
void *  peer 
)

Definition at line 6001 of file dart_api_impl.cc.

6001 {
6002 Thread* thread = Thread::Current();
6003 CHECK_ISOLATE(thread->isolate());
6004 TransitionNativeToVM transition(thread);
6006 Object& obj = thread->ObjectHandle();
6007 obj = Api::UnwrapHandle(object);
6008 if (obj.IsNull() || obj.IsNumber() || obj.IsBool()) {
6009 const char* msg =
6010 "%s: argument 'object' cannot be a subtype of Null, num, or bool";
6011 return Api::NewError(msg, CURRENT_FUNC);
6012 }
6013 {
6014 NoSafepointScope no_safepoint;
6015 ObjectPtr raw_obj = obj.ptr();
6016 thread->heap()->SetPeer(raw_obj, peer);
6017 }
6018 return Api::Success();
6019}
void SetPeer(ObjectPtr raw_obj, void *peer)
Definition heap.h:164
Heap * heap() const
Definition thread.cc:876

◆ Dart_SetPerformanceMode()

DART_EXPORT Dart_PerformanceMode dart::Dart_SetPerformanceMode ( Dart_PerformanceMode  mode)

Definition at line 1857 of file dart_api_impl.cc.

1857 {
1858 Thread* T = Thread::Current();
1859 CHECK_ISOLATE(T->isolate());
1860 TransitionNativeToVM transition(T);
1861 return T->heap()->SetMode(mode);
1862}

◆ Dart_SetPersistentHandle()

DART_EXPORT void dart::Dart_SetPersistentHandle ( Dart_PersistentHandle  obj1,
Dart_Handle  obj2 
)

Definition at line 982 of file dart_api_impl.cc.

983 {
984 DARTSCOPE(Thread::Current());
985 Isolate* I = T->isolate();
986 ApiState* state = I->group()->api_state();
987 ASSERT(state != nullptr);
988 ASSERT(state->IsValidPersistentHandle(obj1));
989 const Object& obj2_ref = Object::Handle(Z, Api::UnwrapHandle(obj2));
990 PersistentHandle* obj1_ref = PersistentHandle::Cast(obj1);
991 obj1_ref->set_ptr(obj2_ref);
992}

◆ Dart_SetReturnValue()

DART_EXPORT void dart::Dart_SetReturnValue ( Dart_NativeArguments  args,
Dart_Handle  retval 
)

Definition at line 5221 of file dart_api_impl.cc.

5222 {
5223 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args);
5224 ASSERT(arguments->thread()->isolate() == Isolate::Current());
5225 ASSERT_CALLBACK_STATE(arguments->thread());
5226 TransitionNativeToVM transition(arguments->thread());
5227 if ((retval != Api::Null()) && !Api::IsInstance(retval) &&
5228 !Api::IsError(retval)) {
5229 // Print the current stack trace to make the problematic caller
5230 // easier to find.
5231 const StackTrace& stacktrace = GetCurrentStackTrace(0);
5232 OS::PrintErr("=== Current Trace:\n%s===\n", stacktrace.ToCString());
5233
5234 const Object& ret_obj = Object::Handle(Api::UnwrapHandle(retval));
5235 FATAL(
5236 "Return value check failed: saw '%s' expected a dart Instance or "
5237 "an Error.",
5238 ret_obj.ToCString());
5239 }
5240 ASSERT(retval != nullptr);
5241 Api::SetReturnValue(arguments, retval);
5242}

◆ Dart_SetRootLibrary()

DART_EXPORT Dart_Handle dart::Dart_SetRootLibrary ( Dart_Handle  library)

Definition at line 5488 of file dart_api_impl.cc.

5488 {
5489 DARTSCOPE(Thread::Current());
5490 const Object& obj = Object::Handle(Z, Api::UnwrapHandle(library));
5491 if (obj.IsNull() || obj.IsLibrary()) {
5492 Library& lib = Library::Handle(Z);
5493 lib ^= obj.ptr();
5494 T->isolate_group()->object_store()->set_root_library(lib);
5495 return library;
5496 }
5497 RETURN_TYPE_ERROR(Z, library, Library);
5498}

◆ Dart_SetServiceStreamCallbacks()

DART_EXPORT char * dart::Dart_SetServiceStreamCallbacks ( Dart_ServiceStreamListenCallback  listen_callback,
Dart_ServiceStreamCancelCallback  cancel_callback 
)

Definition at line 6146 of file dart_api_impl.cc.

6148 {
6149#if defined(PRODUCT)
6150 return nullptr;
6151#else
6152 if (listen_callback != nullptr) {
6153 if (Service::stream_listen_callback() != nullptr) {
6154 return Utils::StrDup(
6155 "Dart_SetServiceStreamCallbacks "
6156 "permits only one listen callback to be registered, please "
6157 "remove the existing callback and then add this callback");
6158 }
6159 } else {
6160 if (Service::stream_listen_callback() == nullptr) {
6161 return Utils::StrDup(
6162 "Dart_SetServiceStreamCallbacks "
6163 "expects 'listen_callback' to be present in the callback set.");
6164 }
6165 }
6166 if (cancel_callback != nullptr) {
6167 if (Service::stream_cancel_callback() != nullptr) {
6168 return Utils::StrDup(
6169 "Dart_SetServiceStreamCallbacks "
6170 "permits only one cancel callback to be registered, please "
6171 "remove the existing callback and then add this callback");
6172 }
6173 } else {
6174 if (Service::stream_cancel_callback() == nullptr) {
6175 return Utils::StrDup(
6176 "Dart_SetServiceStreamCallbacks "
6177 "expects 'cancel_callback' to be present in the callback set.");
6178 }
6179 }
6180 Service::SetEmbedderStreamCallbacks(listen_callback, cancel_callback);
6181 return nullptr;
6182#endif
6183}

◆ Dart_SetShouldPauseOnExit()

DART_EXPORT void dart::Dart_SetShouldPauseOnExit ( bool  should_pause)

Definition at line 1702 of file dart_api_impl.cc.

1702 {
1703#if defined(PRODUCT)
1704 if (should_pause) {
1705 FATAL("%s(true) is not supported in a PRODUCT build", CURRENT_FUNC);
1706 }
1707#else
1708 Isolate* isolate = Isolate::Current();
1709 CHECK_ISOLATE(isolate);
1710 NoSafepointScope no_safepoint_scope;
1711 isolate->message_handler()->set_should_pause_on_exit(should_pause);
1712#endif
1713}

◆ Dart_SetShouldPauseOnStart()

DART_EXPORT void dart::Dart_SetShouldPauseOnStart ( bool  should_pause)

Definition at line 1648 of file dart_api_impl.cc.

1648 {
1649#if defined(PRODUCT)
1650 if (should_pause) {
1651 FATAL("%s(true) is not supported in a PRODUCT build", CURRENT_FUNC);
1652 }
1653#else
1654 Isolate* isolate = Isolate::Current();
1655 CHECK_ISOLATE(isolate);
1656 NoSafepointScope no_safepoint_scope;
1657 if (isolate->is_runnable()) {
1658 FATAL("%s expects the current isolate to not be runnable yet.",
1659 CURRENT_FUNC);
1660 }
1661 isolate->message_handler()->set_should_pause_on_start(should_pause);
1662#endif
1663}

◆ Dart_SetStickyError()

DART_EXPORT void dart::Dart_SetStickyError ( Dart_Handle  error)

Definition at line 1741 of file dart_api_impl.cc.

1741 {
1742 Thread* thread = Thread::Current();
1743 DARTSCOPE(thread);
1744 Isolate* isolate = thread->isolate();
1745 CHECK_ISOLATE(isolate);
1746 NoSafepointScope no_safepoint_scope;
1747 const Error& error_handle = Api::UnwrapErrorHandle(Z, error);
1748 if ((isolate->sticky_error() != Error::null()) &&
1749 (error_handle.ptr() != Object::null())) {
1750 FATAL("%s expects there to be no sticky error.", CURRENT_FUNC);
1751 }
1752 if (!error_handle.IsUnhandledException() &&
1753 (error_handle.ptr() != Object::null())) {
1754 FATAL("%s expects the error to be an unhandled exception error or null.",
1755 CURRENT_FUNC);
1756 }
1757 isolate->SetStickyError(error_handle.ptr());
1758}
void SetStickyError(ErrorPtr sticky_error)
Definition isolate.cc:2368

◆ Dart_SetThreadName()

DART_EXPORT void dart::Dart_SetThreadName ( const char *  name)

Definition at line 6367 of file dart_api_impl.cc.

6367 {
6368 OSThread* thread = OSThread::Current();
6369 if (thread == nullptr) {
6370 // VM is shutting down.
6371 return;
6372 }
6373 thread->SetName(name);
6374}
void SetName(const char *name)
Definition os_thread.cc:115

◆ Dart_SetTimelineRecorderCallback()

DART_EXPORT void dart::Dart_SetTimelineRecorderCallback ( Dart_TimelineRecorderCallback  callback)

Definition at line 6360 of file dart_api_impl.cc.

6361 {
6362#if defined(SUPPORT_TIMELINE)
6363 Timeline::set_callback(callback);
6364#endif
6365}

◆ Dart_SetVMFlags()

DART_EXPORT char * dart::Dart_SetVMFlags ( int  argc,
const char **  argv 
)

Definition at line 1186 of file dart_api_impl.cc.

1186 {
1187 return Flags::ProcessCommandLineFlags(argc, argv);
1188}

◆ Dart_SetWeakHandleReturnValue()

DART_EXPORT void dart::Dart_SetWeakHandleReturnValue ( Dart_NativeArguments  args,
Dart_WeakPersistentHandle  rval 
)

Definition at line 5244 of file dart_api_impl.cc.

5245 {
5246 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args);
5247 TransitionNativeToVM transition(arguments->thread());
5248#if defined(DEBUG)
5249 Isolate* isolate = arguments->thread()->isolate();
5250 ASSERT(isolate == Isolate::Current());
5251 ASSERT(isolate->group()->api_state() != nullptr &&
5252 (isolate->group()->api_state()->IsValidWeakPersistentHandle(rval)));
5253#endif
5254 Api::SetWeakHandleReturnValue(arguments, rval);
5255}
bool IsValidWeakPersistentHandle(Dart_WeakPersistentHandle object)

◆ Dart_ShouldPauseOnExit()

DART_EXPORT bool dart::Dart_ShouldPauseOnExit ( void  )

Definition at line 1691 of file dart_api_impl.cc.

1691 {
1692#if defined(PRODUCT)
1693 return false;
1694#else
1695 Isolate* isolate = Isolate::Current();
1696 CHECK_ISOLATE(isolate);
1697 NoSafepointScope no_safepoint_scope;
1698 return isolate->message_handler()->should_pause_on_exit();
1699#endif
1700}
bool should_pause_on_exit() const

◆ Dart_ShouldPauseOnStart()

DART_EXPORT bool dart::Dart_ShouldPauseOnStart ( void  )

Definition at line 1637 of file dart_api_impl.cc.

1637 {
1638#if defined(PRODUCT)
1639 return false;
1640#else
1641 Isolate* isolate = Isolate::Current();
1642 CHECK_ISOLATE(isolate);
1643 NoSafepointScope no_safepoint_scope;
1644 return isolate->message_handler()->should_pause_on_start();
1645#endif
1646}
bool should_pause_on_start() const

◆ Dart_ShutdownIsolate()

DART_EXPORT void dart::Dart_ShutdownIsolate ( void  )

Definition at line 1423 of file dart_api_impl.cc.

1423 {
1424 Thread* T = Thread::Current();
1425 auto I = T->isolate();
1427
1428 // The Thread structure is disassociated from the isolate, we do the
1429 // safepoint transition explicitly here instead of using the TransitionXXX
1430 // scope objects as the original transition happened outside this scope in
1431 // Dart_EnterIsolate/Dart_CreateIsolateGroup.
1432 ASSERT(T->execution_state() == Thread::kThreadInNative);
1433 T->ExitSafepoint();
1434 T->set_execution_state(Thread::kThreadInVM);
1435
1436 I->WaitForOutstandingSpawns();
1437
1438 // Release any remaining API scopes.
1439 ApiLocalScope* scope = T->api_top_scope();
1440 while (scope != nullptr) {
1441 ApiLocalScope* previous = scope->previous();
1442 delete scope;
1443 scope = previous;
1444 }
1445 T->set_api_top_scope(nullptr);
1446
1447 {
1448 StackZone zone(T);
1449 HandleScope handle_scope(T);
1450 Dart::RunShutdownCallback();
1451 }
1452 Dart::ShutdownIsolate(T);
1453}
ApiLocalScope * previous() const

◆ Dart_SortClasses()

DART_EXPORT Dart_Handle dart::Dart_SortClasses ( void  )

Definition at line 6376 of file dart_api_impl.cc.

6376 {
6377#if defined(DART_PRECOMPILED_RUNTIME)
6378 return Api::NewError("%s: Cannot compile on an AOT runtime.", CURRENT_FUNC);
6379#else
6380 DARTSCOPE(Thread::Current());
6381
6382 // Prevent background compiler from running while code is being cleared and
6383 // adding new code.
6384 NoBackgroundCompilerScope no_bg_compiler(T);
6385
6386 // We don't have mechanisms to change class-ids that are embedded in code and
6387 // ICData.
6388 ClassFinalizer::ClearAllCode();
6389 // Make sure that ICData etc. that have been cleared are also removed from
6390 // the heap so that they are not found by the heap verifier.
6391 IsolateGroup::Current()->heap()->CollectAllGarbage();
6392 ClassFinalizer::SortClasses();
6393 return Api::Success();
6394#endif // defined(DART_PRECOMPILED_RUNTIME)
6395}

◆ Dart_StackTraceLength()

Dart_Handle dart::Dart_StackTraceLength ( Dart_StackTrace  trace,
intptr_t *  length 
)

Returns in \length the number of activation frames in the given stack trace.

Requires there to be a current isolate.

Returns
A handle to the True object if no error occurs.

Definition at line 62 of file debugger_api_impl_test.cc.

62 {
63 DARTSCOPE(Thread::Current());
65 CHECK_AND_CAST(DebuggerStackTrace, stack_trace, trace);
66 *length = stack_trace->Length();
67 return Api::Success();
68}

◆ Dart_StartProfiling()

DART_EXPORT void dart::Dart_StartProfiling ( void  )

Definition at line 1555 of file dart_api_impl.cc.

1555 {
1556#if !defined(PRODUCT)
1557 if (!FLAG_profiler) {
1558 FLAG_profiler = true;
1559 Profiler::Init();
1560 }
1561#endif // !defined(PRODUCT)
1562}

◆ Dart_StopProfiling()

DART_EXPORT void dart::Dart_StopProfiling ( void  )

Definition at line 1564 of file dart_api_impl.cc.

1564 {
1565#if !defined(PRODUCT)
1566 if (FLAG_profiler) {
1567 Profiler::Cleanup();
1568 FLAG_profiler = false;
1569 }
1570#endif // !defined(PRODUCT)
1571}

◆ Dart_StringGetProperties()

DART_EXPORT Dart_Handle dart::Dart_StringGetProperties ( Dart_Handle  object,
intptr_t *  char_size,
intptr_t *  str_len,
void **  peer 
)

Definition at line 3027 of file dart_api_impl.cc.

3030 {
3031 Thread* thread = Thread::Current();
3032 CHECK_ISOLATE(thread->isolate());
3033 TransitionNativeToVM transition(thread);
3034 {
3035 ReusableObjectHandleScope reused_obj_handle(thread);
3036 const String& str = Api::UnwrapStringHandle(reused_obj_handle, object);
3037 if (!str.IsNull()) {
3038 NoSafepointScope no_safepoint_scope;
3039 *peer = thread->heap()->GetPeer(str.ptr());
3040 *char_size = str.CharSize();
3041 *str_len = str.Length();
3042 return Api::Success();
3043 }
3044 }
3045 RETURN_TYPE_ERROR(thread->zone(), object, String);
3046}
void * GetPeer(ObjectPtr raw_obj) const
Definition heap.h:167
intptr_t Length() const
Definition object.h:10189
intptr_t CharSize() const
Definition object.cc:23601

◆ Dart_StringLength()

DART_EXPORT Dart_Handle dart::Dart_StringLength ( Dart_Handle  str,
intptr_t *  len 
)

Definition at line 2816 of file dart_api_impl.cc.

2816 {
2817 Thread* thread = Thread::Current();
2818 DARTSCOPE(thread);
2819 {
2820 ReusableObjectHandleScope reused_obj_handle(thread);
2821 const String& str_obj = Api::UnwrapStringHandle(reused_obj_handle, str);
2822 if (!str_obj.IsNull()) {
2823 *len = str_obj.Length();
2824 return Api::Success();
2825 }
2826 }
2827 RETURN_TYPE_ERROR(thread->zone(), str, String);
2828}

◆ Dart_StringStorageSize()

DART_EXPORT Dart_Handle dart::Dart_StringStorageSize ( Dart_Handle  str,
intptr_t *  size 
)

Definition at line 3008 of file dart_api_impl.cc.

3009 {
3010 Thread* thread = Thread::Current();
3011 CHECK_ISOLATE(thread->isolate());
3012 TransitionNativeToVM transition(thread);
3013 if (size == nullptr) {
3014 RETURN_NULL_ERROR(size);
3015 }
3016 {
3017 ReusableObjectHandleScope reused_obj_handle(thread);
3018 const String& str_obj = Api::UnwrapStringHandle(reused_obj_handle, str);
3019 if (!str_obj.IsNull()) {
3020 *size = (str_obj.Length() * str_obj.CharSize());
3021 return Api::Success();
3022 }
3023 }
3024 RETURN_TYPE_ERROR(thread->zone(), str, String);
3025}

◆ Dart_StringToCString()

DART_EXPORT Dart_Handle dart::Dart_StringToCString ( Dart_Handle  object,
const char **  cstr 
)

Definition at line 2893 of file dart_api_impl.cc.

2894 {
2895 DARTSCOPE(Thread::Current());
2897 if (cstr == nullptr) {
2898 RETURN_NULL_ERROR(cstr);
2899 }
2900 const String& str_obj = Api::UnwrapStringHandle(Z, object);
2901 if (str_obj.IsNull()) {
2902 RETURN_TYPE_ERROR(Z, object, String);
2903 }
2904 intptr_t string_length = Utf8::Length(str_obj);
2905 char* res = Api::TopScope(T)->zone()->Alloc<char>(string_length + 1);
2906 if (res == nullptr) {
2907 return Api::NewError("Unable to allocate memory");
2908 }
2909 const char* string_value = str_obj.ToCString();
2910 memmove(res, string_value, string_length + 1);
2911 ASSERT(res[string_length] == '\0');
2912 *cstr = res;
2913 return Api::Success();
2914}

◆ Dart_StringToLatin1()

DART_EXPORT Dart_Handle dart::Dart_StringToLatin1 ( Dart_Handle  str,
uint8_t *  latin1_array,
intptr_t *  length 
)

Definition at line 2963 of file dart_api_impl.cc.

2965 {
2966 DARTSCOPE(Thread::Current());
2968 if (latin1_array == nullptr) {
2969 RETURN_NULL_ERROR(latin1_array);
2970 }
2971 if (length == nullptr) {
2973 }
2974 const String& str_obj = Api::UnwrapStringHandle(Z, str);
2975 if (str_obj.IsNull() || !str_obj.IsOneByteString()) {
2976 RETURN_TYPE_ERROR(Z, str, String);
2977 }
2978 intptr_t str_len = str_obj.Length();
2979 intptr_t copy_len = (str_len > *length) ? *length : str_len;
2980
2981 // We have already asserted that the string object is a Latin-1 string
2982 // so we can copy the characters over using a simple loop.
2983 for (intptr_t i = 0; i < copy_len; i++) {
2984 latin1_array[i] = str_obj.CharAt(i);
2985 }
2986 *length = copy_len;
2987 return Api::Success();
2988}

◆ Dart_StringToUTF16()

DART_EXPORT Dart_Handle dart::Dart_StringToUTF16 ( Dart_Handle  str,
uint16_t *  utf16_array,
intptr_t *  length 
)

Definition at line 2990 of file dart_api_impl.cc.

2992 {
2993 DARTSCOPE(Thread::Current());
2995 const String& str_obj = Api::UnwrapStringHandle(Z, str);
2996 if (str_obj.IsNull()) {
2997 RETURN_TYPE_ERROR(Z, str, String);
2998 }
2999 intptr_t str_len = str_obj.Length();
3000 intptr_t copy_len = (str_len > *length) ? *length : str_len;
3001 for (intptr_t i = 0; i < copy_len; i++) {
3002 utf16_array[i] = str_obj.CharAt(i);
3003 }
3004 *length = copy_len;
3005 return Api::Success();
3006}

◆ Dart_StringToUTF8()

DART_EXPORT Dart_Handle dart::Dart_StringToUTF8 ( Dart_Handle  str,
uint8_t **  utf8_array,
intptr_t *  length 
)

Definition at line 2916 of file dart_api_impl.cc.

2918 {
2919 DARTSCOPE(Thread::Current());
2921 if (utf8_array == nullptr) {
2922 RETURN_NULL_ERROR(utf8_array);
2923 }
2924 if (length == nullptr) {
2926 }
2927 const String& str_obj = Api::UnwrapStringHandle(Z, str);
2928 if (str_obj.IsNull()) {
2929 RETURN_TYPE_ERROR(Z, str, String);
2930 }
2931 intptr_t str_len = Utf8::Length(str_obj);
2932 *utf8_array = Api::TopScope(T)->zone()->Alloc<uint8_t>(str_len);
2933 if (*utf8_array == nullptr) {
2934 return Api::NewError("Unable to allocate memory");
2935 }
2936 str_obj.ToUTF8(*utf8_array, str_len);
2937 *length = str_len;
2938 return Api::Success();
2939}

◆ Dart_StringUTF8Length()

DART_EXPORT Dart_Handle dart::Dart_StringUTF8Length ( Dart_Handle  str,
intptr_t *  len 
)

Definition at line 2830 of file dart_api_impl.cc.

2830 {
2831 Thread* thread = Thread::Current();
2832 DARTSCOPE(thread);
2833 {
2834 ReusableObjectHandleScope reused_obj_handle(thread);
2835 const String& str_obj = Api::UnwrapStringHandle(reused_obj_handle, str);
2836 if (!str_obj.IsNull()) {
2837 *len = Utf8::Length(str_obj);
2838 return Api::Success();
2839 }
2840 }
2841 RETURN_TYPE_ERROR(thread->zone(), str, String);
2842}

◆ Dart_ThreadDisableProfiling()

DART_EXPORT void dart::Dart_ThreadDisableProfiling ( void  )

Definition at line 1573 of file dart_api_impl.cc.

1573 {
1574#if !defined(PRODUCT)
1575 OSThread* os_thread = OSThread::Current();
1576 if (os_thread == nullptr) {
1577 return;
1578 }
1579 os_thread->DisableThreadInterrupts();
1580#endif // !defined(PRODUCT)
1581}
void DisableThreadInterrupts()
Definition os_thread.cc:143

◆ Dart_ThreadEnableProfiling()

DART_EXPORT void dart::Dart_ThreadEnableProfiling ( void  )

Definition at line 1583 of file dart_api_impl.cc.

1583 {
1584#if !defined(PRODUCT)
1585 OSThread* os_thread = OSThread::Current();
1586 if (os_thread == nullptr) {
1587 return;
1588 }
1589 os_thread->EnableThreadInterrupts();
1590#endif // !defined(PRODUCT)
1591}
void EnableThreadInterrupts()
Definition os_thread.cc:148

◆ Dart_ThrowException()

DART_EXPORT Dart_Handle dart::Dart_ThrowException ( Dart_Handle  exception)

Definition at line 4822 of file dart_api_impl.cc.

4822 {
4823 Thread* thread = Thread::Current();
4824 Zone* zone = thread->zone();
4825 Isolate* isolate = thread->isolate();
4826 CHECK_ISOLATE(isolate);
4827 CHECK_CALLBACK_STATE(thread);
4828 if (::Dart_IsError(exception)) {
4829 ::Dart_PropagateError(exception);
4830 }
4831 TransitionNativeToVM transition(thread);
4832 const Instance& excp = Api::UnwrapInstanceHandle(zone, exception);
4833 if (excp.IsNull()) {
4834 RETURN_TYPE_ERROR(zone, exception, Instance);
4835 }
4836 if (thread->top_exit_frame_info() == 0) {
4837 // There are no dart frames on the stack so it would be illegal to
4838 // throw an exception here.
4839 return Api::NewError("No Dart frames on stack, cannot throw exception");
4840 }
4841 // Unwind all the API scopes till the exit frame before throwing an
4842 // exception.
4843 const Instance* saved_exception;
4844 {
4845 NoSafepointScope no_safepoint;
4846 InstancePtr raw_exception =
4847 Api::UnwrapInstanceHandle(zone, exception).ptr();
4848 thread->UnwindScopes(thread->top_exit_frame_info());
4849 saved_exception = &Instance::Handle(raw_exception);
4850 }
4851 Exceptions::Throw(thread, *saved_exception);
4852 return Api::NewError("Exception was not thrown, internal error");
4853}
DART_EXPORT void Dart_PropagateError(Dart_Handle handle)

◆ Dart_TimelineGetMicros()

DART_EXPORT int64_t dart::Dart_TimelineGetMicros ( )

Definition at line 6269 of file dart_api_impl.cc.

6269 {
6270 return OS::GetCurrentMonotonicMicros();
6271}

◆ Dart_TimelineGetTicks()

DART_EXPORT int64_t dart::Dart_TimelineGetTicks ( )

Definition at line 6273 of file dart_api_impl.cc.

6273 {
6274 return OS::GetCurrentMonotonicTicks();
6275}

◆ Dart_TimelineGetTicksFrequency()

DART_EXPORT int64_t dart::Dart_TimelineGetTicksFrequency ( )

Definition at line 6277 of file dart_api_impl.cc.

6277 {
6278 return OS::GetCurrentMonotonicFrequency();
6279}

◆ Dart_ToString()

DART_EXPORT Dart_Handle dart::Dart_ToString ( Dart_Handle  object)

Definition at line 896 of file dart_api_impl.cc.

896 {
897 DARTSCOPE(Thread::Current());
898 const Object& obj = Object::Handle(Z, Api::UnwrapHandle(object));
899 if (obj.IsString()) {
900 return Api::NewHandle(T, obj.ptr());
901 } else if (obj.IsInstance()) {
903 const Instance& receiver = Instance::Cast(obj);
904 return Api::NewHandle(T, DartLibraryCalls::ToString(receiver));
905 } else {
907 // This is a VM internal object. Call the C++ method of printing.
908 return Api::NewHandle(T, String::New(obj.ToCString()));
909 }
910}

◆ Dart_True()

DART_EXPORT Dart_Handle dart::Dart_True ( void  )

Definition at line 2787 of file dart_api_impl.cc.

2787 {
2788 ASSERT(Isolate::Current() != nullptr);
2789 return Api::True();
2790}

◆ Dart_TypedDataAcquireData()

DART_EXPORT Dart_Handle dart::Dart_TypedDataAcquireData ( Dart_Handle  object,
Dart_TypedData_Type type,
void **  data,
intptr_t *  len 
)

Definition at line 4030 of file dart_api_impl.cc.

4033 {
4034 DARTSCOPE(Thread::Current());
4035 Isolate* I = T->isolate();
4036 intptr_t class_id = Api::ClassId(object);
4037 if (!IsExternalTypedDataClassId(class_id) &&
4038 !IsTypedDataViewClassId(class_id) && !IsTypedDataClassId(class_id) &&
4040 RETURN_TYPE_ERROR(Z, object, 'TypedData');
4041 }
4042 if (type == nullptr) {
4044 }
4045 if (data == nullptr) {
4046 RETURN_NULL_ERROR(data);
4047 }
4048 if (len == nullptr) {
4049 RETURN_NULL_ERROR(len);
4050 }
4051 // Get the type of typed data object.
4052 *type = GetType(class_id);
4053 intptr_t length = 0;
4054 intptr_t size_in_bytes = 0;
4055 void* data_tmp = nullptr;
4056 bool external = false;
4057 T->IncrementNoSafepointScopeDepth();
4059 if (IsExternalTypedDataClassId(class_id)) {
4060 const ExternalTypedData& obj =
4061 Api::UnwrapExternalTypedDataHandle(Z, object);
4062 ASSERT(!obj.IsNull());
4063 length = obj.Length();
4064 size_in_bytes = length * ExternalTypedData::ElementSizeInBytes(class_id);
4065 data_tmp = obj.DataAddr(0);
4066 external = true;
4067 } else if (IsTypedDataClassId(class_id)) {
4068 const TypedData& obj = Api::UnwrapTypedDataHandle(Z, object);
4069 ASSERT(!obj.IsNull());
4070 length = obj.Length();
4071 size_in_bytes = length * TypedData::ElementSizeInBytes(class_id);
4072 data_tmp = obj.DataAddr(0);
4073 } else {
4074 ASSERT(IsTypedDataViewClassId(class_id) ||
4076 const auto& view_obj = Api::UnwrapTypedDataViewHandle(Z, object);
4077 ASSERT(!view_obj.IsNull());
4078 Smi& val = Smi::Handle();
4079 val = view_obj.length();
4080 length = val.Value();
4081 size_in_bytes = length * TypedDataView::ElementSizeInBytes(class_id);
4082 val = view_obj.offset_in_bytes();
4083 intptr_t offset_in_bytes = val.Value();
4084 const auto& obj = Instance::Handle(view_obj.typed_data());
4085 if (TypedData::IsTypedData(obj)) {
4086 const TypedData& data_obj = TypedData::Cast(obj);
4087 data_tmp = data_obj.DataAddr(offset_in_bytes);
4088 } else {
4089 ASSERT(ExternalTypedData::IsExternalTypedData(obj));
4090 const ExternalTypedData& data_obj = ExternalTypedData::Cast(obj);
4091 data_tmp = data_obj.DataAddr(offset_in_bytes);
4092 external = true;
4093 }
4094 }
4095 if (FLAG_verify_acquired_data) {
4096 {
4097 NoSafepointScope no_safepoint(T);
4098 bool sweep_in_progress;
4099 {
4100 PageSpace* old_space = T->heap()->old_space();
4101 MonitorLocker ml(old_space->tasks_lock());
4102 sweep_in_progress = (old_space->phase() == PageSpace::kSweepingLarge) ||
4103 (old_space->phase() == PageSpace::kSweepingRegular);
4104 }
4105 if (!sweep_in_progress) {
4106 if (external) {
4107 ASSERT(!T->heap()->Contains(reinterpret_cast<uword>(data_tmp)));
4108 } else {
4109 ASSERT(T->heap()->Contains(reinterpret_cast<uword>(data_tmp)));
4110 }
4111 }
4112 }
4113 const Object& obj = Object::Handle(Z, Api::UnwrapHandle(object));
4114 WeakTable* table = I->group()->api_state()->acquired_table();
4115 intptr_t current = table->GetValue(obj.ptr());
4116 if (current != 0) {
4117 return Api::NewError("Data was already acquired for this object.");
4118 }
4119 // Do not make a copy if the data is external. Some callers expect external
4120 // data to remain in place, even though the API spec doesn't guarantee it.
4121 // TODO(koda/asiva): Make final decision and document it.
4122 AcquiredData* ad = new AcquiredData(data_tmp, size_in_bytes, !external);
4123 table->SetValue(obj.ptr(), reinterpret_cast<intptr_t>(ad));
4124 data_tmp = ad->GetData();
4125 }
4126 *data = data_tmp;
4127 *len = length;
4128 return Api::Success();
4129}
SI F table(const skcms_Curve *curve, F v)
#define START_NO_CALLBACK_SCOPE(thread)

◆ Dart_TypedDataReleaseData()

DART_EXPORT Dart_Handle dart::Dart_TypedDataReleaseData ( Dart_Handle  object)

Definition at line 4131 of file dart_api_impl.cc.

4131 {
4132 DARTSCOPE(Thread::Current());
4133 Isolate* I = T->isolate();
4134 intptr_t class_id = Api::ClassId(object);
4135 if (!IsExternalTypedDataClassId(class_id) &&
4136 !IsTypedDataViewClassId(class_id) && !IsTypedDataClassId(class_id) &&
4138 RETURN_TYPE_ERROR(Z, object, 'TypedData');
4139 }
4140 if (FLAG_verify_acquired_data) {
4141 const Object& obj = Object::Handle(Z, Api::UnwrapHandle(object));
4142 WeakTable* table = I->group()->api_state()->acquired_table();
4143 intptr_t current = table->GetValue(obj.ptr());
4144 if (current == 0) {
4145 return Api::NewError("Data was not acquired for this object.");
4146 }
4147 AcquiredData* ad = reinterpret_cast<AcquiredData*>(current);
4148 table->SetValue(obj.ptr(), 0); // Delete entry from table.
4149 delete ad;
4150 }
4151 T->DecrementNoSafepointScopeDepth();
4153 return Api::Success();
4154}
#define END_NO_CALLBACK_SCOPE(thread)

◆ Dart_TypeDynamic()

DART_EXPORT Dart_Handle dart::Dart_TypeDynamic ( void  )

Definition at line 2230 of file dart_api_impl.cc.

2230 {
2231 DARTSCOPE(Thread::Current());
2234 return Api::NewHandle(T, Type::DynamicType());
2235}

◆ Dart_TypeNever()

DART_EXPORT Dart_Handle dart::Dart_TypeNever ( void  )

Definition at line 2244 of file dart_api_impl.cc.

2244 {
2245 DARTSCOPE(Thread::Current());
2248 return Api::NewHandle(T, Type::NeverType());
2249}

◆ Dart_TypeToNonNullableType()

DART_EXPORT Dart_Handle dart::Dart_TypeToNonNullableType ( Dart_Handle  type)

Definition at line 5642 of file dart_api_impl.cc.

5642 {
5643 return TypeToHelper(type, Nullability::kNonNullable);
5644}
static Dart_Handle TypeToHelper(Dart_Handle type, Nullability nullability)

◆ Dart_TypeToNullableType()

DART_EXPORT Dart_Handle dart::Dart_TypeToNullableType ( Dart_Handle  type)

Definition at line 5638 of file dart_api_impl.cc.

5638 {
5639 return TypeToHelper(type, Nullability::kNullable);
5640}

◆ Dart_TypeVoid()

DART_EXPORT Dart_Handle dart::Dart_TypeVoid ( void  )

Definition at line 2237 of file dart_api_impl.cc.

2237 {
2238 DARTSCOPE(Thread::Current());
2241 return Api::NewHandle(T, Type::VoidType());
2242}

◆ Dart_VersionString()

DART_EXPORT const char * dart::Dart_VersionString ( void  )

Definition at line 1161 of file dart_api_impl.cc.

1161 {
1162 return Version::String();
1163}

◆ Dart_WriteHeapSnapshot()

DART_EXPORT char * dart::Dart_WriteHeapSnapshot ( Dart_HeapSnapshotWriteChunkCallback  write,
void *  context 
)

Definition at line 6953 of file dart_api_impl.cc.

6955 {
6956#if defined(DART_ENABLE_HEAP_SNAPSHOT_WRITER)
6957 DARTSCOPE(Thread::Current());
6958 CallbackHeapSnapshotWriter callback_writer(T, write, context);
6959 HeapSnapshotWriter writer(T, &callback_writer);
6960 writer.Write();
6961 return nullptr;
6962#else
6963 return Utils::StrDup("VM is built without the heap snapshot writer.");
6964#endif
6965}
void write(SkWStream *wStream, const T &text)
Definition skqp.cpp:188

◆ Dart_WriteProfileToTimeline()

DART_EXPORT bool dart::Dart_WriteProfileToTimeline ( Dart_Port  main_port,
char **  error 
)

Definition at line 1599 of file dart_api_impl.cc.

1600 {
1601#if defined(PRODUCT)
1602 return false;
1603#else
1604 if (!FLAG_profiler) {
1605 if (error != nullptr) {
1606 *error = Utils::StrDup("The profiler is not running.");
1607 }
1608 return false;
1609 }
1610
1611 const intptr_t kBufferLength = 512;
1612 char method[kBufferLength];
1613
1614 // clang-format off
1615 intptr_t method_length = snprintf(method, kBufferLength, "{"
1616 "\"jsonrpc\": \"2.0\","
1617 "\"method\": \"_writeCpuProfileTimeline\","
1618 "\"id\": \"\","
1619 "\"params\": {"
1620 " \"isolateId\": \"isolates/%" Pd64 "\","
1621 " \"tags\": \"None\""
1622 "}"
1623 "}", main_port);
1624 // clang-format on
1625 ASSERT(method_length <= kBufferLength);
1626
1627 char* response = nullptr;
1628 intptr_t response_length;
1629 bool success = Dart_InvokeVMServiceMethod(
1630 reinterpret_cast<uint8_t*>(method), method_length,
1631 reinterpret_cast<uint8_t**>(&response), &response_length, error);
1632 free(response);
1633 return success;
1634#endif
1635}
DART_EXPORT bool Dart_InvokeVMServiceMethod(uint8_t *request_json, intptr_t request_json_length, uint8_t **response_json, intptr_t *response_json_length, char **error)

◆ DartModulo()

double dart::DartModulo ( double  left,
double  right 
)

Definition at line 3794 of file runtime_entry.cc.

3794 {
3795 double remainder = fmod_ieee(left, right);
3796 if (remainder == 0.0) {
3797 // We explicitly switch to the positive 0.0 (just in case it was negative).
3798 remainder = +0.0;
3799 } else if (remainder < 0.0) {
3800 if (right < 0) {
3801 remainder -= right;
3802 } else {
3803 remainder += right;
3804 }
3805 }
3806 return remainder;
3807}
double fmod_ieee(double x, double y)

◆ DartNativeThrowArgumentException()

void dart::DartNativeThrowArgumentException ( const Instance instance)

Definition at line 31 of file native_entry.cc.

31 {
32 const Array& __args__ = Array::Handle(Array::New(1));
33 __args__.SetAt(0, instance);
34 Exceptions::ThrowByType(Exceptions::kArgument, __args__);
35}

◆ DartNativeThrowTypeArgumentCountException()

void dart::DartNativeThrowTypeArgumentCountException ( int  num_type_args,
int  num_type_args_expected 
)

Definition at line 23 of file native_entry.cc.

24 {
25 const String& error = String::Handle(String::NewFormatted(
26 "Wrong number of type arguments (%i), expected %i type arguments",
27 num_type_args, num_type_args_expected));
28 Exceptions::ThrowArgumentError(error);
29}

◆ DebuggerSetResumeIfStepping()

static void dart::DebuggerSetResumeIfStepping ( Isolate isolate)
static

Definition at line 690 of file dart_entry.cc.

690 {
691#if !defined(PRODUCT)
692 if (isolate->debugger()->IsStepping()) {
693 // If the isolate is being debugged and the debugger was stepping
694 // through code, enable single stepping so debugger will stop
695 // at the first location the user is interested in.
696 isolate->debugger()->SetResumeAction(Debugger::kStepInto);
697 }
698#endif
699}
bool IsStepping() const
Definition debugger.h:710
bool SetResumeAction(ResumeAction action, intptr_t frame_index=1, const char **error=nullptr)
Definition debugger.cc:1486

◆ DECLARE_FLAG() [1/69]

dart::DECLARE_FLAG ( bool  ,
check_reloaded   
)

◆ DECLARE_FLAG() [2/69]

dart::DECLARE_FLAG ( bool  ,
complete_timeline   
)

◆ DECLARE_FLAG() [3/69]

dart::DECLARE_FLAG ( bool  ,
enable_simd_inline   
)

◆ DECLARE_FLAG() [4/69]

dart::DECLARE_FLAG ( bool  ,
force_evacuation   
)

◆ DECLARE_FLAG() [5/69]

dart::DECLARE_FLAG ( bool  ,
gc_during_reload   
)

◆ DECLARE_FLAG() [6/69]

dart::DECLARE_FLAG ( bool  ,
inline_alloc   
)

◆ DECLARE_FLAG() [7/69]

dart::DECLARE_FLAG ( bool  ,
intrinsify   
)

◆ DECLARE_FLAG() [8/69]

dart::DECLARE_FLAG ( bool  ,
precompiled_mode   
)

◆ DECLARE_FLAG() [9/69]

dart::DECLARE_FLAG ( bool  ,
print_class_table   
)

◆ DECLARE_FLAG() [10/69]

dart::DECLARE_FLAG ( bool  ,
print_flags   
)

◆ DECLARE_FLAG() [11/69]

dart::DECLARE_FLAG ( bool  ,
print_flow_graph   
)

◆ DECLARE_FLAG() [12/69]

dart::DECLARE_FLAG ( bool  ,
print_flow_graph_optimized   
)

◆ DECLARE_FLAG() [13/69]

dart::DECLARE_FLAG ( bool  ,
print_instruction_stats   
)

◆ DECLARE_FLAG() [14/69]

dart::DECLARE_FLAG ( bool  ,
print_metrics   
)

◆ DECLARE_FLAG() [15/69]

dart::DECLARE_FLAG ( bool  ,
profile_vm   
)

◆ DECLARE_FLAG() [16/69]

dart::DECLARE_FLAG ( bool  ,
profile_vm_allocation   
)

◆ DECLARE_FLAG() [17/69]

dart::DECLARE_FLAG ( bool  ,
reload_every_back_off   
)

◆ DECLARE_FLAG() [18/69]

dart::DECLARE_FLAG ( bool  ,
reload_every_optimized   
)

◆ DECLARE_FLAG() [19/69]

dart::DECLARE_FLAG ( bool  ,
show_invisible_frames   
)

◆ DECLARE_FLAG() [20/69]

dart::DECLARE_FLAG ( bool  ,
trace_bailout   
)

◆ DECLARE_FLAG() [21/69]

dart::DECLARE_FLAG ( bool  ,
trace_compiler   
)

◆ DECLARE_FLAG() [22/69]

dart::DECLARE_FLAG ( bool  ,
trace_constant_propagation   
)

◆ DECLARE_FLAG() [23/69]

dart::DECLARE_FLAG ( bool  ,
trace_deoptimization   
)

◆ DECLARE_FLAG() [24/69]

dart::DECLARE_FLAG ( bool  ,
trace_deoptimization_verbose   
)

◆ DECLARE_FLAG() [25/69]

dart::DECLARE_FLAG ( bool  ,
trace_failed_optimization_attempts   
)

◆ DECLARE_FLAG() [26/69]

dart::DECLARE_FLAG ( bool  ,
trace_inlining_intervals   
)

◆ DECLARE_FLAG() [27/69]

dart::DECLARE_FLAG ( bool  ,
trace_optimizing_compiler   
)

◆ DECLARE_FLAG() [28/69]

dart::DECLARE_FLAG ( bool  ,
trace_reload   
)

◆ DECLARE_FLAG() [29/69]

dart::DECLARE_FLAG ( bool  ,
trace_reload_verbose   
)

◆ DECLARE_FLAG() [30/69]

dart::DECLARE_FLAG ( bool  ,
trace_service   
)

◆ DECLARE_FLAG() [31/69]

dart::DECLARE_FLAG ( bool  ,
trace_service_pause_events   
)

◆ DECLARE_FLAG() [32/69]

dart::DECLARE_FLAG ( bool  ,
trace_service_verbose   
)

◆ DECLARE_FLAG() [33/69]

dart::DECLARE_FLAG ( bool  ,
trace_shutdown   
)

◆ DECLARE_FLAG() [34/69]

dart::DECLARE_FLAG ( bool  ,
two_args_smi_icd   
)

◆ DECLARE_FLAG() [35/69]

dart::DECLARE_FLAG ( bool  ,
use_compressed_instructions   
)

◆ DECLARE_FLAG() [36/69]

dart::DECLARE_FLAG ( bool  ,
use_slow_path   
)

◆ DECLARE_FLAG() [37/69]

dart::DECLARE_FLAG ( bool  ,
use_sse41   
)

◆ DECLARE_FLAG() [38/69]

dart::DECLARE_FLAG ( bool  ,
verify_acquired_data   
)

◆ DECLARE_FLAG() [39/69]

dart::DECLARE_FLAG ( bool  ,
warn_on_pause_with_no_debugger   
)

◆ DECLARE_FLAG() [40/69]

dart::DECLARE_FLAG ( bool  ,
write_protect_code   
)

◆ DECLARE_FLAG() [41/69]

dart::DECLARE_FLAG ( charp  ,
deoptimize_filter   
)

◆ DECLARE_FLAG() [42/69]

dart::DECLARE_FLAG ( charp  ,
stacktrace_filter   
)

◆ DECLARE_FLAG() [43/69]

dart::DECLARE_FLAG ( charp  ,
trace_precompiler_to   
)

◆ DECLARE_FLAG() [44/69]

dart::DECLARE_FLAG ( charp  ,
write_v8_snapshot_profile_to   
)

◆ DECLARE_FLAG() [45/69]

dart::DECLARE_FLAG ( int  ,
code_heap_size   
)

◆ DECLARE_FLAG() [46/69]

dart::DECLARE_FLAG ( int  ,
early_tenuring_threshold   
)

◆ DECLARE_FLAG() [47/69]

dart::DECLARE_FLAG ( int  ,
gc_every   
)

◆ DECLARE_FLAG() [48/69]

dart::DECLARE_FLAG ( int  ,
inline_getters_setters_smaller_than   
)

◆ DECLARE_FLAG() [49/69]

dart::DECLARE_FLAG ( int  ,
inlining_callee_size_threshold   
)

◆ DECLARE_FLAG() [50/69]

dart::DECLARE_FLAG ( int  ,
inlining_caller_size_threshold   
)

◆ DECLARE_FLAG() [51/69]

dart::DECLARE_FLAG ( int  ,
inlining_constant_arguments_max_size_threshold   
)

◆ DECLARE_FLAG() [52/69]

dart::DECLARE_FLAG ( int  ,
inlining_constant_arguments_min_size_threshold   
)

◆ DECLARE_FLAG() [53/69]

dart::DECLARE_FLAG ( int  ,
inlining_depth_threshold   
)

◆ DECLARE_FLAG() [54/69]

dart::DECLARE_FLAG ( int  ,
inlining_hotness   
)

◆ DECLARE_FLAG() [55/69]

dart::DECLARE_FLAG ( int  ,
inlining_size_threshold   
)

◆ DECLARE_FLAG() [56/69]

dart::DECLARE_FLAG ( int  ,
max_deoptimization_counter_threshold   
)

◆ DECLARE_FLAG() [57/69]

dart::DECLARE_FLAG ( int  ,
max_polymorphic_checks   
)

◆ DECLARE_FLAG() [58/69]

dart::DECLARE_FLAG ( int  ,
max_profile_depth   
)

◆ DECLARE_FLAG() [59/69]

dart::DECLARE_FLAG ( int  ,
max_subtype_cache_entries   
)

◆ DECLARE_FLAG() [60/69]

dart::DECLARE_FLAG ( int  ,
old_gen_growth_space_ratio   
)

◆ DECLARE_FLAG() [61/69]

dart::DECLARE_FLAG ( int  ,
old_gen_growth_time_ratio   
)

◆ DECLARE_FLAG() [62/69]

dart::DECLARE_FLAG ( int  ,
optimization_counter_threshold   
)

◆ DECLARE_FLAG() [63/69]

dart::DECLARE_FLAG ( int  ,
profile_period   
)

◆ DECLARE_FLAG() [64/69]

dart::DECLARE_FLAG ( int  ,
regexp_optimization_counter_threshold   
)

◆ DECLARE_FLAG() [65/69]

dart::DECLARE_FLAG ( int  ,
reload_every   
)

◆ DECLARE_FLAG() [66/69]

dart::DECLARE_FLAG ( int  ,
reoptimization_counter_threshold   
)

◆ DECLARE_FLAG() [67/69]

dart::DECLARE_FLAG ( int  ,
stacktrace_every   
)

◆ DECLARE_FLAG() [68/69]

dart::DECLARE_FLAG ( int  ,
worker_timeout_millis   
)

◆ DECLARE_FLAG() [69/69]

dart::DECLARE_FLAG ( uint64_t  ,
random_seed   
)

◆ DecodeBase64()

uint8_t * dart::DecodeBase64 ( const char *  str,
intptr_t *  out_decoded_len 
)

Definition at line 39 of file base64.cc.

39 {
40 intptr_t len = strlen(str);
41 if (len == 0 || (len % 4 != 0)) {
42 return nullptr;
43 }
44
45 int pad_length = 0;
46 for (intptr_t i = len - 1; i >= 0; i--) {
47 const uint8_t current_code_unit = str[i];
48 if (decode_table[current_code_unit] > 0) break;
49 if (current_code_unit == PAD) pad_length++;
50 }
51 intptr_t decoded_en = ((len * 6) >> 3) - pad_length;
52 uint8_t* bytes = static_cast<uint8_t*>(malloc(decoded_en));
53
54 for (int i = 0, o = 0; o < decoded_en;) {
55 // Accumulate 4 valid 6 bit Base 64 characters into an int.
56 int x = 0;
57 for (int j = 4; j > 0;) {
58 int c = decode_table[(uint8_t)str[i++]];
59 if (c >= 0) {
60 x = ((x << 6) & 0xFFFFFF) | c;
61 j--;
62 }
63 }
64 bytes[o++] = x >> 16;
65 if (o < decoded_en) {
66 bytes[o++] = (x >> 8) & 0xFF;
67 if (o < decoded_en) bytes[o++] = x & 0xFF;
68 }
69 }
70 if (out_decoded_len != nullptr) {
71 *out_decoded_len = decoded_en;
72 }
73 return bytes;
74}
#define PAD
static const int8_t decode_table[]
Definition base64.cc:19

◆ DecodeBTypeImm()

intptr_t dart::DecodeBTypeImm ( uint32_t  encoded)
inline

Definition at line 1020 of file constants_riscv.h.

1020 {
1021 uint32_t imm = 0;
1022 imm |= (((encoded >> 31) & 0x1) << 12);
1023 imm |= (((encoded >> 25) & 0x3f) << 5);
1024 imm |= (((encoded >> 8) & 0xf) << 1);
1025 imm |= (((encoded >> 7) & 0x1) << 11);
1026 return SignExtend(12, imm);
1027}
int32_t SignExtend(int N, int32_t value)

◆ DecodeCBImm()

intx_t dart::DecodeCBImm ( uint32_t  encoding)
inline

Definition at line 1336 of file constants_riscv.h.

1336 {
1337 uint32_t imm = 0;
1338 imm |= ((encoding >> 12) & 0x1) << 8;
1339 imm |= ((encoding >> 10) & 0x3) << 3;
1340 imm |= ((encoding >> 5) & 0x3) << 6;
1341 imm |= ((encoding >> 3) & 0x3) << 1;
1342 imm |= ((encoding >> 2) & 0x1) << 5;
1343 return SignExtend(8, imm);
1344}

◆ DecodeCI16Imm()

intx_t dart::DecodeCI16Imm ( uint32_t  encoding)
inline

Definition at line 1393 of file constants_riscv.h.

1393 {
1394 uint32_t imm = 0;
1395 imm |= ((encoding >> 12) & 0x1) << 9;
1396 imm |= ((encoding >> 6) & 0x1) << 4;
1397 imm |= ((encoding >> 5) & 0x1) << 6;
1398 imm |= ((encoding >> 3) & 0x3) << 7;
1399 imm |= ((encoding >> 2) & 0x1) << 5;
1400 return SignExtend(10, imm);
1401}

◆ DecodeCI4SPNImm()

intx_t dart::DecodeCI4SPNImm ( uint32_t  encoding)
inline

Definition at line 1415 of file constants_riscv.h.

1415 {
1416 uint32_t imm = 0;
1417 imm |= ((encoding >> 11) & 0x3) << 4;
1418 imm |= ((encoding >> 7) & 0xF) << 6;
1419 imm |= ((encoding >> 6) & 0x1) << 2;
1420 imm |= ((encoding >> 5) & 0x1) << 3;
1421 return imm;
1422}

◆ DecodeCIImm()

intx_t dart::DecodeCIImm ( uint32_t  encoding)
inline

Definition at line 1356 of file constants_riscv.h.

1356 {
1357 uint32_t imm = 0;
1358 imm |= ((encoding >> 12) & 0x1) << 5;
1359 imm |= ((encoding >> 2) & 0x1F) << 0;
1360 return SignExtend(6, imm);
1361}

◆ DecodeCJImm()

intx_t dart::DecodeCJImm ( uint32_t  encoding)
inline

Definition at line 1310 of file constants_riscv.h.

1310 {
1311 uint32_t imm = 0;
1312 imm |= ((encoding >> 12) & 0x1) << 11;
1313 imm |= ((encoding >> 11) & 0x1) << 4;
1314 imm |= ((encoding >> 9) & 0x3) << 8;
1315 imm |= ((encoding >> 8) & 0x1) << 10;
1316 imm |= ((encoding >> 7) & 0x1) << 6;
1317 imm |= ((encoding >> 6) & 0x1) << 7;
1318 imm |= ((encoding >> 3) & 0x7) << 1;
1319 imm |= ((encoding >> 2) & 0x1) << 5;
1320 return SignExtend(11, imm);
1321}

◆ DecodeCMem4Imm()

intx_t dart::DecodeCMem4Imm ( uint32_t  encoding)
inline

Definition at line 1269 of file constants_riscv.h.

1269 {
1270 uint32_t imm = 0;
1271 imm |= ((encoding >> 10) & 0x7) << 3;
1272 imm |= ((encoding >> 6) & 0x1) << 2;
1273 imm |= ((encoding >> 5) & 0x1) << 6;
1274 return imm;
1275}

◆ DecodeCMem8Imm()

intx_t dart::DecodeCMem8Imm ( uint32_t  encoding)
inline

Definition at line 1287 of file constants_riscv.h.

1287 {
1288 uint32_t imm = 0;
1289 imm |= ((encoding >> 10) & 0x7) << 3;
1290 imm |= ((encoding >> 5) & 0x3) << 6;
1291 return imm;
1292}

◆ DecodeCSPLoad4Imm()

intx_t dart::DecodeCSPLoad4Imm ( uint32_t  encoding)
inline

Definition at line 1197 of file constants_riscv.h.

1197 {
1198 uint32_t imm = 0;
1199 imm |= ((encoding >> 12) & 0x1) << 5;
1200 imm |= ((encoding >> 4) & 0x7) << 2;
1201 imm |= ((encoding >> 2) & 0x3) << 6;
1202 return imm;
1203}

◆ DecodeCSPLoad8Imm()

intx_t dart::DecodeCSPLoad8Imm ( uint32_t  encoding)
inline

Definition at line 1216 of file constants_riscv.h.

1216 {
1217 uint32_t imm = 0;
1218 imm |= ((encoding >> 12) & 0x1) << 5;
1219 imm |= ((encoding >> 5) & 0x3) << 3;
1220 imm |= ((encoding >> 2) & 0x7) << 6;
1221 return imm;
1222}

◆ DecodeCSPStore4Imm()

intx_t dart::DecodeCSPStore4Imm ( uint32_t  encoding)
inline

Definition at line 1234 of file constants_riscv.h.

1234 {
1235 uint32_t imm = 0;
1236 imm |= ((encoding >> 9) & 0xF) << 2;
1237 imm |= ((encoding >> 7) & 0x3) << 6;
1238 return imm;
1239}

◆ DecodeCSPStore8Imm()

intx_t dart::DecodeCSPStore8Imm ( uint32_t  encoding)
inline

Definition at line 1251 of file constants_riscv.h.

1251 {
1252 uint32_t imm = 0;
1253 imm |= ((encoding >> 10) & 0x7) << 3;
1254 imm |= ((encoding >> 7) & 0x7) << 6;
1255 return imm;
1256}

◆ DecodeCUImm()

intx_t dart::DecodeCUImm ( uint32_t  encoding)
inline

Definition at line 1373 of file constants_riscv.h.

1373 {
1374 uint32_t imm = 0;
1375 imm |= ((encoding >> 12) & 0x1) << 17;
1376 imm |= ((encoding >> 2) & 0x1F) << 12;
1377 return SignExtend(17, imm);
1378}

◆ DecodeITypeImm()

intptr_t dart::DecodeITypeImm ( uint32_t  encoded)
inline

Definition at line 1057 of file constants_riscv.h.

1057 {
1058 return SignExtend(12, encoded >> 20);
1059}

◆ DecodeJTypeImm()

intptr_t dart::DecodeJTypeImm ( uint32_t  encoded)
inline

Definition at line 1041 of file constants_riscv.h.

1041 {
1042 uint32_t imm = 0;
1043 imm |= (((encoded >> 31) & 0x1) << 20);
1044 imm |= (((encoded >> 21) & 0x3ff) << 1);
1045 imm |= (((encoded >> 20) & 0x1) << 11);
1046 imm |= (((encoded >> 12) & 0xff) << 12);
1047 return SignExtend(20, imm);
1048}

◆ DecodeKernelBuffer()

ExternalTypedDataPtr dart::DecodeKernelBuffer ( const char *  kernel_buffer_base64)

Definition at line 3307 of file service.cc.

3307 {
3308 intptr_t kernel_length;
3309 uint8_t* kernel_buffer = DecodeBase64(kernel_buffer_base64, &kernel_length);
3310 return ExternalTypedData::NewFinalizeWithFree(kernel_buffer, kernel_length);
3311}
uint8_t * DecodeBase64(const char *str, intptr_t *out_decoded_len)
Definition base64.cc:39

◆ DecodeLoadObjectFromPoolOrThread()

bool dart::DecodeLoadObjectFromPoolOrThread ( uword  pc,
const Code code,
Object obj 
)

◆ DecodeSTypeImm()

intptr_t dart::DecodeSTypeImm ( uint32_t  encoded)
inline

Definition at line 1082 of file constants_riscv.h.

1082 {
1083 uint32_t imm = 0;
1084 imm |= (((encoded >> 25) & 0x7f) << 5);
1085 imm |= (((encoded >> 7) & 0x1f) << 0);
1086 return SignExtend(12, imm);
1087}

◆ DecodeUTypeImm()

intptr_t dart::DecodeUTypeImm ( uint32_t  encoded)
inline

Definition at line 1068 of file constants_riscv.h.

1068 {
1069 return SignExtend(32, encoded & ~((1 << 12) - 1));
1070}

◆ DecreaseRefcount()

DART_EXPORT void dart::DecreaseRefcount ( void *  peer)

Definition at line 1352 of file ffi_test_functions_vmspecific.cc.

1352 {
1353 auto* resource = static_cast<RefCountedResource*>(peer);
1355 resource->refcount--;
1356 if (resource->refcount <= 0) {
1357 free(resource->resource);
1358 free(peer);
1359 }
1360 ref_counted_resource_mutex.unlock();
1361}
std::mutex ref_counted_resource_mutex

◆ DeepLiveness()

static void dart::DeepLiveness ( MaterializeObjectInstr mat,
BitVector live_in 
)
static

Definition at line 151 of file linearscan.cc.

151 {
152 if (mat->was_visited_for_liveness()) {
153 return;
154 }
156
157 for (intptr_t i = 0; i < mat->InputCount(); i++) {
158 if (!mat->InputAt(i)->BindsToConstant()) {
159 Definition* defn = mat->InputAt(i)->definition();
160 MaterializeObjectInstr* inner_mat = defn->AsMaterializeObject();
161 if (inner_mat != nullptr) {
162 DeepLiveness(inner_mat, live_in);
163 } else {
164 intptr_t idx = defn->vreg(0);
165 live_in->Add(idx);
166 }
167 }
168 }
169}
void Add(intptr_t i)
Definition bit_vector.h:63
void mark_visited_for_liveness()
Definition il.h:7720
bool was_visited_for_liveness() const
Definition il.h:7719

◆ DeferredLoadComplete()

static Dart_Handle dart::DeferredLoadComplete ( intptr_t  loading_unit_id,
bool  error,
const uint8_t *  snapshot_data,
const uint8_t *  snapshot_instructions,
const char *  error_message,
bool  transient_error 
)
static

Definition at line 5848 of file dart_api_impl.cc.

5853 {
5854 DARTSCOPE(Thread::Current());
5856 auto IG = T->isolate_group();
5858
5859 const Array& loading_units =
5860 Array::Handle(IG->object_store()->loading_units());
5861 if (loading_units.IsNull() || (loading_unit_id < LoadingUnit::kRootId) ||
5862 (loading_unit_id >= loading_units.Length())) {
5863 return Api::NewError("Invalid loading unit");
5864 }
5865 LoadingUnit& unit = LoadingUnit::Handle();
5866 unit ^= loading_units.At(loading_unit_id);
5867 if (unit.loaded()) {
5868 return Api::NewError("Unit already loaded");
5869 }
5870
5871 if (error) {
5872 CHECK_NULL(error_message);
5873 return Api::NewHandle(
5874 T, unit.CompleteLoad(String::Handle(String::New(error_message)),
5875 transient_error));
5876 } else {
5877#if defined(SUPPORT_TIMELINE)
5878 TimelineBeginEndScope tbes(T, Timeline::GetIsolateStream(),
5879 "ReadUnitSnapshot");
5880#endif // defined(SUPPORT_TIMELINE)
5881 const Snapshot* snapshot = Snapshot::SetupFromBuffer(snapshot_data);
5882 if (snapshot == nullptr) {
5883 return Api::NewError("Invalid snapshot");
5884 }
5885 if (!IsSnapshotCompatible(Dart::vm_snapshot_kind(), snapshot->kind())) {
5886 const String& message = String::Handle(String::NewFormatted(
5887 "Incompatible snapshot kinds: vm '%s', isolate '%s'",
5888 Snapshot::KindToCString(Dart::vm_snapshot_kind()),
5889 Snapshot::KindToCString(snapshot->kind())));
5890 return Api::NewHandle(T, ApiError::New(message));
5891 }
5892
5893 FullSnapshotReader reader(snapshot, snapshot_instructions, T);
5894 const Error& error = Error::Handle(reader.ReadUnitSnapshot(unit));
5895 if (!error.IsNull()) {
5896 return Api::NewHandle(T, error.ptr());
5897 }
5898
5899 return Api::NewHandle(T, unit.CompleteLoad(String::Handle(), false));
5900 }
5901}

◆ DEFINE_BACKEND()

dart::DEFINE_BACKEND ( LoadThread  ,
(Register out)   
)

Definition at line 7960 of file il.cc.

7960 {
7961 __ MoveRegister(out, THR);
7962}
#define __
Definition il.cc:4274

◆ DEFINE_FFI_NATIVE_ENTRY() [1/3]

dart::DEFINE_FFI_NATIVE_ENTRY ( FinalizerEntry_SetExternalSize  ,
void  ,
(Dart_Handle entry_handle, intptr_t external_size)   
)

Definition at line 100 of file ffi.cc.

102 {
103 Thread* const thread = Thread::Current();
104 TransitionNativeToVM transition(thread);
105 Zone* const zone = thread->zone();
106 const auto& entry_object =
107 Object::Handle(zone, Api::UnwrapHandle(entry_handle));
108 const auto& entry = FinalizerEntry::Cast(entry_object);
109
110 Heap::Space space;
111 intptr_t external_size_diff;
112 {
113 NoSafepointScope no_safepoint;
114 space = SpaceForExternal(entry.ptr());
115 const intptr_t external_size_old = entry.external_size();
116 if (FLAG_trace_finalizers) {
117 THR_Print("Setting external size from %" Pd " to %" Pd
118 " bytes in %s space\n",
119 external_size_old, external_size, space == 0 ? "new" : "old");
120 }
121 external_size_diff = external_size - external_size_old;
122 if (external_size_diff == 0) {
123 return;
124 }
125 entry.set_external_size(external_size);
126 }
127 // The next call cannot be in safepoint.
128 if (external_size_diff > 0) {
129 if (!thread->isolate_group()->heap()->AllocatedExternal(external_size_diff,
130 space)) {
131 Exceptions::ThrowOOM();
132 }
133 } else {
134 thread->isolate_group()->heap()->FreedExternal(-external_size_diff, space);
135 }
136};
bool AllocatedExternal(intptr_t size, Space space)
Definition heap.cc:179
void FreedExternal(intptr_t size, Space space)
Definition heap.cc:200
Heap::Space SpaceForExternal(FinalizerEntryPtr raw_entry)
Definition gc_shared.cc:42

◆ DEFINE_FFI_NATIVE_ENTRY() [2/3]

dart::DEFINE_FFI_NATIVE_ENTRY ( Pointer_asTypedListFinalizerAllocateData  ,
void *  ,
()   
)

Definition at line 145 of file ffi.cc.

145 {
146 auto* result = malloc(sizeof(AsTypedListFinalizerData));
147 // Initialized with FFI stores.
148 MSAN_UNPOISON(result, sizeof(AsTypedListFinalizerData));
149 return result;
150};

◆ DEFINE_FFI_NATIVE_ENTRY() [3/3]

dart::DEFINE_FFI_NATIVE_ENTRY ( Pointer_asTypedListFinalizerCallbackPointer  ,
void *  ,
()   
)

Definition at line 158 of file ffi.cc.

160 {
161 return reinterpret_cast<void*>(&AsTypedListFinalizerCallback);
162};
void AsTypedListFinalizerCallback(void *peer)
Definition ffi.cc:152

◆ DEFINE_FLAG() [1/160]

dart::DEFINE_FLAG ( bool  ,
align_all_loops  ,
false  ,
"Align all loop headers to 32 byte boundary"   
)

◆ DEFINE_FLAG() [2/160]

dart::DEFINE_FLAG ( bool  ,
array_bounds_check_elimination  ,
true  ,
"Eliminate redundant bounds checks."   
)

◆ DEFINE_FLAG() [3/160]

dart::DEFINE_FLAG ( bool  ,
basic_flag  ,
true  ,
"Testing of a basic boolean flag."   
)

◆ DEFINE_FLAG() [4/160]

dart::DEFINE_FLAG ( bool  ,
check_code_pointer  ,
false  ,
"Verify instructions offset in code object." "NOTE: This breaks the profiler."   
)

◆ DEFINE_FLAG() [5/160]

dart::DEFINE_FLAG ( bool  ,
check_reloaded  ,
false  ,
"Assert that an isolate has reloaded at least once."   
)

◆ DEFINE_FLAG() [6/160]

dart::DEFINE_FLAG ( bool  ,
compress_deopt_info  ,
true  ,
"Compress the size of the deoptimization info for optimized code."   
)

◆ DEFINE_FLAG() [7/160]

dart::DEFINE_FLAG ( bool  ,
dead_store_elimination  ,
true  ,
"Eliminate dead stores"   
)

◆ DEFINE_FLAG() [8/160]

dart::DEFINE_FLAG ( bool  ,
disable_heap_verification  ,
false  ,
"Explicitly disable heap verification."   
)

◆ DEFINE_FLAG() [9/160]

dart::DEFINE_FLAG ( bool  ,
disable_thread_pool_limit  ,
false  ,
"Disables the limit of the thread pool (simulates custom embedder " "with custom message handler on unlimited number of threads)."   
)

◆ DEFINE_FLAG() [10/160]

dart::DEFINE_FLAG ( bool  ,
dump_tables  ,
false  ,
"Dump common hash tables before snapshotting."   
)

◆ DEFINE_FLAG() [11/160]

dart::DEFINE_FLAG ( bool  ,
enable_deprecated_wait_for  ,
false  ,
"Enable deprecated dart:cli waitFor. " "This feature will be fully removed in Dart 3.4 release. " "See https://dartbug.com/52121."   
)

◆ DEFINE_FLAG() [12/160]

dart::DEFINE_FLAG ( bool  ,
enable_fast_object_copy  ,
true  ,
"Enable fast path for fast object copy."   
)

◆ DEFINE_FLAG() [13/160]

dart::DEFINE_FLAG ( bool  ,
enable_peephole  ,
true  ,
"Enable peephole optimization"   
)

◆ DEFINE_FLAG() [14/160]

dart::DEFINE_FLAG ( bool  ,
enable_simd_inline  ,
true  ,
"Enable inlining of SIMD related method calls."   
)

◆ DEFINE_FLAG() [15/160]

dart::DEFINE_FLAG ( bool  ,
force_evacuation  ,
false  ,
"Force compaction to move every movable object"   
)

◆ DEFINE_FLAG() [16/160]

dart::DEFINE_FLAG ( bool  ,
force_indirect_calls  ,
false  ,
"Do not emit PC relative calls."   
)

◆ DEFINE_FLAG() [17/160]

dart::DEFINE_FLAG ( bool  ,
force_log_flush  ,
false  ,
"Always flush log messages."   
)

◆ DEFINE_FLAG() [18/160]

dart::DEFINE_FLAG ( bool  ,
gc_on_foc_slow_path  ,
false  ,
"Cause a GC when falling off the fast path for fast object copy."   
)

◆ DEFINE_FLAG() [19/160]

dart::DEFINE_FLAG ( bool  ,
identity_reload  ,
false  ,
"Enable checks for identity reload."   
)

◆ DEFINE_FLAG() [20/160]

dart::DEFINE_FLAG ( bool  ,
ignore_unrecognized_flags  ,
false  ,
"Ignore unrecognized flags."   
)

◆ DEFINE_FLAG() [21/160]

dart::DEFINE_FLAG ( bool  ,
include_inlining_info_in_disassembly  ,
true  ,
"Include inlining information when printing disassembly"   
)

Definition at line 28 of file disassembler.cc.

38 {
39 const int kHexColumnWidth = 23;
40#if defined(TARGET_ARCH_IS_32_BIT)
41 THR_Print("0x%" Px32 " %s", static_cast<uint32_t>(pc), hex_buffer);
42#else
43 THR_Print("0x%" Px64 " %s", static_cast<uint64_t>(pc), hex_buffer);
44#endif
45 int hex_length = strlen(hex_buffer);
46 if (hex_length < kHexColumnWidth) {
47 for (int i = kHexColumnWidth - hex_length; i > 0; i--) {
48 THR_Print(" ");
49 }
50 }
51 THR_Print("%s", human_buffer);
52 if (object != nullptr) {
53 THR_Print(" %s", object->ToCString());
54 }
55 THR_Print("\n");
56}
#define Px64
Definition globals.h:418

◆ DEFINE_FLAG() [22/160]

dart::DEFINE_FLAG ( bool  ,
intrinsify  ,
true  ,
"Instrinsify when possible"   
)

◆ DEFINE_FLAG() [23/160]

dart::DEFINE_FLAG ( bool  ,
load_cse  ,
true  ,
"Use redundant load elimination."   
)

◆ DEFINE_FLAG() [24/160]

dart::DEFINE_FLAG ( bool  ,
log_growth  ,
false  ,
"Log PageSpace growth policy decisions."   
)

◆ DEFINE_FLAG() [25/160]

dart::DEFINE_FLAG ( bool  ,
optimize_lazy_initializer_calls  ,
true  ,
"Eliminate redundant lazy initializer calls."   
)

◆ DEFINE_FLAG() [26/160]

dart::DEFINE_FLAG ( bool  ,
parse_flag_bool_test  ,
true  ,
"Flags::Parse (bool) testing"   
)

◆ DEFINE_FLAG() [27/160]

dart::DEFINE_FLAG ( bool  ,
print_class_table  ,
false  ,
"Print initial class table."   
)

◆ DEFINE_FLAG() [28/160]

dart::DEFINE_FLAG ( bool  ,
print_classes  ,
false  ,
"Prints details about loaded classes."   
)

◆ DEFINE_FLAG() [29/160]

dart::DEFINE_FLAG ( bool  ,
print_cluster_information  ,
false  ,
"Print information about clusters written to snapshot"   
)

◆ DEFINE_FLAG() [30/160]

dart::DEFINE_FLAG ( bool  ,
print_code_source_map  ,
false  ,
"Print code source map."   
)

◆ DEFINE_FLAG() [31/160]

dart::DEFINE_FLAG ( bool  ,
print_flags  ,
false  ,
"Print flags as they are being parsed."   
)

◆ DEFINE_FLAG() [32/160]

dart::DEFINE_FLAG ( bool  ,
print_flow_graph  ,
false  ,
"Print the IR flow graph."   
)

◆ DEFINE_FLAG() [33/160]

dart::DEFINE_FLAG ( bool  ,
print_flow_graph_optimized  ,
false  ,
"Print the IR flow graph when optimizing."   
)

◆ DEFINE_FLAG() [34/160]

dart::DEFINE_FLAG ( bool  ,
print_free_list_after_gc  ,
false  ,
"Print free list statistics after a GC"   
)

◆ DEFINE_FLAG() [35/160]

dart::DEFINE_FLAG ( bool  ,
print_free_list_before_gc  ,
false  ,
"Print free list statistics before a GC"   
)

◆ DEFINE_FLAG() [36/160]

dart::DEFINE_FLAG ( bool  ,
print_huge_methods  ,
false  ,
"Print huge methods (less optimized)"   
)

◆ DEFINE_FLAG() [37/160]

dart::DEFINE_FLAG ( bool  ,
print_ic_data_map  ,
false  ,
"Print the deopt-id to ICData map in optimizing compiler."   
)

◆ DEFINE_FLAG() [38/160]

dart::DEFINE_FLAG ( bool  ,
print_inlining_tree  ,
false  ,
"Print inlining tree"   
)

◆ DEFINE_FLAG() [39/160]

dart::DEFINE_FLAG ( bool  ,
print_metrics  ,
false  ,
"Print metrics when isolates (and the VM) are shutdown."   
)

◆ DEFINE_FLAG() [40/160]

dart::DEFINE_FLAG ( bool  ,
print_precompiler_timings  ,
false  ,
"Print per-phase breakdown of time spent precompiling"   
)

◆ DEFINE_FLAG() [41/160]

dart::DEFINE_FLAG ( bool  ,
print_stacktrace_at_throw  ,
false  ,
"Prints a stack trace everytime a throw occurs."   
)

◆ DEFINE_FLAG() [42/160]

dart::DEFINE_FLAG ( bool  ,
print_type_testing_stub_test_headers  ,
true  ,
"Print headers for executed type testing stub tests"   
)

◆ DEFINE_FLAG() [43/160]

dart::DEFINE_FLAG ( bool  ,
print_unique_targets  ,
false  ,
"Print unique dynamic targets"   
)

◆ DEFINE_FLAG() [44/160]

dart::DEFINE_FLAG ( bool  ,
profile_vm  ,
false  ,
"Always collect native stack traces."   
)

◆ DEFINE_FLAG() [45/160]

dart::DEFINE_FLAG ( bool  ,
profile_vm_allocation  ,
false  ,
"Collect native stack traces when tracing Dart allocations."   
)

◆ DEFINE_FLAG() [46/160]

dart::DEFINE_FLAG ( bool  ,
propagate_ic_data  ,
true  ,
"Propagate IC data from unoptimized to optimized IC calls."   
)

◆ DEFINE_FLAG() [47/160]

dart::DEFINE_FLAG ( bool  ,
prune_dead_locals  ,
true  ,
"optimize dead locals away"   
)

◆ DEFINE_FLAG() [48/160]

dart::DEFINE_FLAG ( bool  ,
reload_every_back_off  ,
false  ,
"Double the --reload-every value after each reload."   
)

◆ DEFINE_FLAG() [49/160]

dart::DEFINE_FLAG ( bool  ,
reload_every_optimized  ,
true  ,
"Only from optimized code."   
)

◆ DEFINE_FLAG() [50/160]

dart::DEFINE_FLAG ( bool  ,
reload_force_rollback  ,
false  ,
"Force all reloads to fail and rollback."   
)

◆ DEFINE_FLAG() [51/160]

dart::DEFINE_FLAG ( bool  ,
remove_redundant_phis  ,
true  ,
"Remove redundant phis."   
)

◆ DEFINE_FLAG() [52/160]

dart::DEFINE_FLAG ( bool  ,
remove_script_timestamps_for_test  ,
false  ,
"Remove script timestamps to allow for deterministic testing."   
)

◆ DEFINE_FLAG() [53/160]

dart::DEFINE_FLAG ( bool  ,
runtime_allocate_old  ,
false  ,
"Use old-space for allocation via runtime calls."   
)

◆ DEFINE_FLAG() [54/160]

dart::DEFINE_FLAG ( bool  ,
runtime_allocate_spill_tlab  ,
false  ,
"Ensure results of allocation via runtime calls are not in an " "active TLAB."   
)

◆ DEFINE_FLAG() [55/160]

dart::DEFINE_FLAG ( bool  ,
service_testing_flag  ,
false  ,
"Comment"   
)

◆ DEFINE_FLAG() [56/160]

dart::DEFINE_FLAG ( bool  ,
share_enclosing_context  ,
true  ,
"Allocate captured variables in the existing context of an " "enclosing scope (up to innermost loop) and spare the allocation " "of a local context."   
)

◆ DEFINE_FLAG() [57/160]

dart::DEFINE_FLAG ( bool  ,
show_internal_names  ,
false  ,
"Show names of internal classes (e.g. \"OneByteString\") in error messages " "instead of showing the corresponding interface names (e.g. \"String\"). " "Also show legacy nullability in type names."   
)

◆ DEFINE_FLAG() [58/160]

dart::DEFINE_FLAG ( bool  ,
silent_warnings  ,
false  ,
"Silence warnings."   
)

◆ DEFINE_FLAG() [59/160]

dart::DEFINE_FLAG ( bool  ,
source_lines  ,
false  ,
"Emit source line as assembly comment."   
)

◆ DEFINE_FLAG() [60/160]

dart::DEFINE_FLAG ( bool  ,
stop_on_excessive_deoptimization  ,
false  ,
"Debugging: stops program if deoptimizing same function too often"   
)

◆ DEFINE_FLAG() [61/160]

dart::DEFINE_FLAG ( bool  ,
stress_test_background_compilation  ,
false  ,
"Keep background compiler running all the time"   
)

◆ DEFINE_FLAG() [62/160]

dart::DEFINE_FLAG ( bool  ,
test_il_serialization  ,
false  ,
"Test IL serialization."   
)

◆ DEFINE_FLAG() [63/160]

dart::DEFINE_FLAG ( bool  ,
trace_bailout  ,
false  ,
"Print bailout from ssa compiler."   
)

◆ DEFINE_FLAG() [64/160]

dart::DEFINE_FLAG ( bool  ,
trace_class_finalization  ,
false  ,
"Trace class finalization."   
)

◆ DEFINE_FLAG() [65/160]

dart::DEFINE_FLAG ( bool  ,
trace_compiler  ,
false  ,
"Trace compiler operations."   
)

◆ DEFINE_FLAG() [66/160]

dart::DEFINE_FLAG ( bool  ,
trace_constant_propagation  ,
false  ,
"Print constant propagation and useless code elimination."   
)

◆ DEFINE_FLAG() [67/160]

dart::DEFINE_FLAG ( bool  ,
trace_debugger_stacktrace  ,
false  ,
"Trace debugger stacktrace collection"   
)

◆ DEFINE_FLAG() [68/160]

dart::DEFINE_FLAG ( bool  ,
trace_deoptimization  ,
false  ,
"Trace deoptimization"   
)

◆ DEFINE_FLAG() [69/160]

dart::DEFINE_FLAG ( bool  ,
trace_deoptimization_verbose  ,
false  ,
"Trace deoptimization verbose"   
)

◆ DEFINE_FLAG() [70/160]

dart::DEFINE_FLAG ( bool  ,
trace_failed_optimization_attempts  ,
false  ,
"Traces all failed optimization attempts"   
)

◆ DEFINE_FLAG() [71/160]

dart::DEFINE_FLAG ( bool  ,
trace_inlining  ,
false  ,
"Trace inlining"   
)

◆ DEFINE_FLAG() [72/160]

dart::DEFINE_FLAG ( bool  ,
trace_inlining_intervals  ,
false  ,
"Inlining interval diagnostics"   
)

◆ DEFINE_FLAG() [73/160]

dart::DEFINE_FLAG ( bool  ,
trace_integer_ir_selection  ,
false  ,
"Print integer IR selection optimization pass."   
)

◆ DEFINE_FLAG() [74/160]

dart::DEFINE_FLAG ( bool  ,
trace_intrinsifier  ,
false  ,
"Trace intrinsifier"   
)

◆ DEFINE_FLAG() [75/160]

dart::DEFINE_FLAG ( bool  ,
trace_kernel  ,
false  ,
"Trace Kernel service requests."   
)

◆ DEFINE_FLAG() [76/160]

dart::DEFINE_FLAG ( bool  ,
trace_load_optimization  ,
false  ,
"Print live sets for load optimization pass."   
)

◆ DEFINE_FLAG() [77/160]

dart::DEFINE_FLAG ( bool  ,
trace_optimizing_compiler  ,
false  ,
"Trace only optimizing compiler operations."   
)

◆ DEFINE_FLAG() [78/160]

dart::DEFINE_FLAG ( bool  ,
trace_osr  ,
false  ,
"Trace attempts at on-stack replacement."   
)

◆ DEFINE_FLAG() [79/160]

dart::DEFINE_FLAG ( bool  ,
trace_precompiler  ,
false  ,
"Trace precompiler."   
)

◆ DEFINE_FLAG() [80/160]

dart::DEFINE_FLAG ( bool  ,
trace_profiled_isolates  ,
false  ,
"Trace profiled isolates."   
)

◆ DEFINE_FLAG() [81/160]

dart::DEFINE_FLAG ( bool  ,
trace_range_analysis  ,
false  ,
"Trace range analysis progress"   
)

◆ DEFINE_FLAG() [82/160]

dart::DEFINE_FLAG ( bool  ,
trace_regexp_bytecodes  ,
false  ,
"trace_regexp_bytecodes"   
)

◆ DEFINE_FLAG() [83/160]

dart::DEFINE_FLAG ( bool  ,
trace_reload  ,
false  ,
"Trace isolate reloading"   
)

◆ DEFINE_FLAG() [84/160]

dart::DEFINE_FLAG ( bool  ,
trace_reload_verbose  ,
false  ,
"trace isolate reloading verbose"   
)

◆ DEFINE_FLAG() [85/160]

dart::DEFINE_FLAG ( bool  ,
trace_resolving  ,
false  ,
"Trace resolving."   
)

◆ DEFINE_FLAG() [86/160]

dart::DEFINE_FLAG ( bool  ,
trace_rewind  ,
false  ,
"Trace frame rewind"   
)

◆ DEFINE_FLAG() [87/160]

dart::DEFINE_FLAG ( bool  ,
trace_safepoint  ,
false  ,
"Trace Safepoint logic."   
)

◆ DEFINE_FLAG() [88/160]

dart::DEFINE_FLAG ( bool  ,
trace_service  ,
false  ,
"Trace VM service requests."   
)

◆ DEFINE_FLAG() [89/160]

dart::DEFINE_FLAG ( bool  ,
trace_service_pause_events  ,
false  ,
"Trace VM service isolate pause events."   
)

◆ DEFINE_FLAG() [90/160]

dart::DEFINE_FLAG ( bool  ,
trace_service_verbose  ,
false  ,
"Provide extra service tracing information."   
)

◆ DEFINE_FLAG() [91/160]

dart::DEFINE_FLAG ( bool  ,
trace_shutdown  ,
false  ,
"Trace VM shutdown on stderr"   
)

◆ DEFINE_FLAG() [92/160]

dart::DEFINE_FLAG ( bool  ,
trace_source_positions  ,
false  ,
"Source position diagnostics"   
)

◆ DEFINE_FLAG() [93/160]

dart::DEFINE_FLAG ( bool  ,
trace_thread_interrupter  ,
false  ,
"Trace thread interrupter"   
)

◆ DEFINE_FLAG() [94/160]

dart::DEFINE_FLAG ( bool  ,
trace_type_finalization  ,
false  ,
"Trace type finalization."   
)

◆ DEFINE_FLAG() [95/160]

dart::DEFINE_FLAG ( bool  ,
trace_type_propagation  ,
false  ,
"Trace flow graph type propagation"   
)

◆ DEFINE_FLAG() [96/160]

dart::DEFINE_FLAG ( bool  ,
trace_type_testing_stub_tests  ,
false  ,
"Trace type testing stub tests"   
)

◆ DEFINE_FLAG() [97/160]

dart::DEFINE_FLAG ( bool  ,
two_args_smi_icd  ,
true  ,
"Generate special IC stubs for two args Smi operations"   
)

◆ DEFINE_FLAG() [98/160]

dart::DEFINE_FLAG ( bool  ,
unopt_megamorphic_calls  ,
true  ,
"Enable specializing megamorphic calls from unoptimized code."   
)

◆ DEFINE_FLAG() [99/160]

dart::DEFINE_FLAG ( bool  ,
unopt_monomorphic_calls  ,
true  ,
"Enable specializing monomorphic calls from unoptimized code."   
)

◆ DEFINE_FLAG() [100/160]

dart::DEFINE_FLAG ( bool  ,
use_register_cc  ,
true  ,
"Use register calling conventions"   
)

◆ DEFINE_FLAG() [101/160]

dart::DEFINE_FLAG ( bool  ,
verbose_debug  ,
false  ,
"Verbose debugger messages"   
)

◆ DEFINE_FLAG() [102/160]

dart::DEFINE_FLAG ( bool  ,
verbose_stack_overflow  ,
false  ,
"Print additional details about stack overflow."   
)

◆ DEFINE_FLAG() [103/160]

dart::DEFINE_FLAG ( bool  ,
verify_acquired_data  ,
false  ,
"Verify correct API acquire/release of typed data."   
)

◆ DEFINE_FLAG() [104/160]

dart::DEFINE_FLAG ( bool  ,
warn_on_pause_with_no_debugger  ,
false  ,
"Print a message when an isolate is paused but there is no " "debugger attached."   
)

◆ DEFINE_FLAG() [105/160]

dart::DEFINE_FLAG ( bool  ,
warning_as_error  ,
false  ,
"Treat warnings as errors."   
)

◆ DEFINE_FLAG() [106/160]

dart::DEFINE_FLAG ( bool  ,
write_protect_code  ,
kShouldWriteProtectCodeByDefault  ,
"Write protect jitted code"   
)

◆ DEFINE_FLAG() [107/160]

dart::DEFINE_FLAG ( bool  ,
write_protect_vm_isolate  ,
true  ,
"Write protect vm_isolate."   
)

◆ DEFINE_FLAG() [108/160]

dart::DEFINE_FLAG ( charp  ,
deoptimize_filter  ,
nullptr  ,
"Deoptimize in named function on stack overflow checks"   
)

◆ DEFINE_FLAG() [109/160]

dart::DEFINE_FLAG ( charp  ,
deoptimize_on_runtime_call_name_filter  ,
nullptr  ,
"Runtime call name filter for --deoptimize-on-runtime-call-every."   
)

◆ DEFINE_FLAG() [110/160]

dart::DEFINE_FLAG ( charp  ,
entrypoint_test  ,
"main"  ,
"Testing: entrypoint"   
)

◆ DEFINE_FLAG() [111/160]

dart::DEFINE_FLAG ( charp  ,
inlining_filter  ,
nullptr  ,
"Inline only in named function"   
)

◆ DEFINE_FLAG() [112/160]

dart::DEFINE_FLAG ( charp  ,
isolate_log_filter  ,
nullptr  ,
"Log isolates whose name include the filter. " "Default: service isolate log messages are suppressed " "(specify 'vm-service' to log them)."   
)

◆ DEFINE_FLAG() [113/160]

dart::DEFINE_FLAG ( charp  ,
kernel_multiroot_filepaths  ,
nullptr  ,
"Comma-separated list of file paths that should be treated as roots" " by frontend compiler."   
)

◆ DEFINE_FLAG() [114/160]

dart::DEFINE_FLAG ( charp  ,
kernel_multiroot_scheme  ,
nullptr  ,
"URI scheme that replaces filepaths prefixes specified" " by kernel_multiroot_filepaths option"   
)

◆ DEFINE_FLAG() [115/160]

dart::DEFINE_FLAG ( charp  ,
log_service_response_sizes  ,
nullptr  ,
"Log sizes of service responses and events to a file in CSV format."   
)

◆ DEFINE_FLAG() [116/160]

dart::DEFINE_FLAG ( charp  ,
optimization_filter  ,
nullptr  ,
"Optimize only named function"   
)

◆ DEFINE_FLAG() [117/160]

dart::DEFINE_FLAG ( charp  ,
print_object_layout_to  ,
nullptr  ,
"Print layout of Dart objects to the given file"   
)

◆ DEFINE_FLAG() [118/160]

dart::DEFINE_FLAG ( charp  ,
redirect_isolate_log_to  ,
nullptr  ,
"Log isolate messages into the given file."   
)

◆ DEFINE_FLAG() [119/160]

dart::DEFINE_FLAG ( charp  ,
stacktrace_filter  ,
nullptr  ,
"Compute stacktrace in named function on stack overflow checks"   
)

◆ DEFINE_FLAG() [120/160]

dart::DEFINE_FLAG ( charp  ,
string_opt_test  ,
nullptr  ,
"Testing: string option."   
)

◆ DEFINE_FLAG() [121/160]

dart::DEFINE_FLAG ( charp  ,
vm_name  ,
"vm"  ,
"The default name of this vm as reported by the VM service " "protocol"   
)

◆ DEFINE_FLAG() [122/160]

dart::DEFINE_FLAG ( charp  ,
write_retained_reasons_to  ,
nullptr  ,
"Print reasons for retaining objects to the given file"   
)

◆ DEFINE_FLAG() [123/160]

dart::DEFINE_FLAG ( int  ,
counter  ,
100  ,
"Testing: int flag"   
)

◆ DEFINE_FLAG() [124/160]

dart::DEFINE_FLAG ( int  ,
deoptimization_counter_inlining_threshold  ,
12  ,
"How many times we allow deoptimization before we stop inlining."   
)

◆ DEFINE_FLAG() [125/160]

dart::DEFINE_FLAG ( int  ,
early_tenuring_threshold  ,
66  ,
"When more than this percentage of promotion candidates  survive,
" "promote all survivors of next scavenge."   
)

◆ DEFINE_FLAG() [126/160]

dart::DEFINE_FLAG ( int  ,
force_log_flush_at_size  ,
,
"Flush log messages when buffer exceeds given size (disabled when 0)."   
)

◆ DEFINE_FLAG() [127/160]

dart::DEFINE_FLAG ( int  ,
force_switch_dispatch_type  ,
1,
"Force switch statements to use a particular dispatch type: " "-  1 = auto,
= linear scan,
= binary search 
)

◆ DEFINE_FLAG() [128/160]

dart::DEFINE_FLAG ( int  ,
gc_every  ,
,
"Run major GC on every N stack overflow checks"   
)

◆ DEFINE_FLAG() [129/160]

dart::DEFINE_FLAG ( int  ,
inline_getters_setters_smaller_than  ,
10  ,
"Always inline getters and setters that have fewer instructions"   
)

◆ DEFINE_FLAG() [130/160]

dart::DEFINE_FLAG ( int  ,
inlining_callee_call_sites_threshold  ,
,
"Always inline functions containing threshold or fewer calls."   
)

◆ DEFINE_FLAG() [131/160]

dart::DEFINE_FLAG ( int  ,
inlining_callee_size_threshold  ,
160  ,
"Do not inline callees larger than threshold"   
)

◆ DEFINE_FLAG() [132/160]

dart::DEFINE_FLAG ( int  ,
inlining_caller_size_threshold  ,
50000  ,
"Stop inlining once caller reaches the threshold."   
)

◆ DEFINE_FLAG() [133/160]

dart::DEFINE_FLAG ( int  ,
inlining_depth_threshold  ,
,
"Inline function calls up to threshold nesting depth"   
)

◆ DEFINE_FLAG() [134/160]

dart::DEFINE_FLAG ( int  ,
inlining_hotness  ,
10  ,
"Inline only hotter  calls,
in percents(0 .. 100);" "default 10%:calls above-equal 10% of max-count are inlined."   
)

◆ DEFINE_FLAG() [135/160]

dart::DEFINE_FLAG ( int  ,
inlining_recursion_depth_threshold  ,
,
"Inline recursive function calls up to threshold recursion depth."   
)

◆ DEFINE_FLAG() [136/160]

dart::DEFINE_FLAG ( int  ,
inlining_size_threshold  ,
25  ,
"Always inline functions that have threshold or fewer instructions"   
)

◆ DEFINE_FLAG() [137/160]

dart::DEFINE_FLAG ( int  ,
inlining_small_leaf_size_threshold  ,
50  ,
"Do not inline leaf callees larger than threshold"   
)

◆ DEFINE_FLAG() [138/160]

dart::DEFINE_FLAG ( int  ,
max_deoptimization_counter_threshold  ,
16  ,
"How many times we allow deoptimization before we disallow optimization."   
)

◆ DEFINE_FLAG() [139/160]

dart::DEFINE_FLAG ( int  ,
max_exhaustive_polymorphic_checks  ,
,
"If a call receiver is known to be of at most this many  classes,
" "generate exhaustive class tests instead of a megamorphic call"   
)

◆ DEFINE_FLAG() [140/160]

dart::DEFINE_FLAG ( int  ,
max_inlined_per_depth  ,
500  ,
"Max. number of inlined calls per depth"   
)

◆ DEFINE_FLAG() [141/160]

dart::DEFINE_FLAG ( int  ,
max_profile_depth  ,
Sample::kPCArraySizeInWords kMaxSamplesPerTick,
"Maximum number stack frames walked. Minimum 1. Maximum 255."   
)

◆ DEFINE_FLAG() [142/160]

dart::DEFINE_FLAG ( int  ,
max_speculative_inlining_attempts  ,
,
"Max number of attempts with speculative inlining (precompilation only)"   
)

◆ DEFINE_FLAG() [143/160]

dart::DEFINE_FLAG ( int  ,
max_subtype_cache_entries  ,
kDefaultMaxSubtypeCacheEntries  ,
"Maximum number of subtype cache entries (number of checks cached)."   
)

◆ DEFINE_FLAG() [144/160]

dart::DEFINE_FLAG ( int  ,
min_optimization_counter_threshold  ,
5000  ,
"The minimum invocation count for a function."   
)

◆ DEFINE_FLAG() [145/160]

dart::DEFINE_FLAG ( int  ,
new_gen_garbage_threshold  ,
90  ,
"Grow new gen when less than this percentage is garbage."   
)

◆ DEFINE_FLAG() [146/160]

dart::DEFINE_FLAG ( int  ,
new_gen_growth_factor  ,
,
"Grow new gen by this factor."   
)

◆ DEFINE_FLAG() [147/160]

dart::DEFINE_FLAG ( int  ,
old_gen_growth_rate  ,
280  ,
"The max number of pages the old generation can grow at a time"   
)

◆ DEFINE_FLAG() [148/160]

dart::DEFINE_FLAG ( int  ,
old_gen_growth_space_ratio  ,
20  ,
"The desired maximum percentage of free space after old gen GC"   
)

◆ DEFINE_FLAG() [149/160]

dart::DEFINE_FLAG ( int  ,
old_gen_growth_time_ratio  ,
,
"The desired maximum percentage of time spent in old gen GC"   
)

◆ DEFINE_FLAG() [150/160]

dart::DEFINE_FLAG ( int  ,
optimization_counter_scale  ,
2000  ,
"The scale of invocation  count,
by size of the function."   
)

◆ DEFINE_FLAG() [151/160]

dart::DEFINE_FLAG ( int  ,
profile_period  ,
1000  ,
"Time between profiler samples in microseconds. Minimum 50."   
)

◆ DEFINE_FLAG() [152/160]

dart::DEFINE_FLAG ( int  ,
regexp_backtrack_stack_size_kb  ,
256  ,
"Size of backtracking stack"   
)

◆ DEFINE_FLAG() [153/160]

dart::DEFINE_FLAG ( int  ,
regexp_optimization_counter_threshold  ,
1000  ,
"RegExp's usage-counter value before it is  optimized,
-1 means never"   
)

◆ DEFINE_FLAG() [154/160]

dart::DEFINE_FLAG ( int  ,
reload_every  ,
,
"Reload every N stack overflow checks."   
)

◆ DEFINE_FLAG() [155/160]

dart::DEFINE_FLAG ( int  ,
reoptimization_counter_threshold  ,
4000  ,
"Counter threshold before a function gets reoptimized."   
)

◆ DEFINE_FLAG() [156/160]

dart::DEFINE_FLAG ( int  ,
sample_buffer_duration  ,
,
"Defines the size of the profiler sample buffer to contain at least " "N seconds of samples at a given sample rate. If not  provided,
the " "default is ~4 seconds. Large values will greatly increase memory " "consumption."   
)

◆ DEFINE_FLAG() [157/160]

dart::DEFINE_FLAG ( int  ,
stacktrace_every  ,
,
"Compute debugger stacktrace on every N stack overflow checks"   
)

◆ DEFINE_FLAG() [158/160]

dart::DEFINE_FLAG ( int  ,
worker_timeout_millis  ,
5000  ,
"Free workers when they have been idle for this amount of time."   
)

◆ DEFINE_FLAG() [159/160]

dart::DEFINE_FLAG ( uint64_t  ,
huge_method_cutoff_in_code_size  ,
200000  ,
"Huge method cutoff in unoptimized code size (in bytes)."   
)

◆ DEFINE_FLAG() [160/160]

dart::DEFINE_FLAG ( uint64_t  ,
random_seed  ,
,
"Override the random seed for debugging."   
)

◆ DEFINE_FLAG_HANDLER() [1/3]

dart::DEFINE_FLAG_HANDLER ( DeterministicModeHandler  ,
deterministic  ,
"Enable deterministic mode."   
)

◆ DEFINE_FLAG_HANDLER() [2/3]

dart::DEFINE_FLAG_HANDLER ( DwarfStackTracesHandler  ,
dwarf_stack_traces  ,
"Omit CodeSourceMaps in precompiled snapshots and don't " "symbolize stack traces in the precompiled runtime."   
)

◆ DEFINE_FLAG_HANDLER() [3/3]

dart::DEFINE_FLAG_HANDLER ( PrecompilationModeHandler  ,
precompilation  ,
"Precompilation mode"   
)

◆ DEFINE_LEAF_RUNTIME_ENTRY() [1/7]

dart::DEFINE_LEAF_RUNTIME_ENTRY ( bool  ,
TryDoubleAsInteger  ,
,
Thread thread 
)

Definition at line 3549 of file runtime_entry.cc.

3549 {
3550 double value = thread->unboxed_double_runtime_arg();
3551 int64_t int_value = static_cast<int64_t>(value);
3552 double converted_double = static_cast<double>(int_value);
3553 if (converted_double != value) {
3554 return false;
3555 }
3556 thread->set_unboxed_int64_runtime_arg(int_value);
3557 return true;
3558}
void set_unboxed_int64_runtime_arg(int64_t value)
Definition thread.h:815
double unboxed_double_runtime_arg() const
Definition thread.h:824

◆ DEFINE_LEAF_RUNTIME_ENTRY() [2/7]

END_LEAF_RUNTIME_ENTRY dart::DEFINE_LEAF_RUNTIME_ENTRY ( intptr_t  ,
DeoptimizeCopyFrame  ,
,
uword  saved_registers_address,
uword  is_lazy_deopt 
)

Definition at line 3566 of file runtime_entry.cc.

3570 {
3571#if !defined(DART_PRECOMPILED_RUNTIME)
3572 Thread* thread = Thread::Current();
3573 Isolate* isolate = thread->isolate();
3574 StackZone zone(thread);
3575
3576 // All registers have been saved below last-fp as if they were locals.
3577 const uword last_fp =
3578 saved_registers_address + (kNumberOfSavedCpuRegisters * kWordSize) +
3579 (kNumberOfSavedFpuRegisters * kFpuRegisterSize) -
3580 ((runtime_frame_layout.first_local_from_fp + 1) * kWordSize);
3581
3582 // Get optimized code and frame that need to be deoptimized.
3583 DartFrameIterator iterator(last_fp, thread,
3584 StackFrameIterator::kNoCrossThreadIteration);
3585
3586 StackFrame* caller_frame = iterator.NextFrame();
3587 ASSERT(caller_frame != nullptr);
3588 const Code& optimized_code = Code::Handle(caller_frame->LookupDartCode());
3589 ASSERT(optimized_code.is_optimized());
3590 const Function& top_function =
3591 Function::Handle(thread->zone(), optimized_code.function());
3592 const bool deoptimizing_code = top_function.HasOptimizedCode();
3593 if (FLAG_trace_deoptimization) {
3594 const Function& function = Function::Handle(optimized_code.function());
3595 THR_Print("== Deoptimizing code for '%s', %s, %s\n",
3596 function.ToFullyQualifiedCString(),
3597 deoptimizing_code ? "code & frame" : "frame",
3598 (is_lazy_deopt != 0u) ? "lazy-deopt" : "");
3599 }
3600
3601 if (is_lazy_deopt != 0u) {
3602 const uword deopt_pc =
3603 thread->pending_deopts().FindPendingDeopt(caller_frame->fp());
3604
3605 // N.B.: Update frame before updating pending deopt table. The profiler
3606 // may attempt a stack walk in between.
3607 caller_frame->set_pc(deopt_pc);
3608 ASSERT(caller_frame->pc() == deopt_pc);
3609 ASSERT(optimized_code.ContainsInstructionAt(caller_frame->pc()));
3611 caller_frame->fp(), PendingDeopts::kClearDueToDeopt);
3612 } else {
3613 if (FLAG_trace_deoptimization) {
3614 THR_Print("Eager deopt fp=%" Pp " pc=%" Pp "\n", caller_frame->fp(),
3615 caller_frame->pc());
3616 }
3617 }
3618
3619 // Copy the saved registers from the stack.
3620 fpu_register_t* fpu_registers;
3621 intptr_t* cpu_registers;
3622 CopySavedRegisters(saved_registers_address, &fpu_registers, &cpu_registers);
3623
3624 // Create the DeoptContext.
3625 DeoptContext* deopt_context = new DeoptContext(
3626 caller_frame, optimized_code, DeoptContext::kDestIsOriginalFrame,
3627 fpu_registers, cpu_registers, is_lazy_deopt != 0, deoptimizing_code);
3628 isolate->set_deopt_context(deopt_context);
3629
3630 // Stack size (FP - SP) in bytes.
3631 return deopt_context->DestStackAdjustment() * kWordSize;
3632#else
3633 UNREACHABLE();
3634 return 0;
3635#endif // !DART_PRECOMPILED_RUNTIME
3636}
FunctionPtr function() const
Definition object.h:7101
bool is_optimized() const
Definition object.h:6790
bool ContainsInstructionAt(uword addr) const
Definition object.h:6888
bool HasOptimizedCode() const
Definition object.cc:11032
void set_deopt_context(DeoptContext *value)
Definition isolate.h:1209
uword FindPendingDeopt(uword fp)
void ClearPendingDeoptsAtOrBelow(uword fp, ClearReason reason)
uword pc() const
Definition stack_frame.h:43
CodePtr LookupDartCode() const
void set_pc(uword value)
Definition stack_frame.h:72
uword fp() const
Definition stack_frame.h:42
static void CopySavedRegisters(uword saved_registers_address, fpu_register_t **fpu_registers, intptr_t **cpu_registers)
static constexpr intptr_t kNumberOfSavedCpuRegisters
FrameLayout runtime_frame_layout
constexpr intptr_t kWordSize
Definition globals.h:509
simd128_value_t fpu_register_t
#define Pp
Definition globals.h:425
intptr_t first_local_from_fp

◆ DEFINE_LEAF_RUNTIME_ENTRY() [3/7]

dart::DEFINE_LEAF_RUNTIME_ENTRY ( uword  ,
EnsureRememberedAndMarkingDeferred  ,
,
uword  object_in,
Thread thread 
)

Definition at line 557 of file runtime_entry.cc.

561 {
562 ObjectPtr object = static_cast<ObjectPtr>(object_in);
563
564 // If we eliminate a generational write barriers on allocations of an object
565 // we need to ensure it's either a new-space object or it has been added to
566 // the remembered set.
567 //
568 // NOTE: We use static_cast<>() instead of ::RawCast() to avoid handle
569 // allocations in debug mode. Handle allocations in leaf runtimes can cause
570 // memory leaks because they will allocate into a handle scope from the next
571 // outermost runtime code (to which the generated Dart code might not return
572 // in a long time).
573 bool add_to_remembered_set = true;
574 if (object->IsNewObject()) {
575 add_to_remembered_set = false;
576 } else if (object->IsArray()) {
577 const intptr_t length = Array::LengthOf(static_cast<ArrayPtr>(object));
578 add_to_remembered_set =
579 compiler::target::WillAllocateNewOrRememberedArray(length);
580 } else if (object->IsContext()) {
581 const intptr_t num_context_variables =
582 Context::NumVariables(static_cast<ContextPtr>(object));
583 add_to_remembered_set =
584 compiler::target::WillAllocateNewOrRememberedContext(
585 num_context_variables);
586 }
587
588 if (add_to_remembered_set) {
589 object->untag()->EnsureInRememberedSet(thread);
590 }
591
592 // For incremental write barrier elimination, we need to ensure that the
593 // allocation ends up in the new space or else the object needs to added
594 // to deferred marking stack so it will be [re]scanned.
595 if (thread->is_marking()) {
596 thread->DeferredMarkingStackAddObject(object);
597 }
598
599 return static_cast<uword>(object);
600}
void DeferredMarkingStackAddObject(ObjectPtr obj)
Definition thread.cc:833
bool is_marking() const
Definition thread.h:669

◆ DEFINE_LEAF_RUNTIME_ENTRY() [4/7]

END_LEAF_RUNTIME_ENTRY dart::DEFINE_LEAF_RUNTIME_ENTRY ( void  ,
DeoptimizeFillFrame  ,
,
uword  last_fp 
)

Definition at line 3641 of file runtime_entry.cc.

3641 {
3642#if !defined(DART_PRECOMPILED_RUNTIME)
3643 Thread* thread = Thread::Current();
3644 Isolate* isolate = thread->isolate();
3645 StackZone zone(thread);
3646
3647 DeoptContext* deopt_context = isolate->deopt_context();
3648 DartFrameIterator iterator(last_fp, thread,
3649 StackFrameIterator::kNoCrossThreadIteration);
3650 StackFrame* caller_frame = iterator.NextFrame();
3651 ASSERT(caller_frame != nullptr);
3652
3653#if defined(DEBUG)
3654 {
3655 // The code from the deopt_context.
3656 const Code& code = Code::Handle(deopt_context->code());
3657
3658 // The code from our frame.
3659 const Code& optimized_code = Code::Handle(caller_frame->LookupDartCode());
3660 const Function& function = Function::Handle(optimized_code.function());
3661 ASSERT(!function.IsNull());
3662
3663 // The code will be the same as before.
3664 ASSERT(code.ptr() == optimized_code.ptr());
3665
3666 // Some sanity checking of the optimized code.
3667 ASSERT(!optimized_code.IsNull() && optimized_code.is_optimized());
3668 }
3669#endif
3670
3671 deopt_context->set_dest_frame(caller_frame);
3672 deopt_context->FillDestFrame();
3673
3674#else
3675 UNREACHABLE();
3676#endif // !DART_PRECOMPILED_RUNTIME
3677}
void set_dest_frame(const StackFrame *frame)
DeoptContext * deopt_context() const
Definition isolate.h:1208

◆ DEFINE_LEAF_RUNTIME_ENTRY() [5/7]

END_LEAF_RUNTIME_ENTRY dart::DEFINE_LEAF_RUNTIME_ENTRY ( void  ,
MarkingStackBlockProcess  ,
,
Thread thread 
)

Definition at line 18 of file pointer_block.cc.

18 {
20}
void MarkingStackBlockProcess()
Definition thread.cc:816

◆ DEFINE_LEAF_RUNTIME_ENTRY() [6/7]

dart::DEFINE_LEAF_RUNTIME_ENTRY ( void  ,
RememberCard  ,
,
uword  object_in,
ObjectPtr slot 
)

Definition at line 763 of file raw_object.cc.

767 {
768 ObjectPtr object = static_cast<ObjectPtr>(object_in);
769 ASSERT(object->IsOldObject());
770 ASSERT(object->untag()->IsCardRemembered());
771 Page::Of(object)->RememberCard(slot);
772}
bool IsCardRemembered() const
Definition raw_object.h:364

◆ DEFINE_LEAF_RUNTIME_ENTRY() [7/7]

dart::DEFINE_LEAF_RUNTIME_ENTRY ( void  ,
StoreBufferBlockProcess  ,
,
Thread thread 
)

Definition at line 13 of file pointer_block.cc.

13 {
14 thread->StoreBufferBlockProcess(StoreBuffer::kCheckThreshold);
15}
void StoreBufferBlockProcess(StoreBuffer::ThresholdPolicy policy)
Definition thread.cc:786

◆ DEFINE_MAKE_LOCATION_SUMMARY_SPECIALIZATION() [1/5]

template<typename Instr , typename Out , typename T0 >
dart::DEFINE_MAKE_LOCATION_SUMMARY_SPECIALIZATION ( ,
(T0  
)

◆ DEFINE_MAKE_LOCATION_SUMMARY_SPECIALIZATION() [2/5]

template<typename Instr , typename Out , typename T0 , typename T1 >
dart::DEFINE_MAKE_LOCATION_SUMMARY_SPECIALIZATION ( ,
(T0, T1  
)

◆ DEFINE_MAKE_LOCATION_SUMMARY_SPECIALIZATION() [3/5]

template<typename Instr , typename Out , typename T0 , typename T1 , typename T2 >
dart::DEFINE_MAKE_LOCATION_SUMMARY_SPECIALIZATION ( ,
(T0, T1, T2  
)

◆ DEFINE_MAKE_LOCATION_SUMMARY_SPECIALIZATION() [4/5]

template<typename Instr , typename Out , typename T0 , typename T1 , typename T2 , typename T3 >
dart::DEFINE_MAKE_LOCATION_SUMMARY_SPECIALIZATION ( ,
(T0, T1, T2, T3  
)

◆ DEFINE_MAKE_LOCATION_SUMMARY_SPECIALIZATION() [5/5]

template<typename Instr , typename Out , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 >
dart::DEFINE_MAKE_LOCATION_SUMMARY_SPECIALIZATION ( ,
(T0, T1, T2, T3, T4  
)

◆ DEFINE_NATIVE_ENTRY() [1/345]

dart::DEFINE_NATIVE_ENTRY ( AbstractType_equality  ,
,
 
)

Definition at line 247 of file object.cc.

247 {
248 const AbstractType& type =
249 AbstractType::CheckedHandle(zone, arguments->NativeArgAt(0));
250 const Instance& other =
251 Instance::CheckedHandle(zone, arguments->NativeArgAt(1));
252 if (type.ptr() == other.ptr()) {
253 return Bool::True().ptr();
254 }
255 return Bool::Get(type.IsEquivalent(other, TypeEquality::kSyntactical)).ptr();
256}

◆ DEFINE_NATIVE_ENTRY() [2/345]

dart::DEFINE_NATIVE_ENTRY ( AbstractType_getHashCode  ,
,
 
)

Definition at line 238 of file object.cc.

238 {
239 const AbstractType& type =
240 AbstractType::CheckedHandle(zone, arguments->NativeArgAt(0));
241 intptr_t hash_val = type.Hash();
242 ASSERT(hash_val > 0);
243 ASSERT(Smi::IsValid(hash_val));
244 return Smi::New(hash_val);
245}

◆ DEFINE_NATIVE_ENTRY() [3/345]

dart::DEFINE_NATIVE_ENTRY ( AbstractType_toString  ,
,
 
)

Definition at line 232 of file object.cc.

232 {
233 const AbstractType& type =
234 AbstractType::CheckedHandle(zone, arguments->NativeArgAt(0));
235 return type.UserVisibleName();
236}

◆ DEFINE_NATIVE_ENTRY() [4/345]

dart::DEFINE_NATIVE_ENTRY ( AssertionError_throwNew  ,
,
 
)

Definition at line 67 of file errors.cc.

67 {
68 // No need to type check the arguments. This function can only be called
69 // internally from the VM.
70 const TokenPosition assertion_start = TokenPosition::Deserialize(
71 Smi::CheckedHandle(zone, arguments->NativeArgAt(0)).Value());
72 const TokenPosition assertion_end = TokenPosition::Deserialize(
73 Smi::CheckedHandle(zone, arguments->NativeArgAt(1)).Value());
74
75 const Instance& message =
76 Instance::CheckedHandle(zone, arguments->NativeArgAt(2));
77 const Array& args = Array::Handle(zone, Array::New(5));
78
79 DartFrameIterator iterator(thread,
80 StackFrameIterator::kNoCrossThreadIteration);
81 iterator.NextFrame(); // Skip native call.
82 const Script& script = Script::Handle(FindScript(&iterator));
83
84 // Initialize argument 'failed_assertion' with source snippet.
85 auto& condition_text = String::Handle();
86 // Extract the assertion condition text (if source is available).
87 intptr_t from_line = -1, from_column = -1;
88 String& url = String::Handle();
89 if (!script.IsNull()) {
90 if (script.GetTokenLocation(assertion_start, &from_line, &from_column)) {
91 // Extract the assertion condition text (if source is available).
92 intptr_t to_line, to_column;
93 script.GetTokenLocation(assertion_end, &to_line, &to_column);
94 condition_text =
95 script.GetSnippet(from_line, from_column, to_line, to_column);
96 }
97 url = script.url();
98 }
99 if (condition_text.IsNull()) {
100 condition_text = Symbols::OptimizedOut().ptr();
101 }
102 args.SetAt(0, condition_text);
103
104 // Initialize location arguments starting at position 1.
105 args.SetAt(1, url);
106 args.SetAt(2, Smi::Handle(Smi::New(from_line)));
107 args.SetAt(3, Smi::Handle(Smi::New(from_column)));
108 args.SetAt(4, message);
109
110 Exceptions::ThrowByType(Exceptions::kAssertion, args);
111 UNREACHABLE();
112 return Object::null();
113}
static ScriptPtr FindScript(DartFrameIterator *iterator)
Definition errors.cc:16

◆ DEFINE_NATIVE_ENTRY() [5/345]

dart::DEFINE_NATIVE_ENTRY ( AssertionError_throwNewSource  ,
,
 
)

Definition at line 122 of file errors.cc.

122 {
123 // No need to type check the arguments. This function can only be called
124 // internally from the VM.
125 const String& failed_assertion =
126 String::CheckedHandle(zone, arguments->NativeArgAt(0));
127 const String& script_url =
128 String::CheckedHandle(zone, arguments->NativeArgAt(1));
129 const intptr_t line =
130 Smi::CheckedHandle(zone, arguments->NativeArgAt(2)).Value();
131 const intptr_t column =
132 Smi::CheckedHandle(zone, arguments->NativeArgAt(3)).Value();
133 const Instance& message =
134 Instance::CheckedHandle(zone, arguments->NativeArgAt(4));
135
136 const Array& args = Array::Handle(zone, Array::New(5));
137
138 args.SetAt(0, failed_assertion);
139 args.SetAt(1, script_url);
140 args.SetAt(2, Smi::Handle(zone, Smi::New(line)));
141 args.SetAt(3, Smi::Handle(zone, Smi::New(column)));
142 args.SetAt(4, message);
143
144 Exceptions::ThrowByType(Exceptions::kAssertion, args);
145 UNREACHABLE();
146 return Object::null();
147}

◆ DEFINE_NATIVE_ENTRY() [6/345]

dart::DEFINE_NATIVE_ENTRY ( AsyncStarMoveNext_debuggerStepCheck  ,
,
 
)

Definition at line 14 of file async.cc.

14 {
15#if !defined(PRODUCT)
16 GET_NON_NULL_NATIVE_ARGUMENT(Closure, generator, arguments->NativeArgAt(0));
17 Debugger* debugger = isolate->debugger();
18 if (debugger != nullptr && debugger->IsSingleStepping()) {
19 debugger->AsyncStepInto(generator);
20 }
21#endif
22 return Object::null();
23}
void AsyncStepInto(const Closure &awaiter)
Definition debugger.cc:4142
bool IsSingleStepping() const
Definition debugger.h:712
#define GET_NON_NULL_NATIVE_ARGUMENT(type, name, value)

◆ DEFINE_NATIVE_ENTRY() [7/345]

dart::DEFINE_NATIVE_ENTRY ( Bool_fromEnvironment  ,
,
 
)

Definition at line 19 of file bool.cc.

19 {
20 GET_NON_NULL_NATIVE_ARGUMENT(String, name, arguments->NativeArgAt(1));
21 GET_NATIVE_ARGUMENT(Bool, default_value, arguments->NativeArgAt(2));
22 // Call the embedder to supply us with the environment.
23 const String& env_value =
24 String::Handle(Api::GetEnvironmentValue(thread, name));
25 if (!env_value.IsNull()) {
26 if (Symbols::True().Equals(env_value)) {
27 return Bool::True().ptr();
28 }
29 if (Symbols::False().Equals(env_value)) {
30 return Bool::False().ptr();
31 }
32 }
33 return default_value.ptr();
34}
#define GET_NATIVE_ARGUMENT(type, name, value)

◆ DEFINE_NATIVE_ENTRY() [8/345]

dart::DEFINE_NATIVE_ENTRY ( Bool_hasEnvironment  ,
,
 
)

Definition at line 36 of file bool.cc.

36 {
37 GET_NON_NULL_NATIVE_ARGUMENT(String, name, arguments->NativeArgAt(1));
38 // Call the embedder to supply us with the environment.
39 const String& env_value =
40 String::Handle(Api::GetEnvironmentValue(thread, name));
41 if (!env_value.IsNull()) {
42 return Bool::True().ptr();
43 }
44 return Bool::False().ptr();
45}

◆ DEFINE_NATIVE_ENTRY() [9/345]

dart::DEFINE_NATIVE_ENTRY ( Capability_equals  ,
,
 
)

Definition at line 45 of file isolate.cc.

45 {
46 GET_NON_NULL_NATIVE_ARGUMENT(Capability, recv, arguments->NativeArgAt(0));
47 GET_NON_NULL_NATIVE_ARGUMENT(Capability, other, arguments->NativeArgAt(1));
48 return (recv.Id() == other.Id()) ? Bool::True().ptr() : Bool::False().ptr();
49}

◆ DEFINE_NATIVE_ENTRY() [10/345]

dart::DEFINE_NATIVE_ENTRY ( Capability_factory  ,
,
 
)

Definition at line 34 of file isolate.cc.

34 {
35 ASSERT(
36 TypeArguments::CheckedHandle(zone, arguments->NativeArgAt(0)).IsNull());
37 // Keep capability IDs less than 2^53 so web clients of the service
38 // protocol can process it properly.
39 //
40 // See https://github.com/dart-lang/sdk/issues/53081.
41 uint64_t id = isolate->random()->NextJSInt();
42 return Capability::New(id);
43}

◆ DEFINE_NATIVE_ENTRY() [11/345]

dart::DEFINE_NATIVE_ENTRY ( Capability_get_hashcode  ,
,
 
)

Definition at line 51 of file isolate.cc.

51 {
52 GET_NON_NULL_NATIVE_ARGUMENT(Capability, cap, arguments->NativeArgAt(0));
53 int64_t id = cap.Id();
54 int32_t hi = static_cast<int32_t>(id >> 32);
55 int32_t lo = static_cast<int32_t>(id);
56 int32_t hash = (hi ^ lo) & kSmiMax;
57 return Smi::New(hash);
58}
const uintptr_t id

◆ DEFINE_NATIVE_ENTRY() [12/345]

dart::DEFINE_NATIVE_ENTRY ( ClassMirror_constructors  ,
,
 
)

Definition at line 1069 of file mirrors.cc.

1069 {
1071 arguments->NativeArgAt(0));
1072 GET_NATIVE_ARGUMENT(AbstractType, owner_instantiator,
1073 arguments->NativeArgAt(1));
1074 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(2));
1075 const Class& klass = Class::Handle(ref.GetClassReferent());
1076
1077 const Error& error = Error::Handle(klass.EnsureIsFinalized(thread));
1078 if (!error.IsNull()) {
1079 Exceptions::PropagateError(error);
1080 }
1081
1082 const Array& functions = Array::Handle(klass.current_functions());
1083 const intptr_t num_functions = functions.Length();
1084
1085 Instance& constructor_mirror = Instance::Handle();
1086 const GrowableObjectArray& constructor_mirrors =
1087 GrowableObjectArray::Handle(GrowableObjectArray::New(num_functions));
1088
1089 Function& func = Function::Handle();
1090 for (intptr_t i = 0; i < num_functions; i++) {
1091 func ^= functions.At(i);
1092 if (func.is_reflectable() &&
1093 func.kind() == UntaggedFunction::kConstructor) {
1094 constructor_mirror =
1095 CreateMethodMirror(func, owner_mirror, owner_instantiator);
1096 constructor_mirrors.Add(constructor_mirror);
1097 }
1098 }
1099
1100 return constructor_mirrors.ptr();
1101}
ErrorPtr EnsureIsFinalized(Thread *thread) const
Definition object.cc:4979
ArrayPtr current_functions() const
Definition object.h:1643

◆ DEFINE_NATIVE_ENTRY() [13/345]

dart::DEFINE_NATIVE_ENTRY ( ClassMirror_interfaces  ,
,
 
)

Definition at line 944 of file mirrors.cc.

944 {
945 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, type, arguments->NativeArgAt(0));
946 ASSERT(type.IsFinalized());
947 const Class& cls = Class::Handle(
948 type.IsFunctionType()
949 ? IsolateGroup::Current()->object_store()->closure_class()
950 : type.type_class());
951 const Error& error = Error::Handle(cls.EnsureIsFinalized(thread));
952 if (!error.IsNull()) {
953 Exceptions::PropagateError(error);
954 }
955
956 return cls.interfaces();
957}

◆ DEFINE_NATIVE_ENTRY() [14/345]

dart::DEFINE_NATIVE_ENTRY ( ClassMirror_interfaces_instantiated  ,
,
 
)

Definition at line 959 of file mirrors.cc.

959 {
960 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, type, arguments->NativeArgAt(0));
961 ASSERT(type.IsFinalized());
962 const Class& cls = Class::Handle(
963 type.IsFunctionType()
964 ? IsolateGroup::Current()->object_store()->closure_class()
965 : type.type_class());
966 const Error& error = Error::Handle(cls.EnsureIsFinalized(thread));
967 if (!error.IsNull()) {
968 Exceptions::PropagateError(error);
969 }
970
971 Array& interfaces = Array::Handle(cls.interfaces());
972 Array& interfaces_inst = Array::Handle(Array::New(interfaces.Length()));
973 AbstractType& interface = AbstractType::Handle();
974
975 for (int i = 0; i < interfaces.Length(); i++) {
976 interface ^= interfaces.At(i);
977 interface = InstantiateType(interface, type);
978 interfaces_inst.SetAt(i, interface);
979 }
980
981 return interfaces_inst.ptr();
982}

◆ DEFINE_NATIVE_ENTRY() [15/345]

dart::DEFINE_NATIVE_ENTRY ( ClassMirror_invoke  ,
,
 
)

Definition at line 1302 of file mirrors.cc.

1302 {
1303 // Argument 0 is the mirror, which is unused by the native. It exists
1304 // because this native is an instance method in order to be polymorphic
1305 // with its cousins.
1306 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(1));
1307 const Class& klass = Class::Handle(ref.GetClassReferent());
1308 GET_NON_NULL_NATIVE_ARGUMENT(String, function_name,
1309 arguments->NativeArgAt(2));
1310 GET_NON_NULL_NATIVE_ARGUMENT(Array, args, arguments->NativeArgAt(3));
1311 GET_NON_NULL_NATIVE_ARGUMENT(Array, arg_names, arguments->NativeArgAt(4));
1312 RETURN_OR_PROPAGATE(klass.Invoke(function_name, args, arg_names));
1313}
ObjectPtr Invoke(const String &selector, const Array &arguments, const Array &argument_names, bool respect_reflectable=true, bool check_is_entrypoint=false) const
Definition object.cc:4739
#define RETURN_OR_PROPAGATE(expr)
Definition mirrors.cc:24

◆ DEFINE_NATIVE_ENTRY() [16/345]

dart::DEFINE_NATIVE_ENTRY ( ClassMirror_invokeConstructor  ,
,
 
)

Definition at line 1341 of file mirrors.cc.

1341 {
1342 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0));
1343 const Class& klass = Class::Handle(ref.GetClassReferent());
1344 GET_NATIVE_ARGUMENT(Type, type, arguments->NativeArgAt(1));
1345 GET_NON_NULL_NATIVE_ARGUMENT(String, constructor_name,
1346 arguments->NativeArgAt(2));
1347 GET_NON_NULL_NATIVE_ARGUMENT(Array, explicit_args, arguments->NativeArgAt(3));
1348 GET_NON_NULL_NATIVE_ARGUMENT(Array, arg_names, arguments->NativeArgAt(4));
1349
1350 const Error& error =
1351 Error::Handle(zone, klass.EnsureIsAllocateFinalized(thread));
1352 if (!error.IsNull()) {
1353 Exceptions::PropagateError(error);
1354 UNREACHABLE();
1355 }
1356
1357 // By convention, the static function implementing a named constructor 'C'
1358 // for class 'A' is labeled 'A.C', and the static function implementing the
1359 // unnamed constructor for class 'A' is labeled 'A.'.
1360 // This convention prevents users from explicitly calling constructors.
1361 const String& klass_name = String::Handle(klass.Name());
1362 String& external_constructor_name = String::Handle(klass_name.ptr());
1363 String& internal_constructor_name =
1364 String::Handle(String::Concat(klass_name, Symbols::Dot()));
1365 if (!constructor_name.IsNull() && constructor_name.Length() > 0) {
1366 internal_constructor_name =
1367 String::Concat(internal_constructor_name, constructor_name);
1368 external_constructor_name = internal_constructor_name.ptr();
1369 }
1370
1371 Function& lookup_constructor = Function::Handle(
1372 Resolver::ResolveFunction(zone, klass, internal_constructor_name));
1373
1374 if (lookup_constructor.IsNull() ||
1375 (lookup_constructor.kind() != UntaggedFunction::kConstructor) ||
1376 !lookup_constructor.is_reflectable()) {
1377 ThrowNoSuchMethod(AbstractType::Handle(klass.RareType()),
1378 external_constructor_name, explicit_args, arg_names,
1379 InvocationMirror::kConstructor,
1380 InvocationMirror::kMethod);
1381 UNREACHABLE();
1382 }
1383
1384 if (klass.is_abstract() && !lookup_constructor.IsFactory()) {
1385 const Array& error_args = Array::Handle(Array::New(3));
1386 error_args.SetAt(0, klass_name);
1387 // 1 = script url
1388 // 2 = token position
1389 Exceptions::ThrowByType(Exceptions::kAbstractClassInstantiation,
1390 error_args);
1391 UNREACHABLE();
1392 }
1393
1394 ASSERT(!type.IsNull());
1395 TypeArguments& type_arguments = TypeArguments::Handle();
1396 if (!type.IsInstantiated()) {
1397 // Must have been a declaration type.
1398 const Type& rare_type = Type::Handle(klass.RareType());
1399 ASSERT(rare_type.IsInstantiated());
1400 type_arguments = rare_type.GetInstanceTypeArguments(thread);
1401 } else {
1402 type_arguments = type.GetInstanceTypeArguments(thread);
1403 }
1404
1405 Class& redirected_klass = Class::Handle(klass.ptr());
1406 const intptr_t num_explicit_args = explicit_args.Length();
1407 const intptr_t num_implicit_args = 1;
1408 const Array& args =
1409 Array::Handle(Array::New(num_implicit_args + num_explicit_args));
1410
1411 // Copy over the explicit arguments.
1412 Object& explicit_argument = Object::Handle();
1413 for (int i = 0; i < num_explicit_args; i++) {
1414 explicit_argument = explicit_args.At(i);
1415 args.SetAt(i + num_implicit_args, explicit_argument);
1416 }
1417
1418 const int kTypeArgsLen = 0;
1419 const Array& args_descriptor_array = Array::Handle(
1420 ArgumentsDescriptor::NewBoxed(kTypeArgsLen, args.Length(), arg_names));
1421
1422 ArgumentsDescriptor args_descriptor(args_descriptor_array);
1423 if (!lookup_constructor.AreValidArguments(args_descriptor, nullptr)) {
1424 external_constructor_name = lookup_constructor.name();
1425 ThrowNoSuchMethod(AbstractType::Handle(klass.RareType()),
1426 external_constructor_name, explicit_args, arg_names,
1427 InvocationMirror::kConstructor,
1428 InvocationMirror::kMethod);
1429 UNREACHABLE();
1430 }
1431#if defined(DEBUG)
1432 // Make sure the receiver is the null value, so that DoArgumentTypesMatch does
1433 // not attempt to retrieve the instantiator type arguments from the receiver.
1434 explicit_argument = args.At(args_descriptor.FirstArgIndex());
1435 ASSERT(explicit_argument.IsNull());
1436#endif
1437 const Object& type_error =
1438 Object::Handle(lookup_constructor.DoArgumentTypesMatch(
1439 args, args_descriptor, type_arguments));
1440 if (!type_error.IsNull()) {
1441 Exceptions::PropagateError(Error::Cast(type_error));
1442 UNREACHABLE();
1443 }
1444
1445 Instance& new_object = Instance::Handle();
1446 if (lookup_constructor.IsGenerativeConstructor()) {
1447 // Constructors get the uninitialized object.
1448 // Note we have delayed allocation until after the function
1449 // type and argument matching checks.
1450 new_object = Instance::New(redirected_klass);
1451 if (!type_arguments.IsNull()) {
1452 // The type arguments will be null if the class has no type parameters, in
1453 // which case the following call would fail because there is no slot
1454 // reserved in the object for the type vector.
1455 new_object.SetTypeArguments(type_arguments);
1456 }
1457 args.SetAt(0, new_object);
1458 } else {
1459 // Factories get type arguments.
1460 args.SetAt(0, type_arguments);
1461 }
1462
1463 // Invoke the constructor and return the new object.
1464 const Object& result = Object::Handle(DartEntry::InvokeFunction(
1465 lookup_constructor, args, args_descriptor_array));
1466 if (result.IsError()) {
1467 Exceptions::PropagateError(Error::Cast(result));
1468 UNREACHABLE();
1469 }
1470
1471 // Factories may return null.
1472 ASSERT(result.IsInstance() || result.IsNull());
1473
1474 if (lookup_constructor.IsGenerativeConstructor()) {
1475 return new_object.ptr();
1476 } else {
1477 return result.ptr();
1478 }
1479}
TypePtr RareType() const
Definition object.cc:3097
ErrorPtr EnsureIsAllocateFinalized(Thread *thread) const
Definition object.cc:5009
static void ThrowNoSuchMethod(const Instance &receiver, const String &function_name, const Array &arguments, const Array &argument_names, const InvocationMirror::Level level, const InvocationMirror::Kind kind)
Definition mirrors.cc:49

◆ DEFINE_NATIVE_ENTRY() [17/345]

dart::DEFINE_NATIVE_ENTRY ( ClassMirror_invokeGetter  ,
,
 
)

Definition at line 1315 of file mirrors.cc.

1315 {
1316 // Argument 0 is the mirror, which is unused by the native. It exists
1317 // because this native is an instance method in order to be polymorphic
1318 // with its cousins.
1319 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(1));
1320 const Class& klass = Class::Handle(ref.GetClassReferent());
1321 const Error& error = Error::Handle(zone, klass.EnsureIsFinalized(thread));
1322 if (!error.IsNull()) {
1323 Exceptions::PropagateError(error);
1324 UNREACHABLE();
1325 }
1326 GET_NON_NULL_NATIVE_ARGUMENT(String, getter_name, arguments->NativeArgAt(2));
1327 RETURN_OR_PROPAGATE(klass.InvokeGetter(getter_name, true));
1328}
ObjectPtr InvokeGetter(const String &selector, bool throw_nsm_if_absent, bool respect_reflectable=true, bool check_is_entrypoint=false) const
Definition object.cc:4572

◆ DEFINE_NATIVE_ENTRY() [18/345]

dart::DEFINE_NATIVE_ENTRY ( ClassMirror_invokeSetter  ,
,
 
)

Definition at line 1330 of file mirrors.cc.

1330 {
1331 // Argument 0 is the mirror, which is unused by the native. It exists
1332 // because this native is an instance method in order to be polymorphic
1333 // with its cousins.
1334 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(1));
1335 const Class& klass = Class::Handle(ref.GetClassReferent());
1336 GET_NON_NULL_NATIVE_ARGUMENT(String, setter_name, arguments->NativeArgAt(2));
1337 GET_NATIVE_ARGUMENT(Instance, value, arguments->NativeArgAt(3));
1338 RETURN_OR_PROPAGATE(klass.InvokeSetter(setter_name, value));
1339}
ObjectPtr InvokeSetter(const String &selector, const Instance &argument, bool respect_reflectable=true, bool check_is_entrypoint=false) const
Definition object.cc:4632

◆ DEFINE_NATIVE_ENTRY() [19/345]

dart::DEFINE_NATIVE_ENTRY ( ClassMirror_libraryUri  ,
,
 
)

Definition at line 913 of file mirrors.cc.

913 {
914 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0));
915 const Class& klass = Class::Handle(ref.GetClassReferent());
916 const Library& library = Library::Handle(klass.library());
917 ASSERT(!library.IsNull());
918 return library.url();
919}

◆ DEFINE_NATIVE_ENTRY() [20/345]

dart::DEFINE_NATIVE_ENTRY ( ClassMirror_members  ,
,
 
)

Definition at line 1021 of file mirrors.cc.

1021 {
1023 arguments->NativeArgAt(0));
1024 GET_NATIVE_ARGUMENT(AbstractType, owner_instantiator,
1025 arguments->NativeArgAt(1));
1026 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(2));
1027 const Class& klass = Class::Handle(ref.GetClassReferent());
1028
1029 const Error& error = Error::Handle(klass.EnsureIsFinalized(thread));
1030 if (!error.IsNull()) {
1031 Exceptions::PropagateError(error);
1032 }
1033
1034 const Array& fields = Array::Handle(klass.fields());
1035 const intptr_t num_fields = fields.Length();
1036
1037 const Array& functions = Array::Handle(klass.current_functions());
1038 const intptr_t num_functions = functions.Length();
1039
1040 Instance& member_mirror = Instance::Handle();
1041 const GrowableObjectArray& member_mirrors = GrowableObjectArray::Handle(
1042 GrowableObjectArray::New(num_fields + num_functions));
1043
1044 Field& field = Field::Handle();
1045 for (intptr_t i = 0; i < num_fields; i++) {
1046 field ^= fields.At(i);
1047 if (field.is_reflectable()) {
1048 member_mirror = CreateVariableMirror(field, owner_mirror);
1049 member_mirrors.Add(member_mirror);
1050 }
1051 }
1052
1053 Function& func = Function::Handle();
1054 for (intptr_t i = 0; i < num_functions; i++) {
1055 func ^= functions.At(i);
1056 if (func.is_reflectable() &&
1057 (func.kind() == UntaggedFunction::kRegularFunction ||
1058 func.kind() == UntaggedFunction::kGetterFunction ||
1059 func.kind() == UntaggedFunction::kSetterFunction)) {
1060 member_mirror =
1061 CreateMethodMirror(func, owner_mirror, owner_instantiator);
1062 member_mirrors.Add(member_mirror);
1063 }
1064 }
1065
1066 return member_mirrors.ptr();
1067}
static InstancePtr CreateMethodMirror(const Function &func, const Instance &owner_mirror, const AbstractType &instantiator)
Definition mirrors.cc:240

◆ DEFINE_NATIVE_ENTRY() [21/345]

dart::DEFINE_NATIVE_ENTRY ( ClassMirror_mixin  ,
,
 
)

Definition at line 984 of file mirrors.cc.

984 {
985 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, type, arguments->NativeArgAt(0));
986 ASSERT(type.IsFinalized());
987 const Class& cls = Class::Handle(
988 type.IsFunctionType()
989 ? IsolateGroup::Current()->object_store()->closure_class()
990 : type.type_class());
991 AbstractType& mixin_type = AbstractType::Handle();
993 const Array& interfaces = Array::Handle(cls.interfaces());
994 mixin_type ^= interfaces.At(interfaces.Length() - 1);
995 }
996 ASSERT(mixin_type.IsNull() || mixin_type.IsFinalized());
997 return mixin_type.ptr();
998}

◆ DEFINE_NATIVE_ENTRY() [22/345]

dart::DEFINE_NATIVE_ENTRY ( ClassMirror_mixin_instantiated  ,
,
 
)

Definition at line 1000 of file mirrors.cc.

1000 {
1001 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, type, arguments->NativeArgAt(0));
1003 arguments->NativeArgAt(1));
1004 ASSERT(type.IsFinalized());
1005 const Class& cls = Class::Handle(
1006 type.IsFunctionType()
1007 ? IsolateGroup::Current()->object_store()->closure_class()
1008 : type.type_class());
1009 AbstractType& mixin_type = AbstractType::Handle();
1011 const Array& interfaces = Array::Handle(cls.interfaces());
1012 mixin_type ^= interfaces.At(interfaces.Length() - 1);
1013 }
1014 if (mixin_type.IsNull()) {
1015 return mixin_type.ptr();
1016 }
1017
1018 return InstantiateType(mixin_type, instantiator);
1019}
static AbstractTypePtr InstantiateType(const AbstractType &type, const AbstractType &instantiator)
Definition mirrors.cc:614

◆ DEFINE_NATIVE_ENTRY() [23/345]

dart::DEFINE_NATIVE_ENTRY ( ClassMirror_supertype  ,
,
 
)

Definition at line 921 of file mirrors.cc.

921 {
922 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, type, arguments->NativeArgAt(0));
923 ASSERT(type.IsFinalized());
924 const Class& cls = Class::Handle(
925 type.IsFunctionType()
926 ? IsolateGroup::Current()->object_store()->closure_class()
927 : type.type_class());
928 const AbstractType& super_type = AbstractType::Handle(cls.super_type());
929 ASSERT(super_type.IsNull() || super_type.IsFinalized());
930 return super_type.ptr();
931}

◆ DEFINE_NATIVE_ENTRY() [24/345]

dart::DEFINE_NATIVE_ENTRY ( ClassMirror_supertype_instantiated  ,
,
 
)

Definition at line 933 of file mirrors.cc.

933 {
934 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, type, arguments->NativeArgAt(0));
935 ASSERT(type.IsFinalized());
936 const Class& cls = Class::Handle(
937 type.IsFunctionType()
938 ? IsolateGroup::Current()->object_store()->closure_class()
939 : type.type_class());
940 const AbstractType& super_type = AbstractType::Handle(cls.super_type());
941 return InstantiateType(super_type, type);
942}

◆ DEFINE_NATIVE_ENTRY() [25/345]

dart::DEFINE_NATIVE_ENTRY ( ClassMirror_type_arguments  ,
,
 
)

Definition at line 1170 of file mirrors.cc.

1170 {
1171 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, type, arguments->NativeArgAt(0));
1172
1173 const Class& cls = Class::Handle(
1174 type.IsFunctionType()
1175 ? IsolateGroup::Current()->object_store()->closure_class()
1176 : type.type_class());
1177 const intptr_t num_params = cls.NumTypeParameters();
1178
1179 if (num_params == 0) {
1180 return Object::empty_array().ptr();
1181 }
1182
1183 const Array& result = Array::Handle(Array::New(num_params));
1184 AbstractType& arg_type = AbstractType::Handle();
1185 Instance& type_mirror = Instance::Handle();
1186 const TypeArguments& args =
1187 TypeArguments::Handle(Type::Cast(type).arguments());
1188
1189 // Handle argument lists that have been optimized away, because either no
1190 // arguments have been provided, or all arguments are dynamic. Return a list
1191 // of typemirrors on dynamic in this case.
1192 if (args.IsNull()) {
1193 arg_type = Object::dynamic_type().ptr();
1194 type_mirror = CreateTypeMirror(arg_type);
1195 for (intptr_t i = 0; i < num_params; i++) {
1196 result.SetAt(i, type_mirror);
1197 }
1198 return result.ptr();
1199 }
1200
1201 ASSERT(args.Length() == num_params);
1202 for (intptr_t i = 0; i < num_params; i++) {
1203 arg_type = args.TypeAt(i);
1204 type_mirror = CreateTypeMirror(arg_type);
1205 result.SetAt(i, type_mirror);
1206 }
1207 return result.ptr();
1208}
static InstancePtr CreateTypeMirror(const AbstractType &type)
Definition mirrors.cc:518

◆ DEFINE_NATIVE_ENTRY() [26/345]

dart::DEFINE_NATIVE_ENTRY ( ClassMirror_type_variables  ,
,
 
)

Definition at line 1159 of file mirrors.cc.

1159 {
1160 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0));
1161 const Class& klass = Class::Handle(ref.GetClassReferent());
1162 const Error& error = Error::Handle(zone, klass.EnsureIsFinalized(thread));
1163 if (!error.IsNull()) {
1164 Exceptions::PropagateError(error);
1165 UNREACHABLE();
1166 }
1167 return CreateTypeVariableList(klass);
1168}

◆ DEFINE_NATIVE_ENTRY() [27/345]

dart::DEFINE_NATIVE_ENTRY ( Closure_computeHash  ,
,
 
)

Definition at line 122 of file function.cc.

122 {
123 const Closure& receiver =
124 Closure::CheckedHandle(zone, arguments->NativeArgAt(0));
125 return Smi::New(receiver.ComputeHash());
126}
uword ComputeHash() const
Definition object.cc:25988

◆ DEFINE_NATIVE_ENTRY() [28/345]

dart::DEFINE_NATIVE_ENTRY ( Closure_equals  ,
,
 
)

Definition at line 114 of file function.cc.

114 {
115 const Closure& receiver =
116 Closure::CheckedHandle(zone, arguments->NativeArgAt(0));
117 GET_NATIVE_ARGUMENT(Instance, other, arguments->NativeArgAt(1));
118 ASSERT(!other.IsNull());
119 return Bool::Get(ClosureEqualsHelper(zone, receiver, other)).ptr();
120}
static bool ClosureEqualsHelper(Zone *zone, const Closure &receiver, const Object &other)
Definition function.cc:33

◆ DEFINE_NATIVE_ENTRY() [29/345]

dart::DEFINE_NATIVE_ENTRY ( ClosureMirror_function  ,
,
 
)

Definition at line 1263 of file mirrors.cc.

1263 {
1264 GET_NON_NULL_NATIVE_ARGUMENT(Instance, closure, arguments->NativeArgAt(0));
1265 ASSERT(!closure.IsNull());
1266
1267 Function& function = Function::Handle();
1268 bool callable = closure.IsCallable(&function);
1269 if (callable) {
1270 const Function& parent = Function::Handle(function.parent_function());
1271 if (function.IsImplicitClosureFunction() || parent.is_extension_member() ||
1272 parent.is_extension_type_member()) {
1273 // The VM uses separate Functions for tear-offs, but the mirrors consider
1274 // the tear-offs to be the same as the torn-off methods. Avoid handing out
1275 // a reference to the tear-off here to avoid a special case in the
1276 // the equality test.
1277 // In the case of extension methods also we avoid handing out a reference
1278 // to the tear-off and instead get the parent function of the
1279 // anonymous closure.
1280 function = parent.ptr();
1281 }
1282
1283 Type& instantiator = Type::Handle();
1284 if (closure.IsClosure()) {
1285 const TypeArguments& arguments = TypeArguments::Handle(
1286 Closure::Cast(closure).instantiator_type_arguments());
1287 // TODO(regis): Mirrors need work to properly support generic functions.
1288 // The 'instantiator' created below should not be a type, but two type
1289 // argument vectors: instantiator_type_arguments and
1290 // function_type_arguments.
1291 const Class& cls = Class::Handle(
1292 IsolateGroup::Current()->object_store()->object_class());
1293 instantiator = Type::New(cls, arguments);
1294 instantiator.SetIsFinalized();
1295 }
1296 return CreateMethodMirror(function, Instance::null_instance(),
1297 instantiator);
1298 }
1299 return Instance::null();
1300}

◆ DEFINE_NATIVE_ENTRY() [30/345]

dart::DEFINE_NATIVE_ENTRY ( DartApiDLInitializeData  ,
,
 
)

Definition at line 96 of file ffi.cc.

96 {
97 return Integer::New(reinterpret_cast<intptr_t>(&dart_api_data));
98}

◆ DEFINE_NATIVE_ENTRY() [31/345]

dart::DEFINE_NATIVE_ENTRY ( DartApiDLMajorVersion  ,
,
 
)

Definition at line 78 of file ffi.cc.

78 {
79 return Integer::New(DART_API_DL_MAJOR_VERSION);
80}
#define DART_API_DL_MAJOR_VERSION

◆ DEFINE_NATIVE_ENTRY() [32/345]

dart::DEFINE_NATIVE_ENTRY ( DartApiDLMinorVersion  ,
,
 
)

Definition at line 82 of file ffi.cc.

82 {
83 return Integer::New(DART_API_DL_MINOR_VERSION);
84}
#define DART_API_DL_MINOR_VERSION

◆ DEFINE_NATIVE_ENTRY() [33/345]

dart::DEFINE_NATIVE_ENTRY ( DartAsync_fatal  ,
,
 
)

Definition at line 21 of file object.cc.

21 {
22 // The dart:async library code entered an unrecoverable state.
23 const Instance& instance =
24 Instance::CheckedHandle(zone, arguments->NativeArgAt(0));
25 const char* msg = instance.ToCString();
26 OS::PrintErr("Fatal error in dart:async: %s\n", msg);
27 FATAL("%s", msg);
28 return Object::null();
29}

◆ DEFINE_NATIVE_ENTRY() [34/345]

dart::DEFINE_NATIVE_ENTRY ( DartNativeApiFunctionPointer  ,
,
 
)

Definition at line 62 of file ffi.cc.

62 {
63 GET_NON_NULL_NATIVE_ARGUMENT(String, name_dart, arguments->NativeArgAt(0));
64 const char* name = name_dart.ToCString();
65
66#define RETURN_FUNCTION_ADDRESS(function_name, R, A) \
67 if (strcmp(name, #function_name) == 0) { \
68 return Integer::New(reinterpret_cast<intptr_t>(function_name)); \
69 }
71#undef RETURN_FUNCTION_ADDRESS
72
73 const String& error = String::Handle(
74 String::NewFormatted("Unknown dart_native_api.h symbol: %s.", name));
75 Exceptions::ThrowArgumentError(error);
76}
#define DART_NATIVE_API_DL_SYMBOLS(F)
Definition dart_api_dl.h:46
#define RETURN_FUNCTION_ADDRESS(function_name, R, A)

◆ DEFINE_NATIVE_ENTRY() [35/345]

dart::DEFINE_NATIVE_ENTRY ( DateTime_currentTimeMicros  ,
,
 
)

Definition at line 39 of file date.cc.

39 {
40 return Integer::New(OS::GetCurrentTimeMicros());
41}

◆ DEFINE_NATIVE_ENTRY() [36/345]

dart::DEFINE_NATIVE_ENTRY ( DateTime_timeZoneName  ,
,
 
)

Definition at line 17 of file date.cc.

17 {
19 arguments->NativeArgAt(0));
20 int64_t seconds = dart_seconds.AsInt64Value();
21 if (llabs(seconds) > kMaxAllowedSeconds) {
22 Exceptions::ThrowArgumentError(dart_seconds);
23 }
24 const char* name = OS::GetTimeZoneName(seconds);
25 return String::New(name);
26}

◆ DEFINE_NATIVE_ENTRY() [37/345]

dart::DEFINE_NATIVE_ENTRY ( DateTime_timeZoneOffsetInSeconds  ,
,
 
)

Definition at line 28 of file date.cc.

28 {
30 arguments->NativeArgAt(0));
31 int64_t seconds = dart_seconds.AsInt64Value();
32 if (llabs(seconds) > kMaxAllowedSeconds) {
33 Exceptions::ThrowArgumentError(dart_seconds);
34 }
35 int offset = OS::GetTimeZoneOffsetInSeconds(seconds);
36 return Integer::New(offset);
37}

◆ DEFINE_NATIVE_ENTRY() [38/345]

dart::DEFINE_NATIVE_ENTRY ( DeclarationMirror_location  ,
,
 
)

Definition at line 1568 of file mirrors.cc.

1568 {
1569 GET_NON_NULL_NATIVE_ARGUMENT(Instance, reflectee, arguments->NativeArgAt(0));
1570 Object& decl = Object::Handle(zone);
1571 if (reflectee.IsMirrorReference()) {
1572 const MirrorReference& decl_ref = MirrorReference::Cast(reflectee);
1573 decl = decl_ref.referent();
1574 } else if (reflectee.IsTypeParameter()) {
1575 decl = reflectee.ptr();
1576 } else {
1577 UNREACHABLE();
1578 }
1579
1580 Script& script = Script::Handle(zone);
1581 TokenPosition token_pos = TokenPosition::kNoSource;
1582
1583 if (decl.IsFunction()) {
1584 const Function& func = Function::Cast(decl);
1585 if (func.IsImplicitConstructor()) {
1586 // These are synthetic methods; they have no source.
1587 return Instance::null();
1588 }
1589 script = func.script();
1590 token_pos = func.token_pos();
1591 } else if (decl.IsClass()) {
1592 const Class& cls = Class::Cast(decl);
1593 if (cls.is_synthesized_class() && !cls.is_enum_class()) {
1594 return Instance::null(); // Synthetic.
1595 }
1596 script = cls.script();
1597 token_pos = cls.token_pos();
1598 } else if (decl.IsField()) {
1599 const Field& field = Field::Cast(decl);
1600 script = field.Script();
1601 token_pos = field.token_pos();
1602 } else if (decl.IsTypeParameter()) {
1603 return Instance::null();
1604 } else if (decl.IsLibrary()) {
1605 const Library& lib = Library::Cast(decl);
1606 if (lib.ptr() == Library::NativeWrappersLibrary()) {
1607 return Instance::null(); // No source.
1608 }
1609 const Array& scripts = Array::Handle(zone, lib.LoadedScripts());
1610 ASSERT(scripts.Length() > 0);
1611 script ^= scripts.At(scripts.Length() - 1);
1612 ASSERT(!script.IsNull());
1613 const String& uri = String::Handle(zone, script.url());
1614 return CreateSourceLocation(uri, 1, 1);
1615 } else {
1616 FATAL("Unexpected declaration type: %s", decl.ToCString());
1617 }
1618
1619 ASSERT(!script.IsNull());
1620 if (token_pos == TokenPosition::kNoSource) {
1621 return Instance::null();
1622 }
1623
1624 const String& uri = String::Handle(zone, script.url());
1625 intptr_t from_line = 0, from_col = 0;
1626 script.GetTokenLocation(token_pos, &from_line, &from_col);
1627 return CreateSourceLocation(uri, from_line, from_col);
1628}
ObjectPtr referent() const
Definition object.h:13094
static InstancePtr CreateSourceLocation(const String &uri, intptr_t line, intptr_t column)
Definition mirrors.cc:1558

◆ DEFINE_NATIVE_ENTRY() [39/345]

dart::DEFINE_NATIVE_ENTRY ( DeclarationMirror_metadata  ,
,
 
)

Definition at line 843 of file mirrors.cc.

843 {
844 GET_NON_NULL_NATIVE_ARGUMENT(Instance, reflectee, arguments->NativeArgAt(0));
845 Object& decl = Object::Handle();
846 if (reflectee.IsMirrorReference()) {
847 const MirrorReference& decl_ref = MirrorReference::Cast(reflectee);
848 decl = decl_ref.referent();
849 } else if (reflectee.IsTypeParameter()) {
850 decl = reflectee.ptr();
851 } else {
852 UNREACHABLE();
853 }
854
855 Class& klass = Class::Handle();
856 Library& library = Library::Handle();
857
858 if (decl.IsClass()) {
859 klass ^= decl.ptr();
860 library = klass.library();
861 } else if (decl.IsFunction()) {
862 klass = Function::Cast(decl).Owner();
863 library = klass.library();
864 } else if (decl.IsField()) {
865 klass = Field::Cast(decl).Owner();
866 library = klass.library();
867 } else if (decl.IsLibrary()) {
868 library ^= decl.ptr();
869 } else if (decl.IsTypeParameter()) {
870 // There is no reference from a canonical type parameter to its declaration.
871 return Object::empty_array().ptr();
872 } else {
873 return Object::empty_array().ptr();
874 }
875
876 const Object& metadata = Object::Handle(library.GetMetadata(decl));
877 if (metadata.IsError()) {
878 Exceptions::PropagateError(Error::Cast(metadata));
879 }
880 return metadata.ptr();
881}

◆ DEFINE_NATIVE_ENTRY() [40/345]

dart::DEFINE_NATIVE_ENTRY ( Developer_debugger  ,
,
 
)

Definition at line 26 of file developer.cc.

26 {
27 GET_NON_NULL_NATIVE_ARGUMENT(Bool, when, arguments->NativeArgAt(0));
28#if !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME)
29 GET_NATIVE_ARGUMENT(String, msg, arguments->NativeArgAt(1));
30 Debugger* debugger = isolate->debugger();
31 if (debugger == nullptr) {
32 return when.ptr();
33 }
34 if (when.value()) {
35 debugger->PauseDeveloper(msg);
36 }
37#endif
38 return when.ptr();
39}
void PauseDeveloper(const String &msg)
Definition debugger.cc:3705

◆ DEFINE_NATIVE_ENTRY() [41/345]

dart::DEFINE_NATIVE_ENTRY ( Developer_getIsolateIdFromSendPort  ,
,
 
)

Definition at line 161 of file developer.cc.

161 {
162#if defined(PRODUCT)
163 return Object::null();
164#else
165 GET_NON_NULL_NATIVE_ARGUMENT(SendPort, port, arguments->NativeArgAt(0));
166 int64_t port_id = port.Id();
167 return String::NewFormatted(ISOLATE_SERVICE_ID_FORMAT_STRING, port_id);
168#endif
169}
#define ISOLATE_SERVICE_ID_FORMAT_STRING
Definition service.h:48

◆ DEFINE_NATIVE_ENTRY() [42/345]

dart::DEFINE_NATIVE_ENTRY ( Developer_getObjectId  ,
,
 
)

Definition at line 171 of file developer.cc.

171 {
172#if defined(PRODUCT)
173 return Object::null();
174#else
175 GET_NON_NULL_NATIVE_ARGUMENT(Instance, instance, arguments->NativeArgAt(0));
176 JSONStream js;
177 RingServiceIdZone& ring_service_id_zone =
178 *reinterpret_cast<RingServiceIdZone*>(js.id_zone());
179 return String::New(ring_service_id_zone.GetServiceId(instance));
180#endif
181}
virtual char * GetServiceId(const Object &obj)
Definition service.cc:380

◆ DEFINE_NATIVE_ENTRY() [43/345]

dart::DEFINE_NATIVE_ENTRY ( Developer_getServerInfo  ,
,
 
)

Definition at line 127 of file developer.cc.

127 {
128 GET_NON_NULL_NATIVE_ARGUMENT(SendPort, port, arguments->NativeArgAt(0));
129#if defined(PRODUCT)
130 SendNull(port);
131 return Object::null();
132#else
133 ServiceIsolate::WaitForServiceIsolateStartup();
134 if (!ServiceIsolate::IsRunning()) {
135 SendNull(port);
136 } else {
137 ServiceIsolate::RequestServerInfo(port);
138 }
139 return Object::null();
140#endif
141}
static void SendNull(const SendPort &port)
Definition developer.cc:121

◆ DEFINE_NATIVE_ENTRY() [44/345]

dart::DEFINE_NATIVE_ENTRY ( Developer_getServiceMajorVersion  ,
,
 
)

Definition at line 105 of file developer.cc.

105 {
106#if defined(PRODUCT)
107 return Smi::New(0);
108#else
109 return Smi::New(SERVICE_PROTOCOL_MAJOR_VERSION);
110#endif
111}
#define SERVICE_PROTOCOL_MAJOR_VERSION
Definition service.h:20

◆ DEFINE_NATIVE_ENTRY() [45/345]

dart::DEFINE_NATIVE_ENTRY ( Developer_getServiceMinorVersion  ,
,
 
)

Definition at line 113 of file developer.cc.

113 {
114#if defined(PRODUCT)
115 return Smi::New(0);
116#else
117 return Smi::New(SERVICE_PROTOCOL_MINOR_VERSION);
118#endif
119}
#define SERVICE_PROTOCOL_MINOR_VERSION
Definition service.h:21

◆ DEFINE_NATIVE_ENTRY() [46/345]

dart::DEFINE_NATIVE_ENTRY ( Developer_inspect  ,
,
 
)

Definition at line 41 of file developer.cc.

41 {
42 GET_NATIVE_ARGUMENT(Instance, inspectee, arguments->NativeArgAt(0));
43#ifndef PRODUCT
44 Service::SendInspectEvent(isolate, inspectee);
45#endif // !PRODUCT
46 return inspectee.ptr();
47}

◆ DEFINE_NATIVE_ENTRY() [47/345]

dart::DEFINE_NATIVE_ENTRY ( Developer_log  ,
,
 
)

Definition at line 49 of file developer.cc.

49 {
50#if defined(PRODUCT)
51 return Object::null();
52#else
53 GET_NON_NULL_NATIVE_ARGUMENT(String, message, arguments->NativeArgAt(0));
54 GET_NON_NULL_NATIVE_ARGUMENT(Integer, timestamp, arguments->NativeArgAt(1));
55 GET_NON_NULL_NATIVE_ARGUMENT(Integer, sequence, arguments->NativeArgAt(2));
56 GET_NON_NULL_NATIVE_ARGUMENT(Smi, level, arguments->NativeArgAt(3));
57 GET_NON_NULL_NATIVE_ARGUMENT(String, name, arguments->NativeArgAt(4));
58 GET_NATIVE_ARGUMENT(Instance, dart_zone, arguments->NativeArgAt(5));
59 GET_NATIVE_ARGUMENT(Instance, error, arguments->NativeArgAt(6));
60 GET_NATIVE_ARGUMENT(Instance, stack_trace, arguments->NativeArgAt(7));
61 Service::SendLogEvent(isolate, sequence.AsInt64Value(),
62 timestamp.AsInt64Value(), level.Value(), name, message,
63 dart_zone, error, stack_trace);
64 return Object::null();
65#endif // PRODUCT
66}

◆ DEFINE_NATIVE_ENTRY() [48/345]

dart::DEFINE_NATIVE_ENTRY ( Developer_lookupExtension  ,
,
 
)

Definition at line 79 of file developer.cc.

79 {
80#if defined(PRODUCT)
81 return Object::null();
82#else
83 GET_NON_NULL_NATIVE_ARGUMENT(String, name, arguments->NativeArgAt(0));
84 return isolate->LookupServiceExtensionHandler(name);
85#endif // PRODUCT
86}

◆ DEFINE_NATIVE_ENTRY() [49/345]

dart::DEFINE_NATIVE_ENTRY ( Developer_NativeRuntime_buildId  ,
,
 
)

Definition at line 191 of file developer.cc.

191 {
192#if defined(DART_PRECOMPILED_RUNTIME)
193 IsolateGroup* isolate_group = thread->isolate_group();
194 ASSERT(isolate_group != nullptr);
195 if (const uint8_t* instructions =
196 isolate_group->source()->snapshot_instructions) {
197 const auto& build_id = OS::GetAppBuildId(instructions);
198 if (build_id.data != nullptr) {
200 for (intptr_t i = 0; i < build_id.len; i++) {
201 buffer.Printf("%2.2x", build_id.data[i]);
202 }
203 return String::New(buffer.buffer());
204 }
205 }
206#endif
207 return String::null();
208}
const uint8_t * snapshot_instructions
Definition isolate.h:193
IsolateGroupSource * source() const
Definition isolate.h:285

◆ DEFINE_NATIVE_ENTRY() [50/345]

dart::DEFINE_NATIVE_ENTRY ( Developer_NativeRuntime_writeHeapSnapshotToFile  ,
,
 
)

Definition at line 210 of file developer.cc.

210 {
211#if defined(DART_ENABLE_HEAP_SNAPSHOT_WRITER)
212 const String& filename =
213 String::CheckedHandle(zone, arguments->NativeArgAt(0));
214 bool successful = false;
215 {
216 FileHeapSnapshotWriter file_writer(thread, filename.ToCString(),
217 &successful);
218 HeapSnapshotWriter writer(thread, &file_writer);
219 writer.Write();
220 }
221 if (!successful) {
222 Exceptions::ThrowUnsupportedError(
223 "Could not create & write heapsnapshot to disc. Possibly due to "
224 "missing embedder functionality.");
225 }
226#else
227 Exceptions::ThrowUnsupportedError(
228 "Heap snapshots are only supported in non-product mode.");
229#endif // !defined(PRODUCT)
230 return Object::null();
231}

◆ DEFINE_NATIVE_ENTRY() [51/345]

dart::DEFINE_NATIVE_ENTRY ( Developer_postEvent  ,
,
 
)

Definition at line 68 of file developer.cc.

68 {
69#if defined(PRODUCT)
70 return Object::null();
71#else
72 GET_NON_NULL_NATIVE_ARGUMENT(String, event_kind, arguments->NativeArgAt(0));
73 GET_NON_NULL_NATIVE_ARGUMENT(String, event_data, arguments->NativeArgAt(1));
74 Service::SendExtensionEvent(isolate, event_kind, event_data);
75 return Object::null();
76#endif // PRODUCT
77}

◆ DEFINE_NATIVE_ENTRY() [52/345]

dart::DEFINE_NATIVE_ENTRY ( Developer_reachability_barrier  ,
,
 
)

Definition at line 183 of file developer.cc.

183 {
184 IsolateGroup* isolate_group = thread->isolate_group();
185 ASSERT(isolate_group != nullptr);
186 Heap* heap = isolate_group->heap();
187 ASSERT(heap != nullptr);
188 return Integer::New(heap->ReachabilityBarrier());
189}
intptr_t ReachabilityBarrier()
Definition heap.h:271

◆ DEFINE_NATIVE_ENTRY() [53/345]

dart::DEFINE_NATIVE_ENTRY ( Developer_registerExtension  ,
,
 
)

Definition at line 88 of file developer.cc.

88 {
89#if defined(PRODUCT)
90 return Object::null();
91#else
92 GET_NON_NULL_NATIVE_ARGUMENT(String, name, arguments->NativeArgAt(0));
93 GET_NON_NULL_NATIVE_ARGUMENT(Instance, handler, arguments->NativeArgAt(1));
94 // We don't allow service extensions to be registered for the
95 // service isolate. This can happen, for example, because the
96 // service isolate uses dart:io. If we decide that we want to start
97 // supporting this in the future, it will take some work.
98 if (!isolate->is_service_isolate()) {
99 isolate->RegisterServiceExtensionHandler(name, handler);
100 }
101 return Object::null();
102#endif // PRODUCT
103}

◆ DEFINE_NATIVE_ENTRY() [54/345]

dart::DEFINE_NATIVE_ENTRY ( Developer_webServerControl  ,
,
 
)

Definition at line 143 of file developer.cc.

143 {
144 GET_NON_NULL_NATIVE_ARGUMENT(SendPort, port, arguments->NativeArgAt(0));
145#if defined(PRODUCT)
146 SendNull(port);
147 return Object::null();
148#else
149 GET_NON_NULL_NATIVE_ARGUMENT(Bool, enabled, arguments->NativeArgAt(1));
150 GET_NATIVE_ARGUMENT(Bool, silence_output, arguments->NativeArgAt(2));
151 ServiceIsolate::WaitForServiceIsolateStartup();
152 if (!ServiceIsolate::IsRunning()) {
153 SendNull(port);
154 } else {
155 ServiceIsolate::ControlWebServer(port, enabled.value(), silence_output);
156 }
157 return Object::null();
158#endif
159}

◆ DEFINE_NATIVE_ENTRY() [55/345]

dart::DEFINE_NATIVE_ENTRY ( Double_add  ,
,
 
)

Definition at line 32 of file double.cc.

32 {
33 double left = Double::CheckedHandle(zone, arguments->NativeArgAt(0)).value();
34 GET_NON_NULL_NATIVE_ARGUMENT(Double, right_object, arguments->NativeArgAt(1));
35 double right = right_object.value();
36 if (FLAG_trace_intrinsified_natives) {
37 OS::PrintErr("Double_add %f + %f\n", left, right);
38 }
39 return Double::New(left + right);
40}

◆ DEFINE_NATIVE_ENTRY() [56/345]

dart::DEFINE_NATIVE_ENTRY ( Double_ceil  ,
,
 
)

Definition at line 130 of file double.cc.

130 {
131 const Double& arg = Double::CheckedHandle(zone, arguments->NativeArgAt(0));
132 return Double::New(ceil(arg.value()));
133}

◆ DEFINE_NATIVE_ENTRY() [57/345]

dart::DEFINE_NATIVE_ENTRY ( Double_div  ,
,
 
)

Definition at line 62 of file double.cc.

62 {
63 double left = Double::CheckedHandle(zone, arguments->NativeArgAt(0)).value();
64 GET_NON_NULL_NATIVE_ARGUMENT(Double, right_object, arguments->NativeArgAt(1));
65 double right = right_object.value();
66 if (FLAG_trace_intrinsified_natives) {
67 OS::PrintErr("Double_div %f / %f\n", left, right);
68 }
69 return Double::New(Utils::DivideAllowZero(left, right));
70}

◆ DEFINE_NATIVE_ENTRY() [58/345]

dart::DEFINE_NATIVE_ENTRY ( Double_doubleFromInteger  ,
,
 
)

Definition at line 22 of file double.cc.

22 {
23 ASSERT(
24 TypeArguments::CheckedHandle(zone, arguments->NativeArgAt(0)).IsNull());
25 GET_NON_NULL_NATIVE_ARGUMENT(Integer, value, arguments->NativeArgAt(1));
26 if (FLAG_trace_intrinsified_natives) {
27 OS::PrintErr("Double_doubleFromInteger %s\n", value.ToCString());
28 }
29 return Double::New(value.AsDoubleValue());
30}

◆ DEFINE_NATIVE_ENTRY() [59/345]

dart::DEFINE_NATIVE_ENTRY ( Double_equal  ,
,
 
)

Definition at line 103 of file double.cc.

103 {
104 const Double& left = Double::CheckedHandle(zone, arguments->NativeArgAt(0));
105 GET_NON_NULL_NATIVE_ARGUMENT(Double, right, arguments->NativeArgAt(1));
106 bool result = right.IsNull() ? false : (left.value() == right.value());
107 if (FLAG_trace_intrinsified_natives) {
108 OS::PrintErr("Double_equal %s == %s\n", left.ToCString(),
109 right.ToCString());
110 }
111 return Bool::Get(result).ptr();
112}

◆ DEFINE_NATIVE_ENTRY() [60/345]

dart::DEFINE_NATIVE_ENTRY ( Double_equalToInteger  ,
,
 
)

Definition at line 114 of file double.cc.

114 {
115 const Double& left = Double::CheckedHandle(zone, arguments->NativeArgAt(0));
116 GET_NON_NULL_NATIVE_ARGUMENT(Integer, right, arguments->NativeArgAt(1));
117 return Bool::Get(left.value() == right.AsDoubleValue()).ptr();
118}

◆ DEFINE_NATIVE_ENTRY() [61/345]

dart::DEFINE_NATIVE_ENTRY ( Double_flipSignBit  ,
,
 
)

Definition at line 239 of file double.cc.

239 {
240 const Double& arg = Double::CheckedHandle(zone, arguments->NativeArgAt(0));
241 const double in_val = arg.value();
242 const int64_t bits = bit_cast<int64_t, double>(in_val) ^ kSignBitDouble;
243 return Double::New(bit_cast<double, int64_t>(bits));
244}
constexpr int64_t kSignBitDouble
Definition globals.h:496

◆ DEFINE_NATIVE_ENTRY() [62/345]

dart::DEFINE_NATIVE_ENTRY ( Double_floor  ,
,
 
)

Definition at line 125 of file double.cc.

125 {
126 const Double& arg = Double::CheckedHandle(zone, arguments->NativeArgAt(0));
127 return Double::New(floor(arg.value()));
128}

◆ DEFINE_NATIVE_ENTRY() [63/345]

dart::DEFINE_NATIVE_ENTRY ( Double_getIsInfinite  ,
,
 
)

Definition at line 222 of file double.cc.

222 {
223 const Double& arg = Double::CheckedHandle(zone, arguments->NativeArgAt(0));
224 return Bool::Get(isinf(arg.value())).ptr();
225}

◆ DEFINE_NATIVE_ENTRY() [64/345]

dart::DEFINE_NATIVE_ENTRY ( Double_getIsNaN  ,
,
 
)

Definition at line 227 of file double.cc.

227 {
228 const Double& arg = Double::CheckedHandle(zone, arguments->NativeArgAt(0));
229 return Bool::Get(isnan(arg.value())).ptr();
230}

◆ DEFINE_NATIVE_ENTRY() [65/345]

dart::DEFINE_NATIVE_ENTRY ( Double_getIsNegative  ,
,
 
)

Definition at line 232 of file double.cc.

232 {
233 const Double& arg = Double::CheckedHandle(zone, arguments->NativeArgAt(0));
234 // Include negative zero, infinity.
235 double dval = arg.value();
236 return Bool::Get(signbit(dval) && !isnan(dval)).ptr();
237}

◆ DEFINE_NATIVE_ENTRY() [66/345]

dart::DEFINE_NATIVE_ENTRY ( Double_greaterThan  ,
,
 
)

Definition at line 86 of file double.cc.

86 {
87 const Double& left = Double::CheckedHandle(zone, arguments->NativeArgAt(0));
88 GET_NON_NULL_NATIVE_ARGUMENT(Double, right, arguments->NativeArgAt(1));
89 bool result = right.IsNull() ? false : (left.value() > right.value());
90 if (FLAG_trace_intrinsified_natives) {
91 OS::PrintErr("Double_greaterThan %s > %s\n", left.ToCString(),
92 right.ToCString());
93 }
94 return Bool::Get(result).ptr();
95}

◆ DEFINE_NATIVE_ENTRY() [67/345]

dart::DEFINE_NATIVE_ENTRY ( Double_greaterThanFromInteger  ,
,
 
)

Definition at line 97 of file double.cc.

97 {
98 const Double& right = Double::CheckedHandle(zone, arguments->NativeArgAt(0));
99 GET_NON_NULL_NATIVE_ARGUMENT(Integer, left, arguments->NativeArgAt(1));
100 return Bool::Get(left.AsDoubleValue() > right.value()).ptr();
101}

◆ DEFINE_NATIVE_ENTRY() [68/345]

dart::DEFINE_NATIVE_ENTRY ( Double_modulo  ,
,
 
)

Definition at line 72 of file double.cc.

72 {
73 double left = Double::CheckedHandle(zone, arguments->NativeArgAt(0)).value();
74 GET_NON_NULL_NATIVE_ARGUMENT(Double, right_object, arguments->NativeArgAt(1));
75 double right = right_object.value();
76 return Double::New(DartModulo(left, right));
77}
double DartModulo(double left, double right)

◆ DEFINE_NATIVE_ENTRY() [69/345]

dart::DEFINE_NATIVE_ENTRY ( Double_mul  ,
,
 
)

Definition at line 52 of file double.cc.

52 {
53 double left = Double::CheckedHandle(zone, arguments->NativeArgAt(0)).value();
54 GET_NON_NULL_NATIVE_ARGUMENT(Double, right_object, arguments->NativeArgAt(1));
55 double right = right_object.value();
56 if (FLAG_trace_intrinsified_natives) {
57 OS::PrintErr("Double_mul %f * %f\n", left, right);
58 }
59 return Double::New(left * right);
60}

◆ DEFINE_NATIVE_ENTRY() [70/345]

dart::DEFINE_NATIVE_ENTRY ( Double_parse  ,
,
 
)

Definition at line 150 of file double.cc.

150 {
151 GET_NON_NULL_NATIVE_ARGUMENT(String, value, arguments->NativeArgAt(0));
152 GET_NON_NULL_NATIVE_ARGUMENT(Integer, startValue, arguments->NativeArgAt(1));
153 GET_NON_NULL_NATIVE_ARGUMENT(Integer, endValue, arguments->NativeArgAt(2));
154
155 const intptr_t start = startValue.AsTruncatedUint32Value();
156 const intptr_t end = endValue.AsTruncatedUint32Value();
157 const intptr_t len = value.Length();
158
159 // Indices should be inside the string, and 0 <= start < end <= len.
160 if (0 <= start && start < end && end <= len) {
161 double double_value;
162 if (String::ParseDouble(value, start, end, &double_value)) {
163 return Double::New(double_value);
164 }
165 }
166 return Object::null();
167}

◆ DEFINE_NATIVE_ENTRY() [71/345]

dart::DEFINE_NATIVE_ENTRY ( Double_remainder  ,
,
 
)

Definition at line 79 of file double.cc.

79 {
80 double left = Double::CheckedHandle(zone, arguments->NativeArgAt(0)).value();
81 GET_NON_NULL_NATIVE_ARGUMENT(Double, right_object, arguments->NativeArgAt(1));
82 double right = right_object.value();
83 return Double::New(fmod_ieee(left, right));
84}

◆ DEFINE_NATIVE_ENTRY() [72/345]

dart::DEFINE_NATIVE_ENTRY ( Double_round  ,
,
 
)

Definition at line 120 of file double.cc.

120 {
121 const Double& arg = Double::CheckedHandle(zone, arguments->NativeArgAt(0));
122 return Double::New(round(arg.value()));
123}
static void round(SkPoint *p)

◆ DEFINE_NATIVE_ENTRY() [73/345]

dart::DEFINE_NATIVE_ENTRY ( Double_sub  ,
,
 
)

Definition at line 42 of file double.cc.

42 {
43 double left = Double::CheckedHandle(zone, arguments->NativeArgAt(0)).value();
44 GET_NON_NULL_NATIVE_ARGUMENT(Double, right_object, arguments->NativeArgAt(1));
45 double right = right_object.value();
46 if (FLAG_trace_intrinsified_natives) {
47 OS::PrintErr("Double_sub %f - %f\n", left, right);
48 }
49 return Double::New(left - right);
50}

◆ DEFINE_NATIVE_ENTRY() [74/345]

dart::DEFINE_NATIVE_ENTRY ( Double_toInt  ,
,
 
)

Definition at line 145 of file double.cc.

145 {
146 const Double& arg = Double::CheckedHandle(zone, arguments->NativeArgAt(0));
147 return DoubleToInteger(zone, arg.value());
148}
IntegerPtr DoubleToInteger(Zone *zone, double val)

◆ DEFINE_NATIVE_ENTRY() [75/345]

dart::DEFINE_NATIVE_ENTRY ( Double_toString  ,
,
 
)

Definition at line 169 of file double.cc.

169 {
170 const Number& number = Number::CheckedHandle(zone, arguments->NativeArgAt(0));
171 return number.ToString(Heap::kNew);
172}
StringPtr ToString(Heap::Space space) const
Definition object.cc:23512

◆ DEFINE_NATIVE_ENTRY() [76/345]

dart::DEFINE_NATIVE_ENTRY ( Double_toStringAsExponential  ,
,
 
)

Definition at line 193 of file double.cc.

193 {
194 const Double& arg = Double::CheckedHandle(zone, arguments->NativeArgAt(0));
195 GET_NON_NULL_NATIVE_ARGUMENT(Smi, fraction_digits, arguments->NativeArgAt(1));
196 double d = arg.value();
197 intptr_t fraction_digits_value = fraction_digits.Value();
198 if (-1 <= fraction_digits_value && fraction_digits_value <= 20) {
200 static_cast<int>(fraction_digits_value));
201 } else {
202 Exceptions::ThrowArgumentError(String::Handle(
203 String::New("Illegal arguments to double.toStringAsExponential")));
204 return Object::null();
205 }
206}
StringPtr DoubleToStringAsExponential(double d, int fraction_digits)

◆ DEFINE_NATIVE_ENTRY() [77/345]

dart::DEFINE_NATIVE_ENTRY ( Double_toStringAsFixed  ,
,
 
)

Definition at line 174 of file double.cc.

174 {
175 // The boundaries are exclusive.
176 const double kLowerBoundary = -1e21;
177 const double kUpperBoundary = 1e21;
178
179 const Double& arg = Double::CheckedHandle(zone, arguments->NativeArgAt(0));
180 GET_NON_NULL_NATIVE_ARGUMENT(Smi, fraction_digits, arguments->NativeArgAt(1));
181 double d = arg.value();
182 intptr_t fraction_digits_value = fraction_digits.Value();
183 if (0 <= fraction_digits_value && fraction_digits_value <= 20 &&
184 kLowerBoundary < d && d < kUpperBoundary) {
185 return DoubleToStringAsFixed(d, static_cast<int>(fraction_digits_value));
186 } else {
187 Exceptions::ThrowArgumentError(String::Handle(
188 String::New("Illegal arguments to double.toStringAsFixed")));
189 return Object::null();
190 }
191}
StringPtr DoubleToStringAsFixed(double d, int fraction_digits)

◆ DEFINE_NATIVE_ENTRY() [78/345]

dart::DEFINE_NATIVE_ENTRY ( Double_toStringAsPrecision  ,
,
 
)

Definition at line 208 of file double.cc.

208 {
209 const Double& arg = Double::CheckedHandle(zone, arguments->NativeArgAt(0));
210 GET_NON_NULL_NATIVE_ARGUMENT(Smi, precision, arguments->NativeArgAt(1));
211 double d = arg.value();
212 intptr_t precision_value = precision.Value();
213 if (1 <= precision_value && precision_value <= 21) {
214 return DoubleToStringAsPrecision(d, static_cast<int>(precision_value));
215 } else {
216 Exceptions::ThrowArgumentError(String::Handle(
217 String::New("Illegal arguments to double.toStringAsPrecision")));
218 return Object::null();
219 }
220}
StringPtr DoubleToStringAsPrecision(double d, int precision)

◆ DEFINE_NATIVE_ENTRY() [79/345]

dart::DEFINE_NATIVE_ENTRY ( Double_truncate  ,
,
 
)

Definition at line 135 of file double.cc.

135 {
136 const Double& arg = Double::CheckedHandle(zone, arguments->NativeArgAt(0));
137 return Double::New(trunc(arg.value()));
138}

◆ DEFINE_NATIVE_ENTRY() [80/345]

dart::DEFINE_NATIVE_ENTRY ( Error_throwWithStackTrace  ,
,
 
)

Definition at line 174 of file errors.cc.

174 {
175 GET_NON_NULL_NATIVE_ARGUMENT(Instance, error, arguments->NativeArgAt(0));
176 GET_NON_NULL_NATIVE_ARGUMENT(Instance, stacktrace, arguments->NativeArgAt(1));
177 Exceptions::ThrowWithStackTrace(thread, error, stacktrace);
178 return Object::null();
179}

◆ DEFINE_NATIVE_ENTRY() [81/345]

dart::DEFINE_NATIVE_ENTRY ( Ffi_createNativeCallableIsolateLocal  ,
,
 
)

Definition at line 39 of file ffi.cc.

39 {
40 const auto& trampoline =
41 Function::CheckedHandle(zone, arguments->NativeArg0());
42 const auto& target = Closure::CheckedHandle(zone, arguments->NativeArgAt(1));
43 const bool keep_isolate_alive =
44 Bool::CheckedHandle(zone, arguments->NativeArgAt(2)).value();
45 return Pointer::New(isolate->CreateIsolateLocalFfiCallback(
46 zone, trampoline, target, keep_isolate_alive));
47}

◆ DEFINE_NATIVE_ENTRY() [82/345]

dart::DEFINE_NATIVE_ENTRY ( Ffi_createNativeCallableListener  ,
,
 
)

Definition at line 30 of file ffi.cc.

30 {
31 const auto& send_function =
32 Function::CheckedHandle(zone, arguments->NativeArg0());
33 const auto& port =
34 ReceivePort::CheckedHandle(zone, arguments->NativeArgAt(1));
35 return Pointer::New(
36 isolate->CreateAsyncFfiCallback(zone, send_function, port.Id()));
37}

◆ DEFINE_NATIVE_ENTRY() [83/345]

dart::DEFINE_NATIVE_ENTRY ( Ffi_deleteNativeCallable  ,
,
 
)

Definition at line 49 of file ffi.cc.

49 {
50 const auto& pointer = Pointer::CheckedHandle(zone, arguments->NativeArg0());
51 isolate->DeleteFfiCallback(pointer.NativeAddress());
52 return Object::null();
53}

◆ DEFINE_NATIVE_ENTRY() [84/345]

dart::DEFINE_NATIVE_ENTRY ( Ffi_dl_close  ,
,
 
)

Definition at line 189 of file ffi_dynamic_library.cc.

189 {
190 GET_NON_NULL_NATIVE_ARGUMENT(DynamicLibrary, dlib, arguments->NativeArgAt(0));
191 if (dlib.IsClosed()) {
192 // Already closed, nothing to do
193 } else if (!dlib.CanBeClosed()) {
194 const String& msg = String::Handle(
195 String::New("DynamicLibrary.process() and DynamicLibrary.executable() "
196 "can't be closed."));
197 Exceptions::ThrowStateError(msg);
198 } else {
199 void* handle = dlib.GetHandle();
200 char* error = nullptr;
201 Utils::UnloadDynamicLibrary(handle, &error);
202
203 if (error == nullptr) {
204 dlib.SetClosed(true);
205 } else {
206 const String& msg = String::Handle(String::New(error));
207 free(error);
208 Exceptions::ThrowStateError(msg);
209 }
210 }
211
212 return Object::null();
213}

◆ DEFINE_NATIVE_ENTRY() [85/345]

dart::DEFINE_NATIVE_ENTRY ( Ffi_dl_executableLibrary  ,
,
 
)

Definition at line 185 of file ffi_dynamic_library.cc.

185 {
186 return DynamicLibrary::New(LoadDynamicLibrary(nullptr), false);
187}
static void * LoadDynamicLibrary(const char *library_file, char **error=nullptr)

◆ DEFINE_NATIVE_ENTRY() [86/345]

dart::DEFINE_NATIVE_ENTRY ( Ffi_dl_getHandle  ,
,
 
)

Definition at line 240 of file ffi_dynamic_library.cc.

240 {
241 GET_NON_NULL_NATIVE_ARGUMENT(DynamicLibrary, dlib, arguments->NativeArgAt(0));
242
243 intptr_t handle = reinterpret_cast<intptr_t>(dlib.GetHandle());
244 return Integer::NewFromUint64(handle);
245}

◆ DEFINE_NATIVE_ENTRY() [87/345]

dart::DEFINE_NATIVE_ENTRY ( Ffi_dl_lookup  ,
,
 
)

Definition at line 215 of file ffi_dynamic_library.cc.

215 {
216 GET_NON_NULL_NATIVE_ARGUMENT(DynamicLibrary, dlib, arguments->NativeArgAt(0));
218 arguments->NativeArgAt(1));
219
220 if (dlib.IsClosed()) {
221 const String& msg =
222 String::Handle(String::New("Cannot lookup symbols in closed library."));
223 Exceptions::ThrowStateError(msg);
224 }
225
226 void* handle = dlib.GetHandle();
227
228 char* error = nullptr;
229 const uword pointer = reinterpret_cast<uword>(
230 ResolveSymbol(handle, argSymbolName.ToCString(), &error));
231 if (error != nullptr) {
232 const String& msg = String::Handle(String::NewFormatted(
233 "Failed to lookup symbol '%s': %s", argSymbolName.ToCString(), error));
234 free(error);
235 Exceptions::ThrowArgumentError(msg);
236 }
237 return Pointer::New(pointer);
238}

◆ DEFINE_NATIVE_ENTRY() [88/345]

dart::DEFINE_NATIVE_ENTRY ( Ffi_dl_open  ,
,
 
)

Definition at line 163 of file ffi_dynamic_library.cc.

163 {
164 GET_NON_NULL_NATIVE_ARGUMENT(String, lib_path, arguments->NativeArgAt(0));
165
166 char* error = nullptr;
167 void* handle = LoadDynamicLibrary(lib_path.ToCString(), &error);
168 if (error != nullptr) {
169 const String& msg = String::Handle(String::New(error));
170 free(error);
171 Exceptions::ThrowArgumentError(msg);
172 }
173 return DynamicLibrary::New(handle, true);
174}

◆ DEFINE_NATIVE_ENTRY() [89/345]

dart::DEFINE_NATIVE_ENTRY ( Ffi_dl_processLibrary  ,
,
 
)

Definition at line 176 of file ffi_dynamic_library.cc.

176 {
177#if defined(DART_HOST_OS_LINUX) || defined(DART_HOST_OS_MACOS) || \
178 defined(DART_HOST_OS_ANDROID) || defined(DART_HOST_OS_FUCHSIA)
179 return DynamicLibrary::New(RTLD_DEFAULT, false);
180#else
181 return DynamicLibrary::New(kWindowsDynamicLibraryProcessPtr, false);
182#endif
183}

◆ DEFINE_NATIVE_ENTRY() [90/345]

dart::DEFINE_NATIVE_ENTRY ( Ffi_dl_providesSymbol  ,
,
 
)

Definition at line 247 of file ffi_dynamic_library.cc.

247 {
248 GET_NON_NULL_NATIVE_ARGUMENT(DynamicLibrary, dlib, arguments->NativeArgAt(0));
250 arguments->NativeArgAt(1));
251
252 void* handle = dlib.GetHandle();
253 return Bool::Get(SymbolExists(handle, argSymbolName.ToCString())).ptr();
254}
static bool SymbolExists(void *handle, const char *symbol)

◆ DEFINE_NATIVE_ENTRY() [91/345]

dart::DEFINE_NATIVE_ENTRY ( Ffi_GetFfiNativeResolver  ,
,
 
)

Definition at line 537 of file ffi_dynamic_library.cc.

537 {
538 return Pointer::New(reinterpret_cast<intptr_t>(FfiResolve));
539}

◆ DEFINE_NATIVE_ENTRY() [92/345]

dart::DEFINE_NATIVE_ENTRY ( Ffi_updateNativeCallableKeepIsolateAliveCounter  ,
,
 
)

Definition at line 55 of file ffi.cc.

55 {
56 const int64_t delta =
57 Integer::CheckedHandle(zone, arguments->NativeArg0()).AsInt64Value();
58 isolate->UpdateNativeCallableKeepIsolateAliveCounter(delta);
59 return Object::null();
60}

◆ DEFINE_NATIVE_ENTRY() [93/345]

dart::DEFINE_NATIVE_ENTRY ( Float32x4_abs  ,
,
 
)

Definition at line 177 of file simd128.cc.

177 {
178 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0));
179 float _x = fabsf(self.x());
180 float _y = fabsf(self.y());
181 float _z = fabsf(self.z());
182 float _w = fabsf(self.w());
183 return Float32x4::New(_x, _y, _z, _w);
184}

◆ DEFINE_NATIVE_ENTRY() [94/345]

dart::DEFINE_NATIVE_ENTRY ( Float32x4_add  ,
,
 
)

Definition at line 57 of file simd128.cc.

57 {
58 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0));
59 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, other, arguments->NativeArgAt(1));
60 float _x = self.x() + other.x();
61 float _y = self.y() + other.y();
62 float _z = self.z() + other.z();
63 float _w = self.w() + other.w();
64 return Float32x4::New(_x, _y, _z, _w);
65}

◆ DEFINE_NATIVE_ENTRY() [95/345]

dart::DEFINE_NATIVE_ENTRY ( Float32x4_clamp  ,
,
 
)

Definition at line 186 of file simd128.cc.

186 {
187 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0));
188 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, lo, arguments->NativeArgAt(1));
189 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, hi, arguments->NativeArgAt(2));
190 // The order of the clamping must match the order of the optimized code:
191 // MAX(MIN(self, hi), lo).
192 float _x;
193 float _y;
194 float _z;
195 float _w;
196 // ARM semantics are different from X86/X64 at an instruction level. Ensure
197 // that we match the semantics of the architecture in the C version.
198#if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) || \
199 defined(USING_SIMULATOR)
200 _x = self.x() < hi.x() ? self.x() : hi.x();
201 _y = self.y() < hi.y() ? self.y() : hi.y();
202 _z = self.z() < hi.z() ? self.z() : hi.z();
203 _w = self.w() < hi.w() ? self.w() : hi.w();
204 _x = lo.x() < _x ? _x : lo.x();
205 _y = lo.y() < _y ? _y : lo.y();
206 _z = lo.z() < _z ? _z : lo.z();
207 _w = lo.w() < _w ? _w : lo.w();
208#else
209 _x = fminf(self.x(), hi.x());
210 _y = fminf(self.y(), hi.y());
211 _z = fminf(self.z(), hi.z());
212 _w = fminf(self.w(), hi.w());
213 _x = fmaxf(_x, lo.x());
214 _y = fmaxf(_y, lo.y());
215 _z = fmaxf(_z, lo.z());
216 _w = fmaxf(_w, lo.w());
217#endif
218 return Float32x4::New(_x, _y, _z, _w);
219}

◆ DEFINE_NATIVE_ENTRY() [96/345]

dart::DEFINE_NATIVE_ENTRY ( Float32x4_cmpequal  ,
,
 
)

Definition at line 146 of file simd128.cc.

146 {
147 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, a, arguments->NativeArgAt(0));
148 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, b, arguments->NativeArgAt(1));
149 uint32_t _x = a.x() == b.x() ? 0xFFFFFFFF : 0x0;
150 uint32_t _y = a.y() == b.y() ? 0xFFFFFFFF : 0x0;
151 uint32_t _z = a.z() == b.z() ? 0xFFFFFFFF : 0x0;
152 uint32_t _w = a.w() == b.w() ? 0xFFFFFFFF : 0x0;
153 return Int32x4::New(_x, _y, _z, _w);
154}

◆ DEFINE_NATIVE_ENTRY() [97/345]

dart::DEFINE_NATIVE_ENTRY ( Float32x4_cmpgt  ,
,
 
)

Definition at line 126 of file simd128.cc.

126 {
127 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, a, arguments->NativeArgAt(0));
128 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, b, arguments->NativeArgAt(1));
129 uint32_t _x = a.x() > b.x() ? 0xFFFFFFFF : 0x0;
130 uint32_t _y = a.y() > b.y() ? 0xFFFFFFFF : 0x0;
131 uint32_t _z = a.z() > b.z() ? 0xFFFFFFFF : 0x0;
132 uint32_t _w = a.w() > b.w() ? 0xFFFFFFFF : 0x0;
133 return Int32x4::New(_x, _y, _z, _w);
134}

◆ DEFINE_NATIVE_ENTRY() [98/345]

dart::DEFINE_NATIVE_ENTRY ( Float32x4_cmpgte  ,
,
 
)

Definition at line 136 of file simd128.cc.

136 {
137 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, a, arguments->NativeArgAt(0));
138 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, b, arguments->NativeArgAt(1));
139 uint32_t _x = a.x() >= b.x() ? 0xFFFFFFFF : 0x0;
140 uint32_t _y = a.y() >= b.y() ? 0xFFFFFFFF : 0x0;
141 uint32_t _z = a.z() >= b.z() ? 0xFFFFFFFF : 0x0;
142 uint32_t _w = a.w() >= b.w() ? 0xFFFFFFFF : 0x0;
143 return Int32x4::New(_x, _y, _z, _w);
144}

◆ DEFINE_NATIVE_ENTRY() [99/345]

dart::DEFINE_NATIVE_ENTRY ( Float32x4_cmplt  ,
,
 
)

Definition at line 106 of file simd128.cc.

106 {
107 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, a, arguments->NativeArgAt(0));
108 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, b, arguments->NativeArgAt(1));
109 uint32_t _x = a.x() < b.x() ? 0xFFFFFFFF : 0x0;
110 uint32_t _y = a.y() < b.y() ? 0xFFFFFFFF : 0x0;
111 uint32_t _z = a.z() < b.z() ? 0xFFFFFFFF : 0x0;
112 uint32_t _w = a.w() < b.w() ? 0xFFFFFFFF : 0x0;
113 return Int32x4::New(_x, _y, _z, _w);
114}

◆ DEFINE_NATIVE_ENTRY() [100/345]

dart::DEFINE_NATIVE_ENTRY ( Float32x4_cmplte  ,
,
 
)

Definition at line 116 of file simd128.cc.

116 {
117 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, a, arguments->NativeArgAt(0));
118 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, b, arguments->NativeArgAt(1));
119 uint32_t _x = a.x() <= b.x() ? 0xFFFFFFFF : 0x0;
120 uint32_t _y = a.y() <= b.y() ? 0xFFFFFFFF : 0x0;
121 uint32_t _z = a.z() <= b.z() ? 0xFFFFFFFF : 0x0;
122 uint32_t _w = a.w() <= b.w() ? 0xFFFFFFFF : 0x0;
123 return Int32x4::New(_x, _y, _z, _w);
124}

◆ DEFINE_NATIVE_ENTRY() [101/345]

dart::DEFINE_NATIVE_ENTRY ( Float32x4_cmpnequal  ,
,
 
)

Definition at line 156 of file simd128.cc.

156 {
157 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, a, arguments->NativeArgAt(0));
158 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, b, arguments->NativeArgAt(1));
159 uint32_t _x = a.x() != b.x() ? 0xFFFFFFFF : 0x0;
160 uint32_t _y = a.y() != b.y() ? 0xFFFFFFFF : 0x0;
161 uint32_t _z = a.z() != b.z() ? 0xFFFFFFFF : 0x0;
162 uint32_t _w = a.w() != b.w() ? 0xFFFFFFFF : 0x0;
163 return Int32x4::New(_x, _y, _z, _w);
164}

◆ DEFINE_NATIVE_ENTRY() [102/345]

dart::DEFINE_NATIVE_ENTRY ( Float32x4_div  ,
,
 
)

Definition at line 96 of file simd128.cc.

96 {
97 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0));
98 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, other, arguments->NativeArgAt(1));
99 float _x = Utils::DivideAllowZero(self.x(), other.x());
100 float _y = Utils::DivideAllowZero(self.y(), other.y());
101 float _z = Utils::DivideAllowZero(self.z(), other.z());
102 float _w = Utils::DivideAllowZero(self.w(), other.w());
103 return Float32x4::New(_x, _y, _z, _w);
104}

◆ DEFINE_NATIVE_ENTRY() [103/345]

dart::DEFINE_NATIVE_ENTRY ( Float32x4_fromDoubles  ,
,
 
)

Definition at line 21 of file simd128.cc.

21 {
22 GET_NON_NULL_NATIVE_ARGUMENT(Double, x, arguments->NativeArgAt(0));
23 GET_NON_NULL_NATIVE_ARGUMENT(Double, y, arguments->NativeArgAt(1));
24 GET_NON_NULL_NATIVE_ARGUMENT(Double, z, arguments->NativeArgAt(2));
25 GET_NON_NULL_NATIVE_ARGUMENT(Double, w, arguments->NativeArgAt(3));
26 float _x = static_cast<float>(x.value());
27 float _y = static_cast<float>(y.value());
28 float _z = static_cast<float>(z.value());
29 float _w = static_cast<float>(w.value());
30 return Float32x4::New(_x, _y, _z, _w);
31}
double y
SkScalar w

◆ DEFINE_NATIVE_ENTRY() [104/345]

dart::DEFINE_NATIVE_ENTRY ( Float32x4_fromFloat64x2  ,
,
 
)

Definition at line 50 of file simd128.cc.

50 {
51 GET_NON_NULL_NATIVE_ARGUMENT(Float64x2, v, arguments->NativeArgAt(1));
52 float _x = static_cast<float>(v.x());
53 float _y = static_cast<float>(v.y());
54 return Float32x4::New(_x, _y, 0.0f, 0.0f);
55}

◆ DEFINE_NATIVE_ENTRY() [105/345]

dart::DEFINE_NATIVE_ENTRY ( Float32x4_fromInt32x4Bits  ,
,
 
)

Definition at line 45 of file simd128.cc.

45 {
46 GET_NON_NULL_NATIVE_ARGUMENT(Int32x4, v, arguments->NativeArgAt(1));
47 return Float32x4::New(v.value());
48}

◆ DEFINE_NATIVE_ENTRY() [106/345]

dart::DEFINE_NATIVE_ENTRY ( Float32x4_getSignMask  ,
,
 
)

Definition at line 245 of file simd128.cc.

245 {
246 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0));
247 uint32_t mx = (bit_cast<uint32_t>(self.x()) & 0x80000000) >> 31;
248 uint32_t my = (bit_cast<uint32_t>(self.y()) & 0x80000000) >> 31;
249 uint32_t mz = (bit_cast<uint32_t>(self.z()) & 0x80000000) >> 31;
250 uint32_t mw = (bit_cast<uint32_t>(self.w()) & 0x80000000) >> 31;
251 uint32_t value = mx | (my << 1) | (mz << 2) | (mw << 3);
252 return Integer::New(value);
253}

◆ DEFINE_NATIVE_ENTRY() [107/345]

dart::DEFINE_NATIVE_ENTRY ( Float32x4_getW  ,
,
 
)

Definition at line 239 of file simd128.cc.

239 {
240 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0));
241 double value = static_cast<double>(self.w());
242 return Double::New(value);
243}

◆ DEFINE_NATIVE_ENTRY() [108/345]

dart::DEFINE_NATIVE_ENTRY ( Float32x4_getX  ,
,
 
)

Definition at line 221 of file simd128.cc.

221 {
222 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0));
223 double value = static_cast<double>(self.x());
224 return Double::New(value);
225}

◆ DEFINE_NATIVE_ENTRY() [109/345]

dart::DEFINE_NATIVE_ENTRY ( Float32x4_getY  ,
,
 
)

Definition at line 227 of file simd128.cc.

227 {
228 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0));
229 double value = static_cast<double>(self.y());
230 return Double::New(value);
231}

◆ DEFINE_NATIVE_ENTRY() [110/345]

dart::DEFINE_NATIVE_ENTRY ( Float32x4_getZ  ,
,
 
)

Definition at line 233 of file simd128.cc.

233 {
234 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0));
235 double value = static_cast<double>(self.z());
236 return Double::New(value);
237}

◆ DEFINE_NATIVE_ENTRY() [111/345]

dart::DEFINE_NATIVE_ENTRY ( Float32x4_max  ,
,
 
)

Definition at line 343 of file simd128.cc.

343 {
344 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0));
345 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, other, arguments->NativeArgAt(1));
346 float _x = self.x() > other.x() ? self.x() : other.x();
347 float _y = self.y() > other.y() ? self.y() : other.y();
348 float _z = self.z() > other.z() ? self.z() : other.z();
349 float _w = self.w() > other.w() ? self.w() : other.w();
350 return Float32x4::New(_x, _y, _z, _w);
351}

◆ DEFINE_NATIVE_ENTRY() [112/345]

dart::DEFINE_NATIVE_ENTRY ( Float32x4_min  ,
,
 
)

Definition at line 333 of file simd128.cc.

333 {
334 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0));
335 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, other, arguments->NativeArgAt(1));
336 float _x = self.x() < other.x() ? self.x() : other.x();
337 float _y = self.y() < other.y() ? self.y() : other.y();
338 float _z = self.z() < other.z() ? self.z() : other.z();
339 float _w = self.w() < other.w() ? self.w() : other.w();
340 return Float32x4::New(_x, _y, _z, _w);
341}

◆ DEFINE_NATIVE_ENTRY() [113/345]

dart::DEFINE_NATIVE_ENTRY ( Float32x4_mul  ,
,
 
)

Definition at line 86 of file simd128.cc.

86 {
87 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0));
88 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, other, arguments->NativeArgAt(1));
89 float _x = self.x() * other.x();
90 float _y = self.y() * other.y();
91 float _z = self.z() * other.z();
92 float _w = self.w() * other.w();
93 return Float32x4::New(_x, _y, _z, _w);
94}

◆ DEFINE_NATIVE_ENTRY() [114/345]

dart::DEFINE_NATIVE_ENTRY ( Float32x4_negate  ,
,
 
)

Definition at line 67 of file simd128.cc.

67 {
68 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0));
69 float _x = -self.x();
70 float _y = -self.y();
71 float _z = -self.z();
72 float _w = -self.w();
73 return Float32x4::New(_x, _y, _z, _w);
74}

◆ DEFINE_NATIVE_ENTRY() [115/345]

dart::DEFINE_NATIVE_ENTRY ( Float32x4_reciprocal  ,
,
 
)

Definition at line 362 of file simd128.cc.

362 {
363 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0));
364 float _x = Utils::DivideAllowZero(1.0f, self.x());
365 float _y = Utils::DivideAllowZero(1.0f, self.y());
366 float _z = Utils::DivideAllowZero(1.0f, self.z());
367 float _w = Utils::DivideAllowZero(1.0f, self.w());
368 return Float32x4::New(_x, _y, _z, _w);
369}

◆ DEFINE_NATIVE_ENTRY() [116/345]

dart::DEFINE_NATIVE_ENTRY ( Float32x4_reciprocalSqrt  ,
,
 
)

Definition at line 371 of file simd128.cc.

371 {
372 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0));
373 float _x = sqrtf(Utils::DivideAllowZero(1.0f, self.x()));
374 float _y = sqrtf(Utils::DivideAllowZero(1.0f, self.y()));
375 float _z = sqrtf(Utils::DivideAllowZero(1.0f, self.z()));
376 float _w = sqrtf(Utils::DivideAllowZero(1.0f, self.w()));
377 return Float32x4::New(_x, _y, _z, _w);
378}

◆ DEFINE_NATIVE_ENTRY() [117/345]

dart::DEFINE_NATIVE_ENTRY ( Float32x4_scale  ,
,
 
)

Definition at line 166 of file simd128.cc.

166 {
167 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0));
168 GET_NON_NULL_NATIVE_ARGUMENT(Double, scale, arguments->NativeArgAt(1));
169 float _s = static_cast<float>(scale.value());
170 float _x = self.x() * _s;
171 float _y = self.y() * _s;
172 float _z = self.z() * _s;
173 float _w = self.w() * _s;
174 return Float32x4::New(_x, _y, _z, _w);
175}
const Scalar scale

◆ DEFINE_NATIVE_ENTRY() [118/345]

dart::DEFINE_NATIVE_ENTRY ( Float32x4_setW  ,
,
 
)

Definition at line 323 of file simd128.cc.

323 {
324 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0));
325 GET_NON_NULL_NATIVE_ARGUMENT(Double, w, arguments->NativeArgAt(1));
326 float _x = self.x();
327 float _y = self.y();
328 float _z = self.z();
329 float _w = static_cast<float>(w.value());
330 return Float32x4::New(_x, _y, _z, _w);
331}

◆ DEFINE_NATIVE_ENTRY() [119/345]

dart::DEFINE_NATIVE_ENTRY ( Float32x4_setX  ,
,
 
)

Definition at line 293 of file simd128.cc.

293 {
294 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0));
295 GET_NON_NULL_NATIVE_ARGUMENT(Double, x, arguments->NativeArgAt(1));
296 float _x = static_cast<float>(x.value());
297 float _y = self.y();
298 float _z = self.z();
299 float _w = self.w();
300 return Float32x4::New(_x, _y, _z, _w);
301}

◆ DEFINE_NATIVE_ENTRY() [120/345]

dart::DEFINE_NATIVE_ENTRY ( Float32x4_setY  ,
,
 
)

Definition at line 303 of file simd128.cc.

303 {
304 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0));
305 GET_NON_NULL_NATIVE_ARGUMENT(Double, y, arguments->NativeArgAt(1));
306 float _x = self.x();
307 float _y = static_cast<float>(y.value());
308 float _z = self.z();
309 float _w = self.w();
310 return Float32x4::New(_x, _y, _z, _w);
311}

◆ DEFINE_NATIVE_ENTRY() [121/345]

dart::DEFINE_NATIVE_ENTRY ( Float32x4_setZ  ,
,
 
)

Definition at line 313 of file simd128.cc.

313 {
314 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0));
315 GET_NON_NULL_NATIVE_ARGUMENT(Double, z, arguments->NativeArgAt(1));
316 float _x = self.x();
317 float _y = self.y();
318 float _z = static_cast<float>(z.value());
319 float _w = self.w();
320 return Float32x4::New(_x, _y, _z, _w);
321}

◆ DEFINE_NATIVE_ENTRY() [122/345]

dart::DEFINE_NATIVE_ENTRY ( Float32x4_shuffle  ,
,
 
)

Definition at line 265 of file simd128.cc.

265 {
266 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0));
267 GET_NON_NULL_NATIVE_ARGUMENT(Integer, mask, arguments->NativeArgAt(1));
268 int64_t m = mask.AsInt64Value();
270 float data[4] = {self.x(), self.y(), self.z(), self.w()};
271 float _x = data[m & 0x3];
272 float _y = data[(m >> 2) & 0x3];
273 float _z = data[(m >> 4) & 0x3];
274 float _w = data[(m >> 6) & 0x3];
275 return Float32x4::New(_x, _y, _z, _w);
276}
static void ThrowMaskRangeException(int64_t m)
Definition simd128.cc:14

◆ DEFINE_NATIVE_ENTRY() [123/345]

dart::DEFINE_NATIVE_ENTRY ( Float32x4_shuffleMix  ,
,
 
)

Definition at line 278 of file simd128.cc.

278 {
279 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0));
280 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, other, arguments->NativeArgAt(1));
281 GET_NON_NULL_NATIVE_ARGUMENT(Integer, mask, arguments->NativeArgAt(2));
282 int64_t m = mask.AsInt64Value();
284 float data[4] = {self.x(), self.y(), self.z(), self.w()};
285 float other_data[4] = {other.x(), other.y(), other.z(), other.w()};
286 float _x = data[m & 0x3];
287 float _y = data[(m >> 2) & 0x3];
288 float _z = other_data[(m >> 4) & 0x3];
289 float _w = other_data[(m >> 6) & 0x3];
290 return Float32x4::New(_x, _y, _z, _w);
291}

◆ DEFINE_NATIVE_ENTRY() [124/345]

dart::DEFINE_NATIVE_ENTRY ( Float32x4_splat  ,
,
 
)

Definition at line 33 of file simd128.cc.

33 {
34 GET_NON_NULL_NATIVE_ARGUMENT(Double, v, arguments->NativeArgAt(0));
35 float _v = v.value();
36 return Float32x4::New(_v, _v, _v, _v);
37}

◆ DEFINE_NATIVE_ENTRY() [125/345]

dart::DEFINE_NATIVE_ENTRY ( Float32x4_sqrt  ,
,
 
)

Definition at line 353 of file simd128.cc.

353 {
354 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0));
355 float _x = sqrtf(self.x());
356 float _y = sqrtf(self.y());
357 float _z = sqrtf(self.z());
358 float _w = sqrtf(self.w());
359 return Float32x4::New(_x, _y, _z, _w);
360}

◆ DEFINE_NATIVE_ENTRY() [126/345]

dart::DEFINE_NATIVE_ENTRY ( Float32x4_sub  ,
,
 
)

Definition at line 76 of file simd128.cc.

76 {
77 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, self, arguments->NativeArgAt(0));
78 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, other, arguments->NativeArgAt(1));
79 float _x = self.x() - other.x();
80 float _y = self.y() - other.y();
81 float _z = self.z() - other.z();
82 float _w = self.w() - other.w();
83 return Float32x4::New(_x, _y, _z, _w);
84}

◆ DEFINE_NATIVE_ENTRY() [127/345]

dart::DEFINE_NATIVE_ENTRY ( Float32x4_zero  ,
,
 
)

Definition at line 39 of file simd128.cc.

39 {
40 ASSERT(
41 TypeArguments::CheckedHandle(zone, arguments->NativeArgAt(0)).IsNull());
42 return Float32x4::New(0.0f, 0.0f, 0.0f, 0.0f);
43}

◆ DEFINE_NATIVE_ENTRY() [128/345]

dart::DEFINE_NATIVE_ENTRY ( Float64x2_abs  ,
,
 
)

Definition at line 727 of file simd128.cc.

727 {
728 GET_NON_NULL_NATIVE_ARGUMENT(Float64x2, self, arguments->NativeArgAt(0));
729 double _x = fabs(self.x());
730 double _y = fabs(self.y());
731 return Float64x2::New(_x, _y);
732}

◆ DEFINE_NATIVE_ENTRY() [129/345]

dart::DEFINE_NATIVE_ENTRY ( Float64x2_add  ,
,
 
)

Definition at line 679 of file simd128.cc.

679 {
680 GET_NON_NULL_NATIVE_ARGUMENT(Float64x2, self, arguments->NativeArgAt(0));
681 GET_NON_NULL_NATIVE_ARGUMENT(Float64x2, other, arguments->NativeArgAt(1));
682 double _x = self.x() + other.x();
683 double _y = self.y() + other.y();
684 return Float64x2::New(_x, _y);
685}

◆ DEFINE_NATIVE_ENTRY() [130/345]

dart::DEFINE_NATIVE_ENTRY ( Float64x2_clamp  ,
,
 
)

Definition at line 734 of file simd128.cc.

734 {
735 GET_NON_NULL_NATIVE_ARGUMENT(Float64x2, self, arguments->NativeArgAt(0));
736 GET_NON_NULL_NATIVE_ARGUMENT(Float64x2, lo, arguments->NativeArgAt(1));
737 GET_NON_NULL_NATIVE_ARGUMENT(Float64x2, hi, arguments->NativeArgAt(2));
738 // The order of the clamping must match the order of the optimized code:
739 // MAX(MIN(self, hi), lo).
740 double _x;
741 double _y;
742
743 // ARM semantics are different from X86/X64 at an instruction level. Ensure
744 // that we match the semantics of the architecture in the C version.
745#if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) || \
746 defined(USING_SIMULATOR)
747 _x = self.x() < hi.x() ? self.x() : hi.x();
748 _y = self.y() < hi.y() ? self.y() : hi.y();
749 _x = lo.x() < _x ? _x : lo.x();
750 _y = lo.y() < _y ? _y : lo.y();
751#else
752 _x = fmin(self.x(), hi.x());
753 _y = fmin(self.y(), hi.y());
754 _x = fmax(_x, lo.x());
755 _y = fmax(_y, lo.y());
756#endif
757 return Float64x2::New(_x, _y);
758}

◆ DEFINE_NATIVE_ENTRY() [131/345]

dart::DEFINE_NATIVE_ENTRY ( Float64x2_div  ,
,
 
)

Definition at line 710 of file simd128.cc.

710 {
711 GET_NON_NULL_NATIVE_ARGUMENT(Float64x2, self, arguments->NativeArgAt(0));
712 GET_NON_NULL_NATIVE_ARGUMENT(Float64x2, other, arguments->NativeArgAt(1));
713 double _x = Utils::DivideAllowZero(self.x(), other.x());
714 double _y = Utils::DivideAllowZero(self.y(), other.y());
715 return Float64x2::New(_x, _y);
716}

◆ DEFINE_NATIVE_ENTRY() [132/345]

dart::DEFINE_NATIVE_ENTRY ( Float64x2_fromDoubles  ,
,
 
)

Definition at line 653 of file simd128.cc.

653 {
654 GET_NON_NULL_NATIVE_ARGUMENT(Double, x, arguments->NativeArgAt(0));
655 GET_NON_NULL_NATIVE_ARGUMENT(Double, y, arguments->NativeArgAt(1));
656 return Float64x2::New(x.value(), y.value());
657}

◆ DEFINE_NATIVE_ENTRY() [133/345]

dart::DEFINE_NATIVE_ENTRY ( Float64x2_fromFloat32x4  ,
,
 
)

Definition at line 670 of file simd128.cc.

670 {
671 ASSERT(
672 TypeArguments::CheckedHandle(zone, arguments->NativeArgAt(0)).IsNull());
673 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, v, arguments->NativeArgAt(1));
674 double _x = v.x();
675 double _y = v.y();
676 return Float64x2::New(_x, _y);
677}

◆ DEFINE_NATIVE_ENTRY() [134/345]

dart::DEFINE_NATIVE_ENTRY ( Float64x2_getSignMask  ,
,
 
)

Definition at line 770 of file simd128.cc.

770 {
771 GET_NON_NULL_NATIVE_ARGUMENT(Float64x2, self, arguments->NativeArgAt(0));
772 uint32_t mx = (bit_cast<uint64_t>(self.x()) & 0x8000000000000000LL) >> 63;
773 uint32_t my = (bit_cast<uint64_t>(self.y()) & 0x8000000000000000LL) >> 63;
774 uint32_t value = mx | (my << 1);
775 return Integer::New(value);
776}

◆ DEFINE_NATIVE_ENTRY() [135/345]

dart::DEFINE_NATIVE_ENTRY ( Float64x2_getX  ,
,
 
)

Definition at line 760 of file simd128.cc.

760 {
761 GET_NON_NULL_NATIVE_ARGUMENT(Float64x2, self, arguments->NativeArgAt(0));
762 return Double::New(self.x());
763}

◆ DEFINE_NATIVE_ENTRY() [136/345]

dart::DEFINE_NATIVE_ENTRY ( Float64x2_getY  ,
,
 
)

Definition at line 765 of file simd128.cc.

765 {
766 GET_NON_NULL_NATIVE_ARGUMENT(Float64x2, self, arguments->NativeArgAt(0));
767 return Double::New(self.y());
768}

◆ DEFINE_NATIVE_ENTRY() [137/345]

dart::DEFINE_NATIVE_ENTRY ( Float64x2_max  ,
,
 
)

Definition at line 802 of file simd128.cc.

802 {
803 GET_NON_NULL_NATIVE_ARGUMENT(Float64x2, self, arguments->NativeArgAt(0));
804 GET_NON_NULL_NATIVE_ARGUMENT(Float64x2, other, arguments->NativeArgAt(1));
805 double _x = self.x() > other.x() ? self.x() : other.x();
806 double _y = self.y() > other.y() ? self.y() : other.y();
807 return Float64x2::New(_x, _y);
808}

◆ DEFINE_NATIVE_ENTRY() [138/345]

dart::DEFINE_NATIVE_ENTRY ( Float64x2_min  ,
,
 
)

Definition at line 794 of file simd128.cc.

794 {
795 GET_NON_NULL_NATIVE_ARGUMENT(Float64x2, self, arguments->NativeArgAt(0));
796 GET_NON_NULL_NATIVE_ARGUMENT(Float64x2, other, arguments->NativeArgAt(1));
797 double _x = self.x() < other.x() ? self.x() : other.x();
798 double _y = self.y() < other.y() ? self.y() : other.y();
799 return Float64x2::New(_x, _y);
800}

◆ DEFINE_NATIVE_ENTRY() [139/345]

dart::DEFINE_NATIVE_ENTRY ( Float64x2_mul  ,
,
 
)

Definition at line 702 of file simd128.cc.

702 {
703 GET_NON_NULL_NATIVE_ARGUMENT(Float64x2, self, arguments->NativeArgAt(0));
704 GET_NON_NULL_NATIVE_ARGUMENT(Float64x2, other, arguments->NativeArgAt(1));
705 double _x = self.x() * other.x();
706 double _y = self.y() * other.y();
707 return Float64x2::New(_x, _y);
708}

◆ DEFINE_NATIVE_ENTRY() [140/345]

dart::DEFINE_NATIVE_ENTRY ( Float64x2_negate  ,
,
 
)

Definition at line 687 of file simd128.cc.

687 {
688 GET_NON_NULL_NATIVE_ARGUMENT(Float64x2, self, arguments->NativeArgAt(0));
689 double _x = -self.x();
690 double _y = -self.y();
691 return Float64x2::New(_x, _y);
692}

◆ DEFINE_NATIVE_ENTRY() [141/345]

dart::DEFINE_NATIVE_ENTRY ( Float64x2_scale  ,
,
 
)

Definition at line 718 of file simd128.cc.

718 {
719 GET_NON_NULL_NATIVE_ARGUMENT(Float64x2, self, arguments->NativeArgAt(0));
720 GET_NON_NULL_NATIVE_ARGUMENT(Double, scale, arguments->NativeArgAt(1));
721 double _s = scale.value();
722 double _x = self.x() * _s;
723 double _y = self.y() * _s;
724 return Float64x2::New(_x, _y);
725}

◆ DEFINE_NATIVE_ENTRY() [142/345]

dart::DEFINE_NATIVE_ENTRY ( Float64x2_setX  ,
,
 
)

Definition at line 778 of file simd128.cc.

778 {
779 GET_NON_NULL_NATIVE_ARGUMENT(Float64x2, self, arguments->NativeArgAt(0));
780 GET_NON_NULL_NATIVE_ARGUMENT(Double, x, arguments->NativeArgAt(1));
781 double _x = x.value();
782 double _y = self.y();
783 return Float64x2::New(_x, _y);
784}

◆ DEFINE_NATIVE_ENTRY() [143/345]

dart::DEFINE_NATIVE_ENTRY ( Float64x2_setY  ,
,
 
)

Definition at line 786 of file simd128.cc.

786 {
787 GET_NON_NULL_NATIVE_ARGUMENT(Float64x2, self, arguments->NativeArgAt(0));
788 GET_NON_NULL_NATIVE_ARGUMENT(Double, y, arguments->NativeArgAt(1));
789 double _x = self.x();
790 double _y = y.value();
791 return Float64x2::New(_x, _y);
792}

◆ DEFINE_NATIVE_ENTRY() [144/345]

dart::DEFINE_NATIVE_ENTRY ( Float64x2_splat  ,
,
 
)

Definition at line 659 of file simd128.cc.

659 {
660 GET_NON_NULL_NATIVE_ARGUMENT(Double, v, arguments->NativeArgAt(0));
661 return Float64x2::New(v.value(), v.value());
662}

◆ DEFINE_NATIVE_ENTRY() [145/345]

dart::DEFINE_NATIVE_ENTRY ( Float64x2_sqrt  ,
,
 
)

Definition at line 810 of file simd128.cc.

810 {
811 GET_NON_NULL_NATIVE_ARGUMENT(Float64x2, self, arguments->NativeArgAt(0));
812 double _x = sqrt(self.x());
813 double _y = sqrt(self.y());
814 return Float64x2::New(_x, _y);
815}

◆ DEFINE_NATIVE_ENTRY() [146/345]

dart::DEFINE_NATIVE_ENTRY ( Float64x2_sub  ,
,
 
)

Definition at line 694 of file simd128.cc.

694 {
695 GET_NON_NULL_NATIVE_ARGUMENT(Float64x2, self, arguments->NativeArgAt(0));
696 GET_NON_NULL_NATIVE_ARGUMENT(Float64x2, other, arguments->NativeArgAt(1));
697 double _x = self.x() - other.x();
698 double _y = self.y() - other.y();
699 return Float64x2::New(_x, _y);
700}

◆ DEFINE_NATIVE_ENTRY() [147/345]

dart::DEFINE_NATIVE_ENTRY ( Float64x2_zero  ,
,
 
)

Definition at line 664 of file simd128.cc.

664 {
665 ASSERT(
666 TypeArguments::CheckedHandle(zone, arguments->NativeArgAt(0)).IsNull());
667 return Float64x2::New(0.0, 0.0);
668}

◆ DEFINE_NATIVE_ENTRY() [148/345]

dart::DEFINE_NATIVE_ENTRY ( Function_apply  ,
,
 
)

Definition at line 16 of file function.cc.

16 {
17 const int kTypeArgsLen = 0; // TODO(regis): Add support for generic function.
18 const Array& fun_arguments =
19 Array::CheckedHandle(zone, arguments->NativeArgAt(0));
20 const Array& fun_arg_names =
21 Array::CheckedHandle(zone, arguments->NativeArgAt(1));
22 const Array& fun_args_desc = Array::Handle(
23 zone, ArgumentsDescriptor::NewBoxed(kTypeArgsLen, fun_arguments.Length(),
24 fun_arg_names));
25 const Object& result = Object::Handle(
26 zone, DartEntry::InvokeClosure(thread, fun_arguments, fun_args_desc));
27 if (result.IsError()) {
28 Exceptions::PropagateError(Error::Cast(result));
29 }
30 return result.ptr();
31}

◆ DEFINE_NATIVE_ENTRY() [149/345]

dart::DEFINE_NATIVE_ENTRY ( FunctionTypeMirror_call_method  ,
,
 
)

Definition at line 883 of file mirrors.cc.

883 {
885 arguments->NativeArgAt(0));
886 // Return get:call() method on class _Closure.
887 const auto& getter_name = Symbols::GetCall();
888 const Class& closure_class =
889 Class::Handle(IsolateGroup::Current()->object_store()->closure_class());
890 const Function& get_call = Function::Handle(
891 Resolver::ResolveDynamicAnyArgs(zone, closure_class, getter_name,
892 /*allow_add=*/false));
893 ASSERT(!get_call.IsNull());
894 return CreateMethodMirror(get_call, owner_mirror, AbstractType::Handle());
895}

◆ DEFINE_NATIVE_ENTRY() [150/345]

dart::DEFINE_NATIVE_ENTRY ( FunctionTypeMirror_parameters  ,
,
 
)

Definition at line 897 of file mirrors.cc.

897 {
898 GET_NON_NULL_NATIVE_ARGUMENT(Instance, owner, arguments->NativeArgAt(0));
899 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(1));
900 const FunctionType& sig = FunctionType::Handle(ref.GetFunctionTypeReferent());
901 return CreateParameterMirrorList(Object::null_function(), sig, owner);
902}
static InstancePtr CreateParameterMirrorList(const Function &func, const FunctionType &signature, const Instance &owner_mirror)
Definition mirrors.cc:96

◆ DEFINE_NATIVE_ENTRY() [151/345]

dart::DEFINE_NATIVE_ENTRY ( FunctionTypeMirror_return_type  ,
,
 
)

Definition at line 904 of file mirrors.cc.

904 {
905 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0));
906 const FunctionType& sig = FunctionType::Handle(ref.GetFunctionTypeReferent());
907 ASSERT(!sig.IsNull());
908 AbstractType& type = AbstractType::Handle(sig.result_type());
909 // Signatures of function types are instantiated, but not canonical.
910 return type.Canonicalize(thread);
911}
AbstractTypePtr result_type() const
Definition object.h:9650

◆ DEFINE_NATIVE_ENTRY() [152/345]

dart::DEFINE_NATIVE_ENTRY ( GrowableList_allocate  ,
,
 
)

Definition at line 15 of file growable_array.cc.

15 {
16 const TypeArguments& type_arguments =
17 TypeArguments::CheckedHandle(zone, arguments->NativeArgAt(0));
18 GET_NON_NULL_NATIVE_ARGUMENT(Array, data, arguments->NativeArgAt(1));
19 if (data.Length() < 0) {
20 Exceptions::ThrowRangeError("length",
21 Integer::Handle(Integer::New(data.Length())),
22 0, // This is the limit the user sees.
23 Array::kMaxElements);
24 }
25 const GrowableObjectArray& new_array =
26 GrowableObjectArray::Handle(GrowableObjectArray::New(data));
27 new_array.SetTypeArguments(type_arguments);
28 return new_array.ptr();
29}

◆ DEFINE_NATIVE_ENTRY() [153/345]

dart::DEFINE_NATIVE_ENTRY ( GrowableList_getCapacity  ,
,
 
)

Definition at line 49 of file growable_array.cc.

49 {
50 const GrowableObjectArray& array =
51 GrowableObjectArray::CheckedHandle(zone, arguments->NativeArgAt(0));
52 return Smi::New(array.Capacity());
53}
intptr_t Capacity() const
Definition object.h:11041

◆ DEFINE_NATIVE_ENTRY() [154/345]

dart::DEFINE_NATIVE_ENTRY ( GrowableList_getLength  ,
,
 
)

Definition at line 43 of file growable_array.cc.

43 {
44 const GrowableObjectArray& array =
45 GrowableObjectArray::CheckedHandle(zone, arguments->NativeArgAt(0));
46 return Smi::New(array.Length());
47}

◆ DEFINE_NATIVE_ENTRY() [155/345]

dart::DEFINE_NATIVE_ENTRY ( GrowableList_setData  ,
,
 
)

Definition at line 64 of file growable_array.cc.

64 {
65 const GrowableObjectArray& array =
66 GrowableObjectArray::CheckedHandle(zone, arguments->NativeArgAt(0));
67 GET_NON_NULL_NATIVE_ARGUMENT(Array, data, arguments->NativeArgAt(1));
68 ASSERT(data.Length() >= 0);
69 array.SetData(data);
70 return Object::null();
71}
void SetData(const Array &value) const
Definition object.h:11057

◆ DEFINE_NATIVE_ENTRY() [156/345]

dart::DEFINE_NATIVE_ENTRY ( GrowableList_setIndexed  ,
,
 
)

Definition at line 31 of file growable_array.cc.

31 {
32 const GrowableObjectArray& array =
33 GrowableObjectArray::CheckedHandle(zone, arguments->NativeArgAt(0));
34 GET_NON_NULL_NATIVE_ARGUMENT(Smi, index, arguments->NativeArgAt(1));
35 if ((index.Value() < 0) || (index.Value() >= array.Length())) {
36 Exceptions::ThrowRangeError("index", index, 0, array.Length() - 1);
37 }
38 GET_NON_NULL_NATIVE_ARGUMENT(Instance, value, arguments->NativeArgAt(2));
39 array.SetAt(index.Value(), value);
40 return Object::null();
41}
void SetAt(intptr_t index, const Object &value) const
Definition object.h:11065

◆ DEFINE_NATIVE_ENTRY() [157/345]

dart::DEFINE_NATIVE_ENTRY ( GrowableList_setLength  ,
,
 
)

Definition at line 55 of file growable_array.cc.

55 {
56 const GrowableObjectArray& array =
57 GrowableObjectArray::CheckedHandle(zone, arguments->NativeArgAt(0));
58 GET_NON_NULL_NATIVE_ARGUMENT(Smi, length, arguments->NativeArgAt(1));
59 ASSERT((length.Value() >= 0) && (length.Value() <= array.Capacity()));
60 array.SetLength(length.Value());
61 return Object::null();
62}
void SetLength(intptr_t value) const
Definition object.h:11050

◆ DEFINE_NATIVE_ENTRY() [158/345]

dart::DEFINE_NATIVE_ENTRY ( Identical_comparison  ,
,
 
)

Definition at line 11 of file identical.cc.

11 {
12 GET_NATIVE_ARGUMENT(Instance, a, arguments->NativeArgAt(0));
13 GET_NATIVE_ARGUMENT(Instance, b, arguments->NativeArgAt(1));
14 const bool is_identical = a.IsIdenticalTo(b);
15 return Bool::Get(is_identical).ptr();
16}

◆ DEFINE_NATIVE_ENTRY() [159/345]

dart::DEFINE_NATIVE_ENTRY ( ImmutableList_from  ,
,
 
)

Definition at line 58 of file array.cc.

58 {
59 // Ignore first argument of this factory (type argument).
60 const Array& from_array =
61 Array::CheckedHandle(zone, arguments->NativeArgAt(1));
62 const Smi& smi_offset = Smi::CheckedHandle(zone, arguments->NativeArgAt(2));
63 const Smi& smi_length = Smi::CheckedHandle(zone, arguments->NativeArgAt(3));
64 const intptr_t length = smi_length.Value();
65 const intptr_t offset = smi_offset.Value();
66 const Array& result = Array::Handle(Array::New(length));
67 Object& temp = Object::Handle();
68 for (intptr_t i = 0; i < length; i++) {
69 temp = from_array.At(i + offset);
70 result.SetAt(i, temp);
71 }
72 result.MakeImmutable();
73 return result.ptr();
74}

◆ DEFINE_NATIVE_ENTRY() [160/345]

dart::DEFINE_NATIVE_ENTRY ( InstanceMirror_computeType  ,
,
 
)

Definition at line 1255 of file mirrors.cc.

1255 {
1256 GET_NON_NULL_NATIVE_ARGUMENT(Instance, instance, arguments->NativeArgAt(0));
1257 const AbstractType& type = AbstractType::Handle(instance.GetType(Heap::kNew));
1258 // The static type of null is specified to be the bottom type, however, the
1259 // runtime type of null is the Null type, which we correctly return here.
1260 return type.Canonicalize(thread);
1261}

◆ DEFINE_NATIVE_ENTRY() [161/345]

dart::DEFINE_NATIVE_ENTRY ( InstanceMirror_invoke  ,
,
 
)

Definition at line 1224 of file mirrors.cc.

1224 {
1225 // Argument 0 is the mirror, which is unused by the native. It exists
1226 // because this native is an instance method in order to be polymorphic
1227 // with its cousins.
1228 GET_NATIVE_ARGUMENT(Instance, reflectee, arguments->NativeArgAt(1));
1229 GET_NON_NULL_NATIVE_ARGUMENT(String, function_name,
1230 arguments->NativeArgAt(2));
1231 GET_NON_NULL_NATIVE_ARGUMENT(Array, args, arguments->NativeArgAt(3));
1232 GET_NON_NULL_NATIVE_ARGUMENT(Array, arg_names, arguments->NativeArgAt(4));
1233 RETURN_OR_PROPAGATE(reflectee.Invoke(function_name, args, arg_names));
1234}

◆ DEFINE_NATIVE_ENTRY() [162/345]

dart::DEFINE_NATIVE_ENTRY ( InstanceMirror_invokeGetter  ,
,
 
)

Definition at line 1236 of file mirrors.cc.

1236 {
1237 // Argument 0 is the mirror, which is unused by the native. It exists
1238 // because this native is an instance method in order to be polymorphic
1239 // with its cousins.
1240 GET_NATIVE_ARGUMENT(Instance, reflectee, arguments->NativeArgAt(1));
1241 GET_NON_NULL_NATIVE_ARGUMENT(String, getter_name, arguments->NativeArgAt(2));
1242 RETURN_OR_PROPAGATE(reflectee.InvokeGetter(getter_name));
1243}

◆ DEFINE_NATIVE_ENTRY() [163/345]

dart::DEFINE_NATIVE_ENTRY ( InstanceMirror_invokeSetter  ,
,
 
)

Definition at line 1245 of file mirrors.cc.

1245 {
1246 // Argument 0 is the mirror, which is unused by the native. It exists
1247 // because this native is an instance method in order to be polymorphic
1248 // with its cousins.
1249 GET_NATIVE_ARGUMENT(Instance, reflectee, arguments->NativeArgAt(1));
1250 GET_NON_NULL_NATIVE_ARGUMENT(String, setter_name, arguments->NativeArgAt(2));
1251 GET_NATIVE_ARGUMENT(Instance, value, arguments->NativeArgAt(3));
1252 RETURN_OR_PROPAGATE(reflectee.InvokeSetter(setter_name, value));
1253}

◆ DEFINE_NATIVE_ENTRY() [164/345]

dart::DEFINE_NATIVE_ENTRY ( Int32x4_add  ,
,
 
)

Definition at line 439 of file simd128.cc.

439 {
440 GET_NON_NULL_NATIVE_ARGUMENT(Int32x4, self, arguments->NativeArgAt(0));
441 GET_NON_NULL_NATIVE_ARGUMENT(Int32x4, other, arguments->NativeArgAt(1));
442 int32_t _x = self.x() + other.x();
443 int32_t _y = self.y() + other.y();
444 int32_t _z = self.z() + other.z();
445 int32_t _w = self.w() + other.w();
446 return Int32x4::New(_x, _y, _z, _w);
447}

◆ DEFINE_NATIVE_ENTRY() [165/345]

dart::DEFINE_NATIVE_ENTRY ( Int32x4_and  ,
,
 
)

Definition at line 419 of file simd128.cc.

419 {
420 GET_NON_NULL_NATIVE_ARGUMENT(Int32x4, self, arguments->NativeArgAt(0));
421 GET_NON_NULL_NATIVE_ARGUMENT(Int32x4, other, arguments->NativeArgAt(1));
422 int32_t _x = self.x() & other.x();
423 int32_t _y = self.y() & other.y();
424 int32_t _z = self.z() & other.z();
425 int32_t _w = self.w() & other.w();
426 return Int32x4::New(_x, _y, _z, _w);
427}

◆ DEFINE_NATIVE_ENTRY() [166/345]

dart::DEFINE_NATIVE_ENTRY ( Int32x4_fromBools  ,
,
 
)

Definition at line 392 of file simd128.cc.

392 {
393 GET_NON_NULL_NATIVE_ARGUMENT(Bool, x, arguments->NativeArgAt(0));
394 GET_NON_NULL_NATIVE_ARGUMENT(Bool, y, arguments->NativeArgAt(1));
395 GET_NON_NULL_NATIVE_ARGUMENT(Bool, z, arguments->NativeArgAt(2));
396 GET_NON_NULL_NATIVE_ARGUMENT(Bool, w, arguments->NativeArgAt(3));
397 int32_t _x = x.value() ? 0xFFFFFFFF : 0x0;
398 int32_t _y = y.value() ? 0xFFFFFFFF : 0x0;
399 int32_t _z = z.value() ? 0xFFFFFFFF : 0x0;
400 int32_t _w = w.value() ? 0xFFFFFFFF : 0x0;
401 return Int32x4::New(_x, _y, _z, _w);
402}

◆ DEFINE_NATIVE_ENTRY() [167/345]

dart::DEFINE_NATIVE_ENTRY ( Int32x4_fromFloat32x4Bits  ,
,
 
)

Definition at line 404 of file simd128.cc.

404 {
405 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, v, arguments->NativeArgAt(1));
406 return Int32x4::New(v.value());
407}

◆ DEFINE_NATIVE_ENTRY() [168/345]

dart::DEFINE_NATIVE_ENTRY ( Int32x4_fromInts  ,
,
 
)

Definition at line 380 of file simd128.cc.

380 {
381 GET_NON_NULL_NATIVE_ARGUMENT(Integer, x, arguments->NativeArgAt(0));
382 GET_NON_NULL_NATIVE_ARGUMENT(Integer, y, arguments->NativeArgAt(1));
383 GET_NON_NULL_NATIVE_ARGUMENT(Integer, z, arguments->NativeArgAt(2));
384 GET_NON_NULL_NATIVE_ARGUMENT(Integer, w, arguments->NativeArgAt(3));
385 int32_t _x = static_cast<int32_t>(x.AsTruncatedUint32Value());
386 int32_t _y = static_cast<int32_t>(y.AsTruncatedUint32Value());
387 int32_t _z = static_cast<int32_t>(z.AsTruncatedUint32Value());
388 int32_t _w = static_cast<int32_t>(w.AsTruncatedUint32Value());
389 return Int32x4::New(_x, _y, _z, _w);
390}

◆ DEFINE_NATIVE_ENTRY() [169/345]

dart::DEFINE_NATIVE_ENTRY ( Int32x4_getFlagW  ,
,
 
)

Definition at line 569 of file simd128.cc.

569 {
570 GET_NON_NULL_NATIVE_ARGUMENT(Int32x4, self, arguments->NativeArgAt(0));
571 int32_t value = self.w();
572 return Bool::Get(value != 0).ptr();
573}

◆ DEFINE_NATIVE_ENTRY() [170/345]

dart::DEFINE_NATIVE_ENTRY ( Int32x4_getFlagX  ,
,
 
)

Definition at line 551 of file simd128.cc.

551 {
552 GET_NON_NULL_NATIVE_ARGUMENT(Int32x4, self, arguments->NativeArgAt(0));
553 int32_t value = self.x();
554 return Bool::Get(value != 0).ptr();
555}

◆ DEFINE_NATIVE_ENTRY() [171/345]

dart::DEFINE_NATIVE_ENTRY ( Int32x4_getFlagY  ,
,
 
)

Definition at line 557 of file simd128.cc.

557 {
558 GET_NON_NULL_NATIVE_ARGUMENT(Int32x4, self, arguments->NativeArgAt(0));
559 int32_t value = self.y();
560 return Bool::Get(value != 0).ptr();
561}

◆ DEFINE_NATIVE_ENTRY() [172/345]

dart::DEFINE_NATIVE_ENTRY ( Int32x4_getFlagZ  ,
,
 
)

Definition at line 563 of file simd128.cc.

563 {
564 GET_NON_NULL_NATIVE_ARGUMENT(Int32x4, self, arguments->NativeArgAt(0));
565 int32_t value = self.z();
566 return Bool::Get(value != 0).ptr();
567}

◆ DEFINE_NATIVE_ENTRY() [173/345]

dart::DEFINE_NATIVE_ENTRY ( Int32x4_getSignMask  ,
,
 
)

Definition at line 255 of file simd128.cc.

255 {
256 GET_NON_NULL_NATIVE_ARGUMENT(Int32x4, self, arguments->NativeArgAt(0));
257 uint32_t mx = (self.x() & 0x80000000) >> 31;
258 uint32_t my = (self.y() & 0x80000000) >> 31;
259 uint32_t mz = (self.z() & 0x80000000) >> 31;
260 uint32_t mw = (self.w() & 0x80000000) >> 31;
261 uint32_t value = mx | (my << 1) | (mz << 2) | (mw << 3);
262 return Integer::New(value);
263}

◆ DEFINE_NATIVE_ENTRY() [174/345]

dart::DEFINE_NATIVE_ENTRY ( Int32x4_getW  ,
,
 
)

Definition at line 477 of file simd128.cc.

477 {
478 GET_NON_NULL_NATIVE_ARGUMENT(Int32x4, self, arguments->NativeArgAt(0));
479 int32_t value = self.w();
480 return Integer::New(value);
481}

◆ DEFINE_NATIVE_ENTRY() [175/345]

dart::DEFINE_NATIVE_ENTRY ( Int32x4_getX  ,
,
 
)

Definition at line 459 of file simd128.cc.

459 {
460 GET_NON_NULL_NATIVE_ARGUMENT(Int32x4, self, arguments->NativeArgAt(0));
461 int32_t value = self.x();
462 return Integer::New(value);
463}

◆ DEFINE_NATIVE_ENTRY() [176/345]

dart::DEFINE_NATIVE_ENTRY ( Int32x4_getY  ,
,
 
)

Definition at line 465 of file simd128.cc.

465 {
466 GET_NON_NULL_NATIVE_ARGUMENT(Int32x4, self, arguments->NativeArgAt(0));
467 int32_t value = self.y();
468 return Integer::New(value);
469}

◆ DEFINE_NATIVE_ENTRY() [177/345]

dart::DEFINE_NATIVE_ENTRY ( Int32x4_getZ  ,
,
 
)

Definition at line 471 of file simd128.cc.

471 {
472 GET_NON_NULL_NATIVE_ARGUMENT(Int32x4, self, arguments->NativeArgAt(0));
473 int32_t value = self.z();
474 return Integer::New(value);
475}

◆ DEFINE_NATIVE_ENTRY() [178/345]

dart::DEFINE_NATIVE_ENTRY ( Int32x4_or  ,
,
 
)

Definition at line 409 of file simd128.cc.

409 {
410 GET_NON_NULL_NATIVE_ARGUMENT(Int32x4, self, arguments->NativeArgAt(0));
411 GET_NON_NULL_NATIVE_ARGUMENT(Int32x4, other, arguments->NativeArgAt(1));
412 int32_t _x = self.x() | other.x();
413 int32_t _y = self.y() | other.y();
414 int32_t _z = self.z() | other.z();
415 int32_t _w = self.w() | other.w();
416 return Int32x4::New(_x, _y, _z, _w);
417}

◆ DEFINE_NATIVE_ENTRY() [179/345]

dart::DEFINE_NATIVE_ENTRY ( Int32x4_select  ,
,
 
)

Definition at line 628 of file simd128.cc.

628 {
629 GET_NON_NULL_NATIVE_ARGUMENT(Int32x4, self, arguments->NativeArgAt(0));
630 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, tv, arguments->NativeArgAt(1));
631 GET_NON_NULL_NATIVE_ARGUMENT(Float32x4, fv, arguments->NativeArgAt(2));
632 int32_t _maskX = self.x();
633 int32_t _maskY = self.y();
634 int32_t _maskZ = self.z();
635 int32_t _maskW = self.w();
636 // Extract floats and interpret them as masks.
637 float32_int32 tvx(tv.x());
638 float32_int32 tvy(tv.y());
639 float32_int32 tvz(tv.z());
640 float32_int32 tvw(tv.w());
641 float32_int32 fvx(fv.x());
642 float32_int32 fvy(fv.y());
643 float32_int32 fvz(fv.z());
644 float32_int32 fvw(fv.w());
645 // Perform select.
646 float32_int32 tempX((_maskX & tvx.u) | (~_maskX & fvx.u));
647 float32_int32 tempY((_maskY & tvy.u) | (~_maskY & fvy.u));
648 float32_int32 tempZ((_maskZ & tvz.u) | (~_maskZ & fvz.u));
649 float32_int32 tempW((_maskW & tvw.u) | (~_maskW & fvw.u));
650 return Float32x4::New(tempX.f, tempY.f, tempZ.f, tempW.f);
651}

◆ DEFINE_NATIVE_ENTRY() [180/345]

dart::DEFINE_NATIVE_ENTRY ( Int32x4_setFlagW  ,
,
 
)

Definition at line 608 of file simd128.cc.

608 {
609 GET_NON_NULL_NATIVE_ARGUMENT(Int32x4, self, arguments->NativeArgAt(0));
610 GET_NON_NULL_NATIVE_ARGUMENT(Bool, flagW, arguments->NativeArgAt(1));
611 int32_t _x = self.x();
612 int32_t _y = self.y();
613 int32_t _z = self.z();
614 int32_t _w = self.w();
615 _w = flagW.ptr() == Bool::True().ptr() ? 0xFFFFFFFF : 0x0;
616 return Int32x4::New(_x, _y, _z, _w);
617}

◆ DEFINE_NATIVE_ENTRY() [181/345]

dart::DEFINE_NATIVE_ENTRY ( Int32x4_setFlagX  ,
,
 
)

Definition at line 575 of file simd128.cc.

575 {
576 GET_NON_NULL_NATIVE_ARGUMENT(Int32x4, self, arguments->NativeArgAt(0));
577 GET_NON_NULL_NATIVE_ARGUMENT(Bool, flagX, arguments->NativeArgAt(1));
578 int32_t _x = self.x();
579 int32_t _y = self.y();
580 int32_t _z = self.z();
581 int32_t _w = self.w();
582 _x = flagX.ptr() == Bool::True().ptr() ? 0xFFFFFFFF : 0x0;
583 return Int32x4::New(_x, _y, _z, _w);
584}

◆ DEFINE_NATIVE_ENTRY() [182/345]

dart::DEFINE_NATIVE_ENTRY ( Int32x4_setFlagY  ,
,
 
)

Definition at line 586 of file simd128.cc.

586 {
587 GET_NON_NULL_NATIVE_ARGUMENT(Int32x4, self, arguments->NativeArgAt(0));
588 GET_NON_NULL_NATIVE_ARGUMENT(Bool, flagY, arguments->NativeArgAt(1));
589 int32_t _x = self.x();
590 int32_t _y = self.y();
591 int32_t _z = self.z();
592 int32_t _w = self.w();
593 _y = flagY.ptr() == Bool::True().ptr() ? 0xFFFFFFFF : 0x0;
594 return Int32x4::New(_x, _y, _z, _w);
595}

◆ DEFINE_NATIVE_ENTRY() [183/345]

dart::DEFINE_NATIVE_ENTRY ( Int32x4_setFlagZ  ,
,
 
)

Definition at line 597 of file simd128.cc.

597 {
598 GET_NON_NULL_NATIVE_ARGUMENT(Int32x4, self, arguments->NativeArgAt(0));
599 GET_NON_NULL_NATIVE_ARGUMENT(Bool, flagZ, arguments->NativeArgAt(1));
600 int32_t _x = self.x();
601 int32_t _y = self.y();
602 int32_t _z = self.z();
603 int32_t _w = self.w();
604 _z = flagZ.ptr() == Bool::True().ptr() ? 0xFFFFFFFF : 0x0;
605 return Int32x4::New(_x, _y, _z, _w);
606}

◆ DEFINE_NATIVE_ENTRY() [184/345]

dart::DEFINE_NATIVE_ENTRY ( Int32x4_setW  ,
,
 
)

Definition at line 541 of file simd128.cc.

541 {
542 GET_NON_NULL_NATIVE_ARGUMENT(Int32x4, self, arguments->NativeArgAt(0));
543 GET_NON_NULL_NATIVE_ARGUMENT(Integer, w, arguments->NativeArgAt(1));
544 int32_t _x = self.x();
545 int32_t _y = self.y();
546 int32_t _z = self.z();
547 int32_t _w = static_cast<int32_t>(w.AsInt64Value() & 0xFFFFFFFF);
548 return Int32x4::New(_x, _y, _z, _w);
549}

◆ DEFINE_NATIVE_ENTRY() [185/345]

dart::DEFINE_NATIVE_ENTRY ( Int32x4_setX  ,
,
 
)

Definition at line 511 of file simd128.cc.

511 {
512 GET_NON_NULL_NATIVE_ARGUMENT(Int32x4, self, arguments->NativeArgAt(0));
513 GET_NON_NULL_NATIVE_ARGUMENT(Integer, x, arguments->NativeArgAt(1));
514 int32_t _x = static_cast<int32_t>(x.AsInt64Value() & 0xFFFFFFFF);
515 int32_t _y = self.y();
516 int32_t _z = self.z();
517 int32_t _w = self.w();
518 return Int32x4::New(_x, _y, _z, _w);
519}

◆ DEFINE_NATIVE_ENTRY() [186/345]

dart::DEFINE_NATIVE_ENTRY ( Int32x4_setY  ,
,
 
)

Definition at line 521 of file simd128.cc.

521 {
522 GET_NON_NULL_NATIVE_ARGUMENT(Int32x4, self, arguments->NativeArgAt(0));
523 GET_NON_NULL_NATIVE_ARGUMENT(Integer, y, arguments->NativeArgAt(1));
524 int32_t _x = self.x();
525 int32_t _y = static_cast<int32_t>(y.AsInt64Value() & 0xFFFFFFFF);
526 int32_t _z = self.z();
527 int32_t _w = self.w();
528 return Int32x4::New(_x, _y, _z, _w);
529}

◆ DEFINE_NATIVE_ENTRY() [187/345]

dart::DEFINE_NATIVE_ENTRY ( Int32x4_setZ  ,
,
 
)

Definition at line 531 of file simd128.cc.

531 {
532 GET_NON_NULL_NATIVE_ARGUMENT(Int32x4, self, arguments->NativeArgAt(0));
533 GET_NON_NULL_NATIVE_ARGUMENT(Integer, z, arguments->NativeArgAt(1));
534 int32_t _x = self.x();
535 int32_t _y = self.y();
536 int32_t _z = static_cast<int32_t>(z.AsInt64Value() & 0xFFFFFFFF);
537 int32_t _w = self.w();
538 return Int32x4::New(_x, _y, _z, _w);
539}

◆ DEFINE_NATIVE_ENTRY() [188/345]

dart::DEFINE_NATIVE_ENTRY ( Int32x4_shuffle  ,
,
 
)

Definition at line 483 of file simd128.cc.

483 {
484 GET_NON_NULL_NATIVE_ARGUMENT(Int32x4, self, arguments->NativeArgAt(0));
485 GET_NON_NULL_NATIVE_ARGUMENT(Integer, mask, arguments->NativeArgAt(1));
486 int64_t m = mask.AsInt64Value();
488 int32_t data[4] = {self.x(), self.y(), self.z(), self.w()};
489 int32_t _x = data[m & 0x3];
490 int32_t _y = data[(m >> 2) & 0x3];
491 int32_t _z = data[(m >> 4) & 0x3];
492 int32_t _w = data[(m >> 6) & 0x3];
493 return Int32x4::New(_x, _y, _z, _w);
494}

◆ DEFINE_NATIVE_ENTRY() [189/345]

dart::DEFINE_NATIVE_ENTRY ( Int32x4_shuffleMix  ,
,
 
)

Definition at line 496 of file simd128.cc.

496 {
497 GET_NON_NULL_NATIVE_ARGUMENT(Int32x4, self, arguments->NativeArgAt(0));
498 GET_NON_NULL_NATIVE_ARGUMENT(Int32x4, zw, arguments->NativeArgAt(1));
499 GET_NON_NULL_NATIVE_ARGUMENT(Integer, mask, arguments->NativeArgAt(2));
500 int64_t m = mask.AsInt64Value();
502 int32_t data[4] = {self.x(), self.y(), self.z(), self.w()};
503 int32_t zw_data[4] = {zw.x(), zw.y(), zw.z(), zw.w()};
504 int32_t _x = data[m & 0x3];
505 int32_t _y = data[(m >> 2) & 0x3];
506 int32_t _z = zw_data[(m >> 4) & 0x3];
507 int32_t _w = zw_data[(m >> 6) & 0x3];
508 return Int32x4::New(_x, _y, _z, _w);
509}

◆ DEFINE_NATIVE_ENTRY() [190/345]

dart::DEFINE_NATIVE_ENTRY ( Int32x4_sub  ,
,
 
)

Definition at line 449 of file simd128.cc.

449 {
450 GET_NON_NULL_NATIVE_ARGUMENT(Int32x4, self, arguments->NativeArgAt(0));
451 GET_NON_NULL_NATIVE_ARGUMENT(Int32x4, other, arguments->NativeArgAt(1));
452 int32_t _x = self.x() - other.x();
453 int32_t _y = self.y() - other.y();
454 int32_t _z = self.z() - other.z();
455 int32_t _w = self.w() - other.w();
456 return Int32x4::New(_x, _y, _z, _w);
457}

◆ DEFINE_NATIVE_ENTRY() [191/345]

dart::DEFINE_NATIVE_ENTRY ( Int32x4_xor  ,
,
 
)

Definition at line 429 of file simd128.cc.

429 {
430 GET_NON_NULL_NATIVE_ARGUMENT(Int32x4, self, arguments->NativeArgAt(0));
431 GET_NON_NULL_NATIVE_ARGUMENT(Int32x4, other, arguments->NativeArgAt(1));
432 int32_t _x = self.x() ^ other.x();
433 int32_t _y = self.y() ^ other.y();
434 int32_t _z = self.z() ^ other.z();
435 int32_t _w = self.w() ^ other.w();
436 return Int32x4::New(_x, _y, _z, _w);
437}

◆ DEFINE_NATIVE_ENTRY() [192/345]

dart::DEFINE_NATIVE_ENTRY ( Integer_addFromInteger  ,
,
 
)

Definition at line 71 of file integers.cc.

71 {
72 const Integer& right_int =
73 Integer::CheckedHandle(zone, arguments->NativeArgAt(0));
74 GET_NON_NULL_NATIVE_ARGUMENT(Integer, left_int, arguments->NativeArgAt(1));
75 ASSERT(CheckInteger(right_int));
76 ASSERT(CheckInteger(left_int));
77 if (FLAG_trace_intrinsified_natives) {
78 OS::PrintErr("Integer_addFromInteger %s + %s\n", left_int.ToCString(),
79 right_int.ToCString());
80 }
81 return left_int.ArithmeticOp(Token::kADD, right_int);
82}
static bool CheckInteger(const Integer &i)
Definition integers.cc:24

◆ DEFINE_NATIVE_ENTRY() [193/345]

dart::DEFINE_NATIVE_ENTRY ( Integer_bitAndFromInteger  ,
,
 
)

Definition at line 32 of file integers.cc.

32 {
33 const Integer& right =
34 Integer::CheckedHandle(zone, arguments->NativeArgAt(0));
35 GET_NON_NULL_NATIVE_ARGUMENT(Integer, left, arguments->NativeArgAt(1));
38 if (FLAG_trace_intrinsified_natives) {
39 OS::PrintErr("Integer_bitAndFromInteger %s & %s\n", right.ToCString(),
40 left.ToCString());
41 }
42 return left.BitOp(Token::kBIT_AND, right);
43}

◆ DEFINE_NATIVE_ENTRY() [194/345]

dart::DEFINE_NATIVE_ENTRY ( Integer_bitOrFromInteger  ,
,
 
)

Definition at line 45 of file integers.cc.

45 {
46 const Integer& right =
47 Integer::CheckedHandle(zone, arguments->NativeArgAt(0));
48 GET_NON_NULL_NATIVE_ARGUMENT(Integer, left, arguments->NativeArgAt(1));
51 if (FLAG_trace_intrinsified_natives) {
52 OS::PrintErr("Integer_bitOrFromInteger %s | %s\n", left.ToCString(),
53 right.ToCString());
54 }
55 return left.BitOp(Token::kBIT_OR, right);
56}

◆ DEFINE_NATIVE_ENTRY() [195/345]

dart::DEFINE_NATIVE_ENTRY ( Integer_bitXorFromInteger  ,
,
 
)

Definition at line 58 of file integers.cc.

58 {
59 const Integer& right =
60 Integer::CheckedHandle(zone, arguments->NativeArgAt(0));
61 GET_NON_NULL_NATIVE_ARGUMENT(Integer, left, arguments->NativeArgAt(1));
64 if (FLAG_trace_intrinsified_natives) {
65 OS::PrintErr("Integer_bitXorFromInteger %s ^ %s\n", left.ToCString(),
66 right.ToCString());
67 }
68 return left.BitOp(Token::kBIT_XOR, right);
69}

◆ DEFINE_NATIVE_ENTRY() [196/345]

dart::DEFINE_NATIVE_ENTRY ( Integer_equalToInteger  ,
,
 
)

Definition at line 150 of file integers.cc.

150 {
151 const Integer& left = Integer::CheckedHandle(zone, arguments->NativeArgAt(0));
152 GET_NON_NULL_NATIVE_ARGUMENT(Integer, right, arguments->NativeArgAt(1));
155 if (FLAG_trace_intrinsified_natives) {
156 OS::PrintErr("Integer_equalToInteger %s == %s\n", left.ToCString(),
157 right.ToCString());
158 }
159 return Bool::Get(left.CompareWith(right) == 0).ptr();
160}

◆ DEFINE_NATIVE_ENTRY() [197/345]

dart::DEFINE_NATIVE_ENTRY ( Integer_fromEnvironment  ,
,
 
)

Definition at line 188 of file integers.cc.

188 {
189 GET_NON_NULL_NATIVE_ARGUMENT(String, name, arguments->NativeArgAt(1));
190 GET_NATIVE_ARGUMENT(Integer, default_value, arguments->NativeArgAt(2));
191 // Call the embedder to supply us with the environment.
192 const String& env_value =
193 String::Handle(Api::GetEnvironmentValue(thread, name));
194 if (!env_value.IsNull()) {
195 const Integer& result = Integer::Handle(ParseInteger(env_value));
196 if (!result.IsNull()) {
197 if (result.IsSmi()) {
198 return result.ptr();
199 }
200 return result.Canonicalize(thread);
201 }
202 }
203 return default_value.ptr();
204}
static IntegerPtr ParseInteger(const String &value)
Definition integers.cc:162

◆ DEFINE_NATIVE_ENTRY() [198/345]

dart::DEFINE_NATIVE_ENTRY ( Integer_greaterThanFromInteger  ,
,
 
)

Definition at line 137 of file integers.cc.

137 {
138 const Integer& right =
139 Integer::CheckedHandle(zone, arguments->NativeArgAt(0));
140 GET_NON_NULL_NATIVE_ARGUMENT(Integer, left, arguments->NativeArgAt(1));
143 if (FLAG_trace_intrinsified_natives) {
144 OS::PrintErr("Integer_greaterThanFromInteger %s > %s\n", left.ToCString(),
145 right.ToCString());
146 }
147 return Bool::Get(left.CompareWith(right) == 1).ptr();
148}

◆ DEFINE_NATIVE_ENTRY() [199/345]

dart::DEFINE_NATIVE_ENTRY ( Integer_moduloFromInteger  ,
,
 
)

Definition at line 120 of file integers.cc.

120 {
121 const Integer& right_int =
122 Integer::CheckedHandle(zone, arguments->NativeArgAt(0));
123 GET_NON_NULL_NATIVE_ARGUMENT(Integer, left_int, arguments->NativeArgAt(1));
124 ASSERT(CheckInteger(right_int));
125 ASSERT(CheckInteger(left_int));
126 if (FLAG_trace_intrinsified_natives) {
127 OS::PrintErr("Integer_moduloFromInteger %s mod %s\n", left_int.ToCString(),
128 right_int.ToCString());
129 }
130 if (right_int.IsZero()) {
131 // Should have been caught before calling into runtime.
133 }
134 return left_int.ArithmeticOp(Token::kMOD, right_int);
135}
virtual bool IsZero() const
Definition object.cc:23119
#define UNIMPLEMENTED

◆ DEFINE_NATIVE_ENTRY() [200/345]

dart::DEFINE_NATIVE_ENTRY ( Integer_mulFromInteger  ,
,
 
)

Definition at line 97 of file integers.cc.

97 {
98 const Integer& right_int =
99 Integer::CheckedHandle(zone, arguments->NativeArgAt(0));
100 GET_NON_NULL_NATIVE_ARGUMENT(Integer, left_int, arguments->NativeArgAt(1));
101 ASSERT(CheckInteger(right_int));
102 ASSERT(CheckInteger(left_int));
103 if (FLAG_trace_intrinsified_natives) {
104 OS::PrintErr("Integer_mulFromInteger %s * %s\n", left_int.ToCString(),
105 right_int.ToCString());
106 }
107 return left_int.ArithmeticOp(Token::kMUL, right_int);
108}

◆ DEFINE_NATIVE_ENTRY() [201/345]

dart::DEFINE_NATIVE_ENTRY ( Integer_parse  ,
,
 
)

Definition at line 183 of file integers.cc.

183 {
184 GET_NON_NULL_NATIVE_ARGUMENT(String, value, arguments->NativeArgAt(0));
185 return ParseInteger(value);
186}

◆ DEFINE_NATIVE_ENTRY() [202/345]

dart::DEFINE_NATIVE_ENTRY ( Integer_shlFromInteger  ,
,
 
)

Definition at line 241 of file integers.cc.

241 {
242 const Integer& amount =
243 Integer::CheckedHandle(zone, arguments->NativeArgAt(0));
244 GET_NON_NULL_NATIVE_ARGUMENT(Integer, value, arguments->NativeArgAt(1));
245 ASSERT(CheckInteger(amount));
246 ASSERT(CheckInteger(value));
247 if (FLAG_trace_intrinsified_natives) {
248 OS::PrintErr("Integer_shlFromInteger: %s << %s\n", value.ToCString(),
249 amount.ToCString());
250 }
251 return ShiftOperationHelper(Token::kSHL, value, amount);
252}

◆ DEFINE_NATIVE_ENTRY() [203/345]

dart::DEFINE_NATIVE_ENTRY ( Integer_shrFromInteger  ,
,
 
)

Definition at line 215 of file integers.cc.

215 {
216 const Integer& amount =
217 Integer::CheckedHandle(zone, arguments->NativeArgAt(0));
218 GET_NON_NULL_NATIVE_ARGUMENT(Integer, value, arguments->NativeArgAt(1));
219 ASSERT(CheckInteger(amount));
220 ASSERT(CheckInteger(value));
221 if (FLAG_trace_intrinsified_natives) {
222 OS::PrintErr("Integer_shrFromInteger: %s >> %s\n", value.ToCString(),
223 amount.ToCString());
224 }
225 return ShiftOperationHelper(Token::kSHR, value, amount);
226}

◆ DEFINE_NATIVE_ENTRY() [204/345]

dart::DEFINE_NATIVE_ENTRY ( Integer_subFromInteger  ,
,
 
)

Definition at line 84 of file integers.cc.

84 {
85 const Integer& right_int =
86 Integer::CheckedHandle(zone, arguments->NativeArgAt(0));
87 GET_NON_NULL_NATIVE_ARGUMENT(Integer, left_int, arguments->NativeArgAt(1));
88 ASSERT(CheckInteger(right_int));
89 ASSERT(CheckInteger(left_int));
90 if (FLAG_trace_intrinsified_natives) {
91 OS::PrintErr("Integer_subFromInteger %s - %s\n", left_int.ToCString(),
92 right_int.ToCString());
93 }
94 return left_int.ArithmeticOp(Token::kSUB, right_int);
95}

◆ DEFINE_NATIVE_ENTRY() [205/345]

dart::DEFINE_NATIVE_ENTRY ( Integer_truncDivFromInteger  ,
,
 
)

Definition at line 110 of file integers.cc.

110 {
111 const Integer& right_int =
112 Integer::CheckedHandle(zone, arguments->NativeArgAt(0));
113 GET_NON_NULL_NATIVE_ARGUMENT(Integer, left_int, arguments->NativeArgAt(1));
114 ASSERT(CheckInteger(right_int));
115 ASSERT(CheckInteger(left_int));
116 ASSERT(!right_int.IsZero());
117 return left_int.ArithmeticOp(Token::kTRUNCDIV, right_int);
118}

◆ DEFINE_NATIVE_ENTRY() [206/345]

dart::DEFINE_NATIVE_ENTRY ( Integer_ushrFromInteger  ,
,
 
)

Definition at line 228 of file integers.cc.

228 {
229 const Integer& amount =
230 Integer::CheckedHandle(zone, arguments->NativeArgAt(0));
231 GET_NON_NULL_NATIVE_ARGUMENT(Integer, value, arguments->NativeArgAt(1));
232 ASSERT(CheckInteger(amount));
233 ASSERT(CheckInteger(value));
234 if (FLAG_trace_intrinsified_natives) {
235 OS::PrintErr("Integer_ushrFromInteger: %s >>> %s\n", value.ToCString(),
236 amount.ToCString());
237 }
238 return ShiftOperationHelper(Token::kUSHR, value, amount);
239}

◆ DEFINE_NATIVE_ENTRY() [207/345]

dart::DEFINE_NATIVE_ENTRY ( Internal_allocateObjectInstructionsEnd  ,
,
 
)

Definition at line 344 of file object.cc.

344 {
345 auto& stub = Code::Handle(
346 zone, isolate->group()->object_store()->allocate_object_stub());
347 ASSERT(!stub.IsUnknownDartCode());
348 // We return the end offset in the isolate instructions instead of the
349 // full address because that fits into small Smis on 32-bit architectures
350 // or compressed pointer builds.
351 const uword instructions_start =
352 reinterpret_cast<uword>(isolate->source()->snapshot_instructions);
353 return Smi::New((stub.PayloadStart() - instructions_start) + stub.Size());
354}

◆ DEFINE_NATIVE_ENTRY() [208/345]

dart::DEFINE_NATIVE_ENTRY ( Internal_allocateObjectInstructionsStart  ,
,
 
)

Definition at line 332 of file object.cc.

332 {
333 auto& stub = Code::Handle(
334 zone, isolate->group()->object_store()->allocate_object_stub());
335 ASSERT(!stub.IsUnknownDartCode());
336 // We return the start offset in the isolate instructions instead of the
337 // full address because that fits into small Smis on 32-bit architectures
338 // or compressed pointer builds.
339 const uword instructions_start =
340 reinterpret_cast<uword>(isolate->source()->snapshot_instructions);
341 return Smi::New(stub.PayloadStart() - instructions_start);
342}

◆ DEFINE_NATIVE_ENTRY() [209/345]

dart::DEFINE_NATIVE_ENTRY ( Internal_allocateOneByteString  ,
,
 
)

Definition at line 260 of file string.cc.

260 {
261 GET_NON_NULL_NATIVE_ARGUMENT(Integer, length_obj, arguments->NativeArgAt(0));
262 const int64_t length = length_obj.AsInt64Value();
263 if ((length < 0) || (length > OneByteString::kMaxElements)) {
264 // Assume that negative lengths are the result of wrapping in code in
265 // string_patch.dart.
266 const Instance& exception = Instance::Handle(
267 thread->isolate_group()->object_store()->out_of_memory());
268 Exceptions::Throw(thread, exception);
269 UNREACHABLE();
270 }
271 return OneByteString::New(static_cast<intptr_t>(length), Heap::kNew);
272}

◆ DEFINE_NATIVE_ENTRY() [210/345]

dart::DEFINE_NATIVE_ENTRY ( Internal_allocateTwoByteString  ,
,
 
)

Definition at line 274 of file string.cc.

274 {
275 GET_NON_NULL_NATIVE_ARGUMENT(Integer, length_obj, arguments->NativeArgAt(0));
276 const int64_t length = length_obj.AsInt64Value();
277 if ((length < 0) || (length > TwoByteString::kMaxElements)) {
278 // Assume that negative lengths are the result of wrapping in code in
279 // string_patch.dart.
280 const Instance& exception = Instance::Handle(
281 thread->isolate_group()->object_store()->out_of_memory());
282 Exceptions::Throw(thread, exception);
283 UNREACHABLE();
284 }
285 return TwoByteString::New(static_cast<intptr_t>(length), Heap::kNew);
286}

◆ DEFINE_NATIVE_ENTRY() [211/345]

dart::DEFINE_NATIVE_ENTRY ( Internal_boundsCheckForPartialInstantiation  ,
,
 
)

Definition at line 503 of file object.cc.

503 {
504 const Closure& closure =
505 Closure::CheckedHandle(zone, arguments->NativeArgAt(0));
506 const Function& target = Function::Handle(zone, closure.function());
507 ASSERT(target.IsGeneric()); // No need to check bounds for non-generics.
508 const TypeParameters& type_params =
509 TypeParameters::Handle(zone, target.type_parameters());
510 if (type_params.IsNull() || type_params.AllDynamicBounds()) {
511 // The function is not generic or the bounds are all dynamic.
512 return Object::null();
513 }
514
515 const TypeArguments& type_args_to_check =
516 TypeArguments::CheckedHandle(zone, arguments->NativeArgAt(1));
517
518 // This should be guaranteed by the front-end.
519 ASSERT(type_args_to_check.IsNull() ||
520 type_params.Length() <= type_args_to_check.Length());
521
522 // The bounds on the closure may need instantiation.
523 const TypeArguments& instantiator_type_args =
524 TypeArguments::Handle(zone, closure.instantiator_type_arguments());
525 const TypeArguments& function_type_args = TypeArguments::Handle(
526 zone,
527 type_args_to_check.Prepend(
528 zone, TypeArguments::Handle(zone, closure.function_type_arguments()),
529 target.NumParentTypeArguments(), target.NumTypeArguments()));
530
531 AbstractType& supertype = AbstractType::Handle(zone);
532 AbstractType& subtype = AbstractType::Handle(zone);
533 for (intptr_t i = 0; i < type_params.Length(); ++i) {
534 supertype = type_params.BoundAt(i);
535 subtype = type_args_to_check.IsNull() ? Object::dynamic_type().ptr()
536 : type_args_to_check.TypeAt(i);
537
538 ASSERT(!subtype.IsNull());
539 ASSERT(!supertype.IsNull());
540
541 // The supertype may not be instantiated.
542 if (!AbstractType::InstantiateAndTestSubtype(
543 &subtype, &supertype, instantiator_type_args, function_type_args)) {
544 // Throw a dynamic type error.
545 TokenPosition location = TokenPosition::kNoSource;
546 {
547 DartFrameIterator iterator(Thread::Current(),
548 StackFrameIterator::kNoCrossThreadIteration);
549 StackFrame* caller_frame = iterator.NextFrame();
550 ASSERT(caller_frame != nullptr);
551 location = caller_frame->GetTokenPos();
552 }
553 const auto& parameter_name = String::Handle(zone, type_params.NameAt(i));
554 Exceptions::CreateAndThrowTypeError(location, subtype, supertype,
555 parameter_name);
556 UNREACHABLE();
557 }
558 }
559
560 return Object::null();
561}
intptr_t Length() const
Definition object.cc:6619
StringPtr NameAt(intptr_t index) const
Definition object.cc:6629
bool AllDynamicBounds() const
Definition object.cc:6660
AbstractTypePtr BoundAt(intptr_t index) const
Definition object.cc:6648

◆ DEFINE_NATIVE_ENTRY() [212/345]

dart::DEFINE_NATIVE_ENTRY ( Internal_collectAllGarbage  ,
,
 
)

Definition at line 321 of file object.cc.

321 {
322 isolate->group()->heap()->CollectAllGarbage(GCReason::kDebugging,
323 /*compact=*/true);
324 return Object::null();
325}

◆ DEFINE_NATIVE_ENTRY() [213/345]

dart::DEFINE_NATIVE_ENTRY ( Internal_deoptimizeFunctionsOnStack  ,
,
 
)

Definition at line 327 of file object.cc.

327 {
329 return Object::null();
330}
void DeoptimizeFunctionsOnStack()

◆ DEFINE_NATIVE_ENTRY() [214/345]

dart::DEFINE_NATIVE_ENTRY ( Internal_extractTypeArguments  ,
,
 
)

Definition at line 401 of file object.cc.

401 {
402 const Instance& instance =
403 Instance::CheckedHandle(zone, arguments->NativeArgAt(0));
404 const Instance& extract =
405 Instance::CheckedHandle(zone, arguments->NativeArgAt(1));
406
407 Class& interface_cls = Class::Handle(zone);
408 intptr_t num_type_args = 0;
409 if (arguments->NativeTypeArgCount() >= 1) {
410 const AbstractType& function_type_arg =
411 AbstractType::Handle(zone, arguments->NativeTypeArgAt(0));
412 if (function_type_arg.IsType() &&
413 (Type::Cast(function_type_arg).arguments() == TypeArguments::null())) {
414 interface_cls = function_type_arg.type_class();
415 num_type_args = interface_cls.NumTypeParameters();
416 }
417 }
418 if (num_type_args == 0) {
419 Exceptions::ThrowArgumentError(String::Handle(
420 zone,
421 String::New(
422 "single function type argument must specify a generic class")));
423 }
424 if (instance.IsNull()) {
425 Exceptions::ThrowArgumentError(instance);
426 }
427 // Function 'extract' must be generic and accept the same number of type args,
428 // unless we execute Dart 1.0 code.
429 if (extract.IsNull() || !extract.IsClosure() ||
430 ((num_type_args > 0) && // Dart 1.0 if num_type_args == 0.
431 (Function::Handle(zone, Closure::Cast(extract).function())
432 .NumTypeParameters() != num_type_args))) {
433 Exceptions::ThrowArgumentError(String::Handle(
434 zone,
435 String::New("argument 'extract' is not a generic function or not one "
436 "accepting the correct number of type arguments")));
437 }
438 TypeArguments& extracted_type_args = TypeArguments::Handle(zone);
439 if (num_type_args > 0) {
440 // The passed instance must implement interface_cls.
441 TypeArguments& interface_type_args = TypeArguments::Handle(zone);
442 interface_type_args = TypeArguments::New(num_type_args);
443 Class& instance_cls = Class::Handle(zone, instance.clazz());
444 TypeArguments& instance_type_args = TypeArguments::Handle(zone);
445 if (instance_cls.NumTypeArguments() > 0) {
446 instance_type_args = instance.GetTypeArguments();
447 }
448 if (!ExtractInterfaceTypeArgs(zone, instance_cls, instance_type_args,
449 interface_cls, &interface_type_args)) {
450 Exceptions::ThrowArgumentError(String::Handle(
451 zone, String::New("type of argument 'instance' is not a subtype of "
452 "the function type argument")));
453 }
454 if (!interface_type_args.IsNull()) {
455 extracted_type_args = TypeArguments::New(num_type_args);
456 const intptr_t offset = interface_cls.NumTypeArguments() - num_type_args;
457 AbstractType& type_arg = AbstractType::Handle(zone);
458 for (intptr_t i = 0; i < num_type_args; i++) {
459 type_arg = interface_type_args.TypeAt(offset + i);
460 extracted_type_args.SetTypeAt(i, type_arg);
461 }
462 extracted_type_args =
463 extracted_type_args.Canonicalize(thread); // Can be null.
464 }
465 }
466 // Call the closure 'extract'.
467 Array& args_desc = Array::Handle(zone);
468 Array& args = Array::Handle(zone);
469 if (extracted_type_args.IsNull()) {
470 args_desc = ArgumentsDescriptor::NewBoxed(0, 1);
471 args = Array::New(1);
472 args.SetAt(0, extract);
473 } else {
474 args_desc = ArgumentsDescriptor::NewBoxed(num_type_args, 1);
475 args = Array::New(2);
476 args.SetAt(0, extracted_type_args);
477 args.SetAt(1, extract);
478 }
479 const Object& result =
480 Object::Handle(zone, DartEntry::InvokeClosure(thread, args, args_desc));
481 if (result.IsError()) {
482 Exceptions::PropagateError(Error::Cast(result));
483 UNREACHABLE();
484 }
485 return result.ptr();
486}
T extract(SkSpan< const uint8_t > &data)
static bool ExtractInterfaceTypeArgs(Zone *zone, const Class &instance_cls, const TypeArguments &instance_type_args, const Class &interface_cls, TypeArguments *interface_type_args)
Definition object.cc:356

◆ DEFINE_NATIVE_ENTRY() [215/345]

dart::DEFINE_NATIVE_ENTRY ( Internal_makeFixedListUnmodifiable  ,
,
 
)

Definition at line 79 of file growable_array.cc.

79 {
80 GET_NON_NULL_NATIVE_ARGUMENT(Array, array, arguments->NativeArgAt(0));
81 array.MakeImmutable();
82 return array.ptr();
83}

◆ DEFINE_NATIVE_ENTRY() [216/345]

dart::DEFINE_NATIVE_ENTRY ( Internal_makeListFixedLength  ,
,
 
)

Definition at line 73 of file growable_array.cc.

73 {
75 arguments->NativeArgAt(0));
76 return Array::MakeFixedLength(array, /* unique = */ true);
77}

◆ DEFINE_NATIVE_ENTRY() [217/345]

dart::DEFINE_NATIVE_ENTRY ( Internal_nativeEffect  ,
,
 
)

Definition at line 317 of file object.cc.

317 {
318 UNREACHABLE();
319}

◆ DEFINE_NATIVE_ENTRY() [218/345]

dart::DEFINE_NATIVE_ENTRY ( Internal_prependTypeArguments  ,
,
 
)

Definition at line 488 of file object.cc.

488 {
489 const TypeArguments& function_type_arguments =
490 TypeArguments::CheckedHandle(zone, arguments->NativeArgAt(0));
491 const TypeArguments& parent_type_arguments =
492 TypeArguments::CheckedHandle(zone, arguments->NativeArgAt(1));
493 GET_NON_NULL_NATIVE_ARGUMENT(Smi, smi_parent_len, arguments->NativeArgAt(2));
494 GET_NON_NULL_NATIVE_ARGUMENT(Smi, smi_len, arguments->NativeArgAt(3));
495 return function_type_arguments.Prepend(
496 zone, parent_type_arguments, smi_parent_len.Value(), smi_len.Value());
497}
TypeArgumentsPtr Prepend(Zone *zone, const TypeArguments &other, intptr_t other_length, intptr_t total_length) const
Definition object.cc:6858

◆ DEFINE_NATIVE_ENTRY() [219/345]

dart::DEFINE_NATIVE_ENTRY ( Internal_unsafeCast  ,
,
 
)

Definition at line 312 of file object.cc.

312 {
313 UNREACHABLE(); // Should be erased at Kernel translation time.
314 return arguments->NativeArgAt(0);
315}

◆ DEFINE_NATIVE_ENTRY() [220/345]

dart::DEFINE_NATIVE_ENTRY ( Internal_writeIntoOneByteString  ,
,
 
)

Definition at line 341 of file string.cc.

341 {
342 GET_NON_NULL_NATIVE_ARGUMENT(String, receiver, arguments->NativeArgAt(0));
343 ASSERT(receiver.IsOneByteString());
344 GET_NON_NULL_NATIVE_ARGUMENT(Smi, index_obj, arguments->NativeArgAt(1));
345 GET_NON_NULL_NATIVE_ARGUMENT(Smi, code_point_obj, arguments->NativeArgAt(2));
346 OneByteString::SetCharAt(receiver, index_obj.Value(),
347 code_point_obj.Value() & 0xFF);
348 return Object::null();
349}

◆ DEFINE_NATIVE_ENTRY() [221/345]

dart::DEFINE_NATIVE_ENTRY ( Internal_writeIntoTwoByteString  ,
,
 
)

Definition at line 351 of file string.cc.

351 {
352 GET_NON_NULL_NATIVE_ARGUMENT(String, receiver, arguments->NativeArgAt(0));
353 ASSERT(receiver.IsTwoByteString());
354 GET_NON_NULL_NATIVE_ARGUMENT(Smi, index_obj, arguments->NativeArgAt(1));
355 GET_NON_NULL_NATIVE_ARGUMENT(Smi, code_point_obj, arguments->NativeArgAt(2));
356 TwoByteString::SetCharAt(receiver, index_obj.Value(),
357 code_point_obj.Value() & 0xFFFF);
358 return Object::null();
359}

◆ DEFINE_NATIVE_ENTRY() [222/345]

dart::DEFINE_NATIVE_ENTRY ( InvocationMirror_unpackTypeArguments  ,
,
 
)

Definition at line 563 of file object.cc.

563 {
564 const TypeArguments& type_arguments =
565 TypeArguments::CheckedHandle(zone, arguments->NativeArgAt(0));
566 const Smi& num_type_arguments =
567 Smi::CheckedHandle(zone, arguments->NativeArgAt(1));
568 bool all_dynamic = type_arguments.IsNull();
569 const intptr_t len =
570 all_dynamic ? num_type_arguments.Value() : type_arguments.Length();
571 const Array& type_list = Array::Handle(
572 zone, Array::New(len, Type::Handle(zone, Type::DartTypeType())));
573 AbstractType& type = AbstractType::Handle(zone);
574 for (intptr_t i = 0; i < len; i++) {
575 if (all_dynamic) {
576 type_list.SetAt(i, Object::dynamic_type());
577 } else {
578 type = type_arguments.TypeAt(i);
579 type_list.SetAt(i, type);
580 }
581 }
582 type_list.MakeImmutable();
583 return type_list.ptr();
584}
intptr_t Length() const
Definition object.cc:7352
AbstractTypePtr TypeAt(intptr_t index) const
Definition object.cc:7366

◆ DEFINE_NATIVE_ENTRY() [223/345]

dart::DEFINE_NATIVE_ENTRY ( Isolate_exit_  ,
,
 
)

Definition at line 298 of file isolate.cc.

298 {
299 GET_NATIVE_ARGUMENT(SendPort, port, arguments->NativeArgAt(0));
300 if (!port.IsNull()) {
301 GET_NATIVE_ARGUMENT(Instance, obj, arguments->NativeArgAt(1));
302
303 const bool same_group = InSameGroup(isolate, port);
304#if defined(DEBUG)
305 if (same_group) {
306 ASSERT(PortMap::IsReceiverInThisIsolateGroupOrClosed(port.Id(),
307 isolate->group()));
308 }
309#endif
310 if (!same_group) {
311 const auto& error =
312 String::Handle(String::New("exit with final message is only allowed "
313 "for isolates in one isolate group."));
314 Exceptions::ThrowArgumentError(error);
315 UNREACHABLE();
316 }
317
318 Object& validated_result = Object::Handle(zone);
319 const Object& msg_obj = Object::Handle(zone, obj.ptr());
320 validated_result = ValidateMessageObject(zone, isolate, msg_obj);
321 // msg_array = [
322 // <message>,
323 // <collection-lib-objects-to-rehash>,
324 // <core-lib-objects-to-rehash>,
325 // ]
326 const Array& msg_array = Array::Handle(zone, Array::New(3));
327 msg_array.SetAt(0, msg_obj);
328 if (validated_result.IsUnhandledException()) {
329 Exceptions::PropagateError(Error::Cast(validated_result));
330 UNREACHABLE();
331 }
332 PersistentHandle* handle =
333 isolate->group()->api_state()->AllocatePersistentHandle();
334 handle->set_ptr(msg_array);
335 isolate->bequeath(std::unique_ptr<Bequest>(new Bequest(handle, port.Id())));
336 }
337
338 Thread::Current()->StartUnwindError();
339 const String& msg =
340 String::Handle(String::New("isolate terminated by Isolate.exit"));
341 const UnwindError& error = UnwindError::Handle(UnwindError::New(msg));
342 error.set_is_user_initiated(true);
343 Exceptions::PropagateError(error);
344 UNREACHABLE();
345 // We will never execute dart code again in this isolate.
346 return Object::null();
347}
static ObjectPtr ValidateMessageObject(Zone *zone, Isolate *isolate, const Object &obj)
Definition isolate.cc:142
static bool InSameGroup(Isolate *sender, const SendPort &receiver)
Definition isolate.cc:105

◆ DEFINE_NATIVE_ENTRY() [224/345]

dart::DEFINE_NATIVE_ENTRY ( Isolate_getCurrentRootUriStr  ,
,
 
)

Definition at line 1034 of file isolate.cc.

1034 {
1035 const Library& root_lib =
1036 Library::Handle(zone, isolate->group()->object_store()->root_library());
1037 return root_lib.url();
1038}

◆ DEFINE_NATIVE_ENTRY() [225/345]

dart::DEFINE_NATIVE_ENTRY ( Isolate_getDebugName  ,
,
 
)

Definition at line 1015 of file isolate.cc.

1015 {
1016 GET_NON_NULL_NATIVE_ARGUMENT(SendPort, port, arguments->NativeArgAt(0));
1017 auto name = Isolate::LookupIsolateNameByPort(port.Id());
1018 if (name == nullptr) {
1019 return String::null();
1020 }
1021 return String::New(name.get());
1022}

◆ DEFINE_NATIVE_ENTRY() [226/345]

dart::DEFINE_NATIVE_ENTRY ( Isolate_getPortAndCapabilitiesOfCurrentIsolate  ,
,
 
)

Definition at line 1024 of file isolate.cc.

1024 {
1025 const Array& result = Array::Handle(Array::New(3));
1026 result.SetAt(0, SendPort::Handle(SendPort::New(isolate->main_port())));
1027 result.SetAt(
1028 1, Capability::Handle(Capability::New(isolate->pause_capability())));
1029 result.SetAt(
1030 2, Capability::Handle(Capability::New(isolate->terminate_capability())));
1031 return result.ptr();
1032}

◆ DEFINE_NATIVE_ENTRY() [227/345]

dart::DEFINE_NATIVE_ENTRY ( Isolate_registerKernelBlob  ,
,
 
)

Definition at line 1040 of file isolate.cc.

1040 {
1042 arguments->NativeArgAt(0));
1043 auto register_kernel_blob_callback = Isolate::RegisterKernelBlobCallback();
1044 if (register_kernel_blob_callback == nullptr) {
1045 Exceptions::ThrowUnsupportedError(
1046 "Registration of kernel blobs is not supported by this Dart embedder.");
1047 }
1048 bool is_kernel = false;
1049 {
1050 NoSafepointScope no_safepoint;
1051 is_kernel =
1052 Dart_IsKernel(reinterpret_cast<uint8_t*>(kernel_blob.DataAddr(0)),
1053 kernel_blob.LengthInBytes());
1054 }
1055 if (!is_kernel) {
1056 const auto& error = String::Handle(
1057 zone, String::New("kernelBlob doesn\'t contain a valid kernel.\n"));
1058 Exceptions::ThrowArgumentError(error);
1059 UNREACHABLE();
1060 }
1061 const char* uri = nullptr;
1062 {
1063 NoSafepointScope no_safepoint;
1064 uri = register_kernel_blob_callback(
1065 reinterpret_cast<uint8_t*>(kernel_blob.DataAddr(0)),
1066 kernel_blob.LengthInBytes());
1067 }
1068 if (uri == nullptr) {
1069 Exceptions::ThrowOOM();
1070 }
1071 return String::New(uri);
1072}
DART_EXPORT bool Dart_IsKernel(const uint8_t *buffer, intptr_t buffer_size)

◆ DEFINE_NATIVE_ENTRY() [228/345]

dart::DEFINE_NATIVE_ENTRY ( Isolate_sendOOB  ,
,
 
)

Definition at line 1087 of file isolate.cc.

1087 {
1088 GET_NON_NULL_NATIVE_ARGUMENT(SendPort, port, arguments->NativeArgAt(0));
1089 GET_NON_NULL_NATIVE_ARGUMENT(Array, msg, arguments->NativeArgAt(1));
1090
1091 // Make sure to route this request to the isolate library OOB message handler.
1092 msg.SetAt(0, Smi::Handle(Smi::New(Message::kIsolateLibOOBMsg)));
1093
1094 // Ensure message writer (and it's resources, e.g. forwarding tables) are
1095 // cleaned up before handling interrupts.
1096 {
1097 PortMap::PostMessage(WriteMessage(/*same_group=*/false, msg, port.Id(),
1098 Message::kOOBPriority));
1099 }
1100
1101 // Drain interrupts before running so any IMMEDIATE operations on the current
1102 // isolate happen synchronously.
1103 const Error& error = Error::Handle(thread->HandleInterrupts());
1104 if (!error.IsNull()) {
1105 Exceptions::PropagateError(error);
1106 UNREACHABLE();
1107 }
1108
1109 return Object::null();
1110}

◆ DEFINE_NATIVE_ENTRY() [229/345]

dart::DEFINE_NATIVE_ENTRY ( Isolate_spawnFunction  ,
,
10   
)

Definition at line 866 of file isolate.cc.

866 {
867 GET_NON_NULL_NATIVE_ARGUMENT(SendPort, port, arguments->NativeArgAt(0));
868 GET_NON_NULL_NATIVE_ARGUMENT(String, script_uri, arguments->NativeArgAt(1));
869 GET_NON_NULL_NATIVE_ARGUMENT(Closure, closure, arguments->NativeArgAt(2));
870 GET_NON_NULL_NATIVE_ARGUMENT(Instance, message, arguments->NativeArgAt(3));
871 GET_NON_NULL_NATIVE_ARGUMENT(Bool, paused, arguments->NativeArgAt(4));
872 GET_NATIVE_ARGUMENT(Bool, fatalErrors, arguments->NativeArgAt(5));
873 GET_NATIVE_ARGUMENT(SendPort, onExit, arguments->NativeArgAt(6));
874 GET_NATIVE_ARGUMENT(SendPort, onError, arguments->NativeArgAt(7));
875 GET_NATIVE_ARGUMENT(String, packageConfig, arguments->NativeArgAt(8));
876 GET_NATIVE_ARGUMENT(String, debugName, arguments->NativeArgAt(9));
877
878 PersistentHandle* closure_tuple_handle = nullptr;
879 // We have a non-toplevel closure that we might need to copy.
880 // Result will be [<closure-copy>, <objects-in-msg-to-rehash>]
881 const auto& closure_copy_tuple = Object::Handle(
882 zone, CopyMutableObjectGraph(closure)); // Throws if it fails.
883 ASSERT(closure_copy_tuple.IsArray());
884 ASSERT(
885 Object::Handle(zone, Array::Cast(closure_copy_tuple).At(0)).IsClosure());
886 closure_tuple_handle =
887 isolate->group()->api_state()->AllocatePersistentHandle();
888 closure_tuple_handle->set_ptr(closure_copy_tuple.ptr());
889
890 bool fatal_errors = fatalErrors.IsNull() ? true : fatalErrors.value();
891 Dart_Port on_exit_port = onExit.IsNull() ? ILLEGAL_PORT : onExit.Id();
892 Dart_Port on_error_port = onError.IsNull() ? ILLEGAL_PORT : onError.Id();
893
894 // We first try to serialize the message. In case the message is not
895 // serializable this will throw an exception.
896 SerializedObjectBuffer message_buffer;
897 message_buffer.set_message(WriteMessage(
898 /*same_group=*/true, message, ILLEGAL_PORT, Message::kNormalPriority));
899
900 const char* utf8_package_config =
901 packageConfig.IsNull() ? nullptr : String2UTF8(packageConfig);
902 const char* utf8_debug_name =
903 debugName.IsNull() ? nullptr : String2UTF8(debugName);
904 if (closure_tuple_handle != nullptr && utf8_debug_name == nullptr) {
905 const auto& closure_function = Function::Handle(zone, closure.function());
906 utf8_debug_name =
907 NewConstChar(closure_function.QualifiedUserVisibleNameCString());
908 }
909
910 std::unique_ptr<IsolateSpawnState> state(new IsolateSpawnState(
911 port.Id(), isolate->origin_id(), String2UTF8(script_uri),
912 closure_tuple_handle, &message_buffer, utf8_package_config,
913 paused.value(), fatal_errors, on_exit_port, on_error_port,
914 utf8_debug_name, isolate->group()));
915
916 isolate->group()->thread_pool()->Run<SpawnIsolateTask>(isolate,
917 std::move(state));
918 return Object::null();
919}
void set_message(std::unique_ptr< Message > message)
Definition snapshot.h:122
static const char * NewConstChar(const char *chars)
Definition isolate.cc:421
ObjectPtr CopyMutableObjectGraph(const Object &object)

◆ DEFINE_NATIVE_ENTRY() [230/345]

dart::DEFINE_NATIVE_ENTRY ( Isolate_spawnUri  ,
,
12   
)

Definition at line 952 of file isolate.cc.

952 {
953 GET_NON_NULL_NATIVE_ARGUMENT(SendPort, port, arguments->NativeArgAt(0));
954 GET_NON_NULL_NATIVE_ARGUMENT(String, uri, arguments->NativeArgAt(1));
955 GET_NON_NULL_NATIVE_ARGUMENT(Instance, args, arguments->NativeArgAt(2));
956 GET_NON_NULL_NATIVE_ARGUMENT(Instance, message, arguments->NativeArgAt(3));
957 GET_NON_NULL_NATIVE_ARGUMENT(Bool, paused, arguments->NativeArgAt(4));
958 GET_NATIVE_ARGUMENT(SendPort, onExit, arguments->NativeArgAt(5));
959 GET_NATIVE_ARGUMENT(SendPort, onError, arguments->NativeArgAt(6));
960 GET_NATIVE_ARGUMENT(Bool, fatalErrors, arguments->NativeArgAt(7));
961 GET_NATIVE_ARGUMENT(Bool, checked, arguments->NativeArgAt(8));
962 GET_NATIVE_ARGUMENT(Array, environment, arguments->NativeArgAt(9));
963 GET_NATIVE_ARGUMENT(String, packageConfig, arguments->NativeArgAt(10));
964 GET_NATIVE_ARGUMENT(String, debugName, arguments->NativeArgAt(11));
965
966 bool fatal_errors = fatalErrors.IsNull() ? true : fatalErrors.value();
967 Dart_Port on_exit_port = onExit.IsNull() ? ILLEGAL_PORT : onExit.Id();
968 Dart_Port on_error_port = onError.IsNull() ? ILLEGAL_PORT : onError.Id();
969
970 // We first try to serialize the arguments and the message. In case the
971 // arguments or the message are not serializable this will throw an exception.
972 SerializedObjectBuffer arguments_buffer;
973 SerializedObjectBuffer message_buffer;
974 {
975 arguments_buffer.set_message(WriteMessage(
976 /*same_group=*/false, args, ILLEGAL_PORT, Message::kNormalPriority));
977 }
978 {
979 message_buffer.set_message(WriteMessage(
980 /*same_group=*/false, message, ILLEGAL_PORT, Message::kNormalPriority));
981 }
982
983 // Canonicalize the uri with respect to the current isolate.
984 const Library& root_lib =
985 Library::Handle(isolate->group()->object_store()->root_library());
986 char* error = nullptr;
987 const char* canonical_uri = CanonicalizeUri(thread, root_lib, uri, &error);
988 if (canonical_uri == nullptr) {
989 const String& msg = String::Handle(String::New(error));
991 }
992
993 const char* utf8_package_config =
994 packageConfig.IsNull() ? nullptr : String2UTF8(packageConfig);
995 const char* utf8_debug_name =
996 debugName.IsNull() ? nullptr : String2UTF8(debugName);
997
998 std::unique_ptr<IsolateSpawnState> state(new IsolateSpawnState(
999 port.Id(), canonical_uri, utf8_package_config, &arguments_buffer,
1000 &message_buffer, paused.value(), fatal_errors, on_exit_port,
1001 on_error_port, utf8_debug_name, /*group=*/nullptr));
1002
1003 // If we were passed a value then override the default flags state for
1004 // checked mode.
1005 if (!checked.IsNull()) {
1006 Dart_IsolateFlags* flags = state->isolate_flags();
1007 flags->enable_asserts = checked.value();
1008 }
1009
1010 isolate->group()->thread_pool()->Run<SpawnIsolateTask>(isolate,
1011 std::move(state));
1012 return Object::null();
1013}
static void ThrowIsolateSpawnException(const String &message)
Definition isolate.cc:553
static const char * CanonicalizeUri(Thread *thread, const Library &library, const String &uri, char **error)
Definition isolate.cc:921

◆ DEFINE_NATIVE_ENTRY() [231/345]

dart::DEFINE_NATIVE_ENTRY ( Isolate_unregisterKernelBlob  ,
,
 
)

Definition at line 1074 of file isolate.cc.

1074 {
1075 GET_NON_NULL_NATIVE_ARGUMENT(String, kernel_blob_uri,
1076 arguments->NativeArgAt(0));
1077 auto unregister_kernel_blob_callback =
1078 Isolate::UnregisterKernelBlobCallback();
1079 if (unregister_kernel_blob_callback == nullptr) {
1080 Exceptions::ThrowUnsupportedError(
1081 "Registration of kernel blobs is not supported by this Dart embedder.");
1082 }
1083 unregister_kernel_blob_callback(kernel_blob_uri.ToCString());
1084 return Object::null();
1085}

◆ DEFINE_NATIVE_ENTRY() [232/345]

dart::DEFINE_NATIVE_ENTRY ( IsolateMirror_loadUri  ,
,
 
)

Definition at line 676 of file mirrors.cc.

676 {
677 GET_NON_NULL_NATIVE_ARGUMENT(String, uri, arguments->NativeArgAt(0));
678
679 if (!isolate->group()->HasTagHandler()) {
680 ThrowLanguageError("no library handler registered");
681 }
682
683 NoReloadScope no_reload(thread);
684
685 // Canonicalize library URI.
686 String& canonical_uri = String::Handle(zone);
687 if (uri.StartsWith(Symbols::DartScheme())) {
688 canonical_uri = uri.ptr();
689 } else {
690 isolate->BlockClassFinalization();
691 const Object& result = Object::Handle(
692 zone, isolate->group()->CallTagHandler(
694 Library::Handle(
695 zone, isolate->group()->object_store()->root_library()),
696 uri));
697 isolate->UnblockClassFinalization();
698 if (result.IsError()) {
699 if (result.IsLanguageError()) {
700 Exceptions::ThrowCompileTimeError(LanguageError::Cast(result));
701 }
702 Exceptions::PropagateError(Error::Cast(result));
703 } else if (!result.IsString()) {
704 ThrowLanguageError("library handler failed URI canonicalization");
705 }
706
707 canonical_uri ^= result.ptr();
708 }
709
710 // Return the existing library if it has already been loaded.
711 Library& library =
712 Library::Handle(zone, Library::LookupLibrary(thread, canonical_uri));
713 if (!library.IsNull()) {
714 return CreateLibraryMirror(thread, library);
715 }
716
717 // Request the embedder to load the library.
718 isolate->BlockClassFinalization();
719 Object& result = Object::Handle(
720 zone, isolate->group()->CallTagHandler(
722 Library::Handle(
723 zone, isolate->group()->object_store()->root_library()),
724 canonical_uri));
725 isolate->UnblockClassFinalization();
726 if (result.IsError()) {
727 if (result.IsLanguageError()) {
728 Exceptions::ThrowCompileTimeError(LanguageError::Cast(result));
729 }
730 Exceptions::PropagateError(Error::Cast(result));
731 }
732
733 // This code assumes a synchronous tag handler (which dart::bin and tonic
734 // provide). Strictly though we should complete a future in response to
735 // Dart_FinalizeLoading.
736
737 if (!ClassFinalizer::ProcessPendingClasses()) {
738 Exceptions::PropagateError(Error::Handle(thread->sticky_error()));
739 }
740
741 // Prefer the tag handler's idea of which library is represented by the URI.
742 if (result.IsLibrary()) {
743 return CreateLibraryMirror(thread, Library::Cast(result));
744 }
745
746 if (result.IsNull()) {
747 library = Library::LookupLibrary(thread, canonical_uri);
748 if (!library.IsNull()) {
749 return CreateLibraryMirror(thread, library);
750 }
751 }
752
753 FATAL("Non-library from tag handler");
754}
@ Dart_kImportTag
Definition dart_api.h:3341
static void ThrowLanguageError(const char *message)
Definition mirrors.cc:670

◆ DEFINE_NATIVE_ENTRY() [233/345]

dart::DEFINE_NATIVE_ENTRY ( LibraryMirror_fromPrefix  ,
,
 
)

Definition at line 448 of file mirrors.cc.

448 {
450 arguments->NativeArgAt(0));
451 const Library& deferred_lib = Library::Handle(prefix.GetLibrary(0));
452 if (!deferred_lib.Loaded()) {
453 return Instance::null();
454 }
455 return CreateLibraryMirror(thread, deferred_lib);
456}

◆ DEFINE_NATIVE_ENTRY() [234/345]

dart::DEFINE_NATIVE_ENTRY ( LibraryMirror_invoke  ,
,
 
)

Definition at line 1481 of file mirrors.cc.

1481 {
1482 // Argument 0 is the mirror, which is unused by the native. It exists
1483 // because this native is an instance method in order to be polymorphic
1484 // with its cousins.
1485 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(1));
1486 const Library& library = Library::Handle(ref.GetLibraryReferent());
1487 GET_NON_NULL_NATIVE_ARGUMENT(String, function_name,
1488 arguments->NativeArgAt(2));
1489 GET_NON_NULL_NATIVE_ARGUMENT(Array, args, arguments->NativeArgAt(3));
1490 GET_NON_NULL_NATIVE_ARGUMENT(Array, arg_names, arguments->NativeArgAt(4));
1491 RETURN_OR_PROPAGATE(library.Invoke(function_name, args, arg_names));
1492}
ObjectPtr Invoke(const String &selector, const Array &arguments, const Array &argument_names, bool respect_reflectable=true, bool check_is_entrypoint=false) const
Definition object.cc:14520

◆ DEFINE_NATIVE_ENTRY() [235/345]

dart::DEFINE_NATIVE_ENTRY ( LibraryMirror_invokeGetter  ,
,
 
)

Definition at line 1494 of file mirrors.cc.

1494 {
1495 // Argument 0 is the mirror, which is unused by the native. It exists
1496 // because this native is an instance method in order to be polymorphic
1497 // with its cousins.
1498 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(1));
1499 const Library& library = Library::Handle(ref.GetLibraryReferent());
1500 GET_NON_NULL_NATIVE_ARGUMENT(String, getter_name, arguments->NativeArgAt(2));
1501 RETURN_OR_PROPAGATE(library.InvokeGetter(getter_name, true));
1502}
ObjectPtr InvokeGetter(const String &selector, bool throw_nsm_if_absent, bool respect_reflectable=true, bool check_is_entrypoint=false) const
Definition object.cc:14389

◆ DEFINE_NATIVE_ENTRY() [236/345]

dart::DEFINE_NATIVE_ENTRY ( LibraryMirror_invokeSetter  ,
,
 
)

Definition at line 1504 of file mirrors.cc.

1504 {
1505 // Argument 0 is the mirror, which is unused by the native. It exists
1506 // because this native is an instance method in order to be polymorphic
1507 // with its cousins.
1508 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(1));
1509 const Library& library = Library::Handle(ref.GetLibraryReferent());
1510 GET_NON_NULL_NATIVE_ARGUMENT(String, setter_name, arguments->NativeArgAt(2));
1511 GET_NATIVE_ARGUMENT(Instance, value, arguments->NativeArgAt(3));
1512 RETURN_OR_PROPAGATE(library.InvokeSetter(setter_name, value));
1513}
ObjectPtr InvokeSetter(const String &selector, const Instance &argument, bool respect_reflectable=true, bool check_is_entrypoint=false) const
Definition object.cc:14457

◆ DEFINE_NATIVE_ENTRY() [237/345]

dart::DEFINE_NATIVE_ENTRY ( LibraryMirror_libraryDependencies  ,
,
 
)

Definition at line 458 of file mirrors.cc.

458 {
459 GET_NON_NULL_NATIVE_ARGUMENT(Instance, lib_mirror, arguments->NativeArgAt(0));
460 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(1));
461 const Library& lib = Library::Handle(ref.GetLibraryReferent());
462
463 Array& ports = Array::Handle();
464 Namespace& ns = Namespace::Handle();
465 Instance& dep = Instance::Handle();
466 LibraryPrefix& prefix = LibraryPrefix::Handle();
467 GrowableObjectArray& deps =
468 GrowableObjectArray::Handle(GrowableObjectArray::New());
469
470 // Unprefixed imports.
471 ports = lib.imports();
472 for (intptr_t i = 0; i < ports.Length(); i++) {
473 ns ^= ports.At(i);
474 if (!ns.IsNull()) {
475 dep = CreateLibraryDependencyMirror(thread, lib_mirror, ns, prefix, true,
476 false);
477 if (!dep.IsNull()) {
478 deps.Add(dep);
479 }
480 }
481 }
482
483 // Exports.
484 ports = lib.exports();
485 for (intptr_t i = 0; i < ports.Length(); i++) {
486 ns ^= ports.At(i);
487 dep = CreateLibraryDependencyMirror(thread, lib_mirror, ns, prefix, false,
488 false);
489 if (!dep.IsNull()) {
490 deps.Add(dep);
491 }
492 }
493
494 // Prefixed imports.
495 DictionaryIterator entries(lib);
496 Object& entry = Object::Handle();
497 while (entries.HasNext()) {
498 entry = entries.GetNext();
499 if (entry.IsLibraryPrefix()) {
500 prefix ^= entry.ptr();
501 ports = prefix.imports();
502 for (intptr_t i = 0; i < ports.Length(); i++) {
503 ns ^= ports.At(i);
504 if (!ns.IsNull()) {
505 dep = CreateLibraryDependencyMirror(thread, lib_mirror, ns, prefix,
506 true, prefix.is_deferred_load());
507 if (!dep.IsNull()) {
508 deps.Add(dep);
509 }
510 }
511 }
512 }
513 }
514
515 return deps.ptr();
516}
ArrayPtr exports() const
Definition object.h:5188
ArrayPtr imports() const
Definition object.h:5187

◆ DEFINE_NATIVE_ENTRY() [238/345]

dart::DEFINE_NATIVE_ENTRY ( LibraryMirror_members  ,
,
 
)

Definition at line 1103 of file mirrors.cc.

1103 {
1105 arguments->NativeArgAt(0));
1106 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(1));
1107 const Library& library = Library::Handle(zone, ref.GetLibraryReferent());
1108
1110
1111 Instance& member_mirror = Instance::Handle(zone);
1112 const GrowableObjectArray& member_mirrors =
1113 GrowableObjectArray::Handle(zone, GrowableObjectArray::New());
1114
1115 Object& entry = Object::Handle(zone);
1116 DictionaryIterator entries(library);
1117
1118 Error& error = Error::Handle(zone);
1119 AbstractType& type = AbstractType::Handle(zone);
1120
1121 while (entries.HasNext()) {
1122 entry = entries.GetNext();
1123 if (entry.IsClass()) {
1124 const Class& klass = Class::Cast(entry);
1125 ASSERT(!klass.IsDynamicClass());
1126 ASSERT(!klass.IsVoidClass());
1127 ASSERT(!klass.IsNeverClass());
1128 error = klass.EnsureIsFinalized(thread);
1129 if (!error.IsNull()) {
1130 Exceptions::PropagateError(error);
1131 }
1132 type = klass.DeclarationType();
1133 member_mirror = CreateClassMirror(klass, type,
1134 Bool::True(), // is_declaration
1135 owner_mirror);
1136 member_mirrors.Add(member_mirror);
1137 } else if (entry.IsField()) {
1138 const Field& field = Field::Cast(entry);
1139 if (field.is_reflectable()) {
1140 member_mirror = CreateVariableMirror(field, owner_mirror);
1141 member_mirrors.Add(member_mirror);
1142 }
1143 } else if (entry.IsFunction()) {
1144 const Function& func = Function::Cast(entry);
1145 if (func.is_reflectable() &&
1146 (func.kind() == UntaggedFunction::kRegularFunction ||
1147 func.kind() == UntaggedFunction::kGetterFunction ||
1148 func.kind() == UntaggedFunction::kSetterFunction)) {
1149 member_mirror =
1150 CreateMethodMirror(func, owner_mirror, AbstractType::Handle());
1151 member_mirrors.Add(member_mirror);
1152 }
1153 }
1154 }
1155
1156 return member_mirrors.ptr();
1157}
TypePtr DeclarationType() const
Definition object.cc:5882
void EnsureTopLevelClassIsFinalized() const
Definition object.cc:14091
static InstancePtr CreateVariableMirror(const Field &field, const Instance &owner_mirror)
Definition mirrors.cc:284

◆ DEFINE_NATIVE_ENTRY() [239/345]

dart::DEFINE_NATIVE_ENTRY ( LibraryPrefix_isLoaded  ,
,
 
)

Definition at line 268 of file object.cc.

268 {
269 const LibraryPrefix& prefix =
270 LibraryPrefix::CheckedHandle(zone, arguments->NativeArgAt(0));
271 return Bool::Get(isolate->IsPrefixLoaded(prefix)).ptr();
272}

◆ DEFINE_NATIVE_ENTRY() [240/345]

dart::DEFINE_NATIVE_ENTRY ( LibraryPrefix_issueLoad  ,
,
 
)

Definition at line 289 of file object.cc.

289 {
290 const Smi& id = Smi::CheckedHandle(zone, arguments->NativeArgAt(0));
291 Array& units =
292 Array::Handle(zone, isolate->group()->object_store()->loading_units());
293 if (units.IsNull()) {
294 // Not actually split.
295 const Library& lib = Library::Handle(zone, Library::CoreLibrary());
296 const String& sel = String::Handle(zone, String::New("_completeLoads"));
297 const Function& func =
298 Function::Handle(zone, lib.LookupFunctionAllowPrivate(sel));
299 ASSERT(!func.IsNull());
300 const Array& args = Array::Handle(zone, Array::New(3));
301 args.SetAt(0, id);
302 args.SetAt(1, String::Handle(zone));
303 args.SetAt(2, Bool::Get(false));
304 return DartEntry::InvokeFunction(func, args);
305 }
306 ASSERT(id.Value() != LoadingUnit::kIllegalId);
307 LoadingUnit& unit = LoadingUnit::Handle(zone);
308 unit ^= units.At(id.Value());
309 return unit.IssueLoad();
310}
FunctionPtr LookupFunctionAllowPrivate(const String &name) const
Definition object.cc:14131

◆ DEFINE_NATIVE_ENTRY() [241/345]

dart::DEFINE_NATIVE_ENTRY ( LibraryPrefix_loadingUnit  ,
,
 
)

Definition at line 281 of file object.cc.

281 {
282 const LibraryPrefix& prefix =
283 LibraryPrefix::CheckedHandle(zone, arguments->NativeArgAt(0));
284 const Library& target = Library::Handle(zone, prefix.GetLibrary(0));
285 const LoadingUnit& unit = LoadingUnit::Handle(zone, target.loading_unit());
286 return Smi::New(unit.IsNull() ? LoadingUnit::kIllegalId : unit.id());
287}

◆ DEFINE_NATIVE_ENTRY() [242/345]

dart::DEFINE_NATIVE_ENTRY ( LibraryPrefix_setLoaded  ,
,
 
)

Definition at line 274 of file object.cc.

274 {
275 const LibraryPrefix& prefix =
276 LibraryPrefix::CheckedHandle(zone, arguments->NativeArgAt(0));
277 isolate->SetPrefixIsLoaded(prefix);
278 return Instance::null();
279}

◆ DEFINE_NATIVE_ENTRY() [243/345]

dart::DEFINE_NATIVE_ENTRY ( List_allocate  ,
,
 
)

Definition at line 13 of file array.cc.

13 {
14 // Implemented in FlowGraphBuilder::VisitNativeBody.
16 return Object::null();
17}

◆ DEFINE_NATIVE_ENTRY() [244/345]

dart::DEFINE_NATIVE_ENTRY ( List_getLength  ,
,
 
)

Definition at line 31 of file array.cc.

31 {
32 const Array& array = Array::CheckedHandle(zone, arguments->NativeArgAt(0));
33 return Smi::New(array.Length());
34}

◆ DEFINE_NATIVE_ENTRY() [245/345]

dart::DEFINE_NATIVE_ENTRY ( List_setIndexed  ,
,
 
)

Definition at line 19 of file array.cc.

19 {
20 const Array& array = Array::CheckedHandle(zone, arguments->NativeArgAt(0));
21 GET_NON_NULL_NATIVE_ARGUMENT(Smi, index, arguments->NativeArgAt(1));
22 const Instance& value =
23 Instance::CheckedHandle(zone, arguments->NativeArgAt(2));
24 if ((index.Value() < 0) || (index.Value() >= array.Length())) {
25 Exceptions::ThrowRangeError("index", index, 0, array.Length() - 1);
26 }
27 array.SetAt(index.Value(), value);
28 return Object::null();
29}

◆ DEFINE_NATIVE_ENTRY() [246/345]

dart::DEFINE_NATIVE_ENTRY ( List_slice  ,
,
 
)

Definition at line 37 of file array.cc.

37 {
38 const Array& src = Array::CheckedHandle(zone, arguments->NativeArgAt(0));
39 GET_NON_NULL_NATIVE_ARGUMENT(Smi, start, arguments->NativeArgAt(1));
40 GET_NON_NULL_NATIVE_ARGUMENT(Smi, count, arguments->NativeArgAt(2));
41 GET_NON_NULL_NATIVE_ARGUMENT(Bool, needs_type_arg, arguments->NativeArgAt(3));
42 intptr_t istart = start.Value();
43 if ((istart < 0) || (istart > src.Length())) {
44 Exceptions::ThrowRangeError("start", start, 0, src.Length());
45 }
46 intptr_t icount = count.Value();
47 // Zero count should be handled outside already.
48 if ((icount <= 0) || (icount > src.Length())) {
49 Exceptions::ThrowRangeError("count", count,
50 0, // This is the limit the user sees.
51 src.Length() - istart);
52 }
53
54 return src.Slice(istart, icount, needs_type_arg.value());
55}

◆ DEFINE_NATIVE_ENTRY() [247/345]

dart::DEFINE_NATIVE_ENTRY ( Math_doublePow  ,
,
 
)

Definition at line 16 of file math.cc.

16 {
17 const double operand =
18 Double::CheckedHandle(zone, arguments->NativeArgAt(0)).value();
19 GET_NON_NULL_NATIVE_ARGUMENT(Double, exponent_object,
20 arguments->NativeArgAt(1));
21 const double exponent = exponent_object.value();
22 return Double::New(pow(operand, exponent));
23}

◆ DEFINE_NATIVE_ENTRY() [248/345]

dart::DEFINE_NATIVE_ENTRY ( MethodMirror_owner  ,
,
 
)

Definition at line 1515 of file mirrors.cc.

1515 {
1516 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0));
1517 GET_NATIVE_ARGUMENT(AbstractType, instantiator, arguments->NativeArgAt(1));
1518 const Function& func = Function::Handle(ref.GetFunctionReferent());
1519 if (func.IsNonImplicitClosureFunction()) {
1520 return CreateMethodMirror(Function::Handle(func.parent_function()),
1521 Object::null_instance(), instantiator);
1522 }
1523 const Class& owner = Class::Handle(func.Owner());
1524 if (owner.IsTopLevel()) {
1525 return CreateLibraryMirror(thread, Library::Handle(owner.library()));
1526 }
1527
1528 AbstractType& type = AbstractType::Handle(owner.DeclarationType());
1529 return CreateClassMirror(owner, type, Bool::True(), Object::null_instance());
1530}

◆ DEFINE_NATIVE_ENTRY() [249/345]

dart::DEFINE_NATIVE_ENTRY ( MethodMirror_parameters  ,
,
 
)

Definition at line 1532 of file mirrors.cc.

1532 {
1533 GET_NON_NULL_NATIVE_ARGUMENT(Instance, owner, arguments->NativeArgAt(0));
1534 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(1));
1535 const Function& func = Function::Handle(ref.GetFunctionReferent());
1536 const FunctionType& sig = FunctionType::Handle(func.signature());
1537 return CreateParameterMirrorList(func, sig, owner);
1538}

◆ DEFINE_NATIVE_ENTRY() [250/345]

dart::DEFINE_NATIVE_ENTRY ( MethodMirror_return_type  ,
,
 
)

Definition at line 1540 of file mirrors.cc.

1540 {
1541 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0));
1542 const Function& func = Function::Handle(ref.GetFunctionReferent());
1543 GET_NATIVE_ARGUMENT(AbstractType, instantiator, arguments->NativeArgAt(1));
1544 // We handle constructors in Dart code.
1546 AbstractType& type = AbstractType::Handle(func.result_type());
1547 type =
1548 type.Canonicalize(thread); // Instantiated signatures are not canonical.
1549 return InstantiateType(type, instantiator);
1550}
AbstractTypePtr result_type() const
Definition object.h:3079

◆ DEFINE_NATIVE_ENTRY() [251/345]

dart::DEFINE_NATIVE_ENTRY ( MethodMirror_source  ,
,
 
)

Definition at line 1552 of file mirrors.cc.

1552 {
1553 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0));
1554 const Function& func = Function::Handle(ref.GetFunctionReferent());
1555 return func.GetSource();
1556}
StringPtr GetSource() const
Definition object.cc:11177

◆ DEFINE_NATIVE_ENTRY() [252/345]

dart::DEFINE_NATIVE_ENTRY ( Mint_bitLength  ,
,
 
)

Definition at line 316 of file integers.cc.

316 {
317 const Mint& operand = Mint::CheckedHandle(zone, arguments->NativeArgAt(0));
318 ASSERT(CheckInteger(operand));
319 if (FLAG_trace_intrinsified_natives) {
320 OS::PrintErr("Mint_bitLength: %s\n", operand.ToCString());
321 }
322 int64_t value = operand.AsInt64Value();
323 intptr_t result = Utils::BitLength(value);
324 ASSERT(Smi::IsValid(result));
325 return Smi::New(result);
326}
virtual int64_t AsInt64Value() const
Definition object.cc:23415

◆ DEFINE_NATIVE_ENTRY() [253/345]

dart::DEFINE_NATIVE_ENTRY ( Mint_bitNegate  ,
,
 
)

Definition at line 306 of file integers.cc.

306 {
307 const Mint& operand = Mint::CheckedHandle(zone, arguments->NativeArgAt(0));
308 ASSERT(CheckInteger(operand));
309 if (FLAG_trace_intrinsified_natives) {
310 OS::PrintErr("Mint_bitNegate: %s\n", operand.ToCString());
311 }
312 int64_t result = ~operand.value();
313 return Integer::New(result);
314}

◆ DEFINE_NATIVE_ENTRY() [254/345]

dart::DEFINE_NATIVE_ENTRY ( MirrorReference_equals  ,
,
 
)

Definition at line 837 of file mirrors.cc.

837 {
838 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, a, arguments->NativeArgAt(0));
839 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, b, arguments->NativeArgAt(1));
840 return Bool::Get(a.referent() == b.referent()).ptr();
841}

◆ DEFINE_NATIVE_ENTRY() [255/345]

dart::DEFINE_NATIVE_ENTRY ( Mirrors_instantiateGenericType  ,
,
 
)

Definition at line 778 of file mirrors.cc.

778 {
779 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, type, arguments->NativeArgAt(0));
780 GET_NON_NULL_NATIVE_ARGUMENT(Array, args, arguments->NativeArgAt(1));
781
782 const Class& clz = Class::Handle(
783 type.IsFunctionType()
784 ? IsolateGroup::Current()->object_store()->closure_class()
785 : type.type_class());
786 if (!clz.IsGeneric()) {
787 const Array& error_args = Array::Handle(Array::New(3));
788 error_args.SetAt(0, type);
789 error_args.SetAt(1, String::Handle(String::New("key")));
790 error_args.SetAt(2, String::Handle(String::New(
791 "Type must be a generic class or function.")));
792 Exceptions::ThrowByType(Exceptions::kArgumentValue, error_args);
793 UNREACHABLE();
794 }
795 if (clz.NumTypeParameters() != args.Length()) {
796 const Array& error_args = Array::Handle(Array::New(3));
797 error_args.SetAt(0, args);
798 error_args.SetAt(1, String::Handle(String::New("typeArguments")));
799 error_args.SetAt(2, String::Handle(String::New(
800 "Number of type arguments does not match.")));
801 Exceptions::ThrowByType(Exceptions::kArgumentValue, error_args);
802 UNREACHABLE();
803 }
804
805 intptr_t num_expected_type_arguments = args.Length();
806 TypeArguments& type_args_obj = TypeArguments::Handle();
807 type_args_obj = TypeArguments::New(num_expected_type_arguments);
808 AbstractType& type_arg = AbstractType::Handle();
809 Instance& instance = Instance::Handle();
810 for (intptr_t i = 0; i < args.Length(); i++) {
811 instance ^= args.At(i);
812 if (!instance.IsType()) {
813 const Array& error_args = Array::Handle(Array::New(3));
814 error_args.SetAt(0, args);
815 error_args.SetAt(1, String::Handle(String::New("typeArguments")));
816 error_args.SetAt(2, String::Handle(String::New(
817 "Type arguments must be instances of Type.")));
818 Exceptions::ThrowByType(Exceptions::kArgumentValue, error_args);
819 UNREACHABLE();
820 }
821 type_arg ^= args.At(i);
822 type_args_obj.SetTypeAt(i, type_arg);
823 }
824
825 Type& instantiated_type = Type::Handle(Type::New(clz, type_args_obj));
826 instantiated_type ^= ClassFinalizer::FinalizeType(instantiated_type);
827 return instantiated_type.ptr();
828}

◆ DEFINE_NATIVE_ENTRY() [256/345]

dart::DEFINE_NATIVE_ENTRY ( Mirrors_makeLocalClassMirror  ,
,
 
)

Definition at line 756 of file mirrors.cc.

756 {
757 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, type, arguments->NativeArgAt(0));
758 ASSERT(type.IsFinalized());
759 const Class& cls = Class::Handle(
760 type.IsFunctionType()
761 ? IsolateGroup::Current()->object_store()->closure_class()
762 : type.type_class());
763 ASSERT(!cls.IsNull());
764 if (cls.IsDynamicClass() || cls.IsVoidClass() || cls.IsNeverClass()) {
765 Exceptions::ThrowArgumentError(type);
766 UNREACHABLE();
767 }
768 return CreateClassMirror(cls, AbstractType::Handle(cls.DeclarationType()),
769 Bool::True(), // is_declaration
770 Object::null_instance());
771}

◆ DEFINE_NATIVE_ENTRY() [257/345]

dart::DEFINE_NATIVE_ENTRY ( Mirrors_makeLocalTypeMirror  ,
,
 
)

Definition at line 773 of file mirrors.cc.

773 {
774 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, type, arguments->NativeArgAt(0));
775 return CreateTypeMirror(type);
776}

◆ DEFINE_NATIVE_ENTRY() [258/345]

dart::DEFINE_NATIVE_ENTRY ( Mirrors_mangleName  ,
,
 
)

Definition at line 830 of file mirrors.cc.

830 {
831 GET_NON_NULL_NATIVE_ARGUMENT(String, name, arguments->NativeArgAt(0));
832 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(1));
833 const Library& lib = Library::Handle(ref.GetLibraryReferent());
834 return lib.IsPrivate(name) ? lib.PrivateName(name) : name.ptr();
835}
StringPtr PrivateName(const String &name) const
Definition object.cc:14751
static bool IsPrivate(const String &name)
Definition object.cc:14666

◆ DEFINE_NATIVE_ENTRY() [259/345]

dart::DEFINE_NATIVE_ENTRY ( MirrorSystem_isolate  ,
,
 
)

Definition at line 664 of file mirrors.cc.

664 {
666
667 return CreateIsolateMirror();
668}
static InstancePtr CreateIsolateMirror()
Definition mirrors.cc:569
static void VerifyMethodKindShifts()
Definition mirrors.cc:584

◆ DEFINE_NATIVE_ENTRY() [260/345]

dart::DEFINE_NATIVE_ENTRY ( MirrorSystem_libraries  ,
,
 
)

Definition at line 644 of file mirrors.cc.

644 {
645 const GrowableObjectArray& libraries = GrowableObjectArray::Handle(
646 zone, isolate->group()->object_store()->libraries());
647
648 const intptr_t num_libraries = libraries.Length();
649 const GrowableObjectArray& library_mirrors = GrowableObjectArray::Handle(
650 zone, GrowableObjectArray::New(num_libraries));
651 Library& library = Library::Handle(zone);
652 Instance& library_mirror = Instance::Handle(zone);
653
654 for (int i = 0; i < num_libraries; i++) {
655 library ^= libraries.At(i);
656 library_mirror = CreateLibraryMirror(thread, library);
657 if (!library_mirror.IsNull() && library.Loaded()) {
658 library_mirrors.Add(library_mirror);
659 }
660 }
661 return library_mirrors.ptr();
662}

◆ DEFINE_NATIVE_ENTRY() [261/345]

dart::DEFINE_NATIVE_ENTRY ( NoSuchMethodError_existingMethodSignature  ,
,
 
)

Definition at line 586 of file object.cc.

586 {
587 const Instance& receiver =
588 Instance::CheckedHandle(zone, arguments->NativeArgAt(0));
589 GET_NON_NULL_NATIVE_ARGUMENT(String, method_name, arguments->NativeArgAt(1));
590 GET_NON_NULL_NATIVE_ARGUMENT(Smi, invocation_type, arguments->NativeArgAt(2));
593 InvocationMirror::DecodeType(invocation_type.Value(), &level, &kind);
594
595 Function& function = Function::Handle(zone);
596 if (level == InvocationMirror::Level::kTopLevel) {
597 if (receiver.IsString()) return receiver.ptr();
598 ASSERT(receiver.IsNull());
599 return String::null();
600 }
601 if (receiver.IsType()) {
602 const auto& cls = Class::Handle(zone, Type::Cast(receiver).type_class());
603 const auto& error = Error::Handle(zone, cls.EnsureIsFinalized(thread));
604 if (!error.IsNull()) {
605 Exceptions::PropagateError(error);
606 UNREACHABLE();
607 }
608 if (level == InvocationMirror::kConstructor) {
609 function = cls.LookupConstructor(method_name);
610 if (function.IsNull()) {
611 function = cls.LookupFactory(method_name);
612 }
613 } else {
614 function = cls.LookupStaticFunction(method_name);
615 }
616 } else if (receiver.IsClosure()) {
617 function = Closure::Cast(receiver).function();
618 } else {
619 auto& cls = Class::Handle(zone, receiver.clazz());
620 if (level == InvocationMirror::kSuper) {
621 cls = cls.SuperClass();
622 }
623 function = Resolver::ResolveDynamicAnyArgs(zone, cls, method_name,
624 /*allow_add=*/false);
625 }
626 if (!function.IsNull()) {
627 return function.UserVisibleSignature();
628 }
629 return String::null();
630}

◆ DEFINE_NATIVE_ENTRY() [262/345]

dart::DEFINE_NATIVE_ENTRY ( Object_equals  ,
,
 
)

Definition at line 31 of file object.cc.

31 {
32 // Implemented in the flow graph builder.
34 return Object::null();
35}

◆ DEFINE_NATIVE_ENTRY() [263/345]

dart::DEFINE_NATIVE_ENTRY ( Object_getHash  ,
,
 
)

Definition at line 47 of file object.cc.

47 {
48 // Please note that no handle is created for the argument.
49 // This is safe since the argument is only used in a tail call.
50 // The performance benefit is more than 5% when using hashCode.
51 intptr_t hash = GetHash(isolate, arguments->NativeArgAt(0));
52 if (LIKELY(hash != 0)) {
53 return Smi::New(hash);
54 }
55
56 const Instance& instance =
57 Instance::CheckedHandle(zone, arguments->NativeArgAt(0));
58 return instance.IdentityHashCode(arguments->thread());
59}
static intptr_t GetHash(Isolate *isolate, const ObjectPtr obj)
Definition object.cc:37
#define LIKELY(cond)
Definition globals.h:260

◆ DEFINE_NATIVE_ENTRY() [264/345]

dart::DEFINE_NATIVE_ENTRY ( Object_haveSameRuntimeType  ,
,
 
)

Definition at line 186 of file object.cc.

186 {
187 const Instance& left =
188 Instance::CheckedHandle(zone, arguments->NativeArgAt(0));
189 const Instance& right =
190 Instance::CheckedHandle(zone, arguments->NativeArgAt(1));
191 return Bool::Get(HaveSameRuntimeTypeHelper(zone, left, right)).ptr();
192}
static bool HaveSameRuntimeTypeHelper(Zone *zone, const Instance &left, const Instance &right)
Definition object.cc:101

◆ DEFINE_NATIVE_ENTRY() [265/345]

dart::DEFINE_NATIVE_ENTRY ( Object_instanceOf  ,
,
 
)

Definition at line 194 of file object.cc.

194 {
195 const Instance& instance =
196 Instance::CheckedHandle(zone, arguments->NativeArgAt(0));
197 const TypeArguments& instantiator_type_arguments =
198 TypeArguments::CheckedHandle(zone, arguments->NativeArgAt(1));
199 const TypeArguments& function_type_arguments =
200 TypeArguments::CheckedHandle(zone, arguments->NativeArgAt(2));
201 const AbstractType& type =
202 AbstractType::CheckedHandle(zone, arguments->NativeArgAt(3));
203 ASSERT(type.IsFinalized());
204 const bool is_instance_of = instance.IsInstanceOf(
205 type, instantiator_type_arguments, function_type_arguments);
206 if (FLAG_trace_type_checks) {
207 LogBlock lb;
208 const char* result_str = is_instance_of ? "true" : "false";
209 THR_Print("Native Object.instanceOf: result %s\n", result_str);
210 const AbstractType& instance_type =
211 AbstractType::Handle(zone, instance.GetType(Heap::kNew));
212 THR_Print(" instance type: %s\n", instance_type.NameCString());
213 THR_Print(" test type: %s\n", type.NameCString());
214 }
215 return Bool::Get(is_instance_of).ptr();
216}
const char * NameCString() const
Definition object.cc:21385

◆ DEFINE_NATIVE_ENTRY() [266/345]

dart::DEFINE_NATIVE_ENTRY ( Object_runtimeType  ,
,
 
)

Definition at line 74 of file object.cc.

74 {
75 const Instance& instance =
76 Instance::CheckedHandle(zone, arguments->NativeArgAt(0));
77 if (instance.IsString()) {
78 return Type::StringType();
79 } else if (instance.IsInteger()) {
80 return Type::IntType();
81 } else if (instance.IsDouble()) {
82 return Type::Double();
83 } else if (instance.IsAbstractType()) {
84 return Type::DartTypeType();
85 } else if (IsArrayClassId(instance.GetClassId())) {
86 const auto& cls = Class::Handle(
87 zone, thread->isolate_group()->object_store()->list_class());
88 auto& type_arguments =
89 TypeArguments::Handle(zone, instance.GetTypeArguments());
90 type_arguments = type_arguments.FromInstanceTypeArguments(thread, cls);
91 const auto& type = Type::Handle(
92 zone,
93 Type::New(cls, type_arguments, Nullability::kNonNullable, Heap::kNew));
94 type.SetIsFinalized();
95 return type.Canonicalize(thread);
96 }
97
98 return instance.GetType(Heap::kNew);
99}
bool IsArrayClassId(intptr_t index)
Definition class_id.h:358

◆ DEFINE_NATIVE_ENTRY() [267/345]

dart::DEFINE_NATIVE_ENTRY ( Object_simpleInstanceOf  ,
,
 
)

Definition at line 218 of file object.cc.

218 {
219 // This native is only called when the right hand side passes
220 // SimpleInstanceOfType and it is a non-negative test.
221 const Instance& instance =
222 Instance::CheckedHandle(zone, arguments->NativeArgAt(0));
223 const AbstractType& type =
224 AbstractType::CheckedHandle(zone, arguments->NativeArgAt(1));
225 ASSERT(type.IsFinalized());
226 ASSERT(type.IsInstantiated());
227 const bool is_instance_of = instance.IsInstanceOf(
228 type, Object::null_type_arguments(), Object::null_type_arguments());
229 return Bool::Get(is_instance_of).ptr();
230}

◆ DEFINE_NATIVE_ENTRY() [268/345]

dart::DEFINE_NATIVE_ENTRY ( Object_toString  ,
,
 
)

Definition at line 61 of file object.cc.

61 {
62 const Instance& instance =
63 Instance::CheckedHandle(zone, arguments->NativeArgAt(0));
64 if (instance.IsString()) {
65 return instance.ptr();
66 }
67 if (instance.IsAbstractType()) {
68 return AbstractType::Cast(instance).UserVisibleName();
69 }
70 const char* c_str = instance.ToCString();
71 return String::New(c_str);
72}

◆ DEFINE_NATIVE_ENTRY() [269/345]

dart::DEFINE_NATIVE_ENTRY ( OneByteString_allocateFromOneByteList  ,
,
 
)

Definition at line 288 of file string.cc.

288 {
289 Instance& list = Instance::CheckedHandle(zone, arguments->NativeArgAt(0));
290 GET_NON_NULL_NATIVE_ARGUMENT(Smi, start_obj, arguments->NativeArgAt(1));
291 GET_NON_NULL_NATIVE_ARGUMENT(Smi, end_obj, arguments->NativeArgAt(2));
292
293 intptr_t start = start_obj.Value();
294 intptr_t end = end_obj.Value();
295 if (start < 0) {
296 Exceptions::ThrowArgumentError(start_obj);
297 }
298 intptr_t length = end - start;
299 if (length < 0) {
300 Exceptions::ThrowArgumentError(end_obj);
301 }
302 ASSERT(length >= 0);
303
304 Heap::Space space = Heap::kNew;
305 if (list.IsTypedDataBase()) {
306 const TypedDataBase& array = TypedDataBase::Cast(list);
307 if (array.ElementType() != kUint8ArrayElement) {
308 Exceptions::ThrowArgumentError(list);
309 }
310 if (end > array.Length()) {
311 Exceptions::ThrowArgumentError(end_obj);
312 }
313 return OneByteString::New(array, start, length, space);
314 } else if (list.IsArray()) {
315 const Array& array = Array::Cast(list);
316 if (end > array.Length()) {
317 Exceptions::ThrowArgumentError(end_obj);
318 }
319 String& string = String::Handle(OneByteString::New(length, space));
320 for (int i = 0; i < length; i++) {
321 intptr_t value = Smi::Value(static_cast<SmiPtr>(array.At(start + i)));
322 OneByteString::SetCharAt(string, i, value);
323 }
324 return string.ptr();
325 } else if (list.IsGrowableObjectArray()) {
326 const GrowableObjectArray& array = GrowableObjectArray::Cast(list);
327 if (end > array.Length()) {
328 Exceptions::ThrowArgumentError(end_obj);
329 }
330 String& string = String::Handle(OneByteString::New(length, space));
331 for (int i = 0; i < length; i++) {
332 intptr_t value = Smi::Value(static_cast<SmiPtr>(array.At(start + i)));
333 OneByteString::SetCharAt(string, i, value);
334 }
335 return string.ptr();
336 }
337 UNREACHABLE();
338 return Object::null();
339}

◆ DEFINE_NATIVE_ENTRY() [270/345]

dart::DEFINE_NATIVE_ENTRY ( OneByteString_substringUnchecked  ,
,
 
)

Definition at line 248 of file string.cc.

248 {
249 const String& receiver =
250 String::CheckedHandle(zone, arguments->NativeArgAt(0));
251 ASSERT(receiver.IsOneByteString());
252 GET_NON_NULL_NATIVE_ARGUMENT(Smi, start_obj, arguments->NativeArgAt(1));
253 GET_NON_NULL_NATIVE_ARGUMENT(Smi, end_obj, arguments->NativeArgAt(2));
254
255 const intptr_t start = start_obj.Value();
256 const intptr_t end = end_obj.Value();
257 return OneByteString::New(receiver, start, end - start, Heap::kNew);
258}
bool IsOneByteString() const
Definition object.h:10290

◆ DEFINE_NATIVE_ENTRY() [271/345]

dart::DEFINE_NATIVE_ENTRY ( ParameterMirror_type  ,
,
 
)

Definition at line 1630 of file mirrors.cc.

1630 {
1631 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0));
1632 GET_NON_NULL_NATIVE_ARGUMENT(Smi, pos, arguments->NativeArgAt(1));
1633 GET_NATIVE_ARGUMENT(AbstractType, instantiator, arguments->NativeArgAt(2));
1634 const FunctionType& signature =
1635 FunctionType::Handle(ref.GetFunctionTypeReferent());
1636 AbstractType& type = AbstractType::Handle(signature.ParameterTypeAt(
1637 signature.num_implicit_parameters() + pos.Value()));
1638 type =
1639 type.Canonicalize(thread); // Instantiated signatures are not canonical.
1640 return InstantiateType(type, instantiator);
1641}

◆ DEFINE_NATIVE_ENTRY() [272/345]

dart::DEFINE_NATIVE_ENTRY ( Profiler_getCurrentTag  ,
,
 
)

Definition at line 42 of file profiler.cc.

42 {
43 if (FLAG_trace_intrinsified_natives) {
44 OS::PrintErr("Profiler_getCurrentTag\n");
45 }
46 return isolate->current_tag();
47}

◆ DEFINE_NATIVE_ENTRY() [273/345]

dart::DEFINE_NATIVE_ENTRY ( Random_initialSeed  ,
,
 
)

Definition at line 25 of file math.cc.

25 {
26 Random* rnd = isolate->random();
27 uint64_t seed = rnd->NextUInt32();
28 seed |= (static_cast<uint64_t>(rnd->NextUInt32()) << 32);
29 return Integer::New(seed);
30}
uint32_t NextUInt32()
Definition random.cc:73

◆ DEFINE_NATIVE_ENTRY() [274/345]

dart::DEFINE_NATIVE_ENTRY ( RawReceivePort_closeInternal  ,
,
 
)

Definition at line 72 of file isolate.cc.

72 {
73 GET_NON_NULL_NATIVE_ARGUMENT(ReceivePort, port, arguments->NativeArgAt(0));
74 Dart_Port id = port.Id();
75 isolate->CloseReceivePort(port);
76 return Integer::New(id);
77}

◆ DEFINE_NATIVE_ENTRY() [275/345]

dart::DEFINE_NATIVE_ENTRY ( RawReceivePort_factory  ,
,
 
)

Definition at line 60 of file isolate.cc.

60 {
61 ASSERT(
62 TypeArguments::CheckedHandle(zone, arguments->NativeArgAt(0)).IsNull());
63 GET_NON_NULL_NATIVE_ARGUMENT(String, debug_name, arguments->NativeArgAt(1));
64 return isolate->CreateReceivePort(debug_name);
65}

◆ DEFINE_NATIVE_ENTRY() [276/345]

dart::DEFINE_NATIVE_ENTRY ( RawReceivePort_get_id  ,
,
 
)

Definition at line 67 of file isolate.cc.

67 {
68 GET_NON_NULL_NATIVE_ARGUMENT(ReceivePort, port, arguments->NativeArgAt(0));
69 return Integer::New(port.Id());
70}

◆ DEFINE_NATIVE_ENTRY() [277/345]

dart::DEFINE_NATIVE_ENTRY ( RawReceivePort_getActive  ,
,
 
)

Definition at line 86 of file isolate.cc.

86 {
87 GET_NON_NULL_NATIVE_ARGUMENT(ReceivePort, port, arguments->NativeArgAt(0));
88 return Bool::Get(port.keep_isolate_alive()).ptr();
89}

◆ DEFINE_NATIVE_ENTRY() [278/345]

dart::DEFINE_NATIVE_ENTRY ( RawReceivePort_setActive  ,
,
 
)

Definition at line 79 of file isolate.cc.

79 {
80 GET_NON_NULL_NATIVE_ARGUMENT(ReceivePort, port, arguments->NativeArgAt(0));
81 GET_NON_NULL_NATIVE_ARGUMENT(Bool, active, arguments->NativeArgAt(1));
82 isolate->SetReceivePortKeepAliveState(port, active.value());
83 return Object::null();
84}

◆ DEFINE_NATIVE_ENTRY() [279/345]

dart::DEFINE_NATIVE_ENTRY ( RegExp_ExecuteMatch  ,
,
 
)

Definition at line 173 of file regexp.cc.

173 {
174 // This function is intrinsified. See Intrinsifier::RegExp_ExecuteMatch.
175 return ExecuteMatch(zone, arguments, /*sticky=*/false);
176}
static ObjectPtr ExecuteMatch(Zone *zone, NativeArguments *arguments, bool sticky)
Definition regexp.cc:142

◆ DEFINE_NATIVE_ENTRY() [280/345]

dart::DEFINE_NATIVE_ENTRY ( RegExp_ExecuteMatchSticky  ,
,
 
)

Definition at line 178 of file regexp.cc.

178 {
179 // This function is intrinsified. See Intrinsifier::RegExp_ExecuteMatchSticky.
180 return ExecuteMatch(zone, arguments, /*sticky=*/true);
181}

◆ DEFINE_NATIVE_ENTRY() [281/345]

dart::DEFINE_NATIVE_ENTRY ( RegExp_factory  ,
,
 
)

Definition at line 24 of file regexp.cc.

24 {
25 ASSERT(
26 TypeArguments::CheckedHandle(zone, arguments->NativeArgAt(0)).IsNull());
27 GET_NON_NULL_NATIVE_ARGUMENT(String, pattern, arguments->NativeArgAt(1));
28
29 bool multi_line = arguments->NativeArgAt(2) == Bool::True().ptr();
30 bool ignore_case = arguments->NativeArgAt(3) != Bool::True().ptr();
31 bool unicode = arguments->NativeArgAt(4) == Bool::True().ptr();
32 bool dot_all = arguments->NativeArgAt(5) == Bool::True().ptr();
33
35 flags.SetGlobal(); // All dart regexps are global.
36 if (ignore_case) flags.SetIgnoreCase();
37 if (multi_line) flags.SetMultiLine();
38 if (unicode) flags.SetUnicode();
39 if (dot_all) flags.SetDotAll();
40
41 RegExpKey lookup_key(pattern, flags);
42 RegExp& regexp = RegExp::Handle(thread->zone());
43 {
47 Object& key = thread->ObjectHandle();
48 Smi& value = thread->SmiHandle();
49 WeakArray& data = thread->WeakArrayHandle();
50 data = thread->isolate_group()->object_store()->regexp_table();
51 CanonicalRegExpSet table(&key, &value, &data);
52 regexp ^= table.GetOrNull(lookup_key);
53 table.Release();
54 if (!regexp.IsNull()) {
55 return regexp.ptr();
56 }
57 }
58
59 // Parse the pattern once in order to throw any format exceptions within
60 // the factory constructor. It is parsed again upon compilation.
61 RegExpCompileData compileData;
62 // Throws an exception on parsing failure.
63 RegExpParser::ParseRegExp(pattern, flags, &compileData);
64
65 {
66 RegExpKey lookup_symbol_key(String::Handle(Symbols::New(thread, pattern)),
67 flags);
68 SafepointMutexLocker ml(thread->isolate_group()->symbols_mutex());
70 thread->zone(),
71 thread->isolate_group()->object_store()->regexp_table());
72 regexp ^= table.InsertNewOrGet(lookup_symbol_key);
73 thread->isolate_group()->object_store()->set_regexp_table(table.Release());
74 }
75
76 ASSERT(regexp.flags() == flags);
77 return regexp.ptr();
78}
RegExpFlags flags() const
Definition object.h:12865
UnorderedHashSet< CanonicalRegExpTraits, WeakAcqRelStorageTraits > CanonicalRegExpSet
#define REUSABLE_SMI_HANDLESCOPE(thread)
#define REUSABLE_WEAK_ARRAY_HANDLESCOPE(thread)

◆ DEFINE_NATIVE_ENTRY() [282/345]

dart::DEFINE_NATIVE_ENTRY ( RegExp_getGroupCount  ,
,
 
)

Definition at line 110 of file regexp.cc.

110 {
111 const RegExp& regexp = RegExp::CheckedHandle(zone, arguments->NativeArgAt(0));
112 ASSERT(!regexp.IsNull());
113 if (regexp.is_initialized()) {
114 return Smi::New(regexp.num_bracket_expressions());
115 }
116 const String& pattern = String::Handle(regexp.pattern());
117 const String& errmsg =
118 String::Handle(String::New("Regular expression is not initialized yet."));
119 const String& message = String::Handle(String::Concat(errmsg, pattern));
120 const Array& args = Array::Handle(Array::New(1));
121 args.SetAt(0, message);
122 Exceptions::ThrowByType(Exceptions::kFormat, args);
123 return Object::null();
124}
bool is_initialized() const
Definition object.h:12761
intptr_t num_bracket_expressions() const
Definition object.h:12772

◆ DEFINE_NATIVE_ENTRY() [283/345]

dart::DEFINE_NATIVE_ENTRY ( RegExp_getGroupNameMap  ,
,
 
)

Definition at line 126 of file regexp.cc.

126 {
127 const RegExp& regexp = RegExp::CheckedHandle(zone, arguments->NativeArgAt(0));
128 ASSERT(!regexp.IsNull());
129 if (regexp.is_initialized()) {
130 return regexp.capture_name_map();
131 }
132 const String& pattern = String::Handle(regexp.pattern());
133 const String& errmsg = String::Handle(
134 String::New("Regular expression is not initialized yet. "));
135 const String& message = String::Handle(String::Concat(errmsg, pattern));
136 const Array& args = Array::Handle(Array::New(1));
137 args.SetAt(0, message);
138 Exceptions::ThrowByType(Exceptions::kFormat, args);
139 return Object::null();
140}
ArrayPtr capture_name_map() const
Definition object.h:12775

◆ DEFINE_NATIVE_ENTRY() [284/345]

dart::DEFINE_NATIVE_ENTRY ( RegExp_getIsCaseSensitive  ,
,
 
)

Definition at line 104 of file regexp.cc.

104 {
105 const RegExp& regexp = RegExp::CheckedHandle(zone, arguments->NativeArgAt(0));
106 ASSERT(!regexp.IsNull());
107 return Bool::Get(!regexp.flags().IgnoreCase()).ptr();
108}
bool IgnoreCase() const
Definition object.h:12697

◆ DEFINE_NATIVE_ENTRY() [285/345]

dart::DEFINE_NATIVE_ENTRY ( RegExp_getIsDotAll  ,
,
 
)

Definition at line 98 of file regexp.cc.

98 {
99 const RegExp& regexp = RegExp::CheckedHandle(zone, arguments->NativeArgAt(0));
100 ASSERT(!regexp.IsNull());
101 return Bool::Get(regexp.flags().IsDotAll()).ptr();
102}
bool IsDotAll() const
Definition object.h:12700

◆ DEFINE_NATIVE_ENTRY() [286/345]

dart::DEFINE_NATIVE_ENTRY ( RegExp_getIsMultiLine  ,
,
 
)

Definition at line 86 of file regexp.cc.

86 {
87 const RegExp& regexp = RegExp::CheckedHandle(zone, arguments->NativeArgAt(0));
88 ASSERT(!regexp.IsNull());
89 return Bool::Get(regexp.flags().IsMultiLine()).ptr();
90}
bool IsMultiLine() const
Definition object.h:12698

◆ DEFINE_NATIVE_ENTRY() [287/345]

dart::DEFINE_NATIVE_ENTRY ( RegExp_getIsUnicode  ,
,
 
)

Definition at line 92 of file regexp.cc.

92 {
93 const RegExp& regexp = RegExp::CheckedHandle(zone, arguments->NativeArgAt(0));
94 ASSERT(!regexp.IsNull());
95 return Bool::Get(regexp.flags().IsUnicode()).ptr();
96}
bool IsUnicode() const
Definition object.h:12699

◆ DEFINE_NATIVE_ENTRY() [288/345]

dart::DEFINE_NATIVE_ENTRY ( RegExp_getPattern  ,
,
 
)

Definition at line 80 of file regexp.cc.

80 {
81 const RegExp& regexp = RegExp::CheckedHandle(zone, arguments->NativeArgAt(0));
82 ASSERT(!regexp.IsNull());
83 return regexp.pattern();
84}

◆ DEFINE_NATIVE_ENTRY() [289/345]

dart::DEFINE_NATIVE_ENTRY ( SecureRandom_getBytes  ,
,
 
)

Definition at line 32 of file math.cc.

32 {
33 GET_NON_NULL_NATIVE_ARGUMENT(Smi, count, arguments->NativeArgAt(0));
34 const intptr_t n = count.Value();
35 ASSERT((n > 0) && (n <= 8));
36 uint8_t buffer[8];
37 Dart_EntropySource entropy_source = Dart::entropy_source_callback();
38 if ((entropy_source == nullptr) || !entropy_source(buffer, n)) {
39 const String& error = String::Handle(String::New(
40 "No source of cryptographically secure random numbers available."));
41 const Array& args = Array::Handle(Array::New(1));
42 args.SetAt(0, error);
43 Exceptions::ThrowByType(Exceptions::kUnsupported, args);
44 }
45 uint64_t result = 0;
46 for (intptr_t i = 0; i < n; i++) {
47 result = (result << 8) | buffer[i];
48 }
49 return Integer::New(result);
50}
bool(* Dart_EntropySource)(uint8_t *buffer, intptr_t length)
Definition dart_api.h:821

◆ DEFINE_NATIVE_ENTRY() [290/345]

dart::DEFINE_NATIVE_ENTRY ( SendPort_get_hashcode  ,
,
 
)

Definition at line 96 of file isolate.cc.

96 {
97 GET_NON_NULL_NATIVE_ARGUMENT(SendPort, port, arguments->NativeArgAt(0));
98 int64_t id = port.Id();
99 int32_t hi = static_cast<int32_t>(id >> 32);
100 int32_t lo = static_cast<int32_t>(id);
101 int32_t hash = (hi ^ lo) & kSmiMax;
102 return Smi::New(hash);
103}

◆ DEFINE_NATIVE_ENTRY() [291/345]

dart::DEFINE_NATIVE_ENTRY ( SendPort_get_id  ,
,
 
)

Definition at line 91 of file isolate.cc.

91 {
92 GET_NON_NULL_NATIVE_ARGUMENT(SendPort, port, arguments->NativeArgAt(0));
93 return Integer::New(port.Id());
94}

◆ DEFINE_NATIVE_ENTRY() [292/345]

dart::DEFINE_NATIVE_ENTRY ( SendPort_sendInternal_  ,
,
 
)

Definition at line 113 of file isolate.cc.

113 {
114 GET_NON_NULL_NATIVE_ARGUMENT(SendPort, port, arguments->NativeArgAt(0));
115 GET_NON_NULL_NATIVE_ARGUMENT(Instance, obj, arguments->NativeArgAt(1));
116
117 const Dart_Port destination_port_id = port.Id();
118 const bool same_group = InSameGroup(isolate, port);
119#if defined(DEBUG)
120 if (same_group) {
121 ASSERT(PortMap::IsReceiverInThisIsolateGroupOrClosed(destination_port_id,
122 isolate->group()));
123 }
124#endif
125
126 // TODO(turnidge): Throw an exception when the return value is false?
127 PortMap::PostMessage(WriteMessage(same_group, obj, destination_port_id,
128 Message::kNormalPriority));
129 return Object::null();
130}

◆ DEFINE_NATIVE_ENTRY() [293/345]

dart::DEFINE_NATIVE_ENTRY ( Smi_bitLength  ,
,
 
)

Definition at line 264 of file integers.cc.

264 {
265 const Smi& operand = Smi::CheckedHandle(zone, arguments->NativeArgAt(0));
266 if (FLAG_trace_intrinsified_natives) {
267 OS::PrintErr("Smi_bitLength: %s\n", operand.ToCString());
268 }
269 int64_t value = operand.AsInt64Value();
270 intptr_t result = Utils::BitLength(value);
271 ASSERT(Smi::IsValid(result));
272 return Smi::New(result);
273}
virtual int64_t AsInt64Value() const
Definition object.cc:23341

◆ DEFINE_NATIVE_ENTRY() [294/345]

dart::DEFINE_NATIVE_ENTRY ( Smi_bitNegate  ,
,
 
)

Definition at line 254 of file integers.cc.

254 {
255 const Smi& operand = Smi::CheckedHandle(zone, arguments->NativeArgAt(0));
256 if (FLAG_trace_intrinsified_natives) {
257 OS::PrintErr("Smi_bitNegate: %s\n", operand.ToCString());
258 }
259 intptr_t result = ~operand.Value();
260 ASSERT(Smi::IsValid(result));
261 return Smi::New(result);
262}

◆ DEFINE_NATIVE_ENTRY() [295/345]

dart::DEFINE_NATIVE_ENTRY ( StackTrace_current  ,
,
 
)

Definition at line 61 of file stacktrace.cc.

61 {
62 return CurrentStackTrace(thread);
63}
static StackTracePtr CurrentStackTrace(Thread *thread, intptr_t skip_frames=1)
Definition stacktrace.cc:38

◆ DEFINE_NATIVE_ENTRY() [296/345]

dart::DEFINE_NATIVE_ENTRY ( Stopwatch_frequency  ,
,
 
)

Definition at line 16 of file stopwatch.cc.

16 {
17 return Integer::New(OS::GetCurrentMonotonicFrequency());
18}

◆ DEFINE_NATIVE_ENTRY() [297/345]

dart::DEFINE_NATIVE_ENTRY ( Stopwatch_now  ,
,
 
)

Definition at line 12 of file stopwatch.cc.

12 {
13 return Integer::New(OS::GetCurrentMonotonicTicks());
14}

◆ DEFINE_NATIVE_ENTRY() [298/345]

dart::DEFINE_NATIVE_ENTRY ( String_charAt  ,
,
 
)

Definition at line 443 of file string.cc.

443 {
444 const String& receiver =
445 String::CheckedHandle(zone, arguments->NativeArgAt(0));
446 GET_NON_NULL_NATIVE_ARGUMENT(Integer, index, arguments->NativeArgAt(1));
447 uint16_t value = StringValueAt(receiver, index);
448 return Symbols::FromCharCode(thread, static_cast<int32_t>(value));
449}
static uint16_t StringValueAt(const String &str, const Integer &index)
Definition string.cc:430

◆ DEFINE_NATIVE_ENTRY() [299/345]

dart::DEFINE_NATIVE_ENTRY ( String_concat  ,
,
 
)

Definition at line 451 of file string.cc.

451 {
452 const String& receiver =
453 String::CheckedHandle(zone, arguments->NativeArgAt(0));
454 GET_NON_NULL_NATIVE_ARGUMENT(String, b, arguments->NativeArgAt(1));
455 return String::Concat(receiver, b);
456}

◆ DEFINE_NATIVE_ENTRY() [300/345]

dart::DEFINE_NATIVE_ENTRY ( String_concatRange  ,
,
 
)

Definition at line 472 of file string.cc.

472 {
473 GET_NON_NULL_NATIVE_ARGUMENT(Instance, argument, arguments->NativeArgAt(0));
474 GET_NON_NULL_NATIVE_ARGUMENT(Smi, start, arguments->NativeArgAt(1));
475 GET_NON_NULL_NATIVE_ARGUMENT(Smi, end, arguments->NativeArgAt(2));
476 const intptr_t start_ix = start.Value();
477 const intptr_t end_ix = end.Value();
478 if (start_ix < 0) {
479 Exceptions::ThrowArgumentError(start);
480 }
481 Array& strings = Array::Handle();
482 intptr_t length = -1;
483 if (argument.IsArray()) {
484 strings ^= argument.ptr();
485 length = strings.Length();
486 } else if (argument.IsGrowableObjectArray()) {
487 const GrowableObjectArray& g_array = GrowableObjectArray::Cast(argument);
488 strings = g_array.data();
489 length = g_array.Length();
490 } else {
491 Exceptions::ThrowArgumentError(argument);
492 }
493 if (end_ix > length) {
494 Exceptions::ThrowArgumentError(end);
495 }
496#if defined(DEBUG)
497 // Check that the array contains strings.
498 Instance& elem = Instance::Handle();
499 for (intptr_t i = start_ix; i < end_ix; i++) {
500 elem ^= strings.At(i);
501 ASSERT(elem.IsString());
502 }
503#endif
504 return String::ConcatAllRange(strings, start_ix, end_ix, Heap::kNew);
505}

◆ DEFINE_NATIVE_ENTRY() [301/345]

dart::DEFINE_NATIVE_ENTRY ( String_fromEnvironment  ,
,
 
)

Definition at line 19 of file string.cc.

19 {
20 GET_NON_NULL_NATIVE_ARGUMENT(String, name, arguments->NativeArgAt(1));
21 GET_NATIVE_ARGUMENT(String, default_value, arguments->NativeArgAt(2));
22 // Call the embedder to supply us with the environment.
23 const String& env_value =
24 String::Handle(Api::GetEnvironmentValue(thread, name));
25 if (!env_value.IsNull()) {
26 return Symbols::New(thread, env_value);
27 }
28 return default_value.ptr();
29}

◆ DEFINE_NATIVE_ENTRY() [302/345]

dart::DEFINE_NATIVE_ENTRY ( String_getHashCode  ,
,
 
)

Definition at line 415 of file string.cc.

415 {
416 const String& receiver =
417 String::CheckedHandle(zone, arguments->NativeArgAt(0));
418 intptr_t hash_val = receiver.Hash();
419 ASSERT(hash_val > 0);
420 ASSERT(Smi::IsValid(hash_val));
421 return Smi::New(hash_val);
422}
uword Hash() const
Definition object.h:10195

◆ DEFINE_NATIVE_ENTRY() [303/345]

dart::DEFINE_NATIVE_ENTRY ( String_getLength  ,
,
 
)

Definition at line 424 of file string.cc.

424 {
425 const String& receiver =
426 String::CheckedHandle(zone, arguments->NativeArgAt(0));
427 return Smi::New(receiver.Length());
428}

◆ DEFINE_NATIVE_ENTRY() [304/345]

dart::DEFINE_NATIVE_ENTRY ( String_toLowerCase  ,
,
 
)

Definition at line 458 of file string.cc.

458 {
459 const String& receiver =
460 String::CheckedHandle(zone, arguments->NativeArgAt(0));
461 ASSERT(!receiver.IsNull());
462 return String::ToLowerCase(receiver);
463}

◆ DEFINE_NATIVE_ENTRY() [305/345]

dart::DEFINE_NATIVE_ENTRY ( String_toUpperCase  ,
,
 
)

Definition at line 465 of file string.cc.

465 {
466 const String& receiver =
467 String::CheckedHandle(zone, arguments->NativeArgAt(0));
468 ASSERT(!receiver.IsNull());
469 return String::ToUpperCase(receiver);
470}

◆ DEFINE_NATIVE_ENTRY() [306/345]

dart::DEFINE_NATIVE_ENTRY ( StringBase_createFromCodePoints  ,
,
 
)

Definition at line 31 of file string.cc.

31 {
32 GET_NON_NULL_NATIVE_ARGUMENT(Instance, list, arguments->NativeArgAt(0));
33 GET_NON_NULL_NATIVE_ARGUMENT(Smi, start_obj, arguments->NativeArgAt(1));
34 GET_NON_NULL_NATIVE_ARGUMENT(Smi, end_obj, arguments->NativeArgAt(2));
35
36 Array& a = Array::Handle();
37 intptr_t length;
38 if (list.IsGrowableObjectArray()) {
39 const GrowableObjectArray& growableArray = GrowableObjectArray::Cast(list);
40 a = growableArray.data();
41 length = growableArray.Length();
42 } else if (list.IsArray()) {
43 a = Array::Cast(list).ptr();
44 length = a.Length();
45 } else {
46 Exceptions::ThrowArgumentError(list);
47 return nullptr; // Unreachable.
48 }
49
50 intptr_t start = start_obj.Value();
51 if ((start < 0) || (start > length)) {
52 Exceptions::ThrowArgumentError(start_obj);
53 }
54
55 intptr_t end = end_obj.Value();
56 if ((end < start) || (end > length)) {
57 Exceptions::ThrowArgumentError(end_obj);
58 }
59
60 // Unbox the array and determine the maximum element width.
61 bool is_one_byte_string = true;
62 intptr_t array_len = end - start;
63 intptr_t utf16_len = array_len;
64 int32_t* utf32_array = zone->Alloc<int32_t>(array_len);
65 Instance& index_object = Instance::Handle(zone);
66 for (intptr_t i = 0; i < array_len; i++) {
67 index_object ^= a.At(start + i);
68 if (!index_object.IsSmi()) {
69 Exceptions::ThrowArgumentError(index_object);
70 }
71 intptr_t value = Smi::Cast(index_object).Value();
72 if (Utf::IsOutOfRange(value)) {
73 Exceptions::ThrowByType(Exceptions::kArgument, Object::empty_array());
75 }
76 // Now it is safe to cast the value.
77 int32_t value32 = static_cast<int32_t>(value);
78 if (!Utf::IsLatin1(value32)) {
79 is_one_byte_string = false;
80 if (Utf::IsSupplementary(value32)) {
81 utf16_len += 1;
82 }
83 }
84 utf32_array[i] = value32;
85 }
86 if (is_one_byte_string) {
87 return OneByteString::New(utf32_array, array_len, Heap::kNew);
88 }
89 return TwoByteString::New(utf16_len, utf32_array, array_len, Heap::kNew);
90}

◆ DEFINE_NATIVE_ENTRY() [307/345]

dart::DEFINE_NATIVE_ENTRY ( StringBase_intern  ,
,
 
)

Definition at line 242 of file string.cc.

242 {
243 const String& receiver =
244 String::CheckedHandle(zone, arguments->NativeArgAt(0));
245 return Symbols::New(thread, receiver);
246}

◆ DEFINE_NATIVE_ENTRY() [308/345]

dart::DEFINE_NATIVE_ENTRY ( StringBase_joinReplaceAllResult  ,
,
 
)

Definition at line 157 of file string.cc.

157 {
158 const String& base = String::CheckedHandle(zone, arguments->NativeArgAt(0));
160 arguments->NativeArgAt(1));
161 GET_NON_NULL_NATIVE_ARGUMENT(Smi, length_obj, arguments->NativeArgAt(2));
162 GET_NON_NULL_NATIVE_ARGUMENT(Bool, is_onebyte_obj, arguments->NativeArgAt(3));
163
164 intptr_t len = matches_growable.Length();
165 const Array& matches = Array::Handle(zone, matches_growable.data());
166
167 const intptr_t length = length_obj.Value();
168 if (length < 0) {
169 Exceptions::ThrowArgumentError(length_obj);
170 }
171
172 // Start out assuming result is one-byte if replacements are.
173 bool is_onebyte = is_onebyte_obj.value();
174 if (is_onebyte) {
175 // If any of the base string slices are not one-byte, the result will be
176 // a two-byte string.
177 if (!base.IsOneByteString()) {
178 is_onebyte = CheckSlicesOneByte(base, matches, len);
179 }
180 }
181
182 const intptr_t base_length = base.Length();
183 String& result = String::Handle(zone);
184 if (is_onebyte) {
185 result = OneByteString::New(length, Heap::kNew);
186 } else {
187 result = TwoByteString::New(length, Heap::kNew);
188 }
189 Instance& object = Instance::Handle(zone);
190 intptr_t write_index = 0;
191 for (intptr_t i = 0; i < len; i++) {
192 object ^= matches.At(i);
193 if (object.IsSmi()) {
194 intptr_t slice_start = Smi::Cast(object).Value();
195 intptr_t slice_length = -1;
196 // Slices with limited ranges are stored in a single negative Smi.
197 if (slice_start < 0) {
198 intptr_t bits = -slice_start;
199 slice_start = bits >> kLengthSize;
200 slice_length = bits & kLengthMask;
201 } else {
202 i++;
203 if (i < len) { // Otherwise slice_length stays at -1.
204 object ^= matches.At(i);
205 if (object.IsSmi()) {
206 intptr_t slice_end = Smi::Cast(object).Value();
207 slice_length = slice_end - slice_start;
208 }
209 }
210 }
211 if (slice_length > 0) {
212 if (0 <= slice_start && slice_start + slice_length <= base_length &&
213 write_index + slice_length <= length) {
214 String::Copy(result, write_index, base, slice_start, slice_length);
215 write_index += slice_length;
216 continue;
217 }
218 }
219 // Either the slice_length was zero,
220 // or the first smi was positive and not followed by another smi,
221 // or the smis were not a valid slice of the base string,
222 // or the slice was too large to fit in the result.
223 // Something is wrong with the matches array!
224 Exceptions::ThrowArgumentError(matches_growable);
225 } else if (object.IsString()) {
226 const String& replacement = String::Cast(object);
227 intptr_t replacement_length = replacement.Length();
228 if (write_index + replacement_length > length) {
229 // Invalid input data, either in matches list or the total length.
230 Exceptions::ThrowArgumentError(matches_growable);
231 }
232 String::Copy(result, write_index, replacement, 0, replacement_length);
233 write_index += replacement_length;
234 }
235 }
236 if (write_index < length) {
237 Exceptions::ThrowArgumentError(matches_growable);
238 }
239 return result.ptr();
240}

◆ DEFINE_NATIVE_ENTRY() [309/345]

dart::DEFINE_NATIVE_ENTRY ( StringBase_substringUnchecked  ,
,
 
)

Definition at line 92 of file string.cc.

92 {
93 const String& receiver =
94 String::CheckedHandle(zone, arguments->NativeArgAt(0));
95 GET_NON_NULL_NATIVE_ARGUMENT(Smi, start_obj, arguments->NativeArgAt(1));
96 GET_NON_NULL_NATIVE_ARGUMENT(Smi, end_obj, arguments->NativeArgAt(2));
97
98 intptr_t start = start_obj.Value();
99 intptr_t end = end_obj.Value();
100 return String::SubString(receiver, start, (end - start));
101}

◆ DEFINE_NATIVE_ENTRY() [310/345]

dart::DEFINE_NATIVE_ENTRY ( StringBuffer_createStringFromUint16Array  ,
,
 
)

Definition at line 507 of file string.cc.

507 {
508 GET_NON_NULL_NATIVE_ARGUMENT(TypedData, codeUnits, arguments->NativeArgAt(0));
509 GET_NON_NULL_NATIVE_ARGUMENT(Smi, length, arguments->NativeArgAt(1));
510 GET_NON_NULL_NATIVE_ARGUMENT(Bool, isLatin1, arguments->NativeArgAt(2));
511 intptr_t array_length = codeUnits.Length();
512 intptr_t length_value = length.Value();
513 if (length_value < 0 || length_value > array_length) {
514 Exceptions::ThrowRangeError("length", length, 0, array_length);
515 }
516 const String& result =
517 isLatin1.value()
518 ? String::Handle(OneByteString::New(length_value, Heap::kNew))
519 : String::Handle(TwoByteString::New(length_value, Heap::kNew));
520 NoSafepointScope no_safepoint;
521
522 uint16_t* data_position = reinterpret_cast<uint16_t*>(codeUnits.DataAddr(0));
523 String::Copy(result, 0, data_position, length_value);
524 return result.ptr();
525}

◆ DEFINE_NATIVE_ENTRY() [311/345]

dart::DEFINE_NATIVE_ENTRY ( SuspendState_instantiateClosureWithFutureTypeArgument  ,
,
 
)

Definition at line 28 of file async.cc.

30 {
31 GET_NON_NULL_NATIVE_ARGUMENT(Closure, closure, arguments->NativeArgAt(0));
32 GET_NON_NULL_NATIVE_ARGUMENT(Instance, future, arguments->NativeArgAt(1));
33 IsolateGroup* isolate_group = thread->isolate_group();
34
35 const auto& future_class =
36 Class::Handle(zone, isolate_group->object_store()->future_class());
37 ASSERT(future_class.NumTypeArguments() == 1);
38
39 const auto& cls = Class::Handle(zone, future.clazz());
40 auto& type = Type::Handle(zone, cls.GetInstantiationOf(zone, future_class));
41 ASSERT(!type.IsNull());
42 if (!type.IsInstantiated()) {
43 const auto& instance_type_args =
44 TypeArguments::Handle(zone, future.GetTypeArguments());
45 type ^=
46 type.InstantiateFrom(instance_type_args, Object::null_type_arguments(),
47 kNoneFree, Heap::kOld);
48 }
49 auto& type_args = TypeArguments::Handle(zone, type.arguments());
50 ASSERT(type_args.IsNull() || type_args.Length() == 1);
51 type_args = type_args.Canonicalize(thread);
52
53 ASSERT(closure.delayed_type_arguments() ==
54 Object::empty_type_arguments().ptr());
55 closure.set_delayed_type_arguments(type_args);
56 return closure.ptr();
57}

◆ DEFINE_NATIVE_ENTRY() [312/345]

dart::DEFINE_NATIVE_ENTRY ( Timeline_getNextTaskId  ,
,
 
)

Definition at line 27 of file timeline.cc.

27 {
28#if !defined(SUPPORT_TIMELINE)
29 return Integer::New(0);
30#else
31 return Integer::New(thread->GetNextTaskId());
32#endif
33}

◆ DEFINE_NATIVE_ENTRY() [313/345]

dart::DEFINE_NATIVE_ENTRY ( Timeline_getTraceClock  ,
,
 
)

Definition at line 35 of file timeline.cc.

35 {
36 return Integer::New(OS::GetCurrentMonotonicMicros(), Heap::kNew);
37}

◆ DEFINE_NATIVE_ENTRY() [314/345]

dart::DEFINE_NATIVE_ENTRY ( Timeline_isDartStreamEnabled  ,
,
 
)

Definition at line 18 of file timeline.cc.

18 {
19#if defined(SUPPORT_TIMELINE)
20 if (Timeline::GetDartStream()->enabled()) {
21 return Bool::True().ptr();
22 }
23#endif
24 return Bool::False().ptr();
25}

◆ DEFINE_NATIVE_ENTRY() [315/345]

dart::DEFINE_NATIVE_ENTRY ( Timeline_reportTaskEvent  ,
,
 
)

Definition at line 39 of file timeline.cc.

39 {
40#if defined(SUPPORT_TIMELINE)
41 GET_NON_NULL_NATIVE_ARGUMENT(Integer, id, arguments->NativeArgAt(0));
42 GET_NON_NULL_NATIVE_ARGUMENT(Integer, flow_id, arguments->NativeArgAt(1));
43 GET_NON_NULL_NATIVE_ARGUMENT(Smi, type, arguments->NativeArgAt(2));
44 GET_NON_NULL_NATIVE_ARGUMENT(String, name, arguments->NativeArgAt(3));
45 GET_NON_NULL_NATIVE_ARGUMENT(String, args, arguments->NativeArgAt(4));
46
47 TimelineEventRecorder* recorder = Timeline::recorder();
48 if (recorder == nullptr) {
49 return Object::null();
50 }
51
52 TimelineEvent* event = Timeline::GetDartStream()->StartEvent();
53 if (event == nullptr) {
54 // Stream was turned off.
55 return Object::null();
56 }
57
58 std::unique_ptr<const int64_t[]> flow_ids;
59 if (flow_id.AsInt64Value() != TimelineEvent::kNoFlowId) {
60 int64_t* flow_ids_internal = new int64_t[1];
61 flow_ids_internal[0] = flow_id.AsInt64Value();
62 flow_ids = std::unique_ptr<const int64_t[]>(flow_ids_internal);
63 }
64 intptr_t flow_id_count =
65 flow_id.AsInt64Value() == TimelineEvent::kNoFlowId ? 0 : 1;
66 DartTimelineEventHelpers::ReportTaskEvent(
67 event, id.AsInt64Value(), flow_id_count, flow_ids, type.Value(),
68 name.ToMallocCString(), args.ToMallocCString());
69#endif // SUPPORT_TIMELINE
70 return Object::null();
71}

◆ DEFINE_NATIVE_ENTRY() [316/345]

dart::DEFINE_NATIVE_ENTRY ( TransferableTypedData_factory  ,
,
 
)

Definition at line 1129 of file isolate.cc.

1129 {
1130 ASSERT(
1131 TypeArguments::CheckedHandle(zone, arguments->NativeArgAt(0)).IsNull());
1132
1133 GET_NON_NULL_NATIVE_ARGUMENT(Instance, array_instance,
1134 arguments->NativeArgAt(1));
1135
1136 Array& array = Array::Handle();
1137 intptr_t array_length;
1138 if (array_instance.IsGrowableObjectArray()) {
1139 const auto& growable_array = GrowableObjectArray::Cast(array_instance);
1140 array ^= growable_array.data();
1141 array_length = growable_array.Length();
1142 } else if (array_instance.IsArray()) {
1143 array ^= Array::Cast(array_instance).ptr();
1144 array_length = array.Length();
1145 } else {
1146 Exceptions::ThrowArgumentError(array_instance);
1147 UNREACHABLE();
1148 }
1149 Instance& instance = Instance::Handle();
1150 uint64_t total_bytes = 0;
1151 const uint64_t kMaxBytes = TypedData::MaxElements(kTypedDataUint8ArrayCid);
1152 for (intptr_t i = 0; i < array_length; i++) {
1153 instance ^= array.At(i);
1154 total_bytes += static_cast<uintptr_t>(GetTypedDataSizeOrThrow(instance));
1155 if (total_bytes > kMaxBytes) {
1156 const Array& error_args = Array::Handle(Array::New(3));
1157 error_args.SetAt(0, array);
1158 error_args.SetAt(1, String::Handle(String::New("data")));
1159 error_args.SetAt(
1160 2, String::Handle(String::NewFormatted(
1161 "Aggregated list exceeds max size %" Pu64 "", kMaxBytes)));
1162 Exceptions::ThrowByType(Exceptions::kArgumentValue, error_args);
1163 UNREACHABLE();
1164 }
1165 }
1166
1167 uint8_t* data = reinterpret_cast<uint8_t*>(::malloc(total_bytes));
1168 if (data == nullptr) {
1169 const Instance& exception = Instance::Handle(
1170 thread->isolate_group()->object_store()->out_of_memory());
1171 Exceptions::Throw(thread, exception);
1172 UNREACHABLE();
1173 }
1174 intptr_t offset = 0;
1175 for (intptr_t i = 0; i < array_length; i++) {
1176 instance ^= array.At(i);
1177
1178 {
1179 NoSafepointScope no_safepoint;
1180 const auto& typed_data = TypedDataBase::Cast(instance);
1181 const intptr_t length_in_bytes = typed_data.LengthInBytes();
1182
1183 void* source = typed_data.DataAddr(0);
1184 // The memory does not overlap.
1185 memcpy(data + offset, source, length_in_bytes); // NOLINT
1186 offset += length_in_bytes;
1187 }
1188 }
1189 ASSERT(static_cast<uintptr_t>(offset) == total_bytes);
1190 return TransferableTypedData::New(data, total_bytes);
1191}
static intptr_t GetTypedDataSizeOrThrow(const Instance &instance)
Definition isolate.cc:1117

◆ DEFINE_NATIVE_ENTRY() [317/345]

dart::DEFINE_NATIVE_ENTRY ( TransferableTypedData_materialize  ,
,
 
)

Definition at line 1193 of file isolate.cc.

1193 {
1195 arguments->NativeArgAt(0));
1196
1197 void* peer;
1198 {
1199 NoSafepointScope no_safepoint;
1200 peer = thread->heap()->GetPeer(t.ptr());
1201 // Assume that object's Peer is only used to track transferability state.
1202 ASSERT(peer != nullptr);
1203 }
1204
1205 TransferableTypedDataPeer* tpeer =
1206 reinterpret_cast<TransferableTypedDataPeer*>(peer);
1207 const intptr_t length = tpeer->length();
1208 uint8_t* data = tpeer->data();
1209 if (data == nullptr) {
1210 const auto& error = String::Handle(String::New(
1211 "Attempt to materialize object that was transferred already."));
1212 Exceptions::ThrowArgumentError(error);
1213 UNREACHABLE();
1214 }
1215 tpeer->handle()->EnsureFreedExternal(IsolateGroup::Current());
1216 tpeer->ClearData();
1217
1218 const ExternalTypedData& typed_data = ExternalTypedData::Handle(
1219 ExternalTypedData::New(kExternalTypedDataUint8ArrayCid, data, length,
1220 thread->heap()->SpaceForExternal(length)));
1221 FinalizablePersistentHandle* finalizable_ref =
1222 FinalizablePersistentHandle::New(thread->isolate_group(), typed_data,
1223 /* peer= */ data,
1224 &ExternalTypedDataFinalizer, length,
1225 /*auto_delete=*/true);
1226 ASSERT(finalizable_ref != nullptr);
1227 return typed_data.ptr();
1228}

◆ DEFINE_NATIVE_ENTRY() [318/345]

dart::DEFINE_NATIVE_ENTRY ( TwoByteString_allocateFromTwoByteList  ,
,
 
)

Definition at line 361 of file string.cc.

361 {
362 Instance& list = Instance::CheckedHandle(zone, arguments->NativeArgAt(0));
363 GET_NON_NULL_NATIVE_ARGUMENT(Smi, start_obj, arguments->NativeArgAt(1));
364 GET_NON_NULL_NATIVE_ARGUMENT(Smi, end_obj, arguments->NativeArgAt(2));
365
366 intptr_t start = start_obj.Value();
367 intptr_t end = end_obj.Value();
368 if (start < 0) {
369 Exceptions::ThrowArgumentError(start_obj);
370 }
371 intptr_t length = end - start;
372 if (length < 0) {
373 Exceptions::ThrowArgumentError(end_obj);
374 }
375
376 Heap::Space space = Heap::kNew;
377 if (list.IsTypedDataBase()) {
378 const TypedDataBase& array = TypedDataBase::Cast(list);
379 if (array.ElementType() != kUint16ArrayElement) {
380 Exceptions::ThrowArgumentError(list);
381 }
382 if (end > array.Length()) {
383 Exceptions::ThrowArgumentError(end_obj);
384 }
385 return TwoByteString::New(array, start * sizeof(uint16_t), length, space);
386 } else if (list.IsArray()) {
387 const Array& array = Array::Cast(list);
388 if (end > array.Length()) {
389 Exceptions::ThrowArgumentError(end_obj);
390 }
391 const String& string =
392 String::Handle(zone, TwoByteString::New(length, space));
393 for (int i = 0; i < length; i++) {
394 intptr_t value = Smi::Value(static_cast<SmiPtr>(array.At(start + i)));
395 TwoByteString::SetCharAt(string, i, value);
396 }
397 return string.ptr();
398 } else if (list.IsGrowableObjectArray()) {
399 const GrowableObjectArray& array = GrowableObjectArray::Cast(list);
400 if (end > array.Length()) {
401 Exceptions::ThrowArgumentError(end_obj);
402 }
403 const String& string =
404 String::Handle(zone, TwoByteString::New(length, space));
405 for (int i = 0; i < length; i++) {
406 intptr_t value = Smi::Value(static_cast<SmiPtr>(array.At(start + i)));
407 TwoByteString::SetCharAt(string, i, value);
408 }
409 return string.ptr();
410 }
411 UNREACHABLE();
412 return Object::null();
413}

◆ DEFINE_NATIVE_ENTRY() [319/345]

dart::DEFINE_NATIVE_ENTRY ( Type_equality  ,
,
 
)

Definition at line 258 of file object.cc.

258 {
259 const Type& type = Type::CheckedHandle(zone, arguments->NativeArgAt(0));
260 const Instance& other =
261 Instance::CheckedHandle(zone, arguments->NativeArgAt(1));
262 if (type.ptr() == other.ptr()) {
263 return Bool::True().ptr();
264 }
265 return Bool::Get(type.IsEquivalent(other, TypeEquality::kSyntactical)).ptr();
266}

◆ DEFINE_NATIVE_ENTRY() [320/345]

dart::DEFINE_NATIVE_ENTRY ( TypedDataBase_length  ,
,
 
)

Definition at line 18 of file typed_data.cc.

18 {
19 GET_NON_NULL_NATIVE_ARGUMENT(TypedDataBase, array, arguments->NativeArgAt(0));
20 return Smi::New(array.Length());
21}

◆ DEFINE_NATIVE_ENTRY() [321/345]

dart::DEFINE_NATIVE_ENTRY ( TypedDataBase_setClampedRange  ,
,
 
)

Definition at line 46 of file typed_data.cc.

46 {
47 // This is called after bounds checking, so the numeric inputs are
48 // guaranteed to be Smis, and the length is guaranteed to be non-zero.
49 const TypedDataBase& dst =
50 TypedDataBase::CheckedHandle(zone, arguments->NativeArgAt(0));
51 const Smi& dst_start_smi =
52 Smi::CheckedHandle(zone, arguments->NativeArgAt(1));
53 const Smi& length_smi = Smi::CheckedHandle(zone, arguments->NativeArgAt(2));
54 const TypedDataBase& src =
55 TypedDataBase::CheckedHandle(zone, arguments->NativeArgAt(3));
56 const Smi& src_start_smi =
57 Smi::CheckedHandle(zone, arguments->NativeArgAt(4));
58
59 const intptr_t element_size_in_bytes = dst.ElementSizeInBytes();
60 ASSERT_EQUAL(src.ElementSizeInBytes(), element_size_in_bytes);
61
62 const intptr_t dst_start_in_bytes =
63 dst_start_smi.Value() * element_size_in_bytes;
64 const intptr_t length_in_bytes = length_smi.Value() * element_size_in_bytes;
65 const intptr_t src_start_in_bytes =
66 src_start_smi.Value() * element_size_in_bytes;
67
68#if defined(DEBUG)
69 // Verify bounds checks weren't needed.
70 ASSERT(dst_start_in_bytes >= 0);
71 ASSERT(src_start_in_bytes >= 0);
72 // The callers of this native function never call it for a zero-sized copy.
73 ASSERT(length_in_bytes > 0);
74
75 const intptr_t dst_length_in_bytes = dst.LengthInBytes();
76 // Since the length is non-zero, the start can't be the same as the end.
77 ASSERT(dst_start_in_bytes < dst_length_in_bytes);
78 ASSERT(length_in_bytes <= dst_length_in_bytes - dst_start_in_bytes);
79
80 const intptr_t src_length_in_bytes = src.LengthInBytes();
81 // Since the length is non-zero, the start can't be the same as the end.
82 ASSERT(src_start_in_bytes < src_length_in_bytes);
83 ASSERT(length_in_bytes <= src_length_in_bytes - src_start_in_bytes);
84#endif
85
86 ASSERT(IsClampedTypedDataBaseClassId(dst.ptr()->GetClassId()));
87 // The algorithm below assumes the clamped destination has uint8 elements.
88 ASSERT_EQUAL(element_size_in_bytes, 1);
89 ASSERT(IsTypedDataUint8ArrayClassId(dst.ptr()->GetClassId()));
90 // The native entry should only be called when clamping is needed. When the
91 // source has uint8 elements, a direct memory move should be used instead.
92 ASSERT(!IsTypedDataUint8ArrayClassId(src.ptr()->GetClassId()));
93
94 NoSafepointScope no_safepoint;
95 uint8_t* dst_data =
96 reinterpret_cast<uint8_t*>(dst.DataAddr(dst_start_in_bytes));
97 int8_t* src_data =
98 reinterpret_cast<int8_t*>(src.DataAddr(src_start_in_bytes));
99 for (intptr_t ix = 0; ix < length_in_bytes; ix++) {
100 int8_t v = *src_data;
101 if (v < 0) v = 0;
102 *dst_data = v;
103 src_data++;
104 dst_data++;
105 }
106
107 return Object::null();
108}
static bool IsTypedDataUint8ArrayClassId(intptr_t cid)
Definition typed_data.cc:37
bool IsClampedTypedDataBaseClassId(intptr_t index)
Definition class_id.h:461

◆ DEFINE_NATIVE_ENTRY() [322/345]

dart::DEFINE_NATIVE_ENTRY ( TypedDataView_offsetInBytes  ,
,
 
)

Definition at line 23 of file typed_data.cc.

23 {
24 // "this" is either a _*ArrayView class or _ByteDataView.
25 GET_NON_NULL_NATIVE_ARGUMENT(Instance, instance, arguments->NativeArgAt(0));
26 ASSERT(instance.IsTypedDataView());
27 return TypedDataView::Cast(instance).offset_in_bytes();
28}

◆ DEFINE_NATIVE_ENTRY() [323/345]

dart::DEFINE_NATIVE_ENTRY ( TypedDataView_typedData  ,
,
 
)

Definition at line 30 of file typed_data.cc.

30 {
31 // "this" is either a _*ArrayView class or _ByteDataView.
32 GET_NON_NULL_NATIVE_ARGUMENT(Instance, instance, arguments->NativeArgAt(0));
33 ASSERT(instance.IsTypedDataView());
34 return TypedDataView::Cast(instance).typed_data();
35}

◆ DEFINE_NATIVE_ENTRY() [324/345]

dart::DEFINE_NATIVE_ENTRY ( TypeError_throwNew  ,
,
 
)

Definition at line 155 of file errors.cc.

155 {
156 // No need to type check the arguments. This function can only be called
157 // internally from the VM.
158 const TokenPosition location = TokenPosition::Deserialize(
159 Smi::CheckedHandle(zone, arguments->NativeArgAt(0)).Value());
160 const Instance& src_value =
161 Instance::CheckedHandle(zone, arguments->NativeArgAt(1));
162 const AbstractType& dst_type =
163 AbstractType::CheckedHandle(zone, arguments->NativeArgAt(2));
164 const String& dst_name =
165 String::CheckedHandle(zone, arguments->NativeArgAt(3));
166 const AbstractType& src_type =
167 AbstractType::Handle(src_value.GetType(Heap::kNew));
168 Exceptions::CreateAndThrowTypeError(location, src_type, dst_type, dst_name);
169 UNREACHABLE();
170 return Object::null();
171}
AbstractTypePtr GetType(Heap::Space space) const
Definition object.cc:20561

◆ DEFINE_NATIVE_ENTRY() [325/345]

dart::DEFINE_NATIVE_ENTRY ( TypeMirror_subtypeTest  ,
,
 
)

Definition at line 1651 of file mirrors.cc.

1651 {
1652 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, a, arguments->NativeArgAt(0));
1653 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, b, arguments->NativeArgAt(1));
1654 return Bool::Get(a.IsSubtypeOf(b, Heap::kNew)).ptr();
1655}

◆ DEFINE_NATIVE_ENTRY() [326/345]

dart::DEFINE_NATIVE_ENTRY ( TypeVariableMirror_owner  ,
,
 
)

Definition at line 1210 of file mirrors.cc.

1210 {
1211 // Type parameters do not have a reference to their owner anymore.
1212 const AbstractType& type = AbstractType::Handle(Type::NullType());
1213 Class& owner = Class::Handle(type.type_class());
1214 return CreateClassMirror(owner, type,
1215 Bool::True(), // is_declaration
1216 Instance::null_instance());
1217}

◆ DEFINE_NATIVE_ENTRY() [327/345]

dart::DEFINE_NATIVE_ENTRY ( TypeVariableMirror_upper_bound  ,
,
 
)

Definition at line 1219 of file mirrors.cc.

1219 {
1220 GET_NON_NULL_NATIVE_ARGUMENT(TypeParameter, param, arguments->NativeArgAt(0));
1221 return param.bound();
1222}

◆ DEFINE_NATIVE_ENTRY() [328/345]

dart::DEFINE_NATIVE_ENTRY ( Uri_isWindowsPlatform  ,
,
 
)

Definition at line 11 of file uri.cc.

11 {
12#if defined(DART_HOST_OS_WINDOWS)
13 return Bool::True().ptr();
14#else
15 return Bool::False().ptr();
16#endif
17}

◆ DEFINE_NATIVE_ENTRY() [329/345]

dart::DEFINE_NATIVE_ENTRY ( UserTag_defaultTag  ,
,
 
)

Definition at line 35 of file profiler.cc.

35 {
36 if (FLAG_trace_intrinsified_natives) {
37 OS::PrintErr("UserTag_defaultTag\n");
38 }
39 return isolate->default_tag();
40}

◆ DEFINE_NATIVE_ENTRY() [330/345]

dart::DEFINE_NATIVE_ENTRY ( UserTag_label  ,
,
 
)

Definition at line 25 of file profiler.cc.

25 {
26 const UserTag& self = UserTag::CheckedHandle(zone, arguments->NativeArgAt(0));
27 return self.label();
28}

◆ DEFINE_NATIVE_ENTRY() [331/345]

dart::DEFINE_NATIVE_ENTRY ( UserTag_makeCurrent  ,
,
 
)

Definition at line 30 of file profiler.cc.

30 {
31 const UserTag& self = UserTag::CheckedHandle(zone, arguments->NativeArgAt(0));
32 return self.MakeActive();
33}

◆ DEFINE_NATIVE_ENTRY() [332/345]

dart::DEFINE_NATIVE_ENTRY ( UserTag_new  ,
,
 
)

Definition at line 18 of file profiler.cc.

18 {
19 ASSERT(
20 TypeArguments::CheckedHandle(zone, arguments->NativeArgAt(0)).IsNull());
21 GET_NON_NULL_NATIVE_ARGUMENT(String, tag_label, arguments->NativeArgAt(1));
22 return UserTag::New(tag_label);
23}

◆ DEFINE_NATIVE_ENTRY() [333/345]

dart::DEFINE_NATIVE_ENTRY ( VariableMirror_type  ,
,
 
)

Definition at line 1643 of file mirrors.cc.

1643 {
1644 GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(0));
1645 const Field& field = Field::Handle(ref.GetFieldReferent());
1646 GET_NATIVE_ARGUMENT(AbstractType, instantiator, arguments->NativeArgAt(1));
1647 const AbstractType& type = AbstractType::Handle(field.type());
1648 return InstantiateType(type, instantiator);
1649}
AbstractTypePtr type() const
Definition object.h:4523

◆ DEFINE_NATIVE_ENTRY() [334/345]

dart::DEFINE_NATIVE_ENTRY ( VMService_AddUserTagsToStreamableSampleList  ,
,
 
)

Definition at line 419 of file vmservice.cc.

419 {
420#ifndef PRODUCT
422 arguments->NativeArgAt(0));
423
424 Object& obj = Object::Handle();
425 for (intptr_t i = 0; i < user_tags.Length(); ++i) {
426 obj = user_tags.At(i);
427 UserTags::AddStreamableTagName(obj.ToCString());
428 }
429 UserTagIsolatesVisitor visitor(thread, &user_tags, true);
430 Isolate::VisitIsolates(&visitor);
431#endif
432 return Object::null();
433}

◆ DEFINE_NATIVE_ENTRY() [335/345]

dart::DEFINE_NATIVE_ENTRY ( VMService_CancelStream  ,
,
 
)

Definition at line 143 of file vmservice.cc.

143 {
144#ifndef PRODUCT
145 GET_NON_NULL_NATIVE_ARGUMENT(String, stream_id, arguments->NativeArgAt(0));
146 Service::CancelStream(stream_id.ToCString());
147#endif
148 return Object::null();
149}

◆ DEFINE_NATIVE_ENTRY() [336/345]

dart::DEFINE_NATIVE_ENTRY ( VMService_DecodeAssets  ,
,
 
)

Definition at line 329 of file vmservice.cc.

329 {
330#ifndef PRODUCT
331 GET_NON_NULL_NATIVE_ARGUMENT(TypedData, data, arguments->NativeArgAt(0));
332 Api::Scope scope(thread);
333 Dart_Handle data_handle = Api::NewHandle(thread, data.ptr());
334 Dart_Handle result_list;
335 {
336 TransitionVMToNative transition(thread);
337
339 void* bytes;
340 intptr_t length;
341 Dart_Handle err =
342 Dart_TypedDataAcquireData(data_handle, &typ, &bytes, &length);
343 ASSERT(!Dart_IsError(err));
344
345 TarArchive archive(reinterpret_cast<uint8_t*>(bytes), length);
346 archive.Read();
347
348 err = Dart_TypedDataReleaseData(data_handle);
349 ASSERT(!Dart_IsError(err));
350
351 intptr_t archive_size = archive.Length();
352
353 result_list = Dart_NewList(2 * archive_size);
354 ASSERT(!Dart_IsError(result_list));
355
356 intptr_t idx = 0;
357 while (archive.HasMore()) {
358 char* filename = archive.NextFilename();
359 intptr_t filename_length = strlen(filename);
360 uint8_t* contents = archive.NextContent();
361 intptr_t contents_length = archive.NextContentLength();
362
363 Dart_Handle dart_filename = Dart_NewStringFromUTF8(
364 reinterpret_cast<uint8_t*>(filename), filename_length);
365 ASSERT(!Dart_IsError(dart_filename));
366
368 Dart_TypedData_kUint8, contents, contents_length, contents,
369 contents_length, ContentsFinalizer);
370 ASSERT(!Dart_IsError(dart_contents));
371
372 Dart_ListSetAt(result_list, idx, dart_filename);
373 Dart_ListSetAt(result_list, (idx + 1), dart_contents);
374 idx += 2;
375 }
376 }
377 return Api::UnwrapArrayHandle(thread->zone(), result_list).ptr();
378#else
379 return Object::null();
380#endif
381}
DART_EXPORT Dart_Handle Dart_NewStringFromUTF8(const uint8_t *utf8_array, intptr_t length)
DART_EXPORT Dart_Handle Dart_NewExternalTypedDataWithFinalizer(Dart_TypedData_Type type, void *data, intptr_t length, void *peer, intptr_t external_allocation_size, Dart_HandleFinalizer callback)
DART_EXPORT Dart_Handle Dart_NewList(intptr_t length)
DART_EXPORT Dart_Handle Dart_ListSetAt(Dart_Handle list, intptr_t index, Dart_Handle value)

◆ DEFINE_NATIVE_ENTRY() [337/345]

dart::DEFINE_NATIVE_ENTRY ( VMService_ListenStream  ,
,
 
)

Definition at line 130 of file vmservice.cc.

130 {
131#ifndef PRODUCT
132 GET_NON_NULL_NATIVE_ARGUMENT(String, stream_id, arguments->NativeArgAt(0));
133 GET_NON_NULL_NATIVE_ARGUMENT(Bool, include_privates,
134 arguments->NativeArgAt(1));
135 bool result =
136 Service::ListenStream(stream_id.ToCString(), include_privates.value());
137 return Bool::Get(result).ptr();
138#else
139 return Object::null();
140#endif
141}

◆ DEFINE_NATIVE_ENTRY() [338/345]

dart::DEFINE_NATIVE_ENTRY ( VMService_OnExit  ,
,
 
)

Definition at line 107 of file vmservice.cc.

107 {
108#ifndef PRODUCT
109 if (FLAG_trace_service) {
110 OS::PrintErr("vm-service: processed exit message.\n");
111 OS::PrintErr("vm-service: has live ports: %s\n",
112 isolate->HasLivePorts() ? "yes" : "no");
113 }
114#endif
115 return Object::null();
116}

◆ DEFINE_NATIVE_ENTRY() [339/345]

dart::DEFINE_NATIVE_ENTRY ( VMService_OnServerAddressChange  ,
,
 
)

Definition at line 118 of file vmservice.cc.

118 {
119#ifndef PRODUCT
120 GET_NATIVE_ARGUMENT(String, address, arguments->NativeArgAt(0));
121 if (address.IsNull()) {
122 ServiceIsolate::SetServerAddress(nullptr);
123 } else {
124 ServiceIsolate::SetServerAddress(address.ToCString());
125 }
126#endif
127 return Object::null();
128}

◆ DEFINE_NATIVE_ENTRY() [340/345]

dart::DEFINE_NATIVE_ENTRY ( VMService_OnStart  ,
,
 
)

Definition at line 89 of file vmservice.cc.

89 {
90#ifndef PRODUCT
91 if (FLAG_trace_service) {
92 OS::PrintErr("vm-service: Booting dart:vmservice library.\n");
93 }
94 // Boot the dart:vmservice library.
95 ServiceIsolate::BootVmServiceLibrary();
96 // Register running isolates with service.
97 RegisterRunningIsolatesVisitor register_isolates(thread);
98 if (FLAG_trace_service) {
99 OS::PrintErr("vm-service: Registering running isolates.\n");
100 }
101 Isolate::VisitIsolates(&register_isolates);
102 register_isolates.RegisterIsolates();
103#endif
104 return Object::null();
105}

◆ DEFINE_NATIVE_ENTRY() [341/345]

dart::DEFINE_NATIVE_ENTRY ( VMService_RemoveUserTagsFromStreamableSampleList  ,
,
 
)

Definition at line 435 of file vmservice.cc.

435 {
436#ifndef PRODUCT
438 arguments->NativeArgAt(0));
439
440 Object& obj = Object::Handle();
441 for (intptr_t i = 0; i < user_tags.Length(); ++i) {
442 obj = user_tags.At(i);
443 UserTags::RemoveStreamableTagName(obj.ToCString());
444 }
445 UserTagIsolatesVisitor visitor(thread, &user_tags, false);
446 Isolate::VisitIsolates(&visitor);
447#endif
448 return Object::null();
449}

◆ DEFINE_NATIVE_ENTRY() [342/345]

dart::DEFINE_NATIVE_ENTRY ( VMService_RequestAssets  ,
,
 
)

Definition at line 151 of file vmservice.cc.

151 {
152#ifndef PRODUCT
153 return Service::RequestAssets();
154#else
155 return Object::null();
156#endif
157}

◆ DEFINE_NATIVE_ENTRY() [343/345]

dart::DEFINE_NATIVE_ENTRY ( VMService_SendIsolateServiceMessage  ,
,
 
)

Definition at line 54 of file vmservice.cc.

54 {
55#ifndef PRODUCT
56 GET_NON_NULL_NATIVE_ARGUMENT(SendPort, sp, arguments->NativeArgAt(0));
57 GET_NON_NULL_NATIVE_ARGUMENT(Array, message, arguments->NativeArgAt(1));
58
59 // Set the type of the OOB message.
60 message.SetAt(0,
61 Smi::Handle(thread->zone(), Smi::New(Message::kServiceOOBMsg)));
62
63 // Serialize message.
64 // TODO(turnidge): Throw an exception when the return value is false?
65 bool result = PortMap::PostMessage(WriteMessage(
66 /* same_group */ false, message, sp.Id(), Message::kOOBPriority));
67 return Bool::Get(result).ptr();
68#else
69 return Object::null();
70#endif
71}

◆ DEFINE_NATIVE_ENTRY() [344/345]

dart::DEFINE_NATIVE_ENTRY ( VMService_SendObjectRootServiceMessage  ,
,
 
)

Definition at line 81 of file vmservice.cc.

81 {
82#ifndef PRODUCT
83 GET_NON_NULL_NATIVE_ARGUMENT(Array, message, arguments->NativeArgAt(0));
84 return Service::HandleObjectRootMessage(message);
85#endif
86 return Object::null();
87}

◆ DEFINE_NATIVE_ENTRY() [345/345]

dart::DEFINE_NATIVE_ENTRY ( VMService_SendRootServiceMessage  ,
,
 
)

Definition at line 73 of file vmservice.cc.

73 {
74#ifndef PRODUCT
75 GET_NON_NULL_NATIVE_ARGUMENT(Array, message, arguments->NativeArgAt(0));
76 return Service::HandleRootMessage(message);
77#endif
78 return Object::null();
79}

◆ DEFINE_OPTION_HANDLER() [1/2]

dart::DEFINE_OPTION_HANDLER ( CompilerPass::ParseFiltersFromFlag  ,
compiler_passes  ,
"List of comma separated compilation passes flags. " "Use -Name to disable a  pass 
)

◆ DEFINE_OPTION_HANDLER() [2/2]

dart::DEFINE_OPTION_HANDLER ( KernelIsolate::AddExperimentalFlag  ,
enable_experiment  ,
"Comma separated list of experimental features."   
)

◆ DEFINE_RAW_LEAF_RUNTIME_ENTRY() [1/29]

dart::DEFINE_RAW_LEAF_RUNTIME_ENTRY ( AllocateHandle  ,
,
false  ,
DLRT_AllocateHandle   
)

◆ DEFINE_RAW_LEAF_RUNTIME_ENTRY() [2/29]

dart::DEFINE_RAW_LEAF_RUNTIME_ENTRY ( CaseInsensitiveCompareUCS2  ,
,
false  ,
CaseInsensitiveCompareUCS2   
)

◆ DEFINE_RAW_LEAF_RUNTIME_ENTRY() [3/29]

dart::DEFINE_RAW_LEAF_RUNTIME_ENTRY ( CaseInsensitiveCompareUTF16  ,
,
false  ,
CaseInsensitiveCompareUTF16   
)

◆ DEFINE_RAW_LEAF_RUNTIME_ENTRY() [4/29]

dart::DEFINE_RAW_LEAF_RUNTIME_ENTRY ( DartModulo  ,
,
true  ,
static_cast< BinaryMathCFunction DartModulo 
)

◆ DEFINE_RAW_LEAF_RUNTIME_ENTRY() [5/29]

dart::DEFINE_RAW_LEAF_RUNTIME_ENTRY ( EnterHandleScope  ,
,
false  ,
DLRT_EnterHandleScope   
)

◆ DEFINE_RAW_LEAF_RUNTIME_ENTRY() [6/29]

dart::DEFINE_RAW_LEAF_RUNTIME_ENTRY ( EnterSafepoint  ,
,
false  ,
DFLRT_EnterSafepoint   
)

◆ DEFINE_RAW_LEAF_RUNTIME_ENTRY() [7/29]

dart::DEFINE_RAW_LEAF_RUNTIME_ENTRY ( ExitHandleScope  ,
,
false  ,
DLRT_ExitHandleScope   
)

◆ DEFINE_RAW_LEAF_RUNTIME_ENTRY() [8/29]

dart::DEFINE_RAW_LEAF_RUNTIME_ENTRY ( ExitSafepoint  ,
,
false  ,
DFLRT_ExitSafepoint   
)

◆ DEFINE_RAW_LEAF_RUNTIME_ENTRY() [9/29]

dart::DEFINE_RAW_LEAF_RUNTIME_ENTRY ( ExitSafepointIgnoreUnwindInProgress  ,
,
false  ,
DFLRT_ExitSafepointIgnoreUnwindInProgress   
)

◆ DEFINE_RAW_LEAF_RUNTIME_ENTRY() [10/29]

dart::DEFINE_RAW_LEAF_RUNTIME_ENTRY ( LibcAcos  ,
,
true  ,
static_cast< UnaryMathCFunction acos 
)

◆ DEFINE_RAW_LEAF_RUNTIME_ENTRY() [11/29]

dart::DEFINE_RAW_LEAF_RUNTIME_ENTRY ( LibcAsin  ,
,
true  ,
static_cast< UnaryMathCFunction asin 
)

◆ DEFINE_RAW_LEAF_RUNTIME_ENTRY() [12/29]

dart::DEFINE_RAW_LEAF_RUNTIME_ENTRY ( LibcAtan  ,
,
true  ,
static_cast< UnaryMathCFunction atan 
)

◆ DEFINE_RAW_LEAF_RUNTIME_ENTRY() [13/29]

dart::DEFINE_RAW_LEAF_RUNTIME_ENTRY ( LibcAtan2  ,
,
true  ,
static_cast< BinaryMathCFunction atan2_ieee 
)

◆ DEFINE_RAW_LEAF_RUNTIME_ENTRY() [14/29]

dart::DEFINE_RAW_LEAF_RUNTIME_ENTRY ( LibcCeil  ,
,
true  ,
static_cast< UnaryMathCFunction ceil 
)

◆ DEFINE_RAW_LEAF_RUNTIME_ENTRY() [15/29]

dart::DEFINE_RAW_LEAF_RUNTIME_ENTRY ( LibcCos  ,
,
true  ,
static_cast< UnaryMathCFunction cos 
)

◆ DEFINE_RAW_LEAF_RUNTIME_ENTRY() [16/29]

dart::DEFINE_RAW_LEAF_RUNTIME_ENTRY ( LibcExp  ,
,
true  ,
static_cast< UnaryMathCFunction exp 
)

◆ DEFINE_RAW_LEAF_RUNTIME_ENTRY() [17/29]

dart::DEFINE_RAW_LEAF_RUNTIME_ENTRY ( LibcFloor  ,
,
true  ,
static_cast< UnaryMathCFunction floor 
)

◆ DEFINE_RAW_LEAF_RUNTIME_ENTRY() [18/29]

dart::DEFINE_RAW_LEAF_RUNTIME_ENTRY ( LibcLog  ,
,
true  ,
static_cast< UnaryMathCFunction log 
)

◆ DEFINE_RAW_LEAF_RUNTIME_ENTRY() [19/29]

dart::DEFINE_RAW_LEAF_RUNTIME_ENTRY ( LibcPow  ,
,
true  ,
static_cast< BinaryMathCFunction pow 
)

◆ DEFINE_RAW_LEAF_RUNTIME_ENTRY() [20/29]

dart::DEFINE_RAW_LEAF_RUNTIME_ENTRY ( LibcRound  ,
,
true  ,
static_cast< UnaryMathCFunction round 
)

◆ DEFINE_RAW_LEAF_RUNTIME_ENTRY() [21/29]

dart::DEFINE_RAW_LEAF_RUNTIME_ENTRY ( LibcSin  ,
,
true  ,
static_cast< UnaryMathCFunction sin 
)

◆ DEFINE_RAW_LEAF_RUNTIME_ENTRY() [22/29]

dart::DEFINE_RAW_LEAF_RUNTIME_ENTRY ( LibcTan  ,
,
true  ,
static_cast< UnaryMathCFunction tan 
)

◆ DEFINE_RAW_LEAF_RUNTIME_ENTRY() [23/29]

dart::DEFINE_RAW_LEAF_RUNTIME_ENTRY ( LibcTrunc  ,
,
true  ,
static_cast< UnaryMathCFunction trunc 
)

◆ DEFINE_RAW_LEAF_RUNTIME_ENTRY() [24/29]

dart::DEFINE_RAW_LEAF_RUNTIME_ENTRY ( MemoryMove  ,
,
false  ,
static_cast< MemMoveCFunction memmove 
)

◆ DEFINE_RAW_LEAF_RUNTIME_ENTRY() [25/29]

dart::DEFINE_RAW_LEAF_RUNTIME_ENTRY ( MsanUnpoison  ,
,
false  ,
__msan_unpoison   
)

◆ DEFINE_RAW_LEAF_RUNTIME_ENTRY() [26/29]

dart::DEFINE_RAW_LEAF_RUNTIME_ENTRY ( MsanUnpoisonParam  ,
,
false  ,
__msan_unpoison_param   
)

◆ DEFINE_RAW_LEAF_RUNTIME_ENTRY() [27/29]

dart::DEFINE_RAW_LEAF_RUNTIME_ENTRY ( PropagateError  ,
,
false  ,
DLRT_PropagateError   
)

◆ DEFINE_RAW_LEAF_RUNTIME_ENTRY() [28/29]

dart::DEFINE_RAW_LEAF_RUNTIME_ENTRY ( TsanLoadAcquire  ,
,
false  ,
__tsan_acquire   
)

◆ DEFINE_RAW_LEAF_RUNTIME_ENTRY() [29/29]

dart::DEFINE_RAW_LEAF_RUNTIME_ENTRY ( TsanStoreRelease  ,
,
false  ,
__tsan_release   
)

◆ DEFINE_RUNTIME_ENTRY() [1/57]

dart::DEFINE_RUNTIME_ENTRY ( AllocateArray  ,
 
)

Definition at line 386 of file runtime_entry.cc.

386 {
387 const Instance& length = Instance::CheckedHandle(zone, arguments.ArgAt(0));
388 if (!length.IsInteger()) {
389 // Throw: new ArgumentError.value(length, "length", "is not an integer");
390 const Array& args = Array::Handle(zone, Array::New(3));
391 args.SetAt(0, length);
392 args.SetAt(1, Symbols::Length());
393 args.SetAt(2, String::Handle(zone, String::New("is not an integer")));
394 Exceptions::ThrowByType(Exceptions::kArgumentValue, args);
395 }
396 const int64_t len = Integer::Cast(length).AsInt64Value();
397 if (len < 0) {
398 // Throw: new RangeError.range(length, 0, Array::kMaxElements, "length");
399 Exceptions::ThrowRangeError("length", Integer::Cast(length), 0,
400 Array::kMaxElements);
401 }
402 if (len > Array::kMaxElements) {
403 Exceptions::ThrowOOM();
404 }
405
406 const Array& array = Array::Handle(
407 zone,
408 Array::New(static_cast<intptr_t>(len), SpaceForRuntimeAllocation()));
409 TypeArguments& element_type =
410 TypeArguments::CheckedHandle(zone, arguments.ArgAt(1));
411 // An Array is raw or takes one type argument. However, its type argument
412 // vector may be longer than 1 due to a type optimization reusing the type
413 // argument vector of the instantiator.
414 ASSERT(element_type.IsNull() ||
415 (element_type.Length() >= 1 && element_type.IsInstantiated()));
416 array.SetTypeArguments(element_type); // May be null.
417 arguments.SetReturn(array);
419}
static void RuntimeAllocationEpilogue(Thread *thread)
static Heap::Space SpaceForRuntimeAllocation()

◆ DEFINE_RUNTIME_ENTRY() [2/57]

dart::DEFINE_RUNTIME_ENTRY ( AllocateClosure  ,
 
)

Definition at line 729 of file runtime_entry.cc.

729 {
730 const auto& function = Function::CheckedHandle(zone, arguments.ArgAt(0));
731 const auto& context = Object::Handle(zone, arguments.ArgAt(1));
732 const auto& instantiator_type_args =
733 TypeArguments::CheckedHandle(zone, arguments.ArgAt(2));
734 const auto& delayed_type_args =
735 TypeArguments::CheckedHandle(zone, arguments.ArgAt(3));
736 const Closure& closure = Closure::Handle(
737 zone, Closure::New(instantiator_type_args, Object::null_type_arguments(),
738 delayed_type_args, function, context,
740 arguments.SetReturn(closure);
742}

◆ DEFINE_RUNTIME_ENTRY() [3/57]

dart::DEFINE_RUNTIME_ENTRY ( AllocateContext  ,
 
)

Definition at line 747 of file runtime_entry.cc.

747 {
748 const Smi& num_variables = Smi::CheckedHandle(zone, arguments.ArgAt(0));
749 const Context& context = Context::Handle(
750 zone, Context::New(num_variables.Value(), SpaceForRuntimeAllocation()));
751 arguments.SetReturn(context);
753}

◆ DEFINE_RUNTIME_ENTRY() [4/57]

dart::DEFINE_RUNTIME_ENTRY ( AllocateObject  ,
 
)

Definition at line 534 of file runtime_entry.cc.

534 {
535 const Class& cls = Class::CheckedHandle(zone, arguments.ArgAt(0));
537 const Instance& instance = Instance::Handle(
538 zone, Instance::NewAlreadyFinalized(cls, SpaceForRuntimeAllocation()));
539 if (cls.NumTypeArguments() == 0) {
540 // No type arguments required for a non-parameterized type.
541 ASSERT(Instance::CheckedHandle(zone, arguments.ArgAt(1)).IsNull());
542 } else {
543 const auto& type_arguments =
544 TypeArguments::CheckedHandle(zone, arguments.ArgAt(1));
545 // Unless null (for a raw type), the type argument vector may be longer than
546 // necessary due to a type optimization reusing the type argument vector of
547 // the instantiator.
548 ASSERT(type_arguments.IsNull() ||
549 (type_arguments.IsInstantiated() &&
550 (type_arguments.Length() >= cls.NumTypeArguments())));
551 instance.SetTypeArguments(type_arguments);
552 }
553 arguments.SetReturn(instance);
555}
bool is_allocate_finalized() const
Definition object.h:1734

◆ DEFINE_RUNTIME_ENTRY() [5/57]

dart::DEFINE_RUNTIME_ENTRY ( AllocateRecord  ,
 
)

Definition at line 776 of file runtime_entry.cc.

776 {
777 const RecordShape shape(Smi::RawCast(arguments.ArgAt(0)));
778 const Record& record =
779 Record::Handle(zone, Record::New(shape, SpaceForRuntimeAllocation()));
780 arguments.SetReturn(record);
782}

◆ DEFINE_RUNTIME_ENTRY() [6/57]

dart::DEFINE_RUNTIME_ENTRY ( AllocateSmallRecord  ,
 
)

Definition at line 788 of file runtime_entry.cc.

788 {
789 const RecordShape shape(Smi::RawCast(arguments.ArgAt(0)));
790 const auto& value0 = Instance::CheckedHandle(zone, arguments.ArgAt(1));
791 const auto& value1 = Instance::CheckedHandle(zone, arguments.ArgAt(2));
792 const auto& value2 = Instance::CheckedHandle(zone, arguments.ArgAt(3));
793 const Record& record =
794 Record::Handle(zone, Record::New(shape, SpaceForRuntimeAllocation()));
795 const intptr_t num_fields = shape.num_fields();
796 ASSERT(num_fields == 2 || num_fields == 3);
797 record.SetFieldAt(0, value0);
798 record.SetFieldAt(1, value1);
799 if (num_fields > 2) {
800 record.SetFieldAt(2, value2);
801 }
802 arguments.SetReturn(record);
803 RuntimeAllocationEpilogue(thread);
804}
void SetFieldAt(intptr_t field_index, const Object &value) const
Definition object.h:11410

◆ DEFINE_RUNTIME_ENTRY() [7/57]

dart::DEFINE_RUNTIME_ENTRY ( AllocateSuspendState  ,
 
)

Definition at line 810 of file runtime_entry.cc.

810 {
811 const intptr_t frame_size =
812 Smi::CheckedHandle(zone, arguments.ArgAt(0)).Value();
813 const Object& previous_state = Object::Handle(zone, arguments.ArgAt(1));
814 SuspendState& result = SuspendState::Handle(zone);
815 if (previous_state.IsSuspendState()) {
816 const auto& suspend_state = SuspendState::Cast(previous_state);
817 const auto& function_data =
818 Instance::Handle(zone, suspend_state.function_data());
819 ObjectStore* object_store = thread->isolate_group()->object_store();
820 if (function_data.GetClassId() ==
821 Class::Handle(zone, object_store->async_star_stream_controller())
822 .id()) {
823 // Reset _AsyncStarStreamController.asyncStarBody to null in order
824 // to create a new callback closure during next yield.
825 // The new callback closure will capture the reallocated SuspendState.
826 function_data.SetField(
827 Field::Handle(
828 zone,
829 object_store->async_star_stream_controller_async_star_body()),
830 Object::null_object());
831 }
832 result = SuspendState::New(frame_size, function_data,
833 SpaceForRuntimeAllocation());
834 if (function_data.GetClassId() ==
835 Class::Handle(zone, object_store->sync_star_iterator_class()).id()) {
836 // Refresh _SyncStarIterator._state with the new SuspendState object.
837 function_data.SetField(
838 Field::Handle(zone, object_store->sync_star_iterator_state()),
839 result);
840 }
841 } else {
842 result = SuspendState::New(frame_size, Instance::Cast(previous_state),
844 }
845 arguments.SetReturn(result);
847}

◆ DEFINE_RUNTIME_ENTRY() [8/57]

dart::DEFINE_RUNTIME_ENTRY ( AllocateTypedData  ,
 
)

Definition at line 491 of file runtime_entry.cc.

491 {
492 const intptr_t cid = Smi::CheckedHandle(zone, arguments.ArgAt(0)).Value();
493 const auto& length = Instance::CheckedHandle(zone, arguments.ArgAt(1));
494 if (!length.IsInteger()) {
495 const Array& args = Array::Handle(zone, Array::New(1));
496 args.SetAt(0, length);
497 Exceptions::ThrowByType(Exceptions::kArgument, args);
498 }
499 const int64_t len = Integer::Cast(length).AsInt64Value();
500 const intptr_t max = TypedData::MaxElements(cid);
501 if (len < 0) {
502 Exceptions::ThrowRangeError("length", Integer::Cast(length), 0, max);
503 } else if (len > max) {
504 Exceptions::ThrowOOM();
505 }
506 const auto& typed_data =
507 TypedData::Handle(zone, TypedData::New(cid, static_cast<intptr_t>(len),
509 arguments.SetReturn(typed_data);
511}

◆ DEFINE_RUNTIME_ENTRY() [9/57]

dart::DEFINE_RUNTIME_ENTRY ( ArgumentError  ,
 
)

Definition at line 331 of file runtime_entry.cc.

331 {
332 const Instance& value = Instance::CheckedHandle(zone, arguments.ArgAt(0));
333 Exceptions::ThrowArgumentError(value);
334}

◆ DEFINE_RUNTIME_ENTRY() [10/57]

dart::DEFINE_RUNTIME_ENTRY ( ArgumentErrorUnboxedInt64  ,
 
)

Definition at line 336 of file runtime_entry.cc.

336 {
337 // Unboxed value is passed through a dedicated slot in Thread.
338 int64_t unboxed_value = arguments.thread()->unboxed_int64_runtime_arg();
339 const Integer& value = Integer::Handle(zone, Integer::New(unboxed_value));
340 Exceptions::ThrowArgumentError(value);
341}

◆ DEFINE_RUNTIME_ENTRY() [11/57]

dart::DEFINE_RUNTIME_ENTRY ( ArgumentNullError  ,
 
)

Definition at line 327 of file runtime_entry.cc.

327 {
328 DoThrowNullError(isolate, thread, zone, /*is_param=*/true);
329}
static void DoThrowNullError(Isolate *isolate, Thread *thread, Zone *zone, bool is_param)

◆ DEFINE_RUNTIME_ENTRY() [12/57]

dart::DEFINE_RUNTIME_ENTRY ( BreakpointRuntimeHandler  ,
 
)

Definition at line 1534 of file runtime_entry.cc.

1534 {
1535 DartFrameIterator iterator(thread,
1536 StackFrameIterator::kNoCrossThreadIteration);
1537 StackFrame* caller_frame = iterator.NextFrame();
1538 ASSERT(caller_frame != nullptr);
1539 Code& orig_stub = Code::Handle(zone);
1540 orig_stub =
1541 isolate->group()->debugger()->GetPatchedStubAddress(caller_frame->pc());
1542 const Error& error =
1543 Error::Handle(zone, isolate->debugger()->PauseBreakpoint());
1545 arguments.SetReturn(orig_stub);
1546}
static void ThrowIfError(const Object &result)

◆ DEFINE_RUNTIME_ENTRY() [13/57]

dart::DEFINE_RUNTIME_ENTRY ( CloneContext  ,
 
)

Definition at line 759 of file runtime_entry.cc.

759 {
760 const Context& ctx = Context::CheckedHandle(zone, arguments.ArgAt(0));
761 Context& cloned_ctx = Context::Handle(
762 zone, Context::New(ctx.num_variables(), SpaceForRuntimeAllocation()));
763 cloned_ctx.set_parent(Context::Handle(zone, ctx.parent()));
764 Object& inst = Object::Handle(zone);
765 for (int i = 0; i < ctx.num_variables(); i++) {
766 inst = ctx.At(i);
767 cloned_ctx.SetAt(i, inst);
768 }
769 arguments.SetReturn(cloned_ctx);
770 RuntimeAllocationEpilogue(thread);
771}
void set_parent(const Context &parent) const
Definition object.h:7378
void SetAt(intptr_t context_index, const Object &value) const
Definition object.h:13277
ObjectPtr At(intptr_t context_index) const
Definition object.h:7393
intptr_t num_variables() const
Definition object.h:7385
ContextPtr parent() const
Definition object.h:7377

◆ DEFINE_RUNTIME_ENTRY() [14/57]

dart::DEFINE_RUNTIME_ENTRY ( CloneSuspendState  ,
 
)

Definition at line 852 of file runtime_entry.cc.

852 {
853 const SuspendState& src =
854 SuspendState::CheckedHandle(zone, arguments.ArgAt(0));
855 const SuspendState& dst = SuspendState::Handle(
856 zone, SuspendState::Clone(thread, src, SpaceForRuntimeAllocation()));
857 arguments.SetReturn(dst);
859}

◆ DEFINE_RUNTIME_ENTRY() [15/57]

dart::DEFINE_RUNTIME_ENTRY ( CompileFunction  ,
 
)

Definition at line 213 of file compiler.cc.

213 {
214 ASSERT(thread->IsDartMutatorThread());
215 const Function& function = Function::CheckedHandle(zone, arguments.ArgAt(0));
216
217 {
218 // Another isolate's mutator thread may have created [function] and
219 // published it via an ICData, MegamorphicCache etc. Entering the lock below
220 // is an acquire operation that pairs with the release operation when the
221 // other isolate exited the lock, ensuring the initializing stores for
222 // [function] are visible in the current thread.
223 SafepointReadRwLocker ml(thread, thread->isolate_group()->program_lock());
224 }
225
226 // Will throw if compilation failed (e.g. with compile-time error).
227 function.EnsureHasCode();
228}

◆ DEFINE_RUNTIME_ENTRY() [16/57]

END_LEAF_RUNTIME_ENTRY dart::DEFINE_RUNTIME_ENTRY ( DeoptimizeMaterialize  ,
 
)

Definition at line 3685 of file runtime_entry.cc.

3685 {
3686#if !defined(DART_PRECOMPILED_RUNTIME)
3687#if defined(DEBUG)
3688 {
3689 // We may rendezvous for a safepoint at entry or GC from the allocations
3690 // below. Check the stack is walkable.
3691 ValidateFrames();
3692 }
3693#endif
3694 DeoptContext* deopt_context = isolate->deopt_context();
3695 intptr_t deopt_arg_count = deopt_context->MaterializeDeferredObjects();
3696 isolate->set_deopt_context(nullptr);
3697 delete deopt_context;
3698
3699 // Return value tells deoptimization stub to remove the given number of bytes
3700 // from the stack.
3701 arguments.SetReturn(Smi::Handle(Smi::New(deopt_arg_count * kWordSize)));
3702#else
3703 UNREACHABLE();
3704#endif // !DART_PRECOMPILED_RUNTIME
3705}

◆ DEFINE_RUNTIME_ENTRY() [17/57]

dart::DEFINE_RUNTIME_ENTRY ( DispatchTableNullError  ,
 
)

Definition at line 303 of file runtime_entry.cc.

303 {
304 const Smi& cid = Smi::CheckedHandle(zone, arguments.ArgAt(0));
305 if (cid.Value() != kNullCid) {
306 // We hit null error, but receiver is not null itself. This most likely
307 // is a memory corruption. Crash the VM but provide some additional
308 // information about the arguments on the stack.
309 DartFrameIterator iterator(thread,
310 StackFrameIterator::kNoCrossThreadIteration);
311 StackFrame* caller_frame = iterator.NextFrame();
312 RELEASE_ASSERT(caller_frame->IsDartFrame());
313 ReportImpossibleNullError(cid.Value(), caller_frame, thread);
314 }
315 DoThrowNullError(isolate, thread, zone, /*is_param=*/false);
316}
virtual bool IsDartFrame(bool validate=true) const
Definition stack_frame.h:97
void ReportImpossibleNullError(intptr_t cid, StackFrame *caller_frame, Thread *thread)

◆ DEFINE_RUNTIME_ENTRY() [18/57]

dart::DEFINE_RUNTIME_ENTRY ( DoubleToInteger  ,
 
)

Definition at line 343 of file runtime_entry.cc.

343 {
344 // Unboxed value is passed through a dedicated slot in Thread.
345 double val = arguments.thread()->unboxed_double_runtime_arg();
346 const Smi& recognized_kind = Smi::CheckedHandle(zone, arguments.ArgAt(0));
347 switch (recognized_kind.Value()) {
348 case MethodRecognizer::kDoubleToInteger:
349 break;
350 case MethodRecognizer::kDoubleFloorToInt:
351 val = floor(val);
352 break;
353 case MethodRecognizer::kDoubleCeilToInt:
354 val = ceil(val);
355 break;
356 default:
357 UNREACHABLE();
358 }
359 arguments.SetReturn(Integer::Handle(zone, DoubleToInteger(zone, val)));
360}

◆ DEFINE_RUNTIME_ENTRY() [19/57]

dart::DEFINE_RUNTIME_ENTRY ( FfiAsyncCallbackSend  ,
 
)

Definition at line 3861 of file runtime_entry.cc.

3861 {
3862 Dart_Port target_port = Thread::Current()->unboxed_int64_runtime_arg();
3863 TRACE_RUNTIME_CALL("FfiAsyncCallbackSend %p", (void*)target_port);
3864 const Object& message = Object::Handle(zone, arguments.ArgAt(0));
3865 const Array& msg_array = Array::Handle(zone, Array::New(3));
3866 msg_array.SetAt(0, message);
3867 PersistentHandle* handle =
3868 isolate->group()->api_state()->AllocatePersistentHandle();
3869 handle->set_ptr(msg_array);
3870 PortMap::PostMessage(
3871 Message::New(target_port, handle, Message::kNormalPriority));
3872}
#define TRACE_RUNTIME_CALL(format, name)

◆ DEFINE_RUNTIME_ENTRY() [20/57]

dart::DEFINE_RUNTIME_ENTRY ( FixAllocationStubTarget  ,
 
)

Definition at line 3329 of file runtime_entry.cc.

3329 {
3330#if !defined(DART_PRECOMPILED_RUNTIME)
3331 StackFrameIterator iterator(ValidationPolicy::kDontValidateFrames, thread,
3332 StackFrameIterator::kNoCrossThreadIteration);
3333 StackFrame* frame = iterator.NextFrame();
3334 ASSERT(frame != nullptr);
3335 while (frame->IsStubFrame() || frame->IsExitFrame()) {
3336 frame = iterator.NextFrame();
3337 ASSERT(frame != nullptr);
3338 }
3339 if (frame->IsEntryFrame()) {
3340 // There must be a valid Dart frame.
3341 UNREACHABLE();
3342 }
3343 ASSERT(frame->IsDartFrame());
3344 const Code& caller_code = Code::Handle(zone, frame->LookupDartCode());
3345 ASSERT(!caller_code.IsNull());
3346 const Code& stub = Code::Handle(
3347 CodePatcher::GetStaticCallTargetAt(frame->pc(), caller_code));
3348 Class& alloc_class = Class::ZoneHandle(zone);
3349 alloc_class ^= stub.owner();
3350 Code& alloc_stub = Code::Handle(zone, alloc_class.allocation_stub());
3351 if (alloc_stub.IsNull()) {
3352 alloc_stub = StubCode::GetAllocationStubForClass(alloc_class);
3353 ASSERT(!alloc_stub.IsDisabled());
3354 }
3355 CodePatcher::PatchStaticCallAt(frame->pc(), caller_code, alloc_stub);
3356 caller_code.SetStubCallTargetCodeAt(frame->pc(), alloc_stub);
3357 if (FLAG_trace_patching) {
3358 OS::PrintErr("FixAllocationStubTarget: caller %#" Px
3359 " alloc-class %s "
3360 " -> %#" Px "\n",
3361 frame->pc(), alloc_class.ToCString(), alloc_stub.EntryPoint());
3362 }
3363 arguments.SetReturn(alloc_stub);
3364#else
3365 UNREACHABLE();
3366#endif
3367}

◆ DEFINE_RUNTIME_ENTRY() [21/57]

dart::DEFINE_RUNTIME_ENTRY ( FixCallersTarget  ,
 
)

Definition at line 3261 of file runtime_entry.cc.

3261 {
3262#if !defined(DART_PRECOMPILED_RUNTIME)
3263 StackFrameIterator iterator(ValidationPolicy::kDontValidateFrames, thread,
3264 StackFrameIterator::kNoCrossThreadIteration);
3265 StackFrame* frame = iterator.NextFrame();
3266 ASSERT(frame != nullptr);
3267 while (frame->IsStubFrame() || frame->IsExitFrame()) {
3268 frame = iterator.NextFrame();
3269 ASSERT(frame != nullptr);
3270 }
3271 if (frame->IsEntryFrame()) {
3272 // Since function's current code is always unpatched, the entry frame always
3273 // calls to unpatched code.
3274 UNREACHABLE();
3275 }
3276 ASSERT(frame->IsDartFrame());
3277 const Code& caller_code = Code::Handle(zone, frame->LookupDartCode());
3278 RELEASE_ASSERT(caller_code.is_optimized());
3279 const Function& target_function = Function::Handle(
3280 zone, caller_code.GetStaticCallTargetFunctionAt(frame->pc()));
3281
3282 const Code& current_target_code =
3283 Code::Handle(zone, target_function.EnsureHasCode());
3284 CodePatcher::PatchStaticCallAt(frame->pc(), caller_code, current_target_code);
3285 caller_code.SetStaticCallTargetCodeAt(frame->pc(), current_target_code);
3286 if (FLAG_trace_patching) {
3287 OS::PrintErr(
3288 "FixCallersTarget: caller %#" Px
3289 " "
3290 "target '%s' -> %#" Px " (%s)\n",
3291 frame->pc(), target_function.ToFullyQualifiedCString(),
3292 current_target_code.EntryPoint(),
3293 current_target_code.is_optimized() ? "optimized" : "unoptimized");
3294 }
3295 arguments.SetReturn(current_target_code);
3296#else
3297 UNREACHABLE();
3298#endif
3299}

◆ DEFINE_RUNTIME_ENTRY() [22/57]

dart::DEFINE_RUNTIME_ENTRY ( FixCallersTargetMonomorphic  ,
 
)

Definition at line 3303 of file runtime_entry.cc.

3303 {
3304#if !defined(DART_PRECOMPILED_RUNTIME)
3305 const Instance& receiver = Instance::CheckedHandle(zone, arguments.ArgAt(0));
3306 const Array& switchable_call_data =
3307 Array::CheckedHandle(zone, arguments.ArgAt(1));
3308
3309 DartFrameIterator iterator(thread,
3310 StackFrameIterator::kNoCrossThreadIteration);
3311 StackFrame* caller_frame = iterator.NextFrame();
3312 const auto& caller_code = Code::Handle(zone, caller_frame->LookupDartCode());
3313 const auto& caller_function =
3314 Function::Handle(zone, caller_frame->LookupDartFunction());
3315
3316 GrowableArray<const Instance*> caller_arguments(1);
3317 caller_arguments.Add(&receiver);
3318 PatchableCallHandler handler(
3319 thread, caller_arguments, MissHandler::kFixCallersTargetMonomorphic,
3320 arguments, caller_frame, caller_code, caller_function);
3321 handler.ResolveSwitchAndReturn(switchable_call_data);
3322#else
3323 UNREACHABLE();
3324#endif
3325}
FunctionPtr LookupDartFunction() const

◆ DEFINE_RUNTIME_ENTRY() [23/57]

dart::DEFINE_RUNTIME_ENTRY ( InitInstanceField  ,
 
)

Definition at line 3823 of file runtime_entry.cc.

3823 {
3824 const Instance& instance = Instance::CheckedHandle(zone, arguments.ArgAt(0));
3825 const Field& field = Field::CheckedHandle(zone, arguments.ArgAt(1));
3826 Object& result = Object::Handle(zone, field.InitializeInstance(instance));
3828 result = instance.GetField(field);
3829 ASSERT((result.ptr() != Object::sentinel().ptr()) &&
3830 (result.ptr() != Object::transition_sentinel().ptr()));
3831 arguments.SetReturn(result);
3832}
DART_WARN_UNUSED_RESULT ErrorPtr InitializeInstance(const Instance &instance) const
Definition object.cc:12389

◆ DEFINE_RUNTIME_ENTRY() [24/57]

dart::DEFINE_RUNTIME_ENTRY ( InitStaticField  ,
 
)

Definition at line 3834 of file runtime_entry.cc.

3834 {
3835 const Field& field = Field::CheckedHandle(zone, arguments.ArgAt(0));
3836 Object& result = Object::Handle(zone, field.InitializeStatic());
3838 result = field.StaticValue();
3839 ASSERT((result.ptr() != Object::sentinel().ptr()) &&
3840 (result.ptr() != Object::transition_sentinel().ptr()));
3841 arguments.SetReturn(result);
3842}
DART_WARN_UNUSED_RESULT ErrorPtr InitializeStatic() const
Definition object.cc:12427
ObjectPtr StaticValue() const
Definition object.h:13253

◆ DEFINE_RUNTIME_ENTRY() [25/57]

dart::DEFINE_RUNTIME_ENTRY ( InlineCacheMissHandlerOneArg  ,
 
)

Definition at line 2676 of file runtime_entry.cc.

2676 {
2677 const Instance& receiver = Instance::CheckedHandle(zone, arguments.ArgAt(0));
2678 const ICData& ic_data = ICData::CheckedHandle(zone, arguments.ArgAt(1));
2679 RELEASE_ASSERT(!FLAG_precompiled_mode);
2681 args.Add(&receiver);
2682 InlineCacheMissHandler(thread, zone, args, ic_data, arguments);
2683}
static void InlineCacheMissHandler(Thread *thread, Zone *zone, const GrowableArray< const Instance * > &args, const ICData &ic_data, NativeArguments native_arguments)

◆ DEFINE_RUNTIME_ENTRY() [26/57]

dart::DEFINE_RUNTIME_ENTRY ( InlineCacheMissHandlerTwoArgs  ,
 
)

Definition at line 2691 of file runtime_entry.cc.

2691 {
2692 const Instance& receiver = Instance::CheckedHandle(zone, arguments.ArgAt(0));
2693 const Instance& other = Instance::CheckedHandle(zone, arguments.ArgAt(1));
2694 const ICData& ic_data = ICData::CheckedHandle(zone, arguments.ArgAt(2));
2695 RELEASE_ASSERT(!FLAG_precompiled_mode);
2697 args.Add(&receiver);
2698 args.Add(&other);
2699 InlineCacheMissHandler(thread, zone, args, ic_data, arguments);
2700}

◆ DEFINE_RUNTIME_ENTRY() [27/57]

dart::DEFINE_RUNTIME_ENTRY ( Instanceof  ,
 
)

Definition at line 1112 of file runtime_entry.cc.

1112 {
1113 const Instance& instance = Instance::CheckedHandle(zone, arguments.ArgAt(0));
1114 const AbstractType& type =
1115 AbstractType::CheckedHandle(zone, arguments.ArgAt(1));
1116 const TypeArguments& instantiator_type_arguments =
1117 TypeArguments::CheckedHandle(zone, arguments.ArgAt(2));
1118 const TypeArguments& function_type_arguments =
1119 TypeArguments::CheckedHandle(zone, arguments.ArgAt(3));
1120 const SubtypeTestCache& cache =
1121 SubtypeTestCache::CheckedHandle(zone, arguments.ArgAt(4));
1122 ASSERT(type.IsFinalized());
1123 ASSERT(!type.IsDynamicType()); // No need to check assignment.
1124 ASSERT(!cache.IsNull());
1125#if defined(TARGET_ARCH_IA32)
1126 // Hash-based caches are still not handled by the stubs on IA32.
1127 if (cache.IsHash()) {
1128 const auto& result = Bool::Handle(
1129 zone, CheckHashBasedSubtypeTestCache(zone, thread, instance, type,
1130 instantiator_type_arguments,
1131 function_type_arguments, cache));
1132 if (!result.IsNull()) {
1133 // Early exit because an entry already exists in the cache.
1134 arguments.SetReturn(result);
1135 return;
1136 }
1137 }
1138#endif // defined(TARGET_ARCH_IA32)
1139 const Bool& result = Bool::Get(instance.IsInstanceOf(
1140 type, instantiator_type_arguments, function_type_arguments));
1141 if (FLAG_trace_type_checks) {
1142 PrintTypeCheck("InstanceOf", instance, type, instantiator_type_arguments,
1143 function_type_arguments, result);
1144 }
1145 UpdateTypeTestCache(zone, thread, instance, type, instantiator_type_arguments,
1146 function_type_arguments, result, cache);
1147 arguments.SetReturn(result);
1148}
static void UpdateTypeTestCache(Zone *zone, Thread *thread, const Instance &instance, const AbstractType &destination_type, const TypeArguments &instantiator_type_arguments, const TypeArguments &function_type_arguments, const Bool &result, const SubtypeTestCache &new_cache)
static void PrintTypeCheck(const char *message, const Instance &instance, const AbstractType &type, const TypeArguments &instantiator_type_arguments, const TypeArguments &function_type_arguments, const Bool &result)

◆ DEFINE_RUNTIME_ENTRY() [28/57]

END_LEAF_RUNTIME_ENTRY dart::DEFINE_RUNTIME_ENTRY ( InstantiateType  ,
 
)

Definition at line 608 of file runtime_entry.cc.

608 {
609 AbstractType& type = AbstractType::CheckedHandle(zone, arguments.ArgAt(0));
610 const TypeArguments& instantiator_type_arguments =
611 TypeArguments::CheckedHandle(zone, arguments.ArgAt(1));
612 const TypeArguments& function_type_arguments =
613 TypeArguments::CheckedHandle(zone, arguments.ArgAt(2));
614 ASSERT(!type.IsNull());
615 ASSERT(instantiator_type_arguments.IsNull() ||
616 instantiator_type_arguments.IsInstantiated());
617 ASSERT(function_type_arguments.IsNull() ||
618 function_type_arguments.IsInstantiated());
619 type = type.InstantiateFrom(instantiator_type_arguments,
620 function_type_arguments, kAllFree, Heap::kOld);
621 ASSERT(!type.IsNull() && type.IsInstantiated());
622 arguments.SetReturn(type);
623}
bool IsInstantiated(Genericity genericity=kAny, intptr_t num_free_fun_type_params=kAllFree) const
Definition object.h:8681

◆ DEFINE_RUNTIME_ENTRY() [29/57]

dart::DEFINE_RUNTIME_ENTRY ( InstantiateTypeArguments  ,
 
)

Definition at line 630 of file runtime_entry.cc.

630 {
631 TypeArguments& type_arguments =
632 TypeArguments::CheckedHandle(zone, arguments.ArgAt(0));
633 const TypeArguments& instantiator_type_arguments =
634 TypeArguments::CheckedHandle(zone, arguments.ArgAt(1));
635 const TypeArguments& function_type_arguments =
636 TypeArguments::CheckedHandle(zone, arguments.ArgAt(2));
637 ASSERT(!type_arguments.IsNull() && !type_arguments.IsInstantiated());
638 ASSERT(instantiator_type_arguments.IsNull() ||
639 instantiator_type_arguments.IsInstantiated());
640 ASSERT(function_type_arguments.IsNull() ||
641 function_type_arguments.IsInstantiated());
642 // Code inlined in the caller should have optimized the case where the
643 // instantiator can be reused as type argument vector.
644 ASSERT(!type_arguments.IsUninstantiatedIdentity());
645 type_arguments = type_arguments.InstantiateAndCanonicalizeFrom(
646 instantiator_type_arguments, function_type_arguments);
647 ASSERT(type_arguments.IsNull() || type_arguments.IsInstantiated());
648 arguments.SetReturn(type_arguments);
649}
TypeArgumentsPtr InstantiateAndCanonicalizeFrom(const TypeArguments &instantiator_type_arguments, const TypeArguments &function_type_arguments) const
Definition object.cc:7678
bool IsUninstantiatedIdentity() const
Definition object.cc:7410

◆ DEFINE_RUNTIME_ENTRY() [30/57]

dart::DEFINE_RUNTIME_ENTRY ( IntegerDivisionByZeroException  ,
 
)

Definition at line 362 of file runtime_entry.cc.

362 {
363 const Array& args = Array::Handle(zone, Array::New(0));
364 Exceptions::ThrowByType(Exceptions::kIntegerDivisionByZeroException, args);
365}

◆ DEFINE_RUNTIME_ENTRY() [31/57]

dart::DEFINE_RUNTIME_ENTRY ( InterruptOrStackOverflow  ,
 
)

Definition at line 3135 of file runtime_entry.cc.

3135 {
3136#if defined(USING_SIMULATOR)
3137 uword stack_pos = Simulator::Current()->get_sp();
3138 // If simulator was never called it may return 0 as a value of SPREG.
3139 if (stack_pos == 0) {
3140 // Use any reasonable value which would not be treated
3141 // as stack overflow.
3142 stack_pos = thread->saved_stack_limit();
3143 }
3144#else
3145 uword stack_pos = OSThread::GetCurrentStackPointer();
3146#endif
3147 // Always clear the stack overflow flags. They are meant for this
3148 // particular stack overflow runtime call and are not meant to
3149 // persist.
3150 uword stack_overflow_flags = thread->GetAndClearStackOverflowFlags();
3151
3152 // If an interrupt happens at the same time as a stack overflow, we
3153 // process the stack overflow now and leave the interrupt for next
3154 // time.
3155 if (!thread->os_thread()->HasStackHeadroom() ||
3156 IsCalleeFrameOf(thread->saved_stack_limit(), stack_pos)) {
3157 if (FLAG_verbose_stack_overflow) {
3158 OS::PrintErr("Stack overflow\n");
3159 OS::PrintErr(" Native SP = %" Px ", stack limit = %" Px "\n", stack_pos,
3160 thread->saved_stack_limit());
3161 OS::PrintErr("Call stack:\n");
3162 OS::PrintErr("size | frame\n");
3163 StackFrameIterator frames(ValidationPolicy::kDontValidateFrames, thread,
3164 StackFrameIterator::kNoCrossThreadIteration);
3165 uword fp = stack_pos;
3166 StackFrame* frame = frames.NextFrame();
3167 while (frame != nullptr) {
3168 uword delta = (frame->fp() - fp);
3169 fp = frame->fp();
3170 OS::PrintErr("%4" Pd " %s\n", delta, frame->ToCString());
3171 frame = frames.NextFrame();
3172 }
3173 }
3174
3175 // Use the preallocated stack overflow exception to avoid calling
3176 // into dart code.
3177 const Instance& exception =
3178 Instance::Handle(isolate->group()->object_store()->stack_overflow());
3179 Exceptions::Throw(thread, exception);
3180 UNREACHABLE();
3181 }
3182
3183#if !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME)
3185#endif // !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME)
3186
3187 // Handle interrupts:
3188 // - store buffer overflow
3189 // - OOB message (vm-service or dart:isolate)
3190 // - marking ready for finalization
3191 const Error& error = Error::Handle(thread->HandleInterrupts());
3193
3194#if !defined(DART_PRECOMPILED_RUNTIME)
3195 if ((stack_overflow_flags & Thread::kOsrRequest) != 0) {
3196 HandleOSRRequest(thread);
3197 }
3198#else
3199 ASSERT((stack_overflow_flags & Thread::kOsrRequest) == 0);
3200#endif // !defined(DART_PRECOMPILED_RUNTIME)
3201}
static void HandleOSRRequest(Thread *thread)
static void HandleStackOverflowTestCases(Thread *thread)

◆ DEFINE_RUNTIME_ENTRY() [32/57]

dart::DEFINE_RUNTIME_ENTRY ( LateFieldAssignedDuringInitializationError  ,
 
)

Definition at line 3844 of file runtime_entry.cc.

3844 {
3845 const Field& field = Field::CheckedHandle(zone, arguments.ArgAt(0));
3846 Exceptions::ThrowLateFieldAssignedDuringInitialization(
3847 String::Handle(field.name()));
3848}

◆ DEFINE_RUNTIME_ENTRY() [33/57]

dart::DEFINE_RUNTIME_ENTRY ( LateFieldNotInitializedError  ,
 
)

Definition at line 3850 of file runtime_entry.cc.

3850 {
3851 const Field& field = Field::CheckedHandle(zone, arguments.ArgAt(0));
3852 Exceptions::ThrowLateFieldNotInitialized(String::Handle(field.name()));
3853}

◆ DEFINE_RUNTIME_ENTRY() [34/57]

dart::DEFINE_RUNTIME_ENTRY ( NonBoolTypeError  ,
 
)

Definition at line 1440 of file runtime_entry.cc.

1440 {
1441 const TokenPosition location = GetCallerLocation();
1442 const Instance& src_instance =
1443 Instance::CheckedHandle(zone, arguments.ArgAt(0));
1444
1445 if (src_instance.IsNull()) {
1446 const Array& args = Array::Handle(zone, Array::New(5));
1447 args.SetAt(
1448 0, String::Handle(
1449 zone,
1450 String::New(
1451 "Failed assertion: boolean expression must not be null")));
1452
1453 // No source code for this assertion, set url to null.
1454 args.SetAt(1, String::Handle(zone, String::null()));
1455 args.SetAt(2, Object::smi_zero());
1456 args.SetAt(3, Object::smi_zero());
1457 args.SetAt(4, String::Handle(zone, String::null()));
1458
1459 Exceptions::ThrowByType(Exceptions::kAssertion, args);
1460 UNREACHABLE();
1461 }
1462
1463 ASSERT(!src_instance.IsBool());
1464 const Type& bool_interface = Type::Handle(Type::BoolType());
1465 const AbstractType& src_type =
1466 AbstractType::Handle(zone, src_instance.GetType(Heap::kNew));
1467 Exceptions::CreateAndThrowTypeError(location, src_type, bool_interface,
1468 Symbols::BooleanExpression());
1469 UNREACHABLE();
1470}
static TokenPosition GetCallerLocation()

◆ DEFINE_RUNTIME_ENTRY() [35/57]

dart::DEFINE_RUNTIME_ENTRY ( NoSuchMethodFromCallStub  ,
 
)

Definition at line 2898 of file runtime_entry.cc.

2898 {
2899 ASSERT(!FLAG_lazy_dispatchers);
2900 const Instance& receiver = Instance::CheckedHandle(zone, arguments.ArgAt(0));
2901 const Object& ic_data_or_cache = Object::Handle(zone, arguments.ArgAt(1));
2902 const Array& orig_arguments_desc =
2903 Array::CheckedHandle(zone, arguments.ArgAt(2));
2904 const Array& orig_arguments = Array::CheckedHandle(zone, arguments.ArgAt(3));
2905 String& target_name = String::Handle(zone);
2906 if (ic_data_or_cache.IsICData()) {
2907 target_name = ICData::Cast(ic_data_or_cache).target_name();
2908 } else {
2909 ASSERT(ic_data_or_cache.IsMegamorphicCache());
2910 target_name = MegamorphicCache::Cast(ic_data_or_cache).target_name();
2911 }
2912
2913 const auto& result =
2914 Object::Handle(zone, InvokeCallThroughGetterOrNoSuchMethod(
2915 thread, zone, receiver, target_name,
2916 orig_arguments, orig_arguments_desc));
2918 arguments.SetReturn(result);
2919}
static ObjectPtr InvokeCallThroughGetterOrNoSuchMethod(Thread *thread, Zone *zone, const Instance &receiver, const String &target_name, const Array &orig_arguments, const Array &orig_arguments_desc)

◆ DEFINE_RUNTIME_ENTRY() [36/57]

dart::DEFINE_RUNTIME_ENTRY ( NoSuchMethodFromPrologue  ,
 
)

Definition at line 2926 of file runtime_entry.cc.

2926 {
2927 const Instance& receiver = Instance::CheckedHandle(zone, arguments.ArgAt(0));
2928 const Function& function = Function::CheckedHandle(zone, arguments.ArgAt(1));
2929 const Array& orig_arguments_desc =
2930 Array::CheckedHandle(zone, arguments.ArgAt(2));
2931 const Array& orig_arguments = Array::CheckedHandle(zone, arguments.ArgAt(3));
2932
2933 String& orig_function_name = String::Handle(zone);
2934 if ((function.kind() == UntaggedFunction::kClosureFunction) ||
2935 (function.kind() == UntaggedFunction::kImplicitClosureFunction)) {
2936 // For closure the function name is always 'call'. Replace it with the
2937 // name of the closurized function so that exception contains more
2938 // relevant information.
2939 orig_function_name = function.QualifiedUserVisibleName();
2940 } else {
2941 orig_function_name = function.name();
2942 }
2943
2944 const Object& result = Object::Handle(
2945 zone, DartEntry::InvokeNoSuchMethod(thread, receiver, orig_function_name,
2946 orig_arguments, orig_arguments_desc));
2948 arguments.SetReturn(result);
2949}

◆ DEFINE_RUNTIME_ENTRY() [37/57]

dart::DEFINE_RUNTIME_ENTRY ( NotLoaded  ,
 
)

Definition at line 3855 of file runtime_entry.cc.

3855 {
3856 // We could just use a trap instruction in the stub, but we get better stack
3857 // traces when there is an exit frame.
3858 FATAL("Not loaded");
3859}

◆ DEFINE_RUNTIME_ENTRY() [38/57]

dart::DEFINE_RUNTIME_ENTRY ( NullCastError  ,
 
)

Definition at line 323 of file runtime_entry.cc.

323 {
324 NullErrorHelper(zone, String::null_string());
325}
static void NullErrorHelper(Zone *zone, const String &selector, bool is_param_name=false)

◆ DEFINE_RUNTIME_ENTRY() [39/57]

dart::DEFINE_RUNTIME_ENTRY ( NullError  ,
 
)

Definition at line 265 of file runtime_entry.cc.

265 {
266 DoThrowNullError(isolate, thread, zone, /*is_param=*/false);
267}

◆ DEFINE_RUNTIME_ENTRY() [40/57]

dart::DEFINE_RUNTIME_ENTRY ( NullErrorWithSelector  ,
 
)

Definition at line 318 of file runtime_entry.cc.

318 {
319 const String& selector = String::CheckedHandle(zone, arguments.ArgAt(0));
320 NullErrorHelper(zone, selector);
321}

◆ DEFINE_RUNTIME_ENTRY() [41/57]

dart::DEFINE_RUNTIME_ENTRY ( OptimizeInvokedFunction  ,
 
)

Definition at line 3219 of file runtime_entry.cc.

3219 {
3220#if !defined(DART_PRECOMPILED_RUNTIME)
3221 const Function& function = Function::CheckedHandle(zone, arguments.ArgAt(0));
3222 ASSERT(!function.IsNull());
3223 ASSERT(function.HasCode());
3224
3225 if (Compiler::CanOptimizeFunction(thread, function)) {
3226 auto isolate_group = thread->isolate_group();
3227 if (FLAG_background_compilation) {
3228 if (isolate_group->background_compiler()->EnqueueCompilation(function)) {
3229 // Reduce the chance of triggering a compilation while the function is
3230 // being compiled in the background. INT32_MIN should ensure that it
3231 // takes long time to trigger a compilation.
3232 // Note that the background compilation queue rejects duplicate entries.
3233 function.SetUsageCounter(INT32_MIN);
3234 // Continue in the same code.
3235 arguments.SetReturn(function);
3236 return;
3237 }
3238 }
3239
3240 // Reset usage counter for reoptimization before calling optimizer to
3241 // prevent recursive triggering of function optimization.
3242 function.SetUsageCounter(0);
3243 if (FLAG_trace_compiler || FLAG_trace_optimizing_compiler) {
3244 if (function.HasOptimizedCode()) {
3245 THR_Print("ReCompiling function: '%s' \n",
3246 function.ToFullyQualifiedCString());
3247 }
3248 }
3249 Object& result = Object::Handle(
3250 zone, Compiler::CompileOptimizedFunction(thread, function));
3252 }
3253 arguments.SetReturn(function);
3254#else
3255 UNREACHABLE();
3256#endif // !DART_PRECOMPILED_RUNTIME
3257}

◆ DEFINE_RUNTIME_ENTRY() [42/57]

dart::DEFINE_RUNTIME_ENTRY ( PatchStaticCall  ,
 
)

Definition at line 1488 of file runtime_entry.cc.

1488 {
1489#if !defined(DART_PRECOMPILED_RUNTIME)
1490 DartFrameIterator iterator(thread,
1491 StackFrameIterator::kNoCrossThreadIteration);
1492 StackFrame* caller_frame = iterator.NextFrame();
1493 ASSERT(caller_frame != nullptr);
1494 const Code& caller_code = Code::Handle(zone, caller_frame->LookupDartCode());
1495 ASSERT(!caller_code.IsNull());
1496 ASSERT(caller_code.is_optimized());
1497 const Function& target_function = Function::Handle(
1498 zone, caller_code.GetStaticCallTargetFunctionAt(caller_frame->pc()));
1499 const Code& target_code = Code::Handle(zone, target_function.EnsureHasCode());
1500 // Before patching verify that we are not repeatedly patching to the same
1501 // target.
1502 if (target_code.ptr() !=
1503 CodePatcher::GetStaticCallTargetAt(caller_frame->pc(), caller_code)) {
1504 GcSafepointOperationScope safepoint(thread);
1505 if (target_code.ptr() !=
1506 CodePatcher::GetStaticCallTargetAt(caller_frame->pc(), caller_code)) {
1507 CodePatcher::PatchStaticCallAt(caller_frame->pc(), caller_code,
1508 target_code);
1509 caller_code.SetStaticCallTargetCodeAt(caller_frame->pc(), target_code);
1510 if (FLAG_trace_patching) {
1511 THR_Print("PatchStaticCall: patching caller pc %#" Px
1512 ""
1513 " to '%s' new entry point %#" Px " (%s)\n",
1514 caller_frame->pc(), target_function.ToFullyQualifiedCString(),
1515 target_code.EntryPoint(),
1516 target_code.is_optimized() ? "optimized" : "unoptimized");
1517 }
1518 }
1519 }
1520 arguments.SetReturn(target_code);
1521#else
1522 UNREACHABLE();
1523#endif
1524}
uword EntryPoint() const
Definition object.h:6837
void SetStaticCallTargetCodeAt(uword pc, const Code &code) const
Definition object.cc:17865
FunctionPtr GetStaticCallTargetFunctionAt(uword pc) const
Definition object.cc:17850
const char * ToFullyQualifiedCString() const
Definition object.cc:9820
CodePtr EnsureHasCode() const
Definition object.cc:11396

◆ DEFINE_RUNTIME_ENTRY() [43/57]

dart::DEFINE_RUNTIME_ENTRY ( RangeError  ,
 
)

Definition at line 118 of file runtime_entry.cc.

118 {
119 const Instance& length = Instance::CheckedHandle(zone, arguments.ArgAt(0));
120 const Instance& index = Instance::CheckedHandle(zone, arguments.ArgAt(1));
121 if (!length.IsInteger()) {
122 // Throw: new ArgumentError.value(length, "length", "is not an integer");
123 const Array& args = Array::Handle(zone, Array::New(3));
124 args.SetAt(0, length);
125 args.SetAt(1, Symbols::Length());
126 args.SetAt(2, String::Handle(zone, String::New("is not an integer")));
127 Exceptions::ThrowByType(Exceptions::kArgumentValue, args);
128 }
129 if (!index.IsInteger()) {
130 // Throw: new ArgumentError.value(index, "index", "is not an integer");
131 const Array& args = Array::Handle(zone, Array::New(3));
132 args.SetAt(0, index);
133 args.SetAt(1, Symbols::Index());
134 args.SetAt(2, String::Handle(zone, String::New("is not an integer")));
135 Exceptions::ThrowByType(Exceptions::kArgumentValue, args);
136 }
137 // Throw: new RangeError.range(index, 0, length - 1, "length");
138 const Array& args = Array::Handle(zone, Array::New(4));
139 args.SetAt(0, index);
140 args.SetAt(1, Integer::Handle(zone, Integer::New(0)));
141 args.SetAt(
142 2, Integer::Handle(
143 zone, Integer::Cast(length).ArithmeticOp(
144 Token::kSUB, Integer::Handle(zone, Integer::New(1)))));
145 args.SetAt(3, Symbols::Length());
146 Exceptions::ThrowByType(Exceptions::kRange, args);
147}

◆ DEFINE_RUNTIME_ENTRY() [44/57]

dart::DEFINE_RUNTIME_ENTRY ( RangeErrorUnboxedInt64  ,
 
)

Definition at line 149 of file runtime_entry.cc.

149 {
150 int64_t unboxed_length = thread->unboxed_int64_runtime_arg();
151 int64_t unboxed_index = thread->unboxed_int64_runtime_second_arg();
152 const auto& length = Integer::Handle(zone, Integer::New(unboxed_length));
153 const auto& index = Integer::Handle(zone, Integer::New(unboxed_index));
154 // Throw: new RangeError.range(index, 0, length - 1, "length");
155 const Array& args = Array::Handle(zone, Array::New(4));
156 args.SetAt(0, index);
157 args.SetAt(1, Integer::Handle(zone, Integer::New(0)));
158 args.SetAt(
159 2, Integer::Handle(
160 zone, Integer::Cast(length).ArithmeticOp(
161 Token::kSUB, Integer::Handle(zone, Integer::New(1)))));
162 args.SetAt(3, Symbols::Length());
163 Exceptions::ThrowByType(Exceptions::kRange, args);
164}

◆ DEFINE_RUNTIME_ENTRY() [45/57]

dart::DEFINE_RUNTIME_ENTRY ( ResumeFrame  ,
 
)

Definition at line 3724 of file runtime_entry.cc.

3724 {
3725 const Instance& exception = Instance::CheckedHandle(zone, arguments.ArgAt(0));
3726 const Instance& stacktrace =
3727 Instance::CheckedHandle(zone, arguments.ArgAt(1));
3728
3729#if !defined(DART_PRECOMPILED_RUNTIME)
3730#if !defined(PRODUCT)
3731 if (isolate->has_resumption_breakpoints()) {
3732 isolate->debugger()->ResumptionBreakpoint();
3733 }
3734#endif
3735
3736 DartFrameIterator iterator(thread,
3737 StackFrameIterator::kNoCrossThreadIteration);
3738 StackFrame* frame = iterator.NextFrame();
3739 ASSERT(frame->IsDartFrame());
3740 ASSERT(Function::Handle(zone, frame->LookupDartFunction())
3741 .IsSuspendableFunction());
3742 const Code& caller_code = Code::Handle(zone, frame->LookupDartCode());
3743 if (caller_code.IsDisabled() && caller_code.is_optimized() &&
3744 !caller_code.is_force_optimized()) {
3745 const uword deopt_pc = frame->pc();
3746 thread->pending_deopts().AddPendingDeopt(frame->fp(), deopt_pc);
3747 frame->MarkForLazyDeopt();
3748
3749 if (FLAG_trace_deoptimization) {
3750 THR_Print("Lazy deopt scheduled for resumed frame fp=%" Pp ", pc=%" Pp
3751 "\n",
3752 frame->fp(), deopt_pc);
3753 }
3754 }
3755#endif
3756
3757 if (!exception.IsNull()) {
3758 Exceptions::ReThrow(thread, exception, stacktrace);
3759 }
3760}

◆ DEFINE_RUNTIME_ENTRY() [46/57]

dart::DEFINE_RUNTIME_ENTRY ( ReThrow  ,
 
)

Definition at line 1477 of file runtime_entry.cc.

1477 {
1478 const Instance& exception = Instance::CheckedHandle(zone, arguments.ArgAt(0));
1479 const Instance& stacktrace =
1480 Instance::CheckedHandle(zone, arguments.ArgAt(1));
1481 const Smi& bypass_debugger = Smi::CheckedHandle(zone, arguments.ArgAt(2));
1482 Exceptions::ReThrow(thread, exception, stacktrace,
1483 bypass_debugger.Value() != 0);
1484}

◆ DEFINE_RUNTIME_ENTRY() [47/57]

dart::DEFINE_RUNTIME_ENTRY ( RewindPostDeopt  ,
 
)

Definition at line 3707 of file runtime_entry.cc.

3707 {
3708#if !defined(DART_PRECOMPILED_RUNTIME)
3709#if !defined(PRODUCT)
3710 isolate->debugger()->RewindPostDeopt();
3711#endif // !PRODUCT
3712#endif // !DART_PRECOMPILED_RUNTIME
3713 UNREACHABLE();
3714}

◆ DEFINE_RUNTIME_ENTRY() [48/57]

dart::DEFINE_RUNTIME_ENTRY ( SingleStepHandler  ,
 
)

Definition at line 1549 of file runtime_entry.cc.

1549 {
1550#if defined(PRODUCT) || defined(DART_PRECOMPILED_RUNTIME)
1551 UNREACHABLE();
1552#else
1553 const Error& error =
1554 Error::Handle(zone, isolate->debugger()->PauseStepping());
1556#endif
1557}

◆ DEFINE_RUNTIME_ENTRY() [49/57]

dart::DEFINE_RUNTIME_ENTRY ( StaticCallMissHandlerOneArg  ,
 
)

Definition at line 1772 of file runtime_entry.cc.

1772 {
1773 const Instance& arg = Instance::CheckedHandle(zone, arguments.ArgAt(0));
1774 const ICData& ic_data = ICData::CheckedHandle(zone, arguments.ArgAt(1));
1775 // IC data for static call is prepopulated with the statically known target.
1776 ASSERT(ic_data.NumberOfChecksIs(1));
1777 const Function& target = Function::Handle(zone, ic_data.GetTargetAt(0));
1778 target.EnsureHasCode();
1779 ASSERT(!target.IsNull() && target.HasCode());
1780 ic_data.EnsureHasReceiverCheck(arg.GetClassId(), target, 1);
1781 if (FLAG_trace_ic) {
1782 DartFrameIterator iterator(thread,
1783 StackFrameIterator::kNoCrossThreadIteration);
1784 StackFrame* caller_frame = iterator.NextFrame();
1785 ASSERT(caller_frame != nullptr);
1786 OS::PrintErr("StaticCallMissHandler at %#" Px " target %s (%" Pd ")\n",
1787 caller_frame->pc(), target.ToCString(), arg.GetClassId());
1788 }
1789 arguments.SetReturn(target);
1790}
bool NumberOfChecksIs(intptr_t n) const
Definition object.cc:16629
FunctionPtr GetTargetAt(intptr_t index) const
Definition object.cc:17076
void EnsureHasReceiverCheck(intptr_t receiver_class_id, const Function &target, intptr_t count=1, StaticTypeExactnessState exactness=StaticTypeExactnessState::NotTracking()) const
Definition object.cc:16923
intptr_t GetClassId() const
Definition object.h:341

◆ DEFINE_RUNTIME_ENTRY() [50/57]

dart::DEFINE_RUNTIME_ENTRY ( StaticCallMissHandlerTwoArgs  ,
 
)

Definition at line 1797 of file runtime_entry.cc.

1797 {
1798 const Instance& arg0 = Instance::CheckedHandle(zone, arguments.ArgAt(0));
1799 const Instance& arg1 = Instance::CheckedHandle(zone, arguments.ArgAt(1));
1800 const ICData& ic_data = ICData::CheckedHandle(zone, arguments.ArgAt(2));
1801 // IC data for static call is prepopulated with the statically known target.
1802 ASSERT(!ic_data.NumberOfChecksIs(0));
1803 const Function& target = Function::Handle(zone, ic_data.GetTargetAt(0));
1804 target.EnsureHasCode();
1806 cids.Add(arg0.GetClassId());
1807 cids.Add(arg1.GetClassId());
1808 ic_data.EnsureHasCheck(cids, target);
1809 if (FLAG_trace_ic) {
1810 DartFrameIterator iterator(thread,
1811 StackFrameIterator::kNoCrossThreadIteration);
1812 StackFrame* caller_frame = iterator.NextFrame();
1813 ASSERT(caller_frame != nullptr);
1814 OS::PrintErr("StaticCallMissHandler at %#" Px " target %s (%" Pd ", %" Pd
1815 ")\n",
1816 caller_frame->pc(), target.ToCString(), cids[0], cids[1]);
1817 }
1818 arguments.SetReturn(target);
1819}
void EnsureHasCheck(const GrowableArray< intptr_t > &class_ids, const Function &target, intptr_t count=1) const
Definition object.cc:16822

◆ DEFINE_RUNTIME_ENTRY() [51/57]

dart::DEFINE_RUNTIME_ENTRY ( SubtypeCheck  ,
 
)

Definition at line 685 of file runtime_entry.cc.

685 {
686 const TypeArguments& instantiator_type_args =
687 TypeArguments::CheckedHandle(zone, arguments.ArgAt(0));
688 const TypeArguments& function_type_args =
689 TypeArguments::CheckedHandle(zone, arguments.ArgAt(1));
690 AbstractType& subtype = AbstractType::CheckedHandle(zone, arguments.ArgAt(2));
691 AbstractType& supertype =
692 AbstractType::CheckedHandle(zone, arguments.ArgAt(3));
693 const String& dst_name = String::CheckedHandle(zone, arguments.ArgAt(4));
694
695 ASSERT(!supertype.IsNull());
696 ASSERT(!subtype.IsNull());
697
698 // Now that AssertSubtype may be checking types only available at runtime,
699 // we can't guarantee the supertype isn't the top type.
700 if (supertype.IsTopTypeForSubtyping()) return;
701
702 // The supertype or subtype may not be instantiated.
703 if (AbstractType::InstantiateAndTestSubtype(
704 &subtype, &supertype, instantiator_type_args, function_type_args)) {
705 if (FLAG_trace_type_checks) {
706 // The supertype and subtype are now instantiated. Subtype check passed.
707 PrintSubtypeCheck(subtype, supertype, true);
708 }
709 return;
710 }
711 if (FLAG_trace_type_checks) {
712 // The supertype and subtype are now instantiated. Subtype check failed.
713 PrintSubtypeCheck(subtype, supertype, false);
714 }
715
716 // Throw a dynamic type error.
717 const TokenPosition location = GetCallerLocation();
718 Exceptions::CreateAndThrowTypeError(location, subtype, supertype, dst_name);
719 UNREACHABLE();
720}
bool IsTopTypeForSubtyping() const
Definition object.cc:21457
static void PrintSubtypeCheck(const AbstractType &subtype, const AbstractType &supertype, const bool result)

◆ DEFINE_RUNTIME_ENTRY() [52/57]

dart::DEFINE_RUNTIME_ENTRY ( SwitchableCallMiss  ,
 
)

Definition at line 2706 of file runtime_entry.cc.

2706 {
2707 const Instance& receiver = Instance::CheckedHandle(zone, arguments.ArgAt(1));
2708
2709 StackFrameIterator iterator(ValidationPolicy::kDontValidateFrames, thread,
2710 StackFrameIterator::kNoCrossThreadIteration);
2711 StackFrame* exit_frame = iterator.NextFrame();
2712 ASSERT(exit_frame->IsExitFrame());
2713 StackFrame* miss_handler_frame = iterator.NextFrame();
2714 // This runtime entry can be called either from miss stub or from
2715 // switchable_call_miss "dart" stub/function set up in
2716 // [MegamorphicCacheTable::InitMissHandler].
2717 ASSERT(miss_handler_frame->IsStubFrame() ||
2718 miss_handler_frame->IsDartFrame());
2719 StackFrame* caller_frame = iterator.NextFrame();
2720 ASSERT(caller_frame->IsDartFrame());
2721 const Code& caller_code = Code::Handle(zone, caller_frame->LookupDartCode());
2722 const Function& caller_function =
2723 Function::Handle(zone, caller_frame->LookupDartFunction());
2724
2725 auto& old_data = Object::Handle(zone);
2726#if defined(DART_PRECOMPILED_RUNTIME)
2727 old_data =
2728 CodePatcher::GetSwitchableCallDataAt(caller_frame->pc(), caller_code);
2729#else
2730 CodePatcher::GetInstanceCallAt(caller_frame->pc(), caller_code, &old_data);
2731#endif
2732
2733 GrowableArray<const Instance*> caller_arguments(1);
2734 caller_arguments.Add(&receiver);
2735 PatchableCallHandler handler(thread, caller_arguments,
2736 MissHandler::kSwitchableCallMiss, arguments,
2737 caller_frame, caller_code, caller_function);
2738 handler.ResolveSwitchAndReturn(old_data);
2739}
virtual bool IsExitFrame() const
virtual bool IsStubFrame() const

◆ DEFINE_RUNTIME_ENTRY() [53/57]

dart::DEFINE_RUNTIME_ENTRY ( Throw  ,
 
)

Definition at line 1472 of file runtime_entry.cc.

1472 {
1473 const Instance& exception = Instance::CheckedHandle(zone, arguments.ArgAt(0));
1474 Exceptions::Throw(thread, exception);
1475}

◆ DEFINE_RUNTIME_ENTRY() [54/57]

dart::DEFINE_RUNTIME_ENTRY ( TraceICCall  ,
 
)

Definition at line 3203 of file runtime_entry.cc.

3203 {
3204 const ICData& ic_data = ICData::CheckedHandle(zone, arguments.ArgAt(0));
3205 const Function& function = Function::CheckedHandle(zone, arguments.ArgAt(1));
3206 DartFrameIterator iterator(thread,
3207 StackFrameIterator::kNoCrossThreadIteration);
3208 StackFrame* frame = iterator.NextFrame();
3209 ASSERT(frame != nullptr);
3210 OS::PrintErr(
3211 "IC call @%#" Px ": ICData: %#" Px " cnt:%" Pd " nchecks: %" Pd " %s\n",
3212 frame->pc(), static_cast<uword>(ic_data.ptr()), function.usage_counter(),
3213 ic_data.NumberOfChecks(), function.ToFullyQualifiedCString());
3214}
intptr_t NumberOfChecks() const
Definition object.cc:16624

◆ DEFINE_RUNTIME_ENTRY() [55/57]

dart::DEFINE_RUNTIME_ENTRY ( TypeCheck  ,
 
)

Definition at line 1167 of file runtime_entry.cc.

1167 {
1168 const Instance& src_instance =
1169 Instance::CheckedHandle(zone, arguments.ArgAt(0));
1170 const AbstractType& dst_type =
1171 AbstractType::CheckedHandle(zone, arguments.ArgAt(1));
1172 const TypeArguments& instantiator_type_arguments =
1173 TypeArguments::CheckedHandle(zone, arguments.ArgAt(2));
1174 const TypeArguments& function_type_arguments =
1175 TypeArguments::CheckedHandle(zone, arguments.ArgAt(3));
1176 String& dst_name = String::Handle(zone);
1177 dst_name ^= arguments.ArgAt(4);
1178 ASSERT(dst_name.IsNull() || dst_name.IsString());
1179
1180 SubtypeTestCache& cache = SubtypeTestCache::Handle(zone);
1181 cache ^= arguments.ArgAt(5);
1182 ASSERT(cache.IsNull() || cache.IsSubtypeTestCache());
1183
1184 const TypeCheckMode mode = static_cast<TypeCheckMode>(
1185 Smi::CheckedHandle(zone, arguments.ArgAt(6)).Value());
1186
1187#if defined(TESTING)
1188 TESTING_runtime_entered_on_TTS_invocation = true;
1189#endif
1190
1191#if defined(TARGET_ARCH_IA32)
1192 ASSERT(mode == kTypeCheckFromInline);
1193 // Hash-based caches are still not handled by the stubs on IA32.
1194 if (cache.IsHash()) {
1195 const auto& result = Bool::Handle(
1196 zone, CheckHashBasedSubtypeTestCache(
1197 zone, thread, src_instance, dst_type,
1198 instantiator_type_arguments, function_type_arguments, cache));
1199 if (!result.IsNull()) {
1200 // Early exit because an entry already exists in the cache.
1201 arguments.SetReturn(result);
1202 return;
1203 }
1204 }
1205#endif // defined(TARGET_ARCH_IA32)
1206
1207 // This is guaranteed on the calling side.
1208 ASSERT(!dst_type.IsDynamicType());
1209
1210 const bool is_instance_of = src_instance.IsAssignableTo(
1211 dst_type, instantiator_type_arguments, function_type_arguments);
1212
1213 if (FLAG_trace_type_checks) {
1214 PrintTypeCheck("TypeCheck", src_instance, dst_type,
1215 instantiator_type_arguments, function_type_arguments,
1216 Bool::Get(is_instance_of));
1217 }
1218
1219 // Most paths through this runtime entry don't need to know what the
1220 // destination name was or if this was a dynamic assert assignable call,
1221 // so only walk the stack to find the stored destination name when necessary.
1222 auto resolve_dst_name = [&]() {
1223 if (!dst_name.IsNull()) return;
1224#if !defined(TARGET_ARCH_IA32)
1225 // Can only come here from type testing stub.
1226 ASSERT(mode != kTypeCheckFromInline);
1227
1228 // Grab the [dst_name] from the pool. It's stored at one pool slot after
1229 // the subtype-test-cache.
1230 DartFrameIterator iterator(thread,
1231 StackFrameIterator::kNoCrossThreadIteration);
1232 StackFrame* caller_frame = iterator.NextFrame();
1233 const Code& caller_code =
1234 Code::Handle(zone, caller_frame->LookupDartCode());
1235 const ObjectPool& pool =
1236 ObjectPool::Handle(zone, caller_code.GetObjectPool());
1237 TypeTestingStubCallPattern tts_pattern(caller_frame->pc());
1238 const intptr_t stc_pool_idx = tts_pattern.GetSubtypeTestCachePoolIndex();
1239 const intptr_t dst_name_idx = stc_pool_idx + 1;
1240 dst_name ^= pool.ObjectAt(dst_name_idx);
1241#else
1242 UNREACHABLE();
1243#endif
1244 };
1245
1246 if (!is_instance_of) {
1247 resolve_dst_name();
1248 if (dst_name.ptr() ==
1249 Symbols::dynamic_assert_assignable_stc_check().ptr()) {
1250#if !defined(TARGET_ARCH_IA32)
1251 // Can only come here from type testing stub via dynamic AssertAssignable.
1252 ASSERT(mode != kTypeCheckFromInline);
1253#endif
1254 // This was a dynamic closure call where the destination name was not
1255 // known at compile-time. Thus, fetch the original arguments and arguments
1256 // descriptor and re-do the type check in the runtime, which causes the
1257 // error with the proper destination name to be thrown.
1258 DartFrameIterator iterator(thread,
1259 StackFrameIterator::kNoCrossThreadIteration);
1260 StackFrame* caller_frame = iterator.NextFrame();
1261 const auto& dispatcher =
1262 Function::Handle(zone, caller_frame->LookupDartFunction());
1263 ASSERT(dispatcher.IsInvokeFieldDispatcher());
1264 const auto& orig_arguments_desc =
1265 Array::Handle(zone, dispatcher.saved_args_desc());
1266 const ArgumentsDescriptor args_desc(orig_arguments_desc);
1267 const intptr_t arg_count = args_desc.CountWithTypeArgs();
1268 const auto& orig_arguments = Array::Handle(zone, Array::New(arg_count));
1269 auto& obj = Object::Handle(zone);
1270 for (intptr_t i = 0; i < arg_count; i++) {
1271 obj = *reinterpret_cast<ObjectPtr*>(
1272 ParamAddress(caller_frame->fp(), arg_count - i));
1273 orig_arguments.SetAt(i, obj);
1274 }
1275 const auto& receiver = Closure::CheckedHandle(
1276 zone, orig_arguments.At(args_desc.FirstArgIndex()));
1277 const auto& function = Function::Handle(zone, receiver.function());
1278 const auto& result = Object::Handle(
1279 zone, function.DoArgumentTypesMatch(orig_arguments, args_desc));
1280 if (result.IsError()) {
1281 Exceptions::PropagateError(Error::Cast(result));
1282 }
1283 // IsAssignableTo returned false, so we should have thrown a type
1284 // error in DoArgumentsTypesMatch.
1285 UNREACHABLE();
1286 }
1287
1288 ASSERT(!dst_name.IsNull());
1289 // Throw a dynamic type error.
1290 const TokenPosition location = GetCallerLocation();
1291 const auto& src_type =
1292 AbstractType::Handle(zone, src_instance.GetType(Heap::kNew));
1293 auto& reported_type = AbstractType::Handle(zone, dst_type.ptr());
1294 if (!reported_type.IsInstantiated()) {
1295 // Instantiate dst_type before reporting the error.
1296 reported_type = reported_type.InstantiateFrom(instantiator_type_arguments,
1297 function_type_arguments,
1298 kAllFree, Heap::kNew);
1299 }
1300 Exceptions::CreateAndThrowTypeError(location, src_type, reported_type,
1301 dst_name);
1302 UNREACHABLE();
1303 }
1304
1305 bool should_update_cache = true;
1306#if !defined(TARGET_ARCH_IA32)
1307 bool would_update_cache_if_not_lazy = false;
1308#if !defined(DART_PRECOMPILED_RUNTIME)
1309 // Checks against type parameters are done by loading the corresponding type
1310 // argument at runtime and calling the type argument's TTS. Thus, we install
1311 // specialized TTSes on the type argument, not the parameter itself.
1312 auto& tts_type = AbstractType::Handle(zone, dst_type.ptr());
1313 if (tts_type.IsTypeParameter()) {
1314 const auto& param = TypeParameter::Cast(tts_type);
1315 tts_type = param.GetFromTypeArguments(instantiator_type_arguments,
1316 function_type_arguments);
1317 }
1318 ASSERT(!tts_type.IsTypeParameter());
1319
1320 if (mode == kTypeCheckFromLazySpecializeStub) {
1321 if (FLAG_trace_type_checks) {
1322 THR_Print(" Specializing type testing stub for %s\n",
1323 tts_type.ToCString());
1324 }
1325 const Code& code = Code::Handle(
1326 zone, TypeTestingStubGenerator::SpecializeStubFor(thread, tts_type));
1327 tts_type.SetTypeTestingStub(code);
1328
1329 // Only create the cache if we failed to create a specialized TTS and doing
1330 // the same check would cause an update to the cache.
1331 would_update_cache_if_not_lazy =
1332 (!src_instance.IsNull() &&
1333 tts_type.type_test_stub() ==
1334 StubCode::DefaultNullableTypeTest().ptr()) ||
1335 tts_type.type_test_stub() == StubCode::DefaultTypeTest().ptr();
1336 should_update_cache = would_update_cache_if_not_lazy && cache.IsNull();
1337 }
1338
1339 // Since dst_type is not a top type or type parameter, then the only default
1340 // stubs it can use are DefaultTypeTest or DefaultNullableTypeTest.
1341 if ((mode == kTypeCheckFromSlowStub) &&
1342 (tts_type.type_test_stub() != StubCode::DefaultNullableTypeTest().ptr() &&
1343 tts_type.type_test_stub() != StubCode::DefaultTypeTest().ptr())) {
1344 // The specialized type testing stub returned a false negative. That means
1345 // the specialization may have been generated using outdated cid ranges and
1346 // new classes appeared since the stub was generated. Try respecializing.
1347 if (FLAG_trace_type_checks) {
1348 THR_Print(" Rebuilding type testing stub for %s\n",
1349 tts_type.ToCString());
1350 }
1351 const auto& old_code = Code::Handle(zone, tts_type.type_test_stub());
1352 const auto& new_code = Code::Handle(
1353 zone, TypeTestingStubGenerator::SpecializeStubFor(thread, tts_type));
1354 ASSERT(old_code.ptr() != new_code.ptr());
1355 // A specialized stub should always respecialize to a non-default stub.
1356 ASSERT(new_code.ptr() != StubCode::DefaultNullableTypeTest().ptr() &&
1357 new_code.ptr() != StubCode::DefaultTypeTest().ptr());
1358 const auto& old_instructions =
1359 Instructions::Handle(old_code.instructions());
1360 const auto& new_instructions =
1361 Instructions::Handle(new_code.instructions());
1362 // Check if specialization produced exactly the same sequence of
1363 // instructions. If it did, then we have a false negative, which can
1364 // happen in some cases involving uninstantiated types. In these cases,
1365 // update the cache, because the only case in which these false negatives
1366 // could possibly turn into true positives is with reloads, which clear
1367 // all the SubtypeTestCaches.
1368 should_update_cache = old_instructions.Equals(new_instructions);
1369 if (FLAG_trace_type_checks) {
1370 THR_Print(" %s rebuilt type testing stub for %s\n",
1371 should_update_cache ? "Discarding" : "Installing",
1372 tts_type.ToCString());
1373 }
1374 if (!should_update_cache) {
1375 tts_type.SetTypeTestingStub(new_code);
1376 }
1377 }
1378#endif // !defined(DART_PRECOMPILED_RUNTIME)
1379#endif // !defined(TARGET_ARCH_IA32)
1380
1381 if (should_update_cache) {
1382 if (cache.IsNull()) {
1383#if !defined(TARGET_ARCH_IA32)
1384 ASSERT(mode == kTypeCheckFromSlowStub ||
1385 (mode == kTypeCheckFromLazySpecializeStub &&
1386 would_update_cache_if_not_lazy));
1387 // We lazily create [SubtypeTestCache] for those call sites which actually
1388 // need one and will patch the pool entry.
1389 DartFrameIterator iterator(thread,
1390 StackFrameIterator::kNoCrossThreadIteration);
1391 StackFrame* caller_frame = iterator.NextFrame();
1392 const Code& caller_code =
1393 Code::Handle(zone, caller_frame->LookupDartCode());
1394 const ObjectPool& pool =
1395 ObjectPool::Handle(zone, caller_code.GetObjectPool());
1396 TypeTestingStubCallPattern tts_pattern(caller_frame->pc());
1397 const intptr_t stc_pool_idx = tts_pattern.GetSubtypeTestCachePoolIndex();
1398 // Ensure we do have a STC (lazily create it if not) and all threads use
1399 // the same STC.
1400 {
1401 SafepointMutexLocker ml(isolate->group()->subtype_test_cache_mutex());
1402 cache ^= pool.ObjectAt<std::memory_order_acquire>(stc_pool_idx);
1403 if (cache.IsNull()) {
1404 resolve_dst_name();
1405 // If this is a dynamic AssertAssignable check, then we must assume
1406 // all inputs may be needed, as the type may vary from call to call.
1407 const intptr_t num_inputs =
1408 dst_name.ptr() ==
1409 Symbols::dynamic_assert_assignable_stc_check().ptr()
1410 ? SubtypeTestCache::kMaxInputs
1411 : SubtypeTestCache::UsedInputsForType(dst_type);
1412 cache = SubtypeTestCache::New(num_inputs);
1413 pool.SetObjectAt<std::memory_order_release>(stc_pool_idx, cache);
1414 if (FLAG_trace_type_checks) {
1415 THR_Print(" Installed new subtype test cache %#" Px " with %" Pd
1416 " inputs at index %" Pd " of pool for %s\n",
1417 static_cast<uword>(cache.ptr()), num_inputs, stc_pool_idx,
1418 caller_code.ToCString());
1419 }
1420 }
1421 }
1422#else
1423 UNREACHABLE();
1424#endif
1425 }
1426
1427 UpdateTypeTestCache(zone, thread, src_instance, dst_type,
1428 instantiator_type_arguments, function_type_arguments,
1429 Bool::True(), cache);
1430 }
1431
1432 arguments.SetReturn(src_instance);
1433}
bool IsDynamicType() const
Definition object.h:9166
bool IsAssignableTo(const AbstractType &other, const TypeArguments &other_instantiator_type_arguments, const TypeArguments &other_function_type_arguments) const
Definition object.cc:20670
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 Enable an endless trace buffer The default is a ring buffer This is useful when very old events need to viewed For during application launch Memory usage will continue to grow indefinitely however Start app with an specific route defined on the framework flutter assets Path to the Flutter assets directory enable service port Allow the VM service to fallback to automatic port selection if binding to a specified port fails trace Trace early application lifecycle Automatically switches to an endless trace buffer trace skia Filters out all Skia trace event categories except those that are specified in this comma separated list dump skp on shader Automatically dump the skp that triggers new shader compilations This is useful for writing custom ShaderWarmUp to reduce jank By this is not enabled to reduce the overhead purge persistent cache
Definition switches.h:191

◆ DEFINE_RUNTIME_ENTRY() [56/57]

dart::DEFINE_RUNTIME_ENTRY ( UpdateFieldCid  ,
 
)

Definition at line 3813 of file runtime_entry.cc.

3813 {
3814#if !defined(DART_PRECOMPILED_RUNTIME)
3815 const Field& field = Field::CheckedHandle(zone, arguments.ArgAt(0));
3816 const Object& value = Object::Handle(arguments.ArgAt(1));
3817 field.RecordStore(value);
3818#else
3819 UNREACHABLE();
3820#endif
3821}

◆ DEFINE_RUNTIME_ENTRY() [57/57]

dart::DEFINE_RUNTIME_ENTRY ( WriteError  ,
 
)

Definition at line 166 of file runtime_entry.cc.

166 {
167 const Instance& receiver = Instance::CheckedHandle(zone, arguments.ArgAt(0));
168 const Smi& kind = Smi::CheckedHandle(zone, arguments.ArgAt(1));
169 auto& message = String::Handle(zone);
170 switch (kind.Value()) {
171 case 0: // CheckWritableInstr::Kind::kWriteUnmodifiableTypedData:
172 message = String::NewFormatted("Cannot modify an unmodifiable list: %s",
173 receiver.ToCString());
174 break;
175 case 1: // CheckWritableInstr::Kind::kDeeplyImmutableAttachNativeFinalizer:
176 message = String::NewFormatted(
177 "Cannot attach NativeFinalizer to deeply immutable object: %s",
178 receiver.ToCString());
179 break;
180 }
181 const Array& args = Array::Handle(Array::New(1));
182 args.SetAt(0, message);
183 Exceptions::ThrowByType(Exceptions::kUnsupported, args);
184}

◆ DEFINE_RUNTIME_ENTRY_NO_LAZY_DEOPT() [1/8]

dart::DEFINE_RUNTIME_ENTRY_NO_LAZY_DEOPT ( AllocateDouble  ,
 
)

Definition at line 421 of file runtime_entry.cc.

421 {
422 if (FLAG_shared_slow_path_triggers_gc) {
423 isolate->group()->heap()->CollectAllGarbage(GCReason::kDebugging);
424 }
425 arguments.SetReturn(
426 Object::Handle(zone, Double::New(0.0, SpaceForRuntimeAllocation())));
427 RuntimeAllocationEpilogue(thread);
428}

◆ DEFINE_RUNTIME_ENTRY_NO_LAZY_DEOPT() [2/8]

dart::DEFINE_RUNTIME_ENTRY_NO_LAZY_DEOPT ( AllocateFloat32x4  ,
 
)

Definition at line 460 of file runtime_entry.cc.

460 {
461 if (FLAG_shared_slow_path_triggers_gc) {
462 isolate->group()->heap()->CollectAllGarbage(GCReason::kDebugging);
463 }
464 arguments.SetReturn(Object::Handle(
465 zone, Float32x4::New(0.0, 0.0, 0.0, 0.0, SpaceForRuntimeAllocation())));
466 RuntimeAllocationEpilogue(thread);
467}

◆ DEFINE_RUNTIME_ENTRY_NO_LAZY_DEOPT() [3/8]

dart::DEFINE_RUNTIME_ENTRY_NO_LAZY_DEOPT ( AllocateFloat64x2  ,
 
)

Definition at line 469 of file runtime_entry.cc.

469 {
470 if (FLAG_shared_slow_path_triggers_gc) {
471 isolate->group()->heap()->CollectAllGarbage(GCReason::kDebugging);
472 }
473 arguments.SetReturn(Object::Handle(
474 zone, Float64x2::New(0.0, 0.0, SpaceForRuntimeAllocation())));
475 RuntimeAllocationEpilogue(thread);
476}

◆ DEFINE_RUNTIME_ENTRY_NO_LAZY_DEOPT() [4/8]

dart::DEFINE_RUNTIME_ENTRY_NO_LAZY_DEOPT ( AllocateInt32x4  ,
 
)

Definition at line 478 of file runtime_entry.cc.

478 {
479 if (FLAG_shared_slow_path_triggers_gc) {
480 isolate->group()->heap()->CollectAllGarbage(GCReason::kDebugging);
481 }
482 arguments.SetReturn(Object::Handle(
483 zone, Int32x4::New(0, 0, 0, 0, SpaceForRuntimeAllocation())));
484 RuntimeAllocationEpilogue(thread);
485}

◆ DEFINE_RUNTIME_ENTRY_NO_LAZY_DEOPT() [5/8]

dart::DEFINE_RUNTIME_ENTRY_NO_LAZY_DEOPT ( AllocateMint  ,
 
)

Definition at line 451 of file runtime_entry.cc.

451 {
452 if (FLAG_shared_slow_path_triggers_gc) {
453 isolate->group()->heap()->CollectAllGarbage(GCReason::kDebugging);
454 }
455 arguments.SetReturn(Object::Handle(
456 zone, Integer::New(kMaxInt64, SpaceForRuntimeAllocation())));
457 RuntimeAllocationEpilogue(thread);
458}

◆ DEFINE_RUNTIME_ENTRY_NO_LAZY_DEOPT() [6/8]

dart::DEFINE_RUNTIME_ENTRY_NO_LAZY_DEOPT ( BoxDouble  ,
 
)

Definition at line 430 of file runtime_entry.cc.

430 {
431 const double val = thread->unboxed_double_runtime_arg();
432 arguments.SetReturn(
433 Object::Handle(zone, Double::New(val, SpaceForRuntimeAllocation())));
435}

◆ DEFINE_RUNTIME_ENTRY_NO_LAZY_DEOPT() [7/8]

dart::DEFINE_RUNTIME_ENTRY_NO_LAZY_DEOPT ( BoxFloat32x4  ,
 
)

Definition at line 437 of file runtime_entry.cc.

437 {
438 const auto val = thread->unboxed_simd128_runtime_arg();
439 arguments.SetReturn(
440 Object::Handle(zone, Float32x4::New(val, SpaceForRuntimeAllocation())));
442}

◆ DEFINE_RUNTIME_ENTRY_NO_LAZY_DEOPT() [8/8]

dart::DEFINE_RUNTIME_ENTRY_NO_LAZY_DEOPT ( BoxFloat64x2  ,
 
)

Definition at line 444 of file runtime_entry.cc.

444 {
445 const auto val = thread->unboxed_simd128_runtime_arg();
446 arguments.SetReturn(
447 Object::Handle(zone, Float64x2::New(val, SpaceForRuntimeAllocation())));
449}

◆ DeleteRegion()

static void dart::DeleteRegion ( const MemoryRegion region)
static

Definition at line 16 of file memory_region_test.cc.

16 {
17 delete[] reinterpret_cast<uint8_t*>(region.pointer());
18}

◆ DeleteResource()

void dart::DeleteResource ( intptr_t *  resource)

Definition at line 1167 of file ffi_test_functions_vmspecific.cc.

1167 {
1168 delete resource;
1169}

◆ DeleteThread()

static void dart::DeleteThread ( void *  thread)
static

Definition at line 172 of file os_thread.cc.

172 {
173 MSAN_UNPOISON(&thread, sizeof(thread));
174 delete reinterpret_cast<OSThread*>(thread);
175}

◆ DeleteWeakHandleOnFinalization()

static void dart::DeleteWeakHandleOnFinalization ( void *  isolate_callback_data,
void *  peer 
)
static

Definition at line 4027 of file dart_api_impl_test.cc.

4028 {
4029 *static_cast<int*>(peer) = 42;
4030 Dart_DeleteWeakPersistentHandle(delete_on_finalization);
4031 delete_on_finalization = nullptr;
4032}
Dart_WeakPersistentHandle delete_on_finalization

◆ DeoptimizeAt()

void dart::DeoptimizeAt ( Thread mutator_thread,
const Code optimized_code,
StackFrame frame 
)

Definition at line 3396 of file runtime_entry.cc.

3398 {
3399 ASSERT(optimized_code.is_optimized());
3400
3401 // Force-optimized code is optimized code which cannot deoptimize and doesn't
3402 // have unoptimized code to fall back to.
3403 ASSERT(!optimized_code.is_force_optimized());
3404
3405 Thread* thread = Thread::Current();
3406 Zone* zone = thread->zone();
3407 const Function& function = Function::Handle(zone, optimized_code.function());
3408 const Error& error =
3409 Error::Handle(zone, Compiler::EnsureUnoptimizedCode(thread, function));
3410 if (!error.IsNull()) {
3411 Exceptions::PropagateError(error);
3412 }
3413 const Code& unoptimized_code =
3414 Code::Handle(zone, function.unoptimized_code());
3415 ASSERT(!unoptimized_code.IsNull());
3416 // The switch to unoptimized code may have already occurred.
3417 if (function.HasOptimizedCode()) {
3418 function.SwitchToUnoptimizedCode();
3419 }
3420
3421 if (IsSuspendedFrame(zone, function, frame)) {
3422 // Frame is suspended and going to be removed from the stack.
3423 if (FLAG_trace_deoptimization) {
3424 THR_Print("Not deoptimizing suspended frame, fp=%" Pp "\n", frame->fp());
3425 }
3426 } else if (frame->IsMarkedForLazyDeopt()) {
3427 // Deopt already scheduled.
3428 if (FLAG_trace_deoptimization) {
3429 THR_Print("Lazy deopt already scheduled for fp=%" Pp "\n", frame->fp());
3430 }
3431 } else {
3432 uword deopt_pc = frame->pc();
3433 ASSERT(optimized_code.ContainsInstructionAt(deopt_pc));
3434
3435#if defined(DEBUG)
3436 ValidateFrames();
3437#endif
3438
3439 // N.B.: Update the pending deopt table before updating the frame. The
3440 // profiler may attempt a stack walk in between.
3441 mutator_thread->pending_deopts().AddPendingDeopt(frame->fp(), deopt_pc);
3442 frame->MarkForLazyDeopt();
3443
3444 if (FLAG_trace_deoptimization) {
3445 THR_Print("Lazy deopt scheduled for fp=%" Pp ", pc=%" Pp "\n",
3446 frame->fp(), deopt_pc);
3447 }
3448 }
3449
3450 // Mark code as dead (do not GC its embedded objects).
3451 optimized_code.set_is_alive(false);
3452}
bool is_force_optimized() const
Definition object.h:6798
void set_is_alive(bool value) const
Definition object.cc:17708
void AddPendingDeopt(uword fp, uword pc)
static bool IsSuspendedFrame(Zone *zone, const Function &function, StackFrame *frame)

◆ DeoptimizeFunctionsOnStack()

void dart::DeoptimizeFunctionsOnStack ( )

Definition at line 3456 of file runtime_entry.cc.

3456 {
3457 auto thread = Thread::Current();
3458 // Have to grab program_lock before stopping everybody else.
3459 SafepointWriteRwLocker ml(thread, thread->isolate_group()->program_lock());
3460
3461 auto isolate_group = thread->isolate_group();
3462 isolate_group->RunWithStoppedMutators([&]() {
3463 Code& optimized_code = Code::Handle();
3464 isolate_group->ForEachIsolate(
3465 [&](Isolate* isolate) {
3466 auto mutator_thread = isolate->mutator_thread();
3467 if (mutator_thread == nullptr) {
3468 return;
3469 }
3470 DartFrameIterator iterator(
3471 mutator_thread, StackFrameIterator::kAllowCrossThreadIteration);
3472 StackFrame* frame = iterator.NextFrame();
3473 while (frame != nullptr) {
3474 optimized_code = frame->LookupDartCode();
3475 if (optimized_code.is_optimized() &&
3476 !optimized_code.is_force_optimized()) {
3477 DeoptimizeAt(mutator_thread, optimized_code, frame);
3478 }
3479 frame = iterator.NextFrame();
3480 }
3481 },
3482 /*at_safepoint=*/true);
3483 });
3484}
Thread * mutator_thread() const
Definition isolate.cc:1884

◆ DeoptimizeLastDartFrameIfOptimized()

static void dart::DeoptimizeLastDartFrameIfOptimized ( )
static

Definition at line 3486 of file runtime_entry.cc.

3486 {
3487 auto thread = Thread::Current();
3488 // Have to grab program_lock before stopping everybody else.
3489 SafepointWriteRwLocker ml(thread, thread->isolate_group()->program_lock());
3490
3491 auto isolate = thread->isolate();
3492 auto isolate_group = thread->isolate_group();
3493 isolate_group->RunWithStoppedMutators([&]() {
3494 auto mutator_thread = isolate->mutator_thread();
3495 if (mutator_thread == nullptr) {
3496 return;
3497 }
3498 DartFrameIterator iterator(mutator_thread,
3499 StackFrameIterator::kNoCrossThreadIteration);
3500 StackFrame* frame = iterator.NextFrame();
3501 if (frame != nullptr) {
3502 const auto& optimized_code = Code::Handle(frame->LookupDartCode());
3503 if (optimized_code.is_optimized() &&
3504 !optimized_code.is_force_optimized()) {
3505 DeoptimizeAt(mutator_thread, optimized_code, frame);
3506 }
3507 }
3508 });
3509}

◆ DeoptimizeToArray()

static ArrayPtr dart::DeoptimizeToArray ( Thread thread,
StackFrame frame,
const Code code 
)
static

Definition at line 1648 of file debugger.cc.

1650 {
1651 ASSERT(code.is_optimized() && !code.is_force_optimized());
1652 Isolate* isolate = thread->isolate();
1653 // Create the DeoptContext for this deoptimization.
1654 DeoptContext* deopt_context =
1655 new DeoptContext(frame, code, DeoptContext::kDestIsAllocated, nullptr,
1656 nullptr, true, false /* deoptimizing_code */);
1657 isolate->set_deopt_context(deopt_context);
1658
1659 deopt_context->FillDestFrame();
1660 deopt_context->MaterializeDeferredObjects();
1661 const Array& dest_frame =
1662 Array::Handle(thread->zone(), deopt_context->DestFrameAsArray());
1663
1664 isolate->set_deopt_context(nullptr);
1665 delete deopt_context;
1666
1667 return dest_frame.ptr();
1668}
intptr_t MaterializeDeferredObjects()

◆ DeoptimizeTypeTestingStubs()

void dart::DeoptimizeTypeTestingStubs ( )

Definition at line 1528 of file type_testing_stubs.cc.

1528 {
1529 class CollectTypes : public ObjectVisitor {
1530 public:
1531 CollectTypes(Zone* zone, GrowableArray<AbstractType*>* types)
1532 : zone_(zone), types_(types), cache_(SubtypeTestCache::Handle(zone)) {}
1533
1534 void VisitObject(ObjectPtr object) {
1535 // Only types and record types may have optimized TTSes,
1536 // see TypeTestingStubGenerator::OptimizedCodeForType.
1537 if (object->IsType() || object->IsRecordType()) {
1538 types_->Add(&AbstractType::CheckedHandle(zone_, object));
1539 } else if (object->IsSubtypeTestCache()) {
1540 cache_ ^= object;
1541 cache_.Reset();
1542 }
1543 }
1544
1545 private:
1546 Zone* const zone_;
1547 GrowableArray<AbstractType*>* const types_;
1548 TypeTestingStubGenerator generator_;
1549 SubtypeTestCache& cache_;
1550 };
1551
1552 Thread* thread = Thread::Current();
1553 TIMELINE_DURATION(thread, Isolate, "DeoptimizeTypeTestingStubs");
1554 HANDLESCOPE(thread);
1555 Zone* zone = thread->zone();
1556 GrowableArray<AbstractType*> types(zone, 0);
1557 {
1558 HeapIterationScope iter(thread);
1559 CollectTypes visitor(zone, &types);
1560 iter.IterateObjects(&visitor);
1561 }
1562 auto& stub = Code::Handle(zone);
1563 for (auto* const type : types) {
1564 stub = TypeTestingStubGenerator::DefaultCodeForType(*type);
1565 type->SetTypeTestingStub(stub);
1566 }
1567}
virtual void VisitObject(ObjectPtr obj)=0

◆ DeoptReasonToCString()

const char * dart::DeoptReasonToCString ( ICData::DeoptReasonId  deopt_reason)

Definition at line 3369 of file runtime_entry.cc.

3369 {
3370 switch (deopt_reason) {
3371#define DEOPT_REASON_TO_TEXT(name) \
3372 case ICData::kDeopt##name: \
3373 return #name;
3375#undef DEOPT_REASON_TO_TEXT
3376 default:
3377 UNREACHABLE();
3378 return "";
3379 }
3380}
#define DEOPT_REASONS(V)
Definition object.h:2473
#define DEOPT_REASON_TO_TEXT(name)

◆ DependOnSameSymbol()

static bool dart::DependOnSameSymbol ( const RangeBoundary a,
const RangeBoundary b 
)
static

Definition at line 326 of file range_analysis.cc.

326 {
327 return a.IsSymbol() && b.IsSymbol() &&
328 AreEqualDefinitions(a.symbol(), b.symbol());
329}
static bool AreEqualDefinitions(Definition *a, Definition *b)

◆ DependsOnSymbol()

static bool dart::DependsOnSymbol ( const RangeBoundary a,
Definition symbol 
)
static

Definition at line 2671 of file range_analysis.cc.

2671 {
2672 return a.IsSymbol() && (UnwrapConstraint(a.symbol()) == symbol);
2673}

◆ DeserializeMessage()

static ObjectPtr dart::DeserializeMessage ( Thread thread,
Message message 
)
static

Definition at line 528 of file isolate.cc.

528 {
529 if (message == nullptr) {
530 return Object::null();
531 }
532 if (message->IsRaw()) {
533 return Object::RawCast(message->raw_obj());
534 } else {
535 return ReadMessage(thread, message);
536 }
537}

◆ DeterminedAlready()

static bool dart::DeterminedAlready ( QuickCheckDetails quick_check,
intptr_t  offset 
)
static

Definition at line 2351 of file regexp.cc.

2351 {
2352 if (quick_check == nullptr) return false;
2353 if (offset >= quick_check->characters()) return false;
2354 return quick_check->positions(offset)->determines_perfectly;
2355}
intptr_t characters()
Definition regexp.h:359
Position * positions(intptr_t index)
Definition regexp.h:361

◆ DeterministicModeHandler()

static void dart::DeterministicModeHandler ( bool  value)
static

Definition at line 80 of file isolate.cc.

80 {
81 if (value) {
82 FLAG_background_compilation = false; // Timing dependent.
83 FLAG_concurrent_mark = false; // Timing dependent.
84 FLAG_concurrent_sweep = false; // Timing dependent.
85 FLAG_scavenger_tasks = 0; // Timing dependent.
86 FLAG_old_gen_growth_time_ratio = 0; // Timing dependent.
87 FLAG_random_seed = 0x44617274; // "Dart"
88 }
89}

◆ DevNullFloat()

DART_EXPORT void dart::DevNullFloat ( float  a)

Definition at line 823 of file ffi_test_functions.cc.

823 {
824 std::cout << "DevNullFloat(" << a << ")\n";
825 std::cout << "returning nothing\n";
826}

◆ DFLRT_EnterSafepoint()

void dart::DFLRT_EnterSafepoint ( NativeArguments  __unusable_)

Definition at line 3959 of file runtime_entry.cc.

3959 {
3961 TRACE_RUNTIME_CALL("%s", "EnterSafepoint");
3962 Thread* thread = Thread::Current();
3963 ASSERT(thread->top_exit_frame_info() != 0);
3964 ASSERT(thread->execution_state() == Thread::kThreadInNative);
3965 thread->EnterSafepoint();
3966 TRACE_RUNTIME_CALL("%s", "EnterSafepoint done");
3967}
void EnterSafepoint()
Definition thread.h:1063
ExecutionState execution_state() const
Definition thread.h:1027
#define CHECK_STACK_ALIGNMENT

◆ DFLRT_ExitSafepoint()

void dart::DFLRT_ExitSafepoint ( NativeArguments  __unusable_)

Definition at line 3973 of file runtime_entry.cc.

3973 {
3975 TRACE_RUNTIME_CALL("%s", "ExitSafepoint");
3976 Thread* thread = Thread::Current();
3977 ASSERT(thread->top_exit_frame_info() != 0);
3978
3979 ASSERT(thread->execution_state() == Thread::kThreadInVM);
3980 if (thread->is_unwind_in_progress()) {
3981 // Clean up safepoint unwind error marker to prevent safepoint tripping.
3982 // The safepoint marker will get restored just before jumping back
3983 // to generated code.
3984 thread->SetUnwindErrorInProgress(false);
3985 NoSafepointScope no_safepoint;
3986 Error unwind_error;
3987 unwind_error ^=
3988 thread->isolate()->isolate_object_store()->preallocated_unwind_error();
3989 Exceptions::PropagateError(unwind_error);
3990 }
3991 thread->ExitSafepoint();
3992
3993 TRACE_RUNTIME_CALL("%s", "ExitSafepoint done");
3994}
IsolateObjectStore * isolate_object_store() const
Definition isolate.h:960
void SetUnwindErrorInProgress(bool value)
Definition thread.h:1003
void ExitSafepoint()
Definition thread.h:1081
bool is_unwind_in_progress() const
Definition thread.h:638

◆ DFLRT_ExitSafepointIgnoreUnwindInProgress()

void dart::DFLRT_ExitSafepointIgnoreUnwindInProgress ( NativeArguments  __unusable_)

Definition at line 4002 of file runtime_entry.cc.

4003 {
4005 TRACE_RUNTIME_CALL("%s", "ExitSafepointIgnoreUnwindInProgress");
4006 Thread* thread = Thread::Current();
4007 ASSERT(thread->top_exit_frame_info() != 0);
4008
4009 ASSERT(thread->execution_state() == Thread::kThreadInVM);
4010
4011 // Compared to ExitSafepoint above we are going to ignore
4012 // is_unwind_in_progress flag because this is called as part of JumpToFrame
4013 // exception handler - we want this transition to complete so that the next
4014 // safepoint check does error propagation.
4015 thread->ExitSafepoint();
4016
4017 TRACE_RUNTIME_CALL("%s", "ExitSafepointIgnoreUnwindInProgress done");
4018}

◆ DLRT_AllocateHandle()

LocalHandle * dart::DLRT_AllocateHandle ( ApiLocalScope scope)

Definition at line 4179 of file runtime_entry.cc.

4179 {
4181 TRACE_RUNTIME_CALL("AllocateHandle %p", scope);
4182 LocalHandle* return_value = scope->local_handles()->AllocateHandle();
4183 // Don't return an uninitialised handle.
4184 return_value->set_ptr(Object::sentinel().ptr());
4185 TRACE_RUNTIME_CALL("AllocateHandle returning %p", return_value);
4186 return return_value;
4187}
LocalHandles * local_handles()
void set_ptr(ObjectPtr ptr)
LocalHandle * AllocateHandle()

◆ DLRT_EnterHandleScope()

ApiLocalScope * dart::DLRT_EnterHandleScope ( Thread thread)

Definition at line 4155 of file runtime_entry.cc.

4155 {
4157 TRACE_RUNTIME_CALL("EnterHandleScope %p", thread);
4158 thread->EnterApiScope();
4159 ApiLocalScope* return_value = thread->api_top_scope();
4160 TRACE_RUNTIME_CALL("EnterHandleScope returning %p", return_value);
4161 return return_value;
4162}

◆ DLRT_ExitHandleScope()

void dart::DLRT_ExitHandleScope ( Thread thread)

Definition at line 4168 of file runtime_entry.cc.

4168 {
4170 TRACE_RUNTIME_CALL("ExitHandleScope %p", thread);
4171 thread->ExitApiScope();
4172 TRACE_RUNTIME_CALL("ExitHandleScope %s", "done");
4173}

◆ DLRT_ExitTemporaryIsolate()

void dart::DLRT_ExitTemporaryIsolate ( )

Definition at line 4131 of file runtime_entry.cc.

4131 {
4132 TRACE_RUNTIME_CALL("ExitTemporaryIsolate%s", "");
4133 Thread* thread = Thread::Current();
4134 ASSERT(thread != nullptr);
4135 Isolate* source_isolate =
4136 reinterpret_cast<Isolate*>(thread->unboxed_int64_runtime_second_arg());
4137
4138 // We're either inside a temp isolate, or inside the source_isolate.
4139 const bool inside_temp_isolate =
4140 source_isolate == nullptr || source_isolate != thread->isolate();
4141 if (inside_temp_isolate) {
4142 IsolateGroup::ExitTemporaryIsolate();
4143 if (source_isolate != nullptr) {
4144 TRACE_RUNTIME_CALL("ExitTemporaryIsolate re-entering source isolate %p",
4145 source_isolate);
4146 Thread::EnterIsolate(source_isolate);
4147 Thread::Current()->EnterSafepoint();
4148 }
4149 } else {
4150 thread->EnterSafepoint();
4151 }
4152 TRACE_RUNTIME_CALL("ExitTemporaryIsolate %s", "done");
4153}
int64_t unboxed_int64_runtime_second_arg() const
Definition thread.h:818

◆ DLRT_GetFfiCallbackMetadata()

Thread * dart::DLRT_GetFfiCallbackMetadata ( FfiCallbackMetadata::Trampoline  trampoline,
uword out_entry_point,
uword out_trampoline_type 
)

Definition at line 4027 of file runtime_entry.cc.

4030 {
4032 TRACE_RUNTIME_CALL("GetFfiCallbackMetadata %p",
4033 reinterpret_cast<void*>(trampoline));
4034 ASSERT(out_entry_point != nullptr);
4035 ASSERT(out_trampoline_type != nullptr);
4036
4037 Thread* const current_thread = Thread::Current();
4038 auto* fcm = FfiCallbackMetadata::Instance();
4039 auto metadata = fcm->LookupMetadataForTrampoline(trampoline);
4040
4041 // Is this an async callback?
4042 if (metadata.trampoline_type() ==
4043 FfiCallbackMetadata::TrampolineType::kAsync) {
4044 // It's possible that the callback was deleted, or the target isolate was
4045 // shut down, in between looking up the metadata above, and this point. So
4046 // grab the lock and then check that the callback is still alive.
4047 MutexLocker locker(fcm->lock());
4048 auto metadata2 = fcm->LookupMetadataForTrampoline(trampoline);
4049 *out_trampoline_type = static_cast<uword>(metadata2.trampoline_type());
4050
4051 // Check IsLive, but also check that the metdata hasn't changed. This is
4052 // for the edge case that the callback was destroyed and recycled in between
4053 // the two lookups.
4054 if (!metadata.IsLive() || !metadata.IsSameCallback(metadata2)) {
4055 TRACE_RUNTIME_CALL("GetFfiCallbackMetadata callback deleted %p",
4056 reinterpret_cast<void*>(trampoline));
4057 return nullptr;
4058 }
4059
4060 *out_entry_point = metadata.target_entry_point();
4061 Isolate* target_isolate = metadata.target_isolate();
4062
4063 Isolate* current_isolate = nullptr;
4064 if (current_thread != nullptr) {
4065 current_isolate = current_thread->isolate();
4066 ASSERT(current_thread->execution_state() == Thread::kThreadInNative);
4067 current_thread->ExitSafepoint();
4068 current_thread->set_execution_state(Thread::kThreadInVM);
4069 }
4070
4071 // Enter the temporary isolate. If the current isolate is in the same group
4072 // as the target isolate, we can skip entering the temp isolate, and marshal
4073 // the args on the current isolate.
4074 if (current_isolate == nullptr ||
4075 current_isolate->group() != target_isolate->group()) {
4076 if (current_isolate != nullptr) {
4077 Thread::ExitIsolate(/*isolate_shutdown=*/false);
4078 }
4079 target_isolate->group()->EnterTemporaryIsolate();
4080 }
4081 Thread* const temp_thread = Thread::Current();
4082 ASSERT(temp_thread != nullptr);
4083 temp_thread->set_unboxed_int64_runtime_arg(metadata.send_port());
4084 temp_thread->set_unboxed_int64_runtime_second_arg(
4085 reinterpret_cast<intptr_t>(current_isolate));
4086 ASSERT(!temp_thread->IsAtSafepoint());
4087 return temp_thread;
4088 }
4089
4090 // Otherwise, this is a sync callback, so verify that we're already entered
4091 // into the target isolate.
4092 if (!metadata.IsLive()) {
4093 FATAL("Callback invoked after it has been deleted.");
4094 }
4095 Isolate* target_isolate = metadata.target_isolate();
4096 *out_entry_point = metadata.target_entry_point();
4097 *out_trampoline_type = static_cast<uword>(metadata.trampoline_type());
4098 if (current_thread == nullptr) {
4099 FATAL("Cannot invoke native callback outside an isolate.");
4100 }
4101 if (current_thread->no_callback_scope_depth() != 0) {
4102 FATAL("Cannot invoke native callback when API callbacks are prohibited.");
4103 }
4104 if (current_thread->is_unwind_in_progress()) {
4105 FATAL("Cannot invoke native callback while unwind error propagates.");
4106 }
4107 if (!current_thread->IsDartMutatorThread()) {
4108 FATAL("Native callbacks must be invoked on the mutator thread.");
4109 }
4110 if (current_thread->isolate() != target_isolate) {
4111 FATAL("Cannot invoke native callback from a different isolate.");
4112 }
4113
4114 // Set the execution state to VM while waiting for the safepoint to end.
4115 // This isn't strictly necessary but enables tests to check that we're not
4116 // in native code anymore. See tests/ffi/function_gc_test.dart for example.
4117 current_thread->set_execution_state(Thread::kThreadInVM);
4118
4119 current_thread->ExitSafepoint();
4120
4121 current_thread->set_unboxed_int64_runtime_arg(metadata.context());
4122
4123 TRACE_RUNTIME_CALL("GetFfiCallbackMetadata thread %p", current_thread);
4124 TRACE_RUNTIME_CALL("GetFfiCallbackMetadata entry_point %p",
4125 (void*)*out_entry_point);
4126 TRACE_RUNTIME_CALL("GetFfiCallbackMetadata trampoline_type %p",
4127 (void*)*out_trampoline_type);
4128 return current_thread;
4129}
void set_execution_state(ExecutionState state)
Definition thread.h:1035
int32_t no_callback_scope_depth() const
Definition thread.h:618
bool IsDartMutatorThread() const
Definition thread.h:546

◆ DLRT_PropagateError()

void dart::DLRT_PropagateError ( Dart_Handle  handle)

Definition at line 4203 of file runtime_entry.cc.

4203 {
4205 TRACE_RUNTIME_CALL("PropagateError %p", handle);
4206 ASSERT(Thread::Current()->execution_state() == Thread::kThreadInNative);
4207 ASSERT(Dart_IsError(handle));
4208 Dart_PropagateError(handle);
4209 // We should never exit through normal control flow.
4210 UNREACHABLE();
4211}

◆ DominatesPhi()

static bool dart::DominatesPhi ( BlockEntryInstr a,
BlockEntryInstr phi_block 
)
static

Definition at line 2734 of file range_analysis.cc.

2734 {
2735 return a->Dominates(phi_block) && (a != phi_block);
2736}

◆ DontDeleteWeakHandleOnFinalization()

static void dart::DontDeleteWeakHandleOnFinalization ( void *  isolate_callback_data,
void *  peer 
)
static

Definition at line 4034 of file dart_api_impl_test.cc.

4035 {
4036 *static_cast<int*>(peer) = 42;
4037 delete_on_finalization = nullptr;
4038}

◆ DoThrowNullError()

static void dart::DoThrowNullError ( Isolate isolate,
Thread thread,
Zone zone,
bool  is_param 
)
static

Definition at line 232 of file runtime_entry.cc.

235 {
236 DartFrameIterator iterator(thread,
237 StackFrameIterator::kNoCrossThreadIteration);
238 const StackFrame* caller_frame = iterator.NextFrame();
239 ASSERT(caller_frame->IsDartFrame());
240 const Code& code = Code::Handle(zone, caller_frame->LookupDartCode());
241 const uword pc_offset = caller_frame->pc() - code.PayloadStart();
242
243 if (FLAG_shared_slow_path_triggers_gc) {
244 isolate->group()->heap()->CollectAllGarbage(GCReason::kDebugging);
245 }
246
247 const CodeSourceMap& map =
248 CodeSourceMap::Handle(zone, code.code_source_map());
249 String& member_name = String::Handle(zone);
250 if (!map.IsNull()) {
251 CodeSourceMapReader reader(map, Array::null_array(),
252 Function::null_function());
253 const intptr_t name_index = reader.GetNullCheckNameIndexAt(pc_offset);
254 RELEASE_ASSERT(name_index >= 0);
255
256 const ObjectPool& pool = ObjectPool::Handle(zone, code.GetObjectPool());
257 member_name ^= pool.ObjectAt(name_index);
258 } else {
259 member_name = Symbols::OptimizedOut().ptr();
260 }
261
262 NullErrorHelper(zone, member_name, is_param);
263}

◆ double_to_uint64()

static uint64_t dart::double_to_uint64 ( double  d)
static

Definition at line 13 of file double_internals.h.

13 {
14 return bit_cast<uint64_t>(d);
15}

◆ DoubleToCString()

void dart::DoubleToCString ( double  d,
char *  buffer,
int  buffer_size 
)

Definition at line 19 of file double_conversion.cc.

19 {
20 const int kDecimalLow = -6;
21 const int kDecimalHigh = 21;
22
23 // The output contains the sign, at most kDecimalHigh - 1 digits,
24 // the decimal point followed by a 0 plus the \0.
25 ASSERT(buffer_size >= 1 + (kDecimalHigh - 1) + 1 + 1 + 1);
26 // Or it contains the sign, a 0, the decimal point, kDecimalLow '0's,
27 // 17 digits (the precision needed for doubles), plus the \0.
28 ASSERT(buffer_size >= 1 + 1 + 1 + kDecimalLow + 17 + 1);
29 // Alternatively it contains a sign, at most 17 digits (precision needed for
30 // any double), the decimal point, the exponent character, the exponent's
31 // sign, at most three exponent digits, plus the \0.
32 ASSERT(buffer_size >= 1 + 17 + 1 + 1 + 1 + 3 + 1);
33
34 const int kConversionFlags =
39
41 kConversionFlags, kInfinitySymbol, kNaNSymbol, kExponentChar, kDecimalLow,
42 kDecimalHigh, 0,
43 0); // Last two values are ignored in shortest mode.
44
46 bool status = converter.ToShortest(d, &builder);
47 ASSERT(status);
48 char* result = builder.Finalize();
50}

◆ DoubleToInteger()

IntegerPtr dart::DoubleToInteger ( Zone zone,
double  val 
)

Definition at line 170 of file double_conversion.cc.

170 {
171 if (isinf(val) || isnan(val)) {
172 const Array& args = Array::Handle(zone, Array::New(1));
173 args.SetAt(0, String::Handle(zone, String::New("Infinity or NaN toInt")));
174 Exceptions::ThrowByType(Exceptions::kUnsupported, args);
175 }
176 int64_t ival = 0;
177 if (val <= static_cast<double>(kMinInt64)) {
178 ival = kMinInt64;
179 } else if (val >= static_cast<double>(kMaxInt64)) {
180 ival = kMaxInt64;
181 } else { // Representable in int64_t.
182 ival = static_cast<int64_t>(val);
183 }
184 return Integer::New(ival);
185}

◆ DoubleToStringAsExponential()

StringPtr dart::DoubleToStringAsExponential ( double  d,
int  fraction_digits 
)

Definition at line 91 of file double_conversion.cc.

91 {
92 const int kMinFractionDigits = -1; // -1 represents shortest mode.
93 const int kMaxFractionDigits = 20;
94 const int kConversionFlags =
96 const int kBufferSize = 128;
97
98 USE(kMinFractionDigits);
99 USE(kMaxFractionDigits);
100 // The output contains the sign, at most 1 digits, the decimal point followed
101 // by at most kMaxFractionDigits digits, the exponent-character, the
102 // exponent-sign and three exponent digits plus \0.
103 ASSERT(kBufferSize >= 1 + 1 + kMaxFractionDigits + 1 + 1 + 3 + 1);
104
105 ASSERT(kMinFractionDigits <= fraction_digits &&
106 fraction_digits <= kMaxFractionDigits);
107
109 kConversionFlags, kInfinitySymbol, kNaNSymbol, kExponentChar, 0, 0, 0,
110 0); // Last four values are ignored in exponential mode.
111
112 char* buffer = Thread::Current()->zone()->Alloc<char>(kBufferSize);
113 buffer[kBufferSize - 1] = '\0';
115 bool status = converter.ToExponential(d, fraction_digits, &builder);
116 ASSERT(status);
117 return String::New(builder.Finalize());
118}
static const size_t kBufferSize
Definition SkString.cpp:27

◆ DoubleToStringAsFixed()

StringPtr dart::DoubleToStringAsFixed ( double  d,
int  fraction_digits 
)

Definition at line 52 of file double_conversion.cc.

52 {
53 const int kMinFractionDigits = 0;
54 const int kMaxFractionDigits = 20;
55 const int kMaxDigitsBeforePoint = 20;
56 // The boundaries are exclusive.
57 const double kLowerBoundary = -1e21;
58 const double kUpperBoundary = 1e21;
59 // TODO(floitsch): remove the UNIQUE_ZERO flag when the test is updated.
60 const int kConversionFlags =
62 const int kBufferSize = 128;
63
64 USE(kMaxDigitsBeforePoint);
65 USE(kMaxFractionDigits);
66 USE(kLowerBoundary);
67 USE(kUpperBoundary);
68 USE(kMinFractionDigits);
69 USE(kMaxFractionDigits);
70 // The output contains the sign, at most kMaxDigitsBeforePoint digits,
71 // the decimal point followed by at most fraction_digits digits plus the \0.
72 ASSERT(kBufferSize >= 1 + kMaxDigitsBeforePoint + 1 + kMaxFractionDigits + 1);
73
74 ASSERT(kLowerBoundary < d && d < kUpperBoundary);
75
76 ASSERT(kMinFractionDigits <= fraction_digits &&
77 fraction_digits <= kMaxFractionDigits);
78
80 kConversionFlags, kInfinitySymbol, kNaNSymbol, kExponentChar, 0, 0, 0,
81 0); // Last four values are ignored in fixed mode.
82
83 char* buffer = Thread::Current()->zone()->Alloc<char>(kBufferSize);
84 buffer[kBufferSize - 1] = '\0';
86 bool status = converter.ToFixed(d, fraction_digits, &builder);
87 ASSERT(status);
88 return String::New(builder.Finalize());
89}

◆ DoubleToStringAsPrecision()

StringPtr dart::DoubleToStringAsPrecision ( double  d,
int  precision 
)

Definition at line 120 of file double_conversion.cc.

120 {
121 const int kMinPrecisionDigits = 1;
122 const int kMaxPrecisionDigits = 21;
123 const int kMaxLeadingPaddingZeroes = 6;
124 const int kMaxTrailingPaddingZeroes = 0;
125 const int kConversionFlags =
127 const int kBufferSize = 128;
128
129 USE(kMinPrecisionDigits);
130 USE(kMaxPrecisionDigits);
131 // The output contains the sign, a potential leading 0, the decimal point,
132 // at most kMax{Leading|Trailing} padding zeroes, precision digits,
133 // the exponent-character, the exponent-sign, three exponent digits
134 // plus the \0.
135 // Note that padding and exponent are exclusive. We still add them up.
136 ASSERT(kBufferSize >= 1 + 1 + 1 + kMaxLeadingPaddingZeroes +
137 kMaxTrailingPaddingZeroes + kMaxPrecisionDigits +
138 1 + 1 + 3 + 1);
139
140 ASSERT(kMinPrecisionDigits <= precision && precision <= kMaxPrecisionDigits);
141
143 kConversionFlags, kInfinitySymbol, kNaNSymbol, kExponentChar, 0,
144 0, // Ignored in precision mode.
145 kMaxLeadingPaddingZeroes, kMaxTrailingPaddingZeroes);
146
147 char* buffer = Thread::Current()->zone()->Alloc<char>(kBufferSize);
148 buffer[kBufferSize - 1] = '\0';
150 bool status = converter.ToPrecision(d, precision, &builder);
151 ASSERT(status);
152 return String::New(builder.Finalize());
153}

◆ DRegisterOf()

static DRegister dart::DRegisterOf ( SRegister  s)
inlinestatic

Definition at line 285 of file constants_arm.h.

285 {
286 return static_cast<DRegister>(s / 2);
287}

◆ DropRegExpMatchCode()

static void dart::DropRegExpMatchCode ( Zone zone)
static

Definition at line 6719 of file dart_api_impl.cc.

6719 {
6720 const String& execute_match_name =
6721 String::Handle(zone, String::New("_ExecuteMatch"));
6722 const String& execute_match_sticky_name =
6723 String::Handle(zone, String::New("_ExecuteMatchSticky"));
6724
6725 const Library& core_lib = Library::Handle(zone, Library::CoreLibrary());
6726 const Class& reg_exp_class =
6727 Class::Handle(zone, core_lib.LookupClassAllowPrivate(Symbols::_RegExp()));
6728 ASSERT(!reg_exp_class.IsNull());
6729
6730 auto thread = Thread::Current();
6731 Function& func = Function::Handle(
6732 zone, reg_exp_class.LookupFunctionAllowPrivate(execute_match_name));
6733 ASSERT(!func.IsNull());
6734 Code& code = Code::Handle(zone);
6735 SafepointWriteRwLocker ml(thread, thread->isolate_group()->program_lock());
6736 if (func.HasCode()) {
6737 code = func.CurrentCode();
6738 ASSERT(!code.IsNull());
6739 code.DisableDartCode();
6740 }
6741 func.ClearCode();
6742 func.ClearICDataArray();
6743 ASSERT(!func.HasCode());
6744
6745 func = reg_exp_class.LookupFunctionAllowPrivate(execute_match_sticky_name);
6746 ASSERT(!func.IsNull());
6747 if (func.HasCode()) {
6748 code = func.CurrentCode();
6749 ASSERT(!code.IsNull());
6750 code.DisableDartCode();
6751 }
6752 func.ClearCode();
6753 func.ClearICDataArray();
6754 ASSERT(!func.HasCode());
6755}
FunctionPtr LookupFunctionAllowPrivate(const String &name) const
Definition object.cc:6222
CodePtr CurrentCode() const
Definition object.h:3157
bool HasCode() const
Definition object.cc:7994
void ClearCode() const
Definition object.cc:8006
void ClearICDataArray() const
Definition object.cc:11334

◆ DummyResourceFinalizer()

void dart::DummyResourceFinalizer ( void *  isolate_peer,
void *  peer 
)

Definition at line 1175 of file ffi_test_functions_vmspecific.cc.

1175 {
1176 *reinterpret_cast<intptr_t*>(peer) = 0;
1177}

◆ DumpAliveIsolates()

static void dart::DumpAliveIsolates ( intptr_t  num_attempts,
bool  only_application_isolates 
)
static

Definition at line 542 of file dart.cc.

543 {
544 IsolateGroup::ForEach([&](IsolateGroup* group) {
545 group->ForEachIsolate([&](Isolate* isolate) {
546 if (!only_application_isolates || !Isolate::IsSystemIsolate(isolate)) {
547 OS::PrintErr("Attempt:%" Pd " waiting for isolate %s to check in\n",
548 num_attempts, isolate->name());
549 }
550 });
551 });
552}

◆ DumpCompilerState()

static void dart::DumpCompilerState ( Thread thread)
static

Definition at line 460 of file profiler.cc.

460 {
461#if !defined(DART_PRECOMPILED_RUNTIME)
462 if (thread != nullptr && thread->execution_state() == Thread::kThreadInVM &&
463 thread->HasCompilerState()) {
464 thread->compiler_state().ReportCrash();
465 }
466#endif
467}
bool HasCompilerState() const
Definition thread.h:581
CompilerState & compiler_state()
Definition thread.h:583

◆ DumpFunctionTypeTable()

void dart::DumpFunctionTypeTable ( Isolate isolate)

Definition at line 27161 of file object.cc.

27161 {
27162 OS::PrintErr("canonical function types:\n");
27164 isolate->group()->object_store()->canonical_function_types());
27165 table.Dump();
27166 table.Release();
27167}

◆ DumpRecordTypeTable()

void dart::DumpRecordTypeTable ( Isolate isolate)

Definition at line 27169 of file object.cc.

27169 {
27170 OS::PrintErr("canonical record types:\n");
27172 isolate->group()->object_store()->canonical_record_types());
27173 table.Dump();
27174 table.Release();
27175}

◆ DumpStackFrame() [1/2]

void dart::DumpStackFrame ( intptr_t  frame_index,
uword  pc,
uword  fp 
)

Definition at line 77 of file profiler.cc.

77 {
78 uword start = 0;
79 // The pc for all frames except the top frame is a return address, which can
80 // belong to a different inlining interval than the call. Subtract one to get
81 // the symbolization for the call.
82 uword lookup_pc = frame_index == 0 ? pc : pc - 1;
83 if (auto const name =
84 NativeSymbolResolver::LookupSymbolName(lookup_pc, &start)) {
85 DumpStackFrame(pc, fp, name, pc - start);
86 NativeSymbolResolver::FreeSymbolName(name);
87 return;
88 }
89
90 char* dso_name;
91 uword dso_base;
92 if (NativeSymbolResolver::LookupSharedObject(pc, &dso_base, &dso_name)) {
93 DumpStackFrame(pc, fp, dso_name, pc - dso_base);
94 NativeSymbolResolver::FreeSymbolName(dso_name);
95 return;
96 }
97
98#if !defined(DART_PRECOMPILED_RUNTIME)
99 // This relies on heap iteration, which might fail if we're crashing because
100 // of heap corruption. A nested crash symbolizing a JIT frame will prevent
101 // seeing all caller frames, so only do this when we aren't able to use the
102 // safer StackFrameIterator.
103 Thread* thread = Thread::Current();
104 bool symbolize_jit_code =
105 (thread != nullptr) &&
106 (thread->execution_state() != Thread::kThreadInNative) &&
107 (thread->execution_state() != Thread::kThreadInVM);
108 if (symbolize_jit_code) {
109 Code result;
110 result = Code::FindCodeUnsafe(lookup_pc);
111 if (!result.IsNull()) {
113 pc, fp,
114 result.QualifiedName(NameFormattingParams(Object::kInternalName)),
115 pc - result.PayloadStart());
116 return;
117 }
118 }
119#endif
120
121 OS::PrintErr(" pc 0x%" Pp " fp 0x%" Pp " Unknown symbol\n", pc, fp);
122}
static void DumpStackFrame(uword pc, uword fp, const char *name, uword offset)
Definition profiler.cc:72

◆ DumpStackFrame() [2/2]

static void dart::DumpStackFrame ( uword  pc,
uword  fp,
const char *  name,
uword  offset 
)
static

Definition at line 72 of file profiler.cc.

72 {
73 OS::PrintErr(" pc 0x%" Pp " fp 0x%" Pp " %s+0x%" Px "\n", pc, fp, name,
74 offset);
75}

◆ DumpTypeArgumentsTable()

void dart::DumpTypeArgumentsTable ( Isolate isolate)

Definition at line 27185 of file object.cc.

27185 {
27186 OS::PrintErr("canonical type arguments:\n");
27188 isolate->group()->object_store()->canonical_type_arguments());
27189 table.Dump();
27190 table.Release();
27191}

◆ DumpTypeParameterTable()

void dart::DumpTypeParameterTable ( Isolate isolate)

Definition at line 27177 of file object.cc.

27177 {
27178 OS::PrintErr("canonical type parameters (cloned from declarations):\n");
27180 isolate->group()->object_store()->canonical_type_parameters());
27181 table.Dump();
27182 table.Release();
27183}

◆ DumpTypeTable()

void dart::DumpTypeTable ( Isolate isolate)

Definition at line 27154 of file object.cc.

27154 {
27155 OS::PrintErr("canonical types:\n");
27156 CanonicalTypeSet table(isolate->group()->object_store()->canonical_types());
27157 table.Dump();
27158 table.Release();
27159}

◆ DwarfStackTracesHandler()

static void dart::DwarfStackTracesHandler ( bool  value)
static

Definition at line 26568 of file object.cc.

26568 {
26569 FLAG_dwarf_stack_traces_mode = value;
26570
26571#if defined(PRODUCT)
26572 // We can safely remove function objects in precompiled snapshots if the
26573 // runtime will generate DWARF stack traces and we don't have runtime
26574 // debugging options like the observatory available.
26575 if (value) {
26576 FLAG_retain_function_objects = false;
26577 FLAG_retain_code_objects = false;
26578 }
26579#endif
26580}

◆ Echo()

static void dart::Echo ( Thread thread,
JSONStream js 
)
static

Definition at line 1785 of file service.cc.

1785 {
1786 JSONObject jsobj(js);
1787 HandleCommonEcho(&jsobj, js);
1788}
static void HandleCommonEcho(JSONObject *jsobj, JSONStream *js)
Definition service.cc:1737

◆ EchoInt()

static intptr_t dart::EchoInt ( double  x)
static

Definition at line 10116 of file dart_api_impl_test.cc.

10116 {
10117 loop_test_exit = true;
10118 ml.Notify();
static bool loop_test_exit

◆ ElideJSONSubstring()

void dart::ElideJSONSubstring ( const char *  prefix,
const char *  in,
char *  out,
const char *  postfix 
)

Definition at line 776 of file unit_test.cc.

779 {
780 const char* pos = strstr(in, prefix);
781 while (pos != nullptr) {
782 // Copy up to pos into the output buffer.
783 while (in < pos) {
784 *out++ = *in++;
785 }
786
787 // Skip to the closing postfix.
788 in += strlen(prefix);
789 in += strcspn(in, postfix);
790 pos = strstr(in, prefix);
791 }
792 // Copy the remainder of in to out.
793 while (*in != '\0') {
794 *out++ = *in++;
795 }
796 *out = '\0';
797}

◆ EliminateTrivialBlock()

static void dart::EliminateTrivialBlock ( BlockEntryInstr block,
Definition instr,
IfThenElseInstr before 
)
static

Definition at line 229 of file branch_optimizer.cc.

231 {
232 block->UnuseAllInputs();
234
235 if ((block->next() == instr) &&
236 (instr->next() == block->last_instruction())) {
237 before->previous()->LinkTo(instr);
238 instr->LinkTo(before);
239 }
240}
Instruction * last_instruction() const
Definition il.h:1680
void UnuseAllInputs()
Definition il.cc:1525

◆ EliminateWriteBarriers()

void dart::EliminateWriteBarriers ( FlowGraph flow_graph)

Definition at line 426 of file write_barrier_elimination.cc.

426 {
427 WriteBarrierElimination elimination(Thread::Current()->zone(), flow_graph);
428 elimination.Analyze();
429 elimination.SaveResults();
430}

◆ EmbedderInformationCallback()

static void dart::EmbedderInformationCallback ( Dart_EmbedderInformation info)
static

Definition at line 284 of file run_vm_tests.cc.

284 {
286 info->name = "Run VM Tests";
287 bin::Process::GetRSSInformation(&(info->max_rss), &(info->current_rss));
288}
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition DM.cpp:213
#define DART_EMBEDDER_INFORMATION_CURRENT_VERSION

◆ EmitAtomLetter()

static bool dart::EmitAtomLetter ( Zone zone,
RegExpCompiler compiler,
uint16_t  c,
BlockLabel on_failure,
intptr_t  cp_offset,
bool  check,
bool  preloaded 
)
inlinestatic

Definition at line 981 of file regexp.cc.

987 {
988 RegExpMacroAssembler* macro_assembler = compiler->macro_assembler();
989 bool one_byte = compiler->one_byte();
991 intptr_t length = GetCaseIndependentLetters(c, one_byte, chars);
992 if (length <= 1) return false;
993 // We may not need to check against the end of the input string
994 // if this character lies before a character that matched.
995 if (!preloaded) {
996 macro_assembler->LoadCurrentCharacter(cp_offset, on_failure, check);
997 }
998 BlockLabel ok;
1000 switch (length) {
1001 case 2: {
1002 if (ShortCutEmitCharacterPair(macro_assembler, one_byte, chars[0],
1003 chars[1], on_failure)) {
1004 } else {
1005 macro_assembler->CheckCharacter(chars[0], &ok);
1006 macro_assembler->CheckNotCharacter(chars[1], on_failure);
1007 macro_assembler->BindBlock(&ok);
1008 }
1009 break;
1010 }
1011 case 4:
1012 macro_assembler->CheckCharacter(chars[3], &ok);
1014 case 3:
1015 macro_assembler->CheckCharacter(chars[0], &ok);
1016 macro_assembler->CheckCharacter(chars[1], &ok);
1017 macro_assembler->CheckNotCharacter(chars[2], on_failure);
1018 macro_assembler->BindBlock(&ok);
1019 break;
1020 default:
1021 UNREACHABLE();
1022 break;
1023 }
1024 return true;
1025}
#define check(reporter, ref, unref, make, kill)
static bool ok(int result)
virtual void CheckNotCharacter(unsigned c, BlockLabel *on_not_equal)=0
virtual void BindBlock(BlockLabel *label)=0
virtual void CheckCharacter(unsigned c, BlockLabel *on_equal)=0
virtual void LoadCurrentCharacter(intptr_t cp_offset, BlockLabel *on_end_of_input, bool check_bounds=true, intptr_t characters=1)=0
static intptr_t GetCaseIndependentLetters(uint16_t character, bool one_byte_subject, int32_t *letters)
Definition regexp.cc:861
static constexpr intptr_t kMaxWidth
Definition unibrow.h:56

◆ EmitAtomNonLetter()

static bool dart::EmitAtomNonLetter ( Zone zone,
RegExpCompiler compiler,
uint16_t  c,
BlockLabel on_failure,
intptr_t  cp_offset,
bool  check,
bool  preloaded 
)
inlinestatic

Definition at line 902 of file regexp.cc.

908 {
909 RegExpMacroAssembler* macro_assembler = compiler->macro_assembler();
910 bool one_byte = compiler->one_byte();
912 intptr_t length = GetCaseIndependentLetters(c, one_byte, chars);
913 if (length < 1) {
914 // This can't match. Must be an one-byte subject and a non-one-byte
915 // character. We do not need to do anything since the one-byte pass
916 // already handled this.
917 return false; // Bounds not checked.
918 }
919 bool checked = false;
920 // We handle the length > 1 case in a later pass.
921 if (length == 1) {
922 if (one_byte && c > Symbols::kMaxOneCharCodeSymbol) {
923 // Can't match - see above.
924 return false; // Bounds not checked.
925 }
926 if (!preloaded) {
927 macro_assembler->LoadCurrentCharacter(cp_offset, on_failure, check);
928 checked = check;
929 }
930 macro_assembler->CheckNotCharacter(c, on_failure);
931 }
932 return checked;
933}

◆ EmitBoundaryTest()

static void dart::EmitBoundaryTest ( RegExpMacroAssembler masm,
uint16_t  border,
BlockLabel fall_through,
BlockLabel above_or_equal,
BlockLabel below 
)
static

Definition at line 1027 of file regexp.cc.

1031 {
1032 if (below != fall_through) {
1033 masm->CheckCharacterLT(border, below);
1034 if (above_or_equal != fall_through) masm->GoTo(above_or_equal);
1035 } else {
1036 masm->CheckCharacterGT(border - 1, above_or_equal);
1037 }
1038}
virtual void CheckCharacterLT(uint16_t limit, BlockLabel *on_less)=0
virtual void CheckCharacterGT(uint16_t limit, BlockLabel *on_greater)=0
virtual void GoTo(BlockLabel *to)=0

◆ EmitCharClass()

static void dart::EmitCharClass ( RegExpMacroAssembler macro_assembler,
RegExpCharacterClass cc,
bool  one_byte,
BlockLabel on_failure,
intptr_t  cp_offset,
bool  check_offset,
bool  preloaded,
Zone zone 
)
static

Definition at line 1331 of file regexp.cc.

1338 {
1339 ZoneGrowableArray<CharacterRange>* ranges = cc->ranges();
1340 if (!CharacterRange::IsCanonical(ranges)) {
1341 CharacterRange::Canonicalize(ranges);
1342 }
1343
1344 uint16_t max_char;
1345 if (one_byte) {
1346 max_char = Symbols::kMaxOneCharCodeSymbol;
1347 } else {
1348 max_char = Utf16::kMaxCodeUnit;
1349 }
1350
1351 intptr_t range_count = ranges->length();
1352
1353 intptr_t last_valid_range = range_count - 1;
1354 while (last_valid_range >= 0) {
1355 const CharacterRange& range = ranges->At(last_valid_range);
1356 if (range.from() <= max_char) {
1357 break;
1358 }
1359 last_valid_range--;
1360 }
1361
1362 if (last_valid_range < 0) {
1363 if (!cc->is_negated()) {
1364 macro_assembler->GoTo(on_failure);
1365 }
1366 if (check_offset) {
1367 macro_assembler->CheckPosition(cp_offset, on_failure);
1368 }
1369 return;
1370 }
1371
1372 if (last_valid_range == 0 && ranges->At(0).IsEverything(max_char)) {
1373 if (cc->is_negated()) {
1374 macro_assembler->GoTo(on_failure);
1375 } else {
1376 // This is a common case hit by non-anchored expressions.
1377 if (check_offset) {
1378 macro_assembler->CheckPosition(cp_offset, on_failure);
1379 }
1380 }
1381 return;
1382 }
1383
1384 if (!preloaded) {
1385 macro_assembler->LoadCurrentCharacter(cp_offset, on_failure, check_offset);
1386 }
1387
1388 if (cc->is_standard() && macro_assembler->CheckSpecialCharacterClass(
1389 cc->standard_type(), on_failure)) {
1390 return;
1391 }
1392
1393 // A new list with ascending entries. Each entry is a code unit
1394 // where there is a boundary between code units that are part of
1395 // the class and code units that are not. Normally we insert an
1396 // entry at zero which goes to the failure label, but if there
1397 // was already one there we fall through for success on that entry.
1398 // Subsequent entries have alternating meaning (success/failure).
1399 ZoneGrowableArray<uint16_t>* range_boundaries =
1400 new (zone) ZoneGrowableArray<uint16_t>(last_valid_range);
1401
1402 bool zeroth_entry_is_failure = !cc->is_negated();
1403
1404 for (intptr_t i = 0; i <= last_valid_range; i++) {
1405 const CharacterRange& range = ranges->At(i);
1406 if (range.from() == 0) {
1407 ASSERT(i == 0);
1408 zeroth_entry_is_failure = !zeroth_entry_is_failure;
1409 } else {
1410 range_boundaries->Add(range.from());
1411 }
1412 if (range.to() + 1 <= max_char) {
1413 range_boundaries->Add(range.to() + 1);
1414 }
1415 }
1416 intptr_t end_index = range_boundaries->length() - 1;
1417
1418 BlockLabel fall_through;
1419 GenerateBranches(macro_assembler, range_boundaries,
1420 0, // start_index.
1421 end_index,
1422 0, // min_char.
1423 max_char, &fall_through,
1424 zeroth_entry_is_failure ? &fall_through : on_failure,
1425 zeroth_entry_is_failure ? on_failure : &fall_through);
1426 macro_assembler->BindBlock(&fall_through);
1427}
virtual void CheckPosition(intptr_t cp_offset, BlockLabel *on_outside_input)
virtual bool CheckSpecialCharacterClass(uint16_t type, BlockLabel *on_no_match)
static void GenerateBranches(RegExpMacroAssembler *masm, ZoneGrowableArray< uint16_t > *ranges, intptr_t start_index, intptr_t end_index, uint16_t min_char, uint16_t max_char, BlockLabel *fall_through, BlockLabel *even_label, BlockLabel *odd_label)
Definition regexp.cc:1217

◆ EmitDoubleBoundaryTest()

static void dart::EmitDoubleBoundaryTest ( RegExpMacroAssembler masm,
uint16_t  first,
uint16_t  last,
BlockLabel fall_through,
BlockLabel in_range,
BlockLabel out_of_range 
)
static

Definition at line 1040 of file regexp.cc.

1045 {
1046 if (in_range == fall_through) {
1047 if (first == last) {
1048 masm->CheckNotCharacter(first, out_of_range);
1049 } else {
1050 masm->CheckCharacterNotInRange(first, last, out_of_range);
1051 }
1052 } else {
1053 if (first == last) {
1054 masm->CheckCharacter(first, in_range);
1055 } else {
1056 masm->CheckCharacterInRange(first, last, in_range);
1057 }
1058 if (out_of_range != fall_through) masm->GoTo(out_of_range);
1059 }
1060}
virtual void CheckCharacterInRange(uint16_t from, uint16_t to, BlockLabel *on_in_range)=0
virtual void CheckCharacterNotInRange(uint16_t from, uint16_t to, BlockLabel *on_not_in_range)=0

◆ EmitHat()

static void dart::EmitHat ( RegExpCompiler compiler,
RegExpNode on_success,
Trace trace 
)
static

Definition at line 2188 of file regexp.cc.

2190 {
2191 RegExpMacroAssembler* assembler = compiler->macro_assembler();
2192 // We will be loading the previous character into the current character
2193 // register.
2194 Trace new_trace(*trace);
2195 new_trace.InvalidateCurrentCharacter();
2196
2197 BlockLabel ok;
2198 if (new_trace.cp_offset() == 0) {
2199 // The start of input counts as a newline in this context, so skip to
2200 // ok if we are at the start.
2201 assembler->CheckAtStart(&ok);
2202 }
2203 // We already checked that we are not at the start of input so it must be
2204 // OK to load the previous character.
2205 assembler->LoadCurrentCharacter(new_trace.cp_offset() - 1,
2206 new_trace.backtrack(), false);
2207 if (!assembler->CheckSpecialCharacterClass('n', new_trace.backtrack())) {
2208 // Newline means \n, \r, 0x2028 or 0x2029.
2209 if (!compiler->one_byte()) {
2210 assembler->CheckCharacterAfterAnd(0x2028, 0xfffe, &ok);
2211 }
2212 assembler->CheckCharacter('\n', &ok);
2213 assembler->CheckNotCharacter('\r', new_trace.backtrack());
2214 }
2215 assembler->BindBlock(&ok);
2216 on_success->Emit(compiler, &new_trace);
2217}
virtual void CheckAtStart(BlockLabel *on_at_start)=0
virtual void CheckCharacterAfterAnd(unsigned c, unsigned and_with, BlockLabel *on_equal)=0
virtual void Emit(RegExpCompiler *compiler, Trace *trace)=0

◆ EmitMoveOnEdge()

static void dart::EmitMoveOnEdge ( BlockEntryInstr succ,
BlockEntryInstr pred,
const MoveOperands move 
)
static

Definition at line 2984 of file linearscan.cc.

2986 {
2987 Instruction* last = pred->last_instruction();
2988 if ((last->SuccessorCount() == 1) && !pred->IsGraphEntry()) {
2989 ASSERT(last->IsGoto());
2990 last->AsGoto()->GetParallelMove()->AddMove(move.dest(), move.src());
2991 } else {
2992 succ->GetParallelMove()->AddMove(move.dest(), move.src());
2993 }
2994}
ParallelMoveInstr * GetParallelMove()
Definition il.h:1691
virtual intptr_t SuccessorCount() const
Definition il.cc:1968
Location src() const
Definition il.h:1534
Location dest() const
Definition il.h:1535
MoveOperands * AddMove(Location dest, Location src)
Definition il.h:1603

◆ EmitSimpleCharacter()

static bool dart::EmitSimpleCharacter ( Zone zone,
RegExpCompiler compiler,
uint16_t  c,
BlockLabel on_failure,
intptr_t  cp_offset,
bool  check,
bool  preloaded 
)
inlinestatic

Definition at line 883 of file regexp.cc.

889 {
890 RegExpMacroAssembler* assembler = compiler->macro_assembler();
891 bool bound_checked = false;
892 if (!preloaded) {
893 assembler->LoadCurrentCharacter(cp_offset, on_failure, check);
894 bound_checked = true;
895 }
896 assembler->CheckNotCharacter(c, on_failure);
897 return bound_checked;
898}

◆ EmitUseLookupTable()

static void dart::EmitUseLookupTable ( RegExpMacroAssembler masm,
ZoneGrowableArray< uint16_t > *  ranges,
intptr_t  start_index,
intptr_t  end_index,
uint16_t  min_char,
BlockLabel fall_through,
BlockLabel even_label,
BlockLabel odd_label 
)
static

Definition at line 1064 of file regexp.cc.

1071 {
1072 const intptr_t kSize = RegExpMacroAssembler::kTableSize;
1073 const intptr_t kMask = RegExpMacroAssembler::kTableMask;
1074
1075 intptr_t base = (min_char & ~kMask);
1076
1077 // Assert that everything is on one kTableSize page.
1078 for (intptr_t i = start_index; i <= end_index; i++) {
1079 ASSERT((ranges->At(i) & ~kMask) == base);
1080 }
1081 ASSERT(start_index == 0 || (ranges->At(start_index - 1) & ~kMask) <= base);
1082
1083 char templ[kSize];
1084 BlockLabel* on_bit_set;
1085 BlockLabel* on_bit_clear;
1086 intptr_t bit;
1087 if (even_label == fall_through) {
1088 on_bit_set = odd_label;
1089 on_bit_clear = even_label;
1090 bit = 1;
1091 } else {
1092 on_bit_set = even_label;
1093 on_bit_clear = odd_label;
1094 bit = 0;
1095 }
1096 for (intptr_t i = 0; i < (ranges->At(start_index) & kMask) && i < kSize;
1097 i++) {
1098 templ[i] = bit;
1099 }
1100 intptr_t j = 0;
1101 bit ^= 1;
1102 for (intptr_t i = start_index; i < end_index; i++) {
1103 for (j = (ranges->At(i) & kMask); j < (ranges->At(i + 1) & kMask); j++) {
1104 templ[j] = bit;
1105 }
1106 bit ^= 1;
1107 }
1108 for (intptr_t i = j; i < kSize; i++) {
1109 templ[i] = bit;
1110 }
1111 // TODO(erikcorry): Cache these.
1112 const TypedData& ba = TypedData::ZoneHandle(
1113 masm->zone(), TypedData::New(kTypedDataUint8ArrayCid, kSize, Heap::kOld));
1114 for (intptr_t i = 0; i < kSize; i++) {
1115 ba.SetUint8(i, templ[i]);
1116 }
1117 masm->CheckBitInTable(ba, on_bit_set);
1118 if (on_bit_clear != fall_through) masm->GoTo(on_bit_clear);
1119}
static constexpr uint64_t kMask
Definition DrawPass.cpp:53
virtual void CheckBitInTable(const TypedData &table, BlockLabel *on_bit_set)=0
static constexpr int kSize

◆ EmitWordCheck()

static void dart::EmitWordCheck ( RegExpMacroAssembler assembler,
BlockLabel word,
BlockLabel non_word,
bool  fall_through_on_word 
)
static

Definition at line 2163 of file regexp.cc.

2166 {
2167 if (assembler->CheckSpecialCharacterClass(
2168 fall_through_on_word ? 'w' : 'W',
2169 fall_through_on_word ? non_word : word)) {
2170 // Optimized implementation available.
2171 return;
2172 }
2173 assembler->CheckCharacterGT('z', non_word);
2174 assembler->CheckCharacterLT('0', non_word);
2175 assembler->CheckCharacterGT('a' - 1, word);
2176 assembler->CheckCharacterLT('9' + 1, word);
2177 assembler->CheckCharacterLT('A', non_word);
2178 assembler->CheckCharacterLT('Z' + 1, word);
2179 if (fall_through_on_word) {
2180 assembler->CheckNotCharacter('_', non_word);
2181 } else {
2182 assembler->CheckCharacter('_', word);
2183 }
2184}
intptr_t word
Definition globals.h:500

◆ EnableProfiler() [1/3]

static void dart::EnableProfiler ( )
static

Definition at line 277 of file profiler_test.cc.

277 {
278 if (!FLAG_profiler) {
279 FLAG_profiler = true;
280 Profiler::Init();
281 }
282}

◆ EnableProfiler() [2/3]

static void dart::EnableProfiler ( )
static

Definition at line 679 of file service_test.cc.

679 {
680 if (!FLAG_profiler) {
681 FLAG_profiler = true;
682 Profiler::Init();
683 }
684}

◆ EnableProfiler() [3/3]

static void dart::EnableProfiler ( Thread thread,
JSONStream js 
)
static

Definition at line 4429 of file service.cc.

4429 {
4430 if (!FLAG_profiler) {
4431 FLAG_profiler = true;
4432 Profiler::Init();
4433 }
4434 PrintSuccess(js);
4435}

◆ EncodeBTypeImm()

uint32_t dart::EncodeBTypeImm ( intptr_t  imm)
inline

Definition at line 1011 of file constants_riscv.h.

1011 {
1012 ASSERT(IsBTypeImm(imm));
1013 uint32_t encoded = 0;
1014 encoded |= ((imm >> 12) & 0x1) << 31;
1015 encoded |= ((imm >> 5) & 0x3f) << 25;
1016 encoded |= ((imm >> 1) & 0xf) << 8;
1017 encoded |= ((imm >> 11) & 0x1) << 7;
1018 return encoded;
1019}
bool IsBTypeImm(intptr_t imm)

◆ EncodeCBImm()

uint32_t dart::EncodeCBImm ( intptr_t  imm)
inline

Definition at line 1326 of file constants_riscv.h.

1326 {
1327 ASSERT(IsCBImm(imm));
1328 uint32_t encoding = 0;
1329 encoding |= ((imm >> 8) & 0x1) << 12;
1330 encoding |= ((imm >> 3) & 0x3) << 10;
1331 encoding |= ((imm >> 6) & 0x3) << 5;
1332 encoding |= ((imm >> 1) & 0x3) << 3;
1333 encoding |= ((imm >> 5) & 0x1) << 2;
1334 return encoding;
1335}
bool IsCBImm(intptr_t imm)

◆ EncodeCI16Imm()

uint32_t dart::EncodeCI16Imm ( intptr_t  imm)
inline

Definition at line 1383 of file constants_riscv.h.

1383 {
1384 ASSERT(IsCI16Imm(imm));
1385 uint32_t encoding = 0;
1386 encoding |= ((imm >> 9) & 0x1) << 12;
1387 encoding |= ((imm >> 4) & 0x1) << 6;
1388 encoding |= ((imm >> 6) & 0x1) << 5;
1389 encoding |= ((imm >> 7) & 0x3) << 3;
1390 encoding |= ((imm >> 5) & 0x1) << 2;
1391 return encoding;
1392}
bool IsCI16Imm(intptr_t imm)

◆ EncodeCI4SPNImm()

uint32_t dart::EncodeCI4SPNImm ( intptr_t  imm)
inline

Definition at line 1406 of file constants_riscv.h.

1406 {
1407 ASSERT(IsCI4SPNImm(imm));
1408 uint32_t encoding = 0;
1409 encoding |= ((imm >> 4) & 0x3) << 11;
1410 encoding |= ((imm >> 6) & 0xF) << 7;
1411 encoding |= ((imm >> 2) & 0x1) << 6;
1412 encoding |= ((imm >> 3) & 0x1) << 5;
1413 return encoding;
1414}
bool IsCI4SPNImm(intptr_t imm)

◆ EncodeCIImm()

uint32_t dart::EncodeCIImm ( intptr_t  imm)
inline

Definition at line 1349 of file constants_riscv.h.

1349 {
1350 ASSERT(IsCIImm(imm));
1351 uint32_t encoding = 0;
1352 encoding |= ((imm >> 5) & 0x1) << 12;
1353 encoding |= ((imm >> 0) & 0x1F) << 2;
1354 return encoding;
1355}
bool IsCIImm(intptr_t imm)

◆ EncodeCJImm()

uint32_t dart::EncodeCJImm ( intptr_t  imm)
inline

Definition at line 1297 of file constants_riscv.h.

1297 {
1298 ASSERT(IsCJImm(imm));
1299 uint32_t encoding = 0;
1300 encoding |= ((imm >> 11) & 0x1) << 12;
1301 encoding |= ((imm >> 4) & 0x1) << 11;
1302 encoding |= ((imm >> 8) & 0x3) << 9;
1303 encoding |= ((imm >> 10) & 0x1) << 8;
1304 encoding |= ((imm >> 6) & 0x1) << 7;
1305 encoding |= ((imm >> 7) & 0x1) << 6;
1306 encoding |= ((imm >> 1) & 0x7) << 3;
1307 encoding |= ((imm >> 5) & 0x1) << 2;
1308 return encoding;
1309}
bool IsCJImm(intptr_t imm)

◆ EncodeCMem4Imm()

uint32_t dart::EncodeCMem4Imm ( intptr_t  imm)
inline

Definition at line 1261 of file constants_riscv.h.

1261 {
1262 ASSERT(IsCMem4Imm(imm));
1263 uint32_t encoding = 0;
1264 encoding |= ((imm >> 3) & 0x7) << 10;
1265 encoding |= ((imm >> 2) & 0x1) << 6;
1266 encoding |= ((imm >> 6) & 0x1) << 5;
1267 return encoding;
1268}
bool IsCMem4Imm(intptr_t imm)

◆ EncodeCMem8Imm()

uint32_t dart::EncodeCMem8Imm ( intptr_t  imm)
inline

Definition at line 1280 of file constants_riscv.h.

1280 {
1281 ASSERT(IsCMem8Imm(imm));
1282 uint32_t encoding = 0;
1283 encoding |= ((imm >> 3) & 0x7) << 10;
1284 encoding |= ((imm >> 6) & 0x3) << 5;
1285 return encoding;
1286}
bool IsCMem8Imm(intptr_t imm)

◆ EncodeCSPLoad4Imm()

uint32_t dart::EncodeCSPLoad4Imm ( intptr_t  imm)
inline

Definition at line 1189 of file constants_riscv.h.

1189 {
1190 ASSERT(IsCSPLoad4Imm(imm));
1191 uint32_t encoding = 0;
1192 encoding |= ((imm >> 5) & 0x1) << 12;
1193 encoding |= ((imm >> 2) & 0x7) << 4;
1194 encoding |= ((imm >> 6) & 0x3) << 2;
1195 return encoding;
1196}
bool IsCSPLoad4Imm(intptr_t imm)

◆ EncodeCSPLoad8Imm()

uint32_t dart::EncodeCSPLoad8Imm ( intptr_t  imm)
inline

Definition at line 1208 of file constants_riscv.h.

1208 {
1209 ASSERT(IsCSPLoad8Imm(imm));
1210 uint32_t encoding = 0;
1211 encoding |= ((imm >> 5) & 0x1) << 12;
1212 encoding |= ((imm >> 3) & 0x3) << 5;
1213 encoding |= ((imm >> 6) & 0x7) << 2;
1214 return encoding;
1215}
bool IsCSPLoad8Imm(intptr_t imm)

◆ EncodeCSPStore4Imm()

uint32_t dart::EncodeCSPStore4Imm ( intptr_t  imm)
inline

Definition at line 1227 of file constants_riscv.h.

1227 {
1228 ASSERT(IsCSPStore4Imm(imm));
1229 uint32_t encoding = 0;
1230 encoding |= ((imm >> 2) & 0xF) << 9;
1231 encoding |= ((imm >> 6) & 0x3) << 7;
1232 return encoding;
1233}
bool IsCSPStore4Imm(intptr_t imm)

◆ EncodeCSPStore8Imm()

uint32_t dart::EncodeCSPStore8Imm ( intptr_t  imm)
inline

Definition at line 1244 of file constants_riscv.h.

1244 {
1245 ASSERT(IsCSPStore8Imm(imm));
1246 uint32_t encoding = 0;
1247 encoding |= ((imm >> 3) & 0x7) << 10;
1248 encoding |= ((imm >> 6) & 0x7) << 7;
1249 return encoding;
1250}
bool IsCSPStore8Imm(intptr_t imm)

◆ EncodeCUImm()

uint32_t dart::EncodeCUImm ( intptr_t  imm)
inline

Definition at line 1366 of file constants_riscv.h.

1366 {
1367 ASSERT(IsCUImm(imm));
1368 uint32_t encoding = 0;
1369 encoding |= ((imm >> 17) & 0x1) << 12;
1370 encoding |= ((imm >> 12) & 0x1F) << 2;
1371 return encoding;
1372}
bool IsCUImm(intptr_t imm)

◆ EncodeITypeImm()

uint32_t dart::EncodeITypeImm ( intptr_t  imm)
inline

Definition at line 1053 of file constants_riscv.h.

1053 {
1054 ASSERT(IsITypeImm(imm));
1055 return static_cast<uint32_t>(imm) << 20;
1056}
bool IsITypeImm(intptr_t imm)

◆ EncodeJTypeImm()

uint32_t dart::EncodeJTypeImm ( intptr_t  imm)
inline

Definition at line 1032 of file constants_riscv.h.

1032 {
1033 ASSERT(IsJTypeImm(imm));
1034 uint32_t encoded = 0;
1035 encoded |= ((imm >> 20) & 0x1) << 31;
1036 encoded |= ((imm >> 1) & 0x3ff) << 21;
1037 encoded |= ((imm >> 11) & 0x1) << 20;
1038 encoded |= ((imm >> 12) & 0xff) << 12;
1039 return encoded;
1040}
bool IsJTypeImm(intptr_t imm)

◆ EncodeSTypeImm()

uint32_t dart::EncodeSTypeImm ( intptr_t  imm)
inline

Definition at line 1075 of file constants_riscv.h.

1075 {
1076 ASSERT(IsSTypeImm(imm));
1077 uint32_t encoded = 0;
1078 encoded |= ((imm >> 5) & 0x7f) << 25;
1079 encoded |= ((imm >> 0) & 0x1f) << 7;
1080 return encoded;
1081}
bool IsSTypeImm(intptr_t imm)

◆ EncodeUTypeImm()

uint32_t dart::EncodeUTypeImm ( intptr_t  imm)
inline

Definition at line 1064 of file constants_riscv.h.

1064 {
1065 ASSERT(IsUTypeImm(imm));
1066 return imm;
1067}
bool IsUTypeImm(intptr_t imm)

◆ EnsureAcyclicSymbol()

static RangeBoundary dart::EnsureAcyclicSymbol ( BlockEntryInstr phi_block,
const RangeBoundary a,
const RangeBoundary limit 
)
static

Definition at line 2743 of file range_analysis.cc.

2745 {
2746 if (!a.IsSymbol() || DominatesPhi(a.symbol()->GetBlock(), phi_block)) {
2747 return a;
2748 }
2749
2750 // Symbol does not dominate phi. Try unwrapping constraint and check again.
2751 Definition* unwrapped = UnwrapConstraint(a.symbol());
2752 if ((unwrapped != a.symbol()) &&
2753 DominatesPhi(unwrapped->GetBlock(), phi_block)) {
2754 return RangeBoundary::FromDefinition(unwrapped, a.offset());
2755 }
2756
2757 return limit;
2758}
static bool DominatesPhi(BlockEntryInstr *a, BlockEntryInstr *phi_block)

◆ EnsureConstructorsAreCompiled()

static void dart::EnsureConstructorsAreCompiled ( const Function func)
static

Definition at line 81 of file mirrors.cc.

81 {
82 // Only generative constructors can have initializing formals.
83 if (!func.IsGenerativeConstructor()) return;
84
85 Thread* thread = Thread::Current();
86 Zone* zone = thread->zone();
87 const Class& cls = Class::Handle(zone, func.Owner());
88 const Error& error = Error::Handle(zone, cls.EnsureIsFinalized(thread));
89 if (!error.IsNull()) {
90 Exceptions::PropagateError(error);
92 }
93 func.EnsureHasCode();
94}

◆ EnsureValidOOBMessage()

static void dart::EnsureValidOOBMessage ( Thread thread,
Isolate isolate,
std::unique_ptr< Message message 
)
static

Definition at line 734 of file safepoint_test.cc.

736 {
737 EXPECT(message->IsOOB());
738 EXPECT(message->dest_port() == isolate->main_port());
739
740 const auto& msg = Object::Handle(ReadMessage(thread, message.get()));
741 EXPECT(msg.IsArray());
742
743 const auto& array = Array::Cast(msg);
744 EXPECT(array.Length() == 3);
745 EXPECT(Smi::Value(Smi::RawCast(array.At(0))) == Message::kIsolateLibOOBMsg);
746 EXPECT(Smi::Value(Smi::RawCast(array.At(1))) == Isolate::kCheckForReload);
747 // 3rd value is ignored.
748}

◆ EntryPointFieldInvocationError()

DART_WARN_UNUSED_RESULT ErrorPtr dart::EntryPointFieldInvocationError ( const String getter_name)

Definition at line 27272 of file object.cc.

27272 {
27273 if (!FLAG_verify_entry_points) return Error::null();
27274
27275 char const* error = OS::SCreate(
27276 Thread::Current()->zone(),
27277 "ERROR: Entry-points do not allow invoking fields "
27278 "(failure to resolve '%s')\n"
27279 "ERROR: See "
27280 "https://github.com/dart-lang/sdk/blob/master/runtime/docs/compiler/"
27281 "aot/entry_point_pragma.md\n",
27282 getter_name.ToCString());
27283 OS::PrintErr("%s", error);
27284 return ApiError::New(String::Handle(String::New(error)));
27285}

◆ EntryPointMemberInvocationError()

DART_WARN_UNUSED_RESULT ErrorPtr dart::EntryPointMemberInvocationError ( const Object member)

Definition at line 27288 of file object.cc.

27288 {
27289 const char* member_cstring =
27290 member.IsFunction()
27291 ? OS::SCreate(
27292 Thread::Current()->zone(), "%s (kind %s)",
27293 Function::Cast(member).ToLibNamePrefixedQualifiedCString(),
27294 Function::KindToCString(Function::Cast(member).kind()))
27295 : member.ToCString();
27296 if (!FLAG_verify_entry_points) {
27297 // Print a warning, but do not return an error.
27298 char const* warning = OS::SCreate(
27299 Thread::Current()->zone(),
27300 "WARNING: '%s' is accessed through Dart C API without being marked as "
27301 "an entry point; its tree-shaken signature cannot be verified.\n"
27302 "WARNING: See "
27303 "https://github.com/dart-lang/sdk/blob/master/runtime/docs/compiler/"
27304 "aot/entry_point_pragma.md\n",
27305 member_cstring);
27306 OS::PrintErr("%s", warning);
27307 return Error::null();
27308 }
27309 char const* error = OS::SCreate(
27310 Thread::Current()->zone(),
27311 "ERROR: It is illegal to access '%s' through Dart C API.\n"
27312 "ERROR: See "
27313 "https://github.com/dart-lang/sdk/blob/master/runtime/docs/compiler/"
27314 "aot/entry_point_pragma.md\n",
27315 member_cstring);
27316 OS::PrintErr("%s", error);
27317 return ApiError::New(String::Handle(String::New(error)));
27318}

◆ EnumMapper()

template<typename T >
T dart::EnumMapper ( const char *  value,
const char *const *  enums,
T values 
)

Definition at line 865 of file service.cc.

865 {
866 ASSERT(value != nullptr);
867 intptr_t i = 0;
868 for (i = 0; enums[i] != nullptr; i++) {
869 if (strcmp(value, enums[i]) == 0) {
870 return values[i];
871 }
872 }
873 // Default value.
874 return values[i];
875}

◆ EnvIndexToStackLocation()

static Location dart::EnvIndexToStackLocation ( intptr_t  num_direct_parameters,
intptr_t  env_index 
)
static

Definition at line 1317 of file flow_graph.cc.

1318 {
1319 return Location::StackSlot(
1320 compiler::target::frame_layout.FrameSlotForVariableIndex(
1321 num_direct_parameters - env_index),
1322 FPREG);
1323}

◆ Equals()

static bool dart::Equals ( const Object expected,
const Object actual 
)
static

Definition at line 26 of file snapshot_test.cc.

26 {
27 if (expected.IsNull()) {
28 return actual.IsNull();
29 }
30 if (expected.IsSmi()) {
31 if (actual.IsSmi()) {
32 return expected.ptr() == actual.ptr();
33 }
34 return false;
35 }
36 if (expected.IsDouble()) {
37 if (actual.IsDouble()) {
38 Double& dbl1 = Double::Handle();
39 Double& dbl2 = Double::Handle();
40 dbl1 ^= expected.ptr();
41 dbl2 ^= actual.ptr();
42 return dbl1.value() == dbl2.value();
43 }
44 return false;
45 }
46 if (expected.IsBool()) {
47 if (actual.IsBool()) {
48 return expected.ptr() == actual.ptr();
49 }
50 return false;
51 }
52 return false;
53}

◆ EqualsIgnoringPrivate()

bool dart::EqualsIgnoringPrivate ( const String name,
const String private_name 
)

◆ EqualsIgnoringPrivateKey()

template<typename T1 , typename T2 >
static bool dart::EqualsIgnoringPrivateKey ( const String str1,
const String str2 
)
static

Definition at line 24326 of file object.cc.

24326 {
24327 intptr_t len = str1.Length();
24328 intptr_t str2_len = str2.Length();
24329 if (len == str2_len) {
24330 for (intptr_t i = 0; i < len; i++) {
24331 if (T1::CharAt(str1, i) != T2::CharAt(str2, i)) {
24332 return false;
24333 }
24334 }
24335 return true;
24336 }
24337 if (len < str2_len) {
24338 return false; // No way they can match.
24339 }
24340 intptr_t pos = 0;
24341 intptr_t str2_pos = 0;
24342 while (pos < len) {
24343 int32_t ch = T1::CharAt(str1, pos);
24344 pos++;
24345
24346 if ((str2_pos < str2_len) && (ch == T2::CharAt(str2, str2_pos))) {
24347 str2_pos++;
24348 continue;
24349 }
24350
24351 if (ch == Library::kPrivateKeySeparator) {
24352 // Consume a private key separator if str1 has it but str2 does not.
24353 while ((pos < len) && (T1::CharAt(str1, pos) != '.') &&
24354 (T1::CharAt(str1, pos) != '&')) {
24355 pos++;
24356 }
24357 // Resume matching characters.
24358 continue;
24359 }
24360
24361 return false;
24362 }
24363
24364 // We have reached the end of mangled_name string.
24365 ASSERT(pos == len);
24366 return (str2_pos == str2_len);
24367}

◆ EscapeOverhead()

static int32_t dart::EscapeOverhead ( int32_t  c)
static

Definition at line 520 of file object.cc.

520 {
521 if (IsSpecialCharacter(c)) {
522 return 1; // 1 additional byte for the backslash.
523 } else if (IsAsciiNonprintable(c)) {
524 return 3; // 3 additional bytes to encode c as \x00.
525 }
526 return 0;
527}
static bool IsSpecialCharacter(type value)
Definition object.cc:510

◆ Eval()

static ArrayPtr dart::Eval ( Dart_Handle  lib,
const char *  expr 
)
static

Definition at line 81 of file service_test.cc.

81 {
82 const String& dummy_isolate_id = String::Handle(String::New("isolateId"));
83 Dart_Handle expr_val;
84 {
85 TransitionVMToNative transition(Thread::Current());
86 expr_val = Dart_EvaluateStaticExpr(lib, NewString(expr));
87 EXPECT_VALID(expr_val);
88 }
89 Zone* zone = Thread::Current()->zone();
90 const GrowableObjectArray& value =
91 Api::UnwrapGrowableObjectArrayHandle(zone, expr_val);
92 const Array& result = Array::Handle(Array::MakeFixedLength(value));
93 GrowableObjectArray& growable = GrowableObjectArray::Handle();
94 growable ^= result.At(4);
95 // Append dummy isolate id to parameter values.
96 growable.Add(dummy_isolate_id);
97 Array& array = Array::Handle(Array::MakeFixedLength(growable));
98 result.SetAt(4, array);
99 growable ^= result.At(5);
100 // Append dummy isolate id to parameter values.
101 growable.Add(dummy_isolate_id);
102 array = Array::MakeFixedLength(growable);
103 result.SetAt(5, array);
104 return result.ptr();
105}
Dart_Handle Dart_EvaluateStaticExpr(Dart_Handle lib_handle, Dart_Handle expr_in)

◆ EvalF()

static ArrayPtr dart::EvalF ( Dart_Handle  lib,
const char *  fmt,
  ... 
)
static

Definition at line 107 of file service_test.cc.

107 {
108 va_list measure_args;
109 va_start(measure_args, fmt);
110 intptr_t len = Utils::VSNPrint(nullptr, 0, fmt, measure_args);
111 va_end(measure_args);
112
113 char* buffer = Thread::Current()->zone()->Alloc<char>(len + 1);
114 va_list print_args;
115 va_start(print_args, fmt);
116 Utils::VSNPrint(buffer, (len + 1), fmt, print_args);
117 va_end(print_args);
118
119 return Eval(lib, buffer);
120}
static ArrayPtr Eval(Dart_Handle lib, const char *expr)

◆ Evaluate()

static void dart::Evaluate ( Thread thread,
JSONStream js 
)
static

Definition at line 2872 of file service.cc.

2872 {
2873 // If a compilation service is available, this RPC invocation will have been
2874 // intercepted by RunningIsolates.routeRequest.
2875 js->PrintError(
2876 kExpressionCompilationError,
2877 "%s: No compilation service available; cannot evaluate from source.",
2878 js->method());
2879}

◆ EvaluateCompiledExpression()

static void dart::EvaluateCompiledExpression ( Thread thread,
JSONStream js 
)
static

Definition at line 3313 of file service.cc.

3313 {
3314 if (CheckDebuggerDisabled(thread, js)) {
3315 return;
3316 }
3317
3318 Isolate* isolate = thread->isolate();
3319
3320 bool disable_breakpoints =
3321 BoolParameter::Parse(js->LookupParam("disableBreakpoints"), false);
3322 DisableBreakpointsScope db(isolate->debugger(), disable_breakpoints);
3323
3324 DebuggerStackTrace* stack = isolate->debugger()->StackTrace();
3325 intptr_t frame_pos = UIntParameter::Parse(js->LookupParam("frameIndex"));
3326 if (frame_pos >= stack->Length()) {
3327 PrintInvalidParamError(js, "frameIndex");
3328 return;
3329 }
3330 Zone* zone = thread->zone();
3331 const GrowableObjectArray& param_names =
3332 GrowableObjectArray::Handle(zone, GrowableObjectArray::New());
3333 const GrowableObjectArray& param_values =
3334 GrowableObjectArray::Handle(zone, GrowableObjectArray::New());
3335 if (BuildScope(thread, js, param_names, param_values)) {
3336 return;
3337 }
3338 const GrowableObjectArray& type_params_names =
3339 GrowableObjectArray::Handle(zone, GrowableObjectArray::New());
3340 const GrowableObjectArray& type_params_bounds =
3341 GrowableObjectArray::Handle(zone, GrowableObjectArray::New());
3342 const GrowableObjectArray& type_params_defaults =
3343 GrowableObjectArray::Handle(zone, GrowableObjectArray::New());
3344
3345 const ExternalTypedData& kernel_data = ExternalTypedData::Handle(
3346 zone, DecodeKernelBuffer(js->LookupParam("kernelBytes")));
3347
3348 if (js->HasParam("frameIndex")) {
3349 DebuggerStackTrace* stack = isolate->debugger()->StackTrace();
3350 intptr_t frame_pos = UIntParameter::Parse(js->LookupParam("frameIndex"));
3351 if (frame_pos >= stack->Length()) {
3352 PrintInvalidParamError(js, "frameIndex");
3353 return;
3354 }
3355
3356 ActivationFrame* frame = stack->FrameAt(frame_pos);
3357 TypeArguments& type_arguments = TypeArguments::Handle(
3358 zone,
3359 frame->BuildParameters(param_names, param_values, type_params_names,
3360 type_params_bounds, type_params_defaults));
3361
3362 const Object& result = Object::Handle(
3363 zone,
3364 frame->EvaluateCompiledExpression(
3365 kernel_data,
3366 Array::Handle(zone, Array::MakeFixedLength(type_params_names)),
3367 Array::Handle(zone, Array::MakeFixedLength(param_values)),
3368 type_arguments));
3369 result.PrintJSON(js, true);
3370 } else {
3371 // evaluating expression in the context of a given object
3372 if (!js->HasParam("targetId")) {
3373 js->PrintError(kInvalidParams,
3374 "Either targetId or frameIndex has to be provided.");
3375 return;
3376 }
3377 const char* target_id = js->LookupParam("targetId");
3378 ObjectIdRing::LookupResult lookup_result;
3379 Object& obj = Object::Handle(
3380 zone, LookupHeapObject(thread, target_id, &lookup_result));
3381 if (obj.ptr() == Object::sentinel().ptr()) {
3382 if (lookup_result == ObjectIdRing::kCollected) {
3383 PrintSentinel(js, kCollectedSentinel);
3384 } else if (lookup_result == ObjectIdRing::kExpired) {
3385 PrintSentinel(js, kExpiredSentinel);
3386 } else {
3387 PrintInvalidParamError(js, "targetId");
3388 }
3389 return;
3390 }
3391 const auto& type_params_names_fixed =
3392 Array::Handle(zone, Array::MakeFixedLength(type_params_names));
3393 const auto& param_values_fixed =
3394 Array::Handle(zone, Array::MakeFixedLength(param_values));
3395
3396 TypeArguments& type_arguments = TypeArguments::Handle(zone);
3397 if (obj.IsLibrary()) {
3398 const auto& lib = Library::Cast(obj);
3399 const auto& result = Object::Handle(
3400 zone,
3401 lib.EvaluateCompiledExpression(kernel_data, type_params_names_fixed,
3402 param_values_fixed, type_arguments));
3403 result.PrintJSON(js, true);
3404 return;
3405 }
3406 if (obj.IsClass()) {
3407 const auto& cls = Class::Cast(obj);
3408 const auto& result = Object::Handle(
3409 zone,
3410 cls.EvaluateCompiledExpression(kernel_data, type_params_names_fixed,
3411 param_values_fixed, type_arguments));
3412 result.PrintJSON(js, true);
3413 return;
3414 }
3415 if ((obj.IsInstance() || obj.IsNull()) && !ContainsNonInstance(obj)) {
3416 const auto& instance =
3417 Instance::Handle(zone, Instance::RawCast(obj.ptr()));
3418 const auto& receiver_cls = Class::Handle(zone, instance.clazz());
3419 const auto& result = Object::Handle(
3420 zone, instance.EvaluateCompiledExpression(
3421 receiver_cls, kernel_data, type_params_names_fixed,
3422 param_values_fixed, type_arguments));
3423 result.PrintJSON(js, true);
3424 return;
3425 }
3426 js->PrintError(kInvalidParams,
3427 "%s: invalid 'targetId' parameter: "
3428 "Cannot evaluate against a VM-internal object",
3429 js->method());
3430 }
3431}
ExternalTypedDataPtr DecodeKernelBuffer(const char *kernel_buffer_base64)
Definition service.cc:3307

◆ EvaluateCompiledExpressionHelper()

static ObjectPtr dart::EvaluateCompiledExpressionHelper ( Zone zone,
const Function eval_function,
const Array type_definitions,
const Array arguments,
const TypeArguments type_arguments 
)
static

Definition at line 4837 of file object.cc.

4842 {
4843 // type_arguments is null if all type arguments are dynamic.
4844 if (type_definitions.Length() == 0 || type_arguments.IsNull()) {
4845 return DartEntry::InvokeFunction(eval_function, arguments);
4846 }
4847
4848 intptr_t num_type_args = type_arguments.Length();
4849 const auto& real_arguments =
4850 Array::Handle(zone, Array::New(arguments.Length() + 1));
4851 real_arguments.SetAt(0, type_arguments);
4852 Object& arg = Object::Handle(zone);
4853 for (intptr_t i = 0; i < arguments.Length(); ++i) {
4854 arg = arguments.At(i);
4855 real_arguments.SetAt(i + 1, arg);
4856 }
4857
4858 const Array& args_desc =
4859 Array::Handle(zone, ArgumentsDescriptor::NewBoxed(
4860 num_type_args, arguments.Length(), Heap::kNew));
4861 return DartEntry::InvokeFunction(eval_function, real_arguments, args_desc);
4862}

◆ EvaluateInFrame()

static void dart::EvaluateInFrame ( Thread thread,
JSONStream js 
)
static

Definition at line 3440 of file service.cc.

3440 {
3441 // If a compilation service is available, this RPC invocation will have been
3442 // intercepted by RunningIsolates.routeRequest.
3443 js->PrintError(
3444 kExpressionCompilationError,
3445 "%s: No compilation service available; cannot evaluate from source.",
3446 js->method());
3447}

◆ EvaluateToString()

static const String & dart::EvaluateToString ( Zone zone,
Definition defn 
)
static

Definition at line 5694 of file il.cc.

5694 {
5695 if (auto konst = defn->AsConstant()) {
5696 const Object& obj = konst->value();
5697 if (obj.IsString()) {
5698 return String::Cast(obj);
5699 } else if (obj.IsSmi()) {
5700 const char* cstr = obj.ToCString();
5701 return String::Handle(zone, String::New(cstr, Heap::kOld));
5702 } else if (obj.IsBool()) {
5703 return Bool::Cast(obj).value() ? Symbols::True() : Symbols::False();
5704 } else if (obj.IsNull()) {
5705 return Symbols::null();
5706 }
5707 }
5708 return String::null_string();
5709}

◆ EvaluationFunctionNeedsReceiver()

static bool dart::EvaluationFunctionNeedsReceiver ( Thread thread,
Zone zone,
const Function eval_function 
)
static

Definition at line 4828 of file object.cc.

4830 {
4831 auto parsed_function = new ParsedFunction(
4832 thread, Function::ZoneHandle(zone, eval_function.ptr()));
4833 parsed_function->EnsureKernelScopes();
4834 return parsed_function->is_receiver_used();
4835}

◆ EvenDRegisterOf()

static DRegister dart::EvenDRegisterOf ( QRegister  q)
inlinestatic

Definition at line 255 of file constants_arm.h.

255 {
256 return static_cast<DRegister>(q * 2);
257}

◆ EvenSRegisterOf()

static SRegister dart::EvenSRegisterOf ( DRegister  d)
inlinestatic

Definition at line 263 of file constants_arm.h.

263 {
264#if defined(VFPv3_D32)
265 // When we have 32 D registers, the S registers only overlap the first 16.
266 // That is, there are only ever 32 S registers in any extension.
267 ASSERT(d < D16);
268#endif
269 return static_cast<SRegister>(d * 2);
270}

◆ ExceptionNative()

void dart::ExceptionNative ( Dart_NativeArguments  args)

Definition at line 7028 of file dart_api_impl_test.cc.

7028 {
7030 Dart_ThrowException(NewString("Hello from ExceptionNative!"));
7031 UNREACHABLE();
7032}
DART_EXPORT Dart_Handle Dart_ThrowException(Dart_Handle exception)

◆ ExceptionPauseInfoToServiceEnum()

static const char * dart::ExceptionPauseInfoToServiceEnum ( Dart_ExceptionPauseInfo  pi)
static

Definition at line 2977 of file isolate.cc.

2977 {
2978 switch (pi) {
2980 return "All";
2982 return "None";
2984 return "Unhandled";
2985 default:
2986 UNIMPLEMENTED();
2987 return nullptr;
2988 }
2989}

◆ ExecRaw()

static ObjectPtr dart::ExecRaw ( const RegExp regexp,
const String subject,
int32_t  index,
bool  sticky,
int32_t *  output,
intptr_t  output_size,
Zone zone 
)
static

Definition at line 470 of file regexp_assembler_bytecode.cc.

476 {
477 bool is_one_byte = subject.IsOneByteString();
478
479 // We must have done EnsureCompiledIrregexp, so we can get the number of
480 // registers.
481 int number_of_capture_registers = (regexp.num_bracket_expressions() + 1) * 2;
482 int32_t* raw_output = &output[number_of_capture_registers];
483
484 // We do not touch the actual capture result registers until we know there
485 // has been a match so that we can use those capture results to set the
486 // last match info.
487 for (int i = number_of_capture_registers - 1; i >= 0; i--) {
488 raw_output[i] = -1;
489 }
490
491 const TypedData& bytecode =
492 TypedData::Handle(zone, regexp.bytecode(is_one_byte, sticky));
493 ASSERT(!bytecode.IsNull());
494 const Object& result = Object::Handle(
495 zone, IrregexpInterpreter::Match(bytecode, subject, raw_output, index));
496
497 if (result.ptr() == Bool::True().ptr()) {
498 // Copy capture results to the start of the registers array.
499 memmove(output, raw_output, number_of_capture_registers * sizeof(int32_t));
500 }
501 if (result.ptr() == Object::null()) {
502 // Exception during regexp processing
503 Exceptions::ThrowStackOverflow();
504 UNREACHABLE();
505 }
506 return result.ptr();
507}
TypedDataPtr bytecode(bool is_one_byte, bool sticky) const
Definition object.h:12777

◆ ExecuteCallback()

DART_EXPORT void dart::ExecuteCallback ( Work work_ptr)

Definition at line 604 of file ffi_test_functions_vmspecific.cc.

604 {
605 printf("C Da: ExecuteCallback(%" Pp ").\n",
606 reinterpret_cast<intptr_t>(work_ptr));
607 const Work work = *work_ptr;
608 work();
609 delete work_ptr;
610 printf("C Da: ExecuteCallback done.\n");
611}
std::function< void()> Work

◆ ExecuteMatch()

static ObjectPtr dart::ExecuteMatch ( Zone zone,
NativeArguments arguments,
bool  sticky 
)
static

Definition at line 142 of file regexp.cc.

144 {
145 const RegExp& regexp = RegExp::CheckedHandle(zone, arguments->NativeArgAt(0));
146 ASSERT(!regexp.IsNull());
147 GET_NON_NULL_NATIVE_ARGUMENT(String, subject, arguments->NativeArgAt(1));
148 GET_NON_NULL_NATIVE_ARGUMENT(Smi, start_index, arguments->NativeArgAt(2));
149
150 // Both generated code and the interpreter are using 32-bit registers and
151 // 32-bit backtracking stack so they can't work with strings which are
152 // larger than that. Validate these assumptions before running the regexp.
153 if (!Utils::IsInt(32, subject.Length())) {
154 Exceptions::ThrowRangeError("length",
155 Integer::Handle(Integer::New(subject.Length())),
156 0, kMaxInt32);
157 }
158 if (!Utils::IsInt(32, start_index.Value())) {
159 Exceptions::ThrowRangeError("start_index", Integer::Cast(start_index),
160 kMinInt32, kMaxInt32);
161 }
162
163#if !defined(DART_PRECOMPILED_RUNTIME)
164 if (!FLAG_interpret_irregexp) {
165 return IRRegExpMacroAssembler::Execute(regexp, subject, start_index,
166 /*sticky=*/sticky, zone);
167 }
168#endif
169 return BytecodeRegExpMacroAssembler::Interpret(regexp, subject, start_index,
170 /*sticky=*/sticky, zone);
171}

◆ ExecuteScript()

static ObjectPtr dart::ExecuteScript ( const char *  script,
bool  allow_errors = false 
)
static

Definition at line 13 of file source_report_test.cc.

13 {
14 Dart_Handle lib;
15 {
16 TransitionVMToNative transition(Thread::Current());
17 if (allow_errors) {
18 lib = TestCase::LoadTestScriptWithErrors(script, nullptr);
19 } else {
20 lib = TestCase::LoadTestScript(script, nullptr);
21 }
22 EXPECT_VALID(lib);
23 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, nullptr);
25 }
26 return Api::UnwrapHandle(lib);
27}

◆ ExitForMaterialization()

static Instruction * dart::ExitForMaterialization ( MaterializeObjectInstr mat)
static

Definition at line 3766 of file redundancy_elimination.cc.

3766 {
3767 while (mat->next()->IsMaterializeObject()) {
3768 mat = mat->next()->AsMaterializeObject();
3769 }
3770 return mat->next();
3771}

◆ ExpectedValue()

static intptr_t dart::ExpectedValue ( intptr_t  i)
inlinestatic

Definition at line 44 of file memory_copy_test.cc.

44 {
45 return 1 + i % 100;
46}

◆ ExpectEncodeFail()

static void dart::ExpectEncodeFail ( Zone zone,
Dart_CObject root 
)
static

Definition at line 119 of file snapshot_test.cc.

119 {
120 std::unique_ptr<Message> message =
121 WriteApiMessage(zone, root, ILLEGAL_PORT, Message::kNormalPriority);
122 EXPECT(message == nullptr);
123}

◆ ExpectLocationForPosition()

void dart::ExpectLocationForPosition ( const kernel::KernelLineStartsReader &  reader,
intptr_t  position,
intptr_t  expected_line,
intptr_t  expected_col 
)

Definition at line 35 of file kernel_test.cc.

38 {
39 intptr_t line;
40 intptr_t col;
41 EXPECT_EQ(true, reader.LocationForPosition(position, &line, &col));
42 EXPECT_EQ(expected_line, line);
43 EXPECT_EQ(expected_col, col);
44}

◆ ExpectRangesContainCid()

static bool dart::ExpectRangesContainCid ( const Expect expect,
const CidRangeVector ranges,
intptr_t  expected 
)
static

Definition at line 455 of file il_test.cc.

457 {
458 for (const auto& range : ranges) {
459 for (intptr_t cid = range.cid_start; cid <= range.cid_end; cid++) {
460 if (expected == cid) return true;
461 }
462 }
463 TextBuffer buffer(128);
464 buffer.AddString("Expected CidRangeVector to include cid ");
465 WriteCidTo(expected, &buffer);
466 expect.Fail("%s", buffer.buffer());
467 return false;
468}
static void WriteCidTo(intptr_t cid, BaseTextBuffer *buffer)
Definition il_test.cc:383

◆ ExpectStores()

static void dart::ExpectStores ( FlowGraph flow_graph,
const std::vector< const char * > &  expected_stores 
)
static

Definition at line 95 of file il_test.cc.

96 {
97 size_t next_expected_store = 0;
98 for (BlockIterator block_it = flow_graph->reverse_postorder_iterator();
99 !block_it.Done(); block_it.Advance()) {
100 for (ForwardInstructionIterator it(block_it.Current()); !it.Done();
101 it.Advance()) {
102 if (auto store = it.Current()->AsStoreField()) {
103 EXPECT_LT(next_expected_store, expected_stores.size());
104 EXPECT_STREQ(expected_stores[next_expected_store],
105 store->slot().Name());
106 next_expected_store++;
107 }
108 }
109 }
110}

◆ ExpectTokenRangeAtLine()

void dart::ExpectTokenRangeAtLine ( const kernel::KernelLineStartsReader &  reader,
intptr_t  line,
intptr_t  expected_first_token,
intptr_t  expected_last_token 
)

Definition at line 66 of file kernel_test.cc.

69 {
70 TokenPosition first_token = TokenPosition::Synthetic(0);
71 TokenPosition last_token = TokenPosition::Synthetic(0);
72 EXPECT_EQ(true, reader.TokenRangeAtLine(line, &first_token, &last_token));
73 EXPECT_EQ(expected_first_token, first_token.Serialize());
74 EXPECT_EQ(expected_last_token, last_token.Serialize());
75}
int32_t Serialize() const

◆ ExpectTypesEquivalent()

static void dart::ExpectTypesEquivalent ( const Expect expect,
const AbstractType expected,
const AbstractType got,
TypeEquality  kind 
)
static

Definition at line 7514 of file object_test.cc.

◆ ExportModifiedCallback()

static bool dart::ExportModifiedCallback ( const char *  url,
int64_t  since 
)
static

Definition at line 4592 of file isolate_reload_test.cc.

4592 {\n"
4593 " return importedFunc() + ' pants';\n"
4594 "}\n";
4595
4596 Dart_SetFileModifiedCallback(&ImportModifiedCallback);
4597 lib = TestCase::ReloadTestScript(kReloadScript);

◆ ExternalByteDataNativeFunction()

static void dart::ExternalByteDataNativeFunction ( Dart_NativeArguments  args)
static

Definition at line 2261 of file dart_api_impl_test.cc.

2261 {
2263 Dart_Handle external_byte_data =
2265 EXPECT_VALID(external_byte_data);
2266 EXPECT_EQ(Dart_TypedData_kByteData,
2267 Dart_GetTypeOfTypedData(external_byte_data));
2268 Dart_SetReturnValue(args, external_byte_data);
2270}
DART_EXPORT Dart_Handle Dart_NewExternalTypedData(Dart_TypedData_Type type, void *data, intptr_t length)

◆ ExternalByteDataNativeResolver()

static Dart_NativeFunction dart::ExternalByteDataNativeResolver ( Dart_Handle  name,
int  arg_count,
bool *  auto_setup_scope 
)
static

Definition at line 2272 of file dart_api_impl_test.cc.

2275 {
2276 ASSERT(auto_setup_scope != nullptr);
2277 *auto_setup_scope = true;
2279}
static void ExternalByteDataNativeFunction(Dart_NativeArguments args)

◆ ExternalTypedDataAccessTests()

static void dart::ExternalTypedDataAccessTests ( Dart_Handle  obj,
Dart_TypedData_Type  expected_type,
uint8_t  data[],
intptr_t  data_length 
)
static

Definition at line 3037 of file dart_api_impl_test.cc.

3040 {
3041 EXPECT_VALID(obj);
3042 EXPECT_EQ(expected_type, Dart_GetTypeOfExternalTypedData(obj));
3043 EXPECT(Dart_IsList(obj));
3044
3045 void* raw_data = nullptr;
3046 intptr_t len;
3048 EXPECT_VALID(Dart_TypedDataAcquireData(obj, &type, &raw_data, &len));
3049 EXPECT(raw_data == data);
3050 EXPECT_EQ(data_length, len);
3051 EXPECT_EQ(expected_type, type);
3053
3054 intptr_t list_length = 0;
3055 EXPECT_VALID(Dart_ListLength(obj, &list_length));
3056 EXPECT_EQ(data_length, list_length);
3057
3058 // Load and check values from underlying array and API.
3059 for (intptr_t i = 0; i < list_length; ++i) {
3060 EXPECT_EQ(11 * i, data[i]);
3061 Dart_Handle elt = Dart_ListGetAt(obj, i);
3062 EXPECT_VALID(elt);
3063 int64_t value = 0;
3064 EXPECT_VALID(Dart_IntegerToInt64(elt, &value));
3065 EXPECT_EQ(data[i], value);
3066 }
3067
3068 // Write values through the underlying array.
3069 for (intptr_t i = 0; i < data_length; ++i) {
3070 data[i] *= 2;
3071 }
3072 // Read them back through the API.
3073 for (intptr_t i = 0; i < list_length; ++i) {
3074 Dart_Handle elt = Dart_ListGetAt(obj, i);
3075 EXPECT_VALID(elt);
3076 int64_t value = 0;
3077 EXPECT_VALID(Dart_IntegerToInt64(elt, &value));
3078 EXPECT_EQ(22 * i, value);
3079 }
3080
3081 // Write values through the API.
3082 for (intptr_t i = 0; i < list_length; ++i) {
3084 EXPECT_VALID(value);
3085 EXPECT_VALID(Dart_ListSetAt(obj, i, value));
3086 }
3087 // Read them back through the underlying array.
3088 for (intptr_t i = 0; i < data_length; ++i) {
3089 EXPECT_EQ(33 * i, data[i]);
3090 }
3091}
DART_EXPORT Dart_TypedData_Type Dart_GetTypeOfExternalTypedData(Dart_Handle object)
DART_EXPORT Dart_Handle Dart_IntegerToInt64(Dart_Handle integer, int64_t *value)
DART_EXPORT Dart_Handle Dart_ListLength(Dart_Handle list, intptr_t *length)
DART_EXPORT Dart_Handle Dart_ListGetAt(Dart_Handle list, intptr_t index)
DART_EXPORT bool Dart_IsList(Dart_Handle object)

◆ ExternalTypedDataFinalizer() [1/2]

static void dart::ExternalTypedDataFinalizer ( void *  isolate_callback_data,
void *  peer 
)
static

Definition at line 1112 of file isolate.cc.

1113 {
1114 free(peer);
1115}

◆ ExternalTypedDataFinalizer() [2/2]

static void dart::ExternalTypedDataFinalizer ( void *  isolate_callback_data,
void *  peer 
)
static

Definition at line 3150 of file dart_api_impl_test.cc.

3151 {
3152 *static_cast<int*>(peer) = 42;
3153}

◆ ExtractElementTypeFromArrayType()

static AbstractTypePtr dart::ExtractElementTypeFromArrayType ( const AbstractType array_type)
static

Definition at line 1829 of file type_propagator.cc.

1830 {
1831 if (array_type.IsTypeParameter()) {
1833 AbstractType::Handle(TypeParameter::Cast(array_type).bound()));
1834 }
1835 if (!array_type.IsType()) {
1836 return Object::dynamic_type().ptr();
1837 }
1838 const intptr_t cid = array_type.type_class_id();
1839 if (cid == kGrowableObjectArrayCid || cid == kArrayCid ||
1840 cid == kImmutableArrayCid ||
1841 array_type.type_class() ==
1842 IsolateGroup::Current()->object_store()->list_class()) {
1843 const auto& type_args =
1844 TypeArguments::Handle(Type::Cast(array_type).arguments());
1845 return type_args.TypeAtNullSafe(Array::kElementTypeTypeArgPos);
1846 }
1847 return Object::dynamic_type().ptr();
1848}

◆ ExtractInterfaceTypeArgs()

static bool dart::ExtractInterfaceTypeArgs ( Zone zone,
const Class instance_cls,
const TypeArguments instance_type_args,
const Class interface_cls,
TypeArguments interface_type_args 
)
static

Definition at line 356 of file object.cc.

360 {
361 Thread* thread = Thread::Current();
362 Class& cur_cls = Class::Handle(zone, instance_cls.ptr());
363 // The following code is a specialization of Class::IsSubtypeOf().
364 Array& interfaces = Array::Handle(zone);
365 Type& interface = Type::Handle(zone);
366 Class& cur_interface_cls = Class::Handle(zone);
367 TypeArguments& cur_interface_type_args = TypeArguments::Handle(zone);
368 while (true) {
369 // Additional subtyping rules related to 'FutureOr' are not applied.
370 if (cur_cls.ptr() == interface_cls.ptr()) {
371 *interface_type_args = instance_type_args.ptr();
372 return true;
373 }
374 interfaces = cur_cls.interfaces();
375 for (intptr_t i = 0; i < interfaces.Length(); i++) {
376 interface ^= interfaces.At(i);
377 ASSERT(interface.IsFinalized());
378 cur_interface_cls = interface.type_class();
379 cur_interface_type_args =
380 interface.GetInstanceTypeArguments(thread, /*canonicalize=*/false);
381 if (!cur_interface_type_args.IsNull() &&
382 !cur_interface_type_args.IsInstantiated()) {
383 cur_interface_type_args = cur_interface_type_args.InstantiateFrom(
384 instance_type_args, Object::null_type_arguments(), kNoneFree,
385 Heap::kNew);
386 }
387 if (ExtractInterfaceTypeArgs(zone, cur_interface_cls,
388 cur_interface_type_args, interface_cls,
389 interface_type_args)) {
390 return true;
391 }
392 }
393 cur_cls = cur_cls.SuperClass();
394 if (cur_cls.IsNull()) {
395 return false;
396 }
397 }
398}
TypeArgumentsPtr InstantiateFrom(const TypeArguments &instantiator_type_arguments, const TypeArguments &function_type_arguments, intptr_t num_free_fun_type_params, Heap::Space space, FunctionTypeMapping *function_type_mapping=nullptr, intptr_t num_parent_type_args_adjustment=0) const
Definition object.cc:7598

◆ Failure()

static TTSTestCase dart::Failure ( const TTSTestCase original)
static

Definition at line 363 of file type_testing_stubs_test.cc.

363 {
364 return TTSTestCase(original.instance, original.instantiator_tav,
365 original.function_tav, kFail);
366}
const TypeArguments & function_tav
const TypeArguments & instantiator_tav

◆ FalseNegative()

static TTSTestCase dart::FalseNegative ( const TTSTestCase original)
static

Definition at line 377 of file type_testing_stubs_test.cc.

377 {
378 return TTSTestCase(original.instance, original.instantiator_tav,
379 original.function_tav, kNewSTCEntry);
380}

◆ Fatal()

void dart::Fatal ( char const *  file,
int  line,
char const *  error 
)

Definition at line 427 of file ffi_test_functions_vmspecific.cc.

427 {
428 printf("FATAL %s:%i\n", file, line);
429 printf("%s\n", error);
432 abort();
433}
DART_EXPORT void Dart_PrepareToAbort(void)
DART_EXPORT void Dart_DumpNativeStackTrace(void *context)

◆ FfiNativeResolver() [1/2]

static void * dart::FfiNativeResolver ( const char *  name,
uintptr_t  args_n 
)
static

Definition at line 1222 of file ffi_test_functions_vmspecific.cc.

1222 {
1223 if (strcmp(name, "Dart_SetNativeInstanceField") == 0 && args_n == 3) {
1224 return reinterpret_cast<void*>(Dart_SetNativeInstanceField);
1225 }
1226 if (strcmp(name, "IsThreadInGenerated") == 0 && args_n == 0) {
1227 return reinterpret_cast<void*>(IsThreadInGenerated);
1228 }
1229 if (strcmp(name, "ReturnIntPtr") == 0 && args_n == 1) {
1230 return reinterpret_cast<void*>(ReturnIntPtr);
1231 }
1232 if (strcmp(name, "PassAsHandle") == 0 && args_n == 1) {
1233 return reinterpret_cast<void*>(PassAsHandle);
1234 }
1235 if (strcmp(name, "PassAsPointer") == 0 && args_n == 1) {
1236 return reinterpret_cast<void*>(PassAsPointer);
1237 }
1238 if (strcmp(name, "PassAsPointerAndValue") == 0 && args_n == 2) {
1239 return reinterpret_cast<void*>(PassAsPointerAndValue);
1240 }
1241 if (strcmp(name, "PassAsValueAndPointer") == 0 && args_n == 2) {
1242 return reinterpret_cast<void*>(PassAsValueAndPointer);
1243 }
1244 if (strcmp(name, "AllocateResource") == 0 && args_n == 1) {
1245 return reinterpret_cast<void*>(AllocateResource);
1246 }
1247 if (strcmp(name, "DeleteResource") == 0 && args_n == 1) {
1248 return reinterpret_cast<void*>(DeleteResource);
1249 }
1250 if (strcmp(name, "GetResourceValue") == 0 && args_n == 1) {
1251 return reinterpret_cast<void*>(GetResourceValue);
1252 }
1253 if (strcmp(name, "SetResourceFinalizer") == 0 && args_n == 2) {
1254 return reinterpret_cast<void*>(SetResourceFinalizer);
1255 }
1256 if (strcmp(name, "AddPtrAndInt") == 0 && args_n == 2) {
1257 return reinterpret_cast<void*>(AddPtrAndInt);
1258 }
1259 if (strcmp(name, "AddHandleFieldAndInt") == 0 && args_n == 2) {
1260 return reinterpret_cast<void*>(AddHandleFieldAndInt);
1261 }
1262 if (strcmp(name, "AddPtrAndPtr") == 0 && args_n == 2) {
1263 return reinterpret_cast<void*>(AddPtrAndPtr);
1264 }
1265 if (strcmp(name, "AddHandleFieldAndPtr") == 0 && args_n == 2) {
1266 return reinterpret_cast<void*>(AddHandleFieldAndPtr);
1267 }
1268 if (strcmp(name, "AddHandleFieldAndHandleField") == 0 && args_n == 2) {
1269 return reinterpret_cast<void*>(AddHandleFieldAndHandleField);
1270 }
1271 if (strcmp(name, "AddPtrAndHandleField") == 0 && args_n == 2) {
1272 return reinterpret_cast<void*>(AddPtrAndHandleField);
1273 }
1274 if (strcmp(name, "ReturnIntPtrMethod") == 0 && args_n == 2) {
1275 return reinterpret_cast<void*>(ReturnIntPtrMethod);
1276 }
1277 // This should be unreachable in tests.
1278 ENSURE(false);
1279}
DART_EXPORT Dart_Handle Dart_SetNativeInstanceField(Dart_Handle obj, int index, intptr_t value)
DART_EXPORT some_resource * AllocateResource()
intptr_t PassAsPointer(void *ptr)
intptr_t AddPtrAndHandleField(void *self, Dart_Handle other)
intptr_t AddPtrAndPtr(void *self, void *other)
intptr_t ReturnIntPtr(intptr_t x)
intptr_t PassAsValueAndPointer(intptr_t value, void *ptr)
intptr_t PassAsPointerAndValue(void *ptr, intptr_t value)
intptr_t AddHandleFieldAndHandleField(Dart_Handle self, Dart_Handle other)
void SetResourceFinalizer(Dart_Handle handle, intptr_t *resource)
intptr_t GetResourceValue(intptr_t *resource)
void DeleteResource(intptr_t *resource)
intptr_t AddHandleFieldAndInt(Dart_Handle self, intptr_t x)
intptr_t ReturnIntPtrMethod(Dart_Handle self, intptr_t value)
intptr_t AddHandleFieldAndPtr(Dart_Handle self, void *other)
intptr_t PassAsHandle(Dart_Handle handle)
intptr_t AddPtrAndInt(void *self, intptr_t x)

◆ FfiNativeResolver() [2/2]

static void * dart::FfiNativeResolver ( const char *  name,
uintptr_t  args_n 
)
static

Definition at line 10120 of file dart_api_impl_test.cc.

◆ FfiResolve()

static intptr_t dart::FfiResolve ( Dart_Handle  asset_handle,
Dart_Handle  symbol_handle,
uintptr_t  args_n 
)
static

Definition at line 518 of file ffi_dynamic_library.cc.

520 {
521 auto* const thread = Thread::Current();
522 DARTSCOPE(thread);
523 auto* const zone = thread->zone();
524 const String& asset = Api::UnwrapStringHandle(zone, asset_handle);
525 const String& symbol = Api::UnwrapStringHandle(zone, symbol_handle);
526 char* error = nullptr;
527
528 const intptr_t result = FfiResolveInternal(asset, symbol, args_n, &error);
529 if (error != nullptr) {
530 ThrowFfiResolveError(symbol, asset, error);
531 }
532 ASSERT(result != 0x0);
533 return result;
534}
static void ThrowFfiResolveError(const String &symbol, const String &asset, char *error)
intptr_t FfiResolveInternal(const String &asset, const String &symbol, uintptr_t args_n, char **error)

◆ FfiResolveAsset()

static void * dart::FfiResolveAsset ( Thread *const  thread,
const Array asset_location,
const String symbol,
char **  error 
)
static

Definition at line 385 of file ffi_dynamic_library.cc.

388 {
389 Zone* const zone = thread->zone();
390
391 const auto& asset_type =
392 String::Cast(Object::Handle(zone, asset_location.At(0)));
393 String& path = String::Handle(zone);
394 if (asset_type.Equals(Symbols::absolute()) ||
395 asset_type.Equals(Symbols::relative()) ||
396 asset_type.Equals(Symbols::system())) {
397 path = String::RawCast(asset_location.At(1));
398 }
399 void* handle = nullptr;
400 if (asset_type.Equals(Symbols::absolute())) {
401 handle = LoadDynamicLibrary(path.ToCString(), error);
402 } else if (asset_type.Equals(Symbols::relative())) {
403 const auto& platform_script_uri = String::Handle(
404 zone,
405 String::NewFormatted(
406 "%s%s", file_schema,
407 String::Handle(zone, GetPlatformScriptPath(thread)).ToCString()));
408 const char* target_uri = nullptr;
409 char* path_cstr = path.ToMallocCString();
410#if defined(DART_TARGET_OS_WINDOWS)
411 ReplaceBackSlashes(path_cstr);
412#endif
413 const bool resolved =
414 ResolveUri(path_cstr, platform_script_uri.ToCString(), &target_uri);
415 free(path_cstr);
416 if (!resolved) {
417 *error = OS::SCreate(/*use malloc*/ nullptr,
418 "Failed to resolve '%s' relative to '%s'.",
419 path.ToCString(), platform_script_uri.ToCString());
420 } else {
421 const char* target_path = target_uri + file_schema_length;
422 handle = LoadDynamicLibrary(target_path, error);
423 }
424 } else if (asset_type.Equals(Symbols::system())) {
425 handle = LoadDynamicLibrary(path.ToCString(), error);
426 } else if (asset_type.Equals(Symbols::process())) {
427#if defined(DART_HOST_OS_LINUX) || defined(DART_HOST_OS_MACOS) || \
428 defined(DART_HOST_OS_ANDROID) || defined(DART_HOST_OS_FUCHSIA)
429 handle = RTLD_DEFAULT;
430#else
431 handle = kWindowsDynamicLibraryProcessPtr;
432#endif
433 } else if (asset_type.Equals(Symbols::executable())) {
434 handle = LoadDynamicLibrary(nullptr, error);
435 } else {
436 UNREACHABLE();
437 }
438 if (*error != nullptr) {
439 char* inner_error = *error;
440 *error = OS::SCreate(/*use malloc*/ nullptr,
441 "Failed to load dynamic library '%s': %s",
442 path.ToCString(), inner_error);
443 free(inner_error);
444 } else {
445 void* const result = ResolveSymbol(handle, symbol.ToCString(), error);
446 if (*error != nullptr) {
447 char* inner_error = *error;
448 *error = OS::SCreate(/*use malloc*/ nullptr,
449 "Failed to lookup symbol '%s': %s",
450 symbol.ToCString(), inner_error);
451 free(inner_error);
452 } else {
453 return result;
454 }
455 }
456 ASSERT(*error != nullptr);
457 return nullptr;
458}
const int file_schema_length
static StringPtr GetPlatformScriptPath(Thread *thread)
static void * ResolveSymbol(void *handle, const char *symbol, char **error)
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
Definition switches.h:57

◆ FfiResolveInternal()

intptr_t dart::FfiResolveInternal ( const String asset,
const String symbol,
uintptr_t  args_n,
char **  error 
)

Definition at line 471 of file ffi_dynamic_library.cc.

474 {
475 Thread* thread = Thread::Current();
476 Zone* zone = thread->zone();
477
478 // Resolver resolution.
479 auto resolver = GetFfiNativeResolver(thread, asset);
480 if (resolver != nullptr) {
481 void* ffi_native_result = FfiResolveWithFfiNativeResolver(
482 thread, resolver, symbol, args_n, error);
483 return reinterpret_cast<intptr_t>(ffi_native_result);
484 }
485
486 // Native assets resolution.
487 const auto& asset_location =
488 Array::Handle(zone, GetAssetLocation(thread, asset));
489 if (!asset_location.IsNull()) {
490 void* asset_result = FfiResolveAsset(thread, asset_location, symbol, error);
491 return reinterpret_cast<intptr_t>(asset_result);
492 }
493
494 // Resolution in current process.
495#if !defined(DART_HOST_OS_WINDOWS)
496 void* const result = Utils::ResolveSymbolInDynamicLibrary(
497 RTLD_DEFAULT, symbol.ToCString(), error);
498#else
499 void* const result = LookupSymbolInProcess(symbol.ToCString(), error);
500#endif
501
502 if (*error != nullptr) {
503 // Process lookup failed, but the user might have tried to use native
504 // asset lookup. So augment the error message to include native assets info.
505 char* process_lookup_error = *error;
506 *error = OS::SCreate(/*use malloc*/ nullptr,
507 "No asset with id '%s' found. %s "
508 "Attempted to fallback to process lookup. %s",
509 asset.ToCString(), AvailableAssetsToCString(thread),
510 process_lookup_error);
511 free(process_lookup_error);
512 }
513
514 return reinterpret_cast<intptr_t>(result);
515}
static Dart_FfiNativeResolver GetFfiNativeResolver(Thread *const thread, const String &lib_url_str)
static void * FfiResolveWithFfiNativeResolver(Thread *const thread, Dart_FfiNativeResolver resolver, const String &symbol, intptr_t args_n, char **error)
static char * AvailableAssetsToCString(Thread *const thread)

◆ FfiResolveWithFfiNativeResolver()

static void * dart::FfiResolveWithFfiNativeResolver ( Thread *const  thread,
Dart_FfiNativeResolver  resolver,
const String symbol,
intptr_t  args_n,
char **  error 
)
static

Definition at line 270 of file ffi_dynamic_library.cc.

274 {
275 auto* result = resolver(symbol.ToCString(), args_n);
276 if (result == nullptr) {
277 *error = OS::SCreate(/*use malloc*/ nullptr,
278 "Couldn't resolve function: '%s'", symbol.ToCString());
279 }
280 return result;
281}

◆ FillDeferredSlots()

static void dart::FillDeferredSlots ( DeoptContext deopt_context,
DeferredSlot **  slot_list 
)
static

Definition at line 343 of file deopt_instructions.cc.

344 {
345 DeferredSlot* slot = *slot_list;
346 *slot_list = nullptr;
347
348 while (slot != nullptr) {
349 DeferredSlot* current = slot;
350 slot = slot->next();
351
352 current->Materialize(deopt_context);
353
354 delete current;
355 }
356}
virtual void Materialize(DeoptContext *deopt_context)=0
DeferredSlot * next() const

◆ FillSummary()

static void dart::FillSummary ( LocationSummary locs,
Location  expected_output,
const LocationArray expected_inputs,
const LocationArray expected_temps 
)
static

Definition at line 55 of file locations_helpers_test.cc.

58 {
59 locs->set_out(0, expected_output);
60 for (intptr_t i = 0; i < expected_inputs->length(); i++) {
61 locs->set_in(i, expected_inputs->At(i));
62 }
63 for (intptr_t i = 0; i < expected_temps->length(); i++) {
64 locs->set_temp(i, expected_temps->At(i));
65 }
66}
void set_temp(intptr_t index, Location loc)
Definition locations.h:894
void set_out(intptr_t index, Location loc)
Definition locations.cc:232
void set_in(intptr_t index, Location loc)
Definition locations.cc:205

◆ FinalizableHandleCallback()

static void dart::FinalizableHandleCallback ( void *  isolate_callback_data,
void *  peer 
)
static

Definition at line 3594 of file dart_api_impl_test.cc.

3594 {
3595 if (peer == finalizable_new_ref_peer) {
3597 finalizable_new_ref = nullptr;
3598 } else if (peer == finalizable_old_ref_peer) {
3599 finalizable_old_ref_peer = 0;
3600 finalizable_old_ref = nullptr;
3601 }
3602}
static void * finalizable_new_ref_peer
static Dart_FinalizableHandle finalizable_new_ref

◆ FinalizableHandlePeerCleanupFinalizer()

static void dart::FinalizableHandlePeerCleanupFinalizer ( void *  isolate_callback_data,
void *  peer 
)
static

Definition at line 3890 of file dart_api_impl_test.cc.

3891 {
3892 Dart_DeletePersistentHandle(persistent_handle1);
3893 Dart_DeleteWeakPersistentHandle(weak_persistent_handle2);
3894 *static_cast<int*>(peer) = 42;
3895}
DART_EXPORT void Dart_DeletePersistentHandle(Dart_PersistentHandle object)

◆ FinalizableHandlePeerFinalizer()

static void dart::FinalizableHandlePeerFinalizer ( void *  isolate_callback_data,
void *  peer 
)
static

Definition at line 3952 of file dart_api_impl_test.cc.

3953 {
3954 *static_cast<int*>(peer) = 42;
3955}

◆ FinalizeAndCanonicalize() [1/2]

static void dart::FinalizeAndCanonicalize ( AbstractType type)
static

Definition at line 7398 of file object_test.cc.

◆ FinalizeAndCanonicalize() [2/2]

static void dart::FinalizeAndCanonicalize ( AbstractType type)
static

Definition at line 190 of file type_testing_stubs_test.cc.

190 {
191 *type = ClassFinalizer::FinalizeType(*type);
192 ASSERT(type->IsCanonical());
193}

◆ FinalizeBuiltinClasses()

static void dart::FinalizeBuiltinClasses ( Thread thread)
static

Definition at line 896 of file dart.cc.

896 {
897 auto class_table = thread->isolate_group()->class_table();
898 Class& cls = Class::Handle(thread->zone());
899 for (intptr_t cid = kInstanceCid; cid < kNumPredefinedCids; cid++) {
900 if (class_table->HasValidClassAt(cid)) {
901 cls = class_table->At(cid);
902 RELEASE_ASSERT(cls.EnsureIsFinalized(thread) == Object::null());
903 }
904 }
905}

◆ FinalizeHash()

uint32_t dart::FinalizeHash ( uint32_t  hash,
intptr_t  hashbits = kBitsPerInt32 
)
inline

Definition at line 20 of file hash.h.

20 {
21 // Keep in sync with AssemblerBase::FinalizeHash.
22 hash += hash << 3;
23 hash ^= hash >> 11; // Logical shift, unsigned hash.
24 hash += hash << 15;
25 if (hashbits < kBitsPerInt32) {
26 hash &= (static_cast<uint32_t>(1) << hashbits) - 1;
27 }
28 return (hash == 0) ? 1 : hash;
29}

◆ Finalizer() [1/2]

static void dart::Finalizer ( void *  isolate_callback_data,
void *  buffer 
)
static

Definition at line 192 of file json_stream.cc.

192 {
193 free(buffer);
194}

◆ Finalizer() [2/2]

static void dart::Finalizer ( void *  isolate_callback_data,
void *  buffer 
)
static

Definition at line 1075 of file service.cc.

1075 {
1076 free(buffer);
1077}

◆ Finalizer_ClearDetachOne()

static void dart::Finalizer_ClearDetachOne ( Thread thread,
Heap::Space  space 
)
static

Definition at line 3918 of file object_test.cc.

3918 {
3919#ifdef DEBUG
3920 SetFlagScope<bool> sfs(&FLAG_trace_finalizers, true);
3921#endif
3922
3923 MessageHandler* handler = thread->isolate()->message_handler();
3924 {
3926 EXPECT_EQ(0, aq.queue()->Length());
3927 }
3928
3929 const auto& finalizer = Finalizer::Handle(Finalizer::New(space));
3930 finalizer.set_isolate(thread->isolate());
3931 const auto& entry =
3932 FinalizerEntry::Handle(FinalizerEntry::New(finalizer, space));
3933 const auto& value = String::Handle(OneByteString::New("value", space));
3934 entry.set_value(value);
3935 const auto& token = String::Handle(OneByteString::New("token", space));
3936 entry.set_token(token);
3937
3938 {
3939 HANDLESCOPE(thread);
3940 const auto& detach = String::Handle(OneByteString::New("detach", space));
3941 entry.set_detach(detach);
3942 }
3943
3944 if (space == Heap::kNew) {
3945 GCTestHelper::CollectNewSpace();
3946 } else {
3947 GCTestHelper::CollectAllGarbage();
3948 }
3949
3950 // Detach should have been collected.
3951 EXPECT_NE(Object::null(), entry.value());
3952 EXPECT_EQ(Object::null(), entry.detach());
3953 EXPECT_NE(Object::null(), entry.token());
3954
3955 // The entry should not have moved to the collected list.
3956 EXPECT_EQ(0,
3957 NumEntries(FinalizerEntry::Handle(finalizer.entries_collected())));
3958
3959 // We should have no messages.
3960 {
3961 // Acquire ownership of message handler queues.
3962 MessageHandler::AcquiredQueues aq(handler);
3963 EXPECT_EQ(0, aq.queue()->Length());
3964 }
3965}
static int NumEntries(const FinalizerEntry &entry, intptr_t acc=0)

◆ Finalizer_ClearValueOne()

static void dart::Finalizer_ClearValueOne ( Thread thread,
Heap::Space  space,
bool  null_token 
)
static

Definition at line 3975 of file object_test.cc.

3977 {
3978#ifdef DEBUG
3979 SetFlagScope<bool> sfs(&FLAG_trace_finalizers, true);
3980#endif
3981
3982 MessageHandler* handler = thread->isolate()->message_handler();
3983 {
3985 EXPECT_EQ(0, aq.queue()->Length());
3986 }
3987
3988 const auto& finalizer = Finalizer::Handle(Finalizer::New(space));
3989 finalizer.set_isolate(thread->isolate());
3990 const auto& entry =
3991 FinalizerEntry::Handle(FinalizerEntry::New(finalizer, space));
3992 const auto& detach = String::Handle(OneByteString::New("detach", space));
3993 auto& token = Object::Handle();
3994 if (null_token) {
3995 // Null is a valid token in Dart finalizers.
3996 token = Object::null();
3997 } else {
3998 token = OneByteString::New("token", space);
3999 }
4000 entry.set_token(token);
4001 entry.set_detach(detach);
4002
4003 {
4004 HANDLESCOPE(thread);
4005 const auto& value = String::Handle(OneByteString::New("value", space));
4006 entry.set_value(value);
4007 }
4008
4009 if (space == Heap::kNew) {
4010 GCTestHelper::CollectNewSpace();
4011 } else {
4012 GCTestHelper::CollectAllGarbage();
4013 }
4014
4015 // Value should have been collected.
4016 EXPECT_EQ(Object::null(), entry.value());
4017 EXPECT_NE(Object::null(), entry.detach());
4018
4019 // The entry should have moved to the collected list.
4020 EXPECT_EQ(1,
4021 NumEntries(FinalizerEntry::Handle(finalizer.entries_collected())));
4022
4023 // We should have 1 message.
4024 {
4025 // Acquire ownership of message handler queues.
4026 MessageHandler::AcquiredQueues aq(handler);
4027 EXPECT_EQ(1, aq.queue()->Length());
4028 }
4029}

◆ Finalizer_DetachOne()

static void dart::Finalizer_DetachOne ( Thread thread,
Heap::Space  space,
bool  clear_value 
)
static

Definition at line 4047 of file object_test.cc.

4049 {
4050#ifdef DEBUG
4051 SetFlagScope<bool> sfs(&FLAG_trace_finalizers, true);
4052#endif
4053
4054 MessageHandler* handler = thread->isolate()->message_handler();
4055 {
4057 EXPECT_EQ(0, aq.queue()->Length());
4058 }
4059
4060 const auto& finalizer = Finalizer::Handle(Finalizer::New(space));
4061 finalizer.set_isolate(thread->isolate());
4062 const auto& entry =
4063 FinalizerEntry::Handle(FinalizerEntry::New(finalizer, space));
4064 const auto& detach = String::Handle(OneByteString::New("detach", space));
4065 entry.set_detach(detach);
4066
4067 // Simulate calling detach, setting the token of the entry to the entry.
4068 entry.set_token(entry);
4069
4070 auto& value = String::Handle();
4071 {
4072 HANDLESCOPE(thread);
4073
4074 const auto& object = String::Handle(OneByteString::New("value", space));
4075 entry.set_value(object);
4076 if (!clear_value) {
4077 value = object.ptr();
4078 }
4079 }
4080
4081 if (space == Heap::kNew) {
4082 GCTestHelper::CollectNewSpace();
4083 } else {
4084 GCTestHelper::CollectAllGarbage();
4085 }
4086
4087 EXPECT((entry.value() == Object::null()) ^ !clear_value);
4088 EXPECT_NE(Object::null(), entry.detach());
4089 EXPECT_EQ(entry.ptr(), entry.token());
4090
4091 // The entry should have been removed entirely
4092 EXPECT_EQ(0,
4093 NumEntries(FinalizerEntry::Handle(finalizer.entries_collected())));
4094
4095 // We should have no message.
4096 {
4097 // Acquire ownership of message handler queues.
4098 MessageHandler::AcquiredQueues aq(handler);
4099 EXPECT_EQ(0, aq.queue()->Length());
4100 }
4101}

◆ Finalizer_GcFinalizer()

static void dart::Finalizer_GcFinalizer ( Thread thread,
Heap::Space  space 
)
static

Definition at line 4119 of file object_test.cc.

4119 {
4120#ifdef DEBUG
4121 SetFlagScope<bool> sfs(&FLAG_trace_finalizers, true);
4122#endif
4123
4124 MessageHandler* handler = thread->isolate()->message_handler();
4125 {
4127 EXPECT_EQ(0, aq.queue()->Length());
4128 }
4129
4130 const auto& detach = String::Handle(OneByteString::New("detach", space));
4131 const auto& token = String::Handle(OneByteString::New("token", space));
4132
4133 {
4134 HANDLESCOPE(thread);
4135 const auto& finalizer = Finalizer::Handle(Finalizer::New(space));
4136 finalizer.set_isolate(thread->isolate());
4137 const auto& entry =
4138 FinalizerEntry::Handle(FinalizerEntry::New(finalizer, space));
4139 entry.set_detach(detach);
4140 entry.set_token(token);
4141 const auto& value = String::Handle(OneByteString::New("value", space));
4142 entry.set_value(value);
4143 }
4144
4145 if (space == Heap::kNew) {
4146 GCTestHelper::CollectNewSpace();
4147 } else {
4148 GCTestHelper::CollectAllGarbage();
4149 }
4150
4151 // We should have no message, the Finalizer itself has been GCed.
4152 {
4153 // Acquire ownership of message handler queues.
4154 MessageHandler::AcquiredQueues aq(handler);
4155 EXPECT_EQ(0, aq.queue()->Length());
4156 }
4157}

◆ Finalizer_PreserveOne()

static void dart::Finalizer_PreserveOne ( Thread thread,
Heap::Space  space,
bool  with_detach 
)
static

Definition at line 3850 of file object_test.cc.

3852 {
3853#ifdef DEBUG
3854 SetFlagScope<bool> sfs(&FLAG_trace_finalizers, true);
3855#endif
3856
3857 MessageHandler* handler = thread->isolate()->message_handler();
3858 {
3860 EXPECT_EQ(0, aq.queue()->Length());
3861 }
3862
3863 const auto& finalizer = Finalizer::Handle(Finalizer::New(space));
3864 finalizer.set_isolate(thread->isolate());
3865 const auto& entry =
3866 FinalizerEntry::Handle(FinalizerEntry::New(finalizer, space));
3867 const auto& value = String::Handle(OneByteString::New("value", space));
3868 entry.set_value(value);
3869 auto& detach = Object::Handle();
3870 if (with_detach) {
3871 detach = OneByteString::New("detach", space);
3872 } else {
3873 detach = Object::null();
3874 }
3875 entry.set_detach(detach);
3876 const auto& token = String::Handle(OneByteString::New("token", space));
3877 entry.set_token(token);
3878
3879 if (space == Heap::kNew) {
3880 GCTestHelper::CollectNewSpace();
3881 } else {
3882 GCTestHelper::CollectAllGarbage();
3883 }
3884
3885 // Nothing in the entry should have been collected.
3886 EXPECT_NE(Object::null(), entry.value());
3887 EXPECT((entry.detach() == Object::null()) ^ with_detach);
3888 EXPECT_NE(Object::null(), entry.token());
3889
3890 // The entry should not have moved to the collected list.
3891 EXPECT_EQ(0,
3892 NumEntries(FinalizerEntry::Handle(finalizer.entries_collected())));
3893
3894 // We should have no messages.
3895 {
3896 // Acquire ownership of message handler queues.
3897 MessageHandler::AcquiredQueues aq(handler);
3898 EXPECT_EQ(0, aq.queue()->Length());
3899 }
3900}

◆ Finalizer_TwoEntries()

static void dart::Finalizer_TwoEntries ( Thread thread,
Heap::Space  space,
bool  clear_value_1,
bool  clear_value_2,
bool  clear_detach_1,
bool  clear_detach_2 
)
static

Definition at line 4269 of file object_test.cc.

4274 {
4275 const bool collect_old_space = true;
4276 const bool collect_new_space = space == Heap::kNew;
4277 const bool evacuate_new_space_and_collect_old_space = !collect_new_space;
4278
4280 for (intptr_t i = 0; i < kFinalizerTwoEntriesNumObjects; i++) {
4281 spaces[i] = space;
4282 }
4283 Finalizer_TwoEntriesCrossGen(
4284 thread, spaces, collect_old_space, collect_new_space,
4285 evacuate_new_space_and_collect_old_space, clear_value_1, clear_value_2,
4286 clear_detach_1, clear_detach_2);
4287}
const intptr_t kFinalizerTwoEntriesNumObjects

◆ Finalizer_TwoEntriesCrossGen() [1/2]

static void dart::Finalizer_TwoEntriesCrossGen ( Thread thread,
Heap::Space spaces,
bool  collect_old_space,
bool  collect_new_space,
bool  evacuate_new_space_and_collect_old_space,
bool  clear_value_1,
bool  clear_value_2,
bool  clear_detach_1,
bool  clear_detach_2 
)
static

Definition at line 4167 of file object_test.cc.

4176 {
4177#ifdef DEBUG
4178 SetFlagScope<bool> sfs(&FLAG_trace_finalizers, true);
4179#endif
4180
4181 MessageHandler* handler = thread->isolate()->message_handler();
4182 // We're reusing the isolate in a loop, so there are messages from previous
4183 // runs of this test.
4184 intptr_t queue_length_start = 0;
4185 {
4187 queue_length_start = aq.queue()->Length();
4188 }
4189
4190 const auto& finalizer = Finalizer::Handle(Finalizer::New(spaces[0]));
4191 finalizer.set_isolate(thread->isolate());
4192 const auto& entry1 =
4193 FinalizerEntry::Handle(FinalizerEntry::New(finalizer, spaces[1]));
4194 const auto& entry2 =
4195 FinalizerEntry::Handle(FinalizerEntry::New(finalizer, spaces[2]));
4196
4197 auto& value1 = String::Handle();
4198 auto& detach1 = String::Handle();
4199 const auto& token1 = String::Handle(OneByteString::New("token1", spaces[3]));
4200 entry1.set_token(token1);
4201
4202 auto& value2 = String::Handle();
4203 auto& detach2 = String::Handle();
4204 const auto& token2 = String::Handle(OneByteString::New("token2", spaces[4]));
4205 entry2.set_token(token2);
4206 entry2.set_detach(detach2);
4207
4208 {
4209 HANDLESCOPE(thread);
4210 auto& object = String::Handle();
4211
4212 object ^= OneByteString::New("value1", spaces[5]);
4213 entry1.set_value(object);
4214 if (!clear_value_1) {
4215 value1 = object.ptr();
4216 }
4217
4218 object ^= OneByteString::New("detach", spaces[6]);
4219 entry1.set_detach(object);
4220 if (!clear_detach_1) {
4221 detach1 = object.ptr();
4222 }
4223
4224 object ^= OneByteString::New("value2", spaces[7]);
4225 entry2.set_value(object);
4226 if (!clear_value_2) {
4227 value2 = object.ptr();
4228 }
4229
4230 object ^= OneByteString::New("detach", spaces[8]);
4231 entry2.set_detach(object);
4232 if (!clear_detach_2) {
4233 detach2 = object.ptr();
4234 }
4235 }
4236
4237 if (collect_old_space) {
4238 GCTestHelper::CollectOldSpace();
4239 }
4240 if (collect_new_space) {
4241 GCTestHelper::CollectNewSpace();
4242 }
4243 if (evacuate_new_space_and_collect_old_space) {
4244 GCTestHelper::CollectAllGarbage();
4245 }
4246
4247 EXPECT((entry1.value() == Object::null()) ^ !clear_value_1);
4248 EXPECT((entry2.value() == Object::null()) ^ !clear_value_2);
4249 EXPECT((entry1.detach() == Object::null()) ^ !clear_detach_1);
4250 EXPECT((entry2.detach() == Object::null()) ^ !clear_detach_2);
4251 EXPECT_NE(Object::null(), entry1.token());
4252 EXPECT_NE(Object::null(), entry2.token());
4253
4254 const intptr_t expect_num_cleared =
4255 (clear_value_1 ? 1 : 0) + (clear_value_2 ? 1 : 0);
4256 EXPECT_EQ(expect_num_cleared,
4257 NumEntries(FinalizerEntry::Handle(finalizer.entries_collected())));
4258
4259 const intptr_t expect_num_messages = expect_num_cleared == 0 ? 0 : 1;
4260 {
4261 // Acquire ownership of message handler queues.
4262 MessageHandler::AcquiredQueues aq(handler);
4263 EXPECT_EQ(expect_num_messages + queue_length_start, aq.queue()->Length());
4264 }
4265}

◆ Finalizer_TwoEntriesCrossGen() [2/2]

static void dart::Finalizer_TwoEntriesCrossGen ( Thread thread,
intptr_t  test_i 
)
static

Definition at line 4329 of file object_test.cc.

4329 {
4330 ASSERT(test_i < (1 << kFinalizerTwoEntriesNumObjects));
4332 for (intptr_t i = 0; i < kFinalizerTwoEntriesNumObjects; i++) {
4333 spaces[i] = ((test_i >> i) & 0x1) == 0x1 ? Heap::kOld : Heap::kNew;
4334 }
4335 // Either collect or evacuate new space.
4336 for (const bool collect_new_space : {false, true}) {
4337 // Always run old space collection first.
4338 const bool collect_old_space = true;
4339 // Always run old space collection after new space.
4340 const bool evacuate_new_space_and_collect_old_space = true;
4341 for (intptr_t test_j = 0; test_j < 16; test_j++) {
4342 const bool clear_value_1 = (test_j >> 0 & 0x1) == 0x1;
4343 const bool clear_value_2 = (test_j >> 1 & 0x1) == 0x1;
4344 const bool clear_detach_1 = (test_j >> 2 & 0x1) == 0x1;
4345 const bool clear_detach_2 = (test_j >> 3 & 0x1) == 0x1;
4347 thread, spaces, collect_old_space, collect_new_space,
4348 evacuate_new_space_and_collect_old_space, clear_value_1,
4349 clear_value_2, clear_detach_1, clear_detach_2);
4350 }
4351 }
4352}
static void Finalizer_TwoEntriesCrossGen(Thread *thread, Heap::Space *spaces, bool collect_old_space, bool collect_new_space, bool evacuate_new_space_and_collect_old_space, bool clear_value_1, bool clear_value_2, bool clear_detach_1, bool clear_detach_2)

◆ FinalizerEntry_Generations()

static void dart::FinalizerEntry_Generations ( Generation  entry_space,
Generation  value_space,
bool  cleared_after_minor,
bool  cleared_after_major,
bool  cleared_after_all 
)
static

Definition at line 1156 of file heap_test.cc.

1160 {
1161 FinalizerEntry& entry = FinalizerEntry::Handle();
1162 GCTestHelper::CollectAllGarbage();
1163 {
1164 HANDLESCOPE(Thread::Current());
1165 switch (entry_space) {
1166 case kNew:
1167 entry = FinalizerEntry::New(FinalizerBase::Handle(), Heap::kNew);
1168 break;
1169 case kOld:
1170 entry = FinalizerEntry::New(FinalizerBase::Handle(), Heap::kOld);
1171 break;
1172 case kImm:
1173 UNREACHABLE();
1174 }
1175
1176 Object& value = Object::Handle();
1177 switch (value_space) {
1178 case kNew:
1179 value = OneByteString::New("value", Heap::kNew);
1180 break;
1181 case kOld:
1182 value = OneByteString::New("value", Heap::kOld);
1183 break;
1184 case kImm:
1185 value = Smi::New(42);
1186 break;
1187 }
1188
1189 entry.set_value(value);
1190 }
1191
1192 OS::PrintErr("%d %d\n", entry_space, value_space);
1193
1194 GCTestHelper::CollectNewSpace();
1195 if (cleared_after_minor) {
1196 EXPECT(entry.value() == Object::null());
1197 } else {
1198 EXPECT(entry.value() != Object::null());
1199 }
1200
1201 GCTestHelper::CollectOldSpace();
1202 if (cleared_after_major) {
1203 EXPECT(entry.value() == Object::null());
1204 } else {
1205 EXPECT(entry.value() != Object::null());
1206 }
1207
1208 GCTestHelper::CollectAllGarbage();
1209 if (cleared_after_all) {
1210 EXPECT(entry.value() == Object::null());
1211 } else {
1212 EXPECT(entry.value() != Object::null());
1213 }
1214}
void set_value(const Object &value) const
Definition object.h:12945
ObjectPtr value() const
Definition object.h:12944

◆ FinalizeTypedData()

static void dart::FinalizeTypedData ( void *  isolate_callback_data,
void *  peer 
)
static

Definition at line 8239 of file dart_api_impl_test.cc.

◆ FindBinarySmiOp()

static FunctionPtr dart::FindBinarySmiOp ( Zone zone,
const String name 
)
static

Definition at line 5226 of file il.cc.

5226 {
5227 const auto& smi_class = Class::Handle(zone, Smi::Class());
5228 auto& smi_op_target = Function::Handle(
5229 zone, Resolver::ResolveDynamicAnyArgs(zone, smi_class, name));
5230
5231#if !defined(DART_PRECOMPILED_RUNTIME)
5232 if (smi_op_target.IsNull() &&
5233 Function::IsDynamicInvocationForwarderName(name)) {
5234 const String& demangled = String::Handle(
5235 zone, Function::DemangleDynamicInvocationForwarderName(name));
5236 smi_op_target = Resolver::ResolveDynamicAnyArgs(zone, smi_class, demangled);
5237 }
5238#endif
5239 return smi_op_target.ptr();
5240}

◆ FindCoreLibPrivateFunction()

static FunctionPtr dart::FindCoreLibPrivateFunction ( Zone zone,
const String name 
)
static

Definition at line 287 of file dart_api_impl.cc.

287 {
288 const Library& core_lib = Library::Handle(zone, Library::CoreLibrary());
289 ASSERT(!core_lib.IsNull());
290 const Function& function =
291 Function::Handle(zone, core_lib.LookupFunctionAllowPrivate(name));
292 ASSERT(!function.IsNull());
293 return function.ptr();
294}

◆ FindCover()

static LiveRange * dart::FindCover ( LiveRange parent,
intptr_t  pos 
)
static

Definition at line 2963 of file linearscan.cc.

2963 {
2964 for (LiveRange* range = parent; range != nullptr;
2965 range = range->next_sibling()) {
2966 if (range->CanCover(pos)) {
2967 return range;
2968 }
2969 }
2970 UNREACHABLE();
2971 return nullptr;
2972}
LiveRange * next_sibling() const
Definition linearscan.h:531

◆ FindDoubleConstant()

uword dart::FindDoubleConstant ( double  value)

Definition at line 30 of file flow_graph_builder.cc.

30 {
31 intptr_t len = sizeof(kCommonDoubleConstants) / sizeof(double); // NOLINT
32 for (intptr_t i = 0; i < len; i++) {
33 if (Utils::DoublesBitEqual(value, kCommonDoubleConstants[i])) {
34 return reinterpret_cast<uword>(&kCommonDoubleConstants[i]);
35 }
36 }
37 return 0;
38}
const double kCommonDoubleConstants[]

◆ FindEntryPointPragma()

EntryPointPragma dart::FindEntryPointPragma ( IsolateGroup IG,
const Array metadata,
Field reusable_field_handle,
Object pragma 
)

Definition at line 27193 of file object.cc.

27196 {
27197 for (intptr_t i = 0; i < metadata.Length(); i++) {
27198 *pragma = metadata.At(i);
27199 if (pragma->clazz() != IG->object_store()->pragma_class()) {
27200 continue;
27201 }
27202 *reusable_field_handle = IG->object_store()->pragma_name();
27203 if (Instance::Cast(*pragma).GetField(*reusable_field_handle) !=
27204 Symbols::vm_entry_point().ptr()) {
27205 continue;
27206 }
27207 *reusable_field_handle = IG->object_store()->pragma_options();
27208 *pragma = Instance::Cast(*pragma).GetField(*reusable_field_handle);
27209 if (pragma->ptr() == Bool::null() || pragma->ptr() == Bool::True().ptr()) {
27210 return EntryPointPragma::kAlways;
27211 break;
27212 }
27213 if (pragma->ptr() == Symbols::get().ptr()) {
27214 return EntryPointPragma::kGetterOnly;
27215 }
27216 if (pragma->ptr() == Symbols::set().ptr()) {
27217 return EntryPointPragma::kSetterOnly;
27218 }
27219 if (pragma->ptr() == Symbols::call().ptr()) {
27220 return EntryPointPragma::kCallOnly;
27221 }
27222 }
27223 return EntryPointPragma::kNever;
27224}

◆ FindErrorHandler()

static void dart::FindErrorHandler ( uword handler_pc,
uword handler_sp,
uword handler_fp 
)
static

Definition at line 562 of file exceptions.cc.

564 {
565 StackFrameIterator frames(ValidationPolicy::kDontValidateFrames,
566 Thread::Current(),
567 StackFrameIterator::kNoCrossThreadIteration);
568 StackFrame* frame = frames.NextFrame();
569 ASSERT(frame != nullptr);
570 while (!frame->IsEntryFrame()) {
571 frame = frames.NextFrame();
572 ASSERT(frame != nullptr);
573 }
574 ASSERT(frame->IsEntryFrame());
575 *handler_pc = frame->pc();
576 *handler_sp = frame->sp();
577 *handler_fp = frame->fp();
578}

◆ FindExactTokenPosition()

static TokenPosition dart::FindExactTokenPosition ( const Script script,
TokenPosition  start_of_line,
intptr_t  column_number 
)
static

Definition at line 3736 of file debugger.cc.

3738 {
3739 intptr_t line;
3740 intptr_t col;
3741 if (script.GetTokenLocation(start_of_line, &line, &col)) {
3742 return TokenPosition::Deserialize(start_of_line.Pos() +
3743 (column_number - col));
3744 }
3745 return TokenPosition::kNoSource;
3746}
intptr_t Pos() const

◆ FindFirstNonEmptySuccessor()

static BlockEntryInstr * dart::FindFirstNonEmptySuccessor ( TargetEntryInstr block,
BitVector empty_blocks 
)
static

Definition at line 1695 of file constant_propagator.cc.

1696 {
1697 BlockEntryInstr* current = block;
1698 while (IsEmptyBlock(current) && block->Dominates(current)) {
1699 ASSERT(!HasPhis(block));
1700 empty_blocks->Add(current->preorder_number());
1701 current = current->next()->AsGoto()->successor();
1702 }
1703 return current;
1704}
intptr_t preorder_number() const
Definition il.h:1649
bool Dominates(BlockEntryInstr *other) const
Definition il.cc:1806
static bool HasPhis(BlockEntryInstr *block)
static bool IsEmptyBlock(BlockEntryInstr *block)

◆ FindICData()

static void dart::FindICData ( const Array ic_data_array,
intptr_t  deopt_id,
ICData ic_data 
)
static

Definition at line 97 of file object_reload.cc.

99 {
100 // ic_data_array is sorted because of how it is constructed in
101 // Function::SaveICDataMap.
102 intptr_t lo = Function::ICDataArrayIndices::kFirstICData;
103 intptr_t hi = ic_data_array.Length() - 1;
104 while (lo <= hi) {
105 intptr_t mid = (hi - lo + 1) / 2 + lo;
106 ASSERT(mid >= lo);
107 ASSERT(mid <= hi);
108 *ic_data ^= ic_data_array.At(mid);
109 if (ic_data->deopt_id() == deopt_id) {
110 return;
111 } else if (ic_data->deopt_id() > deopt_id) {
112 hi = mid - 1;
113 } else {
114 lo = mid + 1;
115 }
116 }
117 FATAL("Missing deopt id %" Pd "\n", deopt_id);
118}
intptr_t deopt_id() const
Definition object.h:2448

◆ FindInnermostClosure()

static FunctionPtr dart::FindInnermostClosure ( Zone zone,
const Function function,
TokenPosition  token_pos 
)
static

Definition at line 2891 of file debugger.cc.

2893 {
2894 ASSERT(function.end_token_pos().IsReal());
2895 const TokenPosition& func_start = function.token_pos();
2896 const Script& outer_origin = Script::Handle(zone, function.script());
2897
2898 Function& best_fit = Function::Handle(zone);
2899 ClosureFunctionsCache::ForAllClosureFunctions([&](const Function& closure) {
2900 const TokenPosition& closure_start = closure.token_pos();
2901 const TokenPosition& closure_end = closure.end_token_pos();
2902 // We're only interested in closures that have real ending token positions.
2903 // The starting token position can be synthetic.
2904 if (closure_end.IsReal() && (function.end_token_pos() > closure_end) &&
2905 (!closure_start.IsReal() || !func_start.IsReal() ||
2906 (closure_start > func_start)) &&
2907 token_pos.IsWithin(closure_start, closure_end) &&
2908 (closure.script() == outer_origin.ptr())) {
2909 UpdateBestFit(&best_fit, closure);
2910 }
2911 return true; // Continue iteration.
2912 });
2913 return best_fit.ptr();
2914}
bool IsWithin(const TokenPosition &a, const TokenPosition &b) const

◆ FindMethod()

const ServiceMethodDescriptor * dart::FindMethod ( const char *  method_name)

Definition at line 6006 of file service.cc.

6006 {
6007 intptr_t num_methods = sizeof(service_methods_) / sizeof(service_methods_[0]);
6008 for (intptr_t i = 0; i < num_methods; i++) {
6009 const ServiceMethodDescriptor& method = service_methods_[i];
6010 if (strcmp(method_name, method.name) == 0) {
6011 return &method;
6012 }
6013 }
6014 return nullptr;
6015}
static const ServiceMethodDescriptor service_methods_[]
Definition service.cc:5847

◆ FindNextRewindFrameIndex()

static intptr_t dart::FindNextRewindFrameIndex ( DebuggerStackTrace stack,
intptr_t  frame_index 
)
static

Definition at line 3180 of file debugger.cc.

3181 {
3182 for (intptr_t i = frame_index + 1; i < stack->Length(); i++) {
3183 ActivationFrame* frame = stack->FrameAt(i);
3184 if (frame->IsRewindable()) {
3185 return i;
3186 }
3187 }
3188 return -1;
3189}

◆ FindPCForTokenPosition()

static uword dart::FindPCForTokenPosition ( const Code code,
TokenPosition  tp 
)
static

Definition at line 2192 of file profiler_test.cc.

2192 {
2194 GrowableArray<TokenPosition> token_positions;
2195 for (uword pc_offset = 0; pc_offset < code.Size(); pc_offset++) {
2196 code.GetInlinedFunctionsAtInstruction(pc_offset, &functions,
2197 &token_positions);
2198 if (token_positions[0] == tp) {
2199 return code.PayloadStart() + pc_offset;
2200 }
2201 }
2202
2203 return 0;
2204}

◆ FindPragmaInMetadata()

bool dart::FindPragmaInMetadata ( Thread T,
const Object metadata_obj,
const String pragma_name,
bool  multiple,
Object options 
)

Definition at line 4142 of file object.cc.

4146 {
4147 auto IG = T->isolate_group();
4148 auto Z = T->zone();
4149
4150 // If there is a compile-time error while evaluating the metadata, we will
4151 // simply claim there was no @pragma annotation.
4152 if (metadata_obj.IsNull() || metadata_obj.IsLanguageError()) {
4153 return false;
4154 }
4155 ASSERT(metadata_obj.IsArray());
4156
4157 auto& metadata = Array::Cast(metadata_obj);
4158 auto& pragma_class = Class::Handle(Z, IG->object_store()->pragma_class());
4159 if (pragma_class.IsNull()) {
4160 // Precompiler may drop pragma class.
4161 return false;
4162 }
4163 auto& pragma_name_field =
4164 Field::Handle(Z, pragma_class.LookupField(Symbols::name()));
4165 auto& pragma_options_field =
4166 Field::Handle(Z, pragma_class.LookupField(Symbols::options()));
4167
4168 auto& pragma = Object::Handle(Z);
4169 bool found = false;
4170 auto& options_value = Object::Handle(Z);
4171 auto& results = GrowableObjectArray::Handle(Z);
4172 if (multiple) {
4173 ASSERT(options != nullptr);
4174 results ^= GrowableObjectArray::New(1);
4175 }
4176 for (intptr_t i = 0; i < metadata.Length(); ++i) {
4177 pragma = metadata.At(i);
4178 if (pragma.clazz() != pragma_class.ptr() ||
4179 Instance::Cast(pragma).GetField(pragma_name_field) !=
4180 pragma_name.ptr()) {
4181 continue;
4182 }
4183 options_value = Instance::Cast(pragma).GetField(pragma_options_field);
4184 found = true;
4185 if (multiple) {
4186 results.Add(options_value);
4187 continue;
4188 }
4189 if (options != nullptr) {
4190 *options = options_value.ptr();
4191 }
4192 return true;
4193 }
4194
4195 if (found && options != nullptr) {
4196 *options = results.ptr();
4197 }
4198 return false;
4199}
const char * options

◆ FindRetainingPath()

const char * dart::FindRetainingPath ( Zone zone_,
Isolate isolate,
const Object from,
const Object to,
TraversalRules  traversal_rules 
)

Definition at line 1288 of file object_graph_copy.cc.

1292 {
1293 RetainingPath rr(zone_, isolate, from, to, traversal_rules);
1294 return rr.FindPath();
1295}

◆ FindScript()

static ScriptPtr dart::FindScript ( DartFrameIterator iterator)
static

Definition at line 16 of file errors.cc.

16 {
17#if defined(DART_PRECOMPILED_RUNTIME)
18 // The precompiled runtime faces two issues in recovering the correct
19 // assertion text. First, the precompiled runtime does not include
20 // the inlining meta-data so we cannot walk the inline-aware stack trace.
21 // Second, the script text itself is missing so whatever script is returned
22 // from here will be missing the assertion expression text.
23 iterator->NextFrame(); // Skip _AssertionError._evaluateAssertion frame
24 return Exceptions::GetCallerScript(iterator);
25#else
26 StackFrame* stack_frame = iterator->NextFrame();
27 Code& code = Code::Handle();
28 Function& func = Function::Handle();
29 const Class& assert_error_class =
30 Class::Handle(Library::LookupCoreClass(Symbols::AssertionError()));
31 ASSERT(!assert_error_class.IsNull());
32 bool hit_assertion_error = false;
33 for (; stack_frame != nullptr; stack_frame = iterator->NextFrame()) {
34 code = stack_frame->LookupDartCode();
35 if (code.is_optimized()) {
36 InlinedFunctionsIterator inlined_iterator(code, stack_frame->pc());
37 while (!inlined_iterator.Done()) {
38 func = inlined_iterator.function();
39 if (hit_assertion_error) {
40 return func.script();
41 }
42 ASSERT(!hit_assertion_error);
43 hit_assertion_error = (func.Owner() == assert_error_class.ptr());
44 inlined_iterator.Advance();
45 }
46 continue;
47 } else {
48 func = code.function();
49 }
50 ASSERT(!func.IsNull());
51 if (hit_assertion_error) {
52 return func.script();
53 }
54 ASSERT(!hit_assertion_error);
55 hit_assertion_error = (func.Owner() == assert_error_class.ptr());
56 }
58 return Script::null();
59#endif // defined(DART_PRECOMPILED_RUNTIME)
60}
StackFrame * NextFrame()
ScriptPtr script() const
Definition object.cc:10939

◆ Finish()

static void dart::Finish ( Thread thread)
static

Definition at line 44 of file bootstrap.cc.

44 {
45 Bootstrap::SetupNativeResolver();
46 if (!ClassFinalizer::ProcessPendingClasses()) {
47 FATAL("Error in class finalization during bootstrapping.");
48 }
49
50 // Eagerly compile the _Closure class as it is the class of all closure
51 // instances. This allows us to just finalize function types without going
52 // through the hoops of trying to compile their scope class.
53 ObjectStore* object_store = thread->isolate_group()->object_store();
54 Zone* zone = thread->zone();
55 Class& cls = Class::Handle(zone, object_store->closure_class());
56 cls.EnsureIsFinalized(thread);
57
58 // Make sure _Closure fields are not marked as unboxed as they are accessed
59 // with plain loads.
60 const Array& fields = Array::Handle(zone, cls.fields());
61 Field& field = Field::Handle(zone);
62 for (intptr_t i = 0; i < fields.Length(); ++i) {
63 field ^= fields.At(i);
64 field.set_is_unboxed(false);
65 }
66 // _Closure._hash field should be explicitly marked as nullable because
67 // VM creates instances of _Closure without compiling its constructors,
68 // so it won't get nullability info from a constructor.
69 field ^= fields.At(fields.Length() - 1);
70 // Note that UserVisibleName depends on --show-internal-names.
71 ASSERT(strncmp(field.UserVisibleNameCString(), "_hash", 5) == 0);
72 field.RecordStore(Object::null_object());
73
74#if defined(DEBUG)
75 // Verify that closure field offsets are identical in Dart and C++.
76 ASSERT_EQUAL(fields.Length(), 6);
77 field ^= fields.At(0);
78 ASSERT_EQUAL(field.HostOffset(),
79 Closure::instantiator_type_arguments_offset());
80 field ^= fields.At(1);
81 ASSERT_EQUAL(field.HostOffset(), Closure::function_type_arguments_offset());
82 field ^= fields.At(2);
83 ASSERT_EQUAL(field.HostOffset(), Closure::delayed_type_arguments_offset());
84 field ^= fields.At(3);
85 ASSERT_EQUAL(field.HostOffset(), Closure::function_offset());
86 field ^= fields.At(4);
87 ASSERT_EQUAL(field.HostOffset(), Closure::context_offset());
88 field ^= fields.At(5);
89 ASSERT_EQUAL(field.HostOffset(), Closure::hash_offset());
90#endif // defined(DEBUG)
91
92 // Eagerly compile to avoid repeated checks when loading constants or
93 // serializing.
94 cls = object_store->null_class();
95 cls.EnsureIsFinalized(thread);
96 cls = object_store->bool_class();
97 cls.EnsureIsFinalized(thread);
98 cls = object_store->array_class();
99 cls.EnsureIsFinalized(thread);
100 cls = object_store->immutable_array_class();
101 cls.EnsureIsFinalized(thread);
102 cls = object_store->map_impl_class();
103 cls.EnsureIsFinalized(thread);
104 cls = object_store->const_map_impl_class();
105 cls.EnsureIsFinalized(thread);
106 cls = object_store->set_impl_class();
107 cls.EnsureIsFinalized(thread);
108 cls = object_store->const_set_impl_class();
109 cls.EnsureIsFinalized(thread);
110}

◆ FirstIntersection()

static intptr_t dart::FirstIntersection ( UseInterval a,
UseInterval u 
)
static

Definition at line 1853 of file linearscan.cc.

1853 {
1854 while (a != nullptr && u != nullptr) {
1855 const intptr_t pos = a->Intersect(u);
1856 if (pos != kIllegalPosition) return pos;
1857
1858 if (a->start() < u->start()) {
1859 a = a->next();
1860 } else {
1861 u = u->next();
1862 }
1863 }
1864
1865 return kMaxPosition;
1866}
UseInterval * next() const
Definition linearscan.h:440
intptr_t start() const
Definition linearscan.h:438
static constexpr intptr_t kMaxPosition
Definition linearscan.cc:36

◆ FirstMaterializationAt()

static Instruction * dart::FirstMaterializationAt ( Instruction exit)
static

Definition at line 3775 of file redundancy_elimination.cc.

3775 {
3776 while (exit->previous()->IsMaterializeObject()) {
3777 exit = exit->previous();
3778 }
3779 return exit;
3780}

◆ FirstUseAfter()

static UsePosition * dart::FirstUseAfter ( UsePosition use,
intptr_t  after 
)
static

Definition at line 1790 of file linearscan.cc.

1790 {
1791 while ((use != nullptr) && (use->pos() < after)) {
1792 use = use->next();
1793 }
1794 return use;
1795}
intptr_t pos() const
Definition linearscan.h:413
UsePosition * next() const
Definition linearscan.h:411

◆ FlattenScopeIntoEnvironment()

static void dart::FlattenScopeIntoEnvironment ( FlowGraph graph,
LocalScope scope,
GrowableArray< LocalVariable * > *  env 
)
static

Definition at line 41 of file redundancy_elimination_test.cc.

43 {
44 for (intptr_t i = 0; i < scope->num_variables(); i++) {
45 auto var = scope->VariableAt(i);
46 if (var->is_captured()) {
47 continue;
48 }
49
50 auto index = graph->EnvIndex(var);
51 env->EnsureLength(index + 1, nullptr);
52 (*env)[index] = var;
53 }
54
55 if (scope->sibling() != nullptr) {
56 FlattenScopeIntoEnvironment(graph, scope->sibling(), env);
57 }
58 if (scope->child() != nullptr) {
59 FlattenScopeIntoEnvironment(graph, scope->child(), env);
60 }
61}
intptr_t EnvIndex(const LocalVariable *variable) const
Definition flow_graph.h:189
LocalScope * sibling() const
Definition scopes.h:321
LocalVariable * VariableAt(intptr_t index) const
Definition scopes.h:398
intptr_t num_variables() const
Definition scopes.h:397
LocalScope * child() const
Definition scopes.h:320
static void FlattenScopeIntoEnvironment(FlowGraph *graph, LocalScope *scope, GrowableArray< LocalVariable * > *env)
Definition __init__.py:1

◆ FlushSampleBlocks()

static void dart::FlushSampleBlocks ( Isolate isolate)
static

Definition at line 739 of file profiler.cc.

739 {
740 ASSERT(isolate != nullptr);
741
742 SampleBlock* block = isolate->current_sample_block();
743 if (block != nullptr) {
744 isolate->set_current_sample_block(nullptr);
745 block->MarkCompleted();
746 }
747
748 block = isolate->current_allocation_sample_block();
749 if (block != nullptr) {
750 isolate->set_current_allocation_sample_block(nullptr);
751 block->MarkCompleted();
752 }
753}
void set_current_sample_block(SampleBlock *block)
Definition isolate.h:1065
SampleBlock * current_sample_block() const
Definition isolate.h:1064
void set_current_allocation_sample_block(SampleBlock *block)
Definition isolate.h:1074
SampleBlock * current_allocation_sample_block() const
Definition isolate.h:1071
void MarkCompleted()
Definition profiler.h:679

◆ ForwardedObj()

static DART_FORCE_INLINE ObjectPtr dart::ForwardedObj ( uword  header)
static

Definition at line 73 of file scavenger.cc.

73 {
75 return static_cast<ObjectPtr>(header);
76}
static DART_FORCE_INLINE bool IsForwarding(uword header)
Definition scavenger.cc:66
static const char header[]
Definition skpbench.cpp:88

◆ ForwardingHeader()

static DART_FORCE_INLINE uword dart::ForwardingHeader ( ObjectPtr  target)
static

Definition at line 79 of file scavenger.cc.

79 {
80 uword result = static_cast<uword>(target);
82 return result;
83}

◆ ForwardObjectTo()

static void dart::ForwardObjectTo ( ObjectPtr  before_obj,
ObjectPtr  after_obj 
)
static

Definition at line 61 of file become.cc.

61 {
62 const intptr_t size_before = before_obj->untag()->HeapSize();
63
64 uword corpse_addr = static_cast<uword>(before_obj) - kHeapObjectTag;
65 ForwardingCorpse* forwarder =
66 ForwardingCorpse::AsForwarder(corpse_addr, size_before);
67 forwarder->set_target(after_obj);
68 if (!IsForwardingObject(before_obj)) {
69 FATAL("become: ForwardObjectTo failure.");
70 }
71 // Still need to be able to iterate over the forwarding corpse.
72 const intptr_t size_after = before_obj->untag()->HeapSize();
73 if (size_before != size_after) {
74 FATAL("become: Before and after sizes do not match.");
75 }
76}
void set_target(ObjectPtr target)
Definition become.h:28
intptr_t HeapSize() const
Definition raw_object.h:380
static bool IsForwardingObject(ObjectPtr object)
Definition become.cc:50

◆ Free()

static void dart::Free ( FreeList free_list,
uword  address,
intptr_t  size,
bool  is_protected 
)
static

Definition at line 23 of file freelist_test.cc.

26 {
27 if (is_protected) {
28 VirtualMemory::Protect(reinterpret_cast<void*>(address), size,
29 VirtualMemory::kReadWrite);
30 }
31 free_list->Free(address, size);
32 if (is_protected) {
33 VirtualMemory::Protect(reinterpret_cast<void*>(address), size,
34 VirtualMemory::kReadExecute);
35 }
36}
void Free(uword addr, intptr_t size)
Definition freelist.cc:193

◆ FreeExternalTypedData()

void dart::FreeExternalTypedData ( void *  isolate_callback_data,
void *  buffer 
)

Definition at line 361 of file object_graph_copy.cc.

361 {
362 free(buffer);
363}

◆ FreeFinalizer()

DART_EXPORT void dart::FreeFinalizer ( void *  ,
void *  value 
)

Definition at line 624 of file ffi_test_functions_vmspecific.cc.

624 {
625 free(value);
626}

◆ FreeStruct9Uint8()

DART_EXPORT void dart::FreeStruct9Uint8 ( Struct9Uint8 address)

Definition at line 781 of file ffi_test_functions.cc.

781 {
782#if defined(_WIN32)
783 VirtualFree(address, 0, MEM_RELEASE);
784#else
785 size_t size = sizeof(Struct9Uint8) * 64 * 1024;
786 munmap(address, size * 2);
787#endif
788}

◆ FreeTransferablePeer()

void dart::FreeTransferablePeer ( void *  isolate_callback_data,
void *  peer 
)

Definition at line 365 of file object_graph_copy.cc.

365 {
366 delete static_cast<TransferableTypedDataPeer*>(peer);
367}

◆ FunctionOverlaps()

static bool dart::FunctionOverlaps ( const Function func,
const String script_url,
TokenPosition  token_pos,
TokenPosition  end_token_pos 
)
static

Definition at line 378 of file debugger.cc.

381 {
382 const TokenPosition& func_start = func.token_pos();
383 if (token_pos.IsWithin(func_start, func.end_token_pos()) ||
384 func_start.IsWithin(token_pos, end_token_pos)) {
385 // Check script equality last because it allocates handles as a side effect.
386 Script& func_script = Script::Handle(func.script());
387 String& url = String::Handle(func_script.url());
388 return script_url.Equals(url);
389 }
390 return false;
391}
TokenPosition token_pos() const
Definition object.h:3426
TokenPosition end_token_pos() const
Definition object.h:3435
StringPtr url() const
Definition object.h:4903
bool Equals(const String &str) const
Definition object.h:13311

◆ FunctionPrintNameHelper()

static void dart::FunctionPrintNameHelper ( const Function fun,
const NameFormattingParams params,
BaseTextBuffer printer 
)
static

Definition at line 11095 of file object.cc.

11097 {
11098 if (fun.IsNonImplicitClosureFunction()) {
11099 if (params.include_parent_name) {
11100 const auto& parent = Function::Handle(fun.parent_function());
11101 if (parent.IsNull()) {
11102 printer->AddString(Symbols::OptimizedOut().ToCString());
11103 } else {
11104 parent.PrintName(params, printer);
11105 }
11106 // A function's scrubbed name and its user visible name are identical.
11107 printer->AddString(".");
11108 }
11109 if (params.disambiguate_names &&
11110 fun.name() == Symbols::AnonymousClosure().ptr()) {
11111 if (fun.token_pos().IsReal()) {
11112 printer->Printf("<anonymous closure @%" Pd ">", fun.token_pos().Pos());
11113 } else {
11114 printer->Printf("<anonymous closure @no position>");
11115 }
11116 } else {
11117 printer->AddString(fun.NameCString(params.name_visibility));
11118 if (params.disambiguate_names) {
11119 if (fun.token_pos().IsReal()) {
11120 printer->Printf("@<%" Pd ">", fun.token_pos().Pos());
11121 } else {
11122 printer->Printf("@<no position>");
11123 }
11124 }
11125 }
11126 return;
11127 }
11128 if (params.disambiguate_names) {
11129 if (fun.IsInvokeFieldDispatcher()) {
11130 printer->AddString("[invoke-field] ");
11131 }
11132 if (fun.IsNoSuchMethodDispatcher()) {
11133 printer->AddString("[no-such-method] ");
11134 }
11135 if (fun.IsImplicitClosureFunction()) {
11136 printer->AddString("[tear-off] ");
11137 }
11138 if (fun.IsMethodExtractor()) {
11139 printer->AddString("[tear-off-extractor] ");
11140 }
11141 }
11142
11143 if (fun.kind() == UntaggedFunction::kConstructor) {
11144 printer->AddString("new ");
11145 } else if (params.include_class_name) {
11146 const Class& cls = Class::Handle(fun.Owner());
11147 if (!cls.IsTopLevel()) {
11148 const Class& mixin = Class::Handle(cls.Mixin());
11149 printer->AddString(params.name_visibility == Object::kUserVisibleName
11150 ? mixin.UserVisibleNameCString()
11151 : cls.NameCString(params.name_visibility));
11152 printer->AddString(".");
11153 }
11154 }
11155
11156 printer->AddString(fun.NameCString(params.name_visibility));
11157
11158 // Dispatchers that are created with an arguments descriptor need both the
11159 // name and the saved arguments descriptor to disambiguate.
11160 if (params.disambiguate_names && fun.HasSavedArgumentsDescriptor()) {
11161 const auto& args_desc_array = Array::Handle(fun.saved_args_desc());
11162 const ArgumentsDescriptor args_desc(args_desc_array);
11163 args_desc.PrintTo(printer);
11164 }
11165}
void AddString(const char *s)
intptr_t Printf(const char *format,...) PRINTF_ATTRIBUTE(2
bool IsNoSuchMethodDispatcher() const
Definition object.h:3268
bool IsInvokeFieldDispatcher() const
Definition object.h:3276
bool HasSavedArgumentsDescriptor() const
Definition object.h:3253
const char * NameCString(NameVisibility name_visibility) const
Definition object.cc:11036
bool IsMethodExtractor() const
Definition object.h:3264
ArrayPtr saved_args_desc() const
Definition object.cc:8191

◆ GenerateBranches()

static void dart::GenerateBranches ( RegExpMacroAssembler masm,
ZoneGrowableArray< uint16_t > *  ranges,
intptr_t  start_index,
intptr_t  end_index,
uint16_t  min_char,
uint16_t  max_char,
BlockLabel fall_through,
BlockLabel even_label,
BlockLabel odd_label 
)
static

Definition at line 1217 of file regexp.cc.

1225 {
1226 uint16_t first = ranges->At(start_index);
1227 uint16_t last = ranges->At(end_index) - 1;
1228
1229 ASSERT(min_char < first);
1230
1231 // Just need to test if the character is before or on-or-after
1232 // a particular character.
1233 if (start_index == end_index) {
1234 EmitBoundaryTest(masm, first, fall_through, even_label, odd_label);
1235 return;
1236 }
1237
1238 // Another almost trivial case: There is one interval in the middle that is
1239 // different from the end intervals.
1240 if (start_index + 1 == end_index) {
1241 EmitDoubleBoundaryTest(masm, first, last, fall_through, even_label,
1242 odd_label);
1243 return;
1244 }
1245
1246 // It's not worth using table lookup if there are very few intervals in the
1247 // character class.
1248 if (end_index - start_index <= 6) {
1249 // It is faster to test for individual characters, so we look for those
1250 // first, then try arbitrary ranges in the second round.
1251 static intptr_t kNoCutIndex = -1;
1252 intptr_t cut = kNoCutIndex;
1253 for (intptr_t i = start_index; i < end_index; i++) {
1254 if (ranges->At(i) == ranges->At(i + 1) - 1) {
1255 cut = i;
1256 break;
1257 }
1258 }
1259 if (cut == kNoCutIndex) cut = start_index;
1260 CutOutRange(masm, ranges, start_index, end_index, cut, even_label,
1261 odd_label);
1262 ASSERT(end_index - start_index >= 2);
1263 GenerateBranches(masm, ranges, start_index + 1, end_index - 1, min_char,
1264 max_char, fall_through, even_label, odd_label);
1265 return;
1266 }
1267
1268 // If there are a lot of intervals in the regexp, then we will use tables to
1269 // determine whether the character is inside or outside the character class.
1270 const intptr_t kBits = RegExpMacroAssembler::kTableSizeBits;
1271
1272 if ((max_char >> kBits) == (min_char >> kBits)) {
1273 EmitUseLookupTable(masm, ranges, start_index, end_index, min_char,
1274 fall_through, even_label, odd_label);
1275 return;
1276 }
1277
1278 if ((min_char >> kBits) != (first >> kBits)) {
1279 masm->CheckCharacterLT(first, odd_label);
1280 GenerateBranches(masm, ranges, start_index + 1, end_index, first, max_char,
1281 fall_through, odd_label, even_label);
1282 return;
1283 }
1284
1285 intptr_t new_start_index = 0;
1286 intptr_t new_end_index = 0;
1287 uint16_t border = 0;
1288
1289 SplitSearchSpace(ranges, start_index, end_index, &new_start_index,
1290 &new_end_index, &border);
1291
1292 BlockLabel handle_rest;
1293 BlockLabel* above = &handle_rest;
1294 if (border == last + 1) {
1295 // We didn't find any section that started after the limit, so everything
1296 // above the border is one of the terminal labels.
1297 above = (end_index & 1) != (start_index & 1) ? odd_label : even_label;
1298 ASSERT(new_end_index == end_index - 1);
1299 }
1300
1301 ASSERT(start_index <= new_end_index);
1302 ASSERT(new_start_index <= end_index);
1303 ASSERT(start_index < new_start_index);
1304 ASSERT(new_end_index < end_index);
1305 ASSERT(new_end_index + 1 == new_start_index ||
1306 (new_end_index + 2 == new_start_index &&
1307 border == ranges->At(new_end_index + 1)));
1308 ASSERT(min_char < border - 1);
1309 ASSERT(border < max_char);
1310 ASSERT(ranges->At(new_end_index) < border);
1311 ASSERT(border < ranges->At(new_start_index) ||
1312 (border == ranges->At(new_start_index) &&
1313 new_start_index == end_index && new_end_index == end_index - 1 &&
1314 border == last + 1));
1315 ASSERT(new_start_index == 0 || border >= ranges->At(new_start_index - 1));
1316
1317 masm->CheckCharacterGT(border - 1, above);
1318 BlockLabel dummy;
1319 GenerateBranches(masm, ranges, start_index, new_end_index, min_char,
1320 border - 1, &dummy, even_label, odd_label);
1321
1322 if (handle_rest.is_linked()) {
1323 masm->BindBlock(&handle_rest);
1324 bool flip = (new_start_index & 1) != (start_index & 1);
1325 GenerateBranches(masm, ranges, new_start_index, end_index, border, max_char,
1326 &dummy, flip ? odd_label : even_label,
1327 flip ? even_label : odd_label);
1328 }
1329}
static constexpr uint64_t kBits
Definition DrawPass.cpp:55
static void SplitSearchSpace(ZoneGrowableArray< uint16_t > *ranges, intptr_t start_index, intptr_t end_index, intptr_t *new_start_index, intptr_t *new_end_index, uint16_t *border)
Definition regexp.cc:1148
static void CutOutRange(RegExpMacroAssembler *masm, ZoneGrowableArray< uint16_t > *ranges, intptr_t start_index, intptr_t end_index, intptr_t cut_index, BlockLabel *even_label, BlockLabel *odd_label)
Definition regexp.cc:1121
static void EmitUseLookupTable(RegExpMacroAssembler *masm, ZoneGrowableArray< uint16_t > *ranges, intptr_t start_index, intptr_t end_index, uint16_t min_char, BlockLabel *fall_through, BlockLabel *even_label, BlockLabel *odd_label)
Definition regexp.cc:1064
static void EmitBoundaryTest(RegExpMacroAssembler *masm, uint16_t border, BlockLabel *fall_through, BlockLabel *above_or_equal, BlockLabel *below)
Definition regexp.cc:1027

◆ GenerateInvokeInstantiateTAVStub()

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

Definition at line 7947 of file object_test.cc.

7947 {
7948 const auto& expected = Type::Handle(
7949 CreateFutureOrType(type_non_nullable_int, Nullability::kNullable));
7950 const auto& got = AbstractType::Handle(
7951 instantiate_future_or(nullable_future_or_T, type_non_nullable_int));
7953 }
7954}
7955
7956#define __ assembler->
7957
7958static void GenerateInvokeInstantiateTAVStub(compiler::Assembler* assembler) {
7959 __ EnterDartFrame(0);
7960
7961 // Load the arguments into the right stub calling convention registers.
7962 const intptr_t uninstantiated_offset =
7963 (kCallerSpSlotFromFp + 2) * compiler::target::kWordSize;
7964 const intptr_t inst_type_args_offset =
7965 (kCallerSpSlotFromFp + 1) * compiler::target::kWordSize;
7966 const intptr_t fun_type_args_offset =
7967 (kCallerSpSlotFromFp + 0) * compiler::target::kWordSize;
7968
7969 __ LoadMemoryValue(InstantiationABI::kUninstantiatedTypeArgumentsReg, FPREG,
7970 uninstantiated_offset);
7971 __ LoadMemoryValue(InstantiationABI::kInstantiatorTypeArgumentsReg, FPREG,
7972 inst_type_args_offset);
static TypePtr CreateFutureOrType(const AbstractType &param, Nullability nullability)
#define __
#define EXPECT_TYPES_SYNTACTICALLY_EQUIVALENT(expected, got)

◆ GenerateInvokeTTSStub()

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

Definition at line 69 of file type_testing_stubs_test.cc.

69 {
70 auto calculate_breadcrumb = [](const Register& reg) {
71 return 0x10 + 2 * (static_cast<intptr_t>(reg));
72 };
73
74 __ EnterDartFrame(0);
75
76 for (intptr_t i = 0; i < kNumberOfCpuRegisters; ++i) {
77 if (((1 << i) & kDartAvailableCpuRegs) == 0) continue;
78 if (((1 << i) & TypeTestABI::kAbiRegisters) != 0) continue;
79 if (((1 << i) & TTSInternalRegs::kInternalRegisters) != 0) continue;
80 const Register reg = static_cast<Register>(i);
81 __ LoadImmediate(reg, calculate_breadcrumb(reg));
82 }
83
84 // Load the arguments into the right TTS calling convention registers.
85 const intptr_t instance_offset =
86 (kCallerSpSlotFromFp + 3) * compiler::target::kWordSize;
87 const intptr_t inst_type_args_offset =
88 (kCallerSpSlotFromFp + 2) * compiler::target::kWordSize;
89 const intptr_t fun_type_args_offset =
90 (kCallerSpSlotFromFp + 1) * compiler::target::kWordSize;
91 const intptr_t dst_type_offset =
92 (kCallerSpSlotFromFp + 0) * compiler::target::kWordSize;
93
94 __ LoadMemoryValue(TypeTestABI::kInstanceReg, FPREG, instance_offset);
95 __ LoadMemoryValue(TypeTestABI::kInstantiatorTypeArgumentsReg, FPREG,
96 inst_type_args_offset);
97 __ LoadMemoryValue(TypeTestABI::kFunctionTypeArgumentsReg, FPREG,
98 fun_type_args_offset);
99 __ LoadMemoryValue(TypeTestABI::kDstTypeReg, FPREG, dst_type_offset);
100
101 const intptr_t subtype_test_cache_index = __ object_pool_builder().AddObject(
102 Object::null_object(), compiler::ObjectPoolBuilderEntry::kPatchable);
103 const intptr_t dst_name_index = __ object_pool_builder().AddObject(
104 Symbols::OptimizedOut(), compiler::ObjectPoolBuilderEntry::kPatchable);
105 ASSERT_EQUAL(subtype_test_cache_index + 1, dst_name_index);
106 ASSERT(__ constant_pool_allowed());
107
108 FlowGraphCompiler::GenerateIndirectTTSCall(
109 assembler, TypeTestABI::kDstTypeReg, subtype_test_cache_index);
110
111 // We have the guarantee that TTS preserves all input registers, if the TTS
112 // handles the type test successfully.
113 //
114 // Let the test know which TTS abi registers were not preserved.
115 ASSERT(((1 << static_cast<intptr_t>(TypeTestABI::kInstanceReg)) &
116 TypeTestABI::kPreservedAbiRegisters) != 0);
117 // First we check the instance register, freeing it up in case there are no
118 // other safe registers to use since we need two registers: one to accumulate
119 // the register mask, another to load the array address when saving the mask.
120 __ LoadFromOffset(TypeTestABI::kScratchReg, FPREG, instance_offset);
121 compiler::Label instance_matches, done_with_instance;
122 __ CompareRegisters(TypeTestABI::kScratchReg, TypeTestABI::kInstanceReg);
123 __ BranchIf(EQUAL, &instance_matches, compiler::Assembler::kNearJump);
124 __ LoadImmediate(TypeTestABI::kScratchReg,
125 1 << static_cast<intptr_t>(TypeTestABI::kInstanceReg));
126 __ Jump(&done_with_instance, compiler::Assembler::kNearJump);
127 __ Bind(&instance_matches);
128 __ LoadImmediate(TypeTestABI::kScratchReg, 0);
129 __ Bind(&done_with_instance);
130 for (intptr_t i = 0; i < kNumberOfCpuRegisters; ++i) {
131 if (((1 << i) & TypeTestABI::kPreservedAbiRegisters) == 0) continue;
132 const Register reg = static_cast<Register>(i);
133 compiler::Label done;
134 switch (reg) {
135 case TypeTestABI::kInstanceReg:
136 // Skip the already handled instance register.
137 continue;
138 case TypeTestABI::kDstTypeReg:
139 __ LoadFromOffset(TypeTestABI::kInstanceReg, FPREG, dst_type_offset);
140 break;
141 case TypeTestABI::kFunctionTypeArgumentsReg:
142 __ LoadFromOffset(TypeTestABI::kInstanceReg, FPREG,
143 fun_type_args_offset);
144 break;
145 case TypeTestABI::kInstantiatorTypeArgumentsReg:
146 __ LoadFromOffset(TypeTestABI::kInstanceReg, FPREG,
147 inst_type_args_offset);
148 break;
149 default:
150 FATAL("Unexpected register %s", RegisterNames::RegisterName(reg));
151 break;
152 }
153 __ CompareRegisters(reg, TypeTestABI::kInstanceReg);
154 __ BranchIf(EQUAL, &done, compiler::Assembler::kNearJump);
155 __ AddImmediate(TypeTestABI::kScratchReg, 1 << i);
156 __ Bind(&done);
157 }
158 __ SmiTag(TypeTestABI::kScratchReg);
159 __ LoadFromOffset(TypeTestABI::kInstanceReg, FPREG,
160 (kCallerSpSlotFromFp + 5) * compiler::target::kWordSize);
161 __ StoreFieldToOffset(TypeTestABI::kScratchReg, TypeTestABI::kInstanceReg,
162 compiler::target::Array::element_offset(0));
163
164 // Let the test know which non-TTS abi registers were not preserved.
165 __ LoadImmediate(TypeTestABI::kScratchReg, 0);
166 for (intptr_t i = 0; i < kNumberOfCpuRegisters; ++i) {
167 if (((1 << i) & kDartAvailableCpuRegs) == 0) continue;
168 if (((1 << i) & TypeTestABI::kAbiRegisters) != 0) continue;
169 const Register reg = static_cast<Register>(i);
170 compiler::Label done;
171 __ CompareImmediate(reg, calculate_breadcrumb(reg));
172 __ BranchIf(EQUAL, &done, compiler::Assembler::kNearJump);
173 __ AddImmediate(TypeTestABI::kScratchReg, 1 << i);
174 __ Bind(&done);
175 }
176 __ SmiTag(TypeTestABI::kScratchReg);
177 __ LoadFromOffset(TypeTestABI::kInstanceReg, FPREG,
178 (kCallerSpSlotFromFp + 4) * compiler::target::kWordSize);
179 __ StoreFieldToOffset(TypeTestABI::kScratchReg, TypeTestABI::kInstanceReg,
180 compiler::target::Array::element_offset(0));
181
182 // Set the return from the stub to be null.
183 __ LoadObject(CallingConventions::kReturnReg, Object::null_object());
184 __ LeaveDartFrame();
185 __ Ret();
186}
static void done(const char *config, const char *src, const char *srcOptions, const char *name)
Definition DM.cpp:263
#define __

◆ GetAllocationProfile()

static void dart::GetAllocationProfile ( Thread thread,
JSONStream js 
)
static

Definition at line 4550 of file service.cc.

4550 {
4551 GetAllocationProfileImpl(thread, js, true);
4552}
static void GetAllocationProfileImpl(Thread *thread, JSONStream *js, bool internal)
Definition service.cc:4509

◆ GetAllocationProfileImpl()

static void dart::GetAllocationProfileImpl ( Thread thread,
JSONStream js,
bool  internal 
)
static

Definition at line 4509 of file service.cc.

4511 {
4512 bool should_reset_accumulator = false;
4513 bool should_collect = false;
4514 if (js->HasParam("reset")) {
4515 if (js->ParamIs("reset", "true")) {
4516 should_reset_accumulator = true;
4517 } else {
4518 PrintInvalidParamError(js, "reset");
4519 return;
4520 }
4521 }
4522 if (js->HasParam("gc")) {
4523 if (js->ParamIs("gc", "true")) {
4524 should_collect = true;
4525 } else {
4526 PrintInvalidParamError(js, "gc");
4527 return;
4528 }
4529 }
4530 auto isolate_group = thread->isolate_group();
4531 if (should_reset_accumulator) {
4533 }
4534 if (should_collect) {
4535 isolate_group->UpdateLastAllocationProfileGCTimestamp();
4536 isolate_group->heap()->CollectAllGarbage(GCReason::kDebugging);
4537 }
4538 isolate_group->class_table()->AllocationProfilePrintJSON(js, internal);
4539}
void UpdateLastAllocationProfileAccumulatorResetTimestamp()
Definition isolate.h:345

◆ GetAllocationProfilePublic()

static void dart::GetAllocationProfilePublic ( Thread thread,
JSONStream js 
)
static

Definition at line 4546 of file service.cc.

4546 {
4547 GetAllocationProfileImpl(thread, js, false);
4548}

◆ GetAllocationTraces()

static void dart::GetAllocationTraces ( Thread thread,
JSONStream js 
)
static

Definition at line 4467 of file service.cc.

4467 {
4468 int64_t time_origin_micros =
4469 Int64Parameter::Parse(js->LookupParam("timeOriginMicros"));
4470 int64_t time_extent_micros =
4471 Int64Parameter::Parse(js->LookupParam("timeExtentMicros"));
4472 Isolate* isolate = thread->isolate();
4473
4474 // Return only allocations for objects with classId.
4475 if (js->HasParam("classId")) {
4476 const char* class_id = js->LookupParam("classId");
4477 intptr_t cid = -1;
4478 GetPrefixedIntegerId(class_id, "classes/", &cid);
4479 if (IsValidClassId(isolate, cid)) {
4480 if (CheckProfilerDisabled(thread, js)) {
4481 return;
4482 }
4483 const Class& cls = Class::Handle(GetClassForId(isolate, cid));
4484 ProfilerService::PrintAllocationJSON(js, cls, time_origin_micros,
4485 time_extent_micros);
4486 } else {
4487 PrintInvalidParamError(js, "classId");
4488 }
4489 } else {
4490 // Otherwise, return allocations for all traced class IDs.
4491 if (CheckProfilerDisabled(thread, js)) {
4492 return;
4493 }
4494 ProfilerService::PrintAllocationJSON(js, time_origin_micros,
4495 time_extent_micros);
4496 }
4497}
static bool CheckProfilerDisabled(Thread *thread, JSONStream *js)
Definition service.cc:525
static bool IsValidClassId(Isolate *isolate, intptr_t cid)
Definition service.cc:667
static bool GetPrefixedIntegerId(const char *s, const char *prefix, intptr_t *service_id)
Definition service.cc:645

◆ GetAndValidateThreadStackBounds()

static bool dart::GetAndValidateThreadStackBounds ( OSThread os_thread,
Thread thread,
uintptr_t  fp,
uintptr_t  sp,
uword stack_lower,
uword stack_upper 
)
static

Definition at line 368 of file profiler.cc.

373 {
374 ASSERT(os_thread != nullptr);
375 ASSERT(stack_lower != nullptr);
376 ASSERT(stack_upper != nullptr);
377
378#if defined(USING_SIMULATOR)
379 const bool use_simulator_stack_bounds =
380 thread != nullptr && thread->IsExecutingDartCode();
381 if (use_simulator_stack_bounds) {
382 Isolate* isolate = thread->isolate();
383 ASSERT(isolate != nullptr);
384 Simulator* simulator = isolate->simulator();
385 *stack_lower = simulator->stack_limit();
386 *stack_upper = simulator->stack_base();
387 }
388#else
389 const bool use_simulator_stack_bounds = false;
390#endif // defined(USING_SIMULATOR)
391
392 if (!use_simulator_stack_bounds) {
393 *stack_lower = os_thread->stack_limit();
394 *stack_upper = os_thread->stack_base();
395 }
396
397 if ((*stack_lower == 0) || (*stack_upper == 0)) {
398 return false;
399 }
400
401 if (!use_simulator_stack_bounds && (sp > *stack_lower)) {
402 // The stack pointer gives us a tighter lower bound.
403 *stack_lower = sp;
404 }
405
406 return ValidateThreadStackBounds(fp, sp, *stack_lower, *stack_upper);
407}
Simulator * simulator() const
Definition isolate.h:1146
uword stack_base() const
Definition os_thread.h:128
uword stack_limit() const
Definition os_thread.h:129
uword stack_base() const
uword stack_limit() const
bool IsExecutingDartCode() const
Definition thread.cc:880
static bool ValidateThreadStackBounds(uintptr_t fp, uintptr_t sp, uword stack_lower, uword stack_upper)
Definition profiler.cc:344

◆ GetAssetLocation()

static ArrayPtr dart::GetAssetLocation ( Thread *const  thread,
const String asset 
)
static

Definition at line 332 of file ffi_dynamic_library.cc.

332 {
333 Zone* const zone = thread->zone();
334 auto& result = Array::Handle(zone);
335
336 const auto& native_assets_map =
337 Array::Handle(zone, GetNativeAssetsMap(thread));
338 if (!native_assets_map.IsNull()) {
339 NativeAssetsMap map(native_assets_map.ptr());
340 const auto& lookup = Object::Handle(zone, map.GetOrNull(asset));
341 if (!lookup.IsNull()) {
342 result = Array::Cast(lookup).ptr();
343 }
344 map.Release();
345 }
346 return result.ptr();
347}

◆ GetByteBufferConstructor()

static ObjectPtr dart::GetByteBufferConstructor ( Thread thread,
const String class_name,
const String constructor_name,
intptr_t  num_args 
)
static

Definition at line 3956 of file dart_api_impl.cc.

3959 {
3960 const Library& lib = Library::Handle(
3961 thread->isolate_group()->object_store()->typed_data_library());
3962 ASSERT(!lib.IsNull());
3963 const Class& cls =
3964 Class::Handle(thread->zone(), lib.LookupClassAllowPrivate(class_name));
3965 ASSERT(!cls.IsNull());
3966 return ResolveConstructor(CURRENT_FUNC, cls, class_name, constructor_name,
3967 num_args);
3968}

◆ GetCallerLocation()

static TokenPosition dart::GetCallerLocation ( )
static

Definition at line 514 of file runtime_entry.cc.

514 {
515 DartFrameIterator iterator(Thread::Current(),
516 StackFrameIterator::kNoCrossThreadIteration);
517 StackFrame* caller_frame = iterator.NextFrame();
518 ASSERT(caller_frame != nullptr);
519 return caller_frame->GetTokenPos();
520}
TokenPosition GetTokenPos() const

◆ GetCaseIndependentLetters()

static intptr_t dart::GetCaseIndependentLetters ( uint16_t  character,
bool  one_byte_subject,
int32_t *  letters 
)
static

Definition at line 861 of file regexp.cc.

863 {
865 intptr_t length = jsregexp_uncanonicalize.get(character, '\0', letters);
866 // Unibrow returns 0 or 1 for characters where case independence is
867 // trivial.
868 if (length == 0) {
869 letters[0] = character;
870 length = 1;
871 }
872 if (!one_byte_subject || character <= Symbols::kMaxOneCharCodeSymbol) {
873 return length;
874 }
875
876 // The standard requires that non-ASCII characters cannot have ASCII
877 // character codes in their equivalence class.
878 // TODO(dcarney): issue 3550 this is not actually true for Latin1 anymore,
879 // is it? For example, \u00C5 is equivalent to \u212B.
880 return 0;
881}

◆ GetClass()

static ClassPtr dart::GetClass ( const Library lib,
const char *  name 
)

Definition at line 64 of file il_test_helper.cc.

64 {
65 Thread* thread = Thread::Current();
66 const auto& cls = Class::Handle(
67 lib.LookupClassAllowPrivate(String::Handle(Symbols::New(thread, name))));
68 EXPECT(!cls.IsNull());
69 return cls.ptr();
70}

◆ GetClassForId()

static ClassPtr dart::GetClassForId ( Isolate isolate,
intptr_t  cid 
)
static

Definition at line 674 of file service.cc.

674 {
675 ASSERT(isolate == Isolate::Current());
676 ASSERT(isolate != nullptr);
677 ClassTable* class_table = isolate->group()->class_table();
678 ASSERT(class_table != nullptr);
679 return class_table->At(cid);
680}

◆ GetClassList()

static void dart::GetClassList ( Thread thread,
JSONStream js 
)
static

Definition at line 5159 of file service.cc.

5159 {
5160 ClassTable* table = thread->isolate_group()->class_table();
5161 JSONObject jsobj(js);
5162 table->PrintToJSONObject(&jsobj);
5163}

◆ GetClassTypeParameter()

TypeParameterPtr dart::GetClassTypeParameter ( const Class klass,
intptr_t  index 
)

Definition at line 72 of file il_test_helper.cc.

72 {
73 const auto& param = TypeParameter::Handle(klass.TypeParameterAt(index));
74 EXPECT(!param.IsNull());
75 return param.ptr();
76}

◆ GetCodeAndEntryPointByIndex()

template<bool need_entry_point_for_non_discarded>
static DART_FORCE_INLINE CodePtr dart::GetCodeAndEntryPointByIndex ( const Deserializer d,
intptr_t  code_index,
uword entry_point 
)
static

Definition at line 1799 of file app_snapshot.cc.

1802 {
1803 code_index -= 1; // 0 is reserved for LazyCompile stub.
1804
1805 // In root unit and VM isolate snapshot code_indices are self-contained
1806 // they point into instruction table and/or into the code cluster.
1807 // In non-root units we might also refer to code objects from the
1808 // parent unit which means code_index is biased by num_base_objects_
1809 const intptr_t base = d->is_non_root_unit() ? d->num_base_objects() : 0;
1810 if (code_index < base) {
1811 CodePtr code = static_cast<CodePtr>(d->Ref(code_index));
1812 if (need_entry_point_for_non_discarded) {
1813 *entry_point = Code::EntryPointOf(code);
1814 }
1815 return code;
1816 }
1817 code_index -= base;
1818
1819 // At this point code_index is referring to a code object which is either
1820 // discarded or exists in the Code cluster. Non-discarded Code objects
1821 // are associated with the tail of the instruction table and have the
1822 // same order there and in the Code cluster. This means that
1823 // subtracting first_entry_with_code yields index into the Code cluster.
1824 // This also works for deferred code objects in root unit's snapshot
1825 // due to the choice of encoding (see Serializer::GetCodeIndex).
1826 const intptr_t first_entry_with_code =
1827 d->instructions_table().rodata()->first_entry_with_code;
1828 if (code_index < first_entry_with_code) {
1829 *entry_point = d->instructions_table().EntryPointAt(code_index);
1830 return StubCode::UnknownDartCode().ptr();
1831 } else {
1832 const intptr_t cluster_index = code_index - first_entry_with_code;
1833 CodePtr code =
1834 static_cast<CodePtr>(d->Ref(d->code_start_index() + cluster_index));
1835 if (need_entry_point_for_non_discarded) {
1836 *entry_point = Code::EntryPointOf(code);
1837 }
1838 return code;
1839 }
1840}

◆ GetCodeId()

static bool dart::GetCodeId ( const char *  s,
int64_t *  timestamp,
uword address 
)
static

Definition at line 617 of file service.cc.

617 {
618 if ((s == nullptr) || (*s == '\0')) {
619 // Empty string.
620 return false;
621 }
622 if ((timestamp == nullptr) || (address == nullptr)) {
623 // Bad arguments.
624 return false;
625 }
626 // Extract the timestamp.
627 if (!GetInteger64Id(s, timestamp, 16) || (*timestamp < 0)) {
628 return false;
629 }
630 s = ScanUntilDash(s);
631 if (s == nullptr) {
632 return false;
633 }
634 // Skip the dash.
635 s++;
636 // Extract the PC.
637 if (!GetUnsignedIntegerId(s, address, 16)) {
638 return false;
639 }
640 return true;
641}
static bool GetUnsignedIntegerId(const char *s, uintptr_t *id, int base=10)
Definition service.cc:557
static bool GetInteger64Id(const char *s, int64_t *id, int base=10)
Definition service.cc:581
static const char * ScanUntilDash(const char *s)
Definition service.cc:603

◆ GetCpuSamples()

static void dart::GetCpuSamples ( Thread thread,
JSONStream js 
)
static

Definition at line 4455 of file service.cc.

4455 {
4456 GetCpuSamplesCommon(TimelineOrSamplesResponseFormat::JSON, thread, js);
4457}
static void GetCpuSamplesCommon(TimelineOrSamplesResponseFormat format, Thread *thread, JSONStream *js)
Definition service.cc:4148

◆ GetCpuSamplesCommon()

static void dart::GetCpuSamplesCommon ( TimelineOrSamplesResponseFormat  format,
Thread thread,
JSONStream js 
)
static

Definition at line 4148 of file service.cc.

4150 {
4151 const int64_t time_origin_micros =
4152 Int64Parameter::Parse(js->LookupParam("timeOriginMicros"));
4153 const int64_t time_extent_micros =
4154 Int64Parameter::Parse(js->LookupParam("timeExtentMicros"));
4155 const bool include_code_samples =
4156 BoolParameter::Parse(js->LookupParam("_code"), false);
4157 if (CheckProfilerDisabled(thread, js)) {
4158 return;
4159 }
4160
4161 if (format == TimelineOrSamplesResponseFormat::JSON) {
4162 ProfilerService::PrintJSON(js, time_origin_micros, time_extent_micros,
4163 include_code_samples);
4164 } else if (format == TimelineOrSamplesResponseFormat::Perfetto) {
4165#if defined(SUPPORT_PERFETTO)
4166 // This branch will never be reached when SUPPORT_PERFETTO is not defined,
4167 // because |GetPerfettoCpuSamples| is not defined when SUPPORT_PERFETTO is
4168 // not defined.
4169 ProfilerService::PrintPerfetto(js, time_origin_micros, time_extent_micros);
4170#else
4171 UNREACHABLE();
4172#endif // defined(SUPPORT_PERFETTO)
4173 }
4174}
uint32_t uint32_t * format

◆ GetCurrentStackTrace()

const StackTrace & dart::GetCurrentStackTrace ( int  skip_frames)

Definition at line 94 of file stacktrace.cc.

94 {
95 Zone* zone = Thread::Current()->zone();
96 const GrowableObjectArray& code_list =
97 GrowableObjectArray::Handle(zone, GrowableObjectArray::New());
98 GrowableArray<uword> pc_offset_list;
99 AppendFrames(code_list, &pc_offset_list, skip_frames);
100
101 const StackTrace& stacktrace = StackTrace::Handle(
102 zone, CreateStackTraceObject(zone, code_list, pc_offset_list));
103 return stacktrace;
104}
static void AppendFrames(const GrowableObjectArray &code_list, GrowableArray< uword > *pc_offset_list, int skip_frames)
Definition stacktrace.cc:65
static StackTracePtr CreateStackTraceObject(Zone *zone, const GrowableObjectArray &code_list, const GrowableArray< uword > &pc_offset_list)
Definition stacktrace.cc:21

◆ GetDefaultClassesAliases()

static void dart::GetDefaultClassesAliases ( Thread thread,
JSONStream js 
)
static

Definition at line 5767 of file service.cc.

5767 {
5768 JSONObject jsobj(js);
5769 jsobj.AddProperty("type", "ClassesAliasesMap");
5770
5771 JSONObject map(&jsobj, "map");
5772
5773#define DEFINE_ADD_VALUE_F(id) \
5774 internals.AddValueF("classes/%" Pd, static_cast<intptr_t>(id));
5775#define DEFINE_ADD_VALUE_F_CID(clazz) DEFINE_ADD_VALUE_F(k##clazz##Cid)
5776 {
5777 JSONArray internals(&map, "<VM Internals>");
5778 for (intptr_t id = kFirstInternalOnlyCid; id <= kLastInternalOnlyCid;
5779 ++id) {
5781 }
5782 DEFINE_ADD_VALUE_F_CID(LibraryPrefix);
5783 }
5784 {
5785 JSONArray internals(&map, "Type");
5786 for (intptr_t id = kAbstractTypeCid; id <= kTypeParameterCid; ++id) {
5788 }
5789 }
5790 {
5791 JSONArray internals(&map, "Object");
5792 DEFINE_ADD_VALUE_F_CID(Instance);
5793 }
5794 {
5795 JSONArray internals(&map, "Closure");
5796 DEFINE_ADD_VALUE_F_CID(Closure);
5798 }
5799 {
5800 JSONArray internals(&map, "Int");
5801 for (intptr_t id = kIntegerCid; id <= kMintCid; ++id) {
5803 }
5804 }
5805 {
5806 JSONArray internals(&map, "Double");
5807 DEFINE_ADD_VALUE_F_CID(Double);
5808 }
5809 {
5810 JSONArray internals(&map, "String");
5812 }
5813 {
5814 JSONArray internals(&map, "List");
5816 DEFINE_ADD_VALUE_F_CID(ByteBuffer)
5817 }
5818 {
5819 JSONArray internals(&map, "Map");
5821 }
5822
5823 {
5824 JSONArray internals(&map, "Set");
5826 }
5827#define DEFINE_ADD_MAP_KEY(clazz) \
5828 {JSONArray internals(&map, #clazz); \
5829 DEFINE_ADD_VALUE_F_CID(TypedData##clazz) \
5830 DEFINE_ADD_VALUE_F_CID(TypedData##clazz##View) \
5831 DEFINE_ADD_VALUE_F_CID(ExternalTypedData##clazz) \
5832 DEFINE_ADD_VALUE_F_CID(UnmodifiableTypedData##clazz##View) \
5833 }
5835#undef DEFINE_ADD_MAP_KEY
5836#define DEFINE_ADD_MAP_KEY(clazz) \
5837 {JSONArray internals(&map, #clazz); \
5838 DEFINE_ADD_VALUE_F_CID(Ffi##clazz) \
5839 }
5841#undef DEFINE_ADD_MAP_KEY
5842#undef DEFINE_ADD_VALUE_F_CID
5843#undef DEFINE_ADD_VALUE_F
5844}
#define CLASS_LIST_MAPS(V)
Definition class_id.h:116
#define CLASS_LIST_STRINGS(V)
Definition class_id.h:132
#define CLASS_LIST_ARRAYS(V)
Definition class_id.h:128
#define CLASS_LIST_SETS(V)
Definition class_id.h:120
constexpr intptr_t kLastInternalOnlyCid
Definition class_id.h:289
#define DEFINE_ADD_MAP_KEY(clazz)
#define DEFINE_ADD_VALUE_F(id)
#define DEFINE_ADD_VALUE_F_CID(clazz)

◆ GetDummyTarget()

static FunctionPtr dart::GetDummyTarget ( const char *  name)
static

Definition at line 3011 of file object_test.cc.

3011 {
3012 const String& function_name =
3013 String::Handle(Symbols::New(Thread::Current(), name));
3014 const Class& cls =
3015 Class::Handle(CreateDummyClass(function_name, Script::Handle()));
3016 const bool is_static = false;
3017 const bool is_const = false;
3018 const bool is_abstract = false;
3019 const bool is_external = false;
3020 const bool is_native = false;
3021 const FunctionType& signature = FunctionType::ZoneHandle(FunctionType::New());
3022 return Function::New(signature, function_name,
3023 UntaggedFunction::kRegularFunction, is_static, is_const,
3024 is_abstract, is_external, is_native, cls,
3025 TokenPosition::kMinSource);
3026}

◆ GetEdgeCount()

static intptr_t dart::GetEdgeCount ( const Array edge_counters,
intptr_t  edge_id 
)
static

Definition at line 14 of file block_scheduler.cc.

14 {
15 if (!FLAG_reorder_basic_blocks) {
16 // Assume everything was visited once.
17 return 1;
18 }
19 return Smi::Value(Smi::RawCast(edge_counters.At(edge_id)));
20}

◆ GetElementTypeFromArray()

static AbstractTypePtr dart::GetElementTypeFromArray ( Value array)
static

Definition at line 1850 of file type_propagator.cc.

1850 {
1851 // Sometimes type of definition may contain a static type
1852 // which is useful to extract element type, but reaching type
1853 // only has a cid. So try out type of definition, if any.
1854 if (array->definition()->HasType()) {
1855 auto& elem_type = AbstractType::Handle(ExtractElementTypeFromArrayType(
1856 *(array->definition()->Type()->ToAbstractType())));
1857 if (!elem_type.IsDynamicType()) {
1858 return elem_type.ptr();
1859 }
1860 }
1862}
const AbstractType * ToAbstractType()
CompileType * Type()
Definition il.h:2503
bool HasType() const
Definition il.h:2512
CompileType * Type()

◆ GetErrorString()

static const char * dart::GetErrorString ( Thread thread,
const Object obj 
)
static

Definition at line 335 of file dart_api_impl.cc.

335 {
336 // This function requires an API scope to be present.
337 if (obj.IsError()) {
338 ASSERT(thread->api_top_scope() != nullptr);
339 const Error& error = Error::Cast(obj);
340 const char* str = error.ToErrorCString();
341 intptr_t len = strlen(str) + 1;
342 char* str_copy = Api::TopScope(thread)->zone()->Alloc<char>(len);
343 strncpy(str_copy, str, len);
344 // Strip a possible trailing '\n'.
345 if ((len > 1) && (str_copy[len - 2] == '\n')) {
346 str_copy[len - 2] = '\0';
347 }
348 return str_copy;
349 } else {
350 return "";
351 }
352}

◆ GetEscapedValue()

static int dart::GetEscapedValue ( const char *  str,
intptr_t  pos,
intptr_t  len 
)
static

Definition at line 62 of file uri.cc.

62 {
63 if (pos + 2 >= len) {
64 // Not enough room for a valid escape sequence.
65 return -1;
66 }
67 if (str[pos] != '%') {
68 // Escape sequences start with '%'.
69 return -1;
70 }
71
72 char digit1 = str[pos + 1];
73 char digit2 = str[pos + 2];
74 if (!IsHexDigit(digit1) || !IsHexDigit(digit2)) {
75 // Invalid escape sequence. Ignore it.
76 return -1;
77 }
78 return HexValue(digit1) * 16 + HexValue(digit2);
79}
static bool IsHexDigit(char value)
Definition uri.cc:43
static int HexValue(char digit)
Definition uri.cc:48

◆ GetExperimentalFeatureDefault()

bool dart::GetExperimentalFeatureDefault ( ExperimentalFeature  feature)

Definition at line 17 of file experimental_features.cc.

17 {
18 constexpr bool kFeatureValues[] = {
19 true, true, true, true, true, true, true, true, true, true, true,
20 true, true, true, true, true, true, true, true, true, true, true,
21 };
22 ASSERT(static_cast<size_t>(feature) < ARRAY_SIZE(kFeatureValues));
23 return kFeatureValues[static_cast<int>(feature)];
24}

◆ GetExperimentalFeatureName()

const char * dart::GetExperimentalFeatureName ( ExperimentalFeature  feature)

Definition at line 26 of file experimental_features.cc.

26 {
27 constexpr const char* kFeatureNames[] = {
28 "inference-update-3",
29 "inline-class",
30 "inference-update-2",
31 "sealed-class",
32 "class-modifiers",
33 "records",
34 "patterns",
35 "unnamed-libraries",
36 "inference-update-1",
37 "enhanced-enums",
38 "named-arguments-anywhere",
39 "super-parameters",
40 "constructor-tearoffs",
41 "generic-metadata",
42 "triple-shift",
43 "nonfunction-type-aliases",
44 "non-nullable",
45 "extension-methods",
46 "constant-update-2018",
47 "control-flow-collections",
48 "set-literals",
49 "spread-collections",
50 };
51 ASSERT(static_cast<size_t>(feature) < ARRAY_SIZE(kFeatureNames));
52 return kFeatureNames[static_cast<int>(feature)];
53}

◆ GetFfiNativeResolver()

static Dart_FfiNativeResolver dart::GetFfiNativeResolver ( Thread *const  thread,
const String lib_url_str 
)
static

Definition at line 257 of file ffi_dynamic_library.cc.

258 {
259 const Library& lib =
260 Library::Handle(Library::LookupLibrary(thread, lib_url_str));
261 if (lib.IsNull()) {
262 // It is not an error to not have a native resolver installed.
263 return nullptr;
264 }
265 return lib.ffi_native_resolver();
266}
Dart_FfiNativeResolver ffi_native_resolver() const
Definition object.h:5221

◆ GetField()

static FieldPtr dart::GetField ( const Class cls,
const char *  name 
)
static

Definition at line 5310 of file object_test.cc.

5310 {
5311 const Field& field =
5312 Field::Handle(cls.LookupField(String::Handle(String::New(name))));
5313 EXPECT(!field.IsNull());
5314 return field.ptr();
5315}
FieldPtr LookupField(const String &name) const
Definition object.cc:6407

◆ GetFlagList()

static void dart::GetFlagList ( Thread thread,
JSONStream js 
)
static

Definition at line 5598 of file service.cc.

5598 {
5599 Flags::PrintJSON(js);
5600}

◆ GetForwardedObject()

static ObjectPtr dart::GetForwardedObject ( ObjectPtr  object)
static

Definition at line 54 of file become.cc.

54 {
56 uword addr = static_cast<uword>(object) - kHeapObjectTag;
57 ForwardingCorpse* forwarder = reinterpret_cast<ForwardingCorpse*>(addr);
58 return forwarder->target();
59}
ObjectPtr target() const
Definition become.h:27

◆ GetFunction() [1/3]

static FunctionPtr dart::GetFunction ( const Class cls,
const char *  name 
)
static

Definition at line 5291 of file object_test.cc.

5291 {
5292 Thread* thread = Thread::Current();
5293 const auto& error = cls.EnsureIsFinalized(thread);
5294 EXPECT(error == Error::null());
5295 const Function& result = Function::Handle(Resolver::ResolveDynamicFunction(
5296 Z, cls, String::Handle(String::New(name))));
5297 EXPECT(!result.IsNull());
5298 return result.ptr();
5299}
#define Z

◆ GetFunction() [2/3]

static FunctionPtr dart::GetFunction ( const Class cls,
const char *  name 
)
static

Definition at line 122 of file service_test.cc.

122 {
123 const Function& result = Function::Handle(Resolver::ResolveDynamicFunction(
124 Thread::Current()->zone(), cls, String::Handle(String::New(name))));
125 EXPECT(!result.IsNull());
126 return result.ptr();
127}

◆ GetFunction() [3/3]

static FunctionPtr dart::GetFunction ( const Library lib,
const char *  name 
)

Definition at line 56 of file il_test_helper.cc.

56 {
57 Thread* thread = Thread::Current();
58 const auto& func = Function::Handle(lib.LookupFunctionAllowPrivate(
59 String::Handle(Symbols::New(thread, name))));
60 EXPECT(!func.IsNull());
61 return func.ptr();
62}

◆ GetFunctionTypeParameter()

TypeParameterPtr dart::GetFunctionTypeParameter ( const Function fun,
intptr_t  index 
)

Definition at line 78 of file il_test_helper.cc.

78 {
79 const auto& param = TypeParameter::Handle(fun.TypeParameterAt(index));
80 EXPECT(!param.IsNull());
81 return param.ptr();
82}
TypeParameterPtr TypeParameterAt(intptr_t index, Nullability nullability=Nullability::kNonNullable) const
Definition object.cc:8939

◆ GetGlobalStruct()

DART_EXPORT Coord dart::GetGlobalStruct ( )

Definition at line 63 of file ffi_test_functions.cc.

63 {
64 return globalStruct;
65}
DART_EXPORT_FIELD struct Coord globalStruct

◆ GetGlobalVar()

DART_EXPORT int32_t dart::GetGlobalVar ( )

Definition at line 59 of file ffi_test_functions.cc.

59 {
60 return globalInt;
61}
DART_EXPORT_FIELD int32_t globalInt

◆ GetHash()

static intptr_t dart::GetHash ( Isolate isolate,
const ObjectPtr  obj 
)
static

Definition at line 37 of file object.cc.

37 {
38#if defined(HASH_IN_OBJECT_HEADER)
39 return Object::GetCachedHash(obj);
40#else
41 Heap* heap = isolate->group()->heap();
42 ASSERT(obj->IsDartInstance());
43 return heap->GetHash(obj);
44#endif
45}
intptr_t GetHash(ObjectPtr raw_obj) const
Definition heap.h:178
bool IsDartInstance() const

◆ GetHeapMap()

static void dart::GetHeapMap ( Thread thread,
JSONStream js 
)
static

Definition at line 4570 of file service.cc.

4570 {
4571 auto isolate_group = thread->isolate_group();
4572 if (js->HasParam("gc")) {
4573 if (js->ParamIs("gc", "scavenge")) {
4574 isolate_group->heap()->CollectGarbage(thread, GCType::kScavenge,
4575 GCReason::kDebugging);
4576 } else if (js->ParamIs("gc", "mark-sweep")) {
4577 isolate_group->heap()->CollectGarbage(thread, GCType::kMarkSweep,
4578 GCReason::kDebugging);
4579 } else if (js->ParamIs("gc", "mark-compact")) {
4580 isolate_group->heap()->CollectGarbage(thread, GCType::kMarkCompact,
4581 GCReason::kDebugging);
4582 } else {
4583 PrintInvalidParamError(js, "gc");
4584 return;
4585 }
4586 }
4587 isolate_group->heap()->PrintHeapMapToJSONStream(isolate_group, js);
4588}
void CollectGarbage(Thread *thread, GCType type, GCReason reason)
Definition heap.cc:547

◆ GetHeapObjectCommon()

static bool dart::GetHeapObjectCommon ( Thread thread,
JSONStream js,
const char *  id,
Object obj,
ObjectIdRing::LookupResult lookup_result 
)
static

Definition at line 5009 of file service.cc.

5013 {
5014 *obj = LookupHeapObject(thread, id, lookup_result);
5015 ASSERT(obj != nullptr);
5016 ASSERT(lookup_result != nullptr);
5017 if (obj->ptr() != Object::sentinel().ptr()) {
5018#if !defined(DART_PRECOMPILED_RUNTIME)
5019 // If obj is a script from dart:* and doesn't have source loaded, try and
5020 // load the source before sending the response.
5021 if (obj->IsScript()) {
5022 const Script& script = Script::Cast(*obj);
5023 if (!script.HasSource() && script.IsPartOfDartColonLibrary() &&
5024 Service::HasDartLibraryKernelForSources()) {
5025 const uint8_t* kernel_buffer = Service::dart_library_kernel();
5026 const intptr_t kernel_buffer_len =
5027 Service::dart_library_kernel_length();
5028 script.LoadSourceFromKernel(kernel_buffer, kernel_buffer_len);
5029 }
5030 }
5031#endif // !defined(DART_PRECOMPILED_RUNTIME)
5032 // We found a heap object for this id.
5033 return true;
5034 }
5035
5036 return false;
5037}

◆ GetHexCharacter()

static int32_t dart::GetHexCharacter ( int32_t  c)
static

Definition at line 23975 of file object.cc.

23975 {
23976 ASSERT(c >= 0);
23977 ASSERT(c < 16);
23978 const char* hex = "0123456789ABCDEF";
23979 return hex[c];
23980}

◆ GetHexValue()

static int32_t dart::GetHexValue ( int32_t  c)
static

Definition at line 23982 of file object.cc.

23982 {
23983 if (c >= '0' && c <= '9') {
23984 return c - '0';
23985 }
23986 if (c >= 'A' && c <= 'F') {
23987 return c - 'A' + 10;
23988 }
23989 UNREACHABLE();
23990 return 0;
23991}

◆ GetImplementationFields()

static void dart::GetImplementationFields ( Thread thread,
JSONStream js 
)
static

Definition at line 5102 of file service.cc.

5102 {
5103 const char* id = js->LookupParam("objectId");
5104
5105 // Handle heap objects.
5106 Object& obj = Object::Handle();
5107 ObjectIdRing::LookupResult lookup_result;
5108 if (GetHeapObjectCommon(thread, js, id, &obj, &lookup_result)) {
5110 return;
5111 } else if (lookup_result == ObjectIdRing::kCollected) {
5112 PrintSentinel(js, kCollectedSentinel);
5113 return;
5114 } else if (lookup_result == ObjectIdRing::kExpired) {
5115 PrintSentinel(js, kExpiredSentinel);
5116 return;
5117 }
5118
5119 // Handle non-heap objects.
5120 Breakpoint* bpt = LookupBreakpoint(thread->isolate(), id, &lookup_result);
5121 if (bpt != nullptr) {
5122 const JSONObject jsobj(js);
5123 jsobj.AddProperty("type", "ImplementationFields");
5124 JSONArray jsarr_fields(&jsobj, "fields");
5125 return;
5126 } else if (lookup_result == ObjectIdRing::kCollected) {
5127 PrintSentinel(js, kCollectedSentinel);
5128 return;
5129 }
5130
5131 PrintInvalidParamError(js, "objectId");
5132}
void PrintImplementationFields(JSONStream *stream) const
static bool GetHeapObjectCommon(Thread *thread, JSONStream *js, const char *id, Object *obj, ObjectIdRing::LookupResult *lookup_result)
Definition service.cc:5009
static Breakpoint * LookupBreakpoint(Isolate *isolate, const char *id, ObjectIdRing::LookupResult *result)
Definition service.cc:2238

◆ GetInboundReferences()

static void dart::GetInboundReferences ( Thread thread,
JSONStream js 
)
static

Definition at line 2368 of file service.cc.

2368 {
2369 const char* target_id = js->LookupParam("targetId");
2370 if (target_id == nullptr) {
2371 PrintMissingParamError(js, "targetId");
2372 return;
2373 }
2374 const char* limit_cstr = js->LookupParam("limit");
2375 if (limit_cstr == nullptr) {
2376 PrintMissingParamError(js, "limit");
2377 return;
2378 }
2379 intptr_t limit;
2380 if (!GetIntegerId(limit_cstr, &limit)) {
2381 PrintInvalidParamError(js, "limit");
2382 return;
2383 }
2384
2385 Object& obj = Object::Handle(thread->zone());
2386 ObjectIdRing::LookupResult lookup_result;
2387 {
2388 HANDLESCOPE(thread);
2389 obj = LookupHeapObject(thread, target_id, &lookup_result);
2390 }
2391 if (obj.ptr() == Object::sentinel().ptr()) {
2392 if (lookup_result == ObjectIdRing::kCollected) {
2393 PrintSentinel(js, kCollectedSentinel);
2394 } else if (lookup_result == ObjectIdRing::kExpired) {
2395 PrintSentinel(js, kExpiredSentinel);
2396 } else {
2397 PrintInvalidParamError(js, "targetId");
2398 }
2399 return;
2400 }
2401 PrintInboundReferences(thread, &obj, limit, js);
2402}
static void PrintInboundReferences(Thread *thread, Object *target, intptr_t limit, JSONStream *js)
Definition service.cc:2285
static void PrintMissingParamError(JSONStream *js, const char *param)
Definition service.cc:885
static bool GetIntegerId(const char *s, intptr_t *id, int base=10)
Definition service.cc:533

◆ GetInputRange()

static const Range * dart::GetInputRange ( RangeAnalysis analysis,
RangeBoundary::RangeSize  size,
Value input 
)
static

Definition at line 2760 of file range_analysis.cc.

2762 {
2763 switch (size) {
2764 case RangeBoundary::kRangeBoundarySmi:
2765 return analysis->GetSmiRange(input);
2766 case RangeBoundary::kRangeBoundaryInt8:
2767 case RangeBoundary::kRangeBoundaryInt16:
2768 case RangeBoundary::kRangeBoundaryInt32:
2769 return input->definition()->range();
2770 case RangeBoundary::kRangeBoundaryInt64:
2771 return analysis->GetIntRange(input);
2772 default:
2773 UNREACHABLE();
2774 return nullptr;
2775 }
2776}
Range * range() const
Definition il.h:2618
const Range * GetIntRange(Value *value) const
const Range * GetSmiRange(Value *value) const

◆ GetInstances()

static void dart::GetInstances ( Thread thread,
JSONStream js 
)
static

Definition at line 3541 of file service.cc.

3541 {
3542 const char* object_id = js->LookupParam("objectId");
3543 const intptr_t limit = UIntParameter::Parse(js->LookupParam("limit"));
3544 const bool include_subclasses =
3545 BoolParameter::Parse(js->LookupParam("includeSubclasses"), false);
3546 const bool include_implementers =
3547 BoolParameter::Parse(js->LookupParam("includeImplementers"), false);
3548
3549 const Object& obj =
3550 Object::Handle(LookupHeapObject(thread, object_id, nullptr));
3551 if (obj.ptr() == Object::sentinel().ptr() || !obj.IsClass()) {
3552 PrintInvalidParamError(js, "objectId");
3553 return;
3554 }
3555 const Class& cls = Class::Cast(obj);
3556
3557 // Ensure the array and handles created below are promptly destroyed.
3558 StackZone zone(thread);
3559
3560 ZoneGrowableHandlePtrArray<Object> storage(thread->zone(), limit);
3561 GetInstancesVisitor visitor(&storage, limit);
3562 {
3563 ObjectGraph graph(thread);
3564 HeapIterationScope iteration_scope(Thread::Current(), true);
3565 MarkClasses(cls, include_subclasses, include_implementers);
3566 graph.IterateObjects(&visitor);
3567 UnmarkClasses();
3568 }
3569 intptr_t count = visitor.count();
3570 JSONObject jsobj(js);
3571 jsobj.AddProperty("type", "InstanceSet");
3572 jsobj.AddProperty("totalCount", count);
3573 {
3574 JSONArray samples(&jsobj, "instances");
3575 for (int i = 0; (i < limit) && (i < count); i++) {
3576 samples.AddValue(storage.At(i));
3577 }
3578 }
3579}

◆ GetInstancesAsList()

static void dart::GetInstancesAsList ( Thread thread,
JSONStream js 
)
static

Definition at line 3589 of file service.cc.

3589 {
3590 const char* object_id = js->LookupParam("objectId");
3591 bool include_subclasses =
3592 BoolParameter::Parse(js->LookupParam("includeSubclasses"), false);
3593 bool include_implementers =
3594 BoolParameter::Parse(js->LookupParam("includeImplementers"), false);
3595
3596 const Object& obj =
3597 Object::Handle(LookupHeapObject(thread, object_id, nullptr));
3598 if (obj.ptr() == Object::sentinel().ptr() || !obj.IsClass()) {
3599 PrintInvalidParamError(js, "objectId");
3600 return;
3601 }
3602 const Class& cls = Class::Cast(obj);
3603
3604 Array& instances = Array::Handle();
3605 {
3606 // Ensure the |ZoneGrowableHandlePtrArray| and handles created below are
3607 // promptly destroyed.
3608 StackZone zone(thread);
3609
3610 ZoneGrowableHandlePtrArray<Object> storage(thread->zone(), 1024);
3611 GetInstancesVisitor visitor(&storage, kSmiMax);
3612 {
3613 ObjectGraph graph(thread);
3614 HeapIterationScope iteration_scope(Thread::Current(), true);
3615 MarkClasses(cls, include_subclasses, include_implementers);
3616 graph.IterateObjects(&visitor);
3617 UnmarkClasses();
3618 }
3619 intptr_t count = visitor.count();
3620 instances = Array::New(count);
3621 for (intptr_t i = 0; i < count; i++) {
3622 instances.SetAt(i, storage.At(i));
3623 }
3624 }
3625 instances.PrintJSON(js, /*ref=*/true);
3626}

◆ GetInteger64Id()

static bool dart::GetInteger64Id ( const char *  s,
int64_t *  id,
int  base = 10 
)
static

Definition at line 581 of file service.cc.

581 {
582 if ((s == nullptr) || (*s == '\0')) {
583 // Empty string.
584 return false;
585 }
586 if (id == nullptr) {
587 // No id pointer.
588 return false;
589 }
590 int64_t r = 0;
591 char* end_ptr = nullptr;
592 r = strtoll(s, &end_ptr, base);
593 if (end_ptr == s) {
594 // String was not advanced at all, cannot be valid.
595 return false;
596 }
597 *id = r;
598 return true;
599}

◆ GetIntegerId()

static bool dart::GetIntegerId ( const char *  s,
intptr_t *  id,
int  base = 10 
)
static

Definition at line 533 of file service.cc.

533 {
534 if ((s == nullptr) || (*s == '\0')) {
535 // Empty string.
536 return false;
537 }
538 if (id == nullptr) {
539 // No id pointer.
540 return false;
541 }
542 intptr_t r = 0;
543 char* end_ptr = nullptr;
544#if defined(ARCH_IS_32_BIT)
545 r = strtol(s, &end_ptr, base);
546#else
547 r = strtoll(s, &end_ptr, base);
548#endif
549 if (end_ptr == s) {
550 // String was not advanced at all, cannot be valid.
551 return false;
552 }
553 *id = r;
554 return true;
555}

◆ GetIsolate()

static void dart::GetIsolate ( Thread thread,
JSONStream js 
)
static

Definition at line 1520 of file service.cc.

1520 {
1521 thread->isolate()->PrintJSON(js, false);
1522}
void PrintJSON(JSONStream *stream, bool ref=true)
Definition isolate.cc:3038

◆ GetIsolateGroup()

static void dart::GetIsolateGroup ( Thread thread,
JSONStream js 
)
static

Definition at line 1601 of file service.cc.

1601 {
1602 ActOnIsolateGroup(js, [&](IsolateGroup* isolate_group) {
1603 isolate_group->PrintJSON(js, false);
1604 });
1605}
void PrintJSON(JSONStream *stream, bool ref=true)
Definition isolate.cc:637
static void ActOnIsolateGroup(JSONStream *js, std::function< void(IsolateGroup *)> visitor)
Definition service.cc:1582

◆ GetIsolateGroupMemoryUsage()

static void dart::GetIsolateGroupMemoryUsage ( Thread thread,
JSONStream js 
)
static

Definition at line 1621 of file service.cc.

1621 {
1622 ActOnIsolateGroup(js, [&](IsolateGroup* isolate_group) {
1623 isolate_group->PrintMemoryUsageJSON(js);
1624 });
1625}
void PrintMemoryUsageJSON(JSONStream *stream)
Definition isolate.cc:662

◆ GetIsolateMetric()

static void dart::GetIsolateMetric ( Thread thread,
JSONStream js 
)
static

Definition at line 4128 of file service.cc.

4128 {
4129 const char* metric_id = js->LookupParam("metricId");
4130 if (metric_id == nullptr) {
4131 PrintMissingParamError(js, "metricId");
4132 return;
4133 }
4134 // Verify id begins with "metrics/native/".
4135 static const char* const kNativeMetricIdPrefix = "metrics/native/";
4136 static intptr_t kNativeMetricIdPrefixLen = strlen(kNativeMetricIdPrefix);
4137 if (strncmp(metric_id, kNativeMetricIdPrefix, kNativeMetricIdPrefixLen) !=
4138 0) {
4139 PrintInvalidParamError(js, "metricId");
4140 return;
4141 }
4142 const char* id = metric_id + kNativeMetricIdPrefixLen;
4143 HandleNativeMetric(thread, js, id);
4144}
static void HandleNativeMetric(Thread *thread, JSONStream *js, const char *id)
Definition service.cc:4083

◆ GetIsolateMetricList()

static void dart::GetIsolateMetricList ( Thread thread,
JSONStream js 
)
static

Definition at line 4110 of file service.cc.

4110 {
4111 if (js->HasParam("type")) {
4112 if (!js->ParamIs("type", "Native")) {
4113 PrintInvalidParamError(js, "type");
4114 return;
4115 }
4116 } else {
4117 PrintMissingParamError(js, "type");
4118 return;
4119 }
4120 HandleNativeMetricsList(thread, js);
4121}
static void HandleNativeMetricsList(Thread *thread, JSONStream *js)
Definition service.cc:4063

◆ GetIsolateObjectStore()

static void dart::GetIsolateObjectStore ( Thread thread,
JSONStream js 
)
static

Definition at line 5149 of file service.cc.

5149 {
5150 JSONObject jsobj(js);
5151 thread->isolate()->isolate_object_store()->PrintToJSONObject(&jsobj);
5152}
void PrintToJSONObject(JSONObject *jsobj)

◆ GetIsolatePauseEvent()

static void dart::GetIsolatePauseEvent ( Thread thread,
JSONStream js 
)
static

Definition at line 1632 of file service.cc.

1632 {
1633 thread->isolate()->PrintPauseEventJSON(js);
1634}
void PrintPauseEventJSON(JSONStream *stream)
Definition isolate.cc:3166

◆ GetJSONRpcErrorMessage()

static const char * dart::GetJSONRpcErrorMessage ( intptr_t  code)
static

Definition at line 106 of file json_stream.cc.

106 {
107 switch (code) {
108 case kParseError:
109 return "Parse error";
110 case kInvalidRequest:
111 return "Invalid Request";
112 case kMethodNotFound:
113 return "Method not found";
114 case kInvalidParams:
115 return "Invalid params";
116 case kInternalError:
117 return "Internal error";
118 case kFeatureDisabled:
119 return "Feature is disabled";
121 return "Cannot add breakpoint";
123 return "Stream already subscribed";
125 return "Stream not subscribed";
127 return "Isolate must be runnable";
129 return "Isolate must be paused";
130 case kCannotResume:
131 return "Cannot resume execution";
133 return "Isolate is reloading";
135 return "Isolate cannot be reloaded";
137 return "Isolate must have reloaded";
139 return "File system already exists";
141 return "File system does not exist";
143 return "File does not exist";
145 return "The timeline related request could not be completed due to the "
146 "current configuration";
147 default:
148 return "Extension error";
149 }
150}

◆ GetLastErrorAsString()

static void dart::GetLastErrorAsString ( char **  error)
static

Definition at line 261 of file utils.cc.

261 {
262 if (error == nullptr) return; // Nothing to do.
263
264#if defined(DART_HOST_OS_LINUX) || defined(DART_HOST_OS_MACOS) || \
265 defined(DART_HOST_OS_ANDROID) || defined(DART_HOST_OS_FUCHSIA)
266 const char* status = dlerror();
267 *error = status != nullptr ? strdup(status) : nullptr;
268#elif defined(DART_HOST_OS_WINDOWS)
269 const int status = GetLastError();
270 if (status != 0) {
271 char* description = nullptr;
272 int length = FormatMessageA(
273 FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
274 FORMAT_MESSAGE_IGNORE_INSERTS,
275 nullptr, status, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US),
276 reinterpret_cast<char*>(&description), 0, nullptr);
277 if (length == 0) {
278 // Seems like there is no message for this error code.
279 *error = Utils::SCreate("error code %i", status);
280 } else {
281 *error = Utils::SCreate("%s (error code: %i)", description, status);
282 }
283
284 LocalFree(description);
285 } else {
286 *error = nullptr;
287 }
288#else
289 *error = Utils::StrDup("loading dynamic libraries is not supported");
290#endif
291}
WINBASEAPI _Check_return_ _Post_equals_last_error_ DWORD WINAPI GetLastError(VOID)

◆ GetListInstance()

static InstancePtr dart::GetListInstance ( Zone zone,
const Object obj 
)
static

Definition at line 152 of file dart_api_impl.cc.

152 {
153 if (obj.IsInstance()) {
154 ObjectStore* object_store = IsolateGroup::Current()->object_store();
155 const Type& list_rare_type =
156 Type::Handle(zone, object_store->non_nullable_list_rare_type());
157 ASSERT(!list_rare_type.IsNull());
158 const Instance& instance = Instance::Cast(obj);
159 const Class& obj_class = Class::Handle(zone, obj.clazz());
160 if (Class::IsSubtypeOf(obj_class, Object::null_type_arguments(),
161 Nullability::kNonNullable, list_rare_type,
162 Heap::kNew)) {
163 return instance.ptr();
164 }
165 }
166 return Instance::null();
167}

◆ GetListLength()

static intptr_t dart::GetListLength ( const Object value)
static

Definition at line 12526 of file object.cc.

12526 {
12527 if (value.IsTypedDataBase()) {
12528 return TypedDataBase::Cast(value).Length();
12529 } else if (value.IsArray()) {
12530 return Array::Cast(value).Length();
12531 } else if (value.IsGrowableObjectArray()) {
12532 // List length is variable.
12533 return Field::kNoFixedLength;
12534 }
12535 return Field::kNoFixedLength;
12536}

◆ GetListLengthOffset()

static intptr_t dart::GetListLengthOffset ( intptr_t  cid)
static

Definition at line 12538 of file object.cc.

12538 {
12539 if (IsTypedDataClassId(cid) || IsTypedDataViewClassId(cid) ||
12542 return TypedData::length_offset();
12543 } else if (cid == kArrayCid || cid == kImmutableArrayCid) {
12544 return Array::length_offset();
12545 } else if (cid == kGrowableObjectArrayCid) {
12546 // List length is variable.
12547 return Field::kUnknownLengthOffset;
12548 }
12549 return Field::kUnknownLengthOffset;
12550}

◆ GetMapInstance()

static InstancePtr dart::GetMapInstance ( Zone zone,
const Object obj 
)
static

Definition at line 169 of file dart_api_impl.cc.

169 {
170 if (obj.IsInstance()) {
171 ObjectStore* object_store = IsolateGroup::Current()->object_store();
172 const Type& map_rare_type =
173 Type::Handle(zone, object_store->non_nullable_map_rare_type());
174 ASSERT(!map_rare_type.IsNull());
175 const Instance& instance = Instance::Cast(obj);
176 const Class& obj_class = Class::Handle(zone, obj.clazz());
177 if (Class::IsSubtypeOf(obj_class, Object::null_type_arguments(),
178 Nullability::kNonNullable, map_rare_type,
179 Heap::kNew)) {
180 return instance.ptr();
181 }
182 }
183 return Instance::null();
184}

◆ GetMemoryUsage()

static void dart::GetMemoryUsage ( Thread thread,
JSONStream js 
)
static

Definition at line 1612 of file service.cc.

1612 {
1613 thread->isolate()->PrintMemoryUsageJSON(js);
1614}
void PrintMemoryUsageJSON(JSONStream *stream)
Definition isolate.cc:3162

◆ GetNativeAssetsMap()

ArrayPtr dart::GetNativeAssetsMap ( Thread thread)

Definition at line 13 of file native_assets.cc.

13 {
14 Zone* const zone = thread->zone();
15 ObjectStore* const object_store = thread->isolate_group()->object_store();
16 auto& native_assets_map =
17 Array::Handle(zone, object_store->native_assets_map());
18 if (!native_assets_map.IsNull()) {
19 return native_assets_map.ptr();
20 }
21
22#if defined(DART_PRECOMPILED_RUNTIME)
23 // For now not configuring native assets is supported.
24 return Array::null();
25#else // defined(DART_PRECOMPILED_RUNTIME)
26
27 const auto& native_assets_library =
28 Library::Handle(zone, object_store->native_assets_library());
29 if (native_assets_library.IsNull()) {
30 // For now not configuring native assets is supported.
31 return Array::null();
32 }
33
34 auto& pragma = Object::Handle(zone);
35 const bool pragma_found = native_assets_library.FindPragma(
36 thread, /*only_core=*/false, native_assets_library,
37 Symbols::vm_ffi_native_assets(),
38 /*multiple=*/false, &pragma);
39 ASSERT(pragma_found);
40
41 // This map is formatted as follows:
42 //
43 // '<target_string>': {
44 // '<asset_uri>': ['<path_type>', '<path (optional)>']
45 // }
46 //
47 // It is generated by: pkg/vm/lib/native_assets/synthesizer.dart
48 const auto& abi_map = Map::Cast(pragma);
49 const auto& current_abi = String::Handle(
50 zone, String::NewFormatted("%s_%s", kTargetOperatingSystemName,
51 kTargetArchitectureName));
52 Map::Iterator abi_iterator(abi_map);
53 auto& abi = String::Handle(zone);
54 auto& asset_map = Map::Handle(zone);
55 while (abi_iterator.MoveNext()) {
56 abi = String::RawCast(abi_iterator.CurrentKey());
57 if (abi.Equals(current_abi)) {
58 asset_map = Map::RawCast(abi_iterator.CurrentValue());
59 break;
60 }
61 }
62 const intptr_t asset_map_length = asset_map.IsNull() ? 0 : asset_map.Length();
64 HashTables::New<NativeAssetsMap>(asset_map_length, Heap::kOld));
65 if (!asset_map.IsNull()) {
66 String& asset = String::Handle(zone);
67 Array& path = Array::Handle(zone);
68 Map::Iterator iterator2(asset_map);
69 bool duplicate_asset = false;
70 while (iterator2.MoveNext()) {
71 asset = String::RawCast(iterator2.CurrentKey());
72 path = Array::RawCast(iterator2.CurrentValue());
73 duplicate_asset = map.UpdateOrInsert(asset, path);
74 ASSERT(!duplicate_asset);
75 }
76 }
77 native_assets_map = map.Release().ptr();
78 object_store->set_native_assets_map(native_assets_map);
79 return native_assets_map.ptr();
80
81#endif // defined(DART_PRECOMPILED_RUNTIME)
82}
UnorderedHashMap< NativeAssetsMapTraits > NativeAssetsMap

◆ GetNativeDoubleArgument()

static bool dart::GetNativeDoubleArgument ( NativeArguments arguments,
int  arg_index,
double *  value 
)
static

Definition at line 246 of file dart_api_impl.cc.

248 {
249 ASSERT(value != nullptr);
250 return Api::GetNativeDoubleArgument(arguments, arg_index, value);
251}

◆ GetNativeFieldsOfArgument()

static Dart_Handle dart::GetNativeFieldsOfArgument ( NativeArguments arguments,
int  arg_index,
int  num_fields,
intptr_t *  field_values,
const char *  current_func 
)
static

Definition at line 253 of file dart_api_impl.cc.

257 {
258 ASSERT(field_values != nullptr);
259 if (Api::GetNativeFieldsOfArgument(arguments, arg_index, num_fields,
260 field_values)) {
261 return Api::Success();
262 }
263 Thread* thread = arguments->thread();
264 ASSERT(thread == Thread::Current());
266 Object& obj = thread->ObjectHandle();
267 obj = arguments->NativeArgAt(arg_index);
268 if (obj.IsNull()) {
269 memset(field_values, 0, (num_fields * sizeof(field_values[0])));
270 return Api::Success();
271 }
272 // We did not succeed in extracting the native fields report the
273 // appropriate error.
274 if (!obj.IsInstance()) {
275 return Api::NewError(
276 "%s expects argument at index '%d' to be of"
277 " type Instance.",
278 current_func, arg_index);
279 }
280 const Instance& instance = Instance::Cast(obj);
281 int field_count = instance.NumNativeFields();
282 ASSERT(num_fields != field_count);
283 return Api::NewError("%s: expected %d 'num_fields' but was passed in %d.",
284 current_func, field_count, num_fields);
285}

◆ GetNativeIntegerArgument()

static bool dart::GetNativeIntegerArgument ( NativeArguments arguments,
int  arg_index,
int64_t *  value 
)
static

Definition at line 227 of file dart_api_impl.cc.

229 {
230 ASSERT(value != nullptr);
231 return Api::GetNativeIntegerArgument(arguments, arg_index, value);
232}

◆ GetNativeStringArgument()

static bool dart::GetNativeStringArgument ( NativeArguments arguments,
int  arg_index,
Dart_Handle str,
void **  peer 
)
static

Definition at line 200 of file dart_api_impl.cc.

203 {
204 ASSERT(peer != nullptr);
205 if (Api::StringGetPeerHelper(arguments, arg_index, peer)) {
206 *str = nullptr;
207 return true;
208 }
209 Thread* thread = arguments->thread();
210 ASSERT(thread == Thread::Current());
211 *peer = nullptr;
213 Object& obj = thread->ObjectHandle();
214 obj = arguments->NativeArgAt(arg_index);
215 if (IsStringClassId(obj.GetClassId())) {
216 ASSERT(thread->api_top_scope() != nullptr);
217 *str = Api::NewHandle(thread, obj.ptr());
218 return true;
219 }
220 if (obj.IsNull()) {
221 *str = Api::Null();
222 return true;
223 }
224 return false;
225}

◆ GetNativeUnsignedIntegerArgument()

static bool dart::GetNativeUnsignedIntegerArgument ( NativeArguments arguments,
int  arg_index,
uint64_t *  value 
)
static

Definition at line 234 of file dart_api_impl.cc.

236 {
237 ASSERT(value != nullptr);
238 int64_t arg_value = 0;
239 if (Api::GetNativeIntegerArgument(arguments, arg_index, &arg_value)) {
240 *value = static_cast<uint64_t>(arg_value);
241 return true;
242 }
243 return false;
244}

◆ GetObject()

static void dart::GetObject ( Thread thread,
JSONStream js 
)
static

Definition at line 5046 of file service.cc.

5046 {
5047 const char* id = js->LookupParam("objectId");
5048 if (id == nullptr) {
5049 PrintMissingParamError(js, "objectId");
5050 return;
5051 }
5052 if (js->HasParam("offset")) {
5053 intptr_t value = UIntParameter::Parse(js->LookupParam("offset"));
5054 if (value < 0) {
5055 PrintInvalidParamError(js, "offset");
5056 return;
5057 }
5058 js->set_offset(value);
5059 }
5060 if (js->HasParam("count")) {
5061 intptr_t value = UIntParameter::Parse(js->LookupParam("count"));
5062 if (value < 0) {
5063 PrintInvalidParamError(js, "count");
5064 return;
5065 }
5066 js->set_count(value);
5067 }
5068
5069 // Handle heap objects.
5070 Object& obj = Object::Handle();
5071 ObjectIdRing::LookupResult lookup_result;
5072 if (GetHeapObjectCommon(thread, js, id, &obj, &lookup_result)) {
5073 obj.PrintJSON(js, false);
5074 return;
5075 } else if (lookup_result == ObjectIdRing::kCollected) {
5076 PrintSentinel(js, kCollectedSentinel);
5077 return;
5078 } else if (lookup_result == ObjectIdRing::kExpired) {
5079 PrintSentinel(js, kExpiredSentinel);
5080 return;
5081 }
5082
5083 // Handle non-heap objects.
5084 Breakpoint* bpt = LookupBreakpoint(thread->isolate(), id, &lookup_result);
5085 if (bpt != nullptr) {
5086 bpt->PrintJSON(js);
5087 return;
5088 } else if (lookup_result == ObjectIdRing::kCollected) {
5089 PrintSentinel(js, kCollectedSentinel);
5090 return;
5091 }
5092
5093 PrintInvalidParamError(js, "objectId");
5094}

◆ GetObjectStore()

static void dart::GetObjectStore ( Thread thread,
JSONStream js 
)
static

Definition at line 5139 of file service.cc.

5139 {
5140 JSONObject jsobj(js);
5141 thread->isolate_group()->object_store()->PrintToJSONObject(&jsobj);
5142}
void PrintToJSONObject(JSONObject *jsobj)

◆ GetPersistentHandles()

static void dart::GetPersistentHandles ( Thread thread,
JSONStream js 
)
static

Definition at line 4945 of file service.cc.

4945 {
4946 Isolate* isolate = thread->isolate();
4947 ASSERT(isolate != nullptr);
4948
4949 ApiState* api_state = isolate->group()->api_state();
4950 ASSERT(api_state != nullptr);
4951
4952 {
4953 JSONObject obj(js);
4954 obj.AddProperty("type", "_PersistentHandles");
4955 // Persistent handles.
4956 {
4957 JSONArray persistent_handles(&obj, "persistentHandles");
4959 [&](PersistentHandles& handles) {
4961 thread, &persistent_handles);
4962 handles.Visit(&visitor);
4963 });
4964 }
4965 // Weak persistent handles.
4966 {
4967 JSONArray weak_persistent_handles(&obj, "weakPersistentHandles");
4969 [&](FinalizablePersistentHandles& handles) {
4970 PersistentHandleVisitor<FinalizablePersistentHandle> visitor(
4971 thread, &weak_persistent_handles);
4972 handles.VisitHandles(&visitor);
4973 });
4974 }
4975 }
4976}
void RunWithLockedWeakPersistentHandles(std::function< void(FinalizablePersistentHandles &)> fun)
void RunWithLockedPersistentHandles(std::function< void(PersistentHandles &)> fun)
void Visit(HandleVisitor *visitor)

◆ GetPlaceId()

static DART_FORCE_INLINE intptr_t dart::GetPlaceId ( const Instruction instr)
static

Definition at line 1364 of file redundancy_elimination.cc.

1364 {
1365 ASSERT(HasPlaceId(instr));
1366 return instr->GetPassSpecificId(CompilerPass::kCSE);
1367}
intptr_t GetPassSpecificId(CompilerPass::Id pass) const
Definition il.h:1218
static DART_FORCE_INLINE bool HasPlaceId(const Instruction *instr)

◆ GetPlatformScriptPath()

static StringPtr dart::GetPlatformScriptPath ( Thread thread)
static

Definition at line 297 of file ffi_dynamic_library.cc.

297 {
298 IsolateGroupSource* const source = thread->isolate_group()->source();
299
300#if defined(DART_TARGET_OS_WINDOWS)
301 // Isolate.spawnUri sets a `source` including the file schema.
302 // And on Windows we get an extra forward slash in that case.
303 const char* file_schema_slash = "file:///";
304 const int file_schema_slash_length = 8;
305 const char* path = source->script_uri;
306 if (strlen(source->script_uri) > file_schema_slash_length &&
307 strncmp(source->script_uri, file_schema_slash,
308 file_schema_slash_length) == 0) {
309 path = (source->script_uri + file_schema_slash_length);
310 }
311
312 // Replace backward slashes with forward slashes.
313 const intptr_t len = strlen(path);
314 char* path_copy = reinterpret_cast<char*>(malloc(len + 1));
315 snprintf(path_copy, len + 1, "%s", path);
316 ReplaceBackSlashes(path_copy);
317 const auto& result = String::Handle(String::New(path_copy));
318 free(path_copy);
319 return result.ptr();
320#else
321 // Isolate.spawnUri sets a `source` including the file schema.
322 if (strlen(source->script_uri) > file_schema_length &&
323 strncmp(source->script_uri, file_schema, file_schema_length) == 0) {
324 const char* path = (source->script_uri + file_schema_length);
325 return String::New(path);
326 }
327 return String::New(source->script_uri);
328#endif
329}
SKWASM_EXPORT SkPath * path_copy(SkPath *path)
Definition path.cpp:20

◆ GetPorts()

static void dart::GetPorts ( Thread thread,
JSONStream js 
)
static

Definition at line 3690 of file service.cc.

3690 {
3691 // Ensure the array and handles created below are promptly destroyed.
3692 StackZone zone(thread);
3693 const GrowableObjectArray& ports = GrowableObjectArray::Handle(
3694 GrowableObjectArray::RawCast(DartLibraryCalls::LookupOpenPorts()));
3695 JSONObject jsobj(js);
3696 jsobj.AddProperty("type", "PortList");
3697 {
3698 ReceivePort& port = ReceivePort::Handle(zone.GetZone());
3699 JSONArray arr(&jsobj, "ports");
3700 for (int i = 0; i < ports.Length(); ++i) {
3701 port ^= ports.At(i);
3702 ASSERT(port.is_open());
3703 if (port.keep_isolate_alive()) {
3704 arr.AddValue(port);
3705 }
3706 }
3707 }
3708}

◆ GetPortsPrivate()

static void dart::GetPortsPrivate ( Thread thread,
JSONStream js 
)
static

Definition at line 4983 of file service.cc.

4983 {
4984 MessageHandler* message_handler = thread->isolate()->message_handler();
4985 PortMap::PrintPortsForMessageHandler(message_handler, js);
4986}

◆ GetPrefixedIntegerId()

static bool dart::GetPrefixedIntegerId ( const char *  s,
const char *  prefix,
intptr_t *  service_id 
)
static

Definition at line 645 of file service.cc.

647 {
648 if (s == nullptr) {
649 return false;
650 }
651 ASSERT(prefix != nullptr);
652 const intptr_t kInputLen = strlen(s);
653 const intptr_t kPrefixLen = strlen(prefix);
654 ASSERT(kPrefixLen > 0);
655 if (kInputLen <= kPrefixLen) {
656 return false;
657 }
658 if (strncmp(s, prefix, kPrefixLen) != 0) {
659 return false;
660 }
661 // Prefix satisfied. Move forward.
662 s += kPrefixLen;
663 // Attempt to read integer id.
664 return GetIntegerId(s, service_id);
665}

◆ GetProcessMemoryUsage()

static void dart::GetProcessMemoryUsage ( Thread thread,
JSONStream js 
)
static

Definition at line 4825 of file service.cc.

4825 {
4827}
static intptr_t GetProcessMemoryUsageHelper(JSONStream *js)
Definition service.cc:4705

◆ GetProcessMemoryUsageHelper()

static intptr_t dart::GetProcessMemoryUsageHelper ( JSONStream js)
static

Definition at line 4705 of file service.cc.

4705 {
4706 JSONObject response(js);
4707 response.AddProperty("type", "ProcessMemoryUsage");
4708
4709 JSONObject rss(&response, "root");
4710 rss.AddPropertyF("name", "Process %" Pd "", OS::ProcessId());
4711 rss.AddProperty("description", "Resident set size");
4712 rss.AddProperty64("size", Service::CurrentRSS());
4713 JSONArray rss_children(&rss, "children");
4714
4715 intptr_t vm_size = 0;
4716 {
4717 JSONObject vm(&rss_children);
4718 {
4719 JSONArray vm_children(&vm, "children");
4720
4721 {
4722 JSONObject profiler(&vm_children);
4723 profiler.AddProperty("name", "Profiler");
4724 profiler.AddProperty("description",
4725 "Samples from the Dart VM's profiler");
4726 intptr_t size = Profiler::Size();
4727 vm_size += size;
4728 profiler.AddProperty64("size", size);
4729 JSONArray(&profiler, "children");
4730 }
4731
4732 {
4733 JSONObject timeline(&vm_children);
4734 timeline.AddProperty("name", "Timeline");
4735 timeline.AddProperty(
4736 "description",
4737 "Timeline events from dart:developer and Dart_RecordTimelineEvent");
4738 intptr_t size = Timeline::recorder()->Size();
4739 vm_size += size;
4740 timeline.AddProperty64("size", size);
4741 JSONArray(&timeline, "children");
4742 }
4743
4744 {
4745 JSONObject zone(&vm_children);
4746 zone.AddProperty("name", "Zone");
4747 zone.AddProperty("description", "Arena allocation in the Dart VM");
4748 intptr_t size = Zone::Size();
4749 vm_size += size;
4750 zone.AddProperty64("size", size);
4751 JSONArray(&zone, "children");
4752 }
4753
4754 {
4755 JSONObject semi(&vm_children);
4756 semi.AddProperty("name", "Page Cache");
4757 semi.AddProperty("description", "Cached heap regions");
4758 intptr_t size = Page::CachedSize();
4759 vm_size += size;
4760 semi.AddProperty64("size", size);
4761 JSONArray(&semi, "children");
4762 }
4763
4764 IsolateGroup::ForEach([&vm_children,
4765 &vm_size](IsolateGroup* isolate_group) {
4766 int64_t capacity =
4767 (isolate_group->heap()->new_space()->CapacityInWords() +
4768 isolate_group->heap()->old_space()->CapacityInWords()) *
4769 kWordSize;
4770 // The more precise UsedInWords for new-space iterates pages and
4771 // potentially accesses Thread::top_/end_, which is not thread-safe
4772 // here. CapacityInWords is similar enough for purposes of service stats
4773 // for new-space, differing only up to the as-yet-unused portion of
4774 // active TLABs, unlike old-space where it can differ greatly in a
4775 // highly fragmented heap.
4776 int64_t used = (isolate_group->heap()->new_space()->CapacityInWords() +
4777 isolate_group->heap()->old_space()->UsedInWords()) *
4778 kWordSize;
4779
4780 int64_t free = capacity - used;
4781
4782 JSONObject group(&vm_children);
4783 group.AddPropertyF("name", "IsolateGroup %s",
4784 isolate_group->source()->name);
4785 group.AddProperty("description", "Dart heap capacity");
4786 vm_size += capacity;
4787 group.AddProperty64("size", capacity);
4788 JSONArray group_children(&group, "children");
4789
4790 {
4791 JSONObject jsused(&group_children);
4792 jsused.AddProperty("name", "Used");
4793 jsused.AddProperty("description", "");
4794 jsused.AddProperty64("size", used);
4795 JSONArray(&jsused, "children");
4796 }
4797
4798 {
4799 JSONObject jsfree(&group_children);
4800 jsfree.AddProperty("name", "Free");
4801 jsfree.AddProperty("description", "");
4802 jsfree.AddProperty64("size", free);
4803 JSONArray(&jsfree, "children");
4804 }
4805 });
4806 } // vm_children
4807
4808 vm.AddProperty("name", "Dart VM");
4809 vm.AddProperty("description", "");
4810 vm.AddProperty64("size", vm_size);
4811 }
4812
4813#if defined(DART_HOST_OS_LINUX) || defined(DART_HOST_OS_ANDROID)
4814 AddVMMappings(&rss_children);
4815#endif
4816 // TODO(46166): Implement for other operating systems.
4817
4818 return vm_size;
4819}
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 keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition switches.h:259

◆ GetReachableSize()

static void dart::GetReachableSize ( Thread thread,
JSONStream js 
)
static

Definition at line 2591 of file service.cc.

2591 {
2592 const char* target_id = js->LookupParam("targetId");
2593 ASSERT(target_id != nullptr);
2594 ObjectIdRing::LookupResult lookup_result;
2595 Object& obj =
2596 Object::Handle(LookupHeapObject(thread, target_id, &lookup_result));
2597 if (obj.ptr() == Object::sentinel().ptr()) {
2598 if (lookup_result == ObjectIdRing::kCollected) {
2599 PrintSentinel(js, kCollectedSentinel);
2600 } else if (lookup_result == ObjectIdRing::kExpired) {
2601 PrintSentinel(js, kExpiredSentinel);
2602 } else {
2603 PrintInvalidParamError(js, "targetId");
2604 }
2605 return;
2606 }
2607 // TODO(rmacnak): There is no way to get the size retained by a class object.
2608 // SizeRetainedByClass should be a separate RPC.
2609 if (obj.IsClass()) {
2610 const Class& cls = Class::Cast(obj);
2611 ObjectGraph graph(thread);
2612 intptr_t retained_size = graph.SizeReachableByClass(cls.id());
2613 const Object& result = Object::Handle(Integer::New(retained_size));
2614 result.PrintJSON(js, true);
2615 return;
2616 }
2617
2618 ObjectGraph graph(thread);
2619 intptr_t retained_size = graph.SizeReachableByInstance(obj);
2620 const Object& result = Object::Handle(Integer::New(retained_size));
2621 result.PrintJSON(js, true);
2622}

◆ GetRelativeSourceIndex()

static intptr_t dart::GetRelativeSourceIndex ( const String src,
intptr_t  line,
intptr_t  line_offset = 0,
intptr_t  column = 1,
intptr_t  column_offset = 0,
intptr_t  starting_index = 0 
)
static

Definition at line 13410 of file object.cc.

13415 {
13416 if (starting_index < 0 || line < 1 || column < 1 || line <= line_offset ||
13417 (line == line_offset + 1 && column <= column_offset)) {
13418 return -1;
13419 }
13420 intptr_t len = src.Length();
13421 intptr_t current_line = line_offset + 1;
13422 intptr_t current_index = starting_index;
13423 for (; current_index < len; current_index++) {
13424 if (current_line == line) {
13425 break;
13426 }
13427 const uint16_t c = src.CharAt(current_index);
13428 if (c == '\n' || c == '\r') {
13429 current_line++;
13430 }
13431 if (c == '\r' && current_index + 1 < len &&
13432 src.CharAt(current_index + 1) == '\n') {
13433 // \r\n is treated as a single line terminator.
13434 current_index++;
13435 }
13436 }
13437 if (current_line != line) {
13438 return -1;
13439 }
13440 // Only adjust with column offset when still on the first line.
13441 intptr_t current_column = 1 + (line == line_offset + 1 ? column_offset : 0);
13442 for (; current_index < len; current_index++, current_column++) {
13443 if (current_column == column) {
13444 return current_index;
13445 }
13446 const uint16_t c = src.CharAt(current_index);
13447 if (c == '\n' || c == '\r') {
13448 break;
13449 }
13450 }
13451 // Check for a column value representing the source's end.
13452 if (current_column == column) {
13453 return current_index;
13454 }
13455 return -1;
13456}

◆ GetResourceValue()

intptr_t dart::GetResourceValue ( intptr_t *  resource)

Definition at line 1171 of file ffi_test_functions_vmspecific.cc.

1171 {
1172 return *resource;
1173}

◆ GetRetainedSize()

static void dart::GetRetainedSize ( Thread thread,
JSONStream js 
)
static

Definition at line 2552 of file service.cc.

2552 {
2553 const char* target_id = js->LookupParam("targetId");
2554 ASSERT(target_id != nullptr);
2555 ObjectIdRing::LookupResult lookup_result;
2556 Object& obj =
2557 Object::Handle(LookupHeapObject(thread, target_id, &lookup_result));
2558 if (obj.ptr() == Object::sentinel().ptr()) {
2559 if (lookup_result == ObjectIdRing::kCollected) {
2560 PrintSentinel(js, kCollectedSentinel);
2561 } else if (lookup_result == ObjectIdRing::kExpired) {
2562 PrintSentinel(js, kExpiredSentinel);
2563 } else {
2564 PrintInvalidParamError(js, "targetId");
2565 }
2566 return;
2567 }
2568 // TODO(rmacnak): There is no way to get the size retained by a class object.
2569 // SizeRetainedByClass should be a separate RPC.
2570 if (obj.IsClass()) {
2571 const Class& cls = Class::Cast(obj);
2572 ObjectGraph graph(thread);
2573 intptr_t retained_size = graph.SizeRetainedByClass(cls.id());
2574 const Object& result = Object::Handle(Integer::New(retained_size));
2575 result.PrintJSON(js, true);
2576 return;
2577 }
2578
2579 ObjectGraph graph(thread);
2580 intptr_t retained_size = graph.SizeRetainedByInstance(obj);
2581 const Object& result = Object::Handle(Integer::New(retained_size));
2582 result.PrintJSON(js, true);
2583}

◆ GetRetainingPath()

static void dart::GetRetainingPath ( Thread thread,
JSONStream js 
)
static

Definition at line 2510 of file service.cc.

2510 {
2511 const char* target_id = js->LookupParam("targetId");
2512 if (target_id == nullptr) {
2513 PrintMissingParamError(js, "targetId");
2514 return;
2515 }
2516 const char* limit_cstr = js->LookupParam("limit");
2517 if (limit_cstr == nullptr) {
2518 PrintMissingParamError(js, "limit");
2519 return;
2520 }
2521 intptr_t limit;
2522 if (!GetIntegerId(limit_cstr, &limit)) {
2523 PrintInvalidParamError(js, "limit");
2524 return;
2525 }
2526
2527 Object& obj = Object::Handle(thread->zone());
2528 ObjectIdRing::LookupResult lookup_result;
2529 {
2530 HANDLESCOPE(thread);
2531 obj = LookupHeapObject(thread, target_id, &lookup_result);
2532 }
2533 if (obj.ptr() == Object::sentinel().ptr()) {
2534 if (lookup_result == ObjectIdRing::kCollected) {
2535 PrintSentinel(js, kCollectedSentinel);
2536 } else if (lookup_result == ObjectIdRing::kExpired) {
2537 PrintSentinel(js, kExpiredSentinel);
2538 } else {
2539 PrintInvalidParamError(js, "targetId");
2540 }
2541 return;
2542 }
2543 PrintRetainingPath(thread, &obj, limit, js);
2544}
static void PrintRetainingPath(Thread *thread, Object *obj, intptr_t limit, JSONStream *js)
Definition service.cc:2404

◆ GetRootLibraryUrl()

DART_EXPORT Dart_Handle dart::GetRootLibraryUrl ( )

Definition at line 1134 of file ffi_test_functions_vmspecific.cc.

1134 {
1135 Dart_Handle root_lib = Dart_RootLibrary();
1136 Dart_Handle lib_url = Dart_LibraryUrl(root_lib);
1137 ENSURE(!Dart_IsError(lib_url));
1138 return lib_url;
1139}
DART_EXPORT Dart_Handle Dart_LibraryUrl(Dart_Handle library)
DART_EXPORT Dart_Handle Dart_RootLibrary(void)

◆ GetScripts()

static void dart::GetScripts ( Thread thread,
JSONStream js 
)
static

Definition at line 1641 of file service.cc.

1641 {
1642 auto object_store = thread->isolate_group()->object_store();
1643 Zone* zone = thread->zone();
1644
1645 const auto& libs =
1646 GrowableObjectArray::Handle(zone, object_store->libraries());
1647 intptr_t num_libs = libs.Length();
1648
1649 Library& lib = Library::Handle(zone);
1650 Array& scripts = Array::Handle(zone);
1651 Script& script = Script::Handle(zone);
1652
1653 JSONObject jsobj(js);
1654 {
1655 jsobj.AddProperty("type", "ScriptList");
1656 JSONArray script_array(&jsobj, "scripts");
1657 for (intptr_t i = 0; i < num_libs; i++) {
1658 lib ^= libs.At(i);
1659 ASSERT(!lib.IsNull());
1660 scripts = lib.LoadedScripts();
1661 for (intptr_t j = 0; j < scripts.Length(); j++) {
1662 script ^= scripts.At(j);
1663 ASSERT(!script.IsNull());
1664 script_array.AddValue(script);
1665 }
1666 }
1667 }
1668}
ArrayPtr LoadedScripts() const
Definition object.cc:13987

◆ GetSerialized()

static std::unique_ptr< Message > dart::GetSerialized ( Dart_Handle  lib,
const char *  dart_function 
)
static

Definition at line 797 of file snapshot_test.cc.

798 {
800 {
801 TransitionVMToNative transition(Thread::Current());
802 result = Dart_Invoke(lib, NewString(dart_function), 0, nullptr);
804 }
805 Object& obj = Object::Handle(Api::UnwrapHandle(result));
806
807 // Serialize the object into a message.
808 return WriteMessage(/* same_group */ false, obj, ILLEGAL_PORT,
809 Message::kNormalPriority);
810}

◆ GetSourceReport()

static void dart::GetSourceReport ( Thread thread,
JSONStream js 
)
static

Definition at line 3730 of file service.cc.

3730 {
3731#if defined(DART_PRECOMPILED_RUNTIME)
3732 js->PrintError(kFeatureDisabled, "disabled in AOT mode and PRODUCT.");
3733#else
3734 char* reports_str = Utils::StrDup(js->LookupParam("reports"));
3735 const EnumListParameter* reports_parameter =
3736 static_cast<const EnumListParameter*>(get_source_report_params[1]);
3737 const char** reports = reports_parameter->Parse(reports_str);
3738 const char** riter = reports;
3739 intptr_t report_set = 0;
3740 while (*riter != nullptr) {
3741 if (strcmp(*riter, SourceReport::kCallSitesStr) == 0) {
3742 report_set |= SourceReport::kCallSites;
3743 } else if (strcmp(*riter, SourceReport::kCoverageStr) == 0) {
3744 report_set |= SourceReport::kCoverage;
3745 } else if (strcmp(*riter, SourceReport::kPossibleBreakpointsStr) == 0) {
3746 report_set |= SourceReport::kPossibleBreakpoints;
3747 } else if (strcmp(*riter, SourceReport::kProfileStr) == 0) {
3748 report_set |= SourceReport::kProfile;
3749 } else if (strcmp(*riter, SourceReport::kBranchCoverageStr) == 0) {
3750 report_set |= SourceReport::kBranchCoverage;
3751 }
3752 riter++;
3753 }
3754 if (reports != nullptr) {
3755 delete[] reports;
3756 }
3757 free(reports_str);
3758
3759 SourceReport::CompileMode compile_mode = SourceReport::kNoCompile;
3760 if (BoolParameter::Parse(js->LookupParam("forceCompile"), false)) {
3761 compile_mode = SourceReport::kForceCompile;
3762 }
3763
3764 bool report_lines =
3765 BoolParameter::Parse(js->LookupParam("reportLines"), false);
3766
3767 Script& script = Script::Handle();
3768 intptr_t start_pos = UIntParameter::Parse(js->LookupParam("tokenPos"));
3769 intptr_t end_pos = UIntParameter::Parse(js->LookupParam("endTokenPos"));
3770
3771 if (js->HasParam("scriptId")) {
3772 // Get the target script.
3773 const char* script_id_param = js->LookupParam("scriptId");
3774 const Object& obj =
3775 Object::Handle(LookupHeapObject(thread, script_id_param, nullptr));
3776 if (obj.ptr() == Object::sentinel().ptr() || !obj.IsScript()) {
3777 PrintInvalidParamError(js, "scriptId");
3778 return;
3779 }
3780 script ^= obj.ptr();
3781 } else {
3782 if (js->HasParam("tokenPos")) {
3783 js->PrintError(
3784 kInvalidParams,
3785 "%s: the 'tokenPos' parameter requires the 'scriptId' parameter",
3786 js->method());
3787 return;
3788 }
3789 if (js->HasParam("endTokenPos")) {
3790 js->PrintError(
3791 kInvalidParams,
3792 "%s: the 'endTokenPos' parameter requires the 'scriptId' parameter",
3793 js->method());
3794 return;
3795 }
3796 }
3797
3798 const char* library_filters_param = js->LookupParam("libraryFilters");
3799 GrowableObjectArray& library_filters = GrowableObjectArray::Handle();
3800 if (library_filters_param != nullptr) {
3801 library_filters = GrowableObjectArray::New();
3802 intptr_t library_filters_length =
3803 ParseJSONArray(thread, library_filters_param, library_filters);
3804 if (library_filters_length < 0) {
3805 PrintInvalidParamError(js, "library_filters");
3806 return;
3807 }
3808 }
3809
3810 const char* libraries_already_compiled_param =
3811 js->LookupParam("librariesAlreadyCompiled");
3812 Zone* zone = thread->zone();
3813 ZoneCStringSet* libraries_already_compiled = nullptr;
3814 if (libraries_already_compiled_param != nullptr) {
3815 libraries_already_compiled = new (zone) ZoneCStringSet(zone);
3816 intptr_t libraries_already_compiled_length = ParseJSONSet(
3817 thread, libraries_already_compiled_param, libraries_already_compiled);
3818 if (libraries_already_compiled_length < 0) {
3819 PrintInvalidParamError(js, "libraries_already_compiled");
3820 return;
3821 }
3822 }
3823
3824 SourceReport report(report_set, library_filters, libraries_already_compiled,
3825 compile_mode, report_lines);
3826 report.PrintJSON(js, script, TokenPosition::Deserialize(start_pos),
3827 TokenPosition::Deserialize(end_pos));
3828#endif // !DART_PRECOMPILED_RUNTIME
3829}
const char ** Parse(char *value) const
Definition service.cc:194
static const MethodParameter *const get_source_report_params[]
Definition service.cc:3718
static intptr_t ParseJSONSet(Thread *thread, const char *str, ZoneCStringSet *elements)
Definition service.cc:3674
intptr_t ParseJSONArray(Thread *thread, const char *str, const GrowableObjectArray &elements)
Definition service.cc:3660

◆ GetStack()

static void dart::GetStack ( Thread thread,
JSONStream js 
)
static

Definition at line 1676 of file service.cc.

1676 {
1677 if (CheckDebuggerDisabled(thread, js)) {
1678 return;
1679 }
1680 intptr_t limit = 0;
1681 bool has_limit = js->HasParam("limit");
1682 if (has_limit) {
1683 limit = UIntParameter::Parse(js->LookupParam("limit"));
1684 if (limit < 0) {
1685 PrintInvalidParamError(js, "limit");
1686 return;
1687 }
1688 }
1689 Isolate* isolate = thread->isolate();
1690 DebuggerStackTrace* stack = isolate->debugger()->StackTrace();
1691 DebuggerStackTrace* async_awaiter_stack =
1692 isolate->debugger()->AsyncAwaiterStackTrace();
1693
1694 // Do we want the complete script object and complete local variable objects?
1695 // This is true for dump requests.
1696 JSONObject jsobj(js);
1697 jsobj.AddProperty("type", "Stack");
1698 {
1699 JSONArray jsarr(&jsobj, "frames");
1700
1701 intptr_t num_frames =
1702 has_limit ? Utils::Minimum(stack->Length(), limit) : stack->Length();
1703
1704 for (intptr_t i = 0; i < num_frames; i++) {
1705 ActivationFrame* frame = stack->FrameAt(i);
1706 JSONObject jsobj(&jsarr);
1707 frame->PrintToJSONObject(&jsobj);
1708 jsobj.AddProperty("index", i);
1709 }
1710 }
1711
1712 if (async_awaiter_stack != nullptr) {
1713 JSONArray jsarr(&jsobj, "asyncCausalFrames");
1714 intptr_t num_frames =
1715 has_limit ? Utils::Minimum(async_awaiter_stack->Length(), limit)
1716 : async_awaiter_stack->Length();
1717 for (intptr_t i = 0; i < num_frames; i++) {
1718 ActivationFrame* frame = async_awaiter_stack->FrameAt(i);
1719 JSONObject jsobj(&jsarr);
1720 frame->PrintToJSONObject(&jsobj);
1721 jsobj.AddProperty("index", i);
1722 }
1723 }
1724
1725 const bool truncated =
1726 (has_limit &&
1727 (limit < stack->Length() || (async_awaiter_stack != nullptr &&
1728 limit < async_awaiter_stack->Length())));
1729 jsobj.AddProperty("truncated", truncated);
1730
1731 {
1732 MessageHandler::AcquiredQueues aq(isolate->message_handler());
1733 jsobj.AddProperty("messages", aq.queue());
1734 }
1735}

◆ GetStackTraceForException()

StackTracePtr dart::GetStackTraceForException ( )

Definition at line 56 of file stacktrace.cc.

56 {
57 Thread* thread = Thread::Current();
58 return CurrentStackTrace(thread, 0);
59}

◆ GetStaticFunction()

static FunctionPtr dart::GetStaticFunction ( const Class cls,
const char *  name 
)
static

Definition at line 5301 of file object_test.cc.

5301 {
5302 const auto& error = cls.EnsureIsFinalized(Thread::Current());
5303 EXPECT(error == Error::null());
5304 const Function& result = Function::Handle(
5305 cls.LookupStaticFunction(String::Handle(String::New(name))));
5306 EXPECT(!result.IsNull());
5307 return result.ptr();
5308}
FunctionPtr LookupStaticFunction(const String &name) const
Definition object.cc:6192

◆ GetStoredValue()

static Definition * dart::GetStoredValue ( Instruction instr)
static

Definition at line 1287 of file redundancy_elimination.cc.

1287 {
1288 if (instr->IsStoreIndexed()) {
1289 return instr->AsStoreIndexed()->value()->definition();
1290 }
1291
1292 StoreFieldInstr* store_instance_field = instr->AsStoreField();
1293 if (store_instance_field != nullptr) {
1294 return store_instance_field->value()->definition();
1295 }
1296
1297 StoreStaticFieldInstr* store_static_field = instr->AsStoreStaticField();
1298 if (store_static_field != nullptr) {
1299 return store_static_field->value()->definition();
1300 }
1301
1302 UNREACHABLE(); // Should only be called for supported store instructions.
1303 return nullptr;
1304}

◆ GetTagProfile()

static void dart::GetTagProfile ( Thread thread,
JSONStream js 
)
static

Definition at line 4442 of file service.cc.

4442 {
4443 JSONObject miniProfile(js);
4444 miniProfile.AddProperty("type", "TagProfile");
4445 thread->isolate()->vm_tag_counters()->PrintToJSONObject(&miniProfile);
4446}
VMTagCounters * vm_tag_counters()
Definition isolate.h:1264
void PrintToJSONObject(JSONObject *obj)
Definition tags.cc:123

◆ GetType()

static Dart_TypedData_Type dart::GetType ( intptr_t  class_id)
static

Definition at line 3599 of file dart_api_impl.cc.

3599 {
3601 switch (class_id) {
3602 case kByteDataViewCid:
3605 break;
3606 case kTypedDataInt8ArrayCid:
3607 case kTypedDataInt8ArrayViewCid:
3608 case kUnmodifiableTypedDataInt8ArrayViewCid:
3609 case kExternalTypedDataInt8ArrayCid:
3611 break;
3612 case kTypedDataUint8ArrayCid:
3613 case kTypedDataUint8ArrayViewCid:
3614 case kUnmodifiableTypedDataUint8ArrayViewCid:
3615 case kExternalTypedDataUint8ArrayCid:
3617 break;
3618 case kTypedDataUint8ClampedArrayCid:
3619 case kTypedDataUint8ClampedArrayViewCid:
3620 case kUnmodifiableTypedDataUint8ClampedArrayViewCid:
3621 case kExternalTypedDataUint8ClampedArrayCid:
3623 break;
3624 case kTypedDataInt16ArrayCid:
3625 case kTypedDataInt16ArrayViewCid:
3626 case kUnmodifiableTypedDataInt16ArrayViewCid:
3627 case kExternalTypedDataInt16ArrayCid:
3629 break;
3630 case kTypedDataUint16ArrayCid:
3631 case kTypedDataUint16ArrayViewCid:
3632 case kUnmodifiableTypedDataUint16ArrayViewCid:
3633 case kExternalTypedDataUint16ArrayCid:
3635 break;
3636 case kTypedDataInt32ArrayCid:
3637 case kTypedDataInt32ArrayViewCid:
3638 case kUnmodifiableTypedDataInt32ArrayViewCid:
3639 case kExternalTypedDataInt32ArrayCid:
3641 break;
3642 case kTypedDataUint32ArrayCid:
3643 case kTypedDataUint32ArrayViewCid:
3644 case kUnmodifiableTypedDataUint32ArrayViewCid:
3645 case kExternalTypedDataUint32ArrayCid:
3647 break;
3648 case kTypedDataInt64ArrayCid:
3649 case kTypedDataInt64ArrayViewCid:
3650 case kUnmodifiableTypedDataInt64ArrayViewCid:
3651 case kExternalTypedDataInt64ArrayCid:
3653 break;
3654 case kTypedDataUint64ArrayCid:
3655 case kTypedDataUint64ArrayViewCid:
3656 case kUnmodifiableTypedDataUint64ArrayViewCid:
3657 case kExternalTypedDataUint64ArrayCid:
3659 break;
3660 case kTypedDataFloat32ArrayCid:
3661 case kTypedDataFloat32ArrayViewCid:
3662 case kUnmodifiableTypedDataFloat32ArrayViewCid:
3663 case kExternalTypedDataFloat32ArrayCid:
3665 break;
3666 case kTypedDataFloat64ArrayCid:
3667 case kTypedDataFloat64ArrayViewCid:
3668 case kUnmodifiableTypedDataFloat64ArrayViewCid:
3669 case kExternalTypedDataFloat64ArrayCid:
3671 break;
3672 case kTypedDataInt32x4ArrayCid:
3673 case kTypedDataInt32x4ArrayViewCid:
3674 case kUnmodifiableTypedDataInt32x4ArrayViewCid:
3675 case kExternalTypedDataInt32x4ArrayCid:
3677 break;
3678 case kTypedDataFloat32x4ArrayCid:
3679 case kTypedDataFloat32x4ArrayViewCid:
3680 case kUnmodifiableTypedDataFloat32x4ArrayViewCid:
3681 case kExternalTypedDataFloat32x4ArrayCid:
3683 break;
3684 case kTypedDataFloat64x2ArrayCid:
3685 case kTypedDataFloat64x2ArrayViewCid:
3686 case kUnmodifiableTypedDataFloat64x2ArrayViewCid:
3687 case kExternalTypedDataFloat64x2ArrayCid:
3689 break;
3690 default:
3692 break;
3693 }
3694 return type;
3695}

◆ GetTypeArgumentsList()

static void dart::GetTypeArgumentsList ( Thread thread,
JSONStream js 
)
static

Definition at line 5170 of file service.cc.

5170 {
5171 bool only_with_instantiations = false;
5172 if (js->ParamIs("onlyWithInstantiations", "true")) {
5173 only_with_instantiations = true;
5174 }
5175 Zone* zone = thread->zone();
5176 ObjectStore* object_store = thread->isolate_group()->object_store();
5177 CanonicalTypeArgumentsSet typeargs_table(
5178 zone, object_store->canonical_type_arguments());
5179 const intptr_t table_size = typeargs_table.NumEntries();
5180 const intptr_t table_used = typeargs_table.NumOccupied();
5181 const Array& typeargs_array =
5182 Array::Handle(zone, HashTables::ToArray(typeargs_table, false));
5183 ASSERT(typeargs_array.Length() == table_used);
5184 TypeArguments& typeargs = TypeArguments::Handle(zone);
5185 JSONObject jsobj(js);
5186 jsobj.AddProperty("type", "TypeArgumentsList");
5187 jsobj.AddProperty("canonicalTypeArgumentsTableSize", table_size);
5188 jsobj.AddProperty("canonicalTypeArgumentsTableUsed", table_used);
5189 JSONArray members(&jsobj, "typeArguments");
5190 for (intptr_t i = 0; i < table_used; i++) {
5191 typeargs ^= typeargs_array.At(i);
5192 if (!typeargs.IsNull()) {
5193 if (!only_with_instantiations || typeargs.HasInstantiations()) {
5194 members.AddValue(typeargs);
5195 }
5196 }
5197 }
5198 typeargs_table.Release();
5199}

◆ GetTypeCommon()

static Dart_Handle dart::GetTypeCommon ( Dart_Handle  library,
Dart_Handle  class_name,
intptr_t  number_of_type_arguments,
Dart_Handle type_arguments,
Nullability  nullability 
)
static

Definition at line 5523 of file dart_api_impl.cc.

5527 {
5528 DARTSCOPE(Thread::Current());
5529 // Validate the input arguments.
5530 const Library& lib = Api::UnwrapLibraryHandle(Z, library);
5531 if (lib.IsNull()) {
5532 RETURN_TYPE_ERROR(Z, library, Library);
5533 }
5534 if (!lib.Loaded()) {
5535 return Api::NewError("%s expects library argument 'library' to be loaded.",
5536 CURRENT_FUNC);
5537 }
5538 const String& name_str = Api::UnwrapStringHandle(Z, class_name);
5539 if (name_str.IsNull()) {
5540 RETURN_TYPE_ERROR(Z, class_name, String);
5541 }
5542 const Class& cls = Class::Handle(Z, lib.LookupClassAllowPrivate(name_str));
5543 if (cls.IsNull()) {
5544 const String& lib_name = String::Handle(Z, lib.name());
5545 return Api::NewError("Type '%s' not found in library '%s'.",
5546 name_str.ToCString(), lib_name.ToCString());
5547 }
5548 cls.EnsureDeclarationLoaded();
5549 CHECK_ERROR_HANDLE(cls.VerifyEntryPoint());
5550
5551 Type& type = Type::Handle();
5552 if (cls.NumTypeArguments() == 0) {
5553 if (number_of_type_arguments != 0) {
5554 return Api::NewError(
5555 "Invalid number of type arguments specified, "
5556 "got %" Pd " expected 0",
5557 number_of_type_arguments);
5558 }
5559 type ^= Type::NewNonParameterizedType(cls);
5560 type ^= type.ToNullability(nullability, Heap::kOld);
5561 } else {
5562 intptr_t num_expected_type_arguments = cls.NumTypeParameters();
5563 TypeArguments& type_args_obj = TypeArguments::Handle();
5564 if (number_of_type_arguments > 0) {
5565 if (type_arguments == nullptr) {
5566 RETURN_NULL_ERROR(type_arguments);
5567 }
5568 if (num_expected_type_arguments != number_of_type_arguments) {
5569 return Api::NewError(
5570 "Invalid number of type arguments specified, "
5571 "got %" Pd " expected %" Pd,
5572 number_of_type_arguments, num_expected_type_arguments);
5573 }
5574 const Array& array = Api::UnwrapArrayHandle(Z, *type_arguments);
5575 if (array.IsNull()) {
5576 RETURN_TYPE_ERROR(Z, *type_arguments, Array);
5577 }
5578 if (array.Length() != num_expected_type_arguments) {
5579 return Api::NewError(
5580 "Invalid type arguments specified, expected an "
5581 "array of len %" Pd " but got an array of len %" Pd,
5582 number_of_type_arguments, array.Length());
5583 }
5584 // Set up the type arguments array.
5585 type_args_obj = TypeArguments::New(num_expected_type_arguments);
5586 AbstractType& type_arg = AbstractType::Handle();
5587 for (intptr_t i = 0; i < number_of_type_arguments; i++) {
5588 type_arg ^= array.At(i);
5589 type_args_obj.SetTypeAt(i, type_arg);
5590 }
5591 }
5592
5593 // Construct the type object, canonicalize it and return.
5594 type ^= Type::New(cls, type_args_obj, nullability);
5595 }
5596 type ^= ClassFinalizer::FinalizeType(type);
5597 return Api::NewHandle(T, type.ptr());
5598}

◆ GetTypedDataSizeOrThrow()

static intptr_t dart::GetTypedDataSizeOrThrow ( const Instance instance)
static

Definition at line 1117 of file isolate.cc.

1117 {
1118 // From the Dart side we are guaranteed that the type of [instance] is a
1119 // subtype of TypedData.
1120 if (instance.IsTypedDataBase()) {
1121 return TypedDataBase::Cast(instance).LengthInBytes();
1122 }
1123
1124 // This can happen if [instance] is `null` or an instance of a 3rd party class
1125 // which implements [TypedData].
1126 Exceptions::ThrowArgumentError(instance);
1127}

◆ GetUnsignedIntegerId()

static bool dart::GetUnsignedIntegerId ( const char *  s,
uintptr_t *  id,
int  base = 10 
)
static

Definition at line 557 of file service.cc.

557 {
558 if ((s == nullptr) || (*s == '\0')) {
559 // Empty string.
560 return false;
561 }
562 if (id == nullptr) {
563 // No id pointer.
564 return false;
565 }
566 uintptr_t r = 0;
567 char* end_ptr = nullptr;
568#if defined(ARCH_IS_32_BIT)
569 r = strtoul(s, &end_ptr, base);
570#else
571 r = strtoull(s, &end_ptr, base);
572#endif
573 if (end_ptr == s) {
574 // String was not advanced at all, cannot be valid.
575 return false;
576 }
577 *id = r;
578 return true;
579}

◆ GetValue()

static int64_t dart::GetValue ( Dart_Handle  arg)
static

Definition at line 8653 of file dart_api_impl_test.cc.

◆ GetVariableValue()

static DART_FORCE_INLINE ObjectPtr dart::GetVariableValue ( uword  addr)
static

Definition at line 833 of file debugger.cc.

833 {
834 return *reinterpret_cast<ObjectPtr*>(addr);
835}

◆ GetVersion()

static void dart::GetVersion ( Thread thread,
JSONStream js 
)
static

Definition at line 5206 of file service.cc.

5206 {
5207 JSONObject jsobj(js);
5208 jsobj.AddProperty("type", "Version");
5209 jsobj.AddProperty("major",
5210 static_cast<intptr_t>(SERVICE_PROTOCOL_MAJOR_VERSION));
5211 jsobj.AddProperty("minor",
5212 static_cast<intptr_t>(SERVICE_PROTOCOL_MINOR_VERSION));
5213 jsobj.AddProperty("_privateMajor", static_cast<intptr_t>(0));
5214 jsobj.AddProperty("_privateMinor", static_cast<intptr_t>(0));
5215}

◆ GetVM()

static void dart::GetVM ( Thread thread,
JSONStream js 
)
static

Definition at line 5337 of file service.cc.

5337 {
5338 Service::PrintJSONForVM(js, false);
5339}

◆ GetVMName()

static const char * dart::GetVMName ( )
static

Definition at line 358 of file service.cc.

358 {
359 if (vm_name == nullptr) {
360 return FLAG_vm_name;
361 }
362 return vm_name;
363}

◆ GetVMTimeline()

static void dart::GetVMTimeline ( Thread thread,
JSONStream js 
)
static

Definition at line 4307 of file service.cc.

4307 {
4308 GetVMTimelineCommon(TimelineOrSamplesResponseFormat::JSON, thread, js);
4309}
void GetVMTimelineCommon(TimelineOrSamplesResponseFormat format, Thread *thread, JSONStream *js)
Definition service.cc:4176

◆ GetVMTimelineCommon()

void dart::GetVMTimelineCommon ( TimelineOrSamplesResponseFormat  format,
Thread thread,
JSONStream js 
)
inline

Definition at line 4176 of file service.cc.

4178 {
4179 Isolate* isolate = thread->isolate();
4180 ASSERT(isolate != nullptr);
4181 StackZone zone(thread);
4182 TimelineEventRecorder* timeline_recorder = Timeline::recorder();
4183 ASSERT(timeline_recorder != nullptr);
4184 const char* name = timeline_recorder->name();
4185 if (strcmp(name, CALLBACK_RECORDER_NAME) == 0) {
4186 js->PrintError(kInvalidTimelineRequest,
4187 "A recorder of type \"%s\" is currently in use. As a "
4188 "result, timeline events are handled by the embedder rather "
4189 "than the VM.",
4190 timeline_recorder->name());
4191 return;
4192 } else if (strcmp(name, FUCHSIA_RECORDER_NAME) == 0 ||
4193 strcmp(name, SYSTRACE_RECORDER_NAME) == 0 ||
4194 strcmp(name, MACOS_RECORDER_NAME) == 0) {
4195 js->PrintError(
4196 kInvalidTimelineRequest,
4197 "A recorder of type \"%s\" is currently in use. As a result, timeline "
4198 "events are handled by the OS rather than the VM. See the VM service "
4199 "documentation for more details on where timeline events can be found "
4200 "for this recorder type.",
4201 timeline_recorder->name());
4202 return;
4203 } else if (strcmp(name, FILE_RECORDER_NAME) == 0 ||
4204 strcmp(name, PERFETTO_FILE_RECORDER_NAME) == 0) {
4205 js->PrintError(kInvalidTimelineRequest,
4206 "A recorder of type \"%s\" is currently in use. As a "
4207 "result, timeline events are written directly to a file and "
4208 "thus cannot be retrieved through the VM Service.",
4209 timeline_recorder->name());
4210 return;
4211 }
4212 int64_t time_origin_micros =
4213 Int64Parameter::Parse(js->LookupParam("timeOriginMicros"));
4214 int64_t time_extent_micros =
4215 Int64Parameter::Parse(js->LookupParam("timeExtentMicros"));
4216 TimelineEventFilter filter(time_origin_micros, time_extent_micros);
4217 if (format == TimelineOrSamplesResponseFormat::JSON) {
4218 timeline_recorder->PrintJSON(js, &filter);
4219 } else if (format == TimelineOrSamplesResponseFormat::Perfetto) {
4220#if defined(SUPPORT_PERFETTO)
4221 // This branch will never be reached when SUPPORT_PERFETTO is not defined,
4222 // because |GetPerfettoVMTimeline| is not defined when SUPPORT_PERFETTO is
4223 // not defined.
4224 timeline_recorder->PrintPerfettoTimeline(js, filter);
4225#else
4226 UNREACHABLE();
4227#endif // defined(SUPPORT_PERFETTO)
4228 }
4229}

◆ GetVMTimelineFlags()

static void dart::GetVMTimelineFlags ( Thread thread,
JSONStream js 
)
static

Definition at line 4262 of file service.cc.

4262 {
4263#if !defined(SUPPORT_TIMELINE)
4264 JSONObject obj(js);
4265 obj.AddProperty("type", "TimelineFlags");
4266#else
4267 Isolate* isolate = thread->isolate();
4268 ASSERT(isolate != nullptr);
4269 StackZone zone(thread);
4270 Timeline::PrintFlagsToJSON(js);
4271#endif
4272}

◆ GetVMTimelineMicros()

static void dart::GetVMTimelineMicros ( Thread thread,
JSONStream js 
)
static

Definition at line 4279 of file service.cc.

4279 {
4280 JSONObject obj(js);
4281 obj.AddProperty("type", "Timestamp");
4282 obj.AddPropertyTimeMicros("timestamp", OS::GetCurrentMonotonicMicros());
4283}

◆ GetYieldPointsFromCode()

static YieldPoints * dart::GetYieldPointsFromCode ( const Code code)
static

Definition at line 37 of file yield_position_test.cc.

37 {
38 auto array = new YieldPoints();
39 const auto& pc_descriptor = PcDescriptors::Handle(code.pc_descriptors());
40 PcDescriptors::Iterator it(pc_descriptor, UntaggedPcDescriptors::kOther);
41 while (it.MoveNext()) {
42 if (it.YieldIndex() != UntaggedPcDescriptors::kInvalidYieldIndex) {
43 array->Add(it.TokenPos());
44 }
45 }
46 array->Sort(LowestFirst);
47 return array;
48}

◆ GetYieldPointsFromGraph()

static YieldPoints * dart::GetYieldPointsFromGraph ( FlowGraph flow_graph)
static

Definition at line 21 of file yield_position_test.cc.

21 {
22 auto array = new (flow_graph->zone()) YieldPoints();
23 const auto& blocks = flow_graph->reverse_postorder();
24 for (auto block : blocks) {
26 while (!it.Done()) {
27 if (auto suspend_instr = it.Current()->AsSuspend()) {
28 array->Add(suspend_instr->token_pos());
29 }
30 it.Advance();
31 }
32 }
33 array->Sort(LowestFirst);
34 return array;
35}

◆ gnac_lookup()

static Dart_NativeFunction dart::gnac_lookup ( Dart_Handle  name,
int  argument_count,
bool *  auto_setup_scope 
)
static

Definition at line 7261 of file dart_api_impl_test.cc.

7266 {
7267 ASSERT(auto_setup_scope != nullptr);

◆ greatestFirst()

static int dart::greatestFirst ( const int a,
const int b 
)
static

Definition at line 76 of file growable_array_test.cc.

76 {
77 if (*a > *b) {
78 return -1;
79 } else if (*a < *b) {
80 return 1;
81 } else {
82 return 0;
83 }
84}

◆ HandleCommonEcho()

static void dart::HandleCommonEcho ( JSONObject jsobj,
JSONStream js 
)
static

Definition at line 1737 of file service.cc.

1737 {
1738 jsobj->AddProperty("type", "_EchoResponse");
1739 if (js->HasParam("text")) {
1740 jsobj->AddProperty("text", js->LookupParam("text"));
1741 }
1742}

◆ HandleFromFinalizable()

static Dart_Handle dart::HandleFromFinalizable ( Dart_FinalizableHandle  object)
static

Definition at line 958 of file dart_api_impl.cc.

958 {
959 Thread* thread = Thread::Current();
960 Isolate* isolate = thread->isolate();
961 CHECK_ISOLATE(isolate);
962 ApiState* state = isolate->group()->api_state();
963 ASSERT(state != nullptr);
964 TransitionNativeToVM transition(thread);
965 NoSafepointScope no_safepoint_scope;
967 FinalizablePersistentHandle::Cast(object);
968 return Api::NewHandle(thread, weak_ref->ptr());
969}

◆ HandleInterrupts()

void dart::HandleInterrupts ( Thread thread)

Definition at line 10277 of file dart_api_impl_test.cc.

10277 {
10278 return x;
10279}
10280

◆ HandleIsolateMessage()

static void dart::HandleIsolateMessage ( Isolate isolate,
const Array msg 
)
static

Definition at line 136 of file service_test.cc.

136 {
137 Service::HandleIsolateMessage(isolate, msg);
138}

◆ HandleNativeMetric()

static void dart::HandleNativeMetric ( Thread thread,
JSONStream js,
const char *  id 
)
static

Definition at line 4083 of file service.cc.

4083 {
4084 auto isolate = thread->isolate();
4085#define ADD_METRIC(type, variable, name, unit) \
4086 if (strcmp(id, name) == 0) { \
4087 isolate->Get##variable##Metric()->PrintJSON(js); \
4088 return; \
4089 }
4091#undef ADD_METRIC
4092
4093 auto isolate_group = thread->isolate_group();
4094#define ADD_METRIC(type, variable, name, unit) \
4095 if (strcmp(id, name) == 0) { \
4096 isolate_group->Get##variable##Metric()->PrintJSON(js); \
4097 return; \
4098 }
4100#undef ADD_METRIC
4101
4102 PrintInvalidParamError(js, "metricId");
4103}
#define ISOLATE_METRIC_LIST(V)
Definition metrics.h:49
#define ISOLATE_GROUP_METRIC_LIST(V)
Definition metrics.h:37
#define ADD_METRIC(type, variable, name, unit)

◆ HandleNativeMetricsList()

static void dart::HandleNativeMetricsList ( Thread thread,
JSONStream js 
)
static

Definition at line 4063 of file service.cc.

4063 {
4064 JSONObject obj(js);
4065 obj.AddProperty("type", "MetricList");
4066 {
4067 JSONArray metrics(&obj, "metrics");
4068
4069 auto isolate = thread->isolate();
4070#define ADD_METRIC(type, variable, name, unit) \
4071 metrics.AddValue(isolate->Get##variable##Metric());
4073#undef ADD_METRIC
4074
4075 auto isolate_group = thread->isolate_group();
4076#define ADD_METRIC(type, variable, name, unit) \
4077 metrics.AddValue(isolate_group->Get##variable##Metric());
4079#undef ADD_METRIC
4080 }
4081}

◆ HandleOSRRequest()

static void dart::HandleOSRRequest ( Thread thread)
static

Definition at line 3079 of file runtime_entry.cc.

3079 {
3080 auto isolate_group = thread->isolate_group();
3081 ASSERT(isolate_group->use_osr());
3082 DartFrameIterator iterator(thread,
3083 StackFrameIterator::kNoCrossThreadIteration);
3084 StackFrame* frame = iterator.NextFrame();
3085 ASSERT(frame != nullptr);
3086 const Code& code = Code::ZoneHandle(frame->LookupDartCode());
3087 ASSERT(!code.IsNull());
3088 ASSERT(!code.is_optimized());
3089 const Function& function = Function::Handle(code.function());
3090 ASSERT(!function.IsNull());
3091
3092 // If the code of the frame does not match the function's unoptimized code,
3093 // we bail out since the code was reset by an isolate reload.
3094 if (code.ptr() != function.unoptimized_code()) {
3095 return;
3096 }
3097
3098 // Since the code is referenced from the frame and the ZoneHandle,
3099 // it cannot have been removed from the function.
3100 ASSERT(function.HasCode());
3101 // Don't do OSR on intrinsified functions: The intrinsic code expects to be
3102 // called like a regular function and can't be entered via OSR.
3103 if (!Compiler::CanOptimizeFunction(thread, function) ||
3104 function.is_intrinsic()) {
3105 return;
3106 }
3107
3108 // The unoptimized code is on the stack and should never be detached from
3109 // the function at this point.
3110 ASSERT(function.unoptimized_code() != Object::null());
3111 intptr_t osr_id =
3112 Code::Handle(function.unoptimized_code()).GetDeoptIdForOsr(frame->pc());
3113 ASSERT(osr_id != Compiler::kNoOSRDeoptId);
3114 if (FLAG_trace_osr) {
3115 OS::PrintErr("Attempting OSR for %s at id=%" Pd ", count=%" Pd "\n",
3116 function.ToFullyQualifiedCString(), osr_id,
3117 function.usage_counter());
3118 }
3119
3120 // Since the code is referenced from the frame and the ZoneHandle,
3121 // it cannot have been removed from the function.
3122 const Object& result = Object::Handle(
3123 Compiler::CompileOptimizedFunction(thread, function, osr_id));
3125
3126 if (!result.IsNull()) {
3127 const Code& code = Code::Cast(result);
3128 uword optimized_entry = code.EntryPoint();
3129 frame->set_pc(optimized_entry);
3130 frame->set_pc_marker(code.ptr());
3131 }
3132}

◆ HandleReadFieldValue()

DART_EXPORT int64_t dart::HandleReadFieldValue ( Dart_Handle  handle)

Definition at line 1039 of file ffi_test_functions_vmspecific.cc.

1039 {
1040 printf("HandleReadFieldValue\n");
1041 Dart_Handle field_name = Dart_NewStringFromCString("a");
1042 if (Dart_IsError(field_name)) {
1043 printf("Dart_PropagateError(field_name)\n");
1044 Dart_PropagateError(field_name);
1045 }
1046 Dart_Handle field_value = Dart_GetField(handle, field_name);
1047 if (Dart_IsError(field_value)) {
1048 printf("Dart_PropagateError(field_value)\n");
1049 Dart_PropagateError(field_value);
1050 }
1051 int64_t value;
1052 Dart_Handle err = Dart_IntegerToInt64(field_value, &value);
1053 if (Dart_IsError(err)) {
1055 }
1056 return value;
1057}
DART_EXPORT Dart_Handle Dart_NewStringFromCString(const char *str)

◆ HandleRecursion()

DART_EXPORT Dart_Handle dart::HandleRecursion ( Dart_Handle  object,
Dart_Handle(*)(int64_t)  callback,
int64_t  i 
)

Definition at line 1002 of file ffi_test_functions_vmspecific.cc.

1004 {
1005 printf("HandleRecursion %" Pd64 "\n", i);
1006 const bool do_invoke = i % 3 == 0;
1007 const bool do_gc = i % 7 == 3;
1008 if (do_gc) {
1009 Dart_ExecuteInternalCommand("gc-now", nullptr);
1010 }
1012 if (do_invoke) {
1013 Dart_Handle method_name = Dart_NewStringFromCString("a");
1014 if (Dart_IsError(method_name)) {
1015 Dart_PropagateError(method_name);
1016 }
1017 Dart_Handle arg = Dart_NewInteger(i - 1);
1018 if (Dart_IsError(arg)) {
1020 }
1021 printf("Dart_Invoke\n");
1022 result = Dart_Invoke(object, method_name, 1, &arg);
1023 } else {
1024 printf("callback\n");
1025 result = callback(i - 1);
1026 }
1027 if (do_gc) {
1028 Dart_ExecuteInternalCommand("gc-now", nullptr);
1029 }
1030 if (Dart_IsError(result)) {
1031 // Do C/C++ resource cleanup if needed, before propagating error.
1032 printf("Dart_PropagateError %" Pd64 "\n", i);
1034 }
1035 printf("return %" Pd64 "\n", i);
1036 return result;
1037}
std::string printf(const char *fmt,...) SK_PRINTF_LIKE(1

◆ HandleResponse()

static void dart::HandleResponse ( Dart_Port  dest_port_id,
Dart_CObject message 
)
static

Definition at line 9944 of file dart_api_impl_test.cc.

◆ HandleRootMessage()

static void dart::HandleRootMessage ( const Array message)
static

Definition at line 140 of file service_test.cc.

140 {
141 Service::HandleRootMessage(message);
142}

◆ HandleStackOverflowTestCases()

static void dart::HandleStackOverflowTestCases ( Thread thread)
static

Definition at line 2957 of file runtime_entry.cc.

2957 {
2958 auto isolate = thread->isolate();
2959 auto isolate_group = thread->isolate_group();
2960
2961 if (FLAG_shared_slow_path_triggers_gc) {
2962 isolate->group()->heap()->CollectAllGarbage(GCReason::kDebugging);
2963 }
2964
2965 bool do_deopt = false;
2966 bool do_stacktrace = false;
2967 bool do_reload = false;
2968 bool do_gc = false;
2969 const intptr_t isolate_reload_every =
2970 isolate->group()->reload_every_n_stack_overflow_checks();
2971 if ((FLAG_deoptimize_every > 0) || (FLAG_stacktrace_every > 0) ||
2972 (FLAG_gc_every > 0) || (isolate_reload_every > 0)) {
2973 if (!Isolate::IsSystemIsolate(isolate)) {
2974 // TODO(turnidge): To make --deoptimize_every and
2975 // --stacktrace-every faster we could move this increment/test to
2976 // the generated code.
2977 int32_t count = thread->IncrementAndGetStackOverflowCount();
2978 if (FLAG_deoptimize_every > 0 && (count % FLAG_deoptimize_every) == 0) {
2979 do_deopt = true;
2980 }
2981 if (FLAG_stacktrace_every > 0 && (count % FLAG_stacktrace_every) == 0) {
2982 do_stacktrace = true;
2983 }
2984 if (FLAG_gc_every > 0 && (count % FLAG_gc_every) == 0) {
2985 do_gc = true;
2986 }
2987 if ((isolate_reload_every > 0) && (count % isolate_reload_every) == 0) {
2988 do_reload = isolate->group()->CanReload();
2989 }
2990 }
2991 }
2992 if ((FLAG_deoptimize_filter != nullptr) ||
2993 (FLAG_stacktrace_filter != nullptr) || (FLAG_reload_every != 0)) {
2994 DartFrameIterator iterator(thread,
2995 StackFrameIterator::kNoCrossThreadIteration);
2996 StackFrame* frame = iterator.NextFrame();
2997 ASSERT(frame != nullptr);
2998 Code& code = Code::Handle();
2999 Function& function = Function::Handle();
3000 code = frame->LookupDartCode();
3001 ASSERT(!code.IsNull());
3002 function = code.function();
3003 ASSERT(!function.IsNull());
3004 const char* function_name = nullptr;
3005 if ((FLAG_deoptimize_filter != nullptr) ||
3006 (FLAG_stacktrace_filter != nullptr)) {
3007 function_name = function.ToFullyQualifiedCString();
3008 ASSERT(function_name != nullptr);
3009 }
3010 if (!code.IsNull()) {
3011 if (!code.is_optimized() && FLAG_reload_every_optimized) {
3012 // Don't do the reload if we aren't inside optimized code.
3013 do_reload = false;
3014 }
3015 if (code.is_optimized() && FLAG_deoptimize_filter != nullptr &&
3016 strstr(function_name, FLAG_deoptimize_filter) != nullptr &&
3017 !function.ForceOptimize()) {
3018 OS::PrintErr("*** Forcing deoptimization (%s)\n",
3019 function.ToFullyQualifiedCString());
3020 do_deopt = true;
3021 }
3022 }
3023 if (FLAG_stacktrace_filter != nullptr &&
3024 strstr(function_name, FLAG_stacktrace_filter) != nullptr) {
3025 OS::PrintErr("*** Computing stacktrace (%s)\n",
3026 function.ToFullyQualifiedCString());
3027 do_stacktrace = true;
3028 }
3029 }
3030 if (do_deopt) {
3031 // TODO(turnidge): Consider using DeoptimizeAt instead.
3033 }
3034 if (do_reload) {
3035 // Maybe adjust the rate of future reloads.
3036 isolate_group->MaybeIncreaseReloadEveryNStackOverflowChecks();
3037
3038 // Issue a reload.
3039 const char* script_uri = isolate_group->source()->script_uri;
3040 JSONStream js;
3041 const bool success =
3042 isolate_group->ReloadSources(&js, /*force_reload=*/true, script_uri);
3043 if (!success) {
3044 FATAL("*** Isolate reload failed:\n%s\n", js.ToCString());
3045 }
3046 }
3047 if (do_stacktrace) {
3048 String& var_name = String::Handle();
3049 Instance& var_value = Instance::Handle();
3050 DebuggerStackTrace* stack = isolate->debugger()->StackTrace();
3051 intptr_t num_frames = stack->Length();
3052 for (intptr_t i = 0; i < num_frames; i++) {
3053 ActivationFrame* frame = stack->FrameAt(i);
3054 int num_vars = 0;
3055 // Variable locations and number are unknown when precompiling.
3056#if !defined(DART_PRECOMPILED_RUNTIME)
3057 if (!frame->function().ForceOptimize()) {
3058 // Ensure that we have unoptimized code.
3059 frame->function().EnsureHasCompiledUnoptimizedCode();
3060 num_vars = frame->NumLocalVariables();
3061 }
3062#endif
3063 TokenPosition unused = TokenPosition::kNoSource;
3064 for (intptr_t v = 0; v < num_vars; v++) {
3065 frame->VariableAt(v, &var_name, &unused, &unused, &unused, &var_value);
3066 }
3067 }
3068 if (FLAG_stress_async_stacks) {
3069 DebuggerStackTrace::CollectAsyncAwaiters();
3070 }
3071 }
3072 if (do_gc) {
3073 isolate->group()->heap()->CollectAllGarbage(GCReason::kDebugging);
3074 }
3075}
static bool unused
int32_t IncrementAndGetStackOverflowCount()
Definition thread.h:446

◆ Hash()

static uint32_t dart::Hash ( uint32_t  key)
static

Definition at line 65 of file hashmap_test.cc.

65 {
66 return 23;
67}

◆ Hash64To32()

static uword dart::Hash64To32 ( uint64_t  v)
static

Definition at line 6517 of file object.cc.

6517 {
6518 v = ~v + (v << 18);
6519 v = v ^ (v >> 31);
6520 v = v * 21;
6521 v = v ^ (v >> 11);
6522 v = v + (v << 6);
6523 v = v ^ (v >> 22);
6524 return static_cast<uint32_t>(v);
6525}

◆ HashBaseNonConstEqualsConst()

template<class LinkedHashBase , int kMutableCid, int kImmutableCid>
static void dart::HashBaseNonConstEqualsConst ( const char *  script,
bool  check_data = true 
)
static

Definition at line 6901 of file object_test.cc.

6903 {
6904 return object.IsMap() || object.IsSet();
6905}
6906
6907// Checks that the non-constant and constant HashMap and HashSets are equal.
6908//
6909// Expects a script with a methods named `nonConstValue`, `constValue`, and
6910// `init`.
6911template <class LinkedHashBase, int kMutableCid, int kImmutableCid>
6912static void HashBaseNonConstEqualsConst(const char* script,
6913 bool check_data = true) {
6914 Dart_Handle lib = TestCase::LoadTestScript(script, nullptr);
6915 EXPECT_VALID(lib);
6916 Dart_Handle init_result = Dart_Invoke(lib, NewString("init"), 0, nullptr);
6917 EXPECT_VALID(init_result);
6918 Dart_Handle non_const_result =
6919 Dart_Invoke(lib, NewString("nonConstValue"), 0, nullptr);
6920 EXPECT_VALID(non_const_result);
6921 Dart_Handle const_result =
6922 Dart_Invoke(lib, NewString("constValue"), 0, nullptr);
6923 EXPECT_VALID(const_result);
6924
6925 TransitionNativeToVM transition(Thread::Current());
6926 const auto& non_const_object =
6927 Object::Handle(Api::UnwrapHandle(non_const_result));
6928 const auto& const_object = Object::Handle(Api::UnwrapHandle(const_result));
6929 non_const_object.IsMap();
6930 EXPECT(IsLinkedHashBase(non_const_object));
6931 if (!IsLinkedHashBase(non_const_object)) return;
static void check_data(skiatest::Reporter *reporter, SkCachedData *data, int refcnt, CachedState cacheState, LockedState lockedState)

◆ HashBytes()

uint32_t dart::HashBytes ( const uint8_t *  bytes,
intptr_t  size 
)
inline

Definition at line 31 of file hash.h.

31 {
32 uint32_t hash = size;
33 while (size > 0) {
34 hash = CombineHashes(hash, *bytes);
35 bytes++;
36 size--;
37 }
38 return hash;
39}

◆ HashCodeEqualsCanonicalizeHash()

static bool dart::HashCodeEqualsCanonicalizeHash ( const char *  value_script,
uint32_t  hashcode_canonicalize_vm = kCalculateCanonicalizeHash,
bool  check_identity = true,
bool  check_hashcode = true 
)
static

Definition at line 6453 of file object_test.cc.

6468 {
6469 auto kScriptChars = Utils::CStringUniquePtr(
6470 OS::SCreate(nullptr,
6471 "%s"
6472 "\n"
6473 "valueHashCode() {\n"
6474 " return value().hashCode;\n"
6475 "}\n"
6476 "\n"
6477 "valueIdentityHashCode() {\n"
6478 " return identityHashCode(value());\n"
6479 "}\n",
6480 value_script),
6481 std::free);
6482
6483 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars.get(), nullptr);
6484 EXPECT_VALID(lib);
6485 Dart_Handle value_result = Dart_Invoke(lib, NewString("value"), 0, nullptr);
6486 EXPECT_VALID(value_result);
6487 Dart_Handle hashcode_result;
6488 if (check_hashcode) {
6489 hashcode_result = Dart_Invoke(lib, NewString("valueHashCode"), 0, nullptr);
6490 EXPECT_VALID(hashcode_result);
6491 }
6492 Dart_Handle identity_hashcode_result =
6493 Dart_Invoke(lib, NewString("valueIdentityHashCode"), 0, nullptr);
6494 EXPECT_VALID(identity_hashcode_result);
6495
6496 TransitionNativeToVM transition(Thread::Current());
6497
6498 const auto& value_dart = Instance::CheckedHandle(
6499 Thread::Current()->zone(), Api::UnwrapHandle(value_result));
6500 int64_t hashcode_dart;
6501 if (check_hashcode) {
6502 hashcode_dart =
6503 Integer::Cast(Object::Handle(Api::UnwrapHandle(hashcode_result)))
6504 .AsInt64Value();
6505 }
6506 const int64_t identity_hashcode_dart =
6507 Integer::Cast(Object::Handle(Api::UnwrapHandle(identity_hashcode_result)))
6508 .AsInt64Value();
6509 if (hashcode_canonicalize_vm == 0) {
6510 hashcode_canonicalize_vm = Instance::Cast(value_dart).CanonicalizeHash();
6511 }
6512
6513 bool success = true;
6514
6515 if (check_hashcode) {
6516 success &= hashcode_dart == hashcode_canonicalize_vm;
6517 }
6518 if (check_identity) {
6519 success &= identity_hashcode_dart == hashcode_canonicalize_vm;
6520 }
6521
6522 if (!success) {
6523 LogBlock lb;
6524 THR_Print(
6525 "Dart hashCode or Dart identityHashCode does not equal VM "
6526 "CanonicalizeHash for %s\n",
std::unique_ptr< char, decltype(std::free) * > CStringUniquePtr
Definition utils.h:644

◆ HashMapNonConstEqualsConst()

static void dart::HashMapNonConstEqualsConst ( const char *  script,
bool  check_data = true 
)
static

Definition at line 6933 of file object_test.cc.

◆ HashSetNonConstEqualsConst()

static void dart::HashSetNonConstEqualsConst ( const char *  script,
bool  check_data = true 
)
static

Definition at line 6938 of file object_test.cc.

◆ HasNoTasks()

static bool dart::HasNoTasks ( Heap heap)
static

Definition at line 93 of file isolate_reload.cc.

93 {
94 MonitorLocker ml(heap->old_space()->tasks_lock());
95 return heap->old_space()->tasks() == 0;
96}
PageSpace * old_space()
Definition heap.h:63
intptr_t tasks() const
Definition pages.h:310
Monitor * tasks_lock() const
Definition pages.h:309

◆ HasOnlyUnconstrainedUses()

static bool dart::HasOnlyUnconstrainedUses ( LiveRange range)
static

Definition at line 581 of file linearscan.cc.

581 {
582 UsePosition* use = range->first_use();
583 while (use != nullptr) {
584 if (!use->location_slot()->Equals(Location::Any())) {
585 return false;
586 }
587 use = use->next();
588 }
589 return true;
590}
UsePosition * first_use() const
Definition linearscan.h:532
bool Equals(Location other) const
Definition locations.h:519
Location * location_slot() const
Definition linearscan.h:396

◆ HasOnlyUnconstrainedUsesInLoop()

static bool dart::HasOnlyUnconstrainedUsesInLoop ( LiveRange range,
intptr_t  boundary 
)
static

Definition at line 568 of file linearscan.cc.

569 {
570 UsePosition* use = range->first_use();
571 while ((use != nullptr) && (use->pos() < boundary)) {
572 if (!use->location_slot()->Equals(Location::Any())) {
573 return false;
574 }
575 use = use->next();
576 }
577 return true;
578}

◆ HasPhis()

static bool dart::HasPhis ( BlockEntryInstr block)
static

Definition at line 1676 of file constant_propagator.cc.

1676 {
1677 if (auto* join = block->AsJoinEntry()) {
1678 return (join->phis() != nullptr) && !join->phis()->is_empty();
1679 }
1680 return false;
1681}

◆ HasPlaceId()

static DART_FORCE_INLINE bool dart::HasPlaceId ( const Instruction instr)
static

Definition at line 1360 of file redundancy_elimination.cc.

1360 {
1361 return instr->HasPassSpecificId(CompilerPass::kCSE);
1362}
bool HasPassSpecificId(CompilerPass::Id pass) const
Definition il.h:1226

◆ HasPragma()

static bool dart::HasPragma ( const Object declaration)
static

Definition at line 13760 of file object.cc.

13760 {
13761 return (declaration.IsClass() && Class::Cast(declaration).has_pragma()) ||
13762 (declaration.IsFunction() &&
13763 Function::Cast(declaration).has_pragma()) ||
13764 (declaration.IsField() && Field::Cast(declaration).has_pragma());
13765}

◆ HasRealUse()

static bool dart::HasRealUse ( Definition def)
static

Definition at line 4384 of file redundancy_elimination.cc.

4384 {
4385 // Environment uses are real (non-phi) uses.
4386 if (def->env_use_list() != nullptr) return true;
4387
4388 for (Value::Iterator it(def->input_use_list()); !it.Done(); it.Advance()) {
4389 if (!it.Current()->instruction()->IsPhi()) return true;
4390 }
4391 return false;
4392}
Value * env_use_list() const
Definition il.h:2560
Value * input_use_list() const
Definition il.h:2557

◆ HasStack()

bool dart::HasStack ( )

Definition at line 106 of file stacktrace.cc.

106 {
107 Thread* thread = Thread::Current();
108 StackFrameIterator frames(ValidationPolicy::kDontValidateFrames, thread,
109 StackFrameIterator::kNoCrossThreadIteration);
110 StackFrame* frame = frames.NextFrame();
111 return frame != nullptr;
112}

◆ HaveSameRuntimeTypeHelper()

static bool dart::HaveSameRuntimeTypeHelper ( Zone zone,
const Instance left,
const Instance right 
)
static

Definition at line 101 of file object.cc.

103 {
104 const intptr_t left_cid = left.GetClassId();
105 const intptr_t right_cid = right.GetClassId();
106
107 if (left_cid != right_cid) {
108 if (IsIntegerClassId(left_cid)) {
109 return IsIntegerClassId(right_cid);
110 } else if (IsStringClassId(left_cid)) {
111 return IsStringClassId(right_cid);
112 } else if (IsTypeClassId(left_cid)) {
113 return IsTypeClassId(right_cid);
114 } else if (IsArrayClassId(left_cid)) {
115 if (!IsArrayClassId(right_cid)) {
116 return false;
117 }
118 // Still need to check type arguments.
119 } else {
120 return false;
121 }
122 }
123
124 if (left_cid == kClosureCid) {
125 const auto& left_closure = Closure::Cast(left);
126 const auto& right_closure = Closure::Cast(right);
127 // If all the components that make up the instantiated signature are equal,
128 // then no need to instantiate.
129 if (left_closure.function_type_arguments() ==
130 right_closure.function_type_arguments() &&
131 left_closure.delayed_type_arguments() ==
132 right_closure.delayed_type_arguments() &&
133 left_closure.instantiator_type_arguments() ==
134 right_closure.instantiator_type_arguments()) {
135 const auto& left_fun = Function::Handle(zone, left_closure.function());
136 const auto& right_fun = Function::Handle(zone, right_closure.function());
137 if (left_fun.signature() == right_fun.signature()) {
138 return true;
139 }
140 }
141 const AbstractType& left_type =
142 AbstractType::Handle(zone, left.GetType(Heap::kNew));
143 const AbstractType& right_type =
144 AbstractType::Handle(zone, right.GetType(Heap::kNew));
145 return left_type.IsEquivalent(right_type, TypeEquality::kSyntactical);
146 }
147
148 if (left_cid == kRecordCid) {
149 const auto& left_record = Record::Cast(left);
150 const auto& right_record = Record::Cast(right);
151 if (left_record.shape() != right_record.shape()) {
152 return false;
153 }
154 Instance& left_field = Instance::Handle(zone);
155 Instance& right_field = Instance::Handle(zone);
156 const intptr_t num_fields = left_record.num_fields();
157 for (intptr_t i = 0; i < num_fields; ++i) {
158 left_field ^= left_record.FieldAt(i);
159 right_field ^= right_record.FieldAt(i);
160 if (!HaveSameRuntimeTypeHelper(zone, left_field, right_field)) {
161 return false;
162 }
163 }
164 return true;
165 }
166
167 const Class& cls = Class::Handle(zone, left.clazz());
168 if (!cls.IsGeneric()) {
169 return true;
170 }
171
172 if (left.GetTypeArguments() == right.GetTypeArguments()) {
173 return true;
174 }
175 const TypeArguments& left_type_arguments =
176 TypeArguments::Handle(zone, left.GetTypeArguments());
177 const TypeArguments& right_type_arguments =
178 TypeArguments::Handle(zone, right.GetTypeArguments());
179 const intptr_t num_type_args = cls.NumTypeArguments();
180 const intptr_t num_type_params = cls.NumTypeParameters();
181 return left_type_arguments.IsSubvectorEquivalent(
182 right_type_arguments, num_type_args - num_type_params, num_type_params,
183 TypeEquality::kSyntactical);
184}

◆ HeapSamplingCreate()

static void * dart::HeapSamplingCreate ( Dart_Isolate  isolate,
Dart_IsolateGroup  isolate_group,
const char *  cls_name,
intptr_t  heap_size 
)
static

Definition at line 10242 of file dart_api_impl_test.cc.

10248 {

◆ HeapSamplingDelete()

static void dart::HeapSamplingDelete ( void *  data)
static

Definition at line 10250 of file dart_api_impl_test.cc.

◆ HeapSamplingReport()

void dart::HeapSamplingReport ( void *  context,
void *  data 
)

Definition at line 10254 of file dart_api_impl_test.cc.

◆ Helper()

void dart::Helper ( uword  arg)

Definition at line 1073 of file thread_test.cc.

1073 {
1074 auto state = reinterpret_cast<ReaderThreadState*>(arg);
1075 state->reader_id = OSThread::GetCurrentThreadJoinId(OSThread::Current());
1076 // Notify other thread.
1077 {
1078 MonitorLocker ml(state->monitor);
1079 state->child_started = true;
1080 ml.Notify();
1081 }
1082 const bool kBypassSafepoint = false;
1083 Thread::EnterIsolateGroupAsHelper(state->isolate_group, Thread::kUnknownTask,
1084 kBypassSafepoint);
1085 {
1086 auto thread = Thread::Current();
1087 intptr_t observed_value = -1;
1088 {
1089 SafepointReadRwLocker reader(thread, state->rw_lock);
1090 observed_value = state->value;
1091 }
1092 state->observed_value = observed_value;
1093 }
1094 Thread::ExitIsolateGroupAsHelper(kBypassSafepoint);
1095}

◆ Hex()

static uint8_t dart::Hex ( uint8_t  value)
static

Definition at line 167 of file text_buffer.cc.

167 {
168 return value < 10 ? '0' + value : 'A' + value - 10;
169}

◆ HexValue() [1/2]

static int dart::HexValue ( char  digit)
static

Definition at line 48 of file uri.cc.

48 {
49 if ((digit >= '0' && digit <= '9')) {
50 return digit - '0';
51 }
52 if ((digit >= 'A' && digit <= 'F')) {
53 return digit - 'A' + 10;
54 }
55 if ((digit >= 'a' && digit <= 'f')) {
56 return digit - 'a' + 10;
57 }
59 return 0;
60}

◆ HexValue() [2/2]

static intptr_t dart::HexValue ( uint32_t  c)
inlinestatic

Definition at line 1400 of file regexp_parser.cc.

1400 {
1401 c -= '0';
1402 if (static_cast<unsigned>(c) <= 9) return c;
1403 c = (c | 0x20) - ('a' - '0'); // detect 0x11..0x16 and 0x31..0x36.
1404 if (static_cast<unsigned>(c) <= 5) return c + 10;
1405 return -1;
1406}

◆ IGH_CreateIsolate()

DART_EXPORT Dart_Isolate dart::IGH_CreateIsolate ( const char *  name,
void *  peer 
)

Definition at line 337 of file ffi_test_functions_vmspecific.cc.

337 {
338 struct Helper {
339 static void ShutdownCallback(void* ig_data, void* isolate_data) {
340 char* string = reinterpret_cast<char*>(isolate_data);
341 ENSURE(string[0] == 'a');
342 string[0] = 'x';
343 }
344 static void CleanupCallback(void* ig_data, void* isolate_data) {
345 char* string = reinterpret_cast<char*>(isolate_data);
346 ENSURE(string[2] == 'c');
347 string[2] = 'z';
348 }
349 };
350
353
354 char* error = nullptr;
355 Dart_Isolate child =
356 Dart_CreateIsolateInGroup(parent, name, &Helper::ShutdownCallback,
357 &Helper::CleanupCallback, peer, &error);
358 if (child == nullptr) {
359 Dart_EnterIsolate(parent);
361 free(error);
362 Dart_ThrowException(error_obj);
363 return nullptr;
364 }
366 Dart_EnterIsolate(parent);
367 return child;
368}
#define ENSURE(X)
DART_EXPORT Dart_Isolate Dart_CreateIsolateInGroup(Dart_Isolate group_member, const char *name, Dart_IsolateShutdownCallback shutdown_callback, Dart_IsolateCleanupCallback cleanup_callback, void *child_isolate_data, char **error)
void Helper(uword arg)

◆ IGH_MsanUnpoison()

DART_EXPORT void dart::IGH_MsanUnpoison ( void *  start,
intptr_t  length 
)

Definition at line 333 of file ffi_test_functions_vmspecific.cc.

333 {
335}

◆ IGH_StartIsolate()

DART_EXPORT void dart::IGH_StartIsolate ( Dart_Isolate  child_isolate,
int64_t  main_isolate_port,
const char *  library_uri,
const char *  function_name,
bool  errors_are_fatal,
Dart_Port  on_error_port,
Dart_Port  on_exit_port 
)

Definition at line 370 of file ffi_test_functions_vmspecific.cc.

376 {
379 Dart_EnterIsolate(child_isolate);
380 {
382
383 Dart_Handle library_name = Dart_NewStringFromCString(library_uri);
384 ENSURE(!Dart_IsError(library_name));
385
386 Dart_Handle library = Dart_LookupLibrary(library_name);
387 ENSURE(!Dart_IsError(library));
388
389 Dart_Handle fun = Dart_NewStringFromCString(function_name);
390 ENSURE(!Dart_IsError(fun));
391
392 Dart_Handle port = Dart_NewInteger(main_isolate_port);
393 ENSURE(!Dart_IsError(port));
394
395 Dart_Handle args[] = {
396 port,
397 };
398
399 Dart_Handle result = Dart_Invoke(library, fun, 1, args);
400 if (Dart_IsError(result)) {
401 fprintf(stderr, "Failed to invoke %s/%s in child isolate: %s\n",
402 library_uri, function_name, Dart_GetError(result));
403 }
405
407 }
408
409 char* error = nullptr;
410 ENSURE(
411 Dart_RunLoopAsync(errors_are_fatal, on_error_port, on_exit_port, &error));
412
413 Dart_EnterIsolate(parent);
414}
DART_EXPORT DART_WARN_UNUSED_RESULT bool Dart_RunLoopAsync(bool errors_are_fatal, Dart_Port on_error_port, Dart_Port on_exit_port, char **error)
DART_EXPORT const char * Dart_GetError(Dart_Handle handle)

◆ ImmHi()

intx_t dart::ImmHi ( intx_t  imm)
inline

Definition at line 1001 of file constants_riscv.h.

1001 {
1002 return static_cast<intx_t>(
1003 (static_cast<uintx_t>(imm) - static_cast<uintx_t>(ImmLo(imm)))
1004 << (XLEN - 32)) >>
1005 (XLEN - 32);
1006}
intx_t ImmLo(intx_t imm)

◆ ImmLo()

intx_t dart::ImmLo ( intx_t  imm)
inline

Definition at line 997 of file constants_riscv.h.

997 {
998 return static_cast<intx_t>(static_cast<uintx_t>(imm) << (XLEN - 12)) >>
999 (XLEN - 12);
1000}

◆ ImplicitReferencesCallback()

static void dart::ImplicitReferencesCallback ( void *  isolate_callback_data,
void *  peer 
)
static

Definition at line 4517 of file dart_api_impl_test.cc.

4518 {
4519 if (peer == &weak1) {
4520 weak1 = nullptr;
4521 } else if (peer == &weak2) {
4522 weak2 = nullptr;
4523 } else if (peer == &weak3) {
4524 weak3 = nullptr;
4525 }
4526}
static Dart_WeakPersistentHandle weak3
static Dart_WeakPersistentHandle weak1

◆ ImportModifiedCallback()

static bool dart::ImportModifiedCallback ( const char *  url,
int64_t  since 
)
static

Definition at line 4520 of file isolate_reload_test.cc.

◆ IncreaseBy()

static intptr_t dart::IncreaseBy ( intptr_t  previous,
intptr_t  increase 
)
static

Definition at line 291 of file regexp_ast.cc.

291 {
292 if (RegExpTree::kInfinity - previous < increase) {
293 return RegExpTree::kInfinity;
294 } else {
295 return previous + increase;
296 }
297}

◆ IncreaseRefcount()

DART_EXPORT void dart::IncreaseRefcount ( RefCountedResource *  peer)

Definition at line 1345 of file ffi_test_functions_vmspecific.cc.

1345 {
1347 peer->refcount++;
1349}

◆ IndentN()

static void dart::IndentN ( int  count)
static

Definition at line 18592 of file object.cc.

18592 {
18593 for (int i = 0; i < count; i++) {
18594 THR_Print(" ");
18595 }
18596}

◆ IndexFromPPLoadDisp32()

intptr_t dart::IndexFromPPLoadDisp32 ( uword  start)

◆ IndexFromPPLoadDisp8()

intptr_t dart::IndexFromPPLoadDisp8 ( uword  start)

◆ InduceACrash()

DART_EXPORT void dart::InduceACrash ( )

Definition at line 51 of file ffi_test_functions.cc.

51 {
52 *reinterpret_cast<int*>(InduceACrash) = 123;
53}
DART_EXPORT void InduceACrash()

◆ InitDartApiDL()

DART_EXPORT intptr_t dart::InitDartApiDL ( void *  data)

Definition at line 418 of file ffi_test_functions_vmspecific.cc.

418 {
419 return Dart_InitializeApiDL(data);
420}
intptr_t Dart_InitializeApiDL(void *data)
Definition dart_api_dl.c:45

◆ InitHeapSampling()

void dart::InitHeapSampling ( Thread thread,
const char *  expected_cls 
)

Definition at line 10282 of file dart_api_impl_test.cc.

10287 {
10288 const char* kScriptChars = R"(
10289 import 'dart:ffi';

◆ InitializeExternalTypedData()

void dart::InitializeExternalTypedData ( intptr_t  cid,
ExternalTypedDataPtr  from,
ExternalTypedDataPtr  to 
)

Definition at line 301 of file object_graph_copy.cc.

303 {
304 auto raw_from = from.untag();
305 auto raw_to = to.untag();
306 const intptr_t length =
307 TypedData::ElementSizeInBytes(cid) * Smi::Value(raw_from->length_);
308
309 auto buffer = static_cast<uint8_t*>(malloc(length));
310 memmove(buffer, raw_from->data_, length);
311 raw_to->length_ = raw_from->length_;
312 raw_to->data_ = buffer;
313}

◆ InitializeExternalTypedDataWithSafepointChecks()

void dart::InitializeExternalTypedDataWithSafepointChecks ( Thread thread,
intptr_t  cid,
const ExternalTypedData from,
const ExternalTypedData to 
)

Definition at line 339 of file object_graph_copy.cc.

343 {
344 const intptr_t length_in_elements = from.Length();
345 const intptr_t length_in_bytes =
346 TypedData::ElementSizeInBytes(cid) * length_in_elements;
347
348 uint8_t* to_data = static_cast<uint8_t*>(malloc(length_in_bytes));
349 to.ptr().untag()->data_ = to_data;
350 to.ptr().untag()->length_ = Smi::New(length_in_elements);
351
352 CopyTypedDataBaseWithSafepointChecks(thread, from, to, length_in_bytes);
353}
void CopyTypedDataBaseWithSafepointChecks(Thread *thread, const T &from, const T &to, intptr_t length)

◆ InitializeMemory()

static void dart::InitializeMemory ( uint8_t *  input,
uint8_t *  output 
)
static

Definition at line 48 of file memory_copy_test.cc.

48 {
49 const bool use_same_buffer = input == output;
50 for (intptr_t i = 0; i < kMemoryTestLength; i++) {
51 input[i] = ExpectedValue(i); // Initialized.
52 if (!use_same_buffer) {
53 output[i] = kUnInitialized; // Empty.
54 }
55 }
56}
static constexpr intptr_t kMemoryTestLength

◆ InitializeTypedDataView()

void dart::InitializeTypedDataView ( TypedDataViewPtr  obj)

Definition at line 355 of file object_graph_copy.cc.

355 {
356 obj.untag()->typed_data_ = TypedDataBase::null();
357 obj.untag()->offset_in_bytes_ = Smi::New(0);
358 obj.untag()->length_ = Smi::New(0);
359}

◆ InitIndex()

static intptr_t dart::InitIndex ( LoopInfo loop)
static

Definition at line 111 of file loops.cc.

111 {
112 BlockEntryInstr* header = loop->header();
113 for (intptr_t i = 0; i < header->PredecessorCount(); ++i) {
114 if (!loop->Contains(header->PredecessorAt(i))) { // pick first
115 return i;
116 }
117 }
118 UNREACHABLE();
119 return -1;
120}
bool Contains(BlockEntryInstr *block) const
Definition loops.cc:1058

◆ InitNativeFields()

static void dart::InitNativeFields ( Dart_NativeArguments  args)
static

Definition at line 112 of file benchmark_test.cc.

112 {
114 EXPECT_EQ(1, count);
115
117 EXPECT_VALID(recv);
120}

◆ InitNewReadOnlyApiHandle()

static Dart_Handle dart::InitNewReadOnlyApiHandle ( ObjectPtr  raw)
static

Definition at line 517 of file dart_api_impl.cc.

517 {
518 ASSERT(raw->untag()->InVMIsolateHeap());
519 LocalHandle* ref = Dart::AllocateReadOnlyApiHandle();
520 ref->set_ptr(raw);
521 return ref->apiHandle();
522}
Dart_Handle apiHandle()
bool InVMIsolateHeap() const
Definition raw_object.cc:20

◆ InlineCacheMissHandler()

static void dart::InlineCacheMissHandler ( Thread thread,
Zone zone,
const GrowableArray< const Instance * > &  args,
const ICData ic_data,
NativeArguments  native_arguments 
)
static

Definition at line 2648 of file runtime_entry.cc.

2652 {
2653#if !defined(DART_PRECOMPILED_RUNTIME)
2654 DartFrameIterator iterator(thread,
2655 StackFrameIterator::kNoCrossThreadIteration);
2656 StackFrame* caller_frame = iterator.NextFrame();
2657 const auto& caller_code = Code::Handle(zone, caller_frame->LookupDartCode());
2658 const auto& caller_function =
2659 Function::Handle(zone, caller_frame->LookupDartFunction());
2660
2661 PatchableCallHandler handler(thread, args, MissHandler::kInlineCacheMiss,
2662 native_arguments, caller_frame, caller_code,
2663 caller_function);
2664
2665 handler.ResolveSwitchAndReturn(ic_data);
2666#else
2667 UNREACHABLE();
2668#endif // !defined(DART_PRECOMPILED_RUNTIME)
2669}

◆ InlineCacheMissHelper()

FunctionPtr dart::InlineCacheMissHelper ( const Class receiver_class,
const Array args_descriptor,
const String target_name 
)

Definition at line 1598 of file runtime_entry.cc.

1600 {
1601 // Create a demangled version of the target_name, if necessary, This is used
1602 // for the field getter in ResolveCallThroughGetter and as the target name
1603 // for the NoSuchMethod dispatcher (if needed).
1604 const String* demangled = &target_name;
1605 if (Function::IsDynamicInvocationForwarderName(target_name)) {
1606 demangled = &String::Handle(
1607 Function::DemangleDynamicInvocationForwarderName(target_name));
1608 }
1609 const bool is_getter = Field::IsGetterName(*demangled);
1610 Function& result = Function::Handle();
1611 if (is_getter ||
1612 !ResolveCallThroughGetter(receiver_class, target_name, *demangled,
1613 args_descriptor, &result)) {
1614 ArgumentsDescriptor desc(args_descriptor);
1615 const Function& target_function =
1616 Function::Handle(receiver_class.GetInvocationDispatcher(
1617 *demangled, args_descriptor,
1618 UntaggedFunction::kNoSuchMethodDispatcher, FLAG_lazy_dispatchers));
1619 if (FLAG_trace_ic) {
1620 OS::PrintErr(
1621 "NoSuchMethod IC miss: adding <%s> id:%" Pd " -> <%s>\n",
1622 receiver_class.ToCString(), receiver_class.id(),
1623 target_function.IsNull() ? "null" : target_function.ToCString());
1624 }
1625 result = target_function.ptr();
1626 }
1627 // May be null if --no-lazy-dispatchers, in which case dispatch will be
1628 // handled by NoSuchMethodFromCallStub.
1629 ASSERT(!result.IsNull() || !FLAG_lazy_dispatchers);
1630 return result.ptr();
1631}
FunctionPtr GetInvocationDispatcher(const String &target_name, const Array &args_desc, UntaggedFunction::Kind kind, bool create_if_absent) const
Definition object.cc:3897

◆ InlineDoubleOp()

static bool dart::InlineDoubleOp ( FlowGraph flow_graph,
Token::Kind  op_kind,
Instruction call,
Definition receiver,
GraphEntryInstr graph_entry,
FunctionEntryInstr **  entry,
Instruction **  last,
Definition **  result 
)
static

Definition at line 1963 of file call_specializer.cc.

1970 {
1971 if (!CanUnboxDouble()) {
1972 return false;
1973 }
1974 Definition* left = receiver;
1975 Definition* right = call->ArgumentAt(1);
1976
1977 *entry =
1978 new (Z) FunctionEntryInstr(graph_entry, flow_graph->allocate_block_id(),
1979 call->GetBlock()->try_index(), DeoptId::kNone);
1980 (*entry)->InheritDeoptTarget(Z, call);
1981 // Arguments are checked. No need for class check.
1982 BinaryDoubleOpInstr* double_bin_op = new (Z)
1983 BinaryDoubleOpInstr(op_kind, new (Z) Value(left), new (Z) Value(right),
1984 call->deopt_id(), call->source());
1985 flow_graph->AppendTo(*entry, double_bin_op, call->env(), FlowGraph::kValue);
1986 *last = double_bin_op;
1987 *result = double_bin_op->AsDefinition();
1988
1989 return true;
1990}
#define Z
Instruction * AppendTo(Instruction *prev, Instruction *instr, Environment *env, UseKind use_kind)
intptr_t allocate_block_id()
Definition flow_graph.h:266
static bool CanUnboxDouble()

◆ InlineDoubleTestOp()

static bool dart::InlineDoubleTestOp ( FlowGraph flow_graph,
Instruction call,
Definition receiver,
MethodRecognizer::Kind  kind,
GraphEntryInstr graph_entry,
FunctionEntryInstr **  entry,
Instruction **  last,
Definition **  result 
)
static

Definition at line 1992 of file call_specializer.cc.

1999 {
2000 if (!CanUnboxDouble()) {
2001 return false;
2002 }
2003
2004 *entry =
2005 new (Z) FunctionEntryInstr(graph_entry, flow_graph->allocate_block_id(),
2006 call->GetBlock()->try_index(), DeoptId::kNone);
2007 (*entry)->InheritDeoptTarget(Z, call);
2008 // Arguments are checked. No need for class check.
2009
2010 DoubleTestOpInstr* double_test_op = new (Z) DoubleTestOpInstr(
2011 kind, new (Z) Value(receiver), call->deopt_id(), call->source());
2012 flow_graph->AppendTo(*entry, double_test_op, call->env(), FlowGraph::kValue);
2013 *last = double_test_op;
2014 *result = double_test_op->AsDefinition();
2015
2016 return true;
2017}

◆ InlineGetIndexed()

static bool dart::InlineGetIndexed ( FlowGraph flow_graph,
bool  can_speculate,
bool  is_dynamic_call,
MethodRecognizer::Kind  kind,
Definition call,
Definition receiver,
GraphEntryInstr graph_entry,
FunctionEntryInstr **  entry,
Instruction **  last,
Definition **  result 
)
static

Definition at line 1789 of file call_specializer.cc.

1798 {
1799 intptr_t array_cid = MethodRecognizer::MethodKindToReceiverCid(kind);
1800
1801 Definition* array = receiver;
1802 Definition* index = call->ArgumentAt(1);
1803
1804 if (!can_speculate && is_dynamic_call && !index->Type()->IsInt()) {
1805 return false;
1806 }
1807
1808 *entry =
1809 new (Z) FunctionEntryInstr(graph_entry, flow_graph->allocate_block_id(),
1810 call->GetBlock()->try_index(), DeoptId::kNone);
1811 (*entry)->InheritDeoptTarget(Z, call);
1812 *last = *entry;
1813
1814 array_cid =
1815 PrepareInlineIndexedOp(flow_graph, call, array_cid, &array, &index, last);
1816
1817 // Array load and return.
1818 intptr_t index_scale = compiler::target::Instance::ElementSizeFor(array_cid);
1819 *result = new (Z) LoadIndexedInstr(
1820 new (Z) Value(array), new (Z) Value(index),
1821 /*index_unboxed=*/false, index_scale, array_cid, kAlignedAccess,
1822 call->deopt_id(), call->source(), ResultType(call));
1823 *last = flow_graph->AppendTo(*last, *result, call->env(), FlowGraph::kValue);
1824
1825 if (LoadIndexedInstr::ReturnRepresentation(array_cid) == kUnboxedFloat) {
1826 *result =
1827 new (Z) FloatToDoubleInstr(new (Z) Value(*result), call->deopt_id());
1828 *last =
1829 flow_graph->AppendTo(*last, *result, call->env(), FlowGraph::kValue);
1830 }
1831
1832 return true;
1833}

◆ InlineGrowableArraySetter()

static bool dart::InlineGrowableArraySetter ( FlowGraph flow_graph,
const Slot field,
StoreBarrierType  store_barrier_type,
Instruction call,
Definition receiver,
GraphEntryInstr graph_entry,
FunctionEntryInstr **  entry,
Instruction **  last,
Definition **  result 
)
static

Definition at line 2019 of file call_specializer.cc.

2027 {
2028 Definition* array = receiver;
2029 Definition* value = call->ArgumentAt(1);
2030
2031 *entry =
2032 new (Z) FunctionEntryInstr(graph_entry, flow_graph->allocate_block_id(),
2033 call->GetBlock()->try_index(), DeoptId::kNone);
2034 (*entry)->InheritDeoptTarget(Z, call);
2035
2036 // This is an internal method, no need to check argument types.
2038 new (Z) StoreFieldInstr(field, new (Z) Value(array), new (Z) Value(value),
2039 store_barrier_type, call->source());
2040 flow_graph->AppendTo(*entry, store, call->env(), FlowGraph::kEffect);
2041 *last = store;
2042 // We need a return value to replace uses of the original definition. However,
2043 // the last instruction is a field setter, which returns void, so we use null.
2044 *result = flow_graph->constant_null();
2045
2046 return true;
2047}
ConstantInstr * constant_null() const
Definition flow_graph.h:270

◆ InlineLoadClassId()

static bool dart::InlineLoadClassId ( FlowGraph flow_graph,
Instruction call,
GraphEntryInstr graph_entry,
FunctionEntryInstr **  entry,
Instruction **  last,
Definition **  result 
)
static

Definition at line 2049 of file call_specializer.cc.

2054 {
2055 *entry =
2056 new (Z) FunctionEntryInstr(graph_entry, flow_graph->allocate_block_id(),
2057 call->GetBlock()->try_index(), DeoptId::kNone);
2058 (*entry)->InheritDeoptTarget(Z, call);
2059 auto load_cid =
2060 new (Z) LoadClassIdInstr(call->ArgumentValueAt(0)->CopyWithType(Z));
2061 flow_graph->InsertBefore(call, load_cid, nullptr, FlowGraph::kValue);
2062 *last = load_cid;
2063 *result = load_cid->AsDefinition();
2064 return true;
2065}
void InsertBefore(Instruction *next, Instruction *instr, Environment *env, UseKind use_kind)
Definition flow_graph.h:312

◆ InlineMathIntPow()

static bool dart::InlineMathIntPow ( FlowGraph flow_graph,
Instruction call,
GraphEntryInstr graph_entry,
FunctionEntryInstr **  entry,
Instruction **  last,
Definition **  result 
)
static

Definition at line 3054 of file call_specializer.cc.

3059 {
3060 // Invoking the _intPow(x, y) implies that both:
3061 // (1) x, y are int
3062 // (2) y >= 0.
3063 // Thus, try to inline some very obvious cases.
3064 // TODO(ajcbik): useful to generalize?
3065 intptr_t val = 0;
3066 Value* x = call->ArgumentValueAt(0);
3067 Value* y = call->ArgumentValueAt(1);
3068 // Use x^0 == 1, x^1 == x, and x^c == x * .. * x for small c.
3069 const intptr_t small_exponent = 5;
3070 if (IsSmiValue(y, &val)) {
3071 if (val == 0) {
3072 *last = flow_graph->GetConstant(Smi::ZoneHandle(Smi::New(1)));
3073 *result = (*last)->AsDefinition();
3074 return true;
3075 } else if (val == 1) {
3076 *last = x->definition();
3077 *result = (*last)->AsDefinition();
3078 return true;
3079 } else if (1 < val && val <= small_exponent) {
3080 // Lazily construct entry only in this case.
3081 *entry = new (Z)
3082 FunctionEntryInstr(graph_entry, flow_graph->allocate_block_id(),
3083 call->GetBlock()->try_index(), DeoptId::kNone);
3084 (*entry)->InheritDeoptTarget(Z, call);
3085 Definition* x_def = x->definition();
3086 Definition* square =
3087 InlineMul(flow_graph, *entry, x_def, x_def)->AsDefinition();
3088 *last = square;
3089 *result = square;
3090 switch (val) {
3091 case 2:
3092 return true;
3093 case 3:
3094 *last = InlineMul(flow_graph, *last, x_def, square);
3095 *result = (*last)->AsDefinition();
3096 return true;
3097 case 4:
3098 *last = InlineMul(flow_graph, *last, square, square);
3099 *result = (*last)->AsDefinition();
3100 return true;
3101 case 5:
3102 *last = InlineMul(flow_graph, *last, square, square);
3103 *last = InlineMul(flow_graph, *last, x_def, (*last)->AsDefinition());
3104 *result = (*last)->AsDefinition();
3105 return true;
3106 }
3107 }
3108 }
3109 // Use 0^y == 0 (only for y != 0) and 1^y == 1.
3110 if (IsSmiValue(x, &val)) {
3111 if (val == 1) {
3112 *last = x->definition();
3113 *result = x->definition();
3114 return true;
3115 }
3116 }
3117 return false;
3118}
static int square(int x)
Definition etc1.cpp:302
static bool IsSmiValue(Value *val, intptr_t *int_val)
static Instruction * InlineMul(FlowGraph *flow_graph, Instruction *cursor, Definition *x, Definition *y)

◆ InlineMul()

static Instruction * dart::InlineMul ( FlowGraph flow_graph,
Instruction cursor,
Definition x,
Definition y 
)
static

Definition at line 3044 of file call_specializer.cc.

3047 {
3048 BinaryInt64OpInstr* mul = new (Z)
3049 BinaryInt64OpInstr(Token::kMUL, new (Z) Value(x), new (Z) Value(y),
3050 DeoptId::kNone, Instruction::kNotSpeculative);
3051 return flow_graph->AppendTo(cursor, mul, nullptr, FlowGraph::kValue);
3052}

◆ InlineSetIndexed()

static bool dart::InlineSetIndexed ( FlowGraph flow_graph,
MethodRecognizer::Kind  kind,
const Function target,
Instruction call,
Definition receiver,
const InstructionSource source,
CallSpecializer::ExactnessInfo exactness,
GraphEntryInstr graph_entry,
FunctionEntryInstr **  entry,
Instruction **  last,
Definition **  result 
)
static

Definition at line 1835 of file call_specializer.cc.

1845 {
1846 intptr_t array_cid = MethodRecognizer::MethodKindToReceiverCid(kind);
1847 auto const rep = StoreIndexedInstr::ValueRepresentation(array_cid);
1848
1849 Definition* array = receiver;
1850 Definition* index = call->ArgumentAt(1);
1851 Definition* stored_value = call->ArgumentAt(2);
1852
1853 *entry =
1854 new (Z) FunctionEntryInstr(graph_entry, flow_graph->allocate_block_id(),
1855 call->GetBlock()->try_index(), DeoptId::kNone);
1856 (*entry)->InheritDeoptTarget(Z, call);
1857 *last = *entry;
1858
1859 bool is_unchecked_call = false;
1860 if (StaticCallInstr* static_call = call->AsStaticCall()) {
1861 is_unchecked_call =
1862 static_call->entry_kind() == Code::EntryKind::kUnchecked;
1863 } else if (InstanceCallInstr* instance_call = call->AsInstanceCall()) {
1864 is_unchecked_call =
1865 instance_call->entry_kind() == Code::EntryKind::kUnchecked;
1866 } else if (PolymorphicInstanceCallInstr* instance_call =
1867 call->AsPolymorphicInstanceCall()) {
1868 is_unchecked_call =
1869 instance_call->entry_kind() == Code::EntryKind::kUnchecked;
1870 }
1871
1872 if (!is_unchecked_call &&
1873 (kind != MethodRecognizer::kObjectArraySetIndexedUnchecked &&
1874 kind != MethodRecognizer::kGrowableArraySetIndexedUnchecked)) {
1875 // Only type check for the value. A type check for the index is not
1876 // needed here because we insert a deoptimizing smi-check for the case
1877 // the index is not a smi.
1878 const AbstractType& value_type =
1879 AbstractType::ZoneHandle(Z, target.ParameterTypeAt(2));
1880 Definition* type_args = nullptr;
1881 if (rep == kTagged) {
1882 const Class& instantiator_class = Class::Handle(Z, target.Owner());
1883 LoadFieldInstr* load_type_args =
1884 new (Z) LoadFieldInstr(new (Z) Value(array),
1885 Slot::GetTypeArgumentsSlotFor(
1886 flow_graph->thread(), instantiator_class),
1887 call->source());
1888 *last = flow_graph->AppendTo(*last, load_type_args, call->env(),
1889 FlowGraph::kValue);
1890 type_args = load_type_args;
1891 } else if (!RepresentationUtils::IsUnboxed(rep)) {
1892 UNREACHABLE();
1893 } else {
1894 type_args = flow_graph->constant_null();
1895 ASSERT(value_type.IsInstantiated());
1896#if defined(DEBUG)
1897 if (rep == kUnboxedFloat || rep == kUnboxedDouble) {
1898 ASSERT(value_type.IsDoubleType());
1899 } else if (rep == kUnboxedFloat32x4) {
1900 ASSERT(value_type.IsFloat32x4Type());
1901 } else if (rep == kUnboxedInt32x4) {
1902 ASSERT(value_type.IsInt32x4Type());
1903 } else if (rep == kUnboxedFloat64x2) {
1904 ASSERT(value_type.IsFloat64x2Type());
1905 } else {
1906 ASSERT(RepresentationUtils::IsUnboxedInteger(rep));
1907 ASSERT(value_type.IsIntType());
1908 }
1909#endif
1910 }
1911
1912 if (exactness != nullptr && exactness->is_exact) {
1913 exactness->emit_exactness_guard = true;
1914 } else {
1915 auto const function_type_args = flow_graph->constant_null();
1916 auto const dst_type = flow_graph->GetConstant(value_type);
1917 AssertAssignableInstr* assert_value = new (Z) AssertAssignableInstr(
1918 source, new (Z) Value(stored_value), new (Z) Value(dst_type),
1919 new (Z) Value(type_args), new (Z) Value(function_type_args),
1920 Symbols::Value(), call->deopt_id());
1921 *last = flow_graph->AppendSpeculativeTo(*last, assert_value, call->env(),
1922 FlowGraph::kValue);
1923 }
1924 }
1925
1926 array_cid =
1927 PrepareInlineIndexedOp(flow_graph, call, array_cid, &array, &index, last);
1928
1929 const bool is_typed_data_store = IsTypedDataBaseClassId(array_cid);
1930
1931 // Check if store barrier is needed. Byte arrays don't need a store barrier.
1932 StoreBarrierType needs_store_barrier =
1933 is_typed_data_store ? kNoStoreBarrier : kEmitStoreBarrier;
1934
1935 if (rep == kUnboxedFloat) {
1936 stored_value = new (Z)
1937 DoubleToFloatInstr(new (Z) Value(stored_value), call->deopt_id());
1938 *last = flow_graph->AppendTo(*last, stored_value, call->env(),
1939 FlowGraph::kValue);
1940 } else if (RepresentationUtils::IsUnboxedInteger(rep)) {
1941 // Insert explicit unboxing instructions with truncation to avoid relying
1942 // on [SelectRepresentations] which doesn't mark them as truncating.
1943 stored_value =
1944 UnboxInstr::Create(rep, new (Z) Value(stored_value), call->deopt_id(),
1945 Instruction::kNotSpeculative);
1946 *last = flow_graph->AppendTo(*last, stored_value, call->env(),
1947 FlowGraph::kValue);
1948 }
1949
1950 const intptr_t index_scale =
1951 compiler::target::Instance::ElementSizeFor(array_cid);
1952 auto* const store = new (Z) StoreIndexedInstr(
1953 new (Z) Value(array), new (Z) Value(index), new (Z) Value(stored_value),
1954 needs_store_barrier, /*index_unboxed=*/false, index_scale, array_cid,
1955 kAlignedAccess, call->deopt_id(), call->source());
1956 *last = flow_graph->AppendTo(*last, store, call->env(), FlowGraph::kEffect);
1957 // We need a return value to replace uses of the original definition. However,
1958 // the final instruction is a use of 'void operator[]=()', so we use null.
1959 *result = flow_graph->constant_null();
1960 return true;
1961}
Instruction * AppendSpeculativeTo(Instruction *prev, Instruction *instr, Environment *env, UseKind use_kind)
StoreBarrierType
Definition il.h:6252
static intptr_t PrepareInlineIndexedOp(FlowGraph *flow_graph, Instruction *call, intptr_t array_cid, Definition **array, Definition **index, Instruction **cursor)

◆ InlineSimdOp()

static bool dart::InlineSimdOp ( FlowGraph flow_graph,
bool  is_dynamic_call,
Instruction call,
Definition receiver,
MethodRecognizer::Kind  kind,
GraphEntryInstr graph_entry,
FunctionEntryInstr **  entry,
Instruction **  last,
Definition **  result 
)
static

Definition at line 2921 of file call_specializer.cc.

2929 {
2930 if (is_dynamic_call && call->ArgumentCount() > 1) {
2931 // Issue(dartbug.com/37737): Dynamic invocation forwarders have the
2932 // same recognized kind as the method they are forwarding to.
2933 // That causes us to inline the recognized method and not the
2934 // dyn: forwarder itself.
2935 // This is only safe if all arguments are checked in the flow graph we
2936 // build.
2937 // For double/int arguments speculative unboxing instructions should ensure
2938 // to bailout in AOT (or deoptimize in JIT) if the incoming values are not
2939 // correct. Though for user-implementable types, like
2940 // operator+(Float32x4 other), this is not safe and we therefore bailout.
2941 return false;
2942 }
2943
2944 if (!FLAG_enable_simd_inline) {
2945 return false;
2946 }
2947
2948 if (!FlowGraphCompiler::SupportsUnboxedSimd128()) {
2949#if defined(TARGET_ARCH_RISCV32) || defined(TARGET_ARCH_RISCV64)
2950 SimdLowering lowering(flow_graph, call, graph_entry, entry, last, result);
2951 return lowering.TryInline(kind);
2952#else
2953 return false;
2954#endif
2955 }
2956
2957 *entry =
2958 new (Z) FunctionEntryInstr(graph_entry, flow_graph->allocate_block_id(),
2959 call->GetBlock()->try_index(), DeoptId::kNone);
2960 Instruction* cursor = *entry;
2961 switch (kind) {
2962 case MethodRecognizer::kInt32x4Shuffle:
2963 case MethodRecognizer::kInt32x4ShuffleMix:
2964 case MethodRecognizer::kFloat32x4Shuffle:
2965 case MethodRecognizer::kFloat32x4ShuffleMix: {
2966 Definition* mask_definition = call->ArgumentAt(call->ArgumentCount() - 1);
2967 intptr_t mask = 0;
2968 if (!CheckMask(mask_definition, &mask)) {
2969 return false;
2970 }
2971 *last = SimdOpInstr::CreateFromCall(Z, kind, receiver, call, mask);
2972 break;
2973 }
2974
2975 case MethodRecognizer::kFloat32x4WithX:
2976 case MethodRecognizer::kFloat32x4WithY:
2977 case MethodRecognizer::kFloat32x4WithZ:
2978 case MethodRecognizer::kFloat32x4WithW:
2979 case MethodRecognizer::kFloat32x4Scale: {
2980 Definition* left = receiver;
2981 Definition* right = call->ArgumentAt(1);
2982 // Note: left and right values are swapped when handed to the instruction,
2983 // this is done so that the double value is loaded into the output
2984 // register and can be destroyed.
2985 // TODO(dartbug.com/31035) this swapping is only needed because register
2986 // allocator has SameAsFirstInput policy and not SameAsNthInput(n).
2987 *last = SimdOpInstr::Create(kind, new (Z) Value(right),
2988 new (Z) Value(left), call->deopt_id());
2989 break;
2990 }
2991
2992 case MethodRecognizer::kFloat32x4Zero:
2993 case MethodRecognizer::kFloat32x4ToFloat64x2:
2994 case MethodRecognizer::kFloat64x2ToFloat32x4:
2995 case MethodRecognizer::kFloat32x4ToInt32x4:
2996 case MethodRecognizer::kInt32x4ToFloat32x4:
2997 case MethodRecognizer::kFloat64x2Zero:
2998 *last = SimdOpInstr::CreateFromFactoryCall(Z, kind, call);
2999 break;
3000 case MethodRecognizer::kFloat32x4Mul:
3001 case MethodRecognizer::kFloat32x4Div:
3002 case MethodRecognizer::kFloat32x4Add:
3003 case MethodRecognizer::kFloat32x4Sub:
3004 case MethodRecognizer::kFloat64x2Mul:
3005 case MethodRecognizer::kFloat64x2Div:
3006 case MethodRecognizer::kFloat64x2Add:
3007 case MethodRecognizer::kFloat64x2Sub:
3008 *last = SimdOpInstr::CreateFromCall(Z, kind, receiver, call);
3009 if (CompilerState::Current().is_aot()) {
3010 // Add null-checks in case of the arguments are known to be compatible
3011 // but they are possibly nullable.
3012 // By inserting the null-check, we can allow the unbox instruction later
3013 // inserted to be non-speculative.
3014 CheckNullInstr* check1 =
3015 new (Z) CheckNullInstr(new (Z) Value(receiver), Symbols::FirstArg(),
3016 call->deopt_id(), call->source());
3017
3018 CheckNullInstr* check2 = new (Z) CheckNullInstr(
3019 new (Z) Value(call->ArgumentAt(1)), Symbols::SecondArg(),
3020 call->deopt_id(), call->source(), CheckNullInstr::kArgumentError);
3021
3022 (*last)->SetInputAt(0, new (Z) Value(check1));
3023 (*last)->SetInputAt(1, new (Z) Value(check2));
3024
3025 flow_graph->InsertBefore(call, check1, call->env(), FlowGraph::kValue);
3026 flow_graph->InsertBefore(call, check2, call->env(), FlowGraph::kValue);
3027 }
3028 break;
3029 default:
3030 *last = SimdOpInstr::CreateFromCall(Z, kind, receiver, call);
3031 break;
3032 }
3033 // InheritDeoptTarget also inherits environment (which may add 'entry' into
3034 // env_use_list()), so InheritDeoptTarget should be done only after decided
3035 // to inline.
3036 (*entry)->InheritDeoptTarget(Z, call);
3037 flow_graph->AppendTo(
3038 cursor, *last, call->deopt_id() != DeoptId::kNone ? call->env() : nullptr,
3039 FlowGraph::kValue);
3040 *result = (*last)->AsDefinition();
3041 return true;
3042}
static const char kValue[]
Definition Viewer.cpp:482
static bool CheckMask(Definition *definition, intptr_t *mask_ptr)

◆ InlineStringBaseCharAt()

static bool dart::InlineStringBaseCharAt ( FlowGraph flow_graph,
Instruction call,
Definition receiver,
intptr_t  cid,
GraphEntryInstr graph_entry,
FunctionEntryInstr **  entry,
Instruction **  last,
Definition **  result 
)
static

Definition at line 2106 of file call_specializer.cc.

2113 {
2114 if (cid != kOneByteStringCid) {
2115 return false;
2116 }
2117 Definition* str = receiver;
2118 Definition* index = call->ArgumentAt(1);
2119
2120 *entry =
2121 new (Z) FunctionEntryInstr(graph_entry, flow_graph->allocate_block_id(),
2122 call->GetBlock()->try_index(), DeoptId::kNone);
2123 (*entry)->InheritDeoptTarget(Z, call);
2124
2125 *last = PrepareInlineStringIndexOp(flow_graph, call, cid, str, index, *entry);
2126
2127 OneByteStringFromCharCodeInstr* char_at = new (Z)
2128 OneByteStringFromCharCodeInstr(new (Z) Value((*last)->AsDefinition()));
2129
2130 flow_graph->AppendTo(*last, char_at, nullptr, FlowGraph::kValue);
2131 *last = char_at;
2132 *result = char_at->AsDefinition();
2133
2134 return true;
2135}

◆ InlineStringBaseCodeUnitAt()

static bool dart::InlineStringBaseCodeUnitAt ( FlowGraph flow_graph,
Instruction call,
Definition receiver,
intptr_t  cid,
GraphEntryInstr graph_entry,
FunctionEntryInstr **  entry,
Instruction **  last,
Definition **  result 
)
static

Definition at line 2137 of file call_specializer.cc.

2144 {
2145 if (cid == kDynamicCid) {
2146 ASSERT(call->IsStaticCall());
2147 return false;
2148 } else if ((cid != kOneByteStringCid) && (cid != kTwoByteStringCid)) {
2149 return false;
2150 }
2151 Definition* str = receiver;
2152 Definition* index = call->ArgumentAt(1);
2153
2154 *entry =
2155 new (Z) FunctionEntryInstr(graph_entry, flow_graph->allocate_block_id(),
2156 call->GetBlock()->try_index(), DeoptId::kNone);
2157 (*entry)->InheritDeoptTarget(Z, call);
2158
2159 *last = PrepareInlineStringIndexOp(flow_graph, call, cid, str, index, *entry);
2160 *result = (*last)->AsDefinition();
2161
2162 return true;
2163}
static Definition * PrepareInlineStringIndexOp(FlowGraph *flow_graph, Instruction *call, intptr_t cid, Definition *str, Definition *index, Instruction *cursor)

◆ InlineTypedDataIndexCheck()

static bool dart::InlineTypedDataIndexCheck ( FlowGraph flow_graph,
Instruction call,
Definition receiver,
GraphEntryInstr graph_entry,
FunctionEntryInstr **  entry,
Instruction **  last,
Definition **  result,
const String symbol 
)
static

Definition at line 1717 of file call_specializer.cc.

1724 {
1725 *entry =
1726 new (Z) FunctionEntryInstr(graph_entry, flow_graph->allocate_block_id(),
1727 call->GetBlock()->try_index(), DeoptId::kNone);
1728 (*entry)->InheritDeoptTarget(Z, call);
1729 Instruction* cursor = *entry;
1730
1731 Definition* index = call->ArgumentAt(1);
1732 Definition* length = call->ArgumentAt(2);
1733
1734 if (CompilerState::Current().is_aot()) {
1735 // Add a null-check in case the index argument is known to be compatible
1736 // but possibly nullable. We don't need to do the same for length
1737 // because all callers in typed_data_patch.dart retrieve the length
1738 // from the typed data object.
1739 auto* const null_check =
1740 new (Z) CheckNullInstr(new (Z) Value(index), symbol, call->deopt_id(),
1741 call->source(), CheckNullInstr::kArgumentError);
1742 cursor = flow_graph->AppendTo(cursor, null_check, call->env(),
1743 FlowGraph::kEffect);
1744 }
1745 index = flow_graph->CreateCheckBound(length, index, call->deopt_id());
1746 cursor = flow_graph->AppendTo(cursor, index, call->env(), FlowGraph::kValue);
1747
1748 *last = cursor;
1749 *result = index;
1750 return true;
1751}
Definition * CreateCheckBound(Definition *length, Definition *index, intptr_t deopt_id)

◆ InSameGroup()

static bool dart::InSameGroup ( Isolate sender,
const SendPort receiver 
)
static

Definition at line 105 of file isolate.cc.

105 {
106 // Cannot determine whether sender is in same group (yet).
107 if (sender->origin_id() == ILLEGAL_PORT) return false;
108
109 // Only allow arbitrary messages between isolates of the same IG.
110 return sender->origin_id() == receiver.origin_id();
111}
Dart_Port origin_id()
Definition isolate.cc:1954
Dart_Port origin_id() const
Definition object.h:12466

◆ InsertFakeSample()

static void dart::InsertFakeSample ( uword pc_offsets)
static

Definition at line 2167 of file profiler_test.cc.

2167 {
2168 Isolate* isolate = Isolate::Current();
2169 ASSERT(Profiler::sample_block_buffer() != nullptr);
2170 Sample* sample = Profiler::sample_block_buffer()->ReserveCPUSample(isolate);
2171 ASSERT(sample != nullptr);
2172 sample->Init(isolate->main_port(), OS::GetCurrentMonotonicMicros(),
2173 OSThread::Current()->trace_id());
2174 sample->set_thread_task(Thread::kMutatorTask);
2175
2176 intptr_t i = 0;
2177 while (pc_offsets[i] != 0) {
2178 // When we collect a real stack trace, all PCs collected aside from the
2179 // executing one (i == 0) are actually return addresses. Return addresses
2180 // are one byte beyond the call instruction that is executing. The profiler
2181 // accounts for this and subtracts one from these addresses when querying
2182 // inline and token position ranges. To be consistent with real stack
2183 // traces, we add one byte to all PCs except the executing one.
2184 // See OffsetForPC in profiler_service.cc for more context.
2185 const intptr_t return_address_offset = i > 0 ? 1 : 0;
2186 sample->SetAt(i, pc_offsets[i] + return_address_offset);
2187 i++;
2188 }
2189 sample->SetAt(i, 0);
2190}
void set_thread_task(Thread::TaskKind task)
Definition profiler.h:324
void Init(Dart_Port port, int64_t timestamp, ThreadId tid)
Definition profiler.h:199

◆ InsertRangeInCanonicalList()

static intptr_t dart::InsertRangeInCanonicalList ( ZoneGrowableArray< CharacterRange > *  list,
intptr_t  count,
CharacterRange  insert 
)
static

Definition at line 4811 of file regexp.cc.

4814 {
4815 // Inserts a range into list[0..count[, which must be sorted
4816 // by from value and non-overlapping and non-adjacent, using at most
4817 // list[0..count] for the result. Returns the number of resulting
4818 // canonicalized ranges. Inserting a range may collapse existing ranges into
4819 // fewer ranges, so the return value can be anything in the range 1..count+1.
4820 int32_t from = insert.from();
4821 int32_t to = insert.to();
4822 intptr_t start_pos = 0;
4823 intptr_t end_pos = count;
4824 for (intptr_t i = count - 1; i >= 0; i--) {
4825 CharacterRange current = list->At(i);
4826 if (current.from() > to + 1) {
4827 end_pos = i;
4828 } else if (current.to() + 1 < from) {
4829 start_pos = i + 1;
4830 break;
4831 }
4832 }
4833
4834 // Inserted range overlaps, or is adjacent to, ranges at positions
4835 // [start_pos..end_pos[. Ranges before start_pos or at or after end_pos are
4836 // not affected by the insertion.
4837 // If start_pos == end_pos, the range must be inserted before start_pos.
4838 // if start_pos < end_pos, the entire range from start_pos to end_pos
4839 // must be merged with the insert range.
4840
4841 if (start_pos == end_pos) {
4842 // Insert between existing ranges at position start_pos.
4843 if (start_pos < count) {
4844 MoveRanges(list, start_pos, start_pos + 1, count - start_pos);
4845 }
4846 (*list)[start_pos] = insert;
4847 return count + 1;
4848 }
4849 if (start_pos + 1 == end_pos) {
4850 // Replace single existing range at position start_pos.
4851 CharacterRange to_replace = list->At(start_pos);
4852 intptr_t new_from = Utils::Minimum(to_replace.from(), from);
4853 intptr_t new_to = Utils::Maximum(to_replace.to(), to);
4854 (*list)[start_pos] = CharacterRange(new_from, new_to);
4855 return count;
4856 }
4857 // Replace a number of existing ranges from start_pos to end_pos - 1.
4858 // Move the remaining ranges down.
4859
4860 intptr_t new_from = Utils::Minimum(list->At(start_pos).from(), from);
4861 intptr_t new_to = Utils::Maximum(list->At(end_pos - 1).to(), to);
4862 if (end_pos < count) {
4863 MoveRanges(list, end_pos, start_pos + 1, count - end_pos);
4864 }
4865 (*list)[start_pos] = CharacterRange(new_from, new_to);
4866 return count - (end_pos - start_pos) + 1;
4867}
int32_t to() const
Definition regexp.h:56
int32_t from() const
Definition regexp.h:54
static void MoveRanges(ZoneGrowableArray< CharacterRange > *list, intptr_t from, intptr_t to, intptr_t count)
Definition regexp.cc:4795

◆ InsertRedefinition()

static RedefinitionInstr * dart::InsertRedefinition ( FlowGraph graph,
BlockEntryInstr dom,
Definition original,
const Object constant_value 
)
static

Definition at line 1584 of file constant_propagator.cc.

1587 {
1588 auto redef = new RedefinitionInstr(new Value(original),
1589 /*inserted_by_constant_propagation=*/true);
1590
1591 graph->InsertAfter(dom, redef, nullptr, FlowGraph::kValue);
1592 graph->RenameDominatedUses(original, redef, redef);
1593
1594 if (redef->input_use_list() == nullptr) {
1595 // There are no dominated uses, so the newly added Redefinition is useless.
1596 redef->RemoveFromGraph();
1597 return nullptr;
1598 }
1599
1600 redef->constant_value() = constant_value.ptr();
1601 return redef;
1602}
static void RenameDominatedUses(Definition *def, Instruction *dom, Definition *other)
void InsertAfter(Instruction *prev, Instruction *instr, Environment *env, UseKind use_kind)
Definition dom.py:1

◆ InspectStack()

void dart::InspectStack ( Dart_NativeArguments  args)

Definition at line 463 of file inliner_test.cc.

463 {
464#ifndef PRODUCT
466
467 Dart_StackTrace stacktrace;
470
471 intptr_t frame_count = 0;
472 result = Dart_StackTraceLength(stacktrace, &frame_count);
474 EXPECT_EQ(3, frame_count);
475 // Test something bigger than the preallocated size to verify nothing was
476 // truncated.
477 EXPECT(102 > StackTrace::kPreallocatedStackdepth);
478
480 Dart_Handle script_url;
481 intptr_t line_number = 0;
482 intptr_t column_number = 0;
483 const char* cstr = "";
484 const char* test_lib = "file:///test-lib";
485
486 // Top frame is InspectStack().
488 result = Dart_GetActivationFrame(stacktrace, 0, &frame);
490 result = Dart_ActivationFrameInfo(frame, &function_name, &script_url,
491 &line_number, &column_number);
493 Dart_StringToCString(function_name, &cstr);
494 EXPECT_STREQ("InspectStack", cstr);
495 Dart_StringToCString(script_url, &cstr);
496 EXPECT_STREQ(test_lib, cstr);
497 EXPECT_EQ(11, line_number);
498 EXPECT_EQ(24, column_number);
499
500 // Second frame is foo() positioned at call to InspectStack().
501 result = Dart_GetActivationFrame(stacktrace, 1, &frame);
503 result = Dart_ActivationFrameInfo(frame, &function_name, &script_url,
504 &line_number, &column_number);
506 Dart_StringToCString(function_name, &cstr);
507 EXPECT_STREQ("foo", cstr);
508 Dart_StringToCString(script_url, &cstr);
509 EXPECT_STREQ(test_lib, cstr);
510
511 // Bottom frame positioned at main().
512 result = Dart_GetActivationFrame(stacktrace, frame_count - 1, &frame);
514 result = Dart_ActivationFrameInfo(frame, &function_name, &script_url,
515 &line_number, &column_number);
517 Dart_StringToCString(function_name, &cstr);
518 EXPECT_STREQ("main", cstr);
519 Dart_StringToCString(script_url, &cstr);
520 EXPECT_STREQ(test_lib, cstr);
521
522 // Out-of-bounds frames.
523 result = Dart_GetActivationFrame(stacktrace, frame_count, &frame);
525 result = Dart_GetActivationFrame(stacktrace, -1, &frame);
527
530#endif // !PRODUCT
531}

◆ InstanceIsType()

static bool dart::InstanceIsType ( const Thread thread,
const Instance instance,
const Type type 
)
static

Definition at line 2272 of file dart_api_impl.cc.

2274 {
2275 ASSERT(!type.IsNull());
2276 CHECK_CALLBACK_STATE(thread);
2277 return instance.IsInstanceOf(type, Object::null_type_arguments(),
2278 Object::null_type_arguments());
2279}

◆ InstantiateType()

static AbstractTypePtr dart::InstantiateType ( const AbstractType type,
const AbstractType instantiator 
)
static

Definition at line 614 of file mirrors.cc.

615 {
616 // Generic function type parameters are not reified, but mapped to dynamic,
617 // i.e. all function type parameters are free with a null vector.
618 ASSERT(type.IsFinalized());
619 ASSERT(type.IsCanonical());
620 Thread* thread = Thread::Current();
621
622 if (type.IsInstantiated()) {
623 return type.Canonicalize(thread);
624 }
625 TypeArguments& instantiator_type_args = TypeArguments::Handle();
626 if (!instantiator.IsNull() && instantiator.IsType()) {
627 ASSERT(instantiator.IsFinalized());
628 if (instantiator.type_class_id() == kInstanceCid) {
629 // Handle types created in ClosureMirror_function.
630 instantiator_type_args = instantiator.arguments();
631 } else {
632 instantiator_type_args =
633 Type::Cast(instantiator)
634 .GetInstanceTypeArguments(thread, /*canonicalize=*/false);
635 }
636 }
637 AbstractType& result = AbstractType::Handle(type.InstantiateFrom(
638 instantiator_type_args, Object::null_type_arguments(), kAllFree,
639 Heap::kOld));
640 ASSERT(result.IsFinalized());
641 return result.Canonicalize(thread);
642}
virtual classid_t type_class_id() const
Definition object.cc:21074
virtual TypeArgumentsPtr arguments() const
Definition object.cc:21092

◆ INSTRUCTION_TEST() [1/8]

dart::INSTRUCTION_TEST ( Binary1  ,
,
(Register out, Register in0, FpuRegister in1)  ,
ReqReg  ,
(ReqReg, Location::RequiresFpuRegister())  ,
()  ,
RegLoc(0)  ,
(RegLoc(1), FpuLoc(2))  ,
()   
)

Definition at line 131 of file locations_helpers_test.cc.

139 {
140 EXPECT_EQ(Reg(0), out);
141 EXPECT_EQ(Reg(1), in0);
142 EXPECT_EQ(Fpu(2), in1);
143}
#define Reg(index)
#define Fpu(index)

◆ INSTRUCTION_TEST() [2/8]

dart::INSTRUCTION_TEST ( Binary2  ,
,
(Register out, FpuRegister in0, Register in1)  ,
ReqReg  ,
(ReqFpu, ReqReg ,
()  ,
RegLoc(0)  ,
(FpuLoc(1), RegLoc(2))  ,
()   
)

Definition at line 146 of file locations_helpers_test.cc.

154 {
155 EXPECT_EQ(Reg(0), out);
156 EXPECT_EQ(Fpu(1), in0);
157 EXPECT_EQ(Reg(2), in1);
158}

◆ INSTRUCTION_TEST() [3/8]

dart::INSTRUCTION_TEST ( FixedInput  ,
,
(FpuRegister out, Fixed< FpuRegister, Fpu(3)> in)  ,
ReqFpu  ,
(FpuLoc(3))  ,
()  ,
FpuLoc(0)  ,
(FpuLoc(3))  ,
()   
)

Definition at line 174 of file locations_helpers_test.cc.

182 {
183 EXPECT_EQ(Fpu(0), out);
184 EXPECT_EQ(Fpu(3), Fpu(in));
185}

◆ INSTRUCTION_TEST() [4/8]

dart::INSTRUCTION_TEST ( FixedOutput  ,
,
(Fixed< Register, Reg(3)> out)  ,
RegLoc(3)  ,
()  ,
()  ,
RegLoc(3)  ,
()  ,
()   
)

Definition at line 161 of file locations_helpers_test.cc.

169 {
170 EXPECT_EQ(Reg(3), Reg(out));
171}

◆ INSTRUCTION_TEST() [5/8]

dart::INSTRUCTION_TEST ( FixedTemp  ,
,
(FpuRegister out, Temp< Fixed< FpuRegister, Fpu(3)> > temp)  ,
ReqFpu  ,
()  ,
(FpuLoc(3))  ,
FpuLoc(4)  ,
()  ,
(FpuLoc(3))   
)

Definition at line 223 of file locations_helpers_test.cc.

231 {
232 EXPECT_EQ(Fpu(4), out);
233 EXPECT_EQ(Fpu(3), Fpu(temp));
234}

◆ INSTRUCTION_TEST() [6/8]

dart::INSTRUCTION_TEST ( SameAsFirstInput  ,
,
(SameAsFirstInput, Register in0, Register in1)  ,
Location::SameAsFirstInput()  ,
(ReqReg, ReqReg ,
()  ,
RegLoc(0)  ,
(RegLoc(0), RegLoc(1))  ,
()   
)

Definition at line 188 of file locations_helpers_test.cc.

196 {
197 EXPECT_EQ(Reg(0), in0);
198 EXPECT_EQ(Reg(1), in1);
199}

◆ INSTRUCTION_TEST() [7/8]

dart::INSTRUCTION_TEST ( Temps  ,
,
(Register out, Register in0, FpuRegister in1, Temp< FpuRegister > temp0, Temp< Register > temp1)  ,
ReqReg  ,
(ReqReg, ReqFpu ,
(ReqFpu, ReqReg ,
RegLoc(0)  ,
(RegLoc(1), FpuLoc(2))  ,
(FpuLoc(3), RegLoc(4))   
)

Definition at line 202 of file locations_helpers_test.cc.

214 {
215 EXPECT_EQ(Reg(0), out);
216 EXPECT_EQ(Reg(1), in0);
217 EXPECT_EQ(Fpu(2), in1);
218 EXPECT_EQ(Fpu(3), Fpu(temp0));
219 EXPECT_EQ(Reg(4), Reg(temp1));
220}

◆ INSTRUCTION_TEST() [8/8]

dart::INSTRUCTION_TEST ( Unary  ,
,
(Register out, Register in)  ,
ReqReg  ,
(ReqReg ,
()  ,
RegLoc(0)  ,
(RegLoc(1))  ,
()   
)

Definition at line 117 of file locations_helpers_test.cc.

125 {
126 EXPECT_EQ(Reg(0), out);
127 EXPECT_EQ(Reg(1), in);
128}

◆ IntComputation()

DART_EXPORT int64_t dart::IntComputation ( int8_t  a,
int16_t  b,
int32_t  c,
int64_t  d 
)

Definition at line 198 of file ffi_test_functions.cc.

198 {
199 std::cout << "IntComputation(" << static_cast<int>(a) << ", " << b << ", "
200 << c << ", " << d << ")\n";
201 const int64_t retval = d - c + b - a;
202 std::cout << "returning " << retval << "\n";
203 return retval;
204}

◆ IntptrAdditionClosure()

DART_EXPORT IntptrBinOp dart::IntptrAdditionClosure ( )

Definition at line 593 of file ffi_test_functions.cc.

593 {
594 std::cout << "IntptrAdditionClosure()\n";
595 IntptrBinOp retval = [](intptr_t a, intptr_t b) { return a + b; };
596 std::cout << "returning " << &retval << "\n";
597 return retval;
598}
intptr_t(* IntptrBinOp)(intptr_t a, intptr_t b)

◆ InvalidForwarding()

DART_NOINLINE static DART_NORETURN void dart::InvalidForwarding ( ObjectPtr  before,
ObjectPtr  after,
const char *  message 
)
static

Definition at line 255 of file become.cc.

257 {
258 // Separate prints so we can at least get partial information if header
259 // dereference or ToCString crashes.
260 OS::PrintErr("become: %s\n", message);
261 OS::PrintErr("before: %" Px "\n", static_cast<uword>(before));
262 OS::PrintErr("after: %" Px "\n", static_cast<uword>(after));
263 OS::PrintErr("before header: %" Px "\n",
264 before->IsHeapObject() ? before->untag()->tags() : 0);
265 OS::PrintErr("after header: %" Px "\n",
266 after->IsHeapObject() ? after->untag()->tags() : 0);
267 // Create both handles before either ToCString.
268 Object& before_handle = Object::Handle(before);
269 Object& after_handle = Object::Handle(after);
270 OS::PrintErr("before: %s\n", before_handle.ToCString());
271 OS::PrintErr("after: %s\n", after_handle.ToCString());
272 FATAL("become: %s", message);
273}
uword tags() const
Definition raw_object.h:294

◆ InventFloatValue()

DART_EXPORT float dart::InventFloatValue ( )

Definition at line 830 of file ffi_test_functions.cc.

830 {
831 std::cout << "InventFloatValue()\n";
832 const float retval = 1337.0f;
833 std::cout << "returning " << retval << "\n";
834 return retval;
835}

◆ InvertCondition() [1/4]

static Condition dart::InvertCondition ( Condition  c)
inlinestatic

Definition at line 804 of file constants_arm.h.

804 {
805 COMPILE_ASSERT((EQ ^ NE) == 1);
806 COMPILE_ASSERT((CS ^ CC) == 1);
807 COMPILE_ASSERT((MI ^ PL) == 1);
808 COMPILE_ASSERT((VS ^ VC) == 1);
809 COMPILE_ASSERT((HI ^ LS) == 1);
810 COMPILE_ASSERT((GE ^ LT) == 1);
811 COMPILE_ASSERT((GT ^ LE) == 1);
812 ASSERT(c != AL);
813 ASSERT(c != kSpecialCondition);
814 ASSERT(c != kInvalidCondition);
815 return static_cast<Condition>(c ^ 1);
816}
#define COMPILE_ASSERT(expr)
Definition assert.h:339

◆ InvertCondition() [2/4]

static Condition dart::InvertCondition ( Condition  c)
inlinestatic

Definition at line 680 of file constants_arm64.h.

680 {
681 COMPILE_ASSERT((EQ ^ NE) == 1);
682 COMPILE_ASSERT((CS ^ CC) == 1);
683 COMPILE_ASSERT((MI ^ PL) == 1);
684 COMPILE_ASSERT((VS ^ VC) == 1);
685 COMPILE_ASSERT((HI ^ LS) == 1);
686 COMPILE_ASSERT((GE ^ LT) == 1);
687 COMPILE_ASSERT((GT ^ LE) == 1);
688 COMPILE_ASSERT((AL ^ NV) == 1);
689 ASSERT(c != AL);
690 ASSERT(c != kInvalidCondition);
691 return static_cast<Condition>(c ^ 1);
692}

◆ InvertCondition() [3/4]

static Condition dart::InvertCondition ( Condition  c)
inlinestatic

Definition at line 642 of file constants_riscv.h.

642 {
643 COMPILE_ASSERT((EQ ^ NE) == 1);
644 COMPILE_ASSERT((CS ^ CC) == 1);
645 COMPILE_ASSERT((MI ^ PL) == 1);
646 COMPILE_ASSERT((VS ^ VC) == 1);
647 COMPILE_ASSERT((HI ^ LS) == 1);
648 COMPILE_ASSERT((GE ^ LT) == 1);
649 COMPILE_ASSERT((GT ^ LE) == 1);
650 COMPILE_ASSERT((AL ^ NV) == 1);
651 ASSERT(c != AL);
652 ASSERT(c != kInvalidCondition);
653 return static_cast<Condition>(c ^ 1);
654}

◆ InvertCondition() [4/4]

static Condition dart::InvertCondition ( Condition  c)
inlinestatic

Definition at line 52 of file constants_x86.h.

52 {
53 COMPILE_ASSERT((OVERFLOW ^ NO_OVERFLOW) == 1);
54 COMPILE_ASSERT((BELOW ^ ABOVE_EQUAL) == 1);
55 COMPILE_ASSERT((EQUAL ^ NOT_EQUAL) == 1);
56 COMPILE_ASSERT((BELOW_EQUAL ^ ABOVE) == 1);
57 COMPILE_ASSERT((SIGN ^ NOT_SIGN) == 1);
58 COMPILE_ASSERT((PARITY_EVEN ^ PARITY_ODD) == 1);
59 COMPILE_ASSERT((LESS ^ GREATER_EQUAL) == 1);
60 COMPILE_ASSERT((LESS_EQUAL ^ GREATER) == 1);
61 ASSERT(c != kInvalidCondition);
62 return static_cast<Condition>(c ^ 1);
63}

◆ InVmTests()

static bool dart::InVmTests ( const Function function)
static

Definition at line 9061 of file object.cc.

9061 {
9062#if defined(TESTING)
9063 return true;
9064#else
9065 auto* zone = Thread::Current()->zone();
9066 const auto& cls = Class::Handle(zone, function.Owner());
9067 const auto& lib = Library::Handle(zone, cls.library());
9068 const auto& url = String::Handle(zone, lib.url());
9069 const bool in_vm_tests =
9070 strstr(url.ToCString(), "runtime/tests/vm/") != nullptr;
9071 return in_vm_tests;
9072#endif
9073}

◆ Invoke() [1/3]

ObjectPtr dart::Invoke ( const Library lib,
const char *  name 
)

Definition at line 84 of file il_test_helper.cc.

84 {
85 Thread* thread = Thread::Current();
86 Dart_Handle api_lib = Api::NewHandle(thread, lib.ptr());
88 {
89 TransitionVMToNative transition(thread);
90 result =
91 Dart_Invoke(api_lib, NewString(name), /*argc=*/0, /*argv=*/nullptr);
93 }
94 return Api::UnwrapHandle(result);
95}

◆ Invoke() [2/3]

static void dart::Invoke ( const Library lib,
const char *  name,
intptr_t  argc = 0,
Dart_Handle argv = nullptr 
)
static

Definition at line 238 of file profiler_test.cc.

241 {
242 Thread* thread = Thread::Current();
243 Dart_Handle api_lib = Api::NewHandle(thread, lib.ptr());
244 TransitionVMToNative transition(thread);
245 Dart_Handle result = Dart_Invoke(api_lib, NewString(name), argc, argv);
247}

◆ Invoke() [3/3]

static void dart::Invoke ( Thread thread,
JSONStream js 
)
static

Definition at line 2629 of file service.cc.

2629 {
2630 const char* receiver_id = js->LookupParam("targetId");
2631 if (receiver_id == nullptr) {
2632 PrintMissingParamError(js, "targetId");
2633 return;
2634 }
2635 const char* selector_cstr = js->LookupParam("selector");
2636 if (selector_cstr == nullptr) {
2637 PrintMissingParamError(js, "selector");
2638 return;
2639 }
2640 const char* argument_ids = js->LookupParam("argumentIds");
2641 if (argument_ids == nullptr) {
2642 PrintMissingParamError(js, "argumentIds");
2643 return;
2644 }
2645
2646#if !defined(DART_PRECOMPILED_RUNTIME)
2647 bool disable_breakpoints =
2648 BoolParameter::Parse(js->LookupParam("disableBreakpoints"), false);
2649 DisableBreakpointsScope db(thread->isolate()->debugger(),
2650 disable_breakpoints);
2651#endif
2652
2653 Zone* zone = thread->zone();
2654 ObjectIdRing::LookupResult lookup_result;
2655 Object& receiver = Object::Handle(
2656 zone, LookupHeapObject(thread, receiver_id, &lookup_result));
2657 if (receiver.ptr() == Object::sentinel().ptr()) {
2658 if (lookup_result == ObjectIdRing::kCollected) {
2659 PrintSentinel(js, kCollectedSentinel);
2660 } else if (lookup_result == ObjectIdRing::kExpired) {
2661 PrintSentinel(js, kExpiredSentinel);
2662 } else {
2663 PrintInvalidParamError(js, "targetId");
2664 }
2665 return;
2666 }
2667
2668 const GrowableObjectArray& growable_args =
2669 GrowableObjectArray::Handle(zone, GrowableObjectArray::New());
2670
2671 bool is_instance = (receiver.IsInstance() || receiver.IsNull()) &&
2672 !ContainsNonInstance(receiver);
2673 if (is_instance) {
2674 growable_args.Add(receiver);
2675 }
2676
2677 intptr_t n = strlen(argument_ids);
2678 if ((n < 2) || (argument_ids[0] != '[') || (argument_ids[n - 1] != ']')) {
2679 PrintInvalidParamError(js, "argumentIds");
2680 return;
2681 }
2682 if (n > 2) {
2683 intptr_t start = 1;
2684 while (start < n) {
2685 intptr_t end = start;
2686 while ((argument_ids[end + 1] != ',') && (argument_ids[end + 1] != ']')) {
2687 end++;
2688 }
2689 if (end == start) {
2690 // Empty element.
2691 PrintInvalidParamError(js, "argumentIds");
2692 return;
2693 }
2694
2695 const char* argument_id =
2696 zone->MakeCopyOfStringN(&argument_ids[start], end - start + 1);
2697
2698 ObjectIdRing::LookupResult lookup_result;
2699 Object& argument = Object::Handle(
2700 zone, LookupHeapObject(thread, argument_id, &lookup_result));
2701 // Invoke only accepts Instance arguments.
2702 if (!(argument.IsInstance() || argument.IsNull()) ||
2703 ContainsNonInstance(argument)) {
2704 PrintInvalidParamError(js, "argumentIds");
2705 return;
2706 }
2707 if (argument.ptr() == Object::sentinel().ptr()) {
2708 if (lookup_result == ObjectIdRing::kCollected) {
2709 PrintSentinel(js, kCollectedSentinel);
2710 } else if (lookup_result == ObjectIdRing::kExpired) {
2711 PrintSentinel(js, kExpiredSentinel);
2712 } else {
2713 PrintInvalidParamError(js, "argumentIds");
2714 }
2715 return;
2716 }
2717 growable_args.Add(argument);
2718
2719 start = end + 3;
2720 }
2721 }
2722
2723 const String& selector = String::Handle(zone, String::New(selector_cstr));
2724 const Array& args =
2725 Array::Handle(zone, Array::MakeFixedLength(growable_args));
2726 const Array& arg_names = Object::empty_array();
2727
2728 if (receiver.IsLibrary()) {
2729 const Library& lib = Library::Cast(receiver);
2730 const Object& result =
2731 Object::Handle(zone, lib.Invoke(selector, args, arg_names));
2732 result.PrintJSON(js, true);
2733 return;
2734 }
2735 if (receiver.IsClass()) {
2736 const Class& cls = Class::Cast(receiver);
2737 const Object& result =
2738 Object::Handle(zone, cls.Invoke(selector, args, arg_names));
2739 result.PrintJSON(js, true);
2740 return;
2741 }
2742 if (is_instance) {
2743 // We don't use Instance::Cast here because it doesn't allow null.
2744 Instance& instance = Instance::Handle(zone);
2745 instance ^= receiver.ptr();
2746 const Object& result =
2747 Object::Handle(zone, instance.Invoke(selector, args, arg_names));
2748 result.PrintJSON(js, true);
2749 return;
2750 }
2751 js->PrintError(kInvalidParams,
2752 "%s: invalid 'targetId' parameter: "
2753 "Cannot invoke against a VM-internal object",
2754 js->method());
2755}

◆ InvokeCallThroughGetterOrNoSuchMethod()

static ObjectPtr dart::InvokeCallThroughGetterOrNoSuchMethod ( Thread thread,
Zone zone,
const Instance receiver,
const String target_name,
const Array orig_arguments,
const Array orig_arguments_desc 
)
static

Definition at line 2744 of file runtime_entry.cc.

2750 {
2751 ASSERT(!FLAG_lazy_dispatchers);
2752 const bool is_dynamic_call =
2753 Function::IsDynamicInvocationForwarderName(target_name);
2754 String& demangled_target_name = String::Handle(zone, target_name.ptr());
2755 if (is_dynamic_call) {
2756 demangled_target_name =
2757 Function::DemangleDynamicInvocationForwarderName(target_name);
2758 }
2759
2760 Class& cls = Class::Handle(zone, receiver.clazz());
2761 Function& function = Function::Handle(zone);
2762
2763 // Dart distinguishes getters and regular methods and allows their calls
2764 // to mix with conversions, and its selectors are independent of arity. So do
2765 // a zigzagged lookup to see if this call failed because of an arity mismatch,
2766 // need for conversion, or there really is no such method.
2767
2768 const bool is_getter = Field::IsGetterName(demangled_target_name);
2769 if (is_getter) {
2770 // Tear-off of a method
2771 // o.foo (o.get:foo) failed, closurize o.foo() if it exists.
2772 const auto& function_name =
2773 String::Handle(zone, Field::NameFromGetter(demangled_target_name));
2774 while (!cls.IsNull()) {
2775 // We don't generate dyn:* forwarders for method extractors so there is no
2776 // need to try to find a dyn:get:foo first (see assertion below)
2777 if (function.IsNull()) {
2778 if (cls.EnsureIsFinalized(thread) == Error::null()) {
2779 function = Resolver::ResolveDynamicFunction(zone, cls, function_name);
2780 }
2781 }
2782 if (!function.IsNull()) {
2783#if !defined(DART_PRECOMPILED_RUNTIME)
2784 ASSERT(!kernel::NeedsDynamicInvocationForwarder(Function::Handle(
2785 function.GetMethodExtractor(demangled_target_name))));
2786#endif
2787 const Function& closure_function =
2788 Function::Handle(zone, function.ImplicitClosureFunction());
2789 const Object& result = Object::Handle(
2790 zone, closure_function.ImplicitInstanceClosure(receiver));
2791 return result.ptr();
2792 }
2793 cls = cls.SuperClass();
2794 }
2795
2796 if (receiver.IsRecord()) {
2797 const Record& record = Record::Cast(receiver);
2798 const intptr_t field_index =
2799 record.GetFieldIndexByName(thread, function_name);
2800 if (field_index >= 0) {
2801 return record.FieldAt(field_index);
2802 }
2803 }
2804
2805 // Fall through for noSuchMethod
2806 } else {
2807 // Call through field.
2808 // o.foo(...) failed, invoke noSuchMethod is foo exists but has the wrong
2809 // number of arguments, or try (o.foo).call(...)
2810
2811 if ((target_name.ptr() == Symbols::call().ptr()) && receiver.IsClosure()) {
2812 // Special case: closures are implemented with a call getter instead of a
2813 // call method and with lazy dispatchers the field-invocation-dispatcher
2814 // would perform the closure call.
2815 return DartEntry::InvokeClosure(thread, orig_arguments,
2816 orig_arguments_desc);
2817 }
2818
2819 // Dynamic call sites have to use the dynamic getter as well (if it was
2820 // created).
2821 const auto& getter_name =
2822 String::Handle(zone, Field::GetterName(demangled_target_name));
2823 const auto& dyn_getter_name = String::Handle(
2824 zone, is_dynamic_call
2825 ? Function::CreateDynamicInvocationForwarderName(getter_name)
2826 : getter_name.ptr());
2827 ArgumentsDescriptor args_desc(orig_arguments_desc);
2828 while (!cls.IsNull()) {
2829 // If there is a function with the target name but mismatched arguments
2830 // we need to call `receiver.noSuchMethod()`.
2831 if (cls.EnsureIsFinalized(thread) == Error::null()) {
2832 function = Resolver::ResolveDynamicFunction(zone, cls, target_name);
2833 }
2834 if (!function.IsNull()) {
2835 ASSERT(!function.AreValidArguments(args_desc, nullptr));
2836 break; // mismatch, invoke noSuchMethod
2837 }
2838 if (is_dynamic_call) {
2839 function =
2840 Resolver::ResolveDynamicFunction(zone, cls, demangled_target_name);
2841 if (!function.IsNull()) {
2842 ASSERT(!function.AreValidArguments(args_desc, nullptr));
2843 break; // mismatch, invoke noSuchMethod
2844 }
2845 }
2846
2847 // If there is a getter we need to call-through-getter.
2848 if (is_dynamic_call) {
2849 function = Resolver::ResolveDynamicFunction(zone, cls, dyn_getter_name);
2850 }
2851 if (function.IsNull()) {
2852 function = Resolver::ResolveDynamicFunction(zone, cls, getter_name);
2853 }
2854 if (!function.IsNull()) {
2855 const Array& getter_arguments = Array::Handle(Array::New(1));
2856 getter_arguments.SetAt(0, receiver);
2857 const Object& getter_result = Object::Handle(
2858 zone, DartEntry::InvokeFunction(function, getter_arguments));
2859 if (getter_result.IsError()) {
2860 return getter_result.ptr();
2861 }
2862 ASSERT(getter_result.IsNull() || getter_result.IsInstance());
2863
2864 orig_arguments.SetAt(args_desc.FirstArgIndex(), getter_result);
2865 return DartEntry::InvokeClosure(thread, orig_arguments,
2866 orig_arguments_desc);
2867 }
2868 cls = cls.SuperClass();
2869 }
2870
2871 if (receiver.IsRecord()) {
2872 const Record& record = Record::Cast(receiver);
2873 const intptr_t field_index =
2874 record.GetFieldIndexByName(thread, demangled_target_name);
2875 if (field_index >= 0) {
2876 const Object& getter_result =
2877 Object::Handle(zone, record.FieldAt(field_index));
2878 ASSERT(getter_result.IsNull() || getter_result.IsInstance());
2879 orig_arguments.SetAt(args_desc.FirstArgIndex(), getter_result);
2880 return DartEntry::InvokeClosure(thread, orig_arguments,
2881 orig_arguments_desc);
2882 }
2883 }
2884 }
2885
2886 const Object& result = Object::Handle(
2887 zone,
2888 DartEntry::InvokeNoSuchMethod(thread, receiver, demangled_target_name,
2889 orig_arguments, orig_arguments_desc));
2890 return result.ptr();
2891}

◆ InvokeClosureCallback()

DART_EXPORT void dart::InvokeClosureCallback ( )

Definition at line 1114 of file ffi_test_functions_vmspecific.cc.

1114 {
1115 Dart_Handle closure_handle =
1116 Dart_HandleFromPersistent_DL(closure_to_callback_);
1117 callback_(closure_handle);
1118}

◆ InvokeEmitter() [1/6]

template<typename Instr , typename Out >
void dart::InvokeEmitter ( FlowGraphCompiler compiler,
Instr instr,
void(*)(FlowGraphCompiler *, Instr *, Out)  Emit 
)

Definition at line 340 of file locations_helpers.h.

342 {
343 typedef SIGNATURE_TRAIT(0, ()) S;
344 ASSERT(instr->InputCount() == S::kInputCount);
345 LocationSummary* locs = instr->locs();
346 Emit(compiler, instr, LocationTrait<Out>::Unwrap(locs->out(0)));
347}
#define SIGNATURE_TRAIT(Arity, Args)

◆ InvokeEmitter() [2/6]

template<typename Instr , typename Out , typename T0 >
void dart::InvokeEmitter ( FlowGraphCompiler compiler,
Instr instr,
void(*)(FlowGraphCompiler *, Instr *, Out, T0 Emit 
)

Definition at line 350 of file locations_helpers.h.

352 {
353 typedef SIGNATURE_TRAIT(1, (T0)) S;
354 ASSERT(instr->InputCount() == S::kInputCount);
355 LocationSummary* locs = instr->locs();
356 Emit(compiler, instr, LocationTrait<Out>::Unwrap(locs->out(0)),
357 LocationTrait<T0>::template UnwrapInput<S::kInputCount, 0>(locs));
358}
Location out(intptr_t index) const
Definition locations.h:903

◆ InvokeEmitter() [3/6]

template<typename Instr , typename Out , typename T0 , typename T1 >
void dart::InvokeEmitter ( FlowGraphCompiler compiler,
Instr instr,
void(*)(FlowGraphCompiler *, Instr *, Out, T0, T1 Emit 
)

Definition at line 361 of file locations_helpers.h.

363 {
364 typedef SIGNATURE_TRAIT(2, (T0, T1)) S;
365 ASSERT(instr->InputCount() == S::kInputCount);
366 LocationSummary* locs = instr->locs();
367 Emit(compiler, instr, LocationTrait<Out>::Unwrap(locs->out(0)),
368 LocationTrait<T0>::template UnwrapInput<S::kInputCount, 0>(locs),
369 LocationTrait<T1>::template UnwrapInput<S::kInputCount, 1>(locs));
370}

◆ InvokeEmitter() [4/6]

template<typename Instr , typename Out , typename T0 , typename T1 , typename T2 >
void dart::InvokeEmitter ( FlowGraphCompiler compiler,
Instr instr,
void(*)(FlowGraphCompiler *, Instr *, Out, T0, T1, T2 Emit 
)

Definition at line 373 of file locations_helpers.h.

375 {
376 typedef SIGNATURE_TRAIT(3, (T0, T1, T2)) S;
377 ASSERT(instr->InputCount() == S::kInputCount);
378 LocationSummary* locs = instr->locs();
379 Emit(compiler, instr, LocationTrait<Out>::Unwrap(locs->out(0)),
380 LocationTrait<T0>::template UnwrapInput<S::kInputCount, 0>(locs),
381 LocationTrait<T1>::template UnwrapInput<S::kInputCount, 1>(locs),
382 LocationTrait<T2>::template UnwrapInput<S::kInputCount, 2>(locs));
383}

◆ InvokeEmitter() [5/6]

template<typename Instr , typename Out , typename T0 , typename T1 , typename T2 , typename T3 >
void dart::InvokeEmitter ( FlowGraphCompiler compiler,
Instr instr,
void(*)(FlowGraphCompiler *, Instr *, Out, T0, T1, T2, T3 Emit 
)

Definition at line 391 of file locations_helpers.h.

394 {
395 typedef SIGNATURE_TRAIT(4, (T0, T1, T2, T3)) S;
396 ASSERT(instr->InputCount() == S::kInputCount);
397 LocationSummary* locs = instr->locs();
398 Emit(compiler, instr, LocationTrait<Out>::Unwrap(locs->out(0)),
399 LocationTrait<T0>::template UnwrapInput<S::kInputCount, 0>(locs),
400 LocationTrait<T1>::template UnwrapInput<S::kInputCount, 1>(locs),
401 LocationTrait<T2>::template UnwrapInput<S::kInputCount, 2>(locs),
402 LocationTrait<T3>::template UnwrapInput<S::kInputCount, 3>(locs));
403}

◆ InvokeEmitter() [6/6]

template<typename Instr , typename Out , typename T0 , typename T1 , typename T2 , typename T3 , typename T4 >
void dart::InvokeEmitter ( FlowGraphCompiler compiler,
Instr instr,
void(*)(FlowGraphCompiler *, Instr *, Out, T0, T1, T2, T3, T4 Emit 
)

Definition at line 412 of file locations_helpers.h.

415 {
416 typedef SIGNATURE_TRAIT(5, (T0, T1, T2, T3, T4)) S;
417 ASSERT(instr->InputCount() == S::kInputCount);
418 LocationSummary* locs = instr->locs();
419 Emit(compiler, instr, LocationTrait<Out>::Unwrap(locs->out(0)),
420 LocationTrait<T0>::template UnwrapInput<S::kInputCount, 0>(locs),
421 LocationTrait<T1>::template UnwrapInput<S::kInputCount, 1>(locs),
422 LocationTrait<T2>::template UnwrapInput<S::kInputCount, 2>(locs),
423 LocationTrait<T3>::template UnwrapInput<S::kInputCount, 3>(locs),
424 LocationTrait<T4>::template UnwrapInput<S::kInputCount, 4>(locs));
425}

◆ InvokeEventHandler()

static void dart::InvokeEventHandler ( ServiceEvent event)
static

Definition at line 284 of file debugger.cc.

284 {
285 ASSERT(!event->IsPause()); // For pause events, call Pause instead.
286 Service::HandleEvent(event, /*enter_safepoint*/ false);
287}

◆ InvokeInstanceFunction()

static ObjectPtr dart::InvokeInstanceFunction ( Thread thread,
const Instance receiver,
const Function function,
const String target_name,
const Array args,
const Array args_descriptor_array,
bool  respect_reflectable,
const TypeArguments instantiator_type_args 
)
static

Definition at line 14363 of file object.cc.

14371 {
14372 // Note "args" is already the internal arguments with the receiver as the
14373 // first element.
14374 ArgumentsDescriptor args_descriptor(args_descriptor_array);
14375 if (function.IsNull() ||
14376 !function.AreValidArguments(args_descriptor, nullptr) ||
14377 (respect_reflectable && !function.is_reflectable())) {
14378 return DartEntry::InvokeNoSuchMethod(thread, receiver, target_name, args,
14379 args_descriptor_array);
14380 }
14381 ObjectPtr type_error = function.DoArgumentTypesMatch(args, args_descriptor,
14382 instantiator_type_args);
14383 if (type_error != Error::null()) {
14384 return type_error;
14385 }
14386 return DartEntry::InvokeFunction(function, args, args_descriptor_array);
14387}

◆ InvokeServiceMessages()

static void dart::InvokeServiceMessages ( uword  param)
static

Definition at line 9903 of file dart_api_impl_test.cc.

9904 {
9906 } else if (strcmp(cstr, "SetPerformanceModeLatency") == 0) {
9907 return SetPerformanceModeLatency;
9908 }
9909 return nullptr;
9910}
9911
9912TEST_CASE(DartAPI_SetPerformanceMode) {
9913 const char* kScriptChars = R"(
9914import "dart:typed_data";
9915@pragma("vm:external-name", "SetPerformanceModeDefault")
9916external void setPerformanceModeDefault();
9917@pragma("vm:external-name", "SetPerformanceModeLatency")
9918external void setPerformanceModeLatency();
9919void main() {
9920 for (var i = 0; i < 10; i++) {
9921 setPerformanceModeLatency();
9922 var t = [];
9923 for (var j = 0; j < 32; j++) {
9924 t.add(Uint8List(1000000));
9925 }
9926 setPerformanceModeDefault();
9927 }
9928}
9929)";
9930 Dart_Handle lib =
9931 TestCase::LoadTestScript(kScriptChars, &SetMode_native_lookup);
static void SetPerformanceModeDefault(Dart_NativeArguments args)
#define TEST_CASE(name)
Definition unit_test.h:85

◆ IrregexpRegExpTooBig()

static RegExpEngine::CompilationResult dart::IrregexpRegExpTooBig ( )
static

Definition at line 384 of file regexp.cc.

384 {
385 return RegExpEngine::CompilationResult("RegExp too big");
386}

◆ IsAbiPreservedRegister()

constexpr bool dart::IsAbiPreservedRegister ( Register  reg)
constexpr

Definition at line 90 of file constants.h.

90 {
91 return (kAbiPreservedCpuRegs & (1 << reg)) != 0;
92}

◆ IsAllocatableInNewSpace()

bool dart::IsAllocatableInNewSpace ( intptr_t  size)
inline

Definition at line 57 of file spaces.h.

57 {
58 return size <= kNewAllocatableSize;
59}
static constexpr intptr_t kNewAllocatableSize
Definition spaces.h:54

◆ IsAllocatableViaFreeLists()

bool dart::IsAllocatableViaFreeLists ( intptr_t  size)
inline

Definition at line 60 of file spaces.h.

60 {
61 return size < kAllocatablePageSize;
62}
static constexpr intptr_t kAllocatablePageSize
Definition spaces.h:55

◆ IsAllocatedReference()

static constexpr bool dart::IsAllocatedReference ( intptr_t  ref)
staticconstexpr

Definition at line 292 of file app_snapshot.cc.

292 {
293 return ref > kUnreachableReference;
294}
static constexpr intptr_t kUnreachableReference

◆ IsAlpha()

static bool dart::IsAlpha ( char  c)
static

Definition at line 2762 of file service.cc.

2762 {
2763 return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z');
2764}

◆ IsAlphaNum()

static bool dart::IsAlphaNum ( char  c)
static

Definition at line 2768 of file service.cc.

2768 {
2769 return (c >= '0' && c <= '9') || IsAlpha(c);
2770}
static bool IsAlpha(char c)
Definition service.cc:2762

◆ IsAlphaNumOrDollar()

static bool dart::IsAlphaNumOrDollar ( char  c)
static

Definition at line 2771 of file service.cc.

2771 {
2772 return (c >= '0' && c <= '9') || IsAlphaOrDollar(c);
2773}
static bool IsAlphaOrDollar(char c)
Definition service.cc:2765

◆ IsAlphaOrDollar()

static bool dart::IsAlphaOrDollar ( char  c)
static

Definition at line 2765 of file service.cc.

2765 {
2766 return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c == '$');
2767}

◆ IsArgumentRegister()

static constexpr bool dart::IsArgumentRegister ( Register  reg)
staticconstexpr

Definition at line 77 of file constants.h.

77 {
78 return ((1 << reg) & CallingConventions::kArgumentRegisters) != 0;
79}

◆ IsArrayClassId()

bool dart::IsArrayClassId ( intptr_t  index)
inline

Definition at line 358 of file class_id.h.

358 {
359 COMPILE_ASSERT(kImmutableArrayCid == kArrayCid + 1);
360 COMPILE_ASSERT(kGrowableObjectArrayCid == kArrayCid + 2);
361 return (index >= kArrayCid && index <= kGrowableObjectArrayCid);
362}

◆ IsArtificialReference()

static constexpr bool dart::IsArtificialReference ( intptr_t  ref)
staticconstexpr

Definition at line 296 of file app_snapshot.cc.

296 {
297 return ref < kUnallocatedReference;
298}
static constexpr intptr_t kUnallocatedReference

◆ IsAsciiNonprintable()

static bool dart::IsAsciiNonprintable ( int32_t  c)
inlinestatic

Definition at line 516 of file object.cc.

516 {
517 return ((0 <= c) && (c < 32)) || (c == 127);
518}

◆ IsAtAsyncJump()

static bool dart::IsAtAsyncJump ( ActivationFrame top_frame)
static

Definition at line 3502 of file debugger.cc.

3502 {
3503 Zone* zone = Thread::Current()->zone();
3504 if (!top_frame->function().IsAsyncFunction() &&
3505 !top_frame->function().IsAsyncGenerator()) {
3506 return false;
3507 }
3508 const auto& pc_descriptors =
3509 PcDescriptors::Handle(zone, top_frame->code().pc_descriptors());
3510 if (pc_descriptors.IsNull()) {
3511 return false;
3512 }
3513 const TokenPosition looking_for = top_frame->TokenPos();
3514 PcDescriptors::Iterator it(pc_descriptors, UntaggedPcDescriptors::kOther);
3515 while (it.MoveNext()) {
3516 if (it.TokenPos() == looking_for &&
3517 it.YieldIndex() != UntaggedPcDescriptors::kInvalidYieldIndex) {
3518 return true;
3519 }
3520 }
3521 return false;
3522}
const Function & function() const
Definition debugger.h:316
const Code & code() const
Definition debugger.h:317
TokenPosition TokenPos()
Definition debugger.cc:519
PcDescriptorsPtr pc_descriptors() const
Definition object.h:6900
bool IsAsyncFunction() const
Definition object.h:3942
bool IsAsyncGenerator() const
Definition object.h:3952

◆ IsAThisCallThroughAnUncheckedEntryPoint()

static bool dart::IsAThisCallThroughAnUncheckedEntryPoint ( Definition call)
static

Definition at line 776 of file inliner.cc.

776 {
777 if (auto instance_call = call->AsInstanceCallBase()) {
778 return (instance_call->entry_kind() == Code::EntryKind::kUnchecked) &&
779 instance_call->is_call_on_this();
780 }
781 return false;
782}

◆ IsBTypeImm()

bool dart::IsBTypeImm ( intptr_t  imm)
inline

Definition at line 1008 of file constants_riscv.h.

1008 {
1009 return Utils::IsInt(12, imm) && Utils::IsAligned(imm, 2);
1010}

◆ IsBuiltinListClassId()

bool dart::IsBuiltinListClassId ( intptr_t  index)
inline

Definition at line 364 of file class_id.h.

364 {
365 // Make sure this function is updated when new builtin List types are added.
366 return (IsArrayClassId(index) || IsTypedDataBaseClassId(index) ||
367 (index == kByteBufferCid));
368}

◆ IsCalleeFrameOf()

static DART_FORCE_INLINE bool dart::IsCalleeFrameOf ( uword  fp,
uword  other_fp 
)
static

Definition at line 422 of file stack_frame.h.

422 {
423 return other_fp < fp;
424}
const uint32_t fp

◆ IsCalleeSavedRegister()

static constexpr bool dart::IsCalleeSavedRegister ( Register  reg)
staticconstexpr

Definition at line 85 of file constants.h.

85 {
86 return ((1 << reg) & CallingConventions::kCalleeSaveCpuRegisters) != 0;
87}

◆ IsCallRecursive()

static bool dart::IsCallRecursive ( const Function function,
Definition call 
)
static

Definition at line 104 of file inliner.cc.

104 {
105 Environment* env = call->env();
106 while (env != nullptr) {
107 if (function.ptr() == env->function().ptr()) {
108 return true;
109 }
110 env = env->outer();
111 }
112 return false;
113}

◆ IsCBImm()

bool dart::IsCBImm ( intptr_t  imm)
inline

Definition at line 1323 of file constants_riscv.h.

1323 {
1324 return Utils::IsInt(8, imm) && Utils::IsAligned(imm, 2);
1325}

◆ IsCensoredLibrary()

static bool dart::IsCensoredLibrary ( const String url)
static

Definition at line 328 of file mirrors.cc.

328 {
329 static const char* const censored_libraries[] = {
330 "dart:_builtin",
331 "dart:_vmservice",
332 "dart:vmservice_io",
333 };
334 for (const char* censored_library : censored_libraries) {
335 if (url.Equals(censored_library)) {
336 return true;
337 }
338 }
339 if (!Api::IsFfiEnabled() && url.Equals(Symbols::DartFfi())) {
340 return true;
341 }
342 return false;
343}

◆ IsCI16Imm()

bool dart::IsCI16Imm ( intptr_t  imm)
inline

Definition at line 1380 of file constants_riscv.h.

1380 {
1381 return Utils::IsInt(10, imm) && Utils::IsAligned(imm, 16);
1382}

◆ IsCI4SPNImm()

bool dart::IsCI4SPNImm ( intptr_t  imm)
inline

Definition at line 1403 of file constants_riscv.h.

1403 {
1404 return Utils::IsUint(9, imm) && Utils::IsAligned(imm, 4);
1405}

◆ IsCIImm()

bool dart::IsCIImm ( intptr_t  imm)
inline

Definition at line 1346 of file constants_riscv.h.

1346 {
1347 return Utils::IsInt(6, imm) && Utils::IsAligned(imm, 1);
1348}

◆ IsCInstruction()

bool dart::IsCInstruction ( uint16_t  parcel)
inline

Definition at line 1089 of file constants_riscv.h.

1089 {
1090 return (parcel & 3) != 3;
1091}

◆ IsCJImm()

bool dart::IsCJImm ( intptr_t  imm)
inline

Definition at line 1294 of file constants_riscv.h.

1294 {
1295 return Utils::IsInt(11, imm) && Utils::IsAligned(imm, 2);
1296}

◆ IsClampedTypedDataBaseClassId()

bool dart::IsClampedTypedDataBaseClassId ( intptr_t  index)
inline

Definition at line 461 of file class_id.h.

461 {
462 if (!IsTypedDataBaseClassId(index)) return false;
463 const intptr_t internal_cid =
464 index - ((index - kFirstTypedDataCid) % kNumTypedDataCidRemainders) +
466 // Currently, the only clamped typed data arrays are Uint8.
467 return internal_cid == kTypedDataUint8ClampedArrayCid;
468}
const int kTypedDataCidRemainderInternal
Definition class_id.h:261
static const ClassId kFirstTypedDataCid
Definition class_id.h:377

◆ IsCMem4Imm()

bool dart::IsCMem4Imm ( intptr_t  imm)
inline

Definition at line 1258 of file constants_riscv.h.

1258 {
1259 return Utils::IsUint(7, imm) && Utils::IsAligned(imm, 4);
1260}

◆ IsCMem8Imm()

bool dart::IsCMem8Imm ( intptr_t  imm)
inline

Definition at line 1277 of file constants_riscv.h.

1277 {
1278 return Utils::IsUint(8, imm) && Utils::IsAligned(imm, 8);
1279}

◆ IsCommutative()

static bool dart::IsCommutative ( Token::Kind  op)
static

Definition at line 2231 of file il.cc.

2231 {
2232 switch (op) {
2233 case Token::kMUL:
2235 case Token::kADD:
2237 case Token::kBIT_AND:
2239 case Token::kBIT_OR:
2241 case Token::kBIT_XOR:
2242 return true;
2243 default:
2244 return false;
2245 }
2246}

◆ IsCompiletimeErrorObject()

static bool dart::IsCompiletimeErrorObject ( Zone zone,
const Object obj 
)
static

Definition at line 186 of file dart_api_impl.cc.

186 {
187#if defined(DART_PRECOMPILED_RUNTIME)
188 // All compile-time errors were handled at snapshot generation time and
189 // compiletime_error_class was removed.
190 return false;
191#else
192 auto isolate_group = Thread::Current()->isolate_group();
193 const Class& error_class = Class::Handle(
194 zone, isolate_group->object_store()->compiletime_error_class());
195 ASSERT(!error_class.IsNull());
196 return (obj.GetClassId() == error_class.id());
197#endif
198}

◆ IsConcreteTypeClassId()

bool dart::IsConcreteTypeClassId ( intptr_t  index)
inline

Definition at line 325 of file class_id.h.

325 {
326 // Make sure to update when new AbstractType subclasses are added.
327 COMPILE_ASSERT(kFunctionTypeCid == kTypeCid + 1 &&
328 kRecordTypeCid == kTypeCid + 2 &&
329 kTypeParameterCid == kTypeCid + 3);
330 return (index >= kTypeCid && index <= kTypeParameterCid);
331}

◆ IsConstant()

static bool dart::IsConstant ( Definition def,
int64_t *  val 
)
static

Definition at line 123 of file loops.cc.

123 {
124 if (def->IsConstant()) {
125 const Object& value = def->AsConstant()->value();
126 if (value.IsInteger()) {
127 *val = Integer::Cast(value).AsInt64Value(); // smi and mint
128 return true;
129 }
130 }
131 return false;
132}

◆ IsCreateLargeArray()

static bool dart::IsCreateLargeArray ( Definition defn)
static

Definition at line 192 of file write_barrier_elimination.cc.

192 {
193 if (auto create_array = defn->AsCreateArray()) {
194 static_assert(!Array::UseCardMarkingForAllocation(
195 Array::kMaxLengthForWriteBarrierElimination),
196 "Invariant restoration code does not handle card marking.");
197 // Note: IsUsable would reject CreateArray instructions with non-constant
198 // number of elements.
199 return create_array->GetConstantNumElements() >
200 Array::kMaxLengthForWriteBarrierElimination;
201 }
202 return false;
203}

◆ IsCSPLoad4Imm()

bool dart::IsCSPLoad4Imm ( intptr_t  imm)
inline

Definition at line 1186 of file constants_riscv.h.

1186 {
1187 return Utils::IsUint(8, imm) && Utils::IsAligned(imm, 4);
1188}

◆ IsCSPLoad8Imm()

bool dart::IsCSPLoad8Imm ( intptr_t  imm)
inline

Definition at line 1205 of file constants_riscv.h.

1205 {
1206 return Utils::IsUint(9, imm) && Utils::IsAligned(imm, 8);
1207}

◆ IsCSPStore4Imm()

bool dart::IsCSPStore4Imm ( intptr_t  imm)
inline

Definition at line 1224 of file constants_riscv.h.

1224 {
1225 return Utils::IsUint(8, imm) && Utils::IsAligned(imm, 4);
1226}

◆ IsCSPStore8Imm()

bool dart::IsCSPStore8Imm ( intptr_t  imm)
inline

Definition at line 1241 of file constants_riscv.h.

1241 {
1242 return Utils::IsUint(9, imm) && Utils::IsAligned(imm, 8);
1243}

◆ IsCUImm()

bool dart::IsCUImm ( intptr_t  imm)
inline

Definition at line 1363 of file constants_riscv.h.

1363 {
1364 return Utils::IsInt(17, imm) && Utils::IsAligned(imm, 1 << 12);
1365}

◆ IsDataFieldOfTypedDataView()

static bool dart::IsDataFieldOfTypedDataView ( Definition alloc,
const Slot slot 
)
static

Definition at line 3978 of file redundancy_elimination.cc.

3978 {
3979 if (!slot.IsIdentical(Slot::PointerBase_data())) return false;
3980 // Internal typed data objects use AllocateTypedData.
3981 if (!alloc->IsAllocateObject()) return false;
3982 auto const cid = alloc->AsAllocateObject()->cls().id();
3984}

◆ IsDecimalDigit()

static bool dart::IsDecimalDigit ( int32_t  c)
static

Definition at line 13317 of file object.cc.

13317 {
13318 return '0' <= c && c <= '9';
13319}

◆ IsDeeplyImmutableCid()

bool dart::IsDeeplyImmutableCid ( intptr_t  predefined_cid)
inline

Definition at line 485 of file class_id.h.

485 {
486 ASSERT(predefined_cid < kNumPredefinedCids);
487 return IsStringClassId(predefined_cid) || predefined_cid == kNumberCid ||
488 predefined_cid == kIntegerCid || predefined_cid == kSmiCid ||
489 predefined_cid == kMintCid || predefined_cid == kNeverCid ||
490 predefined_cid == kSentinelCid || predefined_cid == kStackTraceCid ||
491 predefined_cid == kDoubleCid || predefined_cid == kFloat32x4Cid ||
492 predefined_cid == kFloat64x2Cid || predefined_cid == kInt32x4Cid ||
493 predefined_cid == kSendPortCid || predefined_cid == kCapabilityCid ||
494 predefined_cid == kRegExpCid || predefined_cid == kBoolCid ||
495 predefined_cid == kNullCid || predefined_cid == kPointerCid ||
496 predefined_cid == kTypeCid || predefined_cid == kRecordTypeCid ||
497 predefined_cid == kFunctionTypeCid;
498}

◆ IsDelimiter()

static bool dart::IsDelimiter ( intptr_t  value)
static

Definition at line 17 of file uri.cc.

17 {
18 switch (value) {
19 case ':':
20 case '/':
21 case '?':
22 case '#':
23 case '[':
24 case ']':
25 case '@':
26 case '!':
27 case '$':
28 case '&':
29 case '\'':
30 case '(':
31 case ')':
32 case '*':
33 case '+':
34 case ',':
35 case ';':
36 case '=':
37 return true;
38 default:
39 return false;
40 }
41}

◆ IsDominatedUse()

static bool dart::IsDominatedUse ( Instruction dom,
Value use 
)
static

Definition at line 2848 of file flow_graph.cc.

2848 {
2849 BlockEntryInstr* dom_block = dom->GetBlock();
2850
2851 Instruction* instr = use->instruction();
2852
2853 PhiInstr* phi = instr->AsPhi();
2854 if (phi != nullptr) {
2855 return dom_block->Dominates(phi->block()->PredecessorAt(use->use_index()));
2856 }
2857
2858 BlockEntryInstr* use_block = instr->GetBlock();
2859 if (use_block == dom_block) {
2860 // Fast path for the case of block entry.
2861 if (dom_block == dom) return true;
2862
2863 for (Instruction* curr = dom->next(); curr != nullptr;
2864 curr = curr->next()) {
2865 if (curr == instr) return true;
2866 }
2867
2868 return false;
2869 }
2870
2871 return dom_block->Dominates(use_block);
2872}
virtual BlockEntryInstr * GetBlock()
Definition il.cc:1350
virtual BlockEntryInstr * PredecessorAt(intptr_t index) const
Definition il.h:2051
JoinEntryInstr * block() const
Definition il.h:2799
intptr_t use_index() const
Definition il.h:124
Instruction * instruction() const
Definition il.h:121

◆ IsDummyObject()

static bool dart::IsDummyObject ( ObjectPtr  object)
static

Definition at line 248 of file become.cc.

248 {
249 if (!object->IsForwardingCorpse()) return false;
250 return GetForwardedObject(object) == object;
251}
bool IsForwardingCorpse() const
static ObjectPtr GetForwardedObject(ObjectPtr object)
Definition become.cc:54

◆ IsEmptyBlock()

static bool dart::IsEmptyBlock ( BlockEntryInstr block)
static

Definition at line 1683 of file constant_propagator.cc.

1683 {
1684 // A block containing a goto to itself forms an infinite loop.
1685 // We don't consider this an empty block to handle the edge-case where code
1686 // reduces to an infinite loop.
1687 return block->next()->IsGoto() &&
1688 block->next()->AsGoto()->successor() != block && !HasPhis(block) &&
1689 !block->IsIndirectEntry();
1690}

◆ IsErrorClassId()

bool dart::IsErrorClassId ( intptr_t  index)
inline

Definition at line 321 of file class_id.h.

321 {
322 return (index >= kFirstErrorCid && index <= kLastErrorCid);
323}

◆ IsExternalPayloadClassId()

bool dart::IsExternalPayloadClassId ( classid_t  cid)
inline

Definition at line 472 of file class_id.h.

472 {
473 return cid == kPointerCid || IsExternalTypedDataClassId(cid);
474}

◆ IsExternalTypedDataClassId()

bool dart::IsExternalTypedDataClassId ( intptr_t  index)
inline

Definition at line 447 of file class_id.h.

447 {
448 return IsTypedDataBaseClassId(index) &&
449 ((index - kFirstTypedDataCid) % kNumTypedDataCidRemainders) ==
451}
const int kTypedDataCidRemainderExternal
Definition class_id.h:263

◆ IsFfiCompound()

static bool dart::IsFfiCompound ( Thread T,
const Object obj 
)
static

Definition at line 994 of file dart_api_impl.cc.

994 {
995 if (obj.IsNull()) {
996 return false;
997 }
998
999 // CFE guarantees we can only have direct subclasses of `Struct` and `Union`
1000 // (no implementations or indirect subclasses are allowed).
1001 const auto& klass = Class::Handle(Z, obj.clazz());
1002 const auto& super_klass = Class::Handle(Z, klass.SuperClass());
1003 if (super_klass.IsNull()) {
1004 // This means klass is Object.
1005 return false;
1006 }
1007 if (super_klass.Name() != Symbols::Struct().ptr() &&
1008 super_klass.Name() != Symbols::Union().ptr()) {
1009 return false;
1010 }
1011 const auto& library = Library::Handle(Z, super_klass.library());
1012 return library.url() == Symbols::DartFfi().ptr();
1013}

◆ IsFfiDynamicLibraryClassId()

bool dart::IsFfiDynamicLibraryClassId ( intptr_t  index)
inline

Definition at line 545 of file class_id.h.

545 {
546 return index == kDynamicLibraryCid;
547}

◆ IsFfiPointerClassId()

bool dart::IsFfiPointerClassId ( intptr_t  index)
inline

Definition at line 541 of file class_id.h.

541 {
542 return index == kPointerCid;
543}

◆ IsFfiPredefinedClassId()

bool dart::IsFfiPredefinedClassId ( classid_t  class_id)
inline

Definition at line 527 of file class_id.h.

527 {
528 switch (class_id) {
529 case kPointerCid:
530 case kDynamicLibraryCid:
531#define CASE_FFI_CID(name) case kFfi##name##Cid:
533#undef CASE_FFI_CID
534 return true;
535 default:
536 return false;
537 }
538 UNREACHABLE();
539}
#define CASE_FFI_CID(name)

◆ IsFfiTypeClassId()

bool dart::IsFfiTypeClassId ( intptr_t  index)
inline

Definition at line 513 of file class_id.h.

513 {
514 switch (index) {
515 case kPointerCid:
516 case kFfiNativeFunctionCid:
517#define CASE_FFI_CID(name) case kFfi##name##Cid:
519#undef CASE_FFI_CID
520 return true;
521 default:
522 return false;
523 }
524 UNREACHABLE();
525}
#define CLASS_LIST_FFI_TYPE_MARKER(V)
Definition class_id.h:165

◆ IsForwarding()

static DART_FORCE_INLINE bool dart::IsForwarding ( uword  header)
static

Definition at line 66 of file scavenger.cc.

66 {
68 ASSERT((bits == kNotForwarded) || (bits == kForwarded));
69 return bits == kForwarded;
70}

◆ IsForwardingObject()

static bool dart::IsForwardingObject ( ObjectPtr  object)
static

Definition at line 50 of file become.cc.

50 {
51 return object->IsHeapObject() && object->IsForwardingCorpse();
52}

◆ IsFpCompare()

static bool dart::IsFpCompare ( ComparisonInstr comp)
static

Definition at line 3513 of file il.cc.

3513 {
3514 if (comp->IsRelationalOp()) {
3515 return comp->operation_cid() == kDoubleCid;
3516 }
3517 return false;
3518}
intptr_t operation_cid() const
Definition il.h:3860

◆ IsFpuArgumentRegister()

static constexpr bool dart::IsFpuArgumentRegister ( FpuRegister  reg)
staticconstexpr

Definition at line 81 of file constants.h.

81 {
82 return ((1 << reg) & CallingConventions::kFpuArgumentRegisters) != 0;
83}

◆ IsFunctionVisible()

static bool dart::IsFunctionVisible ( const Function function)
static

Definition at line 1286 of file debugger.cc.

1286 {
1287 return FLAG_show_invisible_frames || function.is_visible();
1288}

◆ IsHexCharacter()

static bool dart::IsHexCharacter ( int32_t  c)
static

Definition at line 23952 of file object.cc.

23952 {
23953 if (c >= '0' && c <= '9') {
23954 return true;
23955 }
23956 if (c >= 'A' && c <= 'F') {
23957 return true;
23958 }
23959 return false;
23960}

◆ IsHexDigit()

static bool dart::IsHexDigit ( char  value)
static

Definition at line 43 of file uri.cc.

43 {
44 return ((value >= '0' && value <= '9') || (value >= 'A' && value <= 'F') ||
45 (value >= 'a' && value <= 'f'));
46}

◆ IsIdentChar()

static bool dart::IsIdentChar ( int32_t  c)
static

Definition at line 13325 of file object.cc.

13325 {
13326 return IsLetter(c) || IsDecimalDigit(c) || (c == '_') || (c == '$');
13327}
static bool IsDecimalDigit(int32_t c)
Definition object.cc:13317
static bool IsLetter(int32_t c)
Definition object.cc:13313

◆ IsIdenticalConstants()

static bool dart::IsIdenticalConstants ( const Object left,
const Object right 
)
static

Definition at line 83 of file constant_propagator.cc.

83 {
84 // This should be kept in line with Identical_comparison (identical.cc)
85 // (=> Instance::IsIdenticalTo in object.cc).
86
87 if (left.ptr() == right.ptr()) return true;
88 if (left.GetClassId() != right.GetClassId()) return false;
89 if (left.IsInteger()) {
90 return Integer::Cast(left).Equals(Integer::Cast(right));
91 }
92 if (left.IsDouble()) {
93 return Double::Cast(left).BitwiseEqualsToDouble(
94 Double::Cast(right).value());
95 }
96 return false;
97}

◆ IsIdentStartChar()

static bool dart::IsIdentStartChar ( int32_t  c)
static

Definition at line 13321 of file object.cc.

13321 {
13322 return IsLetter(c) || (c == '_') || (c == '$');
13323}

◆ IsImplicitFieldClassId()

bool dart::IsImplicitFieldClassId ( intptr_t  index)
inline

Definition at line 556 of file class_id.h.

556 {
557 return index == kByteBufferCid;
558}

◆ IsImplicitFunction()

static bool dart::IsImplicitFunction ( const Function func)
static

Definition at line 393 of file debugger.cc.

393 {
394 switch (func.kind()) {
395 case UntaggedFunction::kImplicitGetter:
396 case UntaggedFunction::kImplicitSetter:
397 case UntaggedFunction::kImplicitStaticGetter:
398 case UntaggedFunction::kFieldInitializer:
399 case UntaggedFunction::kMethodExtractor:
400 case UntaggedFunction::kNoSuchMethodDispatcher:
401 case UntaggedFunction::kInvokeFieldDispatcher:
402 case UntaggedFunction::kIrregexpFunction:
403 case UntaggedFunction::kRecordFieldGetter:
404 return true;
405 default:
406 if (func.token_pos() == func.end_token_pos()) {
407 // |func| could be an implicit constructor for example.
408 return true;
409 }
410 }
411 return false;
412}

◆ IsInlineableOperator()

static bool dart::IsInlineableOperator ( const Function function)
static

Definition at line 2468 of file inliner.cc.

2468 {
2469 return (function.name() == Symbols::IndexToken().ptr()) ||
2470 (function.name() == Symbols::AssignIndexToken().ptr()) ||
2471 (function.name() == Symbols::Plus().ptr()) ||
2472 (function.name() == Symbols::Minus().ptr());
2473}

◆ IsInstructionEndPosition()

static bool dart::IsInstructionEndPosition ( intptr_t  pos)
static

Definition at line 46 of file linearscan.cc.

46 {
47 return (pos & 1) == 1;
48}

◆ IsInstructionStartPosition()

static bool dart::IsInstructionStartPosition ( intptr_t  pos)
static

Definition at line 42 of file linearscan.cc.

42 {
43 return (pos & 1) == 0;
44}

◆ IsIntegerClassId()

bool dart::IsIntegerClassId ( intptr_t  index)
inline

Definition at line 340 of file class_id.h.

340 {
341 // Make sure this function is updated when new Integer types are added.
342 COMPILE_ASSERT(kSmiCid == kIntegerCid + 1 && kMintCid == kIntegerCid + 2);
343 return (index >= kIntegerCid && index <= kMintCid);
344}

◆ IsIntegerOrDouble()

static bool dart::IsIntegerOrDouble ( const Object value)
static

Definition at line 1284 of file constant_propagator.cc.

1284 {
1285 return value.IsInteger() || value.IsDouble();
1286}

◆ IsInternalOnlyClassId()

bool dart::IsInternalOnlyClassId ( intptr_t  index)
inline

Definition at line 299 of file class_id.h.

299 {
300 // Fix the condition below if these become non-contiguous.
301 COMPILE_ASSERT(kIllegalCid + 1 == kNativePointer &&
302 kIllegalCid + 2 == kFreeListElement &&
303 kIllegalCid + 3 == kForwardingCorpse &&
304 kIllegalCid + 4 == kObjectCid &&
305 kIllegalCid + 5 == kFirstInternalOnlyCid);
306 return index <= kLastInternalOnlyCid;
307}

◆ IsInternalVMdefinedClassId()

bool dart::IsInternalVMdefinedClassId ( intptr_t  index)
inline

Definition at line 549 of file class_id.h.

549 {
550 return ((index < kNumPredefinedCids) && !IsImplicitFieldClassId(index));
551}
bool IsImplicitFieldClassId(intptr_t index)
Definition class_id.h:556

◆ IsInterruptLimit()

static bool dart::IsInterruptLimit ( uword  limit)
static

Definition at line 700 of file thread.cc.

700 {
701 return (limit & ~Thread::kInterruptsMask) ==
702 (kInterruptStackLimit & ~Thread::kInterruptsMask);
703}

◆ IsITypeImm()

bool dart::IsITypeImm ( intptr_t  imm)
inline

Definition at line 1050 of file constants_riscv.h.

1050 {
1051 return Utils::IsInt(12, imm);
1052}

◆ IsJTypeImm()

bool dart::IsJTypeImm ( intptr_t  imm)
inline

Definition at line 1029 of file constants_riscv.h.

1029 {
1030 return Utils::IsInt(20, imm) && Utils::IsAligned(imm, 2);
1031}

◆ IsLengthOneString()

static bool dart::IsLengthOneString ( Definition d)
static

Definition at line 277 of file call_specializer.cc.

277 {
278 if (d->IsConstant()) {
279 const Object& obj = d->AsConstant()->value();
280 if (obj.IsString()) {
281 return String::Cast(obj).Length() == 1;
282 } else {
283 return false;
284 }
285 } else {
286 return d->IsOneByteStringFromCharCode();
287 }
288}

◆ IsLetter()

static bool dart::IsLetter ( int32_t  c)
static

Definition at line 13313 of file object.cc.

13313 {
13314 return (('A' <= c) && (c <= 'Z')) || (('a' <= c) && (c <= 'z'));
13315}

◆ IsLinkedHashBase()

static bool dart::IsLinkedHashBase ( const Object object)
static

Definition at line 6892 of file object_test.cc.

◆ IsLoadEliminationCandidate()

static bool dart::IsLoadEliminationCandidate ( Instruction instr)
static

Definition at line 1425 of file redundancy_elimination.cc.

1425 {
1426 if (instr->IsDefinition() &&
1427 instr->AsDefinition()->MayCreateUnsafeUntaggedPointer()) {
1428 return false;
1429 }
1430 if (auto* load = instr->AsLoadField()) {
1431 if (load->slot().is_weak()) {
1432 return false;
1433 }
1434 }
1435 return instr->IsLoadField() || instr->IsLoadIndexed() ||
1436 instr->IsLoadStaticField();
1437}
SI T load(const P *ptr)

◆ IsLoopInvariantLoad()

static bool dart::IsLoopInvariantLoad ( ZoneGrowableArray< BitVector * > *  sets,
intptr_t  loop_header_index,
Instruction instr 
)
static

Definition at line 1439 of file redundancy_elimination.cc.

1441 {
1442 return IsLoadEliminationCandidate(instr) && (sets != nullptr) &&
1443 HasPlaceId(instr) &&
1444 (*sets)[loop_header_index]->Contains(GetPlaceId(instr));
1445}
static DART_FORCE_INLINE intptr_t GetPlaceId(const Instruction *instr)
static bool IsLoadEliminationCandidate(Instruction *instr)

◆ IsMarked()

static bool dart::IsMarked ( BlockEntryInstr block,
GrowableArray< BlockEntryInstr * > *  preorder 
)
static

Definition at line 1679 of file il.cc.

1680 {
1681 // Detect that a block has been visited as part of the current
1682 // DiscoverBlocks (we can call DiscoverBlocks multiple times). The block
1683 // will be 'marked' by (1) having a preorder number in the range of the
1684 // preorder array and (2) being in the preorder array at that index.
1685 intptr_t i = block->preorder_number();
1686 return (i >= 0) && (i < preorder->length()) && ((*preorder)[i] == block);
1687}

◆ IsMarkedWithNoBoundsChecks()

static bool dart::IsMarkedWithNoBoundsChecks ( const Function function)
static

Definition at line 43 of file flow_graph.cc.

43 {
44 Object& options = Object::Handle();
45 return Library::FindPragma(dart::Thread::Current(),
46 /*only_core=*/false, function,
47 Symbols::vm_unsafe_no_bounds_checks(),
48 /*multiple=*/false, &options);
49}
static Thread * Current()
Definition thread.h:361

◆ IsMarkedWithNoInterrupts()

static bool dart::IsMarkedWithNoInterrupts ( const Function function)
static

Definition at line 4547 of file redundancy_elimination.cc.

4547 {
4548 Object& options = Object::Handle();
4549 return Library::FindPragma(dart::Thread::Current(),
4550 /*only_core=*/false, function,
4551 Symbols::vm_unsafe_no_interrupts(),
4552 /*multiple=*/false, &options);
4553}

◆ IsNull()

DART_EXPORT bool dart::IsNull ( Dart_Handle  object)

Definition at line 1321 of file ffi_test_functions_vmspecific.cc.

1321 {
1322 return Dart_IsNull(object);
1323}
DART_EXPORT bool Dart_IsNull(Dart_Handle object)

◆ IsNumberCid()

static bool dart::IsNumberCid ( intptr_t  cid)
static

Definition at line 41 of file call_specializer.cc.

41 {
42 return (cid == kSmiCid) || (cid == kDoubleCid);
43}

◆ IsNumberClassId()

bool dart::IsNumberClassId ( intptr_t  index)
inline

Definition at line 333 of file class_id.h.

333 {
334 // Make sure this function is updated when new Number types are added.
335 COMPILE_ASSERT(kIntegerCid == kNumberCid + 1 && kSmiCid == kNumberCid + 2 &&
336 kMintCid == kNumberCid + 3 && kDoubleCid == kNumberCid + 4);
337 return (index >= kNumberCid && index <= kDoubleCid);
338}

◆ IsObjectIdChar()

static bool dart::IsObjectIdChar ( char  c)
static

Definition at line 2777 of file service.cc.

2777 {
2778 return IsAlphaNum(c) || c == '/' || c == '-' || c == '@' || c == '%';
2779}
static bool IsAlphaNum(char c)
Definition service.cc:2768

◆ IsObjectInstruction()

static bool dart::IsObjectInstruction ( DeoptInstr::Kind  kind)
static

Definition at line 224 of file deopt_instructions.cc.

224 {
225 switch (kind) {
226 case DeoptInstr::kConstant:
227 case DeoptInstr::kPp:
228 case DeoptInstr::kCallerPp:
229 case DeoptInstr::kMaterializedObjectRef:
230 case DeoptInstr::kFloat32x4:
231 case DeoptInstr::kInt32x4:
232 case DeoptInstr::kFloat64x2:
233 case DeoptInstr::kWord:
234 case DeoptInstr::kFloat:
235 case DeoptInstr::kDouble:
236 case DeoptInstr::kMint:
237 case DeoptInstr::kMintPair:
238 case DeoptInstr::kInt32:
239 case DeoptInstr::kUint32:
240 return true;
241
242 case DeoptInstr::kRetAddress:
243 case DeoptInstr::kPcMarker:
244 case DeoptInstr::kCallerFp:
245 case DeoptInstr::kCallerPc:
246 return false;
247
248 case DeoptInstr::kMaterializeObject:
249 default:
250 // We should not encounter these instructions when filling stack slots.
251 UNREACHABLE();
252 return false;
253 }
254 UNREACHABLE();
255 return false;
256}

◆ IsOfTypeNullabilityHelper()

static Dart_Handle dart::IsOfTypeNullabilityHelper ( Dart_Handle  type,
Nullability  nullability,
bool *  result 
)
static

Definition at line 5646 of file dart_api_impl.cc.

5648 {
5649 DARTSCOPE(Thread::Current());
5650 const Type& ty = Api::UnwrapTypeHandle(Z, type);
5651 if (ty.IsNull()) {
5652 *result = false;
5654 }
5655 *result = (ty.nullability() == nullability);
5656 return Api::Success();
5657}
Nullability nullability() const
Definition object.h:9037

◆ ISOLATE_UNIT_TEST_CASE() [1/463]

dart::ISOLATE_UNIT_TEST_CASE ( AbstractType_NormalizeFutureOrType  )

Definition at line 7643 of file object_test.cc.

7644 {
7645 ObjectStore* const object_store = IsolateGroup::Current()->object_store();
7646 const auto& future_class = Class::Handle(object_store->future_class());
7647 const auto& tav = TypeArguments::Handle(TypeArguments::New(1));
7648 tav.SetTypeAt(0, param);
7649 const auto& type = Type::Handle(Type::New(future_class, tav, nullability));
7650 return Type::RawCast(
7651 ClassFinalizer::FinalizeType(type, ClassFinalizer::kFinalize));
7652}
7653
7654ISOLATE_UNIT_TEST_CASE(AbstractType_NormalizeFutureOrType) {
7655 // This should be kept up to date with any changes in
7656 // https://github.com/dart-lang/language/blob/master/resources/type-system/normalization.md
7657
7658 ObjectStore* const object_store = IsolateGroup::Current()->object_store();
7659
7660 auto normalized_future_or = [&](const AbstractType& param,
7661 Nullability nullability) -> AbstractTypePtr {
7662 const auto& type = Type::Handle(CreateFutureOrType(param, nullability));
7663 return type.NormalizeFutureOrType(Heap::kNew);
7664 };
7665
7666 // NORM(FutureOr<T>) =
7667 // let S be NORM(T)
7668 // if S is a top type then S
7669 {
7670 const auto& type = AbstractType::Handle(normalized_future_or(
7671 Object::dynamic_type(), Nullability::kNonNullable));
7672 EXPECT_TYPES_SYNTACTICALLY_EQUIVALENT(Object::dynamic_type(), type);
7673 }
7674
7675 {
7676 const auto& type = AbstractType::Handle(
7677 normalized_future_or(Object::void_type(), Nullability::kNonNullable));
7678 EXPECT_TYPES_SYNTACTICALLY_EQUIVALENT(Object::void_type(), type);
7679 }
7680
7681 {
7682 const auto& type_nullable_object =
7683 Type::Handle(object_store->nullable_object_type());
7684 const auto& type = AbstractType::Handle(
7685 normalized_future_or(type_nullable_object, Nullability::kNonNullable));
7686 EXPECT_TYPES_SYNTACTICALLY_EQUIVALENT(type_nullable_object, type);
7687 }
7688
7689 // if S is Object then S
7690
7691 {
7692 const auto& type_non_nullable_object =
7693 Type::Handle(object_store->non_nullable_object_type());
7694 const auto& type = AbstractType::Handle(normalized_future_or(
7695 type_non_nullable_object, Nullability::kNonNullable));
7696 EXPECT_TYPES_SYNTACTICALLY_EQUIVALENT(type_non_nullable_object, type);
7697 }
7698
7699 // if S is Object* then S
7700
7701 {
7702 const auto& type_legacy_object =
7703 Type::Handle(object_store->legacy_object_type());
7704 const auto& type = AbstractType::Handle(
7705 normalized_future_or(type_legacy_object, Nullability::kNonNullable));
7706 EXPECT_TYPES_SYNTACTICALLY_EQUIVALENT(type_legacy_object, type);
7707 }
7708
7709 // if S is Never then Future<Never>
7710
7711 {
7712 const auto& type_never = Type::Handle(object_store->never_type());
7713 const auto& expected =
7714 Type::Handle(CreateFutureType(type_never, Nullability::kNonNullable));
7715 const auto& got = AbstractType::Handle(
7716 normalized_future_or(type_never, Nullability::kNonNullable));
7718 }
7719
7720 // if S is Null then Future<Null>?
7721
7722 {
7723 const auto& type_null = Type::Handle(object_store->null_type());
7724 const auto& expected =
7725 Type::Handle(CreateFutureType(type_null, Nullability::kNullable));
7726 const auto& got = AbstractType::Handle(
7727 normalized_future_or(type_null, Nullability::kNonNullable));
7729 }
7730
7731 // else FutureOr<S>
7732
7733 // NORM(T?) =
7734 // let S be NORM(T)
7735 // ...
7736 // if S is FutureOr<R> and R is nullable then S
static TypePtr CreateFutureType(const AbstractType &param, Nullability nullability)
#define ISOLATE_UNIT_TEST_CASE(name)
Definition unit_test.h:64

◆ ISOLATE_UNIT_TEST_CASE() [2/463]

dart::ISOLATE_UNIT_TEST_CASE ( AllocateScopeHandle  )

Definition at line 40 of file handles_test.cc.

40 {
41#if defined(DEBUG)
42 FLAG_trace_handles = true;
43#endif
44 int32_t handle_count = VMHandles::ScopedHandleCount();
45 const int kNumHandles = 65;
46 // Create some scoped handles.
47 {
48 Thread* thread = Thread::Current();
49 HANDLESCOPE(thread);
50 for (int i = 0; i < kNumHandles; i++) {
51 const Smi& handle = Smi::Handle(Smi::New(i));
52 EXPECT(handle.IsSmi());
53 EXPECT_EQ(i, handle.Value());
54 }
55 EXPECT_EQ((handle_count + kNumHandles), VMHandles::ScopedHandleCount());
56 // Create lots of scoped handles in a loop with a nested scope.
57 for (int loop = 0; loop < 1000; loop++) {
58 HANDLESCOPE(thread);
59 for (int i = 0; i < 2; i++) {
60 const Smi& handle = Smi::Handle(Smi::New(i + loop));
61 EXPECT(handle.IsSmi());
62 EXPECT_EQ(i + loop, handle.Value());
63 }
64 EXPECT_EQ((handle_count + kNumHandles + 2),
65 VMHandles::ScopedHandleCount());
66 }
67 EXPECT_EQ((handle_count + kNumHandles), VMHandles::ScopedHandleCount());
68 for (int i = 0; i < kNumHandles; i++) {
69 const Smi& handle = Smi::Handle(Smi::New(i));
70 EXPECT(handle.IsSmi());
71 EXPECT_EQ(i, handle.Value());
72 }
73 EXPECT_EQ((handle_count + (2 * kNumHandles)),
74 VMHandles::ScopedHandleCount());
75 }
76 EXPECT_EQ(handle_count, VMHandles::ScopedHandleCount());
77}

◆ ISOLATE_UNIT_TEST_CASE() [3/463]

dart::ISOLATE_UNIT_TEST_CASE ( AllocateZoneHandle  )

Definition at line 16 of file handles_test.cc.

16 {
17#if defined(DEBUG)
18 FLAG_trace_handles = true;
19#endif
20 // The previously run stub code generation may have created zone handles.
21 int initial_count = VMHandles::ZoneHandleCount();
22 const int kNumHandles = 65;
23 // Create some zone handles.
24 for (int i = 0; i < kNumHandles; i++) {
25 const Smi& handle = Smi::ZoneHandle(Smi::New(i));
26 EXPECT(handle.IsSmi());
27 EXPECT_EQ(i, handle.Value());
28 }
29 EXPECT_EQ(kNumHandles + initial_count, VMHandles::ZoneHandleCount());
30 // Create some more zone handles.
31 for (int i = kNumHandles; i < (2 * kNumHandles); i++) {
32 const Smi& handle = Smi::ZoneHandle(Smi::New(i));
33 EXPECT(handle.IsSmi());
34 EXPECT_EQ(i, handle.Value());
35 }
36 EXPECT_EQ((2 * kNumHandles) + initial_count, VMHandles::ZoneHandleCount());
37}

◆ ISOLATE_UNIT_TEST_CASE() [4/463]

dart::ISOLATE_UNIT_TEST_CASE ( AllocationSinking_Arrays  )

Definition at line 1208 of file redundancy_elimination_test.cc.

1208 {
1209 const char* kScript = R"(
1210import 'dart:typed_data';
1211
1212class Vector2 {
1213 final Float64List _v2storage;
1214
1215 @pragma('vm:prefer-inline')
1216 Vector2.zero() : _v2storage = Float64List(2);
1217
1218 @pragma('vm:prefer-inline')
1219 factory Vector2(double x, double y) => Vector2.zero()..setValues(x, y);
1220
1221 @pragma('vm:prefer-inline')
1222 factory Vector2.copy(Vector2 other) => Vector2.zero()..setFrom(other);
1223
1224 @pragma('vm:prefer-inline')
1225 Vector2 clone() => Vector2.copy(this);
1226
1227 @pragma('vm:prefer-inline')
1228 void setValues(double x_, double y_) {
1229 _v2storage[0] = x_;
1230 _v2storage[1] = y_;
1231 }
1232
1233 @pragma('vm:prefer-inline')
1234 void setFrom(Vector2 other) {
1235 final otherStorage = other._v2storage;
1236 _v2storage[1] = otherStorage[1];
1237 _v2storage[0] = otherStorage[0];
1238 }
1239
1240 @pragma('vm:prefer-inline')
1241 Vector2 operator +(Vector2 other) => clone()..add(other);
1242
1243 @pragma('vm:prefer-inline')
1244 void add(Vector2 arg) {
1245 final argStorage = arg._v2storage;
1246 _v2storage[0] = _v2storage[0] + argStorage[0];
1247 _v2storage[1] = _v2storage[1] + argStorage[1];
1248 }
1249
1250 @pragma('vm:prefer-inline')
1251 double get x => _v2storage[0];
1252
1253 @pragma('vm:prefer-inline')
1254 double get y => _v2storage[1];
1255}
1256
1257@pragma('vm:never-inline')
1258String foo(double x) {
1259 // All allocations in this function are eliminated by the compiler,
1260 // except array allocation for string interpolation at the end.
1261 List v1 = List.filled(2, null);
1262 v1[0] = 1;
1263 v1[1] = 'hi';
1264 Vector2 v2 = new Vector2(1.0, 2.0);
1265 Vector2 v3 = v2 + Vector2(x, x);
1266 double sum = v3.x + v3.y;
1267 return "v1: [${v1[0]},${v1[1]}], v2: [${v2.x},${v2.y}], v3: [${v3.x},${v3.y}], sum: $sum";
1268}
1269
1270main() {
1271 foo(42.0);
1272}
1273 )";
1274
1275 const auto& root_library = Library::Handle(LoadTestScript(kScript));
1276 Invoke(root_library, "main");
1277 const auto& function = Function::Handle(GetFunction(root_library, "foo"));
1278 TestPipeline pipeline(function, CompilerPass::kJIT);
1279 FlowGraph* flow_graph = pipeline.RunPasses({});
1280 ASSERT(flow_graph != nullptr);
1281
1282 auto entry = flow_graph->graph_entry()->normal_entry();
1283 EXPECT(entry != nullptr);
1284
1285 /* Flow graph to match:
1286
1287 4: CheckStackOverflow:8(stack=0, loop=0)
1288 5: ParallelMove rax <- S+2
1289 6: CheckClass:14(v2 Cids[1: _Double@0150898 etc. cid 62] nullcheck)
1290 8: v312 <- Unbox:14(v2 T{_Double}) T{_Double}
1291 10: ParallelMove xmm1 <- C
1292 10: v221 <- BinaryDoubleOp:22(+, v341, v312) T{_Double}
1293 11: ParallelMove DS-7 <- xmm1
1294 12: ParallelMove xmm2 <- C
1295 12: v227 <- BinaryDoubleOp:34(+, v342, v312) T{_Double}
1296 13: ParallelMove DS-6 <- xmm2
1297 14: v333 <- Box(v221) T{_Double}
1298 15: ParallelMove S-4 <- rax
1299 16: v334 <- Box(v227) T{_Double}
1300 17: ParallelMove S-3 <- rcx
1301 18: ParallelMove xmm0 <- xmm1
1302 18: v15 <- BinaryDoubleOp:28(+, v221, v227) T{_Double}
1303 19: ParallelMove rbx <- C, r10 <- C, DS-5 <- xmm0
1304 20: v17 <- CreateArray:30(v0, v16) T{_List}
1305 21: ParallelMove rcx <- rax
1306 22: StoreIndexed(v17, v5, v18, NoStoreBarrier)
1307 24: StoreIndexed(v17, v6, v6, NoStoreBarrier)
1308 26: StoreIndexed(v17, v3, v20, NoStoreBarrier)
1309 28: StoreIndexed(v17, v21, v7, NoStoreBarrier)
1310 30: StoreIndexed(v17, v23, v24, NoStoreBarrier)
1311 32: StoreIndexed(v17, v25, v8, NoStoreBarrier)
1312 34: StoreIndexed(v17, v27, v20, NoStoreBarrier)
1313 36: StoreIndexed(v17, v28, v9, NoStoreBarrier)
1314 38: StoreIndexed(v17, v30, v31, NoStoreBarrier)
1315 39: ParallelMove rax <- S-4
1316 40: StoreIndexed(v17, v32, v333, NoStoreBarrier)
1317 42: StoreIndexed(v17, v34, v20, NoStoreBarrier)
1318 43: ParallelMove rax <- S-3
1319 44: StoreIndexed(v17, v35, v334, NoStoreBarrier)
1320 46: StoreIndexed(v17, v37, v38, NoStoreBarrier)
1321 47: ParallelMove xmm0 <- DS-5
1322 48: v335 <- Box(v15) T{_Double}
1323 49: ParallelMove rdx <- rcx, rax <- rax
1324 50: StoreIndexed(v17, v39, v335)
1325 52: MoveArgument(v17)
1326 54: v40 <- StaticCall:44( _interpolate@0150898<0> v17,
1327 recognized_kind = StringBaseInterpolate) T{String?}
1328 56: Return:48(v40)
1329*/
1330
1331 CreateArrayInstr* create_array = nullptr;
1332 StaticCallInstr* string_interpolate = nullptr;
1333
1334 ILMatcher cursor(flow_graph, entry, /*trace=*/true,
1335 ParallelMovesHandling::kSkip);
1336 RELEASE_ASSERT(cursor.TryMatch({
1337 kMatchAndMoveFunctionEntry,
1338 kMatchAndMoveCheckStackOverflow,
1339 }));
1340 RELEASE_ASSERT(cursor.TryMatch({
1341 kMatchAndMoveUnbox,
1342 kMatchAndMoveBinaryDoubleOp,
1343 kMatchAndMoveBinaryDoubleOp,
1344 kMatchAndMoveBox,
1345 kMatchAndMoveBox,
1346 kMatchAndMoveBinaryDoubleOp,
1347 {kMatchAndMoveCreateArray, &create_array},
1348 kMatchAndMoveStoreIndexed,
1349 kMatchAndMoveStoreIndexed,
1350 kMatchAndMoveStoreIndexed,
1351 kMatchAndMoveStoreIndexed,
1352 kMatchAndMoveStoreIndexed,
1353 kMatchAndMoveStoreIndexed,
1354 kMatchAndMoveStoreIndexed,
1355 kMatchAndMoveStoreIndexed,
1356 kMatchAndMoveStoreIndexed,
1357 kMatchAndMoveStoreIndexed,
1358 kMatchAndMoveStoreIndexed,
1359 kMatchAndMoveStoreIndexed,
1360 kMatchAndMoveStoreIndexed,
1361 kMatchAndMoveBox,
1362 kMatchAndMoveStoreIndexed,
1363 kMatchAndMoveMoveArgument,
1364 {kMatchAndMoveStaticCall, &string_interpolate},
1365 kMatchDartReturn,
1366 }));
1367
1368 EXPECT(string_interpolate->ArgumentAt(0) == create_array);
1369}
GraphEntryInstr * graph_entry() const
Definition flow_graph.h:268
FunctionEntryInstr * normal_entry() const
Definition il.h:1986
FunctionPtr GetFunction(const Library &lib, const char *name)

◆ ISOLATE_UNIT_TEST_CASE() [5/463]

dart::ISOLATE_UNIT_TEST_CASE ( AllocationSinking_NoViewDataMaterialization  )

Definition at line 1743 of file redundancy_elimination_test.cc.

1743 {
1744 auto* const kFunctionName = "unalignedUint16";
1745 auto* const kInvokeNoDeoptName = "no_deopt";
1746 auto* const kInvokeDeoptName = "deopt";
1747 auto kScript = Utils::CStringUniquePtr(
1748 OS::SCreate(nullptr, R"(
1749 import 'dart:_internal';
1750 import 'dart:typed_data';
1751
1752 @pragma("vm:never-inline")
1753 void check(int x, int y) {
1754 if (x != y) {
1755 throw "Doesn't match";
1756 }
1757 }
1758
1759 @pragma("vm:never-inline")
1760 bool %s(num x) {
1761 var bytes = new ByteData(64);
1762 if (x is int) {
1763 for (var i = 2; i < 4; i++) {
1764 bytes.setUint16(i, x + 1, Endian.host);
1765 check(x + 1, bytes.getUint16(i, Endian.host));
1766 }
1767 } else {
1768 // Force a garbage collection after deoptimization. In DEBUG mode,
1769 // the scavenger tests that the view's data field was set correctly
1770 // during deoptimization before recomputing it.
1771 VMInternalsForTesting.collectAllGarbage();
1772 }
1773 // Make sure the array is also used on the non-int path.
1774 check(0, bytes.getUint16(0, Endian.host));
1775 return x is int;
1776 }
1777
1778 bool %s() {
1779 return %s(0xABCC);
1780 }
1781
1782 bool %s() {
1783 return %s(1.0);
1784 }
1785 )",
1786 kFunctionName, kInvokeNoDeoptName, kFunctionName,
1787 kInvokeDeoptName, kFunctionName),
1788 std::free);
1789
1790 const auto& lib =
1791 Library::Handle(LoadTestScript(kScript.get(), NoopNativeLookup));
1792 EXPECT(!lib.IsNull());
1793 if (lib.IsNull()) return;
1794
1795 const auto& function = Function::ZoneHandle(GetFunction(lib, kFunctionName));
1796 EXPECT(!function.IsNull());
1797 if (function.IsNull()) return;
1798
1799 // Run the unoptimized code.
1800 auto& result = Object::Handle(Invoke(lib, kInvokeNoDeoptName));
1801 EXPECT(Bool::Cast(result).value());
1802
1803 TestPipeline pipeline(function, CompilerPass::kJIT);
1804 FlowGraph* flow_graph = pipeline.RunPasses({
1805 CompilerPass::kComputeSSA,
1806 CompilerPass::kApplyICData,
1807 CompilerPass::kTryOptimizePatterns,
1808 CompilerPass::kSetOuterInliningId,
1809 CompilerPass::kTypePropagation,
1810 CompilerPass::kApplyClassIds,
1811 CompilerPass::kInlining,
1812 CompilerPass::kTypePropagation,
1813 CompilerPass::kApplyClassIds,
1814 CompilerPass::kTypePropagation,
1815 CompilerPass::kApplyICData,
1816 CompilerPass::kCanonicalize,
1817 CompilerPass::kBranchSimplify,
1818 CompilerPass::kIfConvert,
1819 CompilerPass::kCanonicalize,
1820 CompilerPass::kConstantPropagation,
1821 CompilerPass::kOptimisticallySpecializeSmiPhis,
1822 CompilerPass::kTypePropagation,
1823 CompilerPass::kWidenSmiToInt32,
1824 CompilerPass::kSelectRepresentations,
1825 CompilerPass::kCSE,
1826 CompilerPass::kCanonicalize,
1827 CompilerPass::kLICM,
1828 CompilerPass::kTryOptimizePatterns,
1829 CompilerPass::kSelectRepresentations,
1830 CompilerPass::kDSE,
1831 CompilerPass::kTypePropagation,
1832 CompilerPass::kSelectRepresentations,
1833 CompilerPass::kEliminateEnvironments,
1834 CompilerPass::kEliminateDeadPhis,
1835 CompilerPass::kDCE,
1836 CompilerPass::kCanonicalize,
1837 CompilerPass::kOptimizeBranches,
1838 });
1839
1840 // Check for the soon-to-be-sunk ByteDataView allocation.
1841
1842 auto entry = flow_graph->graph_entry()->normal_entry();
1843 EXPECT(entry != nullptr);
1844
1845 AllocateTypedDataInstr* alloc_typed_data = nullptr;
1846 AllocateObjectInstr* alloc_view = nullptr;
1847 StoreFieldInstr* store_view_typed_data = nullptr;
1848 StoreFieldInstr* store_view_offset_in_bytes = nullptr;
1849 StoreFieldInstr* store_view_length = nullptr;
1850 LoadFieldInstr* load_typed_data_payload = nullptr;
1851 StoreFieldInstr* store_view_payload = nullptr;
1852
1853 ILMatcher cursor(flow_graph, entry, true, ParallelMovesHandling::kSkip);
1854 EXPECT(cursor.TryMatch({
1855 kMoveGlob,
1856 {kMatchAndMoveAllocateTypedData, &alloc_typed_data},
1857 {kMatchAndMoveAllocateObject, &alloc_view},
1858 {kMatchAndMoveStoreField, &store_view_typed_data},
1859 {kMatchAndMoveStoreField, &store_view_offset_in_bytes},
1860 {kMatchAndMoveStoreField, &store_view_length},
1861 {kMatchAndMoveLoadField, &load_typed_data_payload},
1862 {kMatchAndMoveStoreField, &store_view_payload},
1863 }));
1864 if (store_view_payload == nullptr) return;
1865
1866 EXPECT_EQ(alloc_view, store_view_typed_data->instance()->definition());
1867 EXPECT(Slot::TypedDataView_typed_data().IsIdentical(
1868 store_view_typed_data->slot()));
1869 EXPECT_EQ(alloc_typed_data, store_view_typed_data->value()->definition());
1870
1871 EXPECT_EQ(alloc_view, store_view_length->instance()->definition());
1872 EXPECT(Slot::TypedDataBase_length().IsIdentical(store_view_length->slot()));
1873 EXPECT_EQ(alloc_typed_data->num_elements()->definition(),
1874 store_view_length->value()->definition());
1875
1876 EXPECT_EQ(alloc_view, store_view_offset_in_bytes->instance()->definition());
1877 EXPECT(Slot::TypedDataView_offset_in_bytes().IsIdentical(
1878 store_view_offset_in_bytes->slot()));
1879 EXPECT(store_view_offset_in_bytes->value()->BindsToSmiConstant());
1880 EXPECT_EQ(0, store_view_offset_in_bytes->value()->BoundSmiConstant());
1881
1882 EXPECT_EQ(alloc_typed_data,
1883 load_typed_data_payload->instance()->definition());
1884 EXPECT(Slot::PointerBase_data().IsIdentical(load_typed_data_payload->slot()));
1885
1886 EXPECT_EQ(alloc_view, store_view_payload->instance()->definition());
1887 EXPECT(Slot::PointerBase_data().IsIdentical(store_view_payload->slot()));
1888 EXPECT_EQ(load_typed_data_payload, store_view_payload->value()->definition());
1889
1890 // Setting the view data field is the only use of the unsafe payload load.
1891 EXPECT(load_typed_data_payload->HasOnlyUse(store_view_payload->value()));
1892
1893 pipeline.RunAdditionalPasses({
1894 CompilerPass::kAllocationSinking_Sink,
1895 });
1896
1897 // After sinking, the view allocation has been removed from the flow graph.
1898 EXPECT_EQ(nullptr, alloc_view->previous());
1899 EXPECT_EQ(nullptr, alloc_view->next());
1900 // There is at least one MaterializeObject instruction created for the view.
1901 intptr_t mat_count = 0;
1902 for (auto block_it = flow_graph->reverse_postorder_iterator();
1903 !block_it.Done(); block_it.Advance()) {
1904 for (ForwardInstructionIterator it(block_it.Current()); !it.Done();
1905 it.Advance()) {
1906 auto* const mat = it.Current()->AsMaterializeObject();
1907 if (mat == nullptr) continue;
1908 if (mat->allocation() == alloc_view) {
1909 ++mat_count;
1910 for (intptr_t i = 0; i < mat->InputCount(); i++) {
1911 // No slot of the materialization should correspond to the data field.
1912 EXPECT(mat->FieldOffsetAt(i) !=
1913 Slot::PointerBase_data().offset_in_bytes());
1914 // No input of the materialization should be a load of the typed
1915 // data object's payload.
1916 if (auto* const load = mat->InputAt(i)->definition()->AsLoadField()) {
1917 if (load->instance()->definition() == alloc_typed_data) {
1918 EXPECT(!load->slot().IsIdentical(Slot::PointerBase_data()));
1919 }
1920 }
1921 }
1922 }
1923 }
1924 }
1925 EXPECT(mat_count > 0);
1926 // There are no uses of the original unsafe payload load. In particular, no
1927 // MaterializeObject instructions use it.
1928 EXPECT(!load_typed_data_payload->HasUses());
1929
1930 pipeline.RunAdditionalPasses({
1931 CompilerPass::kEliminateDeadPhis,
1932 CompilerPass::kDCE,
1933 CompilerPass::kCanonicalize,
1934 CompilerPass::kTypePropagation,
1935 CompilerPass::kSelectRepresentations_Final,
1936 CompilerPass::kUseTableDispatch,
1937 CompilerPass::kEliminateStackOverflowChecks,
1938 CompilerPass::kCanonicalize,
1939 CompilerPass::kAllocationSinking_DetachMaterializations,
1940 CompilerPass::kEliminateWriteBarriers,
1941 CompilerPass::kLoweringAfterCodeMotionDisabled,
1942 CompilerPass::kFinalizeGraph,
1943 CompilerPass::kCanonicalize,
1944 CompilerPass::kReorderBlocks,
1945 CompilerPass::kAllocateRegisters,
1946 CompilerPass::kTestILSerialization,
1947 });
1948
1949 // Finish the compilation and attach code so we can run it.
1950 pipeline.CompileGraphAndAttachFunction();
1951
1952 // Can run optimized code fine without deoptimization.
1953 result = Invoke(lib, kInvokeNoDeoptName);
1954 EXPECT(function.HasOptimizedCode());
1955 EXPECT(Bool::Cast(result).value());
1956
1957 // Can run code fine with deoptimization.
1958 result = Invoke(lib, kInvokeDeoptName);
1959 // Deoptimization has put us back to unoptimized code.
1960 EXPECT(!function.HasOptimizedCode());
1961 EXPECT(!Bool::Cast(result).value());
1962}

◆ ISOLATE_UNIT_TEST_CASE() [6/463]

dart::ISOLATE_UNIT_TEST_CASE ( AllocationSinking_Records  )

Definition at line 1371 of file redundancy_elimination_test.cc.

1371 {
1372 const char* kScript = R"(
1373
1374@pragma('vm:prefer-inline')
1375({int field1, String field2}) getRecord(int x, String y) =>
1376 (field1: x, field2: y);
1377
1378@pragma('vm:never-inline')
1379String foo(int x, String y) {
1380 // All allocations in this function are eliminated by the compiler,
1381 // except array allocation for string interpolation at the end.
1382 (int, bool) r1 = (x, true);
1383 final r2 = getRecord(x, y);
1384 int sum = r1.$1 + r2.field1;
1385 return "r1: (${r1.$1}, ${r1.$2}), "
1386 "r2: (field1: ${r2.field1}, field2: ${r2.field2}), sum: $sum";
1387}
1388
1389int count = 0;
1390main() {
1391 // Deoptimize on the 2nd run.
1392 return foo(count++ == 0 ? 42 : 9223372036854775807, 'hey');
1393}
1394 )";
1395
1396 const auto& root_library = Library::Handle(LoadTestScript(kScript));
1397 const auto& result1 = Object::Handle(Invoke(root_library, "main"));
1398 EXPECT(result1.IsString());
1399 EXPECT_STREQ(result1.ToCString(),
1400 "r1: (42, true), r2: (field1: 42, field2: hey), sum: 84");
1401 const auto& function = Function::Handle(GetFunction(root_library, "foo"));
1402 TestPipeline pipeline(function, CompilerPass::kJIT);
1403 FlowGraph* flow_graph = pipeline.RunPasses({});
1404 ASSERT(flow_graph != nullptr);
1405
1406 auto entry = flow_graph->graph_entry()->normal_entry();
1407 EXPECT(entry != nullptr);
1408
1409 /* Flow graph to match:
1410
1411 2: B1[function entry]:2 {
1412 v2 <- Parameter(0) [-9223372036854775808, 9223372036854775807] T{int}
1413 v3 <- Parameter(1) T{String}
1414}
1415 4: CheckStackOverflow:8(stack=0, loop=0)
1416 5: ParallelMove rax <- S+3
1417 6: CheckSmi:16(v2)
1418 8: ParallelMove rcx <- rax
1419 8: v9 <- BinarySmiOp:16(+, v2 T{_Smi}, v2 T{_Smi}) [-4611686018427387904, 4611686018427387903] T{_Smi}
1420 9: ParallelMove rbx <- C, r10 <- C, S-3 <- rcx
1421 10: v11 <- CreateArray:18(v0, v10) T{_List}
1422 11: ParallelMove rax <- rax
1423 12: StoreIndexed(v11, v12, v13, NoStoreBarrier)
1424 13: ParallelMove rcx <- S+3
1425 14: StoreIndexed(v11, v14, v2 T{_Smi}, NoStoreBarrier)
1426 16: StoreIndexed(v11, v16, v17, NoStoreBarrier)
1427 18: StoreIndexed(v11, v18, v5, NoStoreBarrier)
1428 20: StoreIndexed(v11, v20, v21, NoStoreBarrier)
1429 22: StoreIndexed(v11, v22, v2 T{_Smi}, NoStoreBarrier)
1430 24: StoreIndexed(v11, v24, v25, NoStoreBarrier)
1431 25: ParallelMove rcx <- S+2
1432 26: StoreIndexed(v11, v26, v3, NoStoreBarrier)
1433 28: StoreIndexed(v11, v28, v29, NoStoreBarrier)
1434 29: ParallelMove rcx <- S-3
1435 30: StoreIndexed(v11, v30, v9, NoStoreBarrier)
1436 32: MoveArgument(v11)
1437 34: v31 <- StaticCall:20( _interpolate@0150898<0> v11, recognized_kind = StringBaseInterpolate) T{String}
1438 35: ParallelMove rax <- rax
1439 36: Return:24(v31)
1440*/
1441
1442 ILMatcher cursor(flow_graph, entry, /*trace=*/true,
1443 ParallelMovesHandling::kSkip);
1444 RELEASE_ASSERT(cursor.TryMatch({
1445 kMatchAndMoveFunctionEntry,
1446 kMatchAndMoveCheckStackOverflow,
1447 kMatchAndMoveCheckSmi,
1448 kMatchAndMoveBinarySmiOp,
1449 kMatchAndMoveCreateArray,
1450 kMatchAndMoveStoreIndexed,
1451 kMatchAndMoveStoreIndexed,
1452 kMatchAndMoveStoreIndexed,
1453 kMatchAndMoveStoreIndexed,
1454 kMatchAndMoveStoreIndexed,
1455 kMatchAndMoveStoreIndexed,
1456 kMatchAndMoveStoreIndexed,
1457 kMatchAndMoveStoreIndexed,
1458 kMatchAndMoveStoreIndexed,
1459 kMatchAndMoveStoreIndexed,
1460 kMatchAndMoveMoveArgument,
1461 kMatchAndMoveStaticCall,
1462 kMatchDartReturn,
1463 }));
1464
1465 Compiler::CompileOptimizedFunction(thread, function);
1466 const auto& result2 = Object::Handle(Invoke(root_library, "main"));
1467 EXPECT(result2.IsString());
1468 EXPECT_STREQ(result2.ToCString(),
1469 "r1: (9223372036854775807, true), r2: (field1: "
1470 "9223372036854775807, field2: hey), sum: -2");
1471}

◆ ISOLATE_UNIT_TEST_CASE() [7/463]

dart::ISOLATE_UNIT_TEST_CASE ( Array  )

Definition at line 1776 of file object_test.cc.

1776 {
1777 const int kArrayLen = 5;
1778 const Array& array = Array::Handle(Array::New(kArrayLen));
1779 EXPECT_EQ(kArrayLen, array.Length());
1780 Object& element = Object::Handle(array.At(0));
1781 EXPECT(element.IsNull());
1782 element = array.At(kArrayLen - 1);
1783 EXPECT(element.IsNull());
1784 array.SetAt(0, array);
1785 array.SetAt(2, array);
1786 element = array.At(0);
1787 EXPECT_EQ(array.ptr(), element.ptr());
1788 element = array.At(1);
1789 EXPECT(element.IsNull());
1790 element = array.At(2);
1791 EXPECT_EQ(array.ptr(), element.ptr());
1792
1793 Array& other_array = Array::Handle(Array::New(kArrayLen));
1794 other_array.SetAt(0, array);
1795 other_array.SetAt(2, array);
1796
1797 EXPECT(array.CanonicalizeEquals(array));
1798 EXPECT(array.CanonicalizeEquals(other_array));
1799
1800 other_array.SetAt(1, other_array);
1801 EXPECT(!array.CanonicalizeEquals(other_array));
1802
1803 other_array = Array::New(kArrayLen - 1);
1804 other_array.SetAt(0, array);
1805 other_array.SetAt(2, array);
1806 EXPECT(!array.CanonicalizeEquals(other_array));
1807
1808 EXPECT_EQ(0, Object::empty_array().Length());
1809
1810 array.MakeImmutable();
1811 Object& obj = Object::Handle(array.ptr());
1812 EXPECT(obj.IsArray());
1813}
virtual bool CanonicalizeEquals(const Instance &other) const
Definition object.cc:24781

◆ ISOLATE_UNIT_TEST_CASE() [8/463]

dart::ISOLATE_UNIT_TEST_CASE ( Array_Grow  )

Definition at line 1815 of file object_test.cc.

1815 {
1816 const intptr_t kSmallSize = 100;
1817 EXPECT(!Array::UseCardMarkingForAllocation(kSmallSize));
1818 const intptr_t kMediumSize = 1000;
1819 EXPECT(!Array::UseCardMarkingForAllocation(kMediumSize));
1820 const intptr_t kLargeSize = 100000;
1821 EXPECT(Array::UseCardMarkingForAllocation(kLargeSize));
1822
1823 const Array& small = Array::Handle(Array::New(kSmallSize));
1824 for (intptr_t i = 0; i < kSmallSize; i++) {
1825 small.SetAt(i, Smi::Handle(Smi::New(i)));
1826 }
1827
1828 const Array& medium = Array::Handle(Array::Grow(small, kMediumSize));
1829 EXPECT_EQ(kMediumSize, medium.Length());
1830 for (intptr_t i = 0; i < kSmallSize; i++) {
1831 EXPECT_EQ(Smi::New(i), medium.At(i));
1832 }
1833 for (intptr_t i = kSmallSize; i < kMediumSize; i++) {
1834 EXPECT_EQ(Object::null(), medium.At(i));
1835 }
1836
1837 const Array& large = Array::Handle(Array::Grow(small, kLargeSize));
1838 EXPECT_EQ(kLargeSize, large.Length());
1839 for (intptr_t i = 0; i < kSmallSize; i++) {
1840 EXPECT_EQ(large.At(i), Smi::New(i));
1841 }
1842 for (intptr_t i = kSmallSize; i < kLargeSize; i++) {
1843 EXPECT_EQ(large.At(i), Object::null());
1844 }
1845}

◆ ISOLATE_UNIT_TEST_CASE() [9/463]

dart::ISOLATE_UNIT_TEST_CASE ( ArrayTruncationPadding  )

Definition at line 755 of file heap_test.cc.

755 {
756 GrowableObjectArray& retain =
757 GrowableObjectArray::Handle(GrowableObjectArray::New());
758 Array& array = Array::Handle();
759
760 for (intptr_t big = 0; big < 256; big++) {
761 for (intptr_t small = 0; small < big; small++) {
762 array = Array::New(big);
763
764 // Fill the alignment gap with invalid pointers.
765 uword addr = UntaggedObject::ToAddr(array.ptr());
766 for (intptr_t offset = Array::UnroundedSize(big);
767 offset < Array::InstanceSize(big); offset += sizeof(uword)) {
768 *reinterpret_cast<uword*>(addr + offset) = kHeapObjectTag;
769 }
770
771 array.Truncate(small);
772 retain.Add(array);
773 }
774 }
775
776 IsolateGroup::Current()->heap()->Verify("truncation padding");
777}
void Truncate(intptr_t new_length) const
Definition object.cc:24973

◆ ISOLATE_UNIT_TEST_CASE() [10/463]

dart::ISOLATE_UNIT_TEST_CASE ( ArrayTruncationRaces  )

Definition at line 709 of file heap_test.cc.

709 {
710 // Alternate between allocating new lists and truncating.
711 // For each list, the life cycle is
712 // 1) the list is allocated and filled with some elements
713 // 2) kNumLists other lists are allocated
714 // 3) the list's backing store is truncated; the list becomes unreachable
715 // 4) kNumLists other lists are allocated
716 // 5) the backing store becomes unreachable
717 // The goal is to cause truncation *during* concurrent mark or sweep, by
718 // truncating an array that had been alive for a while and will be visited by
719 // a GC triggering by the allocations in step 2.
720
721 intptr_t kMaxListLength = 100;
722 intptr_t kNumLists = 1000;
723 Array& lists = Array::Handle(Array::New(kNumLists));
724 Array& arrays = Array::Handle(Array::New(kNumLists));
725
726 GrowableObjectArray& list = GrowableObjectArray::Handle();
727 Array& array = Array::Handle();
728 Object& element = Object::Handle();
729
730 for (intptr_t i = 0; i < kNumLists; i++) {
731 list = GrowableObjectArray::New(Heap::kNew);
732 intptr_t length = i % kMaxListLength;
733 for (intptr_t j = 0; j < length; j++) {
734 list.Add(element, Heap::kNew);
735 }
736 lists.SetAt(i, list);
737 }
738
739 intptr_t kTruncations = 100000;
740 for (intptr_t i = 0; i < kTruncations; i++) {
741 list ^= lists.At(i % kNumLists);
742 array = Array::MakeFixedLength(list);
743 arrays.SetAt(i % kNumLists, array);
744
745 list = GrowableObjectArray::New(Heap::kOld);
746 intptr_t length = i % kMaxListLength;
747 for (intptr_t j = 0; j < length; j++) {
748 list.Add(element, Heap::kOld);
749 }
750 lists.SetAt(i % kNumLists, list);
751 }
752}

◆ ISOLATE_UNIT_TEST_CASE() [11/463]

dart::ISOLATE_UNIT_TEST_CASE ( BasicInductionDown  )

Definition at line 110 of file loops_test.cc.

118 {
119 const char* script_chars =

◆ ISOLATE_UNIT_TEST_CASE() [12/463]

dart::ISOLATE_UNIT_TEST_CASE ( BasicInductionLoopNest  )

Definition at line 143 of file loops_test.cc.

144 {
145 foo();
146 }
147 )";
148 const char* expected =
149 " [0\n"
150 " LIN(10 + 2 * i)\n" // phi
151 " LIN(12 + 2 * i)\n" // add
152 " ]\n";
153 EXPECT_STREQ(expected, ComputeInduction(thread, script_chars));
154}
155
156ISOLATE_UNIT_TEST_CASE(BasicInductionStepDown) {
157 const char* script_chars =
158 R"(
159 foo() {
160 for (int i = 100; i >= 0; i -= 7) {

◆ ISOLATE_UNIT_TEST_CASE() [13/463]

dart::ISOLATE_UNIT_TEST_CASE ( BasicInductionStepDown  )

Definition at line 132 of file loops_test.cc.

137 {
138 const char* script_chars =
139 R"(
140 foo() {
141 for (int i = 10; i < 100; i += 2) {

◆ ISOLATE_UNIT_TEST_CASE() [14/463]

dart::ISOLATE_UNIT_TEST_CASE ( BasicInductionStepUp  )

Definition at line 121 of file loops_test.cc.

121 {
122 for (int i = 100; i > 0; i--) {
123 }
124 }
125 main() {
126 foo();
127 }
128 )";
129 const char* expected =
130 " [0\n"

◆ ISOLATE_UNIT_TEST_CASE() [15/463]

dart::ISOLATE_UNIT_TEST_CASE ( BasicInductionUp  )

Definition at line 99 of file loops_test.cc.

99 {
100 const char* script_chars =
101 R"(
102 foo() {
103 for (int i = 0; i < 100; i++) {
104 }
105 }
106 main() {
107 foo();
108 }

◆ ISOLATE_UNIT_TEST_CASE() [16/463]

dart::ISOLATE_UNIT_TEST_CASE ( BCEArithmeticWrapAround  )

Definition at line 138 of file bce_test.cc.

◆ ISOLATE_UNIT_TEST_CASE() [17/463]

dart::ISOLATE_UNIT_TEST_CASE ( BCEBubbleSort  )

Definition at line 132 of file bce_test.cc.

133 {
134 l[i] = 1;
135 }
136 }

◆ ISOLATE_UNIT_TEST_CASE() [18/463]

dart::ISOLATE_UNIT_TEST_CASE ( BCECannotRemove  )

Definition at line 78 of file bce_test.cc.

78 {
79 const char* kScriptChars =
80 R"(
81 import 'dart:typed_data';
82 foo(Float64List l) {

◆ ISOLATE_UNIT_TEST_CASE() [19/463]

dart::ISOLATE_UNIT_TEST_CASE ( BCEListNamedAndPlainLength  )

Definition at line 144 of file bce_test.cc.

144 {
145 const char* kScriptChars =
146 R"(
147 foo(int i) {
148 var l = List<int>.filled(3, 0);

◆ ISOLATE_UNIT_TEST_CASE() [20/463]

dart::ISOLATE_UNIT_TEST_CASE ( BCELowerTriangular  )

Definition at line 108 of file bce_test.cc.

109 :typed_data';
110 foo(Float64List l) {
111 for (int i = 0; i < l.length; i++) {
112 l[i] = 0;

◆ ISOLATE_UNIT_TEST_CASE() [21/463]

dart::ISOLATE_UNIT_TEST_CASE ( BCEModulo  )

Definition at line 102 of file bce_test.cc.

106 {

◆ ISOLATE_UNIT_TEST_CASE() [22/463]

dart::ISOLATE_UNIT_TEST_CASE ( BCENamedLength  )

Definition at line 126 of file bce_test.cc.

128 :typed_data';
129 foo(Float64List l) {
130 for (int i = l.length - 1; i >= 0; i--) {

◆ ISOLATE_UNIT_TEST_CASE() [23/463]

dart::ISOLATE_UNIT_TEST_CASE ( BCERemoveOne  )

Definition at line 84 of file bce_test.cc.

85 {
86 foo(new Float64List(1));
87 }
88 )";

◆ ISOLATE_UNIT_TEST_CASE() [24/463]

dart::ISOLATE_UNIT_TEST_CASE ( BCESimpleLoops  )

Definition at line 90 of file bce_test.cc.

92 {
93 const char* kScriptChars =
94 R"(

◆ ISOLATE_UNIT_TEST_CASE() [25/463]

dart::ISOLATE_UNIT_TEST_CASE ( BCESimpleLoopsDown  )

Definition at line 96 of file bce_test.cc.

96 {
97 return l[1] + l[0];
98 }
99 main() {
100 foo(new Float64List(2));

◆ ISOLATE_UNIT_TEST_CASE() [26/463]

dart::ISOLATE_UNIT_TEST_CASE ( BCETriangularDown  )

Definition at line 120 of file bce_test.cc.

◆ ISOLATE_UNIT_TEST_CASE() [27/463]

dart::ISOLATE_UNIT_TEST_CASE ( BCEUpperTriangular  )

Definition at line 114 of file bce_test.cc.

114 {
115 l[i] = 1;
116 }
117 }
118 main() {

◆ ISOLATE_UNIT_TEST_CASE() [28/463]

dart::ISOLATE_UNIT_TEST_CASE ( BecomeForwardMessageId  )

Definition at line 97 of file become_test.cc.

97 {
98 Isolate* isolate = Isolate::Current();
99 isolate->set_forward_table_new(new WeakTable());
100 isolate->set_forward_table_old(new WeakTable());
101
102 const Array& before_obj = Array::Handle(Array::New(0, Heap::kOld));
103 const Array& after_obj = Array::Handle(Array::New(0, Heap::kOld));
104 EXPECT(before_obj.ptr() != after_obj.ptr());
105
106 intptr_t id = 42;
107 intptr_t no_id = 0;
108 isolate->forward_table_old()->SetValueExclusive(before_obj.ptr(), id);
109 EXPECT_EQ(id,
110 isolate->forward_table_old()->GetValueExclusive(before_obj.ptr()));
111 EXPECT_EQ(no_id,
112 isolate->forward_table_old()->GetValueExclusive(after_obj.ptr()));
113
114 Become become;
115 become.Add(before_obj, after_obj);
116 become.Forward();
117
118 EXPECT(before_obj.ptr() == after_obj.ptr());
119 EXPECT_EQ(id,
120 isolate->forward_table_old()->GetValueExclusive(before_obj.ptr()));
121 EXPECT_EQ(id,
122 isolate->forward_table_old()->GetValueExclusive(after_obj.ptr()));
123
124 isolate->set_forward_table_new(nullptr);
125 isolate->set_forward_table_old(nullptr);
126}
void Add(const Object &before, const Object &after)
Definition become.cc:231
void Forward()
Definition become.cc:275
void set_forward_table_old(WeakTable *table)
Definition isolate.cc:2516
void set_forward_table_new(WeakTable *table)
Definition isolate.cc:2512
WeakTable * forward_table_old()
Definition isolate.h:1414
void SetValueExclusive(ObjectPtr key, intptr_t val)
Definition weak_table.cc:33
intptr_t GetValueExclusive(ObjectPtr key) const
Definition weak_table.h:109

◆ ISOLATE_UNIT_TEST_CASE() [29/463]

dart::ISOLATE_UNIT_TEST_CASE ( BecomeForwardNewToNew  )

Definition at line 41 of file become_test.cc.

41 {
42 TestBecomeForward(Heap::kNew, Heap::kNew);
43}
void TestBecomeForward(Heap::Space before_space, Heap::Space after_space)

◆ ISOLATE_UNIT_TEST_CASE() [30/463]

dart::ISOLATE_UNIT_TEST_CASE ( BecomeForwardNewToOld  )

Definition at line 49 of file become_test.cc.

49 {
50 TestBecomeForward(Heap::kNew, Heap::kOld);
51}

◆ ISOLATE_UNIT_TEST_CASE() [31/463]

dart::ISOLATE_UNIT_TEST_CASE ( BecomeForwardObjectId  )

Definition at line 75 of file become_test.cc.

75 {
76 Heap* heap = IsolateGroup::Current()->heap();
77
78 const Array& before_obj = Array::Handle(Array::New(0, Heap::kOld));
79 const Array& after_obj = Array::Handle(Array::New(0, Heap::kOld));
80 EXPECT(before_obj.ptr() != after_obj.ptr());
81
82 intptr_t id = 42;
83 intptr_t no_id = 0;
84 heap->SetObjectId(before_obj.ptr(), id);
85 EXPECT_EQ(id, heap->GetObjectId(before_obj.ptr()));
86 EXPECT_EQ(no_id, heap->GetObjectId(after_obj.ptr()));
87
88 Become become;
89 become.Add(before_obj, after_obj);
90 become.Forward();
91
92 EXPECT(before_obj.ptr() == after_obj.ptr());
93 EXPECT_EQ(id, heap->GetObjectId(before_obj.ptr()));
94 EXPECT_EQ(id, heap->GetObjectId(after_obj.ptr()));
95}
intptr_t GetObjectId(ObjectPtr raw_obj) const
Definition heap.h:197
void SetObjectId(ObjectPtr raw_obj, intptr_t object_id)
Definition heap.h:193

◆ ISOLATE_UNIT_TEST_CASE() [32/463]

dart::ISOLATE_UNIT_TEST_CASE ( BecomeForwardOldToNew  )

Definition at line 45 of file become_test.cc.

45 {
46 TestBecomeForward(Heap::kOld, Heap::kNew);
47}

◆ ISOLATE_UNIT_TEST_CASE() [33/463]

dart::ISOLATE_UNIT_TEST_CASE ( BecomeForwardOldToOld  )

Definition at line 37 of file become_test.cc.

37 {
38 TestBecomeForward(Heap::kOld, Heap::kOld);
39}

◆ ISOLATE_UNIT_TEST_CASE() [34/463]

dart::ISOLATE_UNIT_TEST_CASE ( BecomeForwardPeer  )

Definition at line 53 of file become_test.cc.

53 {
54 Heap* heap = IsolateGroup::Current()->heap();
55
56 const Array& before_obj = Array::Handle(Array::New(0, Heap::kOld));
57 const Array& after_obj = Array::Handle(Array::New(0, Heap::kOld));
58 EXPECT(before_obj.ptr() != after_obj.ptr());
59
60 void* peer = reinterpret_cast<void*>(42);
61 void* no_peer = reinterpret_cast<void*>(0);
62 heap->SetPeer(before_obj.ptr(), peer);
63 EXPECT_EQ(peer, heap->GetPeer(before_obj.ptr()));
64 EXPECT_EQ(no_peer, heap->GetPeer(after_obj.ptr()));
65
66 Become become;
67 become.Add(before_obj, after_obj);
68 become.Forward();
69
70 EXPECT(before_obj.ptr() == after_obj.ptr());
71 EXPECT_EQ(peer, heap->GetPeer(before_obj.ptr()));
72 EXPECT_EQ(peer, heap->GetPeer(after_obj.ptr()));
73}

◆ ISOLATE_UNIT_TEST_CASE() [35/463]

dart::ISOLATE_UNIT_TEST_CASE ( BecomeForwardRememberedCards  )

Definition at line 152 of file become_test.cc.

152 {
153 const intptr_t length = kNewAllocatableSize / Array::kBytesPerElement;
154 ASSERT(Array::UseCardMarkingForAllocation(length));
155 const Array& card_remembered_array = Array::Handle(Array::New(length));
156 EXPECT(card_remembered_array.ptr()->untag()->IsCardRemembered());
157 EXPECT(!card_remembered_array.ptr()->untag()->IsRemembered());
158
159 const String& old_element = String::Handle(String::New("old", Heap::kOld));
160 const String& new_element = String::Handle(String::New("new", Heap::kNew));
161 card_remembered_array.SetAt(0, old_element);
162
163 {
164 HANDLESCOPE(thread);
165 EXPECT_STREQ("old",
166 Object::Handle(card_remembered_array.At(0)).ToCString());
167 }
168
169 Become become;
170 become.Add(old_element, new_element);
171 become.Forward();
172
173 EXPECT(old_element.ptr() == new_element.ptr());
174 EXPECT(old_element.ptr()->IsNewObject());
175 EXPECT(card_remembered_array.ptr()->untag()->IsCardRemembered());
176 EXPECT(!card_remembered_array.ptr()->untag()->IsRemembered());
177
178 {
179 HANDLESCOPE(thread);
180 EXPECT_STREQ("new",
181 Object::Handle(card_remembered_array.At(0)).ToCString());
182 }
183
184 GCTestHelper::CollectAllGarbage();
185
186 EXPECT(old_element.ptr() == new_element.ptr());
187 EXPECT(card_remembered_array.ptr()->untag()->IsCardRemembered());
188 EXPECT(!card_remembered_array.ptr()->untag()->IsRemembered());
189
190 {
191 HANDLESCOPE(thread);
192 EXPECT_STREQ("new",
193 Object::Handle(card_remembered_array.At(0)).ToCString());
194 }
195}
bool IsRemembered() const
Definition raw_object.h:340

◆ ISOLATE_UNIT_TEST_CASE() [36/463]

dart::ISOLATE_UNIT_TEST_CASE ( BecomeForwardRememberedObject  )

Definition at line 128 of file become_test.cc.

128 {
129 const String& new_element = String::Handle(String::New("new", Heap::kNew));
130 const String& old_element = String::Handle(String::New("old", Heap::kOld));
131 const Array& before_obj = Array::Handle(Array::New(1, Heap::kOld));
132 const Array& after_obj = Array::Handle(Array::New(1, Heap::kOld));
133 before_obj.SetAt(0, new_element);
134 after_obj.SetAt(0, old_element);
135 EXPECT(before_obj.ptr()->untag()->IsRemembered());
136 EXPECT(!after_obj.ptr()->untag()->IsRemembered());
137
138 EXPECT(before_obj.ptr() != after_obj.ptr());
139
140 Become become;
141 become.Add(before_obj, after_obj);
142 become.Forward();
143
144 EXPECT(before_obj.ptr() == after_obj.ptr());
145 EXPECT(!after_obj.ptr()->untag()->IsRemembered());
146
147 GCTestHelper::CollectAllGarbage();
148
149 EXPECT(before_obj.ptr() == after_obj.ptr());
150}

◆ ISOLATE_UNIT_TEST_CASE() [37/463]

dart::ISOLATE_UNIT_TEST_CASE ( BitmapBuilder  )

Definition at line 25 of file bitmap_test.cc.

25 {
26 // Test basic bit map builder operations.
27 BitmapBuilder* builder1 = new BitmapBuilder();
28 EXPECT_EQ(0, builder1->Length());
29
30 bool value = true;
31 for (int32_t i = 0; i < 128; i++) {
32 builder1->Set(i, value);
33 value = !value;
34 }
35 EXPECT_EQ(128, builder1->Length());
36 value = true;
37 for (int32_t i = 0; i < 128; i++) {
38 EXPECT_EQ(value, builder1->Get(i));
39 value = !value;
40 }
41 value = true;
42 for (int32_t i = 0; i < 1024; i++) {
43 builder1->Set(i, value);
44 value = !value;
45 }
46 EXPECT_EQ(1024, builder1->Length());
47 value = true;
48 for (int32_t i = 0; i < 1024; i++) {
49 EXPECT_EQ(value, builder1->Get(i));
50 value = !value;
51 }
52
53 // Create a CompressedStackMaps object and verify its contents.
54 const auto& maps1 = CompressedStackMaps::Handle(
55 thread->zone(), MapsFromBuilder(thread->zone(), builder1));
56 auto it1 = maps1.iterator(thread);
57 EXPECT(it1.MoveNext());
58
59 EXPECT_EQ(kTestPcOffset, it1.pc_offset());
60 EXPECT_EQ(kTestSpillSlotBitCount, it1.SpillSlotBitCount());
61 EXPECT_EQ(1024, it1.Length());
62 value = true;
63 for (int32_t i = 0; i < 1024; i++) {
64 EXPECT_EQ(value, it1.IsObject(i));
65 value = !value;
66 }
67
68 EXPECT(!it1.MoveNext());
69
70 // Test the SetRange function in the builder.
71 builder1->SetRange(0, 256, false);
72 EXPECT_EQ(1024, builder1->Length());
73 builder1->SetRange(257, 1024, true);
74 EXPECT_EQ(1025, builder1->Length());
75 builder1->SetRange(1025, 2048, false);
76 EXPECT_EQ(2049, builder1->Length());
77 for (int32_t i = 0; i <= 256; i++) {
78 EXPECT(!builder1->Get(i));
79 }
80 for (int32_t i = 257; i <= 1024; i++) {
81 EXPECT(builder1->Get(i));
82 }
83 for (int32_t i = 1025; i <= 2048; i++) {
84 EXPECT(!builder1->Get(i));
85 }
86
87 const auto& maps2 = CompressedStackMaps::Handle(
88 thread->zone(), MapsFromBuilder(thread->zone(), builder1));
89 auto it2 = maps2.iterator(thread);
90 EXPECT(it2.MoveNext());
91
92 EXPECT_EQ(kTestPcOffset, it2.pc_offset());
93 EXPECT_EQ(kTestSpillSlotBitCount, it2.SpillSlotBitCount());
94 EXPECT_EQ(2049, it2.Length());
95 for (int32_t i = 0; i <= 256; i++) {
96 EXPECT(!it2.IsObject(i));
97 }
98 for (int32_t i = 257; i <= 1024; i++) {
99 EXPECT(it2.IsObject(i));
100 }
101 for (int32_t i = 1025; i <= 2048; i++) {
102 EXPECT(!it2.IsObject(i));
103 }
104
105 EXPECT(!it2.MoveNext());
106
107 // Test using SetLength to shorten the builder, followed by lengthening.
108 builder1->SetLength(747);
109 EXPECT_EQ(747, builder1->Length());
110 for (int32_t i = 257; i < 747; ++i) {
111 EXPECT(builder1->Get(i));
112 }
113
114 builder1->Set(800, false);
115 EXPECT_EQ(801, builder1->Length());
116 for (int32_t i = 257; i < 747; ++i) {
117 EXPECT(builder1->Get(i));
118 }
119 for (int32_t i = 747; i < 801; ++i) {
120 EXPECT(!builder1->Get(i));
121 }
122
123 builder1->Set(900, true);
124 EXPECT_EQ(901, builder1->Length());
125 for (int32_t i = 257; i < 747; ++i) {
126 EXPECT(builder1->Get(i));
127 }
128 for (int32_t i = 747; i < 900; ++i) {
129 EXPECT(!builder1->Get(i));
130 }
131 EXPECT(builder1->Get(900));
132}
bool Get(intptr_t bit_offset) const
Definition bitmap.cc:35
void Set(intptr_t bit_offset, bool value)
Definition bitmap.cc:44
intptr_t Length() const
Definition bitmap.h:36
void SetRange(intptr_t min, intptr_t max, bool value)
Definition bitmap.cc:75
void SetLength(intptr_t length)
Definition bitmap.cc:13
static CompressedStackMapsPtr MapsFromBuilder(Zone *zone, BitmapBuilder *bmap)

◆ ISOLATE_UNIT_TEST_CASE() [38/463]

dart::ISOLATE_UNIT_TEST_CASE ( BitmapBuilder_Regress44946  )

Definition at line 134 of file bitmap_test.cc.

134 {
135 BitmapBuilder* builder1 = new BitmapBuilder();
136 EXPECT_EQ(0, builder1->Length());
137
138 builder1->Set(10000, false);
139 EXPECT_EQ(10001, builder1->Length());
140 builder1->Set(9999, true);
141 EXPECT(builder1->Get(9999));
142}

◆ ISOLATE_UNIT_TEST_CASE() [39/463]

dart::ISOLATE_UNIT_TEST_CASE ( Bool  )

Definition at line 1771 of file object_test.cc.

1771 {
1772 EXPECT(Bool::True().value());
1773 EXPECT(!Bool::False().value());
1774}

◆ ISOLATE_UNIT_TEST_CASE() [40/463]

dart::ISOLATE_UNIT_TEST_CASE ( BoundsCheckElimination_Pragma  )

Definition at line 1606 of file redundancy_elimination_test.cc.

1606 {
1607 const char* kScript = R"(
1608 import 'dart:typed_data';
1609
1610 @pragma('vm:unsafe:no-bounds-checks')
1611 int test(Uint8List list) {
1612 int result = 0;
1613 for (int i = 0; i < 10; i++) {
1614 result = list[i];
1615 }
1616 return result;
1617 }
1618 )";
1619
1620 const auto& root_library = Library::Handle(LoadTestScript(kScript));
1621 const auto& function = Function::Handle(GetFunction(root_library, "test"));
1622
1623 TestPipeline pipeline(function, CompilerPass::kAOT);
1624 auto flow_graph = pipeline.RunPasses({});
1625 for (auto block : flow_graph->postorder()) {
1626 for (auto instr : block->instructions()) {
1627 EXPECT_PROPERTY(instr, !it.IsCheckBoundBase());
1628 }
1629 }
1630}
#define EXPECT_PROPERTY(entity, property)

◆ ISOLATE_UNIT_TEST_CASE() [41/463]

dart::ISOLATE_UNIT_TEST_CASE ( CardRememberedArray  )

Definition at line 1355 of file heap_test.cc.

1355 {
1356 TestCardRememberedArray(true, true);
1357 TestCardRememberedArray(true, false);
1358}
static void TestCardRememberedArray(bool immutable, bool compact)

◆ ISOLATE_UNIT_TEST_CASE() [42/463]

dart::ISOLATE_UNIT_TEST_CASE ( CardRememberedImmutableArray  )

Definition at line 1360 of file heap_test.cc.

1360 {
1361 TestCardRememberedArray(false, true);
1362 TestCardRememberedArray(false, false);
1363}

◆ ISOLATE_UNIT_TEST_CASE() [43/463]

dart::ISOLATE_UNIT_TEST_CASE ( CardRememberedWeakArray  )

Definition at line 1365 of file heap_test.cc.

1365 {
1368}
static void TestCardRememberedWeakArray(bool compact)

◆ ISOLATE_UNIT_TEST_CASE() [44/463]

dart::ISOLATE_UNIT_TEST_CASE ( CatchEntryMoves  )

Definition at line 95 of file catch_entry_moves_test.cc.

95 {
96 // Common prefix.
97 const TestCaseMoves test1[] = {
99 abcde,
100 ARRAY_SIZE(abcde),
101 },
102 TestCaseMoves{
103 abcdx,
104 ARRAY_SIZE(abcdx),
105 },
106 };
108
109 // Common suffix.
110 const TestCaseMoves test2[] = {
111 TestCaseMoves{
112 abcde,
113 ARRAY_SIZE(abcde),
114 },
115 TestCaseMoves{
116 xbcde,
117 ARRAY_SIZE(xbcde),
118 },
119 };
120 RunTestCase(test2, ARRAY_SIZE(test2));
121
122 // Common prefix and suffix.
123 const TestCaseMoves test3[] = {
124 TestCaseMoves{
125 abcde,
126 ARRAY_SIZE(abcde),
127 },
128 TestCaseMoves{
129 abxde,
130 ARRAY_SIZE(abxde),
131 },
132 };
133 RunTestCase(test3, ARRAY_SIZE(test3));
134
135 // Subset of suffix.
136 const TestCaseMoves test4[] = {
137 TestCaseMoves{
138 abcde,
139 ARRAY_SIZE(abcde),
140 },
141 TestCaseMoves{
142 de,
143 ARRAY_SIZE(de),
144 },
145 };
147
148 // Subset of prefix.
149 const TestCaseMoves test5[] = {
150 TestCaseMoves{
151 abcde,
152 ARRAY_SIZE(abcde),
153 },
154 TestCaseMoves{
155 ab,
156 ARRAY_SIZE(ab),
157 },
158 };
159 RunTestCase(test5, ARRAY_SIZE(test5));
160
161 // All moves (with duplicates).
162 const TestCaseMoves test6[] = {
163 TestCaseMoves{
164 abcde,
165 ARRAY_SIZE(abcde),
166 },
167 TestCaseMoves{
168 abcde,
169 ARRAY_SIZE(abcde),
170 },
171 TestCaseMoves{
172 abcdx,
173 ARRAY_SIZE(abcdx),
174 },
175 TestCaseMoves{
176 xbcde,
177 ARRAY_SIZE(xbcde),
178 },
179 TestCaseMoves{
180 abxde,
181 ARRAY_SIZE(abxde),
182 },
183 TestCaseMoves{
184 ab,
185 ARRAY_SIZE(ab),
186 },
187 TestCaseMoves{
188 de,
189 ARRAY_SIZE(de),
190 },
191 TestCaseMoves{
192 de,
193 ARRAY_SIZE(de),
194 },
195 };
196 RunTestCase(test6, ARRAY_SIZE(test6));
197}
static void test1(skiatest::Reporter *reporter, SkWriter32 *writer)
static void test4(SkCanvas *canvas)
Definition ab.py:1
const CatchEntryMove xbcde[]
const CatchEntryMove abcdx[]
const CatchEntryMove abxde[]
void RunTestCase(const TestCaseMoves *mapping, intptr_t count)
const CatchEntryMove abcde[]
const CatchEntryMove de[]

◆ ISOLATE_UNIT_TEST_CASE() [45/463]

dart::ISOLATE_UNIT_TEST_CASE ( ChainInduction  )

Definition at line 162 of file loops_test.cc.

163 {
164 foo();
165 }
166 )";
167 const char* expected =
168 " [0\n"
169 " LIN(100 + -7 * i)\n" // phi
170 " LIN(93 + -7 * i)\n" // sub
171 " ]\n";
172 EXPECT_STREQ(expected, ComputeInduction(thread, script_chars));
173}
174

◆ ISOLATE_UNIT_TEST_CASE() [46/463]

dart::ISOLATE_UNIT_TEST_CASE ( CheckedHandle  )

Definition at line 2615 of file object_test.cc.

2615 {
2616 // Ensure that null handles have the correct C++ vtable setup.
2617 Zone* zone = Thread::Current()->zone();
2618 const String& str1 = String::Handle(zone);
2619 EXPECT(str1.IsString());
2620 EXPECT(str1.IsNull());
2621 const String& str2 = String::CheckedHandle(zone, Object::null());
2622 EXPECT(str2.IsString());
2623 EXPECT(str2.IsNull());
2624 String& str3 = String::Handle(zone);
2625 str3 ^= Object::null();
2626 EXPECT(str3.IsString());
2627 EXPECT(str3.IsNull());
2628 EXPECT(!str3.IsOneByteString());
2629 str3 = String::New("Steep and Deep!");
2630 EXPECT(str3.IsString());
2631 EXPECT(str3.IsOneByteString());
2632 str3 = OneByteString::null();
2633 EXPECT(str3.IsString());
2634 EXPECT(!str3.IsOneByteString());
2635}

◆ ISOLATE_UNIT_TEST_CASE() [47/463]

dart::ISOLATE_UNIT_TEST_CASE ( CheckStackOverflowElimination_NoInterruptsPragma  )

Definition at line 1572 of file redundancy_elimination_test.cc.

1572 {
1573 const char* kScript = R"(
1574 @pragma('vm:prefer-inline')
1575 int bar(int n) {
1576 print(''); // Side-effectful operation
1577 var sum = 0;
1578 for (int i = 0; i < n; i++) {
1579 sum += i;
1580 }
1581 return sum;
1582 }
1583
1584 @pragma('vm:unsafe:no-interrupts')
1585 int test() {
1586 int result = 0;
1587 for (int i = 0; i < 10; i++) {
1588 result ^= bar(i);
1589 }
1590 return result;
1591 }
1592 )";
1593
1594 const auto& root_library = Library::Handle(LoadTestScript(kScript));
1595 const auto& function = Function::Handle(GetFunction(root_library, "test"));
1596
1597 TestPipeline pipeline(function, CompilerPass::kAOT);
1598 auto flow_graph = pipeline.RunPasses({});
1599 for (auto block : flow_graph->postorder()) {
1600 for (auto instr : block->instructions()) {
1601 EXPECT_PROPERTY(instr, !it.IsCheckStackOverflow());
1602 }
1603 }
1604}

◆ ISOLATE_UNIT_TEST_CASE() [48/463]

dart::ISOLATE_UNIT_TEST_CASE ( Class  )

Definition at line 53 of file object_test.cc.

53 {
54 // Allocate the class first.
55 const String& class_name = String::Handle(Symbols::New(thread, "MyClass"));
56 const Script& script = Script::Handle();
57 const Class& cls = Class::Handle(CreateDummyClass(class_name, script));
58
59 // Class has no fields and no functions yet.
60 EXPECT_EQ(Array::Handle(cls.fields()).Length(), 0);
61 EXPECT_EQ(Array::Handle(cls.current_functions()).Length(), 0);
62
63 // Setup the interfaces in the class.
64 // Normally the class finalizer is resolving super types and interfaces
65 // before finalizing the types in a class. A side-effect of this is setting
66 // the is_implemented() bit on a class. We do that manually here.
67 const Array& interfaces = Array::Handle(Array::New(2));
68 Class& interface = Class::Handle();
69 String& interface_name = String::Handle();
70 interface_name = Symbols::New(thread, "Harley");
71 interface = CreateDummyClass(interface_name, script);
72 interfaces.SetAt(0, Type::Handle(Type::NewNonParameterizedType(interface)));
73 interface.set_is_implemented_unsafe();
74 interface_name = Symbols::New(thread, "Norton");
75 interface = CreateDummyClass(interface_name, script);
76 interfaces.SetAt(1, Type::Handle(Type::NewNonParameterizedType(interface)));
77 interface.set_is_implemented_unsafe();
78 cls.set_interfaces(interfaces);
79
80 // Finalization of types happens before the fields and functions have been
81 // parsed.
82 ClassFinalizer::FinalizeTypesInClass(cls);
83
84 // Create and populate the function arrays.
85 const Array& functions = Array::Handle(Array::New(6));
86 FunctionType& signature = FunctionType::Handle();
87 Function& function = Function::Handle();
88 String& function_name = String::Handle();
89 function_name = Symbols::New(thread, "foo");
90 signature = FunctionType::New();
91 function = Function::New(signature, function_name,
92 UntaggedFunction::kRegularFunction, false, false,
93 false, false, false, cls, TokenPosition::kMinSource);
94 functions.SetAt(0, function);
95 function_name = Symbols::New(thread, "bar");
96 signature = FunctionType::New();
97 function = Function::New(signature, function_name,
98 UntaggedFunction::kRegularFunction, false, false,
99 false, false, false, cls, TokenPosition::kMinSource);
100
101 const int kNumFixedParameters = 2;
102 const int kNumOptionalParameters = 3;
103 const bool kAreOptionalPositional = true;
104 signature.set_num_fixed_parameters(kNumFixedParameters);
105 signature.SetNumOptionalParameters(kNumOptionalParameters,
106 kAreOptionalPositional);
107 functions.SetAt(1, function);
108
109 function_name = Symbols::New(thread, "baz");
110 signature = FunctionType::New();
111 function = Function::New(signature, function_name,
112 UntaggedFunction::kRegularFunction, false, false,
113 false, false, false, cls, TokenPosition::kMinSource);
114 functions.SetAt(2, function);
115
116 function_name = Symbols::New(thread, "Foo");
117 signature = FunctionType::New();
118 function = Function::New(signature, function_name,
119 UntaggedFunction::kRegularFunction, true, false,
120 false, false, false, cls, TokenPosition::kMinSource);
121
122 functions.SetAt(3, function);
123 function_name = Symbols::New(thread, "Bar");
124 signature = FunctionType::New();
125 function = Function::New(signature, function_name,
126 UntaggedFunction::kRegularFunction, true, false,
127 false, false, false, cls, TokenPosition::kMinSource);
128 functions.SetAt(4, function);
129 function_name = Symbols::New(thread, "BaZ");
130 signature = FunctionType::New();
131 function = Function::New(signature, function_name,
132 UntaggedFunction::kRegularFunction, true, false,
133 false, false, false, cls, TokenPosition::kMinSource);
134 functions.SetAt(5, function);
135
136 // Setup the functions in the class.
137 {
138 SafepointWriteRwLocker ml(thread, thread->isolate_group()->program_lock());
139 cls.SetFunctions(functions);
140 // The class can now be finalized.
141 cls.Finalize();
142 }
143
144 function_name = String::New("Foo");
145 function = Resolver::ResolveDynamicFunction(Z, cls, function_name);
146 EXPECT(function.IsNull());
147 function = cls.LookupStaticFunction(function_name);
148 EXPECT(!function.IsNull());
149 EXPECT(function_name.Equals(String::Handle(function.name())));
150 EXPECT_EQ(cls.ptr(), function.Owner());
151 EXPECT(function.is_static());
152 function_name = String::New("baz");
153 function = Resolver::ResolveDynamicFunction(Z, cls, function_name);
154 EXPECT(!function.IsNull());
155 EXPECT(function_name.Equals(String::Handle(function.name())));
156 EXPECT_EQ(cls.ptr(), function.Owner());
157 EXPECT(!function.is_static());
158 function = cls.LookupStaticFunction(function_name);
159 EXPECT(function.IsNull());
160
161 function_name = String::New("foo");
162 function = Resolver::ResolveDynamicFunction(Z, cls, function_name);
163 EXPECT(!function.IsNull());
164 EXPECT_EQ(0, function.num_fixed_parameters());
165 EXPECT(!function.HasOptionalParameters());
166
167 function_name = String::New("bar");
168 function = Resolver::ResolveDynamicFunction(Z, cls, function_name);
169 EXPECT(!function.IsNull());
170 EXPECT_EQ(kNumFixedParameters, function.num_fixed_parameters());
171 EXPECT_EQ(kNumOptionalParameters, function.NumOptionalParameters());
172}
void Finalize() const
Definition object.cc:4362
void SetNumOptionalParameters(intptr_t num_optional_parameters, bool are_optional_positional) const
Definition object.cc:11668

◆ ISOLATE_UNIT_TEST_CASE() [49/463]

dart::ISOLATE_UNIT_TEST_CASE ( ClassDictionaryIterator  )

Definition at line 2989 of file object_test.cc.

2989 {
2990 Class& ae66 = Class::ZoneHandle(CreateTestClass("Ae6/6"));
2991 Class& re44 = Class::ZoneHandle(CreateTestClass("Re4/4"));
2992 Field& ce68 = Field::ZoneHandle(CreateTestField("Ce6/8"));
2993 Field& tee = Field::ZoneHandle(CreateTestField("TEE"));
2994 String& url = String::ZoneHandle(String::New("SBB"));
2995 Library& lib = Library::Handle(Library::New(url));
2996 lib.AddClass(ae66);
2997 lib.AddObject(ce68, String::ZoneHandle(ce68.name()));
2998 lib.AddClass(re44);
2999 lib.AddObject(tee, String::ZoneHandle(tee.name()));
3000 ClassDictionaryIterator iterator(lib);
3001 int count = 0;
3002 Class& cls = Class::Handle();
3003 while (iterator.HasNext()) {
3004 cls = iterator.GetNextClass();
3005 EXPECT((cls.ptr() == ae66.ptr()) || (cls.ptr() == re44.ptr()));
3006 count++;
3007 }
3008 EXPECT(count == 2);
3009}
void AddObject(const Object &obj, const String &name) const
Definition object.cc:13862
void AddClass(const Class &cls) const
Definition object.cc:13961
static FieldPtr CreateTestField(const char *name)

◆ ISOLATE_UNIT_TEST_CASE() [50/463]

dart::ISOLATE_UNIT_TEST_CASE ( ClassFinalizer  )

Definition at line 26 of file class_finalizer_test.cc.

26 {
27 Zone* zone = thread->zone();
28 auto isolate_group = thread->isolate_group();
29 ObjectStore* object_store = isolate_group->object_store();
30 const auto& pending_classes =
31 GrowableObjectArray::Handle(zone, object_store->pending_classes());
33 classes_1.Add(&Class::Handle(CreateTestClass("BMW")));
34 pending_classes.Add(*classes_1[0]);
35 classes_1.Add(&Class::Handle(CreateTestClass("Porsche")));
36 pending_classes.Add(*classes_1[1]);
37
39 classes_2.Add(&Class::ZoneHandle(CreateTestClass("Ferrari")));
40 pending_classes.Add(*classes_2[0]);
41 classes_2.Add(&Class::ZoneHandle(CreateTestClass("Fiat")));
42 pending_classes.Add(*classes_2[1]);
43 classes_2.Add(&Class::ZoneHandle(CreateTestClass("Alfa")));
44 pending_classes.Add(*classes_2[2]);
45 EXPECT(ClassFinalizer::ProcessPendingClasses());
46 for (int i = 0; i < classes_1.length(); i++) {
47 EXPECT(classes_1[i]->is_type_finalized());
48 }
49 for (int i = 0; i < classes_2.length(); i++) {
50 EXPECT(classes_2[i]->is_type_finalized());
51 }
52 EXPECT(ClassFinalizer::AllClassesFinalized());
53 EXPECT(ClassFinalizer::ProcessPendingClasses());
54}

◆ ISOLATE_UNIT_TEST_CASE() [51/463]

dart::ISOLATE_UNIT_TEST_CASE ( Closure  )

Definition at line 2558 of file object_test.cc.

2558 {
2559 // Allocate the class first.
2560 const String& class_name = String::Handle(Symbols::New(thread, "MyClass"));
2561 const Script& script = Script::Handle();
2562 const Class& cls = Class::Handle(CreateDummyClass(class_name, script));
2563 const Array& functions = Array::Handle(Array::New(1));
2564
2565 const Context& context = Context::Handle(Context::New(0));
2566 Function& parent = Function::Handle();
2567 const String& parent_name = String::Handle(Symbols::New(thread, "foo_papa"));
2568 FunctionType& signature = FunctionType::ZoneHandle(FunctionType::New());
2569 parent = Function::New(signature, parent_name,
2570 UntaggedFunction::kRegularFunction, false, false,
2571 false, false, false, cls, TokenPosition::kMinSource);
2572 functions.SetAt(0, parent);
2573 {
2574 SafepointWriteRwLocker ml(thread, thread->isolate_group()->program_lock());
2575 cls.SetFunctions(functions);
2576 cls.Finalize();
2577 }
2578
2579 Function& function = Function::Handle();
2580 const String& function_name = String::Handle(Symbols::New(thread, "foo"));
2581 function = Function::NewClosureFunction(function_name, parent,
2582 TokenPosition::kMinSource);
2583 signature = function.signature();
2584 signature.set_result_type(Object::dynamic_type());
2585 signature ^= ClassFinalizer::FinalizeType(signature);
2586 function.SetSignature(signature);
2587 const Closure& closure = Closure::Handle(
2588 Closure::New(Object::null_type_arguments(), Object::null_type_arguments(),
2589 function, context));
2590 const Class& closure_class = Class::Handle(closure.clazz());
2591 EXPECT_EQ(closure_class.id(), kClosureCid);
2592 const Function& closure_function = Function::Handle(closure.function());
2593 EXPECT_EQ(closure_function.ptr(), function.ptr());
2594 const Context& closure_context = Context::Handle(closure.GetContext());
2595 EXPECT_EQ(closure_context.ptr(), context.ptr());
2596}

◆ ISOLATE_UNIT_TEST_CASE() [52/463]

dart::ISOLATE_UNIT_TEST_CASE ( ClosureType_SubtypeOfFunctionType  )

Definition at line 7422 of file object_test.cc.

7422 : "not be");
7423 super.PrintName(Object::kScrubbedName, &buffer);
7424 expect.Fail("%s", buffer.buffer());
7425 }
7426}
7427
7428#define EXPECT_SUBTYPE(sub, super) \
7429 CheckSubtypeRelation(Expect(__FILE__, __LINE__), sub, super, true);
7430#define EXPECT_NOT_SUBTYPE(sub, super) \
7431 CheckSubtypeRelation(Expect(__FILE__, __LINE__), sub, super, false);
7432
7433ISOLATE_UNIT_TEST_CASE(ClosureType_SubtypeOfFunctionType) {
7434 const auto& closure_class =
7435 Class::Handle(IsolateGroup::Current()->object_store()->closure_class());
7436 const auto& closure_type = Type::Handle(closure_class.DeclarationType());
7437 auto& closure_type_nullable = Type::Handle(
7438 closure_type.ToNullability(Nullability::kNullable, Heap::kNew));
7439 FinalizeAndCanonicalize(&closure_type_nullable);
7440 auto& closure_type_legacy = Type::Handle(
7441 closure_type.ToNullability(Nullability::kLegacy, Heap::kNew));
7442 FinalizeAndCanonicalize(&closure_type_legacy);
7443 auto& closure_type_nonnullable = Type::Handle(
7444 closure_type.ToNullability(Nullability::kNonNullable, Heap::kNew));
7445 FinalizeAndCanonicalize(&closure_type_nonnullable);
7446
7447 const auto& function_type =
7448 Type::Handle(IsolateGroup::Current()->object_store()->function_type());
7449 auto& function_type_nullable = Type::Handle(
7450 function_type.ToNullability(Nullability::kNullable, Heap::kNew));
7451 FinalizeAndCanonicalize(&function_type_nullable);
7452 auto& function_type_legacy = Type::Handle(
7453 function_type.ToNullability(Nullability::kLegacy, Heap::kNew));
7454 FinalizeAndCanonicalize(&function_type_legacy);
7455 auto& function_type_nonnullable = Type::Handle(
7456 function_type.ToNullability(Nullability::kNonNullable, Heap::kNew));
7457 FinalizeAndCanonicalize(&function_type_nonnullable);
7458
7459 EXPECT_SUBTYPE(closure_type_nonnullable, function_type_nullable);
7460 EXPECT_SUBTYPE(closure_type_nonnullable, function_type_legacy);
7461 EXPECT_SUBTYPE(closure_type_nonnullable, function_type_nonnullable);
7462 EXPECT_SUBTYPE(closure_type_legacy, function_type_nullable);
7463 EXPECT_SUBTYPE(closure_type_legacy, function_type_legacy);
7464 EXPECT_SUBTYPE(closure_type_legacy, function_type_nonnullable);
7465 EXPECT_SUBTYPE(closure_type_nullable, function_type_nullable);
7466 EXPECT_SUBTYPE(closure_type_nullable, function_type_legacy);
7467 EXPECT_NOT_SUBTYPE(closure_type_nullable, function_type_nonnullable);
7468
7469 const auto& async_lib = Library::Handle(Library::AsyncLibrary());
7470 const auto& future_or_class =
7471 Class::Handle(async_lib.LookupClass(Symbols::FutureOr()));
7472 auto& tav_function_nullable = TypeArguments::Handle(TypeArguments::New(1));
7473 tav_function_nullable.SetTypeAt(0, function_type_nullable);
7474 tav_function_nullable = tav_function_nullable.Canonicalize(thread);
7475 auto& tav_function_legacy = TypeArguments::Handle(TypeArguments::New(1));
7476 tav_function_legacy.SetTypeAt(0, function_type_legacy);
7477 tav_function_legacy = tav_function_legacy.Canonicalize(thread);
7478 auto& tav_function_nonnullable = TypeArguments::Handle(TypeArguments::New(1));
7479 tav_function_nonnullable.SetTypeAt(0, function_type_nonnullable);
7480 tav_function_nonnullable = tav_function_nonnullable.Canonicalize(thread);
7481
7482 auto& future_or_function_type_nullable =
7483 Type::Handle(Type::New(future_or_class, tav_function_nullable));
7484 FinalizeAndCanonicalize(&future_or_function_type_nullable);
7485 auto& future_or_function_type_legacy =
7486 Type::Handle(Type::New(future_or_class, tav_function_legacy));
7487 FinalizeAndCanonicalize(&future_or_function_type_legacy);
7488 auto& future_or_function_type_nonnullable =
7489 Type::Handle(Type::New(future_or_class, tav_function_nonnullable));
7490 FinalizeAndCanonicalize(&future_or_function_type_nonnullable);
7491
static void FinalizeAndCanonicalize(AbstractType *type)
#define EXPECT_SUBTYPE(sub, super)
#define EXPECT_NOT_SUBTYPE(sub, super)

◆ ISOLATE_UNIT_TEST_CASE() [53/463]

dart::ISOLATE_UNIT_TEST_CASE ( Code  )

Definition at line 2658 of file object_test.cc.

2658 {
2659 extern void GenerateIncrement(compiler::Assembler * assembler);
2660 compiler::ObjectPoolBuilder object_pool_builder;
2661 compiler::Assembler _assembler_(&object_pool_builder);
2662 GenerateIncrement(&_assembler_);
2663 const Function& function = Function::Handle(CreateFunction("Test_Code"));
2664 SafepointWriteRwLocker locker(thread,
2665 thread->isolate_group()->program_lock());
2666 Code& code = Code::Handle(Code::FinalizeCodeAndNotify(
2667 function, nullptr, &_assembler_, Code::PoolAttachment::kAttachPool));
2668 function.AttachCode(code);
2669 const Instructions& instructions = Instructions::Handle(code.instructions());
2670 uword payload_start = instructions.PayloadStart();
2671 EXPECT_EQ(instructions.ptr(), Instructions::FromPayloadStart(payload_start));
2672 const Object& result =
2673 Object::Handle(DartEntry::InvokeFunction(function, Array::empty_array()));
2674 EXPECT_EQ(1, Smi::Cast(result).Value());
2675}
uword PayloadStart() const
Definition object.h:5716
static FunctionPtr CreateFunction(const char *name)

◆ ISOLATE_UNIT_TEST_CASE() [54/463]

dart::ISOLATE_UNIT_TEST_CASE ( CollectAllGarbage_DeadGenCycle  )

Definition at line 278 of file heap_test.cc.

278 {
279 Heap* heap = IsolateGroup::Current()->heap();
280
281 heap->CollectAllGarbage();
282 heap->WaitForMarkerTasks(thread); // Finalize marking to get live size.
283 intptr_t size_before =
284 heap->new_space()->UsedInWords() + heap->old_space()->UsedInWords();
285
286 Array& old = Array::Handle(Array::New(1, Heap::kOld));
287 Array& neu = Array::Handle(Array::New(1, Heap::kNew));
288 neu.SetAt(0, old);
289 old.SetAt(0, neu);
290 old = Array::null();
291 neu = Array::null();
292
293 heap->CollectAllGarbage();
294 heap->WaitForMarkerTasks(thread); // Finalize marking to get live size.
295
296 intptr_t size_after =
297 heap->new_space()->UsedInWords() + heap->old_space()->UsedInWords();
298
299 EXPECT_EQ(size_before, size_after);
300}
Scavenger * new_space()
Definition heap.h:62
void WaitForMarkerTasks(Thread *thread)
Definition heap.cc:645
intptr_t UsedInWords() const
Definition pages.h:189
intptr_t UsedInWords() const
Definition scavenger.h:160

◆ ISOLATE_UNIT_TEST_CASE() [55/463]

dart::ISOLATE_UNIT_TEST_CASE ( CollectAllGarbage_DeadNewToOld  )

Definition at line 255 of file heap_test.cc.

255 {
256 Heap* heap = IsolateGroup::Current()->heap();
257
258 heap->CollectAllGarbage();
259 heap->WaitForMarkerTasks(thread); // Finalize marking to get live size.
260 intptr_t size_before =
261 heap->new_space()->UsedInWords() + heap->old_space()->UsedInWords();
262
263 Array& old = Array::Handle(Array::New(1, Heap::kOld));
264 Array& neu = Array::Handle(Array::New(1, Heap::kNew));
265 neu.SetAt(0, old);
266 old = Array::null();
267 neu = Array::null();
268
269 heap->CollectAllGarbage();
270 heap->WaitForMarkerTasks(thread); // Finalize marking to get live size.
271
272 intptr_t size_after =
273 heap->new_space()->UsedInWords() + heap->old_space()->UsedInWords();
274
275 EXPECT_EQ(size_before, size_after);
276}

◆ ISOLATE_UNIT_TEST_CASE() [56/463]

dart::ISOLATE_UNIT_TEST_CASE ( CollectAllGarbage_DeadOldToNew  )

Definition at line 232 of file heap_test.cc.

232 {
233 Heap* heap = IsolateGroup::Current()->heap();
234
235 heap->CollectAllGarbage();
236 heap->WaitForMarkerTasks(thread); // Finalize marking to get live size.
237 intptr_t size_before =
238 heap->new_space()->UsedInWords() + heap->old_space()->UsedInWords();
239
240 Array& old = Array::Handle(Array::New(1, Heap::kOld));
241 Array& neu = Array::Handle(Array::New(1, Heap::kNew));
242 old.SetAt(0, neu);
243 old = Array::null();
244 neu = Array::null();
245
246 heap->CollectAllGarbage();
247 heap->WaitForMarkerTasks(thread); // Finalize marking to get live size.
248
249 intptr_t size_after =
250 heap->new_space()->UsedInWords() + heap->old_space()->UsedInWords();
251
252 EXPECT_EQ(size_before, size_after);
253}

◆ ISOLATE_UNIT_TEST_CASE() [57/463]

dart::ISOLATE_UNIT_TEST_CASE ( CollectAllGarbage_LiveNewDeadOld  )

Definition at line 368 of file heap_test.cc.

368 {
369 Heap* heap = IsolateGroup::Current()->heap();
370
371 heap->CollectAllGarbage();
372 heap->WaitForMarkerTasks(thread); // Finalize marking to get live size.
373 intptr_t size_before =
374 heap->new_space()->UsedInWords() + heap->old_space()->UsedInWords();
375
376 Array& old = Array::Handle(Array::New(1, Heap::kOld));
377 Array& neu = Array::Handle(Array::New(1, Heap::kNew));
378 old = Array::null();
379 neu.SetAt(0, neu);
380
381 heap->CollectAllGarbage();
382 heap->WaitForMarkerTasks(thread); // Finalize marking to get live size.
383
384 intptr_t size_after =
385 heap->new_space()->UsedInWords() + heap->old_space()->UsedInWords();
386
387 EXPECT(size_before < size_after);
388}

◆ ISOLATE_UNIT_TEST_CASE() [58/463]

dart::ISOLATE_UNIT_TEST_CASE ( CollectAllGarbage_LiveNewToOld  )

Definition at line 302 of file heap_test.cc.

302 {
303 Heap* heap = IsolateGroup::Current()->heap();
304
305 heap->CollectAllGarbage();
306 heap->WaitForMarkerTasks(thread); // Finalize marking to get live size.
307 intptr_t size_before =
308 heap->new_space()->UsedInWords() + heap->old_space()->UsedInWords();
309
310 Array& old = Array::Handle(Array::New(1, Heap::kOld));
311 Array& neu = Array::Handle(Array::New(1, Heap::kNew));
312 neu.SetAt(0, old);
313 old = Array::null();
314
315 heap->CollectAllGarbage();
316 heap->WaitForMarkerTasks(thread); // Finalize marking to get live size.
317
318 intptr_t size_after =
319 heap->new_space()->UsedInWords() + heap->old_space()->UsedInWords();
320
321 EXPECT(size_before < size_after);
322}

◆ ISOLATE_UNIT_TEST_CASE() [59/463]

dart::ISOLATE_UNIT_TEST_CASE ( CollectAllGarbage_LiveNewToOldChain  )

Definition at line 390 of file heap_test.cc.

390 {
391 Heap* heap = IsolateGroup::Current()->heap();
392
393 heap->CollectAllGarbage();
394 intptr_t size_before =
395 heap->new_space()->UsedInWords() + heap->old_space()->UsedInWords();
396
397 Array& old = Array::Handle(Array::New(1, Heap::kOld));
398 Array& old2 = Array::Handle(Array::New(1, Heap::kOld));
399 Array& neu = Array::Handle(Array::New(1, Heap::kNew));
400 old.SetAt(0, old2);
401 neu.SetAt(0, old);
402 old = Array::null();
403 old2 = Array::null();
404
405 heap->CollectAllGarbage();
406
407 intptr_t size_after =
408 heap->new_space()->UsedInWords() + heap->old_space()->UsedInWords();
409
410 EXPECT(size_before < size_after);
411}

◆ ISOLATE_UNIT_TEST_CASE() [60/463]

dart::ISOLATE_UNIT_TEST_CASE ( CollectAllGarbage_LiveOldDeadNew  )

Definition at line 346 of file heap_test.cc.

346 {
347 Heap* heap = IsolateGroup::Current()->heap();
348
349 heap->CollectAllGarbage();
350 heap->WaitForMarkerTasks(thread); // Finalize marking to get live size.
351 intptr_t size_before =
352 heap->new_space()->UsedInWords() + heap->old_space()->UsedInWords();
353
354 Array& old = Array::Handle(Array::New(1, Heap::kOld));
355 Array& neu = Array::Handle(Array::New(1, Heap::kNew));
356 neu = Array::null();
357 old.SetAt(0, old);
358
359 heap->CollectAllGarbage();
360 heap->WaitForMarkerTasks(thread); // Finalize marking to get live size.
361
362 intptr_t size_after =
363 heap->new_space()->UsedInWords() + heap->old_space()->UsedInWords();
364
365 EXPECT(size_before < size_after);
366}

◆ ISOLATE_UNIT_TEST_CASE() [61/463]

dart::ISOLATE_UNIT_TEST_CASE ( CollectAllGarbage_LiveOldToNew  )

Definition at line 324 of file heap_test.cc.

324 {
325 Heap* heap = IsolateGroup::Current()->heap();
326
327 heap->CollectAllGarbage();
328 heap->WaitForMarkerTasks(thread); // Finalize marking to get live size.
329 intptr_t size_before =
330 heap->new_space()->UsedInWords() + heap->old_space()->UsedInWords();
331
332 Array& old = Array::Handle(Array::New(1, Heap::kOld));
333 Array& neu = Array::Handle(Array::New(1, Heap::kNew));
334 old.SetAt(0, neu);
335 neu = Array::null();
336
337 heap->CollectAllGarbage();
338 heap->WaitForMarkerTasks(thread); // Finalize marking to get live size.
339
340 intptr_t size_after =
341 heap->new_space()->UsedInWords() + heap->old_space()->UsedInWords();
342
343 EXPECT(size_before < size_after);
344}

◆ ISOLATE_UNIT_TEST_CASE() [62/463]

dart::ISOLATE_UNIT_TEST_CASE ( CollectAllGarbage_LiveOldToNewChain  )

Definition at line 413 of file heap_test.cc.

413 {
414 Heap* heap = IsolateGroup::Current()->heap();
415
416 heap->CollectAllGarbage();
417 intptr_t size_before =
418 heap->new_space()->UsedInWords() + heap->old_space()->UsedInWords();
419
420 Array& old = Array::Handle(Array::New(1, Heap::kOld));
421 Array& neu = Array::Handle(Array::New(1, Heap::kNew));
422 Array& neu2 = Array::Handle(Array::New(1, Heap::kOld));
423 neu.SetAt(0, neu2);
424 old.SetAt(0, neu);
425 neu = Array::null();
426 neu2 = Array::null();
427
428 heap->CollectAllGarbage();
429
430 intptr_t size_after =
431 heap->new_space()->UsedInWords() + heap->old_space()->UsedInWords();
432
433 EXPECT(size_before < size_after);
434}

◆ ISOLATE_UNIT_TEST_CASE() [63/463]

dart::ISOLATE_UNIT_TEST_CASE ( CompileFunction  )

Definition at line 19 of file compiler_test.cc.

19 {
20 const char* kScriptChars =
21 "class A {\n"
22 " static foo() { return 42; }\n"
23 " static moo() {\n"
24 " // A.foo();\n"
25 " }\n"
26 "}\n";
27 Dart_Handle library;
28 {
29 TransitionVMToNative transition(thread);
30 library = TestCase::LoadTestScript(kScriptChars, nullptr);
31 }
32 const Library& lib =
33 Library::Handle(Library::RawCast(Api::UnwrapHandle(library)));
34 EXPECT(ClassFinalizer::ProcessPendingClasses());
35 Class& cls =
36 Class::Handle(lib.LookupClass(String::Handle(Symbols::New(thread, "A"))));
37 EXPECT(!cls.IsNull());
38 const auto& error = cls.EnsureIsFinalized(thread);
39 EXPECT(error == Error::null());
40 String& function_foo_name = String::Handle(String::New("foo"));
41 Function& function_foo =
42 Function::Handle(cls.LookupStaticFunction(function_foo_name));
43 EXPECT(!function_foo.IsNull());
44 String& function_source = String::Handle(function_foo.GetSource());
45 EXPECT_STREQ("static foo() { return 42; }", function_source.ToCString());
46 EXPECT(CompilerTest::TestCompileFunction(function_foo));
47 EXPECT(function_foo.HasCode());
48
49 String& function_moo_name = String::Handle(String::New("moo"));
50 Function& function_moo =
51 Function::Handle(cls.LookupStaticFunction(function_moo_name));
52 EXPECT(!function_moo.IsNull());
53
54 EXPECT(CompilerTest::TestCompileFunction(function_moo));
55 EXPECT(function_moo.HasCode());
56 function_source = function_moo.GetSource();
57 EXPECT_STREQ("static moo() {\n // A.foo();\n }",
58 function_source.ToCString());
59}

◆ ISOLATE_UNIT_TEST_CASE() [64/463]

dart::ISOLATE_UNIT_TEST_CASE ( CompileFunctionOnHelperThread  )

Definition at line 103 of file compiler_test.cc.

103 {
104 // Create a simple function and compile it without optimization.
105 const char* kScriptChars =
106 "class A {\n"
107 " static foo() { return 42; }\n"
108 "}\n";
109 Dart_Handle library;
110 {
111 TransitionVMToNative transition(thread);
112 library = TestCase::LoadTestScript(kScriptChars, nullptr);
113 }
114 const Library& lib =
115 Library::Handle(Library::RawCast(Api::UnwrapHandle(library)));
116 EXPECT(ClassFinalizer::ProcessPendingClasses());
117 Class& cls =
118 Class::Handle(lib.LookupClass(String::Handle(Symbols::New(thread, "A"))));
119 EXPECT(!cls.IsNull());
120 const auto& error = cls.EnsureIsFinalized(thread);
121 EXPECT(error == Error::null());
122 String& function_foo_name = String::Handle(String::New("foo"));
123 Function& func =
124 Function::Handle(cls.LookupStaticFunction(function_foo_name));
125 EXPECT(!func.HasCode());
126 CompilerTest::TestCompileFunction(func);
127 EXPECT(func.HasCode());
128}

◆ ISOLATE_UNIT_TEST_CASE() [65/463]

dart::ISOLATE_UNIT_TEST_CASE ( CompileType_CanBeSmi  )

Definition at line 400 of file type_propagator_test.cc.

400 {
401 CompilerState S(thread, /*is_aot=*/false, /*is_optimizing=*/true);
402
403 const char* late_tag = TestCase::LateTag();
404 auto script_chars = Utils::CStringUniquePtr(
405 OS::SCreate(nullptr, R"(
406import 'dart:async';
407
408class G<T> {}
409
410class C<NoBound,
411 NumBound extends num,
412 ComparableBound extends Comparable,
413 StringBound extends String> {
414 // Simple instantiated types.
415 @pragma('vm-test:can-be-smi') %s int t1;
416 @pragma('vm-test:can-be-smi') %s num t2;
417 @pragma('vm-test:can-be-smi') %s Object t3;
418 %s String t4;
419
420 // Type parameters.
421 @pragma('vm-test:can-be-smi') %s NoBound tp1;
422 @pragma('vm-test:can-be-smi') %s NumBound tp2;
423 @pragma('vm-test:can-be-smi') %s ComparableBound tp3;
424 %s StringBound tp4;
425
426 // Comparable<T> instantiations.
427 @pragma('vm-test:can-be-smi') %s Comparable c1;
428 %s Comparable<String> c2;
429 @pragma('vm-test:can-be-smi') %s Comparable<num> c3;
430 %s Comparable<int> c4; // int is not a subtype of Comparable<int>.
431 @pragma('vm-test:can-be-smi') %s Comparable<NoBound> c5;
432 @pragma('vm-test:can-be-smi') %s Comparable<NumBound> c6;
433 @pragma('vm-test:can-be-smi') %s Comparable<ComparableBound> c7;
434 %s Comparable<StringBound> c8;
435
436 // FutureOr<T> instantiations.
437 @pragma('vm-test:can-be-smi') %s FutureOr fo1;
438 %s FutureOr<String> fo2;
439 @pragma('vm-test:can-be-smi') %s FutureOr<num> fo3;
440 @pragma('vm-test:can-be-smi') %s FutureOr<int> fo4;
441 @pragma('vm-test:can-be-smi') %s FutureOr<NoBound> fo5;
442 @pragma('vm-test:can-be-smi') %s FutureOr<NumBound> fo6;
443 @pragma('vm-test:can-be-smi') %s FutureOr<ComparableBound> fo7;
444 %s FutureOr<StringBound> fo8;
445
446 // Other generic classes.
447 %s G<int> g1;
448 %s G<NoBound> g2;
449}
450)",
451 late_tag, late_tag, late_tag, late_tag, late_tag, late_tag,
452 late_tag, late_tag, late_tag, late_tag, late_tag, late_tag,
453 late_tag, late_tag, late_tag, late_tag, late_tag, late_tag,
454 late_tag, late_tag, late_tag, late_tag, late_tag, late_tag,
455 late_tag, late_tag),
456 std::free);
457
458 const auto& lib = Library::Handle(LoadTestScript(script_chars.get()));
459
460 const auto& pragma_can_be_smi =
461 String::Handle(Symbols::New(thread, "vm-test:can-be-smi"));
462 auto expected_can_be_smi = [&](const Field& f) {
463 auto& options = Object::Handle();
464 return lib.FindPragma(thread, /*only_core=*/false, f, pragma_can_be_smi,
465 /*multiple=*/false, &options);
466 };
467
468 const auto& cls = Class::Handle(GetClass(lib, "C"));
469 const auto& err = Error::Handle(cls.EnsureIsFinalized(thread));
470 EXPECT(err.IsNull());
471 const auto& fields = Array::Handle(cls.fields());
472
473 auto& field = Field::Handle();
474 auto& type = AbstractType::Handle();
475 for (intptr_t i = 0; i < fields.Length(); i++) {
476 field ^= fields.At(i);
477 type = field.type();
478
479 auto compile_type = CompileType::FromAbstractType(
480 type, CompileType::kCanBeNull, CompileType::kCannotBeSentinel);
481 if (compile_type.CanBeSmi() != expected_can_be_smi(field)) {
482 dart::Expect(__FILE__, __LINE__)
483 .Fail("expected that CanBeSmi() returns %s for compile type %s\n",
484 expected_can_be_smi(field) ? "true" : "false",
485 compile_type.ToCString());
486 }
487 }
488}

◆ ISOLATE_UNIT_TEST_CASE() [66/463]

dart::ISOLATE_UNIT_TEST_CASE ( ConcurrentForceGrowthScope  )

Definition at line 826 of file heap_test.cc.

826 {
827 intptr_t task_count = 8;
828 Monitor monitor;
829 intptr_t done_count = 0;
830
831 for (intptr_t i = 0; i < task_count; i++) {
832 Dart::thread_pool()->Run<ConcurrentForceGrowthScopeTask>(
833 thread->isolate_group(), &monitor, &done_count);
834 }
835
836 {
837 MonitorLocker ml(&monitor);
838 while (done_count < task_count) {
839 ml.WaitWithSafepointCheck(thread);
840 }
841 }
842}

◆ ISOLATE_UNIT_TEST_CASE() [67/463]

dart::ISOLATE_UNIT_TEST_CASE ( ConstantFold_bitLength  )

Definition at line 1132 of file il_test.cc.

1132 {
1133 // clang-format off
1134 auto kScript = R"(
1135 b0() => 0. bitLength; // 0...00000
1136 b1() => 1. bitLength; // 0...00001
1137 b100() => 100. bitLength;
1138 b200() => 200. bitLength;
1139 bffff() => 0xffff. bitLength;
1140 m1() => (-1).bitLength; // 1...11111
1141 m2() => (-2).bitLength; // 1...11110
1142
1143 main() {
1144 b0();
1145 b1();
1146 b100();
1147 b200();
1148 bffff();
1149 m1();
1150 m2();
1151 }
1152 )";
1153 // clang-format on
1154
1155 const auto& root_library = Library::Handle(LoadTestScript(kScript));
1156 Invoke(root_library, "main");
1157
1158 auto test = [&](const char* function, intptr_t expected) {
1159 TestConstantFoldToSmi(root_library, function, CompilerPass::kJIT, expected);
1160 TestConstantFoldToSmi(root_library, function, CompilerPass::kAOT, expected);
1161 };
1162
1163 test("b0", 0);
1164 test("b1", 1);
1165 test("b100", 7);
1166 test("b200", 8);
1167 test("bffff", 16);
1168 test("m1", 0);
1169 test("m2", 1);
1170}
#define test(name)
static void TestConstantFoldToSmi(const Library &root_library, const char *function_name, CompilerPass::PipelineMode mode, intptr_t expected_value)
Definition il_test.cc:1099

◆ ISOLATE_UNIT_TEST_CASE() [68/463]

dart::ISOLATE_UNIT_TEST_CASE ( ConstantPropagation_PhiUnwrappingAndConvergence  )

Definition at line 21 of file constant_propagator_test.cc.

21 {
23 CompilerState S(thread, /*is_aot=*/false, /*is_optimizing=*/true);
25
26 // We are going to build the following graph:
27 //
28 // B0[graph_entry]
29 // B1[function_entry]:
30 // v0 <- Constant(0)
31 // goto B2
32 // B2:
33 // v1 <- phi(v0, v1)
34 // v2 <- EqualityCompare(v1 == v0)
35 // if v2 == true then B4 else B3
36 // B3:
37 // goto B2
38 // B4:
39 // Return(v1)
40
41 PhiInstr* v1;
42 ConstantInstr* v0 = H.IntConstant(0);
43 auto b1 = H.flow_graph()->graph_entry()->normal_entry();
44 auto b2 = H.JoinEntry();
45 auto b3 = H.TargetEntry();
46 auto b4 = H.TargetEntry();
47
48 {
49 BlockBuilder builder(H.flow_graph(), b1);
50 builder.AddInstruction(new GotoInstr(b2, S.GetNextDeoptId()));
51 }
52
53 {
54 BlockBuilder builder(H.flow_graph(), b2);
55 v1 = H.Phi(b2, {{b1, v0}, {b3, &v1}});
56 builder.AddPhi(v1);
57 auto v2 = builder.AddDefinition(
58 new EqualityCompareInstr(InstructionSource(), Token::kEQ, new Value(v1),
59 new Value(v0), kSmiCid, S.GetNextDeoptId()));
60 builder.AddBranch(new StrictCompareInstr(
61 InstructionSource(), Token::kEQ_STRICT, new Value(v2),
62 new Value(H.flow_graph()->GetConstant(Bool::True())),
63 /*needs_number_check=*/false, S.GetNextDeoptId()),
64 b4, b3);
65 }
66
67 {
68 BlockBuilder builder(H.flow_graph(), b3);
69 builder.AddInstruction(new GotoInstr(b2, S.GetNextDeoptId()));
70 }
71
72 {
73 BlockBuilder builder(H.flow_graph(), b4);
74 builder.AddReturn(new Value(v1));
75 }
76
77 H.FinishGraph();
78
79 // Graph transformations will attempt to copy deopt information from
80 // branches and block entries which we did not assign.
81 // To disable copying we mark graph to disable LICM.
82 H.flow_graph()->disallow_licm();
83
84 FlowGraphPrinter::PrintGraph("Before ConstantPropagator", H.flow_graph());
85 ConstantPropagator::Optimize(H.flow_graph());
86 FlowGraphPrinter::PrintGraph("After ConstantPropagator", H.flow_graph());
87
88 auto& blocks = H.flow_graph()->reverse_postorder();
89 EXPECT_EQ(2, blocks.length());
90 EXPECT_PROPERTY(blocks[0], it.IsGraphEntry());
91 EXPECT_PROPERTY(blocks[1], it.IsFunctionEntry());
92 EXPECT_PROPERTY(blocks[1]->next(), it.IsDartReturn());
93 EXPECT_PROPERTY(blocks[1]->next()->AsDartReturn(),
94 it.value()->definition() == v0);
95}
Vec2Value v2
#define H
Definition SkMD5.cpp:130

◆ ISOLATE_UNIT_TEST_CASE() [69/463]

dart::ISOLATE_UNIT_TEST_CASE ( ConstantPropagator_StrictCompareEqualsSentinelLeft  )

Definition at line 350 of file constant_propagator_test.cc.

350 {
351 StrictCompareSentinel(thread, /*negate=*/false,
352 /*non_sentinel_on_left=*/true);
353}
void StrictCompareSentinel(Thread *thread, bool negate, bool non_sentinel_on_left)

◆ ISOLATE_UNIT_TEST_CASE() [70/463]

dart::ISOLATE_UNIT_TEST_CASE ( ConstantPropagator_StrictCompareEqualsSentinelRightt  )

Definition at line 355 of file constant_propagator_test.cc.

355 {
356 StrictCompareSentinel(thread, /*negate=*/false,
357 /*non_sentinel_on_left=*/false);
358}

◆ ISOLATE_UNIT_TEST_CASE() [71/463]

dart::ISOLATE_UNIT_TEST_CASE ( ConstantPropagator_StrictCompareNotEqualsSentinelLeft  )

Definition at line 360 of file constant_propagator_test.cc.

360 {
361 StrictCompareSentinel(thread, /*negate=*/true,
362 /*non_sentinel_on_left=*/true);
363}

◆ ISOLATE_UNIT_TEST_CASE() [72/463]

dart::ISOLATE_UNIT_TEST_CASE ( ConstantPropagator_StrictCompareNotEqualsSentinelRight  )

Definition at line 365 of file constant_propagator_test.cc.

365 {
366 StrictCompareSentinel(thread, /*negate=*/true,
367 /*non_sentinel_on_left=*/false);
368}

◆ ISOLATE_UNIT_TEST_CASE() [73/463]

dart::ISOLATE_UNIT_TEST_CASE ( Context  )

Definition at line 2417 of file object_test.cc.

2417 {
2418 const int kNumVariables = 5;
2419 const Context& parent_context = Context::Handle(Context::New(0));
2420 const Context& context = Context::Handle(Context::New(kNumVariables));
2421 context.set_parent(parent_context);
2422 EXPECT_EQ(kNumVariables, context.num_variables());
2423 EXPECT(Context::Handle(context.parent()).ptr() == parent_context.ptr());
2424 EXPECT_EQ(0, Context::Handle(context.parent()).num_variables());
2425 EXPECT(Context::Handle(Context::Handle(context.parent()).parent()).IsNull());
2426 Object& variable = Object::Handle(context.At(0));
2427 EXPECT(variable.IsNull());
2428 variable = context.At(kNumVariables - 1);
2429 EXPECT(variable.IsNull());
2430 context.SetAt(0, Smi::Handle(Smi::New(2)));
2431 context.SetAt(2, Smi::Handle(Smi::New(3)));
2432 Smi& smi = Smi::Handle();
2433 smi ^= context.At(0);
2434 EXPECT_EQ(2, smi.Value());
2435 smi ^= context.At(2);
2436 EXPECT_EQ(3, smi.Value());
2437}

◆ ISOLATE_UNIT_TEST_CASE() [74/463]

dart::ISOLATE_UNIT_TEST_CASE ( ContextScope  )

Definition at line 2439 of file object_test.cc.

2439 {
2440 // We need an active compiler context to manipulate scopes, since local
2441 // variables and slots can be canonicalized in the compiler state.
2442 CompilerState compiler_state(Thread::Current(), /*is_aot=*/false,
2443 /*is_optimizing=*/false);
2444
2445 const intptr_t parent_scope_function_level = 0;
2446 LocalScope* parent_scope =
2447 new LocalScope(nullptr, parent_scope_function_level, 0);
2448
2449 const intptr_t local_scope_function_level = 1;
2450 LocalScope* local_scope =
2451 new LocalScope(parent_scope, local_scope_function_level, 0);
2452
2453 const Type& dynamic_type = Type::ZoneHandle(Type::DynamicType());
2454 const String& ta = Symbols::FunctionTypeArgumentsVar();
2455 LocalVariable* var_ta = new LocalVariable(
2456 TokenPosition::kNoSource, TokenPosition::kNoSource, ta, dynamic_type);
2457 parent_scope->AddVariable(var_ta);
2458
2459 const String& a = String::ZoneHandle(Symbols::New(thread, "a"));
2460 LocalVariable* var_a = new LocalVariable(
2461 TokenPosition::kNoSource, TokenPosition::kNoSource, a, dynamic_type);
2462 parent_scope->AddVariable(var_a);
2463
2464 const String& b = String::ZoneHandle(Symbols::New(thread, "b"));
2465 LocalVariable* var_b = new LocalVariable(
2466 TokenPosition::kNoSource, TokenPosition::kNoSource, b, dynamic_type);
2467 local_scope->AddVariable(var_b);
2468
2469 const String& c = String::ZoneHandle(Symbols::New(thread, "c"));
2470 LocalVariable* var_c = new LocalVariable(
2471 TokenPosition::kNoSource, TokenPosition::kNoSource, c, dynamic_type);
2472 parent_scope->AddVariable(var_c);
2473
2474 bool test_only = false; // Please, insert alias.
2475 var_ta = local_scope->LookupVariable(ta, LocalVariable::kNoKernelOffset,
2476 test_only);
2477 EXPECT(var_ta->is_captured());
2478 EXPECT_EQ(parent_scope_function_level, var_ta->owner()->function_level());
2479 EXPECT(local_scope->LocalLookupVariable(ta, LocalVariable::kNoKernelOffset) ==
2480 var_ta); // Alias.
2481
2482 var_a =
2483 local_scope->LookupVariable(a, LocalVariable::kNoKernelOffset, test_only);
2484 EXPECT(var_a->is_captured());
2485 EXPECT_EQ(parent_scope_function_level, var_a->owner()->function_level());
2486 EXPECT(local_scope->LocalLookupVariable(a, LocalVariable::kNoKernelOffset) ==
2487 var_a); // Alias.
2488
2489 var_b =
2490 local_scope->LookupVariable(b, LocalVariable::kNoKernelOffset, test_only);
2491 EXPECT(!var_b->is_captured());
2492 EXPECT_EQ(local_scope_function_level, var_b->owner()->function_level());
2493 EXPECT(local_scope->LocalLookupVariable(b, LocalVariable::kNoKernelOffset) ==
2494 var_b);
2495
2496 test_only = true; // Please, do not insert alias.
2497 var_c =
2498 local_scope->LookupVariable(c, LocalVariable::kNoKernelOffset, test_only);
2499 EXPECT(!var_c->is_captured());
2500 EXPECT_EQ(parent_scope_function_level, var_c->owner()->function_level());
2501 // c is not in local_scope.
2502 EXPECT(local_scope->LocalLookupVariable(c, LocalVariable::kNoKernelOffset) ==
2503 nullptr);
2504
2505 test_only = false; // Please, insert alias.
2506 var_c =
2507 local_scope->LookupVariable(c, LocalVariable::kNoKernelOffset, test_only);
2508 EXPECT(var_c->is_captured());
2509
2510 EXPECT_EQ(4, local_scope->num_variables()); // ta, a, b, c.
2511 EXPECT_EQ(3, local_scope->NumCapturedVariables()); // ta, a, c.
2512
2513 const VariableIndex first_parameter_index(0);
2514 const int num_parameters = 0;
2515 const VariableIndex first_local_index(-1);
2516 bool found_captured_vars = false;
2517 VariableIndex next_index = parent_scope->AllocateVariables(
2518 Function::null_function(), first_parameter_index, num_parameters,
2519 first_local_index, nullptr, &found_captured_vars);
2520 // Variables a, c and var_ta are captured, therefore are not allocated in
2521 // frame.
2522 EXPECT_EQ(0, next_index.value() -
2523 first_local_index.value()); // Indices in frame < 0.
2524 const intptr_t parent_scope_context_level = 1;
2525 EXPECT_EQ(parent_scope_context_level, parent_scope->context_level());
2526 EXPECT(found_captured_vars);
2527
2528 const intptr_t local_scope_context_level = 5;
2529 const ContextScope& context_scope =
2530 ContextScope::Handle(local_scope->PreserveOuterScope(
2531 Function::null_function(), local_scope_context_level));
2532 LocalScope* outer_scope = LocalScope::RestoreOuterScope(context_scope);
2533 EXPECT_EQ(3, outer_scope->num_variables());
2534
2535 var_ta = outer_scope->LocalLookupVariable(ta, LocalVariable::kNoKernelOffset);
2536 EXPECT(var_ta->is_captured());
2537 EXPECT_EQ(0, var_ta->index().value()); // First index.
2538 EXPECT_EQ(parent_scope_context_level - local_scope_context_level,
2539 var_ta->owner()->context_level()); // Adjusted context level.
2540
2541 var_a = outer_scope->LocalLookupVariable(a, LocalVariable::kNoKernelOffset);
2542 EXPECT(var_a->is_captured());
2543 EXPECT_EQ(1, var_a->index().value()); // First index.
2544 EXPECT_EQ(parent_scope_context_level - local_scope_context_level,
2545 var_a->owner()->context_level()); // Adjusted context level.
2546
2547 // var b was not captured.
2548 EXPECT(outer_scope->LocalLookupVariable(b, LocalVariable::kNoKernelOffset) ==
2549 nullptr);
2550
2551 var_c = outer_scope->LocalLookupVariable(c, LocalVariable::kNoKernelOffset);
2552 EXPECT(var_c->is_captured());
2553 EXPECT_EQ(2, var_c->index().value());
2554 EXPECT_EQ(parent_scope_context_level - local_scope_context_level,
2555 var_c->owner()->context_level()); // Adjusted context level.
2556}
int context_level() const
Definition scopes.h:333
int NumCapturedVariables() const
Definition scopes.cc:409
int function_level() const
Definition scopes.h:322
VariableIndex AllocateVariables(const Function &function, VariableIndex first_parameter_index, int num_parameters, VariableIndex first_local_index, LocalScope *context_owner, bool *found_captured_variables)
Definition scopes.cc:133
LocalVariable * LookupVariable(const String &name, intptr_t kernel_offset, bool test_only)
Definition scopes.cc:350
bool AddVariable(LocalVariable *variable)
Definition scopes.cc:57
ContextScopePtr PreserveOuterScope(const Function &function, intptr_t current_context_level) const
Definition scopes.cc:433
LocalVariable * LocalLookupVariable(const String &name, intptr_t kernel_offset) const
Definition scopes.cc:336
VariableIndex index() const
Definition scopes.h:202
LocalScope * owner() const
Definition scopes.h:122
bool is_captured() const
Definition scopes.h:143
int value() const
Definition scopes.h:69

◆ ISOLATE_UNIT_TEST_CASE() [75/463]

dart::ISOLATE_UNIT_TEST_CASE ( CSE_Redefinitions  )

Definition at line 1634 of file redundancy_elimination_test.cc.

1634 {
1635 const char* script_chars = R"(
1636 @pragma("vm:external-name", "BlackholeNative")
1637 external dynamic blackhole([a, b, c, d, e, f]);
1638 class K<T> {
1639 final T field;
1640 K(this.field);
1641 }
1642 )";
1643 const Library& lib =
1644 Library::Handle(LoadTestScript(script_chars, NoopNativeLookup));
1645
1646 const Class& cls = Class::ZoneHandle(
1647 lib.LookupClass(String::Handle(Symbols::New(thread, "K"))));
1648 const Error& err = Error::Handle(cls.EnsureIsFinalized(thread));
1649 EXPECT(err.IsNull());
1650
1651 const Field& original_field = Field::Handle(
1652 cls.LookupField(String::Handle(Symbols::New(thread, "field"))));
1653 EXPECT(!original_field.IsNull());
1654 const Field& field = Field::Handle(original_field.CloneFromOriginal());
1655
1656 const Function& blackhole =
1657 Function::ZoneHandle(GetFunction(lib, "blackhole"));
1658
1660 CompilerState S(thread, /*is_aot=*/false, /*is_optimizing=*/true);
1661 FlowGraphBuilderHelper H(/*num_parameters=*/2);
1662 H.AddVariable("v0", AbstractType::ZoneHandle(Type::DynamicType()));
1663 H.AddVariable("v1", AbstractType::ZoneHandle(Type::DynamicType()));
1664
1665 auto b1 = H.flow_graph()->graph_entry()->normal_entry();
1666
1667 BoxInstr* box0;
1668 BoxInstr* box1;
1669 LoadFieldInstr* load0;
1670 LoadFieldInstr* load1;
1671 LoadFieldInstr* load2;
1672 StaticCallInstr* call;
1673 DartReturnInstr* ret;
1674
1675 {
1676 BlockBuilder builder(H.flow_graph(), b1);
1677 auto& slot = Slot::Get(field, &H.flow_graph()->parsed_function());
1678 auto param0 = builder.AddParameter(0, kUnboxedDouble);
1679 auto param1 = builder.AddParameter(1, kTagged);
1680 auto redef0 =
1681 builder.AddDefinition(new RedefinitionInstr(new Value(param0)));
1682 auto redef1 =
1683 builder.AddDefinition(new RedefinitionInstr(new Value(param0)));
1684 box0 = builder.AddDefinition(
1685 BoxInstr::Create(kUnboxedDouble, new Value(redef0)));
1686 box1 = builder.AddDefinition(
1687 BoxInstr::Create(kUnboxedDouble, new Value(redef1)));
1688
1689 auto redef2 =
1690 builder.AddDefinition(new RedefinitionInstr(new Value(param1)));
1691 auto redef3 =
1692 builder.AddDefinition(new RedefinitionInstr(new Value(param1)));
1693 load0 = builder.AddDefinition(
1694 new LoadFieldInstr(new Value(redef2), slot, InstructionSource()));
1695 load1 = builder.AddDefinition(
1696 new LoadFieldInstr(new Value(redef3), slot, InstructionSource()));
1697 load2 = builder.AddDefinition(
1698 new LoadFieldInstr(new Value(redef3), slot, InstructionSource()));
1699
1700 InputsArray args(3);
1701 args.Add(new Value(load0));
1702 args.Add(new Value(load1));
1703 args.Add(new Value(load2));
1704 call = builder.AddInstruction(new StaticCallInstr(
1705 InstructionSource(), blackhole, 0, Array::empty_array(),
1706 std::move(args), S.GetNextDeoptId(), 0, ICData::RebindRule::kStatic));
1707
1708 ret = builder.AddReturn(new Value(box1));
1709 }
1710 H.FinishGraph();
1711
1712 // Running CSE without load optimization should eliminate redundant boxing
1713 // but keep loads intact if they don't have exactly matching inputs.
1714 DominatorBasedCSE::Optimize(H.flow_graph(), /*run_load_optimization=*/false);
1715
1716 EXPECT_PROPERTY(box1, it.WasEliminated());
1717 EXPECT_PROPERTY(ret, it.value()->definition() == box0);
1718
1719 EXPECT_PROPERTY(load0, !it.WasEliminated());
1720 EXPECT_PROPERTY(load1, !it.WasEliminated());
1721 EXPECT_PROPERTY(load2, it.WasEliminated());
1722
1723 EXPECT_PROPERTY(call, it.ArgumentAt(0) == load0);
1724 EXPECT_PROPERTY(call, it.ArgumentAt(1) == load1);
1725 EXPECT_PROPERTY(call, it.ArgumentAt(2) == load1);
1726
1727 // Running load optimization pass should remove the second load but
1728 // insert a redefinition to prevent code motion because the field
1729 // has a generic type.
1730 DominatorBasedCSE::Optimize(H.flow_graph(), /*run_load_optimization=*/true);
1731
1732 EXPECT_PROPERTY(load0, !it.WasEliminated());
1733 EXPECT_PROPERTY(load1, it.WasEliminated());
1734 EXPECT_PROPERTY(load2, it.WasEliminated());
1735
1736 EXPECT_PROPERTY(call, it.ArgumentAt(0) == load0);
1737 EXPECT_PROPERTY(call, it.ArgumentAt(1)->IsRedefinition() &&
1738 it.ArgumentAt(1)->OriginalDefinition() == load0);
1739 EXPECT_PROPERTY(call, it.ArgumentAt(2)->IsRedefinition() &&
1740 it.ArgumentAt(2)->OriginalDefinition() == load0);
1741}
static volatile float blackhole[4]
Definition Sk4fBench.cpp:13
FieldPtr CloneFromOriginal() const
Definition object.cc:11786
ClassPtr LookupClass(const String &name) const
Definition object.cc:14152

◆ ISOLATE_UNIT_TEST_CASE() [76/463]

dart::ISOLATE_UNIT_TEST_CASE ( DelayAllocations_DelayAcrossCalls  )

Definition at line 1475 of file redundancy_elimination_test.cc.

1475 {
1476 const char* kScript = R"(
1477 class A {
1478 dynamic x, y;
1479 A(this.x, this.y);
1480 }
1481
1482 int count = 0;
1483
1484 @pragma("vm:never-inline")
1485 dynamic foo(int i) => count++ < 2 ? i : '$i';
1486
1487 @pragma("vm:never-inline")
1488 dynamic use(v) {}
1489
1490 void test() {
1491 A a = new A(foo(1), foo(2));
1492 use(a);
1493 }
1494 )";
1495
1496 const auto& root_library = Library::Handle(LoadTestScript(kScript));
1497 const auto& function = Function::Handle(GetFunction(root_library, "test"));
1498
1499 // Get fields to kDynamicCid guard
1500 Invoke(root_library, "test");
1501 Invoke(root_library, "test");
1502
1503 TestPipeline pipeline(function, CompilerPass::kAOT);
1504 FlowGraph* flow_graph = pipeline.RunPasses({});
1505 auto entry = flow_graph->graph_entry()->normal_entry();
1506
1507 StaticCallInstr* call1;
1508 StaticCallInstr* call2;
1509 AllocateObjectInstr* allocate;
1510 StoreFieldInstr* store1;
1511 StoreFieldInstr* store2;
1512
1513 ILMatcher cursor(flow_graph, entry, true, ParallelMovesHandling::kSkip);
1514 RELEASE_ASSERT(cursor.TryMatch({
1515 kMoveGlob,
1516 {kMatchAndMoveStaticCall, &call1},
1517 kMoveGlob,
1518 {kMatchAndMoveStaticCall, &call2},
1519 kMoveGlob,
1520 {kMatchAndMoveAllocateObject, &allocate},
1521 {kMatchAndMoveStoreField, &store1},
1522 {kMatchAndMoveStoreField, &store2},
1523 }));
1524
1525 EXPECT(strcmp(call1->function().UserVisibleNameCString(), "foo") == 0);
1526 EXPECT(strcmp(call2->function().UserVisibleNameCString(), "foo") == 0);
1527 EXPECT(store1->instance()->definition() == allocate);
1528 EXPECT(!store1->ShouldEmitStoreBarrier());
1529 EXPECT(store2->instance()->definition() == allocate);
1530 EXPECT(!store2->ShouldEmitStoreBarrier());
1531}
SI void store2(uint16_t *ptr, U16 r, U16 g)

◆ ISOLATE_UNIT_TEST_CASE() [77/463]

dart::ISOLATE_UNIT_TEST_CASE ( DelayAllocations_DontDelayIntoLoop  )

Definition at line 1533 of file redundancy_elimination_test.cc.

1533 {
1534 const char* kScript = R"(
1535 void test() {
1536 Object o = new Object();
1537 for (int i = 0; i < 10; i++) {
1538 use(o);
1539 }
1540 }
1541
1542 @pragma('vm:never-inline')
1543 void use(Object o) {
1544 print(o.hashCode);
1545 }
1546 )";
1547
1548 const auto& root_library = Library::Handle(LoadTestScript(kScript));
1549 const auto& function = Function::Handle(GetFunction(root_library, "test"));
1550
1551 TestPipeline pipeline(function, CompilerPass::kAOT);
1552 FlowGraph* flow_graph = pipeline.RunPasses({});
1553 auto entry = flow_graph->graph_entry()->normal_entry();
1554
1555 AllocateObjectInstr* allocate;
1556 StaticCallInstr* call;
1557
1558 ILMatcher cursor(flow_graph, entry, true, ParallelMovesHandling::kSkip);
1559 RELEASE_ASSERT(cursor.TryMatch({
1560 kMoveGlob,
1561 {kMatchAndMoveAllocateObject, &allocate},
1562 kMoveGlob,
1563 kMatchAndMoveBranchTrue,
1564 kMoveGlob,
1565 {kMatchAndMoveStaticCall, &call},
1566 }));
1567
1568 EXPECT(strcmp(call->function().UserVisibleNameCString(), "use") == 0);
1569 EXPECT(call->Receiver()->definition() == allocate);
1570}

◆ ISOLATE_UNIT_TEST_CASE() [78/463]

dart::ISOLATE_UNIT_TEST_CASE ( DerivedInduction  )

Definition at line 191 of file loops_test.cc.

◆ ISOLATE_UNIT_TEST_CASE() [79/463]

dart::ISOLATE_UNIT_TEST_CASE ( DescriptorList_TokenPositions  )

Definition at line 124 of file code_descriptors_test.cc.

124 {
125 DescriptorList* descriptors = new DescriptorList(thread->zone());
126 ASSERT(descriptors != nullptr);
127 const int32_t token_positions[] = {
128 kMinInt32,
129 5,
130 13,
131 13,
132 13,
133 13,
134 31,
135 23,
136 23,
137 23,
138 33,
139 33,
140 5,
141 5,
142 TokenPosition::kMinSourcePos,
143 TokenPosition::kMaxSourcePos,
144 };
145 const intptr_t num_token_positions = ARRAY_SIZE(token_positions);
146
147 for (intptr_t i = 0; i < num_token_positions; i++) {
148 const TokenPosition& tp = TokenPosition::Deserialize(token_positions[i]);
149 descriptors->AddDescriptor(UntaggedPcDescriptors::kRuntimeCall, 0, 0, tp, 0,
150 1);
151 }
152
153 const PcDescriptors& finalized_descriptors =
154 PcDescriptors::Handle(descriptors->FinalizePcDescriptors(0));
155
156 ASSERT(!finalized_descriptors.IsNull());
157 PcDescriptors::Iterator it(finalized_descriptors,
158 UntaggedPcDescriptors::kRuntimeCall);
159
160 intptr_t i = 0;
161 while (it.MoveNext()) {
162 const TokenPosition& tp = TokenPosition::Deserialize(token_positions[i]);
163 if (tp != it.TokenPos()) {
164 OS::PrintErr("[%" Pd "]: Expected: %s != %s\n", i, tp.ToCString(),
165 it.TokenPos().ToCString());
166 }
167 EXPECT(tp == it.TokenPos());
168 i++;
169 }
170}
void AddDescriptor(UntaggedPcDescriptors::Kind kind, intptr_t pc_offset, intptr_t deopt_id, TokenPosition token_pos, intptr_t try_index, intptr_t yield_index)
PcDescriptorsPtr FinalizePcDescriptors(uword entry_point)
constexpr int32_t kMinInt32
Definition globals.h:482

◆ ISOLATE_UNIT_TEST_CASE() [80/463]

dart::ISOLATE_UNIT_TEST_CASE ( Disassembler  )

Definition at line 14 of file disassembler_test.cc.

14 {
15 compiler::ObjectPoolBuilder object_pool_builder;
16 compiler::Assembler assembler(&object_pool_builder);
17
18 // The used instructions work on all platforms.
19 Register reg = static_cast<Register>(0);
20 assembler.PopRegister(reg);
21 assembler.Stop("testing disassembler");
22
23 // Only verify that the disassembler does not crash.
24 AssemblerTest test("Disassembler", &assembler, Thread::Current()->zone());
25 test.Assemble();
26 Disassembler::Disassemble(test.entry(), test.entry() + assembler.CodeSize());
27}

◆ ISOLATE_UNIT_TEST_CASE() [81/463]

dart::ISOLATE_UNIT_TEST_CASE ( Disassembler_InvalidInput  )

Definition at line 29 of file disassembler_test.cc.

29 {
30 // Test that Disassembler doesn't crash even if the input is nonsense.
31 uint32_t bad_input[] = {
32 0x00000000, 0xFFFFFFFF, 0x12345678, 0x9ABCDEF0, 0x01110001,
33 0xDEADC0DE, 0xBAADF00D, 0xDABADEEE, 0xDABAD111, 0xB000DEAD,
34 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
35 };
36 Disassembler::Disassemble(
37 reinterpret_cast<uword>(&bad_input[0]),
38 reinterpret_cast<uword>(ARRAY_SIZE(bad_input) + &bad_input[0]));
39}

◆ ISOLATE_UNIT_TEST_CASE() [82/463]

dart::ISOLATE_UNIT_TEST_CASE ( Double  )

Definition at line 577 of file object_test.cc.

577 {
578 {
579 const double dbl_const = 5.0;
580 const Double& dbl = Double::Handle(Double::New(dbl_const));
581 Object& dbl_object = Object::Handle(dbl.ptr());
582 EXPECT(dbl.IsDouble());
583 EXPECT(dbl_object.IsDouble());
584 EXPECT_EQ(dbl_const, dbl.value());
585 }
586
587 {
588 const double dbl_const = -5.0;
589 const Double& dbl = Double::Handle(Double::New(dbl_const));
590 Object& dbl_object = Object::Handle(dbl.ptr());
591 EXPECT(dbl.IsDouble());
592 EXPECT(dbl_object.IsDouble());
593 EXPECT_EQ(dbl_const, dbl.value());
594 }
595
596 {
597 const double dbl_const = 0.0;
598 const Double& dbl = Double::Handle(Double::New(dbl_const));
599 Object& dbl_object = Object::Handle(dbl.ptr());
600 EXPECT(dbl.IsDouble());
601 EXPECT(dbl_object.IsDouble());
602 EXPECT_EQ(dbl_const, dbl.value());
603 }
604
605 {
606 const double dbl_const = 5.0;
607 const String& dbl_str = String::Handle(String::New("5.0"));
608 const Double& dbl1 = Double::Handle(Double::NewCanonical(dbl_const));
609 const Double& dbl2 = Double::Handle(Double::NewCanonical(dbl_const));
610 const Double& dbl3 = Double::Handle(Double::NewCanonical(dbl_str));
611 EXPECT_EQ(dbl_const, dbl1.value());
612 EXPECT_EQ(dbl_const, dbl2.value());
613 EXPECT_EQ(dbl_const, dbl3.value());
614 EXPECT_EQ(dbl1.ptr(), dbl2.ptr());
615 EXPECT_EQ(dbl1.ptr(), dbl3.ptr());
616 }
617
618 {
619 const double dbl_const = 2.0;
620 const Double& dbl1 = Double::Handle(Double::New(dbl_const));
621 const Double& dbl2 = Double::Handle(Double::New(dbl_const));
622 EXPECT(dbl1.OperatorEquals(dbl2));
623 EXPECT(dbl1.IsIdenticalTo(dbl2));
624 EXPECT(dbl1.CanonicalizeEquals(dbl2));
625 const Double& dbl3 = Double::Handle(Double::New(3.3));
626 EXPECT(!dbl1.OperatorEquals(dbl3));
627 EXPECT(!dbl1.OperatorEquals(Smi::Handle(Smi::New(3))));
628 EXPECT(!dbl1.OperatorEquals(Double::Handle()));
629 const Double& nan0 = Double::Handle(Double::New(NAN));
630 EXPECT(isnan(nan0.value()));
631 EXPECT(nan0.IsIdenticalTo(nan0));
632 EXPECT(nan0.CanonicalizeEquals(nan0));
633 EXPECT(!nan0.OperatorEquals(nan0));
634 const Double& nan1 =
635 Double::Handle(Double::New(bit_cast<double>(kMaxUint64 - 0)));
636 const Double& nan2 =
637 Double::Handle(Double::New(bit_cast<double>(kMaxUint64 - 1)));
638 EXPECT(isnan(nan1.value()));
639 EXPECT(isnan(nan2.value()));
640 EXPECT(!nan1.IsIdenticalTo(nan2));
641 EXPECT(!nan1.CanonicalizeEquals(nan2));
642 EXPECT(!nan1.OperatorEquals(nan2));
643 }
644 {
645 const String& dbl_str0 = String::Handle(String::New("bla"));
646 const Double& dbl0 = Double::Handle(Double::New(dbl_str0));
647 EXPECT(dbl0.IsNull());
648
649 const String& dbl_str1 = String::Handle(String::New("2.0"));
650 const Double& dbl1 = Double::Handle(Double::New(dbl_str1));
651 EXPECT_EQ(2.0, dbl1.value());
652
653 // Disallow legacy form.
654 const String& dbl_str2 = String::Handle(String::New("2.0d"));
655 const Double& dbl2 = Double::Handle(Double::New(dbl_str2));
656 EXPECT(dbl2.IsNull());
657 }
658}

◆ ISOLATE_UNIT_TEST_CASE() [83/463]

dart::ISOLATE_UNIT_TEST_CASE ( EmbedSmiInCode  )

Definition at line 2740 of file object_test.cc.

2740 {
2741 extern void GenerateEmbedSmiInCode(compiler::Assembler * assembler,
2742 intptr_t value);
2743 const intptr_t kSmiTestValue = 5;
2744 compiler::ObjectPoolBuilder object_pool_builder;
2745 compiler::Assembler _assembler_(&object_pool_builder);
2746 GenerateEmbedSmiInCode(&_assembler_, kSmiTestValue);
2747 const Function& function =
2748 Function::Handle(CreateFunction("Test_EmbedSmiInCode"));
2749 SafepointWriteRwLocker locker(thread,
2750 thread->isolate_group()->program_lock());
2751 const Code& code = Code::Handle(Code::FinalizeCodeAndNotify(
2752 function, nullptr, &_assembler_, Code::PoolAttachment::kAttachPool));
2753 function.AttachCode(code);
2754 const Object& result =
2755 Object::Handle(DartEntry::InvokeFunction(function, Array::empty_array()));
2756 EXPECT(Smi::Cast(result).Value() == kSmiTestValue);
2757}

◆ ISOLATE_UNIT_TEST_CASE() [84/463]

dart::ISOLATE_UNIT_TEST_CASE ( EmbedStringInCode  )

Definition at line 2713 of file object_test.cc.

2713 {
2714 extern void GenerateEmbedStringInCode(compiler::Assembler * assembler,
2715 const char* str);
2716 const char* kHello = "Hello World!";
2717 word expected_length = static_cast<word>(strlen(kHello));
2718 compiler::ObjectPoolBuilder object_pool_builder;
2719 compiler::Assembler _assembler_(&object_pool_builder);
2720 GenerateEmbedStringInCode(&_assembler_, kHello);
2721 const Function& function =
2722 Function::Handle(CreateFunction("Test_EmbedStringInCode"));
2723 SafepointWriteRwLocker locker(thread,
2724 thread->isolate_group()->program_lock());
2725 const Code& code = Code::Handle(Code::FinalizeCodeAndNotify(
2726 function, nullptr, &_assembler_, Code::PoolAttachment::kAttachPool));
2727 function.AttachCode(code);
2728 const Object& result =
2729 Object::Handle(DartEntry::InvokeFunction(function, Array::empty_array()));
2730 EXPECT(result.ptr()->IsHeapObject());
2731 String& string_object = String::Handle();
2732 string_object ^= result.ptr();
2733 EXPECT(string_object.Length() == expected_length);
2734 for (int i = 0; i < expected_length; i++) {
2735 EXPECT(string_object.CharAt(i) == kHello[i]);
2736 }
2737}

◆ ISOLATE_UNIT_TEST_CASE() [85/463]

dart::ISOLATE_UNIT_TEST_CASE ( EmptyDartStackFrameIteration  )

Definition at line 30 of file stack_frame_test.cc.

30 {
31 DartFrameIterator iterator(Thread::Current(),
32 StackFrameIterator::kNoCrossThreadIteration);
33 EXPECT(iterator.NextFrame() == nullptr);
34 VerifyPointersVisitor::VerifyPointers("EmptyDartStackFrameIterationTest");
35}

◆ ISOLATE_UNIT_TEST_CASE() [86/463]

dart::ISOLATE_UNIT_TEST_CASE ( EmptyInstantiationsCacheArray  )

Definition at line 1847 of file object_test.cc.

1847 {
1849 thread->isolate_group()->type_arguments_canonicalization_mutex());
1850 const Array& empty_cache = Object::empty_instantiations_cache_array();
1851 DEBUG_ONLY(EXPECT(TypeArguments::Cache::IsValidStorageLocked(empty_cache));)
1852 const TypeArguments::Cache cache(thread->zone(), empty_cache);
1853 EXPECT(cache.IsLinear());
1854 EXPECT(!cache.IsHash());
1855 EXPECT_EQ(0, cache.NumOccupied());
1856 const InstantiationsCacheTable table(empty_cache);
1857 EXPECT_EQ(1, table.Length());
1858 for (const auto& tuple : table) {
1859 EXPECT(tuple.Get<TypeArguments::Cache::kSentinelIndex>() ==
1860 TypeArguments::Cache::Sentinel());
1861 }
1862}
#define DEBUG_ONLY(code)
Definition globals.h:141

◆ ISOLATE_UNIT_TEST_CASE() [87/463]

dart::ISOLATE_UNIT_TEST_CASE ( EmptyStackFrameIteration  )

Definition at line 20 of file stack_frame_test.cc.

20 {
21 StackFrameIterator iterator(ValidationPolicy::kValidateFrames,
22 Thread::Current(),
23 StackFrameIterator::kNoCrossThreadIteration);
24 EXPECT(!iterator.HasNextFrame());
25 EXPECT(iterator.NextFrame() == nullptr);
26 VerifyPointersVisitor::VerifyPointers("EmptyStackFrameIterationTest");
27}

◆ ISOLATE_UNIT_TEST_CASE() [88/463]

dart::ISOLATE_UNIT_TEST_CASE ( EqualsIgnoringPrivate  )

Definition at line 3219 of file object_test.cc.

3219 {
3220 String& mangled_name = String::Handle();
3221 String& bare_name = String::Handle();
3222
3223 // Simple matches.
3224 mangled_name = OneByteString::New("foo");
3225 bare_name = OneByteString::New("foo");
3226 EXPECT(String::EqualsIgnoringPrivateKey(mangled_name, bare_name));
3227
3228 mangled_name = OneByteString::New("foo.");
3229 bare_name = OneByteString::New("foo.");
3230 EXPECT(String::EqualsIgnoringPrivateKey(mangled_name, bare_name));
3231
3232 mangled_name = OneByteString::New("foo.named");
3233 bare_name = OneByteString::New("foo.named");
3234 EXPECT(String::EqualsIgnoringPrivateKey(mangled_name, bare_name));
3235
3236 // Simple mismatches.
3237 mangled_name = OneByteString::New("bar");
3238 bare_name = OneByteString::New("foo");
3239 EXPECT(!String::EqualsIgnoringPrivateKey(mangled_name, bare_name));
3240
3241 mangled_name = OneByteString::New("foo.");
3242 bare_name = OneByteString::New("foo");
3243 EXPECT(!String::EqualsIgnoringPrivateKey(mangled_name, bare_name));
3244
3245 mangled_name = OneByteString::New("foo");
3246 bare_name = OneByteString::New("foo.");
3247 EXPECT(!String::EqualsIgnoringPrivateKey(mangled_name, bare_name));
3248
3249 mangled_name = OneByteString::New("foo.name");
3250 bare_name = OneByteString::New("foo.named");
3251 EXPECT(!String::EqualsIgnoringPrivateKey(mangled_name, bare_name));
3252
3253 mangled_name = OneByteString::New("foo.named");
3254 bare_name = OneByteString::New("foo.name");
3255 EXPECT(!String::EqualsIgnoringPrivateKey(mangled_name, bare_name));
3256
3257 // Private match.
3258 mangled_name = OneByteString::New("foo@12345");
3259 bare_name = OneByteString::New("foo");
3260 EXPECT(String::EqualsIgnoringPrivateKey(mangled_name, bare_name));
3261
3262 // Private mismatch.
3263 mangled_name = OneByteString::New("food@12345");
3264 bare_name = OneByteString::New("foo");
3265 EXPECT(!String::EqualsIgnoringPrivateKey(mangled_name, bare_name));
3266
3267 // Private mismatch 2.
3268 mangled_name = OneByteString::New("foo@12345");
3269 bare_name = OneByteString::New("food");
3270 EXPECT(!String::EqualsIgnoringPrivateKey(mangled_name, bare_name));
3271
3272 // Private mixin application match.
3273 mangled_name = OneByteString::New("_M1@12345&_M2@12345&_M3@12345");
3274 bare_name = OneByteString::New("_M1&_M2&_M3");
3275 EXPECT(String::EqualsIgnoringPrivateKey(mangled_name, bare_name));
3276
3277 // Private mixin application mismatch.
3278 mangled_name = OneByteString::New("_M1@12345&_M2@12345&_M3@12345");
3279 bare_name = OneByteString::New("_M1&_M2&_M4");
3280 EXPECT(!String::EqualsIgnoringPrivateKey(mangled_name, bare_name));
3281
3282 // Private constructor match.
3283 mangled_name = OneByteString::New("foo@12345.");
3284 bare_name = OneByteString::New("foo.");
3285 EXPECT(String::EqualsIgnoringPrivateKey(mangled_name, bare_name));
3286
3287 // Private constructor mismatch.
3288 mangled_name = OneByteString::New("foo@12345.");
3289 bare_name = OneByteString::New("foo");
3290 EXPECT(!String::EqualsIgnoringPrivateKey(mangled_name, bare_name));
3291
3292 // Private constructor mismatch 2.
3293 mangled_name = OneByteString::New("foo@12345");
3294 bare_name = OneByteString::New("foo.");
3295 EXPECT(!String::EqualsIgnoringPrivateKey(mangled_name, bare_name));
3296
3297 // Named private constructor match.
3298 mangled_name = OneByteString::New("foo@12345.named");
3299 bare_name = OneByteString::New("foo.named");
3300 EXPECT(String::EqualsIgnoringPrivateKey(mangled_name, bare_name));
3301
3302 // Named private constructor mismatch.
3303 mangled_name = OneByteString::New("foo@12345.name");
3304 bare_name = OneByteString::New("foo.named");
3305 EXPECT(!String::EqualsIgnoringPrivateKey(mangled_name, bare_name));
3306
3307 // Named private constructor mismatch 2.
3308 mangled_name = OneByteString::New("foo@12345.named");
3309 bare_name = OneByteString::New("foo.name");
3310 EXPECT(!String::EqualsIgnoringPrivateKey(mangled_name, bare_name));
3311
3312 // Named double-private constructor match. Yes, this happens.
3313 mangled_name = OneByteString::New("foo@12345.named@12345");
3314 bare_name = OneByteString::New("foo.named");
3315 EXPECT(String::EqualsIgnoringPrivateKey(mangled_name, bare_name));
3316
3317 // Named double-private constructor match where the caller knows the private
3318 // key. Yes, this also happens.
3319 mangled_name = OneByteString::New("foo@12345.named@12345");
3320 bare_name = OneByteString::New("foo@12345.named");
3321 EXPECT(String::EqualsIgnoringPrivateKey(mangled_name, bare_name));
3322
3323 // Named double-private constructor mismatch.
3324 mangled_name = OneByteString::New("foo@12345.name@12345");
3325 bare_name = OneByteString::New("foo.named");
3326 EXPECT(!String::EqualsIgnoringPrivateKey(mangled_name, bare_name));
3327
3328 // Named double-private constructor mismatch.
3329 mangled_name = OneByteString::New("foo@12345.named@12345");
3330 bare_name = OneByteString::New("foo.name");
3331 EXPECT(!String::EqualsIgnoringPrivateKey(mangled_name, bare_name));
3332}

◆ ISOLATE_UNIT_TEST_CASE() [89/463]

dart::ISOLATE_UNIT_TEST_CASE ( EscapeSpecialCharactersOneByteString  )

Definition at line 1645 of file object_test.cc.

1645 {
1646 uint8_t characters[] = {'a', '\n', '\f', '\b', '\t',
1647 '\v', '\r', '\\', '$', 'z'};
1648 intptr_t len = ARRAY_SIZE(characters);
1649
1650 const String& str =
1651 String::Handle(OneByteString::New(characters, len, Heap::kNew));
1652 EXPECT(str.IsOneByteString());
1653 EXPECT_EQ(str.Length(), len);
1654 EXPECT(str.Equals("a\n\f\b\t\v\r\\$z"));
1655 const String& escaped_str =
1656 String::Handle(String::EscapeSpecialCharacters(str));
1657 EXPECT(escaped_str.Equals("a\\n\\f\\b\\t\\v\\r\\\\\\$z"));
1658
1659 const String& escaped_empty_str =
1660 String::Handle(String::EscapeSpecialCharacters(Symbols::Empty()));
1661 EXPECT_EQ(escaped_empty_str.Length(), 0);
1662}

◆ ISOLATE_UNIT_TEST_CASE() [90/463]

dart::ISOLATE_UNIT_TEST_CASE ( EscapeSpecialCharactersTwoByteString  )

Definition at line 1664 of file object_test.cc.

1664 {
1665 uint16_t characters[] = {'a', '\n', '\f', '\b', '\t',
1666 '\v', '\r', '\\', '$', 'z'};
1667 intptr_t len = ARRAY_SIZE(characters);
1668
1669 const String& str =
1670 String::Handle(TwoByteString::New(characters, len, Heap::kNew));
1671 EXPECT(str.IsTwoByteString());
1672 EXPECT_EQ(str.Length(), len);
1673 EXPECT(str.Equals("a\n\f\b\t\v\r\\$z"));
1674 const String& escaped_str =
1675 String::Handle(String::EscapeSpecialCharacters(str));
1676 EXPECT(escaped_str.Equals("a\\n\\f\\b\\t\\v\\r\\\\\\$z"));
1677
1678 const String& empty_str =
1679 String::Handle(TwoByteString::New(static_cast<intptr_t>(0), Heap::kNew));
1680 const String& escaped_empty_str =
1681 String::Handle(String::EscapeSpecialCharacters(empty_str));
1682 EXPECT_EQ(empty_str.Length(), 0);
1683 EXPECT_EQ(escaped_empty_str.Length(), 0);
1684}

◆ ISOLATE_UNIT_TEST_CASE() [91/463]

dart::ISOLATE_UNIT_TEST_CASE ( EvalExpressionExhaustCIDs  )

Definition at line 254 of file compiler_test.cc.

254 {
255 { // Initialize an incremental compiler in DFE mode.
256 TransitionVMToNative transition(thread);
257 TestCase::LoadTestScript("", nullptr);
258 }
259 Library& lib = Library::Handle(Library::CoreLibrary());
260 const String& expression = String::Handle(String::New("3 + 4"));
261 Object& val = Object::Handle();
262 val = Api::UnwrapHandle(
263 TestCase::EvaluateExpression(lib, expression,
264 /* param_names= */ Array::empty_array(),
265 /* param_values= */ Array::empty_array()));
266
267 EXPECT(!val.IsNull());
268 EXPECT(!val.IsError());
269 EXPECT(val.IsInteger());
270 EXPECT_EQ(7, Integer::Cast(val).AsInt64Value());
271
272 auto class_table = IsolateGroup::Current()->class_table();
273
274 intptr_t initial_class_table_size = class_table->NumCids();
275
276 val = Api::UnwrapHandle(
277 TestCase::EvaluateExpression(lib, expression,
278 /* param_names= */ Array::empty_array(),
279 /* param_values= */ Array::empty_array()));
280 EXPECT(!val.IsNull());
281 EXPECT(!val.IsError());
282 EXPECT(val.IsInteger());
283 EXPECT_EQ(7, Integer::Cast(val).AsInt64Value());
284
285 intptr_t final_class_table_size = class_table->NumCids();
286 // Eval should not eat into this non-renewable resource.
287 EXPECT_EQ(initial_class_table_size, final_class_table_size);
288}

◆ ISOLATE_UNIT_TEST_CASE() [92/463]

dart::ISOLATE_UNIT_TEST_CASE ( EvalExpressionWithLazyCompile  )

Definition at line 234 of file compiler_test.cc.

234 {
235 { // Initialize an incremental compiler in DFE mode.
236 TransitionVMToNative transition(thread);
237 TestCase::LoadTestScript("", nullptr);
238 }
239 Library& lib = Library::Handle(Library::CoreLibrary());
240 const String& expression = String::Handle(
241 String::New("(){ return (){ return (){ return 3 + 4; }(); }(); }()"));
242 Object& val = Object::Handle();
243 val = Api::UnwrapHandle(
244 TestCase::EvaluateExpression(lib, expression,
245 /* param_names= */ Array::empty_array(),
246 /* param_values= */ Array::empty_array()));
247
248 EXPECT(!val.IsNull());
249 EXPECT(!val.IsError());
250 EXPECT(val.IsInteger());
251 EXPECT_EQ(7, Integer::Cast(val).AsInt64Value());
252}

◆ ISOLATE_UNIT_TEST_CASE() [93/463]

dart::ISOLATE_UNIT_TEST_CASE ( ExceptionHandlers  )

Definition at line 2781 of file object_test.cc.

2781 {
2782 const int kNumEntries = 4;
2783 // Add an exception handler table to the code.
2784 ExceptionHandlers& exception_handlers = ExceptionHandlers::Handle();
2785 exception_handlers ^= ExceptionHandlers::New(kNumEntries);
2786 const bool kNeedsStackTrace = true;
2787 const bool kNoStackTrace = false;
2788 exception_handlers.SetHandlerInfo(0, -1, 20u, kNeedsStackTrace, false, true);
2789 exception_handlers.SetHandlerInfo(1, 0, 30u, kNeedsStackTrace, false, true);
2790 exception_handlers.SetHandlerInfo(2, -1, 40u, kNoStackTrace, true, true);
2791 exception_handlers.SetHandlerInfo(3, 1, 150u, kNoStackTrace, true, true);
2792
2793 extern void GenerateIncrement(compiler::Assembler * assembler);
2794 compiler::ObjectPoolBuilder object_pool_builder;
2795 compiler::Assembler _assembler_(&object_pool_builder);
2796 GenerateIncrement(&_assembler_);
2797 SafepointWriteRwLocker locker(thread,
2798 thread->isolate_group()->program_lock());
2799 Code& code = Code::Handle(Code::FinalizeCodeAndNotify(
2800 Function::Handle(CreateFunction("Test_Code")), nullptr, &_assembler_,
2801 Code::PoolAttachment::kAttachPool));
2802 code.set_exception_handlers(exception_handlers);
2803
2804 // Verify the exception handler table entries by accessing them.
2805 const ExceptionHandlers& handlers =
2806 ExceptionHandlers::Handle(code.exception_handlers());
2807 EXPECT_EQ(kNumEntries, handlers.num_entries());
2809 handlers.GetHandlerInfo(0, &info);
2810 EXPECT_EQ(-1, handlers.OuterTryIndex(0));
2811 EXPECT_EQ(-1, info.outer_try_index);
2812 EXPECT_EQ(20u, handlers.HandlerPCOffset(0));
2813 EXPECT(handlers.NeedsStackTrace(0));
2814 EXPECT(!handlers.HasCatchAll(0));
2815 EXPECT_EQ(20u, info.handler_pc_offset);
2816 EXPECT_EQ(1, handlers.OuterTryIndex(3));
2817 EXPECT_EQ(150u, handlers.HandlerPCOffset(3));
2818 EXPECT(!handlers.NeedsStackTrace(3));
2819 EXPECT(handlers.HasCatchAll(3));
2820}
intptr_t OuterTryIndex(intptr_t try_index) const
Definition object.cc:16248
bool HasCatchAll(intptr_t try_index) const
Definition object.cc:16263
void GetHandlerInfo(intptr_t try_index, ExceptionHandlerInfo *info) const
Definition object.cc:16236
uword HandlerPCOffset(intptr_t try_index) const
Definition object.cc:16243
bool NeedsStackTrace(intptr_t try_index) const
Definition object.cc:16253
void SetHandlerInfo(intptr_t try_index, intptr_t outer_try_index, uword handler_pc_offset, bool needs_stacktrace, bool has_catch_all, bool is_generated) const
Definition object.cc:16215
intptr_t num_entries() const
Definition object.cc:16200

◆ ISOLATE_UNIT_TEST_CASE() [94/463]

dart::ISOLATE_UNIT_TEST_CASE ( ExerciseTLABs  )

Definition at line 942 of file thread_test.cc.

942 {
943 const int NUMBER_TEST_THREADS = 10;
944 Monitor done_monitor[NUMBER_TEST_THREADS];
945 bool done[NUMBER_TEST_THREADS];
946 auto isolate_group = thread->isolate_group();
947 for (int i = 0; i < NUMBER_TEST_THREADS; i++) {
948 done[i] = false;
949 Dart::thread_pool()->Run<AllocateGlobsOfMemoryTask>(
950 isolate_group, &done_monitor[i], &done[i]);
951 }
952
953 for (int i = 0; i < NUMBER_TEST_THREADS; i++) {
954 MonitorLocker ml(&done_monitor[i]);
955 while (!done[i]) {
956 ml.WaitWithSafepointCheck(thread);
957 }
958 }
959}

◆ ISOLATE_UNIT_TEST_CASE() [95/463]

dart::ISOLATE_UNIT_TEST_CASE ( ExternalAllocationStats  )

Definition at line 607 of file heap_test.cc.

607 {
608 auto isolate_group = thread->isolate_group();
609 Heap* heap = isolate_group->heap();
610
611 Array& old = Array::Handle(Array::New(100, Heap::kOld));
612 Array& neu = Array::Handle();
613 for (intptr_t i = 0; i < 100; i++) {
614 neu = Array::New(1, Heap::kNew);
615 FinalizablePersistentHandle::New(isolate_group, neu, nullptr, NoopFinalizer,
616 1 * MB,
617 /*auto_delete=*/true);
618 old.SetAt(i, neu);
619
620 if ((i % 4) == 0) {
621 HeapTestHelper::MarkSweep(thread);
622 } else {
623 HeapTestHelper::Scavenge(thread);
624 }
625
626 CountObjectsVisitor visitor(thread,
627 isolate_group->class_table()->NumCids());
628 HeapIterationScope iter(thread);
629 iter.IterateObjects(&visitor);
630 isolate_group->VisitWeakPersistentHandles(&visitor);
631 EXPECT_LE(visitor.old_external_size_[kArrayCid],
632 heap->old_space()->ExternalInWords() * kWordSize);
633 EXPECT_LE(visitor.new_external_size_[kArrayCid],
634 heap->new_space()->ExternalInWords() * kWordSize);
635 }
636}
intptr_t ExternalInWords() const
Definition pages.h:207
intptr_t ExternalInWords() const
Definition scavenger.h:168

◆ ISOLATE_UNIT_TEST_CASE() [96/463]

dart::ISOLATE_UNIT_TEST_CASE ( ExternalPromotion  )

Definition at line 438 of file heap_test.cc.

438 {
439 auto isolate_group = IsolateGroup::Current();
440 Heap* heap = isolate_group->heap();
441
442 heap->CollectAllGarbage();
443 intptr_t size_before = kWordSize * (heap->new_space()->ExternalInWords() +
444 heap->old_space()->ExternalInWords());
445
446 Array& old = Array::Handle(Array::New(100, Heap::kOld));
447 Array& neu = Array::Handle();
448 for (intptr_t i = 0; i < 100; i++) {
449 neu = Array::New(1, Heap::kNew);
450 FinalizablePersistentHandle::New(isolate_group, neu, nullptr, NoopFinalizer,
451 1 * MB,
452 /*auto_delete=*/true);
453 old.SetAt(i, neu);
454 }
455
456 intptr_t size_middle = kWordSize * (heap->new_space()->ExternalInWords() +
457 heap->old_space()->ExternalInWords());
458 EXPECT_EQ(size_before + 100 * MB, size_middle);
459
460 old = Array::null();
461 neu = Array::null();
462
463 heap->CollectAllGarbage();
464
465 intptr_t size_after = kWordSize * (heap->new_space()->ExternalInWords() +
466 heap->old_space()->ExternalInWords());
467
468 EXPECT_EQ(size_before, size_after);
469}

◆ ISOLATE_UNIT_TEST_CASE() [97/463]

dart::ISOLATE_UNIT_TEST_CASE ( ExternalSizeLimit  )

Definition at line 638 of file heap_test.cc.

638 {
639 // This test checks that the tracked total size of external data never exceeds
640 // the amount of memory on the system. To accomplish this, the test performs
641 // five calls to FinalizablePersistentHandle::New(), all supplying a size
642 // argument that is barely (16 bytes) less than a quarter of kMaxAddrSpaceMB.
643 // So, we expect the first four calls to succeed, and the fifth one to return
644 // nullptr.
645
646 auto isolate_group = thread->isolate_group();
647 Heap* heap = isolate_group->heap();
648
649 // We declare an array of only length 1 here to get around the limit of
650 // ExternalTypedData::MaxElements(kExternalTypedDataUint8ArrayCid). Below, we
651 // pretend that the length is longer when calling
652 // FinalizablePersistentHandle::New(), which is what updates the external size
653 // tracker.
654 const intptr_t data_length = 1;
655 uint8_t data[data_length] = {0};
656 const ExternalTypedData& external_typed_data_1 =
657 ExternalTypedData::Handle(ExternalTypedData::New(
658 kExternalTypedDataUint8ArrayCid, data, data_length, Heap::kOld));
659 const ExternalTypedData& external_typed_data_2 =
660 ExternalTypedData::Handle(ExternalTypedData::New(
661 kExternalTypedDataUint8ArrayCid, data, data_length, Heap::kOld));
662 const ExternalTypedData& external_typed_data_3 =
663 ExternalTypedData::Handle(ExternalTypedData::New(
664 kExternalTypedDataUint8ArrayCid, data, data_length, Heap::kOld));
665 const ExternalTypedData& external_typed_data_4 =
666 ExternalTypedData::Handle(ExternalTypedData::New(
667 kExternalTypedDataUint8ArrayCid, data, data_length, Heap::kOld));
668 const ExternalTypedData& external_typed_data_5 =
669 ExternalTypedData::Handle(ExternalTypedData::New(
670 kExternalTypedDataUint8ArrayCid, data, data_length, Heap::kOld));
671
672 // A size that is less than a quarter of kMaxAddrSpaceMB is used because it
673 // needs to be less than or equal to std::numeric_limits<intptr_t>::max().
674 const intptr_t external_allocation_size =
675 (intptr_t{kMaxAddrSpaceMB / 4} << MBLog2) - 16;
676 EXPECT_NOTNULL(FinalizablePersistentHandle::New(
677 isolate_group, external_typed_data_1, nullptr, NoopFinalizer,
678 external_allocation_size,
679 /*auto_delete=*/true));
680 EXPECT_LT(heap->old_space()->ExternalInWords(), kMaxAddrSpaceInWords);
681
682 EXPECT_NOTNULL(FinalizablePersistentHandle::New(
683 isolate_group, external_typed_data_2, nullptr, NoopFinalizer,
684 external_allocation_size,
685 /*auto_delete=*/true));
686 EXPECT_LT(heap->old_space()->ExternalInWords(), kMaxAddrSpaceInWords);
687
688 EXPECT_NOTNULL(FinalizablePersistentHandle::New(
689 isolate_group, external_typed_data_3, nullptr, NoopFinalizer,
690 external_allocation_size,
691 /*auto_delete=*/true));
692 EXPECT_LT(heap->old_space()->ExternalInWords(), kMaxAddrSpaceInWords);
693
694 EXPECT_NOTNULL(FinalizablePersistentHandle::New(
695 isolate_group, external_typed_data_4, nullptr, NoopFinalizer,
696 external_allocation_size,
697 /*auto_delete=*/true));
698 EXPECT_LT(heap->old_space()->ExternalInWords(), kMaxAddrSpaceInWords);
699
700 EXPECT_NULLPTR(FinalizablePersistentHandle::New(
701 isolate_group, external_typed_data_5, nullptr, NoopFinalizer,
702 external_allocation_size,
703 /*auto_delete=*/true));
704 // Check that the external size is indeed protected from overflowing.
705 EXPECT_LT(heap->old_space()->ExternalInWords(), kMaxAddrSpaceInWords);
706}
constexpr intptr_t MBLog2
Definition globals.h:529

◆ ISOLATE_UNIT_TEST_CASE() [98/463]

dart::ISOLATE_UNIT_TEST_CASE ( ExternalTypedData  )

Definition at line 2292 of file object_test.cc.

2292 {
2293 uint8_t data[] = {253, 254, 255, 0, 1, 2, 3, 4};
2294 intptr_t data_length = ARRAY_SIZE(data);
2295
2296 const ExternalTypedData& int8_array =
2297 ExternalTypedData::Handle(ExternalTypedData::New(
2298 kExternalTypedDataInt8ArrayCid, data, data_length));
2299 EXPECT(!int8_array.IsNull());
2300 EXPECT_EQ(data_length, int8_array.Length());
2301
2302 const ExternalTypedData& uint8_array =
2303 ExternalTypedData::Handle(ExternalTypedData::New(
2304 kExternalTypedDataUint8ArrayCid, data, data_length));
2305 EXPECT(!uint8_array.IsNull());
2306 EXPECT_EQ(data_length, uint8_array.Length());
2307
2308 const ExternalTypedData& uint8_clamped_array =
2309 ExternalTypedData::Handle(ExternalTypedData::New(
2310 kExternalTypedDataUint8ClampedArrayCid, data, data_length));
2311 EXPECT(!uint8_clamped_array.IsNull());
2312 EXPECT_EQ(data_length, uint8_clamped_array.Length());
2313
2314 EXPECT_EQ(-3, int8_array.GetInt8(0));
2315 EXPECT_EQ(253, uint8_array.GetUint8(0));
2316 EXPECT_EQ(253, uint8_clamped_array.GetUint8(0));
2317
2318 EXPECT_EQ(-2, int8_array.GetInt8(1));
2319 EXPECT_EQ(254, uint8_array.GetUint8(1));
2320 EXPECT_EQ(254, uint8_clamped_array.GetUint8(1));
2321
2322 EXPECT_EQ(-1, int8_array.GetInt8(2));
2323 EXPECT_EQ(255, uint8_array.GetUint8(2));
2324 EXPECT_EQ(255, uint8_clamped_array.GetUint8(2));
2325
2326 EXPECT_EQ(0, int8_array.GetInt8(3));
2327 EXPECT_EQ(0, uint8_array.GetUint8(3));
2328 EXPECT_EQ(0, uint8_clamped_array.GetUint8(3));
2329
2330 EXPECT_EQ(1, int8_array.GetInt8(4));
2331 EXPECT_EQ(1, uint8_array.GetUint8(4));
2332 EXPECT_EQ(1, uint8_clamped_array.GetUint8(4));
2333
2334 EXPECT_EQ(2, int8_array.GetInt8(5));
2335 EXPECT_EQ(2, uint8_array.GetUint8(5));
2336 EXPECT_EQ(2, uint8_clamped_array.GetUint8(5));
2337
2338 for (intptr_t i = 0; i < int8_array.Length(); ++i) {
2339 EXPECT_EQ(int8_array.GetUint8(i), uint8_array.GetUint8(i));
2340 }
2341
2342 int8_array.SetInt8(2, -123);
2343 uint8_array.SetUint8(0, 123);
2344 for (intptr_t i = 0; i < int8_array.Length(); ++i) {
2345 EXPECT_EQ(int8_array.GetInt8(i), uint8_array.GetInt8(i));
2346 }
2347
2348 uint8_clamped_array.SetUint8(0, 123);
2349 for (intptr_t i = 0; i < int8_array.Length(); ++i) {
2350 EXPECT_EQ(int8_array.GetUint8(i), uint8_clamped_array.GetUint8(i));
2351 }
2352}

◆ ISOLATE_UNIT_TEST_CASE() [99/463]

dart::ISOLATE_UNIT_TEST_CASE ( FfiCallbackMetadata_BigRandomMultithreadedTest  )

Definition at line 606 of file ffi_callback_metadata_test.cc.

609 {
610 static constexpr int kThreads = 5;
611
612 std::vector<std::thread> threads;
613
614 Random random;
615 for (int i = 0; i < kThreads; ++i) {
616 threads.push_back(
617 std::thread(RunBigRandomMultithreadedTest, random.NextUInt64()));
618 }
619
620 for (auto& thread : threads) {
uint64_t NextUInt64()
Definition random.h:26

◆ ISOLATE_UNIT_TEST_CASE() [100/463]

dart::ISOLATE_UNIT_TEST_CASE ( FfiCallbackMetadata_TrampolineRecycling  )

Definition at line 367 of file ffi_callback_metadata_test.cc.

370 {
371 Isolate* isolate = thread->isolate();
372 auto* zone = thread->zone();
373 auto* fcm = FfiCallbackMetadata::Instance();
374
375 const Function& func =
376 Function::Handle(CreateTestFunction(FfiCallbackKind::kAsyncCallback));
377 const Code& code = Code::Handle(func.EnsureHasCode());
378 EXPECT(!code.IsNull());
379
380 auto port = PortMap::CreatePort(new FakeMessageHandler());
381 FfiCallbackMetadata::Metadata* list_head = nullptr;
382
383 // Allocate and free one callback at a time, and verify that we don't reuse
384 // them. Allocate enough that the whole page fills up with dead trampolines.
385 std::vector<FfiCallbackMetadata::Trampoline> allocation_order;
386 std::unordered_set<FfiCallbackMetadata::Trampoline> allocated;
387 const intptr_t trampolines_per_page =
388 FfiCallbackMetadata::NumCallbackTrampolinesPerPage();
389 for (intptr_t i = 0; i < trampolines_per_page; ++i) {
390 auto tramp =
391 fcm->CreateAsyncFfiCallback(isolate, zone, func, port, &list_head);
392 EXPECT_EQ(allocated.count(tramp), 0u);
393 allocation_order.push_back(tramp);
394 allocated.insert(tramp);
395 fcm->DeleteCallback(tramp, &list_head);
396 }
397
398 // Now as we continue allocating and freeing, we start reusing them, in the
399 // same allocation order as before.
400 for (intptr_t i = 0; i < trampolines_per_page; ++i) {
401 auto tramp =
402 fcm->CreateAsyncFfiCallback(isolate, zone, func, port, &list_head);
403 EXPECT_EQ(allocated.count(tramp), 1u);
404 EXPECT_EQ(allocation_order[i], tramp);
405 fcm->DeleteCallback(tramp, &list_head);
406 }
407
408 // Now allocate enough to fill the page without freeing them. Again they
409 // should come out in the same order.
410 for (intptr_t i = 0; i < trampolines_per_page; ++i) {
411 auto tramp =
412 fcm->CreateAsyncFfiCallback(isolate, zone, func, port, &list_head);
413 EXPECT_EQ(allocated.count(tramp), 1u);
414 EXPECT_EQ(allocation_order[i], tramp);
415 }
416
417 // Now that the page is full, we should allocate a new page and see new
418 // trampolines we haven't seen before.
419 for (intptr_t i = 0; i < 3 * trampolines_per_page; ++i) {
420 auto tramp =
421 fcm->CreateAsyncFfiCallback(isolate, zone, func, port, &list_head);
FunctionPtr CreateTestFunction(FfiCallbackKind kind)

◆ ISOLATE_UNIT_TEST_CASE() [101/463]

dart::ISOLATE_UNIT_TEST_CASE ( FieldTests  )

Definition at line 3200 of file object_test.cc.

3200 {
3201 const String& f = String::Handle(String::New("oneField"));
3202 const String& getter_f = String::Handle(Field::GetterName(f));
3203 const String& setter_f = String::Handle(Field::SetterName(f));
3204 EXPECT(!Field::IsGetterName(f));
3205 EXPECT(!Field::IsSetterName(f));
3206 EXPECT(Field::IsGetterName(getter_f));
3207 EXPECT(!Field::IsSetterName(getter_f));
3208 EXPECT(!Field::IsGetterName(setter_f));
3209 EXPECT(Field::IsSetterName(setter_f));
3210 EXPECT_STREQ(f.ToCString(),
3211 String::Handle(Field::NameFromGetter(getter_f)).ToCString());
3212 EXPECT_STREQ(f.ToCString(),
3213 String::Handle(Field::NameFromSetter(setter_f)).ToCString());
3214}

◆ ISOLATE_UNIT_TEST_CASE() [102/463]

dart::ISOLATE_UNIT_TEST_CASE ( Finalizer_ClearDetachOne_NewSpace  )

Definition at line 3967 of file object_test.cc.

3967 {
3968 Finalizer_ClearDetachOne(thread, Heap::kNew);
3969}
static void Finalizer_ClearDetachOne(Thread *thread, Heap::Space space)

◆ ISOLATE_UNIT_TEST_CASE() [103/463]

dart::ISOLATE_UNIT_TEST_CASE ( Finalizer_ClearDetachOne_OldSpace  )

Definition at line 3971 of file object_test.cc.

3971 {
3972 Finalizer_ClearDetachOne(thread, Heap::kOld);
3973}

◆ ISOLATE_UNIT_TEST_CASE() [104/463]

dart::ISOLATE_UNIT_TEST_CASE ( Finalizer_ClearDetachTwo_NewSpace  )

Definition at line 4321 of file object_test.cc.

4321 {
4322 Finalizer_TwoEntries(thread, Heap::kNew, false, false, true, true);
4323}
static void Finalizer_TwoEntries(Thread *thread, Heap::Space space, bool clear_value_1, bool clear_value_2, bool clear_detach_1, bool clear_detach_2)

◆ ISOLATE_UNIT_TEST_CASE() [105/463]

dart::ISOLATE_UNIT_TEST_CASE ( Finalizer_ClearDetachTwo_OldSpace  )

Definition at line 4325 of file object_test.cc.

4325 {
4326 Finalizer_TwoEntries(thread, Heap::kOld, false, false, true, true);
4327}

◆ ISOLATE_UNIT_TEST_CASE() [106/463]

dart::ISOLATE_UNIT_TEST_CASE ( Finalizer_ClearFirstValue_NewSpace  )

Definition at line 4297 of file object_test.cc.

4297 {
4298 Finalizer_TwoEntries(thread, Heap::kNew, true, false, false, false);
4299}

◆ ISOLATE_UNIT_TEST_CASE() [107/463]

dart::ISOLATE_UNIT_TEST_CASE ( Finalizer_ClearFirstValue_OldSpace  )

Definition at line 4301 of file object_test.cc.

4301 {
4302 Finalizer_TwoEntries(thread, Heap::kOld, true, false, false, false);
4303}

◆ ISOLATE_UNIT_TEST_CASE() [108/463]

dart::ISOLATE_UNIT_TEST_CASE ( Finalizer_ClearSecondValue_NewSpace  )

Definition at line 4305 of file object_test.cc.

4305 {
4306 Finalizer_TwoEntries(thread, Heap::kNew, false, true, false, false);
4307}

◆ ISOLATE_UNIT_TEST_CASE() [109/463]

dart::ISOLATE_UNIT_TEST_CASE ( Finalizer_ClearSecondValue_OldSpace  )

Definition at line 4309 of file object_test.cc.

4309 {
4310 Finalizer_TwoEntries(thread, Heap::kOld, false, true, false, false);
4311}

◆ ISOLATE_UNIT_TEST_CASE() [110/463]

dart::ISOLATE_UNIT_TEST_CASE ( Finalizer_ClearValueNullTokenOne_NewSpace  )

Definition at line 4039 of file object_test.cc.

4039 {
4040 Finalizer_ClearValueOne(thread, Heap::kNew, true);
4041}
static void Finalizer_ClearValueOne(Thread *thread, Heap::Space space, bool null_token)

◆ ISOLATE_UNIT_TEST_CASE() [111/463]

dart::ISOLATE_UNIT_TEST_CASE ( Finalizer_ClearValueNullTokenOne_OldSpace  )

Definition at line 4043 of file object_test.cc.

4043 {
4044 Finalizer_ClearValueOne(thread, Heap::kOld, true);
4045}

◆ ISOLATE_UNIT_TEST_CASE() [112/463]

dart::ISOLATE_UNIT_TEST_CASE ( Finalizer_ClearValueOne_NewSpace  )

Definition at line 4031 of file object_test.cc.

4031 {
4032 Finalizer_ClearValueOne(thread, Heap::kNew, false);
4033}

◆ ISOLATE_UNIT_TEST_CASE() [113/463]

dart::ISOLATE_UNIT_TEST_CASE ( Finalizer_ClearValueOne_OldSpace  )

Definition at line 4035 of file object_test.cc.

4035 {
4036 Finalizer_ClearValueOne(thread, Heap::kOld, false);
4037}

◆ ISOLATE_UNIT_TEST_CASE() [114/463]

dart::ISOLATE_UNIT_TEST_CASE ( Finalizer_ClearValueTwo_NewSpace  )

Definition at line 4289 of file object_test.cc.

4289 {
4290 Finalizer_TwoEntries(thread, Heap::kNew, true, true, false, false);
4291}

◆ ISOLATE_UNIT_TEST_CASE() [115/463]

dart::ISOLATE_UNIT_TEST_CASE ( Finalizer_ClearValueTwo_OldSpace  )

Definition at line 4293 of file object_test.cc.

4293 {
4294 Finalizer_TwoEntries(thread, Heap::kOld, true, true, false, false);
4295}

◆ ISOLATE_UNIT_TEST_CASE() [116/463]

dart::ISOLATE_UNIT_TEST_CASE ( Finalizer_DetachAndClearValueOne_NewSpace  )

Definition at line 4111 of file object_test.cc.

4111 {
4112 Finalizer_DetachOne(thread, Heap::kNew, true);
4113}
static void Finalizer_DetachOne(Thread *thread, Heap::Space space, bool clear_value)

◆ ISOLATE_UNIT_TEST_CASE() [117/463]

dart::ISOLATE_UNIT_TEST_CASE ( Finalizer_DetachAndClearValueOne_OldSpace  )

Definition at line 4115 of file object_test.cc.

4115 {
4116 Finalizer_DetachOne(thread, Heap::kOld, true);
4117}

◆ ISOLATE_UNIT_TEST_CASE() [118/463]

dart::ISOLATE_UNIT_TEST_CASE ( Finalizer_DetachOne_NewSpace  )

Definition at line 4103 of file object_test.cc.

4103 {
4104 Finalizer_DetachOne(thread, Heap::kNew, false);
4105}

◆ ISOLATE_UNIT_TEST_CASE() [119/463]

dart::ISOLATE_UNIT_TEST_CASE ( Finalizer_DetachOne_OldSpace  )

Definition at line 4107 of file object_test.cc.

4107 {
4108 Finalizer_DetachOne(thread, Heap::kOld, false);
4109}

◆ ISOLATE_UNIT_TEST_CASE() [120/463]

dart::ISOLATE_UNIT_TEST_CASE ( Finalizer_GcFinalizer_NewSpace  )

Definition at line 4159 of file object_test.cc.

4159 {
4160 Finalizer_GcFinalizer(thread, Heap::kNew);
4161}
static void Finalizer_GcFinalizer(Thread *thread, Heap::Space space)

◆ ISOLATE_UNIT_TEST_CASE() [121/463]

dart::ISOLATE_UNIT_TEST_CASE ( Finalizer_GcFinalizer_OldSpace  )

Definition at line 4163 of file object_test.cc.

4163 {
4164 Finalizer_GcFinalizer(thread, Heap::kOld);
4165}

◆ ISOLATE_UNIT_TEST_CASE() [122/463]

dart::ISOLATE_UNIT_TEST_CASE ( Finalizer_PreserveNoDetachOne_NewSpace  )

Definition at line 3902 of file object_test.cc.

3902 {
3903 Finalizer_PreserveOne(thread, Heap::kNew, false);
3904}
static void Finalizer_PreserveOne(Thread *thread, Heap::Space space, bool with_detach)

◆ ISOLATE_UNIT_TEST_CASE() [123/463]

dart::ISOLATE_UNIT_TEST_CASE ( Finalizer_PreserveNoDetachOne_OldSpace  )

Definition at line 3906 of file object_test.cc.

3906 {
3907 Finalizer_PreserveOne(thread, Heap::kOld, false);
3908}

◆ ISOLATE_UNIT_TEST_CASE() [124/463]

dart::ISOLATE_UNIT_TEST_CASE ( Finalizer_PreserveTwo_NewSpace  )

Definition at line 4313 of file object_test.cc.

4313 {
4314 Finalizer_TwoEntries(thread, Heap::kNew, false, false, false, false);
4315}

◆ ISOLATE_UNIT_TEST_CASE() [125/463]

dart::ISOLATE_UNIT_TEST_CASE ( Finalizer_PreserveTwo_OldSpace  )

Definition at line 4317 of file object_test.cc.

4317 {
4318 Finalizer_TwoEntries(thread, Heap::kOld, false, false, false, false);
4319}

◆ ISOLATE_UNIT_TEST_CASE() [126/463]

dart::ISOLATE_UNIT_TEST_CASE ( Finalizer_PreserveWithDetachOne_NewSpace  )

Definition at line 3910 of file object_test.cc.

3910 {
3911 Finalizer_PreserveOne(thread, Heap::kNew, true);
3912}

◆ ISOLATE_UNIT_TEST_CASE() [127/463]

dart::ISOLATE_UNIT_TEST_CASE ( Finalizer_PreserveWithDetachOne_OldSpace  )

Definition at line 3914 of file object_test.cc.

3914 {
3915 Finalizer_PreserveOne(thread, Heap::kOld, true);
3916}

◆ ISOLATE_UNIT_TEST_CASE() [128/463]

dart::ISOLATE_UNIT_TEST_CASE ( Finalizer_Regress_48843  )

Definition at line 4895 of file object_test.cc.

4895 {
4896#ifdef DEBUG
4897 SetFlagScope<bool> sfs(&FLAG_trace_finalizers, true);
4898 SetFlagScope<bool> sfs2(&FLAG_verify_store_buffer, true);
4899#endif
4900 SetFlagScope<bool> sfs3(&FLAG_use_compactor, true);
4901
4902 const auto& finalizer = Finalizer::Handle(Finalizer::New(Heap::kOld));
4903 finalizer.set_isolate(thread->isolate());
4904
4905 const auto& detach1 =
4906 String::Handle(OneByteString::New("detach1", Heap::kNew));
4907 const auto& token1 = String::Handle(OneByteString::New("token1", Heap::kNew));
4908 const auto& detach2 =
4909 String::Handle(OneByteString::New("detach2", Heap::kOld));
4910 const auto& token2 = String::Handle(OneByteString::New("token2", Heap::kOld));
4911
4912 {
4913 HANDLESCOPE(thread);
4914 const auto& entry1 =
4915 FinalizerEntry::Handle(FinalizerEntry::New(finalizer, Heap::kNew));
4916 entry1.set_detach(detach1);
4917 entry1.set_token(token1);
4918
4919 const auto& entry2 =
4920 FinalizerEntry::Handle(FinalizerEntry::New(finalizer, Heap::kOld));
4921 entry2.set_detach(detach2);
4922 entry2.set_token(token2);
4923
4924 {
4925 HANDLESCOPE(thread);
4926 const auto& value1 =
4927 String::Handle(OneByteString::New("value1", Heap::kNew));
4928 entry1.set_value(value1);
4929 const auto& value2 =
4930 String::Handle(OneByteString::New("value2", Heap::kOld));
4931 entry2.set_value(value2);
4932 // Lose both values.
4933 }
4934
4935 // First collect new space.
4936 GCTestHelper::CollectNewSpace();
4937 // Then old space, this will make the old space entry point to the new
4938 // space entry.
4939 // Also, this must be a mark compact, not a mark sweep, to move the entry.
4940 GCTestHelper::CollectOldSpace();
4941 }
4942
4943 // Imagine callbacks running.
4944 // Entries themselves become unreachable.
4945 finalizer.set_entries_collected(
4946 FinalizerEntry::Handle(FinalizerEntry::null()));
4947
4948 // There should be a single entry in the store buffer.
4949 // And it should crash when seeing the address in the buffer.
4950 GCTestHelper::CollectNewSpace();
4951
4952 // We should no longer be processing the entries.
4953 GCTestHelper::CollectOldSpace();
4954 GCTestHelper::CollectNewSpace();
4955}

◆ ISOLATE_UNIT_TEST_CASE() [129/463]

dart::ISOLATE_UNIT_TEST_CASE ( FinalizerEntry_Generations  )

Definition at line 1216 of file heap_test.cc.

1216 {
1217 FLAG_early_tenuring_threshold = 100; // I.e., off.
1218
1219 FinalizerEntry_Generations(kNew, kNew, true, true, true);
1220 FinalizerEntry_Generations(kNew, kOld, false, true, true);
1221 FinalizerEntry_Generations(kNew, kImm, false, false, false);
1222 FinalizerEntry_Generations(kOld, kNew, true, true, true);
1223 FinalizerEntry_Generations(kOld, kOld, false, true, true);
1224 FinalizerEntry_Generations(kOld, kImm, false, false, false);
1225}
static void FinalizerEntry_Generations(Generation entry_space, Generation value_space, bool cleared_after_minor, bool cleared_after_major, bool cleared_after_all)

◆ ISOLATE_UNIT_TEST_CASE() [130/463]

dart::ISOLATE_UNIT_TEST_CASE ( FindClosureIndex  )

Definition at line 5317 of file object_test.cc.

5317 {
5318 // Allocate the class first.
5319 const String& class_name = String::Handle(Symbols::New(thread, "MyClass"));
5320 const Script& script = Script::Handle();
5321 const Class& cls = Class::Handle(CreateDummyClass(class_name, script));
5322 const Array& functions = Array::Handle(Array::New(1));
5323
5324 Function& parent = Function::Handle();
5325 const String& parent_name = String::Handle(Symbols::New(thread, "foo_papa"));
5326 const FunctionType& signature = FunctionType::ZoneHandle(FunctionType::New());
5327 parent = Function::New(signature, parent_name,
5328 UntaggedFunction::kRegularFunction, false, false,
5329 false, false, false, cls, TokenPosition::kMinSource);
5330 functions.SetAt(0, parent);
5331 {
5332 SafepointWriteRwLocker ml(thread, thread->isolate_group()->program_lock());
5333 cls.SetFunctions(functions);
5334 }
5335
5336 Function& function = Function::Handle();
5337 const String& function_name = String::Handle(Symbols::New(thread, "foo"));
5338 function = Function::NewClosureFunction(function_name, parent,
5339 TokenPosition::kMinSource);
5340 function.set_kernel_offset(42);
5341 // Add closure function to class.
5342 {
5343 SafepointWriteRwLocker ml(thread, thread->isolate_group()->program_lock());
5344 ClosureFunctionsCache::AddClosureFunctionLocked(function);
5345 }
5346
5347 // The closure should return a valid index.
5348 intptr_t good_closure_index =
5349 ClosureFunctionsCache::FindClosureIndex(function);
5350 EXPECT_GE(good_closure_index, 0);
5351 // The parent function should return an invalid index.
5352 intptr_t bad_closure_index = ClosureFunctionsCache::FindClosureIndex(parent);
5353 EXPECT_EQ(bad_closure_index, -1);
5354
5355 // Retrieve closure function via index.
5356 Function& func_from_index = Function::Handle();
5357 func_from_index ^=
5358 ClosureFunctionsCache::ClosureFunctionFromIndex(good_closure_index);
5359 // Same closure function.
5360 EXPECT_EQ(func_from_index.ptr(), function.ptr());
5361}

◆ ISOLATE_UNIT_TEST_CASE() [131/463]

dart::ISOLATE_UNIT_TEST_CASE ( FindInvocationDispatcherFunctionIndex  )

Definition at line 5363 of file object_test.cc.

5363 {
5364 const String& class_name = String::Handle(Symbols::New(thread, "MyClass"));
5365 const Script& script = Script::Handle();
5366 const Class& cls = Class::Handle(CreateDummyClass(class_name, script));
5367 ClassFinalizer::FinalizeTypesInClass(cls);
5368
5369 const Array& functions = Array::Handle(Array::New(1));
5370 Function& parent = Function::Handle();
5371 const String& parent_name = String::Handle(Symbols::New(thread, "foo_papa"));
5372 const FunctionType& signature = FunctionType::ZoneHandle(FunctionType::New());
5373 parent = Function::New(signature, parent_name,
5374 UntaggedFunction::kRegularFunction, false, false,
5375 false, false, false, cls, TokenPosition::kMinSource);
5376 functions.SetAt(0, parent);
5377 {
5378 SafepointWriteRwLocker ml(thread, thread->isolate_group()->program_lock());
5379 cls.SetFunctions(functions);
5380 cls.Finalize();
5381 }
5382
5383 // Add invocation dispatcher.
5384 const String& invocation_dispatcher_name =
5385 String::Handle(Symbols::New(thread, "myMethod"));
5386 const Array& args_desc = Array::Handle(ArgumentsDescriptor::NewBoxed(0, 1));
5387 Function& invocation_dispatcher = Function::Handle();
5388 invocation_dispatcher ^= cls.GetInvocationDispatcher(
5389 invocation_dispatcher_name, args_desc,
5390 UntaggedFunction::kNoSuchMethodDispatcher, true /* create_if_absent */);
5391 EXPECT(!invocation_dispatcher.IsNull());
5392 // Get index to function.
5393 intptr_t invocation_dispatcher_index =
5394 cls.FindInvocationDispatcherFunctionIndex(invocation_dispatcher);
5395 // Expect a valid index.
5396 EXPECT_GE(invocation_dispatcher_index, 0);
5397 // Retrieve function through index.
5398 Function& invocation_dispatcher_from_index = Function::Handle();
5399 invocation_dispatcher_from_index ^=
5400 cls.InvocationDispatcherFunctionFromIndex(invocation_dispatcher_index);
5401 // Same function.
5402 EXPECT_EQ(invocation_dispatcher.ptr(),
5403 invocation_dispatcher_from_index.ptr());
5404 // Test function not found case.
5405 const Function& bad_function = Function::Handle(Function::null());
5406 intptr_t bad_invocation_dispatcher_index =
5407 cls.FindInvocationDispatcherFunctionIndex(bad_function);
5408 EXPECT_EQ(bad_invocation_dispatcher_index, -1);
5409}
FunctionPtr InvocationDispatcherFunctionFromIndex(intptr_t idx) const
Definition object.cc:3469
intptr_t FindInvocationDispatcherFunctionIndex(const Function &needle) const
Definition object.cc:3442

◆ ISOLATE_UNIT_TEST_CASE() [132/463]

dart::ISOLATE_UNIT_TEST_CASE ( FlowGraph_LargeFrame_Double  )

Definition at line 246 of file flow_graph_test.cc.

246 {
247 TestLargeFrame("double", "0.0", "1.0",
248 "main() {\n"
249 " for (var i = 0; i < 100; i++) {\n"
250 " var r = largeFrame(1);\n"
251 " if (r != 2000.0) throw r;\n"
252 " }\n"
253 " return 'Okay';\n"
254 "}\n");
255}
void TestLargeFrame(const char *type, const char *zero, const char *one, const char *main)

◆ ISOLATE_UNIT_TEST_CASE() [133/463]

dart::ISOLATE_UNIT_TEST_CASE ( FlowGraph_LargeFrame_Float32x4  )

Definition at line 271 of file flow_graph_test.cc.

271 {
272 TestLargeFrame("Float32x4", "Float32x4(0.0, 0.0, 0.0, 0.0)",
273 "Float32x4(1.0, 2.0, 3.0, 4.0)",
274 "main() {\n"
275 " for (var i = 0; i < 100; i++) {\n"
276 " var r = largeFrame(1);\n"
277 " if (r.x != 2000.0) throw r;\n"
278 " if (r.y != 4000.0) throw r;\n"
279 " if (r.z != 6000.0) throw r;\n"
280 " if (r.w != 8000.0) throw r;\n"
281 " }\n"
282 " return 'Okay';\n"
283 "}\n");
284}

◆ ISOLATE_UNIT_TEST_CASE() [134/463]

dart::ISOLATE_UNIT_TEST_CASE ( FlowGraph_LargeFrame_Float64x2  )

Definition at line 286 of file flow_graph_test.cc.

286 {
287 TestLargeFrame("Float64x2", "Float64x2(0.0, 0.0)", "Float64x2(1.0, 2.0)",
288 "main() {\n"
289 " for (var i = 0; i < 100; i++) {\n"
290 " var r = largeFrame(1);\n"
291 " if (r.x != 2000.0) throw r;\n"
292 " if (r.y != 4000.0) throw r;\n"
293 " }\n"
294 " return 'Okay';\n"
295 "}\n");
296}

◆ ISOLATE_UNIT_TEST_CASE() [135/463]

dart::ISOLATE_UNIT_TEST_CASE ( FlowGraph_LargeFrame_Int  )

Definition at line 235 of file flow_graph_test.cc.

235 {
236 TestLargeFrame("int", "0", "1",
237 "main() {\n"
238 " for (var i = 0; i < 100; i++) {\n"
239 " var r = largeFrame(1);\n"
240 " if (r != 2000) throw r;\n"
241 " }\n"
242 " return 'Okay';\n"
243 "}\n");
244}

◆ ISOLATE_UNIT_TEST_CASE() [136/463]

dart::ISOLATE_UNIT_TEST_CASE ( FlowGraph_LargeFrame_Int32x4  )

Definition at line 257 of file flow_graph_test.cc.

257 {
258 TestLargeFrame("Int32x4", "Int32x4(0, 0, 0, 0)", "Int32x4(1, 2, 3, 4)",
259 "main() {\n"
260 " for (var i = 0; i < 100; i++) {\n"
261 " var r = largeFrame(1);\n"
262 " if (r.x != 2000) throw r;\n"
263 " if (r.y != 4000) throw r;\n"
264 " if (r.z != 6000) throw r;\n"
265 " if (r.w != 8000) throw r;\n"
266 " }\n"
267 " return 'Okay';\n"
268 "}\n");
269}

◆ ISOLATE_UNIT_TEST_CASE() [137/463]

dart::ISOLATE_UNIT_TEST_CASE ( FlowGraph_LateVariablePhiUnboxing  )

Definition at line 78 of file flow_graph_test.cc.

78 {
80
81 CompilerState S(thread, /*is_aot=*/true, /*is_optimizing=*/true);
83
84 auto normal_entry = H.flow_graph()->graph_entry()->normal_entry();
85 auto loop_header = H.JoinEntry();
86 auto loop_body = H.TargetEntry();
87 auto loop_exit = H.TargetEntry();
88
89 ConstantInstr* sentinel = H.flow_graph()->GetConstant(Object::sentinel());
90
91 PhiInstr* loop_var;
92 PhiInstr* late_var;
93 Definition* add1;
94
95 {
96 BlockBuilder builder(H.flow_graph(), normal_entry);
97 builder.AddInstruction(new GotoInstr(loop_header, S.GetNextDeoptId()));
98 }
99
100 {
101 BlockBuilder builder(H.flow_graph(), loop_header);
102 loop_var = H.Phi(loop_header,
103 {{normal_entry, H.IntConstant(0)}, {loop_body, &add1}});
104 builder.AddPhi(loop_var);
105 loop_var->UpdateType(CompileType::Int());
106 loop_var->UpdateType(CompileType::FromAbstractType(
107 Type::ZoneHandle(Type::IntType()), CompileType::kCannotBeNull,
108 CompileType::kCanBeSentinel));
109 late_var =
110 H.Phi(loop_header, {{normal_entry, sentinel}, {loop_body, &add1}});
111 builder.AddPhi(late_var);
112 builder.AddBranch(new RelationalOpInstr(
113 InstructionSource(), Token::kLT, new Value(loop_var),
114 new Value(H.IntConstant(10)), kMintCid,
115 S.GetNextDeoptId(), Instruction::kNotSpeculative),
116 loop_body, loop_exit);
117 }
118
119 {
120 BlockBuilder builder(H.flow_graph(), loop_body);
121 add1 = builder.AddDefinition(new BinaryInt64OpInstr(
122 Token::kADD, new Value(loop_var), new Value(H.IntConstant(1)),
123 S.GetNextDeoptId(), Instruction::kNotSpeculative));
124 builder.AddInstruction(new GotoInstr(loop_header, S.GetNextDeoptId()));
125 }
126
127 {
128 BlockBuilder builder(H.flow_graph(), loop_exit);
129 builder.AddReturn(new Value(late_var));
130 }
131
132 H.FinishGraph();
133
134 FlowGraphTypePropagator::Propagate(H.flow_graph());
135 H.flow_graph()->SelectRepresentations();
136
137#if defined(TARGET_ARCH_IS_64_BIT)
138 EXPECT_PROPERTY(loop_var, it.representation() == kUnboxedInt64);
139#endif
140 EXPECT_PROPERTY(late_var, it.representation() == kTagged);
141}
PRINT_OPERANDS_TO_SUPPORT PRINT_TO_SUPPORT bool UpdateType(CompileType new_type)
Definition il.h:2535

◆ ISOLATE_UNIT_TEST_CASE() [138/463]

dart::ISOLATE_UNIT_TEST_CASE ( FlowGraph_PhiUnboxingHeuristic_Double  )

Definition at line 298 of file flow_graph_test.cc.

298 {
299 if (!FlowGraphCompiler::SupportsUnboxedDoubles()) {
300 return;
301 }
302
303 const char* kScript = R"(
304 double foo(double sum, int n) {
305 if (sum == null) return 0.0;
306 for (int i = 0; i < n; i++) {
307 sum += 1.0;
308 }
309 return sum;
310 }
311 main() {
312 foo(0.0, 10);
313 }
314 )";
315
316 const auto& root_library = Library::Handle(LoadTestScript(kScript));
317 const auto& function = Function::Handle(GetFunction(root_library, "foo"));
318
319 Invoke(root_library, "main");
320
321 TestPipeline pipeline(function, CompilerPass::kJIT);
322 FlowGraph* flow_graph = pipeline.RunPasses({});
323
324 auto entry = flow_graph->graph_entry()->normal_entry();
325 ILMatcher cursor(flow_graph, entry, /*trace=*/true,
326 ParallelMovesHandling::kSkip);
327
328 RELEASE_ASSERT(cursor.TryMatch({
329 kMatchAndMoveFunctionEntry,
330 }));
331 RELEASE_ASSERT(cursor.TryMatch({
332 kMatchAndMoveUnbox, // outside of loop
333 kMatchAndMoveCheckSmi,
334 kMoveGlob,
335
336 // Loop header
337 kMatchAndMoveJoinEntry,
338 kMatchAndMoveCheckStackOverflow,
339 kMatchAndMoveBranchTrue,
340
341 // Loop body
342 kMatchAndMoveTargetEntry,
343 kMatchAndMoveBinaryDoubleOp,
344 kMatchAndMoveBinarySmiOp,
345 kMatchAndMoveGoto,
346
347 // Loop header, again
348 kMatchAndMoveJoinEntry,
349 kMatchAndMoveCheckStackOverflow,
350 kMatchAndMoveBranchFalse,
351
352 // After loop
353 kMatchAndMoveTargetEntry,
354 kMatchAndMoveBox,
355 kMatchDartReturn,
356 }));
357}

◆ ISOLATE_UNIT_TEST_CASE() [139/463]

dart::ISOLATE_UNIT_TEST_CASE ( FlowGraph_PhiUnboxingHeuristic_Float32x4  )

Definition at line 407 of file flow_graph_test.cc.

407 {
408 const char* kScript = R"(
409 import 'dart:typed_data';
410 Float32x4 foo(Float32x4 sum, int n) {
411 if (sum == null) return Float32x4(0.0, 0.0, 0.0, 0.0);
412 for (int i = 0; i < n; i++) {
413 sum += Float32x4(1.0, 2.0, 3.0, 4.0);
414 }
415 return sum;
416 }
417 main() {
418 foo(Float32x4(0.0, 0.0, 0.0, 0.0), 10);
419 }
420 )";
422}
static void TestPhiUnboxingHeuristicSimd(const char *script)

◆ ISOLATE_UNIT_TEST_CASE() [140/463]

dart::ISOLATE_UNIT_TEST_CASE ( FlowGraph_PhiUnboxingHeuristic_Float64x2  )

Definition at line 424 of file flow_graph_test.cc.

424 {
425 const char* kScript = R"(
426 import 'dart:typed_data';
427 Float64x2 foo(Float64x2 sum, int n) {
428 if (sum == null) return Float64x2(0.0, 0.0);
429 for (int i = 0; i < n; i++) {
430 sum += Float64x2(1.0, 2.0);
431 }
432 return sum;
433 }
434 main() {
435 foo(Float64x2(0.0, 0.0), 10);
436 }
437 )";
439}

◆ ISOLATE_UNIT_TEST_CASE() [141/463]

dart::ISOLATE_UNIT_TEST_CASE ( FlowGraph_PhiUnboxingHeuristic_Int32x4  )

Definition at line 441 of file flow_graph_test.cc.

441 {
442 const char* kScript = R"(
443 import 'dart:typed_data';
444 Int32x4 foo(Int32x4 sum, int n) {
445 if (sum == null) return Int32x4(0, 0, 0, 0);
446 for (int i = 0; i < n; i++) {
447 sum += Int32x4(1, 2, 3, 4);
448 }
449 return sum;
450 }
451 main() {
452 foo(Int32x4(0, 0, 0, 0), 10);
453 }
454 )";
456}

◆ ISOLATE_UNIT_TEST_CASE() [142/463]

dart::ISOLATE_UNIT_TEST_CASE ( FlowGraph_UnboxedFloatPhi  )

Definition at line 143 of file flow_graph_test.cc.

143 {
145
146 CompilerState S(thread, /*is_aot=*/true, /*is_optimizing=*/true);
148
149 auto normal_entry = H.flow_graph()->graph_entry()->normal_entry();
150 auto then_body = H.TargetEntry();
151 auto else_body = H.TargetEntry();
152 auto join_exit = H.JoinEntry();
153
154 PhiInstr* phi;
155 Definition* double_to_float_1;
156 Definition* double_to_float_2;
157
158 {
159 BlockBuilder builder(H.flow_graph(), normal_entry);
160 builder.AddBranch(
162 InstructionSource(), Token::kEQ_STRICT, new Value(H.IntConstant(1)),
163 new Value(H.IntConstant(1)),
164 /*needs_number_check=*/false, S.GetNextDeoptId()),
165 then_body, else_body);
166 }
167
168 {
169 BlockBuilder builder(H.flow_graph(), then_body);
170 double_to_float_1 = builder.AddDefinition(new DoubleToFloatInstr(
171 new Value(H.DoubleConstant(1)), S.GetNextDeoptId(),
172 Instruction::kNotSpeculative));
173 builder.AddInstruction(new GotoInstr(join_exit, S.GetNextDeoptId()));
174 }
175
176 {
177 BlockBuilder builder(H.flow_graph(), else_body);
178 double_to_float_2 = builder.AddDefinition(new DoubleToFloatInstr(
179 new Value(H.DoubleConstant(2)), S.GetNextDeoptId(),
180 Instruction::kNotSpeculative));
181 builder.AddInstruction(new GotoInstr(join_exit, S.GetNextDeoptId()));
182 }
183
184 {
185 BlockBuilder builder(H.flow_graph(), join_exit);
186 phi = new PhiInstr(join_exit, 3);
187 phi->SetInputAt(0, new Value(double_to_float_1));
188 phi->SetInputAt(1, new Value(double_to_float_2));
189 phi->SetInputAt(2, new Value(phi));
190 builder.AddPhi(phi);
191 builder.AddReturn(new Value(phi));
192 }
193 H.FinishGraph();
194
195 FlowGraphTypePropagator::Propagate(H.flow_graph());
196 H.flow_graph()->SelectRepresentations();
197
198 EXPECT_PROPERTY(phi, it.representation() == kUnboxedFloat);
199}
void SetInputAt(intptr_t i, Value *value)
Definition il.h:1008

◆ ISOLATE_UNIT_TEST_CASE() [143/463]

dart::ISOLATE_UNIT_TEST_CASE ( FunctionType_IsSubtypeOfNonNullableObject  )

Definition at line 7493 of file object_test.cc.

7504 {
7505 const auto& type_object = Type::Handle(
7506 IsolateGroup::Current()->object_store()->non_nullable_object_type());
7507
7508 auto& type_function_int_nullary =
7509 FunctionType::Handle(FunctionType::New(0, Nullability::kNonNullable));

◆ ISOLATE_UNIT_TEST_CASE() [144/463]

dart::ISOLATE_UNIT_TEST_CASE ( GrowableHandlePtr  )

Definition at line 97 of file growable_array_test.cc.

97 {
98 Zone* zone = Thread::Current()->zone();
100 EXPECT_EQ(0, test1.length());
101 test1.Add(Symbols::Int());
102 EXPECT(test1[0].ptr() == Symbols::Int().ptr());
103 EXPECT_EQ(1, test1.length());
104
107 test2->Add(Symbols::GetterPrefix());
108 EXPECT((*test2)[0].ptr() == Symbols::GetterPrefix().ptr());
109 EXPECT_EQ(1, test2->length());
110}

◆ ISOLATE_UNIT_TEST_CASE() [145/463]

dart::ISOLATE_UNIT_TEST_CASE ( GrowableObjectArray  )

Definition at line 2065 of file object_test.cc.

2065 {
2066 const int kArrayLen = 5;
2067 Smi& value = Smi::Handle();
2068 Smi& expected_value = Smi::Handle();
2069 GrowableObjectArray& array = GrowableObjectArray::Handle();
2070
2071 // Test basic growing functionality.
2072 array = GrowableObjectArray::New(kArrayLen);
2073 EXPECT_EQ(kArrayLen, array.Capacity());
2074 EXPECT_EQ(0, array.Length());
2075 for (intptr_t i = 0; i < 10; i++) {
2076 value = Smi::New(i);
2077 array.Add(value);
2078 }
2079 EXPECT_EQ(10, array.Length());
2080 for (intptr_t i = 0; i < 10; i++) {
2081 expected_value = Smi::New(i);
2082 value ^= array.At(i);
2083 EXPECT(value.Equals(expected_value));
2084 }
2085 for (intptr_t i = 0; i < 10; i++) {
2086 value = Smi::New(i * 10);
2087 array.SetAt(i, value);
2088 }
2089 EXPECT_EQ(10, array.Length());
2090 for (intptr_t i = 0; i < 10; i++) {
2091 expected_value = Smi::New(i * 10);
2092 value ^= array.At(i);
2093 EXPECT(value.Equals(expected_value));
2094 }
2095
2096 // Test the MakeFixedLength functionality to make sure the resulting array
2097 // object is properly setup.
2098 // 1. Should produce an array of length 2 and a left over int8 array.
2099 Array& new_array = Array::Handle();
2100 TypedData& left_over_array = TypedData::Handle();
2101 Object& obj = Object::Handle();
2102 uword addr = 0;
2103 intptr_t used_size = 0;
2104
2105 array = GrowableObjectArray::New(kArrayLen + 1);
2106 EXPECT_EQ(kArrayLen + 1, array.Capacity());
2107 EXPECT_EQ(0, array.Length());
2108 for (intptr_t i = 0; i < 2; i++) {
2109 value = Smi::New(i);
2110 array.Add(value);
2111 }
2112 used_size = Array::InstanceSize(array.Length());
2113 new_array = Array::MakeFixedLength(array);
2114 addr = UntaggedObject::ToAddr(new_array.ptr());
2115 obj = UntaggedObject::FromAddr(addr);
2116 EXPECT(obj.IsArray());
2117 new_array ^= obj.ptr();
2118 EXPECT_EQ(2, new_array.Length());
2119 addr += used_size;
2120 obj = UntaggedObject::FromAddr(addr);
2121#if defined(DART_COMPRESSED_POINTERS)
2122 // In compressed pointer mode, the TypedData doesn't fit.
2123 EXPECT(obj.IsInstance());
2124#else
2125 EXPECT(obj.IsTypedData());
2126 left_over_array ^= obj.ptr();
2127 EXPECT_EQ(4 * kWordSize - TypedData::InstanceSize(0),
2128 left_over_array.Length());
2129#endif
2130
2131 // 2. Should produce an array of length 3 and a left over int8 array or
2132 // instance.
2133 array = GrowableObjectArray::New(kArrayLen);
2134 EXPECT_EQ(kArrayLen, array.Capacity());
2135 EXPECT_EQ(0, array.Length());
2136 for (intptr_t i = 0; i < 3; i++) {
2137 value = Smi::New(i);
2138 array.Add(value);
2139 }
2140 used_size = Array::InstanceSize(array.Length());
2141 new_array = Array::MakeFixedLength(array);
2142 addr = UntaggedObject::ToAddr(new_array.ptr());
2143 obj = UntaggedObject::FromAddr(addr);
2144 EXPECT(obj.IsArray());
2145 new_array ^= obj.ptr();
2146 EXPECT_EQ(3, new_array.Length());
2147 addr += used_size;
2148 obj = UntaggedObject::FromAddr(addr);
2149 if (TypedData::InstanceSize(0) <= 2 * kCompressedWordSize) {
2150 EXPECT(obj.IsTypedData());
2151 left_over_array ^= obj.ptr();
2152 EXPECT_EQ(2 * kCompressedWordSize - TypedData::InstanceSize(0),
2153 left_over_array.Length());
2154 } else {
2155 EXPECT(obj.IsInstance());
2156 }
2157
2158 // 3. Should produce an array of length 1 and a left over int8 array.
2159 array = GrowableObjectArray::New(kArrayLen + 3);
2160 EXPECT_EQ((kArrayLen + 3), array.Capacity());
2161 EXPECT_EQ(0, array.Length());
2162 for (intptr_t i = 0; i < 1; i++) {
2163 value = Smi::New(i);
2164 array.Add(value);
2165 }
2166 used_size = Array::InstanceSize(array.Length());
2167 new_array = Array::MakeFixedLength(array);
2168 addr = UntaggedObject::ToAddr(new_array.ptr());
2169 obj = UntaggedObject::FromAddr(addr);
2170 EXPECT(obj.IsArray());
2171 new_array ^= obj.ptr();
2172 EXPECT_EQ(1, new_array.Length());
2173 addr += used_size;
2174 obj = UntaggedObject::FromAddr(addr);
2175#if defined(DART_COMPRESSED_POINTERS)
2176 // In compressed pointer mode, the TypedData doesn't fit.
2177 EXPECT(obj.IsInstance());
2178#else
2179 EXPECT(obj.IsTypedData());
2180 left_over_array ^= obj.ptr();
2181 EXPECT_EQ(8 * kWordSize - TypedData::InstanceSize(0),
2182 left_over_array.Length());
2183#endif
2184
2185 // 4. Verify that GC can handle the filler object for a large array.
2186 array = GrowableObjectArray::New((1 * MB) >> kWordSizeLog2);
2187 EXPECT_EQ(0, array.Length());
2188 for (intptr_t i = 0; i < 1; i++) {
2189 value = Smi::New(i);
2190 array.Add(value);
2191 }
2192 Heap* heap = IsolateGroup::Current()->heap();
2193 GCTestHelper::CollectAllGarbage();
2194 GCTestHelper::WaitForGCTasks(); // Sweeper must finish for accurate capacity.
2195 intptr_t capacity_before = heap->CapacityInWords(Heap::kOld);
2196 new_array = Array::MakeFixedLength(array);
2197 EXPECT_EQ(1, new_array.Length());
2198 GCTestHelper::CollectAllGarbage();
2199 GCTestHelper::WaitForGCTasks(); // Sweeper must finish for accurate capacity.
2200 intptr_t capacity_after = heap->CapacityInWords(Heap::kOld);
2201 // Page should shrink.
2202 EXPECT_LT(capacity_after, capacity_before);
2203 EXPECT_EQ(1, new_array.Length());
2204}
static const char * expected_value

◆ ISOLATE_UNIT_TEST_CASE() [146/463]

dart::ISOLATE_UNIT_TEST_CASE ( HashTable  )

Definition at line 56 of file hash_table_test.cc.

56 {
57 typedef HashTable<TestTraits, 2, 1> Table;
58 Table table(Thread::Current()->zone(), HashTables::New<Table>(5));
59 // Ensure that we did get at least 5 entries.
60 EXPECT_LE(5, table.NumEntries());
61 EXPECT_EQ(0, table.NumOccupied());
63 EXPECT_EQ(-1, table.FindKey("a"));
64
65 // Insertion and lookup.
66 intptr_t a_entry = -1;
67 EXPECT(!table.FindKeyOrDeletedOrUnused("a", &a_entry));
68 EXPECT_NE(-1, a_entry);
69 String& a = String::Handle(String::New("a"));
70 table.InsertKey(a_entry, a);
71 EXPECT_EQ(1, table.NumOccupied());
73 EXPECT_EQ(a_entry, table.FindKey("a"));
74 EXPECT_EQ(-1, table.FindKey("b"));
75 intptr_t a_entry_again = -1;
76 EXPECT(table.FindKeyOrDeletedOrUnused("a", &a_entry_again));
77 EXPECT_EQ(a_entry, a_entry_again);
78 intptr_t b_entry = -1;
79 EXPECT(!table.FindKeyOrDeletedOrUnused("b", &b_entry));
80 String& b = String::Handle(String::New("b"));
81 table.InsertKey(b_entry, b);
82 EXPECT_EQ(2, table.NumOccupied());
84
85 // Deletion.
86 table.DeleteEntry(a_entry);
87 EXPECT_EQ(1, table.NumOccupied());
89 EXPECT_EQ(-1, table.FindKey("a"));
90 EXPECT_EQ(b_entry, table.FindKey("b"));
91 intptr_t c_entry = -1;
92 EXPECT(!table.FindKeyOrDeletedOrUnused("c", &c_entry));
93 String& c = String::Handle(String::New("c"));
94 table.InsertKey(c_entry, c);
95 EXPECT_EQ(2, table.NumOccupied());
97 EXPECT_EQ(c_entry, table.FindKey("c"));
98
99 // Ensure we can actually reach 5 occupied entries (without expansion).
100 {
101 intptr_t entry = -1;
102 EXPECT(!table.FindKeyOrDeletedOrUnused("d", &entry));
103 String& k = String::Handle(String::New("d"));
104 table.InsertKey(entry, k);
105 EXPECT(!table.FindKeyOrDeletedOrUnused("e", &entry));
106 k = String::New("e");
107 table.InsertKey(entry, k);
108 EXPECT(!table.FindKeyOrDeletedOrUnused("f", &entry));
109 k = String::New("f");
110 table.InsertKey(entry, k);
111 EXPECT_EQ(5, table.NumOccupied());
112 }
113 table.Release();
114}
void Validate(const Table &table)

◆ ISOLATE_UNIT_TEST_CASE() [147/463]

dart::ISOLATE_UNIT_TEST_CASE ( HelperAllocAndGC  )

Definition at line 888 of file thread_test.cc.

888 {
889 Monitor done_monitor;
890 bool done = false;
891 auto isolate_group = thread->isolate_group();
892 Dart::thread_pool()->Run<AllocAndGCTask>(isolate_group, &done_monitor, &done);
893 {
894 while (true) {
895 TransitionVMToBlocked transition(thread);
896 MonitorLocker ml(&done_monitor);
897 if (done) {
898 break;
899 }
900 }
901 }
902}

◆ ISOLATE_UNIT_TEST_CASE() [148/463]

dart::ISOLATE_UNIT_TEST_CASE ( HierarchyInfo_Function_Subtype  )

Definition at line 547 of file il_test.cc.

547 {
548 HierarchyInfo hi(thread);
549 const auto& type =
550 Type::Handle(IsolateGroup::Current()->object_store()->function_type());
551 EXPECT(hi.CanUseSubtypeRangeCheckFor(type));
552 const auto& cls = Class::Handle(type.type_class());
553
554 GrowableArray<intptr_t> expected_concrete_cids;
555 expected_concrete_cids.Add(kClosureCid);
556
557 GrowableArray<intptr_t> expected_abstract_cids;
558 expected_abstract_cids.Add(type.type_class_id());
559
560 const CidRangeVector& concrete_range = hi.SubtypeRangesForClass(
561 cls, /*include_abstract=*/false, /*exclude_null=*/true);
562 RANGES_CONTAIN_EXPECTED_CIDS(concrete_range, expected_concrete_cids);
563
564 GrowableArray<intptr_t> expected_cids;
565 expected_cids.AddArray(expected_concrete_cids);
566 expected_cids.AddArray(expected_abstract_cids);
567 const CidRangeVector& abstract_range = hi.SubtypeRangesForClass(
568 cls, /*include_abstract=*/true, /*exclude_null=*/true);
569 RANGES_CONTAIN_EXPECTED_CIDS(abstract_range, expected_cids);
570}
void AddArray(const BaseGrowableArray< T, B, Allocator > &src)
#define RANGES_CONTAIN_EXPECTED_CIDS(ranges, cids)
Definition il_test.cc:498

◆ ISOLATE_UNIT_TEST_CASE() [149/463]

dart::ISOLATE_UNIT_TEST_CASE ( HierarchyInfo_Int_Subtype  )

Definition at line 602 of file il_test.cc.

602 {
603 HierarchyInfo hi(thread);
604 const auto& type = Type::Handle(Type::IntType());
605 EXPECT(hi.CanUseSubtypeRangeCheckFor(type));
606 const auto& cls = Class::Handle(type.type_class());
607
608 GrowableArray<intptr_t> expected_concrete_cids;
609 expected_concrete_cids.Add(kSmiCid);
610 expected_concrete_cids.Add(kMintCid);
611
612 GrowableArray<intptr_t> expected_abstract_cids;
613 expected_abstract_cids.Add(type.type_class_id());
614
615 const CidRangeVector& concrete_range = hi.SubtypeRangesForClass(
616 cls, /*include_abstract=*/false, /*exclude_null=*/true);
617 RANGES_CONTAIN_EXPECTED_CIDS(concrete_range, expected_concrete_cids);
618
619 GrowableArray<intptr_t> expected_cids;
620 expected_cids.AddArray(expected_concrete_cids);
621 expected_cids.AddArray(expected_abstract_cids);
622 const CidRangeVector& abstract_range = hi.SubtypeRangesForClass(
623 cls, /*include_abstract=*/true, /*exclude_null=*/true);
624 RANGES_CONTAIN_EXPECTED_CIDS(abstract_range, expected_cids);
625}

◆ ISOLATE_UNIT_TEST_CASE() [150/463]

dart::ISOLATE_UNIT_TEST_CASE ( HierarchyInfo_Num_Subtype  )

Definition at line 572 of file il_test.cc.

572 {
573 HierarchyInfo hi(thread);
574 const auto& num_type = Type::Handle(Type::Number());
575 const auto& int_type = Type::Handle(Type::IntType());
576 const auto& double_type = Type::Handle(Type::Double());
577 EXPECT(hi.CanUseSubtypeRangeCheckFor(num_type));
578 const auto& cls = Class::Handle(num_type.type_class());
579
580 GrowableArray<intptr_t> expected_concrete_cids;
581 expected_concrete_cids.Add(kSmiCid);
582 expected_concrete_cids.Add(kMintCid);
583 expected_concrete_cids.Add(kDoubleCid);
584
585 GrowableArray<intptr_t> expected_abstract_cids;
586 expected_abstract_cids.Add(num_type.type_class_id());
587 expected_abstract_cids.Add(int_type.type_class_id());
588 expected_abstract_cids.Add(double_type.type_class_id());
589
590 const CidRangeVector& concrete_range = hi.SubtypeRangesForClass(
591 cls, /*include_abstract=*/false, /*exclude_null=*/true);
592 RANGES_CONTAIN_EXPECTED_CIDS(concrete_range, expected_concrete_cids);
593
594 GrowableArray<intptr_t> expected_cids;
595 expected_cids.AddArray(expected_concrete_cids);
596 expected_cids.AddArray(expected_abstract_cids);
597 const CidRangeVector& abstract_range = hi.SubtypeRangesForClass(
598 cls, /*include_abstract=*/true, /*exclude_null=*/true);
599 RANGES_CONTAIN_EXPECTED_CIDS(abstract_range, expected_cids);
600}

◆ ISOLATE_UNIT_TEST_CASE() [151/463]

dart::ISOLATE_UNIT_TEST_CASE ( HierarchyInfo_Object_Subtype  )

Definition at line 501 of file il_test.cc.

501 {
502 HierarchyInfo hi(thread);
503 const auto& type =
504 Type::Handle(IsolateGroup::Current()->object_store()->object_type());
505 const bool is_nullable = Instance::NullIsAssignableTo(type);
506 EXPECT(hi.CanUseSubtypeRangeCheckFor(type));
507 const auto& cls = Class::Handle(type.type_class());
508
509 ClassTable* const class_table = thread->isolate_group()->class_table();
510 const intptr_t num_cids = class_table->NumCids();
511 auto& to_check = Class::Handle(thread->zone());
512 auto& rare_type = AbstractType::Handle(thread->zone());
513
514 GrowableArray<intptr_t> expected_concrete_cids;
515 GrowableArray<intptr_t> expected_abstract_cids;
516 for (intptr_t cid = kInstanceCid; cid < num_cids; cid++) {
517 if (!class_table->HasValidClassAt(cid)) continue;
518 if (cid == kNullCid) continue;
519 if (cid == kNeverCid) continue;
520 if (cid == kDynamicCid && !is_nullable) continue;
521 if (cid == kVoidCid && !is_nullable) continue;
522 to_check = class_table->At(cid);
523 // Only add concrete classes.
524 if (to_check.is_abstract()) {
525 expected_abstract_cids.Add(cid);
526 } else {
527 expected_concrete_cids.Add(cid);
528 }
529 if (cid != kTypeArgumentsCid) { // Cannot call RareType() on this.
530 rare_type = to_check.RareType();
531 EXPECT(rare_type.IsSubtypeOf(type, Heap::kNew));
532 }
533 }
534
535 const CidRangeVector& concrete_range = hi.SubtypeRangesForClass(
536 cls, /*include_abstract=*/false, /*exclude_null=*/!is_nullable);
537 RANGES_CONTAIN_EXPECTED_CIDS(concrete_range, expected_concrete_cids);
538
539 GrowableArray<intptr_t> expected_cids;
540 expected_cids.AddArray(expected_concrete_cids);
541 expected_cids.AddArray(expected_abstract_cids);
542 const CidRangeVector& abstract_range = hi.SubtypeRangesForClass(
543 cls, /*include_abstract=*/true, /*exclude_null=*/!is_nullable);
544 RANGES_CONTAIN_EXPECTED_CIDS(abstract_range, expected_cids);
545}
intptr_t NumCids() const
MallocGrowableArray< CidRangeValue > CidRangeVector
Definition il.h:253

◆ ISOLATE_UNIT_TEST_CASE() [152/463]

dart::ISOLATE_UNIT_TEST_CASE ( HierarchyInfo_String_Subtype  )

Definition at line 627 of file il_test.cc.

627 {
628 HierarchyInfo hi(thread);
629 const auto& type = Type::Handle(Type::StringType());
630 EXPECT(hi.CanUseSubtypeRangeCheckFor(type));
631 const auto& cls = Class::Handle(type.type_class());
632
633 GrowableArray<intptr_t> expected_concrete_cids;
634 expected_concrete_cids.Add(kOneByteStringCid);
635 expected_concrete_cids.Add(kTwoByteStringCid);
636
637 GrowableArray<intptr_t> expected_abstract_cids;
638 expected_abstract_cids.Add(type.type_class_id());
639
640 const CidRangeVector& concrete_range = hi.SubtypeRangesForClass(
641 cls, /*include_abstract=*/false, /*exclude_null=*/true);
642 THR_Print("Checking concrete subtype ranges for String\n");
643 RANGES_CONTAIN_EXPECTED_CIDS(concrete_range, expected_concrete_cids);
644
645 GrowableArray<intptr_t> expected_cids;
646 expected_cids.AddArray(expected_concrete_cids);
647 expected_cids.AddArray(expected_abstract_cids);
648 const CidRangeVector& abstract_range = hi.SubtypeRangesForClass(
649 cls, /*include_abstract=*/true, /*exclude_null=*/true);
650 THR_Print("Checking concrete and abstract subtype ranges for String\n");
651 RANGES_CONTAIN_EXPECTED_CIDS(abstract_range, expected_cids);
652}

◆ ISOLATE_UNIT_TEST_CASE() [153/463]

dart::ISOLATE_UNIT_TEST_CASE ( ICData  )

Definition at line 3028 of file object_test.cc.

3028 {
3029 Function& function = Function::Handle(GetDummyTarget("Bern"));
3030 const intptr_t id = 12;
3031 const intptr_t num_args_tested = 1;
3032 const String& target_name = String::Handle(Symbols::New(thread, "Thun"));
3033 const intptr_t kTypeArgsLen = 0;
3034 const intptr_t kNumArgs = 1;
3035 const Array& args_descriptor = Array::Handle(ArgumentsDescriptor::NewBoxed(
3036 kTypeArgsLen, kNumArgs, Object::null_array()));
3037 ICData& o1 = ICData::Handle();
3038 o1 = ICData::New(function, target_name, args_descriptor, id, num_args_tested,
3039 ICData::kInstance);
3040 EXPECT_EQ(1, o1.NumArgsTested());
3041 EXPECT_EQ(id, o1.deopt_id());
3042 EXPECT_EQ(function.ptr(), o1.Owner());
3043 EXPECT_EQ(0, o1.NumberOfChecks());
3044 EXPECT_EQ(target_name.ptr(), o1.target_name());
3045 EXPECT_EQ(args_descriptor.ptr(), o1.arguments_descriptor());
3046
3047 const Function& target1 = Function::Handle(GetDummyTarget("Thun"));
3048 o1.AddReceiverCheck(kSmiCid, target1);
3049 EXPECT_EQ(1, o1.NumberOfChecks());
3050 EXPECT_EQ(1, o1.NumberOfUsedChecks());
3051 intptr_t test_class_id = -1;
3052 Function& test_target = Function::Handle();
3053 o1.GetOneClassCheckAt(0, &test_class_id, &test_target);
3054 EXPECT_EQ(kSmiCid, test_class_id);
3055 EXPECT_EQ(target1.ptr(), test_target.ptr());
3056 EXPECT_EQ(kSmiCid, o1.GetCidAt(0));
3057 GrowableArray<intptr_t> test_class_ids;
3058 o1.GetCheckAt(0, &test_class_ids, &test_target);
3059 EXPECT_EQ(1, test_class_ids.length());
3060 EXPECT_EQ(kSmiCid, test_class_ids[0]);
3061 EXPECT_EQ(target1.ptr(), test_target.ptr());
3062
3063 const Function& target2 = Function::Handle(GetDummyTarget("Thun"));
3064 o1.AddReceiverCheck(kDoubleCid, target2);
3065 EXPECT_EQ(2, o1.NumberOfChecks());
3066 EXPECT_EQ(2, o1.NumberOfUsedChecks());
3067 o1.GetOneClassCheckAt(1, &test_class_id, &test_target);
3068 EXPECT_EQ(kDoubleCid, test_class_id);
3069 EXPECT_EQ(target2.ptr(), test_target.ptr());
3070 EXPECT_EQ(kDoubleCid, o1.GetCidAt(1));
3071
3072 o1.AddReceiverCheck(kMintCid, target2);
3073 EXPECT_EQ(3, o1.NumberOfUsedChecks());
3074 o1.SetCountAt(o1.NumberOfChecks() - 1, 0);
3075 EXPECT_EQ(2, o1.NumberOfUsedChecks());
3076
3077 ICData& o2 = ICData::Handle();
3078 o2 = ICData::New(function, target_name, args_descriptor, 57, 2,
3079 ICData::kInstance);
3080 EXPECT_EQ(2, o2.NumArgsTested());
3081 EXPECT_EQ(57, o2.deopt_id());
3082 EXPECT_EQ(function.ptr(), o2.Owner());
3083 EXPECT_EQ(0, o2.NumberOfChecks());
3085 classes.Add(kSmiCid);
3086 classes.Add(kSmiCid);
3087 o2.AddCheck(classes, target1);
3088 EXPECT_EQ(1, o2.NumberOfChecks());
3089 o2.GetCheckAt(0, &test_class_ids, &test_target);
3090 EXPECT_EQ(2, test_class_ids.length());
3091 EXPECT_EQ(kSmiCid, test_class_ids[0]);
3092 EXPECT_EQ(kSmiCid, test_class_ids[1]);
3093 EXPECT_EQ(target1.ptr(), test_target.ptr());
3094
3095 // Check ICData for unoptimized static calls.
3096 const intptr_t kNumArgsChecked = 0;
3097 const ICData& scall_icdata = ICData::Handle(
3098 ICData::NewForStaticCall(function, target1, args_descriptor, 57,
3099 kNumArgsChecked, ICData::kInstance));
3100 EXPECT_EQ(target1.ptr(), scall_icdata.GetTargetAt(0));
3101}
StringPtr target_name() const
Definition object.h:2352
ArrayPtr arguments_descriptor() const
Definition object.h:2353
void AddReceiverCheck(intptr_t receiver_class_id, const Function &target, intptr_t count=1, StaticTypeExactnessState exactness=StaticTypeExactnessState::NotTracking()) const
Definition object.cc:16936
intptr_t NumberOfUsedChecks() const
Definition object.cc:16687
void GetOneClassCheckAt(intptr_t index, intptr_t *class_id, Function *target) const
Definition object.cc:17036
intptr_t NumArgsTested() const
Definition object.cc:16518
void AddCheck(const GrowableArray< intptr_t > &class_ids, const Function &target, intptr_t count=1) const
Definition object.cc:16831
void GetCheckAt(intptr_t index, GrowableArray< intptr_t > *class_ids, Function *target) const
Definition object.cc:17002
intptr_t GetCidAt(intptr_t index) const
Definition object.cc:17051
FunctionPtr Owner() const
Definition object.cc:16470
void SetCountAt(intptr_t index, intptr_t value) const
Definition object.cc:17097
static FunctionPtr GetDummyTarget(const char *name)

◆ ISOLATE_UNIT_TEST_CASE() [154/463]

dart::ISOLATE_UNIT_TEST_CASE ( ICDataTest  )

Definition at line 465 of file thread_test.cc.

465 {
466 auto isolate_group = thread->isolate_group();
467 USE(isolate_group);
468 Monitor monitor;
469 intptr_t exited = 0;
470 std::atomic<bool> done = {false};
471
472 const intptr_t kNumICData = 0x10;
473
474 const Array& ic_datas = Array::Handle(Array::New(kNumICData));
475 ICData& ic_data = ICData::Handle();
476 Function& owner = *CreateFunction("DummyFunction");
477 String& name = String::Handle(Symbols::New(thread, "foo"));
478 const Array& args_desc =
479 Array::Handle(ArgumentsDescriptor::NewBoxed(0, 0, Object::empty_array()));
480 for (intptr_t i = 0; i < kNumICData; i++) {
481 ic_data = ICData::New(owner, name, args_desc, /*deopt_id=*/0,
482 /*num_args_tested=*/1, ICData::kInstance,
483 Object::null_abstract_type());
484 ic_datas.SetAtRelease(i, ic_data);
485 }
486
487 for (int i = 0; i < ICDataTestTask::kTaskCount; i++) {
488 Dart::thread_pool()->Run<ICDataTestTask>(isolate_group, ic_datas, &monitor,
489 &exited, &done);
490 }
491
492 for (int i = 0; i < 0x10000; i++) {
493 for (intptr_t i = 0; i < kNumICData; i++) {
494 ic_data ^= ic_datas.At(i);
495 if (ic_data.NumberOfChecks() < 4) {
496 ic_data.AddReceiverCheck(kInstanceCid + ic_data.NumberOfChecks(), owner,
497 1);
498 } else {
499 ic_data = ICData::New(owner, name, args_desc, /*deopt_id=*/0,
500 /*num_args_tested=*/1, ICData::kInstance,
501 Object::null_abstract_type());
502 ic_datas.SetAtRelease(i, ic_data);
503 }
504 }
505 }
506 // Ensure we looped long enough to allow all helpers to succeed and exit.
507 {
508 done.store(true, std::memory_order_release);
509 MonitorLocker ml(&monitor);
510 while (exited != ICDataTestTask::kTaskCount) {
511 ml.Wait();
512 }
513 EXPECT_EQ(ICDataTestTask::kTaskCount, exited);
514 }
515}

◆ ISOLATE_UNIT_TEST_CASE() [155/463]

dart::ISOLATE_UNIT_TEST_CASE ( IL_Canonicalize_EqualityCompare  )

Definition at line 434 of file il_test.cc.

434 {
437}
static void TestNullAwareEqualityCompareCanonicalization(Thread *thread, bool allow_representation_change)
Definition il_test.cc:396

◆ ISOLATE_UNIT_TEST_CASE() [156/463]

dart::ISOLATE_UNIT_TEST_CASE ( IL_Canonicalize_FinalFieldForwarding  )

Definition at line 1483 of file il_test.cc.

1483 {
1484 const char* script_chars = R"(
1485 import 'dart:typed_data';
1486
1487 class TestClass {
1488 final dynamic finalField;
1489 late final dynamic lateFinalField;
1490 dynamic normalField;
1491
1492 TestClass(this.finalField, this.lateFinalField, this.normalField);
1493 }
1494 )";
1495 const auto& lib = Library::Handle(LoadTestScript(script_chars));
1496
1497 const auto& test_cls = Class::ZoneHandle(
1498 lib.LookupClass(String::Handle(Symbols::New(thread, "TestClass"))));
1499 const auto& err = Error::Handle(test_cls.EnsureIsFinalized(thread));
1500 EXPECT(err.IsNull());
1501
1502 const auto lookup_field = [&](const char* name) -> const Field& {
1503 const auto& original_field = Field::Handle(
1504 test_cls.LookupField(String::Handle(Symbols::New(thread, name))));
1505 EXPECT(!original_field.IsNull());
1506 return Field::Handle(original_field.CloneFromOriginal());
1507 };
1508
1509 const auto& final_field = lookup_field("finalField");
1510 const auto& late_final_field = lookup_field("lateFinalField");
1511 const auto& normal_field = lookup_field("normalField");
1512
1513 TestStaticFieldForwarding(thread, test_cls, final_field, /*num_stores=*/0,
1514 /*expected_to_forward=*/false);
1515 TestStaticFieldForwarding(thread, test_cls, final_field, /*num_stores=*/1,
1516 /*expected_to_forward=*/true);
1517 TestStaticFieldForwarding(thread, test_cls, final_field, /*num_stores=*/2,
1518 /*expected_to_forward=*/false);
1519
1520 TestStaticFieldForwarding(thread, test_cls, late_final_field,
1521 /*num_stores=*/0, /*expected_to_forward=*/false);
1522 TestStaticFieldForwarding(thread, test_cls, late_final_field,
1523 /*num_stores=*/1, /*expected_to_forward=*/false);
1524 TestStaticFieldForwarding(thread, test_cls, late_final_field,
1525 /*num_stores=*/2, /*expected_to_forward=*/false);
1526
1527 TestStaticFieldForwarding(thread, test_cls, normal_field, /*num_stores=*/0,
1528 /*expected_to_forward=*/false);
1529 TestStaticFieldForwarding(thread, test_cls, normal_field, /*num_stores=*/1,
1530 /*expected_to_forward=*/false);
1531 TestStaticFieldForwarding(thread, test_cls, normal_field, /*num_stores=*/2,
1532 /*expected_to_forward=*/false);
1533}

◆ ISOLATE_UNIT_TEST_CASE() [157/463]

dart::ISOLATE_UNIT_TEST_CASE ( IL_Canonicalize_InstanceCallWithNoICDataInAOT  )

Definition at line 1338 of file il_test.cc.

1338 {
1339 const auto& typed_data_lib = Library::Handle(Library::TypedDataLibrary());
1340 const auto& view_cls = Class::Handle(typed_data_lib.LookupClassAllowPrivate(
1341 String::Handle(Symbols::New(thread, "_TypedListBase"))));
1342 const Error& err = Error::Handle(view_cls.EnsureIsFinalized(thread));
1343 EXPECT(err.IsNull());
1344 const auto& getter = Function::Handle(
1345 view_cls.LookupFunctionAllowPrivate(Symbols::GetLength()));
1346 EXPECT(!getter.IsNull());
1347
1349 CompilerState S(thread, /*is_aot=*/true, /*is_optimizing=*/true);
1351
1352 auto b1 = H.flow_graph()->graph_entry()->normal_entry();
1353
1354 InstanceCallInstr* length_call;
1355 DartReturnInstr* ret;
1356
1357 {
1358 BlockBuilder builder(H.flow_graph(), b1);
1359 // array <- AllocateTypedData(1)
1360 const auto array = builder.AddDefinition(new AllocateTypedDataInstr(
1361 InstructionSource(), kTypedDataFloat64ArrayCid,
1362 new Value(H.IntConstant(1)), DeoptId::kNone));
1363 // length_call <- InstanceCall('get:length', array, ICData[])
1364 length_call = builder.AddDefinition(new InstanceCallInstr(
1365 InstructionSource(), Symbols::GetLength(), Token::kGET,
1366 /*args=*/{new Value(array)}, 0, Array::empty_array(), 1,
1367 /*deopt_id=*/42));
1368 length_call->EnsureICData(H.flow_graph());
1369 // Return(load)
1370 ret = builder.AddReturn(new Value(length_call));
1371 }
1372 H.FinishGraph();
1373 H.flow_graph()->Canonicalize();
1374
1375 EXPECT_PROPERTY(length_call, it.previous() == nullptr);
1376 EXPECT_PROPERTY(ret->value()->definition(), it.IsStaticCall());
1377 EXPECT_PROPERTY(ret->value()->definition()->AsStaticCall(),
1378 it.function().ptr() == getter.ptr());
1379}
Value * value() const
Definition il.h:3468
void EnsureICData(FlowGraph *graph)
Definition il.cc:5242

◆ ISOLATE_UNIT_TEST_CASE() [158/463]

dart::ISOLATE_UNIT_TEST_CASE ( IL_Canonicalize_RepresentationChange  )

Definition at line 1244 of file il_test.cc.

1244 {
1247}
static void TestRepresentationChangeDuringCanonicalization(Thread *thread, bool allow_representation_change)
Definition il_test.cc:1172

◆ ISOLATE_UNIT_TEST_CASE() [159/463]

dart::ISOLATE_UNIT_TEST_CASE ( IL_Canonicalize_TestRange  )

Definition at line 1410 of file il_test.cc.

1410 {
1411 HierarchyInfo hierarchy_info(thread);
1412 TestTestRangeCanonicalize(AbstractType::ZoneHandle(Type::IntType()),
1413 kOneByteStringCid, kTwoByteStringCid, false);
1414 TestTestRangeCanonicalize(AbstractType::ZoneHandle(Type::IntType()), kSmiCid,
1415 kMintCid, true);
1416 TestTestRangeCanonicalize(AbstractType::ZoneHandle(Type::NullType()), kSmiCid,
1417 kMintCid, false);
1418 TestTestRangeCanonicalize(AbstractType::ZoneHandle(Type::Double()), kSmiCid,
1419 kMintCid, false);
1420 TestTestRangeCanonicalize(AbstractType::ZoneHandle(Type::ObjectType()), 1,
1421 kClassIdTagMax, true);
1422}
static void TestTestRangeCanonicalize(const AbstractType &type, uword lower, uword upper, bool result)
Definition il_test.cc:1381

◆ ISOLATE_UNIT_TEST_CASE() [160/463]

dart::ISOLATE_UNIT_TEST_CASE ( IL_Canonicalize_TypedDataViewFactory  )

Definition at line 1328 of file il_test.cc.

1328 {
1329 TestCanonicalizationOfTypedDataViewFieldLoads(thread, TypedDataBase_length);
1331 TypedDataView_offset_in_bytes);
1333 TypedDataView_typed_data);
1334}
static void TestCanonicalizationOfTypedDataViewFieldLoads(Thread *thread, TypeDataField field_kind)
Definition il_test.cc:1255

◆ ISOLATE_UNIT_TEST_CASE() [161/463]

dart::ISOLATE_UNIT_TEST_CASE ( IL_IntConverterCanonicalization  )

Definition at line 234 of file il_test.cc.

234 {
235 EXPECT(TestIntConverterCanonicalizationRule(thread, kMinInt16, kMaxInt16,
236 kUnboxedInt64, kUnboxedInt32,
237 kUnboxedInt64));
238 EXPECT(TestIntConverterCanonicalizationRule(thread, kMinInt32, kMaxInt32,
239 kUnboxedInt64, kUnboxedInt32,
240 kUnboxedInt64));
242 thread, kMinInt32, static_cast<int64_t>(kMaxInt32) + 1, kUnboxedInt64,
243 kUnboxedInt32, kUnboxedInt64));
245 thread, 0, kMaxInt16, kUnboxedInt64, kUnboxedUint32, kUnboxedInt64));
247 thread, 0, kMaxInt32, kUnboxedInt64, kUnboxedUint32, kUnboxedInt64));
249 thread, 0, kMaxUint32, kUnboxedInt64, kUnboxedUint32, kUnboxedInt64));
251 thread, 0, static_cast<int64_t>(kMaxUint32) + 1, kUnboxedInt64,
252 kUnboxedUint32, kUnboxedInt64));
254 thread, -1, kMaxInt16, kUnboxedInt64, kUnboxedUint32, kUnboxedInt64));
255
256 // Regression test for https://dartbug.com/53613.
257 EXPECT(!TestIntConverterCanonicalizationRule(thread, kMinInt32, kMaxInt32,
258 kUnboxedInt32, kUnboxedUint32,
259 kUnboxedInt64));
260 EXPECT(!TestIntConverterCanonicalizationRule(thread, kMinInt32, kMaxInt32,
261 kUnboxedInt32, kUnboxedUint32,
262 kUnboxedInt32));
264 thread, 0, kMaxInt32, kUnboxedInt32, kUnboxedUint32, kUnboxedInt64));
266 thread, 0, kMaxInt32, kUnboxedInt32, kUnboxedUint32, kUnboxedInt32));
267}
bool TestIntConverterCanonicalizationRule(Thread *thread, int64_t min_value, int64_t max_value, Representation initial, Representation intermediate, Representation final)
Definition il_test.cc:196

◆ ISOLATE_UNIT_TEST_CASE() [162/463]

dart::ISOLATE_UNIT_TEST_CASE ( IL_PhiCanonicalization  )

Definition at line 269 of file il_test.cc.

269 {
271
272 CompilerState S(thread, /*is_aot=*/false, /*is_optimizing=*/true);
273
274 FlowGraphBuilderHelper H(/*num_parameters=*/1);
275 H.AddVariable("v0", AbstractType::ZoneHandle(Type::DynamicType()));
276
277 auto normal_entry = H.flow_graph()->graph_entry()->normal_entry();
278 auto b2 = H.JoinEntry();
279 auto b3 = H.TargetEntry();
280 auto b4 = H.TargetEntry();
281
282 Definition* v0;
283 DartReturnInstr* ret;
284 PhiInstr* phi;
285
286 {
287 BlockBuilder builder(H.flow_graph(), normal_entry);
288 v0 = builder.AddParameter(0, kTagged);
289 builder.AddInstruction(new GotoInstr(b2, S.GetNextDeoptId()));
290 }
291
292 {
293 BlockBuilder builder(H.flow_graph(), b2);
294 phi = new PhiInstr(b2, 2);
295 phi->SetInputAt(0, new Value(v0));
296 phi->SetInputAt(1, new Value(phi));
297 builder.AddPhi(phi);
298 builder.AddBranch(new StrictCompareInstr(
299 InstructionSource(), Token::kEQ_STRICT,
300 new Value(H.IntConstant(1)), new Value(phi),
301 /*needs_number_check=*/false, S.GetNextDeoptId()),
302 b3, b4);
303 }
304
305 {
306 BlockBuilder builder(H.flow_graph(), b3);
307 builder.AddInstruction(new GotoInstr(b2, S.GetNextDeoptId()));
308 }
309
310 {
311 BlockBuilder builder(H.flow_graph(), b4);
312 ret = builder.AddReturn(new Value(phi));
313 }
314
315 H.FinishGraph();
316
317 H.flow_graph()->Canonicalize();
318
319 EXPECT(ret->value()->definition() == v0);
320}

◆ ISOLATE_UNIT_TEST_CASE() [163/463]

dart::ISOLATE_UNIT_TEST_CASE ( IL_UnboxIntegerCanonicalization  )

Definition at line 323 of file il_test.cc.

323 {
325
326 CompilerState S(thread, /*is_aot=*/false, /*is_optimizing=*/true);
327
328 FlowGraphBuilderHelper H(/*num_parameters=*/2);
329 H.AddVariable("v0", AbstractType::ZoneHandle(Type::DynamicType()));
330 H.AddVariable("v1", AbstractType::ZoneHandle(Type::DynamicType()));
331
332 auto normal_entry = H.flow_graph()->graph_entry()->normal_entry();
333 Definition* unbox;
334
335 {
336 BlockBuilder builder(H.flow_graph(), normal_entry);
337 Definition* index = H.IntConstant(0);
338 Definition* int_type =
339 H.flow_graph()->GetConstant(Type::Handle(Type::IntType()));
340
341 Definition* float64_array = builder.AddParameter(0, kTagged);
342 Definition* int64_array = builder.AddParameter(1, kTagged);
343
344 Definition* load_indexed = builder.AddDefinition(new LoadIndexedInstr(
345 new Value(float64_array), new Value(index),
346 /* index_unboxed */ false,
347 /* index_scale */ 8, kTypedDataFloat64ArrayCid, kAlignedAccess,
348 S.GetNextDeoptId(), InstructionSource()));
349 Definition* box = builder.AddDefinition(
350 BoxInstr::Create(kUnboxedDouble, new Value(load_indexed)));
351 Definition* cast = builder.AddDefinition(new AssertAssignableInstr(
352 InstructionSource(), new Value(box), new Value(int_type),
353 /* instantiator_type_arguments */
354 new Value(H.flow_graph()->constant_null()),
355 /* function_type_arguments */
356 new Value(H.flow_graph()->constant_null()),
357 /* dst_name */ String::Handle(String::New("not-null")),
358 S.GetNextDeoptId()));
359 unbox = builder.AddDefinition(new UnboxInt64Instr(
360 new Value(cast), S.GetNextDeoptId(), BoxInstr::kGuardInputs));
361
362 builder.AddInstruction(new StoreIndexedInstr(
363 new Value(int64_array), new Value(index), new Value(unbox),
364 kNoStoreBarrier,
365 /* index_unboxed */ false,
366 /* index_scale */ 8, kTypedDataInt64ArrayCid, kAlignedAccess,
367 S.GetNextDeoptId(), InstructionSource()));
368 builder.AddReturn(new Value(index));
369 }
370
371 H.FinishGraph();
372
373 FlowGraphTypePropagator::Propagate(H.flow_graph());
374 EXPECT(!unbox->ComputeCanDeoptimize());
375
376 H.flow_graph()->Canonicalize();
377 EXPECT(!unbox->ComputeCanDeoptimize());
378
379 H.flow_graph()->RemoveRedefinitions();
380 EXPECT(!unbox->ComputeCanDeoptimize()); // Previously this reverted to true.
381}
SI D cast(const S &v)
virtual bool ComputeCanDeoptimize() const =0

◆ ISOLATE_UNIT_TEST_CASE() [164/463]

dart::ISOLATE_UNIT_TEST_CASE ( Inliner_InlineForceOptimized  )

Definition at line 375 of file inliner_test.cc.

375 {
376 const char* kScript = R"(
377 import 'dart:ffi';
378
379 @pragma('vm:never-inline')
380 int foo(int x) {
381 dynamic ptr = Pointer.fromAddress(x);
382 return x + ptr.hashCode;
383 }
384 main() {
385 int r = 0;
386 for (int i = 0; i < 1000; i++) {
387 r += foo(r);
388 }
389 return r;
390 }
391 )";
392
393 const auto& root_library = Library::Handle(LoadTestScript(kScript));
394 const auto& function = Function::Handle(GetFunction(root_library, "foo"));
395
396 Invoke(root_library, "main");
397
398 TestPipeline pipeline(function, CompilerPass::kJIT);
399 FlowGraph* flow_graph = pipeline.RunPasses({
400 CompilerPass::kComputeSSA,
401 CompilerPass::kApplyICData,
402 CompilerPass::kTryOptimizePatterns,
403 CompilerPass::kSetOuterInliningId,
404 CompilerPass::kTypePropagation,
405 CompilerPass::kApplyClassIds,
406 });
407
408 auto entry = flow_graph->graph_entry()->normal_entry();
409 StaticCallInstr* call_instr = nullptr;
410 {
411 ILMatcher cursor(flow_graph, entry);
412 RELEASE_ASSERT(cursor.TryMatch({
413 {kMoveGlob},
414 {kMatchAndMoveStaticCall, &call_instr},
415 }));
416 EXPECT(strcmp(call_instr->function().UserVisibleNameCString(),
417 "Pointer.fromAddress") == 0);
418 }
419
420 pipeline.RunAdditionalPasses({
421 CompilerPass::kInlining,
422 });
423
424 AllocateObjectInstr* allocate_object_instr = nullptr;
425 {
426 ILMatcher cursor(flow_graph, entry);
427 RELEASE_ASSERT(cursor.TryMatch({
428 {kMoveGlob},
429 {kMatchAndMoveAllocateObject, &allocate_object_instr},
430 }));
431 }
432
433 // Ensure that AllocateObject instruction that came from force-optimized
434 // function has deopt and environment taken from the Call instruction.
435 EXPECT(call_instr->deopt_id() == allocate_object_instr->deopt_id());
436 EXPECT(DeoptId::IsDeoptBefore(call_instr->deopt_id()));
437
438 auto allocate_object_instr_env = allocate_object_instr->env();
439 EXPECT(allocate_object_instr_env->LazyDeoptToBeforeDeoptId());
440 EXPECT(allocate_object_instr_env->Outermost()->GetDeoptId() ==
441 call_instr->deopt_id());
442 const auto call_instr_env = call_instr->env();
443 const intptr_t call_first_index =
444 call_instr_env->Length() - call_instr->InputCount();
445 const intptr_t allocate_first_index =
446 allocate_object_instr_env->Length() - call_instr->InputCount();
447 for (intptr_t i = 0; i < call_instr->InputCount(); i++) {
448 EXPECT(call_instr_env->ValueAt(call_first_index + i)->definition() ==
449 allocate_object_instr_env->ValueAt(allocate_first_index + i)
450 ->definition());
451 }
452}

◆ ISOLATE_UNIT_TEST_CASE() [165/463]

dart::ISOLATE_UNIT_TEST_CASE ( Inliner_PolyInliningRedefinition  )

Definition at line 19 of file inliner_test.cc.

19 {
20 const char* kScript = R"(
21 abstract class A {
22 String toInline() { return "A"; }
23 }
24
25 class B extends A {}
26 class C extends A {
27 @override
28 String toInline() { return "C";}
29 }
30 class D extends A {}
31
32 testInlining(A arg) {
33 arg.toInline();
34 }
35
36 main() {
37 for (var i = 0; i < 10; i++) {
38 testInlining(B());
39 testInlining(C());
40 testInlining(D());
41 }
42 }
43 )";
44
45 const auto& root_library = Library::Handle(LoadTestScript(kScript));
46 const auto& function =
47 Function::Handle(GetFunction(root_library, "testInlining"));
48
49 Invoke(root_library, "main");
50
51 TestPipeline pipeline(function, CompilerPass::kJIT);
52 FlowGraph* flow_graph = pipeline.RunPasses({
53 CompilerPass::kComputeSSA,
54 CompilerPass::kApplyICData,
55 CompilerPass::kTryOptimizePatterns,
56 CompilerPass::kSetOuterInliningId,
57 CompilerPass::kTypePropagation,
58 CompilerPass::kApplyClassIds,
59 CompilerPass::kInlining,
60 });
61
62 auto entry = flow_graph->graph_entry()->normal_entry();
63 EXPECT(entry != nullptr);
64
65 EXPECT(entry->initial_definitions()->length() == 1);
66 EXPECT(entry->initial_definitions()->At(0)->IsParameter());
67 ParameterInstr* param = entry->initial_definitions()->At(0)->AsParameter();
68
69 // First we find the start of the prelude for the inlined instruction,
70 // and also keep a reference to the LoadClassId instruction for later.
71 LoadClassIdInstr* lcid = nullptr;
72 BranchInstr* prelude = nullptr;
73
74 ILMatcher cursor(flow_graph, entry);
75 RELEASE_ASSERT(cursor.TryMatch(
76 {
77 {kMatchLoadClassId, &lcid},
78 {kMatchBranch, &prelude},
79 },
80 /*insert_before=*/kMoveGlob));
81
82 const Class& cls = Class::Handle(
83 root_library.LookupClass(String::Handle(Symbols::New(thread, "B"))));
84
85 Definition* cid_B = flow_graph->GetConstant(Smi::Handle(Smi::New(cls.id())));
86 Instruction* current = prelude;
87
88 // We walk false branches until we either reach a branch instruction that uses
89 // B's cid for comparison to the value returned from the LCID instruction
90 // above, or a default case if there was no branch instruction for B's cid.
91 while (true) {
92 EXPECT(current->IsBranch());
93 const ComparisonInstr* check = current->AsBranch()->comparison();
94 EXPECT(check->left()->definition() == lcid);
95 if (check->right()->definition() == cid_B) break;
96 current = current->SuccessorAt(1);
97 // By following false paths, we should be walking a series of blocks that
98 // looks like:
99 // B#[target]:#
100 // Branch if <check on class ID>
101 // If we end up not finding a branch, then we're in a default case
102 // that contains a class check.
103 current = current->next();
104 if (!current->IsBranch()) {
105 break;
106 }
107 }
108 // If we found a branch that checks against the class ID, we follow the true
109 // branch to a block that contains only a goto to the desired join block.
110 if (current->IsBranch()) {
111 current = current->SuccessorAt(0);
112 } else {
113 // We're in the default case, which will check the class ID to make sure
114 // it's the one expected for the fallthrough. That check will be followed
115 // by a goto to the desired join block.
116 EXPECT(current->IsRedefinition());
117 const auto redef = current->AsRedefinition();
118 EXPECT(redef->value()->definition() == lcid);
119 current = current->next();
120 EXPECT(current->IsCheckClassId());
121 EXPECT(current->AsCheckClassId()->value()->definition() == redef);
122 }
123 current = current->next();
124 EXPECT(current->IsGoto());
125 current = current->AsGoto()->successor();
126 // Now we should be at a block that starts like:
127 // BY[join]:# pred(...)
128 // vW <- Redefinition(vV)
129 //
130 // where vV is a reference to the function parameter (the receiver of
131 // the inlined function).
132 current = current->next();
133 EXPECT(current->IsRedefinition());
134 EXPECT(current->AsRedefinition()->value()->definition() == param);
135 EXPECT(current->AsRedefinition()->Type()->ToCid() == kDynamicCid);
136}

◆ ISOLATE_UNIT_TEST_CASE() [166/463]

dart::ISOLATE_UNIT_TEST_CASE ( Inliner_TypedData_Regress7551  )

Definition at line 138 of file inliner_test.cc.

138 {
139 const char* kScript = R"(
140 import 'dart:typed_data';
141
142 setValue(Int32List list, int value) {
143 list[0] = value;
144 }
145
146 main() {
147 final list = Int32List(10);
148 setValue(list, 0x1122334455);
149 }
150 )";
151
152 const auto& root_library = Library::Handle(LoadTestScript(kScript));
153 const auto& function =
154 Function::Handle(GetFunction(root_library, "setValue"));
155
156 Invoke(root_library, "main");
157
158 TestPipeline pipeline(function, CompilerPass::kJIT);
159 FlowGraph* flow_graph = pipeline.RunPasses({
160 CompilerPass::kComputeSSA,
161 CompilerPass::kApplyICData,
162 CompilerPass::kTryOptimizePatterns,
163 CompilerPass::kSetOuterInliningId,
164 CompilerPass::kTypePropagation,
165 CompilerPass::kApplyClassIds,
166 CompilerPass::kInlining,
167 });
168
169 auto entry = flow_graph->graph_entry()->normal_entry();
170
171 EXPECT(entry->initial_definitions()->length() == 2);
172 EXPECT(entry->initial_definitions()->At(0)->IsParameter());
173 EXPECT(entry->initial_definitions()->At(1)->IsParameter());
174 ParameterInstr* list_param =
175 entry->initial_definitions()->At(0)->AsParameter();
176 ParameterInstr* value_param =
177 entry->initial_definitions()->At(1)->AsParameter();
178
179 ILMatcher cursor(flow_graph, entry);
180
181 CheckArrayBoundInstr* bounds_check_instr = nullptr;
182 UnboxInt32Instr* unbox_instr = nullptr;
183 StoreIndexedInstr* store_instr = nullptr;
184
185 RELEASE_ASSERT(cursor.TryMatch({
186 {kMoveGlob},
187 {kMatchAndMoveCheckArrayBound, &bounds_check_instr},
188 {kMatchAndMoveUnboxInt32, &unbox_instr},
189 {kMatchAndMoveStoreIndexed, &store_instr},
190 }));
191
192 RELEASE_ASSERT(unbox_instr->InputAt(0)->definition()->OriginalDefinition() ==
193 value_param);
194 RELEASE_ASSERT(store_instr->InputAt(0)->definition() == list_param);
195 RELEASE_ASSERT(store_instr->InputAt(2)->definition() == unbox_instr);
196 RELEASE_ASSERT(unbox_instr->is_truncating());
197}

◆ ISOLATE_UNIT_TEST_CASE() [167/463]

dart::ISOLATE_UNIT_TEST_CASE ( InstanceClass  )

Definition at line 315 of file object_test.cc.

315 {
316 // Allocate the class first.
317 String& class_name = String::Handle(Symbols::New(thread, "EmptyClass"));
318 Script& script = Script::Handle();
319 const Class& empty_class =
320 Class::Handle(CreateDummyClass(class_name, script));
321
322 // EmptyClass has no fields and no functions.
323 EXPECT_EQ(Array::Handle(empty_class.fields()).Length(), 0);
324 EXPECT_EQ(Array::Handle(empty_class.current_functions()).Length(), 0);
325
326 ClassFinalizer::FinalizeTypesInClass(empty_class);
327 {
328 SafepointWriteRwLocker ml(thread, thread->isolate_group()->program_lock());
329 empty_class.Finalize();
330 }
331
332 EXPECT_EQ(kObjectAlignment, empty_class.host_instance_size());
333 Instance& instance = Instance::Handle(Instance::New(empty_class));
334 EXPECT_EQ(empty_class.ptr(), instance.clazz());
335
336 class_name = Symbols::New(thread, "OneFieldClass");
337 const Class& one_field_class =
338 Class::Handle(CreateDummyClass(class_name, script));
339
340 // No fields, functions, or super type for the OneFieldClass.
341 EXPECT_EQ(Array::Handle(empty_class.fields()).Length(), 0);
342 EXPECT_EQ(Array::Handle(empty_class.current_functions()).Length(), 0);
343 EXPECT_EQ(empty_class.super_type(), AbstractType::null());
344 ClassFinalizer::FinalizeTypesInClass(one_field_class);
345
346 const Array& one_fields = Array::Handle(Array::New(1));
347 const String& field_name = String::Handle(Symbols::New(thread, "the_field"));
348 const Field& field = Field::Handle(
349 Field::New(field_name, false, false, false, true, false, one_field_class,
350 Object::dynamic_type(), TokenPosition::kMinSource,
351 TokenPosition::kMinSource));
352 one_fields.SetAt(0, field);
353 {
354 SafepointWriteRwLocker ml(thread, thread->isolate_group()->program_lock());
355 one_field_class.SetFields(one_fields);
356 one_field_class.Finalize();
357 }
358 intptr_t header_size = sizeof(UntaggedObject);
359 EXPECT_EQ(Utils::RoundUp((header_size + (1 * kWordSize)), kObjectAlignment),
360 one_field_class.host_instance_size());
361 EXPECT_EQ(header_size, field.HostOffset());
362 EXPECT(!one_field_class.is_implemented());
363 one_field_class.set_is_implemented_unsafe();
364 EXPECT(one_field_class.is_implemented());
365}
intptr_t host_instance_size() const
Definition object.h:1145

◆ ISOLATE_UNIT_TEST_CASE() [168/463]

dart::ISOLATE_UNIT_TEST_CASE ( InstructionTests  )

Definition at line 21 of file il_test.cc.

21 {
22 TargetEntryInstr* target_instr =
23 new TargetEntryInstr(1, kInvalidTryIndex, DeoptId::kNone);
24 EXPECT(target_instr->IsBlockEntry());
25 EXPECT(!target_instr->IsDefinition());
26}

◆ ISOLATE_UNIT_TEST_CASE() [169/463]

dart::ISOLATE_UNIT_TEST_CASE ( Integer  )

Definition at line 660 of file object_test.cc.

660 {
661 Integer& i = Integer::Handle();
662 i = Integer::NewCanonical(String::Handle(String::New("12")));
663 EXPECT(i.IsSmi());
664 i = Integer::NewCanonical(String::Handle(String::New("-120")));
665 EXPECT(i.IsSmi());
666 i = Integer::NewCanonical(String::Handle(String::New("0")));
667 EXPECT(i.IsSmi());
668 i = Integer::NewCanonical(
669 String::Handle(String::New("12345678901234567890")));
670 EXPECT(i.IsNull());
671 i = Integer::NewCanonical(
672 String::Handle(String::New("-12345678901234567890111222")));
673 EXPECT(i.IsNull());
674}

◆ ISOLATE_UNIT_TEST_CASE() [170/463]

dart::ISOLATE_UNIT_TEST_CASE ( InternalTypedData  )

Definition at line 2237 of file object_test.cc.

2237 {
2238 uint8_t data[] = {253, 254, 255, 0, 1, 2, 3, 4};
2239 intptr_t data_length = ARRAY_SIZE(data);
2240
2241 const TypedData& int8_array =
2242 TypedData::Handle(TypedData::New(kTypedDataInt8ArrayCid, data_length));
2243 EXPECT(!int8_array.IsNull());
2244 EXPECT_EQ(data_length, int8_array.Length());
2245 for (intptr_t i = 0; i < data_length; ++i) {
2246 int8_array.SetInt8(i, data[i]);
2247 }
2248
2249 EXPECT_EQ(-3, int8_array.GetInt8(0));
2250 EXPECT_EQ(253, int8_array.GetUint8(0));
2251
2252 EXPECT_EQ(-2, int8_array.GetInt8(1));
2253 EXPECT_EQ(254, int8_array.GetUint8(1));
2254
2255 EXPECT_EQ(-1, int8_array.GetInt8(2));
2256 EXPECT_EQ(255, int8_array.GetUint8(2));
2257
2258 EXPECT_EQ(0, int8_array.GetInt8(3));
2259 EXPECT_EQ(0, int8_array.GetUint8(3));
2260
2261 EXPECT_EQ(1, int8_array.GetInt8(4));
2262 EXPECT_EQ(1, int8_array.GetUint8(4));
2263
2264 EXPECT_EQ(2, int8_array.GetInt8(5));
2265 EXPECT_EQ(2, int8_array.GetUint8(5));
2266
2267 EXPECT_EQ(3, int8_array.GetInt8(6));
2268 EXPECT_EQ(3, int8_array.GetUint8(6));
2269
2270 EXPECT_EQ(4, int8_array.GetInt8(7));
2271 EXPECT_EQ(4, int8_array.GetUint8(7));
2272
2273 const TypedData& int8_array2 =
2274 TypedData::Handle(TypedData::New(kTypedDataInt8ArrayCid, data_length));
2275 EXPECT(!int8_array.IsNull());
2276 EXPECT_EQ(data_length, int8_array.Length());
2277 for (intptr_t i = 0; i < data_length; ++i) {
2278 int8_array2.SetInt8(i, data[i]);
2279 }
2280
2281 for (intptr_t i = 0; i < data_length; ++i) {
2282 EXPECT_EQ(int8_array.GetInt8(i), int8_array2.GetInt8(i));
2283 }
2284 for (intptr_t i = 0; i < data_length; ++i) {
2285 int8_array.SetInt8(i, 123 + i);
2286 }
2287 for (intptr_t i = 0; i < data_length; ++i) {
2288 EXPECT(int8_array.GetInt8(i) != int8_array2.GetInt8(i));
2289 }
2290}

◆ ISOLATE_UNIT_TEST_CASE() [171/463]

dart::ISOLATE_UNIT_TEST_CASE ( IRTest_CachableIdempotentCall  )

Definition at line 764 of file il_test.cc.

764 {
765 // clang-format off
766 auto kScript = Utils::CStringUniquePtr(OS::SCreate(nullptr, R"(
767 int globalCounter = 0;
768
769 int increment() => ++globalCounter;
770
771 int cachedIncrement() {
772 // We will replace this call with a cacheable call,
773 // which will lead to the counter no longer being incremented.
774 // Make sure to return the value, so we can see that the boxing and
775 // unboxing works as expected.
776 return increment();
777 }
778
779 int multipleIncrement() {
780 int returnValue = 0;
781 for(int i = 0; i < 10; i++) {
782 // Save the last returned value.
783 returnValue = cachedIncrement();
784 }
785 return returnValue;
786 }
787 )"), std::free);
788 // clang-format on
789
790 const auto& root_library = Library::Handle(LoadTestScript(kScript.get()));
791 const auto& first_result =
792 Object::Handle(Invoke(root_library, "multipleIncrement"));
793 EXPECT(first_result.IsSmi());
794 if (first_result.IsSmi()) {
795 const intptr_t int_value = Smi::Cast(first_result).Value();
796 EXPECT_EQ(10, int_value);
797 }
798
799 const auto& cached_increment_function =
800 Function::Handle(GetFunction(root_library, "cachedIncrement"));
801
802 const auto& increment_function =
803 Function::ZoneHandle(GetFunction(root_library, "increment"));
804
805 TestPipeline pipeline(cached_increment_function, CompilerPass::kJIT);
806 FlowGraph* flow_graph = pipeline.RunPasses({
807 CompilerPass::kComputeSSA,
808 });
809
810 StaticCallInstr* static_call = nullptr;
811 {
812 ILMatcher cursor(flow_graph, flow_graph->graph_entry()->normal_entry());
813
814 EXPECT(cursor.TryMatch({
815 kMoveGlob,
816 {kMatchAndMoveStaticCall, &static_call},
817 kMoveGlob,
818 kMatchDartReturn,
819 }));
820 }
821
823 CachableIdempotentCallInstr* call = new CachableIdempotentCallInstr(
824 InstructionSource(), kUnboxedAddress, increment_function,
825 static_call->type_args_len(), Array::empty_array(), std::move(args),
826 DeoptId::kNone);
827 static_call->ReplaceWith(call, nullptr);
828
829 pipeline.RunForcedOptimizedAfterSSAPasses();
830
831 {
832 ILMatcher cursor(flow_graph, flow_graph->graph_entry()->normal_entry());
833
834 EXPECT(cursor.TryMatch({
835 kMoveGlob,
836 kMatchAndMoveCachableIdempotentCall,
837 kMoveGlob,
838 // The cacheable call returns unboxed, so select representations
839 // adds boxing.
840 kMatchBox,
841 kMoveGlob,
842 kMatchDartReturn,
843 }));
844 }
845
846 {
847#if !defined(PRODUCT)
848 SetFlagScope<bool> sfs(&FLAG_disassemble_optimized, true);
849#endif
850 pipeline.CompileGraphAndAttachFunction();
851 }
852
853 const auto& second_result =
854 Object::Handle(Invoke(root_library, "multipleIncrement"));
855 EXPECT(second_result.IsSmi());
856 if (second_result.IsSmi()) {
857 const intptr_t int_value = Smi::Cast(second_result).Value();
858 EXPECT_EQ(11, int_value);
859 }
860}
GrowableArray< Value * > InputsArray
Definition il.h:895

◆ ISOLATE_UNIT_TEST_CASE() [172/463]

dart::ISOLATE_UNIT_TEST_CASE ( IRTest_DoubleEqualsSmi  )

Definition at line 657 of file il_test.cc.

657 {
658 const char* kScript = R"(
659 bool foo(double x) => (x + 0.5) == 0;
660 main() {
661 foo(-0.5);
662 }
663 )";
664
665 const auto& root_library = Library::Handle(LoadTestScript(kScript));
666 const auto& function = Function::Handle(GetFunction(root_library, "foo"));
667
668 TestPipeline pipeline(function, CompilerPass::kAOT);
669 FlowGraph* flow_graph = pipeline.RunPasses({});
670
671 auto entry = flow_graph->graph_entry()->normal_entry();
672 ILMatcher cursor(flow_graph, entry, /*trace=*/true,
673 ParallelMovesHandling::kSkip);
674
675 RELEASE_ASSERT(cursor.TryMatch({
676 kMoveGlob,
677 kMatchAndMoveBinaryDoubleOp,
678 kMatchAndMoveEqualityCompare,
679 kMatchDartReturn,
680 }));
681}

◆ ISOLATE_UNIT_TEST_CASE() [173/463]

dart::ISOLATE_UNIT_TEST_CASE ( IRTest_EliminateWriteBarrier  )

Definition at line 49 of file il_test.cc.

49 {
50 const char* nullable_tag = TestCase::NullableTag();
51 // clang-format off
52 auto kScript = Utils::CStringUniquePtr(OS::SCreate(nullptr, R"(
53 class Container<T> {
54 operator []=(var index, var value) {
55 return data[index] = value;
56 }
57
58 List<T%s> data = List<T%s>.filled(10, null);
59 }
60
61 Container<int> x = Container<int>();
62
63 foo() {
64 for (int i = 0; i < 10; ++i) {
65 x[i] = i;
66 }
67 }
68 )", nullable_tag, nullable_tag), std::free);
69 // clang-format on
70
71 const auto& root_library = Library::Handle(LoadTestScript(kScript.get()));
72 const auto& function = Function::Handle(GetFunction(root_library, "foo"));
73
74 Invoke(root_library, "foo");
75
76 TestPipeline pipeline(function, CompilerPass::kJIT);
77 FlowGraph* flow_graph = pipeline.RunPasses({});
78
79 auto entry = flow_graph->graph_entry()->normal_entry();
80 EXPECT(entry != nullptr);
81
82 StoreIndexedInstr* store_indexed = nullptr;
83
84 ILMatcher cursor(flow_graph, entry, true);
85 RELEASE_ASSERT(cursor.TryMatch({
86 kMoveGlob,
87 kMatchAndMoveBranchTrue,
88 kMoveGlob,
89 {kMatchStoreIndexed, &store_indexed},
90 }));
91
92 EXPECT(!store_indexed->value()->NeedsWriteBarrier());
93}

◆ ISOLATE_UNIT_TEST_CASE() [174/463]

dart::ISOLATE_UNIT_TEST_CASE ( IRTest_FfiCallInstrLeafDoesntSpill  )

Definition at line 936 of file il_test.cc.

936 {
937 const char* kScript = R"(
938 import 'dart:ffi';
939
940 // This is purely a placeholder and is never called.
941 void placeholder() {}
942
943 // Will call the "doFfiCall" and exercise its code.
944 bool invokeDoFfiCall() {
945 final double result = doFfiCall(1, 2, 3, 1.0, 2.0, 3.0);
946 if (result != (2 + 3 + 4 + 2.0 + 3.0 + 4.0)) {
947 throw 'Failed. Result was $result.';
948 }
949 return true;
950 }
951
952 // Will perform a "C" call while having live values in registers
953 // across the FfiCall.
954 double doFfiCall(int a, int b, int c, double x, double y, double z) {
955 // Ensure there is at least one live value in a register.
956 a += 1;
957 b += 1;
958 c += 1;
959 x += 1.0;
960 y += 1.0;
961 z += 1.0;
962 // We'll replace this StaticCall with an FfiCall.
963 placeholder();
964 // Use the live value.
965 return (a + b + c + x + y + z);
966 }
967
968 // FFI trampoline function.
969 typedef NT = Void Function();
970 typedef DT = void Function();
971 Pointer<NativeFunction<NT>> ptr = Pointer.fromAddress(0);
972 DT getFfiTrampolineClosure() => ptr.asFunction(isLeaf:true);
973 )";
974
975 const auto& root_library = Library::Handle(LoadTestScript(kScript));
976
977 // Build a "C" function that we can actually invoke.
978 auto& c_function = Instructions::Handle(
980 // Clobber all volatile registers to make sure caller doesn't rely on
981 // any non-callee-save register.
982 for (intptr_t reg = 0; reg < kNumberOfFpuRegisters; reg++) {
983 if ((kAbiVolatileFpuRegs & (1 << reg)) != 0) {
984#if defined(TARGET_ARCH_ARM)
985 // On ARM we need an extra scratch register for LoadDImmediate.
986 assembler->LoadDImmediate(static_cast<DRegister>(reg), 0.0, R3);
987#else
988 assembler->LoadDImmediate(static_cast<FpuRegister>(reg), 0.0);
989#endif
990 }
991 }
992 for (intptr_t reg = 0; reg < kNumberOfCpuRegisters; reg++) {
993 if ((kDartVolatileCpuRegs & (1 << reg)) != 0) {
994 assembler->LoadImmediate(static_cast<Register>(reg), 0xDEADBEEF);
995 }
996 }
997 assembler->Ret();
998 }));
999 uword native_entry = c_function.EntryPoint();
1000
1001 // Get initial compilation done.
1002 Invoke(root_library, "invokeDoFfiCall");
1003
1004 const Function& do_ffi_call =
1005 Function::Handle(GetFunction(root_library, "doFfiCall"));
1006 RELEASE_ASSERT(!do_ffi_call.IsNull());
1007
1008 const auto& value = Closure::Handle(
1009 Closure::RawCast(Invoke(root_library, "getFfiTrampolineClosure")));
1010 RELEASE_ASSERT(value.IsClosure());
1011 const auto& ffi_trampoline =
1012 Function::ZoneHandle(Closure::Cast(value).function());
1013 RELEASE_ASSERT(!ffi_trampoline.IsNull());
1014
1015 // Construct the FFICallInstr from the trampoline matching our native
1016 // function.
1017 const char* error = nullptr;
1018 auto* const zone = thread->zone();
1019 const auto& c_signature =
1020 FunctionType::ZoneHandle(zone, ffi_trampoline.FfiCSignature());
1021 const auto marshaller_ptr = compiler::ffi::CallMarshaller::FromFunction(
1022 zone, ffi_trampoline, /*function_params_start_at=*/1, c_signature,
1023 &error);
1024 RELEASE_ASSERT(error == nullptr);
1025 RELEASE_ASSERT(marshaller_ptr != nullptr);
1026 const auto& marshaller = *marshaller_ptr;
1027
1028 const auto& compile_and_run =
1029 [&](bool is_leaf, std::function<void(ParallelMoveInstr*)> verify) {
1030 // Build the SSA graph for "doFfiCall"
1031 TestPipeline pipeline(do_ffi_call, CompilerPass::kJIT);
1032 FlowGraph* flow_graph =
1033 SetupFfiFlowgraph(&pipeline, marshaller, native_entry, is_leaf);
1034
1035 {
1036 ParallelMoveInstr* parallel_move = nullptr;
1037 ILMatcher cursor(flow_graph,
1038 flow_graph->graph_entry()->normal_entry(),
1039 /*trace=*/false);
1040 while (cursor.TryMatch(
1041 {kMoveGlob, {kMatchAndMoveParallelMove, &parallel_move}})) {
1042 verify(parallel_move);
1043 }
1044 }
1045
1046 // Finish the compilation and attach code so we can run it.
1047 pipeline.CompileGraphAndAttachFunction();
1048
1049 // Ensure we can successfully invoke the FFI call.
1050 auto& result = Object::Handle(Invoke(root_library, "invokeDoFfiCall"));
1051 RELEASE_ASSERT(result.IsBool());
1052 EXPECT(Bool::Cast(result).value());
1053 };
1054
1055 intptr_t num_cpu_reg_to_stack_nonleaf = 0;
1056 intptr_t num_cpu_reg_to_stack_leaf = 0;
1057 intptr_t num_fpu_reg_to_stack_nonleaf = 0;
1058 intptr_t num_fpu_reg_to_stack_leaf = 0;
1059
1060 // Test non-leaf spills live values.
1061 compile_and_run(/*is_leaf=*/false, [&](ParallelMoveInstr* parallel_move) {
1062 // TargetAddress is passed in register, live values are all spilled.
1063 for (int i = 0; i < parallel_move->NumMoves(); i++) {
1064 auto move = parallel_move->moves()[i];
1065 if (move->src_slot()->IsRegister() && move->dest_slot()->IsStackSlot()) {
1066 num_cpu_reg_to_stack_nonleaf++;
1067 } else if (move->src_slot()->IsFpuRegister() &&
1068 move->dest_slot()->IsDoubleStackSlot()) {
1069 num_fpu_reg_to_stack_nonleaf++;
1070 }
1071 }
1072 });
1073
1074 // Test leaf calls do not cause spills of live values.
1075 compile_and_run(/*is_leaf=*/true, [&](ParallelMoveInstr* parallel_move) {
1076 // TargetAddress is passed in registers, live values are not spilled and
1077 // remains in callee-save registers.
1078 for (int i = 0; i < parallel_move->NumMoves(); i++) {
1079 auto move = parallel_move->moves()[i];
1080 if (move->src_slot()->IsRegister() && move->dest_slot()->IsStackSlot()) {
1081 num_cpu_reg_to_stack_leaf++;
1082 } else if (move->src_slot()->IsFpuRegister() &&
1083 move->dest_slot()->IsDoubleStackSlot()) {
1084 num_fpu_reg_to_stack_leaf++;
1085 }
1086 }
1087 });
1088
1089 // We should have less moves to the stack (i.e. spilling) in leaf calls.
1090 EXPECT_LT(num_cpu_reg_to_stack_leaf, num_cpu_reg_to_stack_nonleaf);
1091 // We don't have volatile FPU registers on all platforms.
1092 const bool has_callee_save_fpu_regs =
1093 Utils::CountOneBitsWord(kAbiVolatileFpuRegs) <
1094 Utils::CountOneBitsWord(kAllFpuRegistersList);
1095 EXPECT(!has_callee_save_fpu_regs ||
1096 num_fpu_reg_to_stack_leaf < num_fpu_reg_to_stack_nonleaf);
1097}
void LoadDImmediate(DRegister dd, double value, Register scratch, Condition cond=AL)
void Ret(Condition cond=AL)
void LoadImmediate(Register rd, Immediate value, Condition cond=AL)
if(end==-1)
InstructionsPtr BuildInstructions(std::function< void(compiler::Assembler *assembler)> fun)
FlowGraph * SetupFfiFlowgraph(TestPipeline *pipeline, const compiler::ffi::CallMarshaller &marshaller, uword native_entry, bool is_leaf)
Definition il_test.cc:864

◆ ISOLATE_UNIT_TEST_CASE() [175/463]

dart::ISOLATE_UNIT_TEST_CASE ( IRTest_InitializingStores  )

Definition at line 134 of file il_test.cc.

134 {
135 // clang-format off
136 auto kScript = Utils::CStringUniquePtr(OS::SCreate(nullptr, R"(
137 class Bar {
138 var f;
139 var g;
140
141 Bar({this.f, this.g});
142 }
143 Bar f1() => Bar(f: 10);
144 Bar f2() => Bar(g: 10);
145 f3() {
146 return () { };
147 }
148 f4<T>({T%s value}) {
149 return () { return value; };
150 }
151 main() {
152 f1();
153 f2();
154 f3();
155 f4();
156 }
157 )",
158 TestCase::NullableTag()), std::free);
159 // clang-format on
160
161 const auto& root_library = Library::Handle(LoadTestScript(kScript.get()));
162 Invoke(root_library, "main");
163
164 RunInitializingStoresTest(root_library, "f1", CompilerPass::kJIT,
165 /*expected_stores=*/{"f"});
166 RunInitializingStoresTest(root_library, "f2", CompilerPass::kJIT,
167 /*expected_stores=*/{"g"});
168 RunInitializingStoresTest(root_library, "f3", CompilerPass::kJIT,
169 /*expected_stores=*/
170 {"Closure.function", "Closure.entry_point"});
171
172 // Note that in JIT mode we lower context allocation in a way that hinders
173 // removal of initializing moves so there would be some redundant stores of
174 // null left in the graph. In AOT mode we don't apply this optimization
175 // which enables us to remove more stores.
176 std::vector<const char*> expected_stores_jit;
177 std::vector<const char*> expected_stores_aot;
178
179 expected_stores_jit.insert(
180 expected_stores_jit.end(),
181 {"value", "Context.parent", "Context.parent", "value",
182 "Closure.function_type_arguments", "Closure.context"});
183 expected_stores_aot.insert(
184 expected_stores_aot.end(),
185 {"value", "Closure.function_type_arguments", "Closure.context"});
186
187 RunInitializingStoresTest(root_library, "f4", CompilerPass::kJIT,
188 expected_stores_jit);
189 RunInitializingStoresTest(root_library, "f4", CompilerPass::kAOT,
190 expected_stores_aot);
191}
static void RunInitializingStoresTest(const Library &root_library, const char *function_name, CompilerPass::PipelineMode mode, const std::vector< const char * > &expected_stores)
Definition il_test.cc:112

◆ ISOLATE_UNIT_TEST_CASE() [176/463]

dart::ISOLATE_UNIT_TEST_CASE ( IRTest_LoadThread  )

Definition at line 683 of file il_test.cc.

683 {
684 // clang-format off
685 auto kScript = R"(
686 import 'dart:ffi';
687
688 int myFunction() {
689 return 100;
690 }
691
692 void anotherFunction() {}
693 )";
694 // clang-format on
695
696 const auto& root_library = Library::Handle(LoadTestScript(kScript));
697 Zone* const zone = Thread::Current()->zone();
698 auto& invoke_result = Instance::Handle(zone);
699 invoke_result ^= Invoke(root_library, "myFunction");
700 EXPECT_EQ(Smi::New(100), invoke_result.ptr());
701
702 const auto& my_function =
703 Function::Handle(GetFunction(root_library, "myFunction"));
704
705 TestPipeline pipeline(my_function, CompilerPass::kJIT);
706 FlowGraph* flow_graph = pipeline.RunPasses({
707 CompilerPass::kComputeSSA,
708 });
709
710 DartReturnInstr* return_instr = nullptr;
711 {
712 ILMatcher cursor(flow_graph, flow_graph->graph_entry()->normal_entry());
713
714 EXPECT(cursor.TryMatch({
715 kMoveGlob,
716 {kMatchDartReturn, &return_instr},
717 }));
718 }
719
720 auto* const load_thread_instr = new (zone) LoadThreadInstr();
721 flow_graph->InsertBefore(return_instr, load_thread_instr, nullptr,
722 FlowGraph::kValue);
723 auto load_thread_value = Value(load_thread_instr);
724
725 auto* const convert_instr = new (zone) IntConverterInstr(
726 kUntagged, kUnboxedAddress, &load_thread_value, DeoptId::kNone);
727 flow_graph->InsertBefore(return_instr, convert_instr, nullptr,
728 FlowGraph::kValue);
729 auto convert_value = Value(convert_instr);
730
731 auto* const box_instr = BoxInstr::Create(kUnboxedAddress, &convert_value);
732 flow_graph->InsertBefore(return_instr, box_instr, nullptr, FlowGraph::kValue);
733
734 return_instr->InputAt(0)->definition()->ReplaceUsesWith(box_instr);
735
736 {
737 // Check we constructed the right graph.
738 ILMatcher cursor(flow_graph, flow_graph->graph_entry()->normal_entry());
739 EXPECT(cursor.TryMatch({
740 kMoveGlob,
741 kMatchAndMoveLoadThread,
742 kMatchAndMoveIntConverter,
743 kMatchAndMoveBox,
744 kMatchDartReturn,
745 }));
746 }
747
748 pipeline.RunForcedOptimizedAfterSSAPasses();
749
750 {
751#if !defined(PRODUCT) && !defined(USING_THREAD_SANITIZER)
752 SetFlagScope<bool> sfs(&FLAG_disassemble_optimized, true);
753#endif
754 pipeline.CompileGraphAndAttachFunction();
755 }
756
757 // Ensure we can successfully invoke the function.
758 invoke_result ^= Invoke(root_library, "myFunction");
759 intptr_t result_int = Integer::Cast(invoke_result).AsInt64Value();
760 EXPECT_EQ(reinterpret_cast<intptr_t>(thread), result_int);
761}

◆ ISOLATE_UNIT_TEST_CASE() [177/463]

dart::ISOLATE_UNIT_TEST_CASE ( IRTest_WriteBarrierElimination_Arrays  )

Definition at line 202 of file write_barrier_elimination_test.cc.

206 {kMatchAndMoveStoreField, &store_into_c},

◆ ISOLATE_UNIT_TEST_CASE() [178/463]

dart::ISOLATE_UNIT_TEST_CASE ( IRTest_WriteBarrierElimination_AtLeastOnce  )

Definition at line 85 of file write_barrier_elimination_test.cc.

85 {
87 SetFlagScope<bool> sfs(&FLAG_trace_write_barrier_elimination, true));
88 // Ensure that we process every block at least once during the analysis
89 // phase so that the out-sets will be initialized. If we don't process
90 // each block at least once, the store "c.next = n" will be marked
91 // NoWriteBarrier.
92 // clang-format off
93 auto kScript = Utils::CStringUniquePtr(OS::SCreate(nullptr,
94 R"(
95 class C {
96 %s C next;
97 }
98
99 @pragma("vm:never-inline")
100 fn() {}
101
102 foo(int x) {
103 C c = C();
104 C n = C();
105 if (x > 5) {
106 fn();
107 }
108 c.next = n;
109 return c;
110 }
111
112 main() { foo(0); foo(10); }
113 )", TestCase::LateTag()), std::free);
114 // clang-format on
115 const auto& root_library = Library::Handle(LoadTestScript(kScript.get()));
116
117 Invoke(root_library, "main");
118
119 const auto& function = Function::Handle(GetFunction(root_library, "foo"));
120 TestPipeline pipeline(function, CompilerPass::kJIT);

◆ ISOLATE_UNIT_TEST_CASE() [179/463]

dart::ISOLATE_UNIT_TEST_CASE ( IRTest_WriteBarrierElimination_JoinSuccessors  )

Definition at line 14 of file write_barrier_elimination_test.cc.

14 {
16 SetFlagScope<bool> sfs(&FLAG_trace_write_barrier_elimination, true));
17 const char* nullable_tag = TestCase::NullableTag();
18 const char* null_assert_tag = TestCase::NullAssertTag();
19
20 // This is a regression test for a bug where we were using
21 // JoinEntry::SuccessorCount() to determine the number of outgoing blocks
22 // from the join block. JoinEntry::SuccessorCount() is in fact always 0;
23 // JoinEntry::last_instruction()->SuccessorCount() should be used instead.
24 // clang-format off
25 auto kScript = Utils::CStringUniquePtr(
26 OS::SCreate(nullptr, R"(
27 class C {
28 int%s value;
29 C%s next;
30 C%s prev;
31 }
32
33 @pragma("vm:never-inline")
34 fn() {}
35
36 foo(int x) {
37 C%s prev = C();
38 C%s next;
39 while (x --> 0) {
40 next = C();
41 next%s.prev = prev;
42 prev?.next = next;
43 prev = next;
44 fn();
45 }
46 return next;
47 }
48
49 main() { foo(10); }
50 )",
51 nullable_tag, nullable_tag, nullable_tag, nullable_tag,
52 nullable_tag, null_assert_tag), std::free);
53 // clang-format on
54
55 const auto& root_library = Library::Handle(LoadTestScript(kScript.get()));
56
57 Invoke(root_library, "main");
58
59 const auto& function = Function::Handle(GetFunction(root_library, "foo"));
60 TestPipeline pipeline(function, CompilerPass::kJIT);
61 FlowGraph* flow_graph = pipeline.RunPasses({});
62
63 auto entry = flow_graph->graph_entry()->normal_entry();
64 EXPECT(entry != nullptr);
65
66 StoreFieldInstr* store1 = nullptr;
67 StoreFieldInstr* store2 = nullptr;
68
69 ILMatcher cursor(flow_graph, entry);
70 RELEASE_ASSERT(cursor.TryMatch({
71 kMoveGlob,
72 kMatchAndMoveGoto,
73 kMoveGlob,
74 kMatchAndMoveBranchTrue,
75 kMoveGlob,
76 {kMatchAndMoveStoreField, &store1},
77 kMoveGlob,
78 {kMatchAndMoveStoreField, &store2},
79 }));
80
81 EXPECT(store1->ShouldEmitStoreBarrier() == false);
82 EXPECT(store2->ShouldEmitStoreBarrier() == true);
83}

◆ ISOLATE_UNIT_TEST_CASE() [180/463]

dart::ISOLATE_UNIT_TEST_CASE ( IRTest_WriteBarrierElimination_LoadLateField  )

Definition at line 253 of file write_barrier_elimination_test.cc.

259 {
260 kMatchAndMoveCreateArray,
261 kMatchAndMoveGoto,
263 kMatchAndMoveCreateArray,
264 {kMatchAndMoveStoreIndexed, &store_into_phi},
265 },
266 kMoveGlob));
267
268 EXPECT(store_into_phi->array()->definition()->IsPhi());
269 EXPECT(store_into_phi->ShouldEmitStoreBarrier());
270}
271
272ISOLATE_UNIT_TEST_CASE(IRTest_WriteBarrierElimination_LoadLateField) {
274 SetFlagScope<bool> sfs(&FLAG_trace_write_barrier_elimination, true));
275 const char* kScript = R"(
276 class A {
277 late var x = new B();
278 }
279
280 class B {
281 }
282
283 class C {
284 C(this.a, this.b);
285 A a;
286 B b;
287 }
288
289 foo(A a) => C(a, a.x);
290
291 main() { foo(A()); }
292 )";
293
294 const auto& root_library = Library::Handle(LoadTestScript(kScript));
295
296 Invoke(root_library, "main");
297
298 const auto& function = Function::Handle(GetFunction(root_library, "foo"));
299 TestPipeline pipeline(function, CompilerPass::kJIT);
300 FlowGraph* flow_graph = pipeline.RunPasses({});
301

◆ ISOLATE_UNIT_TEST_CASE() [181/463]

dart::ISOLATE_UNIT_TEST_CASE ( IRTest_WriteBarrierElimination_LoadLateStaticField  )

Definition at line 303 of file write_barrier_elimination_test.cc.

310 {
311 kMatchAndMoveAllocateObject,
312 kMatchAndMoveLoadField,
313 {kMatchAndMoveStoreField, &store1},
314 {kMatchAndMoveStoreField, &store2},
315 },
316 kMoveGlob));
317
318 EXPECT(!store1->ShouldEmitStoreBarrier());
319 EXPECT(!store2->ShouldEmitStoreBarrier());
320}
321
322ISOLATE_UNIT_TEST_CASE(IRTest_WriteBarrierElimination_LoadLateStaticField) {
324 SetFlagScope<bool> sfs(&FLAG_trace_write_barrier_elimination, true));
325 const char* kScript = R"(
326 class A {
327 }
328
329 class B {
330 }
331
332 class C {
333 C(this.a, this.b);
334 A a;
335 B b;
336 }
337
338 late var x = new B();
339
340 foo(A a) => C(a, x);
341
342 main() { foo(A()); }
343 )";
344
345 const auto& root_library = Library::Handle(LoadTestScript(kScript));
346
347 Invoke(root_library, "main");
348
349 const auto& function = Function::Handle(GetFunction(root_library, "foo"));
350 TestPipeline pipeline(function, CompilerPass::kJIT);
351 FlowGraph* flow_graph = pipeline.RunPasses({});
352

◆ ISOLATE_UNIT_TEST_CASE() [182/463]

dart::ISOLATE_UNIT_TEST_CASE ( IRTest_WriteBarrierElimination_Regress43786  )

Definition at line 208 of file write_barrier_elimination_test.cc.

212 {kMatchAndMoveStoreIndexed, &store_into_array_after_loop},
213 }));
214
215 EXPECT(store_into_c->ShouldEmitStoreBarrier() == false);
216 EXPECT(store_into_array_before_loop->ShouldEmitStoreBarrier() == false);
217 EXPECT(store_into_array_after_loop->ShouldEmitStoreBarrier() ==
218 (length > Array::kMaxLengthForWriteBarrierElimination));
219}
220
221ISOLATE_UNIT_TEST_CASE(IRTest_WriteBarrierElimination_Arrays) {
223 TestWBEForArrays(Array::kMaxLengthForWriteBarrierElimination);
224 TestWBEForArrays(Array::kMaxLengthForWriteBarrierElimination + 1);
225}
226
227ISOLATE_UNIT_TEST_CASE(IRTest_WriteBarrierElimination_Regress43786) {
229 SetFlagScope<bool> sfs(&FLAG_trace_write_barrier_elimination, true));
230 const char* kScript = R"(
231 foo() {
232 final root = List<dynamic>.filled(128, null);
233 List<dynamic> last = root;
234 for (int i = 0; i < 10 * 1024; ++i) {
235 final nc = List<dynamic>.filled(128, null);
236 last[0] = nc;
237 last = nc;
238 }
239 }
240
241 main() { foo(); }
242 )";
243
244 const auto& root_library = Library::Handle(LoadTestScript(kScript));
245
246 Invoke(root_library, "main");
247
248 const auto& function = Function::Handle(GetFunction(root_library, "foo"));
249 TestPipeline pipeline(function, CompilerPass::kJIT);
250 FlowGraph* flow_graph = pipeline.RunPasses({});
251
static void TestWBEForArrays(int length)

◆ ISOLATE_UNIT_TEST_CASE() [183/463]

dart::ISOLATE_UNIT_TEST_CASE ( IRTest_YieldIndexAvailableAOT  )

Definition at line 93 of file yield_position_test.cc.

◆ ISOLATE_UNIT_TEST_CASE() [184/463]

dart::ISOLATE_UNIT_TEST_CASE ( IRTest_YieldIndexAvailableJIT  )

Definition at line 89 of file yield_position_test.cc.

◆ ISOLATE_UNIT_TEST_CASE() [185/463]

dart::ISOLATE_UNIT_TEST_CASE ( Isolate_MayExit_False  )

Definition at line 264 of file isolate_test.cc.

264 {
265 TransitionVMToNative transition(thread);
266
267 EXPECT_EQ(false, thread->is_unwind_in_progress());
268
270
271 Dart_Handle lib =
273 EXPECT(!Dart_IsError(lib));
274
276 lib, Dart_NewStringFromCString("Isolate"), 0, nullptr);
277 EXPECT(!Dart_IsError(isolate_type));
278
279 Dart_Handle setter_result = Dart_SetField(
280 isolate_type, Dart_NewStringFromCString("_mayExit"), Dart_False());
281 EXPECT(!Dart_IsError(setter_result));
282
284 Dart_Invoke(isolate_type, Dart_NewStringFromCString("exit"), 0, nullptr);
286
288
289 EXPECT_EQ(false, thread->is_unwind_in_progress());
290}
DART_EXPORT Dart_Handle Dart_GetNonNullableType(Dart_Handle library, Dart_Handle class_name, intptr_t number_of_type_arguments, Dart_Handle *type_arguments)
DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_SetField(Dart_Handle container, Dart_Handle name, Dart_Handle value)
DART_EXPORT Dart_Handle Dart_False(void)

◆ ISOLATE_UNIT_TEST_CASE() [186/463]

dart::ISOLATE_UNIT_TEST_CASE ( Isolate_MayExit_True  )

Definition at line 240 of file isolate_test.cc.

240 {
241 TransitionVMToNative transition(thread);
242
243 EXPECT_EQ(false, thread->is_unwind_in_progress());
244
246
247 Dart_Handle lib =
249 EXPECT(!Dart_IsError(lib));
250
252 lib, Dart_NewStringFromCString("Isolate"), 0, nullptr);
253 EXPECT(!Dart_IsError(isolate_type));
254
256 Dart_Invoke(isolate_type, Dart_NewStringFromCString("exit"), 0, nullptr);
258
260
261 EXPECT_EQ(true, thread->is_unwind_in_progress());
262}
DART_EXPORT bool Dart_IsFatalError(Dart_Handle handle)

◆ ISOLATE_UNIT_TEST_CASE() [187/463]

dart::ISOLATE_UNIT_TEST_CASE ( Isolate_Ports  )

Definition at line 177 of file isolate_test.cc.

177 {
178 auto isolate = thread->isolate();
179 auto& port = ReceivePort::Handle();
180
181 EXPECT(!isolate->HasLivePorts());
182
183 {
184 // Make port.
185 port = isolate->CreateReceivePort(String::null_string());
186 EXPECT(port.is_open());
187 EXPECT(port.keep_isolate_alive());
188 EXPECT(port.Id() != ILLEGAL_PORT);
189 EXPECT(PortMap::PortExists(port.Id()));
190 EXPECT(isolate->HasLivePorts());
191
192 // Make port not keep isolate alive.
193 isolate->SetReceivePortKeepAliveState(port, false);
194 EXPECT(port.is_open());
195 EXPECT(!port.keep_isolate_alive());
196 EXPECT(!isolate->HasLivePorts());
197
198 // Mark it alive again.
199 isolate->SetReceivePortKeepAliveState(port, true);
200 EXPECT(port.is_open());
201 EXPECT(port.keep_isolate_alive());
202 EXPECT(isolate->HasLivePorts());
203
204 // Close the port.
205 isolate->CloseReceivePort(port);
206 EXPECT(!port.is_open());
207 EXPECT(!port.keep_isolate_alive());
208 EXPECT(!isolate->HasLivePorts());
209
210 // Closing again should be a NOP.
211 isolate->CloseReceivePort(port);
212 EXPECT(!port.is_open());
213 EXPECT(!port.keep_isolate_alive());
214 EXPECT(!isolate->HasLivePorts());
215 }
216
217 {
218 // Make port.
219 port = isolate->CreateReceivePort(String::null_string());
220 EXPECT_NE(0, port.Id());
221 EXPECT(PortMap::PortExists(port.Id()));
222 EXPECT(isolate->HasLivePorts());
223
224 // Make port not keep isolate alive.
225 isolate->SetReceivePortKeepAliveState(port, false);
226 EXPECT(port.is_open());
227 EXPECT(!port.keep_isolate_alive());
228 EXPECT(!isolate->HasLivePorts());
229
230 // Close the port while it's not keep alive port.
231 isolate->CloseReceivePort(port);
232 EXPECT(!port.is_open());
233 EXPECT(!port.keep_isolate_alive());
234 EXPECT(!isolate->HasLivePorts());
235 }
236
237 EXPECT(!isolate->HasLivePorts());
238}

◆ ISOLATE_UNIT_TEST_CASE() [188/463]

dart::ISOLATE_UNIT_TEST_CASE ( IsolateReload_DirectSubclasses_Failure  )

Definition at line 3552 of file isolate_reload_test.cc.

3552 {
3553 Object& new_subclass = Object::Handle();
3554 String& name = String::Handle();
3555
3556 // Lookup the Stopwatch class by name from the dart core library.
3557 ObjectStore* object_store = IsolateGroup::Current()->object_store();
3558 const Library& core_lib = Library::Handle(object_store->core_library());
3559 name = String::New("Stopwatch");
3560 const Class& stopwatch_cls = Class::Handle(core_lib.LookupClass(name));
3561
3562 // Keep track of how many subclasses an Stopwatch has.
3563 auto& subclasses =
3564 GrowableObjectArray::Handle(stopwatch_cls.direct_subclasses_unsafe());
3565 intptr_t saved_subclass_count = subclasses.IsNull() ? 0 : subclasses.Length();
3566
3567 const char* kScript =
3568 "class AStopwatch extends Stopwatch {\n"
3569 "}\n"
3570 "class Foo {\n"
3571 " final a;\n"
3572 " Foo(this.a);\n"
3573 "}\n"
3574 "main() {\n"
3575 " new AStopwatch();\n" // Force finalization.
3576 " new Foo(5);\n" // Force finalization.
3577 " return 1;\n"
3578 "}\n";
3579
3580 {
3581 TransitionVMToNative transition(thread);
3582 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
3583 EXPECT_VALID(lib);
3584 EXPECT_EQ(1, SimpleInvoke(lib, "main"));
3585 }
3586
3587 // Stopwatch has one non-core subclass...
3588 subclasses = stopwatch_cls.direct_subclasses_unsafe();
3589 EXPECT_EQ(saved_subclass_count + 1, subclasses.Length());
3590
3591 // ... and the non-core subclass is named AStopwatch.
3592 subclasses = stopwatch_cls.direct_subclasses_unsafe();
3593 new_subclass = subclasses.At(subclasses.Length() - 1);
3594 name = Class::Cast(new_subclass).Name();
3595 EXPECT_STREQ("AStopwatch", name.ToCString());
3596
3597 // Attempt to reload with a bogus script.
3598 const char* kReloadScript =
3599 "class BStopwatch extends Stopwatch {\n"
3600 "}\n"
3601 "class Foo {\n"
3602 " final a kjsdf ksjdf ;\n" // When we refinalize, we get an error.
3603 " Foo(this.a);\n"
3604 "}\n"
3605 "main() {\n"
3606 " new BStopwatch();\n" // Force finalization.
3607 " new Foo(5);\n" // Force finalization.
3608 " return 2;\n"
3609 "}\n";
3610
3611 {
3612 TransitionVMToNative transition(thread);
3613 Dart_Handle lib = TestCase::ReloadTestScript(kReloadScript);
3614 EXPECT_ERROR(lib, "Expected ';' after this");
3615 }
3616
3617 // If we don't clean up the subclasses, we would find BStopwatch in
3618 // the list of subclasses, which would be bad. Make sure that
3619 // Stopwatch still has only one non-core subclass...
3620 subclasses = stopwatch_cls.direct_subclasses_unsafe();
3621 EXPECT_EQ(saved_subclass_count + 1, subclasses.Length());
3622
3623 // ...and the non-core subclass is still named AStopwatch.
3624 new_subclass = subclasses.At(subclasses.Length() - 1);
3625 name = Class::Cast(new_subclass).Name();
3626 EXPECT_STREQ("AStopwatch", name.ToCString());
3627}
GrowableObjectArrayPtr direct_subclasses_unsafe() const
Definition object.h:1544
int64_t SimpleInvoke(Dart_Handle lib, const char *method)
#define EXPECT_ERROR(handle, substring)
Definition unit_test.h:670

◆ ISOLATE_UNIT_TEST_CASE() [189/463]

dart::ISOLATE_UNIT_TEST_CASE ( IsolateReload_DirectSubclasses_GhostSubclass  )

Definition at line 3483 of file isolate_reload_test.cc.

3483 {
3484 Object& new_subclass = Object::Handle();
3485 String& name = String::Handle();
3486
3487 // Lookup the Stopwatch class by name from the dart core library.
3488 ObjectStore* object_store = IsolateGroup::Current()->object_store();
3489 const Library& core_lib = Library::Handle(object_store->core_library());
3490 name = String::New("Stopwatch");
3491 const Class& stopwatch_cls = Class::Handle(core_lib.LookupClass(name));
3492
3493 // Keep track of how many subclasses an Stopwatch has.
3494 auto& subclasses =
3495 GrowableObjectArray::Handle(stopwatch_cls.direct_subclasses_unsafe());
3496 intptr_t saved_subclass_count = subclasses.IsNull() ? 0 : subclasses.Length();
3497
3498 const char* kScript =
3499 "class AStopwatch extends Stopwatch {\n"
3500 "}\n"
3501 "main() {\n"
3502 " new AStopwatch();\n" // Force finalization.
3503 " return 1;\n"
3504 "}\n";
3505
3506 {
3507 TransitionVMToNative transition(thread);
3508 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
3509 EXPECT_VALID(lib);
3510 EXPECT_EQ(1, SimpleInvoke(lib, "main"));
3511 }
3512
3513 // Stopwatch has one new subclass.
3514 subclasses = stopwatch_cls.direct_subclasses_unsafe();
3515 EXPECT_EQ(saved_subclass_count + 1, subclasses.Length());
3516
3517 // The new subclass is named AStopwatch.
3518 new_subclass = subclasses.At(subclasses.Length() - 1);
3519 name = Class::Cast(new_subclass).Name();
3520 EXPECT_STREQ("AStopwatch", name.ToCString());
3521
3522 const char* kReloadScript =
3523 "class BStopwatch extends Stopwatch {\n"
3524 "}\n"
3525 "main() {\n"
3526 " new BStopwatch();\n" // Force finalization.
3527 " return 2;\n"
3528 "}\n";
3529
3530 {
3531 TransitionVMToNative transition(thread);
3532 Dart_Handle lib = TestCase::ReloadTestScript(kReloadScript);
3533 EXPECT_VALID(lib);
3534 EXPECT_EQ(2, SimpleInvoke(lib, "main"));
3535 }
3536
3537 // Stopwatch has two non-core subclasses.
3538 subclasses = stopwatch_cls.direct_subclasses_unsafe();
3539 EXPECT_EQ(saved_subclass_count + 2, subclasses.Length());
3540
3541 // The non-core subclasses are AStopwatch and BStopwatch.
3542 new_subclass = subclasses.At(subclasses.Length() - 2);
3543 name = Class::Cast(new_subclass).Name();
3544 EXPECT_STREQ("AStopwatch", name.ToCString());
3545
3546 new_subclass = subclasses.At(subclasses.Length() - 1);
3547 name = Class::Cast(new_subclass).Name();
3548 EXPECT_STREQ("BStopwatch", name.ToCString());
3549}

◆ ISOLATE_UNIT_TEST_CASE() [190/463]

dart::ISOLATE_UNIT_TEST_CASE ( IsolateReload_DirectSubclasses_Success  )

Definition at line 3416 of file isolate_reload_test.cc.

3416 {
3417 Object& new_subclass = Object::Handle();
3418 String& name = String::Handle();
3419
3420 // Lookup the Stopwatch class by name from the dart core library.
3421 ObjectStore* object_store = IsolateGroup::Current()->object_store();
3422 const Library& core_lib = Library::Handle(object_store->core_library());
3423 name = String::New("Stopwatch");
3424 const Class& stopwatch_cls = Class::Handle(core_lib.LookupClass(name));
3425
3426 // Keep track of how many subclasses an Stopwatch has.
3427 auto& subclasses =
3428 GrowableObjectArray::Handle(stopwatch_cls.direct_subclasses_unsafe());
3429 intptr_t saved_subclass_count = subclasses.IsNull() ? 0 : subclasses.Length();
3430
3431 const char* kScript =
3432 "class AStopwatch extends Stopwatch {\n"
3433 "}\n"
3434 "main() {\n"
3435 " new AStopwatch();\n" // Force finalization.
3436 " return 1;\n"
3437 "}\n";
3438
3439 {
3440 TransitionVMToNative transition(thread);
3441 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
3442 EXPECT_VALID(lib);
3443 EXPECT_EQ(1, SimpleInvoke(lib, "main"));
3444 }
3445
3446 // Stopwatch has one non-core subclass.
3447 subclasses = stopwatch_cls.direct_subclasses_unsafe();
3448 EXPECT_EQ(saved_subclass_count + 1, subclasses.Length());
3449
3450 // The new subclass is named AStopwatch.
3451 new_subclass = subclasses.At(subclasses.Length() - 1);
3452 name = Class::Cast(new_subclass).Name();
3453 EXPECT_STREQ("AStopwatch", name.ToCString());
3454
3455 const char* kReloadScript =
3456 "class AStopwatch {\n"
3457 "}\n"
3458 "class BStopwatch extends Stopwatch {\n"
3459 "}\n"
3460 "main() {\n"
3461 " new AStopwatch();\n" // Force finalization.
3462 " new BStopwatch();\n" // Force finalization.
3463 " return 2;\n"
3464 "}\n";
3465
3466 {
3467 TransitionVMToNative transition(thread);
3468 Dart_Handle lib = TestCase::ReloadTestScript(kReloadScript);
3469 EXPECT_VALID(lib);
3470 EXPECT_EQ(2, SimpleInvoke(lib, "main"));
3471 }
3472
3473 // Stopwatch still has only one non-core subclass (AStopwatch is gone).
3474 subclasses = stopwatch_cls.direct_subclasses_unsafe();
3475 EXPECT_EQ(saved_subclass_count + 1, subclasses.Length());
3476
3477 // The new subclass is named BStopwatch.
3478 new_subclass = subclasses.At(subclasses.Length() - 1);
3479 name = Class::Cast(new_subclass).Name();
3480 EXPECT_STREQ("BStopwatch", name.ToCString());
3481}

◆ ISOLATE_UNIT_TEST_CASE() [191/463]

dart::ISOLATE_UNIT_TEST_CASE ( IterateReadOnly  )

Definition at line 217 of file heap_test.cc.

217 {
218 const String& obj = String::Handle(String::New("x", Heap::kOld));
219
220 // It is not safe to make the heap read-only if marking or sweeping is in
221 // progress.
222 GCTestHelper::WaitForGCTasks();
223
224 Heap* heap = IsolateGroup::Current()->heap();
225 EXPECT(heap->Contains(UntaggedObject::ToAddr(obj.ptr())));
226 heap->WriteProtect(true);
227 EXPECT(heap->Contains(UntaggedObject::ToAddr(obj.ptr())));
228 heap->WriteProtect(false);
229 EXPECT(heap->Contains(UntaggedObject::ToAddr(obj.ptr())));
230}
void WriteProtect(bool read_only)
Definition heap.cc:687
bool Contains(uword addr) const
Definition heap.cc:238

◆ ISOLATE_UNIT_TEST_CASE() [192/463]

dart::ISOLATE_UNIT_TEST_CASE ( JSON_JSONStream_DartObject  )

Definition at line 175 of file json_test.cc.

175 {
176 JSONStream js;
177 {
178 JSONArray jsarr(&js);
179 jsarr.AddValue(Object::Handle(Object::null()));
180 JSONObject jsobj(&jsarr);
181 jsobj.AddProperty("object_key", Object::Handle(Object::null()));
182 }
183 // WARNING: This MUST be big enough for the serialized JSON string.
184 const int kBufferSize = 2048;
185 char buffer[kBufferSize];
186 const char* json_str = js.ToCString();
187 ASSERT(strlen(json_str) < kBufferSize);
188 ElideJSONSubstring("classes", json_str, buffer);
189 ElideJSONSubstring("libraries", buffer, buffer);
190 ElideJSONSubstring("objects", buffer, buffer);
191 ElideJSONSubstring("line", buffer, buffer);
192 ElideJSONSubstring("column", buffer, buffer);
193 StripTokenPositions(buffer);
194
195 EXPECT_STREQ(
196 "[{\"type\":\"@Instance\",\"_vmType\":\"null\",\"class\":{\"type\":\"@"
197 "Class\",\"fixedId\":true,\"id\":\"\",\"name\":\"Null\",\"location\":{"
198 "\"type\":\"SourceLocation\",\"script\":{\"type\":\"@Script\","
199 "\"fixedId\":true,\"id\":\"\",\"uri\":\"dart:core\\/null.dart\","
200 "\"_kind\":\"kernel\"}},\"library\":{"
201 "\"type\":\"@Library\",\"fixedId\":true,\"id\":\"\",\"name\":\"dart."
202 "core\",\"uri\":\"dart:core\"}},\"kind\":\"Null\",\"fixedId\":true,"
203 "\"id\":\"\",\"valueAsString\":\"null\"},{\"object_key\":{\"type\":\"@"
204 "Instance\",\"_vmType\":\"null\",\"class\":{\"type\":\"@Class\","
205 "\"fixedId\":true,\"id\":\"\",\"name\":\"Null\",\"location\":{\"type\":"
206 "\"SourceLocation\",\"script\":{\"type\":\"@Script\",\"fixedId\":true,"
207 "\"id\":\"\",\"uri\":\"dart:core\\/null.dart\",\"_kind\":\"kernel\"}},"
208 "\"library\":{\"type\":\"@"
209 "Library\",\"fixedId\":true,\"id\":\"\",\"name\":\"dart.core\",\"uri\":"
210 "\"dart:core\"}},\"kind\":\"Null\",\"fixedId\":true,\"id\":\"\","
211 "\"valueAsString\":\"null\"}}]",
212 buffer);
213}

◆ ISOLATE_UNIT_TEST_CASE() [193/463]

dart::ISOLATE_UNIT_TEST_CASE ( KernelLineStartsReader_LocationForPosition  )

Definition at line 46 of file kernel_test.cc.

46 {
47 kernel::KernelLineStartsReader reader(CreateLineStartsData(), thread->zone());
48 ExpectLocationForPosition(reader, 0, 1, 1);
49 ExpectLocationForPosition(reader, 4, 1, 5);
50 ExpectLocationForPosition(reader, 8, 2, 1);
51 ExpectLocationForPosition(reader, 14, 3, 3);
52 ExpectLocationForPosition(reader, 17, 4, 1);
53 ExpectLocationForPosition(reader, 19, 5, 2);
54 ExpectLocationForPosition(reader, 22, 6, 3);
55 ExpectLocationForPosition(reader, 29, 7, 7);
56 ExpectLocationForPosition(reader, 30, 8, 1);
57 ExpectLocationForPosition(reader, 32, 9, 2);
58 ExpectLocationForPosition(reader, 33, 10, 1);
59
60 intptr_t line;
61 intptr_t col;
62 EXPECT_EQ(false, reader.LocationForPosition(-1, &line, &col));
63 EXPECT_EQ(false, reader.LocationForPosition(34, &line, &col));
64}
const dart::TypedData & CreateLineStartsData()
void ExpectLocationForPosition(const kernel::KernelLineStartsReader &reader, intptr_t position, intptr_t expected_line, intptr_t expected_col)

◆ ISOLATE_UNIT_TEST_CASE() [194/463]

dart::ISOLATE_UNIT_TEST_CASE ( KernelLineStartsReader_MaxPosition  )

Definition at line 30 of file kernel_test.cc.

30 {
31 kernel::KernelLineStartsReader reader(CreateLineStartsData(), thread->zone());
32 EXPECT_EQ(33u, reader.MaxPosition());
33}

◆ ISOLATE_UNIT_TEST_CASE() [195/463]

dart::ISOLATE_UNIT_TEST_CASE ( KernelLineStartsReader_TokenRangeAtLine  )

Definition at line 77 of file kernel_test.cc.

77 {
78 kernel::KernelLineStartsReader reader(CreateLineStartsData(), thread->zone());
79 ExpectTokenRangeAtLine(reader, 1, 0, 7);
80 ExpectTokenRangeAtLine(reader, 2, 8, 11);
81 ExpectTokenRangeAtLine(reader, 3, 12, 16);
82 ExpectTokenRangeAtLine(reader, 4, 17, 17);
83 ExpectTokenRangeAtLine(reader, 5, 18, 19);
84 ExpectTokenRangeAtLine(reader, 6, 20, 22);
85 ExpectTokenRangeAtLine(reader, 7, 23, 29);
86 ExpectTokenRangeAtLine(reader, 8, 30, 30);
87 ExpectTokenRangeAtLine(reader, 9, 31, 32);
88 ExpectTokenRangeAtLine(reader, 10, 33, 33);
89
90 TokenPosition first_token = TokenPosition::Synthetic(0);
91 TokenPosition last_token = TokenPosition::Synthetic(0);
92 EXPECT_EQ(false, reader.TokenRangeAtLine(0, &first_token, &last_token));
93 EXPECT_EQ(false, reader.TokenRangeAtLine(11, &first_token, &last_token));
94}
void ExpectTokenRangeAtLine(const kernel::KernelLineStartsReader &reader, intptr_t line, intptr_t expected_first_token, intptr_t expected_last_token)

◆ ISOLATE_UNIT_TEST_CASE() [196/463]

dart::ISOLATE_UNIT_TEST_CASE ( LICM_Deopt_Regress50245  )

Definition at line 2011 of file redundancy_elimination_test.cc.

2022 {
2023 const char* kScript = R"(
2024 class A {
2025 List<int> foo;
2026 A(this.foo);
2027 }
2028
2029 A obj = A([1, 2, 3]);
2030 int n = int.parse('3');
2031
2032 main() {
2033 // Make sure A.foo= is compiled.
2034 obj.foo = [];
2035 int sum = 0;
2036 for (int i = 0; i < n; ++i) {
2037 if (int.parse('1') != 1) {
2038 // Field guard from this unreachable code is moved up
2039 // and causes repeated deoptimization.
2040 obj.foo = const [];
2041 }
2042 sum += i;
2043 }
2044 return sum;
2045 }
2046 )";
2047
2048 const auto& root_library = Library::Handle(LoadTestScript(kScript));
2049 const auto& function = Function::Handle(GetFunction(root_library, "main"));
2050
2051 // Run unoptimized code.
2052 Invoke(root_library, "main");
2053 EXPECT(!function.HasOptimizedCode());
2054
2055 Compiler::CompileOptimizedFunction(thread, function);
2056 EXPECT(function.HasOptimizedCode());
2057
2058 // LICM should be disabled after the first round of deoptimization.

◆ ISOLATE_UNIT_TEST_CASE() [197/463]

dart::ISOLATE_UNIT_TEST_CASE ( LICM_Deopt_Regress51220  )

Definition at line 1969 of file redundancy_elimination_test.cc.

1969 {
1970 auto kScript =
1971 Utils::CStringUniquePtr(OS::SCreate(nullptr,
1972 R"(
1973 int n = int.parse('3');
1974 main() {
1975 int x = 0;
1976 for (int i = 0; i < n; ++i) {
1977 if (i > ((1 << %d)*1024)) {
1978 ++x;
1979 }
1980 }
1981 return x;
1982 }
1983 )",
1984 static_cast<int>(kSmiBits + 1 - 10)),
1985 std::free);
1986
1987 const auto& root_library = Library::Handle(LoadTestScript(kScript.get()));
1988 const auto& function = Function::Handle(GetFunction(root_library, "main"));
1989
1990 // Run unoptimized code.
1991 Invoke(root_library, "main");
1992 EXPECT(!function.HasOptimizedCode());
1993
1994 Compiler::CompileOptimizedFunction(thread, function);
1995 EXPECT(function.HasOptimizedCode());
1996
1997 // Only 2 rounds of deoptimization are allowed:
1998 // * the first round should disable LICM;
1999 // * the second round should disable BinarySmiOp.
2000 Invoke(root_library, "main");
2001 EXPECT(!function.HasOptimizedCode());
2002 // EXPECT(function.ProhibitsInstructionHoisting());
2003
2004 Compiler::CompileOptimizedFunction(thread, function);
2005 EXPECT(function.HasOptimizedCode());
2006

◆ ISOLATE_UNIT_TEST_CASE() [198/463]

dart::ISOLATE_UNIT_TEST_CASE ( LoadOptimizer_AliasingViaStore_AssertAssignable_Escape  )

Definition at line 556 of file redundancy_elimination_test.cc.

556 {
557 TestAliasingViaStore(thread, /*make_it_escape=*/true,
558 /* make_host_escape= */ false, MakeAssertAssignable);
559}
static void TestAliasingViaStore(Thread *thread, bool make_it_escape, bool make_host_escape, std::function< Definition *(CompilerState *S, FlowGraph *, Definition *)> make_redefinition)

◆ ISOLATE_UNIT_TEST_CASE() [199/463]

dart::ISOLATE_UNIT_TEST_CASE ( LoadOptimizer_AliasingViaStore_AssertAssignable_EscapeViaHost  )

Definition at line 561 of file redundancy_elimination_test.cc.

562 {
563 TestAliasingViaStore(thread, /*make_it_escape=*/false,
564 /* make_host_escape= */ true, MakeAssertAssignable);
565}

◆ ISOLATE_UNIT_TEST_CASE() [200/463]

dart::ISOLATE_UNIT_TEST_CASE ( LoadOptimizer_AliasingViaStore_AssertAssignable_NoEscape  )

Definition at line 550 of file redundancy_elimination_test.cc.

551 {
552 TestAliasingViaStore(thread, /*make_it_escape=*/false,
553 /* make_host_escape= */ false, MakeAssertAssignable);
554}

◆ ISOLATE_UNIT_TEST_CASE() [201/463]

dart::ISOLATE_UNIT_TEST_CASE ( LoadOptimizer_AliasingViaStore_CheckNull_Escape  )

Definition at line 524 of file redundancy_elimination_test.cc.

524 {
525 TestAliasingViaStore(thread, /*make_it_escape=*/true,
526 /* make_host_escape= */ false, MakeCheckNull);
527}

◆ ISOLATE_UNIT_TEST_CASE() [202/463]

dart::ISOLATE_UNIT_TEST_CASE ( LoadOptimizer_AliasingViaStore_CheckNull_EscapeViaHost  )

Definition at line 529 of file redundancy_elimination_test.cc.

529 {
530 TestAliasingViaStore(thread, /*make_it_escape=*/false,
531 /* make_host_escape= */ true, MakeCheckNull);
532}

◆ ISOLATE_UNIT_TEST_CASE() [203/463]

dart::ISOLATE_UNIT_TEST_CASE ( LoadOptimizer_AliasingViaStore_CheckNull_NoEscape  )

Definition at line 519 of file redundancy_elimination_test.cc.

519 {
520 TestAliasingViaStore(thread, /*make_it_escape=*/false,
521 /* make_host_escape= */ false, MakeCheckNull);
522}

◆ ISOLATE_UNIT_TEST_CASE() [204/463]

dart::ISOLATE_UNIT_TEST_CASE ( LoadOptimizer_AliasingViaStore_Redefinition_Escape  )

Definition at line 539 of file redundancy_elimination_test.cc.

539 {
540 TestAliasingViaStore(thread, /*make_it_escape=*/true,
541 /* make_host_escape= */ false, MakeRedefinition);
542}

◆ ISOLATE_UNIT_TEST_CASE() [205/463]

dart::ISOLATE_UNIT_TEST_CASE ( LoadOptimizer_AliasingViaStore_Redefinition_EscapeViaHost  )

Definition at line 544 of file redundancy_elimination_test.cc.

545 {
546 TestAliasingViaStore(thread, /*make_it_escape=*/false,
547 /* make_host_escape= */ true, MakeRedefinition);
548}

◆ ISOLATE_UNIT_TEST_CASE() [206/463]

dart::ISOLATE_UNIT_TEST_CASE ( LoadOptimizer_AliasingViaStore_Redefinition_NoEscape  )

Definition at line 534 of file redundancy_elimination_test.cc.

534 {
535 TestAliasingViaStore(thread, /*make_it_escape=*/false,
536 /* make_host_escape= */ false, MakeRedefinition);
537}

◆ ISOLATE_UNIT_TEST_CASE() [207/463]

dart::ISOLATE_UNIT_TEST_CASE ( LoadOptimizer_AliasingViaTypedDataAndUntaggedTypedData  )

Definition at line 569 of file redundancy_elimination_test.cc.

569 {
571 CompilerState S(thread, /*is_aot=*/false, /*is_optimizing=*/true);
573
574 const auto& lib = Library::Handle(Library::TypedDataLibrary());
575 const Class& cls = Class::Handle(lib.LookupClass(Symbols::Uint32List()));
576 const Error& err = Error::Handle(cls.EnsureIsFinalized(thread));
577 EXPECT(err.IsNull());
578
579 const Function& function = Function::ZoneHandle(
580 cls.LookupFactory(String::Handle(String::New("Uint32List."))));
581 EXPECT(!function.IsNull());
582
583 auto zone = H.flow_graph()->zone();
584
585 // We are going to build the following graph:
586 //
587 // B0[graph_entry] {
588 // vc0 <- Constant(0)
589 // vc42 <- Constant(42)
590 // }
591 //
592 // B1[function_entry] {
593 // }
594 // array <- StaticCall(...) {_Uint32List}
595 // v1 <- LoadIndexed(array)
596 // v2 <- LoadField(array, Slot::PointerBase_data())
597 // StoreIndexed(v2, index=vc0, value=vc42)
598 // v3 <- LoadIndexed(array)
599 // return v3
600 // }
601
602 auto vc0 = H.flow_graph()->GetConstant(Integer::Handle(Integer::New(0)));
603 auto vc42 = H.flow_graph()->GetConstant(Integer::Handle(Integer::New(42)));
604 auto b1 = H.flow_graph()->graph_entry()->normal_entry();
605
606 StaticCallInstr* array;
611 DartReturnInstr* ret;
612
613 {
614 BlockBuilder builder(H.flow_graph(), b1);
615
616 // array <- StaticCall(...) {_Uint32List}
617 array = builder.AddDefinition(new StaticCallInstr(
618 InstructionSource(), function, 0, Array::empty_array(), InputsArray(),
619 DeoptId::kNone, 0, ICData::kNoRebind));
620 array->UpdateType(CompileType::FromCid(kTypedDataUint32ArrayCid));
621 array->SetResultType(zone, CompileType::FromCid(kTypedDataUint32ArrayCid));
623
624 // v1 <- LoadIndexed(array)
625 v1 = builder.AddDefinition(new LoadIndexedInstr(
626 new Value(array), new Value(vc0), /*index_unboxed=*/false, 1,
627 kTypedDataUint32ArrayCid, kAlignedAccess, DeoptId::kNone,
629
630 // v2 <- LoadField(array, Slot::PointerBase_data())
631 // StoreIndexed(v2, index=0, value=42)
632 v2 = builder.AddDefinition(new LoadFieldInstr(
633 new Value(array), Slot::PointerBase_data(),
634 InnerPointerAccess::kMayBeInnerPointer, InstructionSource()));
635 store = builder.AddInstruction(new StoreIndexedInstr(
636 new Value(v2), new Value(vc0), new Value(vc42), kNoStoreBarrier,
637 /*index_unboxed=*/false, 1, kTypedDataUint32ArrayCid, kAlignedAccess,
638 DeoptId::kNone, InstructionSource()));
639
640 // v3 <- LoadIndexed(array)
641 v3 = builder.AddDefinition(new LoadIndexedInstr(
642 new Value(array), new Value(vc0), /*index_unboxed=*/false, 1,
643 kTypedDataUint32ArrayCid, kAlignedAccess, DeoptId::kNone,
645
646 // return v3
647 ret = builder.AddInstruction(new DartReturnInstr(
648 InstructionSource(), new Value(v3), S.GetNextDeoptId()));
649 }
650 H.FinishGraph();
651
652 DominatorBasedCSE::Optimize(H.flow_graph());
653 {
654 Instruction* sc = nullptr;
655 Instruction* li = nullptr;
656 Instruction* lf = nullptr;
657 Instruction* s = nullptr;
658 Instruction* li2 = nullptr;
659 Instruction* r = nullptr;
660 ILMatcher cursor(H.flow_graph(), b1, true);
661 RELEASE_ASSERT(cursor.TryMatch({
662 kMatchAndMoveFunctionEntry,
663 {kMatchAndMoveStaticCall, &sc},
664 {kMatchAndMoveLoadIndexed, &li},
665 {kMatchAndMoveLoadField, &lf},
666 {kMatchAndMoveStoreIndexed, &s},
667 {kMatchAndMoveLoadIndexed, &li2},
668 {kMatchDartReturn, &r},
669 }));
670 EXPECT(array == sc);
671 EXPECT(v1 == li);
672 EXPECT(v2 == lf);
673 EXPECT(store == s);
674 EXPECT(v3 == li2);
675 EXPECT(ret == r);
676 }
677}
FunctionPtr LookupFactory(const String &name) const
Definition object.cc:6212
void SetResultType(Zone *zone, CompileType new_type)
Definition il.h:5599
void set_is_known_list_constructor(bool value)
Definition il.h:5613

◆ ISOLATE_UNIT_TEST_CASE() [208/463]

dart::ISOLATE_UNIT_TEST_CASE ( LoadOptimizer_LoadDataFieldOfNewTypedData  )

Definition at line 683 of file redundancy_elimination_test.cc.

683 {
685 CompilerState S(thread, /*is_aot=*/false, /*is_optimizing=*/true);
687
688 auto zone = H.flow_graph()->zone();
689
690 // We are going to build the following graph:
691 //
692 // B0[graph_entry] {
693 // vc42 <- Constant(42)
694 // }
695 //
696 // B1[function_entry] {
697 // }
698 // array <- AllocateTypedData(kTypedDataUint8ArrayCid, vc42)
699 // view <- AllocateObject(kTypedDataUint8ArrayViewCid)
700 // v1 <- LoadNativeField(array, Slot::PointerBase_data())
701 // StoreNativeField(Slot::PointerBase_data(), view, v1, kNoStoreBarrier,
702 // kInitalizing)
703 // return view
704 // }
705
706 const auto& lib = Library::Handle(zone, Library::TypedDataLibrary());
707 EXPECT(!lib.IsNull());
708 const Class& view_cls = Class::ZoneHandle(
709 zone, lib.LookupClassAllowPrivate(Symbols::_Uint8ArrayView()));
710 EXPECT(!view_cls.IsNull());
711 const Error& err = Error::Handle(zone, view_cls.EnsureIsFinalized(thread));
712 EXPECT(err.IsNull());
713
714 auto vc42 = H.flow_graph()->GetConstant(Integer::Handle(Integer::New(42)));
715 auto b1 = H.flow_graph()->graph_entry()->normal_entry();
716
719 LoadFieldInstr* v1;
721 DartReturnInstr* ret;
722
723 {
724 BlockBuilder builder(H.flow_graph(), b1);
725
726 // array <- AllocateTypedData(kTypedDataUint8ArrayCid, vc42)
727 array = builder.AddDefinition(
728 new AllocateTypedDataInstr(InstructionSource(), kTypedDataUint8ArrayCid,
729 new (zone) Value(vc42), DeoptId::kNone));
730
731 // view <- AllocateObject(kTypedDataUint8ArrayViewCid, vta)
732 view = builder.AddDefinition(
733 new AllocateObjectInstr(InstructionSource(), view_cls, DeoptId::kNone));
734
735 // v1 <- LoadNativeField(array, Slot::PointerBase_data())
736 v1 = builder.AddDefinition(new LoadFieldInstr(
737 new (zone) Value(array), Slot::PointerBase_data(),
738 InnerPointerAccess::kMayBeInnerPointer, InstructionSource()));
739
740 // StoreNativeField(Slot::PointerBase_data(), view, v1, kNoStoreBarrier,
741 // kInitalizing)
742 store = builder.AddInstruction(new StoreFieldInstr(
743 Slot::PointerBase_data(), new (zone) Value(view), new (zone) Value(v1),
744 kNoStoreBarrier, InnerPointerAccess::kMayBeInnerPointer,
745 InstructionSource(), StoreFieldInstr::Kind::kInitializing));
746
747 // return view
748 ret = builder.AddInstruction(new DartReturnInstr(
749 InstructionSource(), new Value(view), S.GetNextDeoptId()));
750 }
751 H.FinishGraph();
752
753 DominatorBasedCSE::Optimize(H.flow_graph());
754 {
755 Instruction* alloc_array = nullptr;
756 Instruction* alloc_view = nullptr;
757 Instruction* lf = nullptr;
758 Instruction* sf = nullptr;
759 Instruction* r = nullptr;
760 ILMatcher cursor(H.flow_graph(), b1, true);
761 RELEASE_ASSERT(cursor.TryMatch({
762 kMatchAndMoveFunctionEntry,
763 {kMatchAndMoveAllocateTypedData, &alloc_array},
764 {kMatchAndMoveAllocateObject, &alloc_view},
765 {kMatchAndMoveLoadField, &lf},
766 {kMatchAndMoveStoreField, &sf},
767 {kMatchDartReturn, &r},
768 }));
769 EXPECT(array == alloc_array);
770 EXPECT(view == alloc_view);
771 EXPECT(v1 == lf);
772 EXPECT(store == sf);
773 EXPECT(ret == r);
774 }
775}

◆ ISOLATE_UNIT_TEST_CASE() [209/463]

dart::ISOLATE_UNIT_TEST_CASE ( LoadOptimizer_RedefinitionAliasing_AssertAssignable_Escape  )

Definition at line 374 of file redundancy_elimination_test.cc.

375 {
376 TestAliasingViaRedefinition(thread, /*make_it_escape=*/true,
377 MakeAssertAssignable);
378}
static void TestAliasingViaRedefinition(Thread *thread, bool make_it_escape, std::function< Definition *(CompilerState *S, FlowGraph *, Definition *)> make_redefinition)

◆ ISOLATE_UNIT_TEST_CASE() [210/463]

dart::ISOLATE_UNIT_TEST_CASE ( LoadOptimizer_RedefinitionAliasing_AssertAssignable_NoEscape  )

Definition at line 368 of file redundancy_elimination_test.cc.

369 {
370 TestAliasingViaRedefinition(thread, /*make_it_escape=*/false,
371 MakeAssertAssignable);
372}

◆ ISOLATE_UNIT_TEST_CASE() [211/463]

dart::ISOLATE_UNIT_TEST_CASE ( LoadOptimizer_RedefinitionAliasing_CheckNull_Escape  )

Definition at line 353 of file redundancy_elimination_test.cc.

353 {
354 TestAliasingViaRedefinition(thread, /*make_it_escape=*/true, MakeCheckNull);
355}

◆ ISOLATE_UNIT_TEST_CASE() [212/463]

dart::ISOLATE_UNIT_TEST_CASE ( LoadOptimizer_RedefinitionAliasing_CheckNull_NoEscape  )

Definition at line 349 of file redundancy_elimination_test.cc.

349 {
350 TestAliasingViaRedefinition(thread, /*make_it_escape=*/false, MakeCheckNull);
351}

◆ ISOLATE_UNIT_TEST_CASE() [213/463]

dart::ISOLATE_UNIT_TEST_CASE ( LoadOptimizer_RedefinitionAliasing_Redefinition_Escape  )

Definition at line 363 of file redundancy_elimination_test.cc.

363 {
364 TestAliasingViaRedefinition(thread, /*make_it_escape=*/true,
365 MakeRedefinition);
366}

◆ ISOLATE_UNIT_TEST_CASE() [214/463]

dart::ISOLATE_UNIT_TEST_CASE ( LoadOptimizer_RedefinitionAliasing_Redefinition_NoEscape  )

Definition at line 357 of file redundancy_elimination_test.cc.

358 {
359 TestAliasingViaRedefinition(thread, /*make_it_escape=*/false,
360 MakeRedefinition);
361}

◆ ISOLATE_UNIT_TEST_CASE() [215/463]

dart::ISOLATE_UNIT_TEST_CASE ( LoadOptimizer_RedundantInitializerCallAfterIf  )

Definition at line 967 of file redundancy_elimination_test.cc.

967 {
968 const char* kScript = R"(
969 int x = int.parse('1');
970
971 @pragma('vm:never-inline')
972 use(int arg) {}
973
974 foo(bool condition) {
975 if (condition) {
976 x = 3;
977 } else {
978 use(x);
979 }
980 use(x);
981 }
982
983 main() {
984 foo(true);
985 }
986 )";
987
988 const auto& root_library = Library::Handle(LoadTestScript(kScript));
989 Invoke(root_library, "main");
990 const auto& function = Function::Handle(GetFunction(root_library, "foo"));
991 TestPipeline pipeline(function, CompilerPass::kJIT);
992 FlowGraph* flow_graph = pipeline.RunPasses({});
993 ASSERT(flow_graph != nullptr);
994
995 auto entry = flow_graph->graph_entry()->normal_entry();
996 EXPECT(entry != nullptr);
997
998 LoadStaticFieldInstr* load_static_after_if = nullptr;
999
1000 ILMatcher cursor(flow_graph, entry);
1001 RELEASE_ASSERT(cursor.TryMatch({
1002 kMoveGlob,
1003 kMatchAndMoveBranchTrue,
1004 kMoveGlob,
1005 kMatchAndMoveGoto,
1006 kMatchAndMoveJoinEntry,
1007 kMoveParallelMoves,
1008 {kMatchAndMoveLoadStaticField, &load_static_after_if},
1009 kMoveGlob,
1010 kMatchDartReturn,
1011 }));
1012 EXPECT(!load_static_after_if->calls_initializer());
1013}

◆ ISOLATE_UNIT_TEST_CASE() [216/463]

dart::ISOLATE_UNIT_TEST_CASE ( LoadOptimizer_RedundantInitializerCallInLoop  )

Definition at line 1015 of file redundancy_elimination_test.cc.

1015 {
1016 if (!TestCase::IsNNBD()) {
1017 return;
1018 }
1019
1020 const char* kScript = R"(
1021 class A {
1022 late int x = int.parse('1');
1023 A? next;
1024 }
1025
1026 @pragma('vm:never-inline')
1027 use(int arg) {}
1028
1029 foo(A obj) {
1030 use(obj.x);
1031 for (;;) {
1032 use(obj.x);
1033 final next = obj.next;
1034 if (next == null) {
1035 break;
1036 }
1037 obj = next;
1038 use(obj.x);
1039 }
1040 }
1041
1042 main() {
1043 foo(A()..next = A());
1044 }
1045 )";
1046
1047 const auto& root_library = Library::Handle(LoadTestScript(kScript));
1048 Invoke(root_library, "main");
1049 const auto& function = Function::Handle(GetFunction(root_library, "foo"));
1050 TestPipeline pipeline(function, CompilerPass::kJIT);
1051 FlowGraph* flow_graph = pipeline.RunPasses({});
1052 ASSERT(flow_graph != nullptr);
1053
1054 auto entry = flow_graph->graph_entry()->normal_entry();
1055 EXPECT(entry != nullptr);
1056
1057 LoadFieldInstr* load_field_before_loop = nullptr;
1058 LoadFieldInstr* load_field_in_loop1 = nullptr;
1059 LoadFieldInstr* load_field_in_loop2 = nullptr;
1060
1061 ILMatcher cursor(flow_graph, entry);
1062 RELEASE_ASSERT(cursor.TryMatch({
1063 kMoveGlob,
1064 {kMatchAndMoveLoadField, &load_field_before_loop},
1065 kMoveGlob,
1066 kMatchAndMoveGoto,
1067 kMatchAndMoveJoinEntry,
1068 kMoveGlob,
1069 {kMatchAndMoveLoadField, &load_field_in_loop1},
1070 kMoveGlob,
1071 kMatchAndMoveBranchFalse,
1072 kMoveGlob,
1073 {kMatchAndMoveLoadField, &load_field_in_loop2},
1074 }));
1075
1076 EXPECT(load_field_before_loop->calls_initializer());
1077 EXPECT(!load_field_in_loop1->calls_initializer());
1078 EXPECT(load_field_in_loop2->calls_initializer());
1079}

◆ ISOLATE_UNIT_TEST_CASE() [217/463]

dart::ISOLATE_UNIT_TEST_CASE ( LoadOptimizer_RedundantInitializingStoreAOT  )

Definition at line 1083 of file redundancy_elimination_test.cc.

1083 {
1084 const char* kScript = R"(
1085class Vec3 {
1086 final double x, y, z;
1087
1088 @pragma('vm:prefer-inline')
1089 const Vec3(this.x, this.y, this.z);
1090
1091 @override
1092 @pragma('vm:prefer-inline')
1093 String toString() => _vec3ToString(x, y, z);
1094}
1095
1096@pragma('vm:never-inline')
1097String _vec3ToString(double x, double y, double z) => '';
1098
1099// Boxed storage for Vec3.
1100// Fields are unboxed.
1101class Vec3Mut {
1102 double _x = 0.0;
1103 double _y = 0.0;
1104 double _z = 0.0;
1105
1106 Vec3Mut(Vec3 v)
1107 : _x = v.x,
1108 _y = v.y,
1109 _z = v.z;
1110
1111 @override
1112 String toString() => _vec3ToString(_x, _y, _z);
1113
1114 @pragma('vm:prefer-inline')
1115 set vec(Vec3 v) {
1116 _x = v.x;
1117 _y = v.y;
1118 _z = v.z;
1119 }
1120}
1121
1122Vec3Mut main() {
1123 final a = Vec3(3, 4, 5);
1124 final b = Vec3(8, 9, 10);
1125 final c = Vec3(18, 19, 20);
1126 final d = Vec3(180, 190, 200);
1127 final e = Vec3(1800, 1900, 2000);
1128 final v = Vec3Mut(a);
1129 v.vec = b;
1130 v.vec = c;
1131 v.vec = d;
1132 v.vec = e;
1133 return v;
1134}
1135 )";
1136
1137 const auto& root_library = Library::Handle(LoadTestScript(kScript));
1138 const auto& function = Function::Handle(GetFunction(root_library, "main"));
1139
1140 TestPipeline pipeline(function, CompilerPass::kAOT);
1141 FlowGraph* flow_graph = pipeline.RunPasses({});
1142 auto entry = flow_graph->graph_entry()->normal_entry();
1143
1144 AllocateObjectInstr* allocate;
1145 StoreFieldInstr* store1;
1146 StoreFieldInstr* store2;
1147 StoreFieldInstr* store3;
1148
1149 ILMatcher cursor(flow_graph, entry, true, ParallelMovesHandling::kSkip);
1150 RELEASE_ASSERT(cursor.TryMatch({
1151 kMoveGlob,
1152 {kMatchAndMoveAllocateObject, &allocate},
1153 {kMatchAndMoveStoreField, &store1},
1154 {kMatchAndMoveStoreField, &store2},
1155 {kMatchAndMoveStoreField, &store3},
1156 kMatchDartReturn,
1157 }));
1158
1159 EXPECT(store1->instance()->definition() == allocate);
1160 EXPECT(store2->instance()->definition() == allocate);
1161 EXPECT(store3->instance()->definition() == allocate);
1162}

◆ ISOLATE_UNIT_TEST_CASE() [218/463]

dart::ISOLATE_UNIT_TEST_CASE ( LoadOptimizer_RedundantStaticFieldInitialization  )

Definition at line 931 of file redundancy_elimination_test.cc.

931 {
932 const char* kScript = R"(
933 int getX() => 2;
934 int x = getX();
935
936 foo() => x + x;
937
938 main() {
939 foo();
940 }
941 )";
942
943 const auto& root_library = Library::Handle(LoadTestScript(kScript));
944 Invoke(root_library, "main");
945 const auto& function = Function::Handle(GetFunction(root_library, "foo"));
946 TestPipeline pipeline(function, CompilerPass::kJIT);
947 FlowGraph* flow_graph = pipeline.RunPasses({});
948 ASSERT(flow_graph != nullptr);
949
950 auto entry = flow_graph->graph_entry()->normal_entry();
951 EXPECT(entry != nullptr);
952
953 ILMatcher cursor(flow_graph, entry);
954 RELEASE_ASSERT(cursor.TryMatch({
955 kMatchAndMoveFunctionEntry,
956 kMatchAndMoveCheckStackOverflow,
957 kMatchAndMoveLoadStaticField,
958 kMoveParallelMoves,
959 kMatchAndMoveCheckSmi,
960 kMoveParallelMoves,
961 kMatchAndMoveBinarySmiOp,
962 kMoveParallelMoves,
963 kMatchDartReturn,
964 }));
965}

◆ ISOLATE_UNIT_TEST_CASE() [219/463]

dart::ISOLATE_UNIT_TEST_CASE ( LoadOptimizer_RedundantStoreAOT  )

Definition at line 1164 of file redundancy_elimination_test.cc.

1164 {
1165 const char* kScript = R"(
1166class Foo {
1167 int x = -1;
1168
1169 toString() => "Foo x: $x";
1170}
1171
1172class Bar {}
1173
1174main() {
1175 final foo = Foo();
1176 foo.x = 11;
1177 new Bar();
1178 foo.x = 12;
1179 new Bar();
1180 foo.x = 13;
1181 return foo;
1182}
1183 )";
1184
1185 const auto& root_library = Library::Handle(LoadTestScript(kScript));
1186 Invoke(root_library, "main");
1187 const auto& function = Function::Handle(GetFunction(root_library, "main"));
1188 TestPipeline pipeline(function, CompilerPass::kAOT);
1189 FlowGraph* flow_graph = pipeline.RunPasses({});
1190 auto entry = flow_graph->graph_entry()->normal_entry();
1191
1192 AllocateObjectInstr* allocate;
1193 StoreFieldInstr* store1;
1194
1195 ILMatcher cursor(flow_graph, entry, true, ParallelMovesHandling::kSkip);
1196 RELEASE_ASSERT(cursor.TryMatch({
1197 kMoveGlob,
1198 {kMatchAndMoveAllocateObject, &allocate},
1199 {kMatchAndMoveStoreField, &store1}, // initializing store
1200 kMatchDartReturn,
1201 }));
1202
1203 EXPECT(store1->instance()->definition() == allocate);
1204}

◆ ISOLATE_UNIT_TEST_CASE() [220/463]

dart::ISOLATE_UNIT_TEST_CASE ( LoadOptimizer_RedundantStoresAndLoads  )

Definition at line 877 of file redundancy_elimination_test.cc.

877 {
878 const char* kScript = R"(
879 class Bar {
880 Bar() { a = null; }
881 dynamic a;
882 }
883
884 Bar foo() {
885 Bar bar = new Bar();
886 bar.a = null;
887 bar.a = bar;
888 bar.a = bar.a;
889 return bar.a;
890 }
891
892 main() {
893 foo();
894 }
895 )";
896
897 const auto& root_library = Library::Handle(LoadTestScript(kScript));
898 Invoke(root_library, "main");
899 const auto& function = Function::Handle(GetFunction(root_library, "foo"));
900 TestPipeline pipeline(function, CompilerPass::kJIT);
901 FlowGraph* flow_graph = pipeline.RunPasses({
902 CompilerPass::kComputeSSA,
903 CompilerPass::kTypePropagation,
904 CompilerPass::kApplyICData,
905 CompilerPass::kInlining,
906 CompilerPass::kTypePropagation,
907 CompilerPass::kSelectRepresentations,
908 CompilerPass::kCanonicalize,
909 CompilerPass::kConstantPropagation,
910 });
911
912 ASSERT(flow_graph != nullptr);
913
914 // Before CSE, we have 2 loads and 4 stores.
915 intptr_t bef_loads = 0;
916 intptr_t bef_stores = 0;
917 CountLoadsStores(flow_graph, &bef_loads, &bef_stores);
918 EXPECT_EQ(2, bef_loads);
919 EXPECT_EQ(4, bef_stores);
920
921 DominatorBasedCSE::Optimize(flow_graph);
922
923 // After CSE, no load and only one store remains.
924 intptr_t aft_loads = 0;
925 intptr_t aft_stores = 0;
926 CountLoadsStores(flow_graph, &aft_loads, &aft_stores);
927 EXPECT_EQ(0, aft_loads);
928 EXPECT_EQ(1, aft_stores);
929}

◆ ISOLATE_UNIT_TEST_CASE() [221/463]

dart::ISOLATE_UNIT_TEST_CASE ( LoadOptimizer_TypedArrayViewAliasing  )

Definition at line 780 of file redundancy_elimination_test.cc.

780 {
781 const char* script_chars = R"(
782 import 'dart:typed_data';
783
784 class View {
785 final Float64List data;
786 View(this.data);
787 }
788 )";
789 const Library& lib =
790 Library::Handle(LoadTestScript(script_chars, NoopNativeLookup));
791
792 const Class& view_cls = Class::ZoneHandle(
793 lib.LookupClass(String::Handle(Symbols::New(thread, "View"))));
794 const Error& err = Error::Handle(view_cls.EnsureIsFinalized(thread));
795 EXPECT(err.IsNull());
796
797 const Field& original_field = Field::Handle(
798 view_cls.LookupField(String::Handle(Symbols::New(thread, "data"))));
799 EXPECT(!original_field.IsNull());
800 const Field& field = Field::Handle(original_field.CloneFromOriginal());
801
803 CompilerState S(thread, /*is_aot=*/false, /*is_optimizing=*/true);
805
806 auto b1 = H.flow_graph()->graph_entry()->normal_entry();
807
809 DartReturnInstr* ret;
810
811 {
812 BlockBuilder builder(H.flow_graph(), b1);
813 // array <- AllocateTypedData(1)
814 const auto array = builder.AddDefinition(new AllocateTypedDataInstr(
815 InstructionSource(), kTypedDataFloat64ArrayCid,
816 new Value(H.IntConstant(1)), DeoptId::kNone));
817 // view <- AllocateObject(View)
818 const auto view = builder.AddDefinition(
819 new AllocateObjectInstr(InstructionSource(), view_cls, DeoptId::kNone));
820 // StoreField(view.data = array)
821 builder.AddInstruction(new StoreFieldInstr(
822 field, new Value(view), new Value(array),
823 StoreBarrierType::kNoStoreBarrier, InstructionSource(),
824 &H.flow_graph()->parsed_function()));
825 // StoreIndexed(array <float64>, 0, 1.0)
826 builder.AddInstruction(new StoreIndexedInstr(
827 new Value(array), new Value(H.IntConstant(0)),
828 new Value(H.DoubleConstant(1.0)), StoreBarrierType::kNoStoreBarrier,
829 /*index_unboxed=*/false,
830 /*index_scale=*/Instance::ElementSizeFor(kTypedDataFloat64ArrayCid),
831 kTypedDataFloat64ArrayCid, AlignmentType::kAlignedAccess,
832 DeoptId::kNone, InstructionSource()));
833 // array_alias <- LoadField(view.data)
834 const auto array_alias = builder.AddDefinition(new LoadFieldInstr(
835 new Value(view), Slot::Get(field, &H.flow_graph()->parsed_function()),
837 // StoreIndexed(array_alias <float32>, 1, 2.0)
838 builder.AddInstruction(new StoreIndexedInstr(
839 new Value(array_alias), new Value(H.IntConstant(1)),
840 new Value(H.DoubleConstant(2.0)), StoreBarrierType::kNoStoreBarrier,
841 /*index_unboxed=*/false,
842 /*index_scale=*/Instance::ElementSizeFor(kTypedDataFloat32ArrayCid),
843 kTypedDataFloat32ArrayCid, AlignmentType::kAlignedAccess,
844 DeoptId::kNone, InstructionSource()));
845 // load <- LoadIndexed(array <float64>, 0)
846 load = builder.AddDefinition(new LoadIndexedInstr(
847 new Value(array), new Value(H.IntConstant(0)), /*index_unboxed=*/false,
848 /*index_scale=*/Instance::ElementSizeFor(kTypedDataFloat64ArrayCid),
849 kTypedDataFloat64ArrayCid, AlignmentType::kAlignedAccess,
850 DeoptId::kNone, InstructionSource()));
851 // Return(load)
852 ret = builder.AddReturn(new Value(load));
853 }
854 H.FinishGraph();
855 DominatorBasedCSE::Optimize(H.flow_graph());
856
857 // Check that we do not forward the load in question.
858 EXPECT_PROPERTY(ret, it.value()->definition() == load);
859}

◆ ISOLATE_UNIT_TEST_CASE() [222/463]

dart::ISOLATE_UNIT_TEST_CASE ( LocalScope  )

Definition at line 11 of file scopes_test.cc.

11 {
12 // Allocate a couple of local variables first.
13 const Type& dynamic_type = Type::ZoneHandle(Type::DynamicType());
14 const String& a = String::ZoneHandle(Symbols::New(thread, "a"));
15 LocalVariable* var_a = new LocalVariable(
16 TokenPosition::kNoSource, TokenPosition::kNoSource, a, dynamic_type);
17 LocalVariable* inner_var_a = new LocalVariable(
18 TokenPosition::kNoSource, TokenPosition::kNoSource, a, dynamic_type);
19 const String& b = String::ZoneHandle(Symbols::New(thread, "b"));
20 LocalVariable* var_b = new LocalVariable(
21 TokenPosition::kNoSource, TokenPosition::kNoSource, b, dynamic_type);
22 const String& c = String::ZoneHandle(Symbols::New(thread, "c"));
23 LocalVariable* var_c = new LocalVariable(
24 TokenPosition::kNoSource, TokenPosition::kNoSource, c, dynamic_type);
25
26 LocalScope* outer_scope = new LocalScope(nullptr, 0, 0);
27 LocalScope* inner_scope1 = new LocalScope(outer_scope, 0, 0);
28 LocalScope* inner_scope2 = new LocalScope(outer_scope, 0, 0);
29
30 EXPECT(outer_scope->parent() == nullptr);
31 EXPECT_EQ(outer_scope, inner_scope1->parent());
32 EXPECT_EQ(outer_scope, inner_scope2->parent());
33 EXPECT_EQ(inner_scope2, outer_scope->child());
34 EXPECT_EQ(inner_scope1, inner_scope2->sibling());
35 EXPECT(inner_scope1->child() == nullptr);
36 EXPECT(inner_scope2->child() == nullptr);
37
38 // Populate the local scopes as follows:
39 // { // outer_scope
40 // var a;
41 // { // inner_scope1
42 // var b;
43 // }
44 // L: { // inner_scope2
45 // var c;
46 // }
47 // }
48 EXPECT(outer_scope->AddVariable(var_a));
49 EXPECT(inner_scope1->AddVariable(var_b));
50 EXPECT(inner_scope2->AddVariable(var_c));
51 EXPECT(!outer_scope->AddVariable(var_a));
52
53 // Check the simple layout above.
54 EXPECT_EQ(var_a, outer_scope->LocalLookupVariable(
55 a, LocalVariable::kNoKernelOffset));
56 EXPECT_EQ(var_a, inner_scope1->LookupVariable(
57 a, LocalVariable::kNoKernelOffset, true));
58 EXPECT(outer_scope->LocalLookupVariable(b, LocalVariable::kNoKernelOffset) ==
59 nullptr);
60 EXPECT(inner_scope1->LocalLookupVariable(c, LocalVariable::kNoKernelOffset) ==
61 nullptr);
62
63 // Modify the local scopes to contain shadowing:
64 // { // outer_scope
65 // var a;
66 // { // inner_scope1
67 // var b;
68 // var a; // inner_var_a
69 // }
70 // { // inner_scope2
71 // var c;
72 // L: ...
73 // }
74 // }
75 EXPECT(inner_scope1->AddVariable(inner_var_a));
76 EXPECT_EQ(inner_var_a, inner_scope1->LookupVariable(
77 a, LocalVariable::kNoKernelOffset, true));
78 EXPECT(inner_scope1->LookupVariable(a, LocalVariable::kNoKernelOffset,
79 true) != var_a);
80
81 // Modify the local scopes with access of an outer scope variable:
82 // { // outer_scope
83 // var a;
84 // { // inner_scope1
85 // var b;
86 // var a; // inner_var_a
87 // }
88 // { // inner_scope2
89 // var c = a;
90 // L: ...
91 // }
92 // }
93 EXPECT(inner_scope2->LocalLookupVariable(a, LocalVariable::kNoKernelOffset) ==
94 nullptr);
95 EXPECT(inner_scope2->AddVariable(var_a));
96 EXPECT_EQ(var_a, inner_scope2->LocalLookupVariable(
97 a, LocalVariable::kNoKernelOffset));
98
99 EXPECT_EQ(1, outer_scope->num_variables());
100 EXPECT_EQ(2, inner_scope1->num_variables());
101 EXPECT_EQ(2, inner_scope2->num_variables());
102
103 // Cannot depend on the order, but we should find the variables.
104 EXPECT(outer_scope->VariableAt(0) == var_a);
105 EXPECT((inner_scope1->VariableAt(0) == inner_var_a) ||
106 (inner_scope1->VariableAt(1) == inner_var_a));
107 EXPECT((inner_scope1->VariableAt(0) == var_b) ||
108 (inner_scope1->VariableAt(1) == var_b));
109 EXPECT((inner_scope2->VariableAt(0) == var_a) ||
110 (inner_scope2->VariableAt(1) == var_a) ||
111 (inner_scope2->VariableAt(2) == var_a));
112 EXPECT((inner_scope2->VariableAt(0) == var_c) ||
113 (inner_scope2->VariableAt(1) == var_c) ||
114 (inner_scope2->VariableAt(2) == var_c));
115}
LocalScope * parent() const
Definition scopes.h:319

◆ ISOLATE_UNIT_TEST_CASE() [223/463]

dart::ISOLATE_UNIT_TEST_CASE ( LongJump  )

Definition at line 18 of file longjump_test.cc.

18 {
19 LongJumpScope* base = Thread::Current()->long_jump_base();
20 {
21 LongJumpScope jump;
22 if (setjmp(*jump.Set()) == 0) {
23 LongJumpHelper(&jump);
25 } else {
26 ASSERT(Error::Handle(thread->StealStickyError()).IsLanguageError());
27 }
28 }
29 ASSERT(base == Thread::Current()->long_jump_base());
30}
static void LongJumpHelper(LongJumpScope *jump)

◆ ISOLATE_UNIT_TEST_CASE() [224/463]

dart::ISOLATE_UNIT_TEST_CASE ( ManySimpleTasksWithZones  )

Definition at line 309 of file thread_test.cc.

309 {
310 const int kTaskCount = 10;
311 Monitor monitor;
312 Monitor sync;
313 Thread* threads[kTaskCount];
314 auto isolate_group = thread->isolate_group();
315 intptr_t done_count = 0;
316 bool wait = true;
317
318 EXPECT(!thread->force_growth());
319
320 ForceGrowthScope no_heap_growth_scope(thread);
321
322 for (intptr_t i = 0; i < kTaskCount; i++) {
323 Dart::thread_pool()->Run<SimpleTaskWithZoneAllocation>(
324 (i + 1), isolate_group, &threads[i], &sync, &monitor, &done_count,
325 &wait);
326 }
327 // Wait until all spawned tasks finish their memory operations.
328 {
329 MonitorLocker ml(&monitor);
330 while (done_count < kTaskCount) {
331 ml.Wait();
332 }
333 // Reset the done counter for use later.
334 done_count = 0;
335 }
336
337 // Unblock the tasks so they can finish.
338 {
339 MonitorLocker sync_ml(&sync);
340 wait = false;
341 sync_ml.NotifyAll();
342 }
343 // Now wait for them all to exit before destroying the isolate.
344 {
345 MonitorLocker ml(&monitor);
346 while (done_count < kTaskCount) {
347 ml.Wait();
348 }
349 }
350}

◆ ISOLATE_UNIT_TEST_CASE() [225/463]

dart::ISOLATE_UNIT_TEST_CASE ( ManyTasksWithZones  )

Definition at line 190 of file thread_test.cc.

190 {
191 const int kTaskCount = 100;
192 Monitor sync[kTaskCount];
193 bool done[kTaskCount];
194 auto isolate = thread->isolate();
195 auto isolate_group = thread->isolate_group();
196 for (int i = 0; i < kTaskCount; i++) {
197 done[i] = false;
198 Dart::thread_pool()->Run<TaskWithZoneAllocation>(isolate_group, &sync[i],
199 &done[i], i);
200 }
201 bool in_isolate = true;
202 for (int i = 0; i < kTaskCount; i++) {
203 // Check that main mutator thread can still freely use its own zone.
204 String& bar = String::Handle(String::New("bar"));
205 if (i % 10 == 0) {
206 // Mutator thread is free to independently move in/out/between isolates.
207 Thread::ExitIsolate();
208 in_isolate = false;
209 }
210 MonitorLocker ml(&sync[i]);
211 while (!done[i]) {
212 if (in_isolate) {
213 ml.WaitWithSafepointCheck(thread);
214 } else {
215 ml.Wait();
216 }
217 }
218 EXPECT(done[i]);
219 if (i % 10 == 0) {
220 Thread::EnterIsolate(isolate);
221 in_isolate = true;
222 }
223 EXPECT(bar.Equals("bar"));
224 }
225}

◆ ISOLATE_UNIT_TEST_CASE() [226/463]

dart::ISOLATE_UNIT_TEST_CASE ( Maps  )

Definition at line 253 of file hash_table_test.cc.

253 {
254 for (intptr_t initial_capacity = 0; initial_capacity < 32;
255 ++initial_capacity) {
256 TestMap<UnorderedHashMap<TestTraits> >(initial_capacity, false);
257 }
258}

◆ ISOLATE_UNIT_TEST_CASE() [227/463]

dart::ISOLATE_UNIT_TEST_CASE ( MegamorphicCache  )

Definition at line 3149 of file object_test.cc.

3149 {
3150 const auto& name = String::Handle(Symbols::New(thread, "name"));
3151 const auto& args_descriptor =
3152 Array::Handle(ArgumentsDescriptor::NewBoxed(1, 1, Object::null_array()));
3153
3154 const auto& cidA = Smi::Handle(Smi::New(1));
3155 const auto& cidB = Smi::Handle(Smi::New(2));
3156
3157 const auto& valueA = Smi::Handle(Smi::New(42));
3158 const auto& valueB = Smi::Handle(Smi::New(43));
3159
3160 // Test normal insert/lookup methods.
3161 {
3162 const auto& cache =
3163 MegamorphicCache::Handle(MegamorphicCache::New(name, args_descriptor));
3164
3165 EXPECT(cache.Lookup(cidA) == Object::null());
3166 cache.EnsureContains(cidA, valueA);
3167 EXPECT(cache.Lookup(cidA) == valueA.ptr());
3168
3169 EXPECT(cache.Lookup(cidB) == Object::null());
3170 cache.EnsureContains(cidB, valueB);
3171 EXPECT(cache.Lookup(cidB) == valueB.ptr());
3172 }
3173
3174 // Try to insert many keys to hit collisions & growth.
3175 {
3176 const auto& cache =
3177 MegamorphicCache::Handle(MegamorphicCache::New(name, args_descriptor));
3178
3179 auto& cid = Smi::Handle();
3180 auto& value = Object::Handle();
3181 for (intptr_t i = 0; i < 100; ++i) {
3182 cid = Smi::New(100 * i);
3183 if (cid.Value() == kIllegalCid) continue;
3184
3185 value = Smi::New(i);
3186 cache.EnsureContains(cid, value);
3187 }
3188 auto& expected = Object::Handle();
3189 for (intptr_t i = 0; i < 100; ++i) {
3190 cid = Smi::New(100 * i);
3191 if (cid.Value() == kIllegalCid) continue;
3192
3193 expected = Smi::New(i);
3194 value = cache.Lookup(cid);
3195 EXPECT(Smi::Cast(value).Equals(Smi::Cast(expected)));
3196 }
3197 }
3198}

◆ ISOLATE_UNIT_TEST_CASE() [228/463]

dart::ISOLATE_UNIT_TEST_CASE ( Metric_EmbedderAPI  )

Definition at line 79 of file metrics_test.cc.

79 {
80 {
81 TransitionVMToNative transition(thread);
82
83 const char* kScript = "void main() {}";
84 Dart_Handle api_lib = TestCase::LoadTestScript(
85 kScript, /*resolver=*/nullptr, RESOLVED_USER_TEST_URI);
86 EXPECT_VALID(api_lib);
87 }
88
89 // Ensure we've done new/old GCs to ensure max metrics are initialized.
90 String::New("<land-in-new-space>", Heap::kNew);
91 thread->heap()->CollectGarbage(thread, GCType::kScavenge,
92 GCReason::kDebugging);
93 thread->heap()->CollectGarbage(thread, GCType::kMarkCompact,
94 GCReason::kDebugging);
95
96 // Ensure we've something live in new space.
97 String::New("<land-in-new-space2>", Heap::kNew);
98
99 EXPECT(thread->isolate_group()->GetHeapOldUsedMaxMetric()->Value() > 0);
100 EXPECT(thread->isolate_group()->GetHeapOldCapacityMaxMetric()->Value() > 0);
101 EXPECT(thread->isolate_group()->GetHeapNewUsedMaxMetric()->Value() > 0);
102 EXPECT(thread->isolate_group()->GetHeapNewCapacityMaxMetric()->Value() > 0);
103 EXPECT(thread->isolate_group()->GetHeapGlobalUsedMetric()->Value() > 0);
104 EXPECT(thread->isolate_group()->GetHeapGlobalUsedMaxMetric()->Value() > 0);
105
106 {
107 TransitionVMToNative transition(thread);
108
110 EXPECT(Dart_IsolateGroupHeapOldUsedMetric(isolate_group) > 0);
112 EXPECT(Dart_IsolateGroupHeapNewUsedMetric(isolate_group) > 0);
114 }
115}
struct _Dart_IsolateGroup * Dart_IsolateGroup
Definition dart_api.h:89
DART_EXPORT Dart_IsolateGroup Dart_CurrentIsolateGroup(void)
DART_EXPORT int64_t Dart_IsolateGroupHeapNewUsedMetric(Dart_IsolateGroup group)
DART_EXPORT int64_t Dart_IsolateGroupHeapOldCapacityMetric(Dart_IsolateGroup group)
DART_EXPORT int64_t Dart_IsolateGroupHeapNewCapacityMetric(Dart_IsolateGroup group)
DART_EXPORT int64_t Dart_IsolateGroupHeapOldUsedMetric(Dart_IsolateGroup group)

◆ ISOLATE_UNIT_TEST_CASE() [229/463]

dart::ISOLATE_UNIT_TEST_CASE ( Mint  )

Definition at line 512 of file object_test.cc.

512 {
513// On 64-bit architectures a Smi is stored in a 64 bit word. A Midint cannot
514// be allocated if it does fit into a Smi.
515#if !defined(ARCH_IS_64_BIT) || defined(DART_COMPRESSED_POINTERS)
516 {
517 Mint& med = Mint::Handle();
518 EXPECT(med.IsNull());
519 int64_t v = DART_2PART_UINT64_C(1, 0);
520 med ^= Integer::New(v);
521 EXPECT_EQ(v, med.value());
522 const String& smi_str = String::Handle(String::New("1"));
523 const String& mint1_str = String::Handle(String::New("2147419168"));
524 const String& mint2_str = String::Handle(String::New("-2147419168"));
525 Integer& i = Integer::Handle(Integer::NewCanonical(smi_str));
526 EXPECT(i.IsSmi());
527 i = Integer::NewCanonical(mint1_str);
528 EXPECT(i.IsMint());
529 EXPECT(!i.IsZero());
530 EXPECT(!i.IsNegative());
531 i = Integer::NewCanonical(mint2_str);
532 EXPECT(i.IsMint());
533 EXPECT(!i.IsZero());
534 EXPECT(i.IsNegative());
535 }
536 Integer& i = Integer::Handle(Integer::New(DART_2PART_UINT64_C(1, 0)));
537 EXPECT(i.IsMint());
538 EXPECT(!i.IsZero());
539 EXPECT(!i.IsNegative());
540 Integer& i1 = Integer::Handle(Integer::New(DART_2PART_UINT64_C(1010, 0)));
541 Mint& i2 = Mint::Handle();
542 i2 ^= Integer::New(DART_2PART_UINT64_C(1010, 0));
543 EXPECT(i1.Equals(i2));
544 EXPECT(!i.Equals(i1));
545 int64_t test = DART_2PART_UINT64_C(1010, 0);
546 EXPECT_EQ(test, i2.value());
547
548 Mint& a = Mint::Handle();
549 a ^= Integer::New(DART_2PART_UINT64_C(5, 0));
550 Mint& b = Mint::Handle();
551 b ^= Integer::New(DART_2PART_UINT64_C(3, 0));
552 EXPECT_EQ(1, a.CompareWith(b));
553 EXPECT_EQ(-1, b.CompareWith(a));
554 EXPECT_EQ(0, a.CompareWith(a));
555
556 Mint& c = Mint::Handle();
557 c ^= Integer::New(-DART_2PART_UINT64_C(3, 0));
558 Smi& smi1 = Smi::Handle(Smi::New(4));
559 Smi& smi2 = Smi::Handle(Smi::New(-4));
560 EXPECT_EQ(1, a.CompareWith(smi1));
561 EXPECT_EQ(1, a.CompareWith(smi2));
562 EXPECT_EQ(-1, c.CompareWith(smi1));
563 EXPECT_EQ(-1, c.CompareWith(smi2));
564
565 int64_t mint_value = DART_2PART_UINT64_C(0x7FFFFFFF, 64);
566 const String& mint_string = String::Handle(String::New("0x7FFFFFFF00000064"));
567 Mint& mint1 = Mint::Handle();
568 mint1 ^= Integer::NewCanonical(mint_string);
569 Mint& mint2 = Mint::Handle();
570 mint2 ^= Integer::NewCanonical(mint_string);
571 EXPECT_EQ(mint1.value(), mint_value);
572 EXPECT_EQ(mint2.value(), mint_value);
573 EXPECT_EQ(mint1.ptr(), mint2.ptr());
574#endif
575}
virtual bool IsNegative() const
Definition object.cc:23125
virtual bool Equals(const Instance &other) const
Definition object.cc:23113
#define DART_2PART_UINT64_C(a, b)
Definition globals.h:472

◆ ISOLATE_UNIT_TEST_CASE() [230/463]

dart::ISOLATE_UNIT_TEST_CASE ( MirrorReference  )

Definition at line 5266 of file object_test.cc.

5266 {
5267 const MirrorReference& reference =
5268 MirrorReference::Handle(MirrorReference::New(Object::Handle()));
5269 Object& initial_referent = Object::Handle(reference.referent());
5270 EXPECT(initial_referent.IsNull());
5271
5272 Library& library = Library::Handle(Library::CoreLibrary());
5273 EXPECT(!library.IsNull());
5274 EXPECT(library.IsLibrary());
5275 reference.set_referent(library);
5276 const Object& returned_referent = Object::Handle(reference.referent());
5277 EXPECT(returned_referent.IsLibrary());
5278 EXPECT_EQ(returned_referent.ptr(), library.ptr());
5279
5280 const MirrorReference& other_reference =
5281 MirrorReference::Handle(MirrorReference::New(Object::Handle()));
5282 EXPECT_NE(reference.ptr(), other_reference.ptr());
5283 other_reference.set_referent(library);
5284 EXPECT_NE(reference.ptr(), other_reference.ptr());
5285 EXPECT_EQ(reference.referent(), other_reference.referent());
5286
5287 Object& obj = Object::Handle(reference.ptr());
5288 EXPECT(obj.IsMirrorReference());
5289}
void set_referent(const Object &referent) const
Definition object.h:13096

◆ ISOLATE_UNIT_TEST_CASE() [231/463]

dart::ISOLATE_UNIT_TEST_CASE ( NonStrictConditionDown  )

Definition at line 267 of file loops_test.cc.

271 {
272 foo();
273 }
274 )";
275 const char* expected =
276 " [0\n"

◆ ISOLATE_UNIT_TEST_CASE() [232/463]

dart::ISOLATE_UNIT_TEST_CASE ( NonStrictConditionDownWrap  )

Definition at line 278 of file loops_test.cc.

287 {

◆ ISOLATE_UNIT_TEST_CASE() [233/463]

dart::ISOLATE_UNIT_TEST_CASE ( NonStrictConditionUp  )

Definition at line 245 of file loops_test.cc.

◆ ISOLATE_UNIT_TEST_CASE() [234/463]

dart::ISOLATE_UNIT_TEST_CASE ( NonStrictConditionUpWrap  )

Definition at line 256 of file loops_test.cc.

260 {
261 const char* script_chars =
262 R"(
263 foo() {
264 for (int i = 1; i < 100; i++) {
265 int a = i + 3;

◆ ISOLATE_UNIT_TEST_CASE() [235/463]

dart::ISOLATE_UNIT_TEST_CASE ( NotEqualConditionDown  )

Definition at line 300 of file loops_test.cc.

300 {
301 foo();
302 }
303 )";
304 const char* expected =
305 " [0\n"
306 " WRAP(99, LIN(0 + 1 * i))\n" // phi (w)
307 " LIN(0 + 1 * i) 100\n" // phi (i)
308 " WRAP(102, LIN(3 + 1 * i))\n" // a
309 " WRAP(94, LIN(-5 + 1 * i))\n" // b

◆ ISOLATE_UNIT_TEST_CASE() [236/463]

dart::ISOLATE_UNIT_TEST_CASE ( NotEqualConditionUp  )

Definition at line 289 of file loops_test.cc.

290 {
291 int w = 99;
292 for (int i = 0; i < 100; i++) {
293 int a = w + 3;
294 int b = w - 5;
295 int c = w * 7;
296 int d = - w;
297 w = i;
298 }

◆ ISOLATE_UNIT_TEST_CASE() [237/463]

dart::ISOLATE_UNIT_TEST_CASE ( ObjectGraph  )

Definition at line 42 of file object_graph_test.cc.

42 {
43 auto heap = thread->isolate_group()->heap();
44
45 // Create a simple object graph with objects a, b, c, d:
46 // a+->b+->c
47 // +   +
48 // |   v
49 // +-->d
50 Array& a = Array::Handle(Array::New(12, Heap::kNew));
51 Array& b = Array::Handle(Array::New(2, Heap::kOld));
52 Array& c = Array::Handle(Array::New(0, Heap::kOld));
53 Array& d = Array::Handle(Array::New(0, Heap::kOld));
54 a.SetAt(10, b);
55 b.SetAt(0, c);
56 b.SetAt(1, d);
57 a.SetAt(11, d);
58 intptr_t a_size = a.ptr()->untag()->HeapSize();
59 intptr_t b_size = b.ptr()->untag()->HeapSize();
60 intptr_t c_size = c.ptr()->untag()->HeapSize();
61 intptr_t d_size = d.ptr()->untag()->HeapSize();
62 {
63 // No more allocation; raw pointers ahead.
64 GcSafepointOperationScope safepoint(thread);
65 ObjectPtr b_raw = b.ptr();
66 // Clear handles to cut unintended retained paths.
67 b = Array::null();
68 c = Array::null();
69 d = Array::null();
70 ObjectGraph graph(thread);
71 {
72 HeapIterationScope iteration_scope(thread, true);
73 {
74 // Compare count and size when 'b' is/isn't skipped.
75 CounterVisitor with(Object::null(), Object::null());
76 graph.IterateObjectsFrom(a, &with);
77 CounterVisitor without(b_raw, a.ptr());
78 graph.IterateObjectsFrom(a, &without);
79 // Only 'b' and 'c' were cut off.
80 EXPECT_EQ(2, with.count() - without.count());
81 EXPECT_EQ(b_size + c_size, with.size() - without.size());
82 }
83 {
84 // Like above, but iterate over the entire isolate. The counts and sizes
85 // are thus larger, but the difference should still be just 'b' and 'c'.
86 CounterVisitor with(Object::null(), Object::null());
87 graph.IterateObjects(&with);
88 CounterVisitor without(b_raw, a.ptr());
89 graph.IterateObjects(&without);
90 EXPECT_EQ(2, with.count() - without.count());
91 EXPECT_EQ(b_size + c_size, with.size() - without.size());
92 }
93 }
94 EXPECT_EQ(a_size + b_size + c_size + d_size,
95 graph.SizeRetainedByInstance(a));
96 }
97 {
98 // Get hold of c again.
99 b ^= a.At(10);
100 c ^= b.At(0);
101 b = Array::null();
102 ObjectGraph graph(thread);
103 // A retaining path should end like this: c <- b <- a <- ...
104 {
105 HANDLESCOPE(thread);
106 // Test null, empty, and length 1 array.
107 intptr_t null_length =
108 graph.RetainingPath(&c, Object::null_array()).length;
109 intptr_t empty_length =
110 graph.RetainingPath(&c, Object::empty_array()).length;
111 Array& path = Array::Handle(Array::New(1, Heap::kNew));
112 intptr_t one_length = graph.RetainingPath(&c, path).length;
113 EXPECT_EQ(null_length, empty_length);
114 EXPECT_EQ(null_length, one_length);
115 EXPECT_LE(3, null_length);
116 }
117 {
118 HANDLESCOPE(thread);
119 Array& path = Array::Handle(Array::New(6, Heap::kNew));
120 // Trigger a full GC to increase probability of concurrent tasks.
121 heap->CollectAllGarbage();
122 intptr_t length = graph.RetainingPath(&c, path).length;
123 EXPECT_LE(3, length);
124 Array& expected_c = Array::Handle();
125 expected_c ^= path.At(0);
126 // c is the first element in b.
127 Smi& offset_from_parent = Smi::Handle();
128 offset_from_parent ^= path.At(1);
129 EXPECT_EQ(Array::element_offset(0), offset_from_parent.Value());
130 Array& expected_b = Array::Handle();
131 expected_b ^= path.At(2);
132 // b is the element with index 10 in a.
133 offset_from_parent ^= path.At(3);
134 EXPECT_EQ(Array::element_offset(10), offset_from_parent.Value());
135 Array& expected_a = Array::Handle();
136 expected_a ^= path.At(4);
137 EXPECT(expected_c.ptr() == c.ptr());
138 EXPECT(expected_b.ptr() == a.At(10));
139 EXPECT(expected_a.ptr() == a.ptr());
140 }
141 }
142}

◆ ISOLATE_UNIT_TEST_CASE() [238/463]

dart::ISOLATE_UNIT_TEST_CASE ( ObjectIdRingExpiredEntryTest  )

Definition at line 246 of file object_id_ring_test.cc.

246 {
247 Isolate* isolate = Isolate::Current();
248 ObjectIdRing* ring = isolate->EnsureObjectIdRing();
249
250 // Insert an object and check we can look it up.
251 String& obj = String::Handle(String::New("I will expire"));
252 intptr_t obj_id = ring->GetIdForObject(obj.ptr());
253 ObjectIdRing::LookupResult kind = ObjectIdRing::kInvalid;
254 ObjectPtr obj_lookup = ring->GetObjectForId(obj_id, &kind);
255 EXPECT_EQ(ObjectIdRing::kValid, kind);
256 EXPECT_EQ(obj.ptr(), obj_lookup);
257
258 // Insert as many new objects as the ring size to bump out our first entry.
259 Object& new_obj = Object::Handle();
260 for (intptr_t i = 0; i < ObjectIdRing::kDefaultCapacity; i++) {
261 new_obj = String::New("Bump");
262 intptr_t new_obj_id = ring->GetIdForObject(new_obj.ptr());
263 ObjectIdRing::LookupResult kind = ObjectIdRing::kInvalid;
264 ObjectPtr new_obj_lookup = ring->GetObjectForId(new_obj_id, &kind);
265 EXPECT_EQ(ObjectIdRing::kValid, kind);
266 EXPECT_EQ(new_obj.ptr(), new_obj_lookup);
267 }
268
269 // Check our first entry reports it has expired.
270 obj_lookup = ring->GetObjectForId(obj_id, &kind);
271 EXPECT_EQ(ObjectIdRing::kExpired, kind);
272 EXPECT_NE(obj.ptr(), obj_lookup);
273 EXPECT_EQ(Object::null(), obj_lookup);
274}
ObjectIdRing * EnsureObjectIdRing()
Definition isolate.cc:2968
ObjectPtr GetObjectForId(int32_t id, LookupResult *kind)
int32_t GetIdForObject(ObjectPtr raw_obj, IdPolicy policy=kAllocateId)

◆ ISOLATE_UNIT_TEST_CASE() [239/463]

dart::ISOLATE_UNIT_TEST_CASE ( ObjectIdRingOldGCTest  )

Definition at line 199 of file object_id_ring_test.cc.

199 {
200 Isolate* isolate = thread->isolate();
201 ObjectIdRing* ring = isolate->EnsureObjectIdRing();
202
203 ObjectIdRing::LookupResult kind = ObjectIdRing::kInvalid;
204 intptr_t raw_obj_id1 = -1;
205 intptr_t raw_obj_id2 = -1;
206 {
207 HandleScope handle_scope(thread);
208 const String& str = String::Handle(String::New("old", Heap::kOld));
209 EXPECT(!str.IsNull());
210 EXPECT_EQ(3, str.Length());
211
212 ObjectPtr raw_obj = Object::RawCast(str.ptr());
213 // Verify that it is located in old heap.
214 EXPECT(raw_obj->IsOldObject());
215 EXPECT_NE(Object::null(), raw_obj);
216 raw_obj_id1 = ring->GetIdForObject(raw_obj);
217 EXPECT_EQ(0, raw_obj_id1);
218 raw_obj_id2 = ring->GetIdForObject(raw_obj);
219 EXPECT_EQ(1, raw_obj_id2);
220 ObjectPtr raw_obj1 = ring->GetObjectForId(raw_obj_id1, &kind);
221 EXPECT_EQ(ObjectIdRing::kValid, kind);
222 ObjectPtr raw_obj2 = ring->GetObjectForId(raw_obj_id2, &kind);
223 EXPECT_EQ(ObjectIdRing::kValid, kind);
224 EXPECT_NE(Object::null(), raw_obj1);
225 EXPECT_NE(Object::null(), raw_obj2);
226 EXPECT_EQ(UntaggedObject::ToAddr(raw_obj),
227 UntaggedObject::ToAddr(raw_obj1));
228 EXPECT_EQ(UntaggedObject::ToAddr(raw_obj),
229 UntaggedObject::ToAddr(raw_obj2));
230 // Exit scope. Freeing String handle.
231 }
232 // Force a GC. No reference exist to the old string anymore. It should be
233 // collected and the object id ring will now return the null object for
234 // those ids.
235 GCTestHelper::CollectOldSpace();
236 ObjectPtr raw_object_moved1 = ring->GetObjectForId(raw_obj_id1, &kind);
237 EXPECT_EQ(ObjectIdRing::kCollected, kind);
238 EXPECT_EQ(Object::null(), raw_object_moved1);
239 ObjectPtr raw_object_moved2 = ring->GetObjectForId(raw_obj_id2, &kind);
240 EXPECT_EQ(ObjectIdRing::kCollected, kind);
241 EXPECT_EQ(Object::null(), raw_object_moved2);
242}

◆ ISOLATE_UNIT_TEST_CASE() [240/463]

dart::ISOLATE_UNIT_TEST_CASE ( ObjectIdRingSerialWrapTest  )

Definition at line 53 of file object_id_ring_test.cc.

53 {
54 Isolate* isolate = Isolate::Current();
55 ObjectIdRing* ring = isolate->EnsureObjectIdRing();
56 ObjectIdRingTestHelper::SetCapacityAndMaxSerial(ring, 2, 4);
57 intptr_t id;
58 ObjectIdRing::LookupResult kind = ObjectIdRing::kInvalid;
59 id = ring->GetIdForObject(ObjectIdRingTestHelper::MakeString("0"));
60 EXPECT_EQ(0, id);
61 ObjectIdRingTestHelper::ExpectIndexId(ring, 0, 0);
62 ObjectIdRingTestHelper::ExpectInvalidIndex(ring, 1);
63 id = ring->GetIdForObject(ObjectIdRingTestHelper::MakeString("1"));
64 EXPECT_EQ(1, id);
65 ObjectIdRingTestHelper::ExpectIndexId(ring, 0, 0);
66 ObjectIdRingTestHelper::ExpectIndexId(ring, 1, 1);
67 // Test that id 1 gives us the "1" string.
68 ObjectIdRingTestHelper::ExpectString(ring->GetObjectForId(id, &kind), "1");
69 EXPECT_EQ(ObjectIdRing::kValid, kind);
70 ObjectIdRingTestHelper::ExpectIdIsValid(ring, 0);
71 ObjectIdRingTestHelper::ExpectIndexId(ring, 0, 0);
72 ObjectIdRingTestHelper::ExpectIdIsValid(ring, 1);
73 ObjectIdRingTestHelper::ExpectIndexId(ring, 1, 1);
74 ObjectIdRingTestHelper::ExpectIdIsInvalid(ring, 2);
75 ObjectIdRingTestHelper::ExpectIdIsInvalid(ring, 3);
76 // We have wrapped, index 0 is being reused.
77 id = ring->GetIdForObject(ObjectIdRingTestHelper::MakeString("2"));
78 EXPECT_EQ(2, id);
79 ObjectIdRingTestHelper::ExpectIdIsInvalid(ring, 0);
80 ObjectIdRingTestHelper::ExpectIdIsValid(ring, 1);
81 // Index 0 has id 2.
82 ObjectIdRingTestHelper::ExpectIndexId(ring, 0, 2);
83 ObjectIdRingTestHelper::ExpectIdIsValid(ring, 2);
84 // Index 1 has id 1.
85 ObjectIdRingTestHelper::ExpectIndexId(ring, 1, 1);
86 ObjectIdRingTestHelper::ExpectIdIsInvalid(ring, 3);
87 id = ring->GetIdForObject(ObjectIdRingTestHelper::MakeString("3"));
88 EXPECT_EQ(3, id);
89 // Index 0 has id 2.
90 ObjectIdRingTestHelper::ExpectIndexId(ring, 0, 2);
91 // Index 1 has id 3.
92 ObjectIdRingTestHelper::ExpectIndexId(ring, 1, 3);
93 ObjectIdRingTestHelper::ExpectIdIsInvalid(ring, 0);
94 ObjectIdRingTestHelper::ExpectIdIsInvalid(ring, 1);
95 ObjectIdRingTestHelper::ExpectIdIsValid(ring, 2);
96 ObjectIdRingTestHelper::ExpectIdIsValid(ring, 3);
97 id = ring->GetIdForObject(ObjectIdRingTestHelper::MakeString("4"));
98 EXPECT_EQ(0, id);
99 // Index 0 has id 0.
100 ObjectIdRingTestHelper::ExpectIndexId(ring, 0, 0);
101 // Index 1 has id 3.
102 ObjectIdRingTestHelper::ExpectIndexId(ring, 1, 3);
103 ObjectIdRingTestHelper::ExpectString(ring->GetObjectForId(id, &kind), "4");
104 EXPECT_EQ(ObjectIdRing::kValid, kind);
105 ObjectIdRingTestHelper::ExpectIdIsValid(ring, 0);
106 ObjectIdRingTestHelper::ExpectIdIsInvalid(ring, 1);
107 ObjectIdRingTestHelper::ExpectIdIsInvalid(ring, 2);
108 ObjectIdRingTestHelper::ExpectIdIsValid(ring, 3);
109 id = ring->GetIdForObject(ObjectIdRingTestHelper::MakeString("5"));
110 EXPECT_EQ(1, id);
111 // Index 0 has id 0.
112 ObjectIdRingTestHelper::ExpectIndexId(ring, 0, 0);
113 // Index 1 has id 1.
114 ObjectIdRingTestHelper::ExpectIndexId(ring, 1, 1);
115 ObjectIdRingTestHelper::ExpectString(ring->GetObjectForId(id, &kind), "5");
116 EXPECT_EQ(ObjectIdRing::kValid, kind);
117 ObjectIdRingTestHelper::ExpectIdIsValid(ring, 0);
118 ObjectIdRingTestHelper::ExpectIdIsValid(ring, 1);
119 ObjectIdRingTestHelper::ExpectIdIsInvalid(ring, 2);
120 ObjectIdRingTestHelper::ExpectIdIsInvalid(ring, 3);
121}

◆ ISOLATE_UNIT_TEST_CASE() [241/463]

dart::ISOLATE_UNIT_TEST_CASE ( ObjectPrinting  )

Definition at line 2598 of file object_test.cc.

2598 {
2599 // Simple Smis.
2600 EXPECT_STREQ("2", Smi::Handle(Smi::New(2)).ToCString());
2601 EXPECT_STREQ("-15", Smi::Handle(Smi::New(-15)).ToCString());
2602
2603 // bool class and true/false values.
2604 ObjectStore* object_store = IsolateGroup::Current()->object_store();
2605 const Class& bool_class = Class::Handle(object_store->bool_class());
2606 EXPECT_STREQ("Library:'dart:core' Class: bool", bool_class.ToCString());
2607 EXPECT_STREQ("true", Bool::True().ToCString());
2608 EXPECT_STREQ("false", Bool::False().ToCString());
2609
2610 // Strings.
2611 EXPECT_STREQ("Sugarbowl",
2612 String::Handle(String::New("Sugarbowl")).ToCString());
2613}

◆ ISOLATE_UNIT_TEST_CASE() [242/463]

dart::ISOLATE_UNIT_TEST_CASE ( OptimizationTests  )

Definition at line 28 of file il_test.cc.

28 {
29 JoinEntryInstr* join =
30 new JoinEntryInstr(1, kInvalidTryIndex, DeoptId::kNone);
31
32 Definition* def1 = new PhiInstr(join, 0);
33 Definition* def2 = new PhiInstr(join, 0);
34 Value* use1a = new Value(def1);
35 Value* use1b = new Value(def1);
36 EXPECT(use1a->Equals(*use1b));
37 Value* use2 = new Value(def2);
38 EXPECT(!use2->Equals(*use1a));
39
40 ConstantInstr* c1 = new ConstantInstr(Bool::True());
41 ConstantInstr* c2 = new ConstantInstr(Bool::True());
42 EXPECT(c1->Equals(*c2));
43 ConstantInstr* c3 = new ConstantInstr(Object::ZoneHandle());
44 ConstantInstr* c4 = new ConstantInstr(Object::ZoneHandle());
45 EXPECT(c3->Equals(*c4));
46 EXPECT(!c3->Equals(*c1));
47}
bool Equals(const Value &other) const
Definition il.cc:631

◆ ISOLATE_UNIT_TEST_CASE() [243/463]

dart::ISOLATE_UNIT_TEST_CASE ( OptimizeCompileFunctionOnHelperThread  )

Definition at line 61 of file compiler_test.cc.

61 {
62 // Create a simple function and compile it without optimization.
63 const char* kScriptChars =
64 "class A {\n"
65 " static foo() { return 42; }\n"
66 "}\n";
67 Dart_Handle library;
68 {
69 TransitionVMToNative transition(thread);
70 library = TestCase::LoadTestScript(kScriptChars, nullptr);
71 }
72 const Library& lib =
73 Library::Handle(Library::RawCast(Api::UnwrapHandle(library)));
74 EXPECT(ClassFinalizer::ProcessPendingClasses());
75 Class& cls =
76 Class::Handle(lib.LookupClass(String::Handle(Symbols::New(thread, "A"))));
77 EXPECT(!cls.IsNull());
78 String& function_foo_name = String::Handle(String::New("foo"));
79 const auto& error = cls.EnsureIsFinalized(thread);
80 EXPECT(error == Error::null());
81 Function& func =
82 Function::Handle(cls.LookupStaticFunction(function_foo_name));
83 EXPECT(!func.HasCode());
84 CompilerTest::TestCompileFunction(func);
85 EXPECT(func.HasCode());
86 EXPECT(!func.HasOptimizedCode());
87#if !defined(PRODUCT)
88 // Constant in product mode.
89 FLAG_background_compilation = true;
90#endif
91 auto isolate_group = thread->isolate_group();
92 isolate_group->background_compiler()->EnqueueCompilation(func);
93 Monitor* m = new Monitor();
94 {
95 SafepointMonitorLocker ml(m);
96 while (!func.HasOptimizedCode()) {
97 ml.Wait(1);
98 }
99 }
100 delete m;
101}

◆ ISOLATE_UNIT_TEST_CASE() [244/463]

dart::ISOLATE_UNIT_TEST_CASE ( PcDescriptors  )

Definition at line 2822 of file object_test.cc.

2822 {
2823 DescriptorList* builder = new DescriptorList(thread->zone());
2824
2825 // kind, pc_offset, deopt_id, token_pos, try_index, yield_index
2826 builder->AddDescriptor(UntaggedPcDescriptors::kOther, 10, 1,
2827 TokenPosition::Deserialize(20), 1, 1);
2828 builder->AddDescriptor(UntaggedPcDescriptors::kDeopt, 20, 2,
2829 TokenPosition::Deserialize(30), 0, -1);
2830 builder->AddDescriptor(UntaggedPcDescriptors::kOther, 30, 3,
2831 TokenPosition::Deserialize(40), 1, 10);
2832 builder->AddDescriptor(UntaggedPcDescriptors::kOther, 10, 4,
2833 TokenPosition::Deserialize(40), 2, 20);
2834 builder->AddDescriptor(UntaggedPcDescriptors::kOther, 10, 5,
2835 TokenPosition::Deserialize(80), 3, 30);
2836 builder->AddDescriptor(UntaggedPcDescriptors::kOther, 80, 6,
2837 TokenPosition::Deserialize(150), 3, 30);
2838
2839 PcDescriptors& descriptors = PcDescriptors::Handle();
2840 descriptors ^= builder->FinalizePcDescriptors(0);
2841
2842 extern void GenerateIncrement(compiler::Assembler * assembler);
2843 compiler::ObjectPoolBuilder object_pool_builder;
2844 compiler::Assembler _assembler_(&object_pool_builder);
2845 GenerateIncrement(&_assembler_);
2846 SafepointWriteRwLocker locker(thread,
2847 thread->isolate_group()->program_lock());
2848 Code& code = Code::Handle(Code::FinalizeCodeAndNotify(
2849 Function::Handle(CreateFunction("Test_Code")), nullptr, &_assembler_,
2850 Code::PoolAttachment::kAttachPool));
2851 code.set_pc_descriptors(descriptors);
2852
2853 // Verify the PcDescriptor entries by accessing them.
2854 const PcDescriptors& pc_descs = PcDescriptors::Handle(code.pc_descriptors());
2855 PcDescriptors::Iterator iter(pc_descs, UntaggedPcDescriptors::kAnyKind);
2856
2857 EXPECT_EQ(true, iter.MoveNext());
2858 EXPECT_EQ(1, iter.YieldIndex());
2859 EXPECT_EQ(20, iter.TokenPos().Pos());
2860 EXPECT_EQ(1, iter.TryIndex());
2861 EXPECT_EQ(static_cast<uword>(10), iter.PcOffset());
2862 EXPECT_EQ(1, iter.DeoptId());
2863 EXPECT_EQ(UntaggedPcDescriptors::kOther, iter.Kind());
2864
2865 EXPECT_EQ(true, iter.MoveNext());
2866 EXPECT_EQ(-1, iter.YieldIndex());
2867 EXPECT_EQ(30, iter.TokenPos().Pos());
2868 EXPECT_EQ(UntaggedPcDescriptors::kDeopt, iter.Kind());
2869
2870 EXPECT_EQ(true, iter.MoveNext());
2871 EXPECT_EQ(10, iter.YieldIndex());
2872 EXPECT_EQ(40, iter.TokenPos().Pos());
2873
2874 EXPECT_EQ(true, iter.MoveNext());
2875 EXPECT_EQ(20, iter.YieldIndex());
2876 EXPECT_EQ(40, iter.TokenPos().Pos());
2877
2878 EXPECT_EQ(true, iter.MoveNext());
2879 EXPECT_EQ(30, iter.YieldIndex());
2880 EXPECT_EQ(80, iter.TokenPos().Pos());
2881
2882 EXPECT_EQ(true, iter.MoveNext());
2883 EXPECT_EQ(30, iter.YieldIndex());
2884 EXPECT_EQ(150, iter.TokenPos().Pos());
2885
2886 EXPECT_EQ(3, iter.TryIndex());
2887 EXPECT_EQ(static_cast<uword>(80), iter.PcOffset());
2888 EXPECT_EQ(150, iter.TokenPos().Pos());
2889 EXPECT_EQ(UntaggedPcDescriptors::kOther, iter.Kind());
2890
2891 EXPECT_EQ(false, iter.MoveNext());
2892}

◆ ISOLATE_UNIT_TEST_CASE() [245/463]

dart::ISOLATE_UNIT_TEST_CASE ( PcDescriptorsLargeDeltas  )

Definition at line 2894 of file object_test.cc.

2894 {
2895 DescriptorList* builder = new DescriptorList(thread->zone());
2896
2897 // kind, pc_offset, deopt_id, token_pos, try_index
2898 builder->AddDescriptor(UntaggedPcDescriptors::kOther, 100, 1,
2899 TokenPosition::Deserialize(200), 1, 10);
2900 builder->AddDescriptor(UntaggedPcDescriptors::kDeopt, 200, 2,
2901 TokenPosition::Deserialize(300), 0, -1);
2902 builder->AddDescriptor(UntaggedPcDescriptors::kOther, 300, 3,
2903 TokenPosition::Deserialize(400), 1, 10);
2904 builder->AddDescriptor(UntaggedPcDescriptors::kOther, 100, 4,
2905 TokenPosition::Deserialize(0), 2, 20);
2906 builder->AddDescriptor(UntaggedPcDescriptors::kOther, 100, 5,
2907 TokenPosition::Deserialize(800), 3, 30);
2908 builder->AddDescriptor(UntaggedPcDescriptors::kOther, 800, 6,
2909 TokenPosition::Deserialize(150), 3, 30);
2910
2911 PcDescriptors& descriptors = PcDescriptors::Handle();
2912 descriptors ^= builder->FinalizePcDescriptors(0);
2913
2914 extern void GenerateIncrement(compiler::Assembler * assembler);
2915 compiler::ObjectPoolBuilder object_pool_builder;
2916 compiler::Assembler _assembler_(&object_pool_builder);
2917 GenerateIncrement(&_assembler_);
2918 SafepointWriteRwLocker locker(thread,
2919 thread->isolate_group()->program_lock());
2920 Code& code = Code::Handle(Code::FinalizeCodeAndNotify(
2921 Function::Handle(CreateFunction("Test_Code")), nullptr, &_assembler_,
2922 Code::PoolAttachment::kAttachPool));
2923 code.set_pc_descriptors(descriptors);
2924
2925 // Verify the PcDescriptor entries by accessing them.
2926 const PcDescriptors& pc_descs = PcDescriptors::Handle(code.pc_descriptors());
2927 PcDescriptors::Iterator iter(pc_descs, UntaggedPcDescriptors::kAnyKind);
2928
2929 EXPECT_EQ(true, iter.MoveNext());
2930 EXPECT_EQ(10, iter.YieldIndex());
2931 EXPECT_EQ(200, iter.TokenPos().Pos());
2932 EXPECT_EQ(1, iter.TryIndex());
2933 EXPECT_EQ(static_cast<uword>(100), iter.PcOffset());
2934 EXPECT_EQ(1, iter.DeoptId());
2935 EXPECT_EQ(UntaggedPcDescriptors::kOther, iter.Kind());
2936
2937 EXPECT_EQ(true, iter.MoveNext());
2938 EXPECT_EQ(-1, iter.YieldIndex());
2939 EXPECT_EQ(300, iter.TokenPos().Pos());
2940 EXPECT_EQ(UntaggedPcDescriptors::kDeopt, iter.Kind());
2941
2942 EXPECT_EQ(true, iter.MoveNext());
2943 EXPECT_EQ(10, iter.YieldIndex());
2944 EXPECT_EQ(400, iter.TokenPos().Pos());
2945
2946 EXPECT_EQ(true, iter.MoveNext());
2947 EXPECT_EQ(20, iter.YieldIndex());
2948 EXPECT_EQ(0, iter.TokenPos().Pos());
2949
2950 EXPECT_EQ(true, iter.MoveNext());
2951 EXPECT_EQ(30, iter.YieldIndex());
2952 EXPECT_EQ(800, iter.TokenPos().Pos());
2953
2954 EXPECT_EQ(true, iter.MoveNext());
2955 EXPECT_EQ(30, iter.YieldIndex());
2956 EXPECT_EQ(150, iter.TokenPos().Pos());
2957
2958 EXPECT_EQ(3, iter.TryIndex());
2959 EXPECT_EQ(static_cast<uword>(800), iter.PcOffset());
2960 EXPECT_EQ(150, iter.TokenPos().Pos());
2961 EXPECT_EQ(UntaggedPcDescriptors::kOther, iter.Kind());
2962
2963 EXPECT_EQ(false, iter.MoveNext());
2964}

◆ ISOLATE_UNIT_TEST_CASE() [246/463]

dart::ISOLATE_UNIT_TEST_CASE ( PeriodicAndDerived  )

Definition at line 222 of file loops_test.cc.

231 {
232 const char* script_chars =
233 R"(
234 foo() {
235 int j = 123;
236 for (int i = 0; i < 100; i++) {
237 if (i == 10) {
238 j += 3;
239 } else {

◆ ISOLATE_UNIT_TEST_CASE() [247/463]

dart::ISOLATE_UNIT_TEST_CASE ( PrintJSON  )

Definition at line 5902 of file object_test.cc.

5902 {
5903 StackZone zone(thread);
5904 HANDLESCOPE(thread);
5905
5906 // All ToCString implementations should not allocate on the Dart heap so
5907 // they remain useful in all parts of the VM.
5908 NoSafepointScope no_safepoint;
5909 objects[i]->ToCString();
5910 }
5911}
5912
5913ISOLATE_UNIT_TEST_CASE(PrintJSON) {
5914 // Set native resolvers in case we need to read native methods.
5915 {
5916 TransitionVMToNative transition(thread);
5917 bin::Builtin::SetNativeResolver(bin::Builtin::kBuiltinLibrary);
5918 bin::Builtin::SetNativeResolver(bin::Builtin::kIOLibrary);
5919 bin::Builtin::SetNativeResolver(bin::Builtin::kCLILibrary);
5920 bin::VmService::SetNativeResolver();
5921 }
5922
5923 GCTestHelper::CollectAllGarbage();
5924 GrowableArray<Object*> objects;

◆ ISOLATE_UNIT_TEST_CASE() [248/463]

dart::ISOLATE_UNIT_TEST_CASE ( PrintJSONPrimitives  )

Definition at line 5926 of file object_test.cc.

5930 {
5931 JSONStream js;
5932 objects[i]->PrintJSON(&js, false);
5933 EXPECT_SUBSTRING("\"type\":", js.ToCString());
5934 }
5935}
5936
5937ISOLATE_UNIT_TEST_CASE(PrintJSONPrimitives) {
5938 // WARNING: This MUST be big enough for the serialized JSON string.
5939 const int kBufferSize = 4096;
5940 char buffer[kBufferSize];
5941 Isolate* isolate = Isolate::Current();
5942
5943 // Class reference
5944 {
5945 JSONStream js;
5946 Class& cls = Class::Handle(isolate->group()->object_store()->bool_class());
5947 cls.PrintJSON(&js, true);
5948 const char* json_str = js.ToCString();
5949 ASSERT(strlen(json_str) < kBufferSize);
5950 ElideJSONSubstring("classes", json_str, buffer);
5951 ElideJSONSubstring("libraries", buffer, buffer);
5953
5954 EXPECT_STREQ(
5955 "{\"type\":\"@Class\",\"fixedId\":true,\"id\":\"\",\"name\":\"bool\","
5956 "\"location\":{\"type\":\"SourceLocation\",\"script\":{\"type\":\"@"
5957 "Script\","
5958 "\"fixedId\":true,\"id\":\"\",\"uri\":\"dart:core\\/bool.dart\","
5959 "\"_kind\":\"kernel\"}},"
5960 "\"library\":{\"type\":\"@Library\",\"fixedId\":true,\"id\":\"\","
5961 "\"name\":\"dart.core\",\"uri\":\"dart:core\"}}",
5962 buffer);
5963 }
5964 // Function reference
5965 {
5966 Thread* thread = Thread::Current();
5967 JSONStream js;
5968 Class& cls = Class::Handle(isolate->group()->object_store()->bool_class());
5969 const String& func_name = String::Handle(String::New("toString"));
5970 Function& func =
5971 Function::Handle(Resolver::ResolveFunction(Z, cls, func_name));
5972 ASSERT(!func.IsNull());
5973 func.PrintJSON(&js, true);
5974 const char* json_str = js.ToCString();
5975 ASSERT(strlen(json_str) < kBufferSize);
5976 ElideJSONSubstring("classes", json_str, buffer);
5977 ElideJSONSubstring("libraries", buffer, buffer);
5979 EXPECT_STREQ(
5980 "{\"type\":\"@Function\",\"fixedId\":true,\"id\":\"\","
5981 "\"name\":\"toString\",\"owner\":{\"type\":\"@Class\","
5982 "\"fixedId\":true,\"id\":\"\",\"name\":\"bool\","
5983 "\"location\":{\"type\":\"SourceLocation\","
5984 "\"script\":{\"type\":\"@Script\",\"fixedId\":true,"
5985 "\"id\":\"\",\"uri\":\"dart:core\\/bool.dart\","
5986 "\"_kind\":\"kernel\"}},"
5987 "\"library\":{\"type\":\"@Library\",\"fixedId\":true,\"id\":\"\","
5988 "\"name\":\"dart.core\",\"uri\":\"dart:core\"}},"
5989 "\"_kind\":\"RegularFunction\",\"static\":false,\"const\":false,"
5990 "\"implicit\":false,\"abstract\":false,"
5991 "\"_intrinsic\":false,\"_native\":false,\"isGetter\":false,"
5992 "\"isSetter\":false,\"location\":{\"type\":\"SourceLocation\","
5993 "\"script\":{\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\","
5994 "\"uri\":\"dart:core\\/bool.dart\",\"_kind\":\"kernel\"}}}",
5995 buffer);
5996 }
5997 // Library reference
5998 {
5999 JSONStream js;
6000 Library& lib =
6001 Library::Handle(isolate->group()->object_store()->core_library());
6002 lib.PrintJSON(&js, true);
6003 const char* json_str = js.ToCString();
6004 ASSERT(strlen(json_str) < kBufferSize);
6005 ElideJSONSubstring("libraries", json_str, buffer);
6006 EXPECT_STREQ(
6007 "{\"type\":\"@Library\",\"fixedId\":true,\"id\":\"\","
6008 "\"name\":\"dart.core\",\"uri\":\"dart:core\"}",
6009 buffer);
6010 }
6011 // Bool reference
6012 {
6013 JSONStream js;
6014 Bool::True().PrintJSON(&js, true);
6015 const char* json_str = js.ToCString();
6016 ASSERT(strlen(json_str) < kBufferSize);
6017 ElideJSONSubstring("classes", json_str, buffer);
6018 ElideJSONSubstring("libraries", buffer, buffer);
6020 EXPECT_STREQ(
6021 "{\"type\":\"@Instance\",\"_vmType\":\"Bool\",\"class\":{\"type\":\"@"
6022 "Class\",\"fixedId\":true,\"id\":\"\",\"name\":\"bool\",\"location\":{"
6023 "\"type\":\"SourceLocation\",\"script\":{\"type\":\"@Script\","
6024 "\"fixedId\":true,\"id\":\"\",\"uri\":\"dart:core\\/bool.dart\",\"_"
6025 "kind\":\"kernel\"}},\"library\":"
6026 "{\"type\":\"@Library\",\"fixedId\":true,\"id\":\"\",\"name\":\"dart."
6027 "core\",\"uri\":\"dart:core\"}},\"identityHashCode\":0,\"kind\":"
6028 "\"Bool\",\"fixedId\":true,\"id\":\"objects\\/bool-true\","
6029 "\"valueAsString\":\"true\"}",
6030 buffer);
6031 }
6032 // Smi reference
6033 {
6034 JSONStream js;
6035 const Integer& smi = Integer::Handle(Integer::New(7));
6036 smi.PrintJSON(&js, true);
6037 const char* json_str = js.ToCString();
6038 ASSERT(strlen(json_str) < kBufferSize);
6039 ElideJSONSubstring("classes", json_str, buffer);
6040 ElideJSONSubstring("_Smi@", buffer, buffer);
6041 ElideJSONSubstring("libraries", buffer, buffer);
6043 EXPECT_STREQ(
6044 "{\"type\":\"@Instance\",\"_vmType\":\"Smi\",\"class\":{\"type\":\"@"
6045 "Class\",\"fixedId\":true,\"id\":\"\",\"name\":\"_Smi\",\"_vmName\":"
6046 "\"\",\"location\":{\"type\":\"SourceLocation\",\"script\":{\"type\":"
6047 "\"@Script\",\"fixedId\":true,\"id\":\"\",\"uri\":\"dart:core-"
6048 "patch\\/integers.dart\",\"_kind\":\"kernel\"}"
6049 "},\"library\":{\"type\":\"@Library\",\"fixedId\":"
6050 "true,\"id\":\"\",\"name\":\"dart.core\",\"uri\":\"dart:core\"}},"
6051 "\"identityHashCode\":0,\"kind\":\"Int\",\"fixedId\":true,\"id\":"
6052 "\"objects\\/int-7\",\"valueAsString\":\"7\"}",
6053 buffer);
6054 }
6055 // Mint reference
6056 {
6057 JSONStream js;
6058 const Integer& smi = Integer::Handle(Integer::New(Mint::kMinValue));
6059 smi.PrintJSON(&js, true);
6060 const char* json_str = js.ToCString();
6061 ASSERT(strlen(json_str) < kBufferSize);
6062 ElideJSONSubstring("classes", json_str, buffer);
6063 ElideJSONSubstring("objects", buffer, buffer);
6064 ElideJSONSubstring("libraries", buffer, buffer);
6065 ElideJSONSubstring("_Mint@", buffer, buffer);
6067 EXPECT_STREQ(
6068 "{\"type\":\"@Instance\",\"_vmType\":\"Mint\",\"class\":{\"type\":\"@"
6069 "Class\",\"fixedId\":true,\"id\":\"\",\"name\":\"_Mint\",\"_vmName\":"
6070 "\"\",\"location\":{\"type\":\"SourceLocation\",\"script\":{\"type\":"
6071 "\"@Script\",\"fixedId\":true,\"id\":\"\",\"uri\":\"dart:core-"
6072 "patch\\/integers.dart\",\"_kind\":\"kernel\"}"
6073 "},\"library\":{\"type\":\"@Library\",\"fixedId\":"
6074 "true,\"id\":\"\",\"name\":\"dart.core\",\"uri\":\"dart:core\"}},"
6075 "\"identityHashCode\":0,\"id\":\"\",\"kind\":\"Int\",\"valueAsString\":"
6076 "\"-9223372036854775808\"}",
6077 buffer);
6078 }
6079 // Double reference
6080 {
6081 JSONStream js;
6082 const Double& dub = Double::Handle(Double::New(0.1234));
6083 dub.PrintJSON(&js, true);
6084 const char* json_str = js.ToCString();
6085 ASSERT(strlen(json_str) < kBufferSize);
6086 ElideJSONSubstring("classes", json_str, buffer);
6087 ElideJSONSubstring("objects", buffer, buffer);
6088 ElideJSONSubstring("libraries", buffer, buffer);
6089 ElideJSONSubstring("_Double@", buffer, buffer);
6091 EXPECT_STREQ(
6092 "{\"type\":\"@Instance\",\"_vmType\":\"Double\",\"class\":{\"type\":\"@"
6093 "Class\",\"fixedId\":true,\"id\":\"\",\"name\":\"_Double\",\"_vmName\":"
6094 "\"\",\"location\":{\"type\":\"SourceLocation\",\"script\":{\"type\":"
6095 "\"@Script\",\"fixedId\":true,\"id\":\"\",\"uri\":\"dart:core-"
6096 "patch\\/double.dart\",\"_kind\":\"kernel\"}"
6097 "},\"library\":{\"type\":\"@Library\",\"fixedId\":"
6098 "true,\"id\":\"\",\"name\":\"dart.core\",\"uri\":\"dart:core\"}},"
6099 "\"identityHashCode\":0,\"id\":\"\",\"kind\":\"Double\","
6100 "\"valueAsString\":\"0.1234\"}",
6101 buffer);
6102 }
6103 // String reference
6104 {
6105 JSONStream js;
6106 const String& str = String::Handle(String::New("dw"));
6107 str.PrintJSON(&js, true);
6108 const char* json_str = js.ToCString();
6109 ASSERT(strlen(json_str) < kBufferSize);
6110 ElideJSONSubstring("classes", json_str, buffer);
6111 ElideJSONSubstring("objects", buffer, buffer);
6112 ElideJSONSubstring("libraries", buffer, buffer);
6113 ElideJSONSubstring("_OneByteString@", buffer, buffer);
6115 EXPECT_STREQ(
6116 "{\"type\":\"@Instance\",\"_vmType\":\"String\",\"class\":{\"type\":\"@"
6117 "Class\",\"fixedId\":true,\"id\":\"\",\"name\":\"_OneByteString\",\"_"
6118 "vmName\":\"\",\"location\":{\"type\":\"SourceLocation\",\"script\":{"
6119 "\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\",\"uri\":\"dart:core-"
6120 "patch\\/string_patch.dart\",\"_kind\":\"kernel\"}"
6121 "},\"library\":{\"type\":\"@Library\",\"fixedId\":"
6122 "true,\"id\":\"\",\"name\":\"dart.core\",\"uri\":\"dart:core\"}},"
6123 "\"identityHashCode\":0,\"id\":\"\",\"kind\":\"String\",\"length\":2,"
6124 "\"valueAsString\":\"dw\"}",
6125 buffer);
6126 }
6127 // Array reference
6128 {
6129 JSONStream js;
6130 const Array& array = Array::Handle(Array::New(0));
6131 array.PrintJSON(&js, true);
6132 const char* json_str = js.ToCString();
6133 ASSERT(strlen(json_str) < kBufferSize);
6134 ElideJSONSubstring("classes", json_str, buffer);
6135 ElideJSONSubstring("objects", buffer, buffer);
6136 ElideJSONSubstring("libraries", buffer, buffer);
6137 ElideJSONSubstring("_List@", buffer, buffer);
6138 ElideJSONSubstring("_TypeParameter@", buffer, buffer);
6140 EXPECT_SUBSTRING(
6141 "{\"type\":\"@Instance\",\"_vmType\":\"Array\",\"class\":{\"type\":\"@"
6142 "Class\",\"fixedId\":true,\"id\":\"\",\"name\":\"_List\",\"_vmName\":"
6143 "\"\",\"location\":{\"type\":\"SourceLocation\",\"script\":{\"type\":"
6144 "\"@Script\",\"fixedId\":true,\"id\":\"\",\"uri\":\"dart:core-patch\\/"
6145 "array.dart\",\"_kind\":\"kernel\"}},"
6146 "\"library\":{\"type\":\"@Library\",\"fixedId\":true,\"id\":\"\","
6147 "\"name\":\"dart.core\",\"uri\":\"dart:core\"},\"typeParameters\":[{"
6148 "\"type\":\"@"
6149 "Instance\",\"_vmType\":\"TypeParameter\",\"class\":{\"type\":\"@"
6150 "Class\",\"fixedId\":true,\"id\":\"\",\"name\":\"_TypeParameter\",\"_"
6151 "vmName\":\"\",\"location\":{\"type\":"
6152 "\"SourceLocation\",\"script\":{\"type\":\"@Script\",\"fixedId\":true,"
6153 "\"id\":\"\",\"uri\":\"dart:core-patch\\/"
6154 "type_patch.dart\",\"_kind\":\"kernel\"}},"
6155 "\"library\":{\"type\":\"@Library\",\"fixedId\":"
6156 "true,\"id\":\"\",\"name\":\"dart.core\",\"uri\":\"dart:core\"}},"
6157 "\"identityHashCode\":",
6158 buffer);
6159
6160 EXPECT_SUBSTRING(
6161 "\"id\":\"\",\"kind\":\"TypeParameter\",\"name\":\"X0\","
6162 "\"parameterizedClass\":{\"type\":\"@Instance\",\"_vmType\":\"Class\","
6163 "\"class\":{\"type\":\"@Class\",\"fixedId\":true,\"id\":\"\",\"name\":"
6164 "\"Null\",\"location\":{\"type\":\"SourceLocation\",\"script\":{"
6165 "\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\",\"uri\":\"dart:"
6166 "core\\/"
6167 "null.dart\",\"_kind\":\"kernel\"}},"
6168 "\"library\":{\"type\":\"@Library\",\"fixedId\":true,\"id\":\"\","
6169 "\"name\":\"dart.core\",\"uri\":\"dart:core\"}},\"kind\":\"Null\","
6170 "\"fixedId\":true,\"id\":\"\",\"valueAsString\":\"null\"}}]},"
6171 "\"identityHashCode\":0,\"id\":\"\",\"kind\":\"List\",\"length\":0}",
6172 buffer);
6173 }
6174 OS::PrintErr("\n\n\n");
6175 // GrowableObjectArray reference
6176 {
6177 JSONStream js;
6178 const GrowableObjectArray& array =
6179 GrowableObjectArray::Handle(GrowableObjectArray::New());
6180 array.PrintJSON(&js, true);
6181 const char* json_str = js.ToCString();
6182 ASSERT(strlen(json_str) < kBufferSize);
6183 ElideJSONSubstring("classes", json_str, buffer);
6184 ElideJSONSubstring("objects", buffer, buffer);
6185 ElideJSONSubstring("libraries", buffer, buffer);
6186 ElideJSONSubstring("_GrowableList@", buffer, buffer);
6188 ElideJSONSubstring("_TypeParameter@", buffer, buffer);
6189 EXPECT_SUBSTRING(
6190 "{\"type\":\"@Instance\",\"_vmType\":\"GrowableObjectArray\",\"class\":"
6191 "{\"type\":\"@Class\",\"fixedId\":true,\"id\":\"\",\"name\":\"_"
6192 "GrowableList\",\"_vmName\":\"\",\"location\":{\"type\":"
6193 "\"SourceLocation\",\"script\":{\"type\":\"@Script\",\"fixedId\":true,"
6194 "\"id\":\"\",\"uri\":\"dart:core-patch\\/"
6195 "growable_array.dart\",\"_kind\":\"kernel\"}"
6196 "},\"library\":{\"type\":\"@Library\",\"fixedId\":"
6197 "true,\"id\":\"\",\"name\":\"dart.core\",\"uri\":\"dart:core\"},"
6198 "\"typeParameters\":[{\"type\":\"@Instance\",\"_vmType\":"
6199 "\"TypeParameter\",\"class\":{\"type\":\"@Class\",\"fixedId\":true,"
6200 "\"id\":\"\",\"name\":\"_TypeParameter\",\"_vmName\":\""
6201 "\",\"location\":{\"type\":\"SourceLocation\",\"script\":{"
6202 "\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\",\"uri\":\"dart:core-"
6203 "patch\\/"
6204 "type_patch.dart\",\"_kind\":\"kernel\"}"
6205 "},\"library\":{\"type\":\"@Library\",\"fixedId\":"
6206 "true,\"id\":\"\",\"name\":\"dart.core\",\"uri\":\"dart:core\"}},"
6207 "\"identityHashCode\":",
6208 buffer);
6209
6210 EXPECT_SUBSTRING(
6211 "\"id\":\"\",\"kind\":\"TypeParameter\",\"name\":\"X0\","
6212 "\"parameterizedClass\":{\"type\":\"@Instance\","
6213 "\"_vmType\":\"Class\",\"class\":{\"type\":\"@Class\",\"fixedId\":true,"
6214 "\"id\":\"\",\"name\":\"Null\",\"location\":{\"type\":"
6215 "\"SourceLocation\",\"script\":{\"type\":\"@Script\",\"fixedId\":true,"
6216 "\"id\":\"\",\"uri\":\"dart:core\\/"
6217 "null.dart\",\"_kind\":\"kernel\"}"
6218 "},\"library\":{\"type\":\"@Library\",\"fixedId\":true,\"id\":\"\","
6219 "\"name\":\"dart.core\",\"uri\":\"dart:core\"}},\"kind\":\"Null\","
6220 "\"fixedId\":true,\"id\":\"\",\"valueAsString\":\"null\"}}]},"
6221 "\"identityHashCode\":0,\"id\":\"\",\"kind\":\"List\",\"length\":0}",
6222 buffer);
6223 }
6224 // Map reference
6225 {
6226 JSONStream js;
6227 const Map& array = Map::Handle(Map::NewDefault());
6228 array.PrintJSON(&js, true);
6229 const char* json_str = js.ToCString();
6230 ASSERT(strlen(json_str) < kBufferSize);
6231 ElideJSONSubstring("classes", json_str, buffer);
6232 ElideJSONSubstring("objects", buffer, buffer);
6233 ElideJSONSubstring("libraries", buffer, buffer);
6234 ElideJSONSubstring("_Map@", buffer, buffer);
6236 ElideJSONSubstring("_TypeParameter@", buffer, buffer);
6237 EXPECT_SUBSTRING(
6238 "{\"type\":\"@Instance\",\"_vmType\":\"Map\",\"class\":{"
6239 "\"type\":\"@Class\",\"fixedId\":true,\"id\":\"\",\"name\":\"_"
6240 "Map\",\"_vmName\":\"\",\"location\":{\"type\":"
6241 "\"SourceLocation\",\"script\":{\"type\":\"@Script\",\"fixedId\":true,"
6242 "\"id\":\"\",\"uri\":\"dart:collection-patch\\/"
6243 "compact_hash.dart\",\"_kind\":\"kernel\"}"
6244 "},\"library\":{\"type\":\"@Library\",\"fixedId\":"
6245 "true,\"id\":\"\",\"name\":\"dart.collection\",\"uri\":\"dart:"
6246 "collection\"},\"typeParameters\":[{\"type\":\"@Instance\",\"_vmType\":"
6247 "\"TypeParameter\",\"class\":{\"type\":\"@Class\",\"fixedId\":true,"
6248 "\"id\":\"\",\"name\":\"_TypeParameter\",\"_vmName\":\""
6249 "\",\"location\":{\"type\":\"SourceLocation\",\"script\":{"
6250 "\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\",\"uri\":\"dart:core-"
6251 "patch\\/"
6252 "type_patch.dart\",\"_kind\":\"kernel\"}"
6253 "},\"library\":{\"type\":\"@Library\",\"fixedId\":"
6254 "true,\"id\":\"\",\"name\":\"dart.core\",\"uri\":\"dart:core\"}},"
6255 "\"identityHashCode\":",
6256 buffer);
6257
6258 EXPECT_SUBSTRING(
6259 "\"id\":\"\",\"kind\":\"TypeParameter\",\"name\":\"X0\","
6260 "\"parameterizedClass\":{\"type\":\"@Instance\","
6261 "\"_vmType\":\"Class\",\"class\":{\"type\":\"@Class\",\"fixedId\":true,"
6262 "\"id\":\"\",\"name\":\"Null\",\"location\":{\"type\":"
6263 "\"SourceLocation\",\"script\":{\"type\":\"@Script\",\"fixedId\":true,"
6264 "\"id\":\"\",\"uri\":\"dart:core\\/"
6265 "null.dart\",\"_kind\":\"kernel\"}"
6266 "},\"library\":{\"type\":\"@Library\",\"fixedId\":true,\"id\":\"\","
6267 "\"name\":\"dart.core\",\"uri\":\"dart:core\"}},\"kind\":\"Null\","
6268 "\"fixedId\":true,\"id\":\"\",\"valueAsString\":\"null\"}},{\"type\":"
6269 "\"@Instance\",\"_vmType\":\"TypeParameter\",\"class\":{\"type\":\"@"
6270 "Class\",\"fixedId\":true,\"id\":\"\",\"name\":\"_TypeParameter\",\"_"
6271 "vmName\":\"\",\"location\":{\"type\":"
6272 "\"SourceLocation\",\"script\":{\"type\":\"@Script\",\"fixedId\":true,"
6273 "\"id\":\"\",\"uri\":\"dart:core-patch\\/"
6274 "type_patch.dart\",\"_kind\":\"kernel\"}"
6275 "},\"library\":{\"type\":\"@Library\",\"fixedId\":"
6276 "true,\"id\":\"\",\"name\":\"dart.core\",\"uri\":\"dart:core\"}},"
6277 "\"identityHashCode\":",
6278 buffer);
6279
6280 EXPECT_SUBSTRING(
6281 "\"id\":\"\",\"kind\":\"TypeParameter\",\"name\":\"X1\","
6282 "\"parameterizedClass\":{\"type\":\"@Instance\","
6283 "\"_vmType\":\"Class\",\"class\":{\"type\":\"@Class\",\"fixedId\":true,"
6284 "\"id\":\"\",\"name\":\"Null\",\"location\":{\"type\":"
6285 "\"SourceLocation\",\"script\":{\"type\":\"@Script\",\"fixedId\":true,"
6286 "\"id\":\"\",\"uri\":\"dart:core\\/"
6287 "null.dart\",\"_kind\":\"kernel\"}"
6288 "},\"library\":{\"type\":\"@Library\",\"fixedId\":true,\"id\":\"\","
6289 "\"name\":\"dart.core\",\"uri\":\"dart:core\"}},\"kind\":\"Null\","
6290 "\"fixedId\":true,\"id\":\"\",\"valueAsString\":\"null\"}}]},"
6291 "\"identityHashCode\":0,\"id\":\"\",\"kind\":\"Map\",\"length\":0}",
6292 buffer);
6293 }
6294 // UserTag reference
6295 {
6296 JSONStream js;
6297 Instance& tag = Instance::Handle(isolate->default_tag());
6298 tag.PrintJSON(&js, true);
6299 const char* json_str = js.ToCString();
6300 ASSERT(strlen(json_str) < kBufferSize);
6301 ElideJSONSubstring("classes", json_str, buffer);
6302 ElideJSONSubstring("objects", buffer, buffer);
6303 ElideJSONSubstring("libraries", buffer, buffer);
6304 ElideJSONSubstring("_UserTag@", buffer, buffer);
6306 EXPECT_SUBSTRING(
6307 "\"type\":\"@Instance\",\"_vmType\":\"UserTag\",\"class\":{\"type\":\"@"
6308 "Class\",\"fixedId\":true,\"id\":\"\",\"name\":\"_UserTag\",\"_"
6309 "vmName\":\"\",\"location\":{\"type\":\"SourceLocation\",\"script\":{"
6310 "\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\",\"uri\":\"dart:"
6311 "developer-patch\\/"
6312 "profiler.dart\",\"_kind\":\"kernel\"}},\"library\":{\"type\":\"@"
6313 "Library\","
6314 "\"fixedId\":true,\"id\":\"\",\"name\":\"dart.developer\",\"uri\":"
6315 "\"dart:developer\"}},"
6316 // Handle non-zero identity hash.
6317 "\"identityHashCode\":",
6318 buffer);
6319 EXPECT_SUBSTRING(
6320 "\"id\":\"\","
6321 "\"kind\":\"UserTag\",\"label\":\"Default\"}",
6322 buffer);
6323 }
6324 // Type reference
6325 // TODO(turnidge): Add in all of the other Type siblings.
6326 {
6327 JSONStream js;
6328 Instance& type =
6329 Instance::Handle(isolate->group()->object_store()->bool_type());
6330 type.PrintJSON(&js, true);
6331 const char* json_str = js.ToCString();
6332 ASSERT(strlen(json_str) < kBufferSize);
6333 ElideJSONSubstring("classes", json_str, buffer);
6334 ElideJSONSubstring("objects", buffer, buffer);
6335 ElideJSONSubstring("libraries", buffer, buffer);
6336 ElideJSONSubstring("_Type@", buffer, buffer);
6338 EXPECT_SUBSTRING(
6339 "{\"type\":\"@Instance\",\"_vmType\":\"Type\",\"class\":{\"type\":\"@"
6340 "Class\",\"fixedId\":true,\"id\":\"\",\"name\":\"_Type\",\"_vmName\":"
6341 "\"\",\"location\":{\"type\":\"SourceLocation\",\"script\":{\"type\":"
6342 "\"@Script\",\"fixedId\":true,\"id\":\"\",\"uri\":\"dart:core-"
6343 "patch\\/type_patch.dart\",\"_kind\":\"kernel\"}"
6344 "},\"library\":{\"type\":\"@Library\",\"fixedId\":"
6345 "true,\"id\":\"\",\"name\":\"dart.core\",\"uri\":\"dart:core\"}},"
6346 // Handle non-zero identity hash.
6347 "\"identityHashCode\":",
6348 buffer);
6349 EXPECT_SUBSTRING(
6350 "\"kind\":\"Type\","
6351 "\"fixedId\":true,\"id\":\"\","
6352 "\"typeClass\":{\"type\":\"@Class\",\"fixedId\":true,\"id\":\"\","
6353 "\"name\":\"bool\",\"location\":{\"type\":\"SourceLocation\","
6354 "\"script\":{\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\",\"uri\":"
6355 "\"dart:core\\/bool.dart\",\"_kind\":\"kernel\"}"
6356 "},\"library\":{\"type\":\"@Library\",\"fixedId\":"
6357 "true,\"id\":\"\",\"name\":\"dart.core\",\"uri\":\"dart:core\"}},"
6358 "\"name\":\"bool\"}",
6359 buffer);
6360 }
6361 // Null reference
6362 {
6363 JSONStream js;
6364 Object::null_object().PrintJSON(&js, true);
6365 const char* json_str = js.ToCString();
6366 ASSERT(strlen(json_str) < kBufferSize);
6367 ElideJSONSubstring("classes", json_str, buffer);
6368 ElideJSONSubstring("libraries", buffer, buffer);
6370 EXPECT_STREQ(
6371 "{\"type\":\"@Instance\",\"_vmType\":\"null\",\"class\":{\"type\":\"@"
6372 "Class\",\"fixedId\":true,\"id\":\"\",\"name\":\"Null\",\"location\":{"
6373 "\"type\":\"SourceLocation\",\"script\":{\"type\":\"@Script\","
6374 "\"fixedId\":true,\"id\":\"\",\"uri\":\"dart:core\\/null.dart\",\"_"
6375 "kind\":\"kernel\"}},\"library\":"
6376 "{\"type\":\"@Library\",\"fixedId\":true,\"id\":\"\",\"name\":\"dart."
6377 "core\",\"uri\":\"dart:core\"}},\"kind\":\"Null\",\"fixedId\":true,"
6378 "\"id\":\"objects\\/null\",\"valueAsString\":\"null\"}",
6379 buffer);
6380 }
6381 // Sentinel reference
6382 {
6383 JSONStream js;
6384 Object::sentinel().PrintJSON(&js, true);
6385 EXPECT_STREQ(
6386 "{\"type\":\"Sentinel\","
6387 "\"kind\":\"NotInitialized\","
6388 "\"valueAsString\":\"<not initialized>\"}",
6389 js.ToCString());
6390 }
void ElideJSONSubstring(const char *prefix, const char *in, char *out, const char *postfix)
Definition unit_test.cc:776
void StripTokenPositions(char *buffer)
Definition unit_test.cc:799

◆ ISOLATE_UNIT_TEST_CASE() [249/463]

dart::ISOLATE_UNIT_TEST_CASE ( Profiler_ArrayAllocation  )

Definition at line 835 of file profiler_test.cc.

835 {
839 const char* kScript =
840 "List foo() => List.filled(4, null);\n"
841 "List bar() => List.filled(0, null, growable: true);\n";
842 const Library& root_library = Library::Handle(LoadTestScript(kScript));
843 Isolate* isolate = thread->isolate();
844
845 const Class& array_class =
846 Class::Handle(isolate->group()->object_store()->array_class());
847 EXPECT(!array_class.IsNull());
848
849 Invoke(root_library, "foo");
850
851 {
852 StackZone zone(thread);
853 Profile profile;
854 AllocationFilter filter(isolate->main_port(), array_class.id());
855 profile.Build(thread, isolate, &filter, Profiler::sample_block_buffer());
856 // We should have no allocation samples.
857 EXPECT_EQ(0, profile.sample_count());
858 }
859
860 array_class.SetTraceAllocation(true);
861 Invoke(root_library, "foo");
862
863 {
864 StackZone zone(thread);
865 Profile profile;
866 AllocationFilter filter(isolate->main_port(), array_class.id());
867 profile.Build(thread, isolate, &filter, Profiler::sample_block_buffer());
868 // We should have one allocation sample.
869 EXPECT_EQ(1, profile.sample_count());
870 ProfileStackWalker walker(&profile);
871
872 EXPECT_STREQ("DRT_AllocateArray", walker.VMTagName());
873 EXPECT_STREQ("[Stub] AllocateArray", walker.CurrentName());
874 EXPECT(walker.Down());
875 EXPECT_STREQ("[Unoptimized] new _List", walker.CurrentName());
876 EXPECT(walker.Down());
877 EXPECT_STREQ("[Unoptimized] foo", walker.CurrentName());
878 EXPECT(!walker.Down());
879 }
880
881 array_class.SetTraceAllocation(false);
882 Invoke(root_library, "foo");
883
884 {
885 StackZone zone(thread);
886 Profile profile;
887 AllocationFilter filter(isolate->main_port(), array_class.id());
888 profile.Build(thread, isolate, &filter, Profiler::sample_block_buffer());
889 // We should still only have one allocation sample.
890 EXPECT_EQ(1, profile.sample_count());
891 }
892
893 // Clear the samples.
894 ProfilerService::ClearSamples();
895
896 // Compile bar (many List objects allocated).
897 Invoke(root_library, "bar");
898
899 // Enable again.
900 array_class.SetTraceAllocation(true);
901
902 // Run bar.
903 Invoke(root_library, "bar");
904
905 {
906 StackZone zone(thread);
907 Profile profile;
908 AllocationFilter filter(isolate->main_port(), array_class.id());
909 profile.Build(thread, isolate, &filter, Profiler::sample_block_buffer());
910 // We should have no allocation samples, since empty
911 // growable lists use a shared backing.
912 EXPECT_EQ(0, profile.sample_count());
913 }
914}
void SetTraceAllocation(bool trace_allocation) const
Definition object.cc:4498
static void EnableProfiler()

◆ ISOLATE_UNIT_TEST_CASE() [250/463]

dart::ISOLATE_UNIT_TEST_CASE ( Profiler_BasicSourcePosition  )

Definition at line 1606 of file profiler_test.cc.

1606 {
1610 const char* kScript =
1611 "class A {\n"
1612 " var a;\n"
1613 " var b;\n"
1614 " @pragma('vm:never-inline') A() { }\n"
1615 "}\n"
1616 "class B {\n"
1617 " @pragma('vm:prefer-inline')\n"
1618 " static boo() {\n"
1619 " return new A();\n"
1620 " }\n"
1621 "}\n"
1622 "main() {\n"
1623 " B.boo();\n"
1624 "}\n";
1625
1626 const Library& root_library = Library::Handle(LoadTestScript(kScript));
1627
1628 const Class& class_a = Class::Handle(GetClass(root_library, "A"));
1629 EXPECT(!class_a.IsNull());
1630
1631 Invoke(root_library, "main");
1632
1633 // Turn on allocation tracing for A.
1634 class_a.SetTraceAllocation(true);
1635
1636 // Allocate one time.
1637 Invoke(root_library, "main");
1638
1639 {
1640 Thread* thread = Thread::Current();
1641 Isolate* isolate = thread->isolate();
1642 StackZone zone(thread);
1643 Profile profile;
1644 AllocationFilter filter(isolate->main_port(), class_a.id());
1645 profile.Build(thread, isolate, &filter, Profiler::sample_block_buffer());
1646 // We should have one allocation samples.
1647 EXPECT_EQ(1, profile.sample_count());
1648 ProfileStackWalker walker(&profile, true);
1649
1650 EXPECT_STREQ("DRT_AllocateObject", walker.VMTagName());
1651#if defined(TARGET_ARCH_IA32) // Alloc. stub not impl. for ia32.
1652 EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
1653#else
1654 EXPECT_STREQ("[Stub] AllocateObjectSlow", walker.CurrentName());
1655#endif
1656 EXPECT_EQ(1, walker.CurrentExclusiveTicks());
1657 EXPECT(walker.Down());
1658 EXPECT_STREQ("B.boo", walker.CurrentName());
1659 EXPECT_EQ(1, walker.CurrentInclusiveTicks());
1660 EXPECT_STREQ("A", walker.CurrentToken());
1661 EXPECT(walker.Down());
1662 EXPECT_STREQ("main", walker.CurrentName());
1663 EXPECT_EQ(1, walker.CurrentInclusiveTicks());
1664 EXPECT_EQ(0, walker.CurrentExclusiveTicks());
1665 EXPECT_STREQ("boo", walker.CurrentToken());
1666 EXPECT(!walker.Down());
1667 }
1668}
ClassPtr GetClass(const Library &lib, const char *name)

◆ ISOLATE_UNIT_TEST_CASE() [251/463]

dart::ISOLATE_UNIT_TEST_CASE ( Profiler_BasicSourcePositionOptimized  )

Definition at line 1670 of file profiler_test.cc.

1670 {
1674 const char* kScript =
1675 "class A {\n"
1676 " var a;\n"
1677 " var b;\n"
1678 " @pragma('vm:never-inline') A() { }\n"
1679 "}\n"
1680 "class B {\n"
1681 " @pragma('vm:prefer-inline')\n"
1682 " static boo() {\n"
1683 " return new A();\n"
1684 " }\n"
1685 "}\n"
1686 "main() {\n"
1687 " B.boo();\n"
1688 "}\n";
1689
1690 const Library& root_library = Library::Handle(LoadTestScript(kScript));
1691
1692 const Class& class_a = Class::Handle(GetClass(root_library, "A"));
1693 EXPECT(!class_a.IsNull());
1694
1695 const Function& main = Function::Handle(GetFunction(root_library, "main"));
1696 EXPECT(!main.IsNull());
1697
1698 // Optimize quickly.
1699 SetFlagScope<int> sfs(&FLAG_optimization_counter_threshold, 5);
1700 // Warm up function.
1701 while (true) {
1702 Invoke(root_library, "main");
1703 const Code& code = Code::Handle(main.CurrentCode());
1704 if (code.is_optimized()) {
1705 // Warmed up.
1706 break;
1707 }
1708 }
1709
1710 // Turn on allocation tracing for A.
1711 class_a.SetTraceAllocation(true);
1712
1713 // Allocate one time.
1714 Invoke(root_library, "main");
1715
1716 // Still optimized.
1717 const Code& code = Code::Handle(main.CurrentCode());
1718 EXPECT(code.is_optimized());
1719
1720 {
1721 Thread* thread = Thread::Current();
1722 Isolate* isolate = thread->isolate();
1723 StackZone zone(thread);
1724 Profile profile;
1725 AllocationFilter filter(isolate->main_port(), class_a.id());
1726 profile.Build(thread, isolate, &filter, Profiler::sample_block_buffer());
1727 // We should have one allocation samples.
1728 EXPECT_EQ(1, profile.sample_count());
1729 ProfileStackWalker walker(&profile, true);
1730
1731 // Move down from the root.
1732 EXPECT_STREQ("DRT_AllocateObject", walker.VMTagName());
1733#if defined(TARGET_ARCH_IA32) // Alloc. stub not impl. for ia32.
1734 EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
1735#else
1736 EXPECT_STREQ("[Stub] AllocateObjectSlow", walker.CurrentName());
1737#endif
1738 EXPECT_EQ(1, walker.CurrentExclusiveTicks());
1739 EXPECT(walker.Down());
1740 EXPECT_STREQ("B.boo", walker.CurrentName());
1741 EXPECT_EQ(1, walker.CurrentInclusiveTicks());
1742 EXPECT_STREQ("A", walker.CurrentToken());
1743 EXPECT(walker.Down());
1744 EXPECT_STREQ("main", walker.CurrentName());
1745 EXPECT_EQ(1, walker.CurrentInclusiveTicks());
1746 EXPECT_EQ(0, walker.CurrentExclusiveTicks());
1747 EXPECT_STREQ("boo", walker.CurrentToken());
1748 EXPECT(!walker.Down());
1749 }
1750}

◆ ISOLATE_UNIT_TEST_CASE() [252/463]

dart::ISOLATE_UNIT_TEST_CASE ( Profiler_BinaryOperatorSourcePosition  )

Definition at line 1951 of file profiler_test.cc.

1951 {
1955 const char* kScript =
1956 "class A {\n"
1957 " var a;\n"
1958 " var b;\n"
1959 " @pragma('vm:never-inline') A() { }\n"
1960 "}\n"
1961 "class B {\n"
1962 " @pragma('vm:never-inline')\n"
1963 " static oats() {\n"
1964 " return boo();\n"
1965 " }\n"
1966 " @pragma('vm:prefer-inline')\n"
1967 " static boo() {\n"
1968 " return new A();\n"
1969 " }\n"
1970 "}\n"
1971 "class C {\n"
1972 " @pragma('vm:never-inline') bacon() {\n"
1973 " return this + this;\n"
1974 " }\n"
1975 " @pragma('vm:prefer-inline') operator+(C other) {\n"
1976 " return fox();\n"
1977 " }\n"
1978 " @pragma('vm:prefer-inline') fox() {\n"
1979 " return B.oats();\n"
1980 " }\n"
1981 "}\n"
1982 "main() {\n"
1983 " new C()..bacon();\n"
1984 "}\n";
1985
1986 const Library& root_library = Library::Handle(LoadTestScript(kScript));
1987
1988 const Class& class_a = Class::Handle(GetClass(root_library, "A"));
1989 EXPECT(!class_a.IsNull());
1990
1991 Invoke(root_library, "main");
1992
1993 // Turn on allocation tracing for A.
1994 class_a.SetTraceAllocation(true);
1995
1996 // Allocate one time.
1997 Invoke(root_library, "main");
1998
1999 {
2000 Thread* thread = Thread::Current();
2001 Isolate* isolate = thread->isolate();
2002 StackZone zone(thread);
2003 Profile profile;
2004 AllocationFilter filter(isolate->main_port(), class_a.id());
2005 profile.Build(thread, isolate, &filter, Profiler::sample_block_buffer());
2006 // We should have one allocation samples.
2007 EXPECT_EQ(1, profile.sample_count());
2008 ProfileStackWalker walker(&profile, true);
2009
2010 EXPECT_STREQ("DRT_AllocateObject", walker.VMTagName());
2011#if defined(TARGET_ARCH_IA32) // Alloc. stub not impl. for ia32.
2012 EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
2013#else
2014 EXPECT_STREQ("[Stub] AllocateObjectSlow", walker.CurrentName());
2015#endif
2016 EXPECT_EQ(1, walker.CurrentExclusiveTicks());
2017 EXPECT(walker.Down());
2018 EXPECT_STREQ("B.boo", walker.CurrentName());
2019 EXPECT_EQ(1, walker.CurrentInclusiveTicks());
2020 EXPECT_STREQ("A", walker.CurrentToken());
2021 EXPECT(walker.Down());
2022 EXPECT_STREQ("B.oats", walker.CurrentName());
2023 EXPECT_EQ(1, walker.CurrentInclusiveTicks());
2024 EXPECT_EQ(0, walker.CurrentExclusiveTicks());
2025 EXPECT_STREQ("boo", walker.CurrentToken());
2026 EXPECT(walker.Down());
2027 EXPECT_STREQ("C.fox", walker.CurrentName());
2028 EXPECT_EQ(1, walker.CurrentInclusiveTicks());
2029 EXPECT_EQ(0, walker.CurrentExclusiveTicks());
2030 EXPECT_STREQ("oats", walker.CurrentToken());
2031 EXPECT(walker.Down());
2032 EXPECT_STREQ("C.+", walker.CurrentName());
2033 EXPECT_EQ(1, walker.CurrentInclusiveTicks());
2034 EXPECT_EQ(0, walker.CurrentExclusiveTicks());
2035 EXPECT_STREQ("fox", walker.CurrentToken());
2036 EXPECT(walker.Down());
2037 EXPECT_STREQ("C.bacon", walker.CurrentName());
2038 EXPECT_EQ(1, walker.CurrentInclusiveTicks());
2039 EXPECT_EQ(0, walker.CurrentExclusiveTicks());
2040 EXPECT_STREQ("+", walker.CurrentToken());
2041 EXPECT(walker.Down());
2042 EXPECT_STREQ("main", walker.CurrentName());
2043 EXPECT_EQ(1, walker.CurrentInclusiveTicks());
2044 EXPECT_EQ(0, walker.CurrentExclusiveTicks());
2045 EXPECT_STREQ("bacon", walker.CurrentToken());
2046 EXPECT(!walker.Down());
2047 }
2048}

◆ ISOLATE_UNIT_TEST_CASE() [253/463]

dart::ISOLATE_UNIT_TEST_CASE ( Profiler_BinaryOperatorSourcePositionOptimized  )

Definition at line 2050 of file profiler_test.cc.

2050 {
2054
2055 const char* kScript =
2056 "class A {\n"
2057 " var a;\n"
2058 " var b;\n"
2059 " @pragma('vm:never-inline') A() { }\n"
2060 "}\n"
2061 "class B {\n"
2062 " @pragma('vm:never-inline')\n"
2063 " static oats() {\n"
2064 " return boo();\n"
2065 " }\n"
2066 " @pragma('vm:prefer-inline')\n"
2067 " static boo() {\n"
2068 " return new A();\n"
2069 " }\n"
2070 "}\n"
2071 "class C {\n"
2072 " @pragma('vm:never-inline') bacon() {\n"
2073 " return this + this;\n"
2074 " }\n"
2075 " @pragma('vm:prefer-inline') operator+(C other) {\n"
2076 " return fox();\n"
2077 " }\n"
2078 " @pragma('vm:prefer-inline') fox() {\n"
2079 " return B.oats();\n"
2080 " }\n"
2081 "}\n"
2082 "main() {\n"
2083 " new C()..bacon();\n"
2084 "}\n";
2085
2086 const Library& root_library = Library::Handle(LoadTestScript(kScript));
2087
2088 const Class& class_a = Class::Handle(GetClass(root_library, "A"));
2089 EXPECT(!class_a.IsNull());
2090
2091 const Function& main = Function::Handle(GetFunction(root_library, "main"));
2092 EXPECT(!main.IsNull());
2093
2094 // Optimize quickly.
2095 SetFlagScope<int> sfs(&FLAG_optimization_counter_threshold, 5);
2096 // Warm up function.
2097 while (true) {
2098 Invoke(root_library, "main");
2099 const Code& code = Code::Handle(main.CurrentCode());
2100 if (code.is_optimized()) {
2101 // Warmed up.
2102 break;
2103 }
2104 }
2105
2106 // Turn on allocation tracing for A.
2107 class_a.SetTraceAllocation(true);
2108
2109 // Allocate one time.
2110 Invoke(root_library, "main");
2111
2112 // Still optimized.
2113 const Code& code = Code::Handle(main.CurrentCode());
2114 EXPECT(code.is_optimized());
2115
2116 {
2117 Thread* thread = Thread::Current();
2118 Isolate* isolate = thread->isolate();
2119 StackZone zone(thread);
2120 Profile profile;
2121 AllocationFilter filter(isolate->main_port(), class_a.id());
2122 profile.Build(thread, isolate, &filter, Profiler::sample_block_buffer());
2123 // We should have one allocation samples.
2124 EXPECT_EQ(1, profile.sample_count());
2125 ProfileStackWalker walker(&profile, true);
2126
2127 EXPECT_STREQ("DRT_AllocateObject", walker.VMTagName());
2128#if defined(TARGET_ARCH_IA32) // Alloc. stub not impl. for ia32.
2129 EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
2130#else
2131 EXPECT_STREQ("[Stub] AllocateObjectSlow", walker.CurrentName());
2132#endif
2133 EXPECT_EQ(1, walker.CurrentExclusiveTicks());
2134 EXPECT(walker.Down());
2135 EXPECT_STREQ("B.boo", walker.CurrentName());
2136 EXPECT_EQ(1, walker.CurrentInclusiveTicks());
2137 EXPECT_STREQ("A", walker.CurrentToken());
2138 EXPECT(walker.Down());
2139 EXPECT_STREQ("B.oats", walker.CurrentName());
2140 EXPECT_EQ(1, walker.CurrentInclusiveTicks());
2141 EXPECT_EQ(0, walker.CurrentExclusiveTicks());
2142 EXPECT_STREQ("boo", walker.CurrentToken());
2143 EXPECT(walker.Down());
2144 EXPECT_STREQ("C.fox", walker.CurrentName());
2145 EXPECT_EQ(1, walker.CurrentInclusiveTicks());
2146 EXPECT_EQ(0, walker.CurrentExclusiveTicks());
2147 EXPECT_STREQ("oats", walker.CurrentToken());
2148 EXPECT(walker.Down());
2149 EXPECT_STREQ("C.+", walker.CurrentName());
2150 EXPECT_EQ(1, walker.CurrentInclusiveTicks());
2151 EXPECT_EQ(0, walker.CurrentExclusiveTicks());
2152 EXPECT_STREQ("fox", walker.CurrentToken());
2153 EXPECT(walker.Down());
2154 EXPECT_STREQ("C.bacon", walker.CurrentName());
2155 EXPECT_EQ(1, walker.CurrentInclusiveTicks());
2156 EXPECT_EQ(0, walker.CurrentExclusiveTicks());
2157 EXPECT_STREQ("+", walker.CurrentToken());
2158 EXPECT(walker.Down());
2159 EXPECT_STREQ("main", walker.CurrentName());
2160 EXPECT_EQ(1, walker.CurrentInclusiveTicks());
2161 EXPECT_EQ(0, walker.CurrentExclusiveTicks());
2162 EXPECT_STREQ("bacon", walker.CurrentToken());
2163 EXPECT(!walker.Down());
2164 }
2165}

◆ ISOLATE_UNIT_TEST_CASE() [254/463]

dart::ISOLATE_UNIT_TEST_CASE ( Profiler_ChainedSamples  )

Definition at line 1498 of file profiler_test.cc.

1498 {
1500 MaxProfileDepthScope mpds(32);
1502
1503 // Each sample holds 8 stack frames.
1504 // This chain is 20 stack frames deep.
1505 const char* kScript =
1506 "class A {\n"
1507 " var a;\n"
1508 " var b;\n"
1509 "}\n"
1510 "class B {\n"
1511 " static boo() {\n"
1512 " return new A();\n"
1513 " }\n"
1514 "}\n"
1515 "go() => init();\n"
1516 "init() => secondInit();\n"
1517 "secondInit() => apple();\n"
1518 "apple() => banana();\n"
1519 "banana() => cantaloupe();\n"
1520 "cantaloupe() => dog();\n"
1521 "dog() => elephant();\n"
1522 "elephant() => fred();\n"
1523 "fred() => granola();\n"
1524 "granola() => haystack();\n"
1525 "haystack() => ice();\n"
1526 "ice() => jeep();\n"
1527 "jeep() => kindle();\n"
1528 "kindle() => lemon();\n"
1529 "lemon() => mayo();\n"
1530 "mayo() => napkin();\n"
1531 "napkin() => orange();\n"
1532 "orange() => B.boo();\n"
1533 "main() {\n"
1534 " return go();\n"
1535 "}\n";
1536
1537 const Library& root_library = Library::Handle(LoadTestScript(kScript));
1538
1539 const Class& class_a = Class::Handle(GetClass(root_library, "A"));
1540 EXPECT(!class_a.IsNull());
1541 class_a.SetTraceAllocation(true);
1542
1543 Invoke(root_library, "main");
1544
1545 {
1546 Thread* thread = Thread::Current();
1547 Isolate* isolate = thread->isolate();
1548 StackZone zone(thread);
1549 Profile profile;
1550 AllocationFilter filter(isolate->main_port(), class_a.id());
1551 profile.Build(thread, isolate, &filter, Profiler::sample_block_buffer());
1552 // We should have 1 allocation sample.
1553 EXPECT_EQ(1, profile.sample_count());
1554 ProfileStackWalker walker(&profile);
1555
1556 EXPECT_STREQ("DRT_AllocateObject", walker.VMTagName());
1557#if defined(TARGET_ARCH_IA32) // Alloc. stub not impl. for ia32.
1558 EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
1559#else
1560 EXPECT_STREQ("[Stub] AllocateObjectSlow", walker.CurrentName());
1561#endif
1562 EXPECT(walker.Down());
1563 EXPECT_STREQ("[Unoptimized] B.boo", walker.CurrentName());
1564 EXPECT(walker.Down());
1565 EXPECT_STREQ("[Unoptimized] orange", walker.CurrentName());
1566 EXPECT(walker.Down());
1567 EXPECT_STREQ("[Unoptimized] napkin", walker.CurrentName());
1568 EXPECT(walker.Down());
1569 EXPECT_STREQ("[Unoptimized] mayo", walker.CurrentName());
1570 EXPECT(walker.Down());
1571 EXPECT_STREQ("[Unoptimized] lemon", walker.CurrentName());
1572 EXPECT(walker.Down());
1573 EXPECT_STREQ("[Unoptimized] kindle", walker.CurrentName());
1574 EXPECT(walker.Down());
1575 EXPECT_STREQ("[Unoptimized] jeep", walker.CurrentName());
1576 EXPECT(walker.Down());
1577 EXPECT_STREQ("[Unoptimized] ice", walker.CurrentName());
1578 EXPECT(walker.Down());
1579 EXPECT_STREQ("[Unoptimized] haystack", walker.CurrentName());
1580 EXPECT(walker.Down());
1581 EXPECT_STREQ("[Unoptimized] granola", walker.CurrentName());
1582 EXPECT(walker.Down());
1583 EXPECT_STREQ("[Unoptimized] fred", walker.CurrentName());
1584 EXPECT(walker.Down());
1585 EXPECT_STREQ("[Unoptimized] elephant", walker.CurrentName());
1586 EXPECT(walker.Down());
1587 EXPECT_STREQ("[Unoptimized] dog", walker.CurrentName());
1588 EXPECT(walker.Down());
1589 EXPECT_STREQ("[Unoptimized] cantaloupe", walker.CurrentName());
1590 EXPECT(walker.Down());
1591 EXPECT_STREQ("[Unoptimized] banana", walker.CurrentName());
1592 EXPECT(walker.Down());
1593 EXPECT_STREQ("[Unoptimized] apple", walker.CurrentName());
1594 EXPECT(walker.Down());
1595 EXPECT_STREQ("[Unoptimized] secondInit", walker.CurrentName());
1596 EXPECT(walker.Down());
1597 EXPECT_STREQ("[Unoptimized] init", walker.CurrentName());
1598 EXPECT(walker.Down());
1599 EXPECT_STREQ("[Unoptimized] go", walker.CurrentName());
1600 EXPECT(walker.Down());
1601 EXPECT_STREQ("[Unoptimized] main", walker.CurrentName());
1602 EXPECT(!walker.Down());
1603 }
1604}

◆ ISOLATE_UNIT_TEST_CASE() [255/463]

dart::ISOLATE_UNIT_TEST_CASE ( Profiler_ClosureAllocation  )

Definition at line 975 of file profiler_test.cc.

975 {
979 const char* kScript =
980 "var msg1 = 'a';\n"
981 "\n"
982 "foo() {\n"
983 " var msg = msg1 + msg1;\n"
984 " var msg2 = msg + msg;\n"
985 " return (x, y, z, w) { return '$x + $y + $z'; }(msg, msg2, msg, msg);\n"
986 "}\n"
987 "bar() {\n"
988 " var msg = msg1 + msg1;\n"
989 " var msg2 = msg + msg;\n"
990 " return (x, y) { return '$x + $y'; }(msg, msg2);\n"
991 "}\n";
992
993 const Library& root_library = Library::Handle(LoadTestScript(kScript));
994 Isolate* isolate = thread->isolate();
995
996 const Class& closure_class =
997 Class::Handle(IsolateGroup::Current()->object_store()->closure_class());
998 EXPECT(!closure_class.IsNull());
999 closure_class.SetTraceAllocation(true);
1000
1001 // Invoke "foo" which during compilation, triggers a closure allocation.
1002 Invoke(root_library, "foo");
1003
1004 {
1005 StackZone zone(thread);
1006 Profile profile;
1007 AllocationFilter filter(isolate->main_port(), closure_class.id());
1008 filter.set_enable_vm_ticks(true);
1009 profile.Build(thread, isolate, &filter, Profiler::sample_block_buffer());
1010 // We should have one allocation sample.
1011 EXPECT_EQ(1, profile.sample_count());
1012 ProfileStackWalker walker(&profile);
1013
1014 EXPECT_SUBSTRING("DRT_AllocateClosure", walker.VMTagName());
1015 EXPECT_STREQ("[Stub] AllocateClosure", walker.CurrentName());
1016 EXPECT(walker.Down());
1017 EXPECT_SUBSTRING("foo", walker.CurrentName());
1018 EXPECT(!walker.Down());
1019 }
1020
1021 // Disable allocation tracing for Closure.
1022 closure_class.SetTraceAllocation(false);
1023
1024 // Invoke "bar" which during compilation, triggers a closure allocation.
1025 Invoke(root_library, "bar");
1026
1027 {
1028 StackZone zone(thread);
1029 Profile profile;
1030 AllocationFilter filter(isolate->main_port(), closure_class.id());
1031 filter.set_enable_vm_ticks(true);
1032 profile.Build(thread, isolate, &filter, Profiler::sample_block_buffer());
1033 // We should still only have one allocation sample.
1034 EXPECT_EQ(1, profile.sample_count());
1035 }
1036}

◆ ISOLATE_UNIT_TEST_CASE() [256/463]

dart::ISOLATE_UNIT_TEST_CASE ( Profiler_CodeTicks  )

Definition at line 624 of file profiler_test.cc.

624 {
628 const char* kScript =
629 "class A {\n"
630 " var a;\n"
631 " var b;\n"
632 "}\n"
633 "class B {\n"
634 " static boo() {\n"
635 " return new A();\n"
636 " }\n"
637 "}\n"
638 "main() {\n"
639 " return B.boo();\n"
640 "}\n";
641
642 const Library& root_library = Library::Handle(LoadTestScript(kScript));
643
644 const Class& class_a = Class::Handle(GetClass(root_library, "A"));
645 EXPECT(!class_a.IsNull());
646
647 Invoke(root_library, "main");
648
649 {
650 Thread* thread = Thread::Current();
651 Isolate* isolate = thread->isolate();
652 StackZone zone(thread);
653 Profile profile;
654 AllocationFilter filter(isolate->main_port(), class_a.id());
655 profile.Build(thread, isolate, &filter, Profiler::sample_block_buffer());
656 // We should have no allocation samples.
657 EXPECT_EQ(0, profile.sample_count());
658 }
659
660 // Turn on allocation tracing for A.
661 class_a.SetTraceAllocation(true);
662
663 // Allocate three times.
664 Invoke(root_library, "main");
665 Invoke(root_library, "main");
666 Invoke(root_library, "main");
667
668 {
669 Thread* thread = Thread::Current();
670 Isolate* isolate = thread->isolate();
671 StackZone zone(thread);
672 Profile profile;
673 AllocationFilter filter(isolate->main_port(), class_a.id());
674 profile.Build(thread, isolate, &filter, Profiler::sample_block_buffer());
675 // We should have three allocation samples.
676 EXPECT_EQ(3, profile.sample_count());
677 ProfileStackWalker walker(&profile);
678
679 // Move down from the root.
680 EXPECT_STREQ("DRT_AllocateObject", walker.VMTagName());
681#if defined(TARGET_ARCH_IA32) // Alloc. stub not impl. for ia32.
682 EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
683#else
684 EXPECT_STREQ("[Stub] AllocateObjectSlow", walker.CurrentName());
685#endif
686 EXPECT_EQ(3, walker.CurrentExclusiveTicks());
687 EXPECT(walker.Down());
688 EXPECT_STREQ("[Unoptimized] B.boo", walker.CurrentName());
689 EXPECT_EQ(3, walker.CurrentInclusiveTicks());
690 EXPECT(walker.Down());
691 EXPECT_STREQ("[Unoptimized] main", walker.CurrentName());
692 EXPECT_EQ(3, walker.CurrentInclusiveTicks());
693 EXPECT_EQ(0, walker.CurrentExclusiveTicks());
694 EXPECT(!walker.Down());
695 }
696}

◆ ISOLATE_UNIT_TEST_CASE() [257/463]

dart::ISOLATE_UNIT_TEST_CASE ( Profiler_ContextAllocation  )

Definition at line 916 of file profiler_test.cc.

916 {
920 const char* kScript =
921 "var msg1 = 'a';\n"
922 "foo() {\n"
923 " var msg = msg1 + msg1;\n"
924 " return (x) { return '$msg + $msg'; }(msg);\n"
925 "}\n";
926 const Library& root_library = Library::Handle(LoadTestScript(kScript));
927 Isolate* isolate = thread->isolate();
928
929 const Class& context_class = Class::Handle(Object::context_class());
930 EXPECT(!context_class.IsNull());
931
932 Invoke(root_library, "foo");
933
934 {
935 StackZone zone(thread);
936 Profile profile;
937 AllocationFilter filter(isolate->main_port(), context_class.id());
938 profile.Build(thread, isolate, &filter, Profiler::sample_block_buffer());
939 // We should have no allocation samples.
940 EXPECT_EQ(0, profile.sample_count());
941 }
942
943 context_class.SetTraceAllocation(true);
944 Invoke(root_library, "foo");
945
946 {
947 StackZone zone(thread);
948 Profile profile;
949 AllocationFilter filter(isolate->main_port(), context_class.id());
950 profile.Build(thread, isolate, &filter, Profiler::sample_block_buffer());
951 // We should have one allocation sample.
952 EXPECT_EQ(1, profile.sample_count());
953 ProfileStackWalker walker(&profile);
954
955 EXPECT_STREQ("DRT_AllocateContext", walker.VMTagName());
956 EXPECT_STREQ("[Stub] AllocateContext", walker.CurrentName());
957 EXPECT(walker.Down());
958 EXPECT_STREQ("[Unoptimized] foo", walker.CurrentName());
959 EXPECT(!walker.Down());
960 }
961
962 context_class.SetTraceAllocation(false);
963 Invoke(root_library, "foo");
964
965 {
966 StackZone zone(thread);
967 Profile profile;
968 AllocationFilter filter(isolate->main_port(), context_class.id());
969 profile.Build(thread, isolate, &filter, Profiler::sample_block_buffer());
970 // We should still only have one allocation sample.
971 EXPECT_EQ(1, profile.sample_count());
972 }
973}

◆ ISOLATE_UNIT_TEST_CASE() [258/463]

dart::ISOLATE_UNIT_TEST_CASE ( Profiler_EnterExitIsolate  )

Definition at line 2435 of file profiler_test.cc.

2435 {
2437 Profiler::SetSamplePeriod(50); // Microseconds.
2438
2439 const char* kScript = "main() => null;\n";
2440 const Library& root_library = Library::Handle(LoadTestScript(kScript));
2441
2442 Isolate* isolate = Isolate::Current();
2443 for (intptr_t i = 0; i < 100000; i++) {
2444 Thread::ExitIsolate();
2445 Thread::EnterIsolate(isolate);
2446 Invoke(root_library, "main");
2447 }
2448}

◆ ISOLATE_UNIT_TEST_CASE() [259/463]

dart::ISOLATE_UNIT_TEST_CASE ( Profiler_FunctionInline  )

Definition at line 1266 of file profiler_test.cc.

1266 {
1270 SetFlagScope<int> sfs(&FLAG_optimization_counter_threshold, 30000);
1271
1272 const char* kScript =
1273 "class A {\n"
1274 " var a;\n"
1275 " var b;\n"
1276 "}\n"
1277 "class B {\n"
1278 " static choo(bool alloc) {\n"
1279 " if (alloc) return new A();\n"
1280 " return alloc && alloc && !alloc;\n"
1281 " }\n"
1282 " static foo(bool alloc) {\n"
1283 " choo(alloc);\n"
1284 " }\n"
1285 " static boo(bool alloc) {\n"
1286 " for (var i = 0; i < 50000; i++) {\n"
1287 " foo(alloc);\n"
1288 " }\n"
1289 " }\n"
1290 "}\n"
1291 "main() {\n"
1292 " B.boo(false);\n"
1293 "}\n"
1294 "mainA() {\n"
1295 " B.boo(true);\n"
1296 "}\n";
1297
1298 const Library& root_library = Library::Handle(LoadTestScript(kScript));
1299
1300 const Class& class_a = Class::Handle(GetClass(root_library, "A"));
1301 EXPECT(!class_a.IsNull());
1302
1303 // Compile "main".
1304 Invoke(root_library, "main");
1305 // Compile "mainA".
1306 Invoke(root_library, "mainA");
1307 // At this point B.boo should be optimized and inlined B.foo and B.choo.
1308
1309 {
1310 Thread* thread = Thread::Current();
1311 Isolate* isolate = thread->isolate();
1312 StackZone zone(thread);
1313 Profile profile;
1314 AllocationFilter filter(isolate->main_port(), class_a.id());
1315 profile.Build(thread, isolate, &filter, Profiler::sample_block_buffer());
1316 // We should have no allocation samples.
1317 EXPECT_EQ(0, profile.sample_count());
1318 }
1319
1320 // Turn on allocation tracing for A.
1321 class_a.SetTraceAllocation(true);
1322
1323 // Allocate 50,000 instances of A.
1324 Invoke(root_library, "mainA");
1325
1326 {
1327 Thread* thread = Thread::Current();
1328 Isolate* isolate = thread->isolate();
1329 StackZone zone(thread);
1330 Profile profile;
1331 AllocationFilter filter(isolate->main_port(), class_a.id());
1332 profile.Build(thread, isolate, &filter, Profiler::sample_block_buffer());
1333 // We should have 50,000 allocation samples.
1334 EXPECT_EQ(50000, profile.sample_count());
1335 {
1336 ProfileStackWalker walker(&profile);
1337 // We have two code objects: mainA and B.boo.
1338 EXPECT_STREQ("DRT_AllocateObject", walker.VMTagName());
1339#if defined(TARGET_ARCH_IA32) // Alloc. stub not impl. for ia32.
1340 EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
1341#else
1342 EXPECT_STREQ("[Stub] AllocateObjectSlow", walker.CurrentName());
1343#endif
1344 EXPECT_EQ(50000, walker.CurrentExclusiveTicks());
1345 EXPECT(walker.Down());
1346 EXPECT_STREQ("[Optimized] B.boo", walker.CurrentName());
1347 EXPECT_EQ(50000, walker.CurrentInclusiveTicks());
1348 EXPECT(walker.Down());
1349 EXPECT_STREQ("[Unoptimized] mainA", walker.CurrentName());
1350 EXPECT_EQ(50000, walker.CurrentInclusiveTicks());
1351 EXPECT_EQ(0, walker.CurrentExclusiveTicks());
1352 EXPECT(!walker.Down());
1353 }
1354 {
1355 ProfileStackWalker walker(&profile, true);
1356 // Inline expansion should show us the complete call chain:
1357 // mainA -> B.boo -> B.foo -> B.choo.
1358 EXPECT_STREQ("DRT_AllocateObject", walker.VMTagName());
1359#if defined(TARGET_ARCH_IA32) // Alloc. stub not impl. for ia32.
1360 EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
1361#else
1362 EXPECT_STREQ("[Stub] AllocateObjectSlow", walker.CurrentName());
1363#endif
1364 EXPECT_EQ(50000, walker.CurrentExclusiveTicks());
1365 EXPECT(walker.Down());
1366 EXPECT_STREQ("B.choo", walker.CurrentName());
1367 EXPECT_EQ(50000, walker.CurrentInclusiveTicks());
1368 EXPECT(walker.Down());
1369 EXPECT_STREQ("B.foo", walker.CurrentName());
1370 EXPECT_EQ(50000, walker.CurrentInclusiveTicks());
1371 EXPECT_EQ(0, walker.CurrentExclusiveTicks());
1372 EXPECT(walker.Down());
1373 EXPECT_STREQ("B.boo", walker.CurrentName());
1374 EXPECT_EQ(50000, walker.CurrentInclusiveTicks());
1375 EXPECT_EQ(0, walker.CurrentExclusiveTicks());
1376 EXPECT(walker.Down());
1377 EXPECT_STREQ("mainA", walker.CurrentName());
1378 EXPECT_EQ(50000, walker.CurrentInclusiveTicks());
1379 EXPECT_EQ(0, walker.CurrentExclusiveTicks());
1380 EXPECT(!walker.Down());
1381 }
1382 }
1383}

◆ ISOLATE_UNIT_TEST_CASE() [260/463]

dart::ISOLATE_UNIT_TEST_CASE ( Profiler_FunctionTicks  )

Definition at line 697 of file profiler_test.cc.

697 {
701 const char* kScript =
702 "class A {\n"
703 " var a;\n"
704 " var b;\n"
705 "}\n"
706 "class B {\n"
707 " static boo() {\n"
708 " return new A();\n"
709 " }\n"
710 "}\n"
711 "main() {\n"
712 " return B.boo();\n"
713 "}\n";
714
715 const Library& root_library = Library::Handle(LoadTestScript(kScript));
716
717 const Class& class_a = Class::Handle(GetClass(root_library, "A"));
718 EXPECT(!class_a.IsNull());
719
720 Invoke(root_library, "main");
721
722 {
723 Thread* thread = Thread::Current();
724 Isolate* isolate = thread->isolate();
725 StackZone zone(thread);
726 Profile profile;
727 AllocationFilter filter(isolate->main_port(), class_a.id());
728 profile.Build(thread, isolate, &filter, Profiler::sample_block_buffer());
729 // We should have no allocation samples.
730 EXPECT_EQ(0, profile.sample_count());
731 }
732
733 // Turn on allocation tracing for A.
734 class_a.SetTraceAllocation(true);
735
736 // Allocate three times.
737 Invoke(root_library, "main");
738 Invoke(root_library, "main");
739 Invoke(root_library, "main");
740
741 {
742 Thread* thread = Thread::Current();
743 Isolate* isolate = thread->isolate();
744 StackZone zone(thread);
745 Profile profile;
746 AllocationFilter filter(isolate->main_port(), class_a.id());
747 profile.Build(thread, isolate, &filter, Profiler::sample_block_buffer());
748 // We should have three allocation samples.
749 EXPECT_EQ(3, profile.sample_count());
750 ProfileStackWalker walker(&profile, true);
751
752 EXPECT_STREQ("DRT_AllocateObject", walker.VMTagName());
753
754#if defined(TARGET_ARCH_IA32) // Alloc. stub not impl. for ia32.
755 EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
756#else
757 EXPECT_STREQ("[Stub] AllocateObjectSlow", walker.CurrentName());
758#endif
759 EXPECT_EQ(3, walker.CurrentExclusiveTicks());
760 EXPECT(walker.Down());
761 EXPECT_STREQ("B.boo", walker.CurrentName());
762 EXPECT_EQ(3, walker.CurrentInclusiveTicks());
763 EXPECT(walker.Down());
764 EXPECT_STREQ("main", walker.CurrentName());
765 EXPECT_EQ(3, walker.CurrentInclusiveTicks());
766 EXPECT_EQ(0, walker.CurrentExclusiveTicks());
767 EXPECT(!walker.Down());
768 }
769}

◆ ISOLATE_UNIT_TEST_CASE() [261/463]

dart::ISOLATE_UNIT_TEST_CASE ( Profiler_GetSourceReport  )

Definition at line 2206 of file profiler_test.cc.

2206 {
2208 const char* kScript =
2209 "int doWork(i) => i * i;\n"
2210 "int main() {\n"
2211 " int sum = 0;\n"
2212 " for (int i = 0; i < 100; i++) {\n"
2213 " sum += doWork(i);\n"
2214 " }\n"
2215 " return sum;\n"
2216 "}\n";
2217
2218 // Token position of * in `i * i`.
2219 const TokenPosition squarePosition = TokenPosition::Deserialize(19);
2220
2221 // Token position of the call to `doWork`.
2222 const TokenPosition callPosition = TokenPosition::Deserialize(95);
2223
2225 // Disable profiling for this thread.
2226 DisableThreadInterruptsScope dtis(Thread::Current());
2227
2229
2230 SampleBlockBuffer* sample_block_buffer = Profiler::sample_block_buffer();
2231 ASSERT(sample_block_buffer != nullptr);
2232
2233 const Library& root_library = Library::Handle(LoadTestScript(kScript));
2234
2235 // Invoke main so that it gets compiled.
2236 Invoke(root_library, "main");
2237
2238 {
2239 // Clear the profile for this isolate.
2240 ClearProfileVisitor cpv(Isolate::Current());
2241 sample_block_buffer->VisitSamples(&cpv);
2242 }
2243
2244 // Query the code object for main and determine the PC at some token
2245 // positions.
2246 const Function& main = Function::Handle(GetFunction(root_library, "main"));
2247 EXPECT(!main.IsNull());
2248
2249 const Function& do_work =
2250 Function::Handle(GetFunction(root_library, "doWork"));
2251 EXPECT(!do_work.IsNull());
2252
2253 const Script& script = Script::Handle(main.script());
2254 EXPECT(!script.IsNull());
2255
2256 const Code& main_code = Code::Handle(main.CurrentCode());
2257 EXPECT(!main_code.IsNull());
2258
2259 const Code& do_work_code = Code::Handle(do_work.CurrentCode());
2260 EXPECT(!do_work_code.IsNull());
2261
2262 // Dump code source map.
2263 do_work_code.DumpSourcePositions();
2264 main_code.DumpSourcePositions();
2265
2266 // Look up some source token position's pc.
2267 uword squarePositionPc = FindPCForTokenPosition(do_work_code, squarePosition);
2268 EXPECT(squarePositionPc != 0);
2269
2270 uword callPositionPc = FindPCForTokenPosition(main_code, callPosition);
2271 EXPECT(callPositionPc != 0);
2272
2273 // Look up some classifying token position's pc.
2274 uword controlFlowPc =
2275 FindPCForTokenPosition(do_work_code, TokenPosition::kControlFlow);
2276 EXPECT(controlFlowPc != 0);
2277
2278 // Insert fake samples.
2279
2280 // Sample 1:
2281 // squarePositionPc exclusive.
2282 // callPositionPc inclusive.
2283 uword sample1[] = {squarePositionPc, // doWork.
2284 callPositionPc, // main.
2285 0};
2286
2287 // Sample 2:
2288 // squarePositionPc exclusive.
2289 uword sample2[] = {
2290 squarePositionPc, // doWork.
2291 0,
2292 };
2293
2294 // Sample 3:
2295 // controlFlowPc exclusive.
2296 // callPositionPc inclusive.
2297 uword sample3[] = {controlFlowPc, // doWork.
2298 callPositionPc, // main.
2299 0};
2300
2303 InsertFakeSample(&sample3[0]);
2304
2305 // Generate source report for main.
2306 JSONStream js;
2307 {
2308 SourceReport sourceReport(SourceReport::kProfile);
2309 sourceReport.PrintJSON(&js, script, do_work.token_pos(),
2310 main.end_token_pos());
2311 }
2312
2313 // Verify positions in do_work.
2314 EXPECT_SUBSTRING("\"positions\":[\"ControlFlow\",19]", js.ToCString());
2315 // Verify exclusive ticks in do_work.
2316 EXPECT_SUBSTRING("\"exclusiveTicks\":[1,2]", js.ToCString());
2317 // Verify inclusive ticks in do_work.
2318 EXPECT_SUBSTRING("\"inclusiveTicks\":[1,2]", js.ToCString());
2319
2320 // Verify positions in main.
2321 EXPECT_SUBSTRING("\"positions\":[95]", js.ToCString());
2322 // Verify exclusive ticks in main.
2323 EXPECT_SUBSTRING("\"exclusiveTicks\":[0]", js.ToCString());
2324 // Verify inclusive ticks in main.
2325 EXPECT_SUBSTRING("\"inclusiveTicks\":[2]", js.ToCString());
2326}
static void sample1(void *dst, const uint8_t *src, int width, int bpp, int deltaSrc, int offset, const SkPMColor ctable[])
static void sample2(void *dst, const uint8_t *src, int width, int bpp, int deltaSrc, int offset, const SkPMColor ctable[])
static void do_work(int howMuchWork)
void VisitSamples(SampleVisitor *visitor)
Definition profiler.h:749
static void InsertFakeSample(uword *pc_offsets)

◆ ISOLATE_UNIT_TEST_CASE() [262/463]

dart::ISOLATE_UNIT_TEST_CASE ( Profiler_InliningIntervalBoundary  )

Definition at line 1385 of file profiler_test.cc.

1385 {
1386 // The PC of frames below the top frame is a call's return address,
1387 // which can belong to a different inlining interval than the call.
1388 // This test checks the profiler service takes this into account; see
1389 // ProfileBuilder::ProcessFrame.
1390
1394 SetFlagScope<int> sfs(&FLAG_optimization_counter_threshold, 30000);
1395
1396 const char* kScript =
1397 "class A {\n"
1398 "}\n"
1399 "bool alloc = false;"
1400 "maybeAlloc() {\n"
1401 " try {\n"
1402 " if (alloc) new A();\n"
1403 " } catch (e) {\n"
1404 " }\n"
1405 "}\n"
1406 "right() => maybeAlloc();\n"
1407 "doNothing() {\n"
1408 " try {\n"
1409 " } catch (e) {\n"
1410 " }\n"
1411 "}\n"
1412 "wrong() => doNothing();\n"
1413 "a() {\n"
1414 " try {\n"
1415 " right();\n"
1416 " wrong();\n"
1417 " } catch (e) {\n"
1418 " }\n"
1419 "}\n"
1420 "mainNoAlloc() {\n"
1421 " for (var i = 0; i < 20000; i++) {\n"
1422 " a();\n"
1423 " }\n"
1424 "}\n"
1425 "mainAlloc() {\n"
1426 " alloc = true;\n"
1427 " a();\n"
1428 "}\n";
1429
1430 const Library& root_library = Library::Handle(LoadTestScript(kScript));
1431
1432 const Class& class_a = Class::Handle(GetClass(root_library, "A"));
1433 EXPECT(!class_a.IsNull());
1434
1435 // Compile and optimize.
1436 Invoke(root_library, "mainNoAlloc");
1437 Invoke(root_library, "mainAlloc");
1438
1439 // At this point a should be optimized and have inlined both right and wrong,
1440 // but not maybeAllocate or doNothing.
1441 Function& func = Function::Handle();
1442 func = GetFunction(root_library, "a");
1443 EXPECT(!func.is_inlinable());
1444 EXPECT(func.HasOptimizedCode());
1445 func = GetFunction(root_library, "right");
1446 EXPECT(func.is_inlinable());
1447 func = GetFunction(root_library, "wrong");
1448 EXPECT(func.is_inlinable());
1449 func = GetFunction(root_library, "doNothing");
1450 EXPECT(!func.is_inlinable());
1451 func = GetFunction(root_library, "maybeAlloc");
1452 EXPECT(!func.is_inlinable());
1453
1454 {
1455 Thread* thread = Thread::Current();
1456 Isolate* isolate = thread->isolate();
1457 StackZone zone(thread);
1458 Profile profile;
1459 AllocationFilter filter(isolate->main_port(), class_a.id());
1460 profile.Build(thread, isolate, &filter, Profiler::sample_block_buffer());
1461 // We should have no allocation samples.
1462 EXPECT_EQ(0, profile.sample_count());
1463 }
1464
1465 // Turn on allocation tracing for A.
1466 class_a.SetTraceAllocation(true);
1467
1468 Invoke(root_library, "mainAlloc");
1469
1470 {
1471 Thread* thread = Thread::Current();
1472 Isolate* isolate = thread->isolate();
1473 StackZone zone(thread);
1474 Profile profile;
1475 AllocationFilter filter(isolate->main_port(), class_a.id());
1476 profile.Build(thread, isolate, &filter, Profiler::sample_block_buffer());
1477 EXPECT_EQ(1, profile.sample_count());
1478 ProfileStackWalker walker(&profile, true);
1479
1480 // Inline expansion should show us the complete call chain:
1481 EXPECT_STREQ("DRT_AllocateObject", walker.VMTagName());
1482#if defined(TARGET_ARCH_IA32) // Alloc. stub not impl. for ia32.
1483 EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
1484#else
1485 EXPECT_STREQ("[Stub] AllocateObjectSlow", walker.CurrentName());
1486#endif
1487 EXPECT(walker.Down());
1488 EXPECT_STREQ("maybeAlloc", walker.CurrentName());
1489 EXPECT(walker.Down());
1490 EXPECT_STREQ("right", walker.CurrentName());
1491 EXPECT(walker.Down());
1492 EXPECT_STREQ("a", walker.CurrentName());
1493 EXPECT(walker.Down());
1494 EXPECT_STREQ("mainAlloc", walker.CurrentName());
1495 }
1496}

◆ ISOLATE_UNIT_TEST_CASE() [263/463]

dart::ISOLATE_UNIT_TEST_CASE ( Profiler_IntrinsicAllocation  )

Definition at line 771 of file profiler_test.cc.

771 {
775 const char* kScript = "double foo(double a, double b) => a + b;";
776 const Library& root_library = Library::Handle(LoadTestScript(kScript));
777 Isolate* isolate = thread->isolate();
778
779 const Class& double_class =
780 Class::Handle(isolate->group()->object_store()->double_class());
781 EXPECT(!double_class.IsNull());
782
783 Dart_Handle args[2];
784 {
785 TransitionVMToNative transition(thread);
786 args[0] = Dart_NewDouble(1.0);
787 args[1] = Dart_NewDouble(2.0);
788 }
789
790 Invoke(root_library, "foo", 2, &args[0]);
791
792 {
793 StackZone zone(thread);
794 Profile profile;
795 AllocationFilter filter(isolate->main_port(), double_class.id());
796 profile.Build(thread, isolate, &filter, Profiler::sample_block_buffer());
797 // We should have no allocation samples.
798 EXPECT_EQ(0, profile.sample_count());
799 }
800
801 double_class.SetTraceAllocation(true);
802 Invoke(root_library, "foo", 2, &args[0]);
803
804 {
805 StackZone zone(thread);
806 Profile profile;
807 AllocationFilter filter(isolate->main_port(), double_class.id());
808 profile.Build(thread, isolate, &filter, Profiler::sample_block_buffer());
809 // We should have one allocation sample.
810 EXPECT_EQ(1, profile.sample_count());
811 ProfileStackWalker walker(&profile);
812
813 EXPECT_STREQ("Double_add", walker.VMTagName());
814 EXPECT_STREQ("[Unoptimized] double._add", walker.CurrentName());
815 EXPECT(walker.Down());
816 EXPECT_STREQ("[Unoptimized] double.+", walker.CurrentName());
817 EXPECT(walker.Down());
818 EXPECT_STREQ("[Unoptimized] foo", walker.CurrentName());
819 EXPECT(!walker.Down());
820 }
821
822 double_class.SetTraceAllocation(false);
823 Invoke(root_library, "foo", 2, &args[0]);
824
825 {
826 StackZone zone(thread);
827 Profile profile;
828 AllocationFilter filter(isolate->main_port(), double_class.id());
829 profile.Build(thread, isolate, &filter, Profiler::sample_block_buffer());
830 // We should still only have one allocation sample.
831 EXPECT_EQ(1, profile.sample_count());
832 }
833}
DART_EXPORT Dart_Handle Dart_NewDouble(double value)

◆ ISOLATE_UNIT_TEST_CASE() [264/463]

dart::ISOLATE_UNIT_TEST_CASE ( Profiler_NullSampleBuffer  )

Definition at line 531 of file profiler_test.cc.

531 {
532 Isolate* isolate = thread->isolate();
533
534 SampleFilter filter(isolate->main_port(), Thread::kMutatorTask, -1, -1);
535 Profile profile;
536 profile.Build(thread, isolate, &filter, nullptr);
537
538 EXPECT_EQ(0, profile.sample_count());
539}

◆ ISOLATE_UNIT_TEST_CASE() [265/463]

dart::ISOLATE_UNIT_TEST_CASE ( Profiler_ProfileCodeTableTest  )

Definition at line 2328 of file profiler_test.cc.

2328 {
2329 Zone* Z = Thread::Current()->zone();
2330
2332 EXPECT_EQ(table->length(), 0);
2333 EXPECT_EQ(table->FindCodeForPC(42), static_cast<ProfileCode*>(nullptr));
2334
2335 int64_t timestamp = 0;
2336 const AbstractCode null_code(Code::null());
2337
2338 ProfileCode* code1 = new (Z)
2339 ProfileCode(ProfileCode::kNativeCode, 50, 60, timestamp, null_code);
2340 EXPECT_EQ(table->InsertCode(code1), 0);
2341 EXPECT_EQ(table->FindCodeForPC(0), static_cast<ProfileCode*>(nullptr));
2342 EXPECT_EQ(table->FindCodeForPC(100), static_cast<ProfileCode*>(nullptr));
2343 EXPECT_EQ(table->FindCodeForPC(50), code1);
2344 EXPECT_EQ(table->FindCodeForPC(55), code1);
2345 EXPECT_EQ(table->FindCodeForPC(59), code1);
2346 EXPECT_EQ(table->FindCodeForPC(60), static_cast<ProfileCode*>(nullptr));
2347
2348 // Insert below all.
2349 ProfileCode* code2 = new (Z)
2350 ProfileCode(ProfileCode::kNativeCode, 10, 20, timestamp, null_code);
2351 EXPECT_EQ(table->InsertCode(code2), 0);
2352 EXPECT_EQ(table->FindCodeForPC(0), static_cast<ProfileCode*>(nullptr));
2353 EXPECT_EQ(table->FindCodeForPC(100), static_cast<ProfileCode*>(nullptr));
2354 EXPECT_EQ(table->FindCodeForPC(50), code1);
2355 EXPECT_EQ(table->FindCodeForPC(10), code2);
2356 EXPECT_EQ(table->FindCodeForPC(19), code2);
2357 EXPECT_EQ(table->FindCodeForPC(20), static_cast<ProfileCode*>(nullptr));
2358
2359 // Insert above all.
2360 ProfileCode* code3 = new (Z)
2361 ProfileCode(ProfileCode::kNativeCode, 80, 90, timestamp, null_code);
2362 EXPECT_EQ(table->InsertCode(code3), 2);
2363 EXPECT_EQ(table->FindCodeForPC(0), static_cast<ProfileCode*>(nullptr));
2364 EXPECT_EQ(table->FindCodeForPC(100), static_cast<ProfileCode*>(nullptr));
2365 EXPECT_EQ(table->FindCodeForPC(50), code1);
2366 EXPECT_EQ(table->FindCodeForPC(10), code2);
2367 EXPECT_EQ(table->FindCodeForPC(80), code3);
2368 EXPECT_EQ(table->FindCodeForPC(89), code3);
2369 EXPECT_EQ(table->FindCodeForPC(90), static_cast<ProfileCode*>(nullptr));
2370
2371 // Insert between.
2372 ProfileCode* code4 = new (Z)
2373 ProfileCode(ProfileCode::kNativeCode, 65, 75, timestamp, null_code);
2374 EXPECT_EQ(table->InsertCode(code4), 2);
2375 EXPECT_EQ(table->FindCodeForPC(0), static_cast<ProfileCode*>(nullptr));
2376 EXPECT_EQ(table->FindCodeForPC(100), static_cast<ProfileCode*>(nullptr));
2377 EXPECT_EQ(table->FindCodeForPC(50), code1);
2378 EXPECT_EQ(table->FindCodeForPC(10), code2);
2379 EXPECT_EQ(table->FindCodeForPC(80), code3);
2380 EXPECT_EQ(table->FindCodeForPC(65), code4);
2381 EXPECT_EQ(table->FindCodeForPC(74), code4);
2382 EXPECT_EQ(table->FindCodeForPC(75), static_cast<ProfileCode*>(nullptr));
2383
2384 // Insert overlapping left.
2385 ProfileCode* code5 = new (Z)
2386 ProfileCode(ProfileCode::kNativeCode, 15, 25, timestamp, null_code);
2387 EXPECT_EQ(table->InsertCode(code5), 0);
2388 EXPECT_EQ(table->FindCodeForPC(0), static_cast<ProfileCode*>(nullptr));
2389 EXPECT_EQ(table->FindCodeForPC(100), static_cast<ProfileCode*>(nullptr));
2390 EXPECT_EQ(table->FindCodeForPC(50), code1);
2391 EXPECT_EQ(table->FindCodeForPC(10), code2);
2392 EXPECT_EQ(table->FindCodeForPC(80), code3);
2393 EXPECT_EQ(table->FindCodeForPC(65), code4);
2394 EXPECT_EQ(table->FindCodeForPC(15), code2); // Merged left.
2395 EXPECT_EQ(table->FindCodeForPC(24), code2); // Merged left.
2396 EXPECT_EQ(table->FindCodeForPC(25), static_cast<ProfileCode*>(nullptr));
2397
2398 // Insert overlapping right.
2399 ProfileCode* code6 = new (Z)
2400 ProfileCode(ProfileCode::kNativeCode, 45, 55, timestamp, null_code);
2401 EXPECT_EQ(table->InsertCode(code6), 1);
2402 EXPECT_EQ(table->FindCodeForPC(0), static_cast<ProfileCode*>(nullptr));
2403 EXPECT_EQ(table->FindCodeForPC(100), static_cast<ProfileCode*>(nullptr));
2404 EXPECT_EQ(table->FindCodeForPC(50), code1);
2405 EXPECT_EQ(table->FindCodeForPC(10), code2);
2406 EXPECT_EQ(table->FindCodeForPC(80), code3);
2407 EXPECT_EQ(table->FindCodeForPC(65), code4);
2408 EXPECT_EQ(table->FindCodeForPC(15), code2); // Merged left.
2409 EXPECT_EQ(table->FindCodeForPC(24), code2); // Merged left.
2410 EXPECT_EQ(table->FindCodeForPC(45), code1); // Merged right.
2411 EXPECT_EQ(table->FindCodeForPC(54), code1); // Merged right.
2412 EXPECT_EQ(table->FindCodeForPC(55), code1);
2413
2414 // Insert overlapping both.
2415 ProfileCode* code7 = new (Z)
2416 ProfileCode(ProfileCode::kNativeCode, 20, 50, timestamp, null_code);
2417 EXPECT_EQ(table->InsertCode(code7), 0);
2418 EXPECT_EQ(table->FindCodeForPC(0), static_cast<ProfileCode*>(nullptr));
2419 EXPECT_EQ(table->FindCodeForPC(100), static_cast<ProfileCode*>(nullptr));
2420 EXPECT_EQ(table->FindCodeForPC(50), code1);
2421 EXPECT_EQ(table->FindCodeForPC(10), code2);
2422 EXPECT_EQ(table->FindCodeForPC(80), code3);
2423 EXPECT_EQ(table->FindCodeForPC(65), code4);
2424 EXPECT_EQ(table->FindCodeForPC(15), code2); // Merged left.
2425 EXPECT_EQ(table->FindCodeForPC(24), code2); // Merged left.
2426 EXPECT_EQ(table->FindCodeForPC(45), code1); // Merged right.
2427 EXPECT_EQ(table->FindCodeForPC(54), code1); // Merged right.
2428 EXPECT_EQ(table->FindCodeForPC(20), code2); // Merged left.
2429 EXPECT_EQ(table->FindCodeForPC(49), code1); // Truncated.
2430 EXPECT_EQ(table->FindCodeForPC(50), code1);
2431}

◆ ISOLATE_UNIT_TEST_CASE() [266/463]

dart::ISOLATE_UNIT_TEST_CASE ( Profiler_SourcePosition  )

Definition at line 1752 of file profiler_test.cc.

1752 {
1756 const char* kScript =
1757 "class A {\n"
1758 " var a;\n"
1759 " var b;\n"
1760 " @pragma('vm:never-inline') A() { }\n"
1761 "}\n"
1762 "class B {\n"
1763 " @pragma('vm:never-inline')\n"
1764 " static oats() {\n"
1765 " return boo();\n"
1766 " }\n"
1767 " @pragma('vm:prefer-inline')\n"
1768 " static boo() {\n"
1769 " return new A();\n"
1770 " }\n"
1771 "}\n"
1772 "class C {\n"
1773 " @pragma('vm:never-inline') bacon() {\n"
1774 " return fox();\n"
1775 " }\n"
1776 " @pragma('vm:prefer-inline') fox() {\n"
1777 " return B.oats();\n"
1778 " }\n"
1779 "}\n"
1780 "main() {\n"
1781 " new C()..bacon();\n"
1782 "}\n";
1783
1784 const Library& root_library = Library::Handle(LoadTestScript(kScript));
1785
1786 const Class& class_a = Class::Handle(GetClass(root_library, "A"));
1787 EXPECT(!class_a.IsNull());
1788
1789 Invoke(root_library, "main");
1790
1791 // Turn on allocation tracing for A.
1792 class_a.SetTraceAllocation(true);
1793
1794 // Allocate one time.
1795 Invoke(root_library, "main");
1796
1797 {
1798 Thread* thread = Thread::Current();
1799 Isolate* isolate = thread->isolate();
1800 StackZone zone(thread);
1801 Profile profile;
1802 AllocationFilter filter(isolate->main_port(), class_a.id());
1803 profile.Build(thread, isolate, &filter, Profiler::sample_block_buffer());
1804 // We should have one allocation samples.
1805 EXPECT_EQ(1, profile.sample_count());
1806 ProfileStackWalker walker(&profile, true);
1807
1808 EXPECT_STREQ("DRT_AllocateObject", walker.VMTagName());
1809#if defined(TARGET_ARCH_IA32) // Alloc. stub not impl. for ia32.
1810 EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
1811#else
1812 EXPECT_STREQ("[Stub] AllocateObjectSlow", walker.CurrentName());
1813#endif
1814 EXPECT_EQ(1, walker.CurrentExclusiveTicks());
1815 EXPECT(walker.Down());
1816 EXPECT_STREQ("B.boo", walker.CurrentName());
1817 EXPECT_EQ(1, walker.CurrentInclusiveTicks());
1818 EXPECT_STREQ("A", walker.CurrentToken());
1819 EXPECT(walker.Down());
1820 EXPECT_STREQ("B.oats", walker.CurrentName());
1821 EXPECT_EQ(1, walker.CurrentInclusiveTicks());
1822 EXPECT_EQ(0, walker.CurrentExclusiveTicks());
1823 EXPECT_STREQ("boo", walker.CurrentToken());
1824 EXPECT(walker.Down());
1825 EXPECT_STREQ("C.fox", walker.CurrentName());
1826 EXPECT_EQ(1, walker.CurrentInclusiveTicks());
1827 EXPECT_EQ(0, walker.CurrentExclusiveTicks());
1828 EXPECT_STREQ("oats", walker.CurrentToken());
1829 EXPECT(walker.Down());
1830 EXPECT_STREQ("C.bacon", walker.CurrentName());
1831 EXPECT_EQ(1, walker.CurrentInclusiveTicks());
1832 EXPECT_EQ(0, walker.CurrentExclusiveTicks());
1833 EXPECT_STREQ("fox", walker.CurrentToken());
1834 EXPECT(walker.Down());
1835 EXPECT_STREQ("main", walker.CurrentName());
1836 EXPECT_EQ(1, walker.CurrentInclusiveTicks());
1837 EXPECT_EQ(0, walker.CurrentExclusiveTicks());
1838 EXPECT_STREQ("bacon", walker.CurrentToken());
1839 EXPECT(!walker.Down());
1840 }
1841}

◆ ISOLATE_UNIT_TEST_CASE() [267/463]

dart::ISOLATE_UNIT_TEST_CASE ( Profiler_SourcePositionOptimized  )

Definition at line 1843 of file profiler_test.cc.

1843 {
1847 const char* kScript =
1848 "class A {\n"
1849 " var a;\n"
1850 " var b;\n"
1851 " @pragma('vm:never-inline') A() { }\n"
1852 "}\n"
1853 "class B {\n"
1854 " @pragma('vm:never-inline')\n"
1855 " static oats() {\n"
1856 " return boo();\n"
1857 " }\n"
1858 " @pragma('vm:prefer-inline')\n"
1859 " static boo() {\n"
1860 " return new A();\n"
1861 " }\n"
1862 "}\n"
1863 "class C {\n"
1864 " @pragma('vm:never-inline') bacon() {\n"
1865 " return fox();\n"
1866 " }\n"
1867 " @pragma('vm:prefer-inline') fox() {\n"
1868 " return B.oats();\n"
1869 " }\n"
1870 "}\n"
1871 "main() {\n"
1872 " new C()..bacon();\n"
1873 "}\n";
1874
1875 const Library& root_library = Library::Handle(LoadTestScript(kScript));
1876
1877 const Class& class_a = Class::Handle(GetClass(root_library, "A"));
1878 EXPECT(!class_a.IsNull());
1879
1880 const Function& main = Function::Handle(GetFunction(root_library, "main"));
1881 EXPECT(!main.IsNull());
1882
1883 // Optimize quickly.
1884 SetFlagScope<int> sfs(&FLAG_optimization_counter_threshold, 5);
1885 // Warm up function.
1886 while (true) {
1887 Invoke(root_library, "main");
1888 const Code& code = Code::Handle(main.CurrentCode());
1889 if (code.is_optimized()) {
1890 // Warmed up.
1891 break;
1892 }
1893 }
1894
1895 // Turn on allocation tracing for A.
1896 class_a.SetTraceAllocation(true);
1897
1898 // Allocate one time.
1899 Invoke(root_library, "main");
1900
1901 // Still optimized.
1902 const Code& code = Code::Handle(main.CurrentCode());
1903 EXPECT(code.is_optimized());
1904
1905 {
1906 Thread* thread = Thread::Current();
1907 Isolate* isolate = thread->isolate();
1908 StackZone zone(thread);
1909 Profile profile;
1910 AllocationFilter filter(isolate->main_port(), class_a.id());
1911 profile.Build(thread, isolate, &filter, Profiler::sample_block_buffer());
1912 // We should have one allocation samples.
1913 EXPECT_EQ(1, profile.sample_count());
1914 ProfileStackWalker walker(&profile, true);
1915
1916 EXPECT_STREQ("DRT_AllocateObject", walker.VMTagName());
1917#if defined(TARGET_ARCH_IA32) // Alloc. stub not impl. for ia32.
1918 EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
1919#else
1920 EXPECT_STREQ("[Stub] AllocateObjectSlow", walker.CurrentName());
1921#endif
1922 EXPECT_EQ(1, walker.CurrentExclusiveTicks());
1923 EXPECT(walker.Down());
1924 EXPECT_STREQ("B.boo", walker.CurrentName());
1925 EXPECT_EQ(1, walker.CurrentInclusiveTicks());
1926 EXPECT_STREQ("A", walker.CurrentToken());
1927 EXPECT(walker.Down());
1928 EXPECT_STREQ("B.oats", walker.CurrentName());
1929 EXPECT_EQ(1, walker.CurrentInclusiveTicks());
1930 EXPECT_EQ(0, walker.CurrentExclusiveTicks());
1931 EXPECT_STREQ("boo", walker.CurrentToken());
1932 EXPECT(walker.Down());
1933 EXPECT_STREQ("C.fox", walker.CurrentName());
1934 EXPECT_EQ(1, walker.CurrentInclusiveTicks());
1935 EXPECT_EQ(0, walker.CurrentExclusiveTicks());
1936 EXPECT_STREQ("oats", walker.CurrentToken());
1937 EXPECT(walker.Down());
1938 EXPECT_STREQ("C.bacon", walker.CurrentName());
1939 EXPECT_EQ(1, walker.CurrentInclusiveTicks());
1940 EXPECT_EQ(0, walker.CurrentExclusiveTicks());
1941 EXPECT_STREQ("fox", walker.CurrentToken());
1942 EXPECT(walker.Down());
1943 EXPECT_STREQ("main", walker.CurrentName());
1944 EXPECT_EQ(1, walker.CurrentInclusiveTicks());
1945 EXPECT_EQ(0, walker.CurrentExclusiveTicks());
1946 EXPECT_STREQ("bacon", walker.CurrentToken());
1947 EXPECT(!walker.Down());
1948 }
1949}

◆ ISOLATE_UNIT_TEST_CASE() [268/463]

dart::ISOLATE_UNIT_TEST_CASE ( Profiler_StringAllocation  )

Definition at line 1112 of file profiler_test.cc.

1112 {
1116 const char* kScript = "String foo(String a, String b) => a + b;";
1117 const Library& root_library = Library::Handle(LoadTestScript(kScript));
1118 Isolate* isolate = thread->isolate();
1119
1120 const Class& one_byte_string_class =
1121 Class::Handle(isolate->group()->object_store()->one_byte_string_class());
1122 EXPECT(!one_byte_string_class.IsNull());
1123
1124 Dart_Handle args[2];
1125 {
1126 TransitionVMToNative transition(thread);
1127 args[0] = NewString("a");
1128 args[1] = NewString("b");
1129 }
1130
1131 Invoke(root_library, "foo", 2, &args[0]);
1132
1133 {
1134 StackZone zone(thread);
1135 Profile profile;
1136 AllocationFilter filter(isolate->main_port(), one_byte_string_class.id());
1137 profile.Build(thread, isolate, &filter, Profiler::sample_block_buffer());
1138 // We should have no allocation samples.
1139 EXPECT_EQ(0, profile.sample_count());
1140 }
1141
1142 one_byte_string_class.SetTraceAllocation(true);
1143 Invoke(root_library, "foo", 2, &args[0]);
1144
1145 {
1146 StackZone zone(thread);
1147 Profile profile;
1148 AllocationFilter filter(isolate->main_port(), one_byte_string_class.id());
1149 profile.Build(thread, isolate, &filter, Profiler::sample_block_buffer());
1150 // We should still only have one allocation sample.
1151 EXPECT_EQ(1, profile.sample_count());
1152 ProfileStackWalker walker(&profile);
1153
1154 EXPECT_STREQ("String_concat", walker.VMTagName());
1155 EXPECT_STREQ("[Unoptimized] _StringBase.+", walker.CurrentName());
1156 EXPECT(walker.Down());
1157 EXPECT_STREQ("[Unoptimized] foo", walker.CurrentName());
1158 EXPECT(!walker.Down());
1159 }
1160
1161 one_byte_string_class.SetTraceAllocation(false);
1162 Invoke(root_library, "foo", 2, &args[0]);
1163
1164 {
1165 StackZone zone(thread);
1166 Profile profile;
1167 AllocationFilter filter(isolate->main_port(), one_byte_string_class.id());
1168 profile.Build(thread, isolate, &filter, Profiler::sample_block_buffer());
1169 // We should still only have one allocation sample.
1170 EXPECT_EQ(1, profile.sample_count());
1171 }
1172
1173 one_byte_string_class.SetTraceAllocation(true);
1174 Invoke(root_library, "foo", 2, &args[0]);
1175
1176 {
1177 StackZone zone(thread);
1178 Profile profile;
1179 AllocationFilter filter(isolate->main_port(), one_byte_string_class.id());
1180 profile.Build(thread, isolate, &filter, Profiler::sample_block_buffer());
1181 // We should now have two allocation samples.
1182 EXPECT_EQ(2, profile.sample_count());
1183 }
1184}

◆ ISOLATE_UNIT_TEST_CASE() [269/463]

dart::ISOLATE_UNIT_TEST_CASE ( Profiler_StringInterpolation  )

Definition at line 1186 of file profiler_test.cc.

1186 {
1190 const char* kScript = "String foo(String a, String b) => '$a | $b';";
1191 const Library& root_library = Library::Handle(LoadTestScript(kScript));
1192 Isolate* isolate = thread->isolate();
1193
1194 const Class& one_byte_string_class =
1195 Class::Handle(isolate->group()->object_store()->one_byte_string_class());
1196 EXPECT(!one_byte_string_class.IsNull());
1197
1198 Dart_Handle args[2];
1199 {
1200 TransitionVMToNative transition(thread);
1201 args[0] = NewString("a");
1202 args[1] = NewString("b");
1203 }
1204
1205 Invoke(root_library, "foo", 2, &args[0]);
1206
1207 {
1208 StackZone zone(thread);
1209 Profile profile;
1210 AllocationFilter filter(isolate->main_port(), one_byte_string_class.id());
1211 profile.Build(thread, isolate, &filter, Profiler::sample_block_buffer());
1212 // We should have no allocation samples.
1213 EXPECT_EQ(0, profile.sample_count());
1214 }
1215
1216 one_byte_string_class.SetTraceAllocation(true);
1217 Invoke(root_library, "foo", 2, &args[0]);
1218
1219 {
1220 StackZone zone(thread);
1221 Profile profile;
1222 AllocationFilter filter(isolate->main_port(), one_byte_string_class.id());
1223 profile.Build(thread, isolate, &filter, Profiler::sample_block_buffer());
1224 // We should still only have one allocation sample.
1225 EXPECT_EQ(1, profile.sample_count());
1226 ProfileStackWalker walker(&profile);
1227
1228 EXPECT_STREQ("Internal_allocateOneByteString", walker.VMTagName());
1229 EXPECT(walker.Down());
1230 EXPECT_STREQ("[Unoptimized] String._allocate", walker.CurrentName());
1231 EXPECT(walker.Down());
1232 EXPECT_STREQ("[Unoptimized] String._concatAll", walker.CurrentName());
1233 EXPECT(walker.Down());
1234 EXPECT_STREQ("[Unoptimized] _StringBase._interpolate",
1235 walker.CurrentName());
1236 EXPECT(walker.Down());
1237 EXPECT_STREQ("[Unoptimized] foo", walker.CurrentName());
1238 EXPECT(!walker.Down());
1239 }
1240
1241 one_byte_string_class.SetTraceAllocation(false);
1242 Invoke(root_library, "foo", 2, &args[0]);
1243
1244 {
1245 StackZone zone(thread);
1246 Profile profile;
1247 AllocationFilter filter(isolate->main_port(), one_byte_string_class.id());
1248 profile.Build(thread, isolate, &filter, Profiler::sample_block_buffer());
1249 // We should still only have one allocation sample.
1250 EXPECT_EQ(1, profile.sample_count());
1251 }
1252
1253 one_byte_string_class.SetTraceAllocation(true);
1254 Invoke(root_library, "foo", 2, &args[0]);
1255
1256 {
1257 StackZone zone(thread);
1258 Profile profile;
1259 AllocationFilter filter(isolate->main_port(), one_byte_string_class.id());
1260 profile.Build(thread, isolate, &filter, Profiler::sample_block_buffer());
1261 // We should now have two allocation samples.
1262 EXPECT_EQ(2, profile.sample_count());
1263 }
1264}

◆ ISOLATE_UNIT_TEST_CASE() [270/463]

dart::ISOLATE_UNIT_TEST_CASE ( Profiler_ToggleRecordAllocation  )

Definition at line 541 of file profiler_test.cc.

541 {
543
546 const char* kScript =
547 "class A {\n"
548 " var a;\n"
549 " var b;\n"
550 "}\n"
551 "class B {\n"
552 " static boo() {\n"
553 " return new A();\n"
554 " }\n"
555 "}\n"
556 "main() {\n"
557 " return B.boo();\n"
558 "}\n";
559
560 const Library& root_library = Library::Handle(LoadTestScript(kScript));
561
562 const Class& class_a = Class::Handle(GetClass(root_library, "A"));
563 EXPECT(!class_a.IsNull());
564
565 Invoke(root_library, "main");
566
567 {
568 Thread* thread = Thread::Current();
569 Isolate* isolate = thread->isolate();
570 StackZone zone(thread);
571 Profile profile;
572 AllocationFilter filter(isolate->main_port(), class_a.id());
573 profile.Build(thread, isolate, &filter, Profiler::sample_block_buffer());
574 // We should have no allocation samples.
575 EXPECT_EQ(0, profile.sample_count());
576 }
577
578 // Turn on allocation tracing for A.
579 class_a.SetTraceAllocation(true);
580
581 Invoke(root_library, "main");
582
583 {
584 Thread* thread = Thread::Current();
585 Isolate* isolate = thread->isolate();
586 StackZone zone(thread);
587 Profile profile;
588 AllocationFilter filter(isolate->main_port(), class_a.id());
589 profile.Build(thread, isolate, &filter, Profiler::sample_block_buffer());
590 // We should have one allocation sample.
591 EXPECT_EQ(1, profile.sample_count());
592 ProfileStackWalker walker(&profile);
593
594 EXPECT_STREQ("DRT_AllocateObject", walker.VMTagName());
595#if defined(TARGET_ARCH_IA32) // Alloc. stub not impl. for ia32.
596 EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
597#else
598 EXPECT_STREQ("[Stub] AllocateObjectSlow", walker.CurrentName());
599#endif
600 EXPECT(walker.Down());
601 EXPECT_STREQ("[Unoptimized] B.boo", walker.CurrentName());
602 EXPECT(walker.Down());
603 EXPECT_STREQ("[Unoptimized] main", walker.CurrentName());
604 EXPECT(!walker.Down());
605 }
606
607 // Turn off allocation tracing for A.
608 class_a.SetTraceAllocation(false);
609
610 Invoke(root_library, "main");
611
612 {
613 Thread* thread = Thread::Current();
614 Isolate* isolate = thread->isolate();
615 StackZone zone(thread);
616 Profile profile;
617 AllocationFilter filter(isolate->main_port(), class_a.id());
618 profile.Build(thread, isolate, &filter, Profiler::sample_block_buffer());
619 // We should still only have one allocation sample.
620 EXPECT_EQ(1, profile.sample_count());
621 }
622}

◆ ISOLATE_UNIT_TEST_CASE() [271/463]

dart::ISOLATE_UNIT_TEST_CASE ( Profiler_TrivialRecordAllocation  )

Definition at line 458 of file profiler_test.cc.

458 {
462 const char* kScript =
463 "class A {\n"
464 " var a;\n"
465 " var b;\n"
466 "}\n"
467 "class B {\n"
468 " static boo() {\n"
469 " return new A();\n"
470 " }\n"
471 "}\n"
472 "main() {\n"
473 " return B.boo();\n"
474 "}\n";
475
476 const Library& root_library = Library::Handle(LoadTestScript(kScript));
477
478 const int64_t before_allocations_micros = Dart_TimelineGetMicros();
479 const Class& class_a = Class::Handle(GetClass(root_library, "A"));
480 EXPECT(!class_a.IsNull());
481 class_a.SetTraceAllocation(true);
482
483 Invoke(root_library, "main");
484
485 const int64_t after_allocations_micros = Dart_TimelineGetMicros();
486 const int64_t allocation_extent_micros =
487 after_allocations_micros - before_allocations_micros;
488 {
489 Thread* thread = Thread::Current();
490 Isolate* isolate = thread->isolate();
491 StackZone zone(thread);
492 Profile profile;
493 // Filter for the class in the time range.
494 AllocationFilter filter(isolate->main_port(), class_a.id(),
495 before_allocations_micros,
496 allocation_extent_micros);
497 profile.Build(thread, isolate, &filter, Profiler::sample_block_buffer());
498 // We should have 1 allocation sample.
499 EXPECT_EQ(1, profile.sample_count());
500 ProfileStackWalker walker(&profile);
501
502 // Move down from the root.
503 EXPECT_STREQ("DRT_AllocateObject", walker.VMTagName());
504#if defined(TARGET_ARCH_IA32) // Alloc. stub not impl. for ia32.
505 EXPECT_STREQ("[Stub] Allocate A", walker.CurrentName());
506#else
507 EXPECT_STREQ("[Stub] AllocateObjectSlow", walker.CurrentName());
508#endif
509 EXPECT(walker.Down());
510 EXPECT_STREQ("[Unoptimized] B.boo", walker.CurrentName());
511 EXPECT(walker.Down());
512 EXPECT_STREQ("[Unoptimized] main", walker.CurrentName());
513 EXPECT(!walker.Down());
514 }
515
516 // Query with a time filter where no allocations occurred.
517 {
518 Thread* thread = Thread::Current();
519 Isolate* isolate = thread->isolate();
520 StackZone zone(thread);
521 Profile profile;
522 AllocationFilter filter(isolate->main_port(), class_a.id(),
523 Dart_TimelineGetMicros(), 16000);
524 profile.Build(thread, isolate, &filter, Profiler::sample_block_buffer());
525 // We should have no allocation samples because none occurred within
526 // the specified time range.
527 EXPECT_EQ(0, profile.sample_count());
528 }
529}
DART_EXPORT int64_t Dart_TimelineGetMicros()

◆ ISOLATE_UNIT_TEST_CASE() [272/463]

dart::ISOLATE_UNIT_TEST_CASE ( Profiler_TypedArrayAllocation  )

Definition at line 1038 of file profiler_test.cc.

1038 {
1042 const char* kScript =
1043 "import 'dart:typed_data';\n"
1044 "List foo() => new Float32List(4);\n";
1045 const Library& root_library = Library::Handle(LoadTestScript(kScript));
1046 Isolate* isolate = thread->isolate();
1047
1048 const Library& typed_data_library =
1049 Library::Handle(isolate->group()->object_store()->typed_data_library());
1050
1051 const Class& float32_list_class =
1052 Class::Handle(GetClass(typed_data_library, "_Float32List"));
1053 EXPECT(!float32_list_class.IsNull());
1054
1055 Invoke(root_library, "foo");
1056
1057 {
1058 StackZone zone(thread);
1059 Profile profile;
1060 AllocationFilter filter(isolate->main_port(), float32_list_class.id());
1061 profile.Build(thread, isolate, &filter, Profiler::sample_block_buffer());
1062 // We should have no allocation samples.
1063 EXPECT_EQ(0, profile.sample_count());
1064 }
1065
1066 float32_list_class.SetTraceAllocation(true);
1067 Invoke(root_library, "foo");
1068
1069 {
1070 StackZone zone(thread);
1071 Profile profile;
1072 AllocationFilter filter(isolate->main_port(), float32_list_class.id());
1073 profile.Build(thread, isolate, &filter, Profiler::sample_block_buffer());
1074 // We should have one allocation sample.
1075 EXPECT_EQ(1, profile.sample_count());
1076 ProfileStackWalker walker(&profile);
1077
1078 EXPECT_STREQ("DRT_AllocateTypedData", walker.VMTagName());
1079 EXPECT_STREQ("[Stub] AllocateFloat32Array", walker.CurrentName());
1080 EXPECT(walker.Down());
1081 EXPECT_STREQ("[Unoptimized] new Float32List", walker.CurrentName());
1082 EXPECT(walker.Down());
1083 EXPECT_STREQ("[Unoptimized] foo", walker.CurrentName());
1084 EXPECT(!walker.Down());
1085 }
1086
1087 float32_list_class.SetTraceAllocation(false);
1088 Invoke(root_library, "foo");
1089
1090 {
1091 StackZone zone(thread);
1092 Profile profile;
1093 AllocationFilter filter(isolate->main_port(), float32_list_class.id());
1094 profile.Build(thread, isolate, &filter, Profiler::sample_block_buffer());
1095 // We should still only have one allocation sample.
1096 EXPECT_EQ(1, profile.sample_count());
1097 }
1098
1099 float32_list_class.SetTraceAllocation(true);
1100 Invoke(root_library, "foo");
1101
1102 {
1103 StackZone zone(thread);
1104 Profile profile;
1105 AllocationFilter filter(isolate->main_port(), float32_list_class.id());
1106 profile.Build(thread, isolate, &filter, Profiler::sample_block_buffer());
1107 // We should now have two allocation samples.
1108 EXPECT_EQ(2, profile.sample_count());
1109 }
1110}

◆ ISOLATE_UNIT_TEST_CASE() [273/463]

dart::ISOLATE_UNIT_TEST_CASE ( RangeAnalysis_LoadClassId  )

Definition at line 641 of file range_analysis_test.cc.

641 {
642 const char* kScript = R"(
643 @pragma('vm:never-inline')
644 bool foo(num x) {
645 return x is int;
646 }
647 void main() {
648 foo(42);
649 }
650 )";
651
652 const auto& root_library = Library::Handle(LoadTestScript(kScript));
653 Invoke(root_library, "main");
654
655 const auto& function = Function::Handle(GetFunction(root_library, "foo"));
656 TestPipeline pipeline(function, CompilerPass::kAOT);
657 FlowGraph* flow_graph = pipeline.RunPasses({});
658
659 auto entry = flow_graph->graph_entry()->normal_entry();
660 EXPECT(entry != nullptr);
661 ILMatcher cursor(flow_graph, entry, /*trace=*/true,
662 ParallelMovesHandling::kSkip);
663
664 LoadClassIdInstr* load_cid = nullptr;
665
666 RELEASE_ASSERT(cursor.TryMatch({
667 kMoveGlob,
668 {kMatchAndMoveLoadClassId, &load_cid},
669 kMoveGlob,
670 kMatchAndMoveTestRange,
671 kMoveGlob,
672 kMatchDartReturn,
673 }));
674
675 EXPECT(load_cid->range() != nullptr);
676 EXPECT(kSmiCid < kMintCid);
677 EXPECT(kMintCid < kDoubleCid);
678 EXPECT(load_cid->range()->min().ConstantValue() == kSmiCid);
679 EXPECT(load_cid->range()->max().ConstantValue() == kDoubleCid);
680}

◆ ISOLATE_UNIT_TEST_CASE() [274/463]

dart::ISOLATE_UNIT_TEST_CASE ( ReachabilityFence_Loop  )

Definition at line 59 of file reachability_fence_test.cc.

63 {
65 // Allocate the object.
66 {kMatchAndMoveAllocateObject, &allocate_object},
67 kMoveGlob,
68 // The call.
69 kMatchAndMoveStoreStaticField,
70 // The fence should not be moved before the call.
71 {kMatchAndMoveReachabilityFence, &fence},
72 }));
73
74 EXPECT(fence->value()->definition() == allocate_object);
75}
76
77ISOLATE_UNIT_TEST_CASE(ReachabilityFence_Loop) {
78 // clang-format off
79 auto kScript =
80 Utils::CStringUniquePtr(OS::SCreate(nullptr, R"(
81 import 'dart:_internal' show reachabilityFence;
82
83 int someGlobal = 0;
84
85 class A {
86 int%s a;
87 }
88
89 @pragma('vm:never-inline')
90 A makeSomeA() {
91 return A()..a = 10;
92 }
93
94 void someFunction(int arg) {
95 someGlobal += arg;
96 }
97
98 main() {
99 final object = makeSomeA();
100 for(int i = 0; i < 100000; i++) {
101 someFunction(object.a%s);
102 reachabilityFence(object);
103 }
104 }
105 )", TestCase::NullableTag(), TestCase::NullAssertTag()), std::free);
106 // clang-format on
107
108 const auto& root_library = Library::Handle(LoadTestScript(kScript.get()));
109
110 Invoke(root_library, "main");
111
112 const auto& function = Function::Handle(GetFunction(root_library, "main"));
113 TestPipeline pipeline(function, CompilerPass::kJIT);
114 FlowGraph* flow_graph = pipeline.RunPasses({});
115 ASSERT(flow_graph != nullptr);
116
117 auto entry = flow_graph->graph_entry()->normal_entry();
118 EXPECT(entry != nullptr);
119
120 StaticCallInstr* object = nullptr;
121 LoadFieldInstr* field_load = nullptr;
122 ReachabilityFenceInstr* fence = nullptr;

◆ ISOLATE_UNIT_TEST_CASE() [275/463]

dart::ISOLATE_UNIT_TEST_CASE ( ReachabilityFence_NoCanonicalize  )

Definition at line 124 of file reachability_fence_test.cc.

126 {
127 // Get the object from some method
128 {kMatchAndMoveStaticCall, &object},
129 // Load the field outside the loop.
130 {kMatchAndMoveLoadField, &field_load},
131 // Go into the loop.
133 // The fence should not be moved outside of the loop.
134 {kMatchAndMoveReachabilityFence, &fence},
135 },
136 /*insert_before=*/kMoveGlob));
137
138 EXPECT(field_load->instance()->definition() == object);
139 EXPECT(fence->value()->definition() == object);
140}
141
142ISOLATE_UNIT_TEST_CASE(ReachabilityFence_NoCanonicalize) {
143 // clang-format off
144 auto kScript =
145 Utils::CStringUniquePtr(OS::SCreate(nullptr, R"(
146 import 'dart:_internal' show reachabilityFence;
147
148 int someGlobal = 0;
149
150 class A {
151 int%s a;
152 }
153
154 @pragma('vm:never-inline')
155 A makeSomeA() {
156 return A()..a = 10;
157 }
158
159 void someFunction(int arg) {
160 someGlobal += arg;
161 }
162
163 main() {
164 final object = makeSomeA();
165 reachabilityFence(object);
166 for(int i = 0; i < 100000; i++) {
167 someFunction(object.a%s);
168 reachabilityFence(object);
169 }
170 reachabilityFence(object);
171 reachabilityFence(object);
172 }
173 )", TestCase::NullableTag(), TestCase::NullAssertTag()), std::free);
174 // clang-format on
175
176 const auto& root_library = Library::Handle(LoadTestScript(kScript.get()));
177
178 Invoke(root_library, "main");
179
180 const auto& function = Function::Handle(GetFunction(root_library, "main"));
181 TestPipeline pipeline(function, CompilerPass::kJIT);
182 FlowGraph* flow_graph = pipeline.RunPasses({});
183 ASSERT(flow_graph != nullptr);
184
185 auto entry = flow_graph->graph_entry()->normal_entry();
186 EXPECT(entry != nullptr);
187
188 StaticCallInstr* object = nullptr;
189 ReachabilityFenceInstr* fence1 = nullptr;
190 ReachabilityFenceInstr* fence2 = nullptr;
191 ReachabilityFenceInstr* fence3 = nullptr;
192 ReachabilityFenceInstr* fence4 = nullptr;
193

◆ ISOLATE_UNIT_TEST_CASE() [276/463]

dart::ISOLATE_UNIT_TEST_CASE ( ReachabilityFence_Simple  )

Definition at line 17 of file reachability_fence_test.cc.

17 {
18 // clang-format off
19 auto kScript =
20 Utils::CStringUniquePtr(OS::SCreate(nullptr,
21 R"(
22 import 'dart:_internal' show reachabilityFence;
23
24 int someGlobal = 0;
25
26 class A {
27 int%s a;
28 }
29
30 void someFunction(int arg) {
31 someGlobal += arg;
32 }
33
34 main() {
35 final object = A()..a = 10;
36 someFunction(object.a%s);
37 reachabilityFence(object);
38 }
39 )",
40 TestCase::NullableTag(), TestCase::NullAssertTag()), std::free);
41 // clang-format on
42
43 const auto& root_library = Library::Handle(LoadTestScript(kScript.get()));
44
45 Invoke(root_library, "main");
46
47 const auto& function = Function::Handle(GetFunction(root_library, "main"));
48 TestPipeline pipeline(function, CompilerPass::kJIT);
49 FlowGraph* flow_graph = pipeline.RunPasses({});
50 ASSERT(flow_graph != nullptr);
51
52 auto entry = flow_graph->graph_entry()->normal_entry();
53 EXPECT(entry != nullptr);
54
55 // v2 <- AllocateObject(A <not-aliased>) T{A}
56 // ...
57 // [use field of object v2]

◆ ISOLATE_UNIT_TEST_CASE() [277/463]

dart::ISOLATE_UNIT_TEST_CASE ( RecursiveSafepointTest1  )

Definition at line 684 of file thread_test.cc.

684 {
685 intptr_t count = 0;
686 {
687 GcSafepointOperationScope safepoint_scope(thread);
688 count += 1;
689 {
690 GcSafepointOperationScope safepoint_scope(thread);
691 count += 1;
692 {
693 GcSafepointOperationScope safepoint_scope(thread);
694 count += 1;
695 }
696 }
697 }
698 EXPECT(count == 3);
699}

◆ ISOLATE_UNIT_TEST_CASE() [278/463]

dart::ISOLATE_UNIT_TEST_CASE ( RecursiveSafepointTest2  )

Definition at line 816 of file thread_test.cc.

816 {
817 Isolate* isolate = thread->isolate();
818 Monitor monitor;
819 intptr_t expected_count = 0;
820 intptr_t total_done = 0;
821 intptr_t exited = 0;
822 for (int i = 0; i < SafepointTestTask::kTaskCount; i++) {
823 Dart::thread_pool()->Run<SafepointTestTask>(
824 isolate, &monitor, &expected_count, &total_done, &exited);
825 }
826 bool all_helpers = false;
827 do {
828 GcSafepointOperationScope safepoint_scope(thread);
829 {
830 GcSafepointOperationScope safepoint_scope(thread);
831 MonitorLocker ml(&monitor);
832 if (expected_count == SafepointTestTask::kTaskCount) {
833 all_helpers = true;
834 }
835 }
836 } while (!all_helpers);
837 String& label = String::Handle(String::New("foo"));
838 UserTag& tag = UserTag::Handle(UserTag::New(label));
839 isolate->set_current_tag(tag);
840 bool all_exited = false;
841 do {
842 GcSafepointOperationScope safepoint_scope(thread);
843 {
844 GcSafepointOperationScope safepoint_scope(thread);
845 MonitorLocker ml(&monitor);
846 if (exited == SafepointTestTask::kTaskCount) {
847 all_exited = true;
848 }
849 }
850 } while (!all_exited);
851}
void set_current_tag(const UserTag &tag)
Definition isolate.cc:3176

◆ ISOLATE_UNIT_TEST_CASE() [279/463]

dart::ISOLATE_UNIT_TEST_CASE ( RegenerateAllocStubs  )

Definition at line 130 of file compiler_test.cc.

130 {
131 const char* kScriptChars =
132 "class A {\n"
133 "}\n"
134 "unOpt() => new A(); \n"
135 "optIt() => new A(); \n"
136 "A main() {\n"
137 " return unOpt();\n"
138 "}\n";
139
140 Class& cls = Class::Handle();
141 TransitionVMToNative transition(thread);
142
143 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
144 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, nullptr);
146
147 {
148 TransitionNativeToVM transition(thread);
149 Library& lib_handle =
150 Library::Handle(Library::RawCast(Api::UnwrapHandle(lib)));
151 cls = lib_handle.LookupClass(String::Handle(Symbols::New(thread, "A")));
152 EXPECT(!cls.IsNull());
153 }
154
155 {
156 TransitionNativeToVM transition(thread);
158 }
159 result = Dart_Invoke(lib, NewString("main"), 0, nullptr);
161
162 {
163 TransitionNativeToVM transition(thread);
165 }
166 result = Dart_Invoke(lib, NewString("main"), 0, nullptr);
168
169 {
170 TransitionNativeToVM transition(thread);
172 }
173 result = Dart_Invoke(lib, NewString("main"), 0, nullptr);
175}
void DisableAllocationStub() const
Definition object.cc:5934

◆ ISOLATE_UNIT_TEST_CASE() [280/463]

dart::ISOLATE_UNIT_TEST_CASE ( RegExp_OneByteString  )

Definition at line 25 of file regexp_test.cc.

25 {
26 uint8_t chars[] = {'a', 'b', 'c', 'b', 'a'};
27 intptr_t len = ARRAY_SIZE(chars);
28 const String& str =
29 String::Handle(OneByteString::New(chars, len, Heap::kNew));
30
31 const String& pat =
32 String::Handle(Symbols::New(thread, String::Handle(String::New("bc"))));
33 const Array& res = Array::Handle(Match(pat, str));
34 EXPECT_EQ(2, res.Length());
35
36 const Object& res_1 = Object::Handle(res.At(0));
37 const Object& res_2 = Object::Handle(res.At(1));
38 EXPECT(res_1.IsSmi());
39 EXPECT(res_2.IsSmi());
40
41 const Smi& smi_1 = Smi::Cast(res_1);
42 const Smi& smi_2 = Smi::Cast(res_2);
43 EXPECT_EQ(1, smi_1.Value());
44 EXPECT_EQ(3, smi_2.Value());
45}

◆ ISOLATE_UNIT_TEST_CASE() [281/463]

dart::ISOLATE_UNIT_TEST_CASE ( RegExp_TwoByteString  )

Definition at line 47 of file regexp_test.cc.

47 {
48 uint16_t chars[] = {'a', 'b', 'c', 'b', 'a'};
49 intptr_t len = ARRAY_SIZE(chars);
50 const String& str =
51 String::Handle(TwoByteString::New(chars, len, Heap::kNew));
52
53 const String& pat =
54 String::Handle(Symbols::New(thread, String::Handle(String::New("bc"))));
55 const Array& res = Array::Handle(Match(pat, str));
56 EXPECT_EQ(2, res.Length());
57
58 const Object& res_1 = Object::Handle(res.At(0));
59 const Object& res_2 = Object::Handle(res.At(1));
60 EXPECT(res_1.IsSmi());
61 EXPECT(res_2.IsSmi());
62
63 const Smi& smi_1 = Smi::Cast(res_1);
64 const Smi& smi_2 = Smi::Cast(res_2);
65 EXPECT_EQ(1, smi_1.Value());
66 EXPECT_EQ(3, smi_2.Value());
67}

◆ ISOLATE_UNIT_TEST_CASE() [282/463]

dart::ISOLATE_UNIT_TEST_CASE ( Reload_AtNonReloadSafepoint  )

Definition at line 791 of file safepoint_test.cc.

791 {
792 auto isolate = thread->isolate();
793 auto messages = isolate->message_handler();
794
796
797 // The [ReloadTask] will trigger a reload safepoint operation, sees that
798 // we are at not at reload safepoint & sends us an OOB and waits for us to
799 // check-in.
800 std::shared_ptr<ReloadTask::Data> task(
801 new ReloadTask::Data(isolate->group()));
802 pool.Run<ReloadTask>(task);
803 task->WaitUntil(ReloadTask::kEntered);
804
805 {
806 NoReloadScope no_reload(thread);
807
808 // We are not at a safepoint.
809 ASSERT(!thread->IsAtSafepoint());
810
811 // Enter a non-reload safepoint.
812 thread->EnterSafepoint();
813 {
814 // We are at a safepoint but not a reload safepoint. So we'll get an OOM.
815 ASSERT(thread->IsAtSafepoint());
816 while (!messages->HasOOBMessages()) {
817 OS::Sleep(1000);
818 }
819 // Ensure we got a valid OOM
820 std::unique_ptr<Message> message = messages->StealOOBMessage();
821 EnsureValidOOBMessage(thread, isolate, std::move(message));
822 }
823 thread->ExitSafepoint();
824
825 EXPECT(!messages->HasOOBMessages());
826 }
827
828 // We left the [NoReloadScope] which in it's destructor should detect
829 // that a reload safepoint operation is requested and re-send OOM message to
830 // current isolate.
831 EXPECT(messages->HasOOBMessages());
832 std::unique_ptr<Message> message = messages->StealOOBMessage();
833 EnsureValidOOBMessage(thread, isolate, std::move(message));
834
835 // Finally participate in the reload safepoint and finish.
836 {
837 ReloadParticipationScope allow_reload(thread);
838 thread->BlockForSafepoint();
839 }
840
841 task->MarkAndNotify(ReloadTask::kPleaseExit);
842 task->WaitUntil(ReloadTask::kExited);
843}
static void EnsureValidOOBMessage(Thread *thread, Isolate *isolate, std::unique_ptr< Message > message)
AsThreadStackResource< RawReloadParticipationScope > ReloadParticipationScope
Definition thread.h:1612

◆ ISOLATE_UNIT_TEST_CASE() [283/463]

dart::ISOLATE_UNIT_TEST_CASE ( Reload_AtReloadSafepoint  )

Definition at line 704 of file safepoint_test.cc.

704 {
705 auto isolate = thread->isolate();
706 auto messages = isolate->message_handler();
707
709
710 {
711 ReloadParticipationScope allow_reload(thread);
712
713 // We are not at a safepoint.
714 ASSERT(!thread->IsAtSafepoint());
715
716 // Enter a reload safepoint.
717 thread->EnterSafepoint();
718 {
719 // The [ReloadTask] will trigger a reload safepoint operation, sees that
720 // we are at reload safepoint & finishes without sending OOB message.
721 std::shared_ptr<ReloadTask::Data> task(
722 new ReloadTask::Data(isolate->group()));
723 pool.Run<ReloadTask>(task);
724 task->WaitUntil(ReloadTask::kEntered);
725 task->MarkAndNotify(ReloadTask::kPleaseExit);
726 task->WaitUntil(ReloadTask::kExited);
727 }
728 thread->ExitSafepoint();
729
730 EXPECT(!messages->HasOOBMessages());
731 }
732}

◆ ISOLATE_UNIT_TEST_CASE() [284/463]

dart::ISOLATE_UNIT_TEST_CASE ( Reload_NotAtSafepoint  )

Definition at line 750 of file safepoint_test.cc.

750 {
751 auto isolate = thread->isolate();
752 auto messages = isolate->message_handler();
753
755
756 std::shared_ptr<ReloadTask::Data> task(
757 new ReloadTask::Data(isolate->group()));
758
759 {
760 // Even if we are not running with an active isolate (e.g. due to being in
761 // GC / Compiler) the reload safepoint operation should still send us an OOB
762 // message (it should know this thread belongs to an isolate).
763 NoActiveIsolateScope no_active_isolate(thread);
764
765 pool.Run<ReloadTask>(task);
766 task->WaitUntil(ReloadTask::kEntered);
767
768 // We are not at a safepoint. The [ReloadTask] will trigger a reload
769 // safepoint operation, sees that we are not at reload safepoint and instead
770 // sends us an OOB.
771 ASSERT(!thread->IsAtSafepoint());
772 while (!messages->HasOOBMessages()) {
773 OS::Sleep(1000);
774 }
775 }
776
777 // Examine the OOB message for it's content.
778 std::unique_ptr<Message> message = messages->StealOOBMessage();
779 EnsureValidOOBMessage(thread, isolate, std::move(message));
780
781 // Finally participate in the reload safepoint and finish.
782 {
783 ReloadParticipationScope allow_reload(thread);
784 thread->BlockForSafepoint();
785 }
786
787 task->MarkAndNotify(ReloadTask::kPleaseExit);
788 task->WaitUntil(ReloadTask::kExited);
789}

◆ ISOLATE_UNIT_TEST_CASE() [285/463]

dart::ISOLATE_UNIT_TEST_CASE ( ReloadScopes_Test  )

Definition at line 653 of file safepoint_test.cc.

653 {
654 // Unscheduling an isolate will enter a safepoint that is reloadable.
655 {
656 TransitionVMToNative transition(thread);
657 IsolateExitScope isolate_leave_scope;
658 EXPECT(thread->IsAtSafepoint(SafepointLevel::kGCAndDeoptAndReload));
659 }
660
661 // Unscheduling an isolate with active [NoReloadScope] will enter a safepoint
662 // that is not reloadable.
663 {
664 // [NoReloadScope] only works if reload is supported.
665#if !defined(PRODUCT)
666 NoReloadScope no_reload_scope(thread);
667 TransitionVMToNative transition(thread);
668 IsolateExitScope isolate_leave_scope;
669 EXPECT(!thread->IsAtSafepoint(SafepointLevel::kGCAndDeoptAndReload));
670 EXPECT(thread->IsAtSafepoint(SafepointLevel::kGCAndDeopt));
671#endif // !defined(PRODUCT)
672 }
673
674 // Transitioning to native doesn't mean we enter a safepoint that is
675 // reloadable.
676 // => We may want to allow this in the future (so e.g. isolates that perform
677 // blocking FFI call can be reloaded while being blocked).
678 {
679 TransitionVMToNative transition(thread);
680 EXPECT(!thread->IsAtSafepoint(SafepointLevel::kGCAndDeoptAndReload));
681 EXPECT(thread->IsAtSafepoint(SafepointLevel::kGCAndDeopt));
682 }
683
684 // Transitioning to native with explicit [ReloadParticipationScope] will
685 // enter a safepoint that is reloadable.
686 {
687 ReloadParticipationScope enable_reload(thread);
688 TransitionVMToNative transition(thread);
689 EXPECT(thread->IsAtSafepoint(SafepointLevel::kGCAndDeoptAndReload));
690 }
691}

◆ ISOLATE_UNIT_TEST_CASE() [286/463]

dart::ISOLATE_UNIT_TEST_CASE ( RetainingPathGCRoot  )

Definition at line 146 of file object_graph_test.cc.

146 {
147 Dart_PersistentHandle persistent_handle;
148 Dart_WeakPersistentHandle weak_persistent_handle;
149 Array& path = Array::Handle(Array::New(1, Heap::kNew));
150 ObjectGraph graph(thread);
151 Dart_Handle handle = Api::NewHandle(thread, path.ptr());
152
153 // GC root should be a local handle
154 auto result = graph.RetainingPath(&path, path);
155 EXPECT_STREQ(result.gc_root_type, "local handle");
156
157 // GC root should now be a weak persistent handle
158 {
159 TransitionVMToNative transition(thread);
160 weak_persistent_handle = Dart_NewWeakPersistentHandle(
161 handle, reinterpret_cast<void*>(0xdeadbeef), 128, WeakHandleFinalizer);
162 }
163 result = graph.RetainingPath(&path, path);
164 EXPECT_STREQ(result.gc_root_type, "weak persistent handle");
165
166 // GC root should now be a persistent handle
167 {
168 TransitionVMToNative transition(thread);
169 persistent_handle = Dart_NewPersistentHandle(handle);
170 }
171 result = graph.RetainingPath(&path, path);
172 EXPECT_STREQ(result.gc_root_type, "persistent handle");
173
174 // Delete the persistent handle. GC root should now be weak persistent handle
175 {
176 TransitionVMToNative transition(thread);
177 Dart_DeletePersistentHandle(persistent_handle);
178 persistent_handle = nullptr;
179 }
180 result = graph.RetainingPath(&path, path);
181 EXPECT_STREQ(result.gc_root_type, "weak persistent handle");
182
183 // Delete the weak persistent handle. GC root should now be local handle.
184 {
185 TransitionVMToNative transition(thread);
186 Dart_DeleteWeakPersistentHandle(weak_persistent_handle);
187 weak_persistent_handle = nullptr;
188 }
189 result = graph.RetainingPath(&path, path);
190 EXPECT_STREQ(result.gc_root_type, "local handle");
191}
DART_EXPORT Dart_PersistentHandle Dart_NewPersistentHandle(Dart_Handle object)
Dart_Handle Dart_PersistentHandle
Definition dart_api.h:259
DART_EXPORT Dart_WeakPersistentHandle Dart_NewWeakPersistentHandle(Dart_Handle object, void *peer, intptr_t external_allocation_size, Dart_HandleFinalizer callback)

◆ ISOLATE_UNIT_TEST_CASE() [287/463]

dart::ISOLATE_UNIT_TEST_CASE ( SafepointMonitorUnlockScope  )

Definition at line 1141 of file thread_test.cc.

1141 {
1142 // This test uses ASSERT instead of EXPECT because IsOwnedByCurrentThread is
1143 // only available in debug mode. Since our vm/cc tests run in DEBUG mode that
1144 // is sufficient for this test.
1145 Monitor monitor;
1146 {
1147 SafepointMonitorLocker ml(&monitor);
1148 ASSERT(monitor.IsOwnedByCurrentThread());
1149 {
1150 SafepointMonitorUnlockScope ml_unlocker(&ml);
1151 ASSERT(!monitor.IsOwnedByCurrentThread());
1152 {
1153 SafepointMonitorLocker inner_ml(&monitor);
1154 ASSERT(monitor.IsOwnedByCurrentThread());
1155 }
1156 }
1157 }
1158}
bool IsOwnedByCurrentThread() const
Definition os_thread.h:370

◆ ISOLATE_UNIT_TEST_CASE() [288/463]

dart::ISOLATE_UNIT_TEST_CASE ( SafepointMutexLockerWithLongJmp  )

Definition at line 1059 of file thread_test.cc.

1059 {
1060 RunLockerWithLongJumpTest<Mutex, SafepointMutexLocker>();
1061}

◆ ISOLATE_UNIT_TEST_CASE() [289/463]

dart::ISOLATE_UNIT_TEST_CASE ( SafepointOperation_DeoptAndNonDeoptNesting  )

Definition at line 601 of file safepoint_test.cc.

601 {
602 auto safepoint_handler = thread->isolate_group()->safepoint_handler();
603 {
604 DeoptSafepointOperationScope safepoint_scope(thread);
605 EXPECT(safepoint_handler->InnermostSafepointOperation(thread) ==
606 SafepointLevel::kGCAndDeopt);
607 DeoptSafepointOperationScope safepoint_scope2(thread);
608 EXPECT(safepoint_handler->InnermostSafepointOperation(thread) ==
609 SafepointLevel::kGCAndDeopt);
610 GcSafepointOperationScope safepoint_scope3(thread);
611 EXPECT(safepoint_handler->InnermostSafepointOperation(thread) ==
612 SafepointLevel::kGC);
613 GcSafepointOperationScope safepoint_scope4(thread);
614 EXPECT(safepoint_handler->InnermostSafepointOperation(thread) ==
615 SafepointLevel::kGC);
616 }
617 {
618 DeoptSafepointOperationScope safepoint_scope(thread);
619 EXPECT(safepoint_handler->InnermostSafepointOperation(thread) ==
620 SafepointLevel::kGCAndDeopt);
621 GcSafepointOperationScope safepoint_scope2(thread);
622 EXPECT(safepoint_handler->InnermostSafepointOperation(thread) ==
623 SafepointLevel::kGC);
624 }
625 {
626 GcSafepointOperationScope safepoint_scope1(thread);
627 EXPECT(safepoint_handler->InnermostSafepointOperation(thread) ==
628 SafepointLevel::kGC);
629 GcSafepointOperationScope safepoint_scope2(thread);
630 EXPECT(safepoint_handler->InnermostSafepointOperation(thread) ==
631 SafepointLevel::kGC);
632 }
633}

◆ ISOLATE_UNIT_TEST_CASE() [290/463]

dart::ISOLATE_UNIT_TEST_CASE ( SafepointOperation_SafepointOpBlockedWhileDeoptSafepointOp  )

Definition at line 241 of file safepoint_test.cc.

242 {
243 auto isolate_group = thread->isolate_group();
244
245 std::shared_ptr<LongDeoptTask::Data> deopt(
246 new LongDeoptTask::Data(isolate_group));
247 std::shared_ptr<WaiterTask::Data> gc(new WaiterTask::Data(isolate_group));
248
249 thread->EnterSafepoint();
250 {
251 // Will join outstanding threads on destruction.
253
254 pool.Run<LongDeoptTask>(deopt);
255 pool.Run<WaiterTask>(gc);
256
257 // Wait until both threads entered the isolate group.
258 deopt->WaitUntil(LongDeoptTask::kEntered);
259 gc->WaitUntil(WaiterTask::kEntered);
260
261 // Let gc task enter safepoint.
262 gc->MarkAndNotify(WaiterTask::kEnterSafepoint);
263 gc->WaitUntil(WaiterTask::kInsideSafepoint);
264
265 // Now let the "deopt operation" run and block.
266 deopt->MarkAndNotify(LongDeoptTask::kStartDeoptOperation);
267 deopt->WaitUntil(LongDeoptTask::kInsideDeoptOperation);
268
269 // Now let the gc task try to exit safepoint and do it's own safepoint
270 // operation: We expect it to block on exiting safepoint, since the deopt
271 // operation is still ongoing.
272 gc->MarkAndNotify(WaiterTask::kPleaseExitSafepoint);
273 OS::Sleep(200);
274 gc->AssertIsNotIn(WaiterTask::kExitedSafepoint);
275
276 // Now let's finish the deopt operation & ensure the waiter thread made
277 // progress.
278 deopt->MarkAndNotify(LongDeoptTask::kFinishDeoptOperation);
279 gc->WaitUntil(WaiterTask::kExitedSafepoint);
280
281 // Make both threads exit the isolate group.
282 deopt->MarkAndNotify(LongDeoptTask::kPleaseExit);
283 gc->MarkAndNotify(WaiterTask::kPleaseExit);
284
285 deopt->WaitUntil(LongDeoptTask::kExited);
286 gc->WaitUntil(WaiterTask::kExited);
287 }
288 thread->ExitSafepoint();
289}

◆ ISOLATE_UNIT_TEST_CASE() [291/463]

dart::ISOLATE_UNIT_TEST_CASE ( SafepointOperation_SafepointOpWhileDeoptSafepointOpBlocked  )

Definition at line 140 of file safepoint_test.cc.

141 {
142 auto isolate_group = thread->isolate_group();
143
144 std::shared_ptr<DeoptTask::Data> deopt(new DeoptTask::Data(isolate_group));
145 std::shared_ptr<GcWithoutDeoptTask::Data> gc(
146 new GcWithoutDeoptTask::Data(isolate_group));
147
148 thread->EnterSafepoint();
149 {
150 // Will join outstanding threads on destruction.
152
153 pool.Run<DeoptTask>(deopt);
154 pool.Run<GcWithoutDeoptTask>(gc);
155
156 // Wait until both threads entered the isolate group.
157 deopt->WaitUntil(DeoptTask::kEntered);
158 gc->WaitUntil(GcWithoutDeoptTask::kEntered);
159
160 // Let deopt task start deopt operation scope (it will block in
161 // [SafepointOperationScope] constructor until all threads have checked-in).
162 deopt->MarkAndNotify(DeoptTask::kStartDeoptOperation);
163 OS::Sleep(200); // Give it time to actually start the deopt operation
164
165 // Now let the other thread do a full safepoint operation and wait until
166 // it's done: We want to ensure that we can do normal safepoint operations
167 // while a deopt operation is being started and is waiting for all mutators
168 // to reach an appropriate place where they can be deopted.
169 gc->MarkAndNotify(GcWithoutDeoptTask::kStartSafepointOperation);
170 gc->WaitUntil(GcWithoutDeoptTask::kEndSafepointOperation);
171
172 // We were successfully doing a safepoint operation, now let's ensure the
173 // first thread is still stuck in the starting of deopt operation.
174 deopt->AssertIsIn(DeoptTask::kStartDeoptOperation);
175
176 // Now we'll let the other thread check-in and ensure the deopt operation
177 // proceeded and finished.
178 gc->MarkAndNotify(GcWithoutDeoptTask::kJoinDeoptOperation);
179 gc->WaitUntil(GcWithoutDeoptTask::kDeoptOperationDone);
180 deopt->WaitUntil(DeoptTask::kFinishedDeoptOperation);
181
182 // Make both threads exit the isolate group.
183 deopt->MarkAndNotify(DeoptTask::kPleaseExit);
184 gc->MarkAndNotify(GcWithoutDeoptTask::kPleaseExit);
185
186 deopt->WaitUntil(DeoptTask::kExited);
187 gc->WaitUntil(GcWithoutDeoptTask::kExited);
188 }
189 thread->ExitSafepoint();
190}

◆ ISOLATE_UNIT_TEST_CASE() [292/463]

dart::ISOLATE_UNIT_TEST_CASE ( SafepointOperation_SafepointPointTest  )

Definition at line 392 of file safepoint_test.cc.

392 {
393 auto isolate_group = thread->isolate_group();
394
395 const intptr_t kTaskCount = 6;
396 std::atomic<intptr_t> gc_only_checkins[kTaskCount];
397 std::atomic<intptr_t> deopt_checkins[kTaskCount];
398 std::atomic<intptr_t> reload_checkins[kTaskCount];
399 std::atomic<intptr_t> timeout_checkins[kTaskCount];
400 for (intptr_t i = 0; i < kTaskCount; ++i) {
401 gc_only_checkins[i] = 0;
402 deopt_checkins[i] = 0;
403 reload_checkins[i] = 0;
404 timeout_checkins[i] = 0;
405 }
406
407 auto task_to_level = [](intptr_t task_id) -> SafepointLevel {
408 switch (task_id) {
409 case 0:
410 case 1:
411 return SafepointLevel::kGC;
412 case 2:
413 case 3:
414 return SafepointLevel::kGCAndDeopt;
415 case 4:
416 case 5:
417 return SafepointLevel::kGCAndDeoptAndReload;
418 default:
419 UNREACHABLE();
420 return SafepointLevel::kGC;
421 }
422 };
423 auto wait_for_sync = [&](intptr_t syncs) {
424 while (true) {
425 bool ready = true;
426 for (intptr_t i = 0; i < kTaskCount; ++i) {
427 const intptr_t all = gc_only_checkins[i] + deopt_checkins[i] +
428 reload_checkins[i] + timeout_checkins[i];
429 if (all != syncs) {
430 ready = false;
431 break;
432 }
433 }
434 if (ready) {
435 return;
436 }
437 OS::SleepMicros(1000);
438 }
439 };
440
441 std::vector<std::shared_ptr<CheckinTask::Data>> threads;
442 for (intptr_t i = 0; i < kTaskCount; ++i) {
443 const auto level = task_to_level(i);
444 std::unique_ptr<CheckinTask::Data> data(new CheckinTask::Data(
445 isolate_group, level, &gc_only_checkins[i], &deopt_checkins[i],
446 &reload_checkins[i], &timeout_checkins[i]));
447 threads.push_back(std::move(data));
448 }
449
450 {
451 // Will join outstanding threads on destruction.
452 ThreadPool pool;
453
454 for (intptr_t i = 0; i < kTaskCount; i++) {
455 pool.Run<CheckinTask>(threads[i]);
456 }
457 for (intptr_t i = 0; i < kTaskCount; i++) {
458 threads[i]->WaitUntil(CheckinTask::kEntered);
459 }
460 for (intptr_t i = 0; i < kTaskCount; i++) {
461 threads[i]->MarkAndNotify(CheckinTask::kStartLoop);
462 }
463 {
464 { GcSafepointOperationScope safepoint_operation(thread); }
465 wait_for_sync(1); // Wait for threads to exit safepoint
466 { DeoptSafepointOperationScope safepoint_operation(thread); }
467 wait_for_sync(2); // Wait for threads to exit safepoint
468 { RELOAD_OPERATION_SCOPE(thread); }
469 wait_for_sync(3); // Wait for threads to exit safepoint
470 { GcSafepointOperationScope safepoint_operation(thread); }
471 wait_for_sync(4); // Wait for threads to exit safepoint
472 { DeoptSafepointOperationScope safepoint_operation(thread); }
473 wait_for_sync(5); // Wait for threads to exit safepoint
474 { RELOAD_OPERATION_SCOPE(thread); }
475 }
476 for (intptr_t i = 0; i < kTaskCount; i++) {
477 threads[i]->MarkAndNotify(CheckinTask::kPleaseExit);
478 }
479 for (intptr_t i = 0; i < kTaskCount; i++) {
480 threads[i]->WaitUntil(CheckinTask::kExited);
481 }
482 for (intptr_t i = 0; i < kTaskCount; ++i) {
483 switch (task_to_level(i)) {
484 case SafepointLevel::kGC:
485 EXPECT_EQ(2, gc_only_checkins[i]);
486 EXPECT_EQ(0, deopt_checkins[i]);
487 EXPECT_EQ(0, reload_checkins[i]);
488 EXPECT_EQ(4, timeout_checkins[i]);
489 break;
490 case SafepointLevel::kGCAndDeopt:
491 EXPECT_EQ(0, gc_only_checkins[i]);
492 EXPECT_EQ(4, deopt_checkins[i]);
493 EXPECT_EQ(0, reload_checkins[i]);
494 EXPECT_EQ(2, timeout_checkins[i]);
495 break;
496 case SafepointLevel::kGCAndDeoptAndReload:
497 EXPECT_EQ(0, gc_only_checkins[i]);
498 EXPECT_EQ(0, deopt_checkins[i]);
499 EXPECT_EQ(6, reload_checkins[i]);
500 EXPECT_EQ(0, timeout_checkins[i]);
501 break;
502 case SafepointLevel::kNumLevels:
503 case SafepointLevel::kNoSafepoint:
504 UNREACHABLE();
505 }
506 }
507 }
508}
#define RELOAD_OPERATION_SCOPE(thread_expr)
SIT bool all(const Vec< 1, T > &x)
Definition SkVx.h:582

◆ ISOLATE_UNIT_TEST_CASE() [293/463]

dart::ISOLATE_UNIT_TEST_CASE ( SafepointOperation_StressTest  )

Definition at line 565 of file safepoint_test.cc.

565 {
566 auto isolate_group = thread->isolate_group();
567
568 const intptr_t kTaskCount = 5;
569
570 std::vector<std::shared_ptr<StressTask::Data>> threads;
571 for (intptr_t i = 0; i < kTaskCount; ++i) {
572 std::unique_ptr<StressTask::Data> data(new StressTask::Data(isolate_group));
573 threads.push_back(std::move(data));
574 }
575
576 thread->EnterSafepoint();
577 {
578 // Will join outstanding threads on destruction.
579 ThreadPool pool;
580
581 for (intptr_t i = 0; i < kTaskCount; i++) {
582 pool.Run<StressTask>(threads[i]);
583 }
584 for (intptr_t i = 0; i < kTaskCount; i++) {
585 threads[i]->WaitUntil(StressTask::kEntered);
586 }
587 for (intptr_t i = 0; i < kTaskCount; i++) {
588 threads[i]->MarkAndNotify(StressTask::kStart);
589 }
590 OS::Sleep(3 * 1000);
591 for (intptr_t i = 0; i < kTaskCount; i++) {
592 threads[i]->MarkAndNotify(StressTask::kPleaseExit);
593 }
594 for (intptr_t i = 0; i < kTaskCount; i++) {
595 threads[i]->WaitUntil(StressTask::kExited);
596 }
597 }
598 thread->ExitSafepoint();
599}

◆ ISOLATE_UNIT_TEST_CASE() [294/463]

dart::ISOLATE_UNIT_TEST_CASE ( SafepointRwLockExclusiveNestedWriter_Regress44000  )

Definition at line 1097 of file thread_test.cc.

1097 {
1098 auto isolate_group = IsolateGroup::Current();
1099
1100 SafepointRwLock lock;
1102 state.rw_lock = &lock;
1103 state.isolate_group = isolate_group;
1104 state.value = 0;
1105 state.child_started = false;
1106 state.monitor = new Monitor();
1107 {
1108 // Hold one writer lock.
1109 SafepointWriteRwLocker locker(Thread::Current(), &lock);
1110 {
1111 // Hold another, nested, writer lock.
1112 SafepointWriteRwLocker locker2(Thread::Current(), &lock);
1113
1114 // Start a thread, it will try to acquire read lock but it will have to
1115 // wait until we have exited both writer scopes.
1116 if (OSThread::Start("DartWorker", &Helper,
1117 reinterpret_cast<uword>(&state)) != 0) {
1118 FATAL("Could not start worker thread");
1119 }
1120 // Wait for the thread to start.
1121 {
1122 MonitorLocker ml(state.monitor);
1123 while (!state.child_started) {
1124 ml.Wait();
1125 }
1126 }
1127 state.value = 1;
1128 }
1129 state.value = 2;
1130 }
1131 // Join the other thread.
1132 OSThread::Join(state.reader_id);
1133
1134 // Ensure the reader thread had to wait before it entered the
1135 // SafepointWriteRwLocker scope.
1136 EXPECT(state.observed_value == 2);
1137
1138 delete state.monitor;
1139}
SafepointRwLock * rw_lock

◆ ISOLATE_UNIT_TEST_CASE() [295/463]

dart::ISOLATE_UNIT_TEST_CASE ( SafepointRwLockReadWithLongJmp  )

Definition at line 1055 of file thread_test.cc.

1055 {
1056 RunLockerWithLongJumpTest<SafepointRwLock, SafepointReadRwLocker>();
1057}

◆ ISOLATE_UNIT_TEST_CASE() [296/463]

dart::ISOLATE_UNIT_TEST_CASE ( SafepointRwLockReentrantReadLock  )

Definition at line 981 of file thread_test.cc.

981 {
982 SafepointRwLock lock;
983 {
984 SafepointReadRwLocker locker(Thread::Current(), &lock);
985 {
986 SafepointReadRwLocker locker1(Thread::Current(), &lock);
987 DEBUG_ONLY(EXPECT(lock.IsCurrentThreadReader()));
989 }
990 DEBUG_ONLY(EXPECT(lock.IsCurrentThreadReader()));
992 }
993 DEBUG_ONLY(EXPECT(!lock.IsCurrentThreadReader()));
995}
bool IsCurrentThreadWriter()
Definition lockers.h:354

◆ ISOLATE_UNIT_TEST_CASE() [297/463]

dart::ISOLATE_UNIT_TEST_CASE ( SafepointRwLockReentrantWriteLock  )

Definition at line 997 of file thread_test.cc.

997 {
998 SafepointRwLock lock;
999 {
1000 SafepointWriteRwLocker locker(Thread::Current(), &lock);
1001 {
1002 SafepointWriteRwLocker locker1(Thread::Current(), &lock);
1003 DEBUG_ONLY(EXPECT(lock.IsCurrentThreadReader()));
1005 }
1006 DEBUG_ONLY(EXPECT(lock.IsCurrentThreadReader()));
1008 }
1009 DEBUG_ONLY(EXPECT(!lock.IsCurrentThreadReader()));
1011}

◆ ISOLATE_UNIT_TEST_CASE() [298/463]

dart::ISOLATE_UNIT_TEST_CASE ( SafepointRwLockWithoutAnyLocks  )

Definition at line 975 of file thread_test.cc.

975 {
976 SafepointRwLock lock;
977 DEBUG_ONLY(EXPECT(!lock.IsCurrentThreadReader()));
979}

◆ ISOLATE_UNIT_TEST_CASE() [299/463]

dart::ISOLATE_UNIT_TEST_CASE ( SafepointRwLockWithReadLock  )

Definition at line 961 of file thread_test.cc.

961 {
962 SafepointRwLock lock;
963 SafepointReadRwLocker locker(Thread::Current(), &lock);
964 DEBUG_ONLY(EXPECT(lock.IsCurrentThreadReader()));
966}

◆ ISOLATE_UNIT_TEST_CASE() [300/463]

dart::ISOLATE_UNIT_TEST_CASE ( SafepointRwLockWithWriteLock  )

Definition at line 968 of file thread_test.cc.

968 {
969 SafepointRwLock lock;
970 SafepointWriteRwLocker locker(Thread::Current(), &lock);
971 DEBUG_ONLY(EXPECT(lock.IsCurrentThreadReader()));
973}

◆ ISOLATE_UNIT_TEST_CASE() [301/463]

dart::ISOLATE_UNIT_TEST_CASE ( SafepointRwLockWriteToReadLock  )

Definition at line 1013 of file thread_test.cc.

1013 {
1014 SafepointRwLock lock;
1015 {
1016 SafepointWriteRwLocker locker(Thread::Current(), &lock);
1017 {
1018 SafepointReadRwLocker locker1(Thread::Current(), &lock);
1019 DEBUG_ONLY(EXPECT(lock.IsCurrentThreadReader()));
1021 }
1022 DEBUG_ONLY(EXPECT(lock.IsCurrentThreadReader()));
1024 }
1025 DEBUG_ONLY(EXPECT(!lock.IsCurrentThreadReader()));
1027}

◆ ISOLATE_UNIT_TEST_CASE() [302/463]

dart::ISOLATE_UNIT_TEST_CASE ( SafepointRwLockWriteWithLongJmp  )

Definition at line 1051 of file thread_test.cc.

1051 {
1052 RunLockerWithLongJumpTest<SafepointRwLock, SafepointWriteRwLocker>();
1053}

◆ ISOLATE_UNIT_TEST_CASE() [303/463]

dart::ISOLATE_UNIT_TEST_CASE ( SafepointTestVM  )

Definition at line 664 of file thread_test.cc.

664 {
665 Isolate* isolate = thread->isolate();
666 Monitor monitor;
667 intptr_t expected_count = 0;
668 intptr_t total_done = 0;
669 intptr_t exited = 0;
670 for (int i = 0; i < SafepointTestTask::kTaskCount; i++) {
671 Dart::thread_pool()->Run<SafepointTestTask>(
672 isolate, &monitor, &expected_count, &total_done, &exited);
673 }
674 String& label = String::Handle(String::New("foo"));
675 UserTag& tag = UserTag::Handle(UserTag::New(label));
676 isolate->set_current_tag(tag);
677 MonitorLocker ml(&monitor);
678 while (exited != SafepointTestTask::kTaskCount) {
679 ml.WaitWithSafepointCheck(thread);
680 }
681}

◆ ISOLATE_UNIT_TEST_CASE() [304/463]

dart::ISOLATE_UNIT_TEST_CASE ( SafepointTestVM2  )

Definition at line 785 of file thread_test.cc.

785 {
786 Isolate* isolate = thread->isolate();
787 Monitor monitor;
788 intptr_t expected_count = 0;
789 intptr_t total_done = 0;
790 intptr_t exited = 0;
791 for (int i = 0; i < SafepointTestTask::kTaskCount; i++) {
792 Dart::thread_pool()->Run<SafepointTestTask>(
793 isolate, &monitor, &expected_count, &total_done, &exited);
794 }
795 bool all_helpers = false;
796 do {
797 GcSafepointOperationScope safepoint_scope(thread);
798 {
799 MonitorLocker ml(&monitor);
800 if (expected_count == SafepointTestTask::kTaskCount) {
801 all_helpers = true;
802 }
803 }
804 } while (!all_helpers);
805 String& label = String::Handle(String::New("foo"));
806 UserTag& tag = UserTag::Handle(UserTag::New(label));
807 isolate->set_current_tag(tag);
808 MonitorLocker ml(&monitor);
809 while (exited != SafepointTestTask::kTaskCount) {
810 ml.WaitWithSafepointCheck(thread);
811 }
812}

◆ ISOLATE_UNIT_TEST_CASE() [305/463]

dart::ISOLATE_UNIT_TEST_CASE ( Script  )

Definition at line 2354 of file object_test.cc.

2354 {
2355 {
2356 const char* url_chars = "builtin:test-case";
2357 const char* source_chars = "This will not compile.";
2358 const String& url = String::Handle(String::New(url_chars));
2359 const String& source = String::Handle(String::New(source_chars));
2360 const Script& script = Script::Handle(Script::New(url, source));
2361 EXPECT(!script.IsNull());
2362 EXPECT(script.IsScript());
2363 String& str = String::Handle(script.url());
2364 EXPECT_EQ(17, str.Length());
2365 EXPECT_EQ('b', str.CharAt(0));
2366 EXPECT_EQ(':', str.CharAt(7));
2367 EXPECT_EQ('e', str.CharAt(16));
2368 str = script.Source();
2369 EXPECT_EQ(22, str.Length());
2370 EXPECT_EQ('T', str.CharAt(0));
2371 EXPECT_EQ('n', str.CharAt(10));
2372 EXPECT_EQ('.', str.CharAt(21));
2373 }
2374
2375 {
2376 const char* url_chars = "";
2377 // Single line, no terminators.
2378 const char* source_chars = "abc";
2379 const String& url = String::Handle(String::New(url_chars));
2380 const String& source = String::Handle(String::New(source_chars));
2381 const Script& script = Script::Handle(Script::New(url, source));
2382 EXPECT(!script.IsNull());
2383 EXPECT(script.IsScript());
2384 auto& str = String::Handle(Z);
2385 str = script.GetLine(1);
2386 EXPECT_STREQ("abc", str.ToCString());
2387 str = script.GetSnippet(1, 1, 1, 2);
2388 EXPECT_STREQ("a", str.ToCString());
2389 str = script.GetSnippet(1, 2, 1, 4);
2390 EXPECT_STREQ("bc", str.ToCString());
2391 // Lines not in the source should return the empty string.
2392 str = script.GetLine(-500);
2393 EXPECT_STREQ("", str.ToCString());
2394 str = script.GetLine(0);
2395 EXPECT_STREQ("", str.ToCString());
2396 str = script.GetLine(2);
2397 EXPECT_STREQ("", str.ToCString());
2398 str = script.GetLine(10000);
2399 EXPECT_STREQ("", str.ToCString());
2400 // Snippets not contained within the source should be the null string.
2401 str = script.GetSnippet(-1, 1, 1, 2);
2402 EXPECT(str.IsNull());
2403 str = script.GetSnippet(2, 1, 2, 2);
2404 EXPECT(str.IsNull());
2405 str = script.GetSnippet(1, 1, 1, 5);
2406 EXPECT(str.IsNull());
2407 }
2408
2409 TransitionVMToNative transition(thread);
2410 const char* kScript = "main() {}";
2411 Dart_Handle h_lib = TestCase::LoadTestScript(kScript, nullptr);
2412 EXPECT_VALID(h_lib);
2413 Dart_Handle result = Dart_Invoke(h_lib, NewString("main"), 0, nullptr);
2415}

◆ ISOLATE_UNIT_TEST_CASE() [306/463]

dart::ISOLATE_UNIT_TEST_CASE ( SecondExitDown  )

Definition at line 322 of file loops_test.cc.

323 {
324 int a = p1 + 3;
325 int b = p1 - 5;
326 int c = p1 * 7;
327 int d = - p1;
328 p1 = - p1;
329 p2 = 100 - p2;
330 }
331 }

◆ ISOLATE_UNIT_TEST_CASE() [307/463]

dart::ISOLATE_UNIT_TEST_CASE ( SecondExitUp  )

Definition at line 311 of file loops_test.cc.

317 {
318 const char* script_chars =
319 R"(
320 foo() {

◆ ISOLATE_UNIT_TEST_CASE() [308/463]

dart::ISOLATE_UNIT_TEST_CASE ( SerializeArray  )

Definition at line 410 of file snapshot_test.cc.

410 {
411 // Write snapshot with object content.
412 const int kArrayLength = 10;
413 Array& array = Array::Handle(Array::New(kArrayLength));
414 Smi& smi = Smi::Handle();
415 for (int i = 0; i < kArrayLength; i++) {
416 smi ^= Smi::New(i);
417 array.SetAt(i, smi);
418 }
419 std::unique_ptr<Message> message = WriteMessage(
420 /* same_group */ false, array, ILLEGAL_PORT, Message::kNormalPriority);
421
422 // Read object back from the snapshot.
423 Array& serialized_array = Array::Handle();
424 serialized_array ^= ReadMessage(thread, message.get());
425 EXPECT(array.CanonicalizeEquals(serialized_array));
426
427 // Read object back from the snapshot into a C structure.
428 ApiNativeScope scope;
429 Dart_CObject* root = ReadApiMessage(scope.zone(), message.get());
430 EXPECT_EQ(Dart_CObject_kArray, root->type);
431 EXPECT_EQ(kArrayLength, root->value.as_array.length);
432 for (int i = 0; i < kArrayLength; i++) {
433 Dart_CObject* element = root->value.as_array.values[i];
434 EXPECT_EQ(Dart_CObject_kInt32, element->type);
435 EXPECT_EQ(i, element->value.as_int32);
436 }
437 CheckEncodeDecodeMessage(scope.zone(), root);
438}

◆ ISOLATE_UNIT_TEST_CASE() [309/463]

dart::ISOLATE_UNIT_TEST_CASE ( SerializeArrayWithTypeArgument  )

Definition at line 440 of file snapshot_test.cc.

440 {
441 // Write snapshot with object content.
442 const int kArrayLength = 10;
443 Array& array =
444 Array::Handle(Array::New(kArrayLength, Type::Handle(Type::ObjectType())));
445
446 Smi& smi = Smi::Handle();
447 for (int i = 0; i < kArrayLength; i++) {
448 smi ^= Smi::New(i);
449 array.SetAt(i, smi);
450 }
451 std::unique_ptr<Message> message = WriteMessage(
452 /* same_group */ false, array, ILLEGAL_PORT, Message::kNormalPriority);
453
454 // Read object back from the snapshot.
455 Array& serialized_array = Array::Handle();
456 serialized_array ^= ReadMessage(thread, message.get());
457 EXPECT(array.CanonicalizeEquals(serialized_array));
458
459 // Read object back from the snapshot into a C structure.
460 ApiNativeScope scope;
461 Dart_CObject* root = ReadApiMessage(scope.zone(), message.get());
462 EXPECT_EQ(Dart_CObject_kArray, root->type);
463 EXPECT_EQ(kArrayLength, root->value.as_array.length);
464 for (int i = 0; i < kArrayLength; i++) {
465 Dart_CObject* element = root->value.as_array.values[i];
466 EXPECT_EQ(Dart_CObject_kInt32, element->type);
467 EXPECT_EQ(i, element->value.as_int32);
468 }
469 CheckEncodeDecodeMessage(scope.zone(), root);
470}

◆ ISOLATE_UNIT_TEST_CASE() [310/463]

dart::ISOLATE_UNIT_TEST_CASE ( SerializeByteArray  )

Definition at line 556 of file snapshot_test.cc.

556 {
557 // Write snapshot with object content.
558 const int kTypedDataLength = 256;
559 TypedData& typed_data = TypedData::Handle(
560 TypedData::New(kTypedDataUint8ArrayCid, kTypedDataLength));
561 for (int i = 0; i < kTypedDataLength; i++) {
562 typed_data.SetUint8(i, i);
563 }
564 std::unique_ptr<Message> message =
565 WriteMessage(/* same_group */ false, typed_data, ILLEGAL_PORT,
566 Message::kNormalPriority);
567
568 // Read object back from the snapshot.
569 TypedData& serialized_typed_data = TypedData::Handle();
570 serialized_typed_data ^= ReadMessage(thread, message.get());
571 EXPECT(serialized_typed_data.IsTypedData());
572
573 // Read object back from the snapshot into a C structure.
574 ApiNativeScope scope;
575 Dart_CObject* root = ReadApiMessage(scope.zone(), message.get());
576 EXPECT_EQ(Dart_CObject_kTypedData, root->type);
577 EXPECT_EQ(kTypedDataLength, root->value.as_typed_data.length);
578 for (int i = 0; i < kTypedDataLength; i++) {
579 EXPECT(root->value.as_typed_data.values[i] == i);
580 }
581 CheckEncodeDecodeMessage(scope.zone(), root);
582}

◆ ISOLATE_UNIT_TEST_CASE() [311/463]

dart::ISOLATE_UNIT_TEST_CASE ( SerializeCapability  )

Definition at line 326 of file snapshot_test.cc.

326 {
327 // Write snapshot with object content.
328 const Capability& capability = Capability::Handle(Capability::New(12345));
329 std::unique_ptr<Message> message =
330 WriteMessage(/* same_group */ false, capability, ILLEGAL_PORT,
331 Message::kNormalPriority);
332
333 // Read object back from the snapshot.
334 Capability& obj = Capability::Handle();
335 obj ^= ReadMessage(thread, message.get());
336
337 EXPECT_EQ(static_cast<uint64_t>(12345), obj.Id());
338
339 // Read object back from the snapshot into a C structure.
340 ApiNativeScope scope;
341 Dart_CObject* root = ReadApiMessage(scope.zone(), message.get());
342 EXPECT_NOTNULL(root);
343 EXPECT_EQ(Dart_CObject_kCapability, root->type);
344 int64_t id = root->value.as_capability.id;
345 EXPECT_EQ(12345, id);
346 CheckEncodeDecodeMessage(scope.zone(), root);
347}
uint64_t Id() const
Definition object.h:12391

◆ ISOLATE_UNIT_TEST_CASE() [312/463]

dart::ISOLATE_UNIT_TEST_CASE ( SerializeDouble  )

Definition at line 258 of file snapshot_test.cc.

258 {
259 StackZone zone(thread);
260
261 // Write snapshot with object content.
262 const Double& dbl = Double::Handle(Double::New(101.29));
263 std::unique_ptr<Message> message = WriteMessage(
264 /* same_group */ false, dbl, ILLEGAL_PORT, Message::kNormalPriority);
265
266 // Read object back from the snapshot.
267 const Object& serialized_object =
268 Object::Handle(ReadMessage(thread, message.get()));
269 EXPECT(Equals(dbl, serialized_object));
270
271 // Read object back from the snapshot into a C structure.
272 ApiNativeScope scope;
273 Dart_CObject* root = ReadApiMessage(scope.zone(), message.get());
274 EXPECT_NOTNULL(root);
275 EXPECT_EQ(Dart_CObject_kDouble, root->type);
276 EXPECT_EQ(dbl.value(), root->value.as_double);
277 CheckEncodeDecodeMessage(scope.zone(), root);
278}

◆ ISOLATE_UNIT_TEST_CASE() [313/463]

dart::ISOLATE_UNIT_TEST_CASE ( SerializeEmptyArray  )

Definition at line 535 of file snapshot_test.cc.

535 {
536 // Write snapshot with object content.
537 const int kArrayLength = 0;
538 Array& array = Array::Handle(Array::New(kArrayLength));
539 std::unique_ptr<Message> message = WriteMessage(
540 /* same_group */ false, array, ILLEGAL_PORT, Message::kNormalPriority);
541
542 // Read object back from the snapshot.
543 Array& serialized_array = Array::Handle();
544 serialized_array ^= ReadMessage(thread, message.get());
545 EXPECT(array.CanonicalizeEquals(serialized_array));
546
547 // Read object back from the snapshot into a C structure.
548 ApiNativeScope scope;
549 Dart_CObject* root = ReadApiMessage(scope.zone(), message.get());
550 EXPECT_EQ(Dart_CObject_kArray, root->type);
551 EXPECT_EQ(kArrayLength, root->value.as_array.length);
552 EXPECT(root->value.as_array.values == nullptr);
553 CheckEncodeDecodeMessage(scope.zone(), root);
554}

◆ ISOLATE_UNIT_TEST_CASE() [314/463]

dart::ISOLATE_UNIT_TEST_CASE ( SerializeEmptyByteArray  )

Definition at line 685 of file snapshot_test.cc.

685 {
686 // Write snapshot with object content.
687 const int kTypedDataLength = 0;
688 TypedData& typed_data = TypedData::Handle(
689 TypedData::New(kTypedDataUint8ArrayCid, kTypedDataLength));
690 std::unique_ptr<Message> message =
691 WriteMessage(/* same_group */ false, typed_data, ILLEGAL_PORT,
692 Message::kNormalPriority);
693
694 // Read object back from the snapshot.
695 TypedData& serialized_typed_data = TypedData::Handle();
696 serialized_typed_data ^= ReadMessage(thread, message.get());
697 EXPECT(serialized_typed_data.IsTypedData());
698
699 // Read object back from the snapshot into a C structure.
700 ApiNativeScope scope;
701 Dart_CObject* root = ReadApiMessage(scope.zone(), message.get());
702 EXPECT_EQ(Dart_CObject_kTypedData, root->type);
703 EXPECT_EQ(Dart_TypedData_kUint8, root->value.as_typed_data.type);
704 EXPECT_EQ(kTypedDataLength, root->value.as_typed_data.length);
705 EXPECT(root->value.as_typed_data.values == nullptr);
706 CheckEncodeDecodeMessage(scope.zone(), root);
707}
static bool IsTypedData(const Instance &obj)
Definition object.h:11677

◆ ISOLATE_UNIT_TEST_CASE() [315/463]

dart::ISOLATE_UNIT_TEST_CASE ( SerializeExternalTypedArray  )

Definition at line 659 of file snapshot_test.cc.

659 {
660 TEST_EXTERNAL_TYPED_ARRAY(Int8, int8_t);
661 TEST_EXTERNAL_TYPED_ARRAY(Uint8, uint8_t);
662 TEST_EXTERNAL_TYPED_ARRAY(Int16, int16_t);
663 TEST_EXTERNAL_TYPED_ARRAY(Uint16, uint16_t);
664 TEST_EXTERNAL_TYPED_ARRAY(Int32, int32_t);
665 TEST_EXTERNAL_TYPED_ARRAY(Uint32, uint32_t);
666 TEST_EXTERNAL_TYPED_ARRAY(Int64, int64_t);
667 TEST_EXTERNAL_TYPED_ARRAY(Uint64, uint64_t);
668 TEST_EXTERNAL_TYPED_ARRAY(Float32, float);
669 TEST_EXTERNAL_TYPED_ARRAY(Float64, double);
670}
#define TEST_EXTERNAL_TYPED_ARRAY(darttype, ctype)

◆ ISOLATE_UNIT_TEST_CASE() [316/463]

dart::ISOLATE_UNIT_TEST_CASE ( SerializeFalse  )

Definition at line 304 of file snapshot_test.cc.

304 {
305 StackZone zone(thread);
306
307 // Write snapshot with false object.
308 const Bool& bl = Bool::False();
309 std::unique_ptr<Message> message = WriteMessage(
310 /* same_group */ false, bl, ILLEGAL_PORT, Message::kNormalPriority);
311
312 // Read object back from the snapshot.
313 const Object& serialized_object =
314 Object::Handle(ReadMessage(thread, message.get()));
315 EXPECT(Equals(bl, serialized_object));
316
317 // Read object back from the snapshot into a C structure.
318 ApiNativeScope scope;
319 Dart_CObject* root = ReadApiMessage(scope.zone(), message.get());
320 EXPECT_NOTNULL(root);
321 EXPECT_EQ(Dart_CObject_kBool, root->type);
322 EXPECT_EQ(false, root->value.as_bool);
323 CheckEncodeDecodeMessage(scope.zone(), root);
324}

◆ ISOLATE_UNIT_TEST_CASE() [317/463]

dart::ISOLATE_UNIT_TEST_CASE ( SerializeMints  )

Definition at line 239 of file snapshot_test.cc.

239 {
240 // Min positive mint.
241 CheckMint(Smi::kMaxValue + 1);
242 // Min positive mint + 1.
243 CheckMint(Smi::kMaxValue + 2);
244 // Max negative mint.
245 CheckMint(Smi::kMinValue - 1);
246 // Max negative mint - 1.
247 CheckMint(Smi::kMinValue - 2);
248 // Max positive mint.
249 CheckMint(kMaxInt64);
250 // Max positive mint - 1.
251 CheckMint(kMaxInt64 - 1);
252 // Min negative mint.
253 CheckMint(kMinInt64);
254 // Min negative mint + 1.
255 CheckMint(kMinInt64 + 1);
256}
void CheckMint(int64_t value)

◆ ISOLATE_UNIT_TEST_CASE() [318/463]

dart::ISOLATE_UNIT_TEST_CASE ( SerializeNull  )

Definition at line 125 of file snapshot_test.cc.

125 {
126 StackZone zone(thread);
127
128 // Write snapshot with object content.
129 const Object& null_object = Object::Handle();
130 std::unique_ptr<Message> message =
131 WriteMessage(/* same_group */ false, null_object, ILLEGAL_PORT,
132 Message::kNormalPriority);
133
134 // Read object back from the snapshot.
135 const Object& serialized_object =
136 Object::Handle(ReadMessage(thread, message.get()));
137 EXPECT(Equals(null_object, serialized_object));
138
139 // Read object back from the snapshot into a C structure.
140 ApiNativeScope scope;
141 Dart_CObject* root = ReadApiMessage(scope.zone(), message.get());
142 EXPECT_NOTNULL(root);
143 EXPECT_EQ(Dart_CObject_kNull, root->type);
144 CheckEncodeDecodeMessage(scope.zone(), root);
145}

◆ ISOLATE_UNIT_TEST_CASE() [319/463]

dart::ISOLATE_UNIT_TEST_CASE ( SerializeSingletons  )

Definition at line 359 of file snapshot_test.cc.

359 {
360 TEST_ROUND_TRIP_IDENTICAL(Object::class_class());
361 TEST_ROUND_TRIP_IDENTICAL(Object::type_arguments_class());
362 TEST_ROUND_TRIP_IDENTICAL(Object::function_class());
363 TEST_ROUND_TRIP_IDENTICAL(Object::field_class());
364 TEST_ROUND_TRIP_IDENTICAL(Object::script_class());
365 TEST_ROUND_TRIP_IDENTICAL(Object::library_class());
366 TEST_ROUND_TRIP_IDENTICAL(Object::code_class());
367 TEST_ROUND_TRIP_IDENTICAL(Object::instructions_class());
368 TEST_ROUND_TRIP_IDENTICAL(Object::pc_descriptors_class());
369 TEST_ROUND_TRIP_IDENTICAL(Object::exception_handlers_class());
370 TEST_ROUND_TRIP_IDENTICAL(Object::context_class());
371 TEST_ROUND_TRIP_IDENTICAL(Object::context_scope_class());
372}
#define TEST_ROUND_TRIP_IDENTICAL(object)

◆ ISOLATE_UNIT_TEST_CASE() [320/463]

dart::ISOLATE_UNIT_TEST_CASE ( SerializeSmi1  )

Definition at line 147 of file snapshot_test.cc.

147 {
148 StackZone zone(thread);
149
150 // Write snapshot with object content.
151 const Smi& smi = Smi::Handle(Smi::New(124));
152 std::unique_ptr<Message> message = WriteMessage(
153 /* same_group */ false, smi, ILLEGAL_PORT, Message::kNormalPriority);
154
155 // Read object back from the snapshot.
156 const Object& serialized_object =
157 Object::Handle(ReadMessage(thread, message.get()));
158 EXPECT(Equals(smi, serialized_object));
159
160 // Read object back from the snapshot into a C structure.
161 ApiNativeScope scope;
162 Dart_CObject* root = ReadApiMessage(scope.zone(), message.get());
163 EXPECT_NOTNULL(root);
164 EXPECT_EQ(Dart_CObject_kInt32, root->type);
165 EXPECT_EQ(smi.Value(), root->value.as_int32);
166 CheckEncodeDecodeMessage(scope.zone(), root);
167}

◆ ISOLATE_UNIT_TEST_CASE() [321/463]

dart::ISOLATE_UNIT_TEST_CASE ( SerializeSmi2  )

Definition at line 169 of file snapshot_test.cc.

169 {
170 StackZone zone(thread);
171
172 // Write snapshot with object content.
173 const Smi& smi = Smi::Handle(Smi::New(-1));
174 std::unique_ptr<Message> message = WriteMessage(
175 /* same_group */ false, smi, ILLEGAL_PORT, Message::kNormalPriority);
176
177 // Read object back from the snapshot.
178 const Object& serialized_object =
179 Object::Handle(ReadMessage(thread, message.get()));
180 EXPECT(Equals(smi, serialized_object));
181
182 // Read object back from the snapshot into a C structure.
183 ApiNativeScope scope;
184 Dart_CObject* root = ReadApiMessage(scope.zone(), message.get());
185 EXPECT_NOTNULL(root);
186 EXPECT_EQ(Dart_CObject_kInt32, root->type);
187 EXPECT_EQ(smi.Value(), root->value.as_int32);
188 CheckEncodeDecodeMessage(scope.zone(), root);
189}

◆ ISOLATE_UNIT_TEST_CASE() [322/463]

dart::ISOLATE_UNIT_TEST_CASE ( SerializeString  )

Definition at line 395 of file snapshot_test.cc.

395 {
396 TestString("This string shall be serialized");
397 TestString("æøå"); // This file is UTF-8 encoded.
398 const char* data =
399 "\x01"
400 "\x7F"
401 "\xC2\x80" // U+0080
402 "\xDF\xBF" // U+07FF
403 "\xE0\xA0\x80" // U+0800
404 "\xEF\xBF\xBF"; // U+FFFF
405
406 TestString(data);
407 // TODO(sgjesse): Add tests with non-BMP characters.
408}
void TestString(BaseTextBuffer *f, LoopInfo *loop, const GrowableArray< BlockEntryInstr * > &preorder)
Definition loops_test.cc:27

◆ ISOLATE_UNIT_TEST_CASE() [323/463]

dart::ISOLATE_UNIT_TEST_CASE ( SerializeTrue  )

Definition at line 280 of file snapshot_test.cc.

280 {
281 StackZone zone(thread);
282
283 // Write snapshot with true object.
284 const Bool& bl = Bool::True();
285 std::unique_ptr<Message> message = WriteMessage(
286 /* same_group */ false, bl, ILLEGAL_PORT, Message::kNormalPriority);
287
288 // Read object back from the snapshot.
289 const Object& serialized_object =
290 Object::Handle(ReadMessage(thread, message.get()));
291 fprintf(stderr, "%s / %s\n", bl.ToCString(), serialized_object.ToCString());
292
293 EXPECT(Equals(bl, serialized_object));
294
295 // Read object back from the snapshot into a C structure.
296 ApiNativeScope scope;
297 Dart_CObject* root = ReadApiMessage(scope.zone(), message.get());
298 EXPECT_NOTNULL(root);
299 EXPECT_EQ(Dart_CObject_kBool, root->type);
300 EXPECT_EQ(true, root->value.as_bool);
301 CheckEncodeDecodeMessage(scope.zone(), root);
302}

◆ ISOLATE_UNIT_TEST_CASE() [324/463]

dart::ISOLATE_UNIT_TEST_CASE ( SerializeTypedArray  )

Definition at line 646 of file snapshot_test.cc.

646 {
647 TEST_TYPED_ARRAY(Int8, int8_t);
648 TEST_TYPED_ARRAY(Uint8, uint8_t);
649 TEST_TYPED_ARRAY(Int16, int16_t);
650 TEST_TYPED_ARRAY(Uint16, uint16_t);
651 TEST_TYPED_ARRAY(Int32, int32_t);
652 TEST_TYPED_ARRAY(Uint32, uint32_t);
653 TEST_TYPED_ARRAY(Int64, int64_t);
654 TEST_TYPED_ARRAY(Uint64, uint64_t);
655 TEST_TYPED_ARRAY(Float32, float);
656 TEST_TYPED_ARRAY(Float64, double);
657}
#define TEST_TYPED_ARRAY(darttype, ctype)

◆ ISOLATE_UNIT_TEST_CASE() [325/463]

dart::ISOLATE_UNIT_TEST_CASE ( SerializeUnmodifiableExternalTypedArray  )

Definition at line 672 of file snapshot_test.cc.

672 {
683}
#define TEST_UNMODIFIABLE_EXTERNAL_TYPED_ARRAY(darttype, ctype)

◆ ISOLATE_UNIT_TEST_CASE() [326/463]

dart::ISOLATE_UNIT_TEST_CASE ( Service_Code  )

Definition at line 221 of file service_test.cc.

221 {
222 const char* kScript =
223 "var port;\n" // Set to our mock port by C++.
224 "\n"
225 "class A {\n"
226 " var a;\n"
227 " dynamic b() {}\n"
228 " dynamic c() {\n"
229 " var d = () { b(); };\n"
230 " return d;\n"
231 " }\n"
232 "}\n"
233 "main() {\n"
234 " var z = new A();\n"
235 " var x = z.c();\n"
236 " x();\n"
237 "}";
238
239 Isolate* isolate = thread->isolate();
240 isolate->set_is_runnable(true);
241 Dart_Handle lib;
242 Library& vmlib = Library::Handle();
243 {
244 TransitionVMToNative transition(thread);
245 lib = TestCase::LoadTestScript(kScript, nullptr);
246 EXPECT_VALID(lib);
247 EXPECT(!Dart_IsNull(lib));
248 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, nullptr);
250 }
251 vmlib ^= Api::UnwrapHandle(lib);
252 EXPECT(!vmlib.IsNull());
253 const Class& class_a = Class::Handle(GetClass(vmlib, "A"));
254 EXPECT(!class_a.IsNull());
255 const Function& function_c = Function::Handle(GetFunction(class_a, "c"));
256 EXPECT(!function_c.IsNull());
257 const Code& code_c = Code::Handle(function_c.CurrentCode());
258 EXPECT(!code_c.IsNull());
259 // Use the entry of the code object as it's reference.
260 uword entry = code_c.PayloadStart();
261 int64_t compile_timestamp = code_c.compile_timestamp();
262 EXPECT_GT(code_c.Size(), 16u);
263 uword last = entry + code_c.Size();
264
265 // Build a mock message handler and wrap it in a dart port.
266 ServiceTestMessageHandler handler;
267 Dart_Port port_id = PortMap::CreatePort(&handler);
268 Dart_Handle port = Api::NewHandle(thread, SendPort::New(port_id));
269 {
270 TransitionVMToNative transition(thread);
271 EXPECT_VALID(port);
272 EXPECT_VALID(Dart_SetField(lib, NewString("port"), port));
273 }
274
275 Array& service_msg = Array::Handle();
276
277 // Request an invalid code object.
278 service_msg =
279 Eval(lib, "[0, port, '0', 'getObject', ['objectId'], ['code/0']]");
280 HandleIsolateMessage(isolate, service_msg);
281 EXPECT_EQ(MessageHandler::kOK, handler.HandleNextMessage());
282 EXPECT_SUBSTRING("\"error\"", handler.msg());
283
284 // The following test checks that a code object can be found only
285 // at compile_timestamp()-code.EntryPoint().
286 service_msg = EvalF(lib,
287 "[0, port, '0', 'getObject', "
288 "['objectId'], ['code/%" Px64 "-%" Px "']]",
289 compile_timestamp, entry);
290 HandleIsolateMessage(isolate, service_msg);
291 EXPECT_EQ(MessageHandler::kOK, handler.HandleNextMessage());
292 EXPECT_SUBSTRING("\"type\":\"Code\"", handler.msg());
293 {
294 // Only perform a partial match.
295 const intptr_t kBufferSize = 512;
296 char buffer[kBufferSize];
297 Utils::SNPrint(buffer, kBufferSize - 1,
298 "\"fixedId\":true,\"id\":\"code\\/%" Px64 "-%" Px "\",",
299 compile_timestamp, entry);
300 EXPECT_SUBSTRING(buffer, handler.msg());
301 }
302
303 // Request code object at compile_timestamp-code.EntryPoint() + 16
304 // Expect this to fail because the address is not the entry point.
305 uintptr_t address = entry + 16;
306 service_msg = EvalF(lib,
307 "[0, port, '0', 'getObject', "
308 "['objectId'], ['code/%" Px64 "-%" Px "']]",
309 compile_timestamp, address);
310 HandleIsolateMessage(isolate, service_msg);
311 EXPECT_EQ(MessageHandler::kOK, handler.HandleNextMessage());
312 EXPECT_SUBSTRING("\"error\"", handler.msg());
313
314 // Request code object at (compile_timestamp - 1)-code.EntryPoint()
315 // Expect this to fail because the timestamp is wrong.
316 address = entry;
317 service_msg = EvalF(lib,
318 "[0, port, '0', 'getObject', "
319 "['objectId'], ['code/%" Px64 "-%" Px "']]",
320 compile_timestamp - 1, address);
321 HandleIsolateMessage(isolate, service_msg);
322 EXPECT_EQ(MessageHandler::kOK, handler.HandleNextMessage());
323 EXPECT_SUBSTRING("\"error\"", handler.msg());
324
325 // Request native code at address. Expect the null code object back.
326 address = last;
327 service_msg = EvalF(lib,
328 "[0, port, '0', 'getObject', "
329 "['objectId'], ['code/native-%" Px "']]",
330 address);
331 HandleIsolateMessage(isolate, service_msg);
332 EXPECT_EQ(MessageHandler::kOK, handler.HandleNextMessage());
333 // TODO(turnidge): It is pretty broken to return an Instance here. Fix.
334 EXPECT_SUBSTRING("\"kind\":\"Null\"", handler.msg());
335
336 // Request malformed native code.
337 service_msg = EvalF(lib,
338 "[0, port, '0', 'getObject', ['objectId'], "
339 "['code/native%" Px "']]",
340 address);
341 HandleIsolateMessage(isolate, service_msg);
342 EXPECT_EQ(MessageHandler::kOK, handler.HandleNextMessage());
343 EXPECT_SUBSTRING("\"error\"", handler.msg());
344}
void set_is_runnable(bool value)
Definition isolate.h:1049
static ArrayPtr EvalF(Dart_Handle lib, const char *fmt,...)
static void HandleIsolateMessage(Isolate *isolate, const Array &msg)

◆ ISOLATE_UNIT_TEST_CASE() [327/463]

dart::ISOLATE_UNIT_TEST_CASE ( Service_EmbedderIsolateHandler  )

Definition at line 628 of file service_test.cc.

628 {
629 const char* kScript =
630 "var port;\n" // Set to our mock port by C++.
631 "\n"
632 "var x = 7;\n"
633 "main() {\n"
634 " x = x * x;\n"
635 " x = (x / 13).floor();\n"
636 "}";
637
638 Dart_Handle lib;
639 {
640 TransitionVMToNative transition(thread);
641
642 Dart_RegisterIsolateServiceRequestCallback("alpha", alpha_callback,
643 nullptr);
644 Dart_RegisterIsolateServiceRequestCallback("beta", beta_callback, nullptr);
645
646 lib = TestCase::LoadTestScript(kScript, nullptr);
647 EXPECT_VALID(lib);
648 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, nullptr);
650 }
651
652 // Build a mock message handler and wrap it in a dart port.
653 ServiceTestMessageHandler handler;
654 Dart_Port port_id = PortMap::CreatePort(&handler);
655 Dart_Handle port = Api::NewHandle(thread, SendPort::New(port_id));
656 {
657 TransitionVMToNative transition(thread);
658 EXPECT_VALID(port);
659 EXPECT_VALID(Dart_SetField(lib, NewString("port"), port));
660 }
661
662 Isolate* isolate = thread->isolate();
663 Array& service_msg = Array::Handle();
664 service_msg = Eval(lib, "[0, port, '0', 'alpha', [], []]");
665 HandleIsolateMessage(isolate, service_msg);
666 EXPECT_EQ(MessageHandler::kOK, handler.HandleNextMessage());
667 EXPECT_STREQ("{\"jsonrpc\":\"2.0\", \"result\":alpha,\"id\":\"0\"}",
668 handler.msg());
669 service_msg = Eval(lib, "[0, port, '0', 'beta', [], []]");
670 HandleIsolateMessage(isolate, service_msg);
671 EXPECT_EQ(MessageHandler::kOK, handler.HandleNextMessage());
672 EXPECT_STREQ("{\"jsonrpc\":\"2.0\", \"error\":beta,\"id\":\"0\"}",
673 handler.msg());
674}
DART_EXPORT void Dart_RegisterIsolateServiceRequestCallback(const char *method, Dart_ServiceRequestCallback callback, void *user_data)

◆ ISOLATE_UNIT_TEST_CASE() [328/463]

dart::ISOLATE_UNIT_TEST_CASE ( Service_EmbedderRootHandler  )

Definition at line 583 of file service_test.cc.

583 {
584 const char* kScript =
585 "var port;\n" // Set to our mock port by C++.
586 "\n"
587 "var x = 7;\n"
588 "main() {\n"
589 " x = x * x;\n"
590 " x = (x / 13).floor();\n"
591 "}";
592
593 Dart_Handle lib;
594 {
595 TransitionVMToNative transition(thread);
596
597 Dart_RegisterRootServiceRequestCallback("alpha", alpha_callback, nullptr);
598 Dart_RegisterRootServiceRequestCallback("beta", beta_callback, nullptr);
599
600 lib = TestCase::LoadTestScript(kScript, nullptr);
601 EXPECT_VALID(lib);
602 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, nullptr);
604 }
605
606 // Build a mock message handler and wrap it in a dart port.
607 ServiceTestMessageHandler handler;
608 Dart_Port port_id = PortMap::CreatePort(&handler);
609 Dart_Handle port = Api::NewHandle(thread, SendPort::New(port_id));
610 {
611 TransitionVMToNative transition(thread);
612 EXPECT_VALID(port);
613 EXPECT_VALID(Dart_SetField(lib, NewString("port"), port));
614 }
615
616 Array& service_msg = Array::Handle();
617 service_msg = Eval(lib, "[0, port, '\"', 'alpha', [], []]");
618 HandleRootMessage(service_msg);
619 EXPECT_EQ(MessageHandler::kOK, handler.HandleNextMessage());
620 EXPECT_STREQ("{\"jsonrpc\":\"2.0\", \"result\":alpha,\"id\":\"\\\"\"}",
621 handler.msg());
622 service_msg = Eval(lib, "[0, port, 1, 'beta', [], []]");
623 HandleRootMessage(service_msg);
624 EXPECT_EQ(MessageHandler::kOK, handler.HandleNextMessage());
625 EXPECT_STREQ("{\"jsonrpc\":\"2.0\", \"error\":beta,\"id\":1}", handler.msg());
626}
DART_EXPORT void Dart_RegisterRootServiceRequestCallback(const char *method, Dart_ServiceRequestCallback callback, void *user_data)
static void HandleRootMessage(const Array &message)

◆ ISOLATE_UNIT_TEST_CASE() [329/463]

dart::ISOLATE_UNIT_TEST_CASE ( Service_IdZones  )

Definition at line 187 of file service_test.cc.

187 {
188 Zone* zone = thread->zone();
189 Isolate* isolate = thread->isolate();
190 ObjectIdRing* ring = isolate->EnsureObjectIdRing();
191
192 const String& test_a = String::Handle(zone, String::New("a"));
193 const String& test_b = String::Handle(zone, String::New("b"));
194 const String& test_c = String::Handle(zone, String::New("c"));
195 const String& test_d = String::Handle(zone, String::New("d"));
196
197 // Both RingServiceIdZones share the same backing store and id space.
198
199 // Always allocate a new id.
200 RingServiceIdZone always_new_zone;
201 always_new_zone.Init(ring, ObjectIdRing::kAllocateId);
202 EXPECT_STREQ("objects/0", always_new_zone.GetServiceId(test_a));
203 EXPECT_STREQ("objects/1", always_new_zone.GetServiceId(test_a));
204 EXPECT_STREQ("objects/2", always_new_zone.GetServiceId(test_a));
205 EXPECT_STREQ("objects/3", always_new_zone.GetServiceId(test_b));
206 EXPECT_STREQ("objects/4", always_new_zone.GetServiceId(test_c));
207
208 // Reuse an existing id or allocate a new id.
209 RingServiceIdZone reuse_zone;
210 reuse_zone.Init(ring, ObjectIdRing::kReuseId);
211 EXPECT_STREQ("objects/0", reuse_zone.GetServiceId(test_a));
212 EXPECT_STREQ("objects/0", reuse_zone.GetServiceId(test_a));
213 EXPECT_STREQ("objects/3", reuse_zone.GetServiceId(test_b));
214 EXPECT_STREQ("objects/3", reuse_zone.GetServiceId(test_b));
215 EXPECT_STREQ("objects/4", reuse_zone.GetServiceId(test_c));
216 EXPECT_STREQ("objects/4", reuse_zone.GetServiceId(test_c));
217 EXPECT_STREQ("objects/5", reuse_zone.GetServiceId(test_d));
218 EXPECT_STREQ("objects/5", reuse_zone.GetServiceId(test_d));
219}
void Init(ObjectIdRing *ring, ObjectIdRing::IdPolicy policy)
Definition service.cc:374

◆ ISOLATE_UNIT_TEST_CASE() [330/463]

dart::ISOLATE_UNIT_TEST_CASE ( Service_IsolateStickyError  )

Definition at line 144 of file service_test.cc.

144 {
145 const char* kScript = "main() => throw 'HI THERE STICKY';\n";
146
147 Isolate* isolate = thread->isolate();
148 isolate->set_is_runnable(true);
150 {
151 TransitionVMToNative transition(thread);
152 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
153 EXPECT_VALID(lib);
154 result = Dart_Invoke(lib, NewString("main"), 0, nullptr);
157 }
158 EXPECT(Thread::Current()->sticky_error() == Error::null());
159
160 {
161 JSONStream js;
162 isolate->PrintJSON(&js, false);
163 // No error property and no PauseExit state.
164 EXPECT_NOTSUBSTRING("\"error\":", js.ToCString());
165 EXPECT_NOTSUBSTRING("HI THERE STICKY", js.ToCString());
166 EXPECT_NOTSUBSTRING("PauseExit", js.ToCString());
167 }
168
169 {
170 // Set the sticky error.
171 TransitionVMToNative transition(thread);
175 }
176
177 {
178 JSONStream js;
179 isolate->PrintJSON(&js, false);
180 // Error and PauseExit set.
181 EXPECT_SUBSTRING("\"error\":", js.ToCString());
182 EXPECT_SUBSTRING("HI THERE STICKY", js.ToCString());
183 EXPECT_SUBSTRING("PauseExit", js.ToCString());
184 }
185}
DART_EXPORT void Dart_SetPausedOnExit(bool paused)
DART_EXPORT bool Dart_HasStickyError(void)
DART_EXPORT void Dart_SetStickyError(Dart_Handle error)

◆ ISOLATE_UNIT_TEST_CASE() [331/463]

dart::ISOLATE_UNIT_TEST_CASE ( Service_LocalVarDescriptors  )

Definition at line 417 of file service_test.cc.

417 {
418 const char* kScript =
419 "var port;\n" // Set to our mock port by C++.
420 "\n"
421 "class A {\n"
422 " var a;\n"
423 " dynamic b() {}\n"
424 " dynamic c() {\n"
425 " var d = () { b(); };\n"
426 " return d;\n"
427 " }\n"
428 "}\n"
429 "main() {\n"
430 " var z = new A();\n"
431 " var x = z.c();\n"
432 " x();\n"
433 "}";
434
435 Isolate* isolate = thread->isolate();
436 isolate->set_is_runnable(true);
437 Dart_Handle lib;
438 Library& vmlib = Library::Handle();
439 {
440 TransitionVMToNative transition(thread);
441 lib = TestCase::LoadTestScript(kScript, nullptr);
442 EXPECT_VALID(lib);
443 EXPECT(!Dart_IsNull(lib));
444 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, nullptr);
446 }
447 vmlib ^= Api::UnwrapHandle(lib);
448 EXPECT(!vmlib.IsNull());
449 const Class& class_a = Class::Handle(GetClass(vmlib, "A"));
450 EXPECT(!class_a.IsNull());
451 const Function& function_c = Function::Handle(GetFunction(class_a, "c"));
452 EXPECT(!function_c.IsNull());
453 const Code& code_c = Code::Handle(function_c.CurrentCode());
454 EXPECT(!code_c.IsNull());
455
456 const LocalVarDescriptors& descriptors =
457 LocalVarDescriptors::Handle(code_c.GetLocalVarDescriptors());
458 // Generate an ID for this object.
459 ObjectIdRing* ring = isolate->EnsureObjectIdRing();
460 intptr_t id = ring->GetIdForObject(descriptors.ptr());
461
462 // Build a mock message handler and wrap it in a dart port.
463 ServiceTestMessageHandler handler;
464 Dart_Port port_id = PortMap::CreatePort(&handler);
465 Dart_Handle port = Api::NewHandle(thread, SendPort::New(port_id));
466 {
467 TransitionVMToNative transition(thread);
468 EXPECT_VALID(port);
469 EXPECT_VALID(Dart_SetField(lib, NewString("port"), port));
470 }
471
472 Array& service_msg = Array::Handle();
473
474 // Fetch object.
475 service_msg = EvalF(lib,
476 "[0, port, '0', 'getObject', "
477 "['objectId'], ['objects/%" Pd "']]",
478 id);
479 HandleIsolateMessage(isolate, service_msg);
480 EXPECT_EQ(MessageHandler::kOK, handler.HandleNextMessage());
481 // Check type.
482 EXPECT_SUBSTRING("\"type\":\"Object\"", handler.msg());
483 EXPECT_SUBSTRING("\"_vmType\":\"LocalVarDescriptors\"", handler.msg());
484 // Check for members array.
485 EXPECT_SUBSTRING("\"members\":[", handler.msg());
486}

◆ ISOLATE_UNIT_TEST_CASE() [332/463]

dart::ISOLATE_UNIT_TEST_CASE ( Service_ParseJSONArray  )

Definition at line 729 of file service_test.cc.

729 {
730 {
731 const auto& elements =
732 GrowableObjectArray::Handle(GrowableObjectArray::New());
733 EXPECT_EQ(-1, ParseJSONArray(thread, "", elements));
734 EXPECT_EQ(-1, ParseJSONArray(thread, "[", elements));
735 }
736
737 {
738 const auto& elements =
739 GrowableObjectArray::Handle(GrowableObjectArray::New());
740 EXPECT_EQ(0, ParseJSONArray(thread, "[]", elements));
741 EXPECT_EQ(0, elements.Length());
742 }
743
744 {
745 const auto& elements =
746 GrowableObjectArray::Handle(GrowableObjectArray::New());
747 EXPECT_EQ(0, ParseJSONArray(thread, "[a]", elements));
748 EXPECT_EQ(1, elements.Length());
749 auto& element = String::Handle();
750 element ^= elements.At(0);
751 EXPECT(element.Equals("a"));
752 }
753
754 {
755 const auto& elements =
756 GrowableObjectArray::Handle(GrowableObjectArray::New());
757 EXPECT_EQ(0, ParseJSONArray(thread, "[abc, def]", elements));
758 EXPECT_EQ(2, elements.Length());
759 auto& element = String::Handle();
760 element ^= elements.At(0);
761 EXPECT(element.Equals("abc"));
762 element ^= elements.At(1);
763 EXPECT(element.Equals("def"));
764 }
765
766 {
767 const auto& elements =
768 GrowableObjectArray::Handle(GrowableObjectArray::New());
769 EXPECT_EQ(0, ParseJSONArray(thread, "[abc, def, ghi]", elements));
770 EXPECT_EQ(3, elements.Length());
771 auto& element = String::Handle();
772 element ^= elements.At(0);
773 EXPECT(element.Equals("abc"));
774 element ^= elements.At(1);
775 EXPECT(element.Equals("def"));
776 element ^= elements.At(2);
777 EXPECT(element.Equals("ghi"));
778 }
779
780 {
781 const auto& elements =
782 GrowableObjectArray::Handle(GrowableObjectArray::New());
783 EXPECT_EQ(0, ParseJSONArray(thread, "[abc, , ghi]", elements));
784 EXPECT_EQ(3, elements.Length());
785 auto& element = String::Handle();
786 element ^= elements.At(0);
787 EXPECT(element.Equals("abc"));
788 element ^= elements.At(1);
789 EXPECT(element.Equals(""));
790 element ^= elements.At(2);
791 EXPECT(element.Equals("ghi"));
792 }
793}

◆ ISOLATE_UNIT_TEST_CASE() [333/463]

dart::ISOLATE_UNIT_TEST_CASE ( Service_PcDescriptors  )

Definition at line 346 of file service_test.cc.

346 {
347 const char* kScript =
348 "var port;\n" // Set to our mock port by C++.
349 "\n"
350 "class A {\n"
351 " var a;\n"
352 " dynamic b() {}\n"
353 " dynamic c() {\n"
354 " var d = () { b(); };\n"
355 " return d;\n"
356 " }\n"
357 "}\n"
358 "main() {\n"
359 " var z = new A();\n"
360 " var x = z.c();\n"
361 " x();\n"
362 "}";
363
364 Isolate* isolate = thread->isolate();
365 isolate->set_is_runnable(true);
366 Dart_Handle lib;
367 Library& vmlib = Library::Handle();
368 {
369 TransitionVMToNative transition(thread);
370 lib = TestCase::LoadTestScript(kScript, nullptr);
371 EXPECT_VALID(lib);
372 EXPECT(!Dart_IsNull(lib));
373 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, nullptr);
375 }
376 vmlib ^= Api::UnwrapHandle(lib);
377 EXPECT(!vmlib.IsNull());
378 const Class& class_a = Class::Handle(GetClass(vmlib, "A"));
379 EXPECT(!class_a.IsNull());
380 const Function& function_c = Function::Handle(GetFunction(class_a, "c"));
381 EXPECT(!function_c.IsNull());
382 const Code& code_c = Code::Handle(function_c.CurrentCode());
383 EXPECT(!code_c.IsNull());
384
385 const PcDescriptors& descriptors =
386 PcDescriptors::Handle(code_c.pc_descriptors());
387 EXPECT(!descriptors.IsNull());
388 ObjectIdRing* ring = isolate->EnsureObjectIdRing();
389 intptr_t id = ring->GetIdForObject(descriptors.ptr());
390
391 // Build a mock message handler and wrap it in a dart port.
392 ServiceTestMessageHandler handler;
393 Dart_Port port_id = PortMap::CreatePort(&handler);
394 Dart_Handle port = Api::NewHandle(thread, SendPort::New(port_id));
395 {
396 TransitionVMToNative transition(thread);
397 EXPECT_VALID(port);
398 EXPECT_VALID(Dart_SetField(lib, NewString("port"), port));
399 }
400
401 Array& service_msg = Array::Handle();
402
403 // Fetch object.
404 service_msg = EvalF(lib,
405 "[0, port, '0', 'getObject', "
406 "['objectId'], ['objects/%" Pd "']]",
407 id);
408 HandleIsolateMessage(isolate, service_msg);
409 EXPECT_EQ(MessageHandler::kOK, handler.HandleNextMessage());
410 // Check type.
411 EXPECT_SUBSTRING("\"type\":\"Object\"", handler.msg());
412 EXPECT_SUBSTRING("\"_vmType\":\"PcDescriptors\"", handler.msg());
413 // Check for members array.
414 EXPECT_SUBSTRING("\"members\":[", handler.msg());
415}

◆ ISOLATE_UNIT_TEST_CASE() [334/463]

dart::ISOLATE_UNIT_TEST_CASE ( Service_PersistentHandles  )

Definition at line 490 of file service_test.cc.

490 {
491 const char* kScript =
492 "var port;\n" // Set to our mock port by C++.
493 "\n"
494 "class A {\n"
495 " var a;\n"
496 "}\n"
497 "var global = new A();\n"
498 "main() {\n"
499 " return global;\n"
500 "}";
501
502 Isolate* isolate = thread->isolate();
503 isolate->set_is_runnable(true);
504
505 Dart_Handle lib;
506 Dart_PersistentHandle persistent_handle;
507 Dart_WeakPersistentHandle weak_persistent_handle;
508 {
509 TransitionVMToNative transition(thread);
510 lib = TestCase::LoadTestScript(kScript, nullptr);
511 EXPECT_VALID(lib);
512 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, nullptr);
514
515 // Create a persistent handle to global.
516 persistent_handle = Dart_NewPersistentHandle(result);
517
518 // Create a weak persistent handle to global.
519 weak_persistent_handle = Dart_NewWeakPersistentHandle(
520 result, reinterpret_cast<void*>(0xdeadbeef), 128, WeakHandleFinalizer);
521 }
522
523 // Build a mock message handler and wrap it in a dart port.
524 ServiceTestMessageHandler handler;
525 Dart_Port port_id = PortMap::CreatePort(&handler);
526 Dart_Handle port = Api::NewHandle(thread, SendPort::New(port_id));
527 {
528 TransitionVMToNative transition(thread);
529 EXPECT_VALID(port);
530 EXPECT_VALID(Dart_SetField(lib, NewString("port"), port));
531 }
532
533 Array& service_msg = Array::Handle();
534
535 // Get persistent handles.
536 service_msg = Eval(lib, "[0, port, '0', '_getPersistentHandles', [], []]");
537 HandleIsolateMessage(isolate, service_msg);
538 EXPECT_EQ(MessageHandler::kOK, handler.HandleNextMessage());
539 // Look for a heart beat.
540 EXPECT_SUBSTRING("\"type\":\"_PersistentHandles\"", handler.msg());
541 EXPECT_SUBSTRING("\"peer\":\"0xdeadbeef\"", handler.msg());
542 EXPECT_SUBSTRING("\"name\":\"A\"", handler.msg());
543 EXPECT_SUBSTRING("\"externalSize\":\"128\"", handler.msg());
544
545 // Delete persistent handles.
546 {
547 TransitionVMToNative transition(thread);
548 Dart_DeletePersistentHandle(persistent_handle);
549 Dart_DeleteWeakPersistentHandle(weak_persistent_handle);
550 }
551
552 // Get persistent handles (again).
553 service_msg = Eval(lib, "[0, port, '0', '_getPersistentHandles', [], []]");
554 HandleIsolateMessage(isolate, service_msg);
555 EXPECT_EQ(MessageHandler::kOK, handler.HandleNextMessage());
556 EXPECT_SUBSTRING("\"type\":\"_PersistentHandles\"", handler.msg());
557 // Verify that old persistent handles are not present.
558 EXPECT_NOTSUBSTRING("\"peer\":\"0xdeadbeef\"", handler.msg());
559 EXPECT_NOTSUBSTRING("\"name\":\"A\"", handler.msg());
560 EXPECT_NOTSUBSTRING("\"externalSize\":\"128\"", handler.msg());
561}

◆ ISOLATE_UNIT_TEST_CASE() [335/463]

dart::ISOLATE_UNIT_TEST_CASE ( Service_Profile  )

Definition at line 686 of file service_test.cc.

686 {
688 const char* kScript =
689 "var port;\n" // Set to our mock port by C++.
690 "\n"
691 "var x = 7;\n"
692 "main() {\n"
693 " x = x * x;\n"
694 " x = (x / 13).floor();\n"
695 "}";
696
697 Isolate* isolate = thread->isolate();
698 isolate->set_is_runnable(true);
699 Dart_Handle lib;
700 {
701 TransitionVMToNative transition(thread);
702
703 lib = TestCase::LoadTestScript(kScript, nullptr);
704 EXPECT_VALID(lib);
705 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, nullptr);
707 }
708
709 // Build a mock message handler and wrap it in a dart port.
710 ServiceTestMessageHandler handler;
711 Dart_Port port_id = PortMap::CreatePort(&handler);
712 Dart_Handle port = Api::NewHandle(thread, SendPort::New(port_id));
713 {
714 TransitionVMToNative transition(thread);
715 EXPECT_VALID(port);
716 EXPECT_VALID(Dart_SetField(lib, NewString("port"), port));
717 }
718
719 Array& service_msg = Array::Handle();
720 service_msg = Eval(lib, "[0, port, '0', 'getCpuSamples', [], []]");
721 HandleIsolateMessage(isolate, service_msg);
722 EXPECT_EQ(MessageHandler::kOK, handler.HandleNextMessage());
723 // Expect profile
724 EXPECT_SUBSTRING("\"type\":\"CpuSamples\"", handler.msg());
725}

◆ ISOLATE_UNIT_TEST_CASE() [336/463]

dart::ISOLATE_UNIT_TEST_CASE ( Sets  )

Definition at line 246 of file hash_table_test.cc.

246 {
247 for (intptr_t initial_capacity = 0; initial_capacity < 32;
248 ++initial_capacity) {
249 TestSet<UnorderedHashSet<TestTraits> >(initial_capacity, false);
250 }
251}

◆ ISOLATE_UNIT_TEST_CASE() [337/463]

dart::ISOLATE_UNIT_TEST_CASE ( SixtyThousandDartClasses  )

Definition at line 174 of file object_test.cc.

174 {
175 auto zone = thread->zone();
176 auto isolate_group = thread->isolate_group();
177 auto class_table = isolate_group->class_table();
178
179 const intptr_t start_cid = class_table->NumCids();
180 const intptr_t num_classes = std::numeric_limits<uint16_t>::max() - start_cid;
181
182 const Script& script = Script::Handle(zone);
183 String& name = String::Handle(zone);
184 Class& cls = Class::Handle(zone);
185 Field& field = Field::Handle(zone);
186 Array& fields = Array::Handle(zone);
187 Instance& instance = Instance::Handle(zone);
188 Instance& instance2 = Instance::Handle(zone);
189
190 const auto& instances =
191 GrowableObjectArray::Handle(zone, GrowableObjectArray::New());
192
193 // Create many top-level classes - they should not consume 16-bit range.
194 {
195 SafepointWriteRwLocker ml(thread, thread->isolate_group()->program_lock());
196 for (intptr_t i = 0; i < (1 << 16); ++i) {
197 cls = CreateDummyClass(Symbols::TopLevel(), script);
198 cls.Finalize();
199 EXPECT(cls.id() > std::numeric_limits<uint16_t>::max());
200 }
201 }
202
203 // Create many concrete classes - they should occupy the entire 16-bit space.
204 for (intptr_t i = 0; i < num_classes; ++i) {
205 name = Symbols::New(thread, OS::SCreate(zone, "MyClass%" Pd "", i));
206 cls = CreateDummyClass(name, script);
207 EXPECT_EQ(start_cid + i, cls.id());
208
209 const intptr_t num_fields = (i % 10);
210 fields = Array::New(num_fields);
211 for (intptr_t f = 0; f < num_fields; ++f) {
212 name =
213 Symbols::New(thread, OS::SCreate(zone, "myField_%" Pd "_%" Pd, i, f));
214 field = Field::New(name, false, false, false, true, false, cls,
215 Object::dynamic_type(), TokenPosition::kMinSource,
216 TokenPosition::kMinSource);
217 fields.SetAt(f, field);
218 }
219
220 cls.set_interfaces(Array::empty_array());
221 {
222 SafepointWriteRwLocker ml(thread,
223 thread->isolate_group()->program_lock());
224 cls.SetFunctions(Array::empty_array());
225 cls.SetFields(fields);
226 cls.Finalize();
227 }
228
229 instance = Instance::New(cls);
230 for (intptr_t f = 0; f < num_fields; ++f) {
231 field ^= fields.At(f);
232 name = Symbols::New(thread,
233 OS::SCreate(zone, "myFieldValue_%" Pd "_%" Pd, i, f));
234 instance.SetField(field, name);
235 }
236 instances.Add(instance);
237 }
238 EXPECT_EQ((1 << 16) - 1, class_table->NumCids());
239
240 // Ensure GC runs and can recognize all those new instances.
241 isolate_group->heap()->CollectAllGarbage();
242
243 // Ensure the instances are what we expect.
244 for (intptr_t i = 0; i < num_classes; ++i) {
245 instance ^= instances.At(i);
246 cls = instance.clazz();
247 fields = cls.fields();
248
249 name = cls.Name();
250 EXPECT(strstr(name.ToCString(), OS::SCreate(zone, "MyClass%" Pd "", i)) !=
251 0);
252 EXPECT_EQ((i % 10), fields.Length());
253
254 for (intptr_t f = 0; f < fields.Length(); ++f) {
255 field ^= fields.At(f);
256 instance2 ^= instance.GetField(field);
257 EXPECT(strstr(instance2.ToCString(),
258 OS::SCreate(zone, "myFieldValue_%" Pd "_%" Pd, i, f)) != 0);
259 }
260 }
261}
ObjectPtr GetField(const Field &field) const
Definition object.cc:20516

◆ ISOLATE_UNIT_TEST_CASE() [338/463]

dart::ISOLATE_UNIT_TEST_CASE ( Smi  )

Definition at line 367 of file object_test.cc.

367 {
368 const Smi& smi = Smi::Handle(Smi::New(5));
369 Object& smi_object = Object::Handle(smi.ptr());
370 EXPECT(smi.IsSmi());
371 EXPECT(smi_object.IsSmi());
372 EXPECT_EQ(5, smi.Value());
373 const Object& object = Object::Handle();
374 EXPECT(!object.IsSmi());
375 smi_object = Object::null();
376 EXPECT(!smi_object.IsSmi());
377
378 EXPECT(smi.Equals(Smi::Handle(Smi::New(5))));
379 EXPECT(!smi.Equals(Smi::Handle(Smi::New(6))));
380 EXPECT(smi.Equals(smi));
381 EXPECT(!smi.Equals(Smi::Handle()));
382
383 EXPECT(Smi::IsValid(0));
384 EXPECT(Smi::IsValid(-15));
385 EXPECT(Smi::IsValid(0xFFu));
386// Upper two bits must be either 00 or 11.
387#if defined(ARCH_IS_64_BIT) && !defined(DART_COMPRESSED_POINTERS)
388 EXPECT(!Smi::IsValid(kMaxInt64));
389 EXPECT(Smi::IsValid(0x3FFFFFFFFFFFFFFF));
390 EXPECT(Smi::IsValid(-1));
391#else
392 EXPECT(!Smi::IsValid(kMaxInt32));
393 EXPECT(Smi::IsValid(0x3FFFFFFF));
394 EXPECT(Smi::IsValid(-1));
395 EXPECT(!Smi::IsValid(0xFFFFFFFFu));
396#endif
397
398 EXPECT_EQ(5, smi.AsInt64Value());
399 EXPECT_EQ(5.0, smi.AsDoubleValue());
400
401 Smi& a = Smi::Handle(Smi::New(5));
402 Smi& b = Smi::Handle(Smi::New(3));
403 EXPECT_EQ(1, a.CompareWith(b));
404 EXPECT_EQ(-1, b.CompareWith(a));
405 EXPECT_EQ(0, a.CompareWith(a));
406
407 Smi& c = Smi::Handle(Smi::New(-1));
408
409 Mint& mint1 = Mint::Handle();
410 mint1 ^= Integer::New(DART_2PART_UINT64_C(0x7FFFFFFF, 100));
411 Mint& mint2 = Mint::Handle();
412 mint2 ^= Integer::New(-DART_2PART_UINT64_C(0x7FFFFFFF, 100));
413 EXPECT_EQ(-1, a.CompareWith(mint1));
414 EXPECT_EQ(1, a.CompareWith(mint2));
415 EXPECT_EQ(-1, c.CompareWith(mint1));
416 EXPECT_EQ(1, c.CompareWith(mint2));
417}
virtual bool Equals(const Instance &other) const
Definition object.cc:23330
virtual int CompareWith(const Integer &other) const
Definition object.cc:23349
virtual double AsDoubleValue() const
Definition object.cc:23337

◆ ISOLATE_UNIT_TEST_CASE() [339/463]

dart::ISOLATE_UNIT_TEST_CASE ( SourceReport_BranchCoverage_if  )

Definition at line 1343 of file source_report_test.cc.

1343 {
1344 // WARNING: This MUST be big enough for the serialized JSON string.
1345 const int kBufferSize = 1024;
1346 char buffer[kBufferSize];
1347 const char* kScript = R"(
1348int ifTest(int x) {
1349 if (x > 0) {
1350 if (x > 10) {
1351 return 10;
1352 } else {
1353 return 1;
1354 }
1355 } else {
1356 return 0;
1357 }
1358}
1359
1360main() {
1361 ifTest(1);
1362}
1363)";
1364
1365 Library& lib = Library::Handle();
1366 const bool old_branch_coverage = IsolateGroup::Current()->branch_coverage();
1367 IsolateGroup::Current()->set_branch_coverage(true);
1368 lib ^= ExecuteScript(kScript);
1369 IsolateGroup::Current()->set_branch_coverage(old_branch_coverage);
1370 ASSERT(!lib.IsNull());
1371 const Script& script =
1372 Script::Handle(lib.LookupScript(String::Handle(String::New("test-lib"))));
1373
1374 SourceReport report(SourceReport::kBranchCoverage);
1375 JSONStream js;
1376 report.PrintJSON(&js, script);
1377 const char* json_str = js.ToCString();
1378 ASSERT(strlen(json_str) < kBufferSize);
1379 ElideJSONSubstring("classes", json_str, buffer);
1380 ElideJSONSubstring("libraries", buffer, buffer);
1381 EXPECT_STREQ(
1382 "{\"type\":\"SourceReport\",\"ranges\":["
1383
1384 // In ifTest, the outer true case is hit, the inner true case is missed,
1385 // the inner false case is hit, and the outer false case is missed.
1386 "{\"scriptIndex\":0,\"startPos\":1,\"endPos\":135,\"compiled\":true,"
1387 "\"branchCoverage\":{\"hits\":[1,34,82],\"misses\":[52,115]}},"
1388
1389 // Main is hit.
1390 "{\"scriptIndex\":0,\"startPos\":138,\"endPos\":160,\"compiled\":true,"
1391 "\"branchCoverage\":{\"hits\":[138],\"misses\":[]}}],"
1392
1393 // Only one script in the script table.
1394 "\"scripts\":[{\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\","
1395 "\"uri\":\"file:\\/\\/\\/test-lib\",\"_kind\":\"kernel\"}]}",
1396 buffer);
1397}
ScriptPtr LookupScript(const String &url, bool useResolvedUri=false) const
Definition object.cc:14056
static ObjectPtr ExecuteScript(const char *script, bool allow_errors=false)

◆ ISOLATE_UNIT_TEST_CASE() [340/463]

dart::ISOLATE_UNIT_TEST_CASE ( SourceReport_BranchCoverage_loops  )

Definition at line 1399 of file source_report_test.cc.

1399 {
1400 // WARNING: This MUST be big enough for the serialized JSON string.
1401 const int kBufferSize = 1024;
1402 char buffer[kBufferSize];
1403 const char* kScript = R"(
1404int loopTest() {
1405 var x = 0;
1406
1407 while (x < 10) {
1408 ++x;
1409 }
1410
1411 do {
1412 ++x;
1413 } while (false);
1414
1415 for (int i = 0; i < 10; ++i) {
1416 ++x;
1417 }
1418
1419 for (final i in [1, 2, 3]) {
1420 ++x;
1421 }
1422
1423 return x;
1424}
1425
1426main() {
1427 loopTest();
1428}
1429)";
1430
1431 Library& lib = Library::Handle();
1432 const bool old_branch_coverage = IsolateGroup::Current()->branch_coverage();
1433 IsolateGroup::Current()->set_branch_coverage(true);
1434 lib ^= ExecuteScript(kScript);
1435 IsolateGroup::Current()->set_branch_coverage(old_branch_coverage);
1436 ASSERT(!lib.IsNull());
1437 const Script& script =
1438 Script::Handle(lib.LookupScript(String::Handle(String::New("test-lib"))));
1439
1440 SourceReport report(SourceReport::kBranchCoverage);
1441 JSONStream js;
1442 report.PrintJSON(&js, script);
1443 const char* json_str = js.ToCString();
1444 ASSERT(strlen(json_str) < kBufferSize);
1445 ElideJSONSubstring("classes", json_str, buffer);
1446 ElideJSONSubstring("libraries", buffer, buffer);
1447 EXPECT_STREQ(
1448 "{\"type\":\"SourceReport\",\"ranges\":["
1449
1450 // In loopTest, the while loop, do-while loop, for loop, and for-in loop
1451 // are all hit.
1452 "{\"scriptIndex\":0,\"startPos\":1,\"endPos\":205,\"compiled\":true,"
1453 "\"branchCoverage\":{\"hits\":[1,49,70,132,177],\"misses\":[]}},"
1454
1455 // Main is hit.
1456 "{\"scriptIndex\":0,\"startPos\":208,\"endPos\":231,\"compiled\":true,"
1457 "\"branchCoverage\":{\"hits\":[208],\"misses\":[]}}],"
1458
1459 // Only one script in the script table.
1460 "\"scripts\":[{\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\","
1461 "\"uri\":\"file:\\/\\/\\/test-lib\",\"_kind\":\"kernel\"}]}",
1462 buffer);
1463}

◆ ISOLATE_UNIT_TEST_CASE() [341/463]

dart::ISOLATE_UNIT_TEST_CASE ( SourceReport_BranchCoverage_switch  )

Definition at line 1465 of file source_report_test.cc.

1465 {
1466 // WARNING: This MUST be big enough for the serialized JSON string.
1467 const int kBufferSize = 1024;
1468 char buffer[kBufferSize];
1469 const char* kScript = R"(
1470int switchTest(int x) {
1471 switch (x) {
1472 case 0:
1473 return 10;
1474 case 1:
1475 return 20;
1476 default:
1477 return 30;
1478 }
1479}
1480
1481main() {
1482 switchTest(1);
1483}
1484)";
1485
1486 Library& lib = Library::Handle();
1487 const bool old_branch_coverage = IsolateGroup::Current()->branch_coverage();
1488 IsolateGroup::Current()->set_branch_coverage(true);
1489 lib ^= ExecuteScript(kScript);
1490 IsolateGroup::Current()->set_branch_coverage(old_branch_coverage);
1491 ASSERT(!lib.IsNull());
1492 const Script& script =
1493 Script::Handle(lib.LookupScript(String::Handle(String::New("test-lib"))));
1494
1495 SourceReport report(SourceReport::kBranchCoverage);
1496 JSONStream js;
1497 report.PrintJSON(&js, script);
1498 const char* json_str = js.ToCString();
1499 ASSERT(strlen(json_str) < kBufferSize);
1500 ElideJSONSubstring("classes", json_str, buffer);
1501 ElideJSONSubstring("libraries", buffer, buffer);
1502 EXPECT_STREQ(
1503 "{\"type\":\"SourceReport\",\"ranges\":["
1504
1505 // In switchTest, the 1 case is hit and the others are missed.
1506 "{\"scriptIndex\":0,\"startPos\":1,\"endPos\":132,\"compiled\":true,"
1507 "\"branchCoverage\":{\"hits\":[1,73],\"misses\":[44,102]}},"
1508
1509 // Main is hit.
1510 "{\"scriptIndex\":0,\"startPos\":135,\"endPos\":161,\"compiled\":true,"
1511 "\"branchCoverage\":{\"hits\":[135],\"misses\":[]}}],"
1512
1513 // Only one script in the script table.
1514 "\"scripts\":[{\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\","
1515 "\"uri\":\"file:\\/\\/\\/test-lib\",\"_kind\":\"kernel\"}]}",
1516 buffer);
1517}

◆ ISOLATE_UNIT_TEST_CASE() [342/463]

dart::ISOLATE_UNIT_TEST_CASE ( SourceReport_BranchCoverage_try  )

Definition at line 1519 of file source_report_test.cc.

1519 {
1520 // WARNING: This MUST be big enough for the serialized JSON string.
1521 const int kBufferSize = 1024;
1522 char buffer[kBufferSize];
1523 const char* kScript = R"(
1524void tryTestInner() {
1525 try {
1526 throw "abc";
1527 } catch (e) {
1528 } finally {
1529 }
1530
1531 try {
1532 throw "def";
1533 } finally {
1534 }
1535}
1536
1537void tryTestOuter() {
1538 try {
1539 tryTestInner();
1540 } catch (e) {
1541 }
1542}
1543
1544main() {
1545 tryTestOuter();
1546}
1547)";
1548
1549 Library& lib = Library::Handle();
1550 const bool old_branch_coverage = IsolateGroup::Current()->branch_coverage();
1551 IsolateGroup::Current()->set_branch_coverage(true);
1552 lib ^= ExecuteScript(kScript);
1553 IsolateGroup::Current()->set_branch_coverage(old_branch_coverage);
1554 ASSERT(!lib.IsNull());
1555 const Script& script =
1556 Script::Handle(lib.LookupScript(String::Handle(String::New("test-lib"))));
1557
1558 SourceReport report(SourceReport::kBranchCoverage);
1559 JSONStream js;
1560 report.PrintJSON(&js, script);
1561 const char* json_str = js.ToCString();
1562 ASSERT(strlen(json_str) < kBufferSize);
1563 ElideJSONSubstring("classes", json_str, buffer);
1564 ElideJSONSubstring("libraries", buffer, buffer);
1565 EXPECT_STREQ(
1566 "{\"type\":\"SourceReport\",\"ranges\":["
1567
1568 // In tryTestInner, the try/catch/finally and the try/finally are all hit,
1569 // and the try/finally rethrows its exception.
1570 "{\"scriptIndex\":0,\"startPos\":1,\"endPos\":126,\"compiled\":true,"
1571 "\"branchCoverage\":{\"hits\":[1,29,62,76,89,120],\"misses\":[]}},"
1572
1573 // In tryTestOuter, the exception thrown by tryTestInner causes both the
1574 // try and the catch to be hit.
1575 "{\"scriptIndex\":0,\"startPos\":129,\"endPos\":199,\"compiled\":true,"
1576 "\"branchCoverage\":{\"hits\":[129,157,193],\"misses\":[]}},"
1577
1578 // Main is hit.
1579 "{\"scriptIndex\":0,\"startPos\":202,\"endPos\":229,\"compiled\":true,"
1580 "\"branchCoverage\":{\"hits\":[202],\"misses\":[]}}],"
1581
1582 // Only one script in the script table.
1583 "\"scripts\":[{\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\","
1584 "\"uri\":\"file:\\/\\/\\/test-lib\",\"_kind\":\"kernel\"}]}",
1585 buffer);
1586}

◆ ISOLATE_UNIT_TEST_CASE() [343/463]

dart::ISOLATE_UNIT_TEST_CASE ( SourceReport_CallSites_PolymorphicCall  )

Definition at line 670 of file source_report_test.cc.

670 {
671 // WARNING: This MUST be big enough for the serialized JSON string.
672 const int kBufferSize = 4096;
673 char buffer[kBufferSize];
674 const char* kScript =
675 "class Common {\n"
676 " func() {}\n"
677 "}\n"
678 "class Uncommon {\n"
679 " func() {}\n"
680 "}\n"
681 "helper(arg) {\n"
682 " arg.func();\n"
683 "}\n"
684 "main() {\n"
685 " Common common = new Common();\n"
686 " Uncommon uncommon = new Uncommon();\n"
687 " helper(common);\n"
688 " helper(common);\n"
689 " helper(uncommon);\n"
690 "}";
691
692 Library& lib = Library::Handle();
693 lib ^= ExecuteScript(kScript);
694 ASSERT(!lib.IsNull());
695 const Script& script =
696 Script::Handle(lib.LookupScript(String::Handle(String::New("test-lib"))));
697 const Function& helper = Function::Handle(
698 lib.LookupFunctionAllowPrivate(String::Handle(String::New("helper"))));
699
700 SourceReport report(SourceReport::kCallSites);
701 JSONStream js;
702 report.PrintJSON(&js, script, helper.token_pos(), helper.end_token_pos());
703 const char* json_str = js.ToCString();
704 ASSERT(strlen(json_str) < kBufferSize);
705 ElideJSONSubstring("classes", json_str, buffer);
706 ElideJSONSubstring("libraries", buffer, buffer);
707 EXPECT_STREQ(
708 "{\"type\":\"SourceReport\",\"ranges\":["
709
710 // One range...
711 "{\"scriptIndex\":0,\"startPos\":60,\"endPos\":88,\"compiled\":true,"
712
713 // With one call site...
714 "\"callSites\":[{\"name\":\"dyn:func\",\"tokenPos\":80,\"cacheEntries\":["
715
716 // First receiver: "Common", called twice.
717 "{\"receiver\":{\"type\":\"@Class\",\"fixedId\":true,\"id\":\"\","
718 "\"name\":\"Common\","
719 "\"location\":{\"type\":\"SourceLocation\","
720 "\"script\":{\"type\":\"@Script\","
721 "\"fixedId\":true,\"id\":\"\","
722 "\"uri\":\"file:\\/\\/\\/test-lib\","
723 "\"_kind\":\"kernel\"},\"tokenPos\":0,\"endTokenPos\":27,\"line\":1,"
724 "\"column\":1},"
725 "\"library\":{\"type\":\"@Library\",\"fixedId\":true,"
726 "\"id\":\"\",\"name\":\"\",\"uri\":\"file:\\/\\/\\/test-lib\"}},"
727
728 "\"target\":{\"type\":\"@Function\",\"fixedId\":true,\"id\":\"\","
729 "\"name\":\"func\","
730 "\"owner\":{\"type\":\"@Class\",\"fixedId\":true,\"id\":\"\","
731 "\"name\":\"Common\","
732 "\"location\":{\"type\":\"SourceLocation\","
733 "\"script\":{\"type\":\"@Script\","
734 "\"fixedId\":true,\"id\":\"\","
735 "\"uri\":\"file:\\/\\/\\/test-lib\","
736 "\"_kind\":\"kernel\"},\"tokenPos\":0,\"endTokenPos\":27,\"line\":1,"
737 "\"column\":1},"
738 "\"library\":{\"type\":\"@Library\",\"fixedId\":true,"
739 "\"id\":\"\",\"name\":\"\",\"uri\":\"file:\\/\\/\\/test-lib\"}"
740 "},\"_kind\":\"RegularFunction\","
741 "\"static\":false,\"const\":false,\"implicit\":false,\"abstract\":"
742 "false,\"_intrinsic\":false,"
743 "\"_native\":false,\"isGetter\":false,\"isSetter\":false,"
744 "\"location\":{\"type\":\"SourceLocation\","
745 "\"script\":{\"type\":\"@Script\",\"fixedId\":true,"
746 "\"id\":\"\",\"uri\":\"file:\\/\\/\\/test-lib\","
747 "\"_kind\":\"kernel\"},\"tokenPos\":17,\"endTokenPos\":25,\"line\":2,"
748 "\"column\":3}},"
749
750 "\"count\":2},"
751
752 // Second receiver: "Uncommon", called once.
753 "{\"receiver\":{\"type\":\"@Class\",\"fixedId\":true,\"id\":\"\","
754 "\"name\":\"Uncommon\","
755 "\"location\":{\"type\":\"SourceLocation\","
756 "\"script\":{\"type\":\"@Script\","
757 "\"fixedId\":true,\"id\":\"\","
758 "\"uri\":\"file:\\/\\/\\/test-lib\","
759 "\"_kind\":\"kernel\"},\"tokenPos\":29,\"endTokenPos\":58,\"line\":4,"
760 "\"column\":1},"
761 "\"library\":{\"type\":\"@Library\",\"fixedId\":true,"
762 "\"id\":\"\",\"name\":\"\",\"uri\":\"file:\\/\\/\\/test-lib\"}},"
763
764 "\"target\":{\"type\":\"@Function\",\"fixedId\":true,\"id\":\"\","
765 "\"name\":\"func\","
766 "\"owner\":{\"type\":\"@Class\",\"fixedId\":true,\"id\":\"\","
767 "\"name\":\"Uncommon\","
768 "\"location\":{\"type\":\"SourceLocation\","
769 "\"script\":{\"type\":\"@Script\","
770 "\"fixedId\":true,\"id\":\"\","
771 "\"uri\":\"file:\\/\\/\\/test-lib\","
772 "\"_kind\":\"kernel\"},\"tokenPos\":29,\"endTokenPos\":58,\"line\":4,"
773 "\"column\":1},"
774 "\"library\":{\"type\":\"@Library\",\"fixedId\":true,"
775 "\"id\":\"\",\"name\":\"\",\"uri\":\"file:\\/\\/\\/test-lib\"}"
776 "},\"_kind\":\"RegularFunction\","
777 "\"static\":false,\"const\":false,\"implicit\":false,\"abstract\":"
778 "false,\"_intrinsic\":false,"
779 "\"_native\":false,\"isGetter\":false,\"isSetter\":false,"
780 "\"location\":{\"type\":\"SourceLocation\","
781 "\"script\":{\"type\":\"@Script\",\"fixedId\":true,"
782 "\"id\":\"\",\"uri\":\"file:\\/\\/\\/test-lib\","
783 "\"_kind\":\"kernel\"},\"tokenPos\":48,\"endTokenPos\":56,\"line\":5,"
784 "\"column\":3}},"
785
786 "\"count\":1}]}]}],"
787
788 // One script in the script table.
789 "\"scripts\":[{\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\","
790 "\"uri\":\"file:\\/\\/\\/test-lib\",\"_kind\":\"kernel\"}]}",
791 buffer);
792}

◆ ISOLATE_UNIT_TEST_CASE() [344/463]

dart::ISOLATE_UNIT_TEST_CASE ( SourceReport_CallSites_SimpleCall  )

Definition at line 614 of file source_report_test.cc.

614 {
615 // WARNING: This MUST be big enough for the serialized JSON string.
616 const int kBufferSize = 2048;
617 char buffer[kBufferSize];
618 const char* kScript =
619 "helper0() {}\n"
620 "helper1() {}\n"
621 "main() {\n"
622 " helper0();\n"
623 "}";
624
625 Library& lib = Library::Handle();
626 lib ^= ExecuteScript(kScript);
627 ASSERT(!lib.IsNull());
628 const Script& script =
629 Script::Handle(lib.LookupScript(String::Handle(String::New("test-lib"))));
630
631 SourceReport report(SourceReport::kCallSites);
632 JSONStream js;
633 report.PrintJSON(&js, script);
634 const char* json_str = js.ToCString();
635 ASSERT(strlen(json_str) < kBufferSize);
636 ElideJSONSubstring("classes", json_str, buffer);
637 ElideJSONSubstring("libraries", buffer, buffer);
638 EXPECT_STREQ(
639 "{\"type\":\"SourceReport\",\"ranges\":["
640
641 // One range compiled with no callsites (helper0).
642 "{\"scriptIndex\":0,\"startPos\":0,\"endPos\":11,\"compiled\":true,"
643 "\"callSites\":[]},"
644
645 // One range not compiled (helper1).
646 "{\"scriptIndex\":0,\"startPos\":13,\"endPos\":24,\"compiled\":false},"
647
648 // One range compiled with one callsite (main).
649 "{\"scriptIndex\":0,\"startPos\":26,\"endPos\":48,\"compiled\":true,"
650 "\"callSites\":["
651 "{\"name\":\"helper0\",\"tokenPos\":37,\"cacheEntries\":["
652 "{\"target\":{\"type\":\"@Function\",\"fixedId\":true,\"id\":\"\","
653 "\"name\":\"helper0\",\"owner\":{\"type\":\"@Library\",\"fixedId\":true,"
654 "\"id\":\"\",\"name\":\"\",\"uri\":\"file:\\/\\/\\/test-lib\"},"
655 "\"_kind\":\"RegularFunction\",\"static\":true,\"const\":false,"
656 "\"implicit\":false,\"abstract\":false,"
657 "\"_intrinsic\":false,\"_native\":false,\"isGetter\":false,"
658 "\"isSetter\":false,\"location\":{\"type\":"
659 "\"SourceLocation\",\"script\":{\"type\":\"@Script\",\"fixedId\":true,"
660 "\"id\":\"\",\"uri\":\"file:\\/\\/\\/test-lib\",\"_kind\":\"kernel\"},"
661 "\"tokenPos\":0,\"endTokenPos\":11,\"line\":1,\"column\":1}},\"count\":1}"
662 "]}]}],"
663
664 // One script in the script table.
665 "\"scripts\":[{\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\","
666 "\"uri\":\"file:\\/\\/\\/test-lib\",\"_kind\":\"kernel\"}]}",
667 buffer);
668}

◆ ISOLATE_UNIT_TEST_CASE() [345/463]

dart::ISOLATE_UNIT_TEST_CASE ( SourceReport_Coverage_AllFunctions  )

Definition at line 536 of file source_report_test.cc.

536 {
537 const char* kScript =
538 "helper0() {}\n"
539 "helper1() {}\n"
540 "main() {\n"
541 " if (true) {\n"
542 " helper0();\n"
543 " } else {\n"
544 " helper1();\n"
545 " }\n"
546 "}";
547
548 Library& lib = Library::Handle();
549 lib ^= ExecuteScript(kScript);
550 ASSERT(!lib.IsNull());
551
552 SourceReport report(SourceReport::kCoverage);
553 JSONStream js;
554
555 // We generate a report with all functions in the VM.
556 Script& null_script = Script::Handle();
557 report.PrintJSON(&js, null_script);
558 const char* result = js.ToCString();
559
560 // Sanity check the header.
561 EXPECT_SUBSTRING("{\"type\":\"SourceReport\",\"ranges\":[", result);
562
563 // Make sure that the main function was found.
564 EXPECT_SUBSTRING(
565 "\"startPos\":26,\"endPos\":94,\"compiled\":true,"
566 "\"coverage\":{\"hits\":[26,53],\"misses\":[79]}",
567 result);
568
569 // More than one script is referenced in the report.
570 EXPECT_SUBSTRING("\"scriptIndex\":0", result);
571 EXPECT_SUBSTRING("\"scriptIndex\":1", result);
572 EXPECT_SUBSTRING("\"scriptIndex\":2", result);
573}

◆ ISOLATE_UNIT_TEST_CASE() [346/463]

dart::ISOLATE_UNIT_TEST_CASE ( SourceReport_Coverage_AllFunctions_ForceCompile  )

Definition at line 575 of file source_report_test.cc.

575 {
576 const char* kScript =
577 "helper0() {}\n"
578 "helper1() {}\n"
579 "main() {\n"
580 " if (true) {\n"
581 " helper0();\n"
582 " } else {\n"
583 " helper1();\n"
584 " }\n"
585 "}";
586
587 Library& lib = Library::Handle();
588 lib ^= ExecuteScript(kScript);
589 ASSERT(!lib.IsNull());
590
591 SourceReport report(SourceReport::kCoverage, SourceReport::kForceCompile);
592 JSONStream js;
593
594 // We generate a report with all functions in the VM.
595 Script& null_script = Script::Handle();
596 report.PrintJSON(&js, null_script);
597 const char* result = js.ToCString();
598
599 // Sanity check the header.
600 EXPECT_SUBSTRING("{\"type\":\"SourceReport\",\"ranges\":[", result);
601
602 // Make sure that the main function was found.
603 EXPECT_SUBSTRING(
604 "\"startPos\":26,\"endPos\":94,\"compiled\":true,"
605 "\"coverage\":{\"hits\":[26,53],\"misses\":[79]}",
606 result);
607
608 // More than one script is referenced in the report.
609 EXPECT_SUBSTRING("\"scriptIndex\":0", result);
610 EXPECT_SUBSTRING("\"scriptIndex\":1", result);
611 EXPECT_SUBSTRING("\"scriptIndex\":2", result);
612}

◆ ISOLATE_UNIT_TEST_CASE() [347/463]

dart::ISOLATE_UNIT_TEST_CASE ( SourceReport_Coverage_Filters_empty  )

Definition at line 95 of file source_report_test.cc.

95 {
96 // WARNING: This MUST be big enough for the serialized JSON string.
97 const int kBufferSize = 1024;
98 char buffer[kBufferSize];
99 const char* kScript =
100 "main() {\n"
101 "}";
102
103 Library& lib = Library::Handle();
104 lib ^= ExecuteScript(kScript);
105 ASSERT(!lib.IsNull());
106
107 GrowableObjectArray& filters =
108 GrowableObjectArray::Handle(GrowableObjectArray::New());
109 filters.Add(String::Handle(String::New("foo:bar/")));
110 SourceReport report(SourceReport::kCoverage, filters);
111 JSONStream js;
112 report.PrintJSON(&js, Script::Handle(Script::null()));
113 const char* json_str = js.ToCString();
114 ASSERT(strlen(json_str) < kBufferSize);
115 ElideJSONSubstring("libraries", json_str, buffer);
116 EXPECT_STREQ(
117 "{\"type\":\"SourceReport\",\"ranges\":"
118
119 // No compiled range.
120 "[],"
121
122 // No script.
123 "\"scripts\":[]}",
124 buffer);
125}

◆ ISOLATE_UNIT_TEST_CASE() [348/463]

dart::ISOLATE_UNIT_TEST_CASE ( SourceReport_Coverage_Filters_single  )

Definition at line 61 of file source_report_test.cc.

61 {
62 // WARNING: This MUST be big enough for the serialized JSON string.
63 const int kBufferSize = 1024;
64 char buffer[kBufferSize];
65 const char* kScript =
66 "main() {\n"
67 "}";
68
69 Library& lib = Library::Handle();
70 lib ^= ExecuteScript(kScript);
71 ASSERT(!lib.IsNull());
72
73 GrowableObjectArray& filters =
74 GrowableObjectArray::Handle(GrowableObjectArray::New());
75 filters.Add(String::Handle(String::New(RESOLVED_USER_TEST_URI)));
76 SourceReport report(SourceReport::kCoverage, filters);
77 JSONStream js;
78 report.PrintJSON(&js, Script::Handle(Script::null()));
79 const char* json_str = js.ToCString();
80 ASSERT(strlen(json_str) < kBufferSize);
81 ElideJSONSubstring("libraries", json_str, buffer);
82 EXPECT_STREQ(
83 "{\"type\":\"SourceReport\",\"ranges\":"
84
85 // One compiled range, one hit at function declaration.
86 "[{\"scriptIndex\":0,\"startPos\":0,\"endPos\":9,\"compiled\":true,"
87 "\"coverage\":{\"hits\":[0],\"misses\":[]}}],"
88
89 // One script in the script table.
90 "\"scripts\":[{\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\","
91 "\"uri\":\"file:\\/\\/\\/test-lib\",\"_kind\":\"kernel\"}]}",
92 buffer);
93}

◆ ISOLATE_UNIT_TEST_CASE() [349/463]

dart::ISOLATE_UNIT_TEST_CASE ( SourceReport_Coverage_ForceCompile  )

Definition at line 175 of file source_report_test.cc.

175 {
176 // WARNING: This MUST be big enough for the serialized JSON string.
177 const int kBufferSize = 1024;
178 char buffer[kBufferSize];
179 const char* kScript =
180 "helper0() {}\n"
181 "helper1() {}\n"
182 "main() {\n"
183 " if (true) {\n"
184 " helper0();\n"
185 " } else {\n"
186 " helper1();\n"
187 " }\n"
188 "}";
189
190 Library& lib = Library::Handle();
191 lib ^= ExecuteScript(kScript);
192 ASSERT(!lib.IsNull());
193 const Script& script =
194 Script::Handle(lib.LookupScript(String::Handle(String::New("test-lib"))));
195
196 SourceReport report(SourceReport::kCoverage, SourceReport::kForceCompile);
197 JSONStream js;
198 report.PrintJSON(&js, script);
199 const char* json_str = js.ToCString();
200 ASSERT(strlen(json_str) < kBufferSize);
201 ElideJSONSubstring("classes", json_str, buffer);
202 ElideJSONSubstring("libraries", buffer, buffer);
203
204 EXPECT_STREQ(
205 "{\"type\":\"SourceReport\",\"ranges\":["
206
207 // One range compiled with one hit at function declaration (helper0).
208 "{\"scriptIndex\":0,\"startPos\":0,\"endPos\":11,\"compiled\":true,"
209 "\"coverage\":{\"hits\":[0],\"misses\":[]}},"
210
211 // This range is compiled even though it wasn't called (helper1).
212 "{\"scriptIndex\":0,\"startPos\":13,\"endPos\":24,\"compiled\":true,"
213 "\"coverage\":{\"hits\":[],\"misses\":[13]}},"
214
215 // One range with two hits and a miss (main).
216 "{\"scriptIndex\":0,\"startPos\":26,\"endPos\":94,\"compiled\":true,"
217 "\"coverage\":{\"hits\":[26,53],\"misses\":[79]}}],"
218
219 // Only one script in the script table.
220 "\"scripts\":[{\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\","
221 "\"uri\":\"file:\\/\\/\\/test-lib\",\"_kind\":\"kernel\"}]}",
222 buffer);
223}

◆ ISOLATE_UNIT_TEST_CASE() [350/463]

dart::ISOLATE_UNIT_TEST_CASE ( SourceReport_Coverage_Issue35453_NoSuchMethod  )

Definition at line 899 of file source_report_test.cc.

899 {
900 // WARNING: This MUST be big enough for the serialized JSON string.
901 const int kBufferSize = 1024;
902 char buffer[kBufferSize];
903 const char* kScript =
904 "class Foo {\n"
905 " void bar() {}\n"
906 "}\n"
907 "class Unused implements Foo {\n"
908 " dynamic noSuchMethod(_) {}\n"
909 "}\n"
910 "void main() {\n"
911 " Foo().bar();\n"
912 "}\n";
913
914 Library& lib = Library::Handle();
915 lib ^= ExecuteScript(kScript);
916 ASSERT(!lib.IsNull());
917 const Script& script =
918 Script::Handle(lib.LookupScript(String::Handle(String::New("test-lib"))));
919
920 SourceReport report(SourceReport::kCoverage, SourceReport::kForceCompile);
921 JSONStream js;
922 report.PrintJSON(&js, script);
923 const char* json_str = js.ToCString();
924 ASSERT(strlen(json_str) < kBufferSize);
925 ElideJSONSubstring("classes", json_str, buffer);
926 ElideJSONSubstring("libraries", buffer, buffer);
927 EXPECT_STREQ(
928 "{\"type\":\"SourceReport\",\"ranges\":["
929
930 // Foo is hit.
931 "{\"scriptIndex\":0,\"startPos\":14,\"endPos\":26,\"compiled\":true,"
932 "\"coverage\":{\"hits\":[14],\"misses\":[]}},"
933
934 // Unused is missed.
935 "{\"scriptIndex\":0,\"startPos\":62,\"endPos\":87,\"compiled\":true,"
936 "\"coverage\":{\"hits\":[],\"misses\":[62]}},"
937
938 // Main is hit.
939 "{\"scriptIndex\":0,\"startPos\":91,\"endPos\":120,\"compiled\":true,"
940 "\"coverage\":{\"hits\":[91,107,113],\"misses\":[]}}],"
941
942 // Only one script in the script table.
943 "\"scripts\":[{\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\","
944 "\"uri\":\"file:\\/\\/\\/test-lib\",\"_kind\":\"kernel\"}]}",
945 buffer);
946}

◆ ISOLATE_UNIT_TEST_CASE() [351/463]

dart::ISOLATE_UNIT_TEST_CASE ( SourceReport_Coverage_Issue47017_Assert  )

Definition at line 948 of file source_report_test.cc.

948 {
949 // WARNING: This MUST be big enough for the serialized JSON string.
950 const int kBufferSize = 1024;
951 char buffer[kBufferSize];
952 const char* kScript =
953 "void foo(Object? bar) {\n"
954 " assert(bar == null);\n"
955 "}\n"
956 "void main() {\n"
957 " foo(null);\n"
958 "}\n";
959
960 Library& lib = Library::Handle();
961 const bool old_asserts = IsolateGroup::Current()->asserts();
962 IsolateGroup::Current()->set_asserts(true);
963 lib ^= ExecuteScript(kScript);
964 IsolateGroup::Current()->set_asserts(old_asserts);
965 ASSERT(!lib.IsNull());
966 const Script& script =
967 Script::Handle(lib.LookupScript(String::Handle(String::New("test-lib"))));
968
969 SourceReport report(SourceReport::kCoverage, SourceReport::kForceCompile);
970 JSONStream js;
971 report.PrintJSON(&js, script);
972 const char* json_str = js.ToCString();
973 ASSERT(strlen(json_str) < kBufferSize);
974 ElideJSONSubstring("classes", json_str, buffer);
975 ElideJSONSubstring("libraries", buffer, buffer);
976 EXPECT_STREQ(
977 "{\"type\":\"SourceReport\",\"ranges\":["
978
979 // Foo is hit, and the assert is hit.
980 "{\"scriptIndex\":0,\"startPos\":0,\"endPos\":47,\"compiled\":true,"
981 "\"coverage\":{\"hits\":[0,33],\"misses\":[]}},"
982
983 // Main is hit.
984 "{\"scriptIndex\":0,\"startPos\":49,\"endPos\":76,\"compiled\":true,"
985 "\"coverage\":{\"hits\":[49,65],\"misses\":[]}}],"
986
987 // Only one script in the script table.
988 "\"scripts\":[{\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\","
989 "\"uri\":\"file:\\/\\/\\/test-lib\",\"_kind\":\"kernel\"}]}",
990 buffer);
991}

◆ ISOLATE_UNIT_TEST_CASE() [352/463]

dart::ISOLATE_UNIT_TEST_CASE ( SourceReport_Coverage_Issue47021_StaticOnlyClasses  )

Definition at line 993 of file source_report_test.cc.

993 {
994 // WARNING: This MUST be big enough for the serialized JSON string.
995 const int kBufferSize = 2048;
996 char buffer[kBufferSize];
997 const char* kScript =
998 "abstract class AllStatic {\n"
999 " AllStatic._();\n"
1000 " static int test() => 123;\n"
1001 " static int foo = 456;\n"
1002 "}\n"
1003 "class NotAbstract {\n"
1004 " NotAbstract._();\n"
1005 " static int test() => 123;\n"
1006 " static int foo = 456;\n"
1007 "}\n"
1008 "abstract class NotConstructor {\n"
1009 " void _() {}\n"
1010 " static int test() => 123;\n"
1011 "}\n"
1012 "abstract class NotPrivate {\n"
1013 " NotPrivate();\n"
1014 " static int test() => 123;\n"
1015 "}\n"
1016 "abstract class HasParams {\n"
1017 " HasParams._(int i);\n"
1018 " static int test() => 123;\n"
1019 "}\n"
1020 "abstract class HasFields {\n"
1021 " HasFields._();\n"
1022 " static int test() => 123;\n"
1023 " int foo = 0;\n"
1024 "}\n"
1025 "abstract class HasNonStaticFunction {\n"
1026 " HasNonStaticFunction._();\n"
1027 " static int test() => 123;\n"
1028 " int foo() => 456;\n"
1029 "}\n"
1030 "abstract class HasSubclass {\n"
1031 " HasSubclass._();\n"
1032 " static int test() => 123;\n"
1033 " static int foo = 456;\n"
1034 "}\n"
1035 "abstract class Subclass extends HasSubclass {\n"
1036 " Subclass() : super._();\n"
1037 "}\n"
1038 "void main() {\n"
1039 " AllStatic.test();\n"
1040 " NotAbstract.test();\n"
1041 " NotConstructor.test();\n"
1042 " NotPrivate.test();\n"
1043 " HasParams.test();\n"
1044 " HasFields.test();\n"
1045 " HasNonStaticFunction.test();\n"
1046 " HasSubclass.test();\n"
1047 "}\n";
1048
1049 Library& lib = Library::Handle();
1050 lib ^= ExecuteScript(kScript);
1051 ASSERT(!lib.IsNull());
1052 const Script& script =
1053 Script::Handle(lib.LookupScript(String::Handle(String::New("test-lib"))));
1054
1055 SourceReport report(SourceReport::kCoverage, SourceReport::kForceCompile);
1056 JSONStream js;
1057 report.PrintJSON(&js, script);
1058 const char* json_str = js.ToCString();
1059 ASSERT(strlen(json_str) < kBufferSize);
1060 ElideJSONSubstring("classes", json_str, buffer);
1061 ElideJSONSubstring("libraries", buffer, buffer);
1062 EXPECT_STREQ(
1063 "{\"type\":\"SourceReport\",\"ranges\":["
1064
1065 // Subclass() is missed.
1066 "{\"scriptIndex\":0,\"startPos\":775,\"endPos\":797,\"compiled\":true,"
1067 "\"coverage\":{\"hits\":[],\"misses\":[775,794]}},"
1068
1069 // AllStatic.test() is hit. AllStatic._() is ignored (would be pos: 29).
1070 "{\"scriptIndex\":0,\"startPos\":46,\"endPos\":70,\"compiled\":true,"
1071 "\"coverage\":{\"hits\":[46],\"misses\":[]}},"
1072
1073 // HasSubclass._() is missed, not ignored.
1074 "{\"scriptIndex\":0,\"startPos\":656,\"endPos\":671,\"compiled\":true,"
1075 "\"coverage\":{\"hits\":[],\"misses\":[656]}},"
1076
1077 // HasSubclass.test() is hit.
1078 "{\"scriptIndex\":0,\"startPos\":675,\"endPos\":699,\"compiled\":true,"
1079 "\"coverage\":{\"hits\":[675],\"misses\":[]}},"
1080
1081 // HasParams._(int i) is missed, not ignored.
1082 "{\"scriptIndex\":0,\"startPos\":370,\"endPos\":388,\"compiled\":true,"
1083 "\"coverage\":{\"hits\":[],\"misses\":[370]}},"
1084
1085 // HasParams.test() is hit.
1086 "{\"scriptIndex\":0,\"startPos\":392,\"endPos\":416,\"compiled\":true,"
1087 "\"coverage\":{\"hits\":[392],\"misses\":[]}},"
1088
1089 // NotAbstract._() is missed, not ignored.
1090 "{\"scriptIndex\":0,\"startPos\":120,\"endPos\":135,\"compiled\":true,"
1091 "\"coverage\":{\"hits\":[],\"misses\":[120]}},"
1092
1093 // NotAbstract.test() is hit.
1094 "{\"scriptIndex\":0,\"startPos\":139,\"endPos\":163,\"compiled\":true,"
1095 "\"coverage\":{\"hits\":[139],\"misses\":[]}},"
1096
1097 // HasFields._() is missed, not ignored.
1098 "{\"scriptIndex\":0,\"startPos\":449,\"endPos\":462,\"compiled\":true,"
1099 "\"coverage\":{\"hits\":[],\"misses\":[449]}},"
1100
1101 // HasFields.test() is hit.
1102 "{\"scriptIndex\":0,\"startPos\":466,\"endPos\":490,\"compiled\":true,"
1103 "\"coverage\":{\"hits\":[466],\"misses\":[]}},"
1104
1105 // NotPrivate() is missed, not ignored.
1106 "{\"scriptIndex\":0,\"startPos\":297,\"endPos\":309,\"compiled\":true,"
1107 "\"coverage\":{\"hits\":[],\"misses\":[297]}},"
1108
1109 // NotPrivate.test() is hit.
1110 "{\"scriptIndex\":0,\"startPos\":313,\"endPos\":337,\"compiled\":true,"
1111 "\"coverage\":{\"hits\":[313],\"misses\":[]}},"
1112
1113 // HasNonStaticFunction._() is missed, not ignored.
1114 "{\"scriptIndex\":0,\"startPos\":549,\"endPos\":573,\"compiled\":true,"
1115 "\"coverage\":{\"hits\":[],\"misses\":[549]}},"
1116
1117 // HasNonStaticFunction.test() is hit.
1118 "{\"scriptIndex\":0,\"startPos\":577,\"endPos\":601,\"compiled\":true,"
1119 "\"coverage\":{\"hits\":[577],\"misses\":[]}},"
1120
1121 // HasNonStaticFunction.foo() is missed.
1122 "{\"scriptIndex\":0,\"startPos\":605,\"endPos\":621,\"compiled\":true,"
1123 "\"coverage\":{\"hits\":[],\"misses\":[605]}},"
1124
1125 // NotConstructor._() is missed, not ignored.
1126 "{\"scriptIndex\":0,\"startPos\":225,\"endPos\":235,\"compiled\":true,"
1127 "\"coverage\":{\"hits\":[],\"misses\":[225]}},"
1128
1129 // NotConstructor.test() is hit.
1130 "{\"scriptIndex\":0,\"startPos\":239,\"endPos\":263,\"compiled\":true,"
1131 "\"coverage\":{\"hits\":[239],\"misses\":[]}},"
1132
1133 // Main is hit.
1134 "{\"scriptIndex\":0,\"startPos\":801,\"endPos\":996,\"compiled\":true,"
1135 "\"coverage\":{\"hits\":"
1136 "[801,827,849,874,895,915,935,966,988],\"misses\":[]}}],"
1137
1138 // Only one script in the script table.
1139 "\"scripts\":[{\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\","
1140 "\"uri\":\"file:\\/\\/\\/test-lib\",\"_kind\":\"kernel\"}]}",
1141 buffer);
1142}

◆ ISOLATE_UNIT_TEST_CASE() [353/463]

dart::ISOLATE_UNIT_TEST_CASE ( SourceReport_Coverage_IssueCov341_LateFinalVars  )

Definition at line 1144 of file source_report_test.cc.

1144 {
1145 // https://github.com/dart-lang/coverage/issues/341
1146 // WARNING: This MUST be big enough for the serialized JSON string.
1147 const int kBufferSize = 1024;
1148 char buffer[kBufferSize];
1149 const char* kScript =
1150 "int foo(bool bar) {\n"
1151 " late final int baz;\n"
1152 " if (bar) {\n"
1153 " baz = 123;\n"
1154 " } else {\n"
1155 " baz = 456;\n"
1156 " }\n"
1157 " return baz;\n"
1158 "}\n"
1159 "main() {\n"
1160 " foo(true);\n"
1161 " foo(false);\n"
1162 "}\n";
1163
1164 Library& lib = Library::Handle();
1165 lib ^= ExecuteScript(kScript);
1166 ASSERT(!lib.IsNull());
1167 const Script& script =
1168 Script::Handle(lib.LookupScript(String::Handle(String::New("test-lib"))));
1169
1170 SourceReport report(SourceReport::kCoverage, SourceReport::kForceCompile);
1171 JSONStream js;
1172 report.PrintJSON(&js, script);
1173 const char* json_str = js.ToCString();
1174 ASSERT(strlen(json_str) < kBufferSize);
1175 ElideJSONSubstring("classes", json_str, buffer);
1176 ElideJSONSubstring("libraries", buffer, buffer);
1177 EXPECT_STREQ(
1178 "{\"type\":\"SourceReport\",\"ranges\":["
1179
1180 // foo is hit, but the late variable sets and gets are ignored.
1181 "{\"scriptIndex\":0,\"startPos\":0,\"endPos\":114,\"compiled\":true,"
1182 "\"coverage\":{\"hits\":[0],\"misses\":[]}},"
1183
1184 // Main is hit.
1185 "{\"scriptIndex\":0,\"startPos\":116,\"endPos\":152,\"compiled\":true,\""
1186 "coverage\":{\"hits\":[116,127,140],\"misses\":[]}}],"
1187
1188 // Only one script in the script table.
1189 "\"scripts\":[{\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\","
1190 "\"uri\":\"file:\\/\\/\\/test-lib\",\"_kind\":\"kernel\"}]}",
1191 buffer);
1192}

◆ ISOLATE_UNIT_TEST_CASE() [354/463]

dart::ISOLATE_UNIT_TEST_CASE ( SourceReport_Coverage_IssueCov386_EnhancedEnums  )

Definition at line 1194 of file source_report_test.cc.

1194 {
1195 // https://github.com/dart-lang/coverage/issues/386
1196 // https://github.com/dart-lang/coverage/issues/377
1197 // WARNING: This MUST be big enough for the serialized JSON string.
1198 const int kBufferSize = 1024;
1199 char buffer[kBufferSize];
1200 const char* kScript =
1201 "enum FoodType {\n"
1202 " candy();\n"
1203 " const FoodType();\n"
1204 " factory FoodType.candyFactory() => candy;\n"
1205 "}\n"
1206 "void main() {\n"
1207 " final food = FoodType.candyFactory();\n"
1208 "}\n";
1209
1210 Library& lib = Library::Handle();
1211 lib ^= ExecuteScript(kScript);
1212 ASSERT(!lib.IsNull());
1213 const Script& script =
1214 Script::Handle(lib.LookupScript(String::Handle(String::New("test-lib"))));
1215
1216 SourceReport report(SourceReport::kCoverage, SourceReport::kForceCompile);
1217 JSONStream js;
1218 report.PrintJSON(&js, script);
1219 const char* json_str = js.ToCString();
1220 ASSERT(strlen(json_str) < kBufferSize);
1221 ElideJSONSubstring("classes", json_str, buffer);
1222 ElideJSONSubstring("libraries", buffer, buffer);
1223 EXPECT_STREQ(
1224 "{\"type\":\"SourceReport\",\"ranges\":["
1225
1226 // Main is hit.
1227 "{\"scriptIndex\":0,\"startPos\":49,\"endPos\":89,\"compiled\":true,"
1228 "\"coverage\":{\"hits\":[49],\"misses\":[]}},"
1229
1230 // The enum's constructor, and toString, are not included in the hitmap,
1231 // but the factory is included.
1232 "{\"scriptIndex\":0,\"startPos\":93,\"endPos\":147,\"compiled\":true,"
1233 "\"coverage\":{\"hits\":[93,131],\"misses\":[]}}],"
1234
1235 // Only one script in the script table.
1236 "\"scripts\":[{\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\","
1237 "\"uri\":\"file:\\/\\/\\/test-lib\",\"_kind\":\"kernel\"}]}",
1238 buffer);
1239}

◆ ISOLATE_UNIT_TEST_CASE() [355/463]

dart::ISOLATE_UNIT_TEST_CASE ( SourceReport_Coverage_LibrariesAlreadyCompiled  )

Definition at line 370 of file source_report_test.cc.

370 {
371 // WARNING: This MUST be big enough for the serialized JSON string.
372 const int kBufferSize = 1024;
373 char buffer[kBufferSize];
374 const char* kScript =
375 "helper0() {}\n"
376 "class Unused {\n"
377 " helper1() { helper0(); }\n"
378 "}\n"
379 "main() {\n"
380 " helper0();\n"
381 "}";
382
383 Library& lib = Library::Handle();
384 lib ^= ExecuteScript(kScript);
385 ASSERT(!lib.IsNull());
386 const Script& script =
387 Script::Handle(lib.LookupScript(String::Handle(String::New("test-lib"))));
388
389 Zone* zone = thread->zone();
390 ZoneCStringSet* libraries_already_compiled = new (zone) ZoneCStringSet(zone);
391 libraries_already_compiled->Insert(RESOLVED_USER_TEST_URI);
392 SourceReport report(SourceReport::kCoverage, GrowableObjectArray::Handle(),
393 libraries_already_compiled, SourceReport::kForceCompile);
394 JSONStream js;
395 report.PrintJSON(&js, script);
396 const char* json_str = js.ToCString();
397 ASSERT(strlen(json_str) < kBufferSize);
398 ElideJSONSubstring("classes", json_str, buffer);
399 ElideJSONSubstring("libraries", buffer, buffer);
400 EXPECT_STREQ(
401 "{\"type\":\"SourceReport\",\"ranges\":["
402
403 // UnusedClass is not compiled.
404 "{\"scriptIndex\":0,\"startPos\":13,\"endPos\":55,\"compiled\":false},"
405
406 // helper0 is compiled.
407 "{\"scriptIndex\":0,\"startPos\":0,\"endPos\":11,\"compiled\":true,"
408 "\"coverage\":{\"hits\":[0],\"misses\":[]}},"
409
410 // One range with two hits (main).
411 "{\"scriptIndex\":0,\"startPos\":57,\"endPos\":79,\"compiled\":true,"
412 "\"coverage\":{\"hits\":[57,68],\"misses\":[]}}],"
413
414 // Only one script in the script table.
415 "\"scripts\":[{\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\","
416 "\"uri\":\"file:\\/\\/\\/test-lib\",\"_kind\":\"kernel\"}]}",
417 buffer);
418}
void Insert(typename KeyValueTrait::Pair kv)
Definition hash_map.h:230

◆ ISOLATE_UNIT_TEST_CASE() [356/463]

dart::ISOLATE_UNIT_TEST_CASE ( SourceReport_Coverage_NestedFunctions  )

Definition at line 420 of file source_report_test.cc.

420 {
421 // WARNING: This MUST be big enough for the serialized JSON string.
422 const int kBufferSize = 1024;
423 char buffer[kBufferSize];
424 const char* kScript =
425 "helper0() {\n"
426 " nestedHelper0() {}\n"
427 " nestedHelper1() {}\n"
428 " nestedHelper0();\n"
429 "}\n"
430 "helper1() {}\n"
431 "main() {\n"
432 " if (true) {\n"
433 " helper0();\n"
434 " } else {\n"
435 " helper1();\n"
436 " }\n"
437 "}";
438
439 Library& lib = Library::Handle();
440 lib ^= ExecuteScript(kScript);
441 ASSERT(!lib.IsNull());
442 const Script& script =
443 Script::Handle(lib.LookupScript(String::Handle(String::New("test-lib"))));
444
445 SourceReport report(SourceReport::kCoverage);
446 JSONStream js;
447 report.PrintJSON(&js, script);
448 const char* json_str = js.ToCString();
449 ASSERT(strlen(json_str) < kBufferSize);
450 ElideJSONSubstring("classes", json_str, buffer);
451 ElideJSONSubstring("libraries", buffer, buffer);
452
453 EXPECT_STREQ(
454 "{\"type\":\"SourceReport\",\"ranges\":["
455
456 // One range compiled with one hit (helper0).
457 "{\"scriptIndex\":0,\"startPos\":0,\"endPos\":73,\"compiled\":true,"
458 "\"coverage\":{\"hits\":[0,56],\"misses\":[]}},"
459
460 // One range not compiled (helper1).
461 "{\"scriptIndex\":0,\"startPos\":75,\"endPos\":86,\"compiled\":false},"
462
463 // One range with two hits and a miss (main).
464 "{\"scriptIndex\":0,\"startPos\":88,\"endPos\":156,\"compiled\":true,"
465 "\"coverage\":{\"hits\":[88,115],\"misses\":[141]}},"
466
467 // Nested range compiled (nestedHelper0).
468 "{\"scriptIndex\":0,\"startPos\":14,\"endPos\":31,\"compiled\":true,"
469 "\"coverage\":{\"hits\":[14],\"misses\":[]}},"
470
471 // Nested range not compiled (nestedHelper1).
472 "{\"scriptIndex\":0,\"startPos\":35,\"endPos\":52,\"compiled\":false}],"
473
474 // Only one script in the script table.
475 "\"scripts\":[{\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\","
476 "\"uri\":\"file:\\/\\/\\/test-lib\",\"_kind\":\"kernel\"}]}",
477 buffer);
478}

◆ ISOLATE_UNIT_TEST_CASE() [357/463]

dart::ISOLATE_UNIT_TEST_CASE ( SourceReport_Coverage_NoCalls  )

Definition at line 29 of file source_report_test.cc.

29 {
30 // WARNING: This MUST be big enough for the serialized JSON string.
31 const int kBufferSize = 1024;
32 char buffer[kBufferSize];
33 const char* kScript =
34 "main() {\n"
35 "}";
36
37 Library& lib = Library::Handle();
38 lib ^= ExecuteScript(kScript);
39 ASSERT(!lib.IsNull());
40 const Script& script =
41 Script::Handle(lib.LookupScript(String::Handle(String::New("test-lib"))));
42 SourceReport report(SourceReport::kCoverage);
43 JSONStream js;
44 report.PrintJSON(&js, script);
45 const char* json_str = js.ToCString();
46 ASSERT(strlen(json_str) < kBufferSize);
47 ElideJSONSubstring("libraries", json_str, buffer);
48 EXPECT_STREQ(
49 "{\"type\":\"SourceReport\",\"ranges\":"
50
51 // One compiled range, one hit at function declaration.
52 "[{\"scriptIndex\":0,\"startPos\":0,\"endPos\":9,\"compiled\":true,"
53 "\"coverage\":{\"hits\":[0],\"misses\":[]}}],"
54
55 // One script in the script table.
56 "\"scripts\":[{\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\","
57 "\"uri\":\"file:\\/\\/\\/test-lib\",\"_kind\":\"kernel\"}]}",
58 buffer);
59}

◆ ISOLATE_UNIT_TEST_CASE() [358/463]

dart::ISOLATE_UNIT_TEST_CASE ( SourceReport_Coverage_RestrictedRange  )

Definition at line 480 of file source_report_test.cc.

480 {
481 // WARNING: This MUST be big enough for the serialized JSON string.
482 const int kBufferSize = 1024;
483 char buffer[kBufferSize];
484 const char* kScript =
485 "helper0() {\n"
486 " nestedHelper0() {}\n"
487 " nestedHelper1() {}\n"
488 " nestedHelper0();\n"
489 "}\n"
490 "helper1() {}\n"
491 "main() {\n"
492 " if (true) {\n"
493 " helper0();\n"
494 " } else {\n"
495 " helper1();\n"
496 " }\n"
497 "}";
498
499 Library& lib = Library::Handle();
500 lib ^= ExecuteScript(kScript);
501 ASSERT(!lib.IsNull());
502 const Script& script =
503 Script::Handle(lib.LookupScript(String::Handle(String::New("test-lib"))));
504 const Function& helper = Function::Handle(
505 lib.LookupFunctionAllowPrivate(String::Handle(String::New("helper0"))));
506
507 SourceReport report(SourceReport::kCoverage);
508 JSONStream js;
509 // Restrict the report to only helper0 and it's nested functions.
510 report.PrintJSON(&js, script, helper.token_pos(), helper.end_token_pos());
511 const char* json_str = js.ToCString();
512 ASSERT(strlen(json_str) < kBufferSize);
513 ElideJSONSubstring("classes", json_str, buffer);
514 ElideJSONSubstring("libraries", buffer, buffer);
515
516 EXPECT_STREQ(
517 "{\"type\":\"SourceReport\",\"ranges\":["
518
519 // One range compiled with one hit (helper0).
520 "{\"scriptIndex\":0,\"startPos\":0,\"endPos\":73,\"compiled\":true,"
521 "\"coverage\":{\"hits\":[0,56],\"misses\":[]}},"
522
523 // Nested range compiled (nestedHelper0).
524 "{\"scriptIndex\":0,\"startPos\":14,\"endPos\":31,\"compiled\":true,"
525 "\"coverage\":{\"hits\":[14],\"misses\":[]}},"
526
527 // Nested range not compiled (nestedHelper1).
528 "{\"scriptIndex\":0,\"startPos\":35,\"endPos\":52,\"compiled\":false}],"
529
530 // Only one script in the script table.
531 "\"scripts\":[{\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\","
532 "\"uri\":\"file:\\/\\/\\/test-lib\",\"_kind\":\"kernel\"}]}",
533 buffer);
534}

◆ ISOLATE_UNIT_TEST_CASE() [359/463]

dart::ISOLATE_UNIT_TEST_CASE ( SourceReport_Coverage_SimpleCall  )

Definition at line 127 of file source_report_test.cc.

127 {
128 // WARNING: This MUST be big enough for the serialized JSON string.
129 const int kBufferSize = 1024;
130 char buffer[kBufferSize];
131 const char* kScript =
132 "helper0() {}\n"
133 "helper1() {}\n"
134 "main() {\n"
135 " if (true) {\n"
136 " helper0();\n"
137 " } else {\n"
138 " helper1();\n"
139 " }\n"
140 "}";
141
142 Library& lib = Library::Handle();
143 lib ^= ExecuteScript(kScript);
144 ASSERT(!lib.IsNull());
145 const Script& script =
146 Script::Handle(lib.LookupScript(String::Handle(String::New("test-lib"))));
147
148 SourceReport report(SourceReport::kCoverage);
149 JSONStream js;
150 report.PrintJSON(&js, script);
151 const char* json_str = js.ToCString();
152 ASSERT(strlen(json_str) < kBufferSize);
153 ElideJSONSubstring("classes", json_str, buffer);
154 ElideJSONSubstring("libraries", buffer, buffer);
155 EXPECT_STREQ(
156 "{\"type\":\"SourceReport\",\"ranges\":["
157
158 // One range compiled with one hit at function declaration (helper0).
159 "{\"scriptIndex\":0,\"startPos\":0,\"endPos\":11,\"compiled\":true,"
160 "\"coverage\":{\"hits\":[0],\"misses\":[]}},"
161
162 // One range not compiled (helper1).
163 "{\"scriptIndex\":0,\"startPos\":13,\"endPos\":24,\"compiled\":false},"
164
165 // One range with two hits and a miss (main).
166 "{\"scriptIndex\":0,\"startPos\":26,\"endPos\":94,\"compiled\":true,"
167 "\"coverage\":{\"hits\":[26,53],\"misses\":[79]}}],"
168
169 // Only one script in the script table.
170 "\"scripts\":[{\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\","
171 "\"uri\":\"file:\\/\\/\\/test-lib\",\"_kind\":\"kernel\"}]}",
172 buffer);
173}

◆ ISOLATE_UNIT_TEST_CASE() [360/463]

dart::ISOLATE_UNIT_TEST_CASE ( SourceReport_Coverage_UnusedClass_ForceCompile  )

Definition at line 271 of file source_report_test.cc.

271 {
272 // WARNING: This MUST be big enough for the serialized JSON string.
273 const int kBufferSize = 1024;
274 char buffer[kBufferSize];
275 const char* kScript =
276 "helper0() {}\n"
277 "class Unused {\n"
278 " helper1() { helper0(); }\n"
279 "}\n"
280 "main() {\n"
281 " helper0();\n"
282 "}";
283
284 Library& lib = Library::Handle();
285 lib ^= ExecuteScript(kScript);
286 ASSERT(!lib.IsNull());
287 const Script& script =
288 Script::Handle(lib.LookupScript(String::Handle(String::New("test-lib"))));
289
290 SourceReport report(SourceReport::kCoverage, SourceReport::kForceCompile);
291 JSONStream js;
292 report.PrintJSON(&js, script);
293 const char* json_str = js.ToCString();
294 ASSERT(strlen(json_str) < kBufferSize);
295 ElideJSONSubstring("classes", json_str, buffer);
296 ElideJSONSubstring("libraries", buffer, buffer);
297 EXPECT_STREQ(
298 "{\"type\":\"SourceReport\",\"ranges\":["
299
300 // UnusedClass.helper1 is compiled.
301 "{\"scriptIndex\":0,\"startPos\":30,\"endPos\":53,\"compiled\":true,"
302 "\"coverage\":{\"hits\":[],\"misses\":[30,42]}},"
303
304 // helper0 is compiled.
305 "{\"scriptIndex\":0,\"startPos\":0,\"endPos\":11,\"compiled\":true,"
306 "\"coverage\":{\"hits\":[0],\"misses\":[]}},"
307
308 // One range with two hits (main).
309 "{\"scriptIndex\":0,\"startPos\":57,\"endPos\":79,\"compiled\":true,"
310 "\"coverage\":{\"hits\":[57,68],\"misses\":[]}}],"
311
312 // Only one script in the script table.
313 "\"scripts\":[{\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\","
314 "\"uri\":\"file:\\/\\/\\/test-lib\",\"_kind\":\"kernel\"}]}",
315 buffer);
316}

◆ ISOLATE_UNIT_TEST_CASE() [361/463]

dart::ISOLATE_UNIT_TEST_CASE ( SourceReport_Coverage_UnusedClass_ForceCompileError  )

Definition at line 318 of file source_report_test.cc.

318 {
319 // WARNING: This MUST be big enough for the serialized JSON string.
320 const int kBufferSize = 1024;
321 char buffer[kBufferSize];
322 const char* kScript =
323 "helper0() {}\n"
324 "class Unused {\n"
325 " helper1() { helper0()+ }\n" // syntax error
326 "}\n"
327 "main() {\n"
328 " helper0();\n"
329 "}";
330
331 Library& lib = Library::Handle();
332 lib ^= ExecuteScript(kScript, true);
333 ASSERT(!lib.IsNull());
334 const Script& script =
335 Script::Handle(lib.LookupScript(String::Handle(String::New("test-lib"))));
336
337 SourceReport report(SourceReport::kCoverage, SourceReport::kForceCompile);
338 JSONStream js;
339 report.PrintJSON(&js, script);
340 const char* json_str = js.ToCString();
341 ASSERT(strlen(json_str) < kBufferSize);
342 ElideJSONSubstring("classes", json_str, buffer);
343 ElideJSONSubstring("libraries", buffer, buffer);
344 EXPECT_STREQ(
345 "{\"type\":\"SourceReport\",\"ranges\":["
346
347 // UnusedClass has a syntax error.
348 "{\"scriptIndex\":0,\"startPos\":30,\"endPos\":53,\"compiled\":false,"
349 "\"error\":{\"type\":\"@Error\",\"_vmType\":\"LanguageError\","
350 "\"kind\":\"LanguageError\",\"id\":\"objects\\/0\","
351 "\"message\":\"'file:\\/\\/\\/test-lib': error: "
352 "\\/test-lib:3:26: "
353 "Error: This couldn't be parsed.\\n"
354 " helper1() { helper0()+ }\\n ^\"}},"
355
356 // helper0 is compiled.
357 "{\"scriptIndex\":0,\"startPos\":0,\"endPos\":11,\"compiled\":true,"
358 "\"coverage\":{\"hits\":[0],\"misses\":[]}},"
359
360 // One range with two hits (main).
361 "{\"scriptIndex\":0,\"startPos\":57,\"endPos\":79,\"compiled\":true,"
362 "\"coverage\":{\"hits\":[57,68],\"misses\":[]}}],"
363
364 // Only one script in the script table.
365 "\"scripts\":[{\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\","
366 "\"uri\":\"file:\\/\\/\\/test-lib\",\"_kind\":\"kernel\"}]}",
367 buffer);
368}

◆ ISOLATE_UNIT_TEST_CASE() [362/463]

dart::ISOLATE_UNIT_TEST_CASE ( SourceReport_Coverage_UnusedClass_NoForceCompile  )

Definition at line 225 of file source_report_test.cc.

225 {
226 // WARNING: This MUST be big enough for the serialized JSON string.
227 const int kBufferSize = 1024;
228 char buffer[kBufferSize];
229 const char* kScript =
230 "helper0() {}\n"
231 "class Unused {\n"
232 " helper1() { helper0(); }\n"
233 "}\n"
234 "main() {\n"
235 " helper0();\n"
236 "}";
237
238 Library& lib = Library::Handle();
239 lib ^= ExecuteScript(kScript);
240 ASSERT(!lib.IsNull());
241 const Script& script =
242 Script::Handle(lib.LookupScript(String::Handle(String::New("test-lib"))));
243
244 SourceReport report(SourceReport::kCoverage);
245 JSONStream js;
246 report.PrintJSON(&js, script);
247 const char* json_str = js.ToCString();
248 ASSERT(strlen(json_str) < kBufferSize);
249 ElideJSONSubstring("classes", json_str, buffer);
250 ElideJSONSubstring("libraries", buffer, buffer);
251 EXPECT_STREQ(
252 "{\"type\":\"SourceReport\",\"ranges\":["
253
254 // UnusedClass is not compiled.
255 "{\"scriptIndex\":0,\"startPos\":13,\"endPos\":55,\"compiled\":false},"
256
257 // helper0 is compiled.
258 "{\"scriptIndex\":0,\"startPos\":0,\"endPos\":11,\"compiled\":true,"
259 "\"coverage\":{\"hits\":[0],\"misses\":[]}},"
260
261 // One range with two hits (main).
262 "{\"scriptIndex\":0,\"startPos\":57,\"endPos\":79,\"compiled\":true,"
263 "\"coverage\":{\"hits\":[57,68],\"misses\":[]}}],"
264
265 // Only one script in the script table.
266 "\"scripts\":[{\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\","
267 "\"uri\":\"file:\\/\\/\\/test-lib\",\"_kind\":\"kernel\"}]}",
268 buffer);
269}

◆ ISOLATE_UNIT_TEST_CASE() [363/463]

dart::ISOLATE_UNIT_TEST_CASE ( SourceReport_MultipleReports  )

Definition at line 794 of file source_report_test.cc.

794 {
795 // WARNING: This MUST be big enough for the serialized JSON string.
796 const int kBufferSize = 2048;
797 char buffer[kBufferSize];
798 const char* kScript =
799 "helper0() {}\n"
800 "helper1() {}\n"
801 "main() {\n"
802 " helper0();\n"
803 "}";
804
805 Library& lib = Library::Handle();
806 lib ^= ExecuteScript(kScript);
807 ASSERT(!lib.IsNull());
808 const Script& script =
809 Script::Handle(lib.LookupScript(String::Handle(String::New("test-lib"))));
810
811 SourceReport report(SourceReport::kCallSites | SourceReport::kCoverage);
812 JSONStream js;
813 report.PrintJSON(&js, script);
814 const char* json_str = js.ToCString();
815 ASSERT(strlen(json_str) < kBufferSize);
816 ElideJSONSubstring("classes", json_str, buffer);
817 ElideJSONSubstring("libraries", buffer, buffer);
818 EXPECT_STREQ(
819 "{\"type\":\"SourceReport\",\"ranges\":["
820
821 // One range compiled with no callsites (helper0).
822 "{\"scriptIndex\":0,\"startPos\":0,\"endPos\":11,\"compiled\":true,"
823 "\"callSites\":[],"
824 "\"coverage\":{\"hits\":[0],\"misses\":[]}},"
825
826 // One range not compiled (helper1).
827 "{\"scriptIndex\":0,\"startPos\":13,\"endPos\":24,\"compiled\":false},"
828
829 // One range compiled with one callsite (main)m
830 "{\"scriptIndex\":0,\"startPos\":26,\"endPos\":48,\"compiled\":true,"
831 "\"callSites\":[{\"name\":\"helper0\",\"tokenPos\":37,\"cacheEntries\":[{"
832 "\"target\":{\"type\":\"@Function\",\"fixedId\":true,\"id\":\"\","
833 "\"name\":\"helper0\",\"owner\":{\"type\":\"@Library\",\"fixedId\":true,"
834 "\"id\":\"\",\"name\":\"\",\"uri\":\"file:\\/\\/\\/test-lib\"},\"_"
835 "kind\":\"RegularFunction\",\"static\":true,\"const\":false,\"implicit\":"
836 "false,\"abstract\":false,\"_"
837 "intrinsic\":false,\"_native\":false,\"isGetter\":false,"
838 "\"isSetter\":false,\"location\":{\"type\":"
839 "\"SourceLocation\",\"script\":{\"type\":\"@Script\",\"fixedId\":true,"
840 "\"id\":\"\",\"uri\":\"file:\\/\\/\\/test-lib\",\"_kind\":\"kernel\"},"
841 "\"tokenPos\":0,\"endTokenPos\":11,\"line\":1,\"column\":1}},\"count\":1}"
842 "]}],\"coverage\":{"
843 "\"hits\":[26,37],\"misses\":[]}}],"
844
845 // One script in the script table.
846 "\"scripts\":[{\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\","
847 "\"uri\":\"file:\\/\\/\\/test-lib\",\"_kind\":\"kernel\"}]}",
848 buffer);
849}

◆ ISOLATE_UNIT_TEST_CASE() [364/463]

dart::ISOLATE_UNIT_TEST_CASE ( SourceReport_PossibleBreakpoints_Simple  )

Definition at line 851 of file source_report_test.cc.

851 {
852 // WARNING: This MUST be big enough for the serialized JSON string.
853 const int kBufferSize = 1024;
854 char buffer[kBufferSize];
855 const char* kScript =
856 "helper0() {}\n"
857 "helper1() {}\n"
858 "main() {\n"
859 " if (true) {\n"
860 " helper0();\n"
861 " } else {\n"
862 " helper1();\n"
863 " }\n"
864 "}";
865
866 Library& lib = Library::Handle();
867 lib ^= ExecuteScript(kScript);
868 ASSERT(!lib.IsNull());
869 const Script& script =
870 Script::Handle(lib.LookupScript(String::Handle(String::New("test-lib"))));
871
872 SourceReport report(SourceReport::kPossibleBreakpoints);
873 JSONStream js;
874 report.PrintJSON(&js, script);
875 const char* json_str = js.ToCString();
876 ASSERT(strlen(json_str) < kBufferSize);
877 ElideJSONSubstring("classes", json_str, buffer);
878 ElideJSONSubstring("libraries", buffer, buffer);
879 EXPECT_STREQ(
880 "{\"type\":\"SourceReport\",\"ranges\":["
881
882 // helper0.
883 "{\"scriptIndex\":0,\"startPos\":0,\"endPos\":11,\"compiled\":true,"
884 "\"possibleBreakpoints\":[7,11]},"
885
886 // One range not compiled (helper1).
887 "{\"scriptIndex\":0,\"startPos\":13,\"endPos\":24,\"compiled\":false},"
888
889 // main.
890 "{\"scriptIndex\":0,\"startPos\":26,\"endPos\":94,\"compiled\":true,"
891 "\"possibleBreakpoints\":[30,53,79,94]}],"
892
893 // Only one script in the script table.
894 "\"scripts\":[{\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\","
895 "\"uri\":\"file:\\/\\/\\/test-lib\",\"_kind\":\"kernel\"}]}",
896 buffer);
897}

◆ ISOLATE_UNIT_TEST_CASE() [365/463]

dart::ISOLATE_UNIT_TEST_CASE ( SourceReport_Regress53519_Destructuring  )

Definition at line 1295 of file source_report_test.cc.

1295 {
1296 // WARNING: This MUST be big enough for the serialized JSON string.
1297 const int kBufferSize = 1024;
1298 char buffer[kBufferSize];
1299 const char* kScript = R"(
1300main() {
1301 destructure({
1302 'hello': 'world',
1303 'count': [1, 2, 3],
1304 });
1305}
1306
1307String destructure(Map<String, dynamic> map) {
1308 final {'hello': world, 'count': count} = map;
1309 return 'Hello $world, count: $count';
1310}
1311)";
1312
1313 Library& lib = Library::Handle();
1314 lib ^= ExecuteScript(kScript);
1315 ASSERT(!lib.IsNull());
1316 const Script& script =
1317 Script::Handle(lib.LookupScript(String::Handle(String::New("test-lib"))));
1318
1319 SourceReport report(SourceReport::kCoverage);
1320 JSONStream js;
1321 report.PrintJSON(&js, script);
1322 const char* json_str = js.ToCString();
1323 ASSERT(strlen(json_str) < kBufferSize);
1324 ElideJSONSubstring("classes", json_str, buffer);
1325 ElideJSONSubstring("libraries", buffer, buffer);
1326 EXPECT_STREQ(
1327 "{\"type\":\"SourceReport\",\"ranges\":["
1328
1329 // main
1330 "{\"scriptIndex\":0,\"startPos\":1,\"endPos\":78,\"compiled\":true,"
1331 "\"coverage\":{\"hits\":[1,12,24,61],\"misses\":[]}},"
1332
1333 // destructure
1334 "{\"scriptIndex\":0,\"startPos\":81,\"endPos\":216,\"compiled\":true,"
1335 "\"coverage\":{\"hits\":[81,144,160,214],\"misses\":[]}}],"
1336
1337 // Only one script in the script table.
1338 "\"scripts\":[{\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\","
1339 "\"uri\":\"file:\\/\\/\\/test-lib\",\"_kind\":\"kernel\"}]}",
1340 buffer);
1341}

◆ ISOLATE_UNIT_TEST_CASE() [366/463]

dart::ISOLATE_UNIT_TEST_CASE ( SourceReport_Regress95008_RedirectingFactory  )

Definition at line 1241 of file source_report_test.cc.

1241 {
1242 // WARNING: This MUST be big enough for the serialized JSON string.
1243 const int kBufferSize = 1024;
1244 char buffer[kBufferSize];
1245 const char* kScript = R"(
1246class A {
1247 A();
1248 factory A.foo(int i) = B; // LINE_A
1249}
1250
1251class B extends A {
1252 int i;
1253 B(this.i); // LINE_B
1254}
1255
1256main() {
1257 A.foo(42);
1258}
1259)";
1260
1261 Library& lib = Library::Handle();
1262 lib ^= ExecuteScript(kScript);
1263 ASSERT(!lib.IsNull());
1264 const Script& script =
1265 Script::Handle(lib.LookupScript(String::Handle(String::New("test-lib"))));
1266
1267 SourceReport report(SourceReport::kCoverage);
1268 JSONStream js;
1269 report.PrintJSON(&js, script);
1270 const char* json_str = js.ToCString();
1271 ASSERT(strlen(json_str) < kBufferSize);
1272 ElideJSONSubstring("classes", json_str, buffer);
1273 ElideJSONSubstring("libraries", buffer, buffer);
1274 EXPECT_STREQ(
1275 "{\"type\":\"SourceReport\",\"ranges\":["
1276
1277 // A()
1278 "{\"scriptIndex\":0,\"startPos\":13,\"endPos\":16,\"compiled\":true,"
1279 "\"coverage\":{\"hits\":[13],\"misses\":[]}},"
1280
1281 // B()
1282 "{\"scriptIndex\":0,\"startPos\":90,\"endPos\":99,\"compiled\":true,"
1283 "\"coverage\":{\"hits\":[90],\"misses\":[]}},"
1284
1285 // main
1286 "{\"scriptIndex\":0,\"startPos\":114,\"endPos\":136,\"compiled\":true,"
1287 "\"coverage\":{\"hits\":[114,127],\"misses\":[]}}],"
1288
1289 // Only one script in the script table.
1290 "\"scripts\":[{\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\","
1291 "\"uri\":\"file:\\/\\/\\/test-lib\",\"_kind\":\"kernel\"}]}",
1292 buffer);
1293}

◆ ISOLATE_UNIT_TEST_CASE() [367/463]

dart::ISOLATE_UNIT_TEST_CASE ( SpecialClassesHaveEmptyArrays  )

Definition at line 5823 of file object_test.cc.

5824 {
5825 bool result =
5826 Dart_RunLoopAsync(/*errors_are_fatal=*/true,
5827 /*on_error_port=*/0, /*on_exit_port=*/0, &error);
5828 EXPECT_EQ(true, result);
5829 }
5830 EXPECT_EQ(nullptr, error);
5831 Dart_EnterIsolate(parent);
5832}
5833
5834ISOLATE_UNIT_TEST_CASE(SpecialClassesHaveEmptyArrays) {
5835 ObjectStore* object_store = IsolateGroup::Current()->object_store();
5836 Class& cls = Class::Handle();
5837 Object& array = Object::Handle();
5838
5839 cls = object_store->null_class();
5840 array = cls.fields();
5841 EXPECT(!array.IsNull());
5842 EXPECT(array.IsArray());
5843 array = cls.current_functions();
5844 EXPECT(!array.IsNull());
5845 EXPECT(array.IsArray());
5846
5847 cls = Object::void_class();
5848 array = cls.fields();
5849 EXPECT(!array.IsNull());
5850 EXPECT(array.IsArray());
5851 array = cls.current_functions();

◆ ISOLATE_UNIT_TEST_CASE() [368/463]

dart::ISOLATE_UNIT_TEST_CASE ( StackAllocatedDestruction  )

Definition at line 76 of file allocation_test.cc.

76 {
77 int data = 1;
79 EXPECT_EQ(4, data);
80}
static void StackAllocatedDestructionHelper(int *ptr)

◆ ISOLATE_UNIT_TEST_CASE() [369/463]

dart::ISOLATE_UNIT_TEST_CASE ( StackAllocatedLongJump  )

Definition at line 92 of file allocation_test.cc.

92 {
93 LongJumpScope jump;
94 int data = 1;
95 if (setjmp(*jump.Set()) == 0) {
96 StackAllocatedLongJumpHelper(&data, &jump);
98 } else {
99 ASSERT(Error::Handle(thread->StealStickyError()).IsLanguageError());
100 }
101 EXPECT_EQ(3, data);
102}
static void StackAllocatedLongJumpHelper(int *ptr, LongJumpScope *jump)

◆ ISOLATE_UNIT_TEST_CASE() [370/463]

dart::ISOLATE_UNIT_TEST_CASE ( StackResourceDestruction  )

Definition at line 119 of file allocation_test.cc.

119 {
120 int data = 1;
122 EXPECT_EQ(7, data);
123}
static void StackResourceDestructionHelper(int *ptr)

◆ ISOLATE_UNIT_TEST_CASE() [371/463]

dart::ISOLATE_UNIT_TEST_CASE ( StackResourceLongJump  )

Definition at line 143 of file allocation_test.cc.

143 {
144 LongJumpScope* base = Thread::Current()->long_jump_base();
145 {
146 LongJumpScope jump;
147 int data = 1;
148 if (setjmp(*jump.Set()) == 0) {
149 StackResourceLongJumpHelper(&data, &jump);
150 UNREACHABLE();
151 } else {
152 ASSERT(Error::Handle(thread->StealStickyError()).IsLanguageError());
153 }
154 EXPECT_EQ(7, data);
155 }
156 ASSERT(base == Thread::Current()->long_jump_base());
157}
static void StackResourceLongJumpHelper(int *ptr, LongJumpScope *jump)

◆ ISOLATE_UNIT_TEST_CASE() [372/463]

dart::ISOLATE_UNIT_TEST_CASE ( StreamingFlowGraphBuilder_ConcatStringLits  )

Definition at line 182 of file kernel_binary_flowgraph_test.cc.

182 {
183 // We should drop empty strings from StringInterpolates:
184 const char* kScript = R"(
185 test(s) {
186 return '' 'a' '' 'b' '$s' '' 'c' '' 'd' '';
187 }
188 main() => test('u');
189 )";
190
191 const auto& root_library = Library::Handle(LoadTestScript(kScript));
192 const auto& function = Function::Handle(GetFunction(root_library, "test"));
193
194 Invoke(root_library, "main");
195
196 TestPipeline pipeline(function, CompilerPass::kJIT);
197 FlowGraph* flow_graph = pipeline.RunPasses({
198 CompilerPass::kComputeSSA,
199 });
200
201 auto entry = flow_graph->graph_entry()->normal_entry();
202 EXPECT(entry != nullptr);
203
204 StoreIndexedInstr* store1 = nullptr;
205 StoreIndexedInstr* store2 = nullptr;
206 StoreIndexedInstr* store3 = nullptr;
207
208 ILMatcher cursor(flow_graph, entry);
209 // clang-format off
210 RELEASE_ASSERT(cursor.TryMatch({
211 kMatchAndMoveFunctionEntry,
212 kMatchAndMoveCheckStackOverflow,
213 kMoveDebugStepChecks,
214 kMatchAndMoveCreateArray,
215 {kMatchAndMoveStoreIndexed, &store1},
216 {kMatchAndMoveStoreIndexed, &store2},
217 {kMatchAndMoveStoreIndexed, &store3},
218 kMatchAndMoveStaticCall,
219 kMoveDebugStepChecks,
220 kMatchDartReturn,
221 }));
222 // clang-format on
223
224 // StoreIndexed(tmp_array, 0, "ab")
225 EXPECT(store1->index()->BindsToConstant());
226 EXPECT(store1->index()->BoundConstant().IsInteger());
227 EXPECT(Integer::Cast(store1->index()->BoundConstant()).AsInt64Value() == 0);
228
229 EXPECT(store1->value()->BindsToConstant());
230 EXPECT(store1->value()->BoundConstant().IsString());
231 EXPECT(String::Cast(store1->value()->BoundConstant()).Equals("ab"));
232
233 // StoreIndexed(tmp_array, 1, s)
234 EXPECT(store2->index()->BindsToConstant());
235 EXPECT(store2->index()->BoundConstant().IsInteger());
236 EXPECT(Integer::Cast(store2->index()->BoundConstant()).AsInt64Value() == 1);
237
238 EXPECT(!store2->value()->BindsToConstant());
239
240 // StoreIndexed(tmp_array, 2, "cd")
241 EXPECT(store3->index()->BindsToConstant());
242 EXPECT(store3->index()->BoundConstant().IsInteger());
243 EXPECT(Integer::Cast(store3->index()->BoundConstant()).AsInt64Value() == 2);
244
245 EXPECT(store3->value()->BindsToConstant());
246 EXPECT(store3->value()->BoundConstant().IsString());
247 EXPECT(String::Cast(store3->value()->BoundConstant()).Equals("cd"));
248}

◆ ISOLATE_UNIT_TEST_CASE() [373/463]

dart::ISOLATE_UNIT_TEST_CASE ( StreamingFlowGraphBuilder_ConstFoldStringConcats  )

Definition at line 13 of file kernel_binary_flowgraph_test.cc.

13 {
14 // According to the Dart spec:
15 // "Adjacent strings are implicitly concatenated to form a single string
16 // literal."
17 const char* kScript = R"(
18 test() {
19 var s = 'aaaa'
20 'bbbb'
21 'cccc';
22 return s;
23 }
24 )";
25
26 const auto& root_library = Library::Handle(LoadTestScript(kScript));
27 const auto& function = Function::Handle(GetFunction(root_library, "test"));
28
29 Invoke(root_library, "test");
30
31 TestPipeline pipeline(function, CompilerPass::kJIT);
32 FlowGraph* flow_graph = pipeline.RunPasses({
33 CompilerPass::kComputeSSA,
34 });
35
36 auto entry = flow_graph->graph_entry()->normal_entry();
37 EXPECT(entry != nullptr);
38
39 DartReturnInstr* ret = nullptr;
40
41 ILMatcher cursor(flow_graph, entry);
42 // clang-format off
43 RELEASE_ASSERT(cursor.TryMatch({
44 kMatchAndMoveFunctionEntry,
45 kMatchAndMoveCheckStackOverflow,
46 kMoveDebugStepChecks,
47 {kMatchDartReturn, &ret},
48 }));
49 // clang-format on
50
51 EXPECT(ret->value()->BindsToConstant());
52 EXPECT(ret->value()->BoundConstant().IsString());
53 const String& ret_str = String::Cast(ret->value()->BoundConstant());
54 EXPECT(ret_str.Equals("aaaabbbbcccc"));
55}

◆ ISOLATE_UNIT_TEST_CASE() [374/463]

dart::ISOLATE_UNIT_TEST_CASE ( StreamingFlowGraphBuilder_DropEmptyStringInterp  )

Definition at line 114 of file kernel_binary_flowgraph_test.cc.

114 {
115 // We should drop empty strings from StringInterpolates:
116 const char* kScript = R"(
117 test(s) {
118 return '' 'a' '$s' '' 'b' '';
119 }
120 main() => test('u');
121 )";
122
123 const auto& root_library = Library::Handle(LoadTestScript(kScript));
124 const auto& function = Function::Handle(GetFunction(root_library, "test"));
125
126 Invoke(root_library, "main");
127
128 TestPipeline pipeline(function, CompilerPass::kJIT);
129 FlowGraph* flow_graph = pipeline.RunPasses({
130 CompilerPass::kComputeSSA,
131 });
132
133 auto entry = flow_graph->graph_entry()->normal_entry();
134 EXPECT(entry != nullptr);
135
136 StoreIndexedInstr* store1 = nullptr;
137 StoreIndexedInstr* store2 = nullptr;
138 StoreIndexedInstr* store3 = nullptr;
139
140 ILMatcher cursor(flow_graph, entry);
141 // clang-format off
142 RELEASE_ASSERT(cursor.TryMatch({
143 kMatchAndMoveFunctionEntry,
144 kMatchAndMoveCheckStackOverflow,
145 kMoveDebugStepChecks,
146 kMatchAndMoveCreateArray,
147 {kMatchAndMoveStoreIndexed, &store1},
148 {kMatchAndMoveStoreIndexed, &store2},
149 {kMatchAndMoveStoreIndexed, &store3},
150 kMatchAndMoveStaticCall,
151 kMoveDebugStepChecks,
152 kMatchDartReturn,
153 }));
154 // clang-format on
155
156 // StoreIndexed(tmp_array, 0, "ab")
157 EXPECT(store1->index()->BindsToConstant());
158 EXPECT(store1->index()->BoundConstant().IsInteger());
159 EXPECT(Integer::Cast(store1->index()->BoundConstant()).AsInt64Value() == 0);
160
161 EXPECT(store1->value()->BindsToConstant());
162 EXPECT(store1->value()->BoundConstant().IsString());
163 EXPECT(String::Cast(store1->value()->BoundConstant()).Equals("a"));
164
165 // StoreIndexed(tmp_array, 1, s)
166 EXPECT(store2->index()->BindsToConstant());
167 EXPECT(store2->index()->BoundConstant().IsInteger());
168 EXPECT(Integer::Cast(store2->index()->BoundConstant()).AsInt64Value() == 1);
169
170 EXPECT(!store2->value()->BindsToConstant());
171
172 // StoreIndexed(tmp_array, 2, "b")
173 EXPECT(store3->index()->BindsToConstant());
174 EXPECT(store3->index()->BoundConstant().IsInteger());
175 EXPECT(Integer::Cast(store3->index()->BoundConstant()).AsInt64Value() == 2);
176
177 EXPECT(store3->value()->BindsToConstant());
178 EXPECT(store3->value()->BoundConstant().IsString());
179 EXPECT(String::Cast(store3->value()->BoundConstant()).Equals("b"));
180}

◆ ISOLATE_UNIT_TEST_CASE() [375/463]

dart::ISOLATE_UNIT_TEST_CASE ( StreamingFlowGraphBuilder_FlattenNestedStringInterp  )

Definition at line 57 of file kernel_binary_flowgraph_test.cc.

57 {
58 // We should collapse nested StringInterpolates:
59 const char* kScript = R"(
60 test(String s) {
61 return '$s' '${'d' 'e'}';
62 }
63 main() => test('u');
64 )";
65
66 const auto& root_library = Library::Handle(LoadTestScript(kScript));
67 const auto& function = Function::Handle(GetFunction(root_library, "test"));
68
69 Invoke(root_library, "main");
70
71 TestPipeline pipeline(function, CompilerPass::kJIT);
72 FlowGraph* flow_graph = pipeline.RunPasses({
73 CompilerPass::kComputeSSA,
74 });
75
76 auto entry = flow_graph->graph_entry()->normal_entry();
77 EXPECT(entry != nullptr);
78
79 StoreIndexedInstr* store1 = nullptr;
80 StoreIndexedInstr* store2 = nullptr;
81
82 ILMatcher cursor(flow_graph, entry);
83 // clang-format off
84 RELEASE_ASSERT(cursor.TryMatch({
85 kMatchAndMoveFunctionEntry,
86 kMatchAndMoveCheckStackOverflow,
87 kMoveDebugStepChecks,
88 kMatchAndMoveCreateArray,
89 {kMatchAndMoveStoreIndexed, &store1},
90 {kMatchAndMoveStoreIndexed, &store2},
91 kMatchAndMoveStaticCall,
92 kMoveDebugStepChecks,
93 kMatchDartReturn,
94 }));
95 // clang-format on
96
97 // StoreIndexed(tmp_array, 0, s)
98 EXPECT(store1->index()->BindsToConstant());
99 EXPECT(store1->index()->BoundConstant().IsInteger());
100 EXPECT(Integer::Cast(store1->index()->BoundConstant()).AsInt64Value() == 0);
101
102 EXPECT(!store1->value()->BindsToConstant());
103
104 // StoreIndexed(tmp_array, 1, "de")
105 EXPECT(store2->index()->BindsToConstant());
106 EXPECT(store2->index()->BoundConstant().IsInteger());
107 EXPECT(Integer::Cast(store2->index()->BoundConstant()).AsInt64Value() == 1);
108
109 EXPECT(store2->value()->BindsToConstant());
110 EXPECT(store2->value()->BoundConstant().IsString());
111 EXPECT(String::Cast(store2->value()->BoundConstant()).Equals("de"));
112}

◆ ISOLATE_UNIT_TEST_CASE() [376/463]

dart::ISOLATE_UNIT_TEST_CASE ( StreamingFlowGraphBuilder_InvariantFlagInListLiterals  )

Definition at line 250 of file kernel_binary_flowgraph_test.cc.

250 {
251 const char* kScript = R"(
252 test() {
253 return [...[], 42];
254 }
255 )";
256
257 const auto& root_library = Library::Handle(LoadTestScript(kScript));
258 const auto& function = Function::Handle(GetFunction(root_library, "test"));
259
260 Invoke(root_library, "test");
261
262 TestPipeline pipeline(function, CompilerPass::kJIT);
263 FlowGraph* flow_graph = pipeline.RunPasses({
264 CompilerPass::kComputeSSA,
265 });
266
267 auto entry = flow_graph->graph_entry()->normal_entry();
268 EXPECT(entry != nullptr);
269
270 InstanceCallInstr* call_add = nullptr;
271
272 ILMatcher cursor(flow_graph, entry);
273 // clang-format off
274 RELEASE_ASSERT(cursor.TryMatch({
275 kMatchAndMoveFunctionEntry,
276 kMatchAndMoveCheckStackOverflow,
277 kMoveDebugStepChecks,
278 kMatchAndMoveStaticCall,
279 kMatchAndMoveStaticCall,
280 {kMatchAndMoveInstanceCall, &call_add},
281 kMoveDebugStepChecks,
282 kMatchDartReturn,
283 }));
284 // clang-format on
285
286 EXPECT(call_add != nullptr);
287 EXPECT(call_add->function_name().Equals("add"));
288 EXPECT(call_add->entry_kind() == Code::EntryKind::kUnchecked);
289}

◆ ISOLATE_UNIT_TEST_CASE() [377/463]

dart::ISOLATE_UNIT_TEST_CASE ( StreamingFlowGraphBuilder_StaticGetFinalFieldWithTrivialInitializer  )

Definition at line 347 of file kernel_binary_flowgraph_test.cc.

348 {
349 const char* kScript = R"(
350 final int x = 0xFEEDFEED;
351 test() {
352 return x;
353 }
354 )";
355
356 const auto& root_library = Library::Handle(LoadTestScript(kScript));
357 const auto& function = Function::Handle(GetFunction(root_library, "test"));
358
359 Invoke(root_library, "test");
360
361 TestPipeline pipeline(function, CompilerPass::kJIT);
362 FlowGraph* flow_graph = pipeline.RunPasses({
363 CompilerPass::kComputeSSA,
364 });
365
366 auto entry = flow_graph->graph_entry()->normal_entry();
367 EXPECT(entry != nullptr);
368
369 DartReturnInstr* return_instr = nullptr;
370
371 ILMatcher cursor(flow_graph, entry);
372 RELEASE_ASSERT(cursor.TryMatch({
373 kMatchAndMoveFunctionEntry,
374 kMatchAndMoveCheckStackOverflow,
375 kMoveDebugStepChecks,
376 {kMatchDartReturn, &return_instr},
377 }));
378
379 EXPECT(return_instr != nullptr);
380 ConstantInstr* const_value =
381 return_instr->value()->definition()->AsConstant();
382 EXPECT(const_value != nullptr);
383 EXPECT(const_value->value().IsInteger());
384 EXPECT_EQ(0xFEEDFEED, Integer::Cast(const_value->value()).AsInt64Value());
385}

◆ ISOLATE_UNIT_TEST_CASE() [378/463]

dart::ISOLATE_UNIT_TEST_CASE ( StreamingFlowGraphBuilder_TypedClosureCall  )

Definition at line 291 of file kernel_binary_flowgraph_test.cc.

291 {
292 // This test ensures that a typed closure call (i.e. the closure being called
293 // has a real function type as static type) ends up compiling to
294 //
295 // CheckNull()+ClosureCall()
296 //
297 // instead of
298 //
299 // InstanceCall(dyn:call)
300 //
301 // This is a regression test for a case where JIT support uses dynamic calls
302 // instead of typed closure calls if call-site attribute metadata is missing
303 // which is the case if an incremental kernel compiler is used. The
304 // [LoadTestScript] below uses IKG compiler, so this is a regression test for:
305 //
306 // - https://github.com/dart-lang/sdk/issues/46320
307 // - https://github.com/dart-lang/sdk/issues/45421
308 //
309 const char* kScript = R"(
310 int callClosure(int Function(int) fun, int value) => fun(value);
311 test() => callClosure((int a) => a + 1, 10);
312 )";
313
314 const auto& root_library = Library::Handle(LoadTestScript(kScript));
315 Invoke(root_library, "test");
316
317 const auto& callClosureFunction =
318 Function::Handle(GetFunction(root_library, "callClosure"));
319 TestPipeline pipeline(callClosureFunction, CompilerPass::kJIT);
320 FlowGraph* flow_graph = pipeline.RunPasses({
321 CompilerPass::kComputeSSA,
322 });
323
324 auto entry = flow_graph->graph_entry()->normal_entry();
325 EXPECT(entry != nullptr);
326
327 ILMatcher cursor(flow_graph, entry, true);
328 // clang-format off
329 std::initializer_list<MatchCode> expected = {
330 kMatchAndMoveFunctionEntry,
331 kMatchAndMoveCheckStackOverflow,
332 kMoveDebugStepChecks,
333 kMatchAndMoveCheckNull,
334 kMatchAndMoveLoadField,
335 kMoveDebugStepChecks,
336#if !defined(PRODUCT)
337 kMatchAndMoveRecordCoverage,
338#endif
339 kMatchAndMoveClosureCall,
340 kMoveDebugStepChecks,
341 kMatchDartReturn,
342 };
343 RELEASE_ASSERT(cursor.TryMatch(expected));
344 // clang-format on
345}

◆ ISOLATE_UNIT_TEST_CASE() [379/463]

dart::ISOLATE_UNIT_TEST_CASE ( StressMallocThroughZones  )

Definition at line 239 of file zone_test.cc.

239 {
240#if defined(CHECK_RSS)
241 int64_t start_rss = Service::CurrentRSS();
242#endif
243
244 for (size_t i = 0; i < ((3u * GB) / (512u * KB)); i++) {
245 StackZone stack_zone(Thread::Current());
246 Zone* zone = stack_zone.GetZone();
247 for (size_t j = 0; j < ARRAY_SIZE(kSizes); j++) {
248 zone->Alloc<uint8_t>(kSizes[j]);
249 }
250 }
251
252#if defined(CHECK_RSS)
253 int64_t stop_rss = Service::CurrentRSS();
254 EXPECT_LT(stop_rss, start_rss + kRssSlack);
255#endif
256}
constexpr intptr_t GB
Definition globals.h:532
static const size_t kSizes[]
Definition zone_test.cc:202

◆ ISOLATE_UNIT_TEST_CASE() [380/463]

dart::ISOLATE_UNIT_TEST_CASE ( String  )

Definition at line 676 of file object_test.cc.

676 {
677 const char* kHello = "Hello World!";
678 int32_t hello_len = strlen(kHello);
679 const String& str = String::Handle(String::New(kHello));
680 EXPECT(str.IsInstance());
681 EXPECT(str.IsString());
682 EXPECT(str.IsOneByteString());
683 EXPECT(!str.IsTwoByteString());
684 EXPECT(!str.IsNumber());
685 EXPECT_EQ(hello_len, str.Length());
686 EXPECT_EQ('H', str.CharAt(0));
687 EXPECT_EQ('e', str.CharAt(1));
688 EXPECT_EQ('l', str.CharAt(2));
689 EXPECT_EQ('l', str.CharAt(3));
690 EXPECT_EQ('o', str.CharAt(4));
691 EXPECT_EQ(' ', str.CharAt(5));
692 EXPECT_EQ('W', str.CharAt(6));
693 EXPECT_EQ('o', str.CharAt(7));
694 EXPECT_EQ('r', str.CharAt(8));
695 EXPECT_EQ('l', str.CharAt(9));
696 EXPECT_EQ('d', str.CharAt(10));
697 EXPECT_EQ('!', str.CharAt(11));
698
699 const uint8_t* motto =
700 reinterpret_cast<const uint8_t*>("Dart's bescht wos je hets gits");
701 const String& str2 = String::Handle(String::FromUTF8(motto + 7, 4));
702 EXPECT_EQ(4, str2.Length());
703 EXPECT_EQ('b', str2.CharAt(0));
704 EXPECT_EQ('e', str2.CharAt(1));
705 EXPECT_EQ('s', str2.CharAt(2));
706 EXPECT_EQ('c', str2.CharAt(3));
707
708 const String& str3 = String::Handle(String::New(kHello));
709 EXPECT(str.Equals(str));
710 EXPECT_EQ(str.Hash(), str.Hash());
711 EXPECT(!str.Equals(str2));
712 EXPECT(str.Equals(str3));
713 EXPECT_EQ(str.Hash(), str3.Hash());
714 EXPECT(str3.Equals(str));
715
716 const String& str4 = String::Handle(String::New("foo"));
717 const String& str5 = String::Handle(String::New("bar"));
718 const String& str6 = String::Handle(String::Concat(str4, str5));
719 const String& str7 = String::Handle(String::New("foobar"));
720 EXPECT(str6.Equals(str7));
721 EXPECT(!str6.Equals(Smi::Handle(Smi::New(4))));
722
723 const String& empty1 = String::Handle(String::New(""));
724 const String& empty2 = String::Handle(String::New(""));
725 EXPECT(empty1.Equals(empty2, 0, 0));
726
727 const intptr_t kCharsLen = 8;
728 const uint8_t chars[kCharsLen] = {1, 2, 127, 64, 92, 0, 55, 55};
729 const String& str8 = String::Handle(String::FromUTF8(chars, kCharsLen));
730 EXPECT_EQ(kCharsLen, str8.Length());
731 EXPECT_EQ(1, str8.CharAt(0));
732 EXPECT_EQ(127, str8.CharAt(2));
733 EXPECT_EQ(64, str8.CharAt(3));
734 EXPECT_EQ(0, str8.CharAt(5));
735 EXPECT_EQ(55, str8.CharAt(6));
736 EXPECT_EQ(55, str8.CharAt(7));
737 const intptr_t kCharsIndex = 3;
738 const String& sub1 = String::Handle(String::SubString(str8, kCharsIndex));
739 EXPECT_EQ((kCharsLen - kCharsIndex), sub1.Length());
740 EXPECT_EQ(64, sub1.CharAt(0));
741 EXPECT_EQ(92, sub1.CharAt(1));
742 EXPECT_EQ(0, sub1.CharAt(2));
743 EXPECT_EQ(55, sub1.CharAt(3));
744 EXPECT_EQ(55, sub1.CharAt(4));
745
746 const intptr_t kWideCharsLen = 7;
747 uint16_t wide_chars[kWideCharsLen] = {'H', 'e', 'l', 'l', 'o', 256, '!'};
748 const String& two_str =
749 String::Handle(String::FromUTF16(wide_chars, kWideCharsLen));
750 EXPECT(two_str.IsInstance());
751 EXPECT(two_str.IsString());
752 EXPECT(two_str.IsTwoByteString());
753 EXPECT(!two_str.IsOneByteString());
754 EXPECT_EQ(kWideCharsLen, two_str.Length());
755 EXPECT_EQ('H', two_str.CharAt(0));
756 EXPECT_EQ(256, two_str.CharAt(5));
757 const intptr_t kWideCharsIndex = 3;
758 const String& sub2 = String::Handle(String::SubString(two_str, kCharsIndex));
759 EXPECT_EQ((kWideCharsLen - kWideCharsIndex), sub2.Length());
760 EXPECT_EQ('l', sub2.CharAt(0));
761 EXPECT_EQ('o', sub2.CharAt(1));
762 EXPECT_EQ(256, sub2.CharAt(2));
763 EXPECT_EQ('!', sub2.CharAt(3));
764
765 {
766 const String& str1 = String::Handle(String::New("My.create"));
767 const String& str2 = String::Handle(String::New("My"));
768 const String& str3 = String::Handle(String::New("create"));
769 EXPECT_EQ(true, str1.StartsWith(str2));
770 EXPECT_EQ(false, str1.StartsWith(str3));
771 }
772
773 const int32_t four_chars[] = {'C', 0xFF, 'h', 0xFFFF, 'a', 0x10FFFF, 'r'};
774 const String& four_str = String::Handle(String::FromUTF32(four_chars, 7));
775 EXPECT_EQ(four_str.Hash(), four_str.Hash());
776 EXPECT(four_str.IsTwoByteString());
777 EXPECT(!four_str.IsOneByteString());
778 EXPECT_EQ(8, four_str.Length());
779 EXPECT_EQ('C', four_str.CharAt(0));
780 EXPECT_EQ(0xFF, four_str.CharAt(1));
781 EXPECT_EQ('h', four_str.CharAt(2));
782 EXPECT_EQ(0xFFFF, four_str.CharAt(3));
783 EXPECT_EQ('a', four_str.CharAt(4));
784 EXPECT_EQ(0xDBFF, four_str.CharAt(5));
785 EXPECT_EQ(0xDFFF, four_str.CharAt(6));
786 EXPECT_EQ('r', four_str.CharAt(7));
787
788 // Create a 1-byte string from an array of 2-byte elements.
789 {
790 const uint16_t char16[] = {0x00, 0x7F, 0xFF};
791 const String& str8 = String::Handle(String::FromUTF16(char16, 3));
792 EXPECT(str8.IsOneByteString());
793 EXPECT(!str8.IsTwoByteString());
794 EXPECT_EQ(0x00, str8.CharAt(0));
795 EXPECT_EQ(0x7F, str8.CharAt(1));
796 EXPECT_EQ(0xFF, str8.CharAt(2));
797 }
798
799 // Create a 1-byte string from an array of 4-byte elements.
800 {
801 const int32_t char32[] = {0x00, 0x1F, 0x7F};
802 const String& str8 = String::Handle(String::FromUTF32(char32, 3));
803 EXPECT(str8.IsOneByteString());
804 EXPECT(!str8.IsTwoByteString());
805 EXPECT_EQ(0x00, str8.CharAt(0));
806 EXPECT_EQ(0x1F, str8.CharAt(1));
807 EXPECT_EQ(0x7F, str8.CharAt(2));
808 }
809
810 // Create a 2-byte string from an array of 4-byte elements.
811 {
812 const int32_t char32[] = {0, 0x7FFF, 0xFFFF};
813 const String& str16 = String::Handle(String::FromUTF32(char32, 3));
814 EXPECT(!str16.IsOneByteString());
815 EXPECT(str16.IsTwoByteString());
816 EXPECT_EQ(0x0000, str16.CharAt(0));
817 EXPECT_EQ(0x7FFF, str16.CharAt(1));
818 EXPECT_EQ(0xFFFF, str16.CharAt(2));
819 }
820}
bool IsTwoByteString() const
Definition object.h:10294

◆ ISOLATE_UNIT_TEST_CASE() [381/463]

dart::ISOLATE_UNIT_TEST_CASE ( String_EqualsUTF32  )

Definition at line 7364 of file object_test.cc.

7364 {"_MyClass@6328321.named", "_MyClass.named"},
7365 };
7366 String& test = String::Handle();
7367 const char* result;
7368 for (size_t i = 0; i < ARRAY_SIZE(tests); i++) {
7369 test = String::New(tests[i].in);
7370 result = String::ScrubName(test);
7371 EXPECT_STREQ(tests[i].out, result);
7372 }
7373}
7374
7375ISOLATE_UNIT_TEST_CASE(String_EqualsUTF32) {
static BlurTest tests[]
Definition BlurTest.cpp:84

◆ ISOLATE_UNIT_TEST_CASE() [382/463]

dart::ISOLATE_UNIT_TEST_CASE ( String_ScrubName  )

Definition at line 7338 of file object_test.cc.

7338 {&Symbols::TypeError(), &empty,
7339 &Symbols::isPaused()};
7340 CheckConcatAll(data, 3);
7341 }
7342}
7343
7344struct TestResult {
7345 const char* in;
7346 const char* out;
7347};
7348
7349ISOLATE_UNIT_TEST_CASE(String_ScrubName) {
7350 TestResult tests[] = {
7351 {"(dynamic, dynamic) => void", "(dynamic, dynamic) => void"},
7352 {"_List@915557746", "_List"},
7353 {"_HashMap@600006304<K, V>(dynamic) => V",
7354 "_HashMap<K, V>(dynamic) => V"},
7355 {"set:foo", "foo="},
7356 {"get:foo", "foo"},
7357 {"_ReceivePortImpl@709387912", "_ReceivePortImpl"},
7358 {"_ReceivePortImpl@709387912._internal@709387912",
7359 "_ReceivePortImpl._internal"},
7360 {"_C@6328321&_E@6328321&_F@6328321", "_C&_E&_F"},
7361 {"List.", "List"},
7362 {"get:foo@6328321", "foo"},
EMSCRIPTEN_KEEPALIVE void empty()

◆ ISOLATE_UNIT_TEST_CASE() [383/463]

dart::ISOLATE_UNIT_TEST_CASE ( StringCodePointIterator  )

Definition at line 1993 of file object_test.cc.

1993 {
1994 const String& str0 = String::Handle(String::New(""));
1995 String::CodePointIterator it0(str0);
1996 EXPECT(!it0.Next());
1997
1998 const String& str1 = String::Handle(String::New(" \xc3\xa7 "));
1999 String::CodePointIterator it1(str1);
2000 EXPECT(it1.Next());
2001 EXPECT_EQ(' ', it1.Current());
2002 EXPECT(it1.Next());
2003 EXPECT_EQ(0xE7, it1.Current());
2004 EXPECT(it1.Next());
2005 EXPECT_EQ(' ', it1.Current());
2006 EXPECT(!it1.Next());
2007
2008 const String& str2 =
2009 String::Handle(String::New("\xD7\x92\xD7\x9C"
2010 "\xD7\xA2\xD7\x93"
2011 "\xD7\x91\xD7\xA8"
2012 "\xD7\x9B\xD7\x94"));
2013 String::CodePointIterator it2(str2);
2014 EXPECT(it2.Next());
2015 EXPECT_EQ(0x5D2, it2.Current());
2016 EXPECT(it2.Next());
2017 EXPECT_EQ(0x5DC, it2.Current());
2018 EXPECT(it2.Next());
2019 EXPECT_EQ(0x5E2, it2.Current());
2020 EXPECT(it2.Next());
2021 EXPECT_EQ(0x5D3, it2.Current());
2022 EXPECT(it2.Next());
2023 EXPECT_EQ(0x5D1, it2.Current());
2024 EXPECT(it2.Next());
2025 EXPECT_EQ(0x5E8, it2.Current());
2026 EXPECT(it2.Next());
2027 EXPECT_EQ(0x5DB, it2.Current());
2028 EXPECT(it2.Next());
2029 EXPECT_EQ(0x5D4, it2.Current());
2030 EXPECT(!it2.Next());
2031
2032 const String& str3 =
2033 String::Handle(String::New("\xF0\x9D\x91\xA0"
2034 "\xF0\x9D\x91\xA1"
2035 "\xF0\x9D\x91\xA2"
2036 "\xF0\x9D\x91\xA3"));
2037 String::CodePointIterator it3(str3);
2038 EXPECT(it3.Next());
2039 EXPECT_EQ(0x1D460, it3.Current());
2040 EXPECT(it3.Next());
2041 EXPECT_EQ(0x1D461, it3.Current());
2042 EXPECT(it3.Next());
2043 EXPECT_EQ(0x1D462, it3.Current());
2044 EXPECT(it3.Next());
2045 EXPECT_EQ(0x1D463, it3.Current());
2046 EXPECT(!it3.Next());
2047}

◆ ISOLATE_UNIT_TEST_CASE() [384/463]

dart::ISOLATE_UNIT_TEST_CASE ( StringCodePointIteratorRange  )

Definition at line 2049 of file object_test.cc.

2049 {
2050 const String& str = String::Handle(String::New("foo bar baz"));
2051
2052 String::CodePointIterator it0(str, 3, 0);
2053 EXPECT(!it0.Next());
2054
2055 String::CodePointIterator it1(str, 4, 3);
2056 EXPECT(it1.Next());
2057 EXPECT_EQ('b', it1.Current());
2058 EXPECT(it1.Next());
2059 EXPECT_EQ('a', it1.Current());
2060 EXPECT(it1.Next());
2061 EXPECT_EQ('r', it1.Current());
2062 EXPECT(!it1.Next());
2063}

◆ ISOLATE_UNIT_TEST_CASE() [385/463]

dart::ISOLATE_UNIT_TEST_CASE ( StringCompareTo  )

Definition at line 419 of file object_test.cc.

419 {
420 const String& abcd = String::Handle(String::New("abcd"));
421 const String& abce = String::Handle(String::New("abce"));
422 EXPECT_EQ(0, abcd.CompareTo(abcd));
423 EXPECT_EQ(0, abce.CompareTo(abce));
424 EXPECT(abcd.CompareTo(abce) < 0);
425 EXPECT(abce.CompareTo(abcd) > 0);
426
427 const int kMonkeyLen = 4;
428 const uint8_t monkey_utf8[kMonkeyLen] = {0xf0, 0x9f, 0x90, 0xb5};
429 const String& monkey_face =
430 String::Handle(String::FromUTF8(monkey_utf8, kMonkeyLen));
431 const int kDogLen = 4;
432 // 0x1f436 DOG FACE.
433 const uint8_t dog_utf8[kDogLen] = {0xf0, 0x9f, 0x90, 0xb6};
434 const String& dog_face = String::Handle(String::FromUTF8(dog_utf8, kDogLen));
435 EXPECT_EQ(0, monkey_face.CompareTo(monkey_face));
436 EXPECT_EQ(0, dog_face.CompareTo(dog_face));
437 EXPECT(monkey_face.CompareTo(dog_face) < 0);
438 EXPECT(dog_face.CompareTo(monkey_face) > 0);
439
440 const int kDominoLen = 4;
441 // 0x1f036 DOMINO TILE HORIZONTAL-00-05.
442 const uint8_t domino_utf8[kDominoLen] = {0xf0, 0x9f, 0x80, 0xb6};
443 const String& domino =
444 String::Handle(String::FromUTF8(domino_utf8, kDominoLen));
445 EXPECT_EQ(0, domino.CompareTo(domino));
446 EXPECT(domino.CompareTo(dog_face) < 0);
447 EXPECT(domino.CompareTo(monkey_face) < 0);
448 EXPECT(dog_face.CompareTo(domino) > 0);
449 EXPECT(monkey_face.CompareTo(domino) > 0);
450
451 EXPECT(abcd.CompareTo(monkey_face) < 0);
452 EXPECT(abce.CompareTo(monkey_face) < 0);
453 EXPECT(abcd.CompareTo(domino) < 0);
454 EXPECT(abce.CompareTo(domino) < 0);
455 EXPECT(domino.CompareTo(abcd) > 0);
456 EXPECT(domino.CompareTo(abcd) > 0);
457 EXPECT(monkey_face.CompareTo(abce) > 0);
458 EXPECT(monkey_face.CompareTo(abce) > 0);
459}
intptr_t CompareTo(const String &other) const
Definition object.cc:23717

◆ ISOLATE_UNIT_TEST_CASE() [386/463]

dart::ISOLATE_UNIT_TEST_CASE ( StringConcat  )

Definition at line 834 of file object_test.cc.

834 {
835 // Create strings from concatenated 1-byte empty strings.
836 {
837 const String& empty1 = String::Handle(String::New(""));
838 EXPECT(empty1.IsOneByteString());
839 EXPECT_EQ(0, empty1.Length());
840
841 const String& empty2 = String::Handle(String::New(""));
842 EXPECT(empty2.IsOneByteString());
843 EXPECT_EQ(0, empty2.Length());
844
845 // Concat
846
847 const String& empty3 = String::Handle(String::Concat(empty1, empty2));
848 EXPECT(empty3.IsOneByteString());
849 EXPECT_EQ(0, empty3.Length());
850
851 // ConcatAll
852
853 const Array& array1 = Array::Handle(Array::New(0));
854 EXPECT_EQ(0, array1.Length());
855 const String& empty4 = String::Handle(String::ConcatAll(array1));
856 EXPECT_EQ(0, empty4.Length());
857
858 const Array& array2 = Array::Handle(Array::New(10));
859 EXPECT_EQ(10, array2.Length());
860 for (int i = 0; i < array2.Length(); ++i) {
861 array2.SetAt(i, String::Handle(String::New("")));
862 }
863 const String& empty5 = String::Handle(String::ConcatAll(array2));
864 EXPECT(empty5.IsOneByteString());
865 EXPECT_EQ(0, empty5.Length());
866
867 const Array& array3 = Array::Handle(Array::New(123));
868 EXPECT_EQ(123, array3.Length());
869
870 const String& empty6 = String::Handle(String::New(""));
871 EXPECT(empty6.IsOneByteString());
872 EXPECT_EQ(0, empty6.Length());
873 for (int i = 0; i < array3.Length(); ++i) {
874 array3.SetAt(i, empty6);
875 }
876 const String& empty7 = String::Handle(String::ConcatAll(array3));
877 EXPECT(empty7.IsOneByteString());
878 EXPECT_EQ(0, empty7.Length());
879 }
880
881 // Concatenated empty and non-empty 1-byte strings.
882 {
883 const String& str1 = String::Handle(String::New(""));
884 EXPECT_EQ(0, str1.Length());
885 EXPECT(str1.IsOneByteString());
886
887 const String& str2 = String::Handle(String::New("one"));
888 EXPECT(str2.IsOneByteString());
889 EXPECT_EQ(3, str2.Length());
890
891 // Concat
892
893 const String& str3 = String::Handle(String::Concat(str1, str2));
894 EXPECT(str3.IsOneByteString());
895 EXPECT_EQ(3, str3.Length());
896 EXPECT(str3.Equals(str2));
897
898 const String& str4 = String::Handle(String::Concat(str2, str1));
899 EXPECT(str4.IsOneByteString());
900 EXPECT_EQ(3, str4.Length());
901 EXPECT(str4.Equals(str2));
902
903 // ConcatAll
904
905 const Array& array1 = Array::Handle(Array::New(2));
906 EXPECT_EQ(2, array1.Length());
907 array1.SetAt(0, str1);
908 array1.SetAt(1, str2);
909 const String& str5 = String::Handle(String::ConcatAll(array1));
910 EXPECT(str5.IsOneByteString());
911 EXPECT_EQ(3, str5.Length());
912 EXPECT(str5.Equals(str2));
913
914 const Array& array2 = Array::Handle(Array::New(2));
915 EXPECT_EQ(2, array2.Length());
916 array2.SetAt(0, str1);
917 array2.SetAt(1, str2);
918 const String& str6 = String::Handle(String::ConcatAll(array2));
919 EXPECT(str6.IsOneByteString());
920 EXPECT_EQ(3, str6.Length());
921 EXPECT(str6.Equals(str2));
922
923 const Array& array3 = Array::Handle(Array::New(3));
924 EXPECT_EQ(3, array3.Length());
925 array3.SetAt(0, str2);
926 array3.SetAt(1, str1);
927 array3.SetAt(2, str2);
928 const String& str7 = String::Handle(String::ConcatAll(array3));
929 EXPECT(str7.IsOneByteString());
930 EXPECT_EQ(6, str7.Length());
931 EXPECT(str7.Equals("oneone"));
932 EXPECT(!str7.Equals("oneoneone"));
933 }
934
935 // Create a string by concatenating non-empty 1-byte strings.
936 {
937 const char* one = "one";
938 intptr_t one_len = strlen(one);
939 const String& onestr = String::Handle(String::New(one));
940 EXPECT(onestr.IsOneByteString());
941 EXPECT_EQ(one_len, onestr.Length());
942
943 const char* three = "three";
944 intptr_t three_len = strlen(three);
945 const String& threestr = String::Handle(String::New(three));
946 EXPECT(threestr.IsOneByteString());
947 EXPECT_EQ(three_len, threestr.Length());
948
949 // Concat
950
951 const String& str3 = String::Handle(String::Concat(onestr, threestr));
952 EXPECT(str3.IsOneByteString());
953 const char* one_three = "onethree";
954 EXPECT(str3.Equals(one_three));
955
956 const String& str4 = String::Handle(String::Concat(threestr, onestr));
957 EXPECT(str4.IsOneByteString());
958 const char* three_one = "threeone";
959 intptr_t three_one_len = strlen(three_one);
960 EXPECT_EQ(three_one_len, str4.Length());
961 EXPECT(str4.Equals(three_one));
962
963 // ConcatAll
964
965 const Array& array1 = Array::Handle(Array::New(2));
966 EXPECT_EQ(2, array1.Length());
967 array1.SetAt(0, onestr);
968 array1.SetAt(1, threestr);
969 const String& str5 = String::Handle(String::ConcatAll(array1));
970 EXPECT(str5.IsOneByteString());
971 intptr_t one_three_len = strlen(one_three);
972 EXPECT_EQ(one_three_len, str5.Length());
973 EXPECT(str5.Equals(one_three));
974
975 const Array& array2 = Array::Handle(Array::New(2));
976 EXPECT_EQ(2, array2.Length());
977 array2.SetAt(0, threestr);
978 array2.SetAt(1, onestr);
979 const String& str6 = String::Handle(String::ConcatAll(array2));
980 EXPECT(str6.IsOneByteString());
981 EXPECT_EQ(three_one_len, str6.Length());
982 EXPECT(str6.Equals(three_one));
983
984 const Array& array3 = Array::Handle(Array::New(3));
985 EXPECT_EQ(3, array3.Length());
986 array3.SetAt(0, onestr);
987 array3.SetAt(1, threestr);
988 array3.SetAt(2, onestr);
989 const String& str7 = String::Handle(String::ConcatAll(array3));
990 EXPECT(str7.IsOneByteString());
991 const char* one_three_one = "onethreeone";
992 intptr_t one_three_one_len = strlen(one_three_one);
993 EXPECT_EQ(one_three_one_len, str7.Length());
994 EXPECT(str7.Equals(one_three_one));
995
996 const Array& array4 = Array::Handle(Array::New(3));
997 EXPECT_EQ(3, array4.Length());
998 array4.SetAt(0, threestr);
999 array4.SetAt(1, onestr);
1000 array4.SetAt(2, threestr);
1001 const String& str8 = String::Handle(String::ConcatAll(array4));
1002 EXPECT(str8.IsOneByteString());
1003 const char* three_one_three = "threeonethree";
1004 intptr_t three_one_three_len = strlen(three_one_three);
1005 EXPECT_EQ(three_one_three_len, str8.Length());
1006 EXPECT(str8.Equals(three_one_three));
1007 }
1008
1009 // Concatenate empty and non-empty 2-byte strings.
1010 {
1011 const String& str1 = String::Handle(String::New(""));
1012 EXPECT(str1.IsOneByteString());
1013 EXPECT_EQ(0, str1.Length());
1014
1015 uint16_t two[] = {0x05E6, 0x05D5, 0x05D5, 0x05D9, 0x05D9};
1016 intptr_t two_len = sizeof(two) / sizeof(two[0]);
1017 const String& str2 = String::Handle(String::FromUTF16(two, two_len));
1018 EXPECT(str2.IsTwoByteString());
1019 EXPECT_EQ(two_len, str2.Length());
1020
1021 // Concat
1022
1023 const String& str3 = String::Handle(String::Concat(str1, str2));
1024 EXPECT(str3.IsTwoByteString());
1025 EXPECT_EQ(two_len, str3.Length());
1026 EXPECT(str3.Equals(str2));
1027
1028 const String& str4 = String::Handle(String::Concat(str2, str1));
1029 EXPECT(str4.IsTwoByteString());
1030 EXPECT_EQ(two_len, str4.Length());
1031 EXPECT(str4.Equals(str2));
1032
1033 // ConcatAll
1034
1035 const Array& array1 = Array::Handle(Array::New(2));
1036 EXPECT_EQ(2, array1.Length());
1037 array1.SetAt(0, str1);
1038 array1.SetAt(1, str2);
1039 const String& str5 = String::Handle(String::ConcatAll(array1));
1040 EXPECT(str5.IsTwoByteString());
1041 EXPECT_EQ(two_len, str5.Length());
1042 EXPECT(str5.Equals(str2));
1043
1044 const Array& array2 = Array::Handle(Array::New(2));
1045 EXPECT_EQ(2, array2.Length());
1046 array2.SetAt(0, str1);
1047 array2.SetAt(1, str2);
1048 const String& str6 = String::Handle(String::ConcatAll(array2));
1049 EXPECT(str6.IsTwoByteString());
1050 EXPECT_EQ(two_len, str6.Length());
1051 EXPECT(str6.Equals(str2));
1052
1053 const Array& array3 = Array::Handle(Array::New(3));
1054 EXPECT_EQ(3, array3.Length());
1055 array3.SetAt(0, str2);
1056 array3.SetAt(1, str1);
1057 array3.SetAt(2, str2);
1058 const String& str7 = String::Handle(String::ConcatAll(array3));
1059 EXPECT(str7.IsTwoByteString());
1060 EXPECT_EQ(two_len * 2, str7.Length());
1061 uint16_t twotwo[] = {0x05E6, 0x05D5, 0x05D5, 0x05D9, 0x05D9,
1062 0x05E6, 0x05D5, 0x05D5, 0x05D9, 0x05D9};
1063 intptr_t twotwo_len = sizeof(twotwo) / sizeof(twotwo[0]);
1064 EXPECT(str7.IsTwoByteString());
1065 EXPECT(str7.Equals(twotwo, twotwo_len));
1066 }
1067
1068 // Concatenating non-empty 2-byte strings.
1069 {
1070 const uint16_t one[] = {0x05D0, 0x05D9, 0x05D9, 0x05DF};
1071 intptr_t one_len = sizeof(one) / sizeof(one[0]);
1072 const String& str1 = String::Handle(String::FromUTF16(one, one_len));
1073 EXPECT(str1.IsTwoByteString());
1074 EXPECT_EQ(one_len, str1.Length());
1075
1076 const uint16_t two[] = {0x05E6, 0x05D5, 0x05D5, 0x05D9, 0x05D9};
1077 intptr_t two_len = sizeof(two) / sizeof(two[0]);
1078 const String& str2 = String::Handle(String::FromUTF16(two, two_len));
1079 EXPECT(str2.IsTwoByteString());
1080 EXPECT_EQ(two_len, str2.Length());
1081
1082 // Concat
1083
1084 const String& one_two_str = String::Handle(String::Concat(str1, str2));
1085 EXPECT(one_two_str.IsTwoByteString());
1086 const uint16_t one_two[] = {0x05D0, 0x05D9, 0x05D9, 0x05DF, 0x05E6,
1087 0x05D5, 0x05D5, 0x05D9, 0x05D9};
1088 intptr_t one_two_len = sizeof(one_two) / sizeof(one_two[0]);
1089 EXPECT_EQ(one_two_len, one_two_str.Length());
1090 EXPECT(one_two_str.Equals(one_two, one_two_len));
1091
1092 const String& two_one_str = String::Handle(String::Concat(str2, str1));
1093 EXPECT(two_one_str.IsTwoByteString());
1094 const uint16_t two_one[] = {0x05E6, 0x05D5, 0x05D5, 0x05D9, 0x05D9,
1095 0x05D0, 0x05D9, 0x05D9, 0x05DF};
1096 intptr_t two_one_len = sizeof(two_one) / sizeof(two_one[0]);
1097 EXPECT_EQ(two_one_len, two_one_str.Length());
1098 EXPECT(two_one_str.Equals(two_one, two_one_len));
1099
1100 // ConcatAll
1101
1102 const Array& array1 = Array::Handle(Array::New(2));
1103 EXPECT_EQ(2, array1.Length());
1104 array1.SetAt(0, str1);
1105 array1.SetAt(1, str2);
1106 const String& str3 = String::Handle(String::ConcatAll(array1));
1107 EXPECT(str3.IsTwoByteString());
1108 EXPECT_EQ(one_two_len, str3.Length());
1109 EXPECT(str3.Equals(one_two, one_two_len));
1110
1111 const Array& array2 = Array::Handle(Array::New(2));
1112 EXPECT_EQ(2, array2.Length());
1113 array2.SetAt(0, str2);
1114 array2.SetAt(1, str1);
1115 const String& str4 = String::Handle(String::ConcatAll(array2));
1116 EXPECT(str4.IsTwoByteString());
1117 EXPECT_EQ(two_one_len, str4.Length());
1118 EXPECT(str4.Equals(two_one, two_one_len));
1119
1120 const Array& array3 = Array::Handle(Array::New(3));
1121 EXPECT_EQ(3, array3.Length());
1122 array3.SetAt(0, str1);
1123 array3.SetAt(1, str2);
1124 array3.SetAt(2, str1);
1125 const String& str5 = String::Handle(String::ConcatAll(array3));
1126 EXPECT(str5.IsTwoByteString());
1127 const uint16_t one_two_one[] = {0x05D0, 0x05D9, 0x05D9, 0x05DF, 0x05E6,
1128 0x05D5, 0x05D5, 0x05D9, 0x05D9, 0x05D0,
1129 0x05D9, 0x05D9, 0x05DF};
1130 intptr_t one_two_one_len = sizeof(one_two_one) / sizeof(one_two_one[0]);
1131 EXPECT_EQ(one_two_one_len, str5.Length());
1132 EXPECT(str5.Equals(one_two_one, one_two_one_len));
1133
1134 const Array& array4 = Array::Handle(Array::New(3));
1135 EXPECT_EQ(3, array4.Length());
1136 array4.SetAt(0, str2);
1137 array4.SetAt(1, str1);
1138 array4.SetAt(2, str2);
1139 const String& str6 = String::Handle(String::ConcatAll(array4));
1140 EXPECT(str6.IsTwoByteString());
1141 const uint16_t two_one_two[] = {0x05E6, 0x05D5, 0x05D5, 0x05D9, 0x05D9,
1142 0x05D0, 0x05D9, 0x05D9, 0x05DF, 0x05E6,
1143 0x05D5, 0x05D5, 0x05D9, 0x05D9};
1144 intptr_t two_one_two_len = sizeof(two_one_two) / sizeof(two_one_two[0]);
1145 EXPECT_EQ(two_one_two_len, str6.Length());
1146 EXPECT(str6.Equals(two_one_two, two_one_two_len));
1147 }
1148
1149 // Concatenated empty and non-empty strings built from 4-byte elements.
1150 {
1151 const String& str1 = String::Handle(String::New(""));
1152 EXPECT(str1.IsOneByteString());
1153 EXPECT_EQ(0, str1.Length());
1154
1155 int32_t four[] = {0x1D4D5, 0x1D4DE, 0x1D4E4, 0x1D4E1};
1156 intptr_t four_len = sizeof(four) / sizeof(four[0]);
1157 intptr_t expected_len = (four_len * 2);
1158 const String& str2 = String::Handle(String::FromUTF32(four, four_len));
1159 EXPECT(str2.IsTwoByteString());
1160 EXPECT_EQ(expected_len, str2.Length());
1161
1162 // Concat
1163
1164 const String& str3 = String::Handle(String::Concat(str1, str2));
1165 EXPECT_EQ(expected_len, str3.Length());
1166 EXPECT(str3.Equals(str2));
1167
1168 const String& str4 = String::Handle(String::Concat(str2, str1));
1169 EXPECT(str4.IsTwoByteString());
1170 EXPECT_EQ(expected_len, str4.Length());
1171 EXPECT(str4.Equals(str2));
1172
1173 // ConcatAll
1174
1175 const Array& array1 = Array::Handle(Array::New(2));
1176 EXPECT_EQ(2, array1.Length());
1177 array1.SetAt(0, str1);
1178 array1.SetAt(1, str2);
1179 const String& str5 = String::Handle(String::ConcatAll(array1));
1180 EXPECT(str5.IsTwoByteString());
1181 EXPECT_EQ(expected_len, str5.Length());
1182 EXPECT(str5.Equals(str2));
1183
1184 const Array& array2 = Array::Handle(Array::New(2));
1185 EXPECT_EQ(2, array2.Length());
1186 array2.SetAt(0, str1);
1187 array2.SetAt(1, str2);
1188 const String& str6 = String::Handle(String::ConcatAll(array2));
1189 EXPECT(str6.IsTwoByteString());
1190 EXPECT_EQ(expected_len, str6.Length());
1191 EXPECT(str6.Equals(str2));
1192
1193 const Array& array3 = Array::Handle(Array::New(3));
1194 EXPECT_EQ(3, array3.Length());
1195 array3.SetAt(0, str2);
1196 array3.SetAt(1, str1);
1197 array3.SetAt(2, str2);
1198 const String& str7 = String::Handle(String::ConcatAll(array3));
1199 EXPECT(str7.IsTwoByteString());
1200 int32_t fourfour[] = {0x1D4D5, 0x1D4DE, 0x1D4E4, 0x1D4E1,
1201 0x1D4D5, 0x1D4DE, 0x1D4E4, 0x1D4E1};
1202 intptr_t fourfour_len = sizeof(fourfour) / sizeof(fourfour[0]);
1203 EXPECT_EQ((fourfour_len * 2), str7.Length());
1204 const String& fourfour_str =
1205 String::Handle(String::FromUTF32(fourfour, fourfour_len));
1206 EXPECT(str7.Equals(fourfour_str));
1207 }
1208
1209 // Concatenate non-empty strings built from 4-byte elements.
1210 {
1211 const int32_t one[] = {0x105D0, 0x105D9, 0x105D9, 0x105DF};
1212 intptr_t one_len = sizeof(one) / sizeof(one[0]);
1213 const String& onestr = String::Handle(String::FromUTF32(one, one_len));
1214 EXPECT(onestr.IsTwoByteString());
1215 EXPECT_EQ((one_len * 2), onestr.Length());
1216
1217 const int32_t two[] = {0x105E6, 0x105D5, 0x105D5, 0x105D9, 0x105D9};
1218 intptr_t two_len = sizeof(two) / sizeof(two[0]);
1219 const String& twostr = String::Handle(String::FromUTF32(two, two_len));
1220 EXPECT(twostr.IsTwoByteString());
1221 EXPECT_EQ((two_len * 2), twostr.Length());
1222
1223 // Concat
1224
1225 const String& str1 = String::Handle(String::Concat(onestr, twostr));
1226 EXPECT(str1.IsTwoByteString());
1227 const int32_t one_two[] = {0x105D0, 0x105D9, 0x105D9, 0x105DF, 0x105E6,
1228 0x105D5, 0x105D5, 0x105D9, 0x105D9};
1229 intptr_t one_two_len = sizeof(one_two) / sizeof(one_two[0]);
1230 EXPECT_EQ((one_two_len * 2), str1.Length());
1231 const String& one_two_str =
1232 String::Handle(String::FromUTF32(one_two, one_two_len));
1233 EXPECT(str1.Equals(one_two_str));
1234
1235 const String& str2 = String::Handle(String::Concat(twostr, onestr));
1236 EXPECT(str2.IsTwoByteString());
1237 const int32_t two_one[] = {0x105E6, 0x105D5, 0x105D5, 0x105D9, 0x105D9,
1238 0x105D0, 0x105D9, 0x105D9, 0x105DF};
1239 intptr_t two_one_len = sizeof(two_one) / sizeof(two_one[0]);
1240 EXPECT_EQ((two_one_len * 2), str2.Length());
1241 const String& two_one_str =
1242 String::Handle(String::FromUTF32(two_one, two_one_len));
1243 EXPECT(str2.Equals(two_one_str));
1244
1245 // ConcatAll
1246
1247 const Array& array1 = Array::Handle(Array::New(2));
1248 EXPECT_EQ(2, array1.Length());
1249 array1.SetAt(0, onestr);
1250 array1.SetAt(1, twostr);
1251 const String& str3 = String::Handle(String::ConcatAll(array1));
1252 EXPECT(str3.IsTwoByteString());
1253 EXPECT_EQ((one_two_len * 2), str3.Length());
1254 EXPECT(str3.Equals(one_two_str));
1255
1256 const Array& array2 = Array::Handle(Array::New(2));
1257 EXPECT_EQ(2, array2.Length());
1258 array2.SetAt(0, twostr);
1259 array2.SetAt(1, onestr);
1260 const String& str4 = String::Handle(String::ConcatAll(array2));
1261 EXPECT(str4.IsTwoByteString());
1262 EXPECT_EQ((two_one_len * 2), str4.Length());
1263 EXPECT(str4.Equals(two_one_str));
1264
1265 const Array& array3 = Array::Handle(Array::New(3));
1266 EXPECT_EQ(3, array3.Length());
1267 array3.SetAt(0, onestr);
1268 array3.SetAt(1, twostr);
1269 array3.SetAt(2, onestr);
1270 const String& str5 = String::Handle(String::ConcatAll(array3));
1271 EXPECT(str5.IsTwoByteString());
1272 const int32_t one_two_one[] = {0x105D0, 0x105D9, 0x105D9, 0x105DF, 0x105E6,
1273 0x105D5, 0x105D5, 0x105D9, 0x105D9, 0x105D0,
1274 0x105D9, 0x105D9, 0x105DF};
1275 intptr_t one_two_one_len = sizeof(one_two_one) / sizeof(one_two_one[0]);
1276 EXPECT_EQ((one_two_one_len * 2), str5.Length());
1277 const String& one_two_one_str =
1278 String::Handle(String::FromUTF32(one_two_one, one_two_one_len));
1279 EXPECT(str5.Equals(one_two_one_str));
1280
1281 const Array& array4 = Array::Handle(Array::New(3));
1282 EXPECT_EQ(3, array4.Length());
1283 array4.SetAt(0, twostr);
1284 array4.SetAt(1, onestr);
1285 array4.SetAt(2, twostr);
1286 const String& str6 = String::Handle(String::ConcatAll(array4));
1287 EXPECT(str6.IsTwoByteString());
1288 const int32_t two_one_two[] = {0x105E6, 0x105D5, 0x105D5, 0x105D9, 0x105D9,
1289 0x105D0, 0x105D9, 0x105D9, 0x105DF, 0x105E6,
1290 0x105D5, 0x105D5, 0x105D9, 0x105D9};
1291 intptr_t two_one_two_len = sizeof(two_one_two) / sizeof(two_one_two[0]);
1292 EXPECT_EQ((two_one_two_len * 2), str6.Length());
1293 const String& two_one_two_str =
1294 String::Handle(String::FromUTF32(two_one_two, two_one_two_len));
1295 EXPECT(str6.Equals(two_one_two_str));
1296 }
1297
1298 // Concatenate 1-byte strings and 2-byte strings.
1299 {
1300 const uint8_t one[] = {'o', 'n', 'e', ' ', 'b', 'y', 't', 'e'};
1301 intptr_t one_len = sizeof(one) / sizeof(one[0]);
1302 const String& onestr = String::Handle(String::FromLatin1(one, one_len));
1303 EXPECT(onestr.IsOneByteString());
1304 EXPECT_EQ(one_len, onestr.Length());
1305 EXPECT(onestr.EqualsLatin1(one, one_len));
1306
1307 uint16_t two[] = {0x05E6, 0x05D5, 0x05D5, 0x05D9, 0x05D9};
1308 intptr_t two_len = sizeof(two) / sizeof(two[0]);
1309 const String& twostr = String::Handle(String::FromUTF16(two, two_len));
1310 EXPECT(twostr.IsTwoByteString());
1311 EXPECT_EQ(two_len, twostr.Length());
1312 EXPECT(twostr.Equals(two, two_len));
1313
1314 // Concat
1315
1316 const String& one_two_str = String::Handle(String::Concat(onestr, twostr));
1317 EXPECT(one_two_str.IsTwoByteString());
1318 uint16_t one_two[] = {'o', 'n', 'e', ' ', 'b', 'y', 't',
1319 'e', 0x05E6, 0x05D5, 0x05D5, 0x05D9, 0x05D9};
1320 intptr_t one_two_len = sizeof(one_two) / sizeof(one_two[0]);
1321 EXPECT_EQ(one_two_len, one_two_str.Length());
1322 EXPECT(one_two_str.Equals(one_two, one_two_len));
1323
1324 const String& two_one_str = String::Handle(String::Concat(twostr, onestr));
1325 EXPECT(two_one_str.IsTwoByteString());
1326 uint16_t two_one[] = {0x05E6, 0x05D5, 0x05D5, 0x05D9, 0x05D9, 'o', 'n',
1327 'e', ' ', 'b', 'y', 't', 'e'};
1328 intptr_t two_one_len = sizeof(two_one) / sizeof(two_one[0]);
1329 EXPECT_EQ(two_one_len, two_one_str.Length());
1330 EXPECT(two_one_str.Equals(two_one, two_one_len));
1331
1332 // ConcatAll
1333
1334 const Array& array1 = Array::Handle(Array::New(3));
1335 EXPECT_EQ(3, array1.Length());
1336 array1.SetAt(0, onestr);
1337 array1.SetAt(1, twostr);
1338 array1.SetAt(2, onestr);
1339 const String& one_two_one_str = String::Handle(String::ConcatAll(array1));
1340 EXPECT(one_two_one_str.IsTwoByteString());
1341 EXPECT_EQ(onestr.Length() * 2 + twostr.Length(), one_two_one_str.Length());
1342 uint16_t one_two_one[] = {'o', 'n', 'e', ' ', 'b', 'y', 't',
1343 'e', 0x05E6, 0x05D5, 0x05D5, 0x05D9, 0x05D9, 'o',
1344 'n', 'e', ' ', 'b', 'y', 't', 'e'};
1345 intptr_t one_two_one_len = sizeof(one_two_one) / sizeof(one_two_one[0]);
1346 EXPECT(one_two_one_str.Equals(one_two_one, one_two_one_len));
1347
1348 const Array& array2 = Array::Handle(Array::New(3));
1349 EXPECT_EQ(3, array2.Length());
1350 array2.SetAt(0, twostr);
1351 array2.SetAt(1, onestr);
1352 array2.SetAt(2, twostr);
1353 const String& two_one_two_str = String::Handle(String::ConcatAll(array2));
1354 EXPECT(two_one_two_str.IsTwoByteString());
1355 EXPECT_EQ(twostr.Length() * 2 + onestr.Length(), two_one_two_str.Length());
1356 uint16_t two_one_two[] = {0x05E6, 0x05D5, 0x05D5, 0x05D9, 0x05D9, 'o',
1357 'n', 'e', ' ', 'b', 'y', 't',
1358 'e', 0x05E6, 0x05D5, 0x05D5, 0x05D9, 0x05D9};
1359 intptr_t two_one_two_len = sizeof(two_one_two) / sizeof(two_one_two[0]);
1360 EXPECT(two_one_two_str.Equals(two_one_two, two_one_two_len));
1361 }
1362}

◆ ISOLATE_UNIT_TEST_CASE() [387/463]

dart::ISOLATE_UNIT_TEST_CASE ( StringDecodeIRI  )

Definition at line 472 of file object_test.cc.

472 {
473 const char* kOutput =
474 "file:///usr/local/johnmccutchan/workspace/dart-repo/dart/test.dart";
475 const char* kInput =
476 "file%3A%2F%2F%2Fusr%2Flocal%2Fjohnmccutchan%2Fworkspace%2F"
477 "dart-repo%2Fdart%2Ftest.dart";
478 const String& input = String::Handle(String::New(kInput));
479 const String& output = String::Handle(String::New(kOutput));
480 const String& decoded = String::Handle(String::DecodeIRI(input));
481 EXPECT(output.Equals(decoded));
482}

◆ ISOLATE_UNIT_TEST_CASE() [388/463]

dart::ISOLATE_UNIT_TEST_CASE ( StringDecodeIRIInvalid  )

Definition at line 484 of file object_test.cc.

484 {
485 String& input = String::Handle();
486 input = String::New("file%");
487 String& decoded = String::Handle();
488 decoded = String::DecodeIRI(input);
489 EXPECT(decoded.IsNull());
490 input = String::New("file%3");
491 decoded = String::DecodeIRI(input);
492 EXPECT(decoded.IsNull());
493 input = String::New("file%3g");
494 decoded = String::DecodeIRI(input);
495 EXPECT(decoded.IsNull());
496}

◆ ISOLATE_UNIT_TEST_CASE() [389/463]

dart::ISOLATE_UNIT_TEST_CASE ( StringEncodeIRI  )

Definition at line 461 of file object_test.cc.

461 {
462 const char* kInput =
463 "file:///usr/local/johnmccutchan/workspace/dart-repo/dart/test.dart";
464 const char* kOutput =
465 "file%3A%2F%2F%2Fusr%2Flocal%2Fjohnmccutchan%2Fworkspace%2F"
466 "dart-repo%2Fdart%2Ftest.dart";
467 const String& input = String::Handle(String::New(kInput));
468 const char* encoded = String::EncodeIRI(input);
469 EXPECT(strcmp(encoded, kOutput) == 0);
470}

◆ ISOLATE_UNIT_TEST_CASE() [390/463]

dart::ISOLATE_UNIT_TEST_CASE ( StringEqualsUTF32  )

Definition at line 1629 of file object_test.cc.

1629 {
1630 const String& empty = String::Handle(String::New(""));
1631 const String& t_str = String::Handle(String::New("t"));
1632 const String& th_str = String::Handle(String::New("th"));
1633 const int32_t chars[] = {'t', 'h', 'i', 's'};
1634 EXPECT(!empty.Equals(chars, -1));
1635 EXPECT(empty.Equals(chars, 0));
1636 EXPECT(!empty.Equals(chars, 1));
1637 EXPECT(!t_str.Equals(chars, 0));
1638 EXPECT(t_str.Equals(chars, 1));
1639 EXPECT(!t_str.Equals(chars, 2));
1640 EXPECT(!th_str.Equals(chars, 1));
1641 EXPECT(th_str.Equals(chars, 2));
1642 EXPECT(!th_str.Equals(chars, 3));
1643}

◆ ISOLATE_UNIT_TEST_CASE() [391/463]

dart::ISOLATE_UNIT_TEST_CASE ( StringEqualsUtf8  )

Definition at line 1598 of file object_test.cc.

1598 {
1599 const char* onesrc = "abc";
1600 const String& onestr = String::Handle(String::New(onesrc));
1601 EXPECT(onestr.IsOneByteString());
1602 EXPECT(!onestr.Equals(""));
1603 EXPECT(!onestr.Equals("a"));
1604 EXPECT(!onestr.Equals("ab"));
1605 EXPECT(onestr.Equals("abc"));
1606 EXPECT(!onestr.Equals("abcd"));
1607
1608 const char* twosrc = "\xD7\x90\xD7\x91\xD7\x92";
1609 const String& twostr = String::Handle(String::New(twosrc));
1610 EXPECT(twostr.IsTwoByteString());
1611 EXPECT(!twostr.Equals(""));
1612 EXPECT(!twostr.Equals("\xD7\x90"));
1613 EXPECT(!twostr.Equals("\xD7\x90\xD7\x91"));
1614 EXPECT(twostr.Equals("\xD7\x90\xD7\x91\xD7\x92"));
1615 EXPECT(!twostr.Equals("\xD7\x90\xD7\x91\xD7\x92\xD7\x93"));
1616
1617 const char* foursrc = "\xF0\x90\x8E\xA0\xF0\x90\x8E\xA1\xF0\x90\x8E\xA2";
1618 const String& fourstr = String::Handle(String::New(foursrc));
1619 EXPECT(fourstr.IsTwoByteString());
1620 EXPECT(!fourstr.Equals(""));
1621 EXPECT(!fourstr.Equals("\xF0\x90\x8E\xA0"));
1622 EXPECT(!fourstr.Equals("\xF0\x90\x8E\xA0\xF0\x90\x8E\xA1"));
1623 EXPECT(fourstr.Equals("\xF0\x90\x8E\xA0\xF0\x90\x8E\xA1\xF0\x90\x8E\xA2"));
1624 EXPECT(
1625 !fourstr.Equals("\xF0\x90\x8E\xA0\xF0\x90\x8E\xA1"
1626 "\xF0\x90\x8E\xA2\xF0\x90\x8E\xA3"));
1627}

◆ ISOLATE_UNIT_TEST_CASE() [392/463]

dart::ISOLATE_UNIT_TEST_CASE ( StringFormat  )

Definition at line 822 of file object_test.cc.

822 {
823 const char* hello_str = "Hello World!";
824 const String& str =
825 String::Handle(String::NewFormatted("Hello %s!", "World"));
826 EXPECT(str.IsInstance());
827 EXPECT(str.IsString());
828 EXPECT(str.IsOneByteString());
829 EXPECT(!str.IsTwoByteString());
830 EXPECT(!str.IsNumber());
831 EXPECT(str.Equals(hello_str));
832}

◆ ISOLATE_UNIT_TEST_CASE() [393/463]

dart::ISOLATE_UNIT_TEST_CASE ( StringFromUtf8Literal  )

Definition at line 1439 of file object_test.cc.

1439 {
1440 // Create a 1-byte string from a UTF-8 encoded string literal.
1441 {
1442 const char* src =
1443 "\xC2\xA0\xC2\xA1\xC2\xA2\xC2\xA3"
1444 "\xC2\xA4\xC2\xA5\xC2\xA6\xC2\xA7"
1445 "\xC2\xA8\xC2\xA9\xC2\xAA\xC2\xAB"
1446 "\xC2\xAC\xC2\xAD\xC2\xAE\xC2\xAF"
1447 "\xC2\xB0\xC2\xB1\xC2\xB2\xC2\xB3"
1448 "\xC2\xB4\xC2\xB5\xC2\xB6\xC2\xB7"
1449 "\xC2\xB8\xC2\xB9\xC2\xBA\xC2\xBB"
1450 "\xC2\xBC\xC2\xBD\xC2\xBE\xC2\xBF"
1451 "\xC3\x80\xC3\x81\xC3\x82\xC3\x83"
1452 "\xC3\x84\xC3\x85\xC3\x86\xC3\x87"
1453 "\xC3\x88\xC3\x89\xC3\x8A\xC3\x8B"
1454 "\xC3\x8C\xC3\x8D\xC3\x8E\xC3\x8F"
1455 "\xC3\x90\xC3\x91\xC3\x92\xC3\x93"
1456 "\xC3\x94\xC3\x95\xC3\x96\xC3\x97"
1457 "\xC3\x98\xC3\x99\xC3\x9A\xC3\x9B"
1458 "\xC3\x9C\xC3\x9D\xC3\x9E\xC3\x9F"
1459 "\xC3\xA0\xC3\xA1\xC3\xA2\xC3\xA3"
1460 "\xC3\xA4\xC3\xA5\xC3\xA6\xC3\xA7"
1461 "\xC3\xA8\xC3\xA9\xC3\xAA\xC3\xAB"
1462 "\xC3\xAC\xC3\xAD\xC3\xAE\xC3\xAF"
1463 "\xC3\xB0\xC3\xB1\xC3\xB2\xC3\xB3"
1464 "\xC3\xB4\xC3\xB5\xC3\xB6\xC3\xB7"
1465 "\xC3\xB8\xC3\xB9\xC3\xBA\xC3\xBB"
1466 "\xC3\xBC\xC3\xBD\xC3\xBE\xC3\xBF";
1467 const uint8_t expected[] = {
1468 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xAB,
1469 0xAC, 0xAD, 0xAE, 0xAF, 0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7,
1470 0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF, 0xC0, 0xC1, 0xC2, 0xC3,
1471 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF,
1472 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xDB,
1473 0xDC, 0xDD, 0xDE, 0xDF, 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7,
1474 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF, 0xF0, 0xF1, 0xF2, 0xF3,
1475 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF,
1476 };
1477 const String& str = String::Handle(String::New(src));
1478 EXPECT(str.IsOneByteString());
1479 intptr_t expected_length = sizeof(expected);
1480 EXPECT_EQ(expected_length, str.Length());
1481 for (int i = 0; i < str.Length(); ++i) {
1482 EXPECT_EQ(expected[i], str.CharAt(i));
1483 }
1484 }
1485
1486 // Create a 2-byte string from a UTF-8 encoded string literal.
1487 {
1488 const char* src =
1489 "\xD7\x92\xD7\x9C\xD7\xA2\xD7\x93"
1490 "\xD7\x91\xD7\xA8\xD7\x9B\xD7\x94";
1491 const uint16_t expected[] = {0x5D2, 0x5DC, 0x5E2, 0x5D3,
1492 0x5D1, 0x5E8, 0x5DB, 0x5D4};
1493 const String& str = String::Handle(String::New(src));
1494 EXPECT(str.IsTwoByteString());
1495 intptr_t expected_size = sizeof(expected) / sizeof(expected[0]);
1496 EXPECT_EQ(expected_size, str.Length());
1497 for (int i = 0; i < str.Length(); ++i) {
1498 EXPECT_EQ(expected[i], str.CharAt(i));
1499 }
1500 }
1501
1502 // Create a BMP 2-byte string from UTF-8 encoded 1- and 2-byte
1503 // characters.
1504 {
1505 const char* src =
1506 "\x0A\x0B\x0D\x0C\x0E\x0F\xC2\xA0"
1507 "\xC2\xB0\xC3\x80\xC3\x90\xC3\xA0"
1508 "\xC3\xB0\xE0\xA8\x80\xE0\xAC\x80"
1509 "\xE0\xB0\x80\xE0\xB4\x80\xE0\xB8"
1510 "\x80\xE0\xBC\x80\xEA\x80\x80\xEB"
1511 "\x80\x80\xEC\x80\x80\xED\x80\x80"
1512 "\xEE\x80\x80\xEF\x80\x80";
1513 const intptr_t expected[] = {
1514 0x000A, 0x000B, 0x000D, 0x000C, 0x000E, 0x000F, 0x00A0, 0x00B0,
1515 0x00C0, 0x00D0, 0x00E0, 0x00F0, 0x0A00, 0x0B00, 0x0C00, 0x0D00,
1516 0x0E00, 0x0F00, 0xA000, 0xB000, 0xC000, 0xD000, 0xE000, 0xF000};
1517 const String& str = String::Handle(String::New(src));
1518 EXPECT(str.IsTwoByteString());
1519 intptr_t expected_size = sizeof(expected) / sizeof(expected[0]);
1520 EXPECT_EQ(expected_size, str.Length());
1521 for (int i = 0; i < str.Length(); ++i) {
1522 EXPECT_EQ(expected[i], str.CharAt(i));
1523 }
1524 }
1525
1526 // Create a 2-byte string with supplementary characters from a UTF-8
1527 // string literal.
1528 {
1529 const char* src =
1530 "\xF0\x9D\x91\xA0\xF0\x9D\x91\xA1"
1531 "\xF0\x9D\x91\xA2\xF0\x9D\x91\xA3";
1532 const intptr_t expected[] = {0xd835, 0xdc60, 0xd835, 0xdc61,
1533 0xd835, 0xdc62, 0xd835, 0xdc63};
1534 const String& str = String::Handle(String::New(src));
1535 EXPECT(str.IsTwoByteString());
1536 intptr_t expected_size = (sizeof(expected) / sizeof(expected[0]));
1537 EXPECT_EQ(expected_size, str.Length());
1538 for (int i = 0; i < str.Length(); ++i) {
1539 EXPECT_EQ(expected[i], str.CharAt(i));
1540 }
1541 }
1542
1543 // Create a 2-byte string from UTF-8 encoded 2- and 4-byte
1544 // characters.
1545 {
1546 const char* src =
1547 "\xE0\xA8\x80\xE0\xAC\x80\xE0\xB0"
1548 "\x80\xE0\xB4\x80\xE0\xB8\x80\xE0"
1549 "\xBC\x80\xEA\x80\x80\xEB\x80\x80"
1550 "\xEC\x80\x80\xED\x80\x80\xEE\x80"
1551 "\x80\xEF\x80\x80\xF0\x9A\x80\x80"
1552 "\xF0\x9B\x80\x80\xF0\x9D\x80\x80"
1553 "\xF0\x9E\x80\x80\xF0\x9F\x80\x80";
1554 const intptr_t expected[] = {
1555 0x0A00, 0x0B00, 0x0C00, 0x0D00, 0x0E00, 0x0F00, 0xA000, 0xB000,
1556 0xC000, 0xD000, 0xE000, 0xF000, 0xD828, 0xDC00, 0xD82c, 0xDC00,
1557 0xD834, 0xDC00, 0xD838, 0xDC00, 0xD83c, 0xDC00,
1558 };
1559 const String& str = String::Handle(String::New(src));
1560 EXPECT(str.IsTwoByteString());
1561 intptr_t expected_size = sizeof(expected) / sizeof(expected[0]);
1562 EXPECT_EQ(expected_size, str.Length());
1563 for (int i = 0; i < str.Length(); ++i) {
1564 EXPECT_EQ(expected[i], str.CharAt(i));
1565 }
1566 }
1567
1568 // Create a 2-byte string from UTF-8 encoded 1-, 2- and 4-byte
1569 // characters.
1570 {
1571 const char* src =
1572 "\x0A\x0B\x0D\x0C\x0E\x0F\xC2\xA0"
1573 "\xC2\xB0\xC3\x80\xC3\x90\xC3\xA0"
1574 "\xC3\xB0\xE0\xA8\x80\xE0\xAC\x80"
1575 "\xE0\xB0\x80\xE0\xB4\x80\xE0\xB8"
1576 "\x80\xE0\xBC\x80\xEA\x80\x80\xEB"
1577 "\x80\x80\xEC\x80\x80\xED\x80\x80"
1578 "\xEE\x80\x80\xEF\x80\x80\xF0\x9A"
1579 "\x80\x80\xF0\x9B\x80\x80\xF0\x9D"
1580 "\x80\x80\xF0\x9E\x80\x80\xF0\x9F"
1581 "\x80\x80";
1582 const intptr_t expected[] = {
1583 0x000A, 0x000B, 0x000D, 0x000C, 0x000E, 0x000F, 0x00A0, 0x00B0, 0x00C0,
1584 0x00D0, 0x00E0, 0x00F0, 0x0A00, 0x0B00, 0x0C00, 0x0D00, 0x0E00, 0x0F00,
1585 0xA000, 0xB000, 0xC000, 0xD000, 0xE000, 0xF000, 0xD828, 0xDC00, 0xD82c,
1586 0xDC00, 0xD834, 0xDC00, 0xD838, 0xDC00, 0xD83c, 0xDC00,
1587 };
1588 const String& str = String::Handle(String::New(src));
1589 EXPECT(str.IsTwoByteString());
1590 intptr_t expected_size = sizeof(expected) / sizeof(expected[0]);
1591 EXPECT_EQ(expected_size, str.Length());
1592 for (int i = 0; i < str.Length(); ++i) {
1593 EXPECT_EQ(expected[i], str.CharAt(i));
1594 }
1595 }
1596}

◆ ISOLATE_UNIT_TEST_CASE() [394/463]

dart::ISOLATE_UNIT_TEST_CASE ( StringHashConcat  )

Definition at line 1364 of file object_test.cc.

1364 {
1365 EXPECT_EQ(String::Handle(String::New("onebyte")).Hash(),
1366 String::HashConcat(String::Handle(String::New("one")),
1367 String::Handle(String::New("byte"))));
1368 uint16_t clef_utf16[] = {0xD834, 0xDD1E};
1369 const String& clef = String::Handle(String::FromUTF16(clef_utf16, 2));
1370 int32_t clef_utf32[] = {0x1D11E};
1371 EXPECT(clef.Equals(clef_utf32, 1));
1372 uword hash32 = String::Hash(String::FromUTF32(clef_utf32, 1));
1373 EXPECT_EQ(hash32, clef.Hash());
1374 EXPECT_EQ(hash32, String::HashConcat(
1375 String::Handle(String::FromUTF16(clef_utf16, 1)),
1376 String::Handle(String::FromUTF16(clef_utf16 + 1, 1))));
1377}

◆ ISOLATE_UNIT_TEST_CASE() [395/463]

dart::ISOLATE_UNIT_TEST_CASE ( StringIRITwoByte  )

Definition at line 498 of file object_test.cc.

498 {
499 const intptr_t kInputLen = 3;
500 const uint16_t kInput[kInputLen] = {'x', '/', 256};
501 const String& input = String::Handle(String::FromUTF16(kInput, kInputLen));
502 const intptr_t kOutputLen = 10;
503 const uint16_t kOutput[kOutputLen] = {'x', '%', '2', 'F', '%',
504 'C', '4', '%', '8', '0'};
505 const String& output = String::Handle(String::FromUTF16(kOutput, kOutputLen));
506 const String& encoded = String::Handle(String::New(String::EncodeIRI(input)));
507 EXPECT(output.Equals(encoded));
508 const String& decoded = String::Handle(String::DecodeIRI(output));
509 EXPECT(input.Equals(decoded));
510}

◆ ISOLATE_UNIT_TEST_CASE() [396/463]

dart::ISOLATE_UNIT_TEST_CASE ( StringSubStringDifferentWidth  )

Definition at line 1379 of file object_test.cc.

1379 {
1380 // Create 1-byte substring from a 1-byte source string.
1381 const char* onechars = "\xC3\xB6\xC3\xB1\xC3\xA9";
1382
1383 const String& onestr = String::Handle(String::New(onechars));
1384 EXPECT(!onestr.IsNull());
1385 EXPECT(onestr.IsOneByteString());
1386 EXPECT(!onestr.IsTwoByteString());
1387
1388 const String& onesub = String::Handle(String::SubString(onestr, 0));
1389 EXPECT(!onesub.IsNull());
1390 EXPECT(onestr.IsOneByteString());
1391 EXPECT(!onestr.IsTwoByteString());
1392 EXPECT_EQ(onesub.Length(), 3);
1393
1394 // Create 1- and 2-byte substrings from a 2-byte source string.
1395 const char* twochars =
1396 "\x1f\x2f\x3f"
1397 "\xE1\xB9\xAB\xE1\xBA\x85\xE1\xB9\x93";
1398
1399 const String& twostr = String::Handle(String::New(twochars));
1400 EXPECT(!twostr.IsNull());
1401 EXPECT(twostr.IsTwoByteString());
1402
1403 const String& twosub1 = String::Handle(String::SubString(twostr, 0, 3));
1404 EXPECT(!twosub1.IsNull());
1405 EXPECT(twosub1.IsOneByteString());
1406 EXPECT_EQ(twosub1.Length(), 3);
1407
1408 const String& twosub2 = String::Handle(String::SubString(twostr, 3));
1409 EXPECT(!twosub2.IsNull());
1410 EXPECT(twosub2.IsTwoByteString());
1411 EXPECT_EQ(twosub2.Length(), 3);
1412
1413 // Create substrings from a string built using 1-, 2- and 4-byte elements.
1414 const char* fourchars =
1415 "\x1f\x2f\x3f"
1416 "\xE1\xB9\xAB\xE1\xBA\x85\xE1\xB9\x93"
1417 "\xF0\x9D\x96\xBF\xF0\x9D\x97\x88\xF0\x9D\x97\x8E\xF0\x9D\x97\x8B";
1418
1419 const String& fourstr = String::Handle(String::New(fourchars));
1420 EXPECT(!fourstr.IsNull());
1421 EXPECT(fourstr.IsTwoByteString());
1422
1423 const String& foursub1 = String::Handle(String::SubString(fourstr, 0, 3));
1424 EXPECT(!foursub1.IsNull());
1425 EXPECT(foursub1.IsOneByteString());
1426 EXPECT_EQ(foursub1.Length(), 3);
1427
1428 const String& foursub2 = String::Handle(String::SubString(fourstr, 3, 3));
1429 EXPECT(!foursub2.IsNull());
1430 EXPECT(foursub2.IsTwoByteString());
1431 EXPECT_EQ(foursub2.Length(), 3);
1432
1433 const String& foursub4 = String::Handle(String::SubString(fourstr, 6));
1434 EXPECT_EQ(foursub4.Length(), 8);
1435 EXPECT(!foursub4.IsNull());
1436 EXPECT(foursub4.IsTwoByteString());
1437}

◆ ISOLATE_UNIT_TEST_CASE() [397/463]

dart::ISOLATE_UNIT_TEST_CASE ( SubtypeTestCache  )

Definition at line 3103 of file object_test.cc.

3103 {
3104 SafepointMutexLocker ml(thread->isolate_group()->subtype_test_cache_mutex());
3105
3106 String& class1_name = String::Handle(Symbols::New(thread, "EmptyClass1"));
3107 Script& script = Script::Handle();
3108 const Class& empty_class1 =
3109 Class::Handle(CreateDummyClass(class1_name, script));
3110 String& class2_name = String::Handle(Symbols::New(thread, "EmptyClass2"));
3111 const Class& empty_class2 =
3112 Class::Handle(CreateDummyClass(class2_name, script));
3113 SubtypeTestCache& cache = SubtypeTestCache::Handle(
3114 SubtypeTestCache::New(SubtypeTestCache::kMaxInputs));
3115 EXPECT(!cache.IsNull());
3116 EXPECT_EQ(0, cache.NumberOfChecks());
3117 const Object& class_id_or_fun = Object::Handle(Smi::New(empty_class1.id()));
3118 const AbstractType& dest_type =
3119 AbstractType::Handle(Type::NewNonParameterizedType(empty_class2));
3120 const TypeArguments& targ_0 = TypeArguments::Handle(TypeArguments::New(2));
3121 const TypeArguments& targ_1 = TypeArguments::Handle(TypeArguments::New(3));
3122 const TypeArguments& targ_2 = TypeArguments::Handle(TypeArguments::New(4));
3123 const TypeArguments& targ_3 = TypeArguments::Handle(TypeArguments::New(5));
3124 const TypeArguments& targ_4 = TypeArguments::Handle(TypeArguments::New(6));
3125 cache.AddCheck(class_id_or_fun, dest_type, targ_0, targ_1, targ_2, targ_3,
3126 targ_4, Bool::True());
3127 EXPECT_EQ(1, cache.NumberOfChecks());
3128 Object& test_class_id_or_fun = Object::Handle();
3129 AbstractType& test_dest_type = AbstractType::Handle();
3130 TypeArguments& test_targ_0 = TypeArguments::Handle();
3131 TypeArguments& test_targ_1 = TypeArguments::Handle();
3132 TypeArguments& test_targ_2 = TypeArguments::Handle();
3133 TypeArguments& test_targ_3 = TypeArguments::Handle();
3134 TypeArguments& test_targ_4 = TypeArguments::Handle();
3135 Bool& test_result = Bool::Handle();
3136 cache.GetCheck(0, &test_class_id_or_fun, &test_dest_type, &test_targ_0,
3137 &test_targ_1, &test_targ_2, &test_targ_3, &test_targ_4,
3138 &test_result);
3139 EXPECT_EQ(class_id_or_fun.ptr(), test_class_id_or_fun.ptr());
3140 EXPECT_EQ(dest_type.ptr(), test_dest_type.ptr());
3141 EXPECT_EQ(targ_0.ptr(), test_targ_0.ptr());
3142 EXPECT_EQ(targ_1.ptr(), test_targ_1.ptr());
3143 EXPECT_EQ(targ_2.ptr(), test_targ_2.ptr());
3144 EXPECT_EQ(targ_3.ptr(), test_targ_3.ptr());
3145 EXPECT_EQ(targ_4.ptr(), test_targ_4.ptr());
3146 EXPECT_EQ(Bool::True().ptr(), test_result.ptr());
3147}

◆ ISOLATE_UNIT_TEST_CASE() [398/463]

dart::ISOLATE_UNIT_TEST_CASE ( Symbol  )

Definition at line 1686 of file object_test.cc.

1686 {
1687 const String& one = String::Handle(Symbols::New(thread, "Eins"));
1688 EXPECT(one.IsSymbol());
1689 const String& two = String::Handle(Symbols::New(thread, "Zwei"));
1690 const String& three = String::Handle(Symbols::New(thread, "Drei"));
1691 const String& four = String::Handle(Symbols::New(thread, "Vier"));
1692 const String& five = String::Handle(Symbols::New(thread, "Fuenf"));
1693 const String& six = String::Handle(Symbols::New(thread, "Sechs"));
1694 const String& seven = String::Handle(Symbols::New(thread, "Sieben"));
1695 const String& eight = String::Handle(Symbols::New(thread, "Acht"));
1696 const String& nine = String::Handle(Symbols::New(thread, "Neun"));
1697 const String& ten = String::Handle(Symbols::New(thread, "Zehn"));
1698 String& eins = String::Handle(Symbols::New(thread, "Eins"));
1699 EXPECT_EQ(one.ptr(), eins.ptr());
1700 EXPECT(one.ptr() != two.ptr());
1701 EXPECT(two.Equals(String::Handle(String::New("Zwei"))));
1702 EXPECT_EQ(two.ptr(), Symbols::New(thread, "Zwei"));
1703 EXPECT_EQ(three.ptr(), Symbols::New(thread, "Drei"));
1704 EXPECT_EQ(four.ptr(), Symbols::New(thread, "Vier"));
1705 EXPECT_EQ(five.ptr(), Symbols::New(thread, "Fuenf"));
1706 EXPECT_EQ(six.ptr(), Symbols::New(thread, "Sechs"));
1707 EXPECT_EQ(seven.ptr(), Symbols::New(thread, "Sieben"));
1708 EXPECT_EQ(eight.ptr(), Symbols::New(thread, "Acht"));
1709 EXPECT_EQ(nine.ptr(), Symbols::New(thread, "Neun"));
1710 EXPECT_EQ(ten.ptr(), Symbols::New(thread, "Zehn"));
1711
1712 // Make sure to cause symbol table overflow.
1713 for (int i = 0; i < 1024; i++) {
1714 char buf[256];
1715 Utils::SNPrint(buf, sizeof(buf), "%d", i);
1716 Symbols::New(thread, buf);
1717 }
1718 eins = Symbols::New(thread, "Eins");
1719 EXPECT_EQ(one.ptr(), eins.ptr());
1720 EXPECT_EQ(two.ptr(), Symbols::New(thread, "Zwei"));
1721 EXPECT_EQ(three.ptr(), Symbols::New(thread, "Drei"));
1722 EXPECT_EQ(four.ptr(), Symbols::New(thread, "Vier"));
1723 EXPECT_EQ(five.ptr(), Symbols::New(thread, "Fuenf"));
1724 EXPECT_EQ(six.ptr(), Symbols::New(thread, "Sechs"));
1725 EXPECT_EQ(seven.ptr(), Symbols::New(thread, "Sieben"));
1726 EXPECT_EQ(eight.ptr(), Symbols::New(thread, "Acht"));
1727 EXPECT_EQ(nine.ptr(), Symbols::New(thread, "Neun"));
1728 EXPECT_EQ(ten.ptr(), Symbols::New(thread, "Zehn"));
1729
1730 // Symbols from Strings.
1731 eins = String::New("Eins");
1732 EXPECT(!eins.IsSymbol());
1733 String& ein_symbol = String::Handle(Symbols::New(thread, eins));
1734 EXPECT_EQ(one.ptr(), ein_symbol.ptr());
1735 EXPECT(one.ptr() != eins.ptr());
1736
1737 uint16_t char16[] = {'E', 'l', 'f'};
1738 String& elf1 = String::Handle(Symbols::FromUTF16(thread, char16, 3));
1739 int32_t char32[] = {'E', 'l', 'f'};
1740 String& elf2 = String::Handle(
1741 Symbols::New(thread, String::Handle(String::FromUTF32(char32, 3))));
1742 EXPECT(elf1.IsSymbol());
1743 EXPECT(elf2.IsSymbol());
1744 EXPECT_EQ(elf1.ptr(), Symbols::New(thread, "Elf"));
1745 EXPECT_EQ(elf2.ptr(), Symbols::New(thread, "Elf"));
1746}
bool IsSymbol() const
Definition object.h:10288

◆ ISOLATE_UNIT_TEST_CASE() [399/463]

dart::ISOLATE_UNIT_TEST_CASE ( Symbols_FromConcatAll  )

Definition at line 7308 of file object_test.cc.

7309 {
7310 pieces.Add(*data[i]);
7311 array.SetAt(i, *data[i]);
7312 }
7313 const String& res1 =
7314 String::Handle(zone, Symbols::FromConcatAll(thread, pieces));
7315 const String& res2 = String::Handle(zone, String::ConcatAll(array));
7316 EXPECT(res1.Equals(res2));
7317}
7318
7319ISOLATE_UNIT_TEST_CASE(Symbols_FromConcatAll) {
7320 {
7321 const String* data[3] = {&Symbols::TypeError(), &Symbols::Dot(),
7322 &Symbols::isPaused()};
7323 CheckConcatAll(data, 3);
7324 }
7325
7326 {
7327 const intptr_t kWideCharsLen = 7;
7328 uint16_t wide_chars[kWideCharsLen] = {'H', 'e', 'l', 'l', 'o', 256, '!'};
7329 const String& two_str =
7330 String::Handle(String::FromUTF16(wide_chars, kWideCharsLen));
7331
static void CheckConcatAll(const String *data[], intptr_t n)

◆ ISOLATE_UNIT_TEST_CASE() [400/463]

dart::ISOLATE_UNIT_TEST_CASE ( SymbolUnicode  )

Definition at line 1748 of file object_test.cc.

1748 {
1749 uint16_t monkey_utf16[] = {0xd83d, 0xdc35}; // Unicode Monkey Face.
1750 String& monkey = String::Handle(Symbols::FromUTF16(thread, monkey_utf16, 2));
1751 EXPECT(monkey.IsSymbol());
1752 const char monkey_utf8[] = {'\xf0', '\x9f', '\x90', '\xb5', 0};
1753 EXPECT_EQ(monkey.ptr(), Symbols::New(thread, monkey_utf8));
1754
1755 int32_t kMonkeyFace = 0x1f435;
1756 String& monkey2 = String::Handle(
1757 Symbols::New(thread, String::Handle(String::FromUTF32(&kMonkeyFace, 1))));
1758 EXPECT_EQ(monkey.ptr(), monkey2.ptr());
1759
1760 // Unicode cat face with tears of joy.
1761 int32_t kCatFaceWithTearsOfJoy = 0x1f639;
1762 String& cat = String::Handle(Symbols::New(
1763 thread, String::Handle(String::FromUTF32(&kCatFaceWithTearsOfJoy, 1))));
1764
1765 uint16_t cat_utf16[] = {0xd83d, 0xde39};
1766 String& cat2 = String::Handle(Symbols::FromUTF16(thread, cat_utf16, 2));
1767 EXPECT(cat2.IsSymbol());
1768 EXPECT_EQ(cat2.ptr(), cat.ptr());
1769}

◆ ISOLATE_UNIT_TEST_CASE() [401/463]

dart::ISOLATE_UNIT_TEST_CASE ( ThreadIterator_Count  )

Definition at line 701 of file thread_test.cc.

701 {
702 intptr_t thread_count_0 = 0;
703 intptr_t thread_count_1 = 0;
704
705 {
707 while (ti.HasNext()) {
708 OSThread* thread = ti.Next();
709 EXPECT(thread != nullptr);
710 thread_count_0++;
711 }
712 }
713
714 {
715 OSThreadIterator ti;
716 while (ti.HasNext()) {
717 OSThread* thread = ti.Next();
718 EXPECT(thread != nullptr);
719 thread_count_1++;
720 }
721 }
722
723 EXPECT(thread_count_0 > 0);
724 EXPECT(thread_count_1 > 0);
725 EXPECT(thread_count_0 >= thread_count_1);
726}

◆ ISOLATE_UNIT_TEST_CASE() [402/463]

dart::ISOLATE_UNIT_TEST_CASE ( ThreadIterator_FindSelf  )

Definition at line 728 of file thread_test.cc.

728 {
729 OSThread* current = OSThread::Current();
730 EXPECT(OSThread::IsThreadInList(current->id()));
731}
ThreadId id() const
Definition os_thread.h:96

◆ ISOLATE_UNIT_TEST_CASE() [403/463]

dart::ISOLATE_UNIT_TEST_CASE ( ToCString  )

Definition at line 5874 of file object_test.cc.

5875 {
5876 return;
5877 }
5878 objects_->Add(&handle);
5879 }
5880
5881 private:
5882 GrowableArray<Object*>* objects_;
5883};
5884
5885ISOLATE_UNIT_TEST_CASE(ToCString) {
5886 // Set native resolvers in case we need to read native methods.
5887 {
5888 TransitionVMToNative transition(thread);
5889 bin::Builtin::SetNativeResolver(bin::Builtin::kBuiltinLibrary);
5890 bin::Builtin::SetNativeResolver(bin::Builtin::kIOLibrary);
5891 bin::Builtin::SetNativeResolver(bin::Builtin::kCLILibrary);
5892 bin::VmService::SetNativeResolver();
5893 }
5894
5895 GCTestHelper::CollectAllGarbage();
5896 GrowableArray<Object*> objects;
5897 {
5898 HeapIterationScope iteration(Thread::Current());
5899 ObjectAccumulator acc(&objects);
5900 iteration.IterateObjects(&acc);

◆ ISOLATE_UNIT_TEST_CASE() [404/463]

dart::ISOLATE_UNIT_TEST_CASE ( TryCatchOptimizer_DeadParameterElimination_Cyclic1  )

Definition at line 172 of file redundancy_elimination_test.cc.

172 {
173 const char* script_chars = R"(
174 @pragma("vm:external-name", "BlackholeNative")
175 external dynamic blackhole([dynamic val]);
176 foo(int p) {
177 var a = blackhole(), b;
178 for (var i = 0; i < 42; i++) {
179 b = blackhole();
180 try {
181 blackhole([a, b]);
182 } catch (e) {
183 // a and i should be synchronized
184 }
185 }
186 }
187 main() {
188 foo(42);
189 }
190 )";
191
192 TryCatchOptimizerTest(thread, script_chars, /*synchronized=*/{"a", "i"});
193}
static void TryCatchOptimizerTest(Thread *thread, const char *script_chars, std::initializer_list< const char * > synchronized)

◆ ISOLATE_UNIT_TEST_CASE() [405/463]

dart::ISOLATE_UNIT_TEST_CASE ( TryCatchOptimizer_DeadParameterElimination_Cyclic2  )

Definition at line 195 of file redundancy_elimination_test.cc.

195 {
196 const char* script_chars = R"(
197 @pragma("vm:external-name", "BlackholeNative")
198 external dynamic blackhole([dynamic val]);
199 foo(int p) {
200 var a = blackhole(), b = blackhole();
201 for (var i = 0; i < 42; i++) {
202 try {
203 blackhole([a, b]);
204 } catch (e) {
205 // a, b and i should be synchronized
206 }
207 }
208 }
209 main() {
210 foo(42);
211 }
212 )";
213
214 TryCatchOptimizerTest(thread, script_chars, /*synchronized=*/{"a", "b", "i"});
215}

◆ ISOLATE_UNIT_TEST_CASE() [406/463]

dart::ISOLATE_UNIT_TEST_CASE ( TryCatchOptimizer_DeadParameterElimination_Simple1  )

Definition at line 131 of file redundancy_elimination_test.cc.

131 {
132 const char* script_chars = R"(
133 @pragma("vm:external-name", "BlackholeNative")
134 external dynamic blackhole([dynamic val]);
135 foo(int p) {
136 var a = blackhole(), b = blackhole();
137 try {
138 blackhole([a, b]);
139 } catch (e) {
140 // nothing is used
141 }
142 }
143 main() {
144 foo(42);
145 }
146 )";
147
148 TryCatchOptimizerTest(thread, script_chars, /*synchronized=*/{});
149}

◆ ISOLATE_UNIT_TEST_CASE() [407/463]

dart::ISOLATE_UNIT_TEST_CASE ( TryCatchOptimizer_DeadParameterElimination_Simple2  )

Definition at line 151 of file redundancy_elimination_test.cc.

151 {
152 const char* script_chars = R"(
153 @pragma("vm:external-name", "BlackholeNative")
154 external dynamic blackhole([dynamic val]);
155 foo(int p) {
156 var a = blackhole(), b = blackhole();
157 try {
158 blackhole([a, b]);
159 } catch (e) {
160 // a should be synchronized
161 blackhole(a);
162 }
163 }
164 main() {
165 foo(42);
166 }
167 )";
168
169 TryCatchOptimizerTest(thread, script_chars, /*synchronized=*/{"a"});
170}

◆ ISOLATE_UNIT_TEST_CASE() [408/463]

dart::ISOLATE_UNIT_TEST_CASE ( TTS_Double  )

Definition at line 1878 of file type_testing_stubs_test.cc.

1882 {Smi::Handle(Smi::New(0)), tav_null, tav_null});
1883 RunTTSTest(type_int,
1884 {Integer::Handle(Integer::New(kMaxInt64)), tav_null, tav_null});
1885 RunTTSTest(type_int,
1886 Failure({Double::Handle(Double::New(1.0)), tav_null, tav_null}));
1887 RunTTSTest(type_int, Failure({Symbols::Empty(), tav_null, tav_null}));
1888 RunTTSTest(type_int,
1889 Failure({Array::Handle(Array::New(1)), tav_null, tav_null}));
1890}
static void RunTTSTest(const AbstractType &dst_type, const TTSTestCase &test_case, bool should_specialize=true)
static TTSTestCase Failure(const TTSTestCase &original)

◆ ISOLATE_UNIT_TEST_CASE() [409/463]

dart::ISOLATE_UNIT_TEST_CASE ( TTS_Function  )

Definition at line 1919 of file type_testing_stubs_test.cc.

1919 {Array::Handle(Array::New(1)), tav_null, tav_null}));
1920}
1921
1922// Check that we generate correct TTS for Object type.
1923ISOLATE_UNIT_TEST_CASE(TTS_Object) {
1924 const auto& type_obj =
1925 Type::Handle(IsolateGroup::Current()->object_store()->object_type());
1926 const auto& tav_null = Object::null_type_arguments();
1927
1928 // Non-nullable Object is not a top type,
1929 // so its TTS specializes the first time it is invoked.
1930 const bool should_specialize = true;
1931 auto make_test_case = [&](const Instance& instance) -> TTSTestCase {
1932 return {instance, tav_null, tav_null};
1933 };
1934
1935 // Test on some easy-to-make instances.
1936 RunTTSTest(type_obj, make_test_case(Smi::Handle(Smi::New(0))),
1937 should_specialize);
1938 RunTTSTest(type_obj, make_test_case(Integer::Handle(Integer::New(kMaxInt64))),
1939 should_specialize);
1940 RunTTSTest(type_obj, make_test_case(Double::Handle(Double::New(1.0))),
1941 should_specialize);
1942 RunTTSTest(type_obj, make_test_case(Symbols::Empty()), should_specialize);
1943 RunTTSTest(type_obj, make_test_case(Array::Handle(Array::New(1))),
1944 should_specialize);
1945}
1946
1947// Check that we generate correct TTS for type Function (the non-FunctionType
1948// version).

◆ ISOLATE_UNIT_TEST_CASE() [410/463]

dart::ISOLATE_UNIT_TEST_CASE ( TTS_Future  )

Definition at line 1317 of file type_testing_stubs_test.cc.

1319 {obj_b_int, tav_string, tav_null}));
1320}
1321
1322ISOLATE_UNIT_TEST_CASE(TTS_Future) {
1323 const char* kScript =
1324 R"(
1325 import "dart:async";
1326
1327 Future<int> createFutureInt() async => 3;
1328 Future<int Function()> createFutureFunction() async => () => 3;
1329 Future<int Function()?> createFutureNullableFunction() async =>
1330 (() => 3) as int Function()?;
1331)";
1332
1334
1335 const auto& class_future =
1336 Class::Handle(IsolateGroup::Current()->object_store()->future_class());
1337
1338 const auto& root_library = Library::Handle(LoadTestScript(kScript));
1339 const auto& class_closure =
1340 Class::Handle(IsolateGroup::Current()->object_store()->closure_class());
1341 const auto& obj_futureint =
1342 Object::Handle(Invoke(root_library, "createFutureInt"));
1343 const auto& obj_futurefunction =
1344 Object::Handle(Invoke(root_library, "createFutureFunction"));
1345 const auto& obj_futurenullablefunction =
1346 Object::Handle(Invoke(root_library, "createFutureNullableFunction"));
1347
1348 const auto& tav_null = Object::null_type_arguments();
1349 const auto& type_object = Type::Handle(
1350 IsolateGroup::Current()->object_store()->non_nullable_object_type());
1351 const auto& type_legacy_object = Type::Handle(
1352 IsolateGroup::Current()->object_store()->legacy_object_type());
1353 const auto& type_nullable_object = Type::Handle(
1354 IsolateGroup::Current()->object_store()->nullable_object_type());
1355 const auto& type_int = Type::Handle(
1356 IsolateGroup::Current()->object_store()->non_nullable_int_type());
1357
1358 auto& type_string = Type::Handle(Type::StringType());
1359 type_string =
1360 type_string.ToNullability(Nullability::kNonNullable, Heap::kNew);
1361 FinalizeAndCanonicalize(&type_string);
1362 auto& type_num = Type::Handle(Type::Number());
1363 type_num = type_num.ToNullability(Nullability::kNonNullable, Heap::kNew);
1364 FinalizeAndCanonicalize(&type_num);
1365
1366 auto& tav_dynamic = TypeArguments::Handle(TypeArguments::New(1));
1367 tav_dynamic.SetTypeAt(0, Object::dynamic_type());
1368 CanonicalizeTAV(&tav_dynamic);
1369 auto& tav_object = TypeArguments::Handle(TypeArguments::New(1));
1370 tav_object.SetTypeAt(0, type_object);
1371 CanonicalizeTAV(&tav_object);
1372 auto& tav_legacy_object = TypeArguments::Handle(TypeArguments::New(1));
1373 tav_legacy_object.SetTypeAt(0, type_legacy_object);
1374 CanonicalizeTAV(&tav_legacy_object);
1375 auto& tav_nullable_object = TypeArguments::Handle(TypeArguments::New(1));
1376 tav_nullable_object.SetTypeAt(0, type_nullable_object);
1377 CanonicalizeTAV(&tav_nullable_object);
1378 auto& tav_int = TypeArguments::Handle(TypeArguments::New(1));
1379 tav_int.SetTypeAt(0, type_int);
1380 CanonicalizeTAV(&tav_int);
1381 auto& tav_num = TypeArguments::Handle(TypeArguments::New(1));
1382 tav_num.SetTypeAt(0, type_num);
1383 CanonicalizeTAV(&tav_num);
1384 auto& tav_string = TypeArguments::Handle(TypeArguments::New(1));
1385 tav_string.SetTypeAt(0, type_string);
1386 CanonicalizeTAV(&tav_string);
1387
1388 auto& type_future = Type::Handle(
1389 Type::New(class_future, tav_null, Nullability::kNonNullable));
1390 FinalizeAndCanonicalize(&type_future);
1391 auto& type_future_dynamic = Type::Handle(
1392 Type::New(class_future, tav_dynamic, Nullability::kNonNullable));
1393 FinalizeAndCanonicalize(&type_future_dynamic);
1394 auto& type_future_object = Type::Handle(
1395 Type::New(class_future, tav_object, Nullability::kNonNullable));
1396 FinalizeAndCanonicalize(&type_future_object);
1397 auto& type_future_legacy_object = Type::Handle(
1398 Type::New(class_future, tav_legacy_object, Nullability::kNonNullable));
1399 FinalizeAndCanonicalize(&type_future_legacy_object);
1400 auto& type_future_nullable_object = Type::Handle(
1401 Type::New(class_future, tav_nullable_object, Nullability::kNonNullable));
1402 FinalizeAndCanonicalize(&type_future_nullable_object);
1403 auto& type_future_int =
1404 Type::Handle(Type::New(class_future, tav_int, Nullability::kNonNullable));
1405 FinalizeAndCanonicalize(&type_future_int);
1406 auto& type_future_string = Type::Handle(
1407 Type::New(class_future, tav_string, Nullability::kNonNullable));
1408 FinalizeAndCanonicalize(&type_future_string);
1409 auto& type_future_num =
1410 Type::Handle(Type::New(class_future, tav_num, Nullability::kNonNullable));
1411 FinalizeAndCanonicalize(&type_future_num);
1412 const auto& type_future_t = Type::Handle(class_future.DeclarationType());
1413
1414 THR_Print("********************************************************\n");
1415 THR_Print(" Testing Future<int>\n");
1416 THR_Print("********************************************************\n\n");
1417
1418 // Some more tests of generic implemented classes, using Future. Here,
1419 // obj is an object of type Future<int>.
1420 //
1421 // True positives from TTS:
1422 // obj as Future : Null type args
1423 // obj as Future<dynamic> : Canonicalized to same as previous case.
1424 // obj as Future<Object?> : Type arg is top type
1425 // obj as Future<Object*> : Type arg is top type
1426 // obj as Future<Object> : Type arg is certain supertype
1427 // obj as Future<int> : Type arg is the same type
1428 // obj as Future<num> : Type arg is a supertype that can be matched
1429 // with cid range
1430 // obj as Future<X>, : Type arg is a type parameter instantiated with
1431 // X = int : ... the same type
1432 //
1433 RunTTSTest(type_future, {obj_futureint, tav_null, tav_null});
1434 RunTTSTest(type_future_dynamic, {obj_futureint, tav_null, tav_null});
1435 RunTTSTest(type_future_object, {obj_futureint, tav_null, tav_null});
1436 RunTTSTest(type_future_legacy_object, {obj_futureint, tav_null, tav_null});
1437 RunTTSTest(type_future_nullable_object, {obj_futureint, tav_null, tav_null});
1438 RunTTSTest(type_future_int, {obj_futureint, tav_null, tav_null});
1439 RunTTSTest(type_future_num, {obj_futureint, tav_null, tav_null});
1440 RunTTSTest(type_future_t, {obj_futureint, tav_int, tav_null});
1441
1442 // False negatives from TTS (caught by STC/runtime):
1443 // obj as Future<X>, : Type arg is a type parameter instantiated with
1444 // X = num : ... a supertype
1445 RunTTSTest(type_future_t, FalseNegative({obj_futureint, tav_num, tav_null}));
1446
1447 // Errors:
1448 // obj as Future<String> : Type arg is not a supertype
1449 // obj as Future<X>, : Type arg is a type parameter instantiated with
1450 // X = String : ... an unrelated type
1451 //
1452 RunTTSTest(type_future_string, Failure({obj_futureint, tav_null, tav_null}));
1453 RunTTSTest(type_future_t, Failure({obj_futureint, tav_string, tav_null}));
1454
1455 auto& type_function = Type::Handle(Type::DartFunctionType());
1456 type_function =
1457 type_function.ToNullability(Nullability::kNonNullable, Heap::kNew);
1458 FinalizeAndCanonicalize(&type_function);
1459 auto& type_legacy_function = Type::Handle(
1460 type_function.ToNullability(Nullability::kLegacy, Heap::kNew));
1461 FinalizeAndCanonicalize(&type_legacy_function);
1462 auto& type_nullable_function = Type::Handle(
1463 type_function.ToNullability(Nullability::kNullable, Heap::kOld));
1464 FinalizeAndCanonicalize(&type_nullable_function);
1465 auto& type_closure = Type::Handle(
1466 Type::New(class_closure, tav_null, Nullability::kNonNullable));
1467 FinalizeAndCanonicalize(&type_closure);
1468 auto& type_legacy_closure = Type::Handle(
1469 type_closure.ToNullability(Nullability::kLegacy, Heap::kOld));
1470 FinalizeAndCanonicalize(&type_legacy_closure);
1471 auto& type_nullable_closure = Type::Handle(
1472 type_closure.ToNullability(Nullability::kNullable, Heap::kOld));
1473 FinalizeAndCanonicalize(&type_nullable_closure);
1474 auto& type_function_int_nullary =
1475 FunctionType::Handle(FunctionType::New(0, Nullability::kNonNullable));
1476 // Testing with a closure, so it has an implicit parameter, and we want a
1477 // type that is canonically equal to the type of the closure.
1478 type_function_int_nullary.set_num_implicit_parameters(1);
1479 type_function_int_nullary.set_num_fixed_parameters(1);
1480 type_function_int_nullary.set_parameter_types(Array::Handle(Array::New(1)));
1481 type_function_int_nullary.SetParameterTypeAt(0, Type::dynamic_type());
1482 type_function_int_nullary.set_result_type(type_int);
1483 FinalizeAndCanonicalize(&type_function_int_nullary);
1484 auto& type_legacy_function_int_nullary =
1485 FunctionType::Handle(type_function_int_nullary.ToNullability(
1486 Nullability::kLegacy, Heap::kOld));
1487 FinalizeAndCanonicalize(&type_legacy_function_int_nullary);
1488 auto& type_nullable_function_int_nullary =
1489 FunctionType::Handle(type_function_int_nullary.ToNullability(
1490 Nullability::kNullable, Heap::kOld));
1491 FinalizeAndCanonicalize(&type_nullable_function_int_nullary);
1492
1493 auto& tav_function = TypeArguments::Handle(TypeArguments::New(1));
1494 tav_function.SetTypeAt(0, type_function);
1495 CanonicalizeTAV(&tav_function);
1496 auto& tav_legacy_function = TypeArguments::Handle(TypeArguments::New(1));
1497 tav_legacy_function.SetTypeAt(0, type_legacy_function);
1498 CanonicalizeTAV(&tav_legacy_function);
1499 auto& tav_nullable_function = TypeArguments::Handle(TypeArguments::New(1));
1500 tav_nullable_function.SetTypeAt(0, type_nullable_function);
1501 CanonicalizeTAV(&tav_nullable_function);
1502 auto& tav_closure = TypeArguments::Handle(TypeArguments::New(1));
1503 tav_closure.SetTypeAt(0, type_closure);
1504 CanonicalizeTAV(&tav_closure);
1505 auto& tav_legacy_closure = TypeArguments::Handle(TypeArguments::New(1));
1506 tav_legacy_closure.SetTypeAt(0, type_legacy_closure);
1507 CanonicalizeTAV(&tav_legacy_closure);
1508 auto& tav_nullable_closure = TypeArguments::Handle(TypeArguments::New(1));
1509 tav_nullable_closure.SetTypeAt(0, type_nullable_closure);
1510 CanonicalizeTAV(&tav_nullable_closure);
1511 auto& tav_function_int_nullary = TypeArguments::Handle(TypeArguments::New(1));
1512 tav_function_int_nullary.SetTypeAt(0, type_function_int_nullary);
1513 CanonicalizeTAV(&tav_function_int_nullary);
1514 auto& tav_legacy_function_int_nullary =
1515 TypeArguments::Handle(TypeArguments::New(1));
1516 tav_legacy_function_int_nullary.SetTypeAt(0,
1517 type_legacy_function_int_nullary);
1518 CanonicalizeTAV(&tav_legacy_function_int_nullary);
1519 auto& tav_nullable_function_int_nullary =
1520 TypeArguments::Handle(TypeArguments::New(1));
1521 tav_nullable_function_int_nullary.SetTypeAt(
1522 0, type_nullable_function_int_nullary);
1523 CanonicalizeTAV(&tav_nullable_function_int_nullary);
1524
1525 auto& type_future_function = Type::Handle(
1526 Type::New(class_future, tav_function, Nullability::kNonNullable));
1527 FinalizeAndCanonicalize(&type_future_function);
1528 auto& type_future_legacy_function = Type::Handle(
1529 Type::New(class_future, tav_legacy_function, Nullability::kNonNullable));
1530 FinalizeAndCanonicalize(&type_future_legacy_function);
1531 auto& type_future_nullable_function = Type::Handle(Type::New(
1532 class_future, tav_nullable_function, Nullability::kNonNullable));
1533 FinalizeAndCanonicalize(&type_future_nullable_function);
1534 auto& type_future_closure = Type::Handle(
1535 Type::New(class_future, tav_closure, Nullability::kNonNullable));
1536 FinalizeAndCanonicalize(&type_future_closure);
1537 auto& type_future_legacy_closure = Type::Handle(
1538 Type::New(class_future, tav_legacy_closure, Nullability::kNonNullable));
1539 FinalizeAndCanonicalize(&type_future_legacy_closure);
1540 auto& type_future_nullable_closure = Type::Handle(
1541 Type::New(class_future, tav_nullable_closure, Nullability::kNonNullable));
1542 FinalizeAndCanonicalize(&type_future_nullable_closure);
1543 auto& type_future_function_int_nullary =
1544 Type::Handle(Type::New(class_future, tav_function_int_nullary));
1545 FinalizeAndCanonicalize(&type_future_function_int_nullary);
1546 auto& type_future_legacy_function_int_nullary =
1547 Type::Handle(Type::New(class_future, tav_legacy_function_int_nullary));
1548 FinalizeAndCanonicalize(&type_future_legacy_function_int_nullary);
1549 auto& type_future_nullable_function_int_nullary =
1550 Type::Handle(Type::New(class_future, tav_nullable_function_int_nullary));
1551 FinalizeAndCanonicalize(&type_future_nullable_function_int_nullary);
1552
1553 THR_Print("\n********************************************************\n");
1554 THR_Print(" Testing Future<int Function()>\n");
1555 THR_Print("********************************************************\n\n");
1556
1557 // And here, obj is an object of type Future<int Function()>. Note that
1558 // int Function() <: Function, but int Function() </: _Closure. That is,
1559 // _Closure is a separate subtype of Function from FunctionTypes.
1560 //
1561 // True positive from TTS:
1562 // obj as Future : Null type args
1563 // obj as Future<dynamic> : Canonicalized to same as previous case.
1564 // obj as Future<Object?> : Type arg is top type
1565 // obj as Future<Object*> : Type arg is top typ
1566 // obj as Future<Object> : Type arg is certain supertype
1567 // obj as Future<Function?> : Type arg is certain supertype
1568 // obj as Future<Function*> : Type arg is certain supertype
1569 // obj as Future<Function> : Type arg is certain supertype
1570 // obj as Future<X>, : Type arg is a type parameter instantiated with
1571 // X = dynamic : ... a top type
1572 // X = Object? : ... a top type
1573 // X = Object* : ... a top type
1574 // X = Object : ... a certain supertype
1575 // X = int Function() : ... the same type.
1576 //
1577 RunTTSTest(type_future, {obj_futurefunction, tav_null, tav_null});
1578 RunTTSTest(type_future_dynamic, {obj_futurefunction, tav_null, tav_null});
1579 RunTTSTest(type_future_nullable_object,
1580 {obj_futurefunction, tav_null, tav_null});
1581 RunTTSTest(type_future_legacy_object,
1582 {obj_futurefunction, tav_null, tav_null});
1583 RunTTSTest(type_future_object, {obj_futurefunction, tav_null, tav_null});
1584 RunTTSTest(type_future_nullable_object,
1585 {obj_futurefunction, tav_null, tav_null});
1586 RunTTSTest(type_future_legacy_object,
1587 {obj_futurefunction, tav_null, tav_null});
1588 RunTTSTest(type_future_object, {obj_futurefunction, tav_null, tav_null});
1589 RunTTSTest(type_future_nullable_function,
1590 {obj_futurefunction, tav_null, tav_null});
1591 RunTTSTest(type_future_legacy_function,
1592 {obj_futurefunction, tav_null, tav_null});
1593 RunTTSTest(type_future_function, {obj_futurefunction, tav_null, tav_null});
1594 RunTTSTest(type_future_t, {obj_futurefunction, tav_null, tav_null});
1595 RunTTSTest(type_future_t,
1596 {obj_futurefunction, tav_nullable_object, tav_null});
1597 RunTTSTest(type_future_t, {obj_futurefunction, tav_legacy_object, tav_null});
1598 RunTTSTest(type_future_t, {obj_futurefunction, tav_object, tav_null});
1599 RunTTSTest(type_future_t,
1600 {obj_futurefunction, tav_function_int_nullary, tav_null});
1601
1602 // False negative from TTS (caught by runtime or STC):
1603 // obj as Future<int Function()?> : No specialization.
1604 // obj as Future<int Function()*> : No specialization.
1605 // obj as Future<int Function()> : No specialization.
1606 // obj as Future<X>, : Type arg is a type parameter instantiated with
1607 // X = Function? : ... a certain supertype (but not checked)
1608 // X = Function* : ... a certain supertype (but not checked)
1609 // X = Function : ... a certain supertype (but not checked)
1610 // X = int Function()? : ... a canonically different type.
1611 // X = int Function()* : ... a canonically different type.
1612 //
1613 RunTTSTest(type_future_nullable_function_int_nullary,
1614 FalseNegative({obj_futurefunction, tav_null, tav_null}));
1615 RunTTSTest(type_future_legacy_function_int_nullary,
1616 FalseNegative({obj_futurefunction, tav_null, tav_null}));
1617 RunTTSTest(type_future_function_int_nullary,
1618 FalseNegative({obj_futurefunction, tav_null, tav_null}));
1619 RunTTSTest(type_future_t, FalseNegative({obj_futurefunction,
1620 tav_nullable_function, tav_null}));
1621 RunTTSTest(type_future_t, FalseNegative({obj_futurefunction,
1622 tav_legacy_function, tav_null}));
1623 RunTTSTest(type_future_t,
1624 FalseNegative({obj_futurefunction, tav_function, tav_null}));
1625 RunTTSTest(type_future_t,
1626 FalseNegative({obj_futurefunction,
1627 tav_nullable_function_int_nullary, tav_null}));
1628 RunTTSTest(type_future_t,
1629 FalseNegative({obj_futurefunction, tav_legacy_function_int_nullary,
1630 tav_null}));
1631
1632 // Errors:
1633 // obj as Future<_Closure?> : Type arg is not a supertype
1634 // obj as Future<_Closure*> : Type arg is not a supertype
1635 // obj as Future<_Closure> : Type arg is not a supertype
1636 // obj as Future<X>, : Type arg is a type parameter instantiated with
1637 // X = _Closure? : ... an unrelated type.
1638 // X = _Closure* : ... an unrelated type.
1639 // X = _Closure : ... an unrelated type.
1640 //
1641 RunTTSTest(type_future_nullable_closure,
1642 Failure({obj_futurefunction, tav_null, tav_null}));
1643 RunTTSTest(type_future_legacy_closure,
1644 Failure({obj_futurefunction, tav_null, tav_null}));
1645 RunTTSTest(type_future_closure,
1646 Failure({obj_futurefunction, tav_null, tav_null}));
1647 RunTTSTest(type_future_t,
1648 Failure({obj_futurefunction, tav_nullable_closure, tav_null}));
1649 RunTTSTest(type_future_t,
1650 Failure({obj_futurefunction, tav_legacy_closure, tav_null}));
1651 RunTTSTest(type_future_t,
1652 Failure({obj_futurefunction, tav_closure, tav_null}));
1653
1654 THR_Print("\n********************************************************\n");
1655 THR_Print(" Testing Future<int Function()?>\n");
1656 THR_Print("********************************************************\n\n");
1657
1658 // And here, obj is an object of type Future<int Function()?>.
1659 //
1660 // True positive from TTS:
1661 // obj as Future : Null type args
1662 // obj as Future<dynamic> : Canonicalized to same as previous case.
1663 // obj as Future<Object?> : Type arg is top type
1664 // obj as Future<Object*> : Type arg is top typ
1665 // obj as Future<Function?> : Type arg is certain supertype
1666 // obj as Future<Function*> : Type arg is certain supertype
1667 // obj as Future<X>, : Type arg is a type parameter instantiated with
1668 // X = dynamic : ... a top type
1669 // X = Object? : ... a top type
1670 // X = Object* : ... a top type
1671 // X = int Function()? : ... the same type.
1672 //
1673 // If not null safe:
1674 // obj as Future<Object> : Type arg is certain supertype
1675 // obj as Future<Function> : Type arg is certain supertype
1676 // obj as Future<X>, : Type arg is a type parameter instantiated with
1677 // X = Object : ... a certain supertype
1678 RunTTSTest(type_future, {obj_futurenullablefunction, tav_null, tav_null});
1679 RunTTSTest(type_future_dynamic,
1680 {obj_futurenullablefunction, tav_null, tav_null});
1681 RunTTSTest(type_future_nullable_object,
1682 {obj_futurenullablefunction, tav_null, tav_null});
1683 RunTTSTest(type_future_legacy_object,
1684 {obj_futurenullablefunction, tav_null, tav_null});
1685 RunTTSTest(type_future_nullable_object,
1686 {obj_futurefunction, tav_null, tav_null});
1687 RunTTSTest(type_future_legacy_object,
1688 {obj_futurenullablefunction, tav_null, tav_null});
1689 RunTTSTest(type_future_nullable_function,
1690 {obj_futurenullablefunction, tav_null, tav_null});
1691 RunTTSTest(type_future_legacy_function,
1692 {obj_futurenullablefunction, tav_null, tav_null});
1693 RunTTSTest(type_future_t, {obj_futurenullablefunction, tav_null, tav_null});
1694 RunTTSTest(type_future_t,
1695 {obj_futurenullablefunction, tav_nullable_object, tav_null});
1696 RunTTSTest(type_future_t,
1697 {obj_futurenullablefunction, tav_legacy_object, tav_null});
1698 RunTTSTest(type_future_t, {obj_futurenullablefunction,
1699 tav_nullable_function_int_nullary, tav_null});
1700
1701 // False negative from TTS (caught by runtime or STC):
1702 // obj as Future<int Function()?> : No specialization.
1703 // obj as Future<int Function()*> : No specialization.
1704 // obj as Future<X>, : Type arg is a type parameter instantiated with
1705 // X = Function? : ... a certain supertype (but not checked)
1706 // X = Function* : ... a certain supertype (but not checked)
1707 // X = int Function()* : ... a canonically different type.
1708 //
1709 // If not null safe:
1710 // obj as Future<int Function()> : No specialization.
1711 // obj as Future<X>, : Type arg is a type parameter instantiated with
1712 // X = Function : ... a certain supertype (but not checked)
1713 // X = int Function() : ... a canonically different type.
1714
1715 RunTTSTest(type_future_nullable_function_int_nullary,
1716 FalseNegative({obj_futurenullablefunction, tav_null, tav_null}));
1717 RunTTSTest(type_future_legacy_function_int_nullary,
1718 FalseNegative({obj_futurenullablefunction, tav_null, tav_null}));
1719 RunTTSTest(type_future_t, FalseNegative({obj_futurenullablefunction,
1720 tav_nullable_function, tav_null}));
1721 RunTTSTest(type_future_t, FalseNegative({obj_futurenullablefunction,
1722 tav_legacy_function, tav_null}));
1723 RunTTSTest(type_future_t,
1724 FalseNegative({obj_futurenullablefunction,
1725 tav_legacy_function_int_nullary, tav_null}));
1726
1727 // Errors:
1728 // obj as Future<_Closure?> : Type arg is not a supertype
1729 // obj as Future<_Closure*> : Type arg is not a supertype
1730 // obj as Future<_Closure> : Type arg is not a supertype
1731 // obj as Future<X>, : Type arg is a type parameter instantiated with
1732 // X = _Closure? : ... an unrelated type.
1733 // X = _Closure* : ... an unrelated type.
1734 // X = _Closure : ... an unrelated type.
1735 //
1736 // If null safe:
1737 // obj as Future<int Function()> : Nullable type cannot be subtype of a
1738 // non-nullable type.
1739 // obj as Future<Object> : Nullable type cannot be subtype of a
1740 // non-nullable type.
1741 // obj as Future<Function> : Nullable type cannot be subtype of a
1742 // non-nullable type.
1743 // obj as Future<X>, : Type arg is a type parameter instantiated with
1744 // X = Object : ... a non-nullable type.
1745 // X = Function : ... a non-nullable type.
1746 // X = int Function() : ... a non-nullable type.
1747
1748 RunTTSTest(type_future_nullable_closure,
1749 Failure({obj_futurenullablefunction, tav_null, tav_null}));
1750 RunTTSTest(type_future_legacy_closure,
1751 Failure({obj_futurenullablefunction, tav_null, tav_null}));
1752 RunTTSTest(type_future_closure,
1753 Failure({obj_futurenullablefunction, tav_null, tav_null}));
1754 RunTTSTest(type_future_t, Failure({obj_futurenullablefunction,
1755 tav_nullable_closure, tav_null}));
1756 RunTTSTest(type_future_t, Failure({obj_futurenullablefunction,
1757 tav_legacy_closure, tav_null}));
1758 RunTTSTest(type_future_t,
1759 Failure({obj_futurenullablefunction, tav_closure, tav_null}));
1760
1761 RunTTSTest(type_future_function_int_nullary,
static TTSTestCase FalseNegative(const TTSTestCase &original)
void SetupCoreLibrariesForUnitTest()
Definition unit_test.cc:148
static void CanonicalizeTAV(TypeArguments *tav)

◆ ISOLATE_UNIT_TEST_CASE() [411/463]

dart::ISOLATE_UNIT_TEST_CASE ( TTS_Generic_Implements_Instantiated_Interface  )

Definition at line 1293 of file type_testing_stubs_test.cc.

1293 {
1294 const char* kScript =
1295 R"(
1296 abstract class I<T> {}
1297 class B<R> implements I<String> {}
1298
1299 createBInt() => B<int>();
1300)";
1301
1302 const auto& root_library = Library::Handle(LoadTestScript(kScript));
1303 const auto& class_i = Class::Handle(GetClass(root_library, "I"));
1304 const auto& obj_b_int = Object::Handle(Invoke(root_library, "createBInt"));
1305
1306 const auto& tav_null = Object::null_type_arguments();
1307 auto& tav_string = TypeArguments::Handle(TypeArguments::New(1));
1308 tav_string.SetTypeAt(0, Type::Handle(Type::StringType()));
1309 CanonicalizeTAV(&tav_string);
1310
1311 auto& type_i_string = Type::Handle(Type::New(class_i, tav_string));
1312 FinalizeAndCanonicalize(&type_i_string);
1313 const auto& type_i_t = Type::Handle(class_i.DeclarationType());
1314
1315 RunTTSTest(type_i_string, {obj_b_int, tav_null, tav_null});

◆ ISOLATE_UNIT_TEST_CASE() [412/463]

dart::ISOLATE_UNIT_TEST_CASE ( TTS_GenericSubtypeRangeCheck  )

Definition at line 1050 of file type_testing_stubs_test.cc.

1050 {
1051 const auto& root_library =
1052 Library::Handle(LoadTestScript(kSubtypeRangeCheckScript));
1053 const auto& class_a1 = Class::Handle(GetClass(root_library, "A1"));
1054 const auto& class_a2 = Class::Handle(GetClass(root_library, "A2"));
1055 const auto& class_base = Class::Handle(GetClass(root_library, "Base"));
1056 const auto& class_i = Class::Handle(GetClass(root_library, "I"));
1057 const auto& fun_generic =
1058 Function::Handle(GetFunction(root_library, "genericFun"));
1059
1060 const auto& obj_i = Object::Handle(Invoke(root_library, "createI"));
1061 const auto& obj_i2 = Object::Handle(Invoke(root_library, "createI2"));
1062 const auto& obj_base_int =
1063 Object::Handle(Invoke(root_library, "createBaseInt"));
1064 const auto& obj_a = Object::Handle(Invoke(root_library, "createA"));
1065 const auto& obj_a1 = Object::Handle(Invoke(root_library, "createA1"));
1066 const auto& obj_a2 = Object::Handle(Invoke(root_library, "createA2"));
1067 const auto& obj_b = Object::Handle(Invoke(root_library, "createB"));
1068 const auto& obj_b1 = Object::Handle(Invoke(root_library, "createB1"));
1069 const auto& obj_b2 = Object::Handle(Invoke(root_library, "createB2"));
1070 const auto& obj_basea2int =
1071 Object::Handle(Invoke(root_library, "createBaseA2Int"));
1072 const auto& obj_basea2a1 =
1073 Object::Handle(Invoke(root_library, "createBaseA2A1"));
1074 const auto& obj_baseb2int =
1075 Object::Handle(Invoke(root_library, "createBaseB2Int"));
1076 const auto& obj_baseistringdouble =
1077 Object::Handle(Invoke(root_library, "createBaseIStringDouble"));
1078
1079 const auto& type_dynamic = Type::Handle(Type::DynamicType());
1080 auto& type_int = Type::Handle(Type::IntType());
1081 if (!TestCase::IsNNBD()) {
1082 type_int = type_int.ToNullability(Nullability::kLegacy, Heap::kNew);
1083 }
1084 auto& type_string = Type::Handle(Type::StringType());
1085 if (!TestCase::IsNNBD()) {
1086 type_string = type_string.ToNullability(Nullability::kLegacy, Heap::kNew);
1087 }
1088 auto& type_object = Type::Handle(Type::ObjectType());
1089 type_object = type_object.ToNullability(
1090 TestCase::IsNNBD() ? Nullability::kNullable : Nullability::kLegacy,
1091 Heap::kNew);
1092 auto& type_a1 = Type::Handle(class_a1.DeclarationType());
1093 if (!TestCase::IsNNBD()) {
1094 type_a1 = type_a1.ToNullability(Nullability::kLegacy, Heap::kNew);
1095 }
1096 FinalizeAndCanonicalize(&type_a1);
1097
1098 const auto& tav_null = TypeArguments::Handle(TypeArguments::null());
1099
1100 auto& tav_object_dynamic = TypeArguments::Handle(TypeArguments::New(2));
1101 tav_object_dynamic.SetTypeAt(0, type_object);
1102 tav_object_dynamic.SetTypeAt(1, type_dynamic);
1103 CanonicalizeTAV(&tav_object_dynamic);
1104
1105 auto& tav_dynamic_int = TypeArguments::Handle(TypeArguments::New(2));
1106 tav_dynamic_int.SetTypeAt(0, type_dynamic);
1107 tav_dynamic_int.SetTypeAt(1, type_int);
1108 CanonicalizeTAV(&tav_dynamic_int);
1109
1110 auto& tav_dynamic_string = TypeArguments::Handle(TypeArguments::New(2));
1111 tav_dynamic_string.SetTypeAt(0, type_dynamic);
1112 tav_dynamic_string.SetTypeAt(1, type_string);
1113 CanonicalizeTAV(&tav_dynamic_string);
1114
1115 auto& tav_int = TypeArguments::Handle(TypeArguments::New(1));
1116 tav_int.SetTypeAt(0, type_int);
1117 CanonicalizeTAV(&tav_int);
1118
1119 auto& type_i_object_dynamic =
1120 AbstractType::Handle(Type::New(class_i, tav_object_dynamic));
1121 FinalizeAndCanonicalize(&type_i_object_dynamic);
1122 const auto& tav_iod = TypeArguments::Handle(TypeArguments::New(1));
1123 tav_iod.SetTypeAt(0, type_i_object_dynamic);
1124
1125 // We will generate specialized TTS for instantiated interface types
1126 // where there are no type arguments or the type arguments are top
1127 // types.
1128 //
1129 // obj as Base<I<Object, dynamic>> // Subclass ranges for Base, subtype
1130 // // ranges tav arguments.
1131 // obj as Base<T> // Subclass ranges for Base, type
1132 // // equality for instantiator type arg T
1133 // obj as Base<B> // Subclass ranges for Base, type
1134 // // equality for function type arg B.
1135 //
1136
1137 // <...> as Base<I<Object, dynamic>>
1138 auto& type_base_i_object_dynamic =
1139 AbstractType::Handle(Type::New(class_base, tav_iod));
1140 FinalizeAndCanonicalize(&type_base_i_object_dynamic);
1141 RunTTSTest(type_base_i_object_dynamic, {obj_baseb2int, tav_null, tav_null});
1142 RunTTSTest(type_base_i_object_dynamic,
1143 {obj_baseistringdouble, tav_null, tav_null});
1144 RunTTSTest(type_base_i_object_dynamic, Failure({obj_a, tav_null, tav_null}));
1145 RunTTSTest(type_base_i_object_dynamic, Failure({obj_a1, tav_null, tav_null}));
1146 RunTTSTest(type_base_i_object_dynamic, Failure({obj_a2, tav_null, tav_null}));
1147 RunTTSTest(type_base_i_object_dynamic, Failure({obj_b, tav_null, tav_null}));
1148 RunTTSTest(type_base_i_object_dynamic, Failure({obj_b1, tav_null, tav_null}));
1149 RunTTSTest(type_base_i_object_dynamic, Failure({obj_b2, tav_null, tav_null}));
1150
1151 // <...> as Base<T> with T instantiantiator type parameter (T == int)
1152 const auto& tav_baset = TypeArguments::Handle(TypeArguments::New(1));
1153 tav_baset.SetTypeAt(
1154 0, TypeParameter::Handle(GetClassTypeParameter(class_base, 0)));
1155 auto& type_base_t = AbstractType::Handle(Type::New(class_base, tav_baset));
1156 FinalizeAndCanonicalize(&type_base_t);
1157 RunTTSTest(type_base_t, {obj_base_int, tav_int, tav_null});
1158 RunTTSTest(type_base_t, Failure({obj_baseistringdouble, tav_int, tav_null}));
1159
1160 // <...> as Base<B> with B function type parameter
1161 const auto& tav_baseb = TypeArguments::Handle(TypeArguments::New(1));
1162 tav_baseb.SetTypeAt(
1163 0, TypeParameter::Handle(GetFunctionTypeParameter(fun_generic, 1)));
1164 auto& type_base_b = AbstractType::Handle(Type::New(class_base, tav_baseb));
1165 FinalizeAndCanonicalize(&type_base_b);
1166 // With B == int
1167 RunTTSTest(type_base_b, {obj_base_int, tav_null, tav_dynamic_int});
1168 RunTTSTest(type_base_b,
1169 Failure({obj_baseistringdouble, tav_null, tav_dynamic_int}));
1170 // With B == dynamic (null vector)
1171 RunTTSTest(type_base_b, {obj_base_int, tav_null, tav_null});
1172 RunTTSTest(type_base_b, Failure({obj_i2, tav_null, tav_null}));
1173
1174 // We generate TTS for implemented classes and uninstantiated types, but
1175 // any class that implements the type class but does not match in both
1176 // instance TAV offset and type argument indices is guaranteed to be a
1177 // false negative.
1178 //
1179 // obj as I<dynamic, String> // I is generic & implemented.
1180 // obj as Base<A2<T>> // A2<T> is not instantiated.
1181 // obj as Base<A2<A1>> // A2<A1> is not a rare type.
1182 //
1183
1184 // <...> as I<dynamic, String>
1185 RELEASE_ASSERT(class_i.is_implemented());
1186 auto& type_i_dynamic_string =
1187 Type::Handle(Type::New(class_i, tav_dynamic_string));
1188 type_i_dynamic_string = type_i_dynamic_string.ToNullability(
1189 Nullability::kNonNullable, Heap::kNew);
1190 FinalizeAndCanonicalize(&type_i_dynamic_string);
1191 RunTTSTest(type_i_dynamic_string, {obj_i, tav_null, tav_null});
1192 RunTTSTest(type_i_dynamic_string,
1193 Failure({obj_base_int, tav_null, tav_null}));
1194
1195 // <...> as Base<A2<T>>
1196 const auto& tav_t = TypeArguments::Handle(TypeArguments::New(1));
1197 tav_t.SetTypeAt(0,
1198 TypeParameter::Handle(GetClassTypeParameter(class_base, 0)));
1199 auto& type_a2_t = Type::Handle(Type::New(class_a2, tav_t));
1200 type_a2_t = type_a2_t.ToNullability(Nullability::kLegacy, Heap::kNew);
1201 FinalizeAndCanonicalize(&type_a2_t);
1202 const auto& tav_a2_t = TypeArguments::Handle(TypeArguments::New(1));
1203 tav_a2_t.SetTypeAt(0, type_a2_t);
1204 auto& type_base_a2_t = Type::Handle(Type::New(class_base, tav_a2_t));
1205 type_base_a2_t =
1206 type_base_a2_t.ToNullability(Nullability::kNonNullable, Heap::kNew);
1207 FinalizeAndCanonicalize(&type_base_a2_t);
1208 RunTTSTest(type_base_a2_t,
1209 FalseNegative({obj_basea2int, tav_null, tav_null}));
1210 RunTTSTest(type_base_a2_t, Failure({obj_base_int, tav_null, tav_null}));
1211
1212 // <...> as Base<A2<A1>>
1213 const auto& tav_a1 = TypeArguments::Handle(TypeArguments::New(1));
1214 tav_a1.SetTypeAt(0, type_a1);
1215 auto& type_a2_a1 = Type::Handle(Type::New(class_a2, tav_a1));
1216 type_a2_a1 = type_a2_a1.ToNullability(Nullability::kLegacy, Heap::kNew);
1217 FinalizeAndCanonicalize(&type_a2_a1);
1218 const auto& tav_a2_a1 = TypeArguments::Handle(TypeArguments::New(1));
1219 tav_a2_a1.SetTypeAt(0, type_a2_a1);
1220 auto& type_base_a2_a1 = Type::Handle(Type::New(class_base, tav_a2_a1));
1221 type_base_a2_a1 =
1222 type_base_a2_a1.ToNullability(Nullability::kNonNullable, Heap::kNew);
1223 FinalizeAndCanonicalize(&type_base_a2_a1);
1224 RunTTSTest(type_base_a2_a1,
1225 FalseNegative({obj_basea2a1, tav_null, tav_null}));
1226 RunTTSTest(type_base_a2_a1, Failure({obj_basea2int, tav_null, tav_null}));
1227}
Nullability
Definition object.h:1112
TypeParameterPtr GetClassTypeParameter(const Class &klass, intptr_t index)
TypeParameterPtr GetFunctionTypeParameter(const Function &fun, intptr_t index)

◆ ISOLATE_UNIT_TEST_CASE() [413/463]

dart::ISOLATE_UNIT_TEST_CASE ( TTS_Int  )

Definition at line 1847 of file type_testing_stubs_test.cc.

1850 {int_instance, int_tav, string_tav});
1851 THR_Print("\nTesting string instance, class parameter instantiated to int\n");
1852 RunTTSTest(dst_type_t, Failure({string_instance, int_tav, string_tav}));
1853
1854 THR_Print(
1855 "\nTesting string instance, function parameter instantiated to string\n");
1856 RunTTSTest(dst_type_h, {string_instance, int_tav, string_tav});
1857 RunTTSTest(dst_type_h, Failure({int_instance, int_tav, string_tav}));
1858}
1859
1860// Check that we generate correct TTS for _Smi type.

◆ ISOLATE_UNIT_TEST_CASE() [414/463]

dart::ISOLATE_UNIT_TEST_CASE ( TTS_Num  )

Definition at line 1863 of file type_testing_stubs_test.cc.

1866 {Smi::Handle(Smi::New(0)), tav_null, tav_null});
1867 RunTTSTest(type_smi, Failure({Integer::Handle(Integer::New(kMaxInt64)),
1868 tav_null, tav_null}));
1869 RunTTSTest(type_smi,
1870 Failure({Double::Handle(Double::New(1.0)), tav_null, tav_null}));
1871 RunTTSTest(type_smi, Failure({Symbols::Empty(), tav_null, tav_null}));
1872 RunTTSTest(type_smi,
1873 Failure({Array::Handle(Array::New(1)), tav_null, tav_null}));
1874}
1875

◆ ISOLATE_UNIT_TEST_CASE() [415/463]

dart::ISOLATE_UNIT_TEST_CASE ( TTS_Object  )

Definition at line 1893 of file type_testing_stubs_test.cc.

1893 {
1894 const auto& type_num = Type::Handle(Type::Number());
1895 const auto& tav_null = Object::null_type_arguments();
1896
1897 // Test on some easy-to-make instances.
1898 RunTTSTest(type_num, {Smi::Handle(Smi::New(0)), tav_null, tav_null});
1899 RunTTSTest(type_num,
1900 {Integer::Handle(Integer::New(kMaxInt64)), tav_null, tav_null});
1901 RunTTSTest(type_num, {Double::Handle(Double::New(1.0)), tav_null, tav_null});
1902 RunTTSTest(type_num, Failure({Symbols::Empty(), tav_null, tav_null}));
1903 RunTTSTest(type_num,
1904 Failure({Array::Handle(Array::New(1)), tav_null, tav_null}));
1905}
1906
1907// Check that we generate correct TTS for Double type.
1908ISOLATE_UNIT_TEST_CASE(TTS_Double) {
1909 const auto& type_num = Type::Handle(Type::Double());
1910 const auto& tav_null = Object::null_type_arguments();
1911
1912 // Test on some easy-to-make instances.
1913 RunTTSTest(type_num, Failure({Smi::Handle(Smi::New(0)), tav_null, tav_null}));
1914 RunTTSTest(type_num, Failure({Integer::Handle(Integer::New(kMaxInt64)),
1915 tav_null, tav_null}));

◆ ISOLATE_UNIT_TEST_CASE() [416/463]

dart::ISOLATE_UNIT_TEST_CASE ( TTS_Partial  )

Definition at line 1950 of file type_testing_stubs_test.cc.

1952 {}
1953
1954 createF() => (){};
1955 createG() => () => 3;
1956 createH() => (int x, String y, {int z = 0}) => x + z;
1957
1958 createAInt() => A<int>();
1959 createAFunction() => A<Function>();
1960 )";
1961
1962 const auto& root_library = Library::Handle(LoadTestScript(kScript));
1963 const auto& obj_f = Object::Handle(Invoke(root_library, "createF"));
1964 const auto& obj_g = Object::Handle(Invoke(root_library, "createG"));
1965 const auto& obj_h = Object::Handle(Invoke(root_library, "createH"));
1966
1967 const auto& tav_null = TypeArguments::Handle(TypeArguments::null());
1968 const auto& type_function = Type::Handle(Type::DartFunctionType());
1969
1970 RunTTSTest(type_function, {obj_f, tav_null, tav_null});
1971 RunTTSTest(type_function, {obj_g, tav_null, tav_null});
1972 RunTTSTest(type_function, {obj_h, tav_null, tav_null});
1973
1974 const auto& class_a = Class::Handle(GetClass(root_library, "A"));
1975 const auto& obj_a_int = Object::Handle(Invoke(root_library, "createAInt"));
1976 const auto& obj_a_function =
1977 Object::Handle(Invoke(root_library, "createAFunction"));
1978
1979 auto& tav_function = TypeArguments::Handle(TypeArguments::New(1));
1980 tav_function.SetTypeAt(0, type_function);
1981 CanonicalizeTAV(&tav_function);
1982 auto& type_a_function = Type::Handle(Type::New(class_a, tav_function));
1983 FinalizeAndCanonicalize(&type_a_function);
1984
1985 RunTTSTest(type_a_function, {obj_a_function, tav_null, tav_null});
1986 RunTTSTest(type_a_function, Failure({obj_a_int, tav_null, tav_null}));
1987}
1988
1989ISOLATE_UNIT_TEST_CASE(TTS_Partial) {
1990 const char* kScript =
1991 R"(
1992 class B<T> {}
1993
1994 class C {}
1995 class D extends C {}
1996 class E extends D {}
1997
1998 F<A>() {}
1999 createBE() => B<E>();
2000 createBENullable() => B<E?>();
2001 createBNull() => B<Null>();
2002 createBNever() => B<Never>();
2003)";
2004
2005 const auto& root_library = Library::Handle(LoadTestScript(kScript));
2006 const auto& class_b = Class::Handle(GetClass(root_library, "B"));
2007 const auto& class_c = Class::Handle(GetClass(root_library, "C"));
2008 const auto& class_d = Class::Handle(GetClass(root_library, "D"));
2009 const auto& class_e = Class::Handle(GetClass(root_library, "E"));
2010 const auto& fun_f = Function::Handle(GetFunction(root_library, "F"));
2011 const auto& obj_b_e = Object::Handle(Invoke(root_library, "createBE"));
2012 const auto& obj_b_e_nullable =
2013 Object::Handle(Invoke(root_library, "createBENullable"));
2014 const auto& obj_b_null = Object::Handle(Invoke(root_library, "createBNull"));
2015 const auto& obj_b_never =
2016 Object::Handle(Invoke(root_library, "createBNever"));
2017
2018 const auto& tav_null = Object::null_type_arguments();
2019 auto& tav_nullable_object = TypeArguments::Handle(TypeArguments::New(1));
2020 tav_nullable_object.SetTypeAt(
2021 0, Type::Handle(
2022 IsolateGroup::Current()->object_store()->nullable_object_type()));
2023 CanonicalizeTAV(&tav_nullable_object);
2024 auto& tav_legacy_object = TypeArguments::Handle(TypeArguments::New(1));
2025 tav_legacy_object.SetTypeAt(
2026 0, Type::Handle(
2027 IsolateGroup::Current()->object_store()->legacy_object_type()));
2028 CanonicalizeTAV(&tav_legacy_object);
2029 auto& tav_object = TypeArguments::Handle(TypeArguments::New(1));
2030 tav_object.SetTypeAt(
2031 0, Type::Handle(IsolateGroup::Current()->object_store()->object_type()));
2032 CanonicalizeTAV(&tav_object);
2033
2034 auto& type_e =
2035 Type::Handle(Type::New(class_e, tav_null, Nullability::kNonNullable));
2036 FinalizeAndCanonicalize(&type_e);
2037 auto& type_d =
2038 Type::Handle(Type::New(class_d, tav_null, Nullability::kNonNullable));
2039 FinalizeAndCanonicalize(&type_d);
2040 auto& type_c =
2041 Type::Handle(Type::New(class_c, tav_null, Nullability::kNonNullable));
2042 FinalizeAndCanonicalize(&type_c);
2043 auto& type_c_nullable =
2044 Type::Handle(Type::New(class_c, tav_null, Nullability::kNullable));
2045 FinalizeAndCanonicalize(&type_c_nullable);
2046 auto& type_c_legacy =
2047 Type::Handle(Type::New(class_c, tav_null, Nullability::kLegacy));
2048 FinalizeAndCanonicalize(&type_c_legacy);
2049
2050 auto& tav_e = TypeArguments::Handle(TypeArguments::New(1));
2051 tav_e.SetTypeAt(0, type_e);
2052 CanonicalizeTAV(&tav_e);
2053 auto& tav_d = TypeArguments::Handle(TypeArguments::New(1));
2054 tav_d.SetTypeAt(0, type_d);
2055 CanonicalizeTAV(&tav_d);
2056 auto& tav_c = TypeArguments::Handle(TypeArguments::New(1));
2057 tav_c.SetTypeAt(0, type_c);
2058 CanonicalizeTAV(&tav_c);
2059 auto& tav_nullable_c = TypeArguments::Handle(TypeArguments::New(1));
2060 tav_nullable_c.SetTypeAt(0, type_c_nullable);
2061 CanonicalizeTAV(&tav_nullable_c);
2062 auto& tav_legacy_c = TypeArguments::Handle(TypeArguments::New(1));
2063 tav_legacy_c.SetTypeAt(0, type_c_legacy);
2064 CanonicalizeTAV(&tav_legacy_c);
2065
2066 // One case where optimized TTSes can be partial is if the type is
2067 // uninstantiated with a type parameter at the same position as one of the
Definition SkMD5.cpp:120

◆ ISOLATE_UNIT_TEST_CASE() [417/463]

dart::ISOLATE_UNIT_TEST_CASE ( TTS_Partial_Incremental  )

Definition at line 2069 of file type_testing_stubs_test.cc.

◆ ISOLATE_UNIT_TEST_CASE() [418/463]

dart::ISOLATE_UNIT_TEST_CASE ( TTS_RecordSubtypeRangeCheck  )

Definition at line 1251 of file type_testing_stubs_test.cc.

1251 {
1252 const auto& root_library =
1253 Library::Handle(LoadTestScript(kRecordSubtypeRangeCheckScript));
1254
1255 const auto& type1 = AbstractType::Cast(
1256 Object::Handle(Invoke(root_library, "getRecordType1")));
1257 const auto& type2 = AbstractType::Cast(
1258 Object::Handle(Invoke(root_library, "getRecordType2")));
1259 const auto& type3 = AbstractType::Cast(
1260 Object::Handle(Invoke(root_library, "getRecordType3")));
1261
1262 const auto& obj1 = Object::Handle(Invoke(root_library, "createObj1"));
1263 const auto& obj2 = Object::Handle(Invoke(root_library, "createObj2"));
1264 const auto& obj3 = Object::Handle(Invoke(root_library, "createObj3"));
1265 const auto& obj4 = Object::Handle(Invoke(root_library, "createObj4"));
1266 const auto& obj5 = Object::Handle(Invoke(root_library, "createObj5"));
1267 const auto& obj6 = Object::Handle(Invoke(root_library, "createObj6"));
1268 const auto& obj7 = Object::Handle(Invoke(root_library, "createObj7"));
1269 const auto& obj8 = Object::Handle(Invoke(root_library, "createObj8"));
1270
1271 const auto& tav_null = TypeArguments::Handle(TypeArguments::null());
1272
1273 // (1, B()) as (int, A)
1274 // (1, 'bye') as (int, A)
1275 // (1, foo: B()) as (int, A)
1276 // (1, B(), 2) as (int, A)
1277 RunTTSTest(type1, {obj1, tav_null, tav_null});
1278 RunTTSTest(type1, Failure({obj2, tav_null, tav_null}));
1279 RunTTSTest(type1, Failure({obj3, tav_null, tav_null}));
1280 RunTTSTest(type1, Failure({obj4, tav_null, tav_null}));
1281
1282 // (C(), 2, 'hi') as (A, int, String)
1283 // (D(), 2, 'hi') as (A, int, String)
1284 RunTTSTest(type2, {obj5, tav_null, tav_null});
1285 RunTTSTest(type2, Failure({obj6, tav_null, tav_null}));
1286
1287 // (3, D<int>()) as (int, D)
1288 // (D<int>(), 3) as (int, D)
1289 RunTTSTest(type3, {obj7, tav_null, tav_null});
1290 RunTTSTest(type3, Failure({obj8, tav_null, tav_null}));
1291}

◆ ISOLATE_UNIT_TEST_CASE() [419/463]

dart::ISOLATE_UNIT_TEST_CASE ( TTS_Regress40964  )

Definition at line 1763 of file type_testing_stubs_test.cc.

1764 {obj_futurenullablefunction, tav_null, tav_null}));
1765 RunTTSTest(type_future_function,
1766 Failure({obj_futurenullablefunction, tav_null, tav_null}));
1767 RunTTSTest(type_future_t,
1768 Failure({obj_futurenullablefunction, tav_object, tav_null}));
1769 RunTTSTest(type_future_t,
1770 Failure({obj_futurenullablefunction, tav_function, tav_null}));
1771 RunTTSTest(type_future_t, Failure({obj_futurenullablefunction,
1772 tav_function_int_nullary, tav_null}));
1773}
1774
1775ISOLATE_UNIT_TEST_CASE(TTS_Regress40964) {
1776 const char* kScript =
1777 R"(
1778 class A<T> {
1779 test(x) => x as B<T>;
1780 }
1781 class B<T> {}
1782 class C<T> {}
1783
1784 createACint() => A<C<int>>();
1785 createBCint() => B<C<int>>();
1786 createBCnum() => B<C<num>>();
1787 )";
1788
1789 const auto& root_library = Library::Handle(LoadTestScript(kScript));

◆ ISOLATE_UNIT_TEST_CASE() [420/463]

dart::ISOLATE_UNIT_TEST_CASE ( TTS_Smi  )

Definition at line 1831 of file type_testing_stubs_test.cc.

◆ ISOLATE_UNIT_TEST_CASE() [421/463]

dart::ISOLATE_UNIT_TEST_CASE ( TTS_SubtypeRangeCheck  )

Definition at line 885 of file type_testing_stubs_test.cc.

885 {
886 const auto& root_library =
887 Library::Handle(LoadTestScript(kSubtypeRangeCheckScript));
888 const auto& class_a = Class::Handle(GetClass(root_library, "A"));
889 const auto& class_base = Class::Handle(GetClass(root_library, "Base"));
890 const auto& class_i = Class::Handle(GetClass(root_library, "I"));
891 const auto& class_i2 = Class::Handle(GetClass(root_library, "I2"));
892
893 const auto& obj_i = Object::Handle(Invoke(root_library, "createI"));
894 const auto& obj_i2 = Object::Handle(Invoke(root_library, "createI2"));
895 const auto& obj_base_int =
896 Object::Handle(Invoke(root_library, "createBaseInt"));
897 const auto& obj_base_null =
898 Object::Handle(Invoke(root_library, "createBaseNull"));
899 const auto& obj_base_never =
900 Object::Handle(Invoke(root_library, "createBaseNever"));
901 const auto& obj_a = Object::Handle(Invoke(root_library, "createA"));
902 const auto& obj_a1 = Object::Handle(Invoke(root_library, "createA1"));
903 const auto& obj_a2 = Object::Handle(Invoke(root_library, "createA2"));
904 const auto& obj_b = Object::Handle(Invoke(root_library, "createB"));
905 const auto& obj_b1 = Object::Handle(Invoke(root_library, "createB1"));
906 const auto& obj_b2 = Object::Handle(Invoke(root_library, "createB2"));
907
908 const auto& type_dynamic = Type::Handle(Type::DynamicType());
909 auto& type_object = Type::Handle(Type::ObjectType());
910 type_object = type_object.ToNullability(Nullability::kNullable, Heap::kNew);
911
912 const auto& tav_null = TypeArguments::Handle(TypeArguments::null());
913
914 auto& tav_object = TypeArguments::Handle(TypeArguments::New(1));
915 tav_object.SetTypeAt(0, type_object);
916 CanonicalizeTAV(&tav_object);
917
918 auto& tav_object_dynamic = TypeArguments::Handle(TypeArguments::New(2));
919 tav_object_dynamic.SetTypeAt(0, type_object);
920 tav_object_dynamic.SetTypeAt(1, type_dynamic);
921 CanonicalizeTAV(&tav_object_dynamic);
922
923 auto& tav_dynamic_t = TypeArguments::Handle(TypeArguments::New(2));
924 tav_dynamic_t.SetTypeAt(0, type_dynamic);
925 tav_dynamic_t.SetTypeAt(
926 1, TypeParameter::Handle(GetClassTypeParameter(class_base, 0)));
927 CanonicalizeTAV(&tav_dynamic_t);
928
929 // We will generate specialized TTS for instantiated interface types
930 // where there are no type arguments or the type arguments are top
931 // types.
932 //
933 // obj as A // Subclass ranges
934 // obj as Base<Object?> // Subclass ranges with top-type tav
935 // obj as I2 // Subtype ranges
936 // obj as I<Object?, dynamic> // Subtype ranges with top-type tav
937 //
938
939 // <...> as A
940 const auto& type_a = AbstractType::Handle(class_a.RareType());
941 RunTTSTest(type_a, Failure({obj_i, tav_null, tav_null}));
942 RunTTSTest(type_a, Failure({obj_i2, tav_null, tav_null}));
943 RunTTSTest(type_a, Failure({obj_base_int, tav_null, tav_null}));
944 RunTTSTest(type_a, {obj_a, tav_null, tav_null});
945 RunTTSTest(type_a, {obj_a1, tav_null, tav_null});
946 RunTTSTest(type_a, {obj_a2, tav_null, tav_null});
947 RunTTSTest(type_a, Failure({obj_b, tav_null, tav_null}));
948 RunTTSTest(type_a, Failure({obj_b1, tav_null, tav_null}));
949 RunTTSTest(type_a, Failure({obj_b2, tav_null, tav_null}));
950
951 // <...> as Base<Object?>
952 auto& type_base = AbstractType::Handle(Type::New(class_base, tav_object));
953 FinalizeAndCanonicalize(&type_base);
954 RunTTSTest(type_base, Failure({obj_i, tav_null, tav_null}));
955 RunTTSTest(type_base, Failure({obj_i2, tav_null, tav_null}));
956 RunTTSTest(type_base, {obj_base_int, tav_null, tav_null});
957 RunTTSTest(type_base, {obj_base_null, tav_null, tav_null});
958 RunTTSTest(type_base, {obj_a, tav_null, tav_null});
959 RunTTSTest(type_base, {obj_a1, tav_null, tav_null});
960 RunTTSTest(type_base, {obj_a2, tav_null, tav_null});
961 RunTTSTest(type_base, {obj_b, tav_null, tav_null});
962 RunTTSTest(type_base, {obj_b1, tav_null, tav_null});
963 RunTTSTest(type_base, {obj_b2, tav_null, tav_null});
964
965 // Base<Null|Never> as Base<int?>
966 // This is a regression test verifying that we don't fall through into
967 // runtime for Null and Never.
968 auto& type_nullable_int = Type::Handle(Type::IntType());
969 type_nullable_int = type_nullable_int.ToNullability(
970 TestCase::IsNNBD() ? Nullability::kNullable : Nullability::kLegacy,
971 Heap::kNew);
972 auto& tav_nullable_int = TypeArguments::Handle(TypeArguments::New(1));
973 tav_nullable_int.SetTypeAt(0, type_nullable_int);
974 CanonicalizeTAV(&tav_nullable_int);
975 auto& type_base_nullable_int =
976 AbstractType::Handle(Type::New(class_base, tav_nullable_int));
977 FinalizeAndCanonicalize(&type_base_nullable_int);
978 RunTTSTest(type_base_nullable_int, {obj_base_null, tav_null, tav_null});
979 RunTTSTest(type_base_nullable_int, {obj_base_never, tav_null, tav_null});
980
981 if (TestCase::IsNNBD()) {
982 // Base<Null|Never> as Base<int>
983 auto& type_int = Type::Handle(Type::IntType());
984 type_int = type_int.ToNullability(Nullability::kNonNullable, Heap::kNew);
985 auto& tav_int = TypeArguments::Handle(TypeArguments::New(1));
986 tav_int.SetTypeAt(0, type_int);
987 CanonicalizeTAV(&tav_int);
988 auto& type_base_int = Type::Handle(Type::New(class_base, tav_int));
989 type_base_int =
990 type_base_int.ToNullability(Nullability::kNonNullable, Heap::kNew);
991 FinalizeAndCanonicalize(&type_base_int);
992 RunTTSTest(type_base_int, Failure({obj_base_null, tav_null, tav_null}));
993 RunTTSTest(type_base_int, {obj_base_never, tav_null, tav_null});
994 }
995
996 // <...> as I2
997 const auto& type_i2 = AbstractType::Handle(class_i2.RareType());
998 RunTTSTest(type_i2, Failure({obj_i, tav_null, tav_null}));
999 RunTTSTest(type_i2, {obj_i2, tav_null, tav_null});
1000 RunTTSTest(type_i2, Failure({obj_base_int, tav_null, tav_null}));
1001 RunTTSTest(type_i2, Failure({obj_a, tav_null, tav_null}));
1002 RunTTSTest(type_i2, {obj_a1, tav_null, tav_null});
1003 RunTTSTest(type_i2, Failure({obj_a2, tav_null, tav_null}));
1004 RunTTSTest(type_i2, Failure({obj_b, tav_null, tav_null}));
1005 RunTTSTest(type_i2, {obj_b1, tav_null, tav_null});
1006 RunTTSTest(type_i2, Failure({obj_b2, tav_null, tav_null}));
1007
1008 // <...> as I<Object, dynamic>
1009 auto& type_i_object_dynamic =
1010 AbstractType::Handle(Type::New(class_i, tav_object_dynamic));
1011 FinalizeAndCanonicalize(&type_i_object_dynamic);
1012 RunTTSTest(type_i_object_dynamic, {obj_i, tav_null, tav_null});
1013 RunTTSTest(type_i_object_dynamic, Failure({obj_i2, tav_null, tav_null}));
1014 RunTTSTest(type_i_object_dynamic,
1015 Failure({obj_base_int, tav_null, tav_null}));
1016 RunTTSTest(type_i_object_dynamic, Failure({obj_a, tav_null, tav_null}));
1017 RunTTSTest(type_i_object_dynamic, Failure({obj_a1, tav_null, tav_null}));
1018 RunTTSTest(type_i_object_dynamic, {obj_a2, tav_null, tav_null});
1019 RunTTSTest(type_i_object_dynamic, Failure({obj_b, tav_null, tav_null}));
1020 RunTTSTest(type_i_object_dynamic, Failure({obj_b1, tav_null, tav_null}));
1021 RunTTSTest(type_i_object_dynamic, {obj_b2, tav_null, tav_null});
1022
1023 // We do generate TTSes for uninstantiated types when we need to use
1024 // subtype range checks for the class of the interface type, but the TTS
1025 // may be partial (returns a false negative in some cases that means going
1026 // to the STC/runtime).
1027 //
1028 // obj as I<dynamic, T>
1029 //
1030 auto& type_dynamic_t =
1031 AbstractType::Handle(Type::New(class_i, tav_dynamic_t));
1032 FinalizeAndCanonicalize(&type_dynamic_t);
1033 RunTTSTest(type_dynamic_t, {obj_i, tav_object, tav_null});
1034 RunTTSTest(type_dynamic_t, Failure({obj_i2, tav_object, tav_null}));
1035 RunTTSTest(type_dynamic_t, Failure({obj_base_int, tav_object, tav_null}));
1036 RunTTSTest(type_dynamic_t, Failure({obj_a, tav_object, tav_null}));
1037 RunTTSTest(type_dynamic_t, Failure({obj_a1, tav_object, tav_null}));
1038 RunTTSTest(type_dynamic_t, {obj_a2, tav_object, tav_null});
1039 RunTTSTest(type_dynamic_t, Failure({obj_b, tav_object, tav_null}));
1040 RunTTSTest(type_dynamic_t, Failure({obj_b1, tav_object, tav_null}));
1041 RunTTSTest(type_dynamic_t, FalseNegative({obj_b2, tav_object, tav_null}));
1042
1043 // obj as Object (with null safety)
1044 auto isolate_group = IsolateGroup::Current();
1045 auto& type_non_nullable_object =
1046 Type::Handle(isolate_group->object_store()->non_nullable_object_type());
1047 RunTTSTest(type_non_nullable_object, {obj_a, tav_null, tav_null});
1048}

◆ ISOLATE_UNIT_TEST_CASE() [422/463]

dart::ISOLATE_UNIT_TEST_CASE ( TTS_TypeParameter  )

Definition at line 1791 of file type_testing_stubs_test.cc.

1807 {bcint, cint_tav, function_tav});
1808
1809 // a as B<T> -- a==B<C<num>, T==<C<int>>
1810 RunTTSTest(dst_type, Failure({bcnum, cint_tav, function_tav}));
1811}
1812
1813ISOLATE_UNIT_TEST_CASE(TTS_TypeParameter) {
1814 const char* kScript =
1815 R"(
1816 class A<T> {
1817 T test(dynamic x) => x as T;
1818 }
1819 H genericFun<H>(dynamic x) => x as H;
1820
1821 createAInt() => A<int>();
1822 createAString() => A<String>();
1823 )";
1824
1825 const auto& root_library = Library::Handle(LoadTestScript(kScript));
1826 const auto& class_a = Class::Handle(GetClass(root_library, "A"));
1827 ClassFinalizer::FinalizeTypesInClass(class_a);
1828

◆ ISOLATE_UNIT_TEST_CASE() [423/463]

dart::ISOLATE_UNIT_TEST_CASE ( TwoWayInduction  )

Definition at line 176 of file loops_test.cc.

178 {
179 for (int i = 0; i < 100; i++) {
180 for (int j = 1; j < 100; j++) {
181 for (int k = 2; k < 100; k++) {
182 }
183 }
184 }
185 }
186 main() {
187 foo();
188 }
189 )";

◆ ISOLATE_UNIT_TEST_CASE() [424/463]

dart::ISOLATE_UNIT_TEST_CASE ( TypeArguments  )

Definition at line 263 of file object_test.cc.

263 {
264 const Type& type1 = Type::Handle(Type::Double());
265 const Type& type2 = Type::Handle(Type::StringType());
266 const TypeArguments& type_arguments1 =
267 TypeArguments::Handle(TypeArguments::New(2));
268 type_arguments1.SetTypeAt(0, type1);
269 type_arguments1.SetTypeAt(1, type2);
270 const TypeArguments& type_arguments2 =
271 TypeArguments::Handle(TypeArguments::New(2));
272 type_arguments2.SetTypeAt(0, type1);
273 type_arguments2.SetTypeAt(1, type2);
274 EXPECT_NE(type_arguments1.ptr(), type_arguments2.ptr());
275 OS::PrintErr("1: %s\n", type_arguments1.ToCString());
276 OS::PrintErr("2: %s\n", type_arguments2.ToCString());
277 EXPECT(type_arguments1.Equals(type_arguments2));
278 TypeArguments& type_arguments3 = TypeArguments::Handle();
279 type_arguments1.Canonicalize(thread);
280 type_arguments3 ^= type_arguments2.Canonicalize(thread);
281 EXPECT_EQ(type_arguments1.ptr(), type_arguments3.ptr());
282}
bool Equals(const TypeArguments &other) const
Definition object.h:8660
void SetTypeAt(intptr_t index, const AbstractType &value) const
Definition object.cc:7381

◆ ISOLATE_UNIT_TEST_CASE() [425/463]

dart::ISOLATE_UNIT_TEST_CASE ( TypedData_Grow  )

Definition at line 2206 of file object_test.cc.

2206 {
2207 const intptr_t kSmallSize = 42;
2208 const intptr_t kLargeSize = 1000;
2209
2210 Random random(42);
2211
2212 for (classid_t cid = kFirstTypedDataCid; cid <= kLastTypedDataCid;
2215
2216 const auto& small = TypedData::Handle(TypedData::New(cid, kSmallSize));
2217 EXPECT_EQ(small.LengthInBytes(), kSmallSize * small.ElementSizeInBytes());
2218
2219 for (intptr_t i = 0; i < TypedData::ElementSizeFor(cid) * kSmallSize; i++) {
2220 small.SetUint8(i, static_cast<uint8_t>(random.NextUInt64() & 0xff));
2221 }
2222
2223 const auto& big = TypedData::Handle(TypedData::Grow(small, kLargeSize));
2224 EXPECT_EQ(small.GetClassId(), big.GetClassId());
2225 EXPECT_EQ(big.LengthInBytes(), kLargeSize * big.ElementSizeInBytes());
2226
2227 for (intptr_t i = 0; i < TypedData::ElementSizeFor(cid) * kSmallSize; i++) {
2228 EXPECT_EQ(small.GetUint8(i), big.GetUint8(i));
2229 }
2230 for (intptr_t i = TypedData::ElementSizeFor(cid) * kSmallSize;
2231 i < TypedData::ElementSizeFor(cid) * kLargeSize; i++) {
2232 EXPECT_EQ(0, big.GetUint8(i));
2233 }
2234 }
2235}
const int kNumTypedDataCidRemainders
Definition class_id.h:265

◆ ISOLATE_UNIT_TEST_CASE() [426/463]

dart::ISOLATE_UNIT_TEST_CASE ( TypePropagator_RecordFieldAccess  )

Definition at line 699 of file type_propagator_test.cc.

699 {
700 const char* kScript = R"(
701 @pragma('vm:never-inline')
702 (int, {String foo}) bar() => (42, foo: 'hi');
703 @pragma('vm:never-inline')
704 baz(x) {}
705
706 void main() {
707 final x = bar();
708 baz(x.$1 + 1);
709 baz(x.foo);
710 }
711 )";
712
713 const auto& root_library = Library::Handle(LoadTestScript(kScript));
714 Invoke(root_library, "main");
715
716 const auto& function = Function::Handle(GetFunction(root_library, "main"));
717 TestPipeline pipeline(function, CompilerPass::kJIT);
718 FlowGraph* flow_graph = pipeline.RunPasses({});
719
720 auto entry = flow_graph->graph_entry()->normal_entry();
721 ILMatcher cursor(flow_graph, entry, /*trace=*/true,
722 ParallelMovesHandling::kSkip);
723
724 LoadFieldInstr* load1 = nullptr;
725 LoadFieldInstr* load2 = nullptr;
726
727 RELEASE_ASSERT(cursor.TryMatch({
728 kMoveGlob,
729 kMatchAndMoveStaticCall,
730 {kMatchAndMoveLoadField, &load1},
731 kMatchAndMoveCheckSmi,
732 kMatchAndMoveBinarySmiOp,
733 kMatchAndMoveMoveArgument,
734 kMatchAndMoveStaticCall,
735 {kMatchAndMoveLoadField, &load2},
736 kMatchAndMoveMoveArgument,
737 kMatchAndMoveStaticCall,
738 kMatchDartReturn,
739 }));
740
741 EXPECT_PROPERTY(load1->Type()->ToAbstractType(), it.IsIntType());
742 EXPECT_PROPERTY(load2->Type()->ToAbstractType(), it.IsStringType());
743}
SI void load2(const uint16_t *ptr, U16 *r, U16 *g)

◆ ISOLATE_UNIT_TEST_CASE() [427/463]

dart::ISOLATE_UNIT_TEST_CASE ( TypePropagator_RedefinitionAfterStrictCompareWithLoadClassId  )

Definition at line 94 of file type_propagator_test.cc.

95 {
96 CompilerState S(thread, /*is_aot=*/false, /*is_optimizing=*/true);
97
98 FlowGraphBuilderHelper H(/*num_parameters=*/1);
99 H.AddVariable("v0", AbstractType::ZoneHandle(Type::DynamicType()));
100
101 // We are going to build the following graph:
102 //
103 // B0[graph_entry]:
104 // B1[function_entry]:
105 // v0 <- Parameter(0)
106 // v1 <- LoadClassId(v0)
107 // if v1 == kDoubleCid then B2 else B3
108 // B2:
109 // Return(v0)
110 // B3:
111 // Return(v0)
112
113 Definition* v0;
114 auto b1 = H.flow_graph()->graph_entry()->normal_entry();
115 auto b2 = H.TargetEntry();
116 auto b3 = H.TargetEntry();
117
118 {
119 BlockBuilder builder(H.flow_graph(), b1);
120 v0 = builder.AddParameter(0, kTagged);
121 auto load_cid = builder.AddDefinition(new LoadClassIdInstr(new Value(v0)));
122 builder.AddBranch(
124 InstructionSource(), Token::kEQ_STRICT, new Value(load_cid),
125 new Value(H.IntConstant(kDoubleCid)),
126 /*needs_number_check=*/false, S.GetNextDeoptId()),
127 b2, b3);
128 }
129
130 {
131 BlockBuilder builder(H.flow_graph(), b2);
132 builder.AddReturn(new Value(v0));
133 }
134
135 {
136 BlockBuilder builder(H.flow_graph(), b3);
137 builder.AddReturn(new Value(v0));
138 }
139
140 H.FinishGraph();
141
142 FlowGraphTypePropagator::Propagate(H.flow_graph());
143
144 // There should be no information available about the incoming type of
145 // the parameter either on entry or in B3.
147 auto b3_value = b3->last_instruction()->AsDartReturn()->value();
148 EXPECT(b3_value->Type() == v0->Type());
149
150 // In B3 v0 is constrained by comparison of its cid with kDoubleCid - it
151 // should be non-nullable double. There should be a Redefinition inserted to
152 // prevent LICM past the branch.
153 auto b2_value = b2->last_instruction()->AsDartReturn()->value();
154 EXPECT_PROPERTY(b2_value->Type(), it.IsDouble());
155 EXPECT_PROPERTY(b2_value->definition(), it.IsRedefinition());
156 EXPECT_PROPERTY(b2_value->definition()->GetBlock(), &it == b2);
157}

◆ ISOLATE_UNIT_TEST_CASE() [428/463]

dart::ISOLATE_UNIT_TEST_CASE ( TypePropagator_RedefinitionAfterStrictCompareWithNull  )

Definition at line 28 of file type_propagator_test.cc.

28 {
29 CompilerState S(thread, /*is_aot=*/false, /*is_optimizing=*/true);
30
31 FlowGraphBuilderHelper H(/*num_parameters=*/1);
32 H.AddVariable("v0", AbstractType::ZoneHandle(Type::IntType()));
33
34 auto normal_entry = H.flow_graph()->graph_entry()->normal_entry();
35
36 // We are going to build the following graph:
37 //
38 // B0[graph_entry]:
39 // B1[function_entry]:
40 // v0 <- Parameter(0)
41 // if v0 == null then B2 else B3
42 // B2:
43 // Return(v0)
44 // B3:
45 // Return(v0)
46
47 Definition* v0;
48 auto b2 = H.TargetEntry();
49 auto b3 = H.TargetEntry();
50
51 {
52 BlockBuilder builder(H.flow_graph(), normal_entry);
53 v0 = builder.AddParameter(0, kTagged);
54 builder.AddBranch(
56 InstructionSource(), Token::kEQ_STRICT, new Value(v0),
57 new Value(H.flow_graph()->GetConstant(Object::Handle())),
58 /*needs_number_check=*/false, S.GetNextDeoptId()),
59 b2, b3);
60 }
61
62 {
63 BlockBuilder builder(H.flow_graph(), b2);
64 builder.AddReturn(new Value(v0));
65 }
66
67 {
68 BlockBuilder builder(H.flow_graph(), b3);
69 builder.AddReturn(new Value(v0));
70 }
71
72 H.FinishGraph();
73
74 FlowGraphTypePropagator::Propagate(H.flow_graph());
75
76 // We expect that v0 is inferred to be nullable int because that is what
77 // static type of an associated variable tells us.
78 EXPECT(v0->Type()->IsNullableInt());
79
80 // In B2 v0 should not have any additional type information so reaching
81 // type should be still nullable int.
82 auto b2_value = b2->last_instruction()->AsDartReturn()->value();
83 EXPECT(b2_value->Type()->IsNullableInt());
84
85 // In B3 v0 is constrained by comparison with null - it should be non-nullable
86 // integer. There should be a Redefinition inserted to prevent LICM past
87 // the branch.
88 auto b3_value = b3->last_instruction()->AsDartReturn()->value();
89 EXPECT(b3_value->Type()->IsInt());
90 EXPECT(b3_value->definition()->IsRedefinition());
91 EXPECT(b3_value->definition()->GetBlock() == b3);
92}

◆ ISOLATE_UNIT_TEST_CASE() [429/463]

dart::ISOLATE_UNIT_TEST_CASE ( TypePropagator_Refinement  )

Definition at line 159 of file type_propagator_test.cc.

159 {
160 CompilerState S(thread, /*is_aot=*/false, /*is_optimizing=*/true);
161
162 const Class& object_class =
163 Class::Handle(thread->isolate_group()->object_store()->object_class());
164
165 const FunctionType& signature = FunctionType::Handle(FunctionType::New());
166 const Function& target_func = Function::ZoneHandle(Function::New(
167 signature, String::Handle(Symbols::New(thread, "dummy2")),
168 UntaggedFunction::kRegularFunction,
169 /*is_static=*/true,
170 /*is_const=*/false,
171 /*is_abstract=*/false,
172 /*is_external=*/false,
173 /*is_native=*/true, object_class, TokenPosition::kNoSource));
174 signature.set_result_type(AbstractType::Handle(Type::IntType()));
175
176 const Field& field = Field::ZoneHandle(
177 Field::New(String::Handle(Symbols::New(thread, "dummy")),
178 /*is_static=*/true,
179 /*is_final=*/false,
180 /*is_const=*/false,
181 /*is_reflectable=*/true,
182 /*is_late=*/false, object_class, Object::dynamic_type(),
183 TokenPosition::kNoSource, TokenPosition::kNoSource));
184 {
185 SafepointWriteRwLocker locker(thread,
186 thread->isolate_group()->program_lock());
187 thread->isolate_group()->RegisterStaticField(field, Object::Handle());
188 }
189
190 FlowGraphBuilderHelper H(/*num_parameters=*/1);
191 H.AddVariable("v0", AbstractType::ZoneHandle(Type::DynamicType()));
192
193 // We are going to build the following graph:
194 //
195 // B0[graph_entry]
196 // B1[function_entry]:
197 // v0 <- Parameter(0)
198 // v1 <- Constant(0)
199 // if v0 == 1 then B3 else B2
200 // B2:
201 // v2 <- StaticCall(target_func)
202 // goto B4
203 // B3:
204 // goto B4
205 // B4:
206 // v3 <- phi(v1, v2)
207 // return v5
208
209 Definition* v0;
210 Definition* v2;
211 PhiInstr* v3;
212 auto b1 = H.flow_graph()->graph_entry()->normal_entry();
213 auto b2 = H.TargetEntry();
214 auto b3 = H.TargetEntry();
215 auto b4 = H.JoinEntry();
216
217 {
218 BlockBuilder builder(H.flow_graph(), b1);
219 v0 = builder.AddParameter(0, kTagged);
220 builder.AddBranch(new StrictCompareInstr(
221 InstructionSource(), Token::kEQ_STRICT, new Value(v0),
222 new Value(H.IntConstant(1)),
223 /*needs_number_check=*/false, S.GetNextDeoptId()),
224 b2, b3);
225 }
226
227 {
228 BlockBuilder builder(H.flow_graph(), b2);
229 v2 = builder.AddDefinition(
230 new StaticCallInstr(InstructionSource(), target_func,
231 /*type_args_len=*/0,
232 /*argument_names=*/Array::empty_array(),
233 InputsArray(0), S.GetNextDeoptId(),
234 /*call_count=*/0, ICData::RebindRule::kStatic));
235 builder.AddInstruction(new GotoInstr(b4, S.GetNextDeoptId()));
236 }
237
238 {
239 BlockBuilder builder(H.flow_graph(), b3);
240 builder.AddInstruction(new GotoInstr(b4, S.GetNextDeoptId()));
241 }
242
243 {
244 BlockBuilder builder(H.flow_graph(), b4);
245 v3 = H.Phi(b4, {{b2, v2}, {b3, H.IntConstant(0)}});
246 builder.AddPhi(v3);
247 builder.AddReturn(new Value(v3));
248 }
249
250 H.FinishGraph();
251 FlowGraphTypePropagator::Propagate(H.flow_graph());
252
253 EXPECT_PROPERTY(v2->Type(), it.IsNullableInt());
254 EXPECT_PROPERTY(v3->Type(), it.IsNullableInt());
255
256 auto v4 = new LoadStaticFieldInstr(field, InstructionSource());
257 H.flow_graph()->InsertBefore(v2, v4, nullptr, FlowGraph::kValue);
258 v2->ReplaceUsesWith(v4);
259 v2->RemoveFromGraph();
260
261 FlowGraphTypePropagator::Propagate(H.flow_graph());
262
263 EXPECT_PROPERTY(v3->Type(), it.IsNullableInt());
264}
static SkV4 v4(SkV3 v, SkScalar w)
Definition SkM44.cpp:329

◆ ISOLATE_UNIT_TEST_CASE() [430/463]

dart::ISOLATE_UNIT_TEST_CASE ( TypePropagator_Regress36156  )

Definition at line 268 of file type_propagator_test.cc.

268 {
269 CompilerState S(thread, /*is_aot=*/false, /*is_optimizing=*/true);
270 FlowGraphBuilderHelper H(/*num_parameters=*/1);
271 H.AddVariable("v0", AbstractType::ZoneHandle(Type::DynamicType()));
272
273 // We are going to build the following graph:
274 //
275 // B0[graph_entry]
276 // B1[function_entry]:
277 // v0 <- Parameter(0)
278 // v1 <- Constant(42)
279 // v2 <- Constant(24)
280 // v4 <- Constant(1.0)
281 // if v0 == 1 then B6 else B2
282 // B2:
283 // if v0 == 2 then B3 else B4
284 // B3:
285 // goto B5
286 // B4:
287 // goto B5
288 // B5:
289 // v3 <- phi(v1, v2)
290 // goto B7
291 // B6:
292 // goto B7
293 // B7:
294 // v5 <- phi(v4, v3)
295 // return v5
296
297 Definition* v0;
298 PhiInstr* v3;
299 PhiInstr* v5;
300 auto b1 = H.flow_graph()->graph_entry()->normal_entry();
301 auto b2 = H.TargetEntry();
302 auto b3 = H.TargetEntry();
303 auto b4 = H.TargetEntry();
304 auto b5 = H.JoinEntry();
305 auto b6 = H.TargetEntry();
306 auto b7 = H.JoinEntry();
307
308 {
309 BlockBuilder builder(H.flow_graph(), b1);
310 v0 = builder.AddParameter(0, kTagged);
311 builder.AddBranch(new StrictCompareInstr(
312 InstructionSource(), Token::kEQ_STRICT, new Value(v0),
313 new Value(H.IntConstant(1)),
314 /*needs_number_check=*/false, S.GetNextDeoptId()),
315 b6, b2);
316 }
317
318 {
319 BlockBuilder builder(H.flow_graph(), b2);
320 builder.AddBranch(new StrictCompareInstr(
321 InstructionSource(), Token::kEQ_STRICT, new Value(v0),
322 new Value(H.IntConstant(2)),
323 /*needs_number_check=*/false, S.GetNextDeoptId()),
324 b3, b4);
325 }
326
327 {
328 BlockBuilder builder(H.flow_graph(), b3);
329 builder.AddInstruction(new GotoInstr(b5, S.GetNextDeoptId()));
330 }
331
332 {
333 BlockBuilder builder(H.flow_graph(), b4);
334 builder.AddInstruction(new GotoInstr(b5, S.GetNextDeoptId()));
335 }
336
337 {
338 BlockBuilder builder(H.flow_graph(), b5);
339 v3 = H.Phi(b5, {{b3, H.IntConstant(42)}, {b4, H.IntConstant(24)}});
340 builder.AddPhi(v3);
341 builder.AddInstruction(new GotoInstr(b7, S.GetNextDeoptId()));
342 }
343
344 {
345 BlockBuilder builder(H.flow_graph(), b6);
346 builder.AddInstruction(new GotoInstr(b7, S.GetNextDeoptId()));
347 }
348
349 {
350 BlockBuilder builder(H.flow_graph(), b7);
351 v5 = H.Phi(b7, {{b5, v3}, {b6, H.DoubleConstant(1.0)}});
352 builder.AddPhi(v5);
353 builder.AddInstruction(new DartReturnInstr(
354 InstructionSource(), new Value(v5), S.GetNextDeoptId()));
355 }
356
357 H.FinishGraph();
358
359 FlowGraphTypePropagator::Propagate(H.flow_graph());
360
361 // We expect that v3 has an integer type, and v5 is either T{Object} or
362 // T{num}.
363 EXPECT_PROPERTY(v3->Type(), it.IsInt());
365 it.IsObjectType() || it.IsNumberType());
366
367 // Now unbox v3 phi by inserting unboxing for both inputs and boxing
368 // for the result.
369 {
370 v3->set_representation(kUnboxedInt64);
371 for (intptr_t i = 0; i < v3->InputCount(); i++) {
372 auto input = v3->InputAt(i);
373 auto unbox =
374 new UnboxInt64Instr(input->CopyWithType(), S.GetNextDeoptId(),
375 Instruction::kNotSpeculative);
376 H.flow_graph()->InsertBefore(
377 v3->block()->PredecessorAt(i)->last_instruction(), unbox, nullptr,
378 FlowGraph::kValue);
379 input->BindTo(unbox);
380 }
381
382 auto box = new BoxInt64Instr(new Value(v3));
383 v3->ReplaceUsesWith(box);
384 H.flow_graph()->InsertBefore(b4->last_instruction(), box, nullptr,
385 FlowGraph::kValue);
386 }
387
388 // Run type propagation again.
389 FlowGraphTypePropagator::Propagate(H.flow_graph());
390
391 // If CompileType of v3 would be cached as a reaching type at its use in
392 // v5 then we will be incorrect type propagation results.
393 // We expect that v3 has an integer type, and v5 is either T{Object} or
394 // T{num}.
395 EXPECT_PROPERTY(v3->Type(), it.IsInt());
397 it.IsObjectType() || it.IsNumberType());
398}
bool IsObjectType() const
Definition object.h:9181
void ReplaceUsesWith(Definition *other)
Definition il.cc:1484
virtual void set_representation(Representation r)
Definition il.h:2826

◆ ISOLATE_UNIT_TEST_CASE() [431/463]

dart::ISOLATE_UNIT_TEST_CASE ( TypePropagator_RegressFlutter76919  )

Definition at line 493 of file type_propagator_test.cc.

493 {
494 CompilerState S(thread, /*is_aot=*/true, /*is_optimizing=*/true);
495
496 FlowGraphBuilderHelper H(/*num_parameters=*/1);
497 H.AddVariable("v0", AbstractType::ZoneHandle(Type::DynamicType()));
498
499 auto normal_entry = H.flow_graph()->graph_entry()->normal_entry();
500
501 // We are going to build the following graph:
502 //
503 // B0[graph_entry]:
504 // B1[function_entry]:
505 // v0 <- Parameter(0)
506 // AssertAssignable(v0, 'int')
507 // CheckSmi(v0)
508 // Return(v0)
509
510 {
511 BlockBuilder builder(H.flow_graph(), normal_entry);
512 Definition* v0 = builder.AddParameter(0, kTagged);
513 auto null_value = builder.AddNullDefinition();
514 builder.AddDefinition(new AssertAssignableInstr(
515 InstructionSource(), new Value(v0),
516 new Value(
517 H.flow_graph()->GetConstant(Type::ZoneHandle(Type::IntType()))),
518 new Value(null_value), new Value(null_value), Symbols::Value(),
519 S.GetNextDeoptId()));
520 builder.AddInstruction(new CheckSmiInstr(new Value(v0), S.GetNextDeoptId(),
522 builder.AddReturn(new Value(v0));
523 }
524
525 H.FinishGraph();
526
527 H.flow_graph()->EliminateEnvironments();
528 FlowGraphTypePropagator::Propagate(H.flow_graph()); // Should not crash.
529}

◆ ISOLATE_UNIT_TEST_CASE() [432/463]

dart::ISOLATE_UNIT_TEST_CASE ( Utf8Decode  )

Definition at line 64 of file unicode_test.cc.

64 {
65 // Examples from the Unicode specification, chapter 3
66 {
67 const char* src = "\x41\xC3\xB1\x42";
68 int32_t expected[] = {0x41, 0xF1, 0x42};
69 int32_t dst[ARRAY_SIZE(expected)];
70 memset(dst, 0, sizeof(dst));
71 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
73 EXPECT(!memcmp(expected, dst, sizeof(expected)));
74 }
75
76 {
77 const char* src = "\x4D";
78 int32_t expected[] = {0x4D};
79 int32_t dst[ARRAY_SIZE(expected)];
80 memset(dst, 0, sizeof(dst));
81 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
83 EXPECT(!memcmp(expected, dst, sizeof(expected)));
84 }
85
86 {
87 const char* src = "\xD0\xB0";
88 int32_t expected[] = {0x430};
89 int32_t dst[ARRAY_SIZE(expected)];
90 memset(dst, 0, sizeof(dst));
91 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
93 EXPECT(!memcmp(expected, dst, sizeof(expected)));
94 }
95
96 {
97 const char* src = "\xE4\xBA\x8C";
98 int32_t expected[] = {0x4E8C};
99 int32_t dst[ARRAY_SIZE(expected)];
100 memset(dst, 0, sizeof(dst));
101 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
103 EXPECT(!memcmp(expected, dst, sizeof(expected)));
104 }
105
106 {
107 const char* src = "\xF0\x90\x8C\x82";
108 int32_t expected[] = {0x10302};
109 int32_t dst[ARRAY_SIZE(expected)];
110 memset(dst, 0, sizeof(dst));
111 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
113 EXPECT(!memcmp(expected, dst, sizeof(expected)));
114 }
115
116 {
117 const char* src = "\x4D\xD0\xB0\xE4\xBA\x8C\xF0\x90\x8C\x82";
118 int32_t expected[] = {0x4D, 0x430, 0x4E8C, 0x10302};
119 int32_t dst[ARRAY_SIZE(expected)];
120 memset(dst, 0, sizeof(dst));
121 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
123 EXPECT(!memcmp(expected, dst, sizeof(expected)));
124 }
125
126 // Mixture of non-ASCII and ASCII characters
127 {
128 const char* src =
129 "\xD7\x92\xD7\x9C\xD7\xA2\xD7\x93"
130 "\x20"
131 "\xD7\x91\xD7\xA8\xD7\x9B\xD7\x94";
132 int32_t expected[] = {0x5D2, 0x5DC, 0x5E2, 0x5D3, 0x20,
133 0x5D1, 0x5E8, 0x5DB, 0x5D4};
134 int32_t dst[ARRAY_SIZE(expected)];
135 memset(dst, 0, sizeof(dst));
136 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
138 EXPECT(!memcmp(expected, dst, sizeof(expected)));
139 }
140
141 // http://www.cl.cam.ac.uk/~mgk25/ucs/examples/UTF-8-test.txt
142
143 // 1 - Some correct UTF-8 text
144 {
145 const char* src = "\xCE\xBA\xE1\xBD\xB9\xCF\x83\xCE\xBC\xCE\xB5";
146 int32_t expected[] = {0x3BA, 0x1F79, 0x3C3, 0x3BC, 0x3B5};
147 int32_t dst[ARRAY_SIZE(expected)];
148 memset(dst, 0, sizeof(dst));
149 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
151 EXPECT(!memcmp(expected, dst, sizeof(expected)));
152 }
153
154 // 2 - Boundary condition test cases
155
156 // 2.1 - First possible sequence of a certain length
157
158 // 2.1.1 - 1 byte (U-00000000): "\x00"
159 {
160 const char* src = "\x00";
161 int32_t expected[] = {0x0};
162 int32_t dst[ARRAY_SIZE(expected)];
163 memset(dst, 0xFF, sizeof(dst));
164 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
166 EXPECT(memcmp(expected, dst, sizeof(expected)));
167 }
168
169 // 2.1.2 - 2 bytes (U-00000080): "\xC2\x80"
170 {
171 const char* src = "\xC2\x80";
172 int32_t expected[] = {0x80};
173 int32_t dst[ARRAY_SIZE(expected)];
174 memset(dst, 0, sizeof(dst));
175 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
177 EXPECT(!memcmp(expected, dst, sizeof(expected)));
178 }
179
180 // 2.1.3 - 3 bytes (U-00000800): "\xE0\xA0\x80"
181 {
182 const char* src = "\xE0\xA0\x80";
183 int32_t expected[] = {0x800};
184 int32_t dst[ARRAY_SIZE(expected)];
185 memset(dst, 0, sizeof(dst));
186 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
188 EXPECT(!memcmp(expected, dst, sizeof(expected)));
189 }
190
191 // 2.1.4 - 4 bytes (U-00010000): "\xF0\x90\x80\x80"
192 {
193 const char* src = "\xF0\x90\x80\x80";
194 int32_t expected[] = {0x10000};
195 int32_t dst[ARRAY_SIZE(expected)];
196 memset(dst, 0, sizeof(dst));
197 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
199 EXPECT(!memcmp(expected, dst, sizeof(expected)));
200 }
201
202 // 2.1.5 - 5 bytes (U-00200000): "\xF8\x88\x80\x80\x80"
203 {
204 const char* src = "\xF8\x88\x80\x80\x80";
205 int32_t expected[] = {0x200000};
206 int32_t dst[ARRAY_SIZE(expected)];
207 memset(dst, 0, sizeof(dst));
208 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
210 EXPECT(memcmp(expected, dst, sizeof(expected)));
211 }
212
213 // 2.1.6 - 6 bytes (U-04000000): "\xFC\x84\x80\x80\x80\x80"
214 {
215 const char* src = "\xFC\x84\x80\x80\x80\x80";
216 int32_t expected[] = {0x400000};
217 int32_t dst[ARRAY_SIZE(expected)];
218 memset(dst, 0, sizeof(dst));
219 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
221 EXPECT(memcmp(expected, dst, sizeof(expected)));
222 }
223
224 // 2.2 - Last possible sequence of a certain length
225
226 // 2.2.1 - 1 byte (U-0000007F): "\x7F"
227 {
228 const char* src = "\x7F";
229 int32_t expected[] = {0x7F};
230 int32_t dst[ARRAY_SIZE(expected)];
231 memset(dst, 0, sizeof(dst));
232 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
234 EXPECT(!memcmp(expected, dst, sizeof(expected)));
235 }
236
237 // 2.2.2 - 2 bytes (U-000007FF): "\xDF\xBF"
238 {
239 const char* src = "\xDF\xBF";
240 int32_t expected[] = {0x7FF};
241 int32_t dst[ARRAY_SIZE(expected)];
242 memset(dst, 0, sizeof(dst));
243 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
245 EXPECT(!memcmp(expected, dst, sizeof(expected)));
246 }
247
248 // 2.2.3 - 3 bytes (U-0000FFFF): "\xEF\xBF\xBF"
249 {
250 const char* src = "\xEF\xBF\xBF";
251 int32_t expected[] = {0xFFFF};
252 int32_t dst[ARRAY_SIZE(expected)];
253 memset(dst, 0, sizeof(dst));
254 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
256 EXPECT(!memcmp(expected, dst, sizeof(expected)));
257 }
258
259 // 2.2.4 - 4 bytes (U-001FFFFF): "\xF7\xBF\xBF\xBF"
260 {
261 const char* src = "\xF7\xBF\xBF\xBF";
262 int32_t expected[] = {0x1FFFF};
263 int32_t dst[ARRAY_SIZE(expected)];
264 memset(dst, 0, sizeof(dst));
265 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
267 EXPECT(memcmp(expected, dst, sizeof(expected)));
268 }
269
270 // 2.2.5 - 5 bytes (U-03FFFFFF): "\xFB\xBF\xBF\xBF\xBF"
271 {
272 const char* src = "\xFB\xBF\xBF\xBF\xBF";
273 int32_t expected[] = {0x3FFFFFF};
274 int32_t dst[ARRAY_SIZE(expected)];
275 memset(dst, 0, sizeof(dst));
276 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
278 EXPECT(memcmp(expected, dst, sizeof(expected)));
279 }
280
281 // 2.2.6 - 6 bytes (U-7FFFFFFF): "\xFD\xBF\xBF\xBF\xBF\xBF"
282 {
283 const char* src = "\xFD\xBF\xBF\xBF\xBF\xBF";
284 int32_t expected[] = {0x7FFFFFF};
285 int32_t dst[ARRAY_SIZE(expected)];
286 memset(dst, 0, sizeof(dst));
287 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
289 EXPECT(memcmp(expected, dst, sizeof(expected)));
290 }
291
292 // 2.3 - Other boundary conditions
293
294 // 2.3.1 - U-0000D7FF = ed 9f bf = "\xED\x9F\xBF"
295 {
296 const char* src = "\xED\x9F\xBF";
297 int32_t expected[] = {0xD7FF};
298 int32_t dst[ARRAY_SIZE(expected)];
299 memset(dst, 0, sizeof(dst));
300 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
302 EXPECT(!memcmp(expected, dst, sizeof(expected)));
303 }
304
305 // 2.3.2 - U-0000E000 = ee 80 80 = "\xEE\x80\x80"
306 {
307 const char* src = "\xEE\x80\x80";
308 int32_t expected[] = {0xE000};
309 int32_t dst[ARRAY_SIZE(expected)];
310 memset(dst, 0, sizeof(dst));
311 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
313 EXPECT(!memcmp(expected, dst, sizeof(expected)));
314 }
315
316 // 2.3.3 - U-0000FFFD = ef bf bd = "\xEF\xBF\xBD"
317 {
318 const char* src = "\xEF\xBF\xBD";
319 int32_t expected[] = {0xFFFD};
320 int32_t dst[ARRAY_SIZE(expected)];
321 memset(dst, 0, sizeof(dst));
322 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
324 EXPECT(!memcmp(expected, dst, sizeof(expected)));
325 }
326
327 // 2.3.4 - U-0010FFFF = f4 8f bf bf = "\xF4\x8F\xBF\xBF"
328 {
329 const char* src = "\xF4\x8F\xBF\xBF";
330 int32_t expected[] = {0x10FFFF};
331 int32_t dst[ARRAY_SIZE(expected)];
332 memset(dst, 0, sizeof(dst));
333 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
335 EXPECT(!memcmp(expected, dst, sizeof(expected)));
336 }
337
338 // 2.3.5 - U-00110000 = f4 90 80 80 = "\xF4\x90\x80\x80"
339 {
340 const char* src = "\xF4\x90\x80\x80";
341 int32_t expected[] = {0x110000};
342 int32_t dst[ARRAY_SIZE(expected)];
343 memset(dst, 0, sizeof(dst));
344 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
346 EXPECT(memcmp(expected, dst, sizeof(expected)));
347 }
348
349 // 3 - Malformed sequences
350
351 // 3.1 - Unexpected continuation bytes
352
353 // 3.1.1 - First continuation byte 0x80: "\x80"
354 {
355 const char* src = "\x80";
356 int32_t expected[] = {0x80};
357 int32_t dst[ARRAY_SIZE(expected)];
358 memset(dst, 0, sizeof(dst));
359 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
361 EXPECT(memcmp(expected, dst, sizeof(expected)));
362 }
363
364 // 3.1.2 - Last continuation byte 0xbf: "\xBF"
365 {
366 const char* src = "\xBF";
367 int32_t expected[] = {0xBF};
368 int32_t dst[ARRAY_SIZE(expected)];
369 memset(dst, 0, sizeof(dst));
370 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
372 EXPECT(memcmp(expected, dst, sizeof(expected)));
373 }
374
375 // 3.1.3 - 2 continuation bytes: "\x80\xBF"
376 {
377 const char* src = "\x80\xBF";
378 int32_t expected[] = {0x80, 0xBF};
379 int32_t dst[ARRAY_SIZE(expected)];
380 memset(dst, 0, sizeof(dst));
381 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
383 EXPECT(memcmp(expected, dst, sizeof(expected)));
384 }
385
386 // 3.1.4 - 3 continuation bytes: "\x80\xBF\x80"
387 {
388 const char* src = "\x80\xBF\x80";
389 int32_t expected[] = {0x80, 0xBF, 0x80};
390 int32_t dst[ARRAY_SIZE(expected)];
391 memset(dst, 0, sizeof(dst));
392 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
394 EXPECT(memcmp(expected, dst, sizeof(expected)));
395 }
396
397 // 3.1.5 - 4 continuation bytes: "\x80\xBF\x80\xBF"
398 {
399 const char* src = "\x80\xBF\x80\xBF";
400 int32_t expected[] = {0x80, 0xBF, 0x80, 0xBF};
401 int32_t dst[ARRAY_SIZE(expected)];
402 memset(dst, 0, sizeof(dst));
403 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
405 EXPECT(memcmp(expected, dst, sizeof(expected)));
406 }
407
408 // 3.1.6 - 5 continuation bytes: "\x80\xBF\x80\xBF\x80"
409 {
410 const char* src = "\x80\xBF\x80\xBF\x80";
411 int32_t expected[] = {0x80, 0xBF, 0x80, 0xBF, 0x80};
412 int32_t dst[ARRAY_SIZE(expected)];
413 memset(dst, 0, sizeof(dst));
414 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
416 EXPECT(memcmp(expected, dst, sizeof(expected)));
417 }
418
419 // 3.1.7 - 6 continuation bytes: "\x80\xBF\x80\xBF\x80\xBF"
420 {
421 const char* src = "\x80\xBF\x80\xBF\x80\xBF";
422 int32_t expected[] = {0x80, 0xBF, 0x80, 0xBF, 0x80, 0xBF};
423 int32_t dst[ARRAY_SIZE(expected)];
424 memset(dst, 0, sizeof(dst));
425 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
427 EXPECT(memcmp(expected, dst, sizeof(expected)));
428 }
429
430 // 3.1.8 - 7 continuation bytes: "\x80\xBF\x80\xBF\x80\xBF\x80"
431 {
432 const char* src = "\x80\xBF\x80\xBF\x80\xBF\x80";
433 int32_t expected[] = {0x80, 0xBF, 0x80, 0xBF, 0x80, 0xBF, 0x80};
434 int32_t dst[ARRAY_SIZE(expected)];
435 memset(dst, 0, sizeof(dst));
436 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
438 EXPECT(memcmp(expected, dst, sizeof(expected)));
439 }
440
441 // 3.1.9 - Sequence of all 64 possible continuation bytes (0x80-0xbf):
442 {
443 const char* src =
444 "\x80\x81\x82\x83\x84\x85\x86\x87"
445 "\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F"
446 "\x90\x91\x92\x93\x94\x95\x96\x97"
447 "\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F"
448 "\xA0\xA1\xA2\xA3\xA4\xA5\xA6\xA7"
449 "\xA8\xA9\xAA\xAB\xAC\xAD\xAE\xAF"
450 "\xB0\xB1\xB2\xB3\xB4\xB5\xB6\xB7"
451 "\xB8\xB9\xBA\xBB\xBC\xBD\xBE\xBF";
452 int32_t expected[] = {0x0};
453 int32_t dst[ARRAY_SIZE(expected)];
454 for (size_t i = 0; i < strlen(src); ++i) {
455 memset(dst, 0xFF, sizeof(dst));
456 bool is_valid = Utf8::DecodeCStringToUTF32(&src[i], dst, ARRAY_SIZE(dst));
458 EXPECT(memcmp(expected, dst, sizeof(expected)));
459 }
460 }
461
462 // 3.2 - Lonely start character
463
464 // 3.2.1 - All 32 first bytes of 2-byte sequences (0xc0-0xdf), each
465 // followed by a space character:
466 {
467 const char* src =
468 "\xC0\x20\xC1\x20\xC2\x20\xC3\x20"
469 "\xC4\x20\xC5\x20\xC6\x20\xC7\x20"
470 "\xC8\x20\xC9\x20\xCA\x20\xCB\x20"
471 "\xCC\x20\xCD\x20\xCE\x20\xCF\x20"
472 "\xD0\x20\xD1\x20\xD2\x20\xD3\x20"
473 "\xD4\x20\xD5\x20\xD6\x20\xD7\x20"
474 "\xD8\x20\xD9\x20\xDA\x20\xDB\x20"
475 "\xDC\x20\xDD\x20\xDE\x20\xDF\x20";
476 int32_t expected[] = {0x0};
477 int32_t dst[ARRAY_SIZE(expected)];
478 for (size_t i = 0; i < strlen(src); i += 2) {
479 memset(dst, 0xFF, sizeof(dst));
480 bool is_valid = Utf8::DecodeCStringToUTF32(&src[i], dst, ARRAY_SIZE(dst));
482 EXPECT(memcmp(expected, dst, sizeof(expected)));
483 }
484 }
485
486 // 3.2.2 - All 16 first bytes of 3-byte sequences (0xe0-0xef), each
487 // followed by a space character:
488 {
489 const char* src =
490 "\xE0\x20\xE1\x20\xE2\x20\xE3\x20"
491 "\xE4\x20\xE5\x20\xE6\x20\xE7\x20"
492 "\xE8\x20\xE9\x20\xEA\x20\xEB\x20"
493 "\xEC\x20\xED\x20\xEE\x20\xEF\x20";
494 int32_t expected[] = {0x0};
495 int32_t dst[ARRAY_SIZE(expected)];
496 for (size_t i = 0; i < strlen(src); i += 2) {
497 memset(dst, 0xFF, sizeof(dst));
498 bool is_valid = Utf8::DecodeCStringToUTF32(&src[i], dst, ARRAY_SIZE(dst));
500 EXPECT(memcmp(expected, dst, sizeof(expected)));
501 }
502 }
503
504 // 3.2.3 - All 8 first bytes of 4-byte sequences (0xf0-0xf7), each
505 // followed by a space character:
506 {
507 const char* src =
508 "\xF0\x20\xF1\x20\xF2\x20\xF3\x20"
509 "\xF4\x20\xF5\x20\xF6\x20\xF7\x20";
510 int32_t expected[] = {0x0};
511 int32_t dst[ARRAY_SIZE(expected)];
512 for (size_t i = 0; i < strlen(src); i += 2) {
513 memset(dst, 0xFF, sizeof(dst));
514 bool is_valid = Utf8::DecodeCStringToUTF32(&src[i], dst, ARRAY_SIZE(dst));
516 EXPECT(memcmp(expected, dst, sizeof(expected)));
517 }
518 }
519
520 // 3.2.4 - All 4 first bytes of 5-byte sequences (0xf8-0xfb), each
521 // followed by a space character:
522 {
523 const char* src = "\xF8\x20\xF9\x20\xFA\x20\xFB\x20";
524 int32_t expected[] = {0x0};
525 int32_t dst[ARRAY_SIZE(expected)];
526 for (size_t i = 0; i < strlen(src); i += 2) {
527 memset(dst, 0xFF, sizeof(dst));
528 bool is_valid = Utf8::DecodeCStringToUTF32(&src[i], dst, ARRAY_SIZE(dst));
530 EXPECT(memcmp(expected, dst, sizeof(expected)));
531 }
532 }
533
534 // 3.2.5 - All 2 first bytes of 6-byte sequences (0xfc-0xfd), each
535 // followed by a space character:
536 {
537 const char* src = "\xFC\x20\xFD\x20";
538 int32_t expected[] = {0x0};
539 int32_t dst[ARRAY_SIZE(expected)];
540 for (size_t i = 0; i < strlen(src); i += 2) {
541 memset(dst, 0xFF, sizeof(dst));
542 bool is_valid = Utf8::DecodeCStringToUTF32(&src[i], dst, ARRAY_SIZE(dst));
544 EXPECT(memcmp(expected, dst, sizeof(expected)));
545 }
546 }
547
548 // 3.3 - Sequences with last continuation byte missing
549
550 // 3.3.1 - 2-byte sequence with last byte missing (U+0000): "\xC0"
551 {
552 const char* src = "\xC0";
553 int32_t expected[] = {0x0};
554 int32_t dst[ARRAY_SIZE(expected)];
555 memset(dst, 0xFF, sizeof(dst));
556 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
558 EXPECT(memcmp(expected, dst, sizeof(expected)));
559 }
560
561 // 3.3.2 - 3-byte sequence with last byte missing (U+0000): "\xE0\x80"
562 {
563 const char* src = "\xE0\x80";
564 int32_t expected[] = {0x0};
565 int32_t dst[ARRAY_SIZE(expected)];
566 memset(dst, 0xFF, sizeof(dst));
567 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
569 EXPECT(memcmp(expected, dst, sizeof(expected)));
570 }
571
572 // 3.3.3 - 4-byte sequence with last byte missing (U+0000): "\xF0\x80\x80"
573 {
574 const char* src = "\xF0\x80\x80";
575 int32_t expected[] = {0x0};
576 int32_t dst[ARRAY_SIZE(expected)];
577 memset(dst, 0xFF, sizeof(dst));
578 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
580 EXPECT(memcmp(expected, dst, sizeof(expected)));
581 }
582
583 // 3.3.4 - 5-byte sequence with last byte missing (U+0000): "\xF8\x80\x80\x80"
584 {
585 const char* src = "\xF8\x80\x80\x80";
586 int32_t expected[] = {0x0};
587 int32_t dst[ARRAY_SIZE(expected)];
588 memset(dst, 0xFF, sizeof(dst));
589 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
591 EXPECT(memcmp(expected, dst, sizeof(expected)));
592 }
593
594 // 3.3.5 - 6-byte sequence with last byte missing (U+0000):
595 // "\xFC\x80\x80\x80\x80"
596 {
597 const char* src = "\xFC\x80\x80\x80\x80";
598 int32_t expected[] = {0x0};
599 int32_t dst[ARRAY_SIZE(expected)];
600 memset(dst, 0xFF, sizeof(dst));
601 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
603 EXPECT(memcmp(expected, dst, sizeof(expected)));
604 }
605
606 // 3.3.6 - 2-byte sequence with last byte missing (U-000007FF): "\xDF"
607 {
608 const char* src = "\xDF";
609 int32_t expected[] = {0x0};
610 int32_t dst[ARRAY_SIZE(expected)];
611 memset(dst, 0xFF, sizeof(dst));
612 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
614 EXPECT(memcmp(expected, dst, sizeof(expected)));
615 }
616
617 // 3.3.7 - 3-byte sequence with last byte missing (U-0000FFFF): "\xEF\xBF"
618 {
619 const char* src = "\xEF\xBF";
620 int32_t expected[] = {0x0};
621 int32_t dst[ARRAY_SIZE(expected)];
622 memset(dst, 0xFF, sizeof(dst));
623 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
625 EXPECT(memcmp(expected, dst, sizeof(expected)));
626 }
627
628 // 3.3.8 - 4-byte sequence with last byte missing (U-001FFFFF): "\xF7\xBF\xBF"
629 {
630 const char* src = "\xF7\xBF\xBF";
631 int32_t expected[] = {0x0};
632 int32_t dst[ARRAY_SIZE(expected)];
633 memset(dst, 0xFF, sizeof(dst));
634 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
636 EXPECT(memcmp(expected, dst, sizeof(expected)));
637 }
638
639 // 3.3.9 - 5-byte sequence with last byte missing (U-03FFFFFF):
640 // "\xFB\xBF\xBF\xBF"
641 {
642 const char* src = "\xFB\xBF\xBF\xBF";
643 int32_t expected[] = {0x0};
644 int32_t dst[ARRAY_SIZE(expected)];
645 memset(dst, 0xFF, sizeof(dst));
646 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
648 EXPECT(memcmp(expected, dst, sizeof(expected)));
649 }
650
651 // 3.3.10 - 6-byte sequence with last byte missing (U-7FFFFFFF):
652 // "\xFD\xBF\xBF\xBF\xBF"
653 {
654 const char* src = "\xFD\xBF\xBF\xBF\xBF";
655 int32_t expected[] = {0x0};
656 int32_t dst[ARRAY_SIZE(expected)];
657 memset(dst, 0xFF, sizeof(dst));
658 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
660 EXPECT(memcmp(expected, dst, sizeof(expected)));
661 }
662
663 // 3.4 - Concatenation of incomplete sequences
664 {
665 const char* src =
666 "\xC0\xE0\x80\xF0\x80\x80"
667 "\xF8\x80\x80\x80\xFC\x80"
668 "\x80\x80\x80\xDF\xEF\xBF"
669 "\xF7\xBF\xBF\xFB\xBF\xBF"
670 "\xBF\xFD\xBF\xBF\xBF\xBF";
671 int32_t expected[] = {0x0};
672 int32_t dst[ARRAY_SIZE(expected)];
673 for (size_t i = 0; i < strlen(src); ++i) {
674 for (size_t j = 1; j < (strlen(src) - i); ++j) {
675 memset(dst, 0xFF, sizeof(dst));
676 bool is_valid =
677 Utf8::DecodeCStringToUTF32(&src[i], dst, ARRAY_SIZE(dst));
679 EXPECT(memcmp(expected, dst, sizeof(expected)));
680 }
681 }
682 }
683
684 // 3.5 - Impossible bytes
685
686 // 3.5.1 - fe = "\xFE"
687 {
688 const char* src = "\xFE";
689 int32_t expected[] = {0xFE};
690 int32_t dst[ARRAY_SIZE(expected)];
691 memset(dst, 0, sizeof(dst));
692 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
694 EXPECT(memcmp(expected, dst, sizeof(expected)));
695 }
696
697 // 3.5.2 - ff = "\xFF"
698 {
699 const char* src = "\xFF";
700 int32_t expected[] = {0xFF};
701 int32_t dst[ARRAY_SIZE(expected)];
702 memset(dst, 0, sizeof(dst));
703 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
705 EXPECT(memcmp(expected, dst, sizeof(expected)));
706 }
707
708 // 3.5.3 - fe fe ff ff = "\xFE\xFE\xFF\xFF"
709 {
710 const char* src = "\xFE\xFE\xFF\xFF";
711 int32_t expected[] = {0xFF};
712 int32_t dst[ARRAY_SIZE(expected)];
713 memset(dst, 0, sizeof(dst));
714 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
716 EXPECT(memcmp(expected, dst, sizeof(expected)));
717 }
718
719 // 4 - Overlong sequences
720
721 // 4.1 - Examples of an overlong ASCII character
722
723 // 4.1.1 - U+002F = c0 af = "\xC0\xAF"
724 {
725 const char* src = "\xC0\xAF";
726 int32_t expected[] = {0x2F};
727 int32_t dst[ARRAY_SIZE(expected)];
728 memset(dst, 0, sizeof(dst));
729 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
731 EXPECT(memcmp(expected, dst, sizeof(expected)));
732 }
733
734 // 4.1.2 - U+002F = e0 80 af = "\xE0\x80\xAF"
735 {
736 const char* src = "\xE0\x80\xAF";
737 int32_t expected[] = {0x2F};
738 int32_t dst[ARRAY_SIZE(expected)];
739 memset(dst, 0, sizeof(dst));
740 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
742 EXPECT(memcmp(expected, dst, sizeof(expected)));
743 }
744
745 // 4.1.3 - U+002F = f0 80 80 af = "\xF0\x80\x80\xAF"
746 {
747 const char* src = "\xF0\x80\x80\xAF";
748 int32_t expected[] = {0x2F};
749 int32_t dst[ARRAY_SIZE(expected)];
750 memset(dst, 0, sizeof(dst));
751 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
753 EXPECT(memcmp(expected, dst, sizeof(expected)));
754 }
755
756 // 4.1.4 - U+002F = f8 80 80 80 af = "\xF8\x80\x80\x80\xAF"
757 {
758 const char* src = "\xF8\x80\x80\x80\xAF";
759 int32_t expected[] = {0x2F};
760 int32_t dst[ARRAY_SIZE(expected)];
761 memset(dst, 0, sizeof(dst));
762 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
764 EXPECT(memcmp(expected, dst, sizeof(expected)));
765 }
766
767 // 4.1.5 - U+002F = fc 80 80 80 80 af = "\xFC\x80\x80\x80\x80\xAF"
768 {
769 const char* src = "\xFC\x80\x80\x80\x80\xAF";
770 int32_t expected[] = {0x2F};
771 int32_t dst[ARRAY_SIZE(expected)];
772 memset(dst, 0, sizeof(dst));
773 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
775 EXPECT(memcmp(expected, dst, sizeof(expected)));
776 }
777
778 // 4.2 Maximum overlong sequences
779
780 // 4.2.1 - U-0000007F = c1 bf = "\xC1\xBF"
781 {
782 const char* src = "\xC1\xBF";
783 int32_t expected[] = {0x7F};
784 int32_t dst[ARRAY_SIZE(expected)];
785 memset(dst, 0, sizeof(dst));
786 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
788 EXPECT(memcmp(expected, dst, sizeof(expected)));
789 }
790
791 // 4.2.2 U+000007FF = e0 9f bf = "\xE0\x9F\xBF"
792 {
793 const char* src = "\xE0\x9F\xBF";
794 int32_t expected[] = {0x7FF};
795 int32_t dst[ARRAY_SIZE(expected)];
796 memset(dst, 0, sizeof(dst));
797 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
799 EXPECT(memcmp(expected, dst, sizeof(expected)));
800 }
801
802 // 4.2.3 - U+0000FFFF = f0 8f bf bf = "\xF0\x8F\xBF\xBF"
803 {
804 const char* src = "\xF0\x8F\xBF\xBF";
805 int32_t expected[] = {0xFFFF};
806 int32_t dst[ARRAY_SIZE(expected)];
807 memset(dst, 0, sizeof(dst));
808 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
810 EXPECT(memcmp(expected, dst, sizeof(expected)));
811 }
812
813 // 4.2.4 U-001FFFFF = f8 87 bf bf bf = "\xF8\x87\xBF\xBF\xBF"
814 {
815 const char* src = "\xF8\x87\xBF\xBF\xBF";
816 int32_t expected[] = {0x1FFFFF};
817 int32_t dst[ARRAY_SIZE(expected)];
818 memset(dst, 0, sizeof(dst));
819 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
821 EXPECT(memcmp(expected, dst, sizeof(expected)));
822 }
823
824 // 4.2.5 U-03FFFFFF = fc 83 bf bf bf bf = "\xFC\x83\xBF\xBF\xBF\xBF"
825 {
826 const char* src = "\xFC\x83\xBF\xBF\xBF\xBF";
827 int32_t expected[] = {0x3FFFFFF};
828 int32_t dst[ARRAY_SIZE(expected)];
829 memset(dst, 0, sizeof(dst));
830 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
832 EXPECT(memcmp(expected, dst, sizeof(expected)));
833 }
834
835 // 4.3 - Overlong representation of the NUL character
836
837 // 4.3.1 - U+0000 = "\xC0\x80"
838 {
839 const char* src = "\xC0\x80";
840 int32_t expected[] = {0x0};
841 int32_t dst[ARRAY_SIZE(expected)];
842 memset(dst, 0xFF, sizeof(dst));
843 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
845 EXPECT(memcmp(expected, dst, sizeof(expected)));
846 }
847
848 // 4.3.2 U+0000 = e0 80 80 = "\xE0\x80\x80"
849 {
850 const char* src = "\xE0\x80\x80";
851 int32_t expected[] = {0x0};
852 int32_t dst[ARRAY_SIZE(expected)];
853 memset(dst, 0xFF, sizeof(dst));
854 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
856 EXPECT(memcmp(expected, dst, sizeof(expected)));
857 }
858
859 // 4.3.3 U+0000 = f0 80 80 80 = "\xF0\x80\x80\x80"
860 {
861 const char* src = "\xF0\x80\x80\x80";
862 int32_t expected[] = {0x0};
863 int32_t dst[ARRAY_SIZE(expected)];
864 memset(dst, 0xFF, sizeof(dst));
865 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
867 EXPECT(memcmp(expected, dst, sizeof(expected)));
868 }
869
870 // 4.3.4 U+0000 = f8 80 80 80 80 = "\xF8\x80\x80\x80\x80"
871 {
872 const char* src = "\xF8\x80\x80\x80\x80";
873 int32_t expected[] = {0x0};
874 int32_t dst[ARRAY_SIZE(expected)];
875 memset(dst, 0xFF, sizeof(dst));
876 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
878 EXPECT(memcmp(expected, dst, sizeof(expected)));
879 }
880
881 // 4.3.5 U+0000 = fc 80 80 80 80 80 = "\xFC\x80\x80\x80\x80\x80"
882 {
883 const char* src = "\xFC\x80\x80\x80\x80\x80";
884 int32_t expected[] = {0x0};
885 int32_t dst[ARRAY_SIZE(expected)];
886 memset(dst, 0xFF, sizeof(dst));
887 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
889 EXPECT(memcmp(expected, dst, sizeof(expected)));
890 }
891
892 // 5.1 - Single UTF-16 surrogates
893 // UTF-8 suggests single surrogates are invalid, but both JS and
894 // Dart allow them and make use of them.
895
896 // 5.1.1 - U+D800 = ed a0 80 = "\xED\xA0\x80"
897 {
898 const char* src = "\xED\xA0\x80";
899 int32_t expected[] = {0xD800};
900 int32_t dst[ARRAY_SIZE(expected)];
901 memset(dst, 0, sizeof(dst));
902 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
904 EXPECT(!memcmp(expected, dst, sizeof(expected)));
905 }
906
907 // 5.1.2 - U+DB7F = ed ad bf = "\xED\xAD\xBF"
908 {
909 const char* src = "\xED\xAD\xBF";
910 int32_t expected[] = {0xDB7F};
911 int32_t dst[ARRAY_SIZE(expected)];
912 memset(dst, 0, sizeof(dst));
913 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
915 EXPECT(!memcmp(expected, dst, sizeof(expected)));
916 }
917
918 // 5.1.3 - U+DB80 = ed ae 80 = "\xED\xAE\x80"
919 {
920 const char* src = "\xED\xAE\x80";
921 int32_t expected[] = {0xDB80};
922 int32_t dst[ARRAY_SIZE(expected)];
923 memset(dst, 0, sizeof(dst));
924 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
926 EXPECT(!memcmp(expected, dst, sizeof(expected)));
927 }
928
929 // 5.1.4 - U+DBFF = ed af bf = "\xED\xAF\xBF"
930 {
931 const char* src = "\xED\xAF\xBF";
932 int32_t expected[] = {0xDBFF};
933 int32_t dst[ARRAY_SIZE(expected)];
934 memset(dst, 0, sizeof(dst));
935 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
937 EXPECT(!memcmp(expected, dst, sizeof(expected)));
938 }
939
940 // 5.1.5 - U+DC00 = ed b0 80 = "\xED\xB0\x80"
941 {
942 const char* src = "\xED\xB0\x80";
943 int32_t expected[] = {0xDC00};
944 int32_t dst[ARRAY_SIZE(expected)];
945 memset(dst, 0, sizeof(dst));
946 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
948 EXPECT(!memcmp(expected, dst, sizeof(expected)));
949 }
950
951 // 5.1.6 - U+DF80 = ed be 80 = "\xED\xBE\x80"
952 {
953 const char* src = "\xED\xBE\x80";
954 int32_t expected[] = {0xDF80};
955 int32_t dst[ARRAY_SIZE(expected)];
956 memset(dst, 0, sizeof(dst));
957 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
959 EXPECT(!memcmp(expected, dst, sizeof(expected)));
960 }
961
962 // 5.1.7 - U+DFFF = ed bf bf = "\xED\xBF\xBF"
963 {
964 const char* src = "\xED\xBF\xBF";
965 int32_t expected[] = {0xDFFF};
966 int32_t dst[ARRAY_SIZE(expected)];
967 memset(dst, 0, sizeof(dst));
968 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
970 EXPECT(!memcmp(expected, dst, sizeof(expected)));
971 }
972
973 // 5.2 Paired UTF-16 surrogates
974 // Also not a valid string, but accepted in Dart, even if it doesn't make
975 // sense. e.g.
976 // var s = new String.fromCharCodes([0xd800, 0xDC00]);
977 // print(s.runes); // (65536) (0x10000)
978 // print(s.codeUnits); // [55296, 56320]
979
980 // 5.2.1 - U+D800 U+DC00 = ed a0 80 ed b0 80 = "\xED\xA0\x80\xED\xB0\x80"
981 {
982 const char* src = "\xED\xA0\x80\xED\xB0\x80";
983 int32_t expected[] = {0xD800, 0xDC00};
984 int32_t dst[ARRAY_SIZE(expected)];
985 memset(dst, 0, sizeof(dst));
986 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
988 EXPECT(!memcmp(expected, dst, sizeof(expected)));
989 }
990
991 // 5.2.2 - U+D800 U+DFFF = ed a0 80 ed bf bf = "\xED\xA0\x80\xED\xBF\xBF"
992 {
993 const char* src = "\xED\xA0\x80\xED\xBF\xBF";
994 int32_t expected[] = {0xD800, 0xDFFF};
995 int32_t dst[ARRAY_SIZE(expected)];
996 memset(dst, 0, sizeof(dst));
997 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
999 EXPECT(!memcmp(expected, dst, sizeof(expected)));
1000 }
1001
1002 // 5.2.3 - U+DB7F U+DC00 = ed a0 80 ed bf bf = "\xED\xAD\xBF\xED\xB0\x80"
1003 {
1004 const char* src = "\xED\xAD\xBF\xED\xB0\x80";
1005 int32_t expected[] = {0xDB7F, 0xDC00};
1006 int32_t dst[ARRAY_SIZE(expected)];
1007 memset(dst, 0, sizeof(dst));
1008 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
1010 EXPECT(!memcmp(expected, dst, sizeof(expected)));
1011 }
1012
1013 // 5.2.4 - U+DB7F U+DFFF = ed ad bf ed bf bf = "\xED\xAD\xBF\xED\xBF\xBF"
1014 {
1015 const char* src = "\xED\xAD\xBF\xED\xBF\xBF";
1016 int32_t expected[] = {0xDB7F, 0xDFFF};
1017 int32_t dst[ARRAY_SIZE(expected)];
1018 memset(dst, 0, sizeof(dst));
1019 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
1021 EXPECT(!memcmp(expected, dst, sizeof(expected)));
1022 }
1023
1024 // 5.2.5 - U+DB80 U+DC00 = ed ae 80 ed b0 80 = "\xED\xAE\x80\xED\xB0\x80"
1025 {
1026 const char* src = "\xED\xAE\x80\xED\xB0\x80";
1027 int32_t expected[] = {0xDB80, 0xDC00};
1028 int32_t dst[ARRAY_SIZE(expected)];
1029 memset(dst, 0, sizeof(dst));
1030 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
1032 EXPECT(!memcmp(expected, dst, sizeof(expected)));
1033 }
1034
1035 // 5.2.6 - U+DB80 U+DFFF = ed ae 80 ed bf bf = "\xED\xAE\x80\xED\xBF\xBF"
1036 {
1037 const char* src = "\xED\xAE\x80\xED\xBF\xBF";
1038 int32_t expected[] = {0xDB80, 0xDFFF};
1039 int32_t dst[ARRAY_SIZE(expected)];
1040 memset(dst, 0, sizeof(dst));
1041 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
1043 EXPECT(!memcmp(expected, dst, sizeof(expected)));
1044 }
1045
1046 // 5.2.7 - U+DBFF U+DC00 = ed af bf ed b0 80 = "\xED\xAF\xBF\xED\xB0\x80"
1047 {
1048 const char* src = "\xED\xAF\xBF\xED\xB0\x80";
1049 int32_t expected[] = {0xDBFF, 0xDC00};
1050 int32_t dst[ARRAY_SIZE(expected)];
1051 memset(dst, 0, sizeof(dst));
1052 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
1054 EXPECT(!memcmp(expected, dst, sizeof(expected)));
1055 }
1056
1057 // 5.2.8 - U+DBFF U+DFFF = ed af bf ed bf bf = "\xED\xAF\xBF\xED\xBF\xBF"
1058 {
1059 const char* src = "\xED\xAF\xBF\xED\xBF\xBF";
1060 int32_t expected[] = {0xDBFF, 0xDFFF};
1061 int32_t dst[ARRAY_SIZE(expected)];
1062 memset(dst, 0, sizeof(dst));
1063 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
1065 EXPECT(!memcmp(expected, dst, sizeof(expected)));
1066 }
1067
1068 // 5.3 - Other illegal code positions
1069
1070 // 5.3.1 - U+FFFE = ef bf be = "\xEF\xBF\xBE"
1071 {
1072 const char* src = "\xEF\xBF\xBE";
1073 int32_t expected[] = {0xFFFE};
1074 int32_t dst[ARRAY_SIZE(expected)];
1075 memset(dst, 0, sizeof(dst));
1076 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
1078 EXPECT(!memcmp(expected, dst, sizeof(expected)));
1079 }
1080
1081 // 5.3.2 - U+FFFF = ef bf bf = "\xEF\xBF\xBF"
1082 {
1083 const char* src = "\xEF\xBF\xBF";
1084 int32_t expected[] = {0xFFFF};
1085 int32_t dst[ARRAY_SIZE(expected)];
1086 memset(dst, 0, sizeof(dst));
1087 bool is_valid = Utf8::DecodeCStringToUTF32(src, dst, ARRAY_SIZE(dst));
1089 EXPECT(!memcmp(expected, dst, sizeof(expected)));
1090 }
1091}
static bool is_valid(SkISize dim)
dst
Definition cp.py:12

◆ ISOLATE_UNIT_TEST_CASE() [433/463]

dart::ISOLATE_UNIT_TEST_CASE ( Utf8Encode  )

Definition at line 11 of file unicode_test.cc.

11 {
12 const intptr_t kInputLen = 3;
13 const uint16_t kInput[kInputLen] = {0xe6, 0xe7, 0xe8}; // æøå
14 const String& input = String::Handle(String::FromUTF16(kInput, kInputLen));
15 const uintptr_t kBufferLength = 10;
16 unsigned char buffer[kBufferLength];
17 for (uintptr_t i = 0; i < kBufferLength; i++) {
18 buffer[i] = 42;
19 }
20 Utf8::Encode(input, reinterpret_cast<char*>(&buffer[0]), 10);
21 uintptr_t i;
22 for (i = 0; i < static_cast<uintptr_t>(Utf8::Length(input)); i++) {
23 EXPECT(buffer[i] > 127);
24 }
25 for (; i < kBufferLength; i++) {
26 EXPECT(buffer[i] == 42);
27 }
28}

◆ ISOLATE_UNIT_TEST_CASE() [434/463]

dart::ISOLATE_UNIT_TEST_CASE ( Utf8InvalidByte  )

Definition at line 30 of file unicode_test.cc.

30 {
31 {
32 uint8_t array[] = {0x41, 0xF0, 0x92};
33 intptr_t encode_len = 3;
34 intptr_t decode_len = 3;
35 intptr_t pos = Utf8::ReportInvalidByte(array, encode_len, decode_len);
36 EXPECT(pos == 1);
37 }
38
39 {
40 uint8_t array[] = {0x81, 0x40, 0x42};
41 intptr_t encode_len = 3;
42 intptr_t decode_len = 3;
43 intptr_t pos = Utf8::ReportInvalidByte(array, encode_len, decode_len);
44 EXPECT(pos == 0);
45 }
46
47 {
48 uint8_t array[] = {0x42, 0x40, 0x80};
49 intptr_t encode_len = 3;
50 intptr_t decode_len = 3;
51 intptr_t pos = Utf8::ReportInvalidByte(array, encode_len, decode_len);
52 EXPECT(pos == 2);
53 }
54
55 {
56 uint8_t array[] = {0x41, 0xF0, 0x92, 0x92, 0x91};
57 intptr_t encode_len = 5;
58 intptr_t decode_len = 2;
59 intptr_t pos = Utf8::ReportInvalidByte(array, encode_len, decode_len);
60 EXPECT(pos == encode_len);
61 }
62}

◆ ISOLATE_UNIT_TEST_CASE() [435/463]

dart::ISOLATE_UNIT_TEST_CASE ( WeakArray_Generations  )

Definition at line 1132 of file heap_test.cc.

1132 {
1133 FLAG_early_tenuring_threshold = 100; // I.e., off.
1134
1135 intptr_t length = 1;
1136 WeakArray_Generations(length, kNew, kNew, true, true, true);
1137 WeakArray_Generations(length, kNew, kOld, false, true, true);
1138 WeakArray_Generations(length, kNew, kImm, false, false, false);
1139 WeakArray_Generations(length, kOld, kNew, true, true, true);
1140 WeakArray_Generations(length, kOld, kOld, false, true, true);
1141 WeakArray_Generations(length, kOld, kImm, false, false, false);
1142}
static void WeakArray_Generations(intptr_t length, Generation array_space, Generation element_space, bool cleared_after_minor, bool cleared_after_major, bool cleared_after_all)

◆ ISOLATE_UNIT_TEST_CASE() [436/463]

dart::ISOLATE_UNIT_TEST_CASE ( WeakArray_Large_Generations  )

Definition at line 1144 of file heap_test.cc.

1144 {
1145 FLAG_early_tenuring_threshold = 100; // I.e., off.
1146
1147 intptr_t length = kNewAllocatableSize / kCompressedWordSize;
1148 WeakArray_Generations(length, kNew, kNew, true, true, true);
1149 WeakArray_Generations(length, kNew, kOld, false, true, true);
1150 WeakArray_Generations(length, kNew, kImm, false, false, false);
1151 WeakArray_Generations(length, kOld, kNew, true, true, true);
1152 WeakArray_Generations(length, kOld, kOld, false, true, true);
1153 WeakArray_Generations(length, kOld, kImm, false, false, false);
1154}

◆ ISOLATE_UNIT_TEST_CASE() [437/463]

dart::ISOLATE_UNIT_TEST_CASE ( WeakArray_New  )

Definition at line 3799 of file object_test.cc.

3799 {
3800 WeakArray& array = WeakArray::Handle(WeakArray::New(2, Heap::kNew));
3801 Object& target0 = Object::Handle();
3802 {
3803 HANDLESCOPE(thread);
3804 target0 = String::New("0", Heap::kNew);
3805 Object& target1 = Object::Handle(String::New("1", Heap::kNew));
3806 array.SetAt(0, target0);
3807 array.SetAt(1, target1);
3808 }
3809
3810 EXPECT(array.Length() == 2);
3811 EXPECT(array.At(0) != Object::null());
3812 EXPECT(array.At(1) != Object::null());
3813
3814 GCTestHelper::CollectNewSpace();
3815
3816 EXPECT(array.Length() == 2);
3817 EXPECT(array.At(0) != Object::null()); // Survives
3818 EXPECT(array.At(1) == Object::null()); // Cleared
3819}
void SetAt(intptr_t index, const Object &value) const
Definition object.h:6696
intptr_t Length() const
Definition object.h:6670
ObjectPtr At(intptr_t index) const
Definition object.h:6695

◆ ISOLATE_UNIT_TEST_CASE() [438/463]

dart::ISOLATE_UNIT_TEST_CASE ( WeakArray_Old  )

Definition at line 3821 of file object_test.cc.

3821 {
3822 WeakArray& array = WeakArray::Handle(WeakArray::New(2, Heap::kOld));
3823 Object& target0 = Object::Handle();
3824 {
3825 HANDLESCOPE(thread);
3826 target0 = String::New("0", Heap::kOld);
3827 Object& target1 = Object::Handle(String::New("1", Heap::kOld));
3828 array.SetAt(0, target0);
3829 array.SetAt(1, target1);
3830 }
3831
3832 EXPECT(array.Length() == 2);
3833 EXPECT(array.At(0) != Object::null());
3834 EXPECT(array.At(1) != Object::null());
3835
3836 GCTestHelper::CollectAllGarbage();
3837
3838 EXPECT(array.Length() == 2);
3839 EXPECT(array.At(0) != Object::null()); // Survives
3840 EXPECT(array.At(1) == Object::null()); // Cleared
3841}

◆ ISOLATE_UNIT_TEST_CASE() [439/463]

dart::ISOLATE_UNIT_TEST_CASE ( WeakProperty_ClearOne_NewSpace  )

Definition at line 3563 of file object_test.cc.

3563 {
3564 WeakProperty& weak = WeakProperty::Handle();
3565 {
3566 HANDLESCOPE(thread);
3567 String& key = String::Handle();
3568 key ^= OneByteString::New("key");
3569 String& value = String::Handle();
3570 value ^= OneByteString::New("value");
3571 weak ^= WeakProperty::New();
3572 weak.set_key(key);
3573 weak.set_value(value);
3574 key ^= OneByteString::null();
3575 value ^= OneByteString::null();
3576 }
3577 GCTestHelper::CollectNewSpace();
3578 EXPECT(weak.key() == Object::null());
3579 EXPECT(weak.value() == Object::null());
3580}
ObjectPtr value() const
Definition object.h:12898
void set_key(const Object &key) const
Definition object.h:12895
ObjectPtr key() const
Definition object.h:12894
void set_value(const Object &value) const
Definition object.h:12899

◆ ISOLATE_UNIT_TEST_CASE() [440/463]

dart::ISOLATE_UNIT_TEST_CASE ( WeakProperty_ClearOne_OldSpace  )

Definition at line 3607 of file object_test.cc.

3607 {
3608 WeakProperty& weak = WeakProperty::Handle();
3609 {
3610 HANDLESCOPE(thread);
3611 String& key = String::Handle();
3612 key ^= OneByteString::New("key", Heap::kOld);
3613 String& value = String::Handle();
3614 value ^= OneByteString::New("value", Heap::kOld);
3615 weak ^= WeakProperty::New(Heap::kOld);
3616 weak.set_key(key);
3617 weak.set_value(value);
3618 key ^= OneByteString::null();
3619 value ^= OneByteString::null();
3620 }
3621 GCTestHelper::CollectAllGarbage();
3622 EXPECT(weak.key() == Object::null());
3623 EXPECT(weak.value() == Object::null());
3624}

◆ ISOLATE_UNIT_TEST_CASE() [441/463]

dart::ISOLATE_UNIT_TEST_CASE ( WeakProperty_ClearTwoShared_NewSpace  )

Definition at line 3582 of file object_test.cc.

3582 {
3583 WeakProperty& weak1 = WeakProperty::Handle();
3584 WeakProperty& weak2 = WeakProperty::Handle();
3585 {
3586 HANDLESCOPE(thread);
3587 String& key = String::Handle();
3588 key ^= OneByteString::New("key");
3589 String& value1 = String::Handle();
3590 value1 ^= OneByteString::New("value1");
3591 weak1 ^= WeakProperty::New();
3592 weak1.set_key(key);
3593 weak1.set_value(value1);
3594 String& value2 = String::Handle();
3595 value2 ^= OneByteString::New("value2");
3596 weak2 ^= WeakProperty::New();
3597 weak2.set_key(key);
3598 weak2.set_value(value2);
3599 }
3600 GCTestHelper::CollectNewSpace();
3601 EXPECT(weak1.key() == Object::null());
3602 EXPECT(weak1.value() == Object::null());
3603 EXPECT(weak2.key() == Object::null());
3604 EXPECT(weak2.value() == Object::null());
3605}

◆ ISOLATE_UNIT_TEST_CASE() [442/463]

dart::ISOLATE_UNIT_TEST_CASE ( WeakProperty_ClearTwoShared_OldSpace  )

Definition at line 3626 of file object_test.cc.

3626 {
3627 WeakProperty& weak1 = WeakProperty::Handle();
3628 WeakProperty& weak2 = WeakProperty::Handle();
3629 {
3630 HANDLESCOPE(thread);
3631 String& key = String::Handle();
3632 key ^= OneByteString::New("key", Heap::kOld);
3633 String& value1 = String::Handle();
3634 value1 ^= OneByteString::New("value1");
3635 weak1 ^= WeakProperty::New(Heap::kOld);
3636 weak1.set_key(key);
3637 weak1.set_value(value1);
3638 String& value2 = String::Handle();
3639 value2 ^= OneByteString::New("value2", Heap::kOld);
3640 weak2 ^= WeakProperty::New(Heap::kOld);
3641 weak2.set_key(key);
3642 weak2.set_value(value2);
3643 }
3644 GCTestHelper::CollectAllGarbage();
3645 EXPECT(weak1.key() == Object::null());
3646 EXPECT(weak1.value() == Object::null());
3647 EXPECT(weak2.key() == Object::null());
3648 EXPECT(weak2.value() == Object::null());
3649}

◆ ISOLATE_UNIT_TEST_CASE() [443/463]

dart::ISOLATE_UNIT_TEST_CASE ( WeakProperty_Generations  )

Definition at line 977 of file heap_test.cc.

977 {
978 FLAG_early_tenuring_threshold = 100; // I.e., off.
979
980 WeakProperty_Generations(kNew, kNew, kNew, true, true, true);
981 WeakProperty_Generations(kNew, kNew, kOld, true, true, true);
982 WeakProperty_Generations(kNew, kNew, kImm, true, true, true);
983 WeakProperty_Generations(kNew, kOld, kNew, false, true, true);
984 WeakProperty_Generations(kNew, kOld, kOld, false, true, true);
985 WeakProperty_Generations(kNew, kOld, kImm, false, true, true);
986 WeakProperty_Generations(kNew, kImm, kNew, false, false, false);
987 WeakProperty_Generations(kNew, kImm, kOld, false, false, false);
988 WeakProperty_Generations(kNew, kImm, kImm, false, false, false);
989 WeakProperty_Generations(kOld, kNew, kNew, true, true, true);
990 WeakProperty_Generations(kOld, kNew, kOld, true, true, true);
991 WeakProperty_Generations(kOld, kNew, kImm, true, true, true);
992 WeakProperty_Generations(kOld, kOld, kNew, false, true, true);
993 WeakProperty_Generations(kOld, kOld, kOld, false, true, true);
994 WeakProperty_Generations(kOld, kOld, kImm, false, true, true);
995 WeakProperty_Generations(kOld, kImm, kNew, false, false, false);
996 WeakProperty_Generations(kOld, kImm, kOld, false, false, false);
997 WeakProperty_Generations(kOld, kImm, kImm, false, false, false);
998}
static void WeakProperty_Generations(Generation property_space, Generation key_space, Generation value_space, bool cleared_after_minor, bool cleared_after_major, bool cleared_after_all)
Definition heap_test.cc:896

◆ ISOLATE_UNIT_TEST_CASE() [444/463]

dart::ISOLATE_UNIT_TEST_CASE ( WeakProperty_PreserveOne_NewSpace  )

Definition at line 3425 of file object_test.cc.

3425 {
3426 WeakProperty& weak = WeakProperty::Handle();
3427 String& key = String::Handle();
3428 key ^= OneByteString::New("key");
3429 {
3430 HANDLESCOPE(thread);
3431 String& value = String::Handle();
3432 value ^= OneByteString::New("value");
3433 weak ^= WeakProperty::New();
3434 weak.set_key(key);
3435 weak.set_value(value);
3436 }
3437 GCTestHelper::CollectNewSpace();
3438 EXPECT(weak.key() != Object::null());
3439 EXPECT(weak.value() != Object::null());
3440}

◆ ISOLATE_UNIT_TEST_CASE() [445/463]

dart::ISOLATE_UNIT_TEST_CASE ( WeakProperty_PreserveOne_OldSpace  )

Definition at line 3494 of file object_test.cc.

3494 {
3495 WeakProperty& weak = WeakProperty::Handle();
3496 String& key = String::Handle();
3497 key ^= OneByteString::New("key", Heap::kOld);
3498 {
3499 HANDLESCOPE(thread);
3500 String& value = String::Handle();
3501 value ^= OneByteString::New("value", Heap::kOld);
3502 weak ^= WeakProperty::New(Heap::kOld);
3503 weak.set_key(key);
3504 weak.set_value(value);
3505 }
3506 GCTestHelper::CollectAllGarbage();
3507 EXPECT(weak.key() != Object::null());
3508 EXPECT(weak.value() != Object::null());
3509}

◆ ISOLATE_UNIT_TEST_CASE() [446/463]

dart::ISOLATE_UNIT_TEST_CASE ( WeakProperty_PreserveRecurse  )

Definition at line 3404 of file object_test.cc.

3404 {
3405 // This used to end in an infinite recursion. Caused by scavenging the weak
3406 // property before scavenging the key.
3407 WeakProperty& weak = WeakProperty::Handle();
3408 Array& arr = Array::Handle(Array::New(1));
3409 {
3410 HANDLESCOPE(thread);
3411 String& key = String::Handle();
3412 key ^= OneByteString::New("key");
3413 arr.SetAt(0, key);
3414 String& value = String::Handle();
3415 value ^= OneByteString::New("value");
3416 weak ^= WeakProperty::New();
3417 weak.set_key(key);
3418 weak.set_value(value);
3419 }
3420 GCTestHelper::CollectAllGarbage();
3421 EXPECT(weak.key() != Object::null());
3422 EXPECT(weak.value() != Object::null());
3423}

◆ ISOLATE_UNIT_TEST_CASE() [447/463]

dart::ISOLATE_UNIT_TEST_CASE ( WeakProperty_PreserveTwo_NewSpace  )

Definition at line 3442 of file object_test.cc.

3442 {
3443 WeakProperty& weak1 = WeakProperty::Handle();
3444 String& key1 = String::Handle();
3445 key1 ^= OneByteString::New("key1");
3446 WeakProperty& weak2 = WeakProperty::Handle();
3447 String& key2 = String::Handle();
3448 key2 ^= OneByteString::New("key2");
3449 {
3450 HANDLESCOPE(thread);
3451 String& value1 = String::Handle();
3452 value1 ^= OneByteString::New("value1");
3453 weak1 ^= WeakProperty::New();
3454 weak1.set_key(key1);
3455 weak1.set_value(value1);
3456 String& value2 = String::Handle();
3457 value2 ^= OneByteString::New("value2");
3458 weak2 ^= WeakProperty::New();
3459 weak2.set_key(key2);
3460 weak2.set_value(value2);
3461 }
3462 GCTestHelper::CollectNewSpace();
3463 EXPECT(weak1.key() != Object::null());
3464 EXPECT(weak1.value() != Object::null());
3465 EXPECT(weak2.key() != Object::null());
3466 EXPECT(weak2.value() != Object::null());
3467}

◆ ISOLATE_UNIT_TEST_CASE() [448/463]

dart::ISOLATE_UNIT_TEST_CASE ( WeakProperty_PreserveTwo_OldSpace  )

Definition at line 3511 of file object_test.cc.

3511 {
3512 WeakProperty& weak1 = WeakProperty::Handle();
3513 String& key1 = String::Handle();
3514 key1 ^= OneByteString::New("key1", Heap::kOld);
3515 WeakProperty& weak2 = WeakProperty::Handle();
3516 String& key2 = String::Handle();
3517 key2 ^= OneByteString::New("key2", Heap::kOld);
3518 {
3519 HANDLESCOPE(thread);
3520 String& value1 = String::Handle();
3521 value1 ^= OneByteString::New("value1", Heap::kOld);
3522 weak1 ^= WeakProperty::New(Heap::kOld);
3523 weak1.set_key(key1);
3524 weak1.set_value(value1);
3525 String& value2 = String::Handle();
3526 value2 ^= OneByteString::New("value2", Heap::kOld);
3527 weak2 ^= WeakProperty::New(Heap::kOld);
3528 weak2.set_key(key2);
3529 weak2.set_value(value2);
3530 }
3531 GCTestHelper::CollectAllGarbage();
3532 EXPECT(weak1.key() != Object::null());
3533 EXPECT(weak1.value() != Object::null());
3534 EXPECT(weak2.key() != Object::null());
3535 EXPECT(weak2.value() != Object::null());
3536}

◆ ISOLATE_UNIT_TEST_CASE() [449/463]

dart::ISOLATE_UNIT_TEST_CASE ( WeakProperty_PreserveTwoShared_NewSpace  )

Definition at line 3469 of file object_test.cc.

3469 {
3470 WeakProperty& weak1 = WeakProperty::Handle();
3471 WeakProperty& weak2 = WeakProperty::Handle();
3472 String& key = String::Handle();
3473 key ^= OneByteString::New("key");
3474 {
3475 HANDLESCOPE(thread);
3476 String& value1 = String::Handle();
3477 value1 ^= OneByteString::New("value1");
3478 weak1 ^= WeakProperty::New();
3479 weak1.set_key(key);
3480 weak1.set_value(value1);
3481 String& value2 = String::Handle();
3482 value2 ^= OneByteString::New("value2");
3483 weak2 ^= WeakProperty::New();
3484 weak2.set_key(key);
3485 weak2.set_value(value2);
3486 }
3487 GCTestHelper::CollectNewSpace();
3488 EXPECT(weak1.key() != Object::null());
3489 EXPECT(weak1.value() != Object::null());
3490 EXPECT(weak2.key() != Object::null());
3491 EXPECT(weak2.value() != Object::null());
3492}

◆ ISOLATE_UNIT_TEST_CASE() [450/463]

dart::ISOLATE_UNIT_TEST_CASE ( WeakProperty_PreserveTwoShared_OldSpace  )

Definition at line 3538 of file object_test.cc.

3538 {
3539 WeakProperty& weak1 = WeakProperty::Handle();
3540 WeakProperty& weak2 = WeakProperty::Handle();
3541 String& key = String::Handle();
3542 key ^= OneByteString::New("key", Heap::kOld);
3543 {
3544 HANDLESCOPE(thread);
3545 String& value1 = String::Handle();
3546 value1 ^= OneByteString::New("value1", Heap::kOld);
3547 weak1 ^= WeakProperty::New(Heap::kOld);
3548 weak1.set_key(key);
3549 weak1.set_value(value1);
3550 String& value2 = String::Handle();
3551 value2 ^= OneByteString::New("value2", Heap::kOld);
3552 weak2 ^= WeakProperty::New(Heap::kOld);
3553 weak2.set_key(key);
3554 weak2.set_value(value2);
3555 }
3556 GCTestHelper::CollectAllGarbage();
3557 EXPECT(weak1.key() != Object::null());
3558 EXPECT(weak1.value() != Object::null());
3559 EXPECT(weak2.key() != Object::null());
3560 EXPECT(weak2.value() != Object::null());
3561}

◆ ISOLATE_UNIT_TEST_CASE() [451/463]

dart::ISOLATE_UNIT_TEST_CASE ( WeakReference_Clear_ReachableThroughWeakProperty_NewSpace  )

Definition at line 3746 of file object_test.cc.

3747 {
3749}
static void WeakReference_Clear_ReachableThroughWeakProperty(Thread *thread, Heap::Space space)

◆ ISOLATE_UNIT_TEST_CASE() [452/463]

dart::ISOLATE_UNIT_TEST_CASE ( WeakReference_Clear_ReachableThroughWeakProperty_OldSpace  )

Definition at line 3751 of file object_test.cc.

3752 {
3754}

◆ ISOLATE_UNIT_TEST_CASE() [453/463]

dart::ISOLATE_UNIT_TEST_CASE ( WeakReference_ClearOne_NewSpace  )

Definition at line 3705 of file object_test.cc.

3705 {
3706 WeakReference_ClearOne(thread, Heap::kNew);
3707}
static void WeakReference_ClearOne(Thread *thread, Heap::Space space)

◆ ISOLATE_UNIT_TEST_CASE() [454/463]

dart::ISOLATE_UNIT_TEST_CASE ( WeakReference_ClearOne_OldSpace  )

Definition at line 3709 of file object_test.cc.

3709 {
3710 WeakReference_ClearOne(thread, Heap::kOld);
3711}

◆ ISOLATE_UNIT_TEST_CASE() [455/463]

dart::ISOLATE_UNIT_TEST_CASE ( WeakReference_Generations  )

Definition at line 1060 of file heap_test.cc.

1060 {
1061 FLAG_early_tenuring_threshold = 100; // I.e., off.
1062
1063 WeakReference_Generations(kNew, kNew, true, true, true);
1064 WeakReference_Generations(kNew, kOld, false, true, true);
1065 WeakReference_Generations(kNew, kImm, false, false, false);
1066 WeakReference_Generations(kOld, kNew, true, true, true);
1067 WeakReference_Generations(kOld, kOld, false, true, true);
1068 WeakReference_Generations(kOld, kImm, false, false, false);
1069}
static void WeakReference_Generations(Generation reference_space, Generation target_space, bool cleared_after_minor, bool cleared_after_major, bool cleared_after_all)

◆ ISOLATE_UNIT_TEST_CASE() [456/463]

dart::ISOLATE_UNIT_TEST_CASE ( WeakReference_Preserve_ReachableThroughWeakProperty_NewSpace  )

Definition at line 3789 of file object_test.cc.

3790 {
3792}
static void WeakReference_Preserve_ReachableThroughWeakProperty(Thread *thread, Heap::Space space)

◆ ISOLATE_UNIT_TEST_CASE() [457/463]

dart::ISOLATE_UNIT_TEST_CASE ( WeakReference_Preserve_ReachableThroughWeakProperty_OldSpace  )

Definition at line 3794 of file object_test.cc.

3795 {
3797}

◆ ISOLATE_UNIT_TEST_CASE() [458/463]

dart::ISOLATE_UNIT_TEST_CASE ( WeakReference_PreserveOne_NewSpace  )

Definition at line 3674 of file object_test.cc.

3674 {
3675 WeakReference_PreserveOne(thread, Heap::kNew);
3676}
static void WeakReference_PreserveOne(Thread *thread, Heap::Space space)

◆ ISOLATE_UNIT_TEST_CASE() [459/463]

dart::ISOLATE_UNIT_TEST_CASE ( WeakReference_PreserveOne_OldSpace  )

Definition at line 3678 of file object_test.cc.

3678 {
3679 WeakReference_PreserveOne(thread, Heap::kOld);
3680}

◆ ISOLATE_UNIT_TEST_CASE() [460/463]

dart::ISOLATE_UNIT_TEST_CASE ( WeakSmi  )

Definition at line 844 of file heap_test.cc.

844 {
845 // Weaklings are prevented from referencing Smis by the public Dart library
846 // interface, but the VM internally can do this and the implementation should
847 // just handle it. Immediate objects are effectively immortal.
848
849 WeakProperty& new_ephemeron =
850 WeakProperty::Handle(WeakProperty::New(Heap::kNew));
851 WeakProperty& old_ephemeron =
852 WeakProperty::Handle(WeakProperty::New(Heap::kOld));
853 WeakReference& new_weakref =
854 WeakReference::Handle(WeakReference::New(Heap::kNew));
855 WeakReference& old_weakref =
856 WeakReference::Handle(WeakReference::New(Heap::kOld));
857 WeakArray& new_weakarray = WeakArray::Handle(WeakArray::New(1, Heap::kNew));
858 WeakArray& old_weakarray = WeakArray::Handle(WeakArray::New(1, Heap::kOld));
859 FinalizerEntry& new_finalizer = FinalizerEntry::Handle(
860 FinalizerEntry::New(FinalizerBase::Handle(), Heap::kNew));
861 FinalizerEntry& old_finalizer = FinalizerEntry::Handle(
862 FinalizerEntry::New(FinalizerBase::Handle(), Heap::kOld));
863
864 {
865 HANDLESCOPE(thread);
866 Smi& smi = Smi::Handle(Smi::New(42));
867 new_ephemeron.set_key(smi);
868 old_ephemeron.set_key(smi);
869 new_weakref.set_target(smi);
870 old_weakref.set_target(smi);
871 new_weakarray.SetAt(0, smi);
872 old_weakarray.SetAt(0, smi);
873 new_finalizer.set_value(smi);
874 old_finalizer.set_value(smi);
875 }
876
877 GCTestHelper::CollectNewSpace();
878 GCTestHelper::CollectAllGarbage();
879
880 EXPECT(new_ephemeron.key() == Smi::New(42));
881 EXPECT(old_ephemeron.key() == Smi::New(42));
882 EXPECT(new_weakref.target() == Smi::New(42));
883 EXPECT(old_weakref.target() == Smi::New(42));
884 EXPECT(new_weakarray.At(0) == Smi::New(42));
885 EXPECT(old_weakarray.At(0) == Smi::New(42));
886 EXPECT(new_finalizer.value() == Smi::New(42));
887 EXPECT(old_finalizer.value() == Smi::New(42));
888}
ObjectPtr target() const
Definition object.h:12918
void set_target(const Object &target) const
Definition object.h:12919

◆ ISOLATE_UNIT_TEST_CASE() [461/463]

dart::ISOLATE_UNIT_TEST_CASE ( WeakTables  )

Definition at line 15 of file weak_table_test.cc.

15 {
16 const Object& old_obj = Object::Handle(String::New("old", Heap::kOld));
17 const Object& new_obj = Object::Handle(String::New("new", Heap::kNew));
18 const Object& imm_obj = Object::Handle(Smi::New(0));
19
20 // Initially absent.
21 Heap* heap = thread->heap();
22 const intptr_t kNoValue = WeakTable::kNoValue;
23 EXPECT_EQ(kNoValue, heap->GetObjectId(old_obj.ptr()));
24 EXPECT_EQ(kNoValue, heap->GetObjectId(new_obj.ptr()));
25 EXPECT_EQ(kNoValue, heap->GetObjectId(imm_obj.ptr()));
26
27 // Found after insert.
28 heap->SetObjectId(old_obj.ptr(), 100);
29 heap->SetObjectId(new_obj.ptr(), 200);
30 heap->SetObjectId(imm_obj.ptr(), 300);
31 EXPECT_EQ(100, heap->GetObjectId(old_obj.ptr()));
32 EXPECT_EQ(200, heap->GetObjectId(new_obj.ptr()));
33 EXPECT_EQ(300, heap->GetObjectId(imm_obj.ptr()));
34
35 // Found after update.
36 heap->SetObjectId(old_obj.ptr(), 400);
37 heap->SetObjectId(new_obj.ptr(), 500);
38 heap->SetObjectId(imm_obj.ptr(), 600);
39 EXPECT_EQ(400, heap->GetObjectId(old_obj.ptr()));
40 EXPECT_EQ(500, heap->GetObjectId(new_obj.ptr()));
41 EXPECT_EQ(600, heap->GetObjectId(imm_obj.ptr()));
42
43 // Found after GC.
44 GCTestHelper::CollectNewSpace();
45 EXPECT_EQ(400, heap->GetObjectId(old_obj.ptr()));
46 EXPECT_EQ(500, heap->GetObjectId(new_obj.ptr()));
47 EXPECT_EQ(600, heap->GetObjectId(imm_obj.ptr()));
48
49 // Found after GC.
50 GCTestHelper::CollectOldSpace();
51 EXPECT_EQ(400, heap->GetObjectId(old_obj.ptr()));
52 EXPECT_EQ(500, heap->GetObjectId(new_obj.ptr()));
53 EXPECT_EQ(600, heap->GetObjectId(imm_obj.ptr()));
54
55 // Absent after reset.
56 heap->ResetObjectIdTable();
57 EXPECT_EQ(kNoValue, heap->GetObjectId(old_obj.ptr()));
58 EXPECT_EQ(kNoValue, heap->GetObjectId(new_obj.ptr()));
59 EXPECT_EQ(kNoValue, heap->GetObjectId(imm_obj.ptr()));
60}
void ResetObjectIdTable()
Definition heap.cc:888

◆ ISOLATE_UNIT_TEST_CASE() [462/463]

dart::ISOLATE_UNIT_TEST_CASE ( WrapAroundAndDerived  )

Definition at line 206 of file loops_test.cc.

206 {
207 const char* script_chars =
208 R"(
209 foo() {
210 int j = 1;
211 for (int i = 0; i < 100; i++) {
212 j += 5;
213 j += 7;
214 }
215 }
216 main() {
217 foo();
218 }
219 )";
220 const char* expected =

◆ ISOLATE_UNIT_TEST_CASE() [463/463]

dart::ISOLATE_UNIT_TEST_CASE ( ZoneVerificationScaling  )

Definition at line 272 of file zone_test.cc.

272 {
273 // This ought to complete in O(n), not O(n^2).
274 const intptr_t n = 1000000;
275
276 StackZone stack_zone(thread);
277 Zone* zone = stack_zone.GetZone();
278
279 {
280 HANDLESCOPE(thread);
281 for (intptr_t i = 0; i < n; i++) {
282 const Object& a = Object::Handle(zone);
283 DEBUG_ASSERT(!a.IsNotTemporaryScopedHandle());
284 USE(a);
285 const Object& b = Object::ZoneHandle(zone);
286 DEBUG_ASSERT(b.IsNotTemporaryScopedHandle());
287 USE(b);
288 }
289 // Leaves lots of HandleBlocks for recycling.
290 }
291
292 for (intptr_t i = 0; i < n; i++) {
293 HANDLESCOPE(thread);
294 const Object& a = Object::Handle(zone);
295 DEBUG_ASSERT(!a.IsNotTemporaryScopedHandle());
296 USE(a);
297 const Object& b = Object::ZoneHandle(zone);
298 DEBUG_ASSERT(b.IsNotTemporaryScopedHandle());
299 USE(b);
300 // Should not visit those recyclable blocks over and over again.
301 }
302}
#define DEBUG_ASSERT(cond)
Definition assert.h:321

◆ ISOLATE_UNIT_TEST_CASE_WITH_EXPECTATION() [1/3]

dart::ISOLATE_UNIT_TEST_CASE_WITH_EXPECTATION ( ArrayNew_Overflow_Crash  ,
"Crash"   
)

Definition at line 3334 of file object_test.cc.

3334 {
3335 Array::Handle(Array::New(Array::kMaxElements + 1));
3336}

◆ ISOLATE_UNIT_TEST_CASE_WITH_EXPECTATION() [2/3]

dart::ISOLATE_UNIT_TEST_CASE_WITH_EXPECTATION ( CodeImmutability  ,
"Crash"   
)

Definition at line 2679 of file object_test.cc.

2679 {
2680 extern void GenerateIncrement(compiler::Assembler * assembler);
2681 compiler::ObjectPoolBuilder object_pool_builder;
2682 compiler::Assembler _assembler_(&object_pool_builder);
2683 GenerateIncrement(&_assembler_);
2684 const Function& function = Function::Handle(CreateFunction("Test_Code"));
2685 SafepointWriteRwLocker locker(thread,
2686 thread->isolate_group()->program_lock());
2687 Code& code = Code::Handle(Code::FinalizeCodeAndNotify(
2688 function, nullptr, &_assembler_, Code::PoolAttachment::kAttachPool));
2689 function.AttachCode(code);
2690 Instructions& instructions = Instructions::Handle(code.instructions());
2691 uword payload_start = instructions.PayloadStart();
2692 EXPECT_EQ(instructions.ptr(), Instructions::FromPayloadStart(payload_start));
2693 // Try writing into the generated code, expected to crash.
2694 *(reinterpret_cast<char*>(payload_start) + 1) = 1;
2695 if (!FLAG_write_protect_code) {
2696 // Since this test is expected to crash, crash if write protection of code
2697 // is switched off.
2698 FATAL("Test requires --write-protect-code; skip by forcing expected crash");
2699 }
2700}

◆ ISOLATE_UNIT_TEST_CASE_WITH_EXPECTATION() [3/3]

dart::ISOLATE_UNIT_TEST_CASE_WITH_EXPECTATION ( SafepointOperation_NonDeoptAndDeoptNesting  ,
"Crash"   
)

Definition at line 635 of file safepoint_test.cc.

637 {
638 GcSafepointOperationScope safepoint_scope(thread);
639 DeoptSafepointOperationScope safepoint_scope2(thread);
640}

◆ IsolateCleanupTestCallback()

static void dart::IsolateCleanupTestCallback ( void *  group_data,
void *  isolate_data 
)
static

Definition at line 8529 of file dart_api_impl_test.cc.

◆ IsolateExitTest_LookupAndCallIsolateExit()

DART_EXPORT void dart::IsolateExitTest_LookupAndCallIsolateExit ( int  i)

Definition at line 920 of file ffi_test_functions_vmspecific.cc.

920 {
921 Dart_Handle root_lib = Dart_RootLibrary();
922 fprintf(stderr, "IsolateExitTest_LookupAndCallIsolateExit i:%d\n", i);
923 if (i > 0) {
924 Dart_Handle method_name =
925 Dart_NewStringFromCString("recurseLookupAndCallWorker");
926 Dart_Handle dart_args[1];
927 dart_args[0] = Dart_NewInteger(i - 1);
928 Dart_Handle result = Dart_Invoke(root_lib, method_name, 1, dart_args);
930 } else {
931 Dart_Handle method_name = Dart_NewStringFromCString("callIsolateExit");
932 Dart_Handle result = Dart_Invoke(root_lib, method_name, 0, nullptr);
933 if (Dart_IsError(result)) {
934 fprintf(stderr,
935 "%d failed to invoke %s in child isolate: %s, carrying on..\n", i,
936 "callIsolateExit", Dart_GetError(result));
937 }
939 }
940}

◆ IsolateGroupCleanupTestCallback()

static void dart::IsolateGroupCleanupTestCallback ( void *  callback_data)
static

Definition at line 8543 of file dart_api_impl_test.cc.

8543 {
8544 // Cleanup runs after shutdown.
8545 EXPECT(shutdown_isolate_group_data != nullptr);

◆ IsolateMessageTypedDataFinalizer()

static void dart::IsolateMessageTypedDataFinalizer ( void *  isolate_callback_data,
void *  buffer 
)
static

Definition at line 1280 of file message_snapshot.cc.

1281 {
1282 free(buffer);
1283}

◆ IsolatePauseEvent()

static ServiceEvent dart::IsolatePauseEvent ( Isolate isolate)
static

Definition at line 2991 of file isolate.cc.

2991 {
2992 if (!isolate->is_runnable()) {
2993 // Isolate is not yet runnable.
2994 ASSERT((isolate->debugger() == nullptr) ||
2995 (isolate->debugger()->PauseEvent() == nullptr));
2996 return ServiceEvent(isolate, ServiceEvent::kNone);
2997 } else if (isolate->message_handler()->should_pause_on_start()) {
2998 if (isolate->message_handler()->is_paused_on_start()) {
2999 ASSERT((isolate->debugger() == nullptr) ||
3000 (isolate->debugger()->PauseEvent() == nullptr));
3001 return ServiceEvent(isolate, ServiceEvent::kPauseStart);
3002 } else {
3003 // Isolate is runnable but not paused on start.
3004 // Some service clients get confused if they see:
3005 // NotRunnable -> Runnable -> PausedAtStart
3006 // Treat Runnable+ShouldPauseOnStart as NotRunnable so they see:
3007 // NonRunnable -> PausedAtStart
3008 // The should_pause_on_start flag is set to false after resume.
3009 ASSERT((isolate->debugger() == nullptr) ||
3010 (isolate->debugger()->PauseEvent() == nullptr));
3011 return ServiceEvent(isolate, ServiceEvent::kNone);
3012 }
3013 } else if (isolate->message_handler()->is_paused_on_exit() &&
3014 ((isolate->debugger() == nullptr) ||
3015 (isolate->debugger()->PauseEvent() == nullptr))) {
3016 return ServiceEvent(isolate, ServiceEvent::kPauseExit);
3017 } else if ((isolate->debugger() != nullptr) &&
3018 (isolate->debugger()->PauseEvent() != nullptr) &&
3019 !isolate->ResumeRequest()) {
3020 return *(isolate->debugger()->PauseEvent());
3021 } else {
3022 ServiceEvent pause_event(isolate, ServiceEvent::kResume);
3023
3024#if !defined(DART_PRECOMPILED_RUNTIME)
3025 if (isolate->debugger() != nullptr) {
3026 // TODO(turnidge): Don't compute a full stack trace.
3027 DebuggerStackTrace* stack = isolate->debugger()->StackTrace();
3028 if (stack->Length() > 0) {
3029 pause_event.set_top_frame(stack->FrameAt(0));
3030 }
3031 }
3032#endif
3033
3034 return pause_event;
3035 }
3036}
const ServiceEvent * PauseEvent() const
Definition debugger.h:731
bool ResumeRequest() const
Definition isolate.h:1101
bool is_runnable() const
Definition isolate.h:1048

◆ IsolateReloadTestLibUri()

static const char * dart::IsolateReloadTestLibUri ( )
static

Definition at line 231 of file unit_test.cc.

231 {
232 return "test:isolate_reload_helper";
233}

◆ IsolateReloadTestNativeResolver()

static Dart_NativeFunction dart::IsolateReloadTestNativeResolver ( Dart_Handle  name,
int  argument_count,
bool *  auto_setup_scope 
)
static

Definition at line 248 of file unit_test.cc.

251 {
252 const char* function_name = nullptr;
253 Dart_Handle result = Dart_StringToCString(name, &function_name);
255 ASSERT(function_name != nullptr);
256 ASSERT(auto_setup_scope != nullptr);
257 *auto_setup_scope = true;
258 int num_entries = sizeof(ReloadEntries) / sizeof(struct NativeEntries);
259 for (int i = 0; i < num_entries; i++) {
260 struct NativeEntries* entry = &(ReloadEntries[i]);
261 if ((strcmp(function_name, entry->name_) == 0) &&
262 (entry->argument_count_ == argument_count)) {
263 return reinterpret_cast<Dart_NativeFunction>(entry->function_);
264 }
265 }
266 return nullptr;
267}
void(* Dart_NativeFunction)(Dart_NativeArguments arguments)
Definition dart_api.h:3198
static struct dart::NativeEntries ReloadEntries[]
const char *const name_

◆ IsolateShutdownRunDartCodeTestCallback()

static void dart::IsolateShutdownRunDartCodeTestCallback ( void *  isolate_group_data,
void *  isolate_data 
)
static

Definition at line 8591 of file dart_api_impl_test.cc.

8606 {
8608 if (Dart_IsKernelIsolate(isolate) || Dart_IsServiceIsolate(isolate)) {
8609 return;
8610 } else {
8611 ASSERT(add_result == 0);
8612 }
DART_EXPORT bool Dart_IsServiceIsolate(Dart_Isolate isolate)
DART_EXPORT bool Dart_IsKernelIsolate(Dart_Isolate isolate)

◆ IsolateShutdownTestCallback()

static void dart::IsolateShutdownTestCallback ( void *  group_data,
void *  isolate_data 
)
static

Definition at line 8512 of file dart_api_impl_test.cc.

8512 {
8513 RunLoopTest(false);
8514}
8515
8516VM_UNIT_TEST_CASE(DartAPI_RunLoop_Exception) {
8517 RunLoopTest(true);
8518}
8519
8520static void* shutdown_isolate_group_data;
8521static void* shutdown_isolate_data;
8522static void* cleanup_isolate_group_data;
8523static void* cleanup_isolate_data;
8524
8525// Called on isolate shutdown time (which is still allowed to run Dart code)
static void * shutdown_isolate_group_data
static void * cleanup_isolate_data
static void RunLoopTest(bool throw_exception)
static void * cleanup_isolate_group_data
static void * shutdown_isolate_data
#define VM_UNIT_TEST_CASE(name)
Definition unit_test.h:33

◆ IsolateSpawn()

void dart::IsolateSpawn ( const char *  platform_script_value)

Definition at line 28 of file isolate_test.cc.

28 {
29 char* scriptChars = OS::SCreate(
30 nullptr,
31 "import 'dart:isolate';\n"
32 // Ignores printed lines.
33 "var _nullPrintClosure = (String line) {};\n"
34 "var _platformScript = () => Uri.parse(\"%s\");\n"
35 "void entry(message) {}\n"
36 "void testMain() {\n"
37 " Isolate.spawn(entry, null);\n"
38 // TODO(floitsch): the following code is only to bump the event loop
39 // so it executes asynchronous microtasks.
40 " var rp = RawReceivePort();\n"
41 " rp.sendPort.send(null);\n"
42 " rp.handler = (_) { rp.close(); };\n"
43 "}\n",
44 platform_script_value);
45
46 Dart_Handle test_lib = TestCase::LoadTestScript(scriptChars, nullptr);
47
48 free(scriptChars);
49
50 // Setup the internal library's 'internalPrint' function.
51 // Necessary because asynchronous errors use "print" to print their
52 // stack trace.
53 Dart_Handle url = NewString("dart:_internal");
54 EXPECT_VALID(url);
55 Dart_Handle internal_lib = Dart_LookupLibrary(url);
56 EXPECT_VALID(internal_lib);
57 Dart_Handle print = Dart_GetField(test_lib, NewString("_nullPrintClosure"));
60 Dart_SetField(internal_lib, NewString("_printClosure"), print);
62
63 Dart_Handle platform_script =
64 Dart_GetField(test_lib, NewString("_platformScript"));
65 EXPECT_VALID(platform_script);
66 Dart_Handle vmlibraryhooks_class =
67 Dart_GetClass(internal_lib, NewString("VMLibraryHooks"));
68 EXPECT_VALID(vmlibraryhooks_class);
69 result = Dart_SetField(vmlibraryhooks_class, NewString("platformScript"),
70 platform_script);
72
73 // Setup the 'scheduleImmediate' closure.
74 url = NewString("dart:isolate");
75 EXPECT_VALID(url);
76 Dart_Handle isolate_lib = Dart_LookupLibrary(url);
77 EXPECT_VALID(isolate_lib);
78 Dart_Handle schedule_immediate_closure =
79 Dart_Invoke(isolate_lib, NewString("_getIsolateScheduleImmediateClosure"),
80 0, nullptr);
82 args[0] = schedule_immediate_closure;
83 url = NewString("dart:async");
84 EXPECT_VALID(url);
85 Dart_Handle async_lib = Dart_LookupLibrary(url);
86 EXPECT_VALID(async_lib);
87 EXPECT_VALID(Dart_Invoke(async_lib, NewString("_setScheduleImmediateClosure"),
88 1, args));
89
90 result = Dart_Invoke(test_lib, NewString("testMain"), 0, nullptr);
92 // Run until all ports to isolate are closed.
95 result,
96 "Lightweight isolate spawn is not supported by this Dart embedder");
98 Dart_Handle exception_result = Dart_ErrorGetException(result);
99 EXPECT_VALID(exception_result);
100}
void print(void *str)
Definition bridge.cpp:126
DART_EXPORT Dart_Handle Dart_ErrorGetException(Dart_Handle handle)
DART_EXPORT Dart_Handle Dart_GetClass(Dart_Handle library, Dart_Handle class_name)
DART_EXPORT bool Dart_ErrorHasException(Dart_Handle handle)
DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_RunLoop(void)

◆ IsOneByteStringClassId()

bool dart::IsOneByteStringClassId ( intptr_t  index)
inline

Definition at line 354 of file class_id.h.

354 {
355 return (index == kOneByteStringCid);
356}

◆ IsPercent()

static bool dart::IsPercent ( int32_t  c)
static

Definition at line 23948 of file object.cc.

23948 {
23949 return c == '%';
23950}

◆ IsPhiDependentPlace()

static bool dart::IsPhiDependentPlace ( Place place)
static

Definition at line 1306 of file redundancy_elimination.cc.

1306 {
1307 return (place->kind() == Place::kInstanceField) &&
1308 (place->instance() != nullptr) && place->instance()->IsPhi();
1309}

◆ IsPopper()

static bool dart::IsPopper ( Instruction instr)
static

Definition at line 597 of file flow_graph_compiler.cc.

597 {
598 // TODO(ajcbik): even allow deopt targets by making environment aware?
599 if (!instr->CanBecomeDeoptimizationTarget()) {
600 return instr->ArgumentCount() == 0 && instr->InputCount() > 0;
601 }
602 return false;
603}
virtual bool CanBecomeDeoptimizationTarget() const
Definition il.h:1337
virtual intptr_t ArgumentCount() const
Definition il.h:1035

◆ IsPositiveOrZeroSmiConst()

static bool dart::IsPositiveOrZeroSmiConst ( Definition d)
static

Definition at line 2907 of file flow_graph.cc.

2907 {
2908 ConstantInstr* const_instr = d->AsConstant();
2909 if ((const_instr != nullptr) && (const_instr->value().IsSmi())) {
2910 return Smi::Cast(const_instr->value()).Value() >= 0;
2911 }
2912 return false;
2913}

◆ IsPotentialExactGeneric()

static bool dart::IsPotentialExactGeneric ( const AbstractType type)
static

Definition at line 455 of file class_finalizer.cc.

455 {
456 return false;
457}

◆ IsPrivateVariableName()

static bool dart::IsPrivateVariableName ( const String var_name)
static

Definition at line 1067 of file debugger.cc.

1067 {
1068 return (var_name.Length() >= 1) && (var_name.CharAt(0) == '_');
1069}

◆ IsPusher()

static bool dart::IsPusher ( Instruction instr)
static

Definition at line 590 of file flow_graph_compiler.cc.

590 {
591 if (auto def = instr->AsDefinition()) {
592 return def->HasTemp() && (instr->representation() == kTagged);
593 }
594 return false;
595}
virtual Representation representation() const
Definition il.h:1254

◆ IsReachableReference()

static constexpr bool dart::IsReachableReference ( intptr_t  ref)
staticconstexpr

Definition at line 300 of file app_snapshot.cc.

300 {
301 return ref == kUnallocatedReference || IsAllocatedReference(ref);
302}
static constexpr bool IsAllocatedReference(intptr_t ref)

◆ IsRedundantBasedOnRangeInformation()

static bool dart::IsRedundantBasedOnRangeInformation ( Value index,
Value length 
)
static

Definition at line 3150 of file range_analysis.cc.

3150 {
3151 if (index->BindsToSmiConstant() && length->BindsToSmiConstant()) {
3152 const auto index_val = index->BoundSmiConstant();
3153 const auto length_val = length->BoundSmiConstant();
3154 return (0 <= index_val && index_val < length_val);
3155 }
3156
3157 // Range of the index is unknown can't decide if the check is redundant.
3158 Definition* index_defn = index->definition();
3159 Range* index_range = index_defn->range();
3160 if (index_range == nullptr) {
3161 if (!index->BindsToSmiConstant()) {
3162 return false;
3163 }
3164 // index_defn itself is not necessarily the constant.
3165 index_defn = index_defn->OriginalDefinition();
3166 Range range;
3167 index_defn->InferRange(nullptr, &range);
3168 ASSERT(!Range::IsUnknown(&range));
3169 index_defn->set_range(range);
3170 index_range = index_defn->range();
3171 }
3172
3173 // Range of the index is not positive. Check can't be redundant.
3174 if (Range::ConstantMinSmi(index_range).ConstantValue() < 0) {
3175 return false;
3176 }
3177
3178 RangeBoundary max = RangeBoundary::FromDefinition(index_defn);
3179 RangeBoundary max_upper = max.UpperBound();
3180 RangeBoundary array_length =
3181 RangeBoundary::FromDefinition(length->definition());
3182 RangeBoundary length_lower = array_length.LowerBound();
3183 if (max_upper.OverflowedSmi() || length_lower.OverflowedSmi()) {
3184 return false;
3185 }
3186
3187 // Try to compare constant boundaries.
3188 if (max_upper.ConstantValue() < length_lower.ConstantValue()) {
3189 return true;
3190 }
3191
3192 RangeBoundary canonical_length = CanonicalizeBoundary(
3193 array_length,
3194 RangeBoundary::MaxConstant(RangeBoundary::kRangeBoundaryInt64));
3195 if (canonical_length.OverflowedSmi()) {
3196 return false;
3197 }
3198
3199 // Try symbolic comparison.
3200 do {
3201 if (DependOnSameSymbol(max, canonical_length)) {
3202 return max.offset() < canonical_length.offset();
3203 }
3204 } while (CanonicalizeMaxBoundary(&max) ||
3205 CanonicalizeMinBoundary(&canonical_length));
3206
3207 // Failed to prove that maximum is bounded with array length.
3208 return false;
3209}
intptr_t BoundSmiConstant() const
Definition il.cc:1210
bool BindsToSmiConstant() const
Definition il.cc:1206
static bool CanonicalizeMaxBoundary(RangeBoundary *a)
static bool DependOnSameSymbol(const RangeBoundary &a, const RangeBoundary &b)
static bool CanonicalizeMinBoundary(RangeBoundary *a)

◆ IsRoughly1337()

DART_EXPORT uint8_t dart::IsRoughly1337 ( float *  a)

Definition at line 814 of file ffi_test_functions.cc.

814 {
815 std::cout << "IsRoughly1337(" << a[0] << ")\n";
816 uint8_t retval = (1336.0f < a[0] && a[0] < 1338.0f) ? 1 : 0;
817 std::cout << "returning " << static_cast<int>(retval) << "\n";
818 return retval;
819}

◆ IsScavengeSurvivor()

static bool dart::IsScavengeSurvivor ( ObjectPtr  obj)
static

Definition at line 1342 of file scavenger.cc.

1342 {
1343 if (obj->IsImmediateOrOldObject()) return true;
1344 return IsForwarding(ReadHeaderRelaxed(obj));
1345}
static DART_FORCE_INLINE uword ReadHeaderRelaxed(ObjectPtr obj)
Definition scavenger.cc:118

◆ IsShallowlyImmutableCid()

bool dart::IsShallowlyImmutableCid ( intptr_t  predefined_cid)
inline

Definition at line 500 of file class_id.h.

500 {
501 ASSERT(predefined_cid < kNumPredefinedCids);
502 // TODO(https://dartbug.com/55136): Mark kClosureCid as shallowly imutable.
503 return IsUnmodifiableTypedDataViewClassId(predefined_cid);
504}

◆ IsSingleUseUnboxOrConstant()

static bool dart::IsSingleUseUnboxOrConstant ( Value use)
static

Definition at line 3731 of file il.cc.

3731 {
3732 return (use->definition()->IsUnbox() && use->IsSingleUse()) ||
3733 use->definition()->IsConstant();
3734}
bool IsSingleUse() const
Definition il.h:117

◆ IsSmallLeafOrReduction()

static bool dart::IsSmallLeafOrReduction ( int  inlining_depth,
intptr_t  call_site_instructions,
FlowGraph graph 
)
static

Definition at line 666 of file inliner.cc.

668 {
669 intptr_t instruction_count = 0;
670 intptr_t call_count = 0;
671 for (BlockIterator block_it = graph->postorder_iterator(); !block_it.Done();
672 block_it.Advance()) {
673 BlockEntryInstr* entry = block_it.Current();
674 for (ForwardInstructionIterator it(entry); !it.Done(); it.Advance()) {
675 Instruction* current = it.Current();
676 if (current->IsDartReturn()) continue;
677 ASSERT(!current->IsNativeReturn());
678 ++instruction_count;
679 if (current->IsInstanceCall() || current->IsPolymorphicInstanceCall() ||
680 current->IsClosureCall()) {
681 return false;
682 }
683 if (current->IsStaticCall()) {
684 const Function& function = current->AsStaticCall()->function();
685 const intptr_t inl_size = function.optimized_instruction_count();
686 const bool always_inline =
687 FlowGraphInliner::FunctionHasPreferInlinePragma(function);
688 // Accept a static call that is always inlined in some way and add the
689 // cached size to the total instruction count. A reasonable guess is
690 // made if the count has not been collected yet (listed methods are
691 // never very large).
692 if (always_inline || function.IsRecognized()) {
693 if (!always_inline) {
694 const intptr_t kAvgListedMethodSize = 20;
695 instruction_count +=
696 (inl_size == 0 ? kAvgListedMethodSize : inl_size);
697 }
698 } else {
699 ++call_count;
700 instruction_count += current->AsStaticCall()->ArgumentCount();
701 instruction_count += 1; // pop the call frame.
702 }
703 continue;
704 }
705 }
706 }
707 if (call_count > 0) {
708 return instruction_count <= call_site_instructions;
709 }
710 return instruction_count <= FLAG_inlining_small_leaf_size_threshold;
711}
BlockIterator postorder_iterator() const
Definition flow_graph.h:222

◆ IsSmiValue()

static bool dart::IsSmiValue ( Value val,
intptr_t *  int_val 
)
static

Definition at line 1695 of file call_specializer.cc.

1695 {
1696 if (val->BindsToConstant() && val->BoundConstant().IsSmi()) {
1697 *int_val = Smi::Cast(val->BoundConstant()).Value();
1698 return true;
1699 }
1700 return false;
1701}

◆ IsSnapshotCompatible()

static bool dart::IsSnapshotCompatible ( Snapshot::Kind  vm_kind,
Snapshot::Kind  isolate_kind 
)
inlinestatic

Definition at line 108 of file snapshot.h.

109 {
110 if (vm_kind == isolate_kind) return true;
111 if (((vm_kind == Snapshot::kFull) || (vm_kind == Snapshot::kFullCore)) &&
112 isolate_kind == Snapshot::kFullJIT)
113 return true;
114 return Snapshot::IsFull(isolate_kind);
115}

◆ IsSpecialCharacter()

template<typename type >
static bool dart::IsSpecialCharacter ( type  value)
static

Definition at line 510 of file object.cc.

510 {
511 return ((value == '"') || (value == '\n') || (value == '\f') ||
512 (value == '\b') || (value == '\t') || (value == '\v') ||
513 (value == '\r') || (value == '\\') || (value == '$'));
514}

◆ IsStringClassId()

bool dart::IsStringClassId ( intptr_t  index)
inline

Definition at line 350 of file class_id.h.

350 {
351 return (index >= kStringCid && index <= kTwoByteStringCid);
352}

◆ IsSTypeImm()

bool dart::IsSTypeImm ( intptr_t  imm)
inline

Definition at line 1072 of file constants_riscv.h.

1072 {
1073 return Utils::IsInt(12, imm);
1074}

◆ IsSupportedAllocation()

static bool dart::IsSupportedAllocation ( Instruction instr)
static

Definition at line 3290 of file redundancy_elimination.cc.

3290 {
3291 return instr->IsAllocation() &&
3292 (!instr->IsArrayAllocation() ||
3293 IsValidLengthForAllocationSinking(instr->AsArrayAllocation()));
3294}
static bool IsValidLengthForAllocationSinking(ArrayAllocationInstr *array_alloc)

◆ IsSuspendedFrame()

static bool dart::IsSuspendedFrame ( Zone zone,
const Function function,
StackFrame frame 
)
static

Definition at line 3382 of file runtime_entry.cc.

3384 {
3385 if (!function.IsSuspendableFunction()) {
3386 return false;
3387 }
3388 auto& suspend_state = Object::Handle(
3389 zone, *reinterpret_cast<ObjectPtr*>(LocalVarAddress(
3390 frame->fp(), runtime_frame_layout.FrameSlotForVariableIndex(
3391 SuspendState::kSuspendStateVarIndex))));
3392 return suspend_state.IsSuspendState() &&
3393 (SuspendState::Cast(suspend_state).pc() != 0);
3394}
intptr_t FrameSlotForVariableIndex(intptr_t index) const

◆ IsSyntheticVariableName()

static bool dart::IsSyntheticVariableName ( const String var_name)
static

Definition at line 1063 of file debugger.cc.

1063 {
1064 return (var_name.Length() >= 1) && (var_name.CharAt(0) == ':');
1065}

◆ IsThreadInGenerated()

DART_EXPORT uint8_t dart::IsThreadInGenerated ( )

Definition at line 115 of file ffi_test_functions_vmspecific.cc.

115 {
116 return Dart_ExecuteInternalCommand("is-thread-in-generated", nullptr) !=
117 nullptr
118 ? 1
119 : 0;
120}

◆ IsTrivialBlock()

static bool dart::IsTrivialBlock ( BlockEntryInstr block,
Definition defn 
)
static

Definition at line 222 of file branch_optimizer.cc.

222 {
223 return (block->IsTargetEntry() && (block->PredecessorCount() == 1)) &&
224 ((block->next() == block->last_instruction()) ||
225 ((block->next() == defn) &&
226 (defn->next() == block->last_instruction())));
227}
virtual intptr_t PredecessorCount() const =0

◆ IsTypeClassId()

bool dart::IsTypeClassId ( intptr_t  index)
inline

Definition at line 370 of file class_id.h.

370 {
371 // Only Type, FunctionType and RecordType can be encountered as instance
372 // types at runtime.
373 return index == kTypeCid || index == kFunctionTypeCid ||
374 index == kRecordTypeCid;
375}

◆ IsTypedDataBaseClassId()

bool dart::IsTypedDataBaseClassId ( intptr_t  index)
inline

Definition at line 429 of file class_id.h.

429 {
430 return index >= kFirstTypedDataCid && index <= kLastTypedDataCid;
431}
static const ClassId kLastTypedDataCid
Definition class_id.h:378

◆ IsTypedDataClassId()

bool dart::IsTypedDataClassId ( intptr_t  index)
inline

Definition at line 433 of file class_id.h.

433 {
434 return IsTypedDataBaseClassId(index) &&
435 ((index - kFirstTypedDataCid) % kNumTypedDataCidRemainders) ==
437}

◆ IsTypedDataUint8ArrayClassId()

static bool dart::IsTypedDataUint8ArrayClassId ( intptr_t  cid)
static

Definition at line 37 of file typed_data.cc.

37 {
38 if (!IsTypedDataBaseClassId(cid)) return false;
39 const intptr_t internal_cid =
40 cid - ((cid - kFirstTypedDataCid) % kNumTypedDataCidRemainders) +
42 return internal_cid == kTypedDataUint8ArrayCid ||
43 internal_cid == kTypedDataUint8ClampedArrayCid;
44}

◆ IsTypedDataViewClassId()

bool dart::IsTypedDataViewClassId ( intptr_t  index)
inline

Definition at line 439 of file class_id.h.

439 {
440 const bool is_byte_data_view = index == kByteDataViewCid;
441 return is_byte_data_view ||
442 (IsTypedDataBaseClassId(index) &&
443 ((index - kFirstTypedDataCid) % kNumTypedDataCidRemainders) ==
445}
const int kTypedDataCidRemainderView
Definition class_id.h:262

◆ IsUnboxedInteger()

static bool dart::IsUnboxedInteger ( Representation  rep)
static

Definition at line 1927 of file flow_graph.cc.

1927 {
1928 return (rep == kUnboxedInt32) || (rep == kUnboxedUint32) ||
1929 (rep == kUnboxedInt64);
1930}

◆ IsUnmodifiableTypedDataViewClassId()

bool dart::IsUnmodifiableTypedDataViewClassId ( intptr_t  index)
inline

Definition at line 453 of file class_id.h.

453 {
454 const bool is_byte_data_view = index == kUnmodifiableByteDataViewCid;
455 return is_byte_data_view ||
456 (IsTypedDataBaseClassId(index) &&
457 ((index - kFirstTypedDataCid) % kNumTypedDataCidRemainders) ==
459}
const int kTypedDataCidRemainderUnmodifiable
Definition class_id.h:264

◆ IsUnreachable() [1/2]

static bool dart::IsUnreachable ( const ObjectPtr  obj)
static

Definition at line 547 of file marker.cc.

547 {
548 if (obj->IsImmediateObject()) {
549 return false;
550 }
551 return !obj->untag()->IsMarked();
552}
static bool IsMarked(uword tags)
Definition raw_object.h:298

◆ IsUnreachable() [2/2]

static bool dart::IsUnreachable ( ObjectPtr ptr)
static

Definition at line 588 of file scavenger.cc.

588 {
589 ObjectPtr obj = *ptr;
590 if (obj->IsImmediateOrOldObject()) {
591 return false;
592 }
593 uword raw_addr = UntaggedObject::ToAddr(obj);
594 uword header = *reinterpret_cast<uword*>(raw_addr);
595 if (IsForwarding(header)) {
596 *ptr = ForwardedObj(header);
597 return false;
598 }
599 return true;
600}

◆ IsUnreservedChar()

static bool dart::IsUnreservedChar ( intptr_t  value)
static

Definition at line 11 of file uri.cc.

11 {
12 return ((value >= 'a' && value <= 'z') || (value >= 'A' && value <= 'Z') ||
13 (value >= '0' && value <= '9') || value == '-' || value == '.' ||
14 value == '_' || value == '~');
15}

◆ IsURISafeCharacter()

static bool dart::IsURISafeCharacter ( int32_t  c)
static

Definition at line 23962 of file object.cc.

23962 {
23963 if ((c >= '0') && (c <= '9')) {
23964 return true;
23965 }
23966 if ((c >= 'a') && (c <= 'z')) {
23967 return true;
23968 }
23969 if ((c >= 'A') && (c <= 'Z')) {
23970 return true;
23971 }
23972 return (c == '-') || (c == '_') || (c == '.') || (c == '~');
23973}

◆ IsUTypeImm()

bool dart::IsUTypeImm ( intptr_t  imm)
inline

Definition at line 1061 of file constants_riscv.h.

1061 {
1062 return Utils::IsInt(32, imm) && Utils::IsAligned(imm, 1 << 12);
1063}

◆ IsValidClassId()

static bool dart::IsValidClassId ( Isolate isolate,
intptr_t  cid 
)
static

Definition at line 667 of file service.cc.

667 {
668 ASSERT(isolate != nullptr);
669 ClassTable* class_table = isolate->group()->class_table();
670 ASSERT(class_table != nullptr);
671 return class_table->IsValidIndex(cid) && class_table->HasValidClassAt(cid);
672}
bool IsValidIndex(intptr_t cid) const

◆ IsValidFlag()

static bool dart::IsValidFlag ( const char *  name,
const char *  prefix,
intptr_t  prefix_length 
)
static

Definition at line 419 of file flags.cc.

421 {
422 intptr_t name_length = strlen(name);
423 return ((name_length > prefix_length) &&
424 (strncmp(name, prefix, prefix_length) == 0));
425}

◆ IsValidLengthForAllocationSinking()

static bool dart::IsValidLengthForAllocationSinking ( ArrayAllocationInstr array_alloc)
static

Definition at line 3278 of file redundancy_elimination.cc.

3279 {
3280 const intptr_t kMaxAllocationSinkingNumElements = 32;
3281 if (!array_alloc->HasConstantNumElements()) {
3282 return false;
3283 }
3284 const intptr_t length = array_alloc->GetConstantNumElements();
3285 return (length >= 0) && (length <= kMaxAllocationSinkingNumElements);
3286}
intptr_t GetConstantNumElements() const
Definition il.h:7757
bool HasConstantNumElements() const
Definition il.h:7754

◆ IsVisibleAsFutureListener()

static bool dart::IsVisibleAsFutureListener ( const Function function)
static

Definition at line 26299 of file object.cc.

26299 {
26300 if (function.is_visible()) {
26301 return true;
26302 }
26303
26304 if (function.IsImplicitClosureFunction()) {
26305 return function.parent_function() == Function::null() ||
26306 Function::is_visible(function.parent_function());
26307 }
26308
26309 return false;
26310}

◆ IsWhitespace()

static bool dart::IsWhitespace ( char  c)
static

Definition at line 2774 of file service.cc.

2774 {
2775 return c <= ' ';
2776}

◆ IsZero()

bool dart::IsZero ( char *  begin,
char *  end 
)

Definition at line 13 of file virtual_memory_test.cc.

13 {
14 for (char* current = begin; current < end; ++current) {
15 if (*current != 0) {
16 return false;
17 }
18 }
19 return true;
20}
static const char * begin(const StringSlice &s)
Definition editor.cpp:252

◆ Join()

static void dart::Join ( Range range,
Definition defn,
const Range defn_range,
RangeBoundary::RangeSize  size 
)
static

Definition at line 2682 of file range_analysis.cc.

2685 {
2686 if (Range::IsUnknown(defn_range)) {
2687 return;
2688 }
2689
2690 if (Range::IsUnknown(range)) {
2691 *range = *defn_range;
2692 return;
2693 }
2694
2695 Range other = *defn_range;
2696
2697 // Handle patterns where range already depends on defn as a symbol:
2698 //
2699 // (..., S+o] U range(S) and [S+o, ...) U range(S)
2700 //
2701 // To improve precision of the computed join use [S, S] instead of
2702 // using range(S). It will be canonicalized away by JoinMin/JoinMax
2703 // functions.
2704 Definition* unwrapped = UnwrapConstraint(defn);
2705 if (DependsOnSymbol(range->min(), unwrapped) ||
2706 DependsOnSymbol(range->max(), unwrapped)) {
2707 other = Range(RangeBoundary::FromDefinition(defn, 0),
2708 RangeBoundary::FromDefinition(defn, 0));
2709 }
2710
2711 // First try to compare ranges based on their upper and lower bounds.
2712 const int64_t inf_range = range->min().LowerBound(size);
2713 const int64_t inf_other = other.min().LowerBound(size);
2714 const int64_t sup_range = range->max().UpperBound(size);
2715 const int64_t sup_other = other.max().UpperBound(size);
2716
2717 if (sup_range <= inf_other) {
2718 // The range is fully below defn's range. Keep the minimum and
2719 // expand the maximum.
2720 range->set_max(other.max());
2721 } else if (sup_other <= inf_range) {
2722 // The range is fully above defn's range. Keep the maximum and
2723 // expand the minimum.
2724 range->set_min(other.min());
2725 } else {
2726 // Can't compare ranges as whole. Join minimum and maximum separately.
2727 *range = Range(RangeBoundary::JoinMin(range->min(), other.min(), size),
2728 RangeBoundary::JoinMax(range->max(), other.max(), size));
2729 }
2730}
RangeBoundary UpperBound() const
RangeBoundary LowerBound() const
void set_max(const RangeBoundary &value)
void set_min(const RangeBoundary &value)
static bool DependsOnSymbol(const RangeBoundary &a, Definition *symbol)

◆ JumpToExceptionHandler()

static void dart::JumpToExceptionHandler ( Thread thread,
uword  program_counter,
uword  stack_pointer,
uword  frame_pointer,
const Object exception_object,
const Object stacktrace_object 
)
static

Definition at line 612 of file exceptions.cc.

617 {
618 bool clear_deopt = false;
619 uword remapped_pc = thread->pending_deopts().RemapExceptionPCForDeopt(
620 program_counter, frame_pointer, &clear_deopt);
621 thread->set_active_exception(exception_object);
622 thread->set_active_stacktrace(stacktrace_object);
623 thread->set_resume_pc(remapped_pc);
624 uword run_exception_pc = StubCode::RunExceptionHandler().EntryPoint();
625 Exceptions::JumpToFrame(thread, run_exception_pc, stack_pointer,
626 frame_pointer, clear_deopt);
627}
uword RemapExceptionPCForDeopt(uword program_counter, uword frame_pointer, bool *clear_deopt)
void set_active_stacktrace(const Object &value)
Definition thread.cc:226
void set_resume_pc(uword value)
Definition thread.h:861
void set_active_exception(const Object &value)
Definition thread.cc:222

◆ JustPropagateError_lookup()

static Dart_NativeFunction dart::JustPropagateError_lookup ( Dart_Handle  name,
int  argument_count,
bool *  auto_setup_scope 
)
static

Definition at line 719 of file dart_api_impl_test.cc.

721 {
722 ASSERT(auto_setup_scope != nullptr);
723 *auto_setup_scope = true;
725}
void JustPropagateErrorNative(Dart_NativeArguments args)

◆ JustPropagateErrorNative()

void dart::JustPropagateErrorNative ( Dart_NativeArguments  args)

Definition at line 710 of file dart_api_impl_test.cc.

710 {
712 EXPECT(Dart_IsClosure(closure));
713 Dart_Handle result = Dart_InvokeClosure(closure, 0, nullptr);
716 UNREACHABLE();
717}
DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_InvokeClosure(Dart_Handle closure, int number_of_arguments, Dart_Handle *arguments)
DART_EXPORT bool Dart_IsClosure(Dart_Handle object)

◆ Kill()

static void dart::Kill ( Thread thread,
JSONStream js 
)
static

Definition at line 4400 of file service.cc.

4400 {
4401 const String& msg =
4402 String::Handle(String::New("isolate terminated by Kill service request"));
4403 const UnwindError& error = UnwindError::Handle(UnwindError::New(msg));
4404 error.set_is_user_initiated(true);
4405 Thread::Current()->set_sticky_error(error);
4406 PrintSuccess(js);
4407}

◆ KillNonMainIsolatesSlow()

static void dart::KillNonMainIsolatesSlow ( Thread thread,
Isolate main_isolate 
)
static

Definition at line 6760 of file dart_api_impl.cc.

6760 {
6761 auto group = main_isolate->group();
6762 while (true) {
6763 bool non_main_isolates_alive = false;
6764 {
6765 DeoptSafepointOperationScope safepoint(thread);
6766 group->ForEachIsolate(
6767 [&](Isolate* isolate) {
6768 if (isolate != main_isolate) {
6769 Isolate::KillIfExists(isolate, Isolate::kKillMsg);
6770 non_main_isolates_alive = true;
6771 }
6772 },
6773 /*at_safepoint=*/true);
6774 if (!non_main_isolates_alive) {
6775 break;
6776 }
6777 }
6778 OS::SleepMicros(10 * 1000);
6779 }
6780}

◆ LargePointer()

DART_EXPORT void * dart::LargePointer ( )

Definition at line 83 of file ffi_test_functions_vmspecific.cc.

83 {
84 Dart_ExecuteInternalCommand("gc-on-nth-allocation",
85 reinterpret_cast<void*>(1));
86 uint64_t origin = 0x8100000082000000;
87 return reinterpret_cast<void*>(origin);
88}

◆ LibraryTagHandler()

static Dart_Handle dart::LibraryTagHandler ( Dart_LibraryTag  tag,
Dart_Handle  library,
Dart_Handle  url 
)
static

Definition at line 378 of file unit_test.cc.

380 {
381 if (tag == Dart_kCanonicalizeUrl) {
382 Dart_Handle library_url = Dart_LibraryUrl(library);
383 if (Dart_IsError(library_url)) {
384 return library_url;
385 }
386 return Dart_DefaultCanonicalizeUrl(library_url, url);
387 }
388 UNREACHABLE();
389 return Dart_Null();
390}
DART_EXPORT Dart_Handle Dart_DefaultCanonicalizeUrl(Dart_Handle base_url, Dart_Handle url)

◆ LinkedHashBaseEqual()

template<class LinkedHashBase >
static bool dart::LinkedHashBaseEqual ( const LinkedHashBase map1,
const LinkedHashBase map2,
bool  print_diff,
bool  check_data = true 
)
static

Definition at line 6656 of file object_test.cc.

6670 {
6671 if (check_data) {
6672 // Check data, only for non-nested.
6673 const auto& data1 = Array::Handle(map1.data());
6674 const auto& data2 = Array::Handle(map2.data());
6675 const intptr_t data1_length = Smi::Value(map1.used_data());
6676 const intptr_t data2_length = Smi::Value(map2.used_data());
6677 const bool data_length_equal = data1_length == data2_length;
6678 bool data_equal = data_length_equal;
6679 if (data_length_equal) {
6680 auto& object1 = Instance::Handle();
6681 auto& object2 = Instance::Handle();
6682 for (intptr_t i = 0; i < data1_length; i++) {
6683 object1 ^= data1.At(i);
6684 object2 ^= data2.At(i);
6685 data_equal &= object1.CanonicalizeEquals(object2);
6686 }
6687 }
6688 if (!data_equal) {
6689 if (print_diff) {
6690 THR_Print("LinkedHashBaseEqual Data not equal.\n");
6691 THR_Print("LinkedHashBaseEqual data1.length %" Pd " data1.length %" Pd
6692 " \n",
6693 data1_length, data2_length);
6694 auto& object1 = Instance::Handle();
6695 for (intptr_t i = 0; i < data1_length; i++) {
6696 object1 ^= data1.At(i);
6697 THR_Print("LinkedHashBaseEqual data1[%" Pd "] %s\n", i,
6698 object1.ToCString());
6699 }
6700 for (intptr_t i = 0; i < data2_length; i++) {
6701 object1 ^= data2.At(i);
6702 THR_Print("LinkedHashBaseEqual data2[%" Pd "] %s\n", i,
6703 object1.ToCString());
6704 }
6705 }
6706 return false;
6707 }
6708 }
6709
6710 // Check hashing.
6711 intptr_t hash_mask1 = Smi::Value(map1.hash_mask());
6712 EXPECT(!Integer::Handle(map2.hash_mask()).IsNull());
6713 intptr_t hash_mask2 = Smi::Value(map2.hash_mask());
6714 const bool hash_masks_equal = hash_mask1 == hash_mask2;
6715 if (!hash_masks_equal) {
6716 if (print_diff) {
6717 THR_Print("LinkedHashBaseEqual Hash masks not equal.\n");
6718 THR_Print("LinkedHashBaseEqual hash_mask1 %" Px " hash_mask2 %" Px " \n",
6719 hash_mask1, hash_mask2);
6720 }
6721 }
6722
6723 // Check indices.
6724 const auto& index1 = TypedData::Handle(map1.index());
6725 const auto& index2 = TypedData::Handle(map2.index());
6726 EXPECT(!index2.IsNull());
6727 ASSERT(index1.ElementType() == kUint32ArrayElement);
6728 ASSERT(index2.ElementType() == kUint32ArrayElement);
6729 const intptr_t kElementSize = 4;
6730 ASSERT(kElementSize == index1.ElementSizeInBytes());
6731 const bool index_length_equal = index1.Length() == index2.Length();
6732 bool index_equal = index_length_equal;
6733 if (index_length_equal) {
6734 for (intptr_t i = 0; i < index1.Length(); i++) {
6735 const uint32_t index1_val = index1.GetUint32(i * kElementSize);
6736 const uint32_t index2_val = index2.GetUint32(i * kElementSize);
6737 index_equal &= index1_val == index2_val;
6738 }
6739 }
6740 if (!index_equal && print_diff) {
6741 THR_Print("LinkedHashBaseEqual Indices not equal.\n");
6742 THR_Print("LinkedHashBaseEqual index1.length %" Pd " index2.length %" Pd
6743 " \n",
6744 index1.Length(), index2.Length());
6745 for (intptr_t i = 0; i < index1.Length(); i++) {
6746 const uint32_t index_val = index1.GetUint32(i * kElementSize);
TypedDataPtr index() const
Definition object.h:12006
ArrayPtr data() const
Definition object.h:12012
SmiPtr hash_mask() const
Definition object.h:12015
SmiPtr used_data() const
Definition object.h:12020

◆ ListCaptureRegisters()

static Interval dart::ListCaptureRegisters ( ZoneGrowableArray< RegExpTree * > *  children)
static

Definition at line 39 of file regexp_ast.cc.

39 {
40 Interval result = Interval::Empty();
41 for (intptr_t i = 0; i < children->length(); i++)
42 result = result.Union(children->At(i)->CaptureRegisters());
43 return result;
44}

◆ Load16Aligned()

static int32_t dart::Load16Aligned ( const uint8_t *  pc)
static

Definition at line 131 of file regexp_interpreter.cc.

131 {
132 ASSERT((reinterpret_cast<intptr_t>(pc) & 1) == 0);
133 return *reinterpret_cast<const uint16_t*>(pc);
134}

◆ Load32Aligned()

static int32_t dart::Load32Aligned ( const uint8_t *  pc)
static

Definition at line 126 of file regexp_interpreter.cc.

126 {
127 ASSERT((reinterpret_cast<intptr_t>(pc) & 3) == 0);
128 return *reinterpret_cast<const int32_t*>(pc);
129}

◆ LoadDynamicLibrary()

static void * dart::LoadDynamicLibrary ( const char *  library_file,
char **  error = nullptr 
)
static

Definition at line 74 of file ffi_dynamic_library.cc.

75 {
76 char* utils_error = nullptr;
77 void* handle = Utils::LoadDynamicLibrary(library_file, &utils_error);
78 if (utils_error != nullptr) {
79 if (error != nullptr) {
80 *error = OS::SCreate(
81 /*use malloc*/ nullptr, "Failed to load dynamic library '%s': %s",
82 library_file != nullptr ? library_file : "<process>", utils_error);
83 }
84 free(utils_error);
85 }
86 return handle;
87}

◆ LoadExpressionEvaluationFunction()

static ObjectPtr dart::LoadExpressionEvaluationFunction ( Zone zone,
const ExternalTypedData kernel_buffer,
const String library_url,
const String klass 
)
static

Definition at line 4804 of file object.cc.

4808 {
4809 std::unique_ptr<kernel::Program> kernel_pgm =
4810 kernel::Program::ReadFromTypedData(kernel_buffer);
4811
4812 if (kernel_pgm == nullptr) {
4813 return ApiError::New(String::Handle(
4814 zone, String::New("Kernel isolate returned ill-formed kernel.")));
4815 }
4816
4817 auto& result = Object::Handle(zone);
4818 {
4819 kernel::KernelLoader loader(kernel_pgm.get(),
4820 /*uri_to_source_table=*/nullptr);
4821 result = loader.LoadExpressionEvaluationFunction(library_url, klass);
4822 kernel_pgm.reset();
4823 }
4824 if (result.IsError()) return result.ptr();
4825 return Function::Cast(result).ptr();
4826}

◆ LoadIsolateReloadTestLibIfNeeded()

static void dart::LoadIsolateReloadTestLibIfNeeded ( const char *  script)
static

Definition at line 289 of file unit_test.cc.

289 {
290#ifndef PRODUCT
291 if (strstr(script, IsolateReloadTestLibUri()) != nullptr) {
292 Dart_Handle result = TestCase::LoadTestLibrary(
293 IsolateReloadTestLibUri(), kIsolateReloadTestLibSource,
294 IsolateReloadTestNativeResolver);
296 }
297#endif // ifndef PRODUCT
298}
static const char * IsolateReloadTestLibUri()
Definition unit_test.cc:231

◆ LoadLibrary()

static Dart_Handle dart::LoadLibrary ( Thread T,
const ExternalTypedData td 
)
static

Definition at line 5750 of file dart_api_impl.cc.

5750 {
5751 const char* error = nullptr;
5752 std::unique_ptr<kernel::Program> program =
5753 kernel::Program::ReadFromTypedData(td, &error);
5754 if (program == nullptr) {
5755 return Api::NewError("Can't load Kernel binary: %s.", error);
5756 }
5757 const Object& result =
5758 kernel::KernelLoader::LoadEntireProgram(program.get(), false);
5759 program.reset();
5760
5761 IsolateGroupSource* source = Isolate::Current()->source();
5762 source->add_loaded_blob(Z, td);
5763
5764 return Api::NewHandle(T, result.ptr());
5765}

◆ LoadRelaxed()

template<typename T >
static T dart::LoadRelaxed ( const T ptr)
inlinestatic

Definition at line 150 of file atomic.h.

150 {
151 static_assert(sizeof(std::atomic<T>) == sizeof(T));
152 return reinterpret_cast<const std::atomic<T>*>(ptr)->load(
153 std::memory_order_relaxed);
154}

◆ LoadScript()

static Dart_Handle dart::LoadScript ( const char *  url_str,
const char *  source 
)
static

Definition at line 4828 of file dart_api_impl_test.cc.

4828 {
4829 const uint8_t* kernel_buffer = nullptr;
4830 intptr_t kernel_buffer_size = 0;
4831 char* error = TestCase::CompileTestScriptWithDFE(
4832 url_str, source, &kernel_buffer, &kernel_buffer_size);
4833 if (error != nullptr) {
4834 return Dart_NewApiError(error);
4835 }
4836 TestCaseBase::AddToKernelBuffers(kernel_buffer);
4837 return Dart_LoadScriptFromKernel(kernel_buffer, kernel_buffer_size);
4838}
DART_EXPORT Dart_Handle Dart_NewApiError(const char *error)

◆ LoadSource()

static Definition * dart::LoadSource ( Definition instr)
static

Definition at line 3413 of file redundancy_elimination.cc.

3413 {
3414 if (auto load = instr->AsLoadField()) {
3415 return load->instance()->definition();
3416 }
3417 if (auto load = instr->AsLoadIndexed()) {
3418 return load->array()->definition();
3419 }
3420 return nullptr;
3421}

◆ LoadTestScript() [1/2]

static LibraryPtr dart::LoadTestScript ( const char *  script)
static

Definition at line 210 of file profiler_test.cc.

210 {
211 Dart_Handle api_lib;
212 {
213 TransitionVMToNative transition(Thread::Current());
214 api_lib = TestCase::LoadTestScript(script, nullptr);
215 EXPECT_VALID(api_lib);
216 }
217 Library& lib = Library::Handle();
218 lib ^= Api::UnwrapHandle(api_lib);
219 return lib.ptr();
220}

◆ LoadTestScript() [2/2]

LibraryPtr dart::LoadTestScript ( const char *  script,
Dart_NativeEntryResolver  resolver,
const char *  lib_uri 
)

Definition at line 26 of file il_test_helper.cc.

28 {
29 Dart_Handle api_lib;
30 {
31 TransitionVMToNative transition(Thread::Current());
32 api_lib = TestCase::LoadTestScript(script, resolver, lib_uri);
33 EXPECT_VALID(api_lib);
34 }
35 auto& lib = Library::Handle();
36 lib ^= Api::UnwrapHandle(api_lib);
37 EXPECT(!lib.IsNull());
38 return lib.ptr();
39}

◆ LoadUnaligned()

template<typename T >
static T dart::LoadUnaligned ( const T ptr)
inlinestatic

Definition at line 14 of file unaligned.h.

14 {
15 T value;
16 memcpy(reinterpret_cast<void*>(&value), // NOLINT
17 reinterpret_cast<const void*>(ptr), sizeof(value));
18 return value;
19}

◆ LocalVarAddress()

static DART_FORCE_INLINE uword dart::LocalVarAddress ( uword  fp,
intptr_t  index 
)
static

Definition at line 429 of file stack_frame.h.

429 {
430 return fp + LocalVarIndex(0, index) * kWordSize;
431}
static DART_FORCE_INLINE intptr_t LocalVarIndex(intptr_t fp_offset, intptr_t var_index)

◆ LocalVarIndex()

static DART_FORCE_INLINE intptr_t dart::LocalVarIndex ( intptr_t  fp_offset,
intptr_t  var_index 
)
static

Definition at line 412 of file stack_frame.h.

413 {
414 return fp_offset + var_index;
415}

◆ LocationAnyOrConstant()

Location dart::LocationAnyOrConstant ( Value value)

Definition at line 357 of file locations.cc.

357 {
358 ConstantInstr* constant = value->definition()->AsConstant();
359 return ((constant != nullptr) &&
360 compiler::Assembler::IsSafe(constant->value()))
361 ? Location::Constant(constant)
362 : Location::Any();
363}

◆ LocationArgumentsDescriptorLocation()

Location dart::LocationArgumentsDescriptorLocation ( )

Definition at line 480 of file locations.cc.

480 {
481 return Location::RegisterLocation(ARGS_DESC_REG);
482}

◆ LocationCount()

intptr_t dart::LocationCount ( Representation  rep)
inline

Definition at line 75 of file locations.h.

75 {
76 switch (rep) {
77 case kPairOfTagged:
78 return 2;
79 case kUnboxedInt64:
80 return compiler::target::kWordSize == 8 ? 1 : 2;
81 default:
82 return 1;
83 }
84}

◆ LocationExceptionLocation()

Location dart::LocationExceptionLocation ( )

Definition at line 484 of file locations.cc.

484 {
485 return Location::RegisterLocation(kExceptionObjectReg);
486}

◆ LocationFixedRegisterOrConstant()

Location dart::LocationFixedRegisterOrConstant ( Value value,
Register  reg 
)

Definition at line 339 of file locations.cc.

339 {
340 ASSERT(((1 << reg) & kDartAvailableCpuRegs) != 0);
341 ConstantInstr* constant = value->definition()->AsConstant();
342 return ((constant != nullptr) &&
343 compiler::Assembler::IsSafe(constant->value()))
344 ? Location::Constant(constant)
345 : Location::RegisterLocation(reg);
346}

◆ LocationFixedRegisterOrSmiConstant()

Location dart::LocationFixedRegisterOrSmiConstant ( Value value,
Register  reg 
)

Definition at line 348 of file locations.cc.

348 {
349 ASSERT(((1 << reg) & kDartAvailableCpuRegs) != 0);
350 ConstantInstr* constant = value->definition()->AsConstant();
351 return ((constant != nullptr) &&
352 compiler::Assembler::IsSafeSmi(constant->value()))
353 ? Location::Constant(constant)
354 : Location::RegisterLocation(reg);
355}

◆ LocationRegisterOrConstant()

Location dart::LocationRegisterOrConstant ( Value value)

Definition at line 289 of file locations.cc.

289 {
290 ConstantInstr* constant = value->definition()->AsConstant();
291 return ((constant != nullptr) &&
292 compiler::Assembler::IsSafe(constant->value()))
293 ? Location::Constant(constant)
294 : Location::RequiresRegister();
295}

◆ LocationRegisterOrSmiConstant()

Location dart::LocationRegisterOrSmiConstant ( Value value,
intptr_t  min_value,
intptr_t  max_value 
)

Definition at line 297 of file locations.cc.

299 {
300 ConstantInstr* constant = value->definition()->AsConstant();
301 if (constant == nullptr) {
302 return Location::RequiresRegister();
303 }
304 if (!compiler::Assembler::IsSafeSmi(constant->value())) {
305 return Location::RequiresRegister();
306 }
307 const intptr_t smi_value = value->BoundSmiConstant();
308 if (smi_value < min_value || smi_value > max_value) {
309 return Location::RequiresRegister();
310 }
311 return Location::Constant(constant);
312}

◆ LocationRemapForSlowPath()

Location dart::LocationRemapForSlowPath ( Location  loc,
Definition def,
intptr_t *  cpu_reg_slots,
intptr_t *  fpu_reg_slots 
)

Definition at line 492 of file locations.cc.

495 {
496 if (loc.IsRegister()) {
497 intptr_t index = cpu_reg_slots[loc.reg()];
498 ASSERT(index >= 0);
499 return Location::StackSlot(
500 compiler::target::frame_layout.FrameSlotForVariableIndex(-index),
501 FPREG);
502 } else if (loc.IsFpuRegister()) {
503 intptr_t index = fpu_reg_slots[loc.fpu_reg()];
504 ASSERT(index >= 0);
505 switch (def->representation()) {
506 case kUnboxedDouble: // SlowPathEnvironmentFor sees _one_ register
507 case kUnboxedFloat: // both for doubles and floats.
508 return Location::DoubleStackSlot(
509 compiler::target::frame_layout.FrameSlotForVariableIndex(-index),
510 FPREG);
511
512 case kUnboxedFloat32x4:
513 case kUnboxedInt32x4:
514 case kUnboxedFloat64x2:
515 return Location::QuadStackSlot(
516 compiler::target::frame_layout.FrameSlotForVariableIndex(-index),
517 FPREG);
518
519 default:
520 UNREACHABLE();
521 }
522 } else if (loc.IsPairLocation()) {
523 ASSERT(def->representation() == kUnboxedInt64);
524 PairLocation* value_pair = loc.AsPairLocation();
525 intptr_t index_lo;
526 intptr_t index_hi;
527
528 if (value_pair->At(0).IsRegister()) {
529 index_lo = compiler::target::frame_layout.FrameSlotForVariableIndex(
530 -cpu_reg_slots[value_pair->At(0).reg()]);
531 } else {
532 ASSERT(value_pair->At(0).IsStackSlot());
533 index_lo = value_pair->At(0).stack_index();
534 }
535
536 if (value_pair->At(1).IsRegister()) {
537 index_hi = compiler::target::frame_layout.FrameSlotForVariableIndex(
538 -cpu_reg_slots[value_pair->At(1).reg()]);
539 } else {
540 ASSERT(value_pair->At(1).IsStackSlot());
541 index_hi = value_pair->At(1).stack_index();
542 }
543
544 return Location::Pair(Location::StackSlot(index_lo, FPREG),
545 Location::StackSlot(index_hi, FPREG));
546 } else if (loc.IsInvalid() && def->IsMaterializeObject()) {
547 def->AsMaterializeObject()->RemapRegisters(cpu_reg_slots, fpu_reg_slots);
548 return loc;
549 }
550
551 return loc;
552}
bool IsInvalid() const
Definition locations.h:289
bool IsFpuRegister() const
Definition locations.h:414
bool IsRegister() const
Definition locations.h:402
Register reg() const
Definition locations.h:404
PairLocation * AsPairLocation() const
Definition locations.cc:280
bool IsPairLocation() const
Definition locations.h:316
FpuRegister fpu_reg() const
Definition locations.h:416

◆ LocationStackTraceLocation()

Location dart::LocationStackTraceLocation ( )

Definition at line 488 of file locations.cc.

488 {
489 return Location::RegisterLocation(kStackTraceObjectReg);
490}

◆ LocationToStackSlotAddress()

compiler::Address dart::LocationToStackSlotAddress ( Location  loc)

Definition at line 365 of file locations.cc.

365 {
366 return compiler::Address(loc.base_reg(), loc.ToStackSlotOffset());
367}
intptr_t ToStackSlotOffset() const
Definition locations.cc:369
Register base_reg() const
Definition locations.h:480

◆ LocationWritableRegisterOrConstant()

Location dart::LocationWritableRegisterOrConstant ( Value value)

Definition at line 314 of file locations.cc.

314 {
315 ConstantInstr* constant = value->definition()->AsConstant();
316 return ((constant != nullptr) &&
317 compiler::Assembler::IsSafe(constant->value()))
318 ? Location::Constant(constant)
319 : Location::WritableRegister();
320}

◆ LocationWritableRegisterOrSmiConstant()

Location dart::LocationWritableRegisterOrSmiConstant ( Value value,
intptr_t  min_value,
intptr_t  max_value 
)

Definition at line 322 of file locations.cc.

324 {
325 ConstantInstr* constant = value->definition()->AsConstant();
326 if (constant == nullptr) {
327 return Location::WritableRegister();
328 }
329 if (!compiler::Assembler::IsSafeSmi(constant->value())) {
330 return Location::WritableRegister();
331 }
332 const intptr_t smi_value = value->BoundSmiConstant();
333 if (smi_value < min_value || smi_value > max_value) {
334 return Location::WritableRegister();
335 }
336 return Location::Constant(constant);
337}

◆ LongJumpHelper()

static void dart::LongJumpHelper ( LongJumpScope jump)
static

Definition at line 11 of file longjump_test.cc.

11 {
12 const Error& error = Error::Handle(
13 LanguageError::New(String::Handle(String::New("LongJumpHelper"))));
14 jump->Jump(1, error);
16}
DART_NORETURN void Jump(int value, const Error &error)
Definition longjump.cc:22

◆ LookupBreakpoint()

static Breakpoint * dart::LookupBreakpoint ( Isolate isolate,
const char *  id,
ObjectIdRing::LookupResult result 
)
static

Definition at line 2238 of file service.cc.

2240 {
2241 *result = ObjectIdRing::kInvalid;
2242 size_t end_pos = strcspn(id, "/");
2243 if (end_pos == strlen(id)) {
2244 return nullptr;
2245 }
2246 const char* rest = id + end_pos + 1; // +1 for '/'.
2247 if (strncmp("breakpoints", id, end_pos) == 0) {
2248 intptr_t bpt_id = 0;
2249 Breakpoint* bpt = nullptr;
2250 if (GetIntegerId(rest, &bpt_id)) {
2251 bpt = isolate->debugger()->GetBreakpointById(bpt_id);
2252 if (bpt != nullptr) {
2253 *result = ObjectIdRing::kValid;
2254 return bpt;
2255 }
2256 if (bpt_id < isolate->debugger()->limitBreakpointId()) {
2257 *result = ObjectIdRing::kCollected;
2258 return nullptr;
2259 }
2260 }
2261 }
2262 return nullptr;
2263}
Breakpoint * GetBreakpointById(intptr_t id)
Definition debugger.cc:4118

◆ LookupClassMembers()

static ObjectPtr dart::LookupClassMembers ( Thread thread,
const Class klass,
char **  parts,
int  num_parts 
)
static

Definition at line 1847 of file service.cc.

1850 {
1851 auto zone = thread->zone();
1852
1853 if (num_parts != 4) {
1854 return Object::sentinel().ptr();
1855 }
1856
1857 const char* encoded_id = parts[3];
1858 auto& id = String::Handle(String::New(encoded_id));
1859 id = String::DecodeIRI(id);
1860 if (id.IsNull()) {
1861 return Object::sentinel().ptr();
1862 }
1863
1864 if (strcmp(parts[2], "fields") == 0) {
1865 // Field ids look like: "classes/17/fields/name"
1866 const auto& field = Field::Handle(klass.LookupField(id));
1867 if (field.IsNull()) {
1868 return Object::sentinel().ptr();
1869 }
1870 return field.ptr();
1871 }
1872 if (strcmp(parts[2], "field_inits") == 0) {
1873 // Field initializer ids look like: "classes/17/field_inits/name"
1874 const auto& field = Field::Handle(klass.LookupField(id));
1875 if (field.IsNull() || (field.is_late() && !field.has_initializer())) {
1876 return Object::sentinel().ptr();
1877 }
1878 const auto& function = Function::Handle(field.EnsureInitializerFunction());
1879 if (function.IsNull()) {
1880 return Object::sentinel().ptr();
1881 }
1882 return function.ptr();
1883 }
1884 if (strcmp(parts[2], "functions") == 0) {
1885 // Function ids look like: "classes/17/functions/name"
1886
1887 const auto& function =
1888 Function::Handle(Resolver::ResolveFunction(zone, klass, id));
1889 if (function.IsNull()) {
1890 return Object::sentinel().ptr();
1891 }
1892 return function.ptr();
1893 }
1894 if (strcmp(parts[2], "implicit_closures") == 0) {
1895 // Function ids look like: "classes/17/implicit_closures/11"
1896 intptr_t id;
1897 if (!GetIntegerId(parts[3], &id)) {
1898 return Object::sentinel().ptr();
1899 }
1900 const auto& func =
1901 Function::Handle(zone, klass.ImplicitClosureFunctionFromIndex(id));
1902 if (func.IsNull()) {
1903 return Object::sentinel().ptr();
1904 }
1905 return func.ptr();
1906 }
1907 if (strcmp(parts[2], "dispatchers") == 0) {
1908 // Dispatcher Function ids look like: "classes/17/dispatchers/11"
1909 intptr_t id;
1910 if (!GetIntegerId(parts[3], &id)) {
1911 return Object::sentinel().ptr();
1912 }
1913 const auto& func =
1914 Function::Handle(zone, klass.InvocationDispatcherFunctionFromIndex(id));
1915 if (func.IsNull()) {
1916 return Object::sentinel().ptr();
1917 }
1918 return func.ptr();
1919 }
1920 if (strcmp(parts[2], "closures") == 0) {
1921 // Closure ids look like: "classes/17/closures/11"
1922 intptr_t id;
1923 if (!GetIntegerId(parts[3], &id)) {
1924 return Object::sentinel().ptr();
1925 }
1926 Function& func = Function::Handle(zone);
1927 func = ClosureFunctionsCache::ClosureFunctionFromIndex(id);
1928 if (func.IsNull()) {
1929 return Object::sentinel().ptr();
1930 }
1931 return func.ptr();
1932 }
1933
1934 UNREACHABLE();
1935 return Object::sentinel().ptr();
1936}
FunctionPtr ImplicitClosureFunctionFromIndex(intptr_t idx) const
Definition object.cc:3404

◆ LookupField()

FieldPtr dart::LookupField ( Dart_Handle  library,
const char *  class_name,
const char *  field_name 
)

Definition at line 13 of file guard_field_test.cc.

15 {
16 LibraryPtr raw_library = Library::RawCast(Api::UnwrapHandle(library));
17 Library& lib = Library::ZoneHandle(raw_library);
18 const String& classname =
19 String::Handle(Symbols::New(Thread::Current(), class_name));
20 Class& cls = Class::Handle(lib.LookupClass(classname));
21 EXPECT(!cls.IsNull()); // No ambiguity error expected.
22
23 String& fieldname = String::Handle(String::New(field_name));
24 Field& field =
25 Field::ZoneHandle(cls.LookupInstanceFieldAllowPrivate(fieldname));
26 EXPECT(!field.IsNull());
27 return field.ptr();
28}
FieldPtr LookupInstanceFieldAllowPrivate(const String &name) const
Definition object.cc:6489

◆ LookupHeapObject()

static ObjectPtr dart::LookupHeapObject ( Thread thread,
const char *  id_original,
ObjectIdRing::LookupResult result 
)
static

Definition at line 2177 of file service.cc.

2179 {
2180 char* id = thread->zone()->MakeCopyOfString(id_original);
2181
2182 // Parse the id by splitting at each '/'.
2183 const int MAX_PARTS = 8;
2184 char* parts[MAX_PARTS];
2185 int num_parts = 0;
2186 int i = 0;
2187 int start_pos = 0;
2188 while (id[i] != '\0') {
2189 if (id[i] == '/') {
2190 id[i++] = '\0';
2191 parts[num_parts++] = &id[start_pos];
2192 if (num_parts == MAX_PARTS) {
2193 break;
2194 }
2195 start_pos = i;
2196 } else {
2197 i++;
2198 }
2199 }
2200 if (num_parts < MAX_PARTS) {
2201 parts[num_parts++] = &id[start_pos];
2202 }
2203
2204 if (result != nullptr) {
2205 *result = ObjectIdRing::kValid;
2206 }
2207
2208 Isolate* isolate = thread->isolate();
2209 if (strcmp(parts[0], "objects") == 0) {
2210 // Object ids look like "objects/1123"
2211 Object& obj = Object::Handle(thread->zone());
2212 ObjectIdRing::LookupResult lookup_result;
2213 obj = LookupObjectId(thread, parts[1], &lookup_result);
2214 if (lookup_result != ObjectIdRing::kValid) {
2215 if (result != nullptr) {
2216 *result = lookup_result;
2217 }
2218 return Object::sentinel().ptr();
2219 }
2220 return obj.ptr();
2221
2222 } else if (strcmp(parts[0], "libraries") == 0) {
2223 return LookupHeapObjectLibraries(isolate->group(), parts, num_parts);
2224 } else if (strcmp(parts[0], "classes") == 0) {
2225 return LookupHeapObjectClasses(thread, parts, num_parts);
2226 } else if (strcmp(parts[0], "typearguments") == 0) {
2227 return LookupHeapObjectTypeArguments(thread, parts, num_parts);
2228 } else if (strcmp(parts[0], "code") == 0) {
2229 return LookupHeapObjectCode(parts, num_parts);
2230 } else if (strcmp(parts[0], "messages") == 0) {
2231 return LookupHeapObjectMessage(thread, parts, num_parts);
2232 }
2233
2234 // Not found.
2235 return Object::sentinel().ptr();
2236}
char * MakeCopyOfString(const char *str)
Definition zone.cc:270
static ObjectPtr LookupHeapObjectMessage(Thread *thread, char **parts, int num_parts)
Definition service.cc:2154
static ObjectPtr LookupHeapObjectCode(char **parts, int num_parts)
Definition service.cc:2108
static ObjectPtr LookupHeapObjectLibraries(IsolateGroup *isolate_group, char **parts, int num_parts)
Definition service.cc:1938
static ObjectPtr LookupObjectId(Thread *thread, const char *arg, ObjectIdRing::LookupResult *kind)
Definition service.cc:1816
static ObjectPtr LookupHeapObjectTypeArguments(Thread *thread, char **parts, int num_parts)
Definition service.cc:2086
static ObjectPtr LookupHeapObjectClasses(Thread *thread, char **parts, int num_parts)
Definition service.cc:2029

◆ LookupHeapObjectClasses()

static ObjectPtr dart::LookupHeapObjectClasses ( Thread thread,
char **  parts,
int  num_parts 
)
static

Definition at line 2029 of file service.cc.

2031 {
2032 // Class ids look like: "classes/17"
2033 if (num_parts < 2) {
2034 return Object::sentinel().ptr();
2035 }
2036 Zone* zone = thread->zone();
2037 auto table = thread->isolate_group()->class_table();
2038 intptr_t id;
2039 if (!GetIntegerId(parts[1], &id) || !table->IsValidIndex(id)) {
2040 return Object::sentinel().ptr();
2041 }
2042 Class& cls = Class::Handle(zone, table->At(id));
2043 if (num_parts == 2) {
2044 return cls.ptr();
2045 }
2046 if (strcmp(parts[2], "closures") == 0) {
2047 // Closure ids look like: "classes/17/closures/11"
2048 return LookupClassMembers(thread, cls, parts, num_parts);
2049 } else if (strcmp(parts[2], "field_inits") == 0) {
2050 // Field initializer ids look like: "classes/17/field_inits/name"
2051 return LookupClassMembers(thread, cls, parts, num_parts);
2052 } else if (strcmp(parts[2], "fields") == 0) {
2053 // Field ids look like: "classes/17/fields/name"
2054 return LookupClassMembers(thread, cls, parts, num_parts);
2055 } else if (strcmp(parts[2], "functions") == 0) {
2056 // Function ids look like: "classes/17/functions/name"
2057 return LookupClassMembers(thread, cls, parts, num_parts);
2058 } else if (strcmp(parts[2], "implicit_closures") == 0) {
2059 // Function ids look like: "classes/17/implicit_closures/11"
2060 return LookupClassMembers(thread, cls, parts, num_parts);
2061 } else if (strcmp(parts[2], "dispatchers") == 0) {
2062 // Dispatcher Function ids look like: "classes/17/dispatchers/11"
2063 return LookupClassMembers(thread, cls, parts, num_parts);
2064 } else if (strcmp(parts[2], "types") == 0) {
2065 // Type ids look like: "classes/17/types/11"
2066 if (num_parts != 4) {
2067 return Object::sentinel().ptr();
2068 }
2069 intptr_t id;
2070 if (!GetIntegerId(parts[3], &id)) {
2071 return Object::sentinel().ptr();
2072 }
2073 if (id != 0) {
2074 return Object::sentinel().ptr();
2075 }
2076 const Type& type = Type::Handle(zone, cls.DeclarationType());
2077 if (!type.IsNull()) {
2078 return type.ptr();
2079 }
2080 }
2081
2082 // Not found.
2083 return Object::sentinel().ptr();
2084}
static ObjectPtr LookupClassMembers(Thread *thread, const Class &klass, char **parts, int num_parts)
Definition service.cc:1847

◆ LookupHeapObjectCode()

static ObjectPtr dart::LookupHeapObjectCode ( char **  parts,
int  num_parts 
)
static

Definition at line 2108 of file service.cc.

2108 {
2109 if (num_parts != 2) {
2110 return Object::sentinel().ptr();
2111 }
2112 uword pc;
2113 const char* const kCollectedPrefix = "collected-";
2114 const intptr_t kCollectedPrefixLen = strlen(kCollectedPrefix);
2115 const char* const kNativePrefix = "native-";
2116 const intptr_t kNativePrefixLen = strlen(kNativePrefix);
2117 const char* const kReusedPrefix = "reused-";
2118 const intptr_t kReusedPrefixLen = strlen(kReusedPrefix);
2119 const char* id = parts[1];
2120 if (strncmp(kCollectedPrefix, id, kCollectedPrefixLen) == 0) {
2121 if (!GetUnsignedIntegerId(&id[kCollectedPrefixLen], &pc, 16)) {
2122 return Object::sentinel().ptr();
2123 }
2124 // TODO(turnidge): Return "collected" instead.
2125 return Object::null();
2126 }
2127 if (strncmp(kNativePrefix, id, kNativePrefixLen) == 0) {
2128 if (!GetUnsignedIntegerId(&id[kNativePrefixLen], &pc, 16)) {
2129 return Object::sentinel().ptr();
2130 }
2131 // TODO(johnmccutchan): Support native Code.
2132 return Object::null();
2133 }
2134 if (strncmp(kReusedPrefix, id, kReusedPrefixLen) == 0) {
2135 if (!GetUnsignedIntegerId(&id[kReusedPrefixLen], &pc, 16)) {
2136 return Object::sentinel().ptr();
2137 }
2138 // TODO(turnidge): Return "expired" instead.
2139 return Object::null();
2140 }
2141 int64_t timestamp = 0;
2142 if (!GetCodeId(id, &timestamp, &pc) || (timestamp < 0)) {
2143 return Object::sentinel().ptr();
2144 }
2145 Code& code = Code::Handle(Code::FindCode(pc, timestamp));
2146 if (!code.IsNull()) {
2147 return code.ptr();
2148 }
2149
2150 // Not found.
2151 return Object::sentinel().ptr();
2152}
static bool GetCodeId(const char *s, int64_t *timestamp, uword *address)
Definition service.cc:617

◆ LookupHeapObjectLibraries()

static ObjectPtr dart::LookupHeapObjectLibraries ( IsolateGroup isolate_group,
char **  parts,
int  num_parts 
)
static

Definition at line 1938 of file service.cc.

1940 {
1941 // Library ids look like "libraries/35"
1942 if (num_parts < 2) {
1943 return Object::sentinel().ptr();
1944 }
1945 const auto& libs =
1946 GrowableObjectArray::Handle(isolate_group->object_store()->libraries());
1947 ASSERT(!libs.IsNull());
1948 const String& id = String::Handle(String::New(parts[1]));
1949 // Scan for private key.
1950 String& private_key = String::Handle();
1951 Library& lib = Library::Handle();
1952 bool lib_found = false;
1953 for (intptr_t i = 0; i < libs.Length(); i++) {
1954 lib ^= libs.At(i);
1955 ASSERT(!lib.IsNull());
1956 private_key = lib.private_key();
1957 if (private_key.Equals(id)) {
1958 lib_found = true;
1959 break;
1960 }
1961 }
1962 if (!lib_found) {
1963 return Object::sentinel().ptr();
1964 }
1965
1966 const auto& klass = Class::Handle(lib.toplevel_class());
1967 ASSERT(!klass.IsNull());
1968
1969 if (num_parts == 2) {
1970 return lib.ptr();
1971 }
1972 if (strcmp(parts[2], "fields") == 0) {
1973 // Library field ids look like: "libraries/17/fields/name"
1974 return LookupClassMembers(Thread::Current(), klass, parts, num_parts);
1975 }
1976 if (strcmp(parts[2], "field_inits") == 0) {
1977 // Library field ids look like: "libraries/17/field_inits/name"
1978 return LookupClassMembers(Thread::Current(), klass, parts, num_parts);
1979 }
1980 if (strcmp(parts[2], "functions") == 0) {
1981 // Library function ids look like: "libraries/17/functions/name"
1982 return LookupClassMembers(Thread::Current(), klass, parts, num_parts);
1983 }
1984 if (strcmp(parts[2], "closures") == 0) {
1985 // Library function ids look like: "libraries/17/closures/name"
1986 return LookupClassMembers(Thread::Current(), klass, parts, num_parts);
1987 }
1988 if (strcmp(parts[2], "implicit_closures") == 0) {
1989 // Library function ids look like: "libraries/17/implicit_closures/name"
1990 return LookupClassMembers(Thread::Current(), klass, parts, num_parts);
1991 }
1992
1993 if (strcmp(parts[2], "scripts") == 0) {
1994 // Script ids look like "libraries/35/scripts/library%2Furl.dart/12345"
1995 if (num_parts != 5) {
1996 return Object::sentinel().ptr();
1997 }
1998 const String& id = String::Handle(String::New(parts[3]));
1999 ASSERT(!id.IsNull());
2000 // The id is the url of the script % encoded, decode it.
2001 const String& requested_url = String::Handle(String::DecodeIRI(id));
2002
2003 // Each script id is tagged with a load time.
2004 int64_t timestamp;
2005 if (!GetInteger64Id(parts[4], &timestamp, 16) || (timestamp < 0)) {
2006 return Object::sentinel().ptr();
2007 }
2008
2009 Script& script = Script::Handle();
2010 String& script_url = String::Handle();
2011 const Array& loaded_scripts = Array::Handle(lib.LoadedScripts());
2012 ASSERT(!loaded_scripts.IsNull());
2013 intptr_t i;
2014 for (i = 0; i < loaded_scripts.Length(); i++) {
2015 script ^= loaded_scripts.At(i);
2016 ASSERT(!script.IsNull());
2017 script_url = script.url();
2018 if (script_url.Equals(requested_url) &&
2019 (timestamp == script.load_timestamp())) {
2020 return script.ptr();
2021 }
2022 }
2023 }
2024
2025 // Not found.
2026 return Object::sentinel().ptr();
2027}
DART_EXPORT bool IsNull(Dart_Handle object)

◆ LookupHeapObjectMessage()

static ObjectPtr dart::LookupHeapObjectMessage ( Thread thread,
char **  parts,
int  num_parts 
)
static

Definition at line 2154 of file service.cc.

2156 {
2157 if (num_parts != 2) {
2158 return Object::sentinel().ptr();
2159 }
2160 uword message_id = 0;
2161 if (!GetUnsignedIntegerId(parts[1], &message_id, 16)) {
2162 return Object::sentinel().ptr();
2163 }
2164 MessageHandler::AcquiredQueues aq(thread->isolate()->message_handler());
2165 Message* message = aq.queue()->FindMessageById(message_id);
2166 if (message == nullptr) {
2167 // The user may try to load an expired message.
2168 return Object::sentinel().ptr();
2169 }
2170 if (message->IsRaw()) {
2171 return message->raw_obj();
2172 } else {
2173 return ReadMessage(thread, message);
2174 }
2175}

◆ LookupHeapObjectTypeArguments()

static ObjectPtr dart::LookupHeapObjectTypeArguments ( Thread thread,
char **  parts,
int  num_parts 
)
static

Definition at line 2086 of file service.cc.

2088 {
2089 // TypeArguments ids look like: "typearguments/17"
2090 if (num_parts < 2) {
2091 return Object::sentinel().ptr();
2092 }
2093 intptr_t id;
2094 if (!GetIntegerId(parts[1], &id)) {
2095 return Object::sentinel().ptr();
2096 }
2097 ObjectStore* object_store = thread->isolate_group()->object_store();
2098 const Array& table =
2099 Array::Handle(thread->zone(), object_store->canonical_type_arguments());
2100 ASSERT(table.Length() > 0);
2101 const intptr_t table_size = table.Length() - 1;
2102 if ((id < 0) || (id >= table_size) || (table.At(id) == Object::null())) {
2103 return Object::sentinel().ptr();
2104 }
2105 return table.At(id);
2106}

◆ LookupObjectId()

static ObjectPtr dart::LookupObjectId ( Thread thread,
const char *  arg,
ObjectIdRing::LookupResult kind 
)
static

Definition at line 1816 of file service.cc.

1818 {
1819 *kind = ObjectIdRing::kValid;
1820 if (strncmp(arg, "int-", 4) == 0) {
1821 arg += 4;
1822 int64_t value = 0;
1823 if (!OS::StringToInt64(arg, &value) || !Smi::IsValid(value)) {
1824 *kind = ObjectIdRing::kInvalid;
1825 return Object::null();
1826 }
1827 const Integer& obj =
1828 Integer::Handle(thread->zone(), Smi::New(static_cast<intptr_t>(value)));
1829 return obj.ptr();
1830 } else if (strcmp(arg, "bool-true") == 0) {
1831 return Bool::True().ptr();
1832 } else if (strcmp(arg, "bool-false") == 0) {
1833 return Bool::False().ptr();
1834 } else if (strcmp(arg, "null") == 0) {
1835 return Object::null();
1836 }
1837
1838 ObjectIdRing* ring = thread->isolate()->EnsureObjectIdRing();
1839 intptr_t id = -1;
1840 if (!GetIntegerId(arg, &id)) {
1841 *kind = ObjectIdRing::kInvalid;
1842 return Object::null();
1843 }
1844 return ring->GetObjectForId(id, kind);
1845}

◆ LookupPackageUris()

static void dart::LookupPackageUris ( Thread thread,
JSONStream js 
)
static

Definition at line 5481 of file service.cc.

5481 {
5482 LookupScriptUrisImpl(thread, js, false);
5483}
static void LookupScriptUrisImpl(Thread *thread, JSONStream *js, bool lookup_resolved)
Definition service.cc:5407

◆ LookupResolvedPackageUris()

static void dart::LookupResolvedPackageUris ( Thread thread,
JSONStream js 
)
static

Definition at line 5472 of file service.cc.

5472 {
5473 LookupScriptUrisImpl(thread, js, true);
5474}

◆ LookupRewindPc()

static uword dart::LookupRewindPc ( const Code code,
uword  return_address 
)
static

Definition at line 3234 of file debugger.cc.

3234 {
3235 ASSERT(!code.is_optimized());
3236 ASSERT(code.ContainsInstructionAt(return_address));
3237
3238 uword pc_offset = return_address - code.PayloadStart();
3239 const PcDescriptors& descriptors =
3240 PcDescriptors::Handle(code.pc_descriptors());
3241 PcDescriptors::Iterator iter(descriptors,
3242 UntaggedPcDescriptors::kRewind |
3243 UntaggedPcDescriptors::kIcCall |
3244 UntaggedPcDescriptors::kUnoptStaticCall);
3245 intptr_t rewind_deopt_id = -1;
3246 uword rewind_pc = 0;
3247 while (iter.MoveNext()) {
3248 if (iter.Kind() == UntaggedPcDescriptors::kRewind) {
3249 // Remember the last rewind so we don't need to iterator twice.
3250 rewind_pc = code.PayloadStart() + iter.PcOffset();
3251 rewind_deopt_id = iter.DeoptId();
3252 }
3253 if ((pc_offset == iter.PcOffset()) && (iter.DeoptId() == rewind_deopt_id)) {
3254 return rewind_pc;
3255 }
3256 }
3257 return 0;
3258}

◆ LookupScriptUrisImpl()

static void dart::LookupScriptUrisImpl ( Thread thread,
JSONStream js,
bool  lookup_resolved 
)
static

Definition at line 5407 of file service.cc.

5409 {
5410 Zone* zone = thread->zone();
5411 auto object_store = thread->isolate_group()->object_store();
5412
5413 const auto& libs =
5414 GrowableObjectArray::Handle(zone, object_store->libraries());
5415 Smi& last_libraries_count =
5416 Smi::Handle(zone, object_store->last_libraries_count());
5417 if ((object_store->uri_to_resolved_uri_map() == Array::null()) ||
5418 (object_store->resolved_uri_to_uri_map() == Array::null()) ||
5419 (last_libraries_count.Value() != libs.Length())) {
5420 PopulateUriMappings(thread);
5421 }
5422 const char* uris_arg = js->LookupParam("uris");
5423 if (uris_arg == nullptr) {
5424 PrintMissingParamError(js, "uris");
5425 return;
5426 }
5427
5428 const GrowableObjectArray& uris =
5429 GrowableObjectArray::Handle(zone, GrowableObjectArray::New());
5430 intptr_t uris_length = ParseJSONArray(thread, uris_arg, uris);
5431 if (uris_length < 0) {
5432 PrintInvalidParamError(js, "uris");
5433 return;
5434 }
5435
5436 UriMapping map(lookup_resolved ? object_store->uri_to_resolved_uri_map()
5437 : object_store->resolved_uri_to_uri_map());
5438 JSONObject jsobj(js);
5439 jsobj.AddProperty("type", "UriList");
5440
5441 {
5442 JSONArray uris_array(&jsobj, "uris");
5443 String& uri = String::Handle(zone);
5444 String& res = String::Handle(zone);
5445 for (intptr_t i = 0; i < uris.Length(); ++i) {
5446 uri ^= uris.At(i);
5447 res ^= map.GetOrNull(uri);
5448#if defined(DART_HOST_OS_WINDOWS) || defined(DART_HOST_OS_MACOS)
5449 // Windows and MacOS paths can be case insensitive, so we should allow for
5450 // case insensitive URI mappings on Windows and MacOS.
5451 if (res.IsNull()) {
5452 String& lower_case_uri = thread->StringHandle();
5453 lower_case_uri = String::ToLowerCase(uri);
5454 res ^= map.GetOrNull(lower_case_uri);
5455 }
5456#endif // defined(DART_HOST_OS_WINDOWS) || defined(DART_HOST_OS_MACOS)
5457 if (res.IsNull()) {
5458 uris_array.AddValueNull();
5459 } else {
5460 uris_array.AddValue(res.ToCString());
5461 }
5462 }
5463 }
5464 map.Release();
5465}
static void PopulateUriMappings(Thread *thread)
Definition service.cc:5361
UnorderedHashMap< UriMappingTraits > UriMapping
Definition service.cc:5359

◆ LookupStackTraceField()

static FieldPtr dart::LookupStackTraceField ( const Instance instance)
static

Definition at line 700 of file exceptions.cc.

700 {
701 if (instance.GetClassId() < kNumPredefinedCids) {
702 // 'class Error' is not a predefined class.
703 return Field::null();
704 }
705 Thread* thread = Thread::Current();
706 Zone* zone = thread->zone();
707 auto isolate_group = thread->isolate_group();
708 const auto& error_class =
709 Class::Handle(zone, isolate_group->object_store()->error_class());
710 // If instance class extends 'class Error' return '_stackTrace' field.
711 Class& test_class = Class::Handle(zone, instance.clazz());
712 AbstractType& type = AbstractType::Handle(zone, AbstractType::null());
713 while (true) {
714 if (test_class.ptr() == error_class.ptr()) {
715 return error_class.LookupInstanceFieldAllowPrivate(
716 Symbols::_stackTrace());
717 }
718 type = test_class.super_type();
719 if (type.IsNull()) return Field::null();
720 test_class = type.type_class();
721 }
722 UNREACHABLE();
723 return Field::null();
724}

◆ LowestFirst()

int dart::LowestFirst ( const TokenPosition a,
const TokenPosition b 
)

Definition at line 17 of file yield_position_test.cc.

17 {
18 return a->Pos() - b->Pos();
19}

◆ Main()

static int dart::Main ( int  argc,
const char **  argv 
)
static

Definition at line 299 of file run_vm_tests.cc.

299 {
300#if !defined(DART_HOST_OS_WINDOWS)
301 // Very early so any crashes during startup can also be symbolized.
302 bin::EXEUtils::LoadDartProfilerSymbols(argv[0]);
303#endif
304
305 // Flags being passed to the Dart VM.
306 int dart_argc = 0;
307 const char** dart_argv = nullptr;
308
309 // Perform platform specific initialization.
311 Syslog::PrintErr("Initialization failed\n");
312 return 1;
313 }
314
315 // Save the console state so we can restore it later.
317
318 // Store the executable name.
320
321 if (argc < 2) {
322 // Bad parameter count.
323 PrintUsage();
324 return 1;
325 }
326
327 if (argc == 2 && strcmp(argv[1], "--list") == 0) {
329 // List all tests and benchmarks and exit without initializing the VM.
330 TestCaseBase::RunAll();
331 Benchmark::RunAll(argv[0]);
332 TestCaseBase::RunAllRaw();
333 fflush(stdout);
334 return 0;
335 }
336
337 int arg_pos = 1;
338 bool start_kernel_isolate = false;
339 bool suppress_core_dump = false;
340 if (strcmp(argv[arg_pos], "--suppress-core-dump") == 0) {
341 suppress_core_dump = true;
342 ShiftArgs(&argc, argv);
343 }
344
345 if (suppress_core_dump) {
346 bin::Platform::SetCoreDumpResourceLimit(0);
347 } else {
348 bin::InitializeCrashpadClient();
349 }
350
351 if (strncmp(argv[arg_pos], "--dfe", strlen("--dfe")) == 0) {
352 const char* delim = strstr(argv[arg_pos], "=");
353 if (delim == nullptr || strlen(delim + 1) == 0) {
354 Syslog::PrintErr("Invalid value for the option: %s\n", argv[arg_pos]);
355 PrintUsage();
356 return 1;
357 }
358 kernel_snapshot = Utils::StrDup(delim + 1);
359 start_kernel_isolate = true;
360 ShiftArgs(&argc, argv);
361 }
362
363 if (arg_pos == argc - 1 && strcmp(argv[arg_pos], "--benchmarks") == 0) {
364 // "--benchmarks" is the last argument.
366 } else {
367 // Last argument is the test name, the rest are vm flags.
368 run_filter = argv[argc - 1];
369 // Remove the first value (executable) from the arguments and
370 // exclude the last argument which is the test name.
371 dart_argc = argc - 2;
372 dart_argv = &argv[1];
373 }
374
375 bin::TimerUtils::InitOnce();
376 bin::Process::Init();
377 bin::EventHandler::Start();
378
379 char* error = Flags::ProcessCommandLineFlags(dart_argc, dart_argv);
380 if (error != nullptr) {
381 Syslog::PrintErr("Failed to parse flags: %s\n", error);
382 free(error);
383 return 1;
384 }
385
386 TesterState::vm_snapshot_data = dart::bin::vm_snapshot_data;
387 TesterState::create_callback = CreateIsolateAndSetup;
388 TesterState::group_cleanup_callback = CleanupIsolateGroup;
389 TesterState::argv = dart_argv;
390 TesterState::argc = dart_argc;
391
392 Dart_InitializeParams init_params;
393 memset(&init_params, 0, sizeof(init_params));
403 init_params.start_kernel_isolate = start_kernel_isolate;
404#if defined(DART_HOST_OS_FUCHSIA)
405 init_params.vmex_resource = dart::bin::Platform::GetVMEXResource();
406#endif
407 error = Dart::Init(&init_params);
408 if (error != nullptr) {
409 Syslog::PrintErr("Failed to initialize VM: %s\n", error);
410 free(error);
411 return 1;
412 }
413
414 Dart_SetEmbedderInformationCallback(&EmbedderInformationCallback);
415
416 // Apply the filter to all registered tests.
417 TestCaseBase::RunAll();
418 // Apply the filter to all registered benchmarks.
419 Benchmark::RunAll(argv[0]);
420
421 bin::Process::TerminateExitCodeHandler();
422 error = Dart::Cleanup();
423 if (error != nullptr) {
424 Syslog::PrintErr("Failed shutdown VM: %s\n", error);
425 free(error);
426 return 1;
427 }
428
429 TestCaseBase::RunAllRaw();
430
431 bin::EventHandler::Stop();
432 bin::Process::Cleanup();
433
434 // Print a warning message if no tests or benchmarks were matched.
435 if (run_matches == 0) {
436 Syslog::PrintErr("No tests matched: %s\n", run_filter);
437 return 1;
438 }
439 if (Expect::failed()) {
440 return 255;
441 }
442 return 0;
443}
static void SaveConfig()
static void ReadFile(uint8_t **data, intptr_t *file_len, void *stream)
Definition dartutils.cc:277
static void CloseFile(void *stream)
Definition dartutils.cc:307
static void * OpenFile(const char *name, bool write)
Definition dartutils.cc:265
static void WriteFile(const void *buffer, intptr_t num_bytes, void *stream)
Definition dartutils.cc:298
static void SetExecutableName(const char *executable_name)
Definition platform.h:71
static bool Initialize()
DART_EXPORT void Dart_SetEmbedderInformationCallback(Dart_EmbedderInformationCallback callback)
void PrintUsage()
Definition main.cc:143
char ** argv
Definition library.h:9
const uint8_t * vm_snapshot_instructions
Definition main_impl.cc:57
static Dart_Isolate CreateIsolateAndSetup(const char *script_uri, const char *main, const char *package_root, const char *packages_config, Dart_IsolateFlags *flags, void *data, char **error)
static void CleanupIsolateGroup(void *callback_data)
static const char * run_filter
static constexpr const char * kAllBenchmarks
void ShiftArgs(int *argc, const char **argv)
static constexpr const char * kList
Dart_IsolateGroupCreateCallback create_group
Definition dart_api.h:924
Dart_IsolateGroupCleanupCallback cleanup_group
Definition dart_api.h:949
Dart_FileReadCallback file_read
Definition dart_api.h:954
const uint8_t * vm_snapshot_data
Definition dart_api.h:910
Dart_FileOpenCallback file_open
Definition dart_api.h:953
Dart_FileWriteCallback file_write
Definition dart_api.h:955
const uint8_t * vm_snapshot_instructions
Definition dart_api.h:918
Dart_FileCloseCallback file_close
Definition dart_api.h:956

◆ MainModifiedCallback()

static bool dart::MainModifiedCallback ( const char *  url,
int64_t  since 
)
static

Definition at line 4480 of file isolate_reload_test.cc.

4480 {\n"
4481 " hash2 = foo.hashCode;\n"
4482 " return (hash1 == hash2).toString();\n"
4483 "}\n";
4484
4485 lib = TestCase::ReloadTestScript(kReloadScript);
4486 EXPECT_VALID(lib);

◆ MakeAssertAssignable()

static Definition * dart::MakeAssertAssignable ( CompilerState S,
FlowGraph flow_graph,
Definition defn 
)
static

Definition at line 338 of file redundancy_elimination_test.cc.

340 {
341 const auto& dst_type = AbstractType::ZoneHandle(Type::ObjectType());
342 return new AssertAssignableInstr(InstructionSource(), new Value(defn),
343 new Value(flow_graph->GetConstant(dst_type)),
344 new Value(flow_graph->constant_null()),
345 new Value(flow_graph->constant_null()),
346 Symbols::Empty(), S->GetNextDeoptId());
347}

◆ MakeCheckNull()

static Definition * dart::MakeCheckNull ( CompilerState S,
FlowGraph flow_graph,
Definition defn 
)
static

Definition at line 325 of file redundancy_elimination_test.cc.

327 {
328 return new CheckNullInstr(new Value(defn), String::ZoneHandle(),
329 S->GetNextDeoptId(), InstructionSource());
330}

◆ MakeLocationArray() [1/3]

static LocationArray * dart::MakeLocationArray ( )
static

Definition at line 22 of file locations_helpers_test.cc.

22 {
23 LocationArray* arr = new LocationArray();
24 return arr;
25}

◆ MakeLocationArray() [2/3]

static LocationArray * dart::MakeLocationArray ( Location  loc0)
static

Definition at line 27 of file locations_helpers_test.cc.

27 {
28 LocationArray* arr = new LocationArray();
29 arr->Add(loc0);
30 return arr;
31}

◆ MakeLocationArray() [3/3]

static LocationArray * dart::MakeLocationArray ( Location  loc0,
Location  loc1 
)
static

Definition at line 33 of file locations_helpers_test.cc.

33 {
34 LocationArray* arr = new LocationArray();
35 arr->Add(loc0);
36 arr->Add(loc1);
37 return arr;
38}

◆ MakeLocationSummaryFromEmitter()

template<typename Instr , typename Out >
LocationSummary * dart::MakeLocationSummaryFromEmitter ( Zone zone,
const Instr instr,
void(*)(FlowGraphCompiler *, Instr *, Out)  Emit 
)

Definition at line 284 of file locations_helpers.h.

288 {
289 typedef SIGNATURE_TRAIT(0, ()) S;
290 ASSERT(instr->InputCount() == S::kInputCount);
291 LocationSummary* summary = new (zone) LocationSummary(
292 zone, S::kInputCount, S::kTempCount, LocationSummary::kNoCall);
293 summary->set_out(0, LocationTrait<Out>::ToConstraint());
294 return summary;
295}

◆ MakeRedefinition()

static Definition * dart::MakeRedefinition ( CompilerState S,
FlowGraph flow_graph,
Definition defn 
)
static

Definition at line 332 of file redundancy_elimination_test.cc.

334 {
335 return new RedefinitionInstr(new Value(defn));
336}

◆ MakeServerControlMessage()

static ArrayPtr dart::MakeServerControlMessage ( const SendPort sp,
intptr_t  code,
bool  enable,
const Bool silenceOutput 
)
static

Definition at line 88 of file service_isolate.cc.

91 {
92 const Array& list = Array::Handle(Array::New(4));
93 ASSERT(!list.IsNull());
94 list.SetAt(0, Integer::Handle(Integer::New(code)));
95 list.SetAt(1, sp);
96 list.SetAt(2, Bool::Get(enable));
97 list.SetAt(3, silenceOutput);
98 return list.ptr();
99}

◆ malloc()

void * dart::malloc ( size_t  size)

Definition at line 19 of file allocation.cc.

19 {
20 void* result = ::malloc(size);
21 if (result == nullptr) {
23 }
24 return result;
25}

◆ MallocFinalizer() [1/2]

static void dart::MallocFinalizer ( void *  isolate_callback_data,
void *  peer 
)
static

Definition at line 1912 of file snapshot_test.cc.

1912 {
1913 free(peer);
1914}

◆ MallocFinalizer() [2/2]

static void dart::MallocFinalizer ( void *  isolate_callback_data,
void *  peer 
)
static

Definition at line 437 of file unit_test.cc.

437 {
438 free(peer);
439}

◆ ManyHandles()

DART_EXPORT void dart::ManyHandles ( Dart_Handle  o0,
Dart_Handle  o1,
Dart_Handle  o2,
Dart_Handle  o3,
Dart_Handle  o4,
Dart_Handle  o5,
Dart_Handle  o6,
Dart_Handle  o7,
Dart_Handle  o8,
Dart_Handle  o9,
Dart_Handle  o10,
Dart_Handle  o11,
Dart_Handle  o12,
Dart_Handle  o13,
Dart_Handle  o14,
Dart_Handle  o15,
Dart_Handle  o16,
Dart_Handle  o17,
Dart_Handle  o18,
Dart_Handle  o19 
)

Definition at line 1419 of file ffi_test_functions_vmspecific.cc.

1438 {
1439#define CHECK_STRING(o) \
1440 if (!Dart_IsString(o)) { \
1441 FATAL("expected Dart_IsString"); \
1442 }
1443 CHECK_STRING(o0);
1444 CHECK_STRING(o1);
1445 CHECK_STRING(o2);
1446 CHECK_STRING(o3);
1447 CHECK_STRING(o4);
1448 CHECK_STRING(o5);
1449 CHECK_STRING(o6);
1450 CHECK_STRING(o7);
1451 CHECK_STRING(o8);
1452 CHECK_STRING(o9);
1453 CHECK_STRING(o10);
1454 CHECK_STRING(o11);
1455 CHECK_STRING(o12);
1456 CHECK_STRING(o13);
1457 CHECK_STRING(o14);
1458 CHECK_STRING(o15);
1459 CHECK_STRING(o16);
1460 CHECK_STRING(o17);
1461 CHECK_STRING(o18);
1462 CHECK_STRING(o19);
1463}
#define CHECK_STRING(o)

◆ MapsFromBuilder()

static CompressedStackMapsPtr dart::MapsFromBuilder ( Zone zone,
BitmapBuilder bmap 
)
static

Definition at line 19 of file bitmap_test.cc.

19 {
20 CompressedStackMapsBuilder builder(zone);
21 builder.AddEntry(kTestPcOffset, bmap, kTestSpillSlotBitCount);
22 return builder.Finalize();
23}

◆ MarkClasses()

static void dart::MarkClasses ( const Class root,
bool  include_subclasses,
bool  include_implementors 
)
static

Definition at line 3449 of file service.cc.

3451 {
3452 Thread* thread = Thread::Current();
3453 HANDLESCOPE(thread);
3454 ClassTable* table = thread->isolate()->group()->class_table();
3456 table->SetCollectInstancesFor(root.id(), true);
3457 worklist.Add(&root);
3458 GrowableObjectArray& subclasses = GrowableObjectArray::Handle();
3459 GrowableObjectArray& implementors = GrowableObjectArray::Handle();
3460 while (!worklist.is_empty()) {
3461 const Class& cls = *worklist.RemoveLast();
3462 // All subclasses are implementors, but they are not included in
3463 // `direct_implementors`.
3464 if (include_subclasses || include_implementors) {
3465 subclasses = cls.direct_subclasses_unsafe();
3466 if (!subclasses.IsNull()) {
3467 for (intptr_t j = 0; j < subclasses.Length(); j++) {
3468 Class& subclass = Class::Handle();
3469 subclass ^= subclasses.At(j);
3470 if (!table->CollectInstancesFor(subclass.id())) {
3471 table->SetCollectInstancesFor(subclass.id(), true);
3472 worklist.Add(&subclass);
3473 }
3474 }
3475 }
3476 }
3477 if (include_implementors) {
3478 implementors = cls.direct_implementors_unsafe();
3479 if (!implementors.IsNull()) {
3480 for (intptr_t j = 0; j < implementors.Length(); j++) {
3481 Class& implementor = Class::Handle();
3482 implementor ^= implementors.At(j);
3483 if (!table->CollectInstancesFor(implementor.id())) {
3484 table->SetCollectInstancesFor(implementor.id(), true);
3485 worklist.Add(&implementor);
3486 }
3487 }
3488 }
3489 }
3490 }
3491}
GrowableObjectArrayPtr direct_implementors_unsafe() const
Definition object.h:1527

◆ Marker()

static DART_FORCE_INLINE ObjectPtr dart::Marker ( )
static

Definition at line 144 of file object_graph_copy.cc.

144 {
145 return Object::unknown_constant().ptr();
146}

◆ MarkImplemented()

static void dart::MarkImplemented ( Zone zone,
const Class iface 
)
static

Definition at line 530 of file class_finalizer.cc.

530 {
531 if (iface.is_implemented()) {
532 return;
533 }
534
535 Class& cls = Class::Handle(zone, iface.ptr());
536 AbstractType& type = AbstractType::Handle(zone);
537
538 while (!cls.is_implemented()) {
539 cls.set_is_implemented();
540
541 type = cls.super_type();
542 if (type.IsNull() || type.IsObjectType()) {
543 break;
544 }
545 cls = type.type_class();
546 }
547}

◆ Match()

static ArrayPtr dart::Match ( const String pat,
const String str 
)
static

Definition at line 15 of file regexp_test.cc.

15 {
16 Thread* thread = Thread::Current();
17 Zone* zone = thread->zone();
18 const RegExp& regexp =
19 RegExp::Handle(RegExpEngine::CreateRegExp(thread, pat, RegExpFlags()));
20 const Smi& idx = Object::smi_zero();
21 return IRRegExpMacroAssembler::Execute(regexp, str, idx, /*sticky=*/false,
22 zone);
23}

◆ MatchAndNegativeLookaroundInReadDirection()

RegExpNode * dart::MatchAndNegativeLookaroundInReadDirection ( RegExpCompiler compiler,
ZoneGrowableArray< CharacterRange > *  match,
ZoneGrowableArray< CharacterRange > *  lookahead,
RegExpNode on_success,
bool  read_backward,
RegExpFlags  flags 
)

Definition at line 4048 of file regexp.cc.

4054 {
4055 int stack_register = compiler->UnicodeLookaroundStackRegister();
4056 int position_register = compiler->UnicodeLookaroundPositionRegister();
4057 RegExpLookaround::Builder lookaround(false, on_success, stack_register,
4058 position_register);
4059 RegExpNode* negative_match = TextNode::CreateForCharacterRanges(
4060 lookahead, read_backward, lookaround.on_match_success(), flags);
4061 return TextNode::CreateForCharacterRanges(
4062 match, read_backward, lookaround.ForMatch(negative_match), flags);
4063}

◆ MatchesAccessorName()

static bool dart::MatchesAccessorName ( const String name,
const char *  prefix,
intptr_t  prefix_length,
const String accessor_name 
)
static

Definition at line 6231 of file object.cc.

6234 {
6235 intptr_t name_len = name.Length();
6236 intptr_t accessor_name_len = accessor_name.Length();
6237
6238 if (name_len != (accessor_name_len + prefix_length)) {
6239 return false;
6240 }
6241 for (intptr_t i = 0; i < prefix_length; i++) {
6242 if (name.CharAt(i) != prefix[i]) {
6243 return false;
6244 }
6245 }
6246 for (intptr_t i = 0, j = prefix_length; i < accessor_name_len; i++, j++) {
6247 if (name.CharAt(j) != accessor_name.CharAt(i)) {
6248 return false;
6249 }
6250 }
6251 return true;
6252}

◆ MatchesPattern()

bool dart::MatchesPattern ( uword  end,
const int16_t *  pattern,
intptr_t  size 
)

Definition at line 46 of file code_patcher.cc.

46 {
47 // When breaking within generated code in GDB, it may overwrite individual
48 // instructions with trap instructions, which can cause this test to fail.
49 //
50 // Ignoring trap instructions would work well enough within GDB alone, but it
51 // doesn't work in RR, because the check for the trap instruction itself will
52 // cause replay to diverge from the original record.
53 if (FLAG_support_rr) return true;
54
55 uint8_t* bytes = reinterpret_cast<uint8_t*>(end - size);
56 for (intptr_t i = 0; i < size; i++) {
57 int16_t val = pattern[i];
58 if ((val >= 0) && (val != bytes[i])) {
59 return false;
60 }
61 }
62 return true;
63}

◆ MayBeBoxableNumber()

static bool dart::MayBeBoxableNumber ( intptr_t  cid)
static

Definition at line 3534 of file il.cc.

3534 {
3535 return (cid == kDynamicCid) || (cid == kMintCid) || (cid == kDoubleCid);
3536}

◆ MayBeNumber()

static bool dart::MayBeNumber ( CompileType type)
static

Definition at line 3538 of file il.cc.

3538 {
3539 if (type->IsNone()) {
3540 return false;
3541 }
3542 const AbstractType& unwrapped_type =
3543 AbstractType::Handle(type->ToAbstractType()->UnwrapFutureOr());
3544 // Note that type 'Number' is a subtype of itself.
3545 return unwrapped_type.IsTopTypeForSubtyping() ||
3546 unwrapped_type.IsObjectType() || unwrapped_type.IsTypeParameter() ||
3547 unwrapped_type.IsSubtypeOf(Type::Handle(Type::NullableNumber()),
3548 Heap::kOld);
3549}

◆ MergeHexCharacters()

static int32_t dart::MergeHexCharacters ( int32_t  c1,
int32_t  c2 
)
static

Definition at line 23993 of file object.cc.

23993 {
23994 return GetHexValue(c1) << 4 | GetHexValue(c2);
23995}
static int32_t GetHexValue(int32_t c)
Definition object.cc:23982

◆ MergePaths()

static const char * dart::MergePaths ( const char *  base_path,
const char *  ref_path 
)
static

Definition at line 344 of file uri.cc.

344 {
345 Zone* zone = ThreadState::Current()->zone();
346 if (base_path[0] == '\0') {
347 // If the base_path is empty, we prepend '/'.
348 return zone->PrintToString("/%s", ref_path);
349 }
350
351 // We need to find the last '/' in base_path.
352 const char* last_slash = strrchr(base_path, '/');
353 if (last_slash == nullptr) {
354 // There is no slash in the base_path. Return the ref_path unchanged.
355 return ref_path;
356 }
357
358 // We found a '/' in the base_path. Cut off everything after it and
359 // add the ref_path.
360 intptr_t truncated_base_len = last_slash - base_path;
361 intptr_t ref_path_len = strlen(ref_path);
362 intptr_t len = truncated_base_len + ref_path_len + 1; // +1 for '/'
363 char* buffer = zone->Alloc<char>(len + 1); // +1 for '\0'
364
365 // Copy truncated base.
366 strncpy(buffer, base_path, truncated_base_len);
367
368 // Add a slash.
369 buffer[truncated_base_len] = '/';
370
371 // Copy the ref_path.
372 strncpy((buffer + truncated_base_len + 1), ref_path, ref_path_len + 1);
373
374 return buffer;
375}

◆ MicrosecondsToMilliseconds()

constexpr double dart::MicrosecondsToMilliseconds ( int64_t  micros)
constexpr

Definition at line 574 of file globals.h.

574 {
575 return static_cast<double>(micros) / kMicrosecondsPerMillisecond;
576}

◆ MicrosecondsToSeconds()

constexpr double dart::MicrosecondsToSeconds ( int64_t  micros)
constexpr

Definition at line 571 of file globals.h.

571 {
572 return static_cast<double>(micros) / kMicrosecondsPerSecond;
573}
static constexpr int kMicrosecondsPerSecond

◆ MightNeedReHashing()

static DART_FORCE_INLINE bool dart::MightNeedReHashing ( ObjectPtr  object)
static

Definition at line 189 of file object_graph_copy.cc.

189 {
190 const uword tags = TagsFromUntaggedObject(object.untag());
191 const auto cid = UntaggedObject::ClassIdTag::decode(tags);
192 // These use structural hash codes and will therefore always result in the
193 // same hash codes.
194 if (cid == kOneByteStringCid) return false;
195 if (cid == kTwoByteStringCid) return false;
196 if (cid == kMintCid) return false;
197 if (cid == kDoubleCid) return false;
198 if (cid == kBoolCid) return false;
199 if (cid == kSendPortCid) return false;
200 if (cid == kCapabilityCid) return false;
201 if (cid == kNullCid) return false;
202
203 // These are shared and use identity hash codes. If they are used as a key in
204 // a map or a value in a set, they will already have the identity hash code
205 // set.
206 if (cid == kRegExpCid) return false;
207 if (cid == kInt32x4Cid) return false;
208
209 // If the [tags] indicates this is a canonical object we'll share it instead
210 // of copying it. That would suggest we don't have to re-hash maps/sets
211 // containing this object on the receiver side.
212 //
213 // Though the object can be a constant of a user-defined class with a
214 // custom hash code that is misbehaving (e.g one that depends on global field
215 // state, ...). To be on the safe side we'll force re-hashing if such objects
216 // are encountered in maps/sets.
217 //
218 // => We might want to consider changing the implementation to avoid rehashing
219 // in such cases in the future and disambiguate the documentation.
220 return true;
221}
raw_obj untag() -> num_entries()) VARIABLE_COMPRESSED_VISITOR(Array, Smi::Value(raw_obj->untag() ->length())) VARIABLE_COMPRESSED_VISITOR(TypedData, TypedData::ElementSizeInBytes(raw_obj->GetClassId()) *Smi::Value(raw_obj->untag() ->length())) VARIABLE_COMPRESSED_VISITOR(Record, RecordShape(raw_obj->untag() ->shape()).num_fields()) VARIABLE_NULL_VISITOR(CompressedStackMaps, CompressedStackMaps::PayloadSizeOf(raw_obj)) VARIABLE_NULL_VISITOR(OneByteString, Smi::Value(raw_obj->untag() ->length())) VARIABLE_NULL_VISITOR(TwoByteString, Smi::Value(raw_obj->untag() ->length())) intptr_t UntaggedField::VisitFieldPointers(FieldPtr raw_obj, ObjectPointerVisitor *visitor)

◆ MinInt32()

DART_EXPORT int64_t dart::MinInt32 ( )

Definition at line 69 of file ffi_test_functions_vmspecific.cc.

69 {
70 Dart_ExecuteInternalCommand("gc-on-nth-allocation",
71 reinterpret_cast<void*>(1));
72 return 0x80000000;
73}

◆ MinInt64()

DART_EXPORT int64_t dart::MinInt64 ( )

Definition at line 63 of file ffi_test_functions_vmspecific.cc.

63 {
64 Dart_ExecuteInternalCommand("gc-on-nth-allocation",
65 reinterpret_cast<void*>(1));
66 return 0x8000000000000000;
67}

◆ MinPosition()

static intptr_t dart::MinPosition ( intptr_t  a,
intptr_t  b 
)
static

Definition at line 38 of file linearscan.cc.

38 {
39 return (a < b) ? a : b;
40}

◆ MournFinalizerEntry()

template<typename GCVisitorType >
void dart::MournFinalizerEntry ( GCVisitorType *  visitor,
FinalizerEntryPtr  current_entry 
)

Definition at line 162 of file gc_shared.h.

163 {
164 TRACE_FINALIZER("Processing Entry %p", current_entry->untag());
165
166 const Heap::Space before_gc_space = SpaceForExternal(current_entry);
167 const bool value_collected_this_gc =
168 GCVisitorType::ForwardOrSetNullIfCollected(
169 current_entry, &current_entry->untag()->value_);
170 if (!value_collected_this_gc && before_gc_space == Heap::kNew) {
171 const Heap::Space after_gc_space = SpaceForExternal(current_entry);
172 if (after_gc_space == Heap::kOld) {
173 const intptr_t external_size = current_entry->untag()->external_size_;
174 TRACE_FINALIZER("Promoting external size %" Pd
175 " bytes from new to old space",
176 external_size);
177 visitor->isolate_group()->heap()->PromotedExternal(external_size);
178 }
179 }
180 GCVisitorType::ForwardOrSetNullIfCollected(current_entry,
181 &current_entry->untag()->detach_);
182 GCVisitorType::ForwardOrSetNullIfCollected(
183 current_entry, &current_entry->untag()->finalizer_);
184
185 ObjectPtr token_object = current_entry->untag()->token();
186 // See sdk/lib/_internal/vm/lib/internal_patch.dart FinalizerBase.detach.
187 const bool is_detached = token_object == current_entry;
188
189 if (!value_collected_this_gc) return;
190 if (is_detached) return;
191
192 FinalizerBasePtr finalizer = current_entry->untag()->finalizer();
193
194 if (finalizer.IsRawNull()) {
195 TRACE_FINALIZER("Value collected entry %p finalizer null",
196 current_entry->untag());
197
198 // Do nothing, the finalizer has been GCed.
199 return;
200 }
201
202 TRACE_FINALIZER("Value collected entry %p finalizer %p",
203 current_entry->untag(), finalizer->untag());
204
205 FinalizerPtr finalizer_dart = static_cast<FinalizerPtr>(finalizer);
206 // Move entry to entries collected and current head of that list as
207 // the next element. Using a atomic exchange satisfies concurrency
208 // between the parallel GC tasks.
209 // We rely on the fact that the mutator thread is not running to avoid
210 // races between GC and mutator modifying Finalizer.entries_collected.
211 //
212 // We only run in serial marker or in the finalize step in the marker,
213 // both are in safepoint.
214 // The main scavenger worker is at safepoint, the other scavenger
215 // workers are not, but they bypass safepoint because the main
216 // worker is at a safepoint already.
217 ASSERT(Thread::Current()->OwnsGCSafepoint() ||
218 Thread::Current()->BypassSafepoints());
219
220 if (finalizer.IsNativeFinalizer()) {
221 NativeFinalizerPtr native_finalizer =
222 static_cast<NativeFinalizerPtr>(finalizer);
223
224 // Immediately call native callback.
225 RunNativeFinalizerCallback(native_finalizer, current_entry, before_gc_space,
226 visitor);
227
228 // Fall-through sending a message to clear the entries and remove
229 // from detachments.
230 }
231
232 FinalizerEntryPtr previous_head =
233 finalizer_dart->untag()->exchange_entries_collected(current_entry);
234 current_entry->untag()->set_next(previous_head);
235 const bool first_entry = previous_head.IsRawNull();
236
237 // If we're in the marker, we need to ensure that we release the store
238 // buffer afterwards.
239 // If we're in the scavenger and have the finalizer in old space and
240 // a new space entry, we don't need to release the store buffer.
241 if (!first_entry && previous_head->IsNewObject() &&
242 current_entry->IsOldObject()) {
243 TRACE_FINALIZER("Entry %p (old) next is %p (new)", current_entry->untag(),
244 previous_head->untag());
245 // We must release the thread's store buffer block.
246 }
247
248 // Schedule calling Dart finalizer.
249 if (first_entry) {
250 Isolate* isolate = finalizer->untag()->isolate_;
251 if (isolate == nullptr) {
252 TRACE_FINALIZER("Not scheduling finalizer %p callback on isolate null",
253 finalizer->untag());
254 } else {
255 TRACE_FINALIZER("Scheduling finalizer %p callback on isolate %p",
256 finalizer->untag(), isolate);
257
258 PersistentHandle* handle =
259 isolate->group()->api_state()->AllocatePersistentHandle();
260 handle->set_ptr(finalizer);
261 MessageHandler* message_handler = isolate->message_handler();
262 message_handler->PostMessage(
263 Message::New(handle, Message::kNormalPriority),
264 /*before_events*/ false);
265 }
266 }
267}
#define TRACE_FINALIZER(format,...)
Definition gc_shared.h:96
void RunNativeFinalizerCallback(NativeFinalizerPtr raw_finalizer, FinalizerEntryPtr raw_entry, Heap::Space before_gc_space, GCVisitorType *visitor)
Definition gc_shared.h:107
std::function< void(const T &message, const MessageReply< T > &reply)> MessageHandler

◆ MoveRanges()

static void dart::MoveRanges ( ZoneGrowableArray< CharacterRange > *  list,
intptr_t  from,
intptr_t  to,
intptr_t  count 
)
static

Definition at line 4795 of file regexp.cc.

4798 {
4799 // Ranges are potentially overlapping.
4800 if (from < to) {
4801 for (intptr_t i = count - 1; i >= 0; i--) {
4802 (*list)[to + i] = list->At(from + i);
4803 }
4804 } else {
4805 for (intptr_t i = 0; i < count; i++) {
4806 (*list)[to + i] = list->At(from + i);
4807 }
4808 }
4809}

◆ Multiply64Hash()

uint32_t dart::Multiply64Hash ( int64_t  ivalue)

Definition at line 276 of file integers.cc.

276 {
277 const uint64_t magic_constant = /*0x1b873593cc9e*/ 0x2d51;
278 uint64_t value = static_cast<uint64_t>(ivalue);
279#if defined(ARCH_IS_64_BIT)
280#ifdef _MSC_VER
281 __int64 hi = __umulh(value, magic_constant);
282 uint64_t lo = value * magic_constant;
283 uint64_t hash = lo ^ hi;
284#else
285 const __int128 res = static_cast<__int128>(value) * magic_constant;
286 uint64_t hash = res ^ static_cast<int64_t>(res >> 64);
287#endif
288 hash = hash ^ (hash >> 32);
289#else
290 uint64_t prod_lo64 = value * magic_constant;
291
292 uint64_t value_lo32 = value & 0xffffffff;
293 uint64_t value_hi32 = value >> 32;
294 uint64_t carry = (((value_hi32 * magic_constant) & 0xffffffff) +
295 ((value_lo32 * magic_constant) >> 32)) >>
296 32;
297 uint64_t prod_hi64 = ((value_hi32 * magic_constant) >> 32) + carry;
298 uint64_t hash = prod_hi64 ^ prod_lo64;
299 hash = hash ^ (hash >> 32);
300#endif
301 return hash & 0x3fffffff;
302}

◆ MyCallback1()

uint8_t dart::MyCallback1 ( uint8_t  a)

Definition at line 706 of file ffi_test_functions_vmspecific.cc.

706 {
707 const char* methodname = "myCallback1";
708 size_t request_length = sizeof(uint8_t) * 1;
709 void* request_buffer = malloc(request_length); // FreeFinalizer.
710 reinterpret_cast<uint8_t*>(request_buffer)[0] = a; // Populate buffer.
711 void* response_buffer = nullptr;
712 size_t response_length = 0;
713
714 PendingCall pending_call(&response_buffer, &response_length);
715
716 Dart_CObject c_send_port;
717 c_send_port.type = Dart_CObject_kSendPort;
718 c_send_port.value.as_send_port.id = pending_call.port();
720
721 Dart_CObject c_pending_call;
722 c_pending_call.type = Dart_CObject_kInt64;
723 c_pending_call.value.as_int64 = reinterpret_cast<int64_t>(&pending_call);
724
725 Dart_CObject c_method_name;
726 c_method_name.type = Dart_CObject_kString;
727 c_method_name.value.as_string = const_cast<char*>(methodname);
728
729 Dart_CObject c_request_data;
730 c_request_data.type = Dart_CObject_kExternalTypedData;
732 c_request_data.value.as_external_typed_data.length = request_length;
733 c_request_data.value.as_external_typed_data.data =
734 static_cast<uint8_t*>(request_buffer);
735 c_request_data.value.as_external_typed_data.peer = request_buffer;
737
738 Dart_CObject* c_request_arr[] = {&c_send_port, &c_pending_call,
739 &c_method_name, &c_request_data};
740 Dart_CObject c_request;
741 c_request.type = Dart_CObject_kArray;
742 c_request.value.as_array.values = c_request_arr;
743 c_request.value.as_array.length =
744 sizeof(c_request_arr) / sizeof(c_request_arr[0]);
745
746 printf("C : Dart_PostCObject_(request: %" Px ", call: %" Px ").\n",
747 reinterpret_cast<intptr_t>(&c_request),
748 reinterpret_cast<intptr_t>(&c_pending_call));
749 pending_call.PostAndWait(send_port_, &c_request);
750 printf("C : Received result.\n");
751
752 const intptr_t result = reinterpret_cast<uint8_t*>(response_buffer)[0];
753 free(response_buffer);
754
755 return result;
756}
@ Dart_CObject_kSendPort
@ Dart_CObject_kExternalTypedData
DART_EXPORT void FreeFinalizer(void *, void *value)
struct _Dart_CObject::@86::@87 as_send_port
Dart_HandleFinalizer callback
struct _Dart_CObject::@86::@91 as_external_typed_data
Dart_Port origin_id

◆ MyCallback2()

void dart::MyCallback2 ( uint8_t  a)

Definition at line 761 of file ffi_test_functions_vmspecific.cc.

761 {
762 const char* methodname = "myCallback2";
763 void* request_buffer = malloc(sizeof(uint8_t) * 1); // FreeFinalizer.
764 reinterpret_cast<uint8_t*>(request_buffer)[0] = a; // Populate buffer.
765 const size_t request_length = sizeof(uint8_t) * 1;
766
767 Dart_CObject c_send_port;
768 c_send_port.type = Dart_CObject_kNull;
769
770 Dart_CObject c_pending_call;
771 c_pending_call.type = Dart_CObject_kNull;
772
773 Dart_CObject c_method_name;
774 c_method_name.type = Dart_CObject_kString;
775 c_method_name.value.as_string = const_cast<char*>(methodname);
776
777 Dart_CObject c_request_data;
778 c_request_data.type = Dart_CObject_kExternalTypedData;
780 c_request_data.value.as_external_typed_data.length = request_length;
781 c_request_data.value.as_external_typed_data.data =
782 static_cast<uint8_t*>(request_buffer);
783 c_request_data.value.as_external_typed_data.peer = request_buffer;
785
786 Dart_CObject* c_request_arr[] = {&c_send_port, &c_pending_call,
787 &c_method_name, &c_request_data};
788 Dart_CObject c_request;
789 c_request.type = Dart_CObject_kArray;
790 c_request.value.as_array.values = c_request_arr;
791 c_request.value.as_array.length =
792 sizeof(c_request_arr) / sizeof(c_request_arr[0]);
793
794 printf("C : Dart_PostCObject_(request: %" Px ", call: %" Px ").\n",
795 reinterpret_cast<intptr_t>(&c_request),
796 reinterpret_cast<intptr_t>(&c_pending_call));
797 Dart_PostCObject_DL(send_port_, &c_request);
798}

◆ MyCallbackBlocking()

intptr_t dart::MyCallbackBlocking ( intptr_t  a)

Definition at line 476 of file ffi_test_functions_vmspecific.cc.

476 {
477 std::mutex mutex;
478 std::unique_lock<std::mutex> lock(mutex);
479 intptr_t result;
480 auto callback = my_callback_blocking_fp_; // Define storage duration.
481 std::condition_variable cv;
482 bool notified = false;
483 const Work work = [a, &result, callback, &cv, &notified]() {
484 result = callback(a);
485 printf("C Da: Notify result ready.\n");
486 notified = true;
487 cv.notify_one();
488 };
489 const Work* work_ptr = new Work(work); // Copy to heap.
490 NotifyDart(my_callback_blocking_send_port_, work_ptr);
491 printf("C : Waiting for result.\n");
492 while (!notified) {
493 cv.wait(lock);
494 }
495 printf("C : Received result.\n");
496 return result;
497}
intptr_t(* my_callback_blocking_fp_)(intptr_t)

◆ MyCallbackNonBlocking()

void dart::MyCallbackNonBlocking ( intptr_t  a)

Definition at line 502 of file ffi_test_functions_vmspecific.cc.

502 {
503 auto callback = my_callback_non_blocking_fp_; // Define storage duration.
504 const Work work = [a, callback]() { callback(a); };
505 // Copy to heap to make it outlive the function scope.
506 const Work* work_ptr = new Work(work);
507 NotifyDart(my_callback_non_blocking_send_port_, work_ptr);
508}
void(* my_callback_non_blocking_fp_)(intptr_t)

◆ MyMessageNotifyCallback()

static void dart::MyMessageNotifyCallback ( Dart_Isolate  dest_isolate)
static

Definition at line 4855 of file dart_api_impl_test.cc.

4855{}

◆ MyNativeClosureResolver()

static Dart_NativeFunction dart::MyNativeClosureResolver ( Dart_Handle  name,
int  arg_count,
bool *  auto_setup_scope 
)
static

Definition at line 8715 of file dart_api_impl_test.cc.

8717 {
8719 intptr_t i = Dart_GetNativeArgumentCount(args);
8720 EXPECT_EQ(4, i);
8725 args, Dart_NewInteger(GetValue(arg1) + GetValue(arg2) + GetValue(arg3)));
8727}
8728
8729static Dart_NativeFunction MyNativeClosureResolver(Dart_Handle name,
8730 int arg_count,
8731 bool* auto_setup_scope) {
8732 ASSERT(auto_setup_scope != nullptr);
8733 *auto_setup_scope = false;
8734 TransitionNativeToVM transition(Thread::Current());
8735 const Object& obj = Object::Handle(Api::UnwrapHandle(name));
8736 if (!obj.IsString()) {
8737 return nullptr;
8738 }
8739 const char* function_name = obj.ToCString();
8740 const char* kNativeFoo1 = "NativeFoo1";
8741 const char* kNativeFoo2 = "NativeFoo2";
8742 const char* kNativeFoo3 = "NativeFoo3";
static int64_t GetValue(Dart_Handle arg)

◆ MyNativeFunction1()

static void dart::MyNativeFunction1 ( Dart_NativeArguments  args)
static

Definition at line 7657 of file dart_api_impl_test.cc.

7660 {

◆ MyNativeFunction2()

static void dart::MyNativeFunction2 ( Dart_NativeArguments  args)
static

Definition at line 7663 of file dart_api_impl_test.cc.

7666 {

◆ MyNativeResolver1()

static Dart_NativeFunction dart::MyNativeResolver1 ( Dart_Handle  name,
int  arg_count,
bool *  auto_setup_scope 
)
static

Definition at line 7669 of file dart_api_impl_test.cc.

7674 {
7675 ASSERT(auto_setup_scope != nullptr);

◆ MyNativeResolver2()

static Dart_NativeFunction dart::MyNativeResolver2 ( Dart_Handle  name,
int  arg_count,
bool *  auto_setup_scope 
)
static

Definition at line 7677 of file dart_api_impl_test.cc.

7682 {
7683 ASSERT(auto_setup_scope != nullptr);

◆ MyStaticNativeClosureResolver()

static Dart_NativeFunction dart::MyStaticNativeClosureResolver ( Dart_Handle  name,
int  arg_count,
bool *  auto_setup_scope 
)
static

Definition at line 8806 of file dart_api_impl_test.cc.

◆ NarrowBinaryInt64Op()

static void dart::NarrowBinaryInt64Op ( BinaryInt64OpInstr int64_op)
static

Definition at line 1415 of file range_analysis.cc.

1415 {
1416 if (RangeUtils::Fits(int64_op->range(), RangeBoundary::kRangeBoundaryInt32) &&
1417 RangeUtils::Fits(int64_op->left()->definition()->range(),
1418 RangeBoundary::kRangeBoundaryInt32) &&
1419 RangeUtils::Fits(int64_op->right()->definition()->range(),
1420 RangeBoundary::kRangeBoundaryInt32) &&
1421 BinaryInt32OpInstr::IsSupported(int64_op->op_kind(), int64_op->left(),
1422 int64_op->right())) {
1423 BinaryInt32OpInstr* int32_op = new BinaryInt32OpInstr(
1424 int64_op->op_kind(), int64_op->left()->CopyWithType(),
1425 int64_op->right()->CopyWithType(), int64_op->DeoptimizationTarget());
1426 int32_op->set_range(*int64_op->range());
1427 int32_op->set_can_overflow(false);
1428 int64_op->ReplaceWith(int32_op, nullptr);
1429 }
1430}
void set_can_overflow(bool overflow)
Definition il.h:9353
Value * right() const
Definition il.h:9350
Value * left() const
Definition il.h:9349
virtual intptr_t DeoptimizationTarget() const
Definition il.h:9376
Value * CopyWithType(Zone *zone)
Definition il.h:138

◆ NarrowMax()

static RangeBoundary dart::NarrowMax ( const Range range,
const Range new_range,
RangeBoundary::RangeSize  size 
)
static

Definition at line 412 of file range_analysis.cc.

414 {
415 const RangeBoundary max = Range::ConstantMax(range, size);
416 const RangeBoundary new_max = Range::ConstantMax(new_range, size);
417 if (max.ConstantValue() < new_max.ConstantValue()) return range->max();
418
419 // TODO(vegorov): consider using positive infinity to indicate widened bound.
420 return range->max().IsMaximumOrAbove(size) ? new_range->max() : range->max();
421}
bool IsMaximumOrAbove(RangeSize size) const
int64_t ConstantValue() const

◆ NarrowMin()

static RangeBoundary dart::NarrowMin ( const Range range,
const Range new_range,
RangeBoundary::RangeSize  size 
)
static

Definition at line 395 of file range_analysis.cc.

397 {
398 const RangeBoundary min = Range::ConstantMin(range, size);
399 const RangeBoundary new_min = Range::ConstantMin(new_range, size);
400 if (min.ConstantValue() > new_min.ConstantValue()) return range->min();
401
402 // TODO(vegorov): consider using negative infinity to indicate widened bound.
403 return range->min().IsMinimumOrBelow(size) ? new_range->min() : range->min();
404}
bool IsMinimumOrBelow(RangeSize size) const

◆ NarrowShiftInt64Op()

static void dart::NarrowShiftInt64Op ( ShiftIntegerOpInstr int64_op)
static

Definition at line 1432 of file range_analysis.cc.

1432 {
1433 if (RangeUtils::Fits(int64_op->range(), RangeBoundary::kRangeBoundaryInt32) &&
1434 RangeUtils::Fits(int64_op->left()->definition()->range(),
1435 RangeBoundary::kRangeBoundaryInt32) &&
1436 RangeUtils::Fits(int64_op->right()->definition()->range(),
1437 RangeBoundary::kRangeBoundaryInt32) &&
1438 BinaryInt32OpInstr::IsSupported(int64_op->op_kind(), int64_op->left(),
1439 int64_op->right())) {
1440 BinaryInt32OpInstr* int32_op = new BinaryInt32OpInstr(
1441 int64_op->op_kind(), int64_op->left()->CopyWithType(),
1442 int64_op->right()->CopyWithType(), int64_op->DeoptimizationTarget());
1443 int32_op->set_range(*int64_op->range());
1444 int32_op->set_can_overflow(false);
1445 int64_op->ReplaceWith(int32_op, nullptr);
1446 }
1447}

◆ native_args_lookup()

static Dart_NativeFunction dart::native_args_lookup ( Dart_Handle  name,
int  argument_count,
bool *  auto_scope_setup 
)
static

Definition at line 7192 of file dart_api_impl_test.cc.

7197 {
7198 TransitionNativeToVM transition(Thread::Current());
7199 const Object& obj = Object::Handle(Api::UnwrapHandle(name));
7200 if (!obj.IsString()) {
7201 return nullptr;
7202 }
7203 ASSERT(auto_scope_setup != nullptr);
7204 *auto_scope_setup = true;
7205 const char* function_name = obj.ToCString();
7206 ASSERT(function_name != nullptr);
7207 if (strcmp(function_name, "NativeArgument_Create") == 0) {
7208 return NativeArgumentCreate;
7209 } else if (strcmp(function_name, "NativeArgument_Access") == 0) {
7210 return NativeArgumentAccess;
static void NativeArgumentAccess(Dart_NativeArguments args)

◆ native_echo()

static void dart::native_echo ( Dart_NativeArguments  args)
static

Definition at line 241 of file custom_isolate_test.cc.

241 {
244 Dart_Handle toString = Dart_ToString(arg);
245 EXPECT_VALID(toString);
246 const char* c_str = nullptr;
247 EXPECT_VALID(Dart_StringToCString(toString, &c_str));
248 if (saved_echo != nullptr) {
249 free(saved_echo);
250 }
251 saved_echo = Utils::StrDup(c_str);
252 OS::PrintErr("-- (isolate=%p) %s\n", Dart_CurrentIsolate(), c_str);
254}
DART_EXPORT Dart_Handle Dart_ToString(Dart_Handle object)

◆ native_field_lookup()

static Dart_NativeFunction dart::native_field_lookup ( Dart_Handle  name,
int  argument_count,
bool *  auto_setup_scope 
)
static

Definition at line 5444 of file dart_api_impl_test.cc.

5446 {
5447 ASSERT(auto_setup_scope != nullptr);
5448 *auto_setup_scope = false;
5449 return NativeFieldLookup;
5450}
void NativeFieldLookup(Dart_NativeArguments args)

◆ native_lookup() [1/3]

static Dart_NativeFunction dart::native_lookup ( Dart_Handle  name,
int  argument_count,
bool *  auto_setup_scope 
)
static

Definition at line 7034 of file dart_api_impl_test.cc.

7036 {
7037 ASSERT(auto_setup_scope != nullptr);
7038 *auto_setup_scope = true;
7039 return ExceptionNative;
7040}
void ExceptionNative(Dart_NativeArguments args)

◆ native_lookup() [2/3]

static Dart_NativeFunction dart::native_lookup ( Dart_Handle  name,
int  argument_count,
bool *  auto_setup_scope 
)
static

Definition at line 66 of file exceptions_test.cc.

68 {
69 ASSERT(auto_setup_scope != nullptr);
70 *auto_setup_scope = true;
71 TransitionNativeToVM transition(Thread::Current());
72 const Object& obj = Object::Handle(Api::UnwrapHandle(name));
73 ASSERT(obj.IsString());
74 const char* function_name = obj.ToCString();
75 ASSERT(function_name != nullptr);
76 int num_entries = sizeof(BuiltinEntries) / sizeof(struct NativeEntries);
77 for (int i = 0; i < num_entries; i++) {
78 struct NativeEntries* entry = &(BuiltinEntries[i]);
79 if ((strcmp(function_name, entry->name_) == 0) &&
80 (argument_count == entry->argument_count_)) {
81 return reinterpret_cast<Dart_NativeFunction>(entry->function_);
82 }
83 }
84 return nullptr;
85}
static struct dart::NativeEntries BuiltinEntries[]

◆ native_lookup() [3/3]

static Dart_NativeFunction dart::native_lookup ( Dart_Handle  name,
int  argument_count,
bool *  auto_setup_scope 
)
static

Definition at line 139 of file stack_frame_test.cc.

141 {
142 ASSERT(auto_setup_scope != nullptr);
143 *auto_setup_scope = false;
144 TransitionNativeToVM transition(Thread::Current());
145 const Object& obj = Object::Handle(Api::UnwrapHandle(name));
146 ASSERT(obj.IsString());
147 const char* function_name = obj.ToCString();
148 ASSERT(function_name != nullptr);
149 int num_entries = sizeof(BuiltinEntries) / sizeof(struct NativeEntries);
150 for (int i = 0; i < num_entries; i++) {
151 struct NativeEntries* entry = &(BuiltinEntries[i]);
152 if ((strcmp(function_name, entry->name_) == 0) &&
153 (entry->argument_count_ == argument_count)) {
154 return reinterpret_cast<Dart_NativeFunction>(entry->function_);
155 }
156 }
157 return nullptr;
158}

◆ native_resolver()

static Dart_NativeFunction dart::native_resolver ( Dart_Handle  name,
int  argument_count,
bool *  auto_setup_scope 
)
static

Definition at line 34 of file code_descriptors_test.cc.

36 {
37 ASSERT(auto_setup_scope);
38 *auto_setup_scope = false;
39 return NativeFunc;
40}
static void NativeFunc(Dart_NativeArguments args)

◆ NativeArgumentAccess()

static void dart::NativeArgumentAccess ( Dart_NativeArguments  args)
static

Definition at line 7089 of file dart_api_impl_test.cc.

7092 {
7093 const int kNumNativeFields = 2;
7094
7095 // Test different argument types with a valid descriptor set.
7096 {
7097 const char* cstr = nullptr;
7098 intptr_t native_fields1[kNumNativeFields];
7099 intptr_t native_fields2[kNumNativeFields];
7100 const Dart_NativeArgument_Descriptor arg_descriptors[9] = {
7110 };
7111 Dart_NativeArgument_Value arg_values[9];
7112 arg_values[0].as_native_fields.num_fields = kNumNativeFields;
7113 arg_values[0].as_native_fields.values = native_fields1;
7114 arg_values[7].as_native_fields.num_fields = kNumNativeFields;
7115 arg_values[7].as_native_fields.values = native_fields2;
7117 Dart_GetNativeArguments(args, 9, arg_descriptors, arg_values);
7119
7120 EXPECT(arg_values[0].as_native_fields.values[0] == 30);
7121 EXPECT(arg_values[0].as_native_fields.values[1] == 40);
7122
7123 EXPECT(arg_values[1].as_int32 == 77);
7124
7125 // When wrapped-around, this value should not fit into int32, because this
7126 // unit test verifies that getting it as int32 produces error.
7127 EXPECT(arg_values[2].as_uint64 == 0x8000000000000000LL);
7128
7129 EXPECT(arg_values[3].as_bool == true);
7130
7131 EXPECT(arg_values[4].as_double == 3.14);
7132
7133 EXPECT_VALID(arg_values[5].as_string.dart_str);
7134 EXPECT(Dart_IsString(arg_values[5].as_string.dart_str));
7135 EXPECT_VALID(Dart_StringToCString(arg_values[5].as_string.dart_str, &cstr));
7136 EXPECT_STREQ("abcdefg", cstr);
7137 EXPECT(arg_values[5].as_string.peer == nullptr);
7138
7139 EXPECT_VALID(arg_values[6].as_string.dart_str);
7140 EXPECT(Dart_IsString(arg_values[6].as_string.dart_str));
7141 EXPECT_VALID(Dart_StringToCString(arg_values[6].as_string.dart_str, &cstr));
7142 EXPECT_STREQ("string", cstr);
7143 EXPECT(arg_values[6].as_string.peer == nullptr);
7144
7145 EXPECT(arg_values[7].as_native_fields.values[0] == 60);
7146 EXPECT(arg_values[7].as_native_fields.values[1] == 80);
7147
7148 EXPECT_VALID(arg_values[8].as_instance);
7149 EXPECT(Dart_IsInstance(arg_values[8].as_instance));
7150 int field_count = 0;
7151 EXPECT_VALID(Dart_GetNativeInstanceFieldCount(arg_values[8].as_instance,
7152 &field_count));
7153 EXPECT(field_count == 2);
7154 }
7155
7156 // Test with an invalid descriptor set (invalid type).
7157 {
7158 const Dart_NativeArgument_Descriptor arg_descriptors[8] = {
7167 };
7168 Dart_NativeArgument_Value arg_values[8];
7170 Dart_GetNativeArguments(args, 8, arg_descriptors, arg_values);
7172 }
7173
7174 // Test with an invalid range error.
7175 {
7176 const Dart_NativeArgument_Descriptor arg_descriptors[8] = {
7185 };
7186 Dart_NativeArgument_Value arg_values[8];
7188 Dart_GetNativeArguments(args, 8, arg_descriptors, arg_values);
7190 }
DART_EXPORT bool Dart_IsInstance(Dart_Handle object)
DART_EXPORT Dart_Handle Dart_GetNativeInstanceFieldCount(Dart_Handle obj, int *count)
DART_EXPORT Dart_Handle Dart_GetNativeArguments(Dart_NativeArguments args, int num_arguments, const Dart_NativeArgument_Descriptor *arg_descriptors, Dart_NativeArgument_Value *arg_values)

◆ NativeArgumentCounter()

static void dart::NativeArgumentCounter ( Dart_NativeArguments  args)
static

Definition at line 7254 of file dart_api_impl_test.cc.

◆ NativeArgumentCreate()

static void dart::NativeArgumentCreate ( Dart_NativeArguments  args)
static

Definition at line 7069 of file dart_api_impl_test.cc.

7072 {
7073 Dart_Handle lib = Dart_LookupLibrary(NewString(TestCase::url()));
7075 Dart_GetNonNullableType(lib, NewString("MyObject"), 0, nullptr);
7077
7078 // Allocate without a constructor.
7079 const int num_native_fields = 2;
7080 const intptr_t native_fields[] = {kNativeArgumentNativeField1Value,
7082 // Allocate and Setup native fields.
7083 Dart_Handle obj =
7084 Dart_AllocateWithNativeFields(type, num_native_fields, native_fields);
7085 EXPECT_VALID(obj);
7086
7087 kNativeArgumentNativeField1Value *= 2;
DART_EXPORT Dart_Handle Dart_AllocateWithNativeFields(Dart_Handle type, intptr_t num_native_fields, const intptr_t *native_fields)
static intptr_t kNativeArgumentNativeField1Value
static intptr_t kNativeArgumentNativeField2Value

◆ NativeFieldLookup()

void dart::NativeFieldLookup ( Dart_NativeArguments  args)

Definition at line 5440 of file dart_api_impl_test.cc.

5440 {
5441 UNREACHABLE();
5442}

◆ NativeFinalizer_TwoEntriesCrossGen() [1/2]

static void dart::NativeFinalizer_TwoEntriesCrossGen ( Thread thread,
Heap::Space spaces,
bool  collect_new_space,
bool  evacuate_new_space_and_collect_old_space,
bool  clear_value_1,
bool  clear_value_2,
bool  clear_detach_1,
bool  clear_detach_2 
)
static

Definition at line 4962 of file object_test.cc.

4970 {
4971#ifdef DEBUG
4972 SetFlagScope<bool> sfs(&FLAG_trace_finalizers, true);
4973#endif
4974
4975 intptr_t token1_memory = 0;
4976 intptr_t token2_memory = 0;
4977
4978 MessageHandler* handler = thread->isolate()->message_handler();
4979 // We're reusing the isolate in a loop, so there are messages from previous
4980 // runs of this test.
4981 intptr_t queue_length_start = 0;
4982 {
4984 queue_length_start = aq.queue()->Length();
4985 }
4986
4987 const auto& callback = Pointer::Handle(Pointer::New(
4988 reinterpret_cast<uword>(&NativeFinalizer_TwoEntriesCrossGen_Finalizer),
4989 spaces[3]));
4990
4991 const auto& finalizer =
4992 NativeFinalizer::Handle(NativeFinalizer::New(spaces[0]));
4993 finalizer.set_callback(callback);
4994 finalizer.set_isolate(thread->isolate());
4995
4996 const auto& isolate_finalizers =
4997 GrowableObjectArray::Handle(GrowableObjectArray::New());
4998 const auto& weak1 = WeakReference::Handle(WeakReference::New());
4999 weak1.set_target(finalizer);
5000 isolate_finalizers.Add(weak1);
5001 thread->isolate()->set_finalizers(isolate_finalizers);
5002
5003 const auto& all_entries = Set::Handle(Set::NewDefault());
5004 finalizer.set_all_entries(all_entries);
5005 const auto& all_entries_data = Array::Handle(all_entries.data());
5006 THR_Print("entry1 space: %s\n", spaces[1] == Heap::kNew ? "new" : "old");
5007 const auto& entry1 =
5008 FinalizerEntry::Handle(FinalizerEntry::New(finalizer, spaces[1]));
5009 all_entries_data.SetAt(0, entry1);
5010 THR_Print("entry2 space: %s\n", spaces[2] == Heap::kNew ? "new" : "old");
5011 const auto& entry2 =
5012 FinalizerEntry::Handle(FinalizerEntry::New(finalizer, spaces[2]));
5013 all_entries_data.SetAt(1, entry2);
5014 all_entries.set_used_data(2); // Don't bother setting the index.
5015
5016 const intptr_t external_size1 = 1024;
5017 const intptr_t external_size2 = 2048;
5018 entry1.set_external_size(external_size1);
5019 entry2.set_external_size(external_size2);
5020 IsolateGroup::Current()->heap()->AllocatedExternal(external_size1, spaces[5]);
5021 IsolateGroup::Current()->heap()->AllocatedExternal(external_size2, spaces[7]);
5022
5023 auto& value1 = String::Handle();
5024 auto& detach1 = String::Handle();
5025 const auto& token1 = Pointer::Handle(
5026 Pointer::New(reinterpret_cast<uword>(&token1_memory), spaces[3]));
5027 entry1.set_token(token1);
5028
5029 auto& value2 = String::Handle();
5030 auto& detach2 = String::Handle();
5031 const auto& token2 = Pointer::Handle(
5032 Pointer::New(reinterpret_cast<uword>(&token2_memory), spaces[4]));
5033 entry2.set_token(token2);
5034 entry2.set_detach(detach2);
5035
5036 {
5037 HANDLESCOPE(thread);
5038 auto& object = String::Handle();
5039
5040 THR_Print("value1 space: %s\n", spaces[5] == Heap::kNew ? "new" : "old");
5041 object ^= OneByteString::New("value1", spaces[5]);
5042 entry1.set_value(object);
5043 if (!clear_value_1) {
5044 value1 = object.ptr();
5045 }
5046
5047 object ^= OneByteString::New("detach", spaces[6]);
5048 entry1.set_detach(object);
5049 if (!clear_detach_1) {
5050 detach1 = object.ptr();
5051 }
5052
5053 THR_Print("value2 space: %s\n", spaces[7] == Heap::kNew ? "new" : "old");
5054 object ^= OneByteString::New("value2", spaces[7]);
5055 entry2.set_value(object);
5056 if (!clear_value_2) {
5057 value2 = object.ptr();
5058 }
5059
5060 object ^= OneByteString::New("detach", spaces[8]);
5061 entry2.set_detach(object);
5062 if (!clear_detach_2) {
5063 detach2 = object.ptr();
5064 }
5065 }
5066
5067 THR_Print("CollectOldSpace\n");
5068 GCTestHelper::CollectOldSpace();
5069 if (collect_new_space) {
5070 THR_Print("CollectNewSpace\n");
5071 GCTestHelper::CollectNewSpace();
5072 }
5073 if (evacuate_new_space_and_collect_old_space) {
5074 THR_Print("CollectAllGarbage\n");
5075 GCTestHelper::CollectAllGarbage();
5076 }
5077
5078 EXPECT((entry1.value() == Object::null()) ^ !clear_value_1);
5079 EXPECT((entry2.value() == Object::null()) ^ !clear_value_2);
5080 EXPECT((entry1.detach() == Object::null()) ^ !clear_detach_1);
5081 EXPECT((entry2.detach() == Object::null()) ^ !clear_detach_2);
5082 EXPECT_NE(Object::null(), entry1.token());
5083 EXPECT_NE(Object::null(), entry2.token());
5084
5085 const intptr_t expect_num_cleared =
5086 (clear_value_1 ? 1 : 0) + (clear_value_2 ? 1 : 0);
5087 EXPECT_EQ(expect_num_cleared,
5088 NumEntries(FinalizerEntry::Handle(finalizer.entries_collected())));
5089
5090 EXPECT_EQ(clear_value_1 ? 1 : 0, token1_memory);
5091 EXPECT_EQ(clear_value_2 ? 1 : 0, token2_memory);
5092
5093 const intptr_t expect_num_messages = expect_num_cleared == 0 ? 0 : 1;
5094 {
5095 // Acquire ownership of message handler queues.
5096 MessageHandler::AcquiredQueues aq(handler);
5097 EXPECT_EQ(expect_num_messages + queue_length_start, aq.queue()->Length());
5098 }
5099
5100 // Simulate detachments.
5101 entry1.set_token(entry1);
5102 entry2.set_token(entry2);
5103 all_entries_data.SetAt(0, Object::Handle(Object::null()));
5104 all_entries_data.SetAt(1, Object::Handle(Object::null()));
5105 all_entries.set_used_data(0);
5106}
void set_finalizers(const GrowableObjectArray &value)
Definition isolate.cc:1965

◆ NativeFinalizer_TwoEntriesCrossGen() [2/2]

static void dart::NativeFinalizer_TwoEntriesCrossGen ( Thread thread,
intptr_t  test_i 
)
static

Definition at line 5108 of file object_test.cc.

5109 {
5110 ASSERT(test_i < (1 << kFinalizerTwoEntriesNumObjects));
5112 for (intptr_t i = 0; i < kFinalizerTwoEntriesNumObjects; i++) {
5113 spaces[i] = ((test_i >> i) & 0x1) == 0x1 ? Heap::kOld : Heap::kNew;
5114 }
5115 // Either collect or evacuate new space.
5116 for (const bool collect_new_space : {true, false}) {
5117 // Always run old space collection after new space.
5118 const bool evacuate_new_space_and_collect_old_space = true;
5119 const bool clear_value_1 = true;
5120 const bool clear_value_2 = true;
5121 const bool clear_detach_1 = false;
5122 const bool clear_detach_2 = false;
5123 THR_Print(
5124 "collect_new_space: %s evacuate_new_space_and_collect_old_space: %s\n",
5125 collect_new_space ? "true" : "false",
5126 evacuate_new_space_and_collect_old_space ? "true" : "false");
5127 NativeFinalizer_TwoEntriesCrossGen(thread, spaces, collect_new_space,
5128 evacuate_new_space_and_collect_old_space,
5129 clear_value_1, clear_value_2,
5130 clear_detach_1, clear_detach_2);
5131 }
5132}
static void NativeFinalizer_TwoEntriesCrossGen(Thread *thread, Heap::Space *spaces, bool collect_new_space, bool evacuate_new_space_and_collect_old_space, bool clear_value_1, bool clear_value_2, bool clear_detach_1, bool clear_detach_2)

◆ NativeFinalizer_TwoEntriesCrossGen_Finalizer()

void dart::NativeFinalizer_TwoEntriesCrossGen_Finalizer ( void *  peer)

Definition at line 4957 of file object_test.cc.

4957 {
4958 intptr_t* token = reinterpret_cast<intptr_t*>(peer);
4959 (*token)++;
4960}

◆ NativeFoo1()

static void dart::NativeFoo1 ( Dart_NativeArguments  args)
static

Definition at line 8661 of file dart_api_impl_test.cc.

8667 {
8668 EXPECT_VALID(arg);
8669 EXPECT(Dart_IsInteger(arg));
DART_EXPORT bool Dart_IsInteger(Dart_Handle object)

◆ NativeFoo2()

static void dart::NativeFoo2 ( Dart_NativeArguments  args)
static

Definition at line 8671 of file dart_api_impl_test.cc.

8675 {
8677 intptr_t i = Dart_GetNativeArgumentCount(args);
8678 EXPECT_EQ(1, i);
8680 EXPECT_VALID(arg);
8683}
8684
8685static void NativeFoo2(Dart_NativeArguments args) {
8687 intptr_t i = Dart_GetNativeArgumentCount(args);
8688 EXPECT_EQ(2, i);
8690 EXPECT_VALID(arg1);
8691 int64_t value = 0;
struct _Dart_NativeArguments * Dart_NativeArguments
Definition dart_api.h:3010

◆ NativeFoo3()

static void dart::NativeFoo3 ( Dart_NativeArguments  args)
static

Definition at line 8693 of file dart_api_impl_test.cc.

◆ NativeFoo4()

static void dart::NativeFoo4 ( Dart_NativeArguments  args)
static

Definition at line 8703 of file dart_api_impl_test.cc.

8707 {
8709 intptr_t i = Dart_GetNativeArgumentCount(args);
8710 EXPECT_EQ(3, i);

◆ NativeFunc()

static void dart::NativeFunc ( Dart_NativeArguments  args)
static

Definition at line 20 of file code_descriptors_test.cc.

20 {
23 int64_t value = -1;
25 EXPECT_EQ(10, value);
27 EXPECT_EQ(20, value);
28 {
29 TransitionNativeToVM transition(Thread::Current());
30 IsolateGroup::Current()->heap()->CollectAllGarbage();
31 }
32}

◆ NativeLookup()

static Dart_NativeFunction dart::NativeLookup ( Dart_Handle  name,
int  argc,
bool *  auto_setup_scope 
)
static

Definition at line 224 of file custom_isolate_test.cc.

226 {
227 ASSERT(auto_setup_scope != nullptr);
228 *auto_setup_scope = true;
229 const char* name_str = nullptr;
232 if (strcmp(name_str, "native_echo") == 0) {
233 return &native_echo;
234 } else if (strcmp(name_str, "CustomIsolateImpl_start") == 0) {
235 return &CustomIsolateImpl_start;
236 }
237 return nullptr;
238}
static void native_echo(Dart_NativeArguments args)

◆ NativeResolver()

static Dart_NativeFunction dart::NativeResolver ( Dart_Handle  name,
int  arg_count,
bool *  auto_setup_scope 
)
static

Definition at line 210 of file benchmark_test.cc.

212 {
213 ASSERT(auto_setup_scope != nullptr);
214 *auto_setup_scope = false;
215 return &vmservice_resolver;
216}
static void vmservice_resolver(Dart_NativeArguments args)

◆ NativeTypePointerParam()

DART_EXPORT void dart::NativeTypePointerParam ( void *  p)

Definition at line 1160 of file ffi_test_functions.cc.

1160 {
1161 uint8_t* p2 = reinterpret_cast<uint8_t*>(p);
1162 p2[0] = 42;
1163}

◆ NativeTypePointerReturn()

DART_EXPORT void * dart::NativeTypePointerReturn ( )

Definition at line 1166 of file ffi_test_functions.cc.

1166 {
1167 uint64_t bogus_address = 0x13370000;
1168 return reinterpret_cast<void*>(bogus_address);
1169}

◆ NeedsRecordBoxing()

static bool dart::NeedsRecordBoxing ( Definition def)
static

Definition at line 2056 of file flow_graph.cc.

2056 {
2057 if (def->env_use_list() != nullptr) return true;
2058 for (Value::Iterator it(def->input_use_list()); !it.Done(); it.Advance()) {
2059 Value* use = it.Current();
2061 kPairOfTagged) {
2062 return true;
2063 }
2064 }
2065 return false;
2066}
virtual Representation RequiredInputRepresentation(intptr_t idx) const
Definition il.h:1235

◆ NegativeLookaroundAgainstReadDirectionAndMatch()

RegExpNode * dart::NegativeLookaroundAgainstReadDirectionAndMatch ( RegExpCompiler compiler,
ZoneGrowableArray< CharacterRange > *  lookbehind,
ZoneGrowableArray< CharacterRange > *  match,
RegExpNode on_success,
bool  read_backward,
RegExpFlags  flags 
)

Definition at line 4030 of file regexp.cc.

4036 {
4037 RegExpNode* match_node = TextNode::CreateForCharacterRanges(
4038 match, read_backward, on_success, flags);
4039 int stack_register = compiler->UnicodeLookaroundStackRegister();
4040 int position_register = compiler->UnicodeLookaroundPositionRegister();
4041 RegExpLookaround::Builder lookaround(false, match_node, stack_register,
4042 position_register);
4043 RegExpNode* negative_match = TextNode::CreateForCharacterRanges(
4044 lookbehind, !read_backward, lookaround.on_match_success(), flags);
4045 return lookaround.ForMatch(negative_match);
4046}

◆ NewBranch()

static BranchInstr * dart::NewBranch ( FlowGraph graph,
ComparisonInstr cmp,
Instruction inherit 
)
static

Definition at line 3068 of file flow_graph.cc.

3070 {
3071 BranchInstr* bra = new (graph->zone()) BranchInstr(cmp, DeoptId::kNone);
3072 bra->InheritDeoptTarget(graph->zone(), inherit);
3073 return bra;
3074}
void InheritDeoptTarget(Zone *zone, Instruction *other)
Definition il.cc:1560

◆ NewByteData()

static Dart_Handle dart::NewByteData ( Thread thread,
intptr_t  length 
)
static

Definition at line 3732 of file dart_api_impl.cc.

3732 {
3733 CHECK_LENGTH(length, TypedData::MaxElements(kTypedDataUint8ArrayCid));
3734 const TypedData& array =
3735 TypedData::Handle(TypedData::New(kTypedDataUint8ArrayCid, length));
3736 return Api::NewHandle(thread,
3737 TypedDataView::New(kByteDataViewCid, array, 0, length));
3738}

◆ NewConstChar()

static const char * dart::NewConstChar ( const char *  chars)
static

Definition at line 421 of file isolate.cc.

421 {
422 size_t len = strlen(chars);
423 char* mem = new char[len + 1];
424 memmove(mem, chars, len + 1);
425 return mem;
426}

◆ NewDictionary()

static ArrayPtr dart::NewDictionary ( intptr_t  initial_size)
static

Definition at line 14251 of file object.cc.

14251 {
14252 const Array& dict = Array::Handle(Array::New(initial_size + 1, Heap::kOld));
14253 // The last element of the dictionary specifies the number of in use slots.
14254 dict.SetAt(initial_size, Object::smi_zero());
14255 return dict.ptr();
14256}

◆ NewExternalByteData()

static Dart_Handle dart::NewExternalByteData ( Thread thread,
void *  data,
intptr_t  length,
void *  peer,
intptr_t  external_allocation_size,
Dart_HandleFinalizer  callback,
bool  unmodifiable 
)
static

Definition at line 3774 of file dart_api_impl.cc.

3780 {
3781 Zone* zone = thread->zone();
3783 thread, kExternalTypedDataUint8ArrayCid, data, length, peer,
3784 external_allocation_size, callback, false);
3785 if (Api::IsError(ext_data)) {
3786 return ext_data;
3787 }
3788 const ExternalTypedData& array =
3789 Api::UnwrapExternalTypedDataHandle(zone, ext_data);
3790 if (unmodifiable) {
3791 array.SetImmutable(); // Can pass by reference.
3792 }
3793 return Api::NewHandle(
3794 thread, TypedDataView::New(unmodifiable ? kUnmodifiableByteDataViewCid
3796 array, 0, length));
3797}
static Dart_Handle NewExternalTypedData(Thread *thread, intptr_t cid, void *data, intptr_t length, void *peer, intptr_t external_allocation_size, Dart_HandleFinalizer callback, bool unmodifiable)

◆ NewExternalTypedData()

static Dart_Handle dart::NewExternalTypedData ( Thread thread,
intptr_t  cid,
void *  data,
intptr_t  length,
void *  peer,
intptr_t  external_allocation_size,
Dart_HandleFinalizer  callback,
bool  unmodifiable 
)
static

Definition at line 3745 of file dart_api_impl.cc.

3752 {
3753 CHECK_LENGTH(length, ExternalTypedData::MaxElements(cid));
3754 Zone* zone = thread->zone();
3755 intptr_t bytes = length * ExternalTypedData::ElementSizeInBytes(cid);
3756 Object& result = Object::Handle(
3757 zone,
3758 ExternalTypedData::New(cid, reinterpret_cast<uint8_t*>(data), length,
3759 thread->heap()->SpaceForExternal(bytes)));
3760 if (callback != nullptr) {
3761 AllocateFinalizableHandle(thread, result, peer, external_allocation_size,
3762 callback);
3763 }
3764 if (unmodifiable) {
3765 result.SetImmutable(); // Can pass by reference.
3766 const intptr_t view_cid = cid - kTypedDataCidRemainderExternal +
3767 kTypedDataCidRemainderUnmodifiable;
3768 result = TypedDataView::New(view_cid, ExternalTypedData::Cast(result), 0,
3769 length);
3770 }
3771 return Api::NewHandle(thread, result.ptr());
3772}
Space SpaceForExternal(intptr_t size) const
Definition heap.cc:1130

◆ NewExternalTypedDataWithFinalizer()

static Dart_Handle dart::NewExternalTypedDataWithFinalizer ( Dart_TypedData_Type  type,
void *  data,
intptr_t  length,
void *  peer,
intptr_t  external_allocation_size,
Dart_HandleFinalizer  callback,
bool  unmodifiable 
)
static

Definition at line 3842 of file dart_api_impl.cc.

3849 {
3850 DARTSCOPE(Thread::Current());
3851 if (data == nullptr && length != 0) {
3852 RETURN_NULL_ERROR(data);
3853 }
3855 switch (type) {
3857 return NewExternalByteData(T, data, length, peer,
3858 external_allocation_size, callback,
3859 unmodifiable);
3861 return NewExternalTypedData(T, kExternalTypedDataInt8ArrayCid, data,
3862 length, peer, external_allocation_size,
3863 callback, unmodifiable);
3865 return NewExternalTypedData(T, kExternalTypedDataUint8ArrayCid, data,
3866 length, peer, external_allocation_size,
3867 callback, unmodifiable);
3869 return NewExternalTypedData(T, kExternalTypedDataUint8ClampedArrayCid,
3870 data, length, peer, external_allocation_size,
3871 callback, unmodifiable);
3873 return NewExternalTypedData(T, kExternalTypedDataInt16ArrayCid, data,
3874 length, peer, external_allocation_size,
3875 callback, unmodifiable);
3877 return NewExternalTypedData(T, kExternalTypedDataUint16ArrayCid, data,
3878 length, peer, external_allocation_size,
3879 callback, unmodifiable);
3881 return NewExternalTypedData(T, kExternalTypedDataInt32ArrayCid, data,
3882 length, peer, external_allocation_size,
3883 callback, unmodifiable);
3885 return NewExternalTypedData(T, kExternalTypedDataUint32ArrayCid, data,
3886 length, peer, external_allocation_size,
3887 callback, unmodifiable);
3889 return NewExternalTypedData(T, kExternalTypedDataInt64ArrayCid, data,
3890 length, peer, external_allocation_size,
3891 callback, unmodifiable);
3893 return NewExternalTypedData(T, kExternalTypedDataUint64ArrayCid, data,
3894 length, peer, external_allocation_size,
3895 callback, unmodifiable);
3897 return NewExternalTypedData(T, kExternalTypedDataFloat32ArrayCid, data,
3898 length, peer, external_allocation_size,
3899 callback, unmodifiable);
3901 return NewExternalTypedData(T, kExternalTypedDataFloat64ArrayCid, data,
3902 length, peer, external_allocation_size,
3903 callback, unmodifiable);
3905 return NewExternalTypedData(T, kExternalTypedDataInt32x4ArrayCid, data,
3906 length, peer, external_allocation_size,
3907 callback, unmodifiable);
3909 return NewExternalTypedData(T, kExternalTypedDataFloat32x4ArrayCid, data,
3910 length, peer, external_allocation_size,
3911 callback, unmodifiable);
3913 return NewExternalTypedData(T, kExternalTypedDataFloat64x2ArrayCid, data,
3914 length, peer, external_allocation_size,
3915 callback, unmodifiable);
3916 default:
3917 return Api::NewError(
3918 "%s expects argument 'type' to be of"
3919 " 'external TypedData'",
3920 CURRENT_FUNC);
3921 }
3922 UNREACHABLE();
3923 return Api::Null();
3924}

◆ NewGoto()

static GotoInstr * dart::NewGoto ( FlowGraph graph,
JoinEntryInstr target,
Instruction inherit 
)
static

Definition at line 3060 of file flow_graph.cc.

3062 {
3063 GotoInstr* got = new (graph->zone()) GotoInstr(target, DeoptId::kNone);
3064 got->InheritDeoptTarget(graph->zone(), inherit);
3065 return got;
3066}

◆ NewJoin()

static JoinEntryInstr * dart::NewJoin ( FlowGraph graph,
Instruction inherit 
)
static

Definition at line 3052 of file flow_graph.cc.

3052 {
3053 JoinEntryInstr* join = new (graph->zone())
3055 inherit->GetBlock()->try_index(), DeoptId::kNone);
3056 join->InheritDeoptTarget(graph->zone(), inherit);
3057 return join;
3058}
intptr_t try_index() const
Definition il.h:1724

◆ NewMove()

static CatchEntryMove dart::NewMove ( intptr_t  src,
intptr_t  dst 
)
static

Definition at line 16 of file catch_entry_moves_test.cc.

16 {
17 return CatchEntryMove::FromSlot(CatchEntryMove::SourceKind::kTaggedSlot, src,
18 dst);
19}

◆ NewNativePort_ExternalTypedData()

static void dart::NewNativePort_ExternalTypedData ( Dart_Port  dest_port_id,
Dart_CObject message 
)
static

Definition at line 8227 of file dart_api_impl_test.cc.

◆ NewNativePort_nativeReceiveInteger()

static void dart::NewNativePort_nativeReceiveInteger ( Dart_Port  dest_port_id,
Dart_CObject message 
)
static

Definition at line 8376 of file dart_api_impl_test.cc.

8382 : 123\n", Dart_GetError(result));
8383
8384 Dart_ExitScope();
8385
8386 // Delete the native ports.
8387 EXPECT(Dart_CloseNativePort(port_id1));
8388}
8389

◆ NewNativePort_nativeReceiveNull()

static void dart::NewNativePort_nativeReceiveNull ( Dart_Port  dest_port_id,
Dart_CObject message 
)
static

Definition at line 8325 of file dart_api_impl_test.cc.

8326 {
8327 Dart_CloseNativePort(port_id);
8328 Dart_Handle send_port = Dart_NewSendPort(port_id);
8329 EXPECT_VALID(send_port);
8330 Dart_Handle dart_args[1];
8331 dart_args[0] = send_port;
8332 Dart_Handle result = Dart_Invoke(lib, NewString("callPort"), 1, dart_args);
8333 EXPECT_ERROR(result, "Invalid argument");
8334 }
8335
8337}

◆ NewNativePort_send123()

static void dart::NewNativePort_send123 ( Dart_Port  dest_port_id,
Dart_CObject message 
)
static

Definition at line 7958 of file dart_api_impl_test.cc.

7958 {"file:///bar/.packages", "untitled:/"},
7959 };
7960 int sourcefiles_count = sizeof(sourcefiles) / sizeof(Dart_SourceFile);
7961 lib = TestCase::LoadTestScriptWithDFE(
7962 sourcefiles_count, sourcefiles, nullptr, /* finalize= */ true,
7963 /* incrementally= */ true, /* allow_compile_errors= */ false,
7964 "foo1:///main.dart",
7965 /* multiroot_filepaths= */ "/bar,/baz",
7966 /* multiroot_scheme= */ "foo");
7967 EXPECT_ERROR(lib,
7968 "Compilation failed Invalid argument(s): Exception when reading "
7969 "'foo1:///.dart_tool");
7970}
7971
7972static void NewNativePort_send123(Dart_Port dest_port_id,
static void NewNativePort_send123(Dart_Port dest_port_id, Dart_CObject *message)

◆ NewNativePort_send321()

static void dart::NewNativePort_send321 ( Dart_Port  dest_port_id,
Dart_CObject message 
)
static

Definition at line 7974 of file dart_api_impl_test.cc.

◆ NewNativePort_sendInteger123()

static void dart::NewNativePort_sendInteger123 ( Dart_Port  dest_port_id,
Dart_CObject message 
)
static

Definition at line 8084 of file dart_api_impl_test.cc.

8089 : 321\n", Dart_GetError(result));
8090
8091 Dart_ExitScope();
8092
8093 // Delete the native ports.
8094 EXPECT(Dart_CloseNativePort(port_id1));

◆ NewNativePort_sendInteger321()

static void dart::NewNativePort_sendInteger321 ( Dart_Port  dest_port_id,
Dart_CObject message 
)
static

Definition at line 8096 of file dart_api_impl_test.cc.

8099 {
8100 // Gets a send port message.
8101 EXPECT_NOTNULL(message);
8102 EXPECT_EQ(Dart_CObject_kArray, message->type);
8103 EXPECT_EQ(Dart_CObject_kSendPort, message->value.as_array.values[0]->type);
8104
8105 // Post integer value.
8106 Dart_PostInteger(message->value.as_array.values[0]->value.as_send_port.id,
DART_EXPORT bool Dart_PostInteger(Dart_Port port_id, int64_t message)

◆ NewNativePort_Transferrable1()

static void dart::NewNativePort_Transferrable1 ( Dart_Port  dest_port_id,
Dart_CObject message 
)
static

Definition at line 8159 of file dart_api_impl_test.cc.

8164 : 321\n", Dart_GetError(result));
8165
8166 Dart_ExitScope();
8167
8168 // Delete the native ports.

◆ NewNativePort_Transferrable2()

static void dart::NewNativePort_Transferrable2 ( Dart_Port  dest_port_id,
Dart_CObject message 
)
static

Definition at line 8170 of file dart_api_impl_test.cc.

8174 {
8175 // Gets a send port message.
8176 EXPECT_NOTNULL(message);
8177 EXPECT_EQ(Dart_CObject_kTypedData, message->type);
8178 EXPECT_EQ(Dart_TypedData_kUint8, message->value.as_typed_data.type);
8179 EXPECT_EQ(10, message->value.as_typed_data.length);
8180 EXPECT_EQ(42, message->value.as_typed_data.values[0]);
8181 free(const_cast<uint8_t*>(message->value.as_typed_data.values));
8182}

◆ NewRegion()

static void * dart::NewRegion ( uword  size)
static

Definition at line 11 of file memory_region_test.cc.

11 {
12 void* pointer = new uint8_t[size];
13 return pointer;
14}

◆ NewString()

Dart_Handle dart::NewString ( const char *  str)
inline

Definition at line 50 of file benchmark_test.h.

50 {
51 return Dart_NewStringFromCString(str);
52}

◆ NewTarget()

static TargetEntryInstr * dart::NewTarget ( FlowGraph graph,
Instruction inherit 
)
static

Definition at line 3044 of file flow_graph.cc.

3044 {
3045 TargetEntryInstr* target = new (graph->zone())
3047 inherit->GetBlock()->try_index(), DeoptId::kNone);
3048 target->InheritDeoptTarget(graph->zone(), inherit);
3049 return target;
3050}

◆ NewTypedData()

static Dart_Handle dart::NewTypedData ( Thread thread,
intptr_t  cid,
intptr_t  length 
)
static

Definition at line 3740 of file dart_api_impl.cc.

3740 {
3741 CHECK_LENGTH(length, TypedData::MaxElements(cid));
3742 return Api::NewHandle(thread, TypedData::New(cid, length));
3743}

◆ NoopCallback()

static void dart::NoopCallback ( void *  isolate_callback_data,
void *  peer 
)
static

Definition at line 79 of file handles_test.cc.

79{}

◆ NoopFinalizer() [1/2]

static void dart::NoopFinalizer ( void *  isolate_callback_data,
void *  peer 
)
static

Definition at line 436 of file heap_test.cc.

436{}

◆ NoopFinalizer() [2/2]

static void dart::NoopFinalizer ( void *  isolate_callback_data,
void *  peer 
)
static

Definition at line 1915 of file snapshot_test.cc.

1915{}

◆ NoopNative()

static void dart::NoopNative ( Dart_NativeArguments  args)
static

Definition at line 29 of file redundancy_elimination_test.cc.

29{}

◆ NoopNativeLookup()

static Dart_NativeFunction dart::NoopNativeLookup ( Dart_Handle  name,
int  argument_count,
bool *  auto_setup_scope 
)
static

Definition at line 31 of file redundancy_elimination_test.cc.

33 {
34 ASSERT(auto_setup_scope != nullptr);
35 *auto_setup_scope = false;
36 return NoopNative;
37}
static void NoopNative(Dart_NativeArguments args)

◆ NopCallback()

static void dart::NopCallback ( void *  isolate_callback_data,
void *  peer 
)
static

Definition at line 3009 of file dart_api_impl_test.cc.

3009{}

◆ NopResolver()

static void * dart::NopResolver ( const char *  name,
uintptr_t  args_n 
)
static

Definition at line 10165 of file dart_api_impl_test.cc.

◆ Normalize()

static void dart::Normalize ( char *  s)
static

Definition at line 276 of file flags.cc.

276 {
277 intptr_t len = strlen(s);
278 for (intptr_t i = 0; i < len; i++) {
279 if (s[i] == '-') {
280 s[i] = '_';
281 }
282 }
283}

◆ NormalizeClassIdForSyntacticalTypeEquality()

static classid_t dart::NormalizeClassIdForSyntacticalTypeEquality ( classid_t  cid)
static

Definition at line 22110 of file object.cc.

22110 {
22111 if (IsIntegerClassId(cid)) {
22112 return Type::Handle(Type::IntType()).type_class_id();
22113 } else if (IsStringClassId(cid)) {
22114 return Type::Handle(Type::StringType()).type_class_id();
22115 } else if (cid == kDoubleCid) {
22116 return Type::Handle(Type::Double()).type_class_id();
22117 } else if (IsTypeClassId(cid)) {
22118 return Type::Handle(Type::DartTypeType()).type_class_id();
22119 } else if (IsArrayClassId(cid)) {
22120 return Class::Handle(IsolateGroup::Current()->object_store()->list_class())
22121 .id();
22122 }
22123 return cid;
22124}

◆ NormalizeEscapes()

static char * dart::NormalizeEscapes ( const char *  str,
intptr_t  len 
)
static

Definition at line 81 of file uri.cc.

81 {
82 // Allocate the buffer.
83 Zone* zone = ThreadState::Current()->zone();
84 // We multiply len by three because a percent-escape sequence is
85 // three characters long (e.g. ' ' -> '%20). +1 for '\0'. We could
86 // take two passes through the string and avoid the excess
87 // allocation, but it's zone-memory so it doesn't seem necessary.
88 char* buffer = zone->Alloc<char>(len * 3 + 1);
89
90 // Copy the string, normalizing as we go.
91 intptr_t buffer_pos = 0;
92 intptr_t pos = 0;
93 while (pos < len) {
94 int escaped_value = GetEscapedValue(str, pos, len);
95 if (escaped_value >= 0) {
96 // If one of the special "unreserved" characters has been
97 // escaped, revert the escaping. Otherwise preserve the
98 // escaping.
99 if (IsUnreservedChar(escaped_value)) {
100 buffer[buffer_pos] = escaped_value;
101 buffer_pos++;
102 } else {
103 Utils::SNPrint(buffer + buffer_pos, 4, "%%%02X", escaped_value);
104 buffer_pos += 3;
105 }
106 pos += 3;
107 } else {
108 char c = str[pos];
109 // If a delimiter or unreserved character is currently not
110 // escaped, preserve that. If there is a busted %-sequence in
111 // the input, preserve that too.
112 if (c == '%' || IsDelimiter(c) || IsUnreservedChar(c)) {
113 buffer[buffer_pos] = c;
114 buffer_pos++;
115 } else {
116 // Escape funky characters.
117 Utils::SNPrint(buffer + buffer_pos, 4, "%%%02X", c);
118 buffer_pos += 3;
119 }
120 pos++;
121 }
122 }
123 buffer[buffer_pos] = '\0';
124 return buffer;
125}
static int GetEscapedValue(const char *str, intptr_t pos, intptr_t len)
Definition uri.cc:62
static bool IsDelimiter(intptr_t value)
Definition uri.cc:17
static bool IsUnreservedChar(intptr_t value)
Definition uri.cc:11

◆ NOT_IN_PRODUCT()

dart::NOT_IN_PRODUCT ( LibraryPtr   ReloadTestScriptconst char *script)

◆ NothingModifiedCallback()

static bool dart::NothingModifiedCallback ( const char *  url,
int64_t  since 
)
static

Definition at line 4444 of file isolate_reload_test.cc.

◆ NotifyDart()

void dart::NotifyDart ( Dart_Port  send_port,
const Work work 
)

Definition at line 458 of file ffi_test_functions_vmspecific.cc.

458 {
459 const intptr_t work_addr = reinterpret_cast<intptr_t>(work);
460 printf("C : Posting message (port: %" Px64 ", work: %" Px ").\n",
461 send_port, work_addr);
462
463 Dart_CObject dart_object;
464 dart_object.type = Dart_CObject_kInt64;
465 dart_object.value.as_int64 = work_addr;
466
467 const bool result = Dart_PostCObject_DL(send_port, &dart_object);
468 if (!result) {
469 FATAL("C : Posting message to port failed.");
470 }
471}

◆ NotifyDestroyed_native_lookup()

static Dart_NativeFunction dart::NotifyDestroyed_native_lookup ( Dart_Handle  name,
int  argument_count,
bool *  auto_setup_scope 
)
static

Definition at line 9735 of file dart_api_impl_test.cc.

9739 {
9740 result = Dart_SetEnabledTimelineCategory("GC,API,Compiler");
DART_EXPORT bool Dart_SetEnabledTimelineCategory(const char *categories)

◆ NotifyDestroyedNative()

static void dart::NotifyDestroyedNative ( Dart_NativeArguments  args)
static

Definition at line 9731 of file dart_api_impl_test.cc.

9732 {

◆ NotifyIdleLong_native_lookup()

static Dart_NativeFunction dart::NotifyIdleLong_native_lookup ( Dart_Handle  name,
int  argument_count,
bool *  auto_setup_scope 
)
static

Definition at line 9702 of file dart_api_impl_test.cc.

9704 {
9705 int64_t micros1 = Dart_TimelineGetMicros();
9706 int64_t ticks1 = Dart_TimelineGetTicks();
9707 int64_t frequency1 = Dart_TimelineGetTicksFrequency();
DART_EXPORT int64_t Dart_TimelineGetTicksFrequency()
DART_EXPORT int64_t Dart_TimelineGetTicks()

◆ NotifyIdleLongNative()

static void dart::NotifyIdleLongNative ( Dart_NativeArguments  args)
static

Definition at line 9698 of file dart_api_impl_test.cc.

◆ NotifyIdleShort_native_lookup()

static Dart_NativeFunction dart::NotifyIdleShort_native_lookup ( Dart_Handle  name,
int  argument_count,
bool *  auto_setup_scope 
)
static

Definition at line 9670 of file dart_api_impl_test.cc.

◆ NotifyIdleShortNative()

static void dart::NotifyIdleShortNative ( Dart_NativeArguments  args)
static

Definition at line 9666 of file dart_api_impl_test.cc.

◆ NotifyLowMemory_native_lookup()

static Dart_NativeFunction dart::NotifyLowMemory_native_lookup ( Dart_Handle  name,
int  argument_count,
bool *  auto_setup_scope 
)
static

Definition at line 9812 of file dart_api_impl_test.cc.

9813 {
9814 t.add(List.filled(100, null));
9815 }
9816 v = t;
9817 notifyIdle();

◆ NotifyLowMemoryNative()

static void dart::NotifyLowMemoryNative ( Dart_NativeArguments  args)
static

Definition at line 9808 of file dart_api_impl_test.cc.

9809 {
9810 var v;

◆ NotifyMessage()

static void dart::NotifyMessage ( Dart_Isolate  dest_isolate)
static

Definition at line 218 of file custom_isolate_test.cc.

218 {
219 OS::PrintErr("-- Notify isolate(%p) of pending message --\n", dest_isolate);
220 OS::PrintErr("-- Adding MessageEvent to queue --\n");
221 event_queue->Add(new MessageEvent(dest_isolate));
222}

◆ NullableInt64ElemAt1()

DART_EXPORT int64_t * dart::NullableInt64ElemAt1 ( int64_t *  a)

Definition at line 612 of file ffi_test_functions.cc.

612 {
613 std::cout << "NullableInt64ElemAt1(" << a << ")\n";
614 int64_t* retval;
615 if (a != nullptr) {
616 std::cout << "not null pointer, address: " << a << "\n";
617 retval = a + 1;
618 } else {
619 std::cout << "null pointer, address: " << a << "\n";
620 retval = nullptr;
621 }
622 std::cout << "returning " << retval << "\n";
623 return retval;
624}

◆ NullErrorHelper()

static void dart::NullErrorHelper ( Zone zone,
const String selector,
bool  is_param_name = false 
)
static

Definition at line 186 of file runtime_entry.cc.

188 {
189 if (is_param_name) {
190 const String& error = String::Handle(
191 selector.IsNull()
192 ? String::New("argument value is null")
193 : String::NewFormatted("argument value for '%s' is null",
194 selector.ToCString()));
195 Exceptions::ThrowArgumentError(error);
196 return;
197 }
198
199 // If the selector is null, this must be a null check that wasn't due to a
200 // method invocation, so was due to the null check operator.
201 if (selector.IsNull()) {
202 const Array& args = Array::Handle(zone, Array::New(4));
203 args.SetAt(
204 3, String::Handle(
205 zone, String::New("Null check operator used on a null value")));
206 Exceptions::ThrowByType(Exceptions::kType, args);
207 return;
208 }
209
210 InvocationMirror::Kind kind = InvocationMirror::kMethod;
211 if (Field::IsGetterName(selector)) {
212 kind = InvocationMirror::kGetter;
213 } else if (Field::IsSetterName(selector)) {
214 kind = InvocationMirror::kSetter;
215 }
216
217 const Smi& invocation_type = Smi::Handle(
218 zone,
219 Smi::New(InvocationMirror::EncodeType(InvocationMirror::kDynamic, kind)));
220
221 const Array& args = Array::Handle(zone, Array::New(7));
222 args.SetAt(0, /* instance */ Object::null_object());
223 args.SetAt(1, selector);
224 args.SetAt(2, invocation_type);
225 args.SetAt(3, /* func_type_args_length */ Object::smi_zero());
226 args.SetAt(4, /* func_type_args */ Object::null_object());
227 args.SetAt(5, /* func_args */ Object::null_object());
228 args.SetAt(6, /* func_arg_names */ Object::null_object());
229 Exceptions::ThrowByType(Exceptions::kNoSuchMethod, args);
230}

◆ NumberPlaces()

static AliasedSet * dart::NumberPlaces ( FlowGraph graph,
PointerSet< Place > *  map,
CSEMode  mode 
)
static

Definition at line 1371 of file redundancy_elimination.cc.

1373 {
1374 // Loads representing different expression ids will be collected and
1375 // used to build per offset kill sets.
1376 Zone* zone = graph->zone();
1378
1379 bool has_loads = false;
1380 bool has_stores = false;
1381 for (BlockIterator it = graph->reverse_postorder_iterator(); !it.Done();
1382 it.Advance()) {
1383 BlockEntryInstr* block = it.Current();
1384
1385 for (ForwardInstructionIterator instr_it(block); !instr_it.Done();
1386 instr_it.Advance()) {
1387 Instruction* instr = instr_it.Current();
1388 Place place(instr, &has_loads, &has_stores);
1389 if (place.kind() == Place::kNone) {
1390 continue;
1391 }
1392
1393 Place* result = map->LookupValue(&place);
1394 if (result == nullptr) {
1395 result = Place::Wrap(zone, place, places->length());
1396 map->Insert(result);
1397 places->Add(result);
1398
1399 if (FLAG_trace_optimization && graph->should_print()) {
1400 THR_Print("numbering %s as %" Pd "\n", result->ToCString(),
1401 result->id());
1402 }
1403 }
1404
1405 SetPlaceId(instr, result->id());
1406 }
1407 }
1408
1409 if ((mode == kOptimizeLoads) && !has_loads) {
1410 return nullptr;
1411 }
1412 if ((mode == kOptimizeStores) && !has_stores) {
1413 return nullptr;
1414 }
1415
1416 PhiPlaceMoves* phi_moves =
1417 ComputePhiMoves(map, places, graph->should_print());
1418
1419 // Build aliasing sets mapping aliases to loads.
1420 return new (zone)
1421 AliasedSet(zone, map, places, phi_moves, graph->should_print());
1422}
bool Done() const
Definition flow_graph.h:46
bool should_print() const
Definition flow_graph.h:505
static PhiPlaceMoves * ComputePhiMoves(PointerSet< Place > *map, ZoneGrowableArray< Place * > *places, bool print_traces)
static DART_FORCE_INLINE void SetPlaceId(Instruction *instr, intptr_t id)

◆ NumEntries()

static int dart::NumEntries ( const FinalizerEntry entry,
intptr_t  acc = 0 
)
static

Definition at line 3843 of file object_test.cc.

3843 {
3844 if (entry.IsNull()) {
3845 return acc;
3846 }
3847 return NumEntries(FinalizerEntry::Handle(entry.next()), acc + 1);
3848}
FinalizerEntryPtr next() const
Definition object.h:12970

◆ objcpy()

static NO_SANITIZE_THREAD void dart::objcpy ( void *  dst,
const void *  src,
size_t  size 
)
static

Definition at line 92 of file scavenger.cc.

92 {
93 // A mem copy specialized for objects. We can assume:
94 // - dst and src do not overlap
95 ASSERT(
96 (reinterpret_cast<uword>(dst) + size <= reinterpret_cast<uword>(src)) ||
97 (reinterpret_cast<uword>(src) + size <= reinterpret_cast<uword>(dst)));
98 // - dst and src are word aligned
99 ASSERT(Utils::IsAligned(reinterpret_cast<uword>(dst), sizeof(uword)));
100 ASSERT(Utils::IsAligned(reinterpret_cast<uword>(src), sizeof(uword)));
101 // - size is strictly positive
102 ASSERT(size > 0);
103 // - size is a multiple of double words
104 ASSERT(Utils::IsAligned(size, 2 * sizeof(uword)));
105
106 uword* __restrict dst_cursor = reinterpret_cast<uword*>(dst);
107 const uword* __restrict src_cursor = reinterpret_cast<const uword*>(src);
108 do {
109 uword a = *src_cursor++;
110 uword b = *src_cursor++;
111 *dst_cursor++ = a;
112 *dst_cursor++ = b;
113 size -= (2 * sizeof(uword));
114 } while (size > 0);
115}

◆ ObjectAtPoolIndex()

bool dart::ObjectAtPoolIndex ( const Code code,
intptr_t  index,
Object obj 
)

Definition at line 14 of file instructions.cc.

14 {
15#if defined(DART_PRECOMPILER)
16 if (FLAG_precompiled_mode) {
17 Precompiler* precompiler = Precompiler::Instance();
18 if (precompiler != nullptr) {
20 precompiler->global_object_pool_builder();
21 if (index < pool->CurrentLength()) {
22 compiler::ObjectPoolBuilderEntry& entry = pool->EntryAt(index);
23 if (entry.type() == compiler::ObjectPoolBuilderEntry::kTaggedObject) {
24 *obj = entry.obj_->ptr();
25 return true;
26 }
27 }
28 }
29 return false;
30 }
31#endif
32 const ObjectPool& pool = ObjectPool::Handle(code.GetObjectPool());
33 if (!pool.IsNull() && (index < pool.Length()) &&
34 (pool.TypeAt(index) == ObjectPool::EntryType::kTaggedObject)) {
35 *obj = pool.ObjectAt(index);
36 return true;
37 }
38 return false;
39}
compiler::ObjectPoolBuilder * global_object_pool_builder()

◆ OddDRegisterOf()

static DRegister dart::OddDRegisterOf ( QRegister  q)
inlinestatic

Definition at line 259 of file constants_arm.h.

259 {
260 return static_cast<DRegister>((q * 2) + 1);
261}

◆ OddSRegisterOf()

static SRegister dart::OddSRegisterOf ( DRegister  d)
inlinestatic

Definition at line 272 of file constants_arm.h.

272 {
273#if defined(VFPv3_D32)
274 ASSERT(d < D16);
275#endif
276 return static_cast<SRegister>((d * 2) + 1);
277}

◆ OnEveryRuntimeEntryCall()

void dart::OnEveryRuntimeEntryCall ( Thread thread,
const char *  runtime_call_name,
bool  can_lazy_deopt 
)

Definition at line 3762 of file runtime_entry.cc.

3764 {
3765 ASSERT(FLAG_deoptimize_on_runtime_call_every > 0);
3766 if (FLAG_precompiled_mode) {
3767 return;
3768 }
3769 if (IsolateGroup::IsSystemIsolateGroup(thread->isolate_group())) {
3770 return;
3771 }
3772 const bool is_deopt_related =
3773 strstr(runtime_call_name, "Deoptimize") != nullptr;
3774 if (is_deopt_related) {
3775 return;
3776 }
3777 // For --deoptimize-on-every-runtime-call we only consider runtime calls that
3778 // can lazy-deopt.
3779 if (can_lazy_deopt) {
3780 if (FLAG_deoptimize_on_runtime_call_name_filter != nullptr &&
3781 (strlen(runtime_call_name) !=
3782 strlen(FLAG_deoptimize_on_runtime_call_name_filter) ||
3783 strstr(runtime_call_name,
3784 FLAG_deoptimize_on_runtime_call_name_filter) == nullptr)) {
3785 return;
3786 }
3787 const uint32_t count = thread->IncrementAndGetRuntimeCallCount();
3788 if ((count % FLAG_deoptimize_on_runtime_call_every) == 0) {
3790 }
3791 }
3792}
uint32_t IncrementAndGetRuntimeCallCount()
Definition thread.h:450
static void DeoptimizeLastDartFrameIfOptimized()

◆ OnlyVmIsolateLeft()

static bool dart::OnlyVmIsolateLeft ( )
static

Definition at line 554 of file dart.cc.

554 {
555 intptr_t count = 0;
556 bool found_vm_isolate = false;
557 IsolateGroup::ForEach([&](IsolateGroup* group) {
558 group->ForEachIsolate([&](Isolate* isolate) {
559 count++;
560 if (isolate == Dart::vm_isolate()) {
561 found_vm_isolate = true;
562 }
563 });
564 });
565 return count == 1 && found_vm_isolate;
566}

◆ operator!=()

constexpr bool dart::operator!= ( Register  r,
LinkRegister  lr 
)
constexpr

Definition at line 1328 of file constants_arm.h.

1328 {
1329 return !(r == lr);
1330}

◆ operator==()

constexpr bool dart::operator== ( Register  r,
LinkRegister   
)
constexpr

Definition at line 1324 of file constants_arm.h.

1324 {
1325 return r == LR;
1326}

◆ OptExternalByteDataNativeFunction()

static void dart::OptExternalByteDataNativeFunction ( Dart_NativeArguments  args)
static

Definition at line 2400 of file dart_api_impl_test.cc.

2400 {
2402 Dart_Handle external_byte_data =
2404 EXPECT_VALID(external_byte_data);
2405 EXPECT_EQ(Dart_TypedData_kByteData,
2406 Dart_GetTypeOfTypedData(external_byte_data));
2407 Dart_SetReturnValue(args, external_byte_data);
2409}

◆ OptExternalByteDataNativeResolver()

static Dart_NativeFunction dart::OptExternalByteDataNativeResolver ( Dart_Handle  name,
int  arg_count,
bool *  auto_setup_scope 
)
static

Definition at line 2411 of file dart_api_impl_test.cc.

2414 {
2415 ASSERT(auto_setup_scope != nullptr);
2416 *auto_setup_scope = true;
2418}
static void OptExternalByteDataNativeFunction(Dart_NativeArguments args)

◆ OptimizeCatchEntryStates()

void dart::OptimizeCatchEntryStates ( FlowGraph flow_graph,
bool  is_aot 
)

Definition at line 4303 of file redundancy_elimination.cc.

4303 {
4304 if (flow_graph->graph_entry()->catch_entries().is_empty()) {
4305 return;
4306 }
4307
4308 TryCatchAnalyzer analyzer(flow_graph, is_aot);
4309 analyzer.Optimize();
4310}
const GrowableArray< CatchBlockEntryInstr * > & catch_entries() const
Definition il.h:1997

◆ OptionallyStepBackToLeadSurrogate()

RegExpNode * dart::OptionallyStepBackToLeadSurrogate ( RegExpCompiler compiler,
RegExpNode on_success,
RegExpFlags  flags 
)

Definition at line 5263 of file regexp.cc.

5265 {
5266 // If the regexp matching starts within a surrogate pair, step back
5267 // to the lead surrogate and start matching from there.
5268 ASSERT(!compiler->read_backward());
5269 Zone* zone = compiler->zone();
5270
5271 auto lead_surrogates = CharacterRange::List(
5272 on_success->zone(), CharacterRange::Range(Utf16::kLeadSurrogateStart,
5273 Utf16::kLeadSurrogateEnd));
5274 auto trail_surrogates = CharacterRange::List(
5275 on_success->zone(), CharacterRange::Range(Utf16::kTrailSurrogateStart,
5276 Utf16::kTrailSurrogateEnd));
5277
5278 ChoiceNode* optional_step_back = new (zone) ChoiceNode(2, zone);
5279
5280 int stack_register = compiler->UnicodeLookaroundStackRegister();
5281 int position_register = compiler->UnicodeLookaroundPositionRegister();
5282 RegExpNode* step_back = TextNode::CreateForCharacterRanges(
5283 lead_surrogates, /*read_backward=*/true, on_success, flags);
5284 RegExpLookaround::Builder builder(/*is_positive=*/true, step_back,
5285 stack_register, position_register);
5286 RegExpNode* match_trail = TextNode::CreateForCharacterRanges(
5287 trail_surrogates, /*read_backward=*/false, builder.on_match_success(),
5288 flags);
5289
5290 optional_step_back->AddAlternative(
5291 GuardedAlternative(builder.ForMatch(match_trail)));
5292 optional_step_back->AddAlternative(GuardedAlternative(on_success));
5293
5294 return optional_step_back;
5295}
void AddAlternative(GuardedAlternative node)
Definition regexp.h:903

◆ OrderByFrequencyThenId()

static int dart::OrderByFrequencyThenId ( CidRange *const *  a,
CidRange *const *  b 
)
static

Definition at line 642 of file il.cc.

642 {
643 const TargetInfo* target_info_a = static_cast<const TargetInfo*>(*a);
644 const TargetInfo* target_info_b = static_cast<const TargetInfo*>(*b);
645 // Negative if 'a' should sort before 'b'.
646 if (target_info_b->count != target_info_a->count) {
647 return (target_info_b->count - target_info_a->count);
648 } else {
649 return (*a)->cid_start - (*b)->cid_start;
650 }
651}
intptr_t cid_start
Definition il.h:220
intptr_t count
Definition il.h:722

◆ OrderById()

static int dart::OrderById ( CidRange *const *  a,
CidRange *const *  b 
)
static

Definition at line 635 of file il.cc.

635 {
636 // Negative if 'a' should sort before 'b'.
637 ASSERT((*a)->IsSingleCid());
638 ASSERT((*b)->IsSingleCid());
639 return (*a)->cid_start - (*b)->cid_start;
640}

◆ ParamAddress()

static DART_FORCE_INLINE uword dart::ParamAddress ( uword  fp,
intptr_t  reverse_index 
)
static

Definition at line 417 of file stack_frame.h.

417 {
418 return fp + (kParamEndSlotFromFp * kWordSize) + (reverse_index * kWordSize);
419}

◆ ParseAuthority()

static intptr_t dart::ParseAuthority ( const char *  authority,
ParsedUri parsed_uri 
)
static

Definition at line 158 of file uri.cc.

158 {
159 Zone* zone = ThreadState::Current()->zone();
160 const char* current = authority;
161 intptr_t len = 0;
162
163 size_t userinfo_len = strcspn(current, "@/");
164 if (current[userinfo_len] == '@') {
165 // The '@' character follows the optional userinfo string.
166 parsed_uri->userinfo = NormalizeEscapes(current, userinfo_len);
167 current += userinfo_len + 1;
168 len += userinfo_len + 1;
169 } else {
170 parsed_uri->userinfo = nullptr;
171 }
172
173 size_t host_len = strcspn(current, ":/");
174 char* host = NormalizeEscapes(current, host_len);
175 StringLower(host);
176 parsed_uri->host = host;
177 len += host_len;
178
179 if (current[host_len] == ':') {
180 // The ':' character precedes the optional port string.
181 const char* port_start = current + host_len + 1; // +1 for ':'
182 size_t port_len = strcspn(port_start, "/");
183 parsed_uri->port = zone->MakeCopyOfStringN(port_start, port_len);
184 len += 1 + port_len; // +1 for ':'
185 } else {
186 parsed_uri->port = nullptr;
187 }
188 return len;
189}
char * MakeCopyOfStringN(const char *str, intptr_t len)
Definition zone.cc:277
static void StringLower(char *str)
Definition uri.cc:128
static char * NormalizeEscapes(const char *str, intptr_t len)
Definition uri.cc:81
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 host
Definition switches.h:74

◆ ParseCSVList()

static bool dart::ParseCSVList ( const char *  csv_list,
const GrowableObjectArray values 
)
static

Definition at line 3162 of file service.cc.

3163 {
3164 Zone* zone = Thread::Current()->zone();
3165 String& s = String::Handle(zone);
3166 const char* c = csv_list;
3167 if (*c++ != '[') return false;
3168 while (IsWhitespace(*c) && *c != '\0') {
3169 c++;
3170 }
3171 while (*c != '\0') {
3172 const char* value = c;
3173 while (*c != '\0' && *c != ']' && *c != ',' && !IsWhitespace(*c)) {
3174 c++;
3175 }
3176 if (c > value) {
3177 s = String::New(zone->MakeCopyOfStringN(value, c - value));
3178 values.Add(s);
3179 }
3180 switch (*c) {
3181 case '\0':
3182 return false;
3183 case ',':
3184 c++;
3185 break;
3186 case ']':
3187 return true;
3188 }
3189 while (IsWhitespace(*c) && *c != '\0') {
3190 c++;
3191 }
3192 }
3193 return false;
3194}
static bool IsWhitespace(char c)
Definition service.cc:2774

◆ ParseInteger()

static IntegerPtr dart::ParseInteger ( const String value)
static

Definition at line 162 of file integers.cc.

162 {
163 // Used by both Integer_parse and Integer_fromEnvironment.
164 if (value.IsOneByteString()) {
165 // Quick conversion for unpadded integers in strings.
166 const intptr_t len = value.Length();
167 if (len > 0) {
168 const char* cstr = value.ToCString();
169 ASSERT(cstr != nullptr);
170 char* p_end = nullptr;
171 const int64_t int_value = strtoll(cstr, &p_end, 10);
172 if (p_end == (cstr + len)) {
173 if ((int_value != LLONG_MIN) && (int_value != LLONG_MAX)) {
174 return Integer::New(int_value);
175 }
176 }
177 }
178 }
179
180 return Integer::New(value);
181}

◆ ParseJSONArray()

intptr_t dart::ParseJSONArray ( Thread thread,
const char *  str,
const GrowableObjectArray elements 
)

Definition at line 3660 of file service.cc.

3662 {
3663 Zone* zone = thread->zone();
3664 return ParseJSONCollection(
3665 thread, str, [zone, &elements](const char* start, intptr_t length) {
3666 String& element = String::Handle(
3667 zone,
3668 String::FromUTF8(reinterpret_cast<const uint8_t*>(start), length));
3669 elements.Add(element);
3670 });
3671}
static intptr_t ParseJSONCollection(Thread *thread, const char *str, const Adder &add)
Definition service.cc:3629

◆ ParseJSONCollection()

template<typename Adder >
static intptr_t dart::ParseJSONCollection ( Thread thread,
const char *  str,
const Adder &  add 
)
static

Definition at line 3629 of file service.cc.

3631 {
3632 ASSERT(str != nullptr);
3633 ASSERT(thread != nullptr);
3634 intptr_t n = strlen(str);
3635 if (n < 2) {
3636 return -1;
3637 } else if (n == 2) {
3638 return 0;
3639 }
3640 // The JSON string array looks like [abc, def]. There are no quotes around the
3641 // strings, but there is a space after the comma. start points to the first
3642 // character of the element. end points to the separator after the element
3643 // (']' or ',').
3644 intptr_t start = 1;
3645 while (start < n) {
3646 intptr_t end = start;
3647 while (end < n) {
3648 const char c = str[end];
3649 if (c == ',' || c == ']') {
3650 break;
3651 }
3652 ++end;
3653 }
3654 add(&str[start], end - start);
3655 start = end + 2;
3656 }
3657 return 0;
3658}

◆ ParseJSONSet()

static intptr_t dart::ParseJSONSet ( Thread thread,
const char *  str,
ZoneCStringSet elements 
)
static

Definition at line 3674 of file service.cc.

3676 {
3677 Zone* zone = thread->zone();
3678 return ParseJSONCollection(
3679 thread, str, [zone, elements](const char* start, intptr_t length) {
3680 elements->Insert(zone->MakeCopyOfStringN(start, length));
3681 });
3682}

◆ ParseScope()

static bool dart::ParseScope ( const char *  scope,
GrowableArray< const char * > *  names,
GrowableArray< const char * > *  ids 
)
static

Definition at line 2783 of file service.cc.

2785 {
2786 Zone* zone = Thread::Current()->zone();
2787 const char* c = scope;
2788 if (*c++ != '{') return false;
2789
2790 for (;;) {
2791 while (IsWhitespace(*c)) {
2792 c++;
2793 }
2794
2795 if (*c == '}') return true;
2796
2797 const char* name = c;
2798 if (!IsAlphaOrDollar(*c)) return false;
2799 while (IsAlphaNumOrDollar(*c)) {
2800 c++;
2801 }
2802 names->Add(zone->MakeCopyOfStringN(name, c - name));
2803
2804 while (IsWhitespace(*c)) {
2805 c++;
2806 }
2807
2808 if (*c++ != ':') return false;
2809
2810 while (IsWhitespace(*c)) {
2811 c++;
2812 }
2813
2814 const char* id = c;
2815 if (!IsObjectIdChar(*c)) return false;
2816 while (IsObjectIdChar(*c)) {
2817 c++;
2818 }
2819 ids->Add(zone->MakeCopyOfStringN(id, c - id));
2820
2821 while (IsWhitespace(*c)) {
2822 c++;
2823 }
2824 if (*c == ',') c++;
2825 }
2826
2827 return false;
2828}
static bool IsObjectIdChar(char c)
Definition service.cc:2777

◆ ParseUri()

bool dart::ParseUri ( const char *  uri,
ParsedUri parsed_uri 
)

Definition at line 193 of file uri.cc.

193 {
194 Zone* zone = ThreadState::Current()->zone();
195
196 // The first ':' separates the scheme from the rest of the uri. If
197 // a ':' occurs after the first '/' it doesn't count.
198 size_t scheme_len = strcspn(uri, ":/");
199 const char* rest = uri;
200 if (uri[scheme_len] == ':') {
201 char* scheme = zone->MakeCopyOfStringN(uri, scheme_len);
202 StringLower(scheme);
203 parsed_uri->scheme = scheme;
204 rest = uri + scheme_len + 1;
205 } else {
206 parsed_uri->scheme = nullptr;
207 }
208
209 // The first '#' separates the optional fragment
210 const char* hash_pos = rest + strcspn(rest, "#");
211 if (*hash_pos == '#') {
212 // There is a fragment part.
213 const char* fragment_start = hash_pos + 1;
214 parsed_uri->fragment =
215 NormalizeEscapes(fragment_start, strlen(fragment_start));
216 } else {
217 parsed_uri->fragment = nullptr;
218 }
219
220 // The first '?' or '#' separates the hierarchical part from the
221 // optional query.
222 const char* question_pos = rest + strcspn(rest, "?#");
223 if (*question_pos == '?') {
224 // There is a query part.
225 const char* query_start = question_pos + 1;
226 parsed_uri->query = NormalizeEscapes(query_start, (hash_pos - query_start));
227 } else {
228 parsed_uri->query = nullptr;
229 }
230
231 const char* path_start = rest;
232 if (rest[0] == '/' && rest[1] == '/') {
233 // There is an authority part.
234 const char* authority_start = rest + 2; // 2 for '//'.
235
236 intptr_t authority_len = ParseAuthority(authority_start, parsed_uri);
237 if (authority_len < 0) {
238 ClearParsedUri(parsed_uri);
239 return false;
240 }
241 path_start = authority_start + authority_len;
242 } else {
243 parsed_uri->userinfo = nullptr;
244 parsed_uri->host = nullptr;
245 parsed_uri->port = nullptr;
246 }
247
248 // The path is the substring between the authority and the query.
249 parsed_uri->path = NormalizeEscapes(path_start, (question_pos - path_start));
250 return true;
251}
static intptr_t ParseAuthority(const char *authority, ParsedUri *parsed_uri)
Definition uri.cc:158
static void ClearParsedUri(ParsedUri *parsed_uri)
Definition uri.cc:148

◆ PassAsHandle()

intptr_t dart::PassAsHandle ( Dart_Handle  handle)

Definition at line 1145 of file ffi_test_functions_vmspecific.cc.

1145 {
1146 intptr_t result = 0;
1148 return result;
1149}

◆ PassAsPointer()

intptr_t dart::PassAsPointer ( void *  ptr)

Definition at line 1151 of file ffi_test_functions_vmspecific.cc.

1151 {
1152 return reinterpret_cast<intptr_t>(ptr);
1153}

◆ PassAsPointerAndValue()

intptr_t dart::PassAsPointerAndValue ( void *  ptr,
intptr_t  value 
)

Definition at line 1155 of file ffi_test_functions_vmspecific.cc.

1155 {
1156 return value;
1157}

◆ PassAsValueAndPointer()

intptr_t dart::PassAsValueAndPointer ( intptr_t  value,
void *  ptr 
)

Definition at line 1159 of file ffi_test_functions_vmspecific.cc.

1159 {
1160 return value;
1161}

◆ PassDoublex6Struct16BytesMixedx4Int32()

DART_EXPORT double dart::PassDoublex6Struct16BytesMixedx4Int32 ( double  a0,
double  a1,
double  a2,
double  a3,
double  a4,
double  a5,
Struct16BytesMixed  a6,
Struct16BytesMixed  a7,
Struct16BytesMixed  a8,
Struct16BytesMixed  a9,
int32_t  a10 
)

Definition at line 2488 of file ffi_test_functions_generated.cc.

2498 {
2499 std::cout << "PassDoublex6Struct16BytesMixedx4Int32" << "(" << a0 << ", "
2500 << a1 << ", " << a2 << ", " << a3 << ", " << a4 << ", " << a5
2501 << ", (" << a6.a0 << ", " << a6.a1 << "), (" << a7.a0 << ", "
2502 << a7.a1 << "), (" << a8.a0 << ", " << a8.a1 << "), (" << a9.a0
2503 << ", " << a9.a1 << "), " << a10 << ")" << "\n";
2504
2505 double result = 0;
2506
2507 result += a0;
2508 result += a1;
2509 result += a2;
2510 result += a3;
2511 result += a4;
2512 result += a5;
2513 result += a6.a0;
2514 result += a6.a1;
2515 result += a7.a0;
2516 result += a7.a1;
2517 result += a8.a0;
2518 result += a8.a1;
2519 result += a9.a0;
2520 result += a9.a1;
2521 result += a10;
2522
2523 std::cout << "result = " << result << "\n";
2524
2525 return result;
2526}

◆ PassFloatStruct16BytesHomogeneousFloatFloatStruct1()

DART_EXPORT float dart::PassFloatStruct16BytesHomogeneousFloatFloatStruct1 ( float  a0,
Struct16BytesHomogeneousFloat  a1,
float  a2,
Struct16BytesHomogeneousFloat  a3,
float  a4,
Struct16BytesHomogeneousFloat  a5,
float  a6,
Struct16BytesHomogeneousFloat  a7,
float  a8 
)

Definition at line 2344 of file ffi_test_functions_generated.cc.

2353 {
2354 std::cout << "PassFloatStruct16BytesHomogeneousFloatFloatStruct1" << "(" << a0
2355 << ", (" << a1.a0 << ", " << a1.a1 << ", " << a1.a2 << ", " << a1.a3
2356 << "), " << a2 << ", (" << a3.a0 << ", " << a3.a1 << ", " << a3.a2
2357 << ", " << a3.a3 << "), " << a4 << ", (" << a5.a0 << ", " << a5.a1
2358 << ", " << a5.a2 << ", " << a5.a3 << "), " << a6 << ", (" << a7.a0
2359 << ", " << a7.a1 << ", " << a7.a2 << ", " << a7.a3 << "), " << a8
2360 << ")" << "\n";
2361
2362 float result = 0;
2363
2364 result += a0;
2365 result += a1.a0;
2366 result += a1.a1;
2367 result += a1.a2;
2368 result += a1.a3;
2369 result += a2;
2370 result += a3.a0;
2371 result += a3.a1;
2372 result += a3.a2;
2373 result += a3.a3;
2374 result += a4;
2375 result += a5.a0;
2376 result += a5.a1;
2377 result += a5.a2;
2378 result += a5.a3;
2379 result += a6;
2380 result += a7.a0;
2381 result += a7.a1;
2382 result += a7.a2;
2383 result += a7.a3;
2384 result += a8;
2385
2386 std::cout << "result = " << result << "\n";
2387
2388 return result;
2389}

◆ PassFloatStruct32BytesHomogeneousDoubleFloatStruct()

DART_EXPORT double dart::PassFloatStruct32BytesHomogeneousDoubleFloatStruct ( float  a0,
Struct32BytesHomogeneousDouble  a1,
float  a2,
Struct32BytesHomogeneousDouble  a3,
float  a4,
Struct32BytesHomogeneousDouble  a5,
float  a6,
Struct32BytesHomogeneousDouble  a7,
float  a8 
)

Definition at line 2393 of file ffi_test_functions_generated.cc.

2402 {
2403 std::cout << "PassFloatStruct32BytesHomogeneousDoubleFloatStruct" << "(" << a0
2404 << ", (" << a1.a0 << ", " << a1.a1 << ", " << a1.a2 << ", " << a1.a3
2405 << "), " << a2 << ", (" << a3.a0 << ", " << a3.a1 << ", " << a3.a2
2406 << ", " << a3.a3 << "), " << a4 << ", (" << a5.a0 << ", " << a5.a1
2407 << ", " << a5.a2 << ", " << a5.a3 << "), " << a6 << ", (" << a7.a0
2408 << ", " << a7.a1 << ", " << a7.a2 << ", " << a7.a3 << "), " << a8
2409 << ")" << "\n";
2410
2411 double result = 0;
2412
2413 result += a0;
2414 result += a1.a0;
2415 result += a1.a1;
2416 result += a1.a2;
2417 result += a1.a3;
2418 result += a2;
2419 result += a3.a0;
2420 result += a3.a1;
2421 result += a3.a2;
2422 result += a3.a3;
2423 result += a4;
2424 result += a5.a0;
2425 result += a5.a1;
2426 result += a5.a2;
2427 result += a5.a3;
2428 result += a6;
2429 result += a7.a0;
2430 result += a7.a1;
2431 result += a7.a2;
2432 result += a7.a3;
2433 result += a8;
2434
2435 std::cout << "result = " << result << "\n";
2436
2437 return result;
2438}

◆ PassInt32x4Struct16BytesMixedx4Double()

DART_EXPORT double dart::PassInt32x4Struct16BytesMixedx4Double ( int32_t  a0,
int32_t  a1,
int32_t  a2,
int32_t  a3,
Struct16BytesMixed  a4,
Struct16BytesMixed  a5,
Struct16BytesMixed  a6,
Struct16BytesMixed  a7,
double  a8 
)

Definition at line 2532 of file ffi_test_functions_generated.cc.

2540 {
2541 std::cout << "PassInt32x4Struct16BytesMixedx4Double" << "(" << a0 << ", "
2542 << a1 << ", " << a2 << ", " << a3 << ", (" << a4.a0 << ", " << a4.a1
2543 << "), (" << a5.a0 << ", " << a5.a1 << "), (" << a6.a0 << ", "
2544 << a6.a1 << "), (" << a7.a0 << ", " << a7.a1 << "), " << a8 << ")"
2545 << "\n";
2546
2547 double result = 0;
2548
2549 result += a0;
2550 result += a1;
2551 result += a2;
2552 result += a3;
2553 result += a4.a0;
2554 result += a4.a1;
2555 result += a5.a0;
2556 result += a5.a1;
2557 result += a6.a0;
2558 result += a6.a1;
2559 result += a7.a0;
2560 result += a7.a1;
2561 result += a8;
2562
2563 std::cout << "result = " << result << "\n";
2564
2565 return result;
2566}

◆ PassInt32x8Doublex8Int64Int8Struct1ByteIntInt64Int()

DART_EXPORT double dart::PassInt32x8Doublex8Int64Int8Struct1ByteIntInt64Int ( int32_t  a0,
int32_t  a1,
int32_t  a2,
int32_t  a3,
int32_t  a4,
int32_t  a5,
int32_t  a6,
int32_t  a7,
double  a8,
double  a9,
double  a10,
double  a11,
double  a12,
double  a13,
double  a14,
double  a15,
int64_t  a16,
int8_t  a17,
Struct1ByteInt  a18,
int64_t  a19,
int8_t  a20,
Struct4BytesHomogeneousInt16  a21,
int64_t  a22,
int8_t  a23,
Struct8BytesInt  a24,
int64_t  a25,
int8_t  a26,
Struct8BytesHomogeneousFloat  a27,
int64_t  a28,
int8_t  a29,
Struct8BytesMixed  a30,
int64_t  a31,
int8_t  a32,
StructAlignmentInt16  a33,
int64_t  a34,
int8_t  a35,
StructAlignmentInt32  a36,
int64_t  a37,
int8_t  a38,
StructAlignmentInt64  a39 
)

Definition at line 2599 of file ffi_test_functions_generated.cc.

2639 {
2640 std::cout << "PassInt32x8Doublex8Int64Int8Struct1ByteIntInt64Int" << "(" << a0
2641 << ", " << a1 << ", " << a2 << ", " << a3 << ", " << a4 << ", "
2642 << a5 << ", " << a6 << ", " << a7 << ", " << a8 << ", " << a9
2643 << ", " << a10 << ", " << a11 << ", " << a12 << ", " << a13 << ", "
2644 << a14 << ", " << a15 << ", " << a16 << ", "
2645 << static_cast<int>(a17) << ", (" << static_cast<int>(a18.a0)
2646 << "), " << a19 << ", " << static_cast<int>(a20) << ", (" << a21.a0
2647 << ", " << a21.a1 << "), " << a22 << ", " << static_cast<int>(a23)
2648 << ", (" << a24.a0 << ", " << a24.a1 << ", " << a24.a2 << "), "
2649 << a25 << ", " << static_cast<int>(a26) << ", (" << a27.a0 << ", "
2650 << a27.a1 << "), " << a28 << ", " << static_cast<int>(a29) << ", ("
2651 << a30.a0 << ", " << a30.a1 << ", " << a30.a2 << "), " << a31
2652 << ", " << static_cast<int>(a32) << ", ("
2653 << static_cast<int>(a33.a0) << ", " << a33.a1 << ", "
2654 << static_cast<int>(a33.a2) << "), " << a34 << ", "
2655 << static_cast<int>(a35) << ", (" << static_cast<int>(a36.a0)
2656 << ", " << a36.a1 << ", " << static_cast<int>(a36.a2) << "), "
2657 << a37 << ", " << static_cast<int>(a38) << ", ("
2658 << static_cast<int>(a39.a0) << ", " << a39.a1 << ", "
2659 << static_cast<int>(a39.a2) << "))" << "\n";
2660
2661 double result = 0;
2662
2663 result += a0;
2664 result += a1;
2665 result += a2;
2666 result += a3;
2667 result += a4;
2668 result += a5;
2669 result += a6;
2670 result += a7;
2671 result += a8;
2672 result += a9;
2673 result += a10;
2674 result += a11;
2675 result += a12;
2676 result += a13;
2677 result += a14;
2678 result += a15;
2679 result += a16;
2680 result += a17;
2681 result += a18.a0;
2682 result += a19;
2683 result += a20;
2684 result += a21.a0;
2685 result += a21.a1;
2686 result += a22;
2687 result += a23;
2688 result += a24.a0;
2689 result += a24.a1;
2690 result += a24.a2;
2691 result += a25;
2692 result += a26;
2693 result += a27.a0;
2694 result += a27.a1;
2695 result += a28;
2696 result += a29;
2697 result += a30.a0;
2698 result += a30.a1;
2699 result += a30.a2;
2700 result += a31;
2701 result += a32;
2702 result += a33.a0;
2703 result += a33.a1;
2704 result += a33.a2;
2705 result += a34;
2706 result += a35;
2707 result += a36.a0;
2708 result += a36.a1;
2709 result += a36.a2;
2710 result += a37;
2711 result += a38;
2712 result += a39.a0;
2713 result += a39.a1;
2714 result += a39.a2;
2715
2716 std::cout << "result = " << result << "\n";
2717
2718 return result;
2719}

◆ PassInt64x7Struct12BytesHomogeneousInt32()

DART_EXPORT int64_t dart::PassInt64x7Struct12BytesHomogeneousInt32 ( int64_t  a0,
int64_t  a1,
int64_t  a2,
int64_t  a3,
int64_t  a4,
int64_t  a5,
int64_t  a6,
Struct12BytesHomogeneousInt32  a7 
)

Definition at line 4767 of file ffi_test_functions_generated.cc.

4774 {
4775 std::cout << "PassInt64x7Struct12BytesHomogeneousInt32" << "(" << a0 << ", "
4776 << a1 << ", " << a2 << ", " << a3 << ", " << a4 << ", " << a5
4777 << ", " << a6 << ", (" << a7.a0 << ", " << a7.a1 << ", " << a7.a2
4778 << "))" << "\n";
4779
4780 int64_t result = 0;
4781
4782 result += a0;
4783 result += a1;
4784 result += a2;
4785 result += a3;
4786 result += a4;
4787 result += a5;
4788 result += a6;
4789 result += a7.a0;
4790 result += a7.a1;
4791 result += a7.a2;
4792
4793 std::cout << "result = " << result << "\n";
4794
4795 return result;
4796}

◆ PassInt8Struct16BytesMixedInt8Struct16BytesMixedIn()

DART_EXPORT double dart::PassInt8Struct16BytesMixedInt8Struct16BytesMixedIn ( int8_t  a0,
Struct16BytesMixed  a1,
int8_t  a2,
Struct16BytesMixed  a3,
int8_t  a4,
Struct16BytesMixed  a5,
int8_t  a6,
Struct16BytesMixed  a7,
int8_t  a8 
)

Definition at line 2446 of file ffi_test_functions_generated.cc.

2455 {
2456 std::cout << "PassInt8Struct16BytesMixedInt8Struct16BytesMixedIn" << "("
2457 << static_cast<int>(a0) << ", (" << a1.a0 << ", " << a1.a1 << "), "
2458 << static_cast<int>(a2) << ", (" << a3.a0 << ", " << a3.a1 << "), "
2459 << static_cast<int>(a4) << ", (" << a5.a0 << ", " << a5.a1 << "), "
2460 << static_cast<int>(a6) << ", (" << a7.a0 << ", " << a7.a1 << "), "
2461 << static_cast<int>(a8) << ")" << "\n";
2462
2463 double result = 0;
2464
2465 result += a0;
2466 result += a1.a0;
2467 result += a1.a1;
2468 result += a2;
2469 result += a3.a0;
2470 result += a3.a1;
2471 result += a4;
2472 result += a5.a0;
2473 result += a5.a1;
2474 result += a6;
2475 result += a7.a0;
2476 result += a7.a1;
2477 result += a8;
2478
2479 std::cout << "result = " << result << "\n";
2480
2481 return result;
2482}

◆ PassObjectToC()

DART_EXPORT Dart_Handle dart::PassObjectToC ( Dart_Handle  h)

Definition at line 954 of file ffi_test_functions_vmspecific.cc.

954 {
955 // Can use "h" until this function returns.
956
957 // A persistent handle which outlives this call. Lifetime managed in C.
958 auto persistent_handle = Dart_NewPersistentHandle(h);
959
960 Dart_Handle handle_2 = Dart_HandleFromPersistent(persistent_handle);
961 Dart_DeletePersistentHandle(persistent_handle);
962 if (Dart_IsError(handle_2)) {
963 Dart_PropagateError(handle_2);
964 }
965
966 Dart_Handle return_value;
967 if (!Dart_IsNull(h) && !Dart_IsInteger(h)) {
968 // A weak handle which outlives this call. Lifetime managed in C.
969 auto weak_handle = Dart_NewWeakPersistentHandle(
970 h, reinterpret_cast<void*>(0x1234), 64, RunFinalizer);
971 return_value = Dart_HandleFromWeakPersistent(weak_handle);
972
973 // Deleting a weak handle is not required, it deletes itself on
974 // finalization.
975 // Deleting a weak handle cancels the finalizer.
977 } else {
978 return_value = h;
979 }
980
981 return return_value;
982}
SkScalar h

◆ PassObjectToCUseDynamicLinking()

DART_EXPORT Dart_Handle dart::PassObjectToCUseDynamicLinking ( Dart_Handle  h)

Definition at line 1082 of file ffi_test_functions_vmspecific.cc.

1082 {
1083 auto persistent_handle = Dart_NewPersistentHandle_DL(h);
1084
1085 Dart_Handle handle_2 = Dart_HandleFromPersistent_DL(persistent_handle);
1086 Dart_SetPersistentHandle_DL(persistent_handle, h);
1087 Dart_DeletePersistentHandle_DL(persistent_handle);
1088
1089 auto weak_handle = Dart_NewWeakPersistentHandle_DL(
1090 handle_2, reinterpret_cast<void*>(0x1234), 64, RunFinalizer);
1091 Dart_Handle return_value = Dart_HandleFromWeakPersistent_DL(weak_handle);
1092
1093 Dart_DeleteWeakPersistentHandle_DL(weak_handle);
1094
1095 return return_value;
1096}

◆ PassStruct()

DART_EXPORT int32_t dart::PassStruct ( void *  )

Definition at line 1186 of file ffi_test_functions.cc.

1186 {
1187 return 42;
1188}

◆ PassStruct1024BytesHomogeneousUint64()

DART_EXPORT uint64_t dart::PassStruct1024BytesHomogeneousUint64 ( Struct1024BytesHomogeneousUint64  a0)

Definition at line 2166 of file ffi_test_functions_generated.cc.

2166 {
2167 std::cout << "PassStruct1024BytesHomogeneousUint64" << "((" << a0.a0 << ", "
2168 << a0.a1 << ", " << a0.a2 << ", " << a0.a3 << ", " << a0.a4 << ", "
2169 << a0.a5 << ", " << a0.a6 << ", " << a0.a7 << ", " << a0.a8 << ", "
2170 << a0.a9 << ", " << a0.a10 << ", " << a0.a11 << ", " << a0.a12
2171 << ", " << a0.a13 << ", " << a0.a14 << ", " << a0.a15 << ", "
2172 << a0.a16 << ", " << a0.a17 << ", " << a0.a18 << ", " << a0.a19
2173 << ", " << a0.a20 << ", " << a0.a21 << ", " << a0.a22 << ", "
2174 << a0.a23 << ", " << a0.a24 << ", " << a0.a25 << ", " << a0.a26
2175 << ", " << a0.a27 << ", " << a0.a28 << ", " << a0.a29 << ", "
2176 << a0.a30 << ", " << a0.a31 << ", " << a0.a32 << ", " << a0.a33
2177 << ", " << a0.a34 << ", " << a0.a35 << ", " << a0.a36 << ", "
2178 << a0.a37 << ", " << a0.a38 << ", " << a0.a39 << ", " << a0.a40
2179 << ", " << a0.a41 << ", " << a0.a42 << ", " << a0.a43 << ", "
2180 << a0.a44 << ", " << a0.a45 << ", " << a0.a46 << ", " << a0.a47
2181 << ", " << a0.a48 << ", " << a0.a49 << ", " << a0.a50 << ", "
2182 << a0.a51 << ", " << a0.a52 << ", " << a0.a53 << ", " << a0.a54
2183 << ", " << a0.a55 << ", " << a0.a56 << ", " << a0.a57 << ", "
2184 << a0.a58 << ", " << a0.a59 << ", " << a0.a60 << ", " << a0.a61
2185 << ", " << a0.a62 << ", " << a0.a63 << ", " << a0.a64 << ", "
2186 << a0.a65 << ", " << a0.a66 << ", " << a0.a67 << ", " << a0.a68
2187 << ", " << a0.a69 << ", " << a0.a70 << ", " << a0.a71 << ", "
2188 << a0.a72 << ", " << a0.a73 << ", " << a0.a74 << ", " << a0.a75
2189 << ", " << a0.a76 << ", " << a0.a77 << ", " << a0.a78 << ", "
2190 << a0.a79 << ", " << a0.a80 << ", " << a0.a81 << ", " << a0.a82
2191 << ", " << a0.a83 << ", " << a0.a84 << ", " << a0.a85 << ", "
2192 << a0.a86 << ", " << a0.a87 << ", " << a0.a88 << ", " << a0.a89
2193 << ", " << a0.a90 << ", " << a0.a91 << ", " << a0.a92 << ", "
2194 << a0.a93 << ", " << a0.a94 << ", " << a0.a95 << ", " << a0.a96
2195 << ", " << a0.a97 << ", " << a0.a98 << ", " << a0.a99 << ", "
2196 << a0.a100 << ", " << a0.a101 << ", " << a0.a102 << ", " << a0.a103
2197 << ", " << a0.a104 << ", " << a0.a105 << ", " << a0.a106 << ", "
2198 << a0.a107 << ", " << a0.a108 << ", " << a0.a109 << ", " << a0.a110
2199 << ", " << a0.a111 << ", " << a0.a112 << ", " << a0.a113 << ", "
2200 << a0.a114 << ", " << a0.a115 << ", " << a0.a116 << ", " << a0.a117
2201 << ", " << a0.a118 << ", " << a0.a119 << ", " << a0.a120 << ", "
2202 << a0.a121 << ", " << a0.a122 << ", " << a0.a123 << ", " << a0.a124
2203 << ", " << a0.a125 << ", " << a0.a126 << ", " << a0.a127 << "))"
2204 << "\n";
2205
2206 uint64_t result = 0;
2207
2208 result += a0.a0;
2209 result += a0.a1;
2210 result += a0.a2;
2211 result += a0.a3;
2212 result += a0.a4;
2213 result += a0.a5;
2214 result += a0.a6;
2215 result += a0.a7;
2216 result += a0.a8;
2217 result += a0.a9;
2218 result += a0.a10;
2219 result += a0.a11;
2220 result += a0.a12;
2221 result += a0.a13;
2222 result += a0.a14;
2223 result += a0.a15;
2224 result += a0.a16;
2225 result += a0.a17;
2226 result += a0.a18;
2227 result += a0.a19;
2228 result += a0.a20;
2229 result += a0.a21;
2230 result += a0.a22;
2231 result += a0.a23;
2232 result += a0.a24;
2233 result += a0.a25;
2234 result += a0.a26;
2235 result += a0.a27;
2236 result += a0.a28;
2237 result += a0.a29;
2238 result += a0.a30;
2239 result += a0.a31;
2240 result += a0.a32;
2241 result += a0.a33;
2242 result += a0.a34;
2243 result += a0.a35;
2244 result += a0.a36;
2245 result += a0.a37;
2246 result += a0.a38;
2247 result += a0.a39;
2248 result += a0.a40;
2249 result += a0.a41;
2250 result += a0.a42;
2251 result += a0.a43;
2252 result += a0.a44;
2253 result += a0.a45;
2254 result += a0.a46;
2255 result += a0.a47;
2256 result += a0.a48;
2257 result += a0.a49;
2258 result += a0.a50;
2259 result += a0.a51;
2260 result += a0.a52;
2261 result += a0.a53;
2262 result += a0.a54;
2263 result += a0.a55;
2264 result += a0.a56;
2265 result += a0.a57;
2266 result += a0.a58;
2267 result += a0.a59;
2268 result += a0.a60;
2269 result += a0.a61;
2270 result += a0.a62;
2271 result += a0.a63;
2272 result += a0.a64;
2273 result += a0.a65;
2274 result += a0.a66;
2275 result += a0.a67;
2276 result += a0.a68;
2277 result += a0.a69;
2278 result += a0.a70;
2279 result += a0.a71;
2280 result += a0.a72;
2281 result += a0.a73;
2282 result += a0.a74;
2283 result += a0.a75;
2284 result += a0.a76;
2285 result += a0.a77;
2286 result += a0.a78;
2287 result += a0.a79;
2288 result += a0.a80;
2289 result += a0.a81;
2290 result += a0.a82;
2291 result += a0.a83;
2292 result += a0.a84;
2293 result += a0.a85;
2294 result += a0.a86;
2295 result += a0.a87;
2296 result += a0.a88;
2297 result += a0.a89;
2298 result += a0.a90;
2299 result += a0.a91;
2300 result += a0.a92;
2301 result += a0.a93;
2302 result += a0.a94;
2303 result += a0.a95;
2304 result += a0.a96;
2305 result += a0.a97;
2306 result += a0.a98;
2307 result += a0.a99;
2308 result += a0.a100;
2309 result += a0.a101;
2310 result += a0.a102;
2311 result += a0.a103;
2312 result += a0.a104;
2313 result += a0.a105;
2314 result += a0.a106;
2315 result += a0.a107;
2316 result += a0.a108;
2317 result += a0.a109;
2318 result += a0.a110;
2319 result += a0.a111;
2320 result += a0.a112;
2321 result += a0.a113;
2322 result += a0.a114;
2323 result += a0.a115;
2324 result += a0.a116;
2325 result += a0.a117;
2326 result += a0.a118;
2327 result += a0.a119;
2328 result += a0.a120;
2329 result += a0.a121;
2330 result += a0.a122;
2331 result += a0.a123;
2332 result += a0.a124;
2333 result += a0.a125;
2334 result += a0.a126;
2335 result += a0.a127;
2336
2337 std::cout << "result = " << result << "\n";
2338
2339 return result;
2340}

◆ PassStruct12BytesHomogeneousFloatx6()

Definition at line 1396 of file ffi_test_functions_generated.cc.

1402 {
1403 std::cout << "PassStruct12BytesHomogeneousFloatx6" << "((" << a0.a0 << ", "
1404 << a0.a1 << ", " << a0.a2 << "), (" << a1.a0 << ", " << a1.a1
1405 << ", " << a1.a2 << "), (" << a2.a0 << ", " << a2.a1 << ", "
1406 << a2.a2 << "), (" << a3.a0 << ", " << a3.a1 << ", " << a3.a2
1407 << "), (" << a4.a0 << ", " << a4.a1 << ", " << a4.a2 << "), ("
1408 << a5.a0 << ", " << a5.a1 << ", " << a5.a2 << "))" << "\n";
1409
1410 float result = 0;
1411
1412 result += a0.a0;
1413 result += a0.a1;
1414 result += a0.a2;
1415 result += a1.a0;
1416 result += a1.a1;
1417 result += a1.a2;
1418 result += a2.a0;
1419 result += a2.a1;
1420 result += a2.a2;
1421 result += a3.a0;
1422 result += a3.a1;
1423 result += a3.a2;
1424 result += a4.a0;
1425 result += a4.a1;
1426 result += a4.a2;
1427 result += a5.a0;
1428 result += a5.a1;
1429 result += a5.a2;
1430
1431 std::cout << "result = " << result << "\n";
1432
1433 return result;
1434}

◆ PassStruct15BytesInlineArrayMixed()

DART_EXPORT double dart::PassStruct15BytesInlineArrayMixed ( Struct15BytesInlineArrayMixed  a0)

Definition at line 4321 of file ffi_test_functions_generated.cc.

4322 {
4323 std::cout << "PassStruct15BytesInlineArrayMixed" << "(([(" << a0.a0[0].a0
4324 << ", " << static_cast<int>(a0.a0[0].a1) << "), (" << a0.a0[1].a0
4325 << ", " << static_cast<int>(a0.a0[1].a1) << "), (" << a0.a0[2].a0
4326 << ", " << static_cast<int>(a0.a0[2].a1) << ")]))" << "\n";
4327
4328 double result = 0;
4329
4330 result += a0.a0[0].a0;
4331 result += a0.a0[0].a1;
4332 result += a0.a0[1].a0;
4333 result += a0.a0[1].a1;
4334 result += a0.a0[2].a0;
4335 result += a0.a0[2].a1;
4336
4337 std::cout << "result = " << result << "\n";
4338
4339 return result;
4340}

◆ PassStruct16BytesHomogeneousFloatx5()

Definition at line 1440 of file ffi_test_functions_generated.cc.

1445 {
1446 std::cout << "PassStruct16BytesHomogeneousFloatx5" << "((" << a0.a0 << ", "
1447 << a0.a1 << ", " << a0.a2 << ", " << a0.a3 << "), (" << a1.a0
1448 << ", " << a1.a1 << ", " << a1.a2 << ", " << a1.a3 << "), ("
1449 << a2.a0 << ", " << a2.a1 << ", " << a2.a2 << ", " << a2.a3
1450 << "), (" << a3.a0 << ", " << a3.a1 << ", " << a3.a2 << ", "
1451 << a3.a3 << "), (" << a4.a0 << ", " << a4.a1 << ", " << a4.a2
1452 << ", " << a4.a3 << "))" << "\n";
1453
1454 float result = 0;
1455
1456 result += a0.a0;
1457 result += a0.a1;
1458 result += a0.a2;
1459 result += a0.a3;
1460 result += a1.a0;
1461 result += a1.a1;
1462 result += a1.a2;
1463 result += a1.a3;
1464 result += a2.a0;
1465 result += a2.a1;
1466 result += a2.a2;
1467 result += a2.a3;
1468 result += a3.a0;
1469 result += a3.a1;
1470 result += a3.a2;
1471 result += a3.a3;
1472 result += a4.a0;
1473 result += a4.a1;
1474 result += a4.a2;
1475 result += a4.a3;
1476
1477 std::cout << "result = " << result << "\n";
1478
1479 return result;
1480}

◆ PassStruct16BytesMixed2x10()

Definition at line 1538 of file ffi_test_functions_generated.cc.

1547 {
1548 std::cout << "PassStruct16BytesMixed2x10" << "((" << a0.a0 << ", " << a0.a1
1549 << ", " << a0.a2 << ", " << a0.a3 << "), (" << a1.a0 << ", "
1550 << a1.a1 << ", " << a1.a2 << ", " << a1.a3 << "), (" << a2.a0
1551 << ", " << a2.a1 << ", " << a2.a2 << ", " << a2.a3 << "), ("
1552 << a3.a0 << ", " << a3.a1 << ", " << a3.a2 << ", " << a3.a3
1553 << "), (" << a4.a0 << ", " << a4.a1 << ", " << a4.a2 << ", "
1554 << a4.a3 << "), (" << a5.a0 << ", " << a5.a1 << ", " << a5.a2
1555 << ", " << a5.a3 << "), (" << a6.a0 << ", " << a6.a1 << ", "
1556 << a6.a2 << ", " << a6.a3 << "), (" << a7.a0 << ", " << a7.a1
1557 << ", " << a7.a2 << ", " << a7.a3 << "), (" << a8.a0 << ", "
1558 << a8.a1 << ", " << a8.a2 << ", " << a8.a3 << "), (" << a9.a0
1559 << ", " << a9.a1 << ", " << a9.a2 << ", " << a9.a3 << "))" << "\n";
1560
1561 float result = 0;
1562
1563 result += a0.a0;
1564 result += a0.a1;
1565 result += a0.a2;
1566 result += a0.a3;
1567 result += a1.a0;
1568 result += a1.a1;
1569 result += a1.a2;
1570 result += a1.a3;
1571 result += a2.a0;
1572 result += a2.a1;
1573 result += a2.a2;
1574 result += a2.a3;
1575 result += a3.a0;
1576 result += a3.a1;
1577 result += a3.a2;
1578 result += a3.a3;
1579 result += a4.a0;
1580 result += a4.a1;
1581 result += a4.a2;
1582 result += a4.a3;
1583 result += a5.a0;
1584 result += a5.a1;
1585 result += a5.a2;
1586 result += a5.a3;
1587 result += a6.a0;
1588 result += a6.a1;
1589 result += a6.a2;
1590 result += a6.a3;
1591 result += a7.a0;
1592 result += a7.a1;
1593 result += a7.a2;
1594 result += a7.a3;
1595 result += a8.a0;
1596 result += a8.a1;
1597 result += a8.a2;
1598 result += a8.a3;
1599 result += a9.a0;
1600 result += a9.a1;
1601 result += a9.a2;
1602 result += a9.a3;
1603
1604 std::cout << "result = " << result << "\n";
1605
1606 return result;
1607}

◆ PassStruct16BytesMixedx10()

Definition at line 1487 of file ffi_test_functions_generated.cc.

1496 {
1497 std::cout << "PassStruct16BytesMixedx10" << "((" << a0.a0 << ", " << a0.a1
1498 << "), (" << a1.a0 << ", " << a1.a1 << "), (" << a2.a0 << ", "
1499 << a2.a1 << "), (" << a3.a0 << ", " << a3.a1 << "), (" << a4.a0
1500 << ", " << a4.a1 << "), (" << a5.a0 << ", " << a5.a1 << "), ("
1501 << a6.a0 << ", " << a6.a1 << "), (" << a7.a0 << ", " << a7.a1
1502 << "), (" << a8.a0 << ", " << a8.a1 << "), (" << a9.a0 << ", "
1503 << a9.a1 << "))" << "\n";
1504
1505 double result = 0;
1506
1507 result += a0.a0;
1508 result += a0.a1;
1509 result += a1.a0;
1510 result += a1.a1;
1511 result += a2.a0;
1512 result += a2.a1;
1513 result += a3.a0;
1514 result += a3.a1;
1515 result += a4.a0;
1516 result += a4.a1;
1517 result += a5.a0;
1518 result += a5.a1;
1519 result += a6.a0;
1520 result += a6.a1;
1521 result += a7.a0;
1522 result += a7.a1;
1523 result += a8.a0;
1524 result += a8.a1;
1525 result += a9.a0;
1526 result += a9.a1;
1527
1528 std::cout << "result = " << result << "\n";
1529
1530 return result;
1531}

◆ PassStruct16BytesNestedIntx2()

DART_EXPORT int64_t dart::PassStruct16BytesNestedIntx2 ( Struct16BytesNestedInt  a0,
Struct16BytesNestedInt  a1 
)

Definition at line 3017 of file ffi_test_functions_generated.cc.

3018 {
3019 std::cout << "PassStruct16BytesNestedIntx2" << "((((" << a0.a0.a0.a0 << ", "
3020 << a0.a0.a0.a1 << "), (" << a0.a0.a1.a0 << ", " << a0.a0.a1.a1
3021 << ")), ((" << a0.a1.a0.a0 << ", " << a0.a1.a0.a1 << "), ("
3022 << a0.a1.a1.a0 << ", " << a0.a1.a1.a1 << "))), (((" << a1.a0.a0.a0
3023 << ", " << a1.a0.a0.a1 << "), (" << a1.a0.a1.a0 << ", "
3024 << a1.a0.a1.a1 << ")), ((" << a1.a1.a0.a0 << ", " << a1.a1.a0.a1
3025 << "), (" << a1.a1.a1.a0 << ", " << a1.a1.a1.a1 << "))))" << "\n";
3026
3027 int64_t result = 0;
3028
3029 result += a0.a0.a0.a0;
3030 result += a0.a0.a0.a1;
3031 result += a0.a0.a1.a0;
3032 result += a0.a0.a1.a1;
3033 result += a0.a1.a0.a0;
3034 result += a0.a1.a0.a1;
3035 result += a0.a1.a1.a0;
3036 result += a0.a1.a1.a1;
3037 result += a1.a0.a0.a0;
3038 result += a1.a0.a0.a1;
3039 result += a1.a0.a1.a0;
3040 result += a1.a0.a1.a1;
3041 result += a1.a1.a0.a0;
3042 result += a1.a1.a0.a1;
3043 result += a1.a1.a1.a0;
3044 result += a1.a1.a1.a1;
3045
3046 std::cout << "result = " << result << "\n";
3047
3048 return result;
3049}

◆ PassStruct17BytesIntx10()

DART_EXPORT int64_t dart::PassStruct17BytesIntx10 ( Struct17BytesInt  a0,
Struct17BytesInt  a1,
Struct17BytesInt  a2,
Struct17BytesInt  a3,
Struct17BytesInt  a4,
Struct17BytesInt  a5,
Struct17BytesInt  a6,
Struct17BytesInt  a7,
Struct17BytesInt  a8,
Struct17BytesInt  a9 
)

Definition at line 1612 of file ffi_test_functions_generated.cc.

1621 {
1622 std::cout << "PassStruct17BytesIntx10" << "((" << a0.a0 << ", " << a0.a1
1623 << ", " << static_cast<int>(a0.a2) << "), (" << a1.a0 << ", "
1624 << a1.a1 << ", " << static_cast<int>(a1.a2) << "), (" << a2.a0
1625 << ", " << a2.a1 << ", " << static_cast<int>(a2.a2) << "), ("
1626 << a3.a0 << ", " << a3.a1 << ", " << static_cast<int>(a3.a2)
1627 << "), (" << a4.a0 << ", " << a4.a1 << ", "
1628 << static_cast<int>(a4.a2) << "), (" << a5.a0 << ", " << a5.a1
1629 << ", " << static_cast<int>(a5.a2) << "), (" << a6.a0 << ", "
1630 << a6.a1 << ", " << static_cast<int>(a6.a2) << "), (" << a7.a0
1631 << ", " << a7.a1 << ", " << static_cast<int>(a7.a2) << "), ("
1632 << a8.a0 << ", " << a8.a1 << ", " << static_cast<int>(a8.a2)
1633 << "), (" << a9.a0 << ", " << a9.a1 << ", "
1634 << static_cast<int>(a9.a2) << "))" << "\n";
1635
1636 int64_t result = 0;
1637
1638 result += a0.a0;
1639 result += a0.a1;
1640 result += a0.a2;
1641 result += a1.a0;
1642 result += a1.a1;
1643 result += a1.a2;
1644 result += a2.a0;
1645 result += a2.a1;
1646 result += a2.a2;
1647 result += a3.a0;
1648 result += a3.a1;
1649 result += a3.a2;
1650 result += a4.a0;
1651 result += a4.a1;
1652 result += a4.a2;
1653 result += a5.a0;
1654 result += a5.a1;
1655 result += a5.a2;
1656 result += a6.a0;
1657 result += a6.a1;
1658 result += a6.a2;
1659 result += a7.a0;
1660 result += a7.a1;
1661 result += a7.a2;
1662 result += a8.a0;
1663 result += a8.a1;
1664 result += a8.a2;
1665 result += a9.a0;
1666 result += a9.a1;
1667 result += a9.a2;
1668
1669 std::cout << "result = " << result << "\n";
1670
1671 return result;
1672}

◆ PassStruct19BytesHomogeneousUint8x10()

Definition at line 1679 of file ffi_test_functions_generated.cc.

1688 {
1689 std::cout
1690 << "PassStruct19BytesHomogeneousUint8x10" << "(("
1691 << static_cast<int>(a0.a0) << ", " << static_cast<int>(a0.a1) << ", "
1692 << static_cast<int>(a0.a2) << ", " << static_cast<int>(a0.a3) << ", "
1693 << static_cast<int>(a0.a4) << ", " << static_cast<int>(a0.a5) << ", "
1694 << static_cast<int>(a0.a6) << ", " << static_cast<int>(a0.a7) << ", "
1695 << static_cast<int>(a0.a8) << ", " << static_cast<int>(a0.a9) << ", "
1696 << static_cast<int>(a0.a10) << ", " << static_cast<int>(a0.a11) << ", "
1697 << static_cast<int>(a0.a12) << ", " << static_cast<int>(a0.a13) << ", "
1698 << static_cast<int>(a0.a14) << ", " << static_cast<int>(a0.a15) << ", "
1699 << static_cast<int>(a0.a16) << ", " << static_cast<int>(a0.a17) << ", "
1700 << static_cast<int>(a0.a18) << "), (" << static_cast<int>(a1.a0) << ", "
1701 << static_cast<int>(a1.a1) << ", " << static_cast<int>(a1.a2) << ", "
1702 << static_cast<int>(a1.a3) << ", " << static_cast<int>(a1.a4) << ", "
1703 << static_cast<int>(a1.a5) << ", " << static_cast<int>(a1.a6) << ", "
1704 << static_cast<int>(a1.a7) << ", " << static_cast<int>(a1.a8) << ", "
1705 << static_cast<int>(a1.a9) << ", " << static_cast<int>(a1.a10) << ", "
1706 << static_cast<int>(a1.a11) << ", " << static_cast<int>(a1.a12) << ", "
1707 << static_cast<int>(a1.a13) << ", " << static_cast<int>(a1.a14) << ", "
1708 << static_cast<int>(a1.a15) << ", " << static_cast<int>(a1.a16) << ", "
1709 << static_cast<int>(a1.a17) << ", " << static_cast<int>(a1.a18) << "), ("
1710 << static_cast<int>(a2.a0) << ", " << static_cast<int>(a2.a1) << ", "
1711 << static_cast<int>(a2.a2) << ", " << static_cast<int>(a2.a3) << ", "
1712 << static_cast<int>(a2.a4) << ", " << static_cast<int>(a2.a5) << ", "
1713 << static_cast<int>(a2.a6) << ", " << static_cast<int>(a2.a7) << ", "
1714 << static_cast<int>(a2.a8) << ", " << static_cast<int>(a2.a9) << ", "
1715 << static_cast<int>(a2.a10) << ", " << static_cast<int>(a2.a11) << ", "
1716 << static_cast<int>(a2.a12) << ", " << static_cast<int>(a2.a13) << ", "
1717 << static_cast<int>(a2.a14) << ", " << static_cast<int>(a2.a15) << ", "
1718 << static_cast<int>(a2.a16) << ", " << static_cast<int>(a2.a17) << ", "
1719 << static_cast<int>(a2.a18) << "), (" << static_cast<int>(a3.a0) << ", "
1720 << static_cast<int>(a3.a1) << ", " << static_cast<int>(a3.a2) << ", "
1721 << static_cast<int>(a3.a3) << ", " << static_cast<int>(a3.a4) << ", "
1722 << static_cast<int>(a3.a5) << ", " << static_cast<int>(a3.a6) << ", "
1723 << static_cast<int>(a3.a7) << ", " << static_cast<int>(a3.a8) << ", "
1724 << static_cast<int>(a3.a9) << ", " << static_cast<int>(a3.a10) << ", "
1725 << static_cast<int>(a3.a11) << ", " << static_cast<int>(a3.a12) << ", "
1726 << static_cast<int>(a3.a13) << ", " << static_cast<int>(a3.a14) << ", "
1727 << static_cast<int>(a3.a15) << ", " << static_cast<int>(a3.a16) << ", "
1728 << static_cast<int>(a3.a17) << ", " << static_cast<int>(a3.a18) << "), ("
1729 << static_cast<int>(a4.a0) << ", " << static_cast<int>(a4.a1) << ", "
1730 << static_cast<int>(a4.a2) << ", " << static_cast<int>(a4.a3) << ", "
1731 << static_cast<int>(a4.a4) << ", " << static_cast<int>(a4.a5) << ", "
1732 << static_cast<int>(a4.a6) << ", " << static_cast<int>(a4.a7) << ", "
1733 << static_cast<int>(a4.a8) << ", " << static_cast<int>(a4.a9) << ", "
1734 << static_cast<int>(a4.a10) << ", " << static_cast<int>(a4.a11) << ", "
1735 << static_cast<int>(a4.a12) << ", " << static_cast<int>(a4.a13) << ", "
1736 << static_cast<int>(a4.a14) << ", " << static_cast<int>(a4.a15) << ", "
1737 << static_cast<int>(a4.a16) << ", " << static_cast<int>(a4.a17) << ", "
1738 << static_cast<int>(a4.a18) << "), (" << static_cast<int>(a5.a0) << ", "
1739 << static_cast<int>(a5.a1) << ", " << static_cast<int>(a5.a2) << ", "
1740 << static_cast<int>(a5.a3) << ", " << static_cast<int>(a5.a4) << ", "
1741 << static_cast<int>(a5.a5) << ", " << static_cast<int>(a5.a6) << ", "
1742 << static_cast<int>(a5.a7) << ", " << static_cast<int>(a5.a8) << ", "
1743 << static_cast<int>(a5.a9) << ", " << static_cast<int>(a5.a10) << ", "
1744 << static_cast<int>(a5.a11) << ", " << static_cast<int>(a5.a12) << ", "
1745 << static_cast<int>(a5.a13) << ", " << static_cast<int>(a5.a14) << ", "
1746 << static_cast<int>(a5.a15) << ", " << static_cast<int>(a5.a16) << ", "
1747 << static_cast<int>(a5.a17) << ", " << static_cast<int>(a5.a18) << "), ("
1748 << static_cast<int>(a6.a0) << ", " << static_cast<int>(a6.a1) << ", "
1749 << static_cast<int>(a6.a2) << ", " << static_cast<int>(a6.a3) << ", "
1750 << static_cast<int>(a6.a4) << ", " << static_cast<int>(a6.a5) << ", "
1751 << static_cast<int>(a6.a6) << ", " << static_cast<int>(a6.a7) << ", "
1752 << static_cast<int>(a6.a8) << ", " << static_cast<int>(a6.a9) << ", "
1753 << static_cast<int>(a6.a10) << ", " << static_cast<int>(a6.a11) << ", "
1754 << static_cast<int>(a6.a12) << ", " << static_cast<int>(a6.a13) << ", "
1755 << static_cast<int>(a6.a14) << ", " << static_cast<int>(a6.a15) << ", "
1756 << static_cast<int>(a6.a16) << ", " << static_cast<int>(a6.a17) << ", "
1757 << static_cast<int>(a6.a18) << "), (" << static_cast<int>(a7.a0) << ", "
1758 << static_cast<int>(a7.a1) << ", " << static_cast<int>(a7.a2) << ", "
1759 << static_cast<int>(a7.a3) << ", " << static_cast<int>(a7.a4) << ", "
1760 << static_cast<int>(a7.a5) << ", " << static_cast<int>(a7.a6) << ", "
1761 << static_cast<int>(a7.a7) << ", " << static_cast<int>(a7.a8) << ", "
1762 << static_cast<int>(a7.a9) << ", " << static_cast<int>(a7.a10) << ", "
1763 << static_cast<int>(a7.a11) << ", " << static_cast<int>(a7.a12) << ", "
1764 << static_cast<int>(a7.a13) << ", " << static_cast<int>(a7.a14) << ", "
1765 << static_cast<int>(a7.a15) << ", " << static_cast<int>(a7.a16) << ", "
1766 << static_cast<int>(a7.a17) << ", " << static_cast<int>(a7.a18) << "), ("
1767 << static_cast<int>(a8.a0) << ", " << static_cast<int>(a8.a1) << ", "
1768 << static_cast<int>(a8.a2) << ", " << static_cast<int>(a8.a3) << ", "
1769 << static_cast<int>(a8.a4) << ", " << static_cast<int>(a8.a5) << ", "
1770 << static_cast<int>(a8.a6) << ", " << static_cast<int>(a8.a7) << ", "
1771 << static_cast<int>(a8.a8) << ", " << static_cast<int>(a8.a9) << ", "
1772 << static_cast<int>(a8.a10) << ", " << static_cast<int>(a8.a11) << ", "
1773 << static_cast<int>(a8.a12) << ", " << static_cast<int>(a8.a13) << ", "
1774 << static_cast<int>(a8.a14) << ", " << static_cast<int>(a8.a15) << ", "
1775 << static_cast<int>(a8.a16) << ", " << static_cast<int>(a8.a17) << ", "
1776 << static_cast<int>(a8.a18) << "), (" << static_cast<int>(a9.a0) << ", "
1777 << static_cast<int>(a9.a1) << ", " << static_cast<int>(a9.a2) << ", "
1778 << static_cast<int>(a9.a3) << ", " << static_cast<int>(a9.a4) << ", "
1779 << static_cast<int>(a9.a5) << ", " << static_cast<int>(a9.a6) << ", "
1780 << static_cast<int>(a9.a7) << ", " << static_cast<int>(a9.a8) << ", "
1781 << static_cast<int>(a9.a9) << ", " << static_cast<int>(a9.a10) << ", "
1782 << static_cast<int>(a9.a11) << ", " << static_cast<int>(a9.a12) << ", "
1783 << static_cast<int>(a9.a13) << ", " << static_cast<int>(a9.a14) << ", "
1784 << static_cast<int>(a9.a15) << ", " << static_cast<int>(a9.a16) << ", "
1785 << static_cast<int>(a9.a17) << ", " << static_cast<int>(a9.a18) << "))"
1786 << "\n";
1787
1788 int64_t result = 0;
1789
1790 result += a0.a0;
1791 result += a0.a1;
1792 result += a0.a2;
1793 result += a0.a3;
1794 result += a0.a4;
1795 result += a0.a5;
1796 result += a0.a6;
1797 result += a0.a7;
1798 result += a0.a8;
1799 result += a0.a9;
1800 result += a0.a10;
1801 result += a0.a11;
1802 result += a0.a12;
1803 result += a0.a13;
1804 result += a0.a14;
1805 result += a0.a15;
1806 result += a0.a16;
1807 result += a0.a17;
1808 result += a0.a18;
1809 result += a1.a0;
1810 result += a1.a1;
1811 result += a1.a2;
1812 result += a1.a3;
1813 result += a1.a4;
1814 result += a1.a5;
1815 result += a1.a6;
1816 result += a1.a7;
1817 result += a1.a8;
1818 result += a1.a9;
1819 result += a1.a10;
1820 result += a1.a11;
1821 result += a1.a12;
1822 result += a1.a13;
1823 result += a1.a14;
1824 result += a1.a15;
1825 result += a1.a16;
1826 result += a1.a17;
1827 result += a1.a18;
1828 result += a2.a0;
1829 result += a2.a1;
1830 result += a2.a2;
1831 result += a2.a3;
1832 result += a2.a4;
1833 result += a2.a5;
1834 result += a2.a6;
1835 result += a2.a7;
1836 result += a2.a8;
1837 result += a2.a9;
1838 result += a2.a10;
1839 result += a2.a11;
1840 result += a2.a12;
1841 result += a2.a13;
1842 result += a2.a14;
1843 result += a2.a15;
1844 result += a2.a16;
1845 result += a2.a17;
1846 result += a2.a18;
1847 result += a3.a0;
1848 result += a3.a1;
1849 result += a3.a2;
1850 result += a3.a3;
1851 result += a3.a4;
1852 result += a3.a5;
1853 result += a3.a6;
1854 result += a3.a7;
1855 result += a3.a8;
1856 result += a3.a9;
1857 result += a3.a10;
1858 result += a3.a11;
1859 result += a3.a12;
1860 result += a3.a13;
1861 result += a3.a14;
1862 result += a3.a15;
1863 result += a3.a16;
1864 result += a3.a17;
1865 result += a3.a18;
1866 result += a4.a0;
1867 result += a4.a1;
1868 result += a4.a2;
1869 result += a4.a3;
1870 result += a4.a4;
1871 result += a4.a5;
1872 result += a4.a6;
1873 result += a4.a7;
1874 result += a4.a8;
1875 result += a4.a9;
1876 result += a4.a10;
1877 result += a4.a11;
1878 result += a4.a12;
1879 result += a4.a13;
1880 result += a4.a14;
1881 result += a4.a15;
1882 result += a4.a16;
1883 result += a4.a17;
1884 result += a4.a18;
1885 result += a5.a0;
1886 result += a5.a1;
1887 result += a5.a2;
1888 result += a5.a3;
1889 result += a5.a4;
1890 result += a5.a5;
1891 result += a5.a6;
1892 result += a5.a7;
1893 result += a5.a8;
1894 result += a5.a9;
1895 result += a5.a10;
1896 result += a5.a11;
1897 result += a5.a12;
1898 result += a5.a13;
1899 result += a5.a14;
1900 result += a5.a15;
1901 result += a5.a16;
1902 result += a5.a17;
1903 result += a5.a18;
1904 result += a6.a0;
1905 result += a6.a1;
1906 result += a6.a2;
1907 result += a6.a3;
1908 result += a6.a4;
1909 result += a6.a5;
1910 result += a6.a6;
1911 result += a6.a7;
1912 result += a6.a8;
1913 result += a6.a9;
1914 result += a6.a10;
1915 result += a6.a11;
1916 result += a6.a12;
1917 result += a6.a13;
1918 result += a6.a14;
1919 result += a6.a15;
1920 result += a6.a16;
1921 result += a6.a17;
1922 result += a6.a18;
1923 result += a7.a0;
1924 result += a7.a1;
1925 result += a7.a2;
1926 result += a7.a3;
1927 result += a7.a4;
1928 result += a7.a5;
1929 result += a7.a6;
1930 result += a7.a7;
1931 result += a7.a8;
1932 result += a7.a9;
1933 result += a7.a10;
1934 result += a7.a11;
1935 result += a7.a12;
1936 result += a7.a13;
1937 result += a7.a14;
1938 result += a7.a15;
1939 result += a7.a16;
1940 result += a7.a17;
1941 result += a7.a18;
1942 result += a8.a0;
1943 result += a8.a1;
1944 result += a8.a2;
1945 result += a8.a3;
1946 result += a8.a4;
1947 result += a8.a5;
1948 result += a8.a6;
1949 result += a8.a7;
1950 result += a8.a8;
1951 result += a8.a9;
1952 result += a8.a10;
1953 result += a8.a11;
1954 result += a8.a12;
1955 result += a8.a13;
1956 result += a8.a14;
1957 result += a8.a15;
1958 result += a8.a16;
1959 result += a8.a17;
1960 result += a8.a18;
1961 result += a9.a0;
1962 result += a9.a1;
1963 result += a9.a2;
1964 result += a9.a3;
1965 result += a9.a4;
1966 result += a9.a5;
1967 result += a9.a6;
1968 result += a9.a7;
1969 result += a9.a8;
1970 result += a9.a9;
1971 result += a9.a10;
1972 result += a9.a11;
1973 result += a9.a12;
1974 result += a9.a13;
1975 result += a9.a14;
1976 result += a9.a15;
1977 result += a9.a16;
1978 result += a9.a17;
1979 result += a9.a18;
1980
1981 std::cout << "result = " << result << "\n";
1982
1983 return result;
1984}

◆ PassStruct1ByteIntx10()

DART_EXPORT int64_t dart::PassStruct1ByteIntx10 ( Struct1ByteInt  a0,
Struct1ByteInt  a1,
Struct1ByteInt  a2,
Struct1ByteInt  a3,
Struct1ByteInt  a4,
Struct1ByteInt  a5,
Struct1ByteInt  a6,
Struct1ByteInt  a7,
Struct1ByteInt  a8,
Struct1ByteInt  a9 
)

Definition at line 584 of file ffi_test_functions_generated.cc.

593 {
594 std::cout << "PassStruct1ByteIntx10" << "((" << static_cast<int>(a0.a0)
595 << "), (" << static_cast<int>(a1.a0) << "), ("
596 << static_cast<int>(a2.a0) << "), (" << static_cast<int>(a3.a0)
597 << "), (" << static_cast<int>(a4.a0) << "), ("
598 << static_cast<int>(a5.a0) << "), (" << static_cast<int>(a6.a0)
599 << "), (" << static_cast<int>(a7.a0) << "), ("
600 << static_cast<int>(a8.a0) << "), (" << static_cast<int>(a9.a0)
601 << "))" << "\n";
602
603 int64_t result = 0;
604
605 result += a0.a0;
606 result += a1.a0;
607 result += a2.a0;
608 result += a3.a0;
609 result += a4.a0;
610 result += a5.a0;
611 result += a6.a0;
612 result += a7.a0;
613 result += a8.a0;
614 result += a9.a0;
615
616 std::cout << "result = " << result << "\n";
617
618 return result;
619}

◆ PassStruct20BytesHomogeneousFloat()

DART_EXPORT float dart::PassStruct20BytesHomogeneousFloat ( Struct20BytesHomogeneousFloat  a0)

Definition at line 2078 of file ffi_test_functions_generated.cc.

2079 {
2080 std::cout << "PassStruct20BytesHomogeneousFloat" << "((" << a0.a0 << ", "
2081 << a0.a1 << ", " << a0.a2 << ", " << a0.a3 << ", " << a0.a4 << "))"
2082 << "\n";
2083
2084 float result = 0;
2085
2086 result += a0.a0;
2087 result += a0.a1;
2088 result += a0.a2;
2089 result += a0.a3;
2090 result += a0.a4;
2091
2092 std::cout << "result = " << result << "\n";
2093
2094 return result;
2095}

◆ PassStruct20BytesHomogeneousInt32x10()

Definition at line 1992 of file ffi_test_functions_generated.cc.

2001 {
2002 std::cout << "PassStruct20BytesHomogeneousInt32x10" << "((" << a0.a0 << ", "
2003 << a0.a1 << ", " << a0.a2 << ", " << a0.a3 << ", " << a0.a4
2004 << "), (" << a1.a0 << ", " << a1.a1 << ", " << a1.a2 << ", "
2005 << a1.a3 << ", " << a1.a4 << "), (" << a2.a0 << ", " << a2.a1
2006 << ", " << a2.a2 << ", " << a2.a3 << ", " << a2.a4 << "), ("
2007 << a3.a0 << ", " << a3.a1 << ", " << a3.a2 << ", " << a3.a3 << ", "
2008 << a3.a4 << "), (" << a4.a0 << ", " << a4.a1 << ", " << a4.a2
2009 << ", " << a4.a3 << ", " << a4.a4 << "), (" << a5.a0 << ", "
2010 << a5.a1 << ", " << a5.a2 << ", " << a5.a3 << ", " << a5.a4
2011 << "), (" << a6.a0 << ", " << a6.a1 << ", " << a6.a2 << ", "
2012 << a6.a3 << ", " << a6.a4 << "), (" << a7.a0 << ", " << a7.a1
2013 << ", " << a7.a2 << ", " << a7.a3 << ", " << a7.a4 << "), ("
2014 << a8.a0 << ", " << a8.a1 << ", " << a8.a2 << ", " << a8.a3 << ", "
2015 << a8.a4 << "), (" << a9.a0 << ", " << a9.a1 << ", " << a9.a2
2016 << ", " << a9.a3 << ", " << a9.a4 << "))" << "\n";
2017
2018 int32_t result = 0;
2019
2020 result += a0.a0;
2021 result += a0.a1;
2022 result += a0.a2;
2023 result += a0.a3;
2024 result += a0.a4;
2025 result += a1.a0;
2026 result += a1.a1;
2027 result += a1.a2;
2028 result += a1.a3;
2029 result += a1.a4;
2030 result += a2.a0;
2031 result += a2.a1;
2032 result += a2.a2;
2033 result += a2.a3;
2034 result += a2.a4;
2035 result += a3.a0;
2036 result += a3.a1;
2037 result += a3.a2;
2038 result += a3.a3;
2039 result += a3.a4;
2040 result += a4.a0;
2041 result += a4.a1;
2042 result += a4.a2;
2043 result += a4.a3;
2044 result += a4.a4;
2045 result += a5.a0;
2046 result += a5.a1;
2047 result += a5.a2;
2048 result += a5.a3;
2049 result += a5.a4;
2050 result += a6.a0;
2051 result += a6.a1;
2052 result += a6.a2;
2053 result += a6.a3;
2054 result += a6.a4;
2055 result += a7.a0;
2056 result += a7.a1;
2057 result += a7.a2;
2058 result += a7.a3;
2059 result += a7.a4;
2060 result += a8.a0;
2061 result += a8.a1;
2062 result += a8.a2;
2063 result += a8.a3;
2064 result += a8.a4;
2065 result += a9.a0;
2066 result += a9.a1;
2067 result += a9.a2;
2068 result += a9.a3;
2069 result += a9.a4;
2070
2071 std::cout << "result = " << result << "\n";
2072
2073 return result;
2074}

◆ PassStruct32BytesHomogeneousDoublex5()

Definition at line 2100 of file ffi_test_functions_generated.cc.

2105 {
2106 std::cout << "PassStruct32BytesHomogeneousDoublex5" << "((" << a0.a0 << ", "
2107 << a0.a1 << ", " << a0.a2 << ", " << a0.a3 << "), (" << a1.a0
2108 << ", " << a1.a1 << ", " << a1.a2 << ", " << a1.a3 << "), ("
2109 << a2.a0 << ", " << a2.a1 << ", " << a2.a2 << ", " << a2.a3
2110 << "), (" << a3.a0 << ", " << a3.a1 << ", " << a3.a2 << ", "
2111 << a3.a3 << "), (" << a4.a0 << ", " << a4.a1 << ", " << a4.a2
2112 << ", " << a4.a3 << "))" << "\n";
2113
2114 double result = 0;
2115
2116 result += a0.a0;
2117 result += a0.a1;
2118 result += a0.a2;
2119 result += a0.a3;
2120 result += a1.a0;
2121 result += a1.a1;
2122 result += a1.a2;
2123 result += a1.a3;
2124 result += a2.a0;
2125 result += a2.a1;
2126 result += a2.a2;
2127 result += a2.a3;
2128 result += a3.a0;
2129 result += a3.a1;
2130 result += a3.a2;
2131 result += a3.a3;
2132 result += a4.a0;
2133 result += a4.a1;
2134 result += a4.a2;
2135 result += a4.a3;
2136
2137 std::cout << "result = " << result << "\n";
2138
2139 return result;
2140}

◆ PassStruct32BytesNestedIntx2()

DART_EXPORT int64_t dart::PassStruct32BytesNestedIntx2 ( Struct32BytesNestedInt  a0,
Struct32BytesNestedInt  a1 
)

Definition at line 3053 of file ffi_test_functions_generated.cc.

3054 {
3055 std::cout << "PassStruct32BytesNestedIntx2" << "(((((" << a0.a0.a0.a0.a0
3056 << ", " << a0.a0.a0.a0.a1 << "), (" << a0.a0.a0.a1.a0 << ", "
3057 << a0.a0.a0.a1.a1 << ")), ((" << a0.a0.a1.a0.a0 << ", "
3058 << a0.a0.a1.a0.a1 << "), (" << a0.a0.a1.a1.a0 << ", "
3059 << a0.a0.a1.a1.a1 << "))), (((" << a0.a1.a0.a0.a0 << ", "
3060 << a0.a1.a0.a0.a1 << "), (" << a0.a1.a0.a1.a0 << ", "
3061 << a0.a1.a0.a1.a1 << ")), ((" << a0.a1.a1.a0.a0 << ", "
3062 << a0.a1.a1.a0.a1 << "), (" << a0.a1.a1.a1.a0 << ", "
3063 << a0.a1.a1.a1.a1 << ")))), ((((" << a1.a0.a0.a0.a0 << ", "
3064 << a1.a0.a0.a0.a1 << "), (" << a1.a0.a0.a1.a0 << ", "
3065 << a1.a0.a0.a1.a1 << ")), ((" << a1.a0.a1.a0.a0 << ", "
3066 << a1.a0.a1.a0.a1 << "), (" << a1.a0.a1.a1.a0 << ", "
3067 << a1.a0.a1.a1.a1 << "))), (((" << a1.a1.a0.a0.a0 << ", "
3068 << a1.a1.a0.a0.a1 << "), (" << a1.a1.a0.a1.a0 << ", "
3069 << a1.a1.a0.a1.a1 << ")), ((" << a1.a1.a1.a0.a0 << ", "
3070 << a1.a1.a1.a0.a1 << "), (" << a1.a1.a1.a1.a0 << ", "
3071 << a1.a1.a1.a1.a1 << ")))))" << "\n";
3072
3073 int64_t result = 0;
3074
3075 result += a0.a0.a0.a0.a0;
3076 result += a0.a0.a0.a0.a1;
3077 result += a0.a0.a0.a1.a0;
3078 result += a0.a0.a0.a1.a1;
3079 result += a0.a0.a1.a0.a0;
3080 result += a0.a0.a1.a0.a1;
3081 result += a0.a0.a1.a1.a0;
3082 result += a0.a0.a1.a1.a1;
3083 result += a0.a1.a0.a0.a0;
3084 result += a0.a1.a0.a0.a1;
3085 result += a0.a1.a0.a1.a0;
3086 result += a0.a1.a0.a1.a1;
3087 result += a0.a1.a1.a0.a0;
3088 result += a0.a1.a1.a0.a1;
3089 result += a0.a1.a1.a1.a0;
3090 result += a0.a1.a1.a1.a1;
3091 result += a1.a0.a0.a0.a0;
3092 result += a1.a0.a0.a0.a1;
3093 result += a1.a0.a0.a1.a0;
3094 result += a1.a0.a0.a1.a1;
3095 result += a1.a0.a1.a0.a0;
3096 result += a1.a0.a1.a0.a1;
3097 result += a1.a0.a1.a1.a0;
3098 result += a1.a0.a1.a1.a1;
3099 result += a1.a1.a0.a0.a0;
3100 result += a1.a1.a0.a0.a1;
3101 result += a1.a1.a0.a1.a0;
3102 result += a1.a1.a0.a1.a1;
3103 result += a1.a1.a1.a0.a0;
3104 result += a1.a1.a1.a0.a1;
3105 result += a1.a1.a1.a1.a0;
3106 result += a1.a1.a1.a1.a1;
3107
3108 std::cout << "result = " << result << "\n";
3109
3110 return result;
3111}

◆ PassStruct3BytesHomogeneousUint8x10()

Definition at line 625 of file ffi_test_functions_generated.cc.

634 {
635 std::cout << "PassStruct3BytesHomogeneousUint8x10" << "(("
636 << static_cast<int>(a0.a0) << ", " << static_cast<int>(a0.a1)
637 << ", " << static_cast<int>(a0.a2) << "), ("
638 << static_cast<int>(a1.a0) << ", " << static_cast<int>(a1.a1)
639 << ", " << static_cast<int>(a1.a2) << "), ("
640 << static_cast<int>(a2.a0) << ", " << static_cast<int>(a2.a1)
641 << ", " << static_cast<int>(a2.a2) << "), ("
642 << static_cast<int>(a3.a0) << ", " << static_cast<int>(a3.a1)
643 << ", " << static_cast<int>(a3.a2) << "), ("
644 << static_cast<int>(a4.a0) << ", " << static_cast<int>(a4.a1)
645 << ", " << static_cast<int>(a4.a2) << "), ("
646 << static_cast<int>(a5.a0) << ", " << static_cast<int>(a5.a1)
647 << ", " << static_cast<int>(a5.a2) << "), ("
648 << static_cast<int>(a6.a0) << ", " << static_cast<int>(a6.a1)
649 << ", " << static_cast<int>(a6.a2) << "), ("
650 << static_cast<int>(a7.a0) << ", " << static_cast<int>(a7.a1)
651 << ", " << static_cast<int>(a7.a2) << "), ("
652 << static_cast<int>(a8.a0) << ", " << static_cast<int>(a8.a1)
653 << ", " << static_cast<int>(a8.a2) << "), ("
654 << static_cast<int>(a9.a0) << ", " << static_cast<int>(a9.a1)
655 << ", " << static_cast<int>(a9.a2) << "))" << "\n";
656
657 int64_t result = 0;
658
659 result += a0.a0;
660 result += a0.a1;
661 result += a0.a2;
662 result += a1.a0;
663 result += a1.a1;
664 result += a1.a2;
665 result += a2.a0;
666 result += a2.a1;
667 result += a2.a2;
668 result += a3.a0;
669 result += a3.a1;
670 result += a3.a2;
671 result += a4.a0;
672 result += a4.a1;
673 result += a4.a2;
674 result += a5.a0;
675 result += a5.a1;
676 result += a5.a2;
677 result += a6.a0;
678 result += a6.a1;
679 result += a6.a2;
680 result += a7.a0;
681 result += a7.a1;
682 result += a7.a2;
683 result += a8.a0;
684 result += a8.a1;
685 result += a8.a2;
686 result += a9.a0;
687 result += a9.a1;
688 result += a9.a2;
689
690 std::cout << "result = " << result << "\n";
691
692 return result;
693}

◆ PassStruct3BytesInt2ByteAlignedx10()

Definition at line 700 of file ffi_test_functions_generated.cc.

709 {
710 std::cout << "PassStruct3BytesInt2ByteAlignedx10" << "((" << a0.a0 << ", "
711 << static_cast<int>(a0.a1) << "), (" << a1.a0 << ", "
712 << static_cast<int>(a1.a1) << "), (" << a2.a0 << ", "
713 << static_cast<int>(a2.a1) << "), (" << a3.a0 << ", "
714 << static_cast<int>(a3.a1) << "), (" << a4.a0 << ", "
715 << static_cast<int>(a4.a1) << "), (" << a5.a0 << ", "
716 << static_cast<int>(a5.a1) << "), (" << a6.a0 << ", "
717 << static_cast<int>(a6.a1) << "), (" << a7.a0 << ", "
718 << static_cast<int>(a7.a1) << "), (" << a8.a0 << ", "
719 << static_cast<int>(a8.a1) << "), (" << a9.a0 << ", "
720 << static_cast<int>(a9.a1) << "))" << "\n";
721
722 int64_t result = 0;
723
724 result += a0.a0;
725 result += a0.a1;
726 result += a1.a0;
727 result += a1.a1;
728 result += a2.a0;
729 result += a2.a1;
730 result += a3.a0;
731 result += a3.a1;
732 result += a4.a0;
733 result += a4.a1;
734 result += a5.a0;
735 result += a5.a1;
736 result += a6.a0;
737 result += a6.a1;
738 result += a7.a0;
739 result += a7.a1;
740 result += a8.a0;
741 result += a8.a1;
742 result += a9.a0;
743 result += a9.a1;
744
745 std::cout << "result = " << result << "\n";
746
747 return result;
748}

◆ PassStruct3BytesPackedIntx10()

Definition at line 4052 of file ffi_test_functions_generated.cc.

4061 {
4062 std::cout << "PassStruct3BytesPackedIntx10" << "((" << static_cast<int>(a0.a0)
4063 << ", " << a0.a1 << "), (" << static_cast<int>(a1.a0) << ", "
4064 << a1.a1 << "), (" << static_cast<int>(a2.a0) << ", " << a2.a1
4065 << "), (" << static_cast<int>(a3.a0) << ", " << a3.a1 << "), ("
4066 << static_cast<int>(a4.a0) << ", " << a4.a1 << "), ("
4067 << static_cast<int>(a5.a0) << ", " << a5.a1 << "), ("
4068 << static_cast<int>(a6.a0) << ", " << a6.a1 << "), ("
4069 << static_cast<int>(a7.a0) << ", " << a7.a1 << "), ("
4070 << static_cast<int>(a8.a0) << ", " << a8.a1 << "), ("
4071 << static_cast<int>(a9.a0) << ", " << a9.a1 << "))" << "\n";
4072
4073 int64_t result = 0;
4074
4075 result += a0.a0;
4076 result += a0.a1;
4077 result += a1.a0;
4078 result += a1.a1;
4079 result += a2.a0;
4080 result += a2.a1;
4081 result += a3.a0;
4082 result += a3.a1;
4083 result += a4.a0;
4084 result += a4.a1;
4085 result += a5.a0;
4086 result += a5.a1;
4087 result += a6.a0;
4088 result += a6.a1;
4089 result += a7.a0;
4090 result += a7.a1;
4091 result += a8.a0;
4092 result += a8.a1;
4093 result += a9.a0;
4094 result += a9.a1;
4095
4096 std::cout << "result = " << result << "\n";
4097
4098 return result;
4099}

◆ PassStruct40BytesHomogeneousDouble()

DART_EXPORT double dart::PassStruct40BytesHomogeneousDouble ( Struct40BytesHomogeneousDouble  a0)

Definition at line 2144 of file ffi_test_functions_generated.cc.

2145 {
2146 std::cout << "PassStruct40BytesHomogeneousDouble" << "((" << a0.a0 << ", "
2147 << a0.a1 << ", " << a0.a2 << ", " << a0.a3 << ", " << a0.a4 << "))"
2148 << "\n";
2149
2150 double result = 0;
2151
2152 result += a0.a0;
2153 result += a0.a1;
2154 result += a0.a2;
2155 result += a0.a3;
2156 result += a0.a4;
2157
2158 std::cout << "result = " << result << "\n";
2159
2160 return result;
2161}

◆ PassStruct40BytesHomogeneousDoubleStruct4BytesHomo()

DART_EXPORT double dart::PassStruct40BytesHomogeneousDoubleStruct4BytesHomo ( Struct40BytesHomogeneousDouble  a0,
Struct4BytesHomogeneousInt16  a1,
Struct8BytesHomogeneousFloat  a2 
)

Definition at line 2571 of file ffi_test_functions_generated.cc.

2574 {
2575 std::cout << "PassStruct40BytesHomogeneousDoubleStruct4BytesHomo" << "(("
2576 << a0.a0 << ", " << a0.a1 << ", " << a0.a2 << ", " << a0.a3 << ", "
2577 << a0.a4 << "), (" << a1.a0 << ", " << a1.a1 << "), (" << a2.a0
2578 << ", " << a2.a1 << "))" << "\n";
2579
2580 double result = 0;
2581
2582 result += a0.a0;
2583 result += a0.a1;
2584 result += a0.a2;
2585 result += a0.a3;
2586 result += a0.a4;
2587 result += a1.a0;
2588 result += a1.a1;
2589 result += a2.a0;
2590 result += a2.a1;
2591
2592 std::cout << "result = " << result << "\n";
2593
2594 return result;
2595}

◆ PassStruct4BytesHomogeneousInt16x10()

Definition at line 754 of file ffi_test_functions_generated.cc.

763 {
764 std::cout << "PassStruct4BytesHomogeneousInt16x10" << "((" << a0.a0 << ", "
765 << a0.a1 << "), (" << a1.a0 << ", " << a1.a1 << "), (" << a2.a0
766 << ", " << a2.a1 << "), (" << a3.a0 << ", " << a3.a1 << "), ("
767 << a4.a0 << ", " << a4.a1 << "), (" << a5.a0 << ", " << a5.a1
768 << "), (" << a6.a0 << ", " << a6.a1 << "), (" << a7.a0 << ", "
769 << a7.a1 << "), (" << a8.a0 << ", " << a8.a1 << "), (" << a9.a0
770 << ", " << a9.a1 << "))" << "\n";
771
772 int64_t result = 0;
773
774 result += a0.a0;
775 result += a0.a1;
776 result += a1.a0;
777 result += a1.a1;
778 result += a2.a0;
779 result += a2.a1;
780 result += a3.a0;
781 result += a3.a1;
782 result += a4.a0;
783 result += a4.a1;
784 result += a5.a0;
785 result += a5.a1;
786 result += a6.a0;
787 result += a6.a1;
788 result += a7.a0;
789 result += a7.a1;
790 result += a8.a0;
791 result += a8.a1;
792 result += a9.a0;
793 result += a9.a1;
794
795 std::cout << "result = " << result << "\n";
796
797 return result;
798}

◆ PassStruct5BytesPackedMixed()

DART_EXPORT double dart::PassStruct5BytesPackedMixed ( Struct5BytesPackedMixed  a0)

Definition at line 4265 of file ffi_test_functions_generated.cc.

4265 {
4266 std::cout << "PassStruct5BytesPackedMixed" << "((" << a0.a0 << ", "
4267 << static_cast<int>(a0.a1) << "))" << "\n";
4268
4269 double result = 0;
4270
4271 result += a0.a0;
4272 result += a0.a1;
4273
4274 std::cout << "result = " << result << "\n";
4275
4276 return result;
4277}

◆ PassStruct6BytesInlineArrayInt()

DART_EXPORT double dart::PassStruct6BytesInlineArrayInt ( Struct6BytesInlineArrayInt  a0)

Definition at line 4300 of file ffi_test_functions_generated.cc.

4301 {
4302 std::cout << "PassStruct6BytesInlineArrayInt" << "(([("
4303 << static_cast<int>(a0.a0[0].a0) << ", " << a0.a0[0].a1 << "), ("
4304 << static_cast<int>(a0.a0[1].a0) << ", " << a0.a0[1].a1 << ")]))"
4305 << "\n";
4306
4307 double result = 0;
4308
4309 result += a0.a0[0].a0;
4310 result += a0.a0[0].a1;
4311 result += a0.a0[1].a0;
4312 result += a0.a0[1].a1;
4313
4314 std::cout << "result = " << result << "\n";
4315
4316 return result;
4317}
Struct3BytesPackedIntMembersAligned a0[2]

◆ PassStruct7BytesHomogeneousUint8x10()

Definition at line 804 of file ffi_test_functions_generated.cc.

813 {
814 std::cout
815 << "PassStruct7BytesHomogeneousUint8x10" << "(("
816 << static_cast<int>(a0.a0) << ", " << static_cast<int>(a0.a1) << ", "
817 << static_cast<int>(a0.a2) << ", " << static_cast<int>(a0.a3) << ", "
818 << static_cast<int>(a0.a4) << ", " << static_cast<int>(a0.a5) << ", "
819 << static_cast<int>(a0.a6) << "), (" << static_cast<int>(a1.a0) << ", "
820 << static_cast<int>(a1.a1) << ", " << static_cast<int>(a1.a2) << ", "
821 << static_cast<int>(a1.a3) << ", " << static_cast<int>(a1.a4) << ", "
822 << static_cast<int>(a1.a5) << ", " << static_cast<int>(a1.a6) << "), ("
823 << static_cast<int>(a2.a0) << ", " << static_cast<int>(a2.a1) << ", "
824 << static_cast<int>(a2.a2) << ", " << static_cast<int>(a2.a3) << ", "
825 << static_cast<int>(a2.a4) << ", " << static_cast<int>(a2.a5) << ", "
826 << static_cast<int>(a2.a6) << "), (" << static_cast<int>(a3.a0) << ", "
827 << static_cast<int>(a3.a1) << ", " << static_cast<int>(a3.a2) << ", "
828 << static_cast<int>(a3.a3) << ", " << static_cast<int>(a3.a4) << ", "
829 << static_cast<int>(a3.a5) << ", " << static_cast<int>(a3.a6) << "), ("
830 << static_cast<int>(a4.a0) << ", " << static_cast<int>(a4.a1) << ", "
831 << static_cast<int>(a4.a2) << ", " << static_cast<int>(a4.a3) << ", "
832 << static_cast<int>(a4.a4) << ", " << static_cast<int>(a4.a5) << ", "
833 << static_cast<int>(a4.a6) << "), (" << static_cast<int>(a5.a0) << ", "
834 << static_cast<int>(a5.a1) << ", " << static_cast<int>(a5.a2) << ", "
835 << static_cast<int>(a5.a3) << ", " << static_cast<int>(a5.a4) << ", "
836 << static_cast<int>(a5.a5) << ", " << static_cast<int>(a5.a6) << "), ("
837 << static_cast<int>(a6.a0) << ", " << static_cast<int>(a6.a1) << ", "
838 << static_cast<int>(a6.a2) << ", " << static_cast<int>(a6.a3) << ", "
839 << static_cast<int>(a6.a4) << ", " << static_cast<int>(a6.a5) << ", "
840 << static_cast<int>(a6.a6) << "), (" << static_cast<int>(a7.a0) << ", "
841 << static_cast<int>(a7.a1) << ", " << static_cast<int>(a7.a2) << ", "
842 << static_cast<int>(a7.a3) << ", " << static_cast<int>(a7.a4) << ", "
843 << static_cast<int>(a7.a5) << ", " << static_cast<int>(a7.a6) << "), ("
844 << static_cast<int>(a8.a0) << ", " << static_cast<int>(a8.a1) << ", "
845 << static_cast<int>(a8.a2) << ", " << static_cast<int>(a8.a3) << ", "
846 << static_cast<int>(a8.a4) << ", " << static_cast<int>(a8.a5) << ", "
847 << static_cast<int>(a8.a6) << "), (" << static_cast<int>(a9.a0) << ", "
848 << static_cast<int>(a9.a1) << ", " << static_cast<int>(a9.a2) << ", "
849 << static_cast<int>(a9.a3) << ", " << static_cast<int>(a9.a4) << ", "
850 << static_cast<int>(a9.a5) << ", " << static_cast<int>(a9.a6) << "))"
851 << "\n";
852
853 int64_t result = 0;
854
855 result += a0.a0;
856 result += a0.a1;
857 result += a0.a2;
858 result += a0.a3;
859 result += a0.a4;
860 result += a0.a5;
861 result += a0.a6;
862 result += a1.a0;
863 result += a1.a1;
864 result += a1.a2;
865 result += a1.a3;
866 result += a1.a4;
867 result += a1.a5;
868 result += a1.a6;
869 result += a2.a0;
870 result += a2.a1;
871 result += a2.a2;
872 result += a2.a3;
873 result += a2.a4;
874 result += a2.a5;
875 result += a2.a6;
876 result += a3.a0;
877 result += a3.a1;
878 result += a3.a2;
879 result += a3.a3;
880 result += a3.a4;
881 result += a3.a5;
882 result += a3.a6;
883 result += a4.a0;
884 result += a4.a1;
885 result += a4.a2;
886 result += a4.a3;
887 result += a4.a4;
888 result += a4.a5;
889 result += a4.a6;
890 result += a5.a0;
891 result += a5.a1;
892 result += a5.a2;
893 result += a5.a3;
894 result += a5.a4;
895 result += a5.a5;
896 result += a5.a6;
897 result += a6.a0;
898 result += a6.a1;
899 result += a6.a2;
900 result += a6.a3;
901 result += a6.a4;
902 result += a6.a5;
903 result += a6.a6;
904 result += a7.a0;
905 result += a7.a1;
906 result += a7.a2;
907 result += a7.a3;
908 result += a7.a4;
909 result += a7.a5;
910 result += a7.a6;
911 result += a8.a0;
912 result += a8.a1;
913 result += a8.a2;
914 result += a8.a3;
915 result += a8.a4;
916 result += a8.a5;
917 result += a8.a6;
918 result += a9.a0;
919 result += a9.a1;
920 result += a9.a2;
921 result += a9.a3;
922 result += a9.a4;
923 result += a9.a5;
924 result += a9.a6;
925
926 std::cout << "result = " << result << "\n";
927
928 return result;
929}

◆ PassStruct7BytesInt4ByteAlignedx10()

Definition at line 936 of file ffi_test_functions_generated.cc.

945 {
946 std::cout << "PassStruct7BytesInt4ByteAlignedx10" << "((" << a0.a0 << ", "
947 << a0.a1 << ", " << static_cast<int>(a0.a2) << "), (" << a1.a0
948 << ", " << a1.a1 << ", " << static_cast<int>(a1.a2) << "), ("
949 << a2.a0 << ", " << a2.a1 << ", " << static_cast<int>(a2.a2)
950 << "), (" << a3.a0 << ", " << a3.a1 << ", "
951 << static_cast<int>(a3.a2) << "), (" << a4.a0 << ", " << a4.a1
952 << ", " << static_cast<int>(a4.a2) << "), (" << a5.a0 << ", "
953 << a5.a1 << ", " << static_cast<int>(a5.a2) << "), (" << a6.a0
954 << ", " << a6.a1 << ", " << static_cast<int>(a6.a2) << "), ("
955 << a7.a0 << ", " << a7.a1 << ", " << static_cast<int>(a7.a2)
956 << "), (" << a8.a0 << ", " << a8.a1 << ", "
957 << static_cast<int>(a8.a2) << "), (" << a9.a0 << ", " << a9.a1
958 << ", " << static_cast<int>(a9.a2) << "))" << "\n";
959
960 int64_t result = 0;
961
962 result += a0.a0;
963 result += a0.a1;
964 result += a0.a2;
965 result += a1.a0;
966 result += a1.a1;
967 result += a1.a2;
968 result += a2.a0;
969 result += a2.a1;
970 result += a2.a2;
971 result += a3.a0;
972 result += a3.a1;
973 result += a3.a2;
974 result += a4.a0;
975 result += a4.a1;
976 result += a4.a2;
977 result += a5.a0;
978 result += a5.a1;
979 result += a5.a2;
980 result += a6.a0;
981 result += a6.a1;
982 result += a6.a2;
983 result += a7.a0;
984 result += a7.a1;
985 result += a7.a2;
986 result += a8.a0;
987 result += a8.a1;
988 result += a8.a2;
989 result += a9.a0;
990 result += a9.a1;
991 result += a9.a2;
992
993 std::cout << "result = " << result << "\n";
994
995 return result;
996}

◆ PassStruct8BytesHomogeneousFloatx10()

Definition at line 1063 of file ffi_test_functions_generated.cc.

1073 {
1074 std::cout << "PassStruct8BytesHomogeneousFloatx10" << "((" << a0.a0 << ", "
1075 << a0.a1 << "), (" << a1.a0 << ", " << a1.a1 << "), (" << a2.a0
1076 << ", " << a2.a1 << "), (" << a3.a0 << ", " << a3.a1 << "), ("
1077 << a4.a0 << ", " << a4.a1 << "), (" << a5.a0 << ", " << a5.a1
1078 << "), (" << a6.a0 << ", " << a6.a1 << "), (" << a7.a0 << ", "
1079 << a7.a1 << "), (" << a8.a0 << ", " << a8.a1 << "), (" << a9.a0
1080 << ", " << a9.a1 << "))" << "\n";
1081
1082 float result = 0;
1083
1084 result += a0.a0;
1085 result += a0.a1;
1086 result += a1.a0;
1087 result += a1.a1;
1088 result += a2.a0;
1089 result += a2.a1;
1090 result += a3.a0;
1091 result += a3.a1;
1092 result += a4.a0;
1093 result += a4.a1;
1094 result += a5.a0;
1095 result += a5.a1;
1096 result += a6.a0;
1097 result += a6.a1;
1098 result += a7.a0;
1099 result += a7.a1;
1100 result += a8.a0;
1101 result += a8.a1;
1102 result += a9.a0;
1103 result += a9.a1;
1104
1105 std::cout << "result = " << result << "\n";
1106
1107 return result;
1108}

◆ PassStruct8BytesInlineArrayIntx4()

DART_EXPORT int32_t dart::PassStruct8BytesInlineArrayIntx4 ( Struct8BytesInlineArrayInt  a0,
Struct8BytesInlineArrayInt  a1,
Struct8BytesInlineArrayInt  a2,
Struct8BytesInlineArrayInt  a3 
)

Definition at line 3396 of file ffi_test_functions_generated.cc.

3399 {
3400 std::cout << "PassStruct8BytesInlineArrayIntx4" << "((["
3401 << static_cast<int>(a0.a0[0]) << ", " << static_cast<int>(a0.a0[1])
3402 << ", " << static_cast<int>(a0.a0[2]) << ", "
3403 << static_cast<int>(a0.a0[3]) << ", " << static_cast<int>(a0.a0[4])
3404 << ", " << static_cast<int>(a0.a0[5]) << ", "
3405 << static_cast<int>(a0.a0[6]) << ", " << static_cast<int>(a0.a0[7])
3406 << "]), ([" << static_cast<int>(a1.a0[0]) << ", "
3407 << static_cast<int>(a1.a0[1]) << ", " << static_cast<int>(a1.a0[2])
3408 << ", " << static_cast<int>(a1.a0[3]) << ", "
3409 << static_cast<int>(a1.a0[4]) << ", " << static_cast<int>(a1.a0[5])
3410 << ", " << static_cast<int>(a1.a0[6]) << ", "
3411 << static_cast<int>(a1.a0[7]) << "]), (["
3412 << static_cast<int>(a2.a0[0]) << ", " << static_cast<int>(a2.a0[1])
3413 << ", " << static_cast<int>(a2.a0[2]) << ", "
3414 << static_cast<int>(a2.a0[3]) << ", " << static_cast<int>(a2.a0[4])
3415 << ", " << static_cast<int>(a2.a0[5]) << ", "
3416 << static_cast<int>(a2.a0[6]) << ", " << static_cast<int>(a2.a0[7])
3417 << "]), ([" << static_cast<int>(a3.a0[0]) << ", "
3418 << static_cast<int>(a3.a0[1]) << ", " << static_cast<int>(a3.a0[2])
3419 << ", " << static_cast<int>(a3.a0[3]) << ", "
3420 << static_cast<int>(a3.a0[4]) << ", " << static_cast<int>(a3.a0[5])
3421 << ", " << static_cast<int>(a3.a0[6]) << ", "
3422 << static_cast<int>(a3.a0[7]) << "]))" << "\n";
3423
3424 int32_t result = 0;
3425
3426 result += a0.a0[0];
3427 result += a0.a0[1];
3428 result += a0.a0[2];
3429 result += a0.a0[3];
3430 result += a0.a0[4];
3431 result += a0.a0[5];
3432 result += a0.a0[6];
3433 result += a0.a0[7];
3434 result += a1.a0[0];
3435 result += a1.a0[1];
3436 result += a1.a0[2];
3437 result += a1.a0[3];
3438 result += a1.a0[4];
3439 result += a1.a0[5];
3440 result += a1.a0[6];
3441 result += a1.a0[7];
3442 result += a2.a0[0];
3443 result += a2.a0[1];
3444 result += a2.a0[2];
3445 result += a2.a0[3];
3446 result += a2.a0[4];
3447 result += a2.a0[5];
3448 result += a2.a0[6];
3449 result += a2.a0[7];
3450 result += a3.a0[0];
3451 result += a3.a0[1];
3452 result += a3.a0[2];
3453 result += a3.a0[3];
3454 result += a3.a0[4];
3455 result += a3.a0[5];
3456 result += a3.a0[6];
3457 result += a3.a0[7];
3458
3459 std::cout << "result = " << result << "\n";
3460
3461 return result;
3462}

◆ PassStruct8BytesIntx10()

DART_EXPORT int64_t dart::PassStruct8BytesIntx10 ( Struct8BytesInt  a0,
Struct8BytesInt  a1,
Struct8BytesInt  a2,
Struct8BytesInt  a3,
Struct8BytesInt  a4,
Struct8BytesInt  a5,
Struct8BytesInt  a6,
Struct8BytesInt  a7,
Struct8BytesInt  a8,
Struct8BytesInt  a9 
)

Definition at line 1001 of file ffi_test_functions_generated.cc.

1010 {
1011 std::cout << "PassStruct8BytesIntx10" << "((" << a0.a0 << ", " << a0.a1
1012 << ", " << a0.a2 << "), (" << a1.a0 << ", " << a1.a1 << ", "
1013 << a1.a2 << "), (" << a2.a0 << ", " << a2.a1 << ", " << a2.a2
1014 << "), (" << a3.a0 << ", " << a3.a1 << ", " << a3.a2 << "), ("
1015 << a4.a0 << ", " << a4.a1 << ", " << a4.a2 << "), (" << a5.a0
1016 << ", " << a5.a1 << ", " << a5.a2 << "), (" << a6.a0 << ", "
1017 << a6.a1 << ", " << a6.a2 << "), (" << a7.a0 << ", " << a7.a1
1018 << ", " << a7.a2 << "), (" << a8.a0 << ", " << a8.a1 << ", "
1019 << a8.a2 << "), (" << a9.a0 << ", " << a9.a1 << ", " << a9.a2
1020 << "))" << "\n";
1021
1022 int64_t result = 0;
1023
1024 result += a0.a0;
1025 result += a0.a1;
1026 result += a0.a2;
1027 result += a1.a0;
1028 result += a1.a1;
1029 result += a1.a2;
1030 result += a2.a0;
1031 result += a2.a1;
1032 result += a2.a2;
1033 result += a3.a0;
1034 result += a3.a1;
1035 result += a3.a2;
1036 result += a4.a0;
1037 result += a4.a1;
1038 result += a4.a2;
1039 result += a5.a0;
1040 result += a5.a1;
1041 result += a5.a2;
1042 result += a6.a0;
1043 result += a6.a1;
1044 result += a6.a2;
1045 result += a7.a0;
1046 result += a7.a1;
1047 result += a7.a2;
1048 result += a8.a0;
1049 result += a8.a1;
1050 result += a8.a2;
1051 result += a9.a0;
1052 result += a9.a1;
1053 result += a9.a2;
1054
1055 std::cout << "result = " << result << "\n";
1056
1057 return result;
1058}

◆ PassStruct8BytesMixedx10()

Definition at line 1113 of file ffi_test_functions_generated.cc.

1122 {
1123 std::cout << "PassStruct8BytesMixedx10" << "((" << a0.a0 << ", " << a0.a1
1124 << ", " << a0.a2 << "), (" << a1.a0 << ", " << a1.a1 << ", "
1125 << a1.a2 << "), (" << a2.a0 << ", " << a2.a1 << ", " << a2.a2
1126 << "), (" << a3.a0 << ", " << a3.a1 << ", " << a3.a2 << "), ("
1127 << a4.a0 << ", " << a4.a1 << ", " << a4.a2 << "), (" << a5.a0
1128 << ", " << a5.a1 << ", " << a5.a2 << "), (" << a6.a0 << ", "
1129 << a6.a1 << ", " << a6.a2 << "), (" << a7.a0 << ", " << a7.a1
1130 << ", " << a7.a2 << "), (" << a8.a0 << ", " << a8.a1 << ", "
1131 << a8.a2 << "), (" << a9.a0 << ", " << a9.a1 << ", " << a9.a2
1132 << "))" << "\n";
1133
1134 float result = 0;
1135
1136 result += a0.a0;
1137 result += a0.a1;
1138 result += a0.a2;
1139 result += a1.a0;
1140 result += a1.a1;
1141 result += a1.a2;
1142 result += a2.a0;
1143 result += a2.a1;
1144 result += a2.a2;
1145 result += a3.a0;
1146 result += a3.a1;
1147 result += a3.a2;
1148 result += a4.a0;
1149 result += a4.a1;
1150 result += a4.a2;
1151 result += a5.a0;
1152 result += a5.a1;
1153 result += a5.a2;
1154 result += a6.a0;
1155 result += a6.a1;
1156 result += a6.a2;
1157 result += a7.a0;
1158 result += a7.a1;
1159 result += a7.a2;
1160 result += a8.a0;
1161 result += a8.a1;
1162 result += a8.a2;
1163 result += a9.a0;
1164 result += a9.a1;
1165 result += a9.a2;
1166
1167 std::cout << "result = " << result << "\n";
1168
1169 return result;
1170}

◆ PassStruct8BytesNestedFloat2x10()

Definition at line 2905 of file ffi_test_functions_generated.cc.

2914 {
2915 std::cout << "PassStruct8BytesNestedFloat2x10" << "(((" << a0.a0.a0 << "), "
2916 << a0.a1 << "), ((" << a1.a0.a0 << "), " << a1.a1 << "), (("
2917 << a2.a0.a0 << "), " << a2.a1 << "), ((" << a3.a0.a0 << "), "
2918 << a3.a1 << "), ((" << a4.a0.a0 << "), " << a4.a1 << "), (("
2919 << a5.a0.a0 << "), " << a5.a1 << "), ((" << a6.a0.a0 << "), "
2920 << a6.a1 << "), ((" << a7.a0.a0 << "), " << a7.a1 << "), (("
2921 << a8.a0.a0 << "), " << a8.a1 << "), ((" << a9.a0.a0 << "), "
2922 << a9.a1 << "))" << "\n";
2923
2924 float result = 0;
2925
2926 result += a0.a0.a0;
2927 result += a0.a1;
2928 result += a1.a0.a0;
2929 result += a1.a1;
2930 result += a2.a0.a0;
2931 result += a2.a1;
2932 result += a3.a0.a0;
2933 result += a3.a1;
2934 result += a4.a0.a0;
2935 result += a4.a1;
2936 result += a5.a0.a0;
2937 result += a5.a1;
2938 result += a6.a0.a0;
2939 result += a6.a1;
2940 result += a7.a0.a0;
2941 result += a7.a1;
2942 result += a8.a0.a0;
2943 result += a8.a1;
2944 result += a9.a0.a0;
2945 result += a9.a1;
2946
2947 std::cout << "result = " << result << "\n";
2948
2949 return result;
2950}

◆ PassStruct8BytesNestedFloatx10()

Definition at line 2852 of file ffi_test_functions_generated.cc.

2861 {
2862 std::cout << "PassStruct8BytesNestedFloatx10" << "(((" << a0.a0.a0 << "), ("
2863 << a0.a1.a0 << ")), ((" << a1.a0.a0 << "), (" << a1.a1.a0
2864 << ")), ((" << a2.a0.a0 << "), (" << a2.a1.a0 << ")), (("
2865 << a3.a0.a0 << "), (" << a3.a1.a0 << ")), ((" << a4.a0.a0 << "), ("
2866 << a4.a1.a0 << ")), ((" << a5.a0.a0 << "), (" << a5.a1.a0
2867 << ")), ((" << a6.a0.a0 << "), (" << a6.a1.a0 << ")), (("
2868 << a7.a0.a0 << "), (" << a7.a1.a0 << ")), ((" << a8.a0.a0 << "), ("
2869 << a8.a1.a0 << ")), ((" << a9.a0.a0 << "), (" << a9.a1.a0 << ")))"
2870 << "\n";
2871
2872 float result = 0;
2873
2874 result += a0.a0.a0;
2875 result += a0.a1.a0;
2876 result += a1.a0.a0;
2877 result += a1.a1.a0;
2878 result += a2.a0.a0;
2879 result += a2.a1.a0;
2880 result += a3.a0.a0;
2881 result += a3.a1.a0;
2882 result += a4.a0.a0;
2883 result += a4.a1.a0;
2884 result += a5.a0.a0;
2885 result += a5.a1.a0;
2886 result += a6.a0.a0;
2887 result += a6.a1.a0;
2888 result += a7.a0.a0;
2889 result += a7.a1.a0;
2890 result += a8.a0.a0;
2891 result += a8.a1.a0;
2892 result += a9.a0.a0;
2893 result += a9.a1.a0;
2894
2895 std::cout << "result = " << result << "\n";
2896
2897 return result;
2898}

◆ PassStruct8BytesNestedIntx10()

Definition at line 2775 of file ffi_test_functions_generated.cc.

2784 {
2785 std::cout << "PassStruct8BytesNestedIntx10" << "(((" << a0.a0.a0 << ", "
2786 << a0.a0.a1 << "), (" << a0.a1.a0 << ", " << a0.a1.a1 << ")), (("
2787 << a1.a0.a0 << ", " << a1.a0.a1 << "), (" << a1.a1.a0 << ", "
2788 << a1.a1.a1 << ")), ((" << a2.a0.a0 << ", " << a2.a0.a1 << "), ("
2789 << a2.a1.a0 << ", " << a2.a1.a1 << ")), ((" << a3.a0.a0 << ", "
2790 << a3.a0.a1 << "), (" << a3.a1.a0 << ", " << a3.a1.a1 << ")), (("
2791 << a4.a0.a0 << ", " << a4.a0.a1 << "), (" << a4.a1.a0 << ", "
2792 << a4.a1.a1 << ")), ((" << a5.a0.a0 << ", " << a5.a0.a1 << "), ("
2793 << a5.a1.a0 << ", " << a5.a1.a1 << ")), ((" << a6.a0.a0 << ", "
2794 << a6.a0.a1 << "), (" << a6.a1.a0 << ", " << a6.a1.a1 << ")), (("
2795 << a7.a0.a0 << ", " << a7.a0.a1 << "), (" << a7.a1.a0 << ", "
2796 << a7.a1.a1 << ")), ((" << a8.a0.a0 << ", " << a8.a0.a1 << "), ("
2797 << a8.a1.a0 << ", " << a8.a1.a1 << ")), ((" << a9.a0.a0 << ", "
2798 << a9.a0.a1 << "), (" << a9.a1.a0 << ", " << a9.a1.a1 << ")))"
2799 << "\n";
2800
2801 int64_t result = 0;
2802
2803 result += a0.a0.a0;
2804 result += a0.a0.a1;
2805 result += a0.a1.a0;
2806 result += a0.a1.a1;
2807 result += a1.a0.a0;
2808 result += a1.a0.a1;
2809 result += a1.a1.a0;
2810 result += a1.a1.a1;
2811 result += a2.a0.a0;
2812 result += a2.a0.a1;
2813 result += a2.a1.a0;
2814 result += a2.a1.a1;
2815 result += a3.a0.a0;
2816 result += a3.a0.a1;
2817 result += a3.a1.a0;
2818 result += a3.a1.a1;
2819 result += a4.a0.a0;
2820 result += a4.a0.a1;
2821 result += a4.a1.a0;
2822 result += a4.a1.a1;
2823 result += a5.a0.a0;
2824 result += a5.a0.a1;
2825 result += a5.a1.a0;
2826 result += a5.a1.a1;
2827 result += a6.a0.a0;
2828 result += a6.a0.a1;
2829 result += a6.a1.a0;
2830 result += a6.a1.a1;
2831 result += a7.a0.a0;
2832 result += a7.a0.a1;
2833 result += a7.a1.a0;
2834 result += a7.a1.a1;
2835 result += a8.a0.a0;
2836 result += a8.a0.a1;
2837 result += a8.a1.a0;
2838 result += a8.a1.a1;
2839 result += a9.a0.a0;
2840 result += a9.a0.a1;
2841 result += a9.a1.a0;
2842 result += a9.a1.a1;
2843
2844 std::cout << "result = " << result << "\n";
2845
2846 return result;
2847}

◆ PassStruct8BytesNestedMixedx10()

Definition at line 2955 of file ffi_test_functions_generated.cc.

2964 {
2965 std::cout << "PassStruct8BytesNestedMixedx10" << "(((" << a0.a0.a0 << ", "
2966 << a0.a0.a1 << "), (" << a0.a1.a0 << ")), ((" << a1.a0.a0 << ", "
2967 << a1.a0.a1 << "), (" << a1.a1.a0 << ")), ((" << a2.a0.a0 << ", "
2968 << a2.a0.a1 << "), (" << a2.a1.a0 << ")), ((" << a3.a0.a0 << ", "
2969 << a3.a0.a1 << "), (" << a3.a1.a0 << ")), ((" << a4.a0.a0 << ", "
2970 << a4.a0.a1 << "), (" << a4.a1.a0 << ")), ((" << a5.a0.a0 << ", "
2971 << a5.a0.a1 << "), (" << a5.a1.a0 << ")), ((" << a6.a0.a0 << ", "
2972 << a6.a0.a1 << "), (" << a6.a1.a0 << ")), ((" << a7.a0.a0 << ", "
2973 << a7.a0.a1 << "), (" << a7.a1.a0 << ")), ((" << a8.a0.a0 << ", "
2974 << a8.a0.a1 << "), (" << a8.a1.a0 << ")), ((" << a9.a0.a0 << ", "
2975 << a9.a0.a1 << "), (" << a9.a1.a0 << ")))" << "\n";
2976
2977 double result = 0;
2978
2979 result += a0.a0.a0;
2980 result += a0.a0.a1;
2981 result += a0.a1.a0;
2982 result += a1.a0.a0;
2983 result += a1.a0.a1;
2984 result += a1.a1.a0;
2985 result += a2.a0.a0;
2986 result += a2.a0.a1;
2987 result += a2.a1.a0;
2988 result += a3.a0.a0;
2989 result += a3.a0.a1;
2990 result += a3.a1.a0;
2991 result += a4.a0.a0;
2992 result += a4.a0.a1;
2993 result += a4.a1.a0;
2994 result += a5.a0.a0;
2995 result += a5.a0.a1;
2996 result += a5.a1.a0;
2997 result += a6.a0.a0;
2998 result += a6.a0.a1;
2999 result += a6.a1.a0;
3000 result += a7.a0.a0;
3001 result += a7.a0.a1;
3002 result += a7.a1.a0;
3003 result += a8.a0.a0;
3004 result += a8.a0.a1;
3005 result += a8.a1.a0;
3006 result += a9.a0.a0;
3007 result += a9.a0.a1;
3008 result += a9.a1.a0;
3009
3010 std::cout << "result = " << result << "\n";
3011
3012 return result;
3013}

◆ PassStruct8BytesPackedIntx10()

Definition at line 4103 of file ffi_test_functions_generated.cc.

4112 {
4113 std::cout << "PassStruct8BytesPackedIntx10" << "((" << static_cast<int>(a0.a0)
4114 << ", " << a0.a1 << ", " << static_cast<int>(a0.a2) << ", "
4115 << static_cast<int>(a0.a3) << ", " << static_cast<int>(a0.a4)
4116 << "), (" << static_cast<int>(a1.a0) << ", " << a1.a1 << ", "
4117 << static_cast<int>(a1.a2) << ", " << static_cast<int>(a1.a3)
4118 << ", " << static_cast<int>(a1.a4) << "), ("
4119 << static_cast<int>(a2.a0) << ", " << a2.a1 << ", "
4120 << static_cast<int>(a2.a2) << ", " << static_cast<int>(a2.a3)
4121 << ", " << static_cast<int>(a2.a4) << "), ("
4122 << static_cast<int>(a3.a0) << ", " << a3.a1 << ", "
4123 << static_cast<int>(a3.a2) << ", " << static_cast<int>(a3.a3)
4124 << ", " << static_cast<int>(a3.a4) << "), ("
4125 << static_cast<int>(a4.a0) << ", " << a4.a1 << ", "
4126 << static_cast<int>(a4.a2) << ", " << static_cast<int>(a4.a3)
4127 << ", " << static_cast<int>(a4.a4) << "), ("
4128 << static_cast<int>(a5.a0) << ", " << a5.a1 << ", "
4129 << static_cast<int>(a5.a2) << ", " << static_cast<int>(a5.a3)
4130 << ", " << static_cast<int>(a5.a4) << "), ("
4131 << static_cast<int>(a6.a0) << ", " << a6.a1 << ", "
4132 << static_cast<int>(a6.a2) << ", " << static_cast<int>(a6.a3)
4133 << ", " << static_cast<int>(a6.a4) << "), ("
4134 << static_cast<int>(a7.a0) << ", " << a7.a1 << ", "
4135 << static_cast<int>(a7.a2) << ", " << static_cast<int>(a7.a3)
4136 << ", " << static_cast<int>(a7.a4) << "), ("
4137 << static_cast<int>(a8.a0) << ", " << a8.a1 << ", "
4138 << static_cast<int>(a8.a2) << ", " << static_cast<int>(a8.a3)
4139 << ", " << static_cast<int>(a8.a4) << "), ("
4140 << static_cast<int>(a9.a0) << ", " << a9.a1 << ", "
4141 << static_cast<int>(a9.a2) << ", " << static_cast<int>(a9.a3)
4142 << ", " << static_cast<int>(a9.a4) << "))" << "\n";
4143
4144 int64_t result = 0;
4145
4146 result += a0.a0;
4147 result += a0.a1;
4148 result += a0.a2;
4149 result += a0.a3;
4150 result += a0.a4;
4151 result += a1.a0;
4152 result += a1.a1;
4153 result += a1.a2;
4154 result += a1.a3;
4155 result += a1.a4;
4156 result += a2.a0;
4157 result += a2.a1;
4158 result += a2.a2;
4159 result += a2.a3;
4160 result += a2.a4;
4161 result += a3.a0;
4162 result += a3.a1;
4163 result += a3.a2;
4164 result += a3.a3;
4165 result += a3.a4;
4166 result += a4.a0;
4167 result += a4.a1;
4168 result += a4.a2;
4169 result += a4.a3;
4170 result += a4.a4;
4171 result += a5.a0;
4172 result += a5.a1;
4173 result += a5.a2;
4174 result += a5.a3;
4175 result += a5.a4;
4176 result += a6.a0;
4177 result += a6.a1;
4178 result += a6.a2;
4179 result += a6.a3;
4180 result += a6.a4;
4181 result += a7.a0;
4182 result += a7.a1;
4183 result += a7.a2;
4184 result += a7.a3;
4185 result += a7.a4;
4186 result += a8.a0;
4187 result += a8.a1;
4188 result += a8.a2;
4189 result += a8.a3;
4190 result += a8.a4;
4191 result += a9.a0;
4192 result += a9.a1;
4193 result += a9.a2;
4194 result += a9.a3;
4195 result += a9.a4;
4196
4197 std::cout << "result = " << result << "\n";
4198
4199 return result;
4200}

◆ PassStruct9BytesHomogeneousUint8x10()

Definition at line 1179 of file ffi_test_functions_generated.cc.

1188 {
1189 std::cout
1190 << "PassStruct9BytesHomogeneousUint8x10" << "(("
1191 << static_cast<int>(a0.a0) << ", " << static_cast<int>(a0.a1) << ", "
1192 << static_cast<int>(a0.a2) << ", " << static_cast<int>(a0.a3) << ", "
1193 << static_cast<int>(a0.a4) << ", " << static_cast<int>(a0.a5) << ", "
1194 << static_cast<int>(a0.a6) << ", " << static_cast<int>(a0.a7) << ", "
1195 << static_cast<int>(a0.a8) << "), (" << static_cast<int>(a1.a0) << ", "
1196 << static_cast<int>(a1.a1) << ", " << static_cast<int>(a1.a2) << ", "
1197 << static_cast<int>(a1.a3) << ", " << static_cast<int>(a1.a4) << ", "
1198 << static_cast<int>(a1.a5) << ", " << static_cast<int>(a1.a6) << ", "
1199 << static_cast<int>(a1.a7) << ", " << static_cast<int>(a1.a8) << "), ("
1200 << static_cast<int>(a2.a0) << ", " << static_cast<int>(a2.a1) << ", "
1201 << static_cast<int>(a2.a2) << ", " << static_cast<int>(a2.a3) << ", "
1202 << static_cast<int>(a2.a4) << ", " << static_cast<int>(a2.a5) << ", "
1203 << static_cast<int>(a2.a6) << ", " << static_cast<int>(a2.a7) << ", "
1204 << static_cast<int>(a2.a8) << "), (" << static_cast<int>(a3.a0) << ", "
1205 << static_cast<int>(a3.a1) << ", " << static_cast<int>(a3.a2) << ", "
1206 << static_cast<int>(a3.a3) << ", " << static_cast<int>(a3.a4) << ", "
1207 << static_cast<int>(a3.a5) << ", " << static_cast<int>(a3.a6) << ", "
1208 << static_cast<int>(a3.a7) << ", " << static_cast<int>(a3.a8) << "), ("
1209 << static_cast<int>(a4.a0) << ", " << static_cast<int>(a4.a1) << ", "
1210 << static_cast<int>(a4.a2) << ", " << static_cast<int>(a4.a3) << ", "
1211 << static_cast<int>(a4.a4) << ", " << static_cast<int>(a4.a5) << ", "
1212 << static_cast<int>(a4.a6) << ", " << static_cast<int>(a4.a7) << ", "
1213 << static_cast<int>(a4.a8) << "), (" << static_cast<int>(a5.a0) << ", "
1214 << static_cast<int>(a5.a1) << ", " << static_cast<int>(a5.a2) << ", "
1215 << static_cast<int>(a5.a3) << ", " << static_cast<int>(a5.a4) << ", "
1216 << static_cast<int>(a5.a5) << ", " << static_cast<int>(a5.a6) << ", "
1217 << static_cast<int>(a5.a7) << ", " << static_cast<int>(a5.a8) << "), ("
1218 << static_cast<int>(a6.a0) << ", " << static_cast<int>(a6.a1) << ", "
1219 << static_cast<int>(a6.a2) << ", " << static_cast<int>(a6.a3) << ", "
1220 << static_cast<int>(a6.a4) << ", " << static_cast<int>(a6.a5) << ", "
1221 << static_cast<int>(a6.a6) << ", " << static_cast<int>(a6.a7) << ", "
1222 << static_cast<int>(a6.a8) << "), (" << static_cast<int>(a7.a0) << ", "
1223 << static_cast<int>(a7.a1) << ", " << static_cast<int>(a7.a2) << ", "
1224 << static_cast<int>(a7.a3) << ", " << static_cast<int>(a7.a4) << ", "
1225 << static_cast<int>(a7.a5) << ", " << static_cast<int>(a7.a6) << ", "
1226 << static_cast<int>(a7.a7) << ", " << static_cast<int>(a7.a8) << "), ("
1227 << static_cast<int>(a8.a0) << ", " << static_cast<int>(a8.a1) << ", "
1228 << static_cast<int>(a8.a2) << ", " << static_cast<int>(a8.a3) << ", "
1229 << static_cast<int>(a8.a4) << ", " << static_cast<int>(a8.a5) << ", "
1230 << static_cast<int>(a8.a6) << ", " << static_cast<int>(a8.a7) << ", "
1231 << static_cast<int>(a8.a8) << "), (" << static_cast<int>(a9.a0) << ", "
1232 << static_cast<int>(a9.a1) << ", " << static_cast<int>(a9.a2) << ", "
1233 << static_cast<int>(a9.a3) << ", " << static_cast<int>(a9.a4) << ", "
1234 << static_cast<int>(a9.a5) << ", " << static_cast<int>(a9.a6) << ", "
1235 << static_cast<int>(a9.a7) << ", " << static_cast<int>(a9.a8) << "))"
1236 << "\n";
1237
1238 int64_t result = 0;
1239
1240 result += a0.a0;
1241 result += a0.a1;
1242 result += a0.a2;
1243 result += a0.a3;
1244 result += a0.a4;
1245 result += a0.a5;
1246 result += a0.a6;
1247 result += a0.a7;
1248 result += a0.a8;
1249 result += a1.a0;
1250 result += a1.a1;
1251 result += a1.a2;
1252 result += a1.a3;
1253 result += a1.a4;
1254 result += a1.a5;
1255 result += a1.a6;
1256 result += a1.a7;
1257 result += a1.a8;
1258 result += a2.a0;
1259 result += a2.a1;
1260 result += a2.a2;
1261 result += a2.a3;
1262 result += a2.a4;
1263 result += a2.a5;
1264 result += a2.a6;
1265 result += a2.a7;
1266 result += a2.a8;
1267 result += a3.a0;
1268 result += a3.a1;
1269 result += a3.a2;
1270 result += a3.a3;
1271 result += a3.a4;
1272 result += a3.a5;
1273 result += a3.a6;
1274 result += a3.a7;
1275 result += a3.a8;
1276 result += a4.a0;
1277 result += a4.a1;
1278 result += a4.a2;
1279 result += a4.a3;
1280 result += a4.a4;
1281 result += a4.a5;
1282 result += a4.a6;
1283 result += a4.a7;
1284 result += a4.a8;
1285 result += a5.a0;
1286 result += a5.a1;
1287 result += a5.a2;
1288 result += a5.a3;
1289 result += a5.a4;
1290 result += a5.a5;
1291 result += a5.a6;
1292 result += a5.a7;
1293 result += a5.a8;
1294 result += a6.a0;
1295 result += a6.a1;
1296 result += a6.a2;
1297 result += a6.a3;
1298 result += a6.a4;
1299 result += a6.a5;
1300 result += a6.a6;
1301 result += a6.a7;
1302 result += a6.a8;
1303 result += a7.a0;
1304 result += a7.a1;
1305 result += a7.a2;
1306 result += a7.a3;
1307 result += a7.a4;
1308 result += a7.a5;
1309 result += a7.a6;
1310 result += a7.a7;
1311 result += a7.a8;
1312 result += a8.a0;
1313 result += a8.a1;
1314 result += a8.a2;
1315 result += a8.a3;
1316 result += a8.a4;
1317 result += a8.a5;
1318 result += a8.a6;
1319 result += a8.a7;
1320 result += a8.a8;
1321 result += a9.a0;
1322 result += a9.a1;
1323 result += a9.a2;
1324 result += a9.a3;
1325 result += a9.a4;
1326 result += a9.a5;
1327 result += a9.a6;
1328 result += a9.a7;
1329 result += a9.a8;
1330
1331 std::cout << "result = " << result << "\n";
1332
1333 return result;
1334}

◆ PassStruct9BytesInt4Or8ByteAlignedx10()

Definition at line 1342 of file ffi_test_functions_generated.cc.

1351 {
1352 std::cout << "PassStruct9BytesInt4Or8ByteAlignedx10" << "((" << a0.a0 << ", "
1353 << static_cast<int>(a0.a1) << "), (" << a1.a0 << ", "
1354 << static_cast<int>(a1.a1) << "), (" << a2.a0 << ", "
1355 << static_cast<int>(a2.a1) << "), (" << a3.a0 << ", "
1356 << static_cast<int>(a3.a1) << "), (" << a4.a0 << ", "
1357 << static_cast<int>(a4.a1) << "), (" << a5.a0 << ", "
1358 << static_cast<int>(a5.a1) << "), (" << a6.a0 << ", "
1359 << static_cast<int>(a6.a1) << "), (" << a7.a0 << ", "
1360 << static_cast<int>(a7.a1) << "), (" << a8.a0 << ", "
1361 << static_cast<int>(a8.a1) << "), (" << a9.a0 << ", "
1362 << static_cast<int>(a9.a1) << "))" << "\n";
1363
1364 int64_t result = 0;
1365
1366 result += a0.a0;
1367 result += a0.a1;
1368 result += a1.a0;
1369 result += a1.a1;
1370 result += a2.a0;
1371 result += a2.a1;
1372 result += a3.a0;
1373 result += a3.a1;
1374 result += a4.a0;
1375 result += a4.a1;
1376 result += a5.a0;
1377 result += a5.a1;
1378 result += a6.a0;
1379 result += a6.a1;
1380 result += a7.a0;
1381 result += a7.a1;
1382 result += a8.a0;
1383 result += a8.a1;
1384 result += a9.a0;
1385 result += a9.a1;
1386
1387 std::cout << "result = " << result << "\n";
1388
1389 return result;
1390}

◆ PassStruct9BytesPackedMixedx10DoubleInt32x2()

DART_EXPORT double dart::PassStruct9BytesPackedMixedx10DoubleInt32x2 ( Struct9BytesPackedMixed  a0,
Struct9BytesPackedMixed  a1,
Struct9BytesPackedMixed  a2,
Struct9BytesPackedMixed  a3,
Struct9BytesPackedMixed  a4,
Struct9BytesPackedMixed  a5,
Struct9BytesPackedMixed  a6,
Struct9BytesPackedMixed  a7,
Struct9BytesPackedMixed  a8,
Struct9BytesPackedMixed  a9,
double  a10,
int32_t  a11,
int32_t  a12 
)

Definition at line 4205 of file ffi_test_functions_generated.cc.

4218 {
4219 std::cout << "PassStruct9BytesPackedMixedx10DoubleInt32x2" << "(("
4220 << static_cast<int>(a0.a0) << ", " << a0.a1 << "), ("
4221 << static_cast<int>(a1.a0) << ", " << a1.a1 << "), ("
4222 << static_cast<int>(a2.a0) << ", " << a2.a1 << "), ("
4223 << static_cast<int>(a3.a0) << ", " << a3.a1 << "), ("
4224 << static_cast<int>(a4.a0) << ", " << a4.a1 << "), ("
4225 << static_cast<int>(a5.a0) << ", " << a5.a1 << "), ("
4226 << static_cast<int>(a6.a0) << ", " << a6.a1 << "), ("
4227 << static_cast<int>(a7.a0) << ", " << a7.a1 << "), ("
4228 << static_cast<int>(a8.a0) << ", " << a8.a1 << "), ("
4229 << static_cast<int>(a9.a0) << ", " << a9.a1 << "), " << a10 << ", "
4230 << a11 << ", " << a12 << ")" << "\n";
4231
4232 double result = 0;
4233
4234 result += a0.a0;
4235 result += a0.a1;
4236 result += a1.a0;
4237 result += a1.a1;
4238 result += a2.a0;
4239 result += a2.a1;
4240 result += a3.a0;
4241 result += a3.a1;
4242 result += a4.a0;
4243 result += a4.a1;
4244 result += a5.a0;
4245 result += a5.a1;
4246 result += a6.a0;
4247 result += a6.a1;
4248 result += a7.a0;
4249 result += a7.a1;
4250 result += a8.a0;
4251 result += a8.a1;
4252 result += a9.a0;
4253 result += a9.a1;
4254 result += a10;
4255 result += a11;
4256 result += a12;
4257
4258 std::cout << "result = " << result << "\n";
4259
4260 return result;
4261}

◆ PassStructAlignmentInt16()

DART_EXPORT int64_t dart::PassStructAlignmentInt16 ( StructAlignmentInt16  a0)

Definition at line 2723 of file ffi_test_functions_generated.cc.

2723 {
2724 std::cout << "PassStructAlignmentInt16" << "((" << static_cast<int>(a0.a0)
2725 << ", " << a0.a1 << ", " << static_cast<int>(a0.a2) << "))" << "\n";
2726
2727 int64_t result = 0;
2728
2729 result += a0.a0;
2730 result += a0.a1;
2731 result += a0.a2;
2732
2733 std::cout << "result = " << result << "\n";
2734
2735 return result;
2736}

◆ PassStructAlignmentInt32()

DART_EXPORT int64_t dart::PassStructAlignmentInt32 ( StructAlignmentInt32  a0)

Definition at line 2740 of file ffi_test_functions_generated.cc.

2740 {
2741 std::cout << "PassStructAlignmentInt32" << "((" << static_cast<int>(a0.a0)
2742 << ", " << a0.a1 << ", " << static_cast<int>(a0.a2) << "))" << "\n";
2743
2744 int64_t result = 0;
2745
2746 result += a0.a0;
2747 result += a0.a1;
2748 result += a0.a2;
2749
2750 std::cout << "result = " << result << "\n";
2751
2752 return result;
2753}

◆ PassStructAlignmentInt64()

DART_EXPORT int64_t dart::PassStructAlignmentInt64 ( StructAlignmentInt64  a0)

Definition at line 2757 of file ffi_test_functions_generated.cc.

2757 {
2758 std::cout << "PassStructAlignmentInt64" << "((" << static_cast<int>(a0.a0)
2759 << ", " << a0.a1 << ", " << static_cast<int>(a0.a2) << "))" << "\n";
2760
2761 int64_t result = 0;
2762
2763 result += a0.a0;
2764 result += a0.a1;
2765 result += a0.a2;
2766
2767 std::cout << "result = " << result << "\n";
2768
2769 return result;
2770}

◆ PassStructInlineArray100Bytes()

DART_EXPORT int32_t dart::PassStructInlineArray100Bytes ( StructInlineArray100Bytes  a0)

Definition at line 3516 of file ffi_test_functions_generated.cc.

3516 {
3517 std::cout
3518 << "PassStructInlineArray100Bytes" << "(([" << static_cast<int>(a0.a0[0])
3519 << ", " << static_cast<int>(a0.a0[1]) << ", "
3520 << static_cast<int>(a0.a0[2]) << ", " << static_cast<int>(a0.a0[3])
3521 << ", " << static_cast<int>(a0.a0[4]) << ", "
3522 << static_cast<int>(a0.a0[5]) << ", " << static_cast<int>(a0.a0[6])
3523 << ", " << static_cast<int>(a0.a0[7]) << ", "
3524 << static_cast<int>(a0.a0[8]) << ", " << static_cast<int>(a0.a0[9])
3525 << ", " << static_cast<int>(a0.a0[10]) << ", "
3526 << static_cast<int>(a0.a0[11]) << ", " << static_cast<int>(a0.a0[12])
3527 << ", " << static_cast<int>(a0.a0[13]) << ", "
3528 << static_cast<int>(a0.a0[14]) << ", " << static_cast<int>(a0.a0[15])
3529 << ", " << static_cast<int>(a0.a0[16]) << ", "
3530 << static_cast<int>(a0.a0[17]) << ", " << static_cast<int>(a0.a0[18])
3531 << ", " << static_cast<int>(a0.a0[19]) << ", "
3532 << static_cast<int>(a0.a0[20]) << ", " << static_cast<int>(a0.a0[21])
3533 << ", " << static_cast<int>(a0.a0[22]) << ", "
3534 << static_cast<int>(a0.a0[23]) << ", " << static_cast<int>(a0.a0[24])
3535 << ", " << static_cast<int>(a0.a0[25]) << ", "
3536 << static_cast<int>(a0.a0[26]) << ", " << static_cast<int>(a0.a0[27])
3537 << ", " << static_cast<int>(a0.a0[28]) << ", "
3538 << static_cast<int>(a0.a0[29]) << ", " << static_cast<int>(a0.a0[30])
3539 << ", " << static_cast<int>(a0.a0[31]) << ", "
3540 << static_cast<int>(a0.a0[32]) << ", " << static_cast<int>(a0.a0[33])
3541 << ", " << static_cast<int>(a0.a0[34]) << ", "
3542 << static_cast<int>(a0.a0[35]) << ", " << static_cast<int>(a0.a0[36])
3543 << ", " << static_cast<int>(a0.a0[37]) << ", "
3544 << static_cast<int>(a0.a0[38]) << ", " << static_cast<int>(a0.a0[39])
3545 << ", " << static_cast<int>(a0.a0[40]) << ", "
3546 << static_cast<int>(a0.a0[41]) << ", " << static_cast<int>(a0.a0[42])
3547 << ", " << static_cast<int>(a0.a0[43]) << ", "
3548 << static_cast<int>(a0.a0[44]) << ", " << static_cast<int>(a0.a0[45])
3549 << ", " << static_cast<int>(a0.a0[46]) << ", "
3550 << static_cast<int>(a0.a0[47]) << ", " << static_cast<int>(a0.a0[48])
3551 << ", " << static_cast<int>(a0.a0[49]) << ", "
3552 << static_cast<int>(a0.a0[50]) << ", " << static_cast<int>(a0.a0[51])
3553 << ", " << static_cast<int>(a0.a0[52]) << ", "
3554 << static_cast<int>(a0.a0[53]) << ", " << static_cast<int>(a0.a0[54])
3555 << ", " << static_cast<int>(a0.a0[55]) << ", "
3556 << static_cast<int>(a0.a0[56]) << ", " << static_cast<int>(a0.a0[57])
3557 << ", " << static_cast<int>(a0.a0[58]) << ", "
3558 << static_cast<int>(a0.a0[59]) << ", " << static_cast<int>(a0.a0[60])
3559 << ", " << static_cast<int>(a0.a0[61]) << ", "
3560 << static_cast<int>(a0.a0[62]) << ", " << static_cast<int>(a0.a0[63])
3561 << ", " << static_cast<int>(a0.a0[64]) << ", "
3562 << static_cast<int>(a0.a0[65]) << ", " << static_cast<int>(a0.a0[66])
3563 << ", " << static_cast<int>(a0.a0[67]) << ", "
3564 << static_cast<int>(a0.a0[68]) << ", " << static_cast<int>(a0.a0[69])
3565 << ", " << static_cast<int>(a0.a0[70]) << ", "
3566 << static_cast<int>(a0.a0[71]) << ", " << static_cast<int>(a0.a0[72])
3567 << ", " << static_cast<int>(a0.a0[73]) << ", "
3568 << static_cast<int>(a0.a0[74]) << ", " << static_cast<int>(a0.a0[75])
3569 << ", " << static_cast<int>(a0.a0[76]) << ", "
3570 << static_cast<int>(a0.a0[77]) << ", " << static_cast<int>(a0.a0[78])
3571 << ", " << static_cast<int>(a0.a0[79]) << ", "
3572 << static_cast<int>(a0.a0[80]) << ", " << static_cast<int>(a0.a0[81])
3573 << ", " << static_cast<int>(a0.a0[82]) << ", "
3574 << static_cast<int>(a0.a0[83]) << ", " << static_cast<int>(a0.a0[84])
3575 << ", " << static_cast<int>(a0.a0[85]) << ", "
3576 << static_cast<int>(a0.a0[86]) << ", " << static_cast<int>(a0.a0[87])
3577 << ", " << static_cast<int>(a0.a0[88]) << ", "
3578 << static_cast<int>(a0.a0[89]) << ", " << static_cast<int>(a0.a0[90])
3579 << ", " << static_cast<int>(a0.a0[91]) << ", "
3580 << static_cast<int>(a0.a0[92]) << ", " << static_cast<int>(a0.a0[93])
3581 << ", " << static_cast<int>(a0.a0[94]) << ", "
3582 << static_cast<int>(a0.a0[95]) << ", " << static_cast<int>(a0.a0[96])
3583 << ", " << static_cast<int>(a0.a0[97]) << ", "
3584 << static_cast<int>(a0.a0[98]) << ", " << static_cast<int>(a0.a0[99])
3585 << "]))" << "\n";
3586
3587 int32_t result = 0;
3588
3589 result += a0.a0[0];
3590 result += a0.a0[1];
3591 result += a0.a0[2];
3592 result += a0.a0[3];
3593 result += a0.a0[4];
3594 result += a0.a0[5];
3595 result += a0.a0[6];
3596 result += a0.a0[7];
3597 result += a0.a0[8];
3598 result += a0.a0[9];
3599 result += a0.a0[10];
3600 result += a0.a0[11];
3601 result += a0.a0[12];
3602 result += a0.a0[13];
3603 result += a0.a0[14];
3604 result += a0.a0[15];
3605 result += a0.a0[16];
3606 result += a0.a0[17];
3607 result += a0.a0[18];
3608 result += a0.a0[19];
3609 result += a0.a0[20];
3610 result += a0.a0[21];
3611 result += a0.a0[22];
3612 result += a0.a0[23];
3613 result += a0.a0[24];
3614 result += a0.a0[25];
3615 result += a0.a0[26];
3616 result += a0.a0[27];
3617 result += a0.a0[28];
3618 result += a0.a0[29];
3619 result += a0.a0[30];
3620 result += a0.a0[31];
3621 result += a0.a0[32];
3622 result += a0.a0[33];
3623 result += a0.a0[34];
3624 result += a0.a0[35];
3625 result += a0.a0[36];
3626 result += a0.a0[37];
3627 result += a0.a0[38];
3628 result += a0.a0[39];
3629 result += a0.a0[40];
3630 result += a0.a0[41];
3631 result += a0.a0[42];
3632 result += a0.a0[43];
3633 result += a0.a0[44];
3634 result += a0.a0[45];
3635 result += a0.a0[46];
3636 result += a0.a0[47];
3637 result += a0.a0[48];
3638 result += a0.a0[49];
3639 result += a0.a0[50];
3640 result += a0.a0[51];
3641 result += a0.a0[52];
3642 result += a0.a0[53];
3643 result += a0.a0[54];
3644 result += a0.a0[55];
3645 result += a0.a0[56];
3646 result += a0.a0[57];
3647 result += a0.a0[58];
3648 result += a0.a0[59];
3649 result += a0.a0[60];
3650 result += a0.a0[61];
3651 result += a0.a0[62];
3652 result += a0.a0[63];
3653 result += a0.a0[64];
3654 result += a0.a0[65];
3655 result += a0.a0[66];
3656 result += a0.a0[67];
3657 result += a0.a0[68];
3658 result += a0.a0[69];
3659 result += a0.a0[70];
3660 result += a0.a0[71];
3661 result += a0.a0[72];
3662 result += a0.a0[73];
3663 result += a0.a0[74];
3664 result += a0.a0[75];
3665 result += a0.a0[76];
3666 result += a0.a0[77];
3667 result += a0.a0[78];
3668 result += a0.a0[79];
3669 result += a0.a0[80];
3670 result += a0.a0[81];
3671 result += a0.a0[82];
3672 result += a0.a0[83];
3673 result += a0.a0[84];
3674 result += a0.a0[85];
3675 result += a0.a0[86];
3676 result += a0.a0[87];
3677 result += a0.a0[88];
3678 result += a0.a0[89];
3679 result += a0.a0[90];
3680 result += a0.a0[91];
3681 result += a0.a0[92];
3682 result += a0.a0[93];
3683 result += a0.a0[94];
3684 result += a0.a0[95];
3685 result += a0.a0[96];
3686 result += a0.a0[97];
3687 result += a0.a0[98];
3688 result += a0.a0[99];
3689
3690 std::cout << "result = " << result << "\n";
3691
3692 return result;
3693}

◆ PassStructInlineArrayIrregularx4()

DART_EXPORT int32_t dart::PassStructInlineArrayIrregularx4 ( StructInlineArrayIrregular  a0,
StructInlineArrayIrregular  a1,
StructInlineArrayIrregular  a2,
StructInlineArrayIrregular  a3 
)

Definition at line 3467 of file ffi_test_functions_generated.cc.

3470 {
3471 std::cout << "PassStructInlineArrayIrregularx4" << "(([(" << a0.a0[0].a0
3472 << ", " << static_cast<int>(a0.a0[0].a1) << "), (" << a0.a0[1].a0
3473 << ", " << static_cast<int>(a0.a0[1].a1) << ")], "
3474 << static_cast<int>(a0.a1) << "), ([(" << a1.a0[0].a0 << ", "
3475 << static_cast<int>(a1.a0[0].a1) << "), (" << a1.a0[1].a0 << ", "
3476 << static_cast<int>(a1.a0[1].a1) << ")], "
3477 << static_cast<int>(a1.a1) << "), ([(" << a2.a0[0].a0 << ", "
3478 << static_cast<int>(a2.a0[0].a1) << "), (" << a2.a0[1].a0 << ", "
3479 << static_cast<int>(a2.a0[1].a1) << ")], "
3480 << static_cast<int>(a2.a1) << "), ([(" << a3.a0[0].a0 << ", "
3481 << static_cast<int>(a3.a0[0].a1) << "), (" << a3.a0[1].a0 << ", "
3482 << static_cast<int>(a3.a0[1].a1) << ")], "
3483 << static_cast<int>(a3.a1) << "))" << "\n";
3484
3485 int32_t result = 0;
3486
3487 result += a0.a0[0].a0;
3488 result += a0.a0[0].a1;
3489 result += a0.a0[1].a0;
3490 result += a0.a0[1].a1;
3491 result += a0.a1;
3492 result += a1.a0[0].a0;
3493 result += a1.a0[0].a1;
3494 result += a1.a0[1].a0;
3495 result += a1.a0[1].a1;
3496 result += a1.a1;
3497 result += a2.a0[0].a0;
3498 result += a2.a0[0].a1;
3499 result += a2.a0[1].a0;
3500 result += a2.a0[1].a1;
3501 result += a2.a1;
3502 result += a3.a0[0].a0;
3503 result += a3.a0[0].a1;
3504 result += a3.a0[1].a0;
3505 result += a3.a0[1].a1;
3506 result += a3.a1;
3507
3508 std::cout << "result = " << result << "\n";
3509
3510 return result;
3511}

◆ PassStructNestedAlignmentStruct5BytesPackedMixed()

DART_EXPORT double dart::PassStructNestedAlignmentStruct5BytesPackedMixed ( StructNestedAlignmentStruct5BytesPackedMixed  a0)

Definition at line 4281 of file ffi_test_functions_generated.cc.

4282 {
4283 std::cout << "PassStructNestedAlignmentStruct5BytesPackedMixed" << "(("
4284 << static_cast<int>(a0.a0) << ", (" << a0.a1.a0 << ", "
4285 << static_cast<int>(a0.a1.a1) << ")))" << "\n";
4286
4287 double result = 0;
4288
4289 result += a0.a0;
4290 result += a0.a1.a0;
4291 result += a0.a1.a1;
4292
4293 std::cout << "result = " << result << "\n";
4294
4295 return result;
4296}

◆ PassStructNestedIntStructAlignmentInt16()

DART_EXPORT int64_t dart::PassStructNestedIntStructAlignmentInt16 ( StructNestedIntStructAlignmentInt16  a0)

Definition at line 3115 of file ffi_test_functions_generated.cc.

3116 {
3117 std::cout << "PassStructNestedIntStructAlignmentInt16" << "((("
3118 << static_cast<int>(a0.a0.a0) << ", " << a0.a0.a1 << ", "
3119 << static_cast<int>(a0.a0.a2) << "), ("
3120 << static_cast<int>(a0.a1.a0) << ", " << a0.a1.a1 << ", "
3121 << static_cast<int>(a0.a1.a2) << ")))" << "\n";
3122
3123 int64_t result = 0;
3124
3125 result += a0.a0.a0;
3126 result += a0.a0.a1;
3127 result += a0.a0.a2;
3128 result += a0.a1.a0;
3129 result += a0.a1.a1;
3130 result += a0.a1.a2;
3131
3132 std::cout << "result = " << result << "\n";
3133
3134 return result;
3135}

◆ PassStructNestedIntStructAlignmentInt32()

DART_EXPORT int64_t dart::PassStructNestedIntStructAlignmentInt32 ( StructNestedIntStructAlignmentInt32  a0)

Definition at line 3139 of file ffi_test_functions_generated.cc.

3140 {
3141 std::cout << "PassStructNestedIntStructAlignmentInt32" << "((("
3142 << static_cast<int>(a0.a0.a0) << ", " << a0.a0.a1 << ", "
3143 << static_cast<int>(a0.a0.a2) << "), ("
3144 << static_cast<int>(a0.a1.a0) << ", " << a0.a1.a1 << ", "
3145 << static_cast<int>(a0.a1.a2) << ")))" << "\n";
3146
3147 int64_t result = 0;
3148
3149 result += a0.a0.a0;
3150 result += a0.a0.a1;
3151 result += a0.a0.a2;
3152 result += a0.a1.a0;
3153 result += a0.a1.a1;
3154 result += a0.a1.a2;
3155
3156 std::cout << "result = " << result << "\n";
3157
3158 return result;
3159}

◆ PassStructNestedIntStructAlignmentInt64()

DART_EXPORT int64_t dart::PassStructNestedIntStructAlignmentInt64 ( StructNestedIntStructAlignmentInt64  a0)

Definition at line 3163 of file ffi_test_functions_generated.cc.

3164 {
3165 std::cout << "PassStructNestedIntStructAlignmentInt64" << "((("
3166 << static_cast<int>(a0.a0.a0) << ", " << a0.a0.a1 << ", "
3167 << static_cast<int>(a0.a0.a2) << "), ("
3168 << static_cast<int>(a0.a1.a0) << ", " << a0.a1.a1 << ", "
3169 << static_cast<int>(a0.a1.a2) << ")))" << "\n";
3170
3171 int64_t result = 0;
3172
3173 result += a0.a0.a0;
3174 result += a0.a0.a1;
3175 result += a0.a0.a2;
3176 result += a0.a1.a0;
3177 result += a0.a1.a1;
3178 result += a0.a1.a2;
3179
3180 std::cout << "result = " << result << "\n";
3181
3182 return result;
3183}

◆ PassStructNestedIrregularEvenBiggerx4()

Definition at line 3187 of file ffi_test_functions_generated.cc.

3191 {
3192 std::cout
3193 << "PassStructNestedIrregularEvenBiggerx4" << "((" << a0.a0 << ", (("
3194 << a0.a1.a0.a0 << ", ((" << a0.a1.a0.a1.a0.a0 << ", " << a0.a1.a0.a1.a0.a1
3195 << "), (" << a0.a1.a0.a1.a1.a0 << ")), " << a0.a1.a0.a2 << ", (("
3196 << a0.a1.a0.a3.a0.a0 << "), " << a0.a1.a0.a3.a1 << "), " << a0.a1.a0.a4
3197 << ", ((" << a0.a1.a0.a5.a0.a0 << "), (" << a0.a1.a0.a5.a1.a0 << ")), "
3198 << a0.a1.a0.a6 << "), ((" << a0.a1.a1.a0.a0 << ", " << a0.a1.a1.a0.a1
3199 << "), (" << a0.a1.a1.a1.a0 << ")), " << a0.a1.a2 << ", " << a0.a1.a3
3200 << "), ((" << a0.a2.a0.a0 << ", ((" << a0.a2.a0.a1.a0.a0 << ", "
3201 << a0.a2.a0.a1.a0.a1 << "), (" << a0.a2.a0.a1.a1.a0 << ")), "
3202 << a0.a2.a0.a2 << ", ((" << a0.a2.a0.a3.a0.a0 << "), " << a0.a2.a0.a3.a1
3203 << "), " << a0.a2.a0.a4 << ", ((" << a0.a2.a0.a5.a0.a0 << "), ("
3204 << a0.a2.a0.a5.a1.a0 << ")), " << a0.a2.a0.a6 << "), ((" << a0.a2.a1.a0.a0
3205 << ", " << a0.a2.a1.a0.a1 << "), (" << a0.a2.a1.a1.a0 << ")), "
3206 << a0.a2.a2 << ", " << a0.a2.a3 << "), " << a0.a3 << "), (" << a1.a0
3207 << ", ((" << a1.a1.a0.a0 << ", ((" << a1.a1.a0.a1.a0.a0 << ", "
3208 << a1.a1.a0.a1.a0.a1 << "), (" << a1.a1.a0.a1.a1.a0 << ")), "
3209 << a1.a1.a0.a2 << ", ((" << a1.a1.a0.a3.a0.a0 << "), " << a1.a1.a0.a3.a1
3210 << "), " << a1.a1.a0.a4 << ", ((" << a1.a1.a0.a5.a0.a0 << "), ("
3211 << a1.a1.a0.a5.a1.a0 << ")), " << a1.a1.a0.a6 << "), ((" << a1.a1.a1.a0.a0
3212 << ", " << a1.a1.a1.a0.a1 << "), (" << a1.a1.a1.a1.a0 << ")), "
3213 << a1.a1.a2 << ", " << a1.a1.a3 << "), ((" << a1.a2.a0.a0 << ", (("
3214 << a1.a2.a0.a1.a0.a0 << ", " << a1.a2.a0.a1.a0.a1 << "), ("
3215 << a1.a2.a0.a1.a1.a0 << ")), " << a1.a2.a0.a2 << ", (("
3216 << a1.a2.a0.a3.a0.a0 << "), " << a1.a2.a0.a3.a1 << "), " << a1.a2.a0.a4
3217 << ", ((" << a1.a2.a0.a5.a0.a0 << "), (" << a1.a2.a0.a5.a1.a0 << ")), "
3218 << a1.a2.a0.a6 << "), ((" << a1.a2.a1.a0.a0 << ", " << a1.a2.a1.a0.a1
3219 << "), (" << a1.a2.a1.a1.a0 << ")), " << a1.a2.a2 << ", " << a1.a2.a3
3220 << "), " << a1.a3 << "), (" << a2.a0 << ", ((" << a2.a1.a0.a0 << ", (("
3221 << a2.a1.a0.a1.a0.a0 << ", " << a2.a1.a0.a1.a0.a1 << "), ("
3222 << a2.a1.a0.a1.a1.a0 << ")), " << a2.a1.a0.a2 << ", (("
3223 << a2.a1.a0.a3.a0.a0 << "), " << a2.a1.a0.a3.a1 << "), " << a2.a1.a0.a4
3224 << ", ((" << a2.a1.a0.a5.a0.a0 << "), (" << a2.a1.a0.a5.a1.a0 << ")), "
3225 << a2.a1.a0.a6 << "), ((" << a2.a1.a1.a0.a0 << ", " << a2.a1.a1.a0.a1
3226 << "), (" << a2.a1.a1.a1.a0 << ")), " << a2.a1.a2 << ", " << a2.a1.a3
3227 << "), ((" << a2.a2.a0.a0 << ", ((" << a2.a2.a0.a1.a0.a0 << ", "
3228 << a2.a2.a0.a1.a0.a1 << "), (" << a2.a2.a0.a1.a1.a0 << ")), "
3229 << a2.a2.a0.a2 << ", ((" << a2.a2.a0.a3.a0.a0 << "), " << a2.a2.a0.a3.a1
3230 << "), " << a2.a2.a0.a4 << ", ((" << a2.a2.a0.a5.a0.a0 << "), ("
3231 << a2.a2.a0.a5.a1.a0 << ")), " << a2.a2.a0.a6 << "), ((" << a2.a2.a1.a0.a0
3232 << ", " << a2.a2.a1.a0.a1 << "), (" << a2.a2.a1.a1.a0 << ")), "
3233 << a2.a2.a2 << ", " << a2.a2.a3 << "), " << a2.a3 << "), (" << a3.a0
3234 << ", ((" << a3.a1.a0.a0 << ", ((" << a3.a1.a0.a1.a0.a0 << ", "
3235 << a3.a1.a0.a1.a0.a1 << "), (" << a3.a1.a0.a1.a1.a0 << ")), "
3236 << a3.a1.a0.a2 << ", ((" << a3.a1.a0.a3.a0.a0 << "), " << a3.a1.a0.a3.a1
3237 << "), " << a3.a1.a0.a4 << ", ((" << a3.a1.a0.a5.a0.a0 << "), ("
3238 << a3.a1.a0.a5.a1.a0 << ")), " << a3.a1.a0.a6 << "), ((" << a3.a1.a1.a0.a0
3239 << ", " << a3.a1.a1.a0.a1 << "), (" << a3.a1.a1.a1.a0 << ")), "
3240 << a3.a1.a2 << ", " << a3.a1.a3 << "), ((" << a3.a2.a0.a0 << ", (("
3241 << a3.a2.a0.a1.a0.a0 << ", " << a3.a2.a0.a1.a0.a1 << "), ("
3242 << a3.a2.a0.a1.a1.a0 << ")), " << a3.a2.a0.a2 << ", (("
3243 << a3.a2.a0.a3.a0.a0 << "), " << a3.a2.a0.a3.a1 << "), " << a3.a2.a0.a4
3244 << ", ((" << a3.a2.a0.a5.a0.a0 << "), (" << a3.a2.a0.a5.a1.a0 << ")), "
3245 << a3.a2.a0.a6 << "), ((" << a3.a2.a1.a0.a0 << ", " << a3.a2.a1.a0.a1
3246 << "), (" << a3.a2.a1.a1.a0 << ")), " << a3.a2.a2 << ", " << a3.a2.a3
3247 << "), " << a3.a3 << "))" << "\n";
3248
3249 double result = 0;
3250
3251 result += a0.a0;
3252 result += a0.a1.a0.a0;
3253 result += a0.a1.a0.a1.a0.a0;
3254 result += a0.a1.a0.a1.a0.a1;
3255 result += a0.a1.a0.a1.a1.a0;
3256 result += a0.a1.a0.a2;
3257 result += a0.a1.a0.a3.a0.a0;
3258 result += a0.a1.a0.a3.a1;
3259 result += a0.a1.a0.a4;
3260 result += a0.a1.a0.a5.a0.a0;
3261 result += a0.a1.a0.a5.a1.a0;
3262 result += a0.a1.a0.a6;
3263 result += a0.a1.a1.a0.a0;
3264 result += a0.a1.a1.a0.a1;
3265 result += a0.a1.a1.a1.a0;
3266 result += a0.a1.a2;
3267 result += a0.a1.a3;
3268 result += a0.a2.a0.a0;
3269 result += a0.a2.a0.a1.a0.a0;
3270 result += a0.a2.a0.a1.a0.a1;
3271 result += a0.a2.a0.a1.a1.a0;
3272 result += a0.a2.a0.a2;
3273 result += a0.a2.a0.a3.a0.a0;
3274 result += a0.a2.a0.a3.a1;
3275 result += a0.a2.a0.a4;
3276 result += a0.a2.a0.a5.a0.a0;
3277 result += a0.a2.a0.a5.a1.a0;
3278 result += a0.a2.a0.a6;
3279 result += a0.a2.a1.a0.a0;
3280 result += a0.a2.a1.a0.a1;
3281 result += a0.a2.a1.a1.a0;
3282 result += a0.a2.a2;
3283 result += a0.a2.a3;
3284 result += a0.a3;
3285 result += a1.a0;
3286 result += a1.a1.a0.a0;
3287 result += a1.a1.a0.a1.a0.a0;
3288 result += a1.a1.a0.a1.a0.a1;
3289 result += a1.a1.a0.a1.a1.a0;
3290 result += a1.a1.a0.a2;
3291 result += a1.a1.a0.a3.a0.a0;
3292 result += a1.a1.a0.a3.a1;
3293 result += a1.a1.a0.a4;
3294 result += a1.a1.a0.a5.a0.a0;
3295 result += a1.a1.a0.a5.a1.a0;
3296 result += a1.a1.a0.a6;
3297 result += a1.a1.a1.a0.a0;
3298 result += a1.a1.a1.a0.a1;
3299 result += a1.a1.a1.a1.a0;
3300 result += a1.a1.a2;
3301 result += a1.a1.a3;
3302 result += a1.a2.a0.a0;
3303 result += a1.a2.a0.a1.a0.a0;
3304 result += a1.a2.a0.a1.a0.a1;
3305 result += a1.a2.a0.a1.a1.a0;
3306 result += a1.a2.a0.a2;
3307 result += a1.a2.a0.a3.a0.a0;
3308 result += a1.a2.a0.a3.a1;
3309 result += a1.a2.a0.a4;
3310 result += a1.a2.a0.a5.a0.a0;
3311 result += a1.a2.a0.a5.a1.a0;
3312 result += a1.a2.a0.a6;
3313 result += a1.a2.a1.a0.a0;
3314 result += a1.a2.a1.a0.a1;
3315 result += a1.a2.a1.a1.a0;
3316 result += a1.a2.a2;
3317 result += a1.a2.a3;
3318 result += a1.a3;
3319 result += a2.a0;
3320 result += a2.a1.a0.a0;
3321 result += a2.a1.a0.a1.a0.a0;
3322 result += a2.a1.a0.a1.a0.a1;
3323 result += a2.a1.a0.a1.a1.a0;
3324 result += a2.a1.a0.a2;
3325 result += a2.a1.a0.a3.a0.a0;
3326 result += a2.a1.a0.a3.a1;
3327 result += a2.a1.a0.a4;
3328 result += a2.a1.a0.a5.a0.a0;
3329 result += a2.a1.a0.a5.a1.a0;
3330 result += a2.a1.a0.a6;
3331 result += a2.a1.a1.a0.a0;
3332 result += a2.a1.a1.a0.a1;
3333 result += a2.a1.a1.a1.a0;
3334 result += a2.a1.a2;
3335 result += a2.a1.a3;
3336 result += a2.a2.a0.a0;
3337 result += a2.a2.a0.a1.a0.a0;
3338 result += a2.a2.a0.a1.a0.a1;
3339 result += a2.a2.a0.a1.a1.a0;
3340 result += a2.a2.a0.a2;
3341 result += a2.a2.a0.a3.a0.a0;
3342 result += a2.a2.a0.a3.a1;
3343 result += a2.a2.a0.a4;
3344 result += a2.a2.a0.a5.a0.a0;
3345 result += a2.a2.a0.a5.a1.a0;
3346 result += a2.a2.a0.a6;
3347 result += a2.a2.a1.a0.a0;
3348 result += a2.a2.a1.a0.a1;
3349 result += a2.a2.a1.a1.a0;
3350 result += a2.a2.a2;
3351 result += a2.a2.a3;
3352 result += a2.a3;
3353 result += a3.a0;
3354 result += a3.a1.a0.a0;
3355 result += a3.a1.a0.a1.a0.a0;
3356 result += a3.a1.a0.a1.a0.a1;
3357 result += a3.a1.a0.a1.a1.a0;
3358 result += a3.a1.a0.a2;
3359 result += a3.a1.a0.a3.a0.a0;
3360 result += a3.a1.a0.a3.a1;
3361 result += a3.a1.a0.a4;
3362 result += a3.a1.a0.a5.a0.a0;
3363 result += a3.a1.a0.a5.a1.a0;
3364 result += a3.a1.a0.a6;
3365 result += a3.a1.a1.a0.a0;
3366 result += a3.a1.a1.a0.a1;
3367 result += a3.a1.a1.a1.a0;
3368 result += a3.a1.a2;
3369 result += a3.a1.a3;
3370 result += a3.a2.a0.a0;
3371 result += a3.a2.a0.a1.a0.a0;
3372 result += a3.a2.a0.a1.a0.a1;
3373 result += a3.a2.a0.a1.a1.a0;
3374 result += a3.a2.a0.a2;
3375 result += a3.a2.a0.a3.a0.a0;
3376 result += a3.a2.a0.a3.a1;
3377 result += a3.a2.a0.a4;
3378 result += a3.a2.a0.a5.a0.a0;
3379 result += a3.a2.a0.a5.a1.a0;
3380 result += a3.a2.a0.a6;
3381 result += a3.a2.a1.a0.a0;
3382 result += a3.a2.a1.a0.a1;
3383 result += a3.a2.a1.a1.a0;
3384 result += a3.a2.a2;
3385 result += a3.a2.a3;
3386 result += a3.a3;
3387
3388 std::cout << "result = " << result << "\n";
3389
3390 return result;
3391}

◆ PassStructRecursive()

Definition at line 846 of file ffi_test_functions.cc.

850 {
851 std::cout << "PassStruct20BytesHomogeneousInt32x10" << "(" << recursionCounter
852 << ", (" << a0.a0 << ", " << a0.a1 << ", " << a0.a2 << ", " << a0.a3
853 << ", " << a0.a4 << "), " << reinterpret_cast<void*>(f) << ")\n";
854 a0.a0++;
855 const int32_t a0_a0_saved = a0.a0;
856
857 if (recursionCounter <= 0) {
858 return a0;
859 }
860
861 Struct20BytesHomogeneousInt32Copy result = f(recursionCounter - 1, a0);
862 result.a0++;
863 if (a0_a0_saved != a0.a0) {
864 result.a4 = 0;
865 }
866
867 return result;
868}

◆ PassStructStruct16BytesHomogeneousFloat2x5()

Definition at line 3698 of file ffi_test_functions_generated.cc.

3703 {
3704 std::cout << "PassStructStruct16BytesHomogeneousFloat2x5" << "(((" << a0.a0.a0
3705 << "), [(" << a0.a1[0].a0 << "), (" << a0.a1[1].a0 << ")], "
3706 << a0.a2 << "), ((" << a1.a0.a0 << "), [(" << a1.a1[0].a0 << "), ("
3707 << a1.a1[1].a0 << ")], " << a1.a2 << "), ((" << a2.a0.a0 << "), [("
3708 << a2.a1[0].a0 << "), (" << a2.a1[1].a0 << ")], " << a2.a2
3709 << "), ((" << a3.a0.a0 << "), [(" << a3.a1[0].a0 << "), ("
3710 << a3.a1[1].a0 << ")], " << a3.a2 << "), ((" << a4.a0.a0 << "), [("
3711 << a4.a1[0].a0 << "), (" << a4.a1[1].a0 << ")], " << a4.a2 << "))"
3712 << "\n";
3713
3714 float result = 0;
3715
3716 result += a0.a0.a0;
3717 result += a0.a1[0].a0;
3718 result += a0.a1[1].a0;
3719 result += a0.a2;
3720 result += a1.a0.a0;
3721 result += a1.a1[0].a0;
3722 result += a1.a1[1].a0;
3723 result += a1.a2;
3724 result += a2.a0.a0;
3725 result += a2.a1[0].a0;
3726 result += a2.a1[1].a0;
3727 result += a2.a2;
3728 result += a3.a0.a0;
3729 result += a3.a1[0].a0;
3730 result += a3.a1[1].a0;
3731 result += a3.a2;
3732 result += a4.a0.a0;
3733 result += a4.a1[0].a0;
3734 result += a4.a1[1].a0;
3735 result += a4.a2;
3736
3737 std::cout << "result = " << result << "\n";
3738
3739 return result;
3740}

◆ PassStructStruct16BytesMixed3x10()

Definition at line 3794 of file ffi_test_functions_generated.cc.

3804 {
3805 std::cout << "PassStructStruct16BytesMixed3x10" << "(((" << a0.a0.a0
3806 << "), [(" << a0.a1[0].a0 << ", " << a0.a1[0].a1 << ", "
3807 << a0.a1[0].a2 << ")], [" << a0.a2[0] << ", " << a0.a2[1]
3808 << "]), ((" << a1.a0.a0 << "), [(" << a1.a1[0].a0 << ", "
3809 << a1.a1[0].a1 << ", " << a1.a1[0].a2 << ")], [" << a1.a2[0] << ", "
3810 << a1.a2[1] << "]), ((" << a2.a0.a0 << "), [(" << a2.a1[0].a0
3811 << ", " << a2.a1[0].a1 << ", " << a2.a1[0].a2 << ")], [" << a2.a2[0]
3812 << ", " << a2.a2[1] << "]), ((" << a3.a0.a0 << "), [("
3813 << a3.a1[0].a0 << ", " << a3.a1[0].a1 << ", " << a3.a1[0].a2
3814 << ")], [" << a3.a2[0] << ", " << a3.a2[1] << "]), ((" << a4.a0.a0
3815 << "), [(" << a4.a1[0].a0 << ", " << a4.a1[0].a1 << ", "
3816 << a4.a1[0].a2 << ")], [" << a4.a2[0] << ", " << a4.a2[1]
3817 << "]), ((" << a5.a0.a0 << "), [(" << a5.a1[0].a0 << ", "
3818 << a5.a1[0].a1 << ", " << a5.a1[0].a2 << ")], [" << a5.a2[0] << ", "
3819 << a5.a2[1] << "]), ((" << a6.a0.a0 << "), [(" << a6.a1[0].a0
3820 << ", " << a6.a1[0].a1 << ", " << a6.a1[0].a2 << ")], [" << a6.a2[0]
3821 << ", " << a6.a2[1] << "]), ((" << a7.a0.a0 << "), [("
3822 << a7.a1[0].a0 << ", " << a7.a1[0].a1 << ", " << a7.a1[0].a2
3823 << ")], [" << a7.a2[0] << ", " << a7.a2[1] << "]), ((" << a8.a0.a0
3824 << "), [(" << a8.a1[0].a0 << ", " << a8.a1[0].a1 << ", "
3825 << a8.a1[0].a2 << ")], [" << a8.a2[0] << ", " << a8.a2[1]
3826 << "]), ((" << a9.a0.a0 << "), [(" << a9.a1[0].a0 << ", "
3827 << a9.a1[0].a1 << ", " << a9.a1[0].a2 << ")], [" << a9.a2[0] << ", "
3828 << a9.a2[1] << "]))" << "\n";
3829
3830 float result = 0;
3831
3832 result += a0.a0.a0;
3833 result += a0.a1[0].a0;
3834 result += a0.a1[0].a1;
3835 result += a0.a1[0].a2;
3836 result += a0.a2[0];
3837 result += a0.a2[1];
3838 result += a1.a0.a0;
3839 result += a1.a1[0].a0;
3840 result += a1.a1[0].a1;
3841 result += a1.a1[0].a2;
3842 result += a1.a2[0];
3843 result += a1.a2[1];
3844 result += a2.a0.a0;
3845 result += a2.a1[0].a0;
3846 result += a2.a1[0].a1;
3847 result += a2.a1[0].a2;
3848 result += a2.a2[0];
3849 result += a2.a2[1];
3850 result += a3.a0.a0;
3851 result += a3.a1[0].a0;
3852 result += a3.a1[0].a1;
3853 result += a3.a1[0].a2;
3854 result += a3.a2[0];
3855 result += a3.a2[1];
3856 result += a4.a0.a0;
3857 result += a4.a1[0].a0;
3858 result += a4.a1[0].a1;
3859 result += a4.a1[0].a2;
3860 result += a4.a2[0];
3861 result += a4.a2[1];
3862 result += a5.a0.a0;
3863 result += a5.a1[0].a0;
3864 result += a5.a1[0].a1;
3865 result += a5.a1[0].a2;
3866 result += a5.a2[0];
3867 result += a5.a2[1];
3868 result += a6.a0.a0;
3869 result += a6.a1[0].a0;
3870 result += a6.a1[0].a1;
3871 result += a6.a1[0].a2;
3872 result += a6.a2[0];
3873 result += a6.a2[1];
3874 result += a7.a0.a0;
3875 result += a7.a1[0].a0;
3876 result += a7.a1[0].a1;
3877 result += a7.a1[0].a2;
3878 result += a7.a2[0];
3879 result += a7.a2[1];
3880 result += a8.a0.a0;
3881 result += a8.a1[0].a0;
3882 result += a8.a1[0].a1;
3883 result += a8.a1[0].a2;
3884 result += a8.a2[0];
3885 result += a8.a2[1];
3886 result += a9.a0.a0;
3887 result += a9.a1[0].a0;
3888 result += a9.a1[0].a1;
3889 result += a9.a1[0].a2;
3890 result += a9.a2[0];
3891 result += a9.a2[1];
3892
3893 std::cout << "result = " << result << "\n";
3894
3895 return result;
3896}

◆ PassStructStruct32BytesHomogeneousDouble2x5()

Definition at line 3745 of file ffi_test_functions_generated.cc.

3750 {
3751 std::cout << "PassStructStruct32BytesHomogeneousDouble2x5" << "((("
3752 << a0.a0.a0 << "), [(" << a0.a1[0].a0 << "), (" << a0.a1[1].a0
3753 << ")], " << a0.a2 << "), ((" << a1.a0.a0 << "), [(" << a1.a1[0].a0
3754 << "), (" << a1.a1[1].a0 << ")], " << a1.a2 << "), ((" << a2.a0.a0
3755 << "), [(" << a2.a1[0].a0 << "), (" << a2.a1[1].a0 << ")], "
3756 << a2.a2 << "), ((" << a3.a0.a0 << "), [(" << a3.a1[0].a0 << "), ("
3757 << a3.a1[1].a0 << ")], " << a3.a2 << "), ((" << a4.a0.a0 << "), [("
3758 << a4.a1[0].a0 << "), (" << a4.a1[1].a0 << ")], " << a4.a2 << "))"
3759 << "\n";
3760
3761 double result = 0;
3762
3763 result += a0.a0.a0;
3764 result += a0.a1[0].a0;
3765 result += a0.a1[1].a0;
3766 result += a0.a2;
3767 result += a1.a0.a0;
3768 result += a1.a1[0].a0;
3769 result += a1.a1[1].a0;
3770 result += a1.a2;
3771 result += a2.a0.a0;
3772 result += a2.a1[0].a0;
3773 result += a2.a1[1].a0;
3774 result += a2.a2;
3775 result += a3.a0.a0;
3776 result += a3.a1[0].a0;
3777 result += a3.a1[1].a0;
3778 result += a3.a2;
3779 result += a4.a0.a0;
3780 result += a4.a1[0].a0;
3781 result += a4.a1[1].a0;
3782 result += a4.a2;
3783
3784 std::cout << "result = " << result << "\n";
3785
3786 return result;
3787}

◆ PassThroughFinalizer()

static void dart::PassThroughFinalizer ( void *  isolate_callback_data,
void *  peer 
)
static

Definition at line 366 of file kernel_isolate.cc.

366{}

◆ PassUint8Boolx9Struct10BytesHomogeneousBoolBool()

DART_EXPORT int32_t dart::PassUint8Boolx9Struct10BytesHomogeneousBoolBool ( uint8_t  a0,
bool  a1,
bool  a2,
bool  a3,
bool  a4,
bool  a5,
bool  a6,
bool  a7,
bool  a8,
bool  a9,
Struct10BytesHomogeneousBool  a10,
bool  a11 
)

Definition at line 4604 of file ffi_test_functions_generated.cc.

4616 {
4617 std::cout << "PassUint8Boolx9Struct10BytesHomogeneousBoolBool" << "("
4618 << static_cast<int>(a0) << ", " << a1 << ", " << a2 << ", " << a3
4619 << ", " << a4 << ", " << a5 << ", " << a6 << ", " << a7 << ", "
4620 << a8 << ", " << a9 << ", (" << a10.a0 << ", " << a10.a1 << ", "
4621 << a10.a2 << ", " << a10.a3 << ", " << a10.a4 << ", " << a10.a5
4622 << ", " << a10.a6 << ", " << a10.a7 << ", " << a10.a8 << ", "
4623 << a10.a9 << "), " << a11 << ")" << "\n";
4624
4625 int32_t result = 0;
4626
4627 result += a0;
4628 result += a1 ? 1 : 0;
4629 result += a2 ? 1 : 0;
4630 result += a3 ? 1 : 0;
4631 result += a4 ? 1 : 0;
4632 result += a5 ? 1 : 0;
4633 result += a6 ? 1 : 0;
4634 result += a7 ? 1 : 0;
4635 result += a8 ? 1 : 0;
4636 result += a9 ? 1 : 0;
4637 result += a10.a0 ? 1 : 0;
4638 result += a10.a1 ? 1 : 0;
4639 result += a10.a2 ? 1 : 0;
4640 result += a10.a3 ? 1 : 0;
4641 result += a10.a4 ? 1 : 0;
4642 result += a10.a5 ? 1 : 0;
4643 result += a10.a6 ? 1 : 0;
4644 result += a10.a7 ? 1 : 0;
4645 result += a10.a8 ? 1 : 0;
4646 result += a10.a9 ? 1 : 0;
4647 result += a11 ? 1 : 0;
4648
4649 std::cout << "result = " << result << "\n";
4650
4651 return result;
4652}

◆ PassUint8Boolx9Struct10BytesInlineArrayBoolBool()

DART_EXPORT int32_t dart::PassUint8Boolx9Struct10BytesInlineArrayBoolBool ( uint8_t  a0,
bool  a1,
bool  a2,
bool  a3,
bool  a4,
bool  a5,
bool  a6,
bool  a7,
bool  a8,
bool  a9,
Struct10BytesInlineArrayBool  a10,
bool  a11 
)

Definition at line 4658 of file ffi_test_functions_generated.cc.

4670 {
4671 std::cout << "PassUint8Boolx9Struct10BytesInlineArrayBoolBool" << "("
4672 << static_cast<int>(a0) << ", " << a1 << ", " << a2 << ", " << a3
4673 << ", " << a4 << ", " << a5 << ", " << a6 << ", " << a7 << ", "
4674 << a8 << ", " << a9 << ", ([" << a10.a0[0] << ", " << a10.a0[1]
4675 << ", " << a10.a0[2] << ", " << a10.a0[3] << ", " << a10.a0[4]
4676 << ", " << a10.a0[5] << ", " << a10.a0[6] << ", " << a10.a0[7]
4677 << ", " << a10.a0[8] << ", " << a10.a0[9] << "]), " << a11 << ")"
4678 << "\n";
4679
4680 int32_t result = 0;
4681
4682 result += a0;
4683 result += a1 ? 1 : 0;
4684 result += a2 ? 1 : 0;
4685 result += a3 ? 1 : 0;
4686 result += a4 ? 1 : 0;
4687 result += a5 ? 1 : 0;
4688 result += a6 ? 1 : 0;
4689 result += a7 ? 1 : 0;
4690 result += a8 ? 1 : 0;
4691 result += a9 ? 1 : 0;
4692 result += a10.a0[0] ? 1 : 0;
4693 result += a10.a0[1] ? 1 : 0;
4694 result += a10.a0[2] ? 1 : 0;
4695 result += a10.a0[3] ? 1 : 0;
4696 result += a10.a0[4] ? 1 : 0;
4697 result += a10.a0[5] ? 1 : 0;
4698 result += a10.a0[6] ? 1 : 0;
4699 result += a10.a0[7] ? 1 : 0;
4700 result += a10.a0[8] ? 1 : 0;
4701 result += a10.a0[9] ? 1 : 0;
4702 result += a11 ? 1 : 0;
4703
4704 std::cout << "result = " << result << "\n";
4705
4706 return result;
4707}

◆ PassUint8Struct1ByteBool()

DART_EXPORT bool dart::PassUint8Struct1ByteBool ( uint8_t  a0,
Struct1ByteBool  a1 
)

Definition at line 4711 of file ffi_test_functions_generated.cc.

4711 {
4712 std::cout << "PassUint8Struct1ByteBool" << "(" << static_cast<int>(a0)
4713 << ", (" << a1.a0 << "))" << "\n";
4714
4715 uint64_t result = 0;
4716
4717 result += a0;
4718 result += a1.a0 ? 1 : 0;
4719
4720 std::cout << "result = " << result << "\n";
4721
4722 return result % 2 != 0;
4723}

◆ PassUint8Struct32BytesInlineArrayMultiDimensionalI()

DART_EXPORT uint32_t dart::PassUint8Struct32BytesInlineArrayMultiDimensionalI ( uint8_t  a0,
Struct32BytesInlineArrayMultiDimensionalInt  a1,
uint8_t  a2,
Struct8BytesInlineArrayMultiDimensionalInt  a3,
uint8_t  a4,
Struct8BytesInlineArrayMultiDimensionalInt  a5,
uint8_t  a6 
)

Definition at line 3900 of file ffi_test_functions_generated.cc.

3907 {
3908 std::cout << "PassUint8Struct32BytesInlineArrayMultiDimensionalI" << "("
3909 << static_cast<int>(a0) << ", ([[[[["
3910 << static_cast<int>(a1.a0[0][0][0][0][0]) << ", "
3911 << static_cast<int>(a1.a0[0][0][0][0][1]) << "], ["
3912 << static_cast<int>(a1.a0[0][0][0][1][0]) << ", "
3913 << static_cast<int>(a1.a0[0][0][0][1][1]) << "]], [["
3914 << static_cast<int>(a1.a0[0][0][1][0][0]) << ", "
3915 << static_cast<int>(a1.a0[0][0][1][0][1]) << "], ["
3916 << static_cast<int>(a1.a0[0][0][1][1][0]) << ", "
3917 << static_cast<int>(a1.a0[0][0][1][1][1]) << "]]], [[["
3918 << static_cast<int>(a1.a0[0][1][0][0][0]) << ", "
3919 << static_cast<int>(a1.a0[0][1][0][0][1]) << "], ["
3920 << static_cast<int>(a1.a0[0][1][0][1][0]) << ", "
3921 << static_cast<int>(a1.a0[0][1][0][1][1]) << "]], [["
3922 << static_cast<int>(a1.a0[0][1][1][0][0]) << ", "
3923 << static_cast<int>(a1.a0[0][1][1][0][1]) << "], ["
3924 << static_cast<int>(a1.a0[0][1][1][1][0]) << ", "
3925 << static_cast<int>(a1.a0[0][1][1][1][1]) << "]]]], [[[["
3926 << static_cast<int>(a1.a0[1][0][0][0][0]) << ", "
3927 << static_cast<int>(a1.a0[1][0][0][0][1]) << "], ["
3928 << static_cast<int>(a1.a0[1][0][0][1][0]) << ", "
3929 << static_cast<int>(a1.a0[1][0][0][1][1]) << "]], [["
3930 << static_cast<int>(a1.a0[1][0][1][0][0]) << ", "
3931 << static_cast<int>(a1.a0[1][0][1][0][1]) << "], ["
3932 << static_cast<int>(a1.a0[1][0][1][1][0]) << ", "
3933 << static_cast<int>(a1.a0[1][0][1][1][1]) << "]]], [[["
3934 << static_cast<int>(a1.a0[1][1][0][0][0]) << ", "
3935 << static_cast<int>(a1.a0[1][1][0][0][1]) << "], ["
3936 << static_cast<int>(a1.a0[1][1][0][1][0]) << ", "
3937 << static_cast<int>(a1.a0[1][1][0][1][1]) << "]], [["
3938 << static_cast<int>(a1.a0[1][1][1][0][0]) << ", "
3939 << static_cast<int>(a1.a0[1][1][1][0][1]) << "], ["
3940 << static_cast<int>(a1.a0[1][1][1][1][0]) << ", "
3941 << static_cast<int>(a1.a0[1][1][1][1][1]) << "]]]]]), "
3942 << static_cast<int>(a2) << ", ([[["
3943 << static_cast<int>(a3.a0[0][0][0]) << ", "
3944 << static_cast<int>(a3.a0[0][0][1]) << "], ["
3945 << static_cast<int>(a3.a0[0][1][0]) << ", "
3946 << static_cast<int>(a3.a0[0][1][1]) << "]], [["
3947 << static_cast<int>(a3.a0[1][0][0]) << ", "
3948 << static_cast<int>(a3.a0[1][0][1]) << "], ["
3949 << static_cast<int>(a3.a0[1][1][0]) << ", "
3950 << static_cast<int>(a3.a0[1][1][1]) << "]]]), "
3951 << static_cast<int>(a4) << ", ([[["
3952 << static_cast<int>(a5.a0[0][0][0]) << ", "
3953 << static_cast<int>(a5.a0[0][0][1]) << "], ["
3954 << static_cast<int>(a5.a0[0][1][0]) << ", "
3955 << static_cast<int>(a5.a0[0][1][1]) << "]], [["
3956 << static_cast<int>(a5.a0[1][0][0]) << ", "
3957 << static_cast<int>(a5.a0[1][0][1]) << "], ["
3958 << static_cast<int>(a5.a0[1][1][0]) << ", "
3959 << static_cast<int>(a5.a0[1][1][1]) << "]]]), "
3960 << static_cast<int>(a6) << ")" << "\n";
3961
3962 uint32_t result = 0;
3963
3964 result += a0;
3965 result += a1.a0[0][0][0][0][0];
3966 result += a1.a0[0][0][0][0][1];
3967 result += a1.a0[0][0][0][1][0];
3968 result += a1.a0[0][0][0][1][1];
3969 result += a1.a0[0][0][1][0][0];
3970 result += a1.a0[0][0][1][0][1];
3971 result += a1.a0[0][0][1][1][0];
3972 result += a1.a0[0][0][1][1][1];
3973 result += a1.a0[0][1][0][0][0];
3974 result += a1.a0[0][1][0][0][1];
3975 result += a1.a0[0][1][0][1][0];
3976 result += a1.a0[0][1][0][1][1];
3977 result += a1.a0[0][1][1][0][0];
3978 result += a1.a0[0][1][1][0][1];
3979 result += a1.a0[0][1][1][1][0];
3980 result += a1.a0[0][1][1][1][1];
3981 result += a1.a0[1][0][0][0][0];
3982 result += a1.a0[1][0][0][0][1];
3983 result += a1.a0[1][0][0][1][0];
3984 result += a1.a0[1][0][0][1][1];
3985 result += a1.a0[1][0][1][0][0];
3986 result += a1.a0[1][0][1][0][1];
3987 result += a1.a0[1][0][1][1][0];
3988 result += a1.a0[1][0][1][1][1];
3989 result += a1.a0[1][1][0][0][0];
3990 result += a1.a0[1][1][0][0][1];
3991 result += a1.a0[1][1][0][1][0];
3992 result += a1.a0[1][1][0][1][1];
3993 result += a1.a0[1][1][1][0][0];
3994 result += a1.a0[1][1][1][0][1];
3995 result += a1.a0[1][1][1][1][0];
3996 result += a1.a0[1][1][1][1][1];
3997 result += a2;
3998 result += a3.a0[0][0][0];
3999 result += a3.a0[0][0][1];
4000 result += a3.a0[0][1][0];
4001 result += a3.a0[0][1][1];
4002 result += a3.a0[1][0][0];
4003 result += a3.a0[1][0][1];
4004 result += a3.a0[1][1][0];
4005 result += a3.a0[1][1][1];
4006 result += a4;
4007 result += a5.a0[0][0][0];
4008 result += a5.a0[0][0][1];
4009 result += a5.a0[0][1][0];
4010 result += a5.a0[0][1][1];
4011 result += a5.a0[1][0][0];
4012 result += a5.a0[1][0][1];
4013 result += a5.a0[1][1][0];
4014 result += a5.a0[1][1][1];
4015 result += a6;
4016
4017 std::cout << "result = " << result << "\n";
4018
4019 return result;
4020}

◆ PassUint8Struct4BytesInlineArrayMultiDimensionalIn()

DART_EXPORT uint32_t dart::PassUint8Struct4BytesInlineArrayMultiDimensionalIn ( uint8_t  a0,
Struct4BytesInlineArrayMultiDimensionalInt  a1,
uint8_t  a2 
)

Definition at line 4024 of file ffi_test_functions_generated.cc.

4027 {
4028 std::cout << "PassUint8Struct4BytesInlineArrayMultiDimensionalIn" << "("
4029 << static_cast<int>(a0) << ", ([[("
4030 << static_cast<int>(a1.a0[0][0].a0) << "), ("
4031 << static_cast<int>(a1.a0[0][1].a0) << ")], [("
4032 << static_cast<int>(a1.a0[1][0].a0) << "), ("
4033 << static_cast<int>(a1.a0[1][1].a0) << ")]]), "
4034 << static_cast<int>(a2) << ")" << "\n";
4035
4036 uint32_t result = 0;
4037
4038 result += a0;
4039 result += a1.a0[0][0].a0;
4040 result += a1.a0[0][1].a0;
4041 result += a1.a0[1][0].a0;
4042 result += a1.a0[1][1].a0;
4043 result += a2;
4044
4045 std::cout << "result = " << result << "\n";
4046
4047 return result;
4048}

◆ PassUnion16BytesNestedFloatx10()

Definition at line 4553 of file ffi_test_functions_generated.cc.

4562 {
4563 std::cout << "PassUnion16BytesNestedFloatx10" << "(((" << a0.a0.a0 << ", "
4564 << a0.a0.a1 << ")), ((" << a1.a0.a0 << ", " << a1.a0.a1 << ")), (("
4565 << a2.a0.a0 << ", " << a2.a0.a1 << ")), ((" << a3.a0.a0 << ", "
4566 << a3.a0.a1 << ")), ((" << a4.a0.a0 << ", " << a4.a0.a1 << ")), (("
4567 << a5.a0.a0 << ", " << a5.a0.a1 << ")), ((" << a6.a0.a0 << ", "
4568 << a6.a0.a1 << ")), ((" << a7.a0.a0 << ", " << a7.a0.a1 << ")), (("
4569 << a8.a0.a0 << ", " << a8.a0.a1 << ")), ((" << a9.a0.a0 << ", "
4570 << a9.a0.a1 << ")))" << "\n";
4571
4572 double result = 0;
4573
4574 result += a0.a0.a0;
4575 result += a0.a0.a1;
4576 result += a1.a0.a0;
4577 result += a1.a0.a1;
4578 result += a2.a0.a0;
4579 result += a2.a0.a1;
4580 result += a3.a0.a0;
4581 result += a3.a0.a1;
4582 result += a4.a0.a0;
4583 result += a4.a0.a1;
4584 result += a5.a0.a0;
4585 result += a5.a0.a1;
4586 result += a6.a0.a0;
4587 result += a6.a0.a1;
4588 result += a7.a0.a0;
4589 result += a7.a0.a1;
4590 result += a8.a0.a0;
4591 result += a8.a0.a1;
4592 result += a9.a0.a0;
4593 result += a9.a0.a1;
4594
4595 std::cout << "result = " << result << "\n";
4596
4597 return result;
4598}

◆ PassUnion16BytesNestedInlineArrayFloatx10()

Definition at line 4476 of file ffi_test_functions_generated.cc.

4486 {
4487 std::cout << "PassUnion16BytesNestedInlineArrayFloatx10" << "(([" << a0.a0[0]
4488 << ", " << a0.a0[1] << ", " << a0.a0[2] << ", " << a0.a0[3]
4489 << "]), ([" << a1.a0[0] << ", " << a1.a0[1] << ", " << a1.a0[2]
4490 << ", " << a1.a0[3] << "]), ([" << a2.a0[0] << ", " << a2.a0[1]
4491 << ", " << a2.a0[2] << ", " << a2.a0[3] << "]), ([" << a3.a0[0]
4492 << ", " << a3.a0[1] << ", " << a3.a0[2] << ", " << a3.a0[3]
4493 << "]), ([" << a4.a0[0] << ", " << a4.a0[1] << ", " << a4.a0[2]
4494 << ", " << a4.a0[3] << "]), ([" << a5.a0[0] << ", " << a5.a0[1]
4495 << ", " << a5.a0[2] << ", " << a5.a0[3] << "]), ([" << a6.a0[0]
4496 << ", " << a6.a0[1] << ", " << a6.a0[2] << ", " << a6.a0[3]
4497 << "]), ([" << a7.a0[0] << ", " << a7.a0[1] << ", " << a7.a0[2]
4498 << ", " << a7.a0[3] << "]), ([" << a8.a0[0] << ", " << a8.a0[1]
4499 << ", " << a8.a0[2] << ", " << a8.a0[3] << "]), ([" << a9.a0[0]
4500 << ", " << a9.a0[1] << ", " << a9.a0[2] << ", " << a9.a0[3] << "]))"
4501 << "\n";
4502
4503 double result = 0;
4504
4505 result += a0.a0[0];
4506 result += a0.a0[1];
4507 result += a0.a0[2];
4508 result += a0.a0[3];
4509 result += a1.a0[0];
4510 result += a1.a0[1];
4511 result += a1.a0[2];
4512 result += a1.a0[3];
4513 result += a2.a0[0];
4514 result += a2.a0[1];
4515 result += a2.a0[2];
4516 result += a2.a0[3];
4517 result += a3.a0[0];
4518 result += a3.a0[1];
4519 result += a3.a0[2];
4520 result += a3.a0[3];
4521 result += a4.a0[0];
4522 result += a4.a0[1];
4523 result += a4.a0[2];
4524 result += a4.a0[3];
4525 result += a5.a0[0];
4526 result += a5.a0[1];
4527 result += a5.a0[2];
4528 result += a5.a0[3];
4529 result += a6.a0[0];
4530 result += a6.a0[1];
4531 result += a6.a0[2];
4532 result += a6.a0[3];
4533 result += a7.a0[0];
4534 result += a7.a0[1];
4535 result += a7.a0[2];
4536 result += a7.a0[3];
4537 result += a8.a0[0];
4538 result += a8.a0[1];
4539 result += a8.a0[2];
4540 result += a8.a0[3];
4541 result += a9.a0[0];
4542 result += a9.a0[1];
4543 result += a9.a0[2];
4544 result += a9.a0[3];
4545
4546 std::cout << "result = " << result << "\n";
4547
4548 return result;
4549}

◆ PassUnion4BytesMixedx10()

DART_EXPORT double dart::PassUnion4BytesMixedx10 ( Union4BytesMixed  a0,
Union4BytesMixed  a1,
Union4BytesMixed  a2,
Union4BytesMixed  a3,
Union4BytesMixed  a4,
Union4BytesMixed  a5,
Union4BytesMixed  a6,
Union4BytesMixed  a7,
Union4BytesMixed  a8,
Union4BytesMixed  a9 
)

Definition at line 4344 of file ffi_test_functions_generated.cc.

4353 {
4354 std::cout << "PassUnion4BytesMixedx10" << "((" << a0.a0 << "), (" << a1.a0
4355 << "), (" << a2.a0 << "), (" << a3.a0 << "), (" << a4.a0 << "), ("
4356 << a5.a0 << "), (" << a6.a0 << "), (" << a7.a0 << "), (" << a8.a0
4357 << "), (" << a9.a0 << "))" << "\n";
4358
4359 double result = 0;
4360
4361 result += a0.a0;
4362 result += a1.a0;
4363 result += a2.a0;
4364 result += a3.a0;
4365 result += a4.a0;
4366 result += a5.a0;
4367 result += a6.a0;
4368 result += a7.a0;
4369 result += a8.a0;
4370 result += a9.a0;
4371
4372 std::cout << "result = " << result << "\n";
4373
4374 return result;
4375}

◆ PassUnion8BytesNestedFloatx10()

Definition at line 4379 of file ffi_test_functions_generated.cc.

4388 {
4389 std::cout << "PassUnion8BytesNestedFloatx10" << "((" << a0.a0 << "), ("
4390 << a1.a0 << "), (" << a2.a0 << "), (" << a3.a0 << "), (" << a4.a0
4391 << "), (" << a5.a0 << "), (" << a6.a0 << "), (" << a7.a0 << "), ("
4392 << a8.a0 << "), (" << a9.a0 << "))" << "\n";
4393
4394 double result = 0;
4395
4396 result += a0.a0;
4397 result += a1.a0;
4398 result += a2.a0;
4399 result += a3.a0;
4400 result += a4.a0;
4401 result += a5.a0;
4402 result += a6.a0;
4403 result += a7.a0;
4404 result += a8.a0;
4405 result += a9.a0;
4406
4407 std::cout << "result = " << result << "\n";
4408
4409 return result;
4410}

◆ PassUnion9BytesNestedIntx10()

Definition at line 4414 of file ffi_test_functions_generated.cc.

4423 {
4424 std::cout << "PassUnion9BytesNestedIntx10" << "(((" << a0.a0.a0 << ", "
4425 << a0.a0.a1 << ", " << a0.a0.a2 << ")), ((" << a1.a0.a0 << ", "
4426 << a1.a0.a1 << ", " << a1.a0.a2 << ")), ((" << a2.a0.a0 << ", "
4427 << a2.a0.a1 << ", " << a2.a0.a2 << ")), ((" << a3.a0.a0 << ", "
4428 << a3.a0.a1 << ", " << a3.a0.a2 << ")), ((" << a4.a0.a0 << ", "
4429 << a4.a0.a1 << ", " << a4.a0.a2 << ")), ((" << a5.a0.a0 << ", "
4430 << a5.a0.a1 << ", " << a5.a0.a2 << ")), ((" << a6.a0.a0 << ", "
4431 << a6.a0.a1 << ", " << a6.a0.a2 << ")), ((" << a7.a0.a0 << ", "
4432 << a7.a0.a1 << ", " << a7.a0.a2 << ")), ((" << a8.a0.a0 << ", "
4433 << a8.a0.a1 << ", " << a8.a0.a2 << ")), ((" << a9.a0.a0 << ", "
4434 << a9.a0.a1 << ", " << a9.a0.a2 << ")))" << "\n";
4435
4436 double result = 0;
4437
4438 result += a0.a0.a0;
4439 result += a0.a0.a1;
4440 result += a0.a0.a2;
4441 result += a1.a0.a0;
4442 result += a1.a0.a1;
4443 result += a1.a0.a2;
4444 result += a2.a0.a0;
4445 result += a2.a0.a1;
4446 result += a2.a0.a2;
4447 result += a3.a0.a0;
4448 result += a3.a0.a1;
4449 result += a3.a0.a2;
4450 result += a4.a0.a0;
4451 result += a4.a0.a1;
4452 result += a4.a0.a2;
4453 result += a5.a0.a0;
4454 result += a5.a0.a1;
4455 result += a5.a0.a2;
4456 result += a6.a0.a0;
4457 result += a6.a0.a1;
4458 result += a6.a0.a2;
4459 result += a7.a0.a0;
4460 result += a7.a0.a1;
4461 result += a7.a0.a2;
4462 result += a8.a0.a0;
4463 result += a8.a0.a1;
4464 result += a8.a0.a2;
4465 result += a9.a0.a0;
4466 result += a9.a0.a1;
4467 result += a9.a0.a2;
4468
4469 std::cout << "result = " << result << "\n";
4470
4471 return result;
4472}

◆ PassWCharStructInlineArrayIntUintPtrx2LongUnsigned()

DART_EXPORT wchar_t dart::PassWCharStructInlineArrayIntUintPtrx2LongUnsigned ( wchar_t  a0,
StructInlineArrayInt  a1,
uintptr_t  a2,
uintptr_t  a3,
long  a4,
unsigned long  a5 
)

Definition at line 4727 of file ffi_test_functions_generated.cc.

4733 {
4734 std::cout << "PassWCharStructInlineArrayIntUintPtrx2LongUnsigned" << "(" << a0
4735 << ", ([" << a1.a0[0] << ", " << a1.a0[1] << ", " << a1.a0[2]
4736 << ", " << a1.a0[3] << ", " << a1.a0[4] << ", " << a1.a0[5] << ", "
4737 << a1.a0[6] << ", " << a1.a0[7] << ", " << a1.a0[8] << ", "
4738 << a1.a0[9] << "]), " << a2 << ", " << a3 << ", " << a4 << ", "
4739 << a5 << ")" << "\n";
4740
4741 wchar_t result = 0;
4742
4743 result += a0;
4744 result += a1.a0[0];
4745 result += a1.a0[1];
4746 result += a1.a0[2];
4747 result += a1.a0[3];
4748 result += a1.a0[4];
4749 result += a1.a0[5];
4750 result += a1.a0[6];
4751 result += a1.a0[7];
4752 result += a1.a0[8];
4753 result += a1.a0[9];
4754 result += a2;
4755 result += a3;
4756 result += a4;
4757 result += a5;
4758
4759 std::cout << "result = " << result << "\n";
4760
4761 return result;
4762}

◆ Pause()

static void dart::Pause ( Thread thread,
JSONStream js 
)
static

Definition at line 4414 of file service.cc.

4414 {
4415 // TODO(turnidge): This interrupt message could have been sent from
4416 // the service isolate directly, but would require some special case
4417 // code. That would prevent this isolate getting double-interrupted
4418 // with OOB messages.
4419 Isolate* isolate = thread->isolate();
4420 isolate->SendInternalLibMessage(Isolate::kInterruptMsg,
4421 isolate->pause_capability());
4422 PrintSuccess(js);
4423}
void SendInternalLibMessage(LibMsgId msg_id, uint64_t capability)
Definition isolate.cc:997
uint64_t pause_capability() const
Definition isolate.h:1009

◆ PhiHasSingleUse()

static bool dart::PhiHasSingleUse ( PhiInstr phi,
Value use 
)
static

Definition at line 15 of file branch_optimizer.cc.

15 {
16 if ((use->next_use() != nullptr) || (phi->input_use_list() != use)) {
17 return false;
18 }
19
20 BlockEntryInstr* block = phi->block();
21 for (Value* env_use = phi->env_use_list(); env_use != nullptr;
22 env_use = env_use->next_use()) {
23 if ((env_use->instruction() != block) &&
24 (env_use->instruction() != use->instruction())) {
25 return false;
26 }
27 }
28
29 return true;
30}
Value * next_use() const
Definition il.h:114

◆ PopulateUriMappings()

static void dart::PopulateUriMappings ( Thread thread)
static

Definition at line 5361 of file service.cc.

5361 {
5362 Zone* zone = thread->zone();
5363 auto object_store = thread->isolate_group()->object_store();
5364 UriMapping uri_to_resolved_uri(HashTables::New<UriMapping>(16, Heap::kOld));
5365 UriMapping resolved_uri_to_uri(HashTables::New<UriMapping>(16, Heap::kOld));
5366
5367 const auto& libs =
5368 GrowableObjectArray::Handle(zone, object_store->libraries());
5369 intptr_t num_libs = libs.Length();
5370
5371 Library& lib = Library::Handle(zone);
5372 Script& script = Script::Handle(zone);
5373 Array& scripts = Array::Handle(zone);
5374 String& uri = String::Handle(zone);
5375 String& resolved_uri = String::Handle(zone);
5376#if defined(DART_HOST_OS_WINDOWS) || defined(DART_HOST_OS_MACOS)
5377 String& tmp = thread->StringHandle();
5378#endif
5379 for (intptr_t i = 0; i < num_libs; ++i) {
5380 lib ^= libs.At(i);
5381 scripts ^= lib.LoadedScripts();
5382 intptr_t num_scripts = scripts.Length();
5383 for (intptr_t j = 0; j < num_scripts; ++j) {
5384 script ^= scripts.At(j);
5385 uri ^= script.url();
5386 resolved_uri ^= script.resolved_url();
5387 uri_to_resolved_uri.UpdateOrInsert(uri, resolved_uri);
5388 resolved_uri_to_uri.UpdateOrInsert(resolved_uri, uri);
5389
5390#if defined(DART_HOST_OS_WINDOWS) || defined(DART_HOST_OS_MACOS)
5391 // Allow for case insensitive matching on platforms that might allow for
5392 // case insensitive paths.
5393 tmp = String::ToLowerCase(uri);
5394 uri_to_resolved_uri.UpdateOrInsert(tmp, resolved_uri);
5395 tmp = String::ToLowerCase(resolved_uri);
5396 resolved_uri_to_uri.UpdateOrInsert(tmp, uri);
5397#endif
5398 }
5399 }
5400
5401 object_store->set_uri_to_resolved_uri_map(uri_to_resolved_uri.Release());
5402 object_store->set_resolved_uri_to_uri_map(resolved_uri_to_uri.Release());
5403 Smi& count = Smi::Handle(zone, Smi::New(num_libs));
5404 object_store->set_last_libraries_count(count);
5405}

◆ PostCObjectHelper()

static bool dart::PostCObjectHelper ( Dart_Port  port_id,
Dart_CObject message 
)
static

Definition at line 46 of file native_api_impl.cc.

46 {
48 std::unique_ptr<Message> msg = WriteApiMessage(
49 zone.GetZone(), message, port_id, Message::kNormalPriority);
50
51 if (msg == nullptr) {
52 return false;
53 }
54
55 // Post the message at the given port.
56 return PortMap::PostMessage(std::move(msg));
57}

◆ PrecompilationModeHandler()

static void dart::PrecompilationModeHandler ( bool  value)
static

Definition at line 91 of file compiler.cc.

91 {
92 if (value) {
93#if defined(TARGET_ARCH_IA32)
94 FATAL("Precompilation not supported on IA32");
95#endif
96
97 FLAG_background_compilation = false;
98 FLAG_enable_mirrors = false;
99 FLAG_interpret_irregexp = true;
100 FLAG_lazy_dispatchers = false;
101 FLAG_link_natives_lazily = true;
102 FLAG_optimization_counter_threshold = -1;
103 FLAG_polymorphic_with_deopt = false;
104 FLAG_precompiled_mode = true;
105 FLAG_reorder_basic_blocks = true;
106 FLAG_use_field_guards = false;
107 FLAG_use_cha_deopt = false;
108
109#if !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME)
110 // Set flags affecting runtime accordingly for gen_snapshot.
111 // These flags are constants with PRODUCT and DART_PRECOMPILED_RUNTIME.
112 FLAG_deoptimize_alot = false; // Used in some tests.
113 FLAG_deoptimize_every = 0; // Used in some tests.
114 FLAG_use_osr = false;
115#endif
116 }
117}

◆ Prepare()

static intptr_t dart::Prepare ( const RegExp regexp,
const String subject,
bool  sticky,
Zone zone 
)
static

Definition at line 422 of file regexp_assembler_bytecode.cc.

425 {
426 bool is_one_byte = subject.IsOneByteString();
427
428 if (regexp.bytecode(is_one_byte, sticky) == TypedData::null()) {
429 const String& pattern = String::Handle(zone, regexp.pattern());
430#if defined(SUPPORT_TIMELINE)
431 TimelineBeginEndScope tbes(Thread::Current(), Timeline::GetCompilerStream(),
432 "CompileIrregexpBytecode");
433 if (tbes.enabled()) {
434 tbes.SetNumArguments(1);
435 tbes.CopyArgument(0, "pattern", pattern.ToCString());
436 }
437#endif // !defined(PRODUCT)
438
439 RegExpCompileData* compile_data = new (zone) RegExpCompileData();
440
441 // Parsing failures are handled in the RegExp factory constructor.
442 RegExpParser::ParseRegExp(pattern, regexp.flags(), compile_data);
443
444 regexp.set_num_bracket_expressions(compile_data->capture_count);
445 regexp.set_capture_name_map(compile_data->capture_name_map);
446 if (compile_data->simple) {
447 regexp.set_is_simple();
448 } else {
449 regexp.set_is_complex();
450 }
451
452 RegExpEngine::CompilationResult result = RegExpEngine::CompileBytecode(
453 compile_data, regexp, is_one_byte, sticky, zone);
454 if (result.error_message != nullptr) {
455 Exceptions::ThrowUnsupportedError(result.error_message);
456 }
457 ASSERT(result.bytecode != nullptr);
458 ASSERT(regexp.num_registers(is_one_byte) == -1 ||
459 regexp.num_registers(is_one_byte) == result.num_registers);
460 regexp.set_num_registers(is_one_byte, result.num_registers);
461 regexp.set_bytecode(is_one_byte, sticky, *(result.bytecode));
462 }
463
464 ASSERT(regexp.num_registers(is_one_byte) != -1);
465
466 return regexp.num_registers(is_one_byte) +
467 (regexp.num_bracket_expressions() + 1) * 2;
468}
void set_is_simple() const
Definition object.h:12856
void set_is_complex() const
Definition object.h:12857
void set_num_bracket_expressions(SmiPtr value) const
void set_capture_name_map(const Array &array) const
Definition object.cc:26737
void set_bytecode(bool is_one_byte, bool sticky, const TypedData &bytecode) const
Definition object.cc:26715
intptr_t num_registers(bool is_one_byte) const
Definition object.h:12765
void set_num_registers(bool is_one_byte, intptr_t value) const
Definition object.h:12858

◆ PrepareInlineIndexedOp()

static intptr_t dart::PrepareInlineIndexedOp ( FlowGraph flow_graph,
Instruction call,
intptr_t  array_cid,
Definition **  array,
Definition **  index,
Instruction **  cursor 
)
static

Definition at line 1753 of file call_specializer.cc.

1758 {
1759 // Insert array length load and bounds check.
1761 new (Z) Value(*array), Slot::GetLengthFieldForArrayCid(array_cid),
1762 call->source());
1763 *cursor = flow_graph->AppendTo(*cursor, length, nullptr, FlowGraph::kValue);
1764 *index = flow_graph->CreateCheckBound(length, *index, call->deopt_id());
1765 *cursor =
1766 flow_graph->AppendTo(*cursor, *index, call->env(), FlowGraph::kValue);
1767
1768 if (array_cid == kGrowableObjectArrayCid) {
1769 // Insert data elements load.
1770 LoadFieldInstr* elements = new (Z)
1771 LoadFieldInstr(new (Z) Value(*array), Slot::GrowableObjectArray_data(),
1772 call->source());
1773 *cursor =
1774 flow_graph->AppendTo(*cursor, elements, nullptr, FlowGraph::kValue);
1775 // Load from the data from backing store which is a fixed-length array.
1776 *array = elements;
1777 array_cid = kArrayCid;
1778 } else if (IsExternalTypedDataClassId(array_cid)) {
1779 auto* const elements = new (Z) LoadFieldInstr(
1780 new (Z) Value(*array), Slot::PointerBase_data(),
1781 InnerPointerAccess::kCannotBeInnerPointer, call->source());
1782 *cursor =
1783 flow_graph->AppendTo(*cursor, elements, nullptr, FlowGraph::kValue);
1784 *array = elements;
1785 }
1786 return array_cid;
1787}

◆ PrepareInlineStringIndexOp()

static Definition * dart::PrepareInlineStringIndexOp ( FlowGraph flow_graph,
Instruction call,
intptr_t  cid,
Definition str,
Definition index,
Instruction cursor 
)
static

Definition at line 2068 of file call_specializer.cc.

2073 {
2075 new (Z) Value(str), Slot::GetLengthFieldForArrayCid(cid), str->source());
2076 cursor = flow_graph->AppendTo(cursor, length, nullptr, FlowGraph::kValue);
2077
2078 // Bounds check.
2079 if (CompilerState::Current().is_aot()) {
2080 // Add a null-check in case the index argument is known to be compatible
2081 // but possibly nullable. By inserting the null-check, we can allow the
2082 // unbox instruction later inserted to be non-speculative.
2083 auto* const null_check = new (Z)
2084 CheckNullInstr(new (Z) Value(index), Symbols::Index(), call->deopt_id(),
2085 call->source(), CheckNullInstr::kArgumentError);
2086 cursor = flow_graph->AppendTo(cursor, null_check, call->env(),
2087 FlowGraph::kEffect);
2088 }
2089 index = flow_graph->CreateCheckBound(length, index, call->deopt_id());
2090 cursor = flow_graph->AppendTo(cursor, index, call->env(), FlowGraph::kValue);
2091
2092 LoadIndexedInstr* load_indexed = new (Z) LoadIndexedInstr(
2093 new (Z) Value(str), new (Z) Value(index), /*index_unboxed=*/false,
2094 compiler::target::Instance::ElementSizeFor(cid), cid, kAlignedAccess,
2095 call->deopt_id(), call->source());
2096 cursor =
2097 flow_graph->AppendTo(cursor, load_indexed, nullptr, FlowGraph::kValue);
2098
2099 auto box = BoxInstr::Create(kUnboxedIntPtr, new Value(load_indexed));
2100 cursor = flow_graph->AppendTo(cursor, box, nullptr, FlowGraph::kValue);
2101
2102 ASSERT(box == cursor);
2103 return box;
2104}
InstructionSource source() const
Definition il.h:1002

◆ PrintAndInspectResolver()

static Dart_NativeFunction dart::PrintAndInspectResolver ( Dart_Handle  name,
int  argument_count,
bool *  auto_setup_scope 
)
static

Definition at line 533 of file inliner_test.cc.

535 {
536 ASSERT(auto_setup_scope != nullptr);
537 *auto_setup_scope = true;
538 const char* cstr = nullptr;
541 if (strcmp(cstr, "testPrint") == 0) {
542 return &TestPrint;
543 } else {
544 return &InspectStack;
545 }
546}
static void TestPrint(Dart_NativeArguments args)

◆ PrintBitVector()

static void dart::PrintBitVector ( const char *  tag,
BitVector v 
)
static

Definition at line 746 of file flow_graph.cc.

746 {
747 THR_Print("%s:", tag);
748 for (BitVector::Iterator it(v); !it.Done(); it.Advance()) {
749 THR_Print(" %" Pd "", it.Current());
750 }
751 THR_Print("\n");
752}

◆ PrintInboundReferences()

static void dart::PrintInboundReferences ( Thread thread,
Object target,
intptr_t  limit,
JSONStream js 
)
static

Definition at line 2285 of file service.cc.

2288 {
2289 ObjectGraph graph(thread);
2290 Array& path = Array::Handle(Array::New(limit * 2));
2291 intptr_t length = graph.InboundReferences(target, path);
2292 OffsetsTable offsets_table(thread->zone());
2293 JSONObject jsobj(js);
2294 jsobj.AddProperty("type", "InboundReferences");
2295 {
2296 JSONArray elements(&jsobj, "references");
2297 Object& source = Object::Handle();
2298 Smi& slot_offset = Smi::Handle();
2299 Array& field_names = Array::Handle();
2300 String& name = String::Handle();
2301 Class& source_class = Class::Handle();
2302 Field& field = Field::Handle();
2303 Array& parent_field_map = Array::Handle();
2304 limit = Utils::Minimum(limit, length);
2305 for (intptr_t i = 0; i < limit; ++i) {
2306 JSONObject jselement(&elements);
2307 source = path.At(i * 2);
2308 slot_offset ^= path.At((i * 2) + 1);
2309
2310 jselement.AddProperty("source", source);
2311 if (source.IsArray()) {
2312 intptr_t element_index =
2313 (slot_offset.Value() - Array::element_offset(0)) /
2314 Array::kBytesPerElement;
2315 jselement.AddProperty("parentListIndex", element_index);
2316 jselement.AddProperty("parentField", element_index);
2317 } else if (source.IsRecord()) {
2318 AddParentFieldToResponseBasedOnRecord(thread, &field_names, &name,
2319 jselement, Record::Cast(source),
2320 slot_offset.Value());
2321 } else {
2322 if (source.IsInstance()) {
2323 source_class = source.clazz();
2324 parent_field_map = source_class.OffsetToFieldMap();
2325 intptr_t index = slot_offset.Value() >> kCompressedWordSizeLog2;
2326 if (index > 0 && index < parent_field_map.Length()) {
2327 field ^= parent_field_map.At(index);
2328 if (!field.IsNull()) {
2329 jselement.AddProperty("parentField", field);
2330 continue;
2331 }
2332 }
2333 }
2334 const char* field_name = offsets_table.FieldNameForOffset(
2335 source.GetClassId(), slot_offset.Value());
2336 if (field_name != nullptr) {
2337 jselement.AddProperty("_parentWordOffset", slot_offset.Value());
2338 // TODO(vm-service): Adjust RPC type to allow returning a field name
2339 // without a field object, or reify the fields described by
2340 // raw_object_fields.cc
2341 // jselement.AddProperty("_parentFieldName", field_name);
2342 } else if (source.IsContext()) {
2343 intptr_t element_index =
2344 (slot_offset.Value() - Context::variable_offset(0)) /
2345 Context::kBytesPerElement;
2346 jselement.AddProperty("parentListIndex", element_index);
2347 jselement.AddProperty("parentField", element_index);
2348 } else {
2349 jselement.AddProperty("_parentWordOffset", slot_offset.Value());
2350 }
2351 }
2352 }
2353 }
2354
2355 // We nil out the array after generating the response to prevent
2356 // reporting spurious references when repeatedly looking for the
2357 // references to an object.
2358 for (intptr_t i = 0; i < path.Length(); i++) {
2359 path.SetAt(i, Object::null_object());
2360 }
2361}
ArrayPtr OffsetToFieldMap(ClassTable *class_table=nullptr) const
Definition object.cc:3233

◆ PrintInvalidParamError()

static void dart::PrintInvalidParamError ( JSONStream js,
const char *  param 
)
static

Definition at line 128 of file service.cc.

128 {
129#if !defined(PRODUCT)
130 js->PrintError(kInvalidParams, "%s: invalid '%s' parameter: %s", js->method(),
131 param, js->LookupParam(param));
132#endif
133}

◆ PrintMetadata()

static void dart::PrintMetadata ( const char *  name,
const Object data 
)
static

Definition at line 5411 of file object_test.cc.

5411 {
5412 if (data.IsError()) {
5413 OS::PrintErr("Error in metadata evaluation for %s: '%s'\n", name,
5414 Error::Cast(data).ToErrorCString());
5415 }
5416 EXPECT(data.IsArray());
5417 const Array& metadata = Array::Cast(data);
5418 OS::PrintErr("Metadata for %s has %" Pd " values:\n", name,
5419 metadata.Length());
5420 Object& elem = Object::Handle();
5421 for (int i = 0; i < metadata.Length(); i++) {
5422 elem = metadata.At(i);
5423 OS::PrintErr(" %d: %s\n", i, elem.ToCString());
5424 }
5425}

◆ PrintMissingParamError()

static void dart::PrintMissingParamError ( JSONStream js,
const char *  param 
)
static

Definition at line 885 of file service.cc.

885 {
886 js->PrintError(kInvalidParams, "%s expects the '%s' parameter", js->method(),
887 param);
888}

◆ PrintRequest()

static void dart::PrintRequest ( JSONObject obj,
JSONStream js 
)
static

Definition at line 152 of file json_stream.cc.

152 {
153 JSONObject jsobj(obj, "request");
154 jsobj.AddProperty("method", js->method());
155 {
156 JSONObject params(&jsobj, "params");
157 for (intptr_t i = 0; i < js->num_params(); i++) {
158 params.AddProperty(js->GetParamKey(i), js->GetParamValue(i));
159 }
160 }
161}

◆ PrintRetainingPath()

static void dart::PrintRetainingPath ( Thread thread,
Object obj,
intptr_t  limit,
JSONStream js 
)
static

Definition at line 2404 of file service.cc.

2407 {
2408 ObjectGraph graph(thread);
2409 Array& path = Array::Handle(Array::New(limit * 2));
2410 auto result = graph.RetainingPath(obj, path);
2411 intptr_t length = result.length;
2412 JSONObject jsobj(js);
2413 jsobj.AddProperty("type", "RetainingPath");
2414 jsobj.AddProperty("length", length);
2415 jsobj.AddProperty("gcRootType", result.gc_root_type);
2416 JSONArray elements(&jsobj, "elements");
2417 Object& element = Object::Handle();
2418 Smi& slot_offset = Smi::Handle();
2419 Array& field_names = Array::Handle();
2420 String& name = String::Handle();
2421 Class& element_class = Class::Handle();
2422 Array& element_field_map = Array::Handle();
2423 Map& map = Map::Handle();
2424 Array& map_data = Array::Handle();
2425 Field& field = Field::Handle();
2426 WeakProperty& wp = WeakProperty::Handle();
2427 limit = Utils::Minimum(limit, length);
2428 OffsetsTable offsets_table(thread->zone());
2429 for (intptr_t i = 0; i < limit; ++i) {
2430 JSONObject jselement(&elements);
2431 element = path.At(i * 2);
2432 jselement.AddProperty("value", element);
2433 // Interpret the word offset from parent as list index, map key,
2434 // weak property, or instance field.
2435 if (i > 0) {
2436 slot_offset ^= path.At((i * 2) - 1);
2437 if (element.IsArray() || element.IsGrowableObjectArray()) {
2438 intptr_t element_index =
2439 (slot_offset.Value() - Array::element_offset(0)) /
2440 Array::kBytesPerElement;
2441 jselement.AddProperty("parentListIndex", element_index);
2442 jselement.AddProperty("parentField", element_index);
2443 } else if (element.IsRecord()) {
2444 AddParentFieldToResponseBasedOnRecord(thread, &field_names, &name,
2445 jselement, Record::Cast(element),
2446 slot_offset.Value());
2447 } else if (element.IsMap()) {
2448 map = static_cast<MapPtr>(path.At(i * 2));
2449 map_data = map.data();
2450 intptr_t element_index =
2451 (slot_offset.Value() - Array::element_offset(0)) /
2452 Array::kBytesPerElement;
2453 Map::Iterator iterator(map);
2454 while (iterator.MoveNext()) {
2455 if (iterator.CurrentKey() == map_data.At(element_index) ||
2456 iterator.CurrentValue() == map_data.At(element_index)) {
2457 element = iterator.CurrentKey();
2458 jselement.AddProperty("parentMapKey", element);
2459 break;
2460 }
2461 }
2462 } else if (element.IsWeakProperty()) {
2463 wp ^= static_cast<WeakPropertyPtr>(element.ptr());
2464 element = wp.key();
2465 jselement.AddProperty("parentMapKey", element);
2466 } else {
2467 if (element.IsInstance()) {
2468 element_class = element.clazz();
2469 element_field_map = element_class.OffsetToFieldMap();
2470 intptr_t index = slot_offset.Value() >> kCompressedWordSizeLog2;
2471 if ((index > 0) && (index < element_field_map.Length())) {
2472 field ^= element_field_map.At(index);
2473 if (!field.IsNull()) {
2474 name ^= field.name();
2475 jselement.AddProperty("parentField", name.ToCString());
2476 continue;
2477 }
2478 }
2479 }
2480 const char* field_name = offsets_table.FieldNameForOffset(
2481 element.GetClassId(), slot_offset.Value());
2482 if (field_name != nullptr) {
2483 jselement.AddProperty("parentField", field_name);
2484 } else if (element.IsContext()) {
2485 intptr_t element_index =
2486 (slot_offset.Value() - Context::variable_offset(0)) /
2487 Context::kBytesPerElement;
2488 jselement.AddProperty("parentListIndex", element_index);
2489 jselement.AddProperty("parentField", element_index);
2490 } else {
2491 jselement.AddProperty("_parentWordOffset", slot_offset.Value());
2492 }
2493 }
2494 }
2495 }
2496
2497 // We nil out the array after generating the response to prevent
2498 // reporting spurious references when looking for inbound references
2499 // after looking for a retaining path.
2500 for (intptr_t i = 0; i < path.Length(); i++) {
2501 path.SetAt(i, Object::null_object());
2502 }
2503}

◆ PrintSentinel()

static void dart::PrintSentinel ( JSONStream js,
SentinelType  sentinel_type 
)
static

Definition at line 1535 of file service.cc.

1535 {
1536 JSONObject jsobj(js);
1537 jsobj.AddProperty("type", "Sentinel");
1538 switch (sentinel_type) {
1539 case kCollectedSentinel:
1540 jsobj.AddProperty("kind", "Collected");
1541 jsobj.AddProperty("valueAsString", "<collected>");
1542 break;
1543 case kExpiredSentinel:
1544 jsobj.AddProperty("kind", "Expired");
1545 jsobj.AddProperty("valueAsString", "<expired>");
1546 break;
1547 case kFreeSentinel:
1548 jsobj.AddProperty("kind", "Free");
1549 jsobj.AddProperty("valueAsString", "<free>");
1550 break;
1551 default:
1552 UNIMPLEMENTED();
1553 break;
1554 }
1555}

◆ PrintShowHideNamesToJSON()

static void dart::PrintShowHideNamesToJSON ( JSONObject jsobj,
const Namespace ns 
)
static

Definition at line 568 of file object_service.cc.

568 {
569 Array& arr = Array::Handle();
570 String& name = String::Handle();
571 arr ^= ns.show_names();
572 if (!arr.IsNull()) {
573 JSONArray jsarr(jsobj, "shows");
574 for (intptr_t i = 0; i < arr.Length(); ++i) {
575 name ^= arr.At(i);
576 jsarr.AddValue(name.ToCString());
577 }
578 }
579 arr ^= ns.hide_names();
580 if (!arr.IsNull()) {
581 JSONArray jsarr(jsobj, "hides");
582 for (intptr_t i = 0; i < arr.Length(); ++i) {
583 name ^= arr.At(i);
584 jsarr.AddValue(name.ToCString());
585 }
586 }
587}

◆ PrintSubtypeCheck()

static void dart::PrintSubtypeCheck ( const AbstractType subtype,
const AbstractType supertype,
const bool  result 
)
static

Definition at line 652 of file runtime_entry.cc.

654 {
655 DartFrameIterator iterator(Thread::Current(),
656 StackFrameIterator::kNoCrossThreadIteration);
657 StackFrame* caller_frame = iterator.NextFrame();
658 ASSERT(caller_frame != nullptr);
659
660 LogBlock lb;
661 THR_Print("SubtypeCheck: '%s' %d %s '%s' %d (pc: %#" Px ").\n",
662 subtype.NameCString(), subtype.type_class_id(),
663 result ? "is" : "is !", supertype.NameCString(),
664 supertype.type_class_id(), caller_frame->pc());
665
666 const Function& function =
667 Function::Handle(caller_frame->LookupDartFunction());
668 if (function.HasSavedArgumentsDescriptor()) {
669 const auto& args_desc_array = Array::Handle(function.saved_args_desc());
670 const ArgumentsDescriptor args_desc(args_desc_array);
671 THR_Print(" -> Function %s [%s]\n", function.ToFullyQualifiedCString(),
672 args_desc.ToCString());
673 } else {
674 THR_Print(" -> Function %s\n", function.ToFullyQualifiedCString());
675 }
676}

◆ PrintSuccess()

static void dart::PrintSuccess ( JSONStream js)
static

Definition at line 507 of file service.cc.

507 {
508 JSONObject jsobj(js);
509 jsobj.AddProperty("type", "Success");
510}

◆ PrintSymbolicStackFrame()

static void dart::PrintSymbolicStackFrame ( Zone zone,
BaseTextBuffer buffer,
const Function function,
TokenPosition  token_pos_or_line,
intptr_t  frame_index,
bool  is_line = false 
)
static

Definition at line 26265 of file object.cc.

26270 {
26271 ASSERT(!function.IsNull());
26272 const auto& script = Script::Handle(zone, function.script());
26273 const char* function_name = function.QualifiedUserVisibleNameCString();
26274 const char* url = script.IsNull()
26275 ? "Kernel"
26276 : String::Handle(zone, script.url()).ToCString();
26277
26278 // If the URI starts with "data:application/dart;" this is a URI encoded
26279 // script so we shouldn't print the entire URI because it could be very long.
26280 if (strstr(url, "data:application/dart;") == url) {
26281 url = "<data:application/dart>";
26282 }
26283
26284 intptr_t line = -1;
26285 intptr_t column = -1;
26286 if (is_line) {
26287 ASSERT(token_pos_or_line.IsNoSource() || token_pos_or_line.IsReal());
26288 if (token_pos_or_line.IsReal()) {
26289 line = token_pos_or_line.Pos();
26290 }
26291 } else {
26292 ASSERT(!script.IsNull());
26293 script.GetTokenLocation(token_pos_or_line, &line, &column);
26294 }
26296 PrintSymbolicStackFrameBody(buffer, function_name, url, line, column);
26297}
bool IsNoSource() const
static void PrintSymbolicStackFrameBody(BaseTextBuffer *buffer, const char *function_name, const char *url, intptr_t line=-1, intptr_t column=-1)
Definition object.cc:26250
static void PrintSymbolicStackFrameIndex(BaseTextBuffer *buffer, intptr_t frame_index)
Definition object.cc:26245

◆ PrintSymbolicStackFrameBody()

static void dart::PrintSymbolicStackFrameBody ( BaseTextBuffer buffer,
const char *  function_name,
const char *  url,
intptr_t  line = -1,
intptr_t  column = -1 
)
static

Definition at line 26250 of file object.cc.

26254 {
26255 buffer->Printf(" %s (%s", function_name, url);
26256 if (line >= 0) {
26257 buffer->Printf(":%" Pd "", line);
26258 if (column >= 0) {
26259 buffer->Printf(":%" Pd "", column);
26260 }
26261 }
26262 buffer->Printf(")\n");
26263}

◆ PrintSymbolicStackFrameIndex()

static void dart::PrintSymbolicStackFrameIndex ( BaseTextBuffer buffer,
intptr_t  frame_index 
)
static

Definition at line 26245 of file object.cc.

26246 {
26247 buffer->Printf("#%-6" Pd "", frame_index);
26248}

◆ PrintTypeCheck()

static void dart::PrintTypeCheck ( const char *  message,
const Instance instance,
const AbstractType type,
const TypeArguments instantiator_type_arguments,
const TypeArguments function_type_arguments,
const Bool result 
)
static

Definition at line 862 of file runtime_entry.cc.

867 {
868 DartFrameIterator iterator(Thread::Current(),
869 StackFrameIterator::kNoCrossThreadIteration);
870 StackFrame* caller_frame = iterator.NextFrame();
871 ASSERT(caller_frame != nullptr);
872
873 const AbstractType& instance_type =
874 AbstractType::Handle(instance.GetType(Heap::kNew));
875 ASSERT(instance_type.IsInstantiated() ||
876 (instance.IsClosure() && instance_type.IsInstantiated(kCurrentClass)));
877 LogBlock lb;
878 if (type.IsInstantiated()) {
879 THR_Print("%s: '%s' %d %s '%s' %d (pc: %#" Px ").\n", message,
880 instance_type.NameCString(), instance_type.type_class_id(),
881 (result.ptr() == Bool::True().ptr()) ? "is" : "is !",
882 type.NameCString(), type.type_class_id(), caller_frame->pc());
883 } else {
884 // Instantiate type before printing.
885 const AbstractType& instantiated_type = AbstractType::Handle(
886 type.InstantiateFrom(instantiator_type_arguments,
887 function_type_arguments, kAllFree, Heap::kOld));
888 THR_Print("%s: '%s' %s '%s' instantiated from '%s' (pc: %#" Px ").\n",
889 message, instance_type.NameCString(),
890 (result.ptr() == Bool::True().ptr()) ? "is" : "is !",
891 instantiated_type.NameCString(), type.NameCString(),
892 caller_frame->pc());
893 }
894 const Function& function =
895 Function::Handle(caller_frame->LookupDartFunction());
896 if (function.HasSavedArgumentsDescriptor()) {
897 const auto& args_desc_array = Array::Handle(function.saved_args_desc());
898 const ArgumentsDescriptor args_desc(args_desc_array);
899 THR_Print(" -> Function %s [%s]\n", function.ToFullyQualifiedCString(),
900 args_desc.ToCString());
901 } else {
902 THR_Print(" -> Function %s\n", function.ToFullyQualifiedCString());
903 }
904}
virtual bool IsInstantiated(Genericity genericity=kAny, intptr_t num_free_fun_type_params=kAllFree) const
Definition object.cc:21200

◆ PrintUnrecognizedMethodError()

static void dart::PrintUnrecognizedMethodError ( JSONStream js)
static

Definition at line 890 of file service.cc.

890 {
891 js->PrintError(kMethodNotFound, nullptr);
892}

◆ PrintUsage()

static void dart::PrintUsage ( )
static

Definition at line 86 of file run_vm_tests.cc.

86 {
87 Syslog::PrintErr(
88 "Usage: one of the following\n"
89 " run_vm_tests --list\n"
90 " run_vm_tests [--dfe=<snapshot file name>] --benchmarks\n"
91 " run_vm_tests [--dfe=<snapshot file name>] [vm-flags ...] <test name>\n"
92 " run_vm_tests [--dfe=<snapshot file name>] [vm-flags ...] <benchmark "
93 "name>\n");
94}

◆ PrintUtf16()

void dart::PrintUtf16 ( uint16_t  c)

Definition at line 18 of file regexp_assembler.cc.

18 {
19 const char* format = (0x20 <= c && c <= 0x7F) ? "%c"
20 : (c <= 0xff) ? "\\x%02x"
21 : "\\u%04x";
22 OS::PrintErr(format, c);
23}

◆ PrintVarInfo()

static int dart::PrintVarInfo ( char *  buffer,
int  len,
intptr_t  i,
const String var_name,
const UntaggedLocalVarDescriptors::VarInfo info 
)
static

Definition at line 16100 of file object.cc.

16104 {
16106 const int32_t index = info.index();
16107 if (kind == UntaggedLocalVarDescriptors::kContextLevel) {
16108 return Utils::SNPrint(buffer, len,
16109 "%2" Pd
16110 " %-13s level=%-3d"
16111 " begin=%-3d end=%d\n",
16112 i, LocalVarDescriptors::KindToCString(kind), index,
16113 static_cast<int>(info.begin_pos.Pos()),
16114 static_cast<int>(info.end_pos.Pos()));
16115 } else if (kind == UntaggedLocalVarDescriptors::kContextVar) {
16116 return Utils::SNPrint(
16117 buffer, len,
16118 "%2" Pd
16119 " %-13s level=%-3d index=%-3d"
16120 " begin=%-3d end=%-3d name=%s\n",
16121 i, LocalVarDescriptors::KindToCString(kind), info.scope_id, index,
16122 static_cast<int>(info.begin_pos.Pos()),
16123 static_cast<int>(info.end_pos.Pos()), var_name.ToCString());
16124 } else {
16125 return Utils::SNPrint(
16126 buffer, len,
16127 "%2" Pd
16128 " %-13s scope=%-3d index=%-3d"
16129 " begin=%-3d end=%-3d name=%s\n",
16130 i, LocalVarDescriptors::KindToCString(kind), info.scope_id, index,
16131 static_cast<int>(info.begin_pos.Pos()),
16132 static_cast<int>(info.end_pos.Pos()), var_name.ToCString());
16133 }
16134}

◆ PrivateLibName()

static Dart_Handle dart::PrivateLibName ( Dart_Handle  lib,
const char *  str 
)
static

Definition at line 6583 of file dart_api_impl_test.cc.

6583 {
6584 EXPECT(Dart_IsLibrary(lib));
6585 Thread* thread = Thread::Current();
6586 TransitionNativeToVM transition(thread);
6587 const Library& library_obj = Api::UnwrapLibraryHandle(thread->zone(), lib);
6588 const String& name = String::Handle(String::New(str));
6589 return Api::NewHandle(thread, library_obj.PrivateName(name));
6590}
DART_EXPORT bool Dart_IsLibrary(Dart_Handle object)

◆ PropagateError_native_lookup()

static Dart_NativeFunction dart::PropagateError_native_lookup ( Dart_Handle  name,
int  argument_count,
bool *  auto_setup_scope 
)
static

Definition at line 809 of file dart_api_impl_test.cc.

812 {
813 ASSERT(auto_setup_scope != nullptr);
814 *auto_setup_scope = true;
816}
void PropagateErrorNative(Dart_NativeArguments args)

◆ PropagateErrorNative()

void dart::PropagateErrorNative ( Dart_NativeArguments  args)

Definition at line 792 of file dart_api_impl_test.cc.

792 {
794 EXPECT(Dart_IsClosure(closure));
795 Dart_Handle result = Dart_InvokeClosure(closure, 0, nullptr);
797 if (use_set_return) {
799 } else if (use_throw_exception) {
801 EXPECT_VALID(result); // We do not expect to reach here.
802 UNREACHABLE();
803 } else {
805 UNREACHABLE();
806 }
807}

◆ PropagateErrorWithoutHandle()

DART_EXPORT int64_t dart::PropagateErrorWithoutHandle ( Dart_Handle(*)()  callback)

Definition at line 1061 of file ffi_test_functions_vmspecific.cc.

1061 {
1064 if (Dart_IsError(result)) {
1066 }
1068 return 0;
1069}

◆ PropagateLibraryModified()

static void dart::PropagateLibraryModified ( const ZoneGrowableArray< ZoneGrowableArray< intptr_t > * > *  imported_by,
intptr_t  lib_index,
BitVector modified_libs 
)
static

Copied in from https://dart-review.googlesource.com/c/sdk/+/77722.

Definition at line 1021 of file isolate_reload.cc.

1024 {
1025 ZoneGrowableArray<intptr_t>* dep_libs = (*imported_by)[lib_index];
1026 for (intptr_t i = 0; i < dep_libs->length(); i++) {
1027 intptr_t dep_lib_index = (*dep_libs)[i];
1028 if (!modified_libs->Contains(dep_lib_index)) {
1029 modified_libs->Add(dep_lib_index);
1030 PropagateLibraryModified(imported_by, dep_lib_index, modified_libs);
1031 }
1032 }
1033}
static void PropagateLibraryModified(const ZoneGrowableArray< ZoneGrowableArray< intptr_t > * > *imported_by, intptr_t lib_index, BitVector *modified_libs)
Copied in from https://dart-review.googlesource.com/c/sdk/+/77722.

◆ ProtectedHandleCallback()

void dart::ProtectedHandleCallback ( void *  peer)

◆ Ptr() [1/2]

static ObjectPtr dart::Ptr ( const Object obj)
static

Definition at line 404 of file object_graph_copy.cc.

404 {
405 return obj.ptr();
406}

◆ Ptr() [2/2]

static ObjectPtr dart::Ptr ( ObjectPtr  obj)
static

Definition at line 401 of file object_graph_copy.cc.

401 {
402 return obj;
403}

◆ PurgeNegativeTestCidsEntries()

static void dart::PurgeNegativeTestCidsEntries ( ZoneGrowableArray< intptr_t > *  results)
static

Definition at line 1381 of file call_specializer.cc.

1381 {
1382 // We can't purge the Smi entry at the beginning since it is used in the
1383 // Smi check before the Cid is loaded.
1384 int dest = 2;
1385 for (intptr_t i = 2; i < results->length(); i += 2) {
1386 if (results->At(i + 1) != 0) {
1387 (*results)[dest++] = results->At(i);
1388 (*results)[dest++] = results->At(i + 1);
1389 }
1390 }
1391 results->SetLength(dest);
1392}
void SetLength(intptr_t new_length)

◆ PushCodeUnit()

static void dart::PushCodeUnit ( RegExpCaptureName v,
uint32_t  code_unit 
)
static

Definition at line 1106 of file regexp_parser.cc.

1106 {
1107 if (code_unit <= Utf16::kMaxCodeUnit) {
1108 v->Add(code_unit);
1109 } else {
1110 uint16_t units[2];
1111 Utf16::Encode(code_unit, units);
1112 v->Add(units[0]);
1113 v->Add(units[1]);
1114 }
1115}

◆ PutIfAbsent()

template<typename T >
T * dart::PutIfAbsent ( Thread thread,
ZoneGrowableArray< T * > **  array_slot,
intptr_t  index,
std::function< T *()>  create 
)

Definition at line 19 of file compiler_state.cc.

22 {
23 auto array = *array_slot;
24
25 if (array == nullptr) {
26 Zone* const Z = thread->zone();
27 *array_slot = array = new (Z) ZoneGrowableArray<T*>(Z, index + 1);
28 }
29
30 while (array->length() <= index) {
31 array->Add(nullptr);
32 }
33
34 if (array->At(index) == nullptr) {
35 (*array)[index] = create();
36 }
37 return array->At(index);
38}

◆ QRegisterOf() [1/2]

static QRegister dart::QRegisterOf ( DRegister  d)
inlinestatic

Definition at line 279 of file constants_arm.h.

279 {
280 return static_cast<QRegister>(d / 2);
281}

◆ QRegisterOf() [2/2]

static QRegister dart::QRegisterOf ( SRegister  s)
inlinestatic

Definition at line 282 of file constants_arm.h.

282 {
283 return static_cast<QRegister>(s / 4);
284}

◆ QualifiedFunctionName()

static const char * dart::QualifiedFunctionName ( const Function func)
static

Definition at line 366 of file debugger.cc.

366 {
367 const String& func_name = String::Handle(func.name());
368 Class& func_class = Class::Handle(func.Owner());
369 String& class_name = String::Handle(func_class.Name());
370
371 return OS::SCreate(Thread::Current()->zone(), "%s%s%s",
372 func_class.IsTopLevel() ? "" : class_name.ToCString(),
373 func_class.IsTopLevel() ? "" : ".", func_name.ToCString());
374}
bool IsTopLevel() const
Definition object.cc:6176

◆ RangeContainsLatin1Equivalents()

static bool dart::RangeContainsLatin1Equivalents ( CharacterRange  range)
inlinestatic

Definition at line 1947 of file regexp.cc.

1947 {
1948 // TODO(dcarney): this could be a lot more efficient.
1949 return range.Contains(0x39c) || range.Contains(0x3bc) ||
1950 range.Contains(0x178);
1951}
bool Contains(int32_t i) const
Definition regexp.h:53

◆ RangesContainExpectedCids()

static void dart::RangesContainExpectedCids ( const Expect expect,
const CidRangeVector ranges,
const GrowableArray< intptr_t > &  expected 
)
static

Definition at line 470 of file il_test.cc.

472 {
473 ASSERT(!ranges.is_empty());
474 ASSERT(!expected.is_empty());
475 {
476 TextBuffer buffer(128);
477 buffer.AddString("Checking that ");
479 buffer.AddString("includes cids:\n");
480 for (const intptr_t cid : expected) {
481 buffer.AddString(" * ");
482 WriteCidTo(cid, &buffer);
483 buffer.AddString("\n");
484 }
485 THR_Print("%s", buffer.buffer());
486 }
487 bool all_found = true;
488 for (const intptr_t cid : expected) {
489 if (!ExpectRangesContainCid(expect, ranges, cid)) {
490 all_found = false;
491 }
492 }
493 if (all_found) {
494 THR_Print("All expected cids included.\n\n");
495 }
496}
static void WriteCidRangeVectorTo(const CidRangeVector &ranges, BaseTextBuffer *buffer)
Definition il_test.cc:439
static bool ExpectRangesContainCid(const Expect &expect, const CidRangeVector &ranges, intptr_t expected)
Definition il_test.cc:455

◆ RangesContainLatin1Equivalents()

static bool dart::RangesContainLatin1Equivalents ( ZoneGrowableArray< CharacterRange > *  ranges)
static

Definition at line 1953 of file regexp.cc.

1954 {
1955 for (intptr_t i = 0; i < ranges->length(); i++) {
1956 // TODO(dcarney): this could be a lot more efficient.
1957 if (RangeContainsLatin1Equivalents(ranges->At(i))) return true;
1958 }
1959 return false;
1960}
static bool RangeContainsLatin1Equivalents(CharacterRange range)
Definition regexp.cc:1947

◆ RangeSizeForPhi()

static RangeBoundary::RangeSize dart::RangeSizeForPhi ( Definition phi)
static

Definition at line 436 of file range_analysis.cc.

436 {
437 ASSERT(phi->IsPhi());
438 if (phi->Type()->ToCid() == kSmiCid) {
439 return RangeBoundary::kRangeBoundarySmi;
440 } else if (phi->representation() == kUnboxedInt32) {
441 return RangeBoundary::kRangeBoundaryInt32;
442 } else if (phi->Type()->IsInt()) {
443 return RangeBoundary::kRangeBoundaryInt64;
444 } else {
445 UNREACHABLE();
446 return RangeBoundary::kRangeBoundaryInt64;
447 }
448}

◆ RawMatch()

template<typename Char >
static ObjectPtr dart::RawMatch ( const TypedData bytecode,
const String subject,
int32_t *  registers,
int32_t  current,
uint32_t  current_char 
)
static

Definition at line 182 of file regexp_interpreter.cc.

186 {
187 // BacktrackStack ensures that the memory allocated for the backtracking stack
188 // is returned to the system or cached if there is no stack being cached at
189 // the moment.
190 BacktrackStack backtrack_stack;
191 if (backtrack_stack.out_of_memory()) {
192 Exceptions::ThrowOOM();
193 UNREACHABLE();
194 }
195 int32_t* backtrack_stack_base = backtrack_stack.data();
196 int32_t* backtrack_sp = backtrack_stack_base;
197 intptr_t backtrack_stack_space = backtrack_stack.max_size();
198
199 // TODO(zerny): Optimize as single instance. V8 has this as an
200 // isolate member.
202
203 intptr_t subject_length = subject.Length();
204
205#ifdef DEBUG
206 if (FLAG_trace_regexp_bytecodes) {
207 OS::PrintErr("Start irregexp bytecode interpreter\n");
208 }
209#endif
210 const auto thread = Thread::Current();
211 const uint8_t* code_base;
212 const uint8_t* pc;
213 {
214 NoSafepointScope no_safepoint;
215 code_base = reinterpret_cast<uint8_t*>(bytecode.DataAddr(0));
216 pc = code_base;
217 }
218 while (true) {
219 if (UNLIKELY(thread->HasScheduledInterrupts())) {
220 intptr_t pc_offset = pc - code_base;
221 ErrorPtr error = thread->HandleInterrupts();
222 if (error != Object::null()) {
223 // Needs to be propagated to the Dart native invoking the
224 // regex matcher.
225 return error;
226 }
227 NoSafepointScope no_safepoint;
228 code_base = reinterpret_cast<uint8_t*>(bytecode.DataAddr(0));
229 pc = code_base + pc_offset;
230 }
231 NoSafepointScope no_safepoint;
232 bool check_for_safepoint_now = false;
233 while (!check_for_safepoint_now) {
234 int32_t insn = Load32Aligned(pc);
235 switch (insn & BYTECODE_MASK) {
236 BYTECODE(BREAK)
237 UNREACHABLE();
238 return Bool::False().ptr();
239 BYTECODE(PUSH_CP)
240 if (--backtrack_stack_space < 0) {
241 return Object::null();
242 }
243 *backtrack_sp++ = current;
244 pc += BC_PUSH_CP_LENGTH;
245 break;
246 BYTECODE(PUSH_BT)
247 if (--backtrack_stack_space < 0) {
248 return Object::null();
249 }
250 *backtrack_sp++ = Load32Aligned(pc + 4);
251 pc += BC_PUSH_BT_LENGTH;
252 break;
253 BYTECODE(PUSH_REGISTER)
254 if (--backtrack_stack_space < 0) {
255 return Object::null();
256 }
257 *backtrack_sp++ = registers[insn >> BYTECODE_SHIFT];
258 pc += BC_PUSH_REGISTER_LENGTH;
259 break;
260 BYTECODE(SET_REGISTER)
261 registers[insn >> BYTECODE_SHIFT] = Load32Aligned(pc + 4);
262 pc += BC_SET_REGISTER_LENGTH;
263 break;
264 BYTECODE(ADVANCE_REGISTER)
265 registers[insn >> BYTECODE_SHIFT] += Load32Aligned(pc + 4);
266 pc += BC_ADVANCE_REGISTER_LENGTH;
267 break;
268 BYTECODE(SET_REGISTER_TO_CP)
269 registers[insn >> BYTECODE_SHIFT] = current + Load32Aligned(pc + 4);
270 pc += BC_SET_REGISTER_TO_CP_LENGTH;
271 break;
272 BYTECODE(SET_CP_TO_REGISTER)
273 current = registers[insn >> BYTECODE_SHIFT];
274 pc += BC_SET_CP_TO_REGISTER_LENGTH;
275 break;
276 BYTECODE(SET_REGISTER_TO_SP)
277 registers[insn >> BYTECODE_SHIFT] =
278 static_cast<int>(backtrack_sp - backtrack_stack_base);
279 pc += BC_SET_REGISTER_TO_SP_LENGTH;
280 break;
281 BYTECODE(SET_SP_TO_REGISTER)
282 backtrack_sp = backtrack_stack_base + registers[insn >> BYTECODE_SHIFT];
283 backtrack_stack_space =
284 backtrack_stack.max_size() -
285 static_cast<int>(backtrack_sp - backtrack_stack_base);
286 pc += BC_SET_SP_TO_REGISTER_LENGTH;
287 break;
288 BYTECODE(POP_CP)
289 backtrack_stack_space++;
290 --backtrack_sp;
291 current = *backtrack_sp;
292 pc += BC_POP_CP_LENGTH;
293 break;
294 BYTECODE(POP_BT)
295 backtrack_stack_space++;
296 --backtrack_sp;
297 pc = code_base + *backtrack_sp;
298 // This should match check cadence in JIT irregexp implementation.
299 check_for_safepoint_now = true;
300 break;
301 BYTECODE(POP_REGISTER)
302 backtrack_stack_space++;
303 --backtrack_sp;
304 registers[insn >> BYTECODE_SHIFT] = *backtrack_sp;
305 pc += BC_POP_REGISTER_LENGTH;
306 break;
308 return Bool::False().ptr();
309 BYTECODE(SUCCEED)
310 return Bool::True().ptr();
311 BYTECODE(ADVANCE_CP)
312 current += insn >> BYTECODE_SHIFT;
313 pc += BC_ADVANCE_CP_LENGTH;
314 break;
315 BYTECODE(GOTO)
316 pc = code_base + Load32Aligned(pc + 4);
317 break;
318 BYTECODE(ADVANCE_CP_AND_GOTO)
319 current += insn >> BYTECODE_SHIFT;
320 pc = code_base + Load32Aligned(pc + 4);
321 break;
322 BYTECODE(CHECK_GREEDY)
323 if (current == backtrack_sp[-1]) {
324 backtrack_sp--;
325 backtrack_stack_space++;
326 pc = code_base + Load32Aligned(pc + 4);
327 } else {
328 pc += BC_CHECK_GREEDY_LENGTH;
329 }
330 break;
331 BYTECODE(LOAD_CURRENT_CHAR) {
332 int pos = current + (insn >> BYTECODE_SHIFT);
333 if (pos < 0 || pos >= subject_length) {
334 pc = code_base + Load32Aligned(pc + 4);
335 } else {
336 current_char = subject.CharAt(pos);
337 pc += BC_LOAD_CURRENT_CHAR_LENGTH;
338 }
339 break;
340 }
341 BYTECODE(LOAD_CURRENT_CHAR_UNCHECKED) {
342 int pos = current + (insn >> BYTECODE_SHIFT);
343 current_char = subject.CharAt(pos);
344 pc += BC_LOAD_CURRENT_CHAR_UNCHECKED_LENGTH;
345 break;
346 }
347 BYTECODE(LOAD_2_CURRENT_CHARS) {
348 int pos = current + (insn >> BYTECODE_SHIFT);
349 if (pos + 2 > subject_length) {
350 pc = code_base + Load32Aligned(pc + 4);
351 } else {
352 Char next = subject.CharAt(pos + 1);
353 current_char =
354 subject.CharAt(pos) | (next << (kBitsPerByte * sizeof(Char)));
355 pc += BC_LOAD_2_CURRENT_CHARS_LENGTH;
356 }
357 break;
358 }
359 BYTECODE(LOAD_2_CURRENT_CHARS_UNCHECKED) {
360 int pos = current + (insn >> BYTECODE_SHIFT);
361 Char next = subject.CharAt(pos + 1);
362 current_char =
363 subject.CharAt(pos) | (next << (kBitsPerByte * sizeof(Char)));
364 pc += BC_LOAD_2_CURRENT_CHARS_UNCHECKED_LENGTH;
365 break;
366 }
367 BYTECODE(LOAD_4_CURRENT_CHARS) {
368 ASSERT(sizeof(Char) == 1);
369 int pos = current + (insn >> BYTECODE_SHIFT);
370 if (pos + 4 > subject_length) {
371 pc = code_base + Load32Aligned(pc + 4);
372 } else {
373 Char next1 = subject.CharAt(pos + 1);
374 Char next2 = subject.CharAt(pos + 2);
375 Char next3 = subject.CharAt(pos + 3);
376 current_char = (subject.CharAt(pos) | (next1 << 8) | (next2 << 16) |
377 (next3 << 24));
378 pc += BC_LOAD_4_CURRENT_CHARS_LENGTH;
379 }
380 break;
381 }
382 BYTECODE(LOAD_4_CURRENT_CHARS_UNCHECKED) {
383 ASSERT(sizeof(Char) == 1);
384 int pos = current + (insn >> BYTECODE_SHIFT);
385 Char next1 = subject.CharAt(pos + 1);
386 Char next2 = subject.CharAt(pos + 2);
387 Char next3 = subject.CharAt(pos + 3);
388 current_char = (subject.CharAt(pos) | (next1 << 8) | (next2 << 16) |
389 (next3 << 24));
390 pc += BC_LOAD_4_CURRENT_CHARS_UNCHECKED_LENGTH;
391 break;
392 }
393 BYTECODE(CHECK_4_CHARS) {
394 uint32_t c = Load32Aligned(pc + 4);
395 if (c == current_char) {
396 pc = code_base + Load32Aligned(pc + 8);
397 } else {
398 pc += BC_CHECK_4_CHARS_LENGTH;
399 }
400 break;
401 }
402 BYTECODE(CHECK_CHAR) {
403 uint32_t c = (insn >> BYTECODE_SHIFT);
404 if (c == current_char) {
405 pc = code_base + Load32Aligned(pc + 4);
406 } else {
407 pc += BC_CHECK_CHAR_LENGTH;
408 }
409 break;
410 }
411 BYTECODE(CHECK_NOT_4_CHARS) {
412 uint32_t c = Load32Aligned(pc + 4);
413 if (c != current_char) {
414 pc = code_base + Load32Aligned(pc + 8);
415 } else {
416 pc += BC_CHECK_NOT_4_CHARS_LENGTH;
417 }
418 break;
419 }
420 BYTECODE(CHECK_NOT_CHAR) {
421 uint32_t c = (insn >> BYTECODE_SHIFT);
422 if (c != current_char) {
423 pc = code_base + Load32Aligned(pc + 4);
424 } else {
425 pc += BC_CHECK_NOT_CHAR_LENGTH;
426 }
427 break;
428 }
429 BYTECODE(AND_CHECK_4_CHARS) {
430 uint32_t c = Load32Aligned(pc + 4);
431 if (c == (current_char & Load32Aligned(pc + 8))) {
432 pc = code_base + Load32Aligned(pc + 12);
433 } else {
434 pc += BC_AND_CHECK_4_CHARS_LENGTH;
435 }
436 break;
437 }
438 BYTECODE(AND_CHECK_CHAR) {
439 uint32_t c = (insn >> BYTECODE_SHIFT);
440 if (c == (current_char & Load32Aligned(pc + 4))) {
441 pc = code_base + Load32Aligned(pc + 8);
442 } else {
443 pc += BC_AND_CHECK_CHAR_LENGTH;
444 }
445 break;
446 }
447 BYTECODE(AND_CHECK_NOT_4_CHARS) {
448 uint32_t c = Load32Aligned(pc + 4);
449 if (c != (current_char & Load32Aligned(pc + 8))) {
450 pc = code_base + Load32Aligned(pc + 12);
451 } else {
452 pc += BC_AND_CHECK_NOT_4_CHARS_LENGTH;
453 }
454 break;
455 }
456 BYTECODE(AND_CHECK_NOT_CHAR) {
457 uint32_t c = (insn >> BYTECODE_SHIFT);
458 if (c != (current_char & Load32Aligned(pc + 4))) {
459 pc = code_base + Load32Aligned(pc + 8);
460 } else {
461 pc += BC_AND_CHECK_NOT_CHAR_LENGTH;
462 }
463 break;
464 }
465 BYTECODE(MINUS_AND_CHECK_NOT_CHAR) {
466 uint32_t c = (insn >> BYTECODE_SHIFT);
467 uint32_t minus = Load16Aligned(pc + 4);
468 uint32_t mask = Load16Aligned(pc + 6);
469 if (c != ((current_char - minus) & mask)) {
470 pc = code_base + Load32Aligned(pc + 8);
471 } else {
472 pc += BC_MINUS_AND_CHECK_NOT_CHAR_LENGTH;
473 }
474 break;
475 }
476 BYTECODE(CHECK_CHAR_IN_RANGE) {
477 uint32_t from = Load16Aligned(pc + 4);
478 uint32_t to = Load16Aligned(pc + 6);
479 if (from <= current_char && current_char <= to) {
480 pc = code_base + Load32Aligned(pc + 8);
481 } else {
482 pc += BC_CHECK_CHAR_IN_RANGE_LENGTH;
483 }
484 break;
485 }
486 BYTECODE(CHECK_CHAR_NOT_IN_RANGE) {
487 uint32_t from = Load16Aligned(pc + 4);
488 uint32_t to = Load16Aligned(pc + 6);
489 if (from > current_char || current_char > to) {
490 pc = code_base + Load32Aligned(pc + 8);
491 } else {
492 pc += BC_CHECK_CHAR_NOT_IN_RANGE_LENGTH;
493 }
494 break;
495 }
496 BYTECODE(CHECK_BIT_IN_TABLE) {
497 int mask = RegExpMacroAssembler::kTableMask;
498 uint8_t b = pc[8 + ((current_char & mask) >> kBitsPerByteLog2)];
499 int bit = (current_char & (kBitsPerByte - 1));
500 if ((b & (1 << bit)) != 0) {
501 pc = code_base + Load32Aligned(pc + 4);
502 } else {
503 pc += BC_CHECK_BIT_IN_TABLE_LENGTH;
504 }
505 break;
506 }
507 BYTECODE(CHECK_LT) {
508 uint32_t limit = (insn >> BYTECODE_SHIFT);
509 if (current_char < limit) {
510 pc = code_base + Load32Aligned(pc + 4);
511 } else {
512 pc += BC_CHECK_LT_LENGTH;
513 }
514 break;
515 }
516 BYTECODE(CHECK_GT) {
517 uint32_t limit = (insn >> BYTECODE_SHIFT);
518 if (current_char > limit) {
519 pc = code_base + Load32Aligned(pc + 4);
520 } else {
521 pc += BC_CHECK_GT_LENGTH;
522 }
523 break;
524 }
525 BYTECODE(CHECK_REGISTER_LT)
526 if (registers[insn >> BYTECODE_SHIFT] < Load32Aligned(pc + 4)) {
527 pc = code_base + Load32Aligned(pc + 8);
528 } else {
529 pc += BC_CHECK_REGISTER_LT_LENGTH;
530 }
531 break;
532 BYTECODE(CHECK_REGISTER_GE)
533 if (registers[insn >> BYTECODE_SHIFT] >= Load32Aligned(pc + 4)) {
534 pc = code_base + Load32Aligned(pc + 8);
535 } else {
536 pc += BC_CHECK_REGISTER_GE_LENGTH;
537 }
538 break;
539 BYTECODE(CHECK_REGISTER_EQ_POS)
540 if (registers[insn >> BYTECODE_SHIFT] == current) {
541 pc = code_base + Load32Aligned(pc + 4);
542 } else {
543 pc += BC_CHECK_REGISTER_EQ_POS_LENGTH;
544 }
545 break;
546 BYTECODE(CHECK_NOT_REGS_EQUAL)
547 if (registers[insn >> BYTECODE_SHIFT] ==
548 registers[Load32Aligned(pc + 4)]) {
549 pc += BC_CHECK_NOT_REGS_EQUAL_LENGTH;
550 } else {
551 pc = code_base + Load32Aligned(pc + 8);
552 }
553 break;
554 BYTECODE(CHECK_NOT_BACK_REF) {
555 int from = registers[insn >> BYTECODE_SHIFT];
556 int len = registers[(insn >> BYTECODE_SHIFT) + 1] - from;
557 if (from < 0 || len <= 0) {
558 pc += BC_CHECK_NOT_BACK_REF_LENGTH;
559 break;
560 }
561 if (current + len > subject_length) {
562 pc = code_base + Load32Aligned(pc + 4);
563 break;
564 } else {
565 int i;
566 for (i = 0; i < len; i++) {
567 if (subject.CharAt(from + i) != subject.CharAt(current + i)) {
568 pc = code_base + Load32Aligned(pc + 4);
569 break;
570 }
571 }
572 if (i < len) break;
573 current += len;
574 }
575 pc += BC_CHECK_NOT_BACK_REF_LENGTH;
576 break;
577 }
578 BYTECODE(CHECK_NOT_BACK_REF_NO_CASE_UNICODE)
580 BYTECODE(CHECK_NOT_BACK_REF_NO_CASE) {
581 const bool unicode =
582 (insn & BYTECODE_MASK) == BC_CHECK_NOT_BACK_REF_NO_CASE_UNICODE;
583 int from = registers[insn >> BYTECODE_SHIFT];
584 int len = registers[(insn >> BYTECODE_SHIFT) + 1] - from;
585 if (from < 0 || len <= 0) {
586 pc += BC_CHECK_NOT_BACK_REF_NO_CASE_LENGTH;
587 break;
588 }
589 if (current + len > subject_length) {
590 pc = code_base + Load32Aligned(pc + 4);
591 break;
592 } else {
593 if (BackRefMatchesNoCase<Char>(&canonicalize, from, current, len,
594 subject, unicode)) {
595 current += len;
596 pc += BC_CHECK_NOT_BACK_REF_NO_CASE_LENGTH;
597 } else {
598 pc = code_base + Load32Aligned(pc + 4);
599 }
600 }
601 break;
602 }
603 BYTECODE(CHECK_NOT_BACK_REF_BACKWARD) {
604 const int from = registers[insn >> BYTECODE_SHIFT];
605 const int len = registers[(insn >> BYTECODE_SHIFT) + 1] - from;
606 if (from < 0 || len <= 0) {
607 pc += BC_CHECK_NOT_BACK_REF_BACKWARD_LENGTH;
608 break;
609 }
610 if ((current - len) < 0) {
611 pc = code_base + Load32Aligned(pc + 4);
612 break;
613 } else {
614 // When looking behind, the string to match (if it is there) lies
615 // before the current position, so we will check the [len]
616 // characters before the current position, excluding the current
617 // position itself.
618 const int start = current - len;
619 int i;
620 for (i = 0; i < len; i++) {
621 if (subject.CharAt(from + i) != subject.CharAt(start + i)) {
622 pc = code_base + Load32Aligned(pc + 4);
623 break;
624 }
625 }
626 if (i < len) break;
627 current -= len;
628 }
629 pc += BC_CHECK_NOT_BACK_REF_BACKWARD_LENGTH;
630 break;
631 }
632 BYTECODE(CHECK_NOT_BACK_REF_NO_CASE_UNICODE_BACKWARD)
634 BYTECODE(CHECK_NOT_BACK_REF_NO_CASE_BACKWARD) {
635 bool unicode = (insn & BYTECODE_MASK) ==
636 BC_CHECK_NOT_BACK_REF_NO_CASE_UNICODE_BACKWARD;
637 int from = registers[insn >> BYTECODE_SHIFT];
638 int len = registers[(insn >> BYTECODE_SHIFT) + 1] - from;
639 if (from < 0 || len <= 0) {
640 pc += BC_CHECK_NOT_BACK_REF_NO_CASE_BACKWARD_LENGTH;
641 break;
642 }
643 if (current < len) {
644 pc = code_base + Load32Aligned(pc + 4);
645 break;
646 } else {
647 if (BackRefMatchesNoCase<Char>(&canonicalize, from, current - len,
648 len, subject, unicode)) {
649 current -= len;
650 pc += BC_CHECK_NOT_BACK_REF_NO_CASE_BACKWARD_LENGTH;
651 } else {
652 pc = code_base + Load32Aligned(pc + 4);
653 }
654 }
655 break;
656 }
657 BYTECODE(CHECK_AT_START)
658 if (current == 0) {
659 pc = code_base + Load32Aligned(pc + 4);
660 } else {
661 pc += BC_CHECK_AT_START_LENGTH;
662 }
663 break;
664 BYTECODE(CHECK_NOT_AT_START) {
665 const int32_t cp_offset = insn >> BYTECODE_SHIFT;
666 if (current + cp_offset == 0) {
667 pc += BC_CHECK_NOT_AT_START_LENGTH;
668 } else {
669 pc = code_base + Load32Aligned(pc + 4);
670 }
671 break;
672 }
673 BYTECODE(SET_CURRENT_POSITION_FROM_END) {
674 int by = static_cast<uint32_t>(insn) >> BYTECODE_SHIFT;
675 if (subject_length - current > by) {
676 current = subject_length - by;
677 current_char = subject.CharAt(current - 1);
678 }
679 pc += BC_SET_CURRENT_POSITION_FROM_END_LENGTH;
680 break;
681 }
682 default:
683 UNREACHABLE();
684 break;
685 }
686 }
687 }
688}
#define FAIL(name, result)
static int32_t Load32Aligned(const uint8_t *pc)
const int BYTECODE_SHIFT
constexpr intptr_t kBitsPerByte
Definition globals.h:463
const int BYTECODE_MASK
static int32_t Load16Aligned(const uint8_t *pc)
#define UNLIKELY(cond)
Definition globals.h:261
#define BYTECODE(name)

◆ RawSmiValue()

intptr_t dart::RawSmiValue ( const SmiPtr  raw_value)
inline

Definition at line 459 of file tagged_pointer.h.

459 {
460#if !defined(DART_COMPRESSED_POINTERS)
461 const intptr_t value = static_cast<intptr_t>(raw_value);
462#else
463 const intptr_t value = static_cast<intptr_t>(static_cast<int32_t>(
464 static_cast<uint32_t>(static_cast<uintptr_t>(raw_value))));
465#endif
466 ASSERT((value & kSmiTagMask) == kSmiTag);
467 return (value >> kSmiTagShift);
468}

◆ ReadApiMessage()

Dart_CObject * dart::ReadApiMessage ( Zone zone,
Message message 
)

Definition at line 3501 of file message_snapshot.cc.

3501 {
3502 if (message->IsRaw()) {
3504 ApiObjectConverter::Convert(message->raw_obj(), result);
3505 return result;
3506 } else {
3507 RELEASE_ASSERT(message->IsSnapshot());
3508 ApiMessageDeserializer deserializer(zone, message);
3509 return deserializer.Deserialize();
3510 }
3511}

◆ ReadHeaderRelaxed()

static DART_FORCE_INLINE uword dart::ReadHeaderRelaxed ( ObjectPtr  obj)
static

Definition at line 118 of file scavenger.cc.

118 {
119 return reinterpret_cast<std::atomic<uword>*>(UntaggedObject::ToAddr(obj))
120 ->load(std::memory_order_relaxed);
121}

◆ ReadMessage()

ObjectPtr dart::ReadMessage ( Thread thread,
Message message 
)

Definition at line 3479 of file message_snapshot.cc.

3479 {
3480 if (message->IsRaw()) {
3481 return message->raw_obj();
3482 } else if (message->IsFinalizerInvocationRequest()) {
3483 PersistentHandle* handle = message->persistent_handle();
3484 Object& msg_obj = Object::Handle(thread->zone(), handle->ptr());
3485 ASSERT(msg_obj.IsFinalizer() || msg_obj.IsNativeFinalizer());
3486 return msg_obj.ptr();
3487 } else if (message->IsPersistentHandle()) {
3488 return ReadObjectGraphCopyMessage(thread, message->persistent_handle());
3489 } else {
3490 RELEASE_ASSERT(message->IsSnapshot());
3491 LongJumpScope jump(thread);
3492 if (setjmp(*jump.Set()) == 0) {
3493 MessageDeserializer deserializer(thread, message);
3494 return deserializer.Deserialize();
3495 } else {
3496 return thread->StealStickyError();
3497 }
3498 }
3499}
ObjectPtr ReadObjectGraphCopyMessage(Thread *thread, PersistentHandle *handle)

◆ ReadObjectGraphCopyMessage()

ObjectPtr dart::ReadObjectGraphCopyMessage ( Thread thread,
PersistentHandle handle 
)

Definition at line 3447 of file message_snapshot.cc.

3447 {
3448 // msg_array = [
3449 // <message>,
3450 // <collection-lib-objects-to-rehash>,
3451 // <core-lib-objects-to-rehash>,
3452 // ]
3453 Zone* zone = thread->zone();
3454 Object& msg_obj = Object::Handle(zone);
3455 const auto& msg_array = Array::Handle(zone, Array::RawCast(handle->ptr()));
3456 ASSERT(msg_array.Length() == 3);
3457 msg_obj = msg_array.At(0);
3458 if (msg_array.At(1) != Object::null()) {
3459 const auto& objects_to_rehash = Object::Handle(zone, msg_array.At(1));
3460 auto& result = Object::Handle(zone);
3461 result = DartLibraryCalls::RehashObjectsInDartCollection(thread,
3462 objects_to_rehash);
3463 if (result.ptr() != Object::null()) {
3464 msg_obj = result.ptr();
3465 }
3466 }
3467 if (msg_array.At(2) != Object::null()) {
3468 const auto& objects_to_rehash = Object::Handle(zone, msg_array.At(2));
3469 auto& result = Object::Handle(zone);
3470 result =
3471 DartLibraryCalls::RehashObjectsInDartCore(thread, objects_to_rehash);
3472 if (result.ptr() != Object::null()) {
3473 msg_obj = result.ptr();
3474 }
3475 }
3476 return msg_obj.ptr();
3477}

◆ realloc()

void * dart::realloc ( void *  ptr,
size_t  size 
)

Definition at line 27 of file allocation.cc.

27 {
28 void* result = ::realloc(ptr, size);
29 if (result == nullptr) {
31 }
32 return result;
33}

◆ ReciprocalEstimate()

float dart::ReciprocalEstimate ( float  op)

◆ ReciprocalSqrtEstimate()

float dart::ReciprocalSqrtEstimate ( float  op)

◆ ReciprocalSqrtStep()

float dart::ReciprocalSqrtStep ( float  op1,
float  op2 
)

◆ ReciprocalStep()

float dart::ReciprocalStep ( float  op1,
float  op2 
)

◆ RecognizeTestPattern()

static bool dart::RecognizeTestPattern ( Value left,
Value right,
bool *  negate 
)
static

Definition at line 3611 of file il.cc.

3611 {
3612 if (!right->BindsToConstant() || !right->BoundConstant().IsSmi()) {
3613 return false;
3614 }
3615
3616 const intptr_t value = Smi::Cast(right->BoundConstant()).Value();
3617 if ((value != 0) && !Utils::IsPowerOfTwo(value)) {
3618 return false;
3619 }
3620
3621 BinarySmiOpInstr* mask_op = left->definition()->AsBinarySmiOp();
3622 if ((mask_op == nullptr) || (mask_op->op_kind() != Token::kBIT_AND) ||
3623 !mask_op->HasOnlyUse(left)) {
3624 return false;
3625 }
3626
3627 if (value == 0) {
3628 // Recognized (a & b) == 0 pattern.
3629 *negate = false;
3630 return true;
3631 }
3632
3633 // Recognize
3634 if (BindsToGivenConstant(mask_op->left(), value) ||
3635 BindsToGivenConstant(mask_op->right(), value)) {
3636 // Recognized (a & 2^n) == 2^n pattern. It's equivalent to (a & 2^n) != 0
3637 // so we need to negate original comparison.
3638 *negate = true;
3639 return true;
3640 }
3641
3642 return false;
3643}
static bool BindsToGivenConstant(Value *v, intptr_t expected)
Definition il.cc:3605

◆ RecognizeTokenKindHelper()

static Token::Kind dart::RecognizeTokenKindHelper ( const String name)
static

Definition at line 256 of file method_recognizer.cc.

256 {
257 if (name.ptr() == Symbols::Plus().ptr()) {
258 return Token::kADD;
259 } else if (name.ptr() == Symbols::Minus().ptr()) {
260 return Token::kSUB;
261 } else if (name.ptr() == Symbols::Star().ptr()) {
262 return Token::kMUL;
263 } else if (name.ptr() == Symbols::Slash().ptr()) {
264 return Token::kDIV;
265 } else if (name.ptr() == Symbols::TruncDivOperator().ptr()) {
266 return Token::kTRUNCDIV;
267 } else if (name.ptr() == Symbols::Percent().ptr()) {
268 return Token::kMOD;
269 } else if (name.ptr() == Symbols::BitOr().ptr()) {
270 return Token::kBIT_OR;
271 } else if (name.ptr() == Symbols::Ampersand().ptr()) {
272 return Token::kBIT_AND;
273 } else if (name.ptr() == Symbols::Caret().ptr()) {
274 return Token::kBIT_XOR;
275 } else if (name.ptr() == Symbols::LeftShiftOperator().ptr()) {
276 return Token::kSHL;
277 } else if (name.ptr() == Symbols::RightShiftOperator().ptr()) {
278 return Token::kSHR;
279 } else if (name.ptr() == Symbols::UnsignedRightShiftOperator().ptr()) {
280 return Token::kUSHR;
281 } else if (name.ptr() == Symbols::Tilde().ptr()) {
282 return Token::kBIT_NOT;
283 } else if (name.ptr() == Symbols::UnaryMinus().ptr()) {
284 return Token::kNEGATE;
285 } else if (name.ptr() == Symbols::EqualOperator().ptr()) {
286 return Token::kEQ;
287 } else if (name.ptr() == Symbols::Token(Token::kNE).ptr()) {
288 return Token::kNE;
289 } else if (name.ptr() == Symbols::LAngleBracket().ptr()) {
290 return Token::kLT;
291 } else if (name.ptr() == Symbols::RAngleBracket().ptr()) {
292 return Token::kGT;
293 } else if (name.ptr() == Symbols::LessEqualOperator().ptr()) {
294 return Token::kLTE;
295 } else if (name.ptr() == Symbols::GreaterEqualOperator().ptr()) {
296 return Token::kGTE;
297 } else if (Field::IsGetterName(name)) {
298 return Token::kGET;
299 } else if (Field::IsSetterName(name)) {
300 return Token::kSET;
301 }
302 return Token::kILLEGAL;
303}

◆ RefineBreakpointPos()

static void dart::RefineBreakpointPos ( const Script script,
TokenPosition  pos,
TokenPosition  next_closest_token_position,
TokenPosition  requested_token_pos,
TokenPosition  last_token_pos,
intptr_t  requested_column,
TokenPosition  exact_token_pos,
TokenPosition best_fit_pos,
intptr_t *  best_column,
intptr_t *  best_line 
)
static

Definition at line 1955 of file debugger.cc.

1964 {
1965 ASSERT(
1966 (requested_column == -1 && exact_token_pos == TokenPosition::kNoSource) ||
1967 (requested_column > -1 && exact_token_pos != TokenPosition::kNoSource));
1968
1969 intptr_t token_start_column = -1;
1970 intptr_t token_line = -1;
1971 if (requested_column >= 0) {
1972 TokenPosition ignored = TokenPosition::kNoSource;
1973 TokenPosition end_of_line_pos = TokenPosition::kNoSource;
1974 script.GetTokenLocation(pos, &token_line, &token_start_column);
1975 script.TokenRangeAtLine(token_line, &ignored, &end_of_line_pos);
1976
1977 TokenPosition token_end_pos = TokenPosition::Min(
1978 TokenPosition::Deserialize(next_closest_token_position.Pos() - 1),
1979 end_of_line_pos);
1980
1981 if ((token_end_pos.IsReal() && exact_token_pos.IsReal() &&
1982 (token_end_pos < exact_token_pos)) ||
1983 (token_start_column > *best_column)) {
1984 // We prefer the token with the lowest column number compatible with the
1985 // requested column. The current token under consideration either ends
1986 // before the requested column, and is thus incompatible with it, or
1987 // has a higher column number than the best token we've found so far, so
1988 // we reject the current token under consideration.
1989 return;
1990 }
1991 }
1992
1993 // Prefer the lowest (first) token pos.
1994 if (pos < *best_fit_pos) {
1995 *best_fit_pos = pos;
1996 *best_line = token_line;
1997 *best_column = token_start_column;
1998 }
1999}

◆ RefineUseTypes()

static void dart::RefineUseTypes ( Definition instr)
static

Definition at line 22 of file call_specializer.cc.

22 {
23 CompileType* new_type = instr->Type();
24 for (Value::Iterator it(instr->input_use_list()); !it.Done(); it.Advance()) {
25 it.Current()->RefineReachingType(new_type);
26 }
27}

◆ RegisterClosureCallback()

DART_EXPORT void dart::RegisterClosureCallback ( Dart_Handle  h)

Definition at line 1110 of file ffi_test_functions_vmspecific.cc.

1110 {
1111 closure_to_callback_ = Dart_NewPersistentHandle_DL(h);
1112}
Dart_PersistentHandle closure_to_callback_

◆ RegisterClosureCallbackFP()

DART_EXPORT void dart::RegisterClosureCallbackFP ( void(*)(Dart_Handle callback)

Definition at line 1106 of file ffi_test_functions_vmspecific.cc.

1106 {
1107 callback_ = callback;
1108}

◆ RegisterFakeFunction()

const Function & dart::RegisterFakeFunction ( const char *  name,
const Code code 
)

Definition at line 13 of file stub_code_test.cc.

13 {
14 Thread* thread = Thread::Current();
15 const String& class_name = String::Handle(Symbols::New(thread, "ownerClass"));
16 const Script& script = Script::Handle();
17 const Library& lib = Library::Handle(Library::CoreLibrary());
18 const Class& owner_class = Class::Handle(
19 Class::New(lib, class_name, script, TokenPosition::kNoSource));
20 const String& function_name = String::ZoneHandle(Symbols::New(thread, name));
21 const FunctionType& signature = FunctionType::ZoneHandle(FunctionType::New());
22 Function& function = Function::ZoneHandle(Function::New(
23 signature, function_name, UntaggedFunction::kRegularFunction, true, false,
24 false, false, false, owner_class, TokenPosition::kNoSource));
25 const Array& functions = Array::Handle(Array::New(1));
26 functions.SetAt(0, function);
27 {
28 SafepointWriteRwLocker ml(thread, thread->isolate_group()->program_lock());
29 owner_class.SetFunctions(functions);
30 }
31 lib.AddClass(owner_class);
32 function.AttachCode(code);
33 return function;
34}

◆ RegisterKindFromPolicy()

static Location::Kind dart::RegisterKindFromPolicy ( Location  loc)
static

Definition at line 876 of file linearscan.cc.

876 {
877 if (loc.policy() == Location::kRequiresFpuRegister) {
878 return Location::kFpuRegister;
879 } else {
880 return Location::kRegister;
881 }
882}
Policy policy() const
Definition locations.h:389

◆ RegisterMyCallbackBlocking()

DART_EXPORT void dart::RegisterMyCallbackBlocking ( Dart_Port  send_port,
intptr_t(*)(intptr_t)  callback1 
)

Definition at line 584 of file ffi_test_functions_vmspecific.cc.

585 {
586 my_callback_blocking_fp_ = callback1;
588}
Dart_Port my_callback_blocking_send_port_

◆ RegisterMyCallbackNonBlocking()

DART_EXPORT void dart::RegisterMyCallbackNonBlocking ( Dart_Port  send_port,
void(*)(intptr_t)  callback 
)

Definition at line 590 of file ffi_test_functions_vmspecific.cc.

◆ RegisterRange()

static Utils::BitsRange< Register > dart::RegisterRange ( uint32_t  regs)
inlinestatic

Definition at line 110 of file constants.h.

110 {
111 return Utils::BitsRange<Register>(regs);
112}

◆ RegisterSendPort()

DART_EXPORT void dart::RegisterSendPort ( Dart_Port  send_port)

Definition at line 874 of file ffi_test_functions_vmspecific.cc.

874 {
875 send_port_ = send_port;
876}

◆ RegisterTypeArgumentsUse()

void dart::RegisterTypeArgumentsUse ( const Function function,
TypeUsageInfo type_usage_info,
const Class klass,
Definition type_arguments 
)

Definition at line 1260 of file type_testing_stubs.cc.

1263 {
1264 // The [type_arguments] can, in the general case, be any kind of [Definition]
1265 // but generally (in order of expected frequency)
1266 //
1267 // Case a)
1268 // type_arguments <- Constant(#null)
1269 // type_arguments <- Constant(#TypeArguments: [ ... ])
1270 //
1271 // Case b)
1272 // type_arguments <- InstantiateTypeArguments(ita, fta, uta)
1273 // (where uta may not be a constant non-null TypeArguments object)
1274 //
1275 // Case c)
1276 // type_arguments <- LoadField(vx)
1277 // type_arguments <- LoadField(vx T{_ABC})
1278 // type_arguments <- LoadField(vx T{Type: class: '_ABC'})
1279 //
1280 // Case d, e)
1281 // type_arguments <- LoadIndexedUnsafe(rbp[vx + 16]))
1282 // type_arguments <- Parameter(0)
1283
1284 if (ConstantInstr* constant = type_arguments->AsConstant()) {
1285 const Object& object = constant->value();
1286 ASSERT(object.IsNull() || object.IsTypeArguments());
1287 const TypeArguments& type_arguments =
1288 TypeArguments::Handle(TypeArguments::RawCast(object.ptr()));
1289 type_usage_info->UseTypeArgumentsInInstanceCreation(klass, type_arguments);
1290 } else if (InstantiateTypeArgumentsInstr* instantiate =
1291 type_arguments->AsInstantiateTypeArguments()) {
1292 if (instantiate->type_arguments()->BindsToConstant() &&
1293 !instantiate->type_arguments()->BoundConstant().IsNull()) {
1294 const auto& ta =
1295 TypeArguments::Cast(instantiate->type_arguments()->BoundConstant());
1296 type_usage_info->UseTypeArgumentsInInstanceCreation(klass, ta);
1297 }
1298 } else if (LoadFieldInstr* load_field = type_arguments->AsLoadField()) {
1299 Definition* instance = load_field->instance()->definition();
1300 intptr_t cid = instance->Type()->ToNullableCid();
1301 if (cid == kDynamicCid) {
1302 // This is an approximation: If we only know the type, but not the cid, we
1303 // might have a this-dispatch where we know it's either this class or any
1304 // subclass.
1305 // We try to strengthen this assumption further down by checking the
1306 // offset of the type argument vector, but generally speaking this could
1307 // be a false-positive, which is still ok!
1308 const AbstractType& type = *instance->Type()->ToAbstractType();
1309 if (type.IsType()) {
1310 const Class& type_class = Class::Handle(type.type_class());
1311 if (type_class.NumTypeArguments() >= klass.NumTypeArguments()) {
1312 cid = type_class.id();
1313 }
1314 }
1315 }
1316 if (cid != kDynamicCid) {
1317 const Class& instance_klass =
1318 Class::Handle(IsolateGroup::Current()->class_table()->At(cid));
1319 if (load_field->slot().IsTypeArguments() && instance_klass.IsGeneric() &&
1320 compiler::target::Class::TypeArgumentsFieldOffset(instance_klass) ==
1321 load_field->slot().offset_in_bytes()) {
1322 // This is a subset of Case c) above, namely forwarding the type
1323 // argument vector.
1324 //
1325 // We use the declaration type arguments for the instance creation,
1326 // which is a non-instantiated, expanded, type arguments vector.
1327 TypeArguments& declaration_type_args = TypeArguments::Handle(
1328 instance_klass.GetDeclarationInstanceTypeArguments());
1329 type_usage_info->UseTypeArgumentsInInstanceCreation(
1330 klass, declaration_type_args);
1331 }
1332 }
1333 } else if (type_arguments->IsParameter() ||
1334 type_arguments->IsLoadIndexedUnsafe()) {
1335 // This happens in constructors with non-optional/optional parameters
1336 // where we forward the type argument vector to object allocation.
1337 //
1338 // Theoretically this could be a false-positive, which is still ok, but
1339 // practically it's guaranteed that this is a forward of a type argument
1340 // vector passed in by the caller.
1341 if (function.IsFactory()) {
1342 const Class& enclosing_class = Class::Handle(function.Owner());
1343 TypeArguments& declaration_type_args = TypeArguments::Handle(
1344 enclosing_class.GetDeclarationInstanceTypeArguments());
1345 type_usage_info->UseTypeArgumentsInInstanceCreation(
1346 klass, declaration_type_args);
1347 }
1348 } else {
1349 // It can also be a phi node where the inputs are any of the above,
1350 // or it could be the result of _prependTypeArguments call.
1351 ASSERT(type_arguments->IsPhi() || type_arguments->IsStaticCall());
1352 }
1353}
void UseTypeArgumentsInInstanceCreation(const Class &klass, const TypeArguments &ta)

◆ RegMaskBit()

static uword dart::RegMaskBit ( Register  reg)
static

Definition at line 80 of file parallel_move_resolver.cc.

80 {
81 return ((reg) != kNoRegister) ? (1 << (reg)) : 0;
82}

◆ Regress37069()

DART_EXPORT void dart::Regress37069 ( uint64_t  a,
uint64_t  b,
uint64_t  c,
uint64_t  d,
uint64_t  e,
uint64_t  f,
uint64_t  g,
uint64_t  h,
uint64_t  i,
uint64_t  j,
uint64_t  k 
)

Definition at line 101 of file ffi_test_functions_vmspecific.cc.

111 {
112 Dart_ExecuteInternalCommand("gc-now", nullptr);
113}

◆ Regress39044()

DART_EXPORT int64_t dart::Regress39044 ( int64_t  a,
int8_t  b 
)

Definition at line 207 of file ffi_test_functions.cc.

207 {
208 std::cout << "Regress39044(" << a << ", " << static_cast<int>(b) << ")\n";
209 const int64_t retval = a - b;
210 std::cout << "returning " << retval << "\n";
211 return retval;
212}

◆ Regress40537()

DART_EXPORT intptr_t dart::Regress40537 ( uint8_t  x)

Definition at line 214 of file ffi_test_functions.cc.

214 {
215 std::cout << "Regress40537(" << static_cast<int>(x) << ")\n";
216 return x == 249 ? 1 : 0;
217}

◆ Regress40537Variant2()

DART_EXPORT intptr_t dart::Regress40537Variant2 ( uint8_t  x)

Definition at line 219 of file ffi_test_functions.cc.

219 {
220 std::cout << "Regress40537Variant2(" << static_cast<int>(x) << ")\n";
221 return x;
222}

◆ Regress40537Variant3()

DART_EXPORT uint8_t dart::Regress40537Variant3 ( intptr_t  x)

Definition at line 224 of file ffi_test_functions.cc.

224 {
225 std::cout << "Regress40537Variant3(" << static_cast<int>(x) << ")\n";
226 return x;
227}

◆ Regress43693()

DART_EXPORT uint64_t dart::Regress43693 ( Struct43693 my_struct)

Definition at line 1195 of file ffi_test_functions.cc.

1195 {
1196 return my_struct->someValue;
1197}

◆ Regress46127()

DART_EXPORT Struct46127 dart::Regress46127 ( )

Definition at line 1203 of file ffi_test_functions.cc.

1203 {
1204 struct Struct46127 myStruct;
1205 myStruct.val = 123;
1206 return myStruct;
1207}

◆ RehashObjects()

static ObjectPtr dart::RehashObjects ( Zone zone,
const Library library,
const Object array_or_growable_array 
)
static

Definition at line 777 of file dart_entry.cc.

779 {
780 ASSERT(array_or_growable_array.IsArray() ||
781 array_or_growable_array.IsGrowableObjectArray());
782 const auto& rehashing_function = Function::Handle(
783 zone, library.LookupFunctionAllowPrivate(Symbols::_rehashObjects()));
784 ASSERT(!rehashing_function.IsNull());
785
786 const auto& arguments = Array::Handle(zone, Array::New(1));
787 arguments.SetAt(0, array_or_growable_array);
788
789 return DartEntry::InvokeFunction(rehashing_function, arguments);
790}

◆ RejectCompilation()

static ObjectPtr dart::RejectCompilation ( Thread thread)
static

Definition at line 663 of file isolate_reload.cc.

663 {
664 TransitionVMToNative transition(thread);
665 Dart_KernelCompilationResult result = KernelIsolate::RejectCompilation();
668 FATAL(
669 "An error occurred while rejecting the most recent"
670 " compilation results: %s",
671 result.error);
672 }
673 TIR_Print(
674 "An error occurred while rejecting the most recent"
675 " compilation results: %s",
676 result.error);
677 Zone* zone = thread->zone();
678 const auto& error_str = String::Handle(zone, String::New(result.error));
679 free(result.error);
680 return ApiError::New(error_str);
681 }
682 return Object::null();
683}

◆ ReleaseClosureCallback()

DART_EXPORT void dart::ReleaseClosureCallback ( )

Definition at line 1120 of file ffi_test_functions_vmspecific.cc.

1120 {
1121 Dart_DeletePersistentHandle_DL(closure_to_callback_);
1122}

◆ ReleaseFilesPairs()

static void dart::ReleaseFilesPairs ( const Dart_CObject files)
static

Definition at line 359 of file kernel_isolate.cc.

359 {
360 for (intptr_t i = 0; i < files.value.as_array.length; i++) {
361 delete files.value.as_array.values[i];
362 }
363 delete[] files.value.as_array.values;
364}

◆ RELOAD_NATIVE_LIST()

dart::RELOAD_NATIVE_LIST ( DECLARE_FUNCTION  )

◆ ReloadSources()

static void dart::ReloadSources ( Thread thread,
JSONStream js 
)
static

Definition at line 3840 of file service.cc.

3840 {
3841#if defined(DART_PRECOMPILED_RUNTIME)
3842 js->PrintError(kFeatureDisabled, "Compiler is disabled in AOT mode.");
3843#else
3844 IsolateGroup* isolate_group = thread->isolate_group();
3845 if (isolate_group->library_tag_handler() == nullptr) {
3846 js->PrintError(kFeatureDisabled,
3847 "A library tag handler must be installed.");
3848 return;
3849 }
3850 // TODO(dartbug.com/36097): We need to change the "reloadSources" service-api
3851 // call to accept an isolate group instead of an isolate.
3852 Isolate* isolate = thread->isolate();
3853 if ((isolate->sticky_error() != Error::null()) ||
3854 (Thread::Current()->sticky_error() != Error::null())) {
3855 js->PrintError(kIsolateReloadBarred,
3856 "This isolate cannot reload sources anymore because there "
3857 "was an unhandled exception error. Restart the isolate.");
3858 return;
3859 }
3860 if (isolate_group->IsReloading()) {
3861 js->PrintError(kIsolateIsReloading, "This isolate is being reloaded.");
3862 return;
3863 }
3864 if (!isolate_group->CanReload()) {
3865 js->PrintError(kFeatureDisabled,
3866 "This isolate cannot reload sources right now.");
3867 return;
3868 }
3869 const bool force_reload =
3870 BoolParameter::Parse(js->LookupParam("force"), false);
3871
3872 isolate_group->ReloadSources(js, force_reload, js->LookupParam("rootLibUri"),
3873 js->LookupParam("packagesUri"));
3874
3875 Service::CheckForPause(isolate, js);
3876
3877#endif
3878}
Dart_LibraryTagHandler library_tag_handler() const
Definition isolate.h:550
bool ReloadSources(JSONStream *js, bool force_reload, const char *root_script_url=nullptr, const char *packages_url=nullptr, bool dont_delete_reload_context=false)
Definition isolate.cc:2037

◆ ReloadTestScript()

LibraryPtr dart::ReloadTestScript ( const char *  script)

Definition at line 42 of file il_test_helper.cc.

42 {
43 Dart_Handle api_lib;
44 {
45 TransitionVMToNative transition(Thread::Current());
46 api_lib = TestCase::ReloadTestScript(script);
47 EXPECT_VALID(api_lib);
48 }
49 auto& lib = Library::Handle();
50 lib ^= Api::UnwrapHandle(api_lib);
51 EXPECT(!lib.IsNull());
52 return lib.ptr();
53}

◆ RemoveBreakpoint()

static void dart::RemoveBreakpoint ( Thread thread,
JSONStream js 
)
static

Definition at line 4040 of file service.cc.

4040 {
4041 if (CheckDebuggerDisabled(thread, js)) {
4042 return;
4043 }
4044
4045 if (!js->HasParam("breakpointId")) {
4046 PrintMissingParamError(js, "breakpointId");
4047 return;
4048 }
4049 const char* bpt_id = js->LookupParam("breakpointId");
4050 ObjectIdRing::LookupResult lookup_result;
4051 Isolate* isolate = thread->isolate();
4052 Breakpoint* bpt = LookupBreakpoint(isolate, bpt_id, &lookup_result);
4053 // TODO(turnidge): Should we return a different error for bpts which
4054 // have been already removed?
4055 if (bpt == nullptr) {
4056 PrintInvalidParamError(js, "breakpointId");
4057 return;
4058 }
4059 isolate->debugger()->RemoveBreakpoint(bpt->id());
4060 PrintSuccess(js);
4061}

◆ RemoveCHAOptimizedCode()

static void dart::RemoveCHAOptimizedCode ( const Class subclass,
const GrowableArray< intptr_t > &  added_subclass_to_cids 
)
static

Definition at line 53 of file class_finalizer.cc.

55 {
56 ASSERT(FLAG_use_cha_deopt);
57 if (added_subclass_to_cids.is_empty()) {
58 return;
59 }
60 // Switch all functions' code to unoptimized.
61 const ClassTable& class_table = *IsolateGroup::Current()->class_table();
62 Class& cls = Class::Handle();
63 for (intptr_t i = 0; i < added_subclass_to_cids.length(); i++) {
64 intptr_t cid = added_subclass_to_cids[i];
65 cls = class_table.At(cid);
66 ASSERT(!cls.IsNull());
67 cls.DisableCHAOptimizedCode(subclass);
68 }
69}

◆ RemoveDotSegments()

static const char * dart::RemoveDotSegments ( const char *  path)
static

Definition at line 282 of file uri.cc.

282 {
283 const char* input = path;
284
285 // The output path will always be less than or equal to the size of
286 // the input path.
287 Zone* zone = ThreadState::Current()->zone();
288 char* buffer = zone->Alloc<char>(strlen(path) + 1); // +1 for '\0'
289 char* output = buffer;
290
291 while (*input != '\0') {
292 if (strncmp("../", input, 3) == 0) {
293 // Discard initial "../" from the input. It's junk.
294 input += 3;
295
296 } else if (strncmp("./", input, 3) == 0) {
297 // Discard initial "./" from the input. It's junk.
298 input += 2;
299
300 } else if (strncmp("/./", input, 3) == 0) {
301 // Advance past the "/." part of the input.
302 input += 2;
303
304 } else if (strcmp("/.", input) == 0) {
305 // Pretend the input just contains a "/".
306 input = "/";
307
308 } else if (strncmp("/../", input, 4) == 0) {
309 // Advance past the "/.." part of the input and remove one
310 // segment from the output.
311 input += 3;
313
314 } else if (strcmp("/..", input) == 0) {
315 // Pretend the input contains a "/" and remove one segment from
316 // the output.
317 input = "/";
319
320 } else if (strcmp("..", input) == 0) {
321 // The input has been reduced to nothing useful.
322 input += 2;
323
324 } else if (strcmp(".", input) == 0) {
325 // The input has been reduced to nothing useful.
326 input += 1;
327
328 } else {
329 intptr_t segment_len = SegmentLength(input);
330 if (input[0] != '/' && output != buffer) {
331 *output = '/';
332 output++;
333 }
334 strncpy(output, input, segment_len);
335 output += segment_len;
336 input += segment_len;
337 }
338 }
339 *output = '\0';
340 return buffer;
341}
static char * RemoveLastSegment(char *current, char *base)
Definition uri.cc:253
static intptr_t SegmentLength(const char *input)
Definition uri.cc:268

◆ RemoveLastSegment()

static char * dart::RemoveLastSegment ( char *  current,
char *  base 
)
static

Definition at line 253 of file uri.cc.

253 {
254 if (current == base) {
255 return current;
256 }
257 ASSERT(current > base);
258 for (current--; current > base; current--) {
259 if (*current == '/') {
260 // We have found the beginning of the last segment.
261 return current;
262 }
263 }
264 ASSERT(current == base);
265 return current;
266}

◆ RepeatBitsAcrossReg()

static uint64_t dart::RepeatBitsAcrossReg ( uint8_t  reg_size,
uint64_t  value,
uint8_t  width 
)
inlinestatic

Definition at line 1280 of file constants_arm64.h.

1282 {
1283 ASSERT((width == 2) || (width == 4) || (width == 8) || (width == 16) ||
1284 (width == 32));
1285 ASSERT((reg_size == kWRegSizeInBits) || (reg_size == kXRegSizeInBits));
1286 uint64_t result = value & ((1ULL << width) - 1ULL);
1287 for (unsigned i = width; i < reg_size; i *= 2) {
1288 result |= (result << i);
1289 }
1290 return result;
1291}
int32_t width

◆ ReplaceParameterStubs()

static void dart::ReplaceParameterStubs ( Zone zone,
FlowGraph caller_graph,
InlinedCallData call_data,
const TargetInfo target_info 
)
static

Definition at line 842 of file inliner.cc.

845 {
846 const bool is_polymorphic = call_data->call->IsPolymorphicInstanceCall();
847 const bool no_checks =
849 ASSERT(is_polymorphic == (target_info != nullptr));
850 FlowGraph* callee_graph = call_data->callee_graph;
851 auto callee_entry = callee_graph->graph_entry()->normal_entry();
852 const Function& callee = callee_graph->function();
853
854 FunctionType& interface_target_signature = FunctionType::Handle();
855 FunctionType& callee_signature = FunctionType::Handle(callee.signature());
856
857 // If we are inlining a call on this and we are going to skip parameter checks
858 // then a situation can arise when parameter type in the callee has a narrower
859 // type than what interface target specifies, e.g.
860 //
861 // class A<T> {
862 // void f(T v);
863 // void g(T v) { f(v); }
864 // }
865 // class B extends A<X> { void f(X v) { ... } }
866 //
867 // Consider when B.f is inlined into a callsite in A.g (e.g. due to
868 // polymorphic inlining). v is known to be X within the body of B.f, but not
869 // guaranteed to be X outside of it. Thus we must ensure that all operations
870 // with v that depend on its type being X are pinned to stay within the
871 // inlined body.
872 //
873 // We achieve that by inserting redefinitions for parameters which potentially
874 // have narrower types in callee compared to those in the interface target of
875 // the call.
876 BitVector* is_generic_covariant_impl = nullptr;
877 if (no_checks && callee.IsRegularFunction()) {
878 const Function& interface_target =
879 call_data->call->AsInstanceCallBase()->interface_target();
880
881 callee_signature = callee.signature();
882 interface_target_signature = interface_target.signature();
883
884 // If signatures match then there is nothing to do.
885 if (interface_target.signature() != callee.signature()) {
886 const intptr_t num_params = callee.NumParameters();
887 BitVector is_covariant(zone, num_params);
888 is_generic_covariant_impl = new (zone) BitVector(zone, num_params);
889
890 kernel::ReadParameterCovariance(callee_graph->function(), &is_covariant,
891 is_generic_covariant_impl);
892 }
893 }
894
895 // Replace each stub with the actual argument or the caller's constant.
896 // Nulls denote optional parameters for which no actual was given.
897 const intptr_t first_arg_index = call_data->first_arg_index;
898
899 // When first_arg_index > 0, the stub and actual argument processed in the
900 // first loop iteration represent a passed-in type argument vector.
901 GrowableArray<Value*>* arguments = call_data->arguments;
902 intptr_t first_arg_stub_index = 0;
903 if (arguments->length() != call_data->parameter_stubs->length()) {
904 ASSERT(arguments->length() == call_data->parameter_stubs->length() - 1);
905 ASSERT(first_arg_index == 0);
906 // The first parameter stub accepts an optional type argument vector, but
907 // none was provided in arguments.
908 first_arg_stub_index = 1;
909 }
910 for (intptr_t i = 0; i < arguments->length(); ++i) {
911 Value* actual = (*arguments)[i];
912 Definition* defn = nullptr;
913
914 // Replace the receiver argument with a redefinition to prevent code from
915 // the inlined body from being hoisted above the inlined entry.
916 const bool is_polymorphic_receiver =
917 (is_polymorphic && (i == first_arg_index));
918
919 if (actual == nullptr) {
920 ASSERT(!is_polymorphic_receiver);
921 continue;
922 }
923
924 if (is_polymorphic_receiver ||
926 is_generic_covariant_impl, interface_target_signature,
927 callee_signature, first_arg_index, i)) {
928 RedefinitionInstr* redefinition =
929 new (zone) RedefinitionInstr(actual->Copy(zone));
930 caller_graph->AllocateSSAIndex(redefinition);
931 if (is_polymorphic_receiver && target_info->IsSingleCid()) {
932 redefinition->UpdateType(CompileType::FromCid(target_info->cid_start));
933 }
934 redefinition->InsertAfter(callee_entry);
935 defn = redefinition;
936 // Since the redefinition does not dominate the callee entry, replace
937 // uses of the receiver argument in this entry with the redefined value.
938 callee_entry->ReplaceInEnvironment(
939 call_data->parameter_stubs->At(first_arg_stub_index + i),
940 actual->definition());
941 } else {
942 defn = actual->definition();
943 }
944
945 call_data->parameter_stubs->At(first_arg_stub_index + i)
946 ->ReplaceUsesWith(defn);
947 }
948
949 // Replace remaining constants with uses by constants in the caller's
950 // initial definitions.
951 auto defns = callee_graph->graph_entry()->initial_definitions();
952 for (intptr_t i = 0; i < defns->length(); ++i) {
953 ConstantInstr* constant = (*defns)[i]->AsConstant();
954 if (constant != nullptr && constant->HasUses()) {
955 constant->ReplaceUsesWith(caller_graph->GetConstant(
956 constant->value(), constant->representation()));
957 }
958 }
959
960 defns = callee_graph->graph_entry()->normal_entry()->initial_definitions();
961 for (intptr_t i = 0; i < defns->length(); ++i) {
962 auto defn = (*defns)[i];
963 if (!defn->HasUses()) continue;
964
965 if (auto constant = defn->AsConstant()) {
966 constant->ReplaceUsesWith(caller_graph->GetConstant(
967 constant->value(), constant->representation()));
968 }
969
970 if (auto param = defn->AsParameter()) {
971 if (param->location().Equals(Location::RegisterLocation(ARGS_DESC_REG))) {
972 param->ReplaceUsesWith(
973 caller_graph->GetConstant(call_data->arguments_descriptor));
974 }
975 }
976 }
977}
GrowableArray< Definition * > * initial_definitions()
Definition il.h:1911
const Function & function() const
Definition flow_graph.h:130
void AllocateSSAIndex(Definition *def)
Definition flow_graph.h:274
bool IsRegularFunction() const
Definition object.h:3260
intptr_t NumParameters() const
Definition object.cc:8935
static bool IsAThisCallThroughAnUncheckedEntryPoint(Definition *call)
Definition inliner.cc:776
static bool CalleeParameterTypeMightBeMoreSpecific(BitVector *is_generic_covariant_impl, const FunctionType &interface_target_signature, const FunctionType &callee_signature, intptr_t first_arg_index, intptr_t arg_index)
Definition inliner.cc:786
bool IsSingleCid() const
Definition il.h:207
const Array & arguments_descriptor
Definition inliner.cc:729
Definition * call
Definition inliner.cc:728
GrowableArray< Value * > * arguments
Definition inliner.cc:731
const intptr_t first_arg_index
Definition inliner.cc:730
ZoneGrowableArray< Definition * > * parameter_stubs
Definition inliner.cc:733
FlowGraph * callee_graph
Definition inliner.cc:732

◆ ReportImpossibleNullError()

void dart::ReportImpossibleNullError ( intptr_t  cid,
StackFrame caller_frame,
Thread thread 
)

Definition at line 273 of file runtime_entry.cc.

275 {
276 TextBuffer buffer(512);
277 buffer.Printf("hit null error with cid %" Pd ", caller context: ", cid);
278
279 const intptr_t kMaxSlotsCollected = 5;
280 const auto slots = reinterpret_cast<ObjectPtr*>(caller_frame->sp());
281 const intptr_t num_slots_in_frame =
282 reinterpret_cast<ObjectPtr*>(caller_frame->fp()) - slots;
283 const auto num_slots_to_collect =
284 Utils::Maximum(kMaxSlotsCollected, num_slots_in_frame);
285 bool comma = false;
286 for (intptr_t i = 0; i < num_slots_to_collect; i++) {
287 const ObjectPtr ptr = slots[i];
288 buffer.Printf("%s[sp+%" Pd "] %" Pp "", comma ? ", " : "", i,
289 static_cast<uword>(ptr));
290 if (ptr->IsHeapObject() &&
291 (Dart::vm_isolate_group()->heap()->Contains(
292 UntaggedObject::ToAddr(ptr)) ||
293 thread->heap()->Contains(UntaggedObject::ToAddr(ptr)))) {
294 buffer.Printf("(%" Pp ")", static_cast<uword>(ptr->untag()->tags_));
295 }
296 comma = true;
297 }
298
299 const char* message = buffer.buffer();
300 FATAL("%s", message);
301}
uword sp() const
Definition stack_frame.h:41

◆ ReportPauseOnConsole()

static void dart::ReportPauseOnConsole ( ServiceEvent event)
static

Definition at line 1152 of file service.cc.

1152 {
1153 const char* name = event->isolate()->name();
1154 const int64_t main_port = static_cast<int64_t>(event->isolate()->main_port());
1155 switch (event->kind()) {
1156 case ServiceEvent::kPauseStart:
1157 OS::PrintErr("vm-service: isolate(%" Pd64
1158 ") '%s' has no debugger attached and is paused at start.",
1159 main_port, name);
1160 break;
1161 case ServiceEvent::kPauseExit:
1162 OS::PrintErr("vm-service: isolate(%" Pd64
1163 ") '%s' has no debugger attached and is paused at exit.",
1164 main_port, name);
1165 break;
1166 case ServiceEvent::kPauseException:
1167 OS::PrintErr(
1168 "vm-service: isolate (%" Pd64
1169 ") '%s' has no debugger attached and is paused due to exception.",
1170 main_port, name);
1171 break;
1172 case ServiceEvent::kPauseInterrupted:
1173 OS::PrintErr(
1174 "vm-service: isolate (%" Pd64
1175 ") '%s' has no debugger attached and is paused due to interrupt.",
1176 main_port, name);
1177 break;
1178 case ServiceEvent::kPauseBreakpoint:
1179 OS::PrintErr("vm-service: isolate (%" Pd64
1180 ") '%s' has no debugger attached and is paused.",
1181 main_port, name);
1182 break;
1183 case ServiceEvent::kPausePostRequest:
1184 OS::PrintErr("vm-service: isolate (%" Pd64
1185 ") '%s' has no debugger attached and is paused post reload.",
1186 main_port, name);
1187 break;
1188 default:
1189 UNREACHABLE();
1190 break;
1191 }
1192 if (!ServiceIsolate::IsRunning()) {
1193 OS::PrintErr(" Start the vm-service to debug.\n");
1194 } else if (ServiceIsolate::server_address() == nullptr) {
1195 OS::PrintErr(" Connect to the Dart VM service to debug.\n");
1196 } else {
1197 OS::PrintErr(" Connect to the Dart VM service at %s to debug.\n",
1198 ServiceIsolate::server_address());
1199 }
1200 const Error& err = Error::Handle(Thread::Current()->sticky_error());
1201 if (!err.IsNull()) {
1202 OS::PrintErr("%s\n", err.ToErrorCString());
1203 }
1204}

◆ ReportTimelineEvents()

static void dart::ReportTimelineEvents ( )
static

Definition at line 9975 of file dart_api_impl_test.cc.

9976 :math';\n"
9977 "import 'dart:developer';\n"
9978 "main() {}";
9979 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
9980 EXPECT_VALID(lib);
9981
9982 Dart_Handle max = Dart_NewStringFromCString("max");
9983
9984 Dart_Handle args[2] = {Dart_NewInteger(123), Dart_NewInteger(321)};
9985 Dart_Handle result = Dart_Invoke(lib, max, 2, args);
9986 EXPECT_ERROR(result,
9987 "NoSuchMethodError: No top-level method 'max' declared.");
9988
9989 Dart_Handle getCurrentTag = Dart_NewStringFromCString("getCurrentTag");
9990 result = Dart_Invoke(lib, getCurrentTag, 0, nullptr);
9991 EXPECT_ERROR(
9992 result,
9993 "NoSuchMethodError: No top-level method 'getCurrentTag' declared.");
9994}
9995
9996TEST_CASE(DartAPI_InvokeVMServiceMethod) {
9997 char buffer[1024];
9998 Utils::SNPrint(buffer, sizeof(buffer),
9999 R"({
10000 "jsonrpc": 2.0,
10001 "id": "foo",
10002 "method": "getVM",
10003 "params": { }
10004 })");
10005 uint8_t* response_json = nullptr;
10006 intptr_t response_json_length = 0;
10007 char* error = nullptr;
10008 const bool success = Dart_InvokeVMServiceMethod(
10009 reinterpret_cast<uint8_t*>(buffer), strlen(buffer), &response_json,
10010 &response_json_length, &error);
10011 EXPECT(success);
10012 EXPECT(error == nullptr);
10013
10014 Dart_Handle bytes = Dart_NewExternalTypedDataWithFinalizer(
10015 Dart_TypedData_kUint8, response_json, response_json_length, response_json,
10016 response_json_length, [](void* ignored, void* peer) { free(peer); });
10017 EXPECT_VALID(bytes);
10018
10019 // We don't have a C++ JSON decoder so we'll invoke dart to validate the
10020 // result.
10021 const char* kScript =
10022 R"(
10023 import 'dart:convert';
10024 import 'dart:typed_data';
10025 bool validate(bool condition) {
10026 if (!condition) {
10027 throw 'Failed to validate InvokeVMServiceMethod() response.';
10028 }
10029 return false;
10030 }
10031 bool validateResult(Uint8List bytes) {
10032 final map = json.decode(utf8.decode(bytes));
10033 validate(map['jsonrpc'] == '2.0');
10034 validate(map['id'] == 'foo');
10035 validate(map['result']['name'] == 'vm');
10036 validate(map['result']['type'] == 'VM');
static Editor::Movement convert(skui::Key key)

◆ ReportTooManyImports()

static void dart::ReportTooManyImports ( const Library lib)
static

Definition at line 13608 of file object.cc.

13608 {
13609 const String& url = String::Handle(lib.url());
13610 Report::MessageF(Report::kError, Script::Handle(lib.LookupScript(url)),
13611 TokenPosition::kNoSource, Report::AtLocation,
13612 "too many imports in library '%s'", url.ToCString());
13613 UNREACHABLE();
13614}

◆ ReportTooManyTypeArguments()

static void dart::ReportTooManyTypeArguments ( const Class cls)
static

Definition at line 3160 of file object.cc.

3160 {
3161 Report::MessageF(Report::kError, Script::Handle(cls.script()),
3162 cls.token_pos(), Report::AtLocation,
3163 "too many type parameters declared in class '%s' or in its "
3164 "super classes",
3165 String::Handle(cls.Name()).ToCString());
3166 UNREACHABLE();
3167}
TokenPosition token_pos() const
Definition object.h:1281
ScriptPtr script() const
Definition object.h:1274
const char * ToCString() const

◆ ReportTooManyTypeParameters()

static void dart::ReportTooManyTypeParameters ( const FunctionType sig)
static

Definition at line 8875 of file object.cc.

8875 {
8876 Report::MessageF(Report::kError, Script::Handle(), TokenPosition::kNoSource,
8877 Report::AtLocation,
8878 "too many type parameters declared in signature '%s' or in "
8879 "its enclosing signatures",
8880 sig.ToUserVisibleCString());
8881 UNREACHABLE();
8882}
const char * ToUserVisibleCString() const
Definition object.cc:11712

◆ RepresentationBits()

static intptr_t dart::RepresentationBits ( Representation  r)
static

Definition at line 2125 of file il.cc.

2125 {
2126 switch (r) {
2127 case kTagged:
2128 return compiler::target::kSmiBits + 1;
2129 case kUnboxedInt32:
2130 case kUnboxedUint32:
2131 return 32;
2132 case kUnboxedInt64:
2133 return 64;
2134 default:
2135 UNREACHABLE();
2136 return 0;
2137 }
2138}

◆ RepresentationForRange()

static Representation dart::RepresentationForRange ( Representation  definition_rep)
static

Definition at line 3191 of file linearscan.cc.

3191 {
3192 if (definition_rep == kUnboxedInt64) {
3193 // kUnboxedInt64 is split into two ranges, each of which are kUntagged.
3194 return kUntagged;
3195 } else if (definition_rep == kUnboxedUint32) {
3196 // kUnboxedUint32 is untagged.
3197 return kUntagged;
3198 }
3199 return definition_rep;
3200}

◆ RepresentationMask()

static int64_t dart::RepresentationMask ( Representation  r)
static

Definition at line 2140 of file il.cc.

2140 {
2141 return static_cast<int64_t>(static_cast<uint64_t>(-1) >>
2142 (64 - RepresentationBits(r)));
2143}
static intptr_t RepresentationBits(Representation r)
Definition il.cc:2125

◆ RepresentationToRangeSize()

static RangeBoundary::RangeSize dart::RepresentationToRangeSize ( Representation  r)
static

Definition at line 2099 of file range_analysis.cc.

2099 {
2100 switch (r) {
2101 case kTagged:
2102 return RangeBoundary::kRangeBoundarySmi;
2103 case kUnboxedInt8:
2104 return RangeBoundary::kRangeBoundaryInt8;
2105 case kUnboxedInt16:
2106 case kUnboxedUint8: // Overapproximate Uint8 as Int16.
2107 return RangeBoundary::kRangeBoundaryInt16;
2108 case kUnboxedInt32:
2109 case kUnboxedUint16: // Overapproximate Uint16 as Int32.
2110 return RangeBoundary::kRangeBoundaryInt32;
2111 case kUnboxedInt64:
2112 case kUnboxedUint32: // Overapproximate Uint32 as Int64.
2113 return RangeBoundary::kRangeBoundaryInt64;
2114 default:
2115 UNREACHABLE();
2116 return RangeBoundary::kRangeBoundarySmi;
2117 }
2118}

◆ RequestHeapSnapshot()

static void dart::RequestHeapSnapshot ( Thread thread,
JSONStream js 
)
static

Definition at line 4595 of file service.cc.

4595 {
4596 if (Service::heapsnapshot_stream.enabled()) {
4597 VmServiceHeapSnapshotChunkedWriter vmservice_writer(thread);
4598 HeapSnapshotWriter writer(thread, &vmservice_writer);
4599 writer.Write();
4600 }
4601 // TODO(koda): Provide some id that ties this request to async response(s).
4602 PrintSuccess(js);
4603}

◆ ResetHeapSamplingState()

void dart::ResetHeapSamplingState ( const char *  expected_cls = nullptr)

Definition at line 10262 of file dart_api_impl_test.cc.

◆ Resolve()

static FunctionPtr dart::Resolve ( Thread thread,
Zone zone,
const GrowableArray< const Instance * > &  caller_arguments,
const Class receiver_class,
const String name,
const Array descriptor 
)
static

Definition at line 1733 of file runtime_entry.cc.

1739 {
1740 ASSERT(name.IsSymbol());
1741 auto& target_function = Function::Handle(zone);
1742 ArgumentsDescriptor args_desc(descriptor);
1743
1744 if (receiver_class.EnsureIsFinalized(thread) == Error::null()) {
1745 target_function = Resolver::ResolveDynamicForReceiverClass(receiver_class,
1746 name, args_desc);
1747 }
1748 if (caller_arguments.length() == 2 &&
1749 target_function.ptr() == thread->isolate_group()
1750 ->object_store()
1751 ->simple_instance_of_function()) {
1752 // Replace the target function with constant function.
1753 const AbstractType& type = AbstractType::Cast(*caller_arguments[1]);
1754 target_function =
1755 ComputeTypeCheckTarget(*caller_arguments[0], type, args_desc);
1756 }
1757
1758 if (target_function.IsNull()) {
1759 target_function = InlineCacheMissHelper(receiver_class, descriptor, name);
1760 }
1761 if (target_function.IsNull()) {
1762 ASSERT(!FLAG_lazy_dispatchers);
1763 }
1764
1765 return target_function.ptr();
1766}
FunctionPtr InlineCacheMissHelper(const Class &receiver_class, const Array &args_descriptor, const String &target_name)

◆ ResolveBreakpointPos()

static TokenPosition dart::ResolveBreakpointPos ( const Function func,
TokenPosition  requested_token_pos,
TokenPosition  last_token_pos,
intptr_t  requested_column,
TokenPosition  exact_token_pos 
)
static

Definition at line 2062 of file debugger.cc.

2066 {
2067 ASSERT(!func.HasOptimizedCode());
2068 ASSERT(
2069 (requested_column == -1 && exact_token_pos == TokenPosition::kNoSource) ||
2070 (requested_column > -1 && exact_token_pos != TokenPosition::kNoSource));
2071
2072 requested_token_pos =
2073 TokenPosition::Max(requested_token_pos, func.token_pos());
2074 last_token_pos = TokenPosition::Min(last_token_pos, func.end_token_pos());
2075
2076 Zone* zone = Thread::Current()->zone();
2077 Script& script = Script::Handle(zone, func.script());
2078 Code& code = Code::Handle(zone);
2079 PcDescriptors& desc = PcDescriptors::Handle(zone);
2080 ASSERT(func.HasCode());
2081 code = func.unoptimized_code();
2082 ASSERT(!code.IsNull());
2083 desc = code.pc_descriptors();
2084
2085 // First pass: find the safe point which is closest to the beginning
2086 // of the given token range.
2087 TokenPosition best_fit_pos = TokenPosition::kMaxSource;
2088 intptr_t best_column = INT_MAX;
2089 intptr_t best_line = INT_MAX;
2090
2091 PcDescriptors::Iterator iter(desc, kSafepointKind);
2092 while (iter.MoveNext()) {
2093 const TokenPosition& pos = iter.TokenPos();
2094 if (pos.IsSynthetic() && pos == requested_token_pos) {
2095 // if there's a safepoint for a synthetic function start and the start
2096 // was requested, we're done.
2097 return pos;
2098 }
2099 if (!pos.IsWithin(requested_token_pos, last_token_pos)) {
2100 // Token is not in the target range.
2101 continue;
2102 }
2103 TokenPosition next_closest_token_position = TokenPosition::kMaxSource;
2104 if (requested_column >= 0) {
2105 // Find next closest safepoint
2106 PcDescriptors::Iterator iter2(desc, kSafepointKind);
2107 while (iter2.MoveNext()) {
2108 const TokenPosition& next = iter2.TokenPos();
2109 if (!next.IsReal()) continue;
2110 if ((pos < next) && (next < next_closest_token_position)) {
2111 next_closest_token_position = next;
2112 }
2113 }
2114 }
2115 RefineBreakpointPos(script, pos, next_closest_token_position,
2116 requested_token_pos, last_token_pos, requested_column,
2117 exact_token_pos, &best_fit_pos, &best_column,
2118 &best_line);
2119 }
2120
2121 // Second pass (if we found a safe point in the first pass). Find
2122 // the token on the line which is at the best fit column (if column
2123 // was specified) and has the lowest code address.
2124 if (best_fit_pos != TokenPosition::kMaxSource) {
2125 ASSERT(best_fit_pos.IsReal());
2126 const Script& script = Script::Handle(zone, func.script());
2127 const TokenPosition begin_pos = best_fit_pos;
2128
2129 TokenPosition end_of_line_pos = TokenPosition::kNoSource;
2130 if (best_line < 0) {
2131 script.GetTokenLocation(begin_pos, &best_line);
2132 }
2133 ASSERT(best_line > 0);
2134 TokenPosition ignored = TokenPosition::kNoSource;
2135 script.TokenRangeAtLine(best_line, &ignored, &end_of_line_pos);
2136 end_of_line_pos = TokenPosition::Max(end_of_line_pos, begin_pos);
2137
2138 uword lowest_pc_offset = kUwordMax;
2139 PcDescriptors::Iterator iter(desc, kSafepointKind);
2140 while (iter.MoveNext()) {
2141 const TokenPosition& pos = iter.TokenPos();
2142 if (requested_column >= 0) {
2143 if (pos != best_fit_pos) {
2144 // Not an match for the requested column.
2145 continue;
2146 }
2147 } else if (!pos.IsWithin(begin_pos, end_of_line_pos)) {
2148 // Token is not on same line as best fit.
2149 continue;
2150 }
2151
2152 // Prefer the lowest pc offset.
2153 if (iter.PcOffset() < lowest_pc_offset) {
2154 lowest_pc_offset = iter.PcOffset();
2155 best_fit_pos = pos;
2156 }
2157 }
2158 return best_fit_pos;
2159 }
2160
2161 // We didn't find a safe point in the given token range. Try and
2162 // find a safe point in the remaining source code of the function.
2163 // Since we have moved to the next line of the function, we no
2164 // longer are requesting a specific column number.
2165 if (last_token_pos < func.end_token_pos()) {
2166 return ResolveBreakpointPos(func, last_token_pos, func.end_token_pos(),
2167 -1 /* no column */, TokenPosition::kNoSource);
2168 }
2169 return TokenPosition::kNoSource;
2170}
CodePtr unoptimized_code() const
Definition object.h:3165
static TokenPosition ResolveBreakpointPos(const Function &func, TokenPosition requested_token_pos, TokenPosition last_token_pos, intptr_t requested_column, TokenPosition exact_token_pos)
Definition debugger.cc:2062
constexpr uword kUwordMax
Definition globals.h:519
static void RefineBreakpointPos(const Script &script, TokenPosition pos, TokenPosition next_closest_token_position, TokenPosition requested_token_pos, TokenPosition last_token_pos, intptr_t requested_column, TokenPosition exact_token_pos, TokenPosition *best_fit_pos, intptr_t *best_column, intptr_t *best_line)
Definition debugger.cc:1955

◆ ResolveCallThroughGetter()

static bool dart::ResolveCallThroughGetter ( const Class receiver_class,
const String target_name,
const String demangled,
const Array arguments_descriptor,
Function result 
)
static

Definition at line 1563 of file runtime_entry.cc.

1567 {
1568 const String& getter_name = String::Handle(Field::GetterName(demangled));
1569 const int kTypeArgsLen = 0;
1570 const int kNumArguments = 1;
1571 ArgumentsDescriptor args_desc(Array::Handle(
1572 ArgumentsDescriptor::NewBoxed(kTypeArgsLen, kNumArguments)));
1573 const Function& getter =
1574 Function::Handle(Resolver::ResolveDynamicForReceiverClass(
1575 receiver_class, getter_name, args_desc));
1576 if (getter.IsNull() || getter.IsMethodExtractor()) {
1577 return false;
1578 }
1579 // We do this on the target_name, _not_ on the demangled name, so that
1580 // FlowGraphBuilder::BuildGraphOfInvokeFieldDispatcher can detect dynamic
1581 // calls from the dyn: tag on the name of the dispatcher.
1582 const Function& target_function =
1583 Function::Handle(receiver_class.GetInvocationDispatcher(
1584 target_name, arguments_descriptor,
1585 UntaggedFunction::kInvokeFieldDispatcher, FLAG_lazy_dispatchers));
1586 ASSERT(!target_function.IsNull() || !FLAG_lazy_dispatchers);
1587 if (FLAG_trace_ic) {
1588 OS::PrintErr(
1589 "InvokeField IC miss: adding <%s> id:%" Pd " -> <%s>\n",
1590 receiver_class.ToCString(), receiver_class.id(),
1591 target_function.IsNull() ? "null" : target_function.ToCString());
1592 }
1593 *result = target_function.ptr();
1594 return true;
1595}

◆ ResolveConstructor()

static ObjectPtr dart::ResolveConstructor ( const char *  current_func,
const Class cls,
const String class_name,
const String dotted_name,
int  num_args 
)
static

Definition at line 4173 of file dart_api_impl.cc.

4177 {
4178 // The constructor must be present in the interface.
4179 Function& constructor = Function::Handle();
4180 if (cls.EnsureIsFinalized(Thread::Current()) == Error::null()) {
4181 constructor = cls.LookupFunctionAllowPrivate(constr_name);
4182 }
4183 if (constructor.IsNull() ||
4184 (!constructor.IsGenerativeConstructor() && !constructor.IsFactory())) {
4185 const String& lookup_class_name = String::Handle(cls.Name());
4186 if (!class_name.Equals(lookup_class_name)) {
4187 // When the class name used to build the constructor name is
4188 // different than the name of the class in which we are doing
4189 // the lookup, it can be confusing to the user to figure out
4190 // what's going on. Be a little more explicit for these error
4191 // messages.
4192 const String& message = String::Handle(String::NewFormatted(
4193 "%s: could not find factory '%s' in class '%s'.", current_func,
4194 constr_name.ToCString(), lookup_class_name.ToCString()));
4195 return ApiError::New(message);
4196 } else {
4197 const String& message = String::Handle(
4198 String::NewFormatted("%s: could not find constructor '%s'.",
4199 current_func, constr_name.ToCString()));
4200 return ApiError::New(message);
4201 }
4202 }
4203 const int kTypeArgsLen = 0;
4204 const int extra_args = 1;
4205 String& error_message = String::Handle();
4206 if (!constructor.AreValidArgumentCounts(kTypeArgsLen, num_args + extra_args,
4207 0, &error_message)) {
4208 const String& message = String::Handle(String::NewFormatted(
4209 "%s: wrong argument count for "
4210 "constructor '%s': %s.",
4211 current_func, constr_name.ToCString(), error_message.ToCString()));
4212 return ApiError::New(message);
4213 }
4214 ErrorPtr error = constructor.VerifyCallEntryPoint();
4215 if (error != Error::null()) return error;
4216 return constructor.ptr();
4217}
bool AreValidArgumentCounts(intptr_t num_type_arguments, intptr_t num_arguments, intptr_t num_named_arguments, String *error_message) const
Definition object.cc:9308
DART_WARN_UNUSED_RESULT ErrorPtr VerifyCallEntryPoint() const
Definition object.cc:27386

◆ ResolveDynamicAnyArgsWithCustomLookup()

static FunctionPtr dart::ResolveDynamicAnyArgsWithCustomLookup ( Zone zone,
const Class receiver_class,
const String function_name,
bool  allow_add,
std::function< FunctionPtr(Class &, const String &)>  lookup 
)
static

Definition at line 33 of file resolver.cc.

38 {
39 Class& cls = Class::Handle(zone, receiver_class.ptr());
40 if (FLAG_trace_resolving) {
41 THR_Print("ResolveDynamic '%s' for class %s\n", function_name.ToCString(),
42 String::Handle(zone, cls.Name()).ToCString());
43 }
44 Function& function = Function::Handle(zone);
45
46 const String& demangled = String::Handle(
47 zone,
48 Function::IsDynamicInvocationForwarderName(function_name)
49 ? Function::DemangleDynamicInvocationForwarderName(function_name)
50 : function_name.ptr());
51
52 const bool is_getter = Field::IsGetterName(demangled);
53 String& demangled_getter_name = String::Handle();
54 if (is_getter) {
55 demangled_getter_name = Field::NameFromGetter(demangled);
56 }
57
58 const bool is_dyn_call = demangled.ptr() != function_name.ptr();
59
60 Thread* thread = Thread::Current();
61 bool need_to_create_method_extractor = false;
62 while (!cls.IsNull()) {
63 if (is_dyn_call) {
64 // Try to find a dyn:* forwarder & return it.
66 function_name, Array::null_array(),
67 UntaggedFunction::kDynamicInvocationForwarder,
68 /*create_if_absent=*/false);
69 }
70 if (!function.IsNull()) return function.ptr();
71
72 ASSERT(cls.is_finalized());
73 {
74 SafepointReadRwLocker ml(thread, thread->isolate_group()->program_lock());
75 function = lookup(cls, demangled);
76 }
77#if !defined(DART_PRECOMPILED_RUNTIME)
78 // In JIT we might need to lazily create a dyn:* forwarder.
79 if (is_dyn_call && !function.IsNull()) {
80 function =
81 function.GetDynamicInvocationForwarder(function_name, allow_add);
82 }
83#endif
84 if (!function.IsNull()) return function.ptr();
85
86 // Getter invocation might actually be a method extraction.
87 if (is_getter) {
88 SafepointReadRwLocker ml(thread, thread->isolate_group()->program_lock());
89 function = lookup(cls, demangled_getter_name);
90 if (!function.IsNull()) {
91 if (allow_add && FLAG_lazy_dispatchers) {
92 need_to_create_method_extractor = true;
93 break;
94 } else {
95 return Function::null();
96 }
97 }
98 }
99 cls = cls.SuperClass();
100 }
101 if (need_to_create_method_extractor) {
102 // We were looking for the getter but found a method with the same
103 // name. Create a method extractor and return it.
104 // Use GetMethodExtractor instead of CreateMethodExtractor to ensure
105 // nobody created method extractor since we last checked under ReadRwLocker.
106 function = function.GetMethodExtractor(demangled);
107 } else if (is_getter && receiver_class.IsRecordClass() && allow_add &&
108 FLAG_lazy_dispatchers) {
109 function = receiver_class.GetRecordFieldGetter(demangled);
110 }
111 return function.ptr();
112}
bool IsRecordClass() const
Definition object.h:1585
FunctionPtr GetRecordFieldGetter(const String &getter_name) const
Definition object.cc:4128

◆ ResolveDynamicForReceiverClassWithCustomLookup()

static FunctionPtr dart::ResolveDynamicForReceiverClassWithCustomLookup ( const Class receiver_class,
const String function_name,
const ArgumentsDescriptor args_desc,
bool  allow_add,
std::function< FunctionPtr(Class &, const String &)>  lookup 
)
static

Definition at line 114 of file resolver.cc.

119 {
120 Thread* thread = Thread::Current();
121 Zone* zone = thread->zone();
122
123 Function& function = Function::Handle(
125 zone, receiver_class, function_name, allow_add, lookup));
126
127#if defined(DART_PRECOMPILED_RUNTIME)
128 if (!function.IsNull() && function.signature() == FunctionType::null()) {
129 // FfiTrampolines are the only functions that can still be called
130 // dynamically without going through a dynamic invocation forwarder.
131 RELEASE_ASSERT(!Function::IsDynamicInvocationForwarderName(function_name) &&
132 !function.IsFfiCallbackTrampoline());
133 // The signature for this function was dropped in the precompiler, which
134 // means it is not a possible target for a dynamic call in the program.
135 // That means we're resolving an UnlinkedCall for an InstanceCall to
136 // a known interface. Since there's no overloading in Dart, the type checker
137 // has already checked the validity of the arguments at compile time.
138 return function.ptr();
139 }
140#endif
141
142 if (function.IsNull() || !function.AreValidArguments(args_desc, nullptr)) {
143 // Return a null function to signal to the upper levels to dispatch to
144 // "noSuchMethod" function.
145 if (FLAG_trace_resolving) {
146 String& error_message =
147 String::Handle(zone, Symbols::New(thread, "function not found"));
148 if (!function.IsNull()) {
149 // Obtain more detailed error message.
150 function.AreValidArguments(args_desc, &error_message);
151 }
152 THR_Print("ResolveDynamic error '%s': %s.\n", function_name.ToCString(),
153 error_message.ToCString());
154 }
155 return Function::null();
156 }
157 return function.ptr();
158}
static FunctionPtr ResolveDynamicAnyArgsWithCustomLookup(Zone *zone, const Class &receiver_class, const String &function_name, bool allow_add, std::function< FunctionPtr(Class &, const String &)> lookup)
Definition resolver.cc:33

◆ ResolveNativeFunction()

static NativeFunction dart::ResolveNativeFunction ( Zone zone,
const Function func,
bool *  is_bootstrap_native,
bool *  is_auto_scope 
)
static

Definition at line 228 of file native_entry.cc.

231 {
232 const Class& cls = Class::Handle(zone, func.Owner());
233 const Library& library = Library::Handle(zone, cls.library());
234
235 *is_bootstrap_native =
236 Bootstrap::IsBootstrapResolver(library.native_entry_resolver());
237
238 const String& native_name = String::Handle(zone, func.native_name());
239 ASSERT(!native_name.IsNull());
240
241 const int num_params = NativeArguments::ParameterCountForResolution(func);
242 NativeFunction native_function = NativeEntry::ResolveNative(
243 library, native_name, num_params, is_auto_scope);
244 if (native_function == nullptr) {
245 FATAL("Failed to resolve native function '%s' in '%s'\n",
246 native_name.ToCString(), func.ToQualifiedCString());
247 }
248 return native_function;
249}
StringPtr native_name() const
Definition object.cc:8564
const char * ToQualifiedCString() const
Definition object.cc:9834
Dart_NativeEntryResolver native_entry_resolver() const
Definition object.h:5200
void(* NativeFunction)(NativeArguments *arguments)

◆ ResolveSymbol()

static void * dart::ResolveSymbol ( void *  handle,
const char *  symbol,
char **  error 
)
static

Definition at line 136 of file ffi_dynamic_library.cc.

136 {
137#if defined(DART_HOST_OS_WINDOWS)
138 if (handle == kWindowsDynamicLibraryProcessPtr) {
139 return LookupSymbolInProcess(symbol, error);
140 }
141#endif
142 return Utils::ResolveSymbolInDynamicLibrary(handle, symbol, error);
143}

◆ ResolveUri()

bool dart::ResolveUri ( const char *  ref_uri,
const char *  base_uri,
const char **  target_uri 
)

Definition at line 424 of file uri.cc.

426 {
427 // Parse the reference uri.
428 ParsedUri ref;
429 if (!ParseUri(ref_uri, &ref)) {
430 *target_uri = nullptr;
431 return false;
432 }
433
434 ParsedUri target;
435 if (ref.scheme != nullptr) {
436 if (strcmp(ref.scheme, "dart") == 0) {
437 Zone* zone = ThreadState::Current()->zone();
438 *target_uri = zone->MakeCopyOfString(ref_uri);
439 return true;
440 }
441
442 // When the ref_uri specifies a scheme, the base_uri is ignored.
443 target.scheme = ref.scheme;
444 target.userinfo = ref.userinfo;
445 target.host = ref.host;
446 target.port = ref.port;
447 target.path = RemoveDotSegments(ref.path);
448 target.query = ref.query;
449 target.fragment = ref.fragment;
450 *target_uri = BuildUri(target);
451 return true;
452 }
453
454 // Parse the base uri.
455 ParsedUri base;
456 if (!ParseUri(base_uri, &base)) {
457 *target_uri = nullptr;
458 return false;
459 }
460
461 if ((base.scheme != nullptr) && strcmp(base.scheme, "dart") == 0) {
462 Zone* zone = ThreadState::Current()->zone();
463 *target_uri = zone->MakeCopyOfString(ref_uri);
464 return true;
465 }
466
467 if (ref.host != nullptr) {
468 // When the ref_uri specifies an authority, we only use the base scheme.
469 target.scheme = base.scheme;
470 target.userinfo = ref.userinfo;
471 target.host = ref.host;
472 target.port = ref.port;
473 target.path = RemoveDotSegments(ref.path);
474 target.query = ref.query;
475 target.fragment = ref.fragment;
476 *target_uri = BuildUri(target);
477 return true;
478 }
479
480 if (ref.path[0] == '\0') {
481 // Empty path. Use most parts of base_uri.
482 target.scheme = base.scheme;
483 target.userinfo = base.userinfo;
484 target.host = base.host;
485 target.port = base.port;
486 target.path = base.path;
487 target.query = ((ref.query == nullptr) ? base.query : ref.query);
488 target.fragment = ref.fragment;
489 *target_uri = BuildUri(target);
490 return true;
491
492 } else if (ref.path[0] == '/') {
493 // Absolute path. ref_path wins.
494 target.scheme = base.scheme;
495 target.userinfo = base.userinfo;
496 target.host = base.host;
497 target.port = base.port;
498 target.path = RemoveDotSegments(ref.path);
499 target.query = ref.query;
500 target.fragment = ref.fragment;
501 *target_uri = BuildUri(target);
502 return true;
503
504 } else {
505 // Relative path. We need to merge the base path and the ref path.
506
507 if (base.scheme == nullptr && base.host == nullptr && base.path[0] != '/') {
508 // The dart:core Uri class handles resolving a relative uri
509 // against a second relative uri specially, in a way not
510 // described in the RFC. We do not need to support this for
511 // library resolution. If we need to implement this later, we
512 // can.
513 *target_uri = nullptr;
514 return false;
515 }
516
517 target.scheme = base.scheme;
518 target.userinfo = base.userinfo;
519 target.host = base.host;
520 target.port = base.port;
521 target.path = RemoveDotSegments(MergePaths(base.path, ref.path));
522 target.query = ref.query;
523 target.fragment = ref.fragment;
524 *target_uri = BuildUri(target);
525 return true;
526 }
527}
bool ParseUri(const char *uri, ParsedUri *parsed_uri)
Definition uri.cc:193
static const char * RemoveDotSegments(const char *path)
Definition uri.cc:282
static const char * MergePaths(const char *base_path, const char *ref_path)
Definition uri.cc:344
static char * BuildUri(const ParsedUri &uri)
Definition uri.cc:377

◆ Respecialization()

static TTSTestCase dart::Respecialization ( const TTSTestCase original)
static

Definition at line 391 of file type_testing_stubs_test.cc.

391 {
392 return TTSTestCase(original.instance, original.instantiator_tav,
393 original.function_tav, kRespecialize);
394}

◆ RespondWithMalformedJson()

static void dart::RespondWithMalformedJson ( Thread thread,
JSONStream js 
)
static

Definition at line 4988 of file service.cc.

4988 {
4989 JSONObject jsobj(js);
4990 jsobj.AddProperty("a", "a");
4991 JSONObject jsobj1(js);
4992 jsobj1.AddProperty("a", "a");
4993 JSONObject jsobj2(js);
4994 jsobj2.AddProperty("a", "a");
4995 JSONObject jsobj3(js);
4996 jsobj3.AddProperty("a", "a");
4997}

◆ RespondWithMalformedObject()

static void dart::RespondWithMalformedObject ( Thread thread,
JSONStream js 
)
static

Definition at line 4999 of file service.cc.

4999 {
5000 JSONObject jsobj(js);
5001 jsobj.AddProperty("bart", "simpson");
5002}

◆ RestoreSIGPIPEHandler()

DART_EXPORT void dart::RestoreSIGPIPEHandler ( )

Definition at line 327 of file ffi_test_functions_vmspecific.cc.

327 {
328#if defined(DART_HOST_OS_MACOS)
329 signal(SIGPIPE, SIG_DFL);
330#endif
331}

◆ ResultType()

static CompileType * dart::ResultType ( Definition call)
static

Definition at line 1704 of file call_specializer.cc.

1704 {
1705 if (auto static_call = call->AsStaticCall()) {
1706 return static_call->result_type();
1707 } else if (auto instance_call = call->AsInstanceCall()) {
1708 return instance_call->result_type();
1709 }
1710 return nullptr;
1711}

◆ Resume()

static void dart::Resume ( Thread thread,
JSONStream js 
)
static

Definition at line 4329 of file service.cc.

4329 {
4330 const char* step_param = js->LookupParam("step");
4331 Debugger::ResumeAction step = Debugger::kContinue;
4332 if (step_param != nullptr) {
4333 step = EnumMapper(step_param, step_enum_names, step_enum_values);
4334 }
4335 intptr_t frame_index = 1;
4336 const char* frame_index_param = js->LookupParam("frameIndex");
4337 if (frame_index_param != nullptr) {
4338 if (step != Debugger::kStepRewind) {
4339 // Only rewind supports the frameIndex parameter.
4340 js->PrintError(
4341 kInvalidParams,
4342 "%s: the 'frameIndex' parameter can only be used when rewinding",
4343 js->method());
4344 return;
4345 }
4346 frame_index = UIntParameter::Parse(js->LookupParam("frameIndex"));
4347 }
4348 Isolate* isolate = thread->isolate();
4349 if (isolate->message_handler()->is_paused_on_start()) {
4350 // If the user is issuing a 'Over' or an 'Out' step, that is the
4351 // same as a regular resume request.
4352 if (step == Debugger::kStepInto) {
4353 isolate->debugger()->EnterSingleStepMode();
4354 }
4355 isolate->message_handler()->set_should_pause_on_start(false);
4356 isolate->SetResumeRequest();
4357 if (Service::debug_stream.enabled()) {
4358 ServiceEvent event(isolate, ServiceEvent::kResume);
4359 Service::HandleEvent(&event);
4360 }
4361 PrintSuccess(js);
4362 return;
4363 }
4364 if (isolate->message_handler()->should_pause_on_start()) {
4365 isolate->message_handler()->set_should_pause_on_start(false);
4366 isolate->SetResumeRequest();
4367 if (Service::debug_stream.enabled()) {
4368 ServiceEvent event(isolate, ServiceEvent::kResume);
4369 Service::HandleEvent(&event);
4370 }
4371 PrintSuccess(js);
4372 return;
4373 }
4374 if (isolate->message_handler()->is_paused_on_exit()) {
4375 isolate->message_handler()->set_should_pause_on_exit(false);
4376 isolate->SetResumeRequest();
4377 // We don't send a resume event because we will be exiting.
4378 PrintSuccess(js);
4379 return;
4380 }
4381 if (isolate->debugger()->PauseEvent() == nullptr) {
4382 js->PrintError(kIsolateMustBePaused, nullptr);
4383 return;
4384 }
4385
4386 const char* error = nullptr;
4387 if (!isolate->debugger()->SetResumeAction(step, frame_index, &error)) {
4388 js->PrintError(kCannotResume, "%s", error);
4389 return;
4390 }
4391 isolate->SetResumeRequest();
4392 PrintSuccess(js);
4393}
static int step(int x, SkScalar min, SkScalar max)
Definition BlurTest.cpp:215
void EnterSingleStepMode()
Definition debugger.cc:3079
T EnumMapper(const char *value, const char *const *enums, T *values)
Definition service.cc:865

◆ RetrieveFunctionTypeArguments()

static TypeArgumentsPtr dart::RetrieveFunctionTypeArguments ( Thread thread,
Zone zone,
const Function function,
const Instance receiver,
const TypeArguments instantiator_type_args,
const Array args,
const ArgumentsDescriptor args_desc 
)
static

Definition at line 9467 of file object.cc.

9474 {
9475 ASSERT(!function.IsNull());
9476
9477 const intptr_t kNumCurrentTypeArgs = function.NumTypeParameters();
9478 const intptr_t kNumParentTypeArgs = function.NumParentTypeArguments();
9479 const intptr_t kNumTypeArgs = kNumCurrentTypeArgs + kNumParentTypeArgs;
9480 // Non-generic functions don't receive type arguments.
9481 if (kNumTypeArgs == 0) return Object::empty_type_arguments().ptr();
9482 // Closure functions require that the receiver be provided (and is a closure).
9483 ASSERT(!function.IsClosureFunction() || receiver.IsClosure());
9484
9485 // Only closure functions should have possibly generic parents.
9486 ASSERT(function.IsClosureFunction() || kNumParentTypeArgs == 0);
9487 const auto& parent_type_args =
9488 function.IsClosureFunction()
9489 ? TypeArguments::Handle(
9490 zone, Closure::Cast(receiver).function_type_arguments())
9491 : Object::empty_type_arguments();
9492 // We don't try to instantiate the parent type parameters to their bounds
9493 // if not provided or check any closed-over type arguments against the parent
9494 // type parameter bounds (since they have been type checked already).
9495 if (kNumCurrentTypeArgs == 0) return parent_type_args.ptr();
9496
9497 auto& function_type_args = TypeArguments::Handle(zone);
9498 // First check for delayed type arguments before using either provided or
9499 // default type arguments.
9500 bool has_delayed_type_args = false;
9501 if (function.IsClosureFunction()) {
9502 const auto& closure = Closure::Cast(receiver);
9503 function_type_args = closure.delayed_type_arguments();
9504 has_delayed_type_args =
9505 function_type_args.ptr() != Object::empty_type_arguments().ptr();
9506 }
9507
9508 if (args_desc.TypeArgsLen() > 0) {
9509 // We should never end up here when the receiver is a closure with delayed
9510 // type arguments unless this dynamically called closure function was
9511 // retrieved directly from the closure instead of going through
9512 // DartEntry::ResolveCallable, which appropriately checks for this case.
9513 ASSERT(!has_delayed_type_args);
9514 function_type_args ^= args.At(0);
9515 } else if (!has_delayed_type_args) {
9516 // We have no explicitly provided function type arguments, so instantiate
9517 // the type parameters to bounds or replace as appropriate.
9518 function_type_args = function.DefaultTypeArguments(zone);
9519 auto const mode =
9520 function.IsClosureFunction()
9521 ? function.default_type_arguments_instantiation_mode()
9522 : function_type_args.GetInstantiationMode(zone, &function);
9523 switch (mode) {
9524 case InstantiationMode::kIsInstantiated:
9525 // Nothing left to do.
9526 break;
9527 case InstantiationMode::kNeedsInstantiation:
9528 function_type_args = function_type_args.InstantiateAndCanonicalizeFrom(
9529 instantiator_type_args, parent_type_args);
9530 break;
9531 case InstantiationMode::kSharesInstantiatorTypeArguments:
9532 function_type_args = instantiator_type_args.ptr();
9533 break;
9534 case InstantiationMode::kSharesFunctionTypeArguments:
9535 function_type_args = parent_type_args.ptr();
9536 break;
9537 }
9538 }
9539
9540 return function_type_args.Prepend(zone, parent_type_args, kNumParentTypeArgs,
9541 kNumTypeArgs);
9542}
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

◆ RetrieveInstantiatorTypeArguments()

static TypeArgumentsPtr dart::RetrieveInstantiatorTypeArguments ( Zone zone,
const Function function,
const Instance receiver 
)
static

Definition at line 9545 of file object.cc.

9548 {
9549 if (function.IsClosureFunction()) {
9550 ASSERT(receiver.IsClosure());
9551 const auto& closure = Closure::Cast(receiver);
9552 return closure.instantiator_type_arguments();
9553 }
9554 if (!receiver.IsNull()) {
9555 const auto& cls = Class::Handle(zone, receiver.clazz());
9556 if (cls.NumTypeArguments() > 0) {
9557 return receiver.GetTypeArguments();
9558 }
9559 }
9560 return Object::empty_type_arguments().ptr();
9561}
virtual TypeArgumentsPtr GetTypeArguments() const
Definition object.cc:20611

◆ RetryCompilationWithFarBranches()

static CodePtr dart::RetryCompilationWithFarBranches ( Thread thread,
std::function< CodePtr(compiler::Assembler &)>  fun 
)
static

Definition at line 220 of file type_testing_stubs.cc.

222 {
223 volatile intptr_t far_branch_level = 0;
224 while (true) {
225 LongJumpScope jump;
226 if (setjmp(*jump.Set()) == 0) {
227 // To use the already-defined __ Macro !
228 compiler::Assembler assembler(nullptr, far_branch_level);
229 return fun(assembler);
230 } else {
231 // We bailed out or we encountered an error.
232 const Error& error = Error::Handle(thread->StealStickyError());
233 if (error.ptr() == Object::branch_offset_error().ptr()) {
234 ASSERT(far_branch_level < 2);
235 far_branch_level++;
236 } else if (error.ptr() == Object::out_of_memory_error().ptr()) {
237 thread->set_sticky_error(error);
238 return Code::null();
239 } else {
240 UNREACHABLE();
241 }
242 }
243 }
244}
void set_sticky_error(const Error &value)
Definition thread.cc:234

◆ ReturnHandleInCallback()

DART_EXPORT Dart_Handle dart::ReturnHandleInCallback ( Dart_Handle(*)()  callback)

Definition at line 990 of file ffi_test_functions_vmspecific.cc.

990 {
991 printf("ReturnHandleInCallback %p\n", callback);
992 Dart_Handle handle = callback();
993 if (Dart_IsError(handle)) {
994 printf("callback() returned an error, propagating error\n");
995 // Do C/C++ resource cleanup if needed, before propagating error.
996 Dart_PropagateError(handle);
997 }
998 return handle;
999}

◆ ReturnIntPtr()

intptr_t dart::ReturnIntPtr ( intptr_t  x)

Definition at line 1141 of file ffi_test_functions_vmspecific.cc.

1141 {
1142 return x;
1143}

◆ ReturnIntPtrMethod()

intptr_t dart::ReturnIntPtrMethod ( Dart_Handle  self,
intptr_t  value 
)

Definition at line 1218 of file ffi_test_functions_vmspecific.cc.

1218 {
1219 return value;
1220}

◆ ReturnMaxUint16()

DART_EXPORT uint16_t dart::ReturnMaxUint16 ( )

Definition at line 83 of file ffi_test_functions.cc.

83 {
84 return 0xffff;
85}

◆ ReturnMaxUint16v2()

DART_EXPORT uint16_t dart::ReturnMaxUint16v2 ( )

Definition at line 111 of file ffi_test_functions.cc.

111 {
112 uint64_t v = 0xabcffff;
113 return v;
114}

◆ ReturnMaxUint32()

DART_EXPORT uint32_t dart::ReturnMaxUint32 ( )

Definition at line 87 of file ffi_test_functions.cc.

87 {
88 return 0xffffffff;
89}

◆ ReturnMaxUint32v2()

DART_EXPORT uint32_t dart::ReturnMaxUint32v2 ( )

Definition at line 116 of file ffi_test_functions.cc.

116 {
117 uint64_t v = 0xabcffffffff;
118 return v;
119}

◆ ReturnMaxUint8()

DART_EXPORT uint8_t dart::ReturnMaxUint8 ( )

Definition at line 79 of file ffi_test_functions.cc.

79 {
80 return 0xff;
81}

◆ ReturnMaxUint8v2()

DART_EXPORT uint8_t dart::ReturnMaxUint8v2 ( )

Definition at line 104 of file ffi_test_functions.cc.

104 {
105 uint64_t v = 0xabcff;
106 // Truncated to 8 bits and zero extended, or truncated to 32 bits, depending
107 // on ABI.
108 return v;
109}

◆ ReturnMinInt16()

DART_EXPORT int16_t dart::ReturnMinInt16 ( )

Definition at line 95 of file ffi_test_functions.cc.

95 {
96 return 0x8000;
97}

◆ ReturnMinInt16v2()

DART_EXPORT int16_t dart::ReturnMinInt16v2 ( )

Definition at line 126 of file ffi_test_functions.cc.

126 {
127 int64_t v = 0x8abc8000;
128 return v;
129}

◆ ReturnMinInt32()

DART_EXPORT int32_t dart::ReturnMinInt32 ( )

Definition at line 99 of file ffi_test_functions.cc.

99 {
100 return 0x80000000;
101}

◆ ReturnMinInt32v2()

DART_EXPORT int32_t dart::ReturnMinInt32v2 ( )

Definition at line 131 of file ffi_test_functions.cc.

131 {
132 int64_t v = 0x8abc80000000;
133 return v;
134}

◆ ReturnMinInt8()

DART_EXPORT int8_t dart::ReturnMinInt8 ( )

Definition at line 91 of file ffi_test_functions.cc.

91 {
92 return 0x80;
93}

◆ ReturnMinInt8v2()

DART_EXPORT int8_t dart::ReturnMinInt8v2 ( )

Definition at line 121 of file ffi_test_functions.cc.

121 {
122 int64_t v = 0x8abc80;
123 return v;
124}

◆ ReturnPtrAsInt()

static intptr_t dart::ReturnPtrAsInt ( void *  ptr)
static

Definition at line 4442 of file dart_api_impl_test.cc.

4442 {
4443 return reinterpret_cast<intptr_t>(ptr);
4444}

◆ ReturnStruct1024BytesHomogeneousUint64()

DART_EXPORT Struct1024BytesHomogeneousUint64 dart::ReturnStruct1024BytesHomogeneousUint64 ( uint64_t  a0,
uint64_t  a1,
uint64_t  a2,
uint64_t  a3,
uint64_t  a4,
uint64_t  a5,
uint64_t  a6,
uint64_t  a7,
uint64_t  a8,
uint64_t  a9,
uint64_t  a10,
uint64_t  a11,
uint64_t  a12,
uint64_t  a13,
uint64_t  a14,
uint64_t  a15,
uint64_t  a16,
uint64_t  a17,
uint64_t  a18,
uint64_t  a19,
uint64_t  a20,
uint64_t  a21,
uint64_t  a22,
uint64_t  a23,
uint64_t  a24,
uint64_t  a25,
uint64_t  a26,
uint64_t  a27,
uint64_t  a28,
uint64_t  a29,
uint64_t  a30,
uint64_t  a31,
uint64_t  a32,
uint64_t  a33,
uint64_t  a34,
uint64_t  a35,
uint64_t  a36,
uint64_t  a37,
uint64_t  a38,
uint64_t  a39,
uint64_t  a40,
uint64_t  a41,
uint64_t  a42,
uint64_t  a43,
uint64_t  a44,
uint64_t  a45,
uint64_t  a46,
uint64_t  a47,
uint64_t  a48,
uint64_t  a49,
uint64_t  a50,
uint64_t  a51,
uint64_t  a52,
uint64_t  a53,
uint64_t  a54,
uint64_t  a55,
uint64_t  a56,
uint64_t  a57,
uint64_t  a58,
uint64_t  a59,
uint64_t  a60,
uint64_t  a61,
uint64_t  a62,
uint64_t  a63,
uint64_t  a64,
uint64_t  a65,
uint64_t  a66,
uint64_t  a67,
uint64_t  a68,
uint64_t  a69,
uint64_t  a70,
uint64_t  a71,
uint64_t  a72,
uint64_t  a73,
uint64_t  a74,
uint64_t  a75,
uint64_t  a76,
uint64_t  a77,
uint64_t  a78,
uint64_t  a79,
uint64_t  a80,
uint64_t  a81,
uint64_t  a82,
uint64_t  a83,
uint64_t  a84,
uint64_t  a85,
uint64_t  a86,
uint64_t  a87,
uint64_t  a88,
uint64_t  a89,
uint64_t  a90,
uint64_t  a91,
uint64_t  a92,
uint64_t  a93,
uint64_t  a94,
uint64_t  a95,
uint64_t  a96,
uint64_t  a97,
uint64_t  a98,
uint64_t  a99,
uint64_t  a100,
uint64_t  a101,
uint64_t  a102,
uint64_t  a103,
uint64_t  a104,
uint64_t  a105,
uint64_t  a106,
uint64_t  a107,
uint64_t  a108,
uint64_t  a109,
uint64_t  a110,
uint64_t  a111,
uint64_t  a112,
uint64_t  a113,
uint64_t  a114,
uint64_t  a115,
uint64_t  a116,
uint64_t  a117,
uint64_t  a118,
uint64_t  a119,
uint64_t  a120,
uint64_t  a121,
uint64_t  a122,
uint64_t  a123,
uint64_t  a124,
uint64_t  a125,
uint64_t  a126,
uint64_t  a127 
)

Definition at line 5338 of file ffi_test_functions_generated.cc.

5465 {
5466 std::cout << "ReturnStruct1024BytesHomogeneousUint64" << "(" << a0 << ", "
5467 << a1 << ", " << a2 << ", " << a3 << ", " << a4 << ", " << a5
5468 << ", " << a6 << ", " << a7 << ", " << a8 << ", " << a9 << ", "
5469 << a10 << ", " << a11 << ", " << a12 << ", " << a13 << ", " << a14
5470 << ", " << a15 << ", " << a16 << ", " << a17 << ", " << a18 << ", "
5471 << a19 << ", " << a20 << ", " << a21 << ", " << a22 << ", " << a23
5472 << ", " << a24 << ", " << a25 << ", " << a26 << ", " << a27 << ", "
5473 << a28 << ", " << a29 << ", " << a30 << ", " << a31 << ", " << a32
5474 << ", " << a33 << ", " << a34 << ", " << a35 << ", " << a36 << ", "
5475 << a37 << ", " << a38 << ", " << a39 << ", " << a40 << ", " << a41
5476 << ", " << a42 << ", " << a43 << ", " << a44 << ", " << a45 << ", "
5477 << a46 << ", " << a47 << ", " << a48 << ", " << a49 << ", " << a50
5478 << ", " << a51 << ", " << a52 << ", " << a53 << ", " << a54 << ", "
5479 << a55 << ", " << a56 << ", " << a57 << ", " << a58 << ", " << a59
5480 << ", " << a60 << ", " << a61 << ", " << a62 << ", " << a63 << ", "
5481 << a64 << ", " << a65 << ", " << a66 << ", " << a67 << ", " << a68
5482 << ", " << a69 << ", " << a70 << ", " << a71 << ", " << a72 << ", "
5483 << a73 << ", " << a74 << ", " << a75 << ", " << a76 << ", " << a77
5484 << ", " << a78 << ", " << a79 << ", " << a80 << ", " << a81 << ", "
5485 << a82 << ", " << a83 << ", " << a84 << ", " << a85 << ", " << a86
5486 << ", " << a87 << ", " << a88 << ", " << a89 << ", " << a90 << ", "
5487 << a91 << ", " << a92 << ", " << a93 << ", " << a94 << ", " << a95
5488 << ", " << a96 << ", " << a97 << ", " << a98 << ", " << a99 << ", "
5489 << a100 << ", " << a101 << ", " << a102 << ", " << a103 << ", "
5490 << a104 << ", " << a105 << ", " << a106 << ", " << a107 << ", "
5491 << a108 << ", " << a109 << ", " << a110 << ", " << a111 << ", "
5492 << a112 << ", " << a113 << ", " << a114 << ", " << a115 << ", "
5493 << a116 << ", " << a117 << ", " << a118 << ", " << a119 << ", "
5494 << a120 << ", " << a121 << ", " << a122 << ", " << a123 << ", "
5495 << a124 << ", " << a125 << ", " << a126 << ", " << a127 << ")"
5496 << "\n";
5497
5499
5500 result.a0 = a0;
5501 result.a1 = a1;
5502 result.a2 = a2;
5503 result.a3 = a3;
5504 result.a4 = a4;
5505 result.a5 = a5;
5506 result.a6 = a6;
5507 result.a7 = a7;
5508 result.a8 = a8;
5509 result.a9 = a9;
5510 result.a10 = a10;
5511 result.a11 = a11;
5512 result.a12 = a12;
5513 result.a13 = a13;
5514 result.a14 = a14;
5515 result.a15 = a15;
5516 result.a16 = a16;
5517 result.a17 = a17;
5518 result.a18 = a18;
5519 result.a19 = a19;
5520 result.a20 = a20;
5521 result.a21 = a21;
5522 result.a22 = a22;
5523 result.a23 = a23;
5524 result.a24 = a24;
5525 result.a25 = a25;
5526 result.a26 = a26;
5527 result.a27 = a27;
5528 result.a28 = a28;
5529 result.a29 = a29;
5530 result.a30 = a30;
5531 result.a31 = a31;
5532 result.a32 = a32;
5533 result.a33 = a33;
5534 result.a34 = a34;
5535 result.a35 = a35;
5536 result.a36 = a36;
5537 result.a37 = a37;
5538 result.a38 = a38;
5539 result.a39 = a39;
5540 result.a40 = a40;
5541 result.a41 = a41;
5542 result.a42 = a42;
5543 result.a43 = a43;
5544 result.a44 = a44;
5545 result.a45 = a45;
5546 result.a46 = a46;
5547 result.a47 = a47;
5548 result.a48 = a48;
5549 result.a49 = a49;
5550 result.a50 = a50;
5551 result.a51 = a51;
5552 result.a52 = a52;
5553 result.a53 = a53;
5554 result.a54 = a54;
5555 result.a55 = a55;
5556 result.a56 = a56;
5557 result.a57 = a57;
5558 result.a58 = a58;
5559 result.a59 = a59;
5560 result.a60 = a60;
5561 result.a61 = a61;
5562 result.a62 = a62;
5563 result.a63 = a63;
5564 result.a64 = a64;
5565 result.a65 = a65;
5566 result.a66 = a66;
5567 result.a67 = a67;
5568 result.a68 = a68;
5569 result.a69 = a69;
5570 result.a70 = a70;
5571 result.a71 = a71;
5572 result.a72 = a72;
5573 result.a73 = a73;
5574 result.a74 = a74;
5575 result.a75 = a75;
5576 result.a76 = a76;
5577 result.a77 = a77;
5578 result.a78 = a78;
5579 result.a79 = a79;
5580 result.a80 = a80;
5581 result.a81 = a81;
5582 result.a82 = a82;
5583 result.a83 = a83;
5584 result.a84 = a84;
5585 result.a85 = a85;
5586 result.a86 = a86;
5587 result.a87 = a87;
5588 result.a88 = a88;
5589 result.a89 = a89;
5590 result.a90 = a90;
5591 result.a91 = a91;
5592 result.a92 = a92;
5593 result.a93 = a93;
5594 result.a94 = a94;
5595 result.a95 = a95;
5596 result.a96 = a96;
5597 result.a97 = a97;
5598 result.a98 = a98;
5599 result.a99 = a99;
5600 result.a100 = a100;
5601 result.a101 = a101;
5602 result.a102 = a102;
5603 result.a103 = a103;
5604 result.a104 = a104;
5605 result.a105 = a105;
5606 result.a106 = a106;
5607 result.a107 = a107;
5608 result.a108 = a108;
5609 result.a109 = a109;
5610 result.a110 = a110;
5611 result.a111 = a111;
5612 result.a112 = a112;
5613 result.a113 = a113;
5614 result.a114 = a114;
5615 result.a115 = a115;
5616 result.a116 = a116;
5617 result.a117 = a117;
5618 result.a118 = a118;
5619 result.a119 = a119;
5620 result.a120 = a120;
5621 result.a121 = a121;
5622 result.a122 = a122;
5623 result.a123 = a123;
5624 result.a124 = a124;
5625 result.a125 = a125;
5626 result.a126 = a126;
5627 result.a127 = a127;
5628
5629 std::cout << "result = " << "(" << result.a0 << ", " << result.a1 << ", "
5630 << result.a2 << ", " << result.a3 << ", " << result.a4 << ", "
5631 << result.a5 << ", " << result.a6 << ", " << result.a7 << ", "
5632 << result.a8 << ", " << result.a9 << ", " << result.a10 << ", "
5633 << result.a11 << ", " << result.a12 << ", " << result.a13 << ", "
5634 << result.a14 << ", " << result.a15 << ", " << result.a16 << ", "
5635 << result.a17 << ", " << result.a18 << ", " << result.a19 << ", "
5636 << result.a20 << ", " << result.a21 << ", " << result.a22 << ", "
5637 << result.a23 << ", " << result.a24 << ", " << result.a25 << ", "
5638 << result.a26 << ", " << result.a27 << ", " << result.a28 << ", "
5639 << result.a29 << ", " << result.a30 << ", " << result.a31 << ", "
5640 << result.a32 << ", " << result.a33 << ", " << result.a34 << ", "
5641 << result.a35 << ", " << result.a36 << ", " << result.a37 << ", "
5642 << result.a38 << ", " << result.a39 << ", " << result.a40 << ", "
5643 << result.a41 << ", " << result.a42 << ", " << result.a43 << ", "
5644 << result.a44 << ", " << result.a45 << ", " << result.a46 << ", "
5645 << result.a47 << ", " << result.a48 << ", " << result.a49 << ", "
5646 << result.a50 << ", " << result.a51 << ", " << result.a52 << ", "
5647 << result.a53 << ", " << result.a54 << ", " << result.a55 << ", "
5648 << result.a56 << ", " << result.a57 << ", " << result.a58 << ", "
5649 << result.a59 << ", " << result.a60 << ", " << result.a61 << ", "
5650 << result.a62 << ", " << result.a63 << ", " << result.a64 << ", "
5651 << result.a65 << ", " << result.a66 << ", " << result.a67 << ", "
5652 << result.a68 << ", " << result.a69 << ", " << result.a70 << ", "
5653 << result.a71 << ", " << result.a72 << ", " << result.a73 << ", "
5654 << result.a74 << ", " << result.a75 << ", " << result.a76 << ", "
5655 << result.a77 << ", " << result.a78 << ", " << result.a79 << ", "
5656 << result.a80 << ", " << result.a81 << ", " << result.a82 << ", "
5657 << result.a83 << ", " << result.a84 << ", " << result.a85 << ", "
5658 << result.a86 << ", " << result.a87 << ", " << result.a88 << ", "
5659 << result.a89 << ", " << result.a90 << ", " << result.a91 << ", "
5660 << result.a92 << ", " << result.a93 << ", " << result.a94 << ", "
5661 << result.a95 << ", " << result.a96 << ", " << result.a97 << ", "
5662 << result.a98 << ", " << result.a99 << ", " << result.a100 << ", "
5663 << result.a101 << ", " << result.a102 << ", " << result.a103 << ", "
5664 << result.a104 << ", " << result.a105 << ", " << result.a106 << ", "
5665 << result.a107 << ", " << result.a108 << ", " << result.a109 << ", "
5666 << result.a110 << ", " << result.a111 << ", " << result.a112 << ", "
5667 << result.a113 << ", " << result.a114 << ", " << result.a115 << ", "
5668 << result.a116 << ", " << result.a117 << ", " << result.a118 << ", "
5669 << result.a119 << ", " << result.a120 << ", " << result.a121 << ", "
5670 << result.a122 << ", " << result.a123 << ", " << result.a124 << ", "
5671 << result.a125 << ", " << result.a126 << ", " << result.a127 << ")"
5672 << "\n";
5673
5674 return result;
5675}

◆ ReturnStruct12BytesHomogeneousFloat()

DART_EXPORT Struct12BytesHomogeneousFloat dart::ReturnStruct12BytesHomogeneousFloat ( float  a0,
float  a1,
float  a2 
)

Definition at line 5055 of file ffi_test_functions_generated.cc.

5055 {
5056 std::cout << "ReturnStruct12BytesHomogeneousFloat" << "(" << a0 << ", " << a1
5057 << ", " << a2 << ")" << "\n";
5058
5060
5061 result.a0 = a0;
5062 result.a1 = a1;
5063 result.a2 = a2;
5064
5065 std::cout << "result = " << "(" << result.a0 << ", " << result.a1 << ", "
5066 << result.a2 << ")" << "\n";
5067
5068 return result;
5069}

◆ ReturnStruct16BytesHomogeneousFloat()

DART_EXPORT Struct16BytesHomogeneousFloat dart::ReturnStruct16BytesHomogeneousFloat ( float  a0,
float  a1,
float  a2,
float  a3 
)

Definition at line 5074 of file ffi_test_functions_generated.cc.

5074 {
5075 std::cout << "ReturnStruct16BytesHomogeneousFloat" << "(" << a0 << ", " << a1
5076 << ", " << a2 << ", " << a3 << ")" << "\n";
5077
5079
5080 result.a0 = a0;
5081 result.a1 = a1;
5082 result.a2 = a2;
5083 result.a3 = a3;
5084
5085 std::cout << "result = " << "(" << result.a0 << ", " << result.a1 << ", "
5086 << result.a2 << ", " << result.a3 << ")" << "\n";
5087
5088 return result;
5089}

◆ ReturnStruct16BytesMixed()

DART_EXPORT Struct16BytesMixed dart::ReturnStruct16BytesMixed ( double  a0,
int64_t  a1 
)

Definition at line 5093 of file ffi_test_functions_generated.cc.

5093 {
5094 std::cout << "ReturnStruct16BytesMixed" << "(" << a0 << ", " << a1 << ")"
5095 << "\n";
5096
5098
5099 result.a0 = a0;
5100 result.a1 = a1;
5101
5102 std::cout << "result = " << "(" << result.a0 << ", " << result.a1 << ")"
5103 << "\n";
5104
5105 return result;
5106}

◆ ReturnStruct16BytesMixed2()

DART_EXPORT Struct16BytesMixed2 dart::ReturnStruct16BytesMixed2 ( float  a0,
float  a1,
float  a2,
int32_t  a3 
)

Definition at line 5111 of file ffi_test_functions_generated.cc.

5114 {
5115 std::cout << "ReturnStruct16BytesMixed2" << "(" << a0 << ", " << a1 << ", "
5116 << a2 << ", " << a3 << ")" << "\n";
5117
5119
5120 result.a0 = a0;
5121 result.a1 = a1;
5122 result.a2 = a2;
5123 result.a3 = a3;
5124
5125 std::cout << "result = " << "(" << result.a0 << ", " << result.a1 << ", "
5126 << result.a2 << ", " << result.a3 << ")" << "\n";
5127
5128 return result;
5129}

◆ ReturnStruct16BytesNestedInt()

DART_EXPORT Struct16BytesNestedInt dart::ReturnStruct16BytesNestedInt ( Struct8BytesNestedInt  a0,
Struct8BytesNestedInt  a1 
)

Definition at line 6132 of file ffi_test_functions_generated.cc.

6133 {
6134 std::cout << "ReturnStruct16BytesNestedInt" << "(((" << a0.a0.a0 << ", "
6135 << a0.a0.a1 << "), (" << a0.a1.a0 << ", " << a0.a1.a1 << ")), (("
6136 << a1.a0.a0 << ", " << a1.a0.a1 << "), (" << a1.a1.a0 << ", "
6137 << a1.a1.a1 << ")))" << "\n";
6138
6140
6141 result.a0.a0.a0 = a0.a0.a0;
6142 result.a0.a0.a1 = a0.a0.a1;
6143 result.a0.a1.a0 = a0.a1.a0;
6144 result.a0.a1.a1 = a0.a1.a1;
6145 result.a1.a0.a0 = a1.a0.a0;
6146 result.a1.a0.a1 = a1.a0.a1;
6147 result.a1.a1.a0 = a1.a1.a0;
6148 result.a1.a1.a1 = a1.a1.a1;
6149
6150 std::cout << "result = " << "(((" << result.a0.a0.a0 << ", "
6151 << result.a0.a0.a1 << "), (" << result.a0.a1.a0 << ", "
6152 << result.a0.a1.a1 << ")), ((" << result.a1.a0.a0 << ", "
6153 << result.a1.a0.a1 << "), (" << result.a1.a1.a0 << ", "
6154 << result.a1.a1.a1 << ")))" << "\n";
6155
6156 return result;
6157}

◆ ReturnStruct17BytesInt()

DART_EXPORT Struct17BytesInt dart::ReturnStruct17BytesInt ( int64_t  a0,
int64_t  a1,
int8_t  a2 
)

Definition at line 5135 of file ffi_test_functions_generated.cc.

5137 {
5138 std::cout << "ReturnStruct17BytesInt" << "(" << a0 << ", " << a1 << ", "
5139 << static_cast<int>(a2) << ")" << "\n";
5140
5142
5143 result.a0 = a0;
5144 result.a1 = a1;
5145 result.a2 = a2;
5146
5147 std::cout << "result = " << "(" << result.a0 << ", " << result.a1 << ", "
5148 << static_cast<int>(result.a2) << ")" << "\n";
5149
5150 return result;
5151}

◆ ReturnStruct19BytesHomogeneousUint8()

DART_EXPORT Struct19BytesHomogeneousUint8 dart::ReturnStruct19BytesHomogeneousUint8 ( uint8_t  a0,
uint8_t  a1,
uint8_t  a2,
uint8_t  a3,
uint8_t  a4,
uint8_t  a5,
uint8_t  a6,
uint8_t  a7,
uint8_t  a8,
uint8_t  a9,
uint8_t  a10,
uint8_t  a11,
uint8_t  a12,
uint8_t  a13,
uint8_t  a14,
uint8_t  a15,
uint8_t  a16,
uint8_t  a17,
uint8_t  a18 
)

Definition at line 5158 of file ffi_test_functions_generated.cc.

5176 {
5177 std::cout << "ReturnStruct19BytesHomogeneousUint8" << "("
5178 << static_cast<int>(a0) << ", " << static_cast<int>(a1) << ", "
5179 << static_cast<int>(a2) << ", " << static_cast<int>(a3) << ", "
5180 << static_cast<int>(a4) << ", " << static_cast<int>(a5) << ", "
5181 << static_cast<int>(a6) << ", " << static_cast<int>(a7) << ", "
5182 << static_cast<int>(a8) << ", " << static_cast<int>(a9) << ", "
5183 << static_cast<int>(a10) << ", " << static_cast<int>(a11) << ", "
5184 << static_cast<int>(a12) << ", " << static_cast<int>(a13) << ", "
5185 << static_cast<int>(a14) << ", " << static_cast<int>(a15) << ", "
5186 << static_cast<int>(a16) << ", " << static_cast<int>(a17) << ", "
5187 << static_cast<int>(a18) << ")" << "\n";
5188
5190
5191 result.a0 = a0;
5192 result.a1 = a1;
5193 result.a2 = a2;
5194 result.a3 = a3;
5195 result.a4 = a4;
5196 result.a5 = a5;
5197 result.a6 = a6;
5198 result.a7 = a7;
5199 result.a8 = a8;
5200 result.a9 = a9;
5201 result.a10 = a10;
5202 result.a11 = a11;
5203 result.a12 = a12;
5204 result.a13 = a13;
5205 result.a14 = a14;
5206 result.a15 = a15;
5207 result.a16 = a16;
5208 result.a17 = a17;
5209 result.a18 = a18;
5210
5211 std::cout << "result = " << "(" << static_cast<int>(result.a0) << ", "
5212 << static_cast<int>(result.a1) << ", "
5213 << static_cast<int>(result.a2) << ", "
5214 << static_cast<int>(result.a3) << ", "
5215 << static_cast<int>(result.a4) << ", "
5216 << static_cast<int>(result.a5) << ", "
5217 << static_cast<int>(result.a6) << ", "
5218 << static_cast<int>(result.a7) << ", "
5219 << static_cast<int>(result.a8) << ", "
5220 << static_cast<int>(result.a9) << ", "
5221 << static_cast<int>(result.a10) << ", "
5222 << static_cast<int>(result.a11) << ", "
5223 << static_cast<int>(result.a12) << ", "
5224 << static_cast<int>(result.a13) << ", "
5225 << static_cast<int>(result.a14) << ", "
5226 << static_cast<int>(result.a15) << ", "
5227 << static_cast<int>(result.a16) << ", "
5228 << static_cast<int>(result.a17) << ", "
5229 << static_cast<int>(result.a18) << ")" << "\n";
5230
5231 return result;
5232}

◆ ReturnStruct1ByteInt()

DART_EXPORT Struct1ByteInt dart::ReturnStruct1ByteInt ( int8_t  a0)

Definition at line 4800 of file ffi_test_functions_generated.cc.

4800 {
4801 std::cout << "ReturnStruct1ByteInt" << "(" << static_cast<int>(a0) << ")"
4802 << "\n";
4803
4805
4806 result.a0 = a0;
4807
4808 std::cout << "result = " << "(" << static_cast<int>(result.a0) << ")" << "\n";
4809
4810 return result;
4811}

◆ ReturnStruct20BytesHomogeneousFloat()

DART_EXPORT Struct20BytesHomogeneousFloat dart::ReturnStruct20BytesHomogeneousFloat ( float  a0,
float  a1,
float  a2,
float  a3,
float  a4 
)

Definition at line 5263 of file ffi_test_functions_generated.cc.

5267 {
5268 std::cout << "ReturnStruct20BytesHomogeneousFloat" << "(" << a0 << ", " << a1
5269 << ", " << a2 << ", " << a3 << ", " << a4 << ")" << "\n";
5270
5272
5273 result.a0 = a0;
5274 result.a1 = a1;
5275 result.a2 = a2;
5276 result.a3 = a3;
5277 result.a4 = a4;
5278
5279 std::cout << "result = " << "(" << result.a0 << ", " << result.a1 << ", "
5280 << result.a2 << ", " << result.a3 << ", " << result.a4 << ")"
5281 << "\n";
5282
5283 return result;
5284}

◆ ReturnStruct20BytesHomogeneousInt32()

DART_EXPORT Struct20BytesHomogeneousInt32 dart::ReturnStruct20BytesHomogeneousInt32 ( int32_t  a0,
int32_t  a1,
int32_t  a2,
int32_t  a3,
int32_t  a4 
)

Definition at line 5237 of file ffi_test_functions_generated.cc.

5241 {
5242 std::cout << "ReturnStruct20BytesHomogeneousInt32" << "(" << a0 << ", " << a1
5243 << ", " << a2 << ", " << a3 << ", " << a4 << ")" << "\n";
5244
5246
5247 result.a0 = a0;
5248 result.a1 = a1;
5249 result.a2 = a2;
5250 result.a3 = a3;
5251 result.a4 = a4;
5252
5253 std::cout << "result = " << "(" << result.a0 << ", " << result.a1 << ", "
5254 << result.a2 << ", " << result.a3 << ", " << result.a4 << ")"
5255 << "\n";
5256
5257 return result;
5258}

◆ ReturnStruct32BytesHomogeneousDouble()

DART_EXPORT Struct32BytesHomogeneousDouble dart::ReturnStruct32BytesHomogeneousDouble ( double  a0,
double  a1,
double  a2,
double  a3 
)

Definition at line 5289 of file ffi_test_functions_generated.cc.

5292 {
5293 std::cout << "ReturnStruct32BytesHomogeneousDouble" << "(" << a0 << ", " << a1
5294 << ", " << a2 << ", " << a3 << ")" << "\n";
5295
5297
5298 result.a0 = a0;
5299 result.a1 = a1;
5300 result.a2 = a2;
5301 result.a3 = a3;
5302
5303 std::cout << "result = " << "(" << result.a0 << ", " << result.a1 << ", "
5304 << result.a2 << ", " << result.a3 << ")" << "\n";
5305
5306 return result;
5307}

◆ ReturnStruct32BytesNestedInt()

DART_EXPORT Struct32BytesNestedInt dart::ReturnStruct32BytesNestedInt ( Struct16BytesNestedInt  a0,
Struct16BytesNestedInt  a1 
)

Definition at line 6162 of file ffi_test_functions_generated.cc.

6163 {
6164 std::cout << "ReturnStruct32BytesNestedInt" << "((((" << a0.a0.a0.a0 << ", "
6165 << a0.a0.a0.a1 << "), (" << a0.a0.a1.a0 << ", " << a0.a0.a1.a1
6166 << ")), ((" << a0.a1.a0.a0 << ", " << a0.a1.a0.a1 << "), ("
6167 << a0.a1.a1.a0 << ", " << a0.a1.a1.a1 << "))), (((" << a1.a0.a0.a0
6168 << ", " << a1.a0.a0.a1 << "), (" << a1.a0.a1.a0 << ", "
6169 << a1.a0.a1.a1 << ")), ((" << a1.a1.a0.a0 << ", " << a1.a1.a0.a1
6170 << "), (" << a1.a1.a1.a0 << ", " << a1.a1.a1.a1 << "))))" << "\n";
6171
6173
6174 result.a0.a0.a0.a0 = a0.a0.a0.a0;
6175 result.a0.a0.a0.a1 = a0.a0.a0.a1;
6176 result.a0.a0.a1.a0 = a0.a0.a1.a0;
6177 result.a0.a0.a1.a1 = a0.a0.a1.a1;
6178 result.a0.a1.a0.a0 = a0.a1.a0.a0;
6179 result.a0.a1.a0.a1 = a0.a1.a0.a1;
6180 result.a0.a1.a1.a0 = a0.a1.a1.a0;
6181 result.a0.a1.a1.a1 = a0.a1.a1.a1;
6182 result.a1.a0.a0.a0 = a1.a0.a0.a0;
6183 result.a1.a0.a0.a1 = a1.a0.a0.a1;
6184 result.a1.a0.a1.a0 = a1.a0.a1.a0;
6185 result.a1.a0.a1.a1 = a1.a0.a1.a1;
6186 result.a1.a1.a0.a0 = a1.a1.a0.a0;
6187 result.a1.a1.a0.a1 = a1.a1.a0.a1;
6188 result.a1.a1.a1.a0 = a1.a1.a1.a0;
6189 result.a1.a1.a1.a1 = a1.a1.a1.a1;
6190
6191 std::cout << "result = " << "((((" << result.a0.a0.a0.a0 << ", "
6192 << result.a0.a0.a0.a1 << "), (" << result.a0.a0.a1.a0 << ", "
6193 << result.a0.a0.a1.a1 << ")), ((" << result.a0.a1.a0.a0 << ", "
6194 << result.a0.a1.a0.a1 << "), (" << result.a0.a1.a1.a0 << ", "
6195 << result.a0.a1.a1.a1 << "))), (((" << result.a1.a0.a0.a0 << ", "
6196 << result.a1.a0.a0.a1 << "), (" << result.a1.a0.a1.a0 << ", "
6197 << result.a1.a0.a1.a1 << ")), ((" << result.a1.a1.a0.a0 << ", "
6198 << result.a1.a1.a0.a1 << "), (" << result.a1.a1.a1.a0 << ", "
6199 << result.a1.a1.a1.a1 << "))))" << "\n";
6200
6201 return result;
6202}

◆ ReturnStruct3BytesHomogeneousUint8()

DART_EXPORT Struct3BytesHomogeneousUint8 dart::ReturnStruct3BytesHomogeneousUint8 ( uint8_t  a0,
uint8_t  a1,
uint8_t  a2 
)

Definition at line 4816 of file ffi_test_functions_generated.cc.

4816 {
4817 std::cout << "ReturnStruct3BytesHomogeneousUint8" << "("
4818 << static_cast<int>(a0) << ", " << static_cast<int>(a1) << ", "
4819 << static_cast<int>(a2) << ")" << "\n";
4820
4822
4823 result.a0 = a0;
4824 result.a1 = a1;
4825 result.a2 = a2;
4826
4827 std::cout << "result = " << "(" << static_cast<int>(result.a0) << ", "
4828 << static_cast<int>(result.a1) << ", "
4829 << static_cast<int>(result.a2) << ")" << "\n";
4830
4831 return result;
4832}

◆ ReturnStruct3BytesInt2ByteAligned()

DART_EXPORT Struct3BytesInt2ByteAligned dart::ReturnStruct3BytesInt2ByteAligned ( int16_t  a0,
int8_t  a1 
)

Definition at line 4838 of file ffi_test_functions_generated.cc.

4838 {
4839 std::cout << "ReturnStruct3BytesInt2ByteAligned" << "(" << a0 << ", "
4840 << static_cast<int>(a1) << ")" << "\n";
4841
4843
4844 result.a0 = a0;
4845 result.a1 = a1;
4846
4847 std::cout << "result = " << "(" << result.a0 << ", "
4848 << static_cast<int>(result.a1) << ")" << "\n";
4849
4850 return result;
4851}

◆ ReturnStruct3BytesPackedInt()

DART_EXPORT Struct3BytesPackedInt dart::ReturnStruct3BytesPackedInt ( int8_t  a0,
int16_t  a1 
)

Definition at line 5679 of file ffi_test_functions_generated.cc.

5680 {
5681 std::cout << "ReturnStruct3BytesPackedInt" << "(" << static_cast<int>(a0)
5682 << ", " << a1 << ")" << "\n";
5683
5685
5686 result.a0 = a0;
5687 result.a1 = a1;
5688
5689 std::cout << "result = " << "(" << static_cast<int>(result.a0) << ", "
5690 << result.a1 << ")" << "\n";
5691
5692 return result;
5693}

◆ ReturnStruct40BytesHomogeneousDouble()

DART_EXPORT Struct40BytesHomogeneousDouble dart::ReturnStruct40BytesHomogeneousDouble ( double  a0,
double  a1,
double  a2,
double  a3,
double  a4 
)

Definition at line 5312 of file ffi_test_functions_generated.cc.

5316 {
5317 std::cout << "ReturnStruct40BytesHomogeneousDouble" << "(" << a0 << ", " << a1
5318 << ", " << a2 << ", " << a3 << ", " << a4 << ")" << "\n";
5319
5321
5322 result.a0 = a0;
5323 result.a1 = a1;
5324 result.a2 = a2;
5325 result.a3 = a3;
5326 result.a4 = a4;
5327
5328 std::cout << "result = " << "(" << result.a0 << ", " << result.a1 << ", "
5329 << result.a2 << ", " << result.a3 << ", " << result.a4 << ")"
5330 << "\n";
5331
5332 return result;
5333}

◆ ReturnStruct4BytesHomogeneousInt16()

DART_EXPORT Struct4BytesHomogeneousInt16 dart::ReturnStruct4BytesHomogeneousInt16 ( int16_t  a0,
int16_t  a1 
)

Definition at line 4856 of file ffi_test_functions_generated.cc.

4856 {
4857 std::cout << "ReturnStruct4BytesHomogeneousInt16" << "(" << a0 << ", " << a1
4858 << ")" << "\n";
4859
4861
4862 result.a0 = a0;
4863 result.a1 = a1;
4864
4865 std::cout << "result = " << "(" << result.a0 << ", " << result.a1 << ")"
4866 << "\n";
4867
4868 return result;
4869}

◆ ReturnStruct7BytesHomogeneousUint8()

DART_EXPORT Struct7BytesHomogeneousUint8 dart::ReturnStruct7BytesHomogeneousUint8 ( uint8_t  a0,
uint8_t  a1,
uint8_t  a2,
uint8_t  a3,
uint8_t  a4,
uint8_t  a5,
uint8_t  a6 
)

Definition at line 4874 of file ffi_test_functions_generated.cc.

4880 {
4881 std::cout << "ReturnStruct7BytesHomogeneousUint8" << "("
4882 << static_cast<int>(a0) << ", " << static_cast<int>(a1) << ", "
4883 << static_cast<int>(a2) << ", " << static_cast<int>(a3) << ", "
4884 << static_cast<int>(a4) << ", " << static_cast<int>(a5) << ", "
4885 << static_cast<int>(a6) << ")" << "\n";
4886
4888
4889 result.a0 = a0;
4890 result.a1 = a1;
4891 result.a2 = a2;
4892 result.a3 = a3;
4893 result.a4 = a4;
4894 result.a5 = a5;
4895 result.a6 = a6;
4896
4897 std::cout << "result = " << "(" << static_cast<int>(result.a0) << ", "
4898 << static_cast<int>(result.a1) << ", "
4899 << static_cast<int>(result.a2) << ", "
4900 << static_cast<int>(result.a3) << ", "
4901 << static_cast<int>(result.a4) << ", "
4902 << static_cast<int>(result.a5) << ", "
4903 << static_cast<int>(result.a6) << ")" << "\n";
4904
4905 return result;
4906}

◆ ReturnStruct7BytesInt4ByteAligned()

DART_EXPORT Struct7BytesInt4ByteAligned dart::ReturnStruct7BytesInt4ByteAligned ( int32_t  a0,
int16_t  a1,
int8_t  a2 
)

Definition at line 4912 of file ffi_test_functions_generated.cc.

4912 {
4913 std::cout << "ReturnStruct7BytesInt4ByteAligned" << "(" << a0 << ", " << a1
4914 << ", " << static_cast<int>(a2) << ")" << "\n";
4915
4917
4918 result.a0 = a0;
4919 result.a1 = a1;
4920 result.a2 = a2;
4921
4922 std::cout << "result = " << "(" << result.a0 << ", " << result.a1 << ", "
4923 << static_cast<int>(result.a2) << ")" << "\n";
4924
4925 return result;
4926}

◆ ReturnStruct8BytesHomogeneousFloat()

DART_EXPORT Struct8BytesHomogeneousFloat dart::ReturnStruct8BytesHomogeneousFloat ( float  a0,
float  a1 
)

Definition at line 4951 of file ffi_test_functions_generated.cc.

4951 {
4952 std::cout << "ReturnStruct8BytesHomogeneousFloat" << "(" << a0 << ", " << a1
4953 << ")" << "\n";
4954
4956
4957 result.a0 = a0;
4958 result.a1 = a1;
4959
4960 std::cout << "result = " << "(" << result.a0 << ", " << result.a1 << ")"
4961 << "\n";
4962
4963 return result;
4964}

◆ ReturnStruct8BytesInt()

DART_EXPORT Struct8BytesInt dart::ReturnStruct8BytesInt ( int16_t  a0,
int16_t  a1,
int32_t  a2 
)

Definition at line 4930 of file ffi_test_functions_generated.cc.

4932 {
4933 std::cout << "ReturnStruct8BytesInt" << "(" << a0 << ", " << a1 << ", " << a2
4934 << ")" << "\n";
4935
4937
4938 result.a0 = a0;
4939 result.a1 = a1;
4940 result.a2 = a2;
4941
4942 std::cout << "result = " << "(" << result.a0 << ", " << result.a1 << ", "
4943 << result.a2 << ")" << "\n";
4944
4945 return result;
4946}

◆ ReturnStruct8BytesMixed()

DART_EXPORT Struct8BytesMixed dart::ReturnStruct8BytesMixed ( float  a0,
int16_t  a1,
int16_t  a2 
)

Definition at line 4968 of file ffi_test_functions_generated.cc.

4970 {
4971 std::cout << "ReturnStruct8BytesMixed" << "(" << a0 << ", " << a1 << ", "
4972 << a2 << ")" << "\n";
4973
4975
4976 result.a0 = a0;
4977 result.a1 = a1;
4978 result.a2 = a2;
4979
4980 std::cout << "result = " << "(" << result.a0 << ", " << result.a1 << ", "
4981 << result.a2 << ")" << "\n";
4982
4983 return result;
4984}

◆ ReturnStruct8BytesNestedFloat()

DART_EXPORT Struct8BytesNestedFloat dart::ReturnStruct8BytesNestedFloat ( Struct4BytesFloat  a0,
Struct4BytesFloat  a1 
)

Definition at line 6075 of file ffi_test_functions_generated.cc.

6075 {
6076 std::cout << "ReturnStruct8BytesNestedFloat" << "((" << a0.a0 << "), ("
6077 << a1.a0 << "))" << "\n";
6078
6080
6081 result.a0.a0 = a0.a0;
6082 result.a1.a0 = a1.a0;
6083
6084 std::cout << "result = " << "((" << result.a0.a0 << "), (" << result.a1.a0
6085 << "))" << "\n";
6086
6087 return result;
6088}

◆ ReturnStruct8BytesNestedFloat2()

DART_EXPORT Struct8BytesNestedFloat2 dart::ReturnStruct8BytesNestedFloat2 ( Struct4BytesFloat  a0,
float  a1 
)

Definition at line 6094 of file ffi_test_functions_generated.cc.

6094 {
6095 std::cout << "ReturnStruct8BytesNestedFloat2" << "((" << a0.a0 << "), " << a1
6096 << ")" << "\n";
6097
6099
6100 result.a0.a0 = a0.a0;
6101 result.a1 = a1;
6102
6103 std::cout << "result = " << "((" << result.a0.a0 << "), " << result.a1 << ")"
6104 << "\n";
6105
6106 return result;
6107}

◆ ReturnStruct8BytesNestedInt()

Definition at line 6054 of file ffi_test_functions_generated.cc.

6055 {
6056 std::cout << "ReturnStruct8BytesNestedInt" << "((" << a0.a0 << ", " << a0.a1
6057 << "), (" << a1.a0 << ", " << a1.a1 << "))" << "\n";
6058
6060
6061 result.a0.a0 = a0.a0;
6062 result.a0.a1 = a0.a1;
6063 result.a1.a0 = a1.a0;
6064 result.a1.a1 = a1.a1;
6065
6066 std::cout << "result = " << "((" << result.a0.a0 << ", " << result.a0.a1
6067 << "), (" << result.a1.a0 << ", " << result.a1.a1 << "))" << "\n";
6068
6069 return result;
6070}

◆ ReturnStruct8BytesNestedMixed()

DART_EXPORT Struct8BytesNestedMixed dart::ReturnStruct8BytesNestedMixed ( Struct4BytesHomogeneousInt16  a0,
Struct4BytesFloat  a1 
)

Definition at line 6112 of file ffi_test_functions_generated.cc.

6113 {
6114 std::cout << "ReturnStruct8BytesNestedMixed" << "((" << a0.a0 << ", " << a0.a1
6115 << "), (" << a1.a0 << "))" << "\n";
6116
6118
6119 result.a0.a0 = a0.a0;
6120 result.a0.a1 = a0.a1;
6121 result.a1.a0 = a1.a0;
6122
6123 std::cout << "result = " << "((" << result.a0.a0 << ", " << result.a0.a1
6124 << "), (" << result.a1.a0 << "))" << "\n";
6125
6126 return result;
6127}

◆ ReturnStruct8BytesPackedInt()

DART_EXPORT Struct8BytesPackedInt dart::ReturnStruct8BytesPackedInt ( uint8_t  a0,
uint32_t  a1,
uint8_t  a2,
uint8_t  a3,
uint8_t  a4 
)

Definition at line 5697 of file ffi_test_functions_generated.cc.

5701 {
5702 std::cout << "ReturnStruct8BytesPackedInt" << "(" << static_cast<int>(a0)
5703 << ", " << a1 << ", " << static_cast<int>(a2) << ", "
5704 << static_cast<int>(a3) << ", " << static_cast<int>(a4) << ")"
5705 << "\n";
5706
5708
5709 result.a0 = a0;
5710 result.a1 = a1;
5711 result.a2 = a2;
5712 result.a3 = a3;
5713 result.a4 = a4;
5714
5715 std::cout << "result = " << "(" << static_cast<int>(result.a0) << ", "
5716 << result.a1 << ", " << static_cast<int>(result.a2) << ", "
5717 << static_cast<int>(result.a3) << ", "
5718 << static_cast<int>(result.a4) << ")" << "\n";
5719
5720 return result;
5721}

◆ ReturnStruct9BytesHomogeneousUint8()

DART_EXPORT Struct9BytesHomogeneousUint8 dart::ReturnStruct9BytesHomogeneousUint8 ( uint8_t  a0,
uint8_t  a1,
uint8_t  a2,
uint8_t  a3,
uint8_t  a4,
uint8_t  a5,
uint8_t  a6,
uint8_t  a7,
uint8_t  a8 
)

Definition at line 4991 of file ffi_test_functions_generated.cc.

4999 {
5000 std::cout << "ReturnStruct9BytesHomogeneousUint8" << "("
5001 << static_cast<int>(a0) << ", " << static_cast<int>(a1) << ", "
5002 << static_cast<int>(a2) << ", " << static_cast<int>(a3) << ", "
5003 << static_cast<int>(a4) << ", " << static_cast<int>(a5) << ", "
5004 << static_cast<int>(a6) << ", " << static_cast<int>(a7) << ", "
5005 << static_cast<int>(a8) << ")" << "\n";
5006
5008
5009 result.a0 = a0;
5010 result.a1 = a1;
5011 result.a2 = a2;
5012 result.a3 = a3;
5013 result.a4 = a4;
5014 result.a5 = a5;
5015 result.a6 = a6;
5016 result.a7 = a7;
5017 result.a8 = a8;
5018
5019 std::cout << "result = " << "(" << static_cast<int>(result.a0) << ", "
5020 << static_cast<int>(result.a1) << ", "
5021 << static_cast<int>(result.a2) << ", "
5022 << static_cast<int>(result.a3) << ", "
5023 << static_cast<int>(result.a4) << ", "
5024 << static_cast<int>(result.a5) << ", "
5025 << static_cast<int>(result.a6) << ", "
5026 << static_cast<int>(result.a7) << ", "
5027 << static_cast<int>(result.a8) << ")" << "\n";
5028
5029 return result;
5030}

◆ ReturnStruct9BytesInt4Or8ByteAligned()

DART_EXPORT Struct9BytesInt4Or8ByteAligned dart::ReturnStruct9BytesInt4Or8ByteAligned ( int64_t  a0,
int8_t  a1 
)

Definition at line 5036 of file ffi_test_functions_generated.cc.

5036 {
5037 std::cout << "ReturnStruct9BytesInt4Or8ByteAligned" << "(" << a0 << ", "
5038 << static_cast<int>(a1) << ")" << "\n";
5039
5041
5042 result.a0 = a0;
5043 result.a1 = a1;
5044
5045 std::cout << "result = " << "(" << result.a0 << ", "
5046 << static_cast<int>(result.a1) << ")" << "\n";
5047
5048 return result;
5049}

◆ ReturnStruct9BytesPackedMixed()

DART_EXPORT Struct9BytesPackedMixed dart::ReturnStruct9BytesPackedMixed ( uint8_t  a0,
double  a1 
)

Definition at line 5726 of file ffi_test_functions_generated.cc.

5727 {
5728 std::cout << "ReturnStruct9BytesPackedMixed" << "(" << static_cast<int>(a0)
5729 << ", " << a1 << ")" << "\n";
5730
5732
5733 result.a0 = a0;
5734 result.a1 = a1;
5735
5736 std::cout << "result = " << "(" << static_cast<int>(result.a0) << ", "
5737 << result.a1 << ")" << "\n";
5738
5739 return result;
5740}

◆ ReturnStructAlignmentInt16()

DART_EXPORT StructAlignmentInt16 dart::ReturnStructAlignmentInt16 ( int8_t  a0,
int16_t  a1,
int8_t  a2 
)

Definition at line 5993 of file ffi_test_functions_generated.cc.

5995 {
5996 std::cout << "ReturnStructAlignmentInt16" << "(" << static_cast<int>(a0)
5997 << ", " << a1 << ", " << static_cast<int>(a2) << ")" << "\n";
5998
6000
6001 result.a0 = a0;
6002 result.a1 = a1;
6003 result.a2 = a2;
6004
6005 std::cout << "result = " << "(" << static_cast<int>(result.a0) << ", "
6006 << result.a1 << ", " << static_cast<int>(result.a2) << ")" << "\n";
6007
6008 return result;
6009}

◆ ReturnStructAlignmentInt32()

DART_EXPORT StructAlignmentInt32 dart::ReturnStructAlignmentInt32 ( int8_t  a0,
int32_t  a1,
int8_t  a2 
)

Definition at line 6013 of file ffi_test_functions_generated.cc.

6015 {
6016 std::cout << "ReturnStructAlignmentInt32" << "(" << static_cast<int>(a0)
6017 << ", " << a1 << ", " << static_cast<int>(a2) << ")" << "\n";
6018
6020
6021 result.a0 = a0;
6022 result.a1 = a1;
6023 result.a2 = a2;
6024
6025 std::cout << "result = " << "(" << static_cast<int>(result.a0) << ", "
6026 << result.a1 << ", " << static_cast<int>(result.a2) << ")" << "\n";
6027
6028 return result;
6029}

◆ ReturnStructAlignmentInt64()

DART_EXPORT StructAlignmentInt64 dart::ReturnStructAlignmentInt64 ( int8_t  a0,
int64_t  a1,
int8_t  a2 
)

Definition at line 6033 of file ffi_test_functions_generated.cc.

6035 {
6036 std::cout << "ReturnStructAlignmentInt64" << "(" << static_cast<int>(a0)
6037 << ", " << a1 << ", " << static_cast<int>(a2) << ")" << "\n";
6038
6040
6041 result.a0 = a0;
6042 result.a1 = a1;
6043 result.a2 = a2;
6044
6045 std::cout << "result = " << "(" << static_cast<int>(result.a0) << ", "
6046 << result.a1 << ", " << static_cast<int>(result.a2) << ")" << "\n";
6047
6048 return result;
6049}

◆ ReturnStructArgumentInt32x8Struct1ByteInt()

DART_EXPORT Struct1ByteInt dart::ReturnStructArgumentInt32x8Struct1ByteInt ( int32_t  a0,
int32_t  a1,
int32_t  a2,
int32_t  a3,
int32_t  a4,
int32_t  a5,
int32_t  a6,
int32_t  a7,
Struct1ByteInt  a8 
)

Definition at line 5828 of file ffi_test_functions_generated.cc.

5836 {
5837 std::cout << "ReturnStructArgumentInt32x8Struct1ByteInt" << "(" << a0 << ", "
5838 << a1 << ", " << a2 << ", " << a3 << ", " << a4 << ", " << a5
5839 << ", " << a6 << ", " << a7 << ", (" << static_cast<int>(a8.a0)
5840 << "))" << "\n";
5841
5843
5844 std::cout << "result = " << "(" << static_cast<int>(result.a0) << ")" << "\n";
5845
5846 return result;
5847}

◆ ReturnStructArgumentInt32x8Struct20BytesHomogeneou()

DART_EXPORT Struct20BytesHomogeneousInt32 dart::ReturnStructArgumentInt32x8Struct20BytesHomogeneou ( int32_t  a0,
int32_t  a1,
int32_t  a2,
int32_t  a3,
int32_t  a4,
int32_t  a5,
int32_t  a6,
int32_t  a7,
Struct20BytesHomogeneousInt32  a8 
)

Definition at line 5889 of file ffi_test_functions_generated.cc.

5898 {
5899 std::cout << "ReturnStructArgumentInt32x8Struct20BytesHomogeneou" << "(" << a0
5900 << ", " << a1 << ", " << a2 << ", " << a3 << ", " << a4 << ", "
5901 << a5 << ", " << a6 << ", " << a7 << ", (" << a8.a0 << ", " << a8.a1
5902 << ", " << a8.a2 << ", " << a8.a3 << ", " << a8.a4 << "))" << "\n";
5903
5905
5906 std::cout << "result = " << "(" << result.a0 << ", " << result.a1 << ", "
5907 << result.a2 << ", " << result.a3 << ", " << result.a4 << ")"
5908 << "\n";
5909
5910 return result;
5911}

◆ ReturnStructArgumentStruct1ByteInt()

DART_EXPORT Struct1ByteInt dart::ReturnStructArgumentStruct1ByteInt ( Struct1ByteInt  a0)

Definition at line 5812 of file ffi_test_functions_generated.cc.

5812 {
5813 std::cout << "ReturnStructArgumentStruct1ByteInt" << "(("
5814 << static_cast<int>(a0.a0) << "))" << "\n";
5815
5817
5818 std::cout << "result = " << "(" << static_cast<int>(result.a0) << ")" << "\n";
5819
5820 return result;
5821}

◆ ReturnStructArgumentStruct20BytesHomogeneousInt32()

DART_EXPORT Struct20BytesHomogeneousInt32 dart::ReturnStructArgumentStruct20BytesHomogeneousInt32 ( Struct20BytesHomogeneousInt32  a0)

Definition at line 5870 of file ffi_test_functions_generated.cc.

5871 {
5872 std::cout << "ReturnStructArgumentStruct20BytesHomogeneousInt32" << "(("
5873 << a0.a0 << ", " << a0.a1 << ", " << a0.a2 << ", " << a0.a3 << ", "
5874 << a0.a4 << "))" << "\n";
5875
5877
5878 std::cout << "result = " << "(" << result.a0 << ", " << result.a1 << ", "
5879 << result.a2 << ", " << result.a3 << ", " << result.a4 << ")"
5880 << "\n";
5881
5882 return result;
5883}

◆ ReturnStructArgumentStruct8BytesHomogeneousFloat()

DART_EXPORT Struct8BytesHomogeneousFloat dart::ReturnStructArgumentStruct8BytesHomogeneousFloat ( Struct8BytesHomogeneousFloat  a0)

Definition at line 5854 of file ffi_test_functions_generated.cc.

5855 {
5856 std::cout << "ReturnStructArgumentStruct8BytesHomogeneousFloat" << "(("
5857 << a0.a0 << ", " << a0.a1 << "))" << "\n";
5858
5860
5861 std::cout << "result = " << "(" << result.a0 << ", " << result.a1 << ")"
5862 << "\n";
5863
5864 return result;
5865}

◆ ReturnStructArgumentStruct8BytesInlineArrayInt()

DART_EXPORT Struct8BytesInlineArrayInt dart::ReturnStructArgumentStruct8BytesInlineArrayInt ( Struct8BytesInlineArrayInt  a0)

Definition at line 5916 of file ffi_test_functions_generated.cc.

5916 {
5917 std::cout << "ReturnStructArgumentStruct8BytesInlineArrayInt" << "((["
5918 << static_cast<int>(a0.a0[0]) << ", " << static_cast<int>(a0.a0[1])
5919 << ", " << static_cast<int>(a0.a0[2]) << ", "
5920 << static_cast<int>(a0.a0[3]) << ", " << static_cast<int>(a0.a0[4])
5921 << ", " << static_cast<int>(a0.a0[5]) << ", "
5922 << static_cast<int>(a0.a0[6]) << ", " << static_cast<int>(a0.a0[7])
5923 << "]))" << "\n";
5924
5926
5927 std::cout << "result = " << "([" << static_cast<int>(result.a0[0]) << ", "
5928 << static_cast<int>(result.a0[1]) << ", "
5929 << static_cast<int>(result.a0[2]) << ", "
5930 << static_cast<int>(result.a0[3]) << ", "
5931 << static_cast<int>(result.a0[4]) << ", "
5932 << static_cast<int>(result.a0[5]) << ", "
5933 << static_cast<int>(result.a0[6]) << ", "
5934 << static_cast<int>(result.a0[7]) << "])" << "\n";
5935
5936 return result;
5937}

◆ ReturnStructArgumentStructStruct16BytesHomogeneous()

DART_EXPORT StructStruct16BytesHomogeneousFloat2 dart::ReturnStructArgumentStructStruct16BytesHomogeneous ( StructStruct16BytesHomogeneousFloat2  a0)

Definition at line 5942 of file ffi_test_functions_generated.cc.

5943 {
5944 std::cout << "ReturnStructArgumentStructStruct16BytesHomogeneous" << "((("
5945 << a0.a0.a0 << "), [(" << a0.a1[0].a0 << "), (" << a0.a1[1].a0
5946 << ")], " << a0.a2 << "))" << "\n";
5947
5949
5950 std::cout << "result = " << "((" << result.a0.a0 << "), [(" << result.a1[0].a0
5951 << "), (" << result.a1[1].a0 << ")], " << result.a2 << ")" << "\n";
5952
5953 return result;
5954}

◆ ReturnStructArgumentStructStruct16BytesMixed3()

DART_EXPORT StructStruct16BytesMixed3 dart::ReturnStructArgumentStructStruct16BytesMixed3 ( StructStruct16BytesMixed3  a0)

Definition at line 5976 of file ffi_test_functions_generated.cc.

5976 {
5977 std::cout << "ReturnStructArgumentStructStruct16BytesMixed3" << "((("
5978 << a0.a0.a0 << "), [(" << a0.a1[0].a0 << ", " << a0.a1[0].a1 << ", "
5979 << a0.a1[0].a2 << ")], [" << a0.a2[0] << ", " << a0.a2[1] << "]))"
5980 << "\n";
5981
5983
5984 std::cout << "result = " << "((" << result.a0.a0 << "), [(" << result.a1[0].a0
5985 << ", " << result.a1[0].a1 << ", " << result.a1[0].a2 << ")], ["
5986 << result.a2[0] << ", " << result.a2[1] << "])" << "\n";
5987
5988 return result;
5989}

◆ ReturnStructArgumentStructStruct32BytesHomogeneous()

DART_EXPORT StructStruct32BytesHomogeneousDouble2 dart::ReturnStructArgumentStructStruct32BytesHomogeneous ( StructStruct32BytesHomogeneousDouble2  a0)

Definition at line 5959 of file ffi_test_functions_generated.cc.

5960 {
5961 std::cout << "ReturnStructArgumentStructStruct32BytesHomogeneous" << "((("
5962 << a0.a0.a0 << "), [(" << a0.a1[0].a0 << "), (" << a0.a1[1].a0
5963 << ")], " << a0.a2 << "))" << "\n";
5964
5966
5967 std::cout << "result = " << "((" << result.a0.a0 << "), [(" << result.a1[0].a0
5968 << "), (" << result.a1[1].a0 << ")], " << result.a2 << ")" << "\n";
5969
5970 return result;
5971}

◆ ReturnStructNestedIntStructAlignmentInt16()

DART_EXPORT StructNestedIntStructAlignmentInt16 dart::ReturnStructNestedIntStructAlignmentInt16 ( StructAlignmentInt16  a0,
StructAlignmentInt16  a1 
)

Definition at line 6207 of file ffi_test_functions_generated.cc.

6208 {
6209 std::cout << "ReturnStructNestedIntStructAlignmentInt16" << "(("
6210 << static_cast<int>(a0.a0) << ", " << a0.a1 << ", "
6211 << static_cast<int>(a0.a2) << "), (" << static_cast<int>(a1.a0)
6212 << ", " << a1.a1 << ", " << static_cast<int>(a1.a2) << "))" << "\n";
6213
6215
6216 result.a0.a0 = a0.a0;
6217 result.a0.a1 = a0.a1;
6218 result.a0.a2 = a0.a2;
6219 result.a1.a0 = a1.a0;
6220 result.a1.a1 = a1.a1;
6221 result.a1.a2 = a1.a2;
6222
6223 std::cout << "result = " << "((" << static_cast<int>(result.a0.a0) << ", "
6224 << result.a0.a1 << ", " << static_cast<int>(result.a0.a2) << "), ("
6225 << static_cast<int>(result.a1.a0) << ", " << result.a1.a1 << ", "
6226 << static_cast<int>(result.a1.a2) << "))" << "\n";
6227
6228 return result;
6229}

◆ ReturnStructNestedIntStructAlignmentInt32()

DART_EXPORT StructNestedIntStructAlignmentInt32 dart::ReturnStructNestedIntStructAlignmentInt32 ( StructAlignmentInt32  a0,
StructAlignmentInt32  a1 
)

Definition at line 6234 of file ffi_test_functions_generated.cc.

6235 {
6236 std::cout << "ReturnStructNestedIntStructAlignmentInt32" << "(("
6237 << static_cast<int>(a0.a0) << ", " << a0.a1 << ", "
6238 << static_cast<int>(a0.a2) << "), (" << static_cast<int>(a1.a0)
6239 << ", " << a1.a1 << ", " << static_cast<int>(a1.a2) << "))" << "\n";
6240
6242
6243 result.a0.a0 = a0.a0;
6244 result.a0.a1 = a0.a1;
6245 result.a0.a2 = a0.a2;
6246 result.a1.a0 = a1.a0;
6247 result.a1.a1 = a1.a1;
6248 result.a1.a2 = a1.a2;
6249
6250 std::cout << "result = " << "((" << static_cast<int>(result.a0.a0) << ", "
6251 << result.a0.a1 << ", " << static_cast<int>(result.a0.a2) << "), ("
6252 << static_cast<int>(result.a1.a0) << ", " << result.a1.a1 << ", "
6253 << static_cast<int>(result.a1.a2) << "))" << "\n";
6254
6255 return result;
6256}

◆ ReturnStructNestedIntStructAlignmentInt64()

DART_EXPORT StructNestedIntStructAlignmentInt64 dart::ReturnStructNestedIntStructAlignmentInt64 ( StructAlignmentInt64  a0,
StructAlignmentInt64  a1 
)

Definition at line 6261 of file ffi_test_functions_generated.cc.

6262 {
6263 std::cout << "ReturnStructNestedIntStructAlignmentInt64" << "(("
6264 << static_cast<int>(a0.a0) << ", " << a0.a1 << ", "
6265 << static_cast<int>(a0.a2) << "), (" << static_cast<int>(a1.a0)
6266 << ", " << a1.a1 << ", " << static_cast<int>(a1.a2) << "))" << "\n";
6267
6269
6270 result.a0.a0 = a0.a0;
6271 result.a0.a1 = a0.a1;
6272 result.a0.a2 = a0.a2;
6273 result.a1.a0 = a1.a0;
6274 result.a1.a1 = a1.a1;
6275 result.a1.a2 = a1.a2;
6276
6277 std::cout << "result = " << "((" << static_cast<int>(result.a0.a0) << ", "
6278 << result.a0.a1 << ", " << static_cast<int>(result.a0.a2) << "), ("
6279 << static_cast<int>(result.a1.a0) << ", " << result.a1.a1 << ", "
6280 << static_cast<int>(result.a1.a2) << "))" << "\n";
6281
6282 return result;
6283}

◆ ReturnStructNestedIrregularEvenBigger()

DART_EXPORT StructNestedIrregularEvenBigger dart::ReturnStructNestedIrregularEvenBigger ( uint64_t  a0,
StructNestedIrregularBigger  a1,
StructNestedIrregularBigger  a2,
double  a3 
)

Definition at line 6288 of file ffi_test_functions_generated.cc.

6291 {
6292 std::cout << "ReturnStructNestedIrregularEvenBigger" << "(" << a0 << ", (("
6293 << a1.a0.a0 << ", ((" << a1.a0.a1.a0.a0 << ", " << a1.a0.a1.a0.a1
6294 << "), (" << a1.a0.a1.a1.a0 << ")), " << a1.a0.a2 << ", (("
6295 << a1.a0.a3.a0.a0 << "), " << a1.a0.a3.a1 << "), " << a1.a0.a4
6296 << ", ((" << a1.a0.a5.a0.a0 << "), (" << a1.a0.a5.a1.a0 << ")), "
6297 << a1.a0.a6 << "), ((" << a1.a1.a0.a0 << ", " << a1.a1.a0.a1
6298 << "), (" << a1.a1.a1.a0 << ")), " << a1.a2 << ", " << a1.a3
6299 << "), ((" << a2.a0.a0 << ", ((" << a2.a0.a1.a0.a0 << ", "
6300 << a2.a0.a1.a0.a1 << "), (" << a2.a0.a1.a1.a0 << ")), " << a2.a0.a2
6301 << ", ((" << a2.a0.a3.a0.a0 << "), " << a2.a0.a3.a1 << "), "
6302 << a2.a0.a4 << ", ((" << a2.a0.a5.a0.a0 << "), (" << a2.a0.a5.a1.a0
6303 << ")), " << a2.a0.a6 << "), ((" << a2.a1.a0.a0 << ", "
6304 << a2.a1.a0.a1 << "), (" << a2.a1.a1.a0 << ")), " << a2.a2 << ", "
6305 << a2.a3 << "), " << a3 << ")" << "\n";
6306
6308
6309 result.a0 = a0;
6310 result.a1.a0.a0 = a1.a0.a0;
6311 result.a1.a0.a1.a0.a0 = a1.a0.a1.a0.a0;
6312 result.a1.a0.a1.a0.a1 = a1.a0.a1.a0.a1;
6313 result.a1.a0.a1.a1.a0 = a1.a0.a1.a1.a0;
6314 result.a1.a0.a2 = a1.a0.a2;
6315 result.a1.a0.a3.a0.a0 = a1.a0.a3.a0.a0;
6316 result.a1.a0.a3.a1 = a1.a0.a3.a1;
6317 result.a1.a0.a4 = a1.a0.a4;
6318 result.a1.a0.a5.a0.a0 = a1.a0.a5.a0.a0;
6319 result.a1.a0.a5.a1.a0 = a1.a0.a5.a1.a0;
6320 result.a1.a0.a6 = a1.a0.a6;
6321 result.a1.a1.a0.a0 = a1.a1.a0.a0;
6322 result.a1.a1.a0.a1 = a1.a1.a0.a1;
6323 result.a1.a1.a1.a0 = a1.a1.a1.a0;
6324 result.a1.a2 = a1.a2;
6325 result.a1.a3 = a1.a3;
6326 result.a2.a0.a0 = a2.a0.a0;
6327 result.a2.a0.a1.a0.a0 = a2.a0.a1.a0.a0;
6328 result.a2.a0.a1.a0.a1 = a2.a0.a1.a0.a1;
6329 result.a2.a0.a1.a1.a0 = a2.a0.a1.a1.a0;
6330 result.a2.a0.a2 = a2.a0.a2;
6331 result.a2.a0.a3.a0.a0 = a2.a0.a3.a0.a0;
6332 result.a2.a0.a3.a1 = a2.a0.a3.a1;
6333 result.a2.a0.a4 = a2.a0.a4;
6334 result.a2.a0.a5.a0.a0 = a2.a0.a5.a0.a0;
6335 result.a2.a0.a5.a1.a0 = a2.a0.a5.a1.a0;
6336 result.a2.a0.a6 = a2.a0.a6;
6337 result.a2.a1.a0.a0 = a2.a1.a0.a0;
6338 result.a2.a1.a0.a1 = a2.a1.a0.a1;
6339 result.a2.a1.a1.a0 = a2.a1.a1.a0;
6340 result.a2.a2 = a2.a2;
6341 result.a2.a3 = a2.a3;
6342 result.a3 = a3;
6343
6344 std::cout << "result = " << "(" << result.a0 << ", ((" << result.a1.a0.a0
6345 << ", ((" << result.a1.a0.a1.a0.a0 << ", " << result.a1.a0.a1.a0.a1
6346 << "), (" << result.a1.a0.a1.a1.a0 << ")), " << result.a1.a0.a2
6347 << ", ((" << result.a1.a0.a3.a0.a0 << "), " << result.a1.a0.a3.a1
6348 << "), " << result.a1.a0.a4 << ", ((" << result.a1.a0.a5.a0.a0
6349 << "), (" << result.a1.a0.a5.a1.a0 << ")), " << result.a1.a0.a6
6350 << "), ((" << result.a1.a1.a0.a0 << ", " << result.a1.a1.a0.a1
6351 << "), (" << result.a1.a1.a1.a0 << ")), " << result.a1.a2 << ", "
6352 << result.a1.a3 << "), ((" << result.a2.a0.a0 << ", (("
6353 << result.a2.a0.a1.a0.a0 << ", " << result.a2.a0.a1.a0.a1 << "), ("
6354 << result.a2.a0.a1.a1.a0 << ")), " << result.a2.a0.a2 << ", (("
6355 << result.a2.a0.a3.a0.a0 << "), " << result.a2.a0.a3.a1 << "), "
6356 << result.a2.a0.a4 << ", ((" << result.a2.a0.a5.a0.a0 << "), ("
6357 << result.a2.a0.a5.a1.a0 << ")), " << result.a2.a0.a6 << "), (("
6358 << result.a2.a1.a0.a0 << ", " << result.a2.a1.a0.a1 << "), ("
6359 << result.a2.a1.a1.a0 << ")), " << result.a2.a2 << ", "
6360 << result.a2.a3 << "), " << result.a3 << ")" << "\n";
6361
6362 return result;
6363}

◆ ReturnUnion16BytesNestedFloat()

DART_EXPORT Union16BytesNestedFloat dart::ReturnUnion16BytesNestedFloat ( Struct8BytesHomogeneousFloat  a0)

Definition at line 5792 of file ffi_test_functions_generated.cc.

5792 {
5793 std::cout << "ReturnUnion16BytesNestedFloat" << "((" << a0.a0 << ", " << a0.a1
5794 << "))" << "\n";
5795
5797
5798 result.a0.a0 = a0.a0;
5799 result.a0.a1 = a0.a1;
5800
5801 std::cout << "result = " << "((" << result.a0.a0 << ", " << result.a0.a1
5802 << "))" << "\n";
5803
5804 return result;
5805}

◆ ReturnUnion4BytesMixed()

DART_EXPORT Union4BytesMixed dart::ReturnUnion4BytesMixed ( uint32_t  a0)

Definition at line 5744 of file ffi_test_functions_generated.cc.

5744 {
5745 std::cout << "ReturnUnion4BytesMixed" << "(" << a0 << ")" << "\n";
5746
5748
5749 result.a0 = a0;
5750
5751 std::cout << "result = " << "(" << result.a0 << ")" << "\n";
5752
5753 return result;
5754}

◆ ReturnUnion8BytesNestedFloat()

DART_EXPORT Union8BytesNestedFloat dart::ReturnUnion8BytesNestedFloat ( double  a0)

Definition at line 5758 of file ffi_test_functions_generated.cc.

5758 {
5759 std::cout << "ReturnUnion8BytesNestedFloat" << "(" << a0 << ")" << "\n";
5760
5762
5763 result.a0 = a0;
5764
5765 std::cout << "result = " << "(" << result.a0 << ")" << "\n";
5766
5767 return result;
5768}

◆ ReturnUnion9BytesNestedInt()

DART_EXPORT Union9BytesNestedInt dart::ReturnUnion9BytesNestedInt ( Struct8BytesInt  a0)

Definition at line 5773 of file ffi_test_functions_generated.cc.

5773 {
5774 std::cout << "ReturnUnion9BytesNestedInt" << "((" << a0.a0 << ", " << a0.a1
5775 << ", " << a0.a2 << "))" << "\n";
5776
5778
5779 result.a0.a0 = a0.a0;
5780 result.a0.a1 = a0.a1;
5781 result.a0.a2 = a0.a2;
5782
5783 std::cout << "result = " << "((" << result.a0.a0 << ", " << result.a0.a1
5784 << ", " << result.a0.a2 << "))" << "\n";
5785
5786 return result;
5787}

◆ RotateRight()

static uint64_t dart::RotateRight ( uint64_t  value,
uint8_t  rotate,
uint8_t  width 
)
inlinestatic

Definition at line 1271 of file constants_arm64.h.

1273 {
1274 ASSERT(width <= 64);
1275 uint8_t right = rotate & 63;
1276 uint8_t left = (width - rotate) & 63;
1277 return ((value & ((1ULL << right) - 1ULL)) << left) | (value >> right);
1278}
static bool rotate(const SkDCubic &cubic, int zero, int index, SkDCubic &rotPath)

◆ RoundWordsToGB()

constexpr intptr_t dart::RoundWordsToGB ( intptr_t  size_in_words)
constexpr

Definition at line 548 of file globals.h.

548 {
549 return (size_in_words + (GBInWords >> 1)) >> GBInWordsLog2;
550}
constexpr intptr_t GBInWordsLog2
Definition globals.h:538

◆ RoundWordsToKB()

constexpr intptr_t dart::RoundWordsToKB ( intptr_t  size_in_words)
constexpr

Definition at line 542 of file globals.h.

542 {
543 return (size_in_words + (KBInWords >> 1)) >> KBInWordsLog2;
544}
constexpr intptr_t KBInWordsLog2
Definition globals.h:534

◆ RoundWordsToMB()

constexpr intptr_t dart::RoundWordsToMB ( intptr_t  size_in_words)
constexpr

Definition at line 545 of file globals.h.

545 {
546 return (size_in_words + (MBInWords >> 1)) >> MBInWordsLog2;
547}
constexpr intptr_t MBInWordsLog2
Definition globals.h:536

◆ RunBigRandomMultithreadedTest()

static void dart::RunBigRandomMultithreadedTest ( uint64_t  seed)
static

Definition at line 498 of file ffi_callback_metadata_test.cc.

501 {
502 static constexpr int kIterations = 1000;
503
504 TestIsolateScope isolate_scope;
505 Thread* thread = Thread::Current();
506 Isolate* isolate = thread->isolate();
507 ASSERT(isolate == isolate_scope.isolate());
508 TransitionNativeToVM transition(thread);
509 StackZone stack_zone(thread);
510 HandleScope handle_scope(thread);
511
512 struct TrampolineWithPort {
514 Dart_Port port;
515 };
516
517 auto* fcm = FfiCallbackMetadata::Instance();
518 Random random(seed);
519 std::vector<TrampolineWithPort> tramps;
520 std::unordered_set<FfiCallbackMetadata::Trampoline> tramp_set;
521 FfiCallbackMetadata::Metadata* list_head = nullptr;
522
523 const Function& async_func =
524 Function::Handle(CreateTestFunction(FfiCallbackKind::kAsyncCallback));
525 const Code& async_code = Code::Handle(async_func.EnsureHasCode());
526 EXPECT(!async_code.IsNull());
527 const Function& sync_func = Function::Handle(
528 CreateTestFunction(FfiCallbackKind::kIsolateLocalStaticCallback));
529 const auto& sync_code = Code::Handle(sync_func.EnsureHasCode());
530 EXPECT(!sync_code.IsNull());
531
532 for (int itr = 0; itr < kIterations; ++itr) {
533 // Do a random action:
534 // - Allocate a sync callback
535 // - Allocate an async callback
536 // - Delete a callback
537 // - Delete all the sync callbacks for an isolate
538
539 if ((random.NextUInt32() % 100) == 0) {
540 // 1% chance of deleting all the callbacks on the thread.
541 fcm->DeleteAllCallbacks(&list_head);
542
543 // It would be nice to verify that all the trampolines have been deleted,
544 // but this is flaky because other threads can recycle these trampolines
545 // before we finish checking all of them.
546 tramps.clear();
547 tramp_set.clear();
548 EXPECT_EQ(list_head, nullptr);
549 } else if (tramps.size() > 0 && (random.NextUInt32() % 4) == 0) {
550 // 25% chance of deleting a callback.
551 uint32_t r = random.NextUInt32() % tramps.size();
552 auto tramp = tramps[r].tramp;
553 fcm->DeleteCallback(tramp, &list_head);
554 tramps[r] = tramps[tramps.size() - 1];
555 tramps.pop_back();
556 tramp_set.erase(tramp);
557 } else {
558 TrampolineWithPort tramp;
559 if ((random.NextUInt32() % 2) == 0) {
560 // 50% chance of creating a sync callback.
561 tramp.port = ILLEGAL_PORT;
562 tramp.tramp = fcm->CreateIsolateLocalFfiCallback(
563 isolate, thread->zone(), sync_func,
564 Closure::Handle(Closure::null()), &list_head);
565 } else {
566 // 50% chance of creating an async callback.
567 tramp.port = PortMap::CreatePort(new FakeMessageHandler());
568 tramp.tramp = fcm->CreateAsyncFfiCallback(
569 isolate, thread->zone(), async_func, tramp.port, &list_head);
570 }
571 tramps.push_back(tramp);
572 tramp_set.insert(tramp.tramp);
573 }
574
575 // Verify all the callbacks.
576 for (const auto& tramp : tramps) {
577 auto metadata = fcm->LookupMetadataForTrampoline(tramp.tramp);
578 EXPECT(metadata.IsLive());
579 EXPECT_EQ(metadata.target_isolate(), isolate);
580 if (metadata.trampoline_type() ==
581 FfiCallbackMetadata::TrampolineType::kSync) {
582 EXPECT_EQ(metadata.closure_handle(), nullptr);
583 EXPECT_EQ(metadata.target_entry_point(), sync_code.EntryPoint());
584 } else {
585 EXPECT_EQ(metadata.send_port(), tramp.port);
586 EXPECT_EQ(metadata.target_entry_point(), async_code.EntryPoint());
587 }
588 }
589
590 // Verify the isolate's list of callbacks.
591 uword list_length = 0;
592 for (FfiCallbackMetadata::Metadata* m = list_head; m != nullptr;) {
593 ++list_length;
594 auto tramp = fcm->TrampolineOfMetadata(m);
595 EXPECT(m->IsLive());
596 EXPECT_EQ(m->target_isolate(), isolate);
597 EXPECT_EQ(tramp_set.count(tramp), 1u);
598 m = m->list_next();
599 }
600 EXPECT_EQ(list_length, tramps.size());
601 EXPECT_EQ(list_length, tramp_set.size());
602 }
603
604 // Delete all remaining callbacks.
Isolate * isolate() const
Definition unit_test.h:478

◆ RunFinalizer()

static void dart::RunFinalizer ( void *  isolate_callback_data,
void *  peer 
)
static

Definition at line 948 of file ffi_test_functions_vmspecific.cc.

948 {
949 printf("Running finalizer for weak handle.\n");
950}

◆ RunInitializingStoresTest()

static void dart::RunInitializingStoresTest ( const Library root_library,
const char *  function_name,
CompilerPass::PipelineMode  mode,
const std::vector< const char * > &  expected_stores 
)
static

Definition at line 112 of file il_test.cc.

116 {
117 const auto& function =
118 Function::Handle(GetFunction(root_library, function_name));
119 TestPipeline pipeline(function, mode);
120 FlowGraph* flow_graph = pipeline.RunPasses({
121 CompilerPass::kComputeSSA,
122 CompilerPass::kTypePropagation,
123 CompilerPass::kApplyICData,
124 CompilerPass::kInlining,
125 CompilerPass::kTypePropagation,
126 CompilerPass::kSelectRepresentations,
127 CompilerPass::kCanonicalize,
128 CompilerPass::kConstantPropagation,
129 });
130 ASSERT(flow_graph != nullptr);
131 ExpectStores(flow_graph, expected_stores);
132}

◆ RunLockerWithLongJumpTest()

template<typename LockType , typename LockerType >
static void dart::RunLockerWithLongJumpTest ( )
static

Definition at line 1030 of file thread_test.cc.

1030 {
1031 const intptr_t kNumIterations = 5;
1032 volatile intptr_t execution_count = 0;
1033 volatile intptr_t thrown_count = 0;
1034 LockType lock;
1035 for (intptr_t i = 0; i < kNumIterations; ++i) {
1036 LongJumpScope jump;
1037 if (setjmp(*jump.Set()) == 0) {
1038 LockerType locker(Thread::Current(), &lock);
1039 execution_count++;
1040 Thread::Current()->long_jump_base()->Jump(
1041 1, Object::background_compilation_error());
1042 } else {
1043 ASSERT(Thread::Current()->StealStickyError() ==
1044 Object::background_compilation_error().ptr());
1045 thrown_count++;
1046 }
1047 }
1048 EXPECT_EQ(kNumIterations, execution_count);
1049 EXPECT_EQ(kNumIterations, thrown_count);
1050}

◆ RunLoopDone()

static void dart::RunLoopDone ( uword  param)
static

Definition at line 1988 of file dart_api_impl.cc.

1988 {
1989 RunLoopData* data = reinterpret_cast<RunLoopData*>(param);
1990 ASSERT(data->monitor != nullptr);
1991 MonitorLocker ml(data->monitor);
1992 data->done = true;
1993 ml.Notify();
1994}

◆ RunLoopTest()

static void dart::RunLoopTest ( bool  throw_exception)
static

Definition at line 8469 of file dart_api_impl_test.cc.

8483 {
8484 Dart_IsolateGroupCreateCallback saved = Isolate::CreateGroupCallback();
8485 Isolate::SetCreateGroupCallback(RunLoopTestCallback);
8486 Dart_Isolate isolate = RunLoopTestCallback(nullptr, nullptr, nullptr, nullptr,
8487 nullptr, nullptr, nullptr);
8488
8489 Dart_EnterIsolate(isolate);
8491 Dart_Handle lib = Dart_LookupLibrary(NewString(TestCase::url()));
8492 EXPECT_VALID(lib);
8493
8495 Dart_Handle args[1];
8496 args[0] = (throw_exception ? Dart_True() : Dart_False());
Dart_Isolate(* Dart_IsolateGroupCreateCallback)(const char *script_uri, const char *main, const char *package_root, const char *package_config, Dart_IsolateFlags *flags, void *isolate_data, char **error)
Definition dart_api.h:653
DART_EXPORT Dart_Handle Dart_True(void)
static Dart_Isolate RunLoopTestCallback(const char *script_name, const char *main, const char *package_root, const char *package_config, Dart_IsolateFlags *flags, void *data, char **error)

◆ RunLoopTestCallback()

static Dart_Isolate dart::RunLoopTestCallback ( const char *  script_name,
const char *  main,
const char *  package_root,
const char *  package_config,
Dart_IsolateFlags flags,
void *  data,
char **  error 
)
static

Definition at line 8428 of file dart_api_impl_test.cc.

8434 : 123\n", Dart_GetError(result));
8435
8436 Dart_ExitScope();
8437
8438 // Delete the native ports.
8439 EXPECT(Dart_CloseNativePort(port_id1));
8440}
8441
8442static Dart_Isolate RunLoopTestCallback(const char* script_name,
8443 const char* main,
8444 const char* package_root,
8445 const char* package_config,
8446 Dart_IsolateFlags* flags,
8447 void* data,
8448 char** error) {
8449 const char* kScriptChars =
8450 "import 'dart:isolate';\n"
8451 "void main(shouldThrowException) {\n"
8452 " var rp = new RawReceivePort();\n"
8453 " rp.handler = (msg) {\n"
8454 " rp.close();\n"
8455 " if (shouldThrowException) {\n"
8456 " throw new Exception('ExceptionFromTimer');\n"
8457 " }\n"
8458 " };\n"
8459 " rp.sendPort.send(1);\n"
8460 "}\n";
8461
8462 if (Dart_CurrentIsolate() != nullptr) {
8463 Dart_ExitIsolate();
8464 }
8465 Dart_Isolate isolate = TestCase::CreateTestIsolate(script_name);
8466 ASSERT(isolate != nullptr);

◆ RunMemoryCopyInstrTest()

static void dart::RunMemoryCopyInstrTest ( intptr_t  src_start,
intptr_t  dest_start,
intptr_t  length,
intptr_t  elem_size,
bool  unboxed_inputs,
bool  use_same_buffer 
)
static

Definition at line 133 of file memory_copy_test.cc.

138 {
139 OS::Print("==================================================\n");
140 OS::Print("RunMemoryCopyInstrTest src_start %" Pd " dest_start %" Pd
141 " length "
142 "%" Pd "%s elem_size %" Pd "\n",
143 src_start, dest_start, length, unboxed_inputs ? " (unboxed)" : "",
144 elem_size);
145 OS::Print("==================================================\n");
147
148 uint8_t* ptr = reinterpret_cast<uint8_t*>(malloc(kMemoryTestLength));
149 uint8_t* ptr2 = use_same_buffer
150 ? ptr
151 : reinterpret_cast<uint8_t*>(malloc(kMemoryTestLength));
152 InitializeMemory(ptr, ptr2);
153
154 OS::Print("&ptr %p &ptr2 %p\n", ptr, ptr2);
155
156 // clang-format off
157 auto kScript = Utils::CStringUniquePtr(OS::SCreate(nullptr, R"(
158 import 'dart:ffi';
159
160 void copyConst() {
161 final pointer = Pointer<Uint8>.fromAddress(%s%p);
162 final pointer2 = Pointer<Uint8>.fromAddress(%s%p);
163 noop();
164 }
165
166 void callNonConstCopy() {
167 final pointer = Pointer<Uint8>.fromAddress(%s%p);
168 final pointer2 = Pointer<Uint8>.fromAddress(%s%p);
169 final src_start = %)" Pd R"(;
170 final dest_start = %)" Pd R"(;
171 final length = %)" Pd R"(;
172 copyNonConst(
173 pointer, pointer2, src_start, dest_start, length);
174 }
175
176 void noop() {}
177
178 void copyNonConst(Pointer<Uint8> ptr1,
179 Pointer<Uint8> ptr2,
180 int src_start,
181 int dest_start,
182 int length) {}
183 )", pointer_prefix, ptr, pointer_prefix, ptr2,
184 pointer_prefix, ptr, pointer_prefix, ptr2,
185 src_start, dest_start, length), std::free);
186 // clang-format on
187
188 const auto& root_library = Library::Handle(LoadTestScript(kScript.get()));
189
190 // Test the MemoryCopy instruction when the inputs are constants.
191 {
192 Invoke(root_library, "copyConst");
193 // Running this should be a no-op on the memory.
194 CHECK_DEFAULT_MEMORY(ptr, ptr2);
195
196 const auto& const_copy =
197 Function::Handle(GetFunction(root_library, "copyConst"));
198
199 TestPipeline pipeline(const_copy, CompilerPass::kJIT);
200 FlowGraph* flow_graph = pipeline.RunPasses({
201 CompilerPass::kComputeSSA,
202 });
203
204 StaticCallInstr* pointer = nullptr;
205 StaticCallInstr* pointer2 = nullptr;
206 StaticCallInstr* another_function_call = nullptr;
207 {
208 ILMatcher cursor(flow_graph, flow_graph->graph_entry()->normal_entry());
209
210 EXPECT(cursor.TryMatch({
211 kMoveGlob,
212 {kMatchAndMoveStaticCall, &pointer},
213 {kMatchAndMoveStaticCall, &pointer2},
214 {kMatchAndMoveStaticCall, &another_function_call},
215 }));
216 }
217
218 Zone* const zone = Thread::Current()->zone();
219 auto const rep = unboxed_inputs ? kUnboxedIntPtr : kTagged;
220
221 auto* const src_start_constant_instr = flow_graph->GetConstant(
222 Integer::ZoneHandle(zone, Integer::New(src_start, Heap::kOld)), rep);
223
224 auto* const dest_start_constant_instr = flow_graph->GetConstant(
225 Integer::ZoneHandle(zone, Integer::New(dest_start, Heap::kOld)), rep);
226
227 auto* const length_constant_instr = flow_graph->GetConstant(
228 Integer::ZoneHandle(zone, Integer::New(length, Heap::kOld)), rep);
229
230 auto* const memory_copy_instr = new (zone) MemoryCopyInstr(
231 new (zone) Value(pointer), /*src_cid=*/cid, new (zone) Value(pointer2),
232 /*dest_cid=*/cid, new (zone) Value(src_start_constant_instr),
233 new (zone) Value(dest_start_constant_instr),
234 new (zone) Value(length_constant_instr), unboxed_inputs,
235 /*can_overlap=*/use_same_buffer);
236 flow_graph->InsertBefore(another_function_call, memory_copy_instr, nullptr,
237 FlowGraph::kEffect);
238
239 another_function_call->RemoveFromGraph();
240
241 {
242 // Check we constructed the right graph.
243 ILMatcher cursor(flow_graph, flow_graph->graph_entry()->normal_entry());
244 EXPECT(cursor.TryMatch({
245 kMoveGlob,
246 kMatchAndMoveStaticCall,
247 kMatchAndMoveStaticCall,
248 kMatchAndMoveMemoryCopy,
249 }));
250 }
251
252 {
253#if !defined(PRODUCT) && !defined(USING_THREAD_SANITIZER)
254 SetFlagScope<bool> sfs(&FLAG_disassemble_optimized, true);
255#endif
256
257 pipeline.RunForcedOptimizedAfterSSAPasses();
258 pipeline.CompileGraphAndAttachFunction();
259 }
260
261 {
262 // Check that the memory copy has constant inputs after optimization.
263 ILMatcher cursor(flow_graph, flow_graph->graph_entry()->normal_entry());
264 MemoryCopyInstr* memory_copy;
265 EXPECT(cursor.TryMatch({
266 kMoveGlob,
267 {kMatchAndMoveMemoryCopy, &memory_copy},
268 }));
269 EXPECT_EQ(kUntagged, memory_copy->src()->definition()->representation());
270 EXPECT_EQ(kUntagged, memory_copy->dest()->definition()->representation());
271 EXPECT(memory_copy->src_start()->BindsToConstant());
272 EXPECT(memory_copy->dest_start()->BindsToConstant());
273 EXPECT(memory_copy->length()->BindsToConstant());
274 }
275
276 // Run the mem copy.
277 Invoke(root_library, "copyConst");
278 }
279
280 CHECK_MEMORY(ptr, ptr2, dest_start, src_start, length, elem_size);
281 // Reinitialize the memory for the non-constant MemoryCopy version.
282 InitializeMemory(ptr, ptr2);
283
284 // Test the MemoryCopy instruction when the inputs are not constants.
285 {
286 Invoke(root_library, "callNonConstCopy");
287 // Running this should be a no-op on the memory.
288 CHECK_DEFAULT_MEMORY(ptr, ptr2);
289
290 const auto& copy_non_const =
291 Function::Handle(GetFunction(root_library, "copyNonConst"));
292
293 TestPipeline pipeline(copy_non_const, CompilerPass::kJIT);
294 FlowGraph* flow_graph = pipeline.RunPasses({
295 CompilerPass::kComputeSSA,
296 });
297
298 auto* const entry_instr = flow_graph->graph_entry()->normal_entry();
299 auto* const initial_defs = entry_instr->initial_definitions();
300 EXPECT(initial_defs != nullptr);
301 EXPECT_EQ(5, initial_defs->length());
302
303 auto* const param_ptr = initial_defs->At(0)->AsParameter();
304 EXPECT(param_ptr != nullptr);
305 auto* const param_ptr2 = initial_defs->At(1)->AsParameter();
306 EXPECT(param_ptr2 != nullptr);
307 auto* const param_src_start = initial_defs->At(2)->AsParameter();
308 EXPECT(param_src_start != nullptr);
309 auto* const param_dest_start = initial_defs->At(3)->AsParameter();
310 EXPECT(param_dest_start != nullptr);
311 auto* const param_length = initial_defs->At(4)->AsParameter();
312 EXPECT(param_length != nullptr);
313
314 DartReturnInstr* return_instr;
315 {
316 ILMatcher cursor(flow_graph, entry_instr);
317
318 EXPECT(cursor.TryMatch({
319 kMoveGlob,
320 {kMatchDartReturn, &return_instr},
321 }));
322 }
323
324 Zone* const zone = Thread::Current()->zone();
325
326 Definition* src_start_def = param_src_start;
327 Definition* dest_start_def = param_dest_start;
328 Definition* length_def = param_length;
329 if (unboxed_inputs) {
330 // Manually add the unbox instruction ourselves instead of leaving it
331 // up to the SelectDefinitions pass.
332 length_def =
333 UnboxInstr::Create(kUnboxedWord, new (zone) Value(param_length),
334 DeoptId::kNone, Instruction::kNotSpeculative);
335 flow_graph->InsertBefore(return_instr, length_def, nullptr,
336 FlowGraph::kValue);
337 dest_start_def =
338 UnboxInstr::Create(kUnboxedWord, new (zone) Value(param_dest_start),
339 DeoptId::kNone, Instruction::kNotSpeculative);
340 flow_graph->InsertBefore(length_def, dest_start_def, nullptr,
341 FlowGraph::kValue);
342 src_start_def =
343 UnboxInstr::Create(kUnboxedWord, new (zone) Value(param_src_start),
344 DeoptId::kNone, Instruction::kNotSpeculative);
345 flow_graph->InsertBefore(dest_start_def, src_start_def, nullptr,
346 FlowGraph::kValue);
347 }
348
349 auto* const memory_copy_instr = new (zone) MemoryCopyInstr(
350 new (zone) Value(param_ptr), /*src_cid=*/cid,
351 new (zone) Value(param_ptr2), /*dest_cid=*/cid,
352 new (zone) Value(src_start_def), new (zone) Value(dest_start_def),
353 new (zone) Value(length_def),
354
355 unboxed_inputs, /*can_overlap=*/use_same_buffer);
356 flow_graph->InsertBefore(return_instr, memory_copy_instr, nullptr,
357 FlowGraph::kEffect);
358
359 {
360 // Check we constructed the right graph.
361 ILMatcher cursor(flow_graph, flow_graph->graph_entry()->normal_entry());
362 if (unboxed_inputs) {
363 EXPECT(cursor.TryMatch({
364 kMoveGlob,
365 kMatchAndMoveUnbox,
366 kMatchAndMoveUnbox,
367 kMatchAndMoveUnbox,
368 kMatchAndMoveMemoryCopy,
369 kMatchDartReturn,
370 }));
371 } else {
372 EXPECT(cursor.TryMatch({
373 kMoveGlob,
374 kMatchAndMoveMemoryCopy,
375 kMatchDartReturn,
376 }));
377 }
378 }
379
380 {
381#if !defined(PRODUCT) && !defined(USING_THREAD_SANITIZER)
382 SetFlagScope<bool> sfs(&FLAG_disassemble_optimized, true);
383#endif
384
385 pipeline.RunForcedOptimizedAfterSSAPasses();
386 pipeline.CompileGraphAndAttachFunction();
387 }
388
389 {
390 // Check that the memory copy has non-constant inputs after optimization.
391 ILMatcher cursor(flow_graph, flow_graph->graph_entry()->normal_entry());
392 MemoryCopyInstr* memory_copy;
393 EXPECT(cursor.TryMatch({
394 kMoveGlob,
395 {kMatchAndMoveMemoryCopy, &memory_copy},
396 }));
397 EXPECT_EQ(kUntagged, memory_copy->src()->definition()->representation());
398 EXPECT_EQ(kUntagged, memory_copy->dest()->definition()->representation());
399 EXPECT(!memory_copy->src_start()->BindsToConstant());
400 EXPECT(!memory_copy->dest_start()->BindsToConstant());
401 EXPECT(!memory_copy->length()->BindsToConstant());
402 }
403
404 // Run the mem copy.
405 Invoke(root_library, "callNonConstCopy");
406 }
407
408 CHECK_MEMORY(ptr, ptr2, dest_start, src_start, length, elem_size);
409 free(ptr);
410 if (!use_same_buffer) {
411 free(ptr2);
412 }
413}
#define CHECK_DEFAULT_MEMORY(in, out)
#define CHECK_MEMORY(in, out, start, skip, len, size)
static void InitializeMemory(uint8_t *input, uint8_t *output)
static classid_t TypedDataCidForElementSize(intptr_t elem_size)

◆ RunNativeFinalizerCallback()

template<typename GCVisitorType >
void dart::RunNativeFinalizerCallback ( NativeFinalizerPtr  raw_finalizer,
FinalizerEntryPtr  raw_entry,
Heap::Space  before_gc_space,
GCVisitorType *  visitor 
)

Definition at line 107 of file gc_shared.h.

110 {
111 PointerPtr callback_pointer = raw_finalizer->untag()->callback();
112 const auto callback = reinterpret_cast<NativeFinalizer::Callback>(
113 callback_pointer->untag()->data());
114 ObjectPtr token_object = raw_entry->untag()->token();
115 const bool is_detached = token_object == raw_entry;
116 const intptr_t external_size = raw_entry->untag()->external_size();
117 if (is_detached) {
118 // Detached from Dart code.
119 ASSERT(token_object == raw_entry);
120 ASSERT(external_size == 0);
121 if (FLAG_trace_finalizers) {
122 TRACE_FINALIZER("Not running native finalizer %p callback %p, detached",
123 raw_finalizer->untag(), callback);
124 }
125 } else {
126 // TODO(http://dartbug.com/48615): Unbox pointer address in entry.
127 ASSERT(token_object.IsPointer());
128 PointerPtr token = static_cast<PointerPtr>(token_object);
129 void* peer = reinterpret_cast<void*>(token->untag()->data());
130 if (FLAG_trace_finalizers) {
131 TRACE_FINALIZER("Running native finalizer %p callback %p with token %p",
132 raw_finalizer->untag(), callback, peer);
133 }
134 raw_entry.untag()->set_token(raw_entry);
135 (*callback)(peer);
136 if (external_size > 0) {
137 if (FLAG_trace_finalizers) {
138 TRACE_FINALIZER("Clearing external size %" Pd " bytes in %s space",
139 external_size, before_gc_space == 0 ? "new" : "old");
140 }
141 visitor->isolate_group()->heap()->FreedExternal(external_size,
142 before_gc_space);
143 raw_entry->untag()->set_external_size(0);
144 }
145 }
146}

◆ RunTestCase()

void dart::RunTestCase ( const TestCaseMoves mapping,
intptr_t  count 
)

Definition at line 67 of file catch_entry_moves_test.cc.

67 {
68 std::unique_ptr<intptr_t[]> permutation(new intptr_t[count]);
69 for (intptr_t i = 0; i < count; ++i) {
70 permutation[i] = i;
71 }
72
73 std::function<void(intptr_t)> run_all_permutations = [&](intptr_t offset) {
74 if (offset == count) {
75 RunTestCaseWithPermutations(mapping, &permutation[0], count);
76 } else {
77 for (intptr_t i = offset; i < count; ++i) {
78 const intptr_t start = permutation[offset];
79 const intptr_t replacement = permutation[i];
80
81 permutation[offset] = replacement;
82 permutation[i] = start;
83
84 run_all_permutations(offset + 1);
85
86 permutation[offset] = start;
87 permutation[i] = replacement;
88 }
89 }
90 };
91
92 run_all_permutations(0);
93}

◆ RunTestCaseWithPermutations()

void dart::RunTestCaseWithPermutations ( const TestCaseMoves mapping,
intptr_t *  insert_permutation,
intptr_t  count 
)

Definition at line 39 of file catch_entry_moves_test.cc.

41 {
43
44 for (intptr_t i = 0; i < count; ++i) {
45 auto expected_moves = mapping[insert_permutation[i]];
46 b.NewMapping(/*pc_offset=*/insert_permutation[i]);
47 for (intptr_t j = 0; j < expected_moves.count; ++j) {
48 b.Append(expected_moves.moves[j]);
49 }
50 b.EndMapping();
51 }
52
53 const auto& bytes = TypedData::Handle(b.FinalizeCatchEntryMovesMap());
54 CatchEntryMovesMapReader reader(bytes);
55
56 for (intptr_t i = 0; i < count; ++i) {
57 auto expected_moves = mapping[i];
58 auto read_moves = reader.ReadMovesForPcOffset(i);
59 EXPECT_EQ(expected_moves.count, read_moves->count());
60 for (intptr_t j = 0; j < expected_moves.count; ++j) {
61 EXPECT(expected_moves.moves[j] == read_moves->At(j));
62 }
63 free(read_moves);
64 }
65}

◆ RunTestInMode()

void dart::RunTestInMode ( CompilerPass::PipelineMode  mode)

Definition at line 50 of file yield_position_test.cc.

50 {
51 const char* kScript =
52 R"(
53 import 'dart:async';
54
55 Future foo() async {
56 print('pos-0');
57 await 0;
58 print('pos-1');
59 await 1;
60 print('pos-2');
61 await 2;
62 }
63 )";
64
66
67 const auto& root_library = Library::Handle(LoadTestScript(kScript));
68 // Ensure the outer function was compiled once, ensuring we have a closure
69 // function for the inner closure.
70 Invoke(root_library, "foo");
71
72 const auto& function = Function::Handle(GetFunction(root_library, "foo"));
73
74 // Ensure we have 3 different return instructions with yield indices attached
75 // to them.
76 TestPipeline pipeline(function, mode);
77 FlowGraph* flow_graph = pipeline.RunPasses({
78 CompilerPass::kComputeSSA,
79 });
80
81 auto validate_indices = [](const YieldPoints& yield_points) {
82 EXPECT_EQ(3, yield_points.length());
83
84 EXPECT_EQ(88, yield_points[0].Pos());
85 EXPECT_EQ(129, yield_points[1].Pos());
86 EXPECT_EQ(170, yield_points[2].Pos());
87 };

◆ RuntimeAllocationEpilogue()

static void dart::RuntimeAllocationEpilogue ( Thread thread)
static

Definition at line 371 of file runtime_entry.cc.

371 {
372 if (UNLIKELY(FLAG_runtime_allocate_spill_tlab)) {
373 static RelaxedAtomic<uword> count = 0;
374 if ((count++ % 10) == 0) {
375 thread->heap()->new_space()->AbandonRemainingTLAB(thread);
376 }
377 }
378}
intptr_t AbandonRemainingTLAB(Thread *thread)

◆ RuntimeCheck()

static TTSTestCase dart::RuntimeCheck ( const TTSTestCase original)
static

Definition at line 384 of file type_testing_stubs_test.cc.

384 {
385 return TTSTestCase(original.instance, original.instantiator_tav,
386 original.function_tav, kRuntimeCheck);
387}

◆ RunTTSTest()

static void dart::RunTTSTest ( const AbstractType dst_type,
const TTSTestCase test_case,
bool  should_specialize = true 
)
static

Definition at line 780 of file type_testing_stubs_test.cc.

782 {
783 // We're testing null here, there's no need to call this with null.
784 EXPECT(!test_case.instance.IsNull());
785 // should_specialize is what governs whether specialization is expected here.
786 EXPECT_NE(kSpecialize, test_case.expected_result);
787 EXPECT_NE(kRespecialize, test_case.expected_result);
788 // We're creating a new STC so it _can't_ use an existing entry.
789 EXPECT_NE(kExistingSTCEntry, test_case.expected_result);
790
791 bool null_should_fail = !Instance::NullIsAssignableTo(
792 dst_type, test_case.instantiator_tav, test_case.function_tav);
793 const TTSTestCase null_test{Instance::Handle(), test_case.instantiator_tav,
794 test_case.function_tav,
795 null_should_fail ? kFail : kTTS};
796
797 // First test the lazy case.
798 {
799 TTSTestState state(Thread::Current(), dst_type);
800
801 // We only get specialization when testing null if the type being tested
802 // isn't nullable and it is either a Type or a RecordType.
803 const auto& type_to_test =
804 AbstractType::Handle(state.TypeToTest(test_case));
805 const bool null_should_specialize =
806 null_should_fail &&
807 (type_to_test.IsType() || type_to_test.IsRecordType());
808
809 // First check the null case. This should _never_ create an STC.
810 state.InvokeLazilySpecializedStub(null_test, null_should_specialize);
811 state.InvokeExistingStub(null_test);
812 EXPECT(state.last_stc().IsNull());
813
814 // Now run the actual test case, starting with a fresh stub.
815 state.InvokeLazilySpecializedStub(test_case, should_specialize);
816 if (test_case.expected_result == kNewSTCEntry) {
817 if (state.last_stc().IsNull()) {
818 // The stub specialized to a non-default stub, so we need to run the
819 // test again to see it added to the cache.
820 state.InvokeExistingStub(test_case);
821 } else {
822 // The stub doesn't specialize or it specialized to a default stub,
823 // in which case the entry did get added to the STC already.
824 }
825 state.InvokeExistingStub(STCCheck(test_case));
826 } else {
827 state.InvokeExistingStub(test_case);
828 }
829 }
830
831 // Now test the eager case with a fresh stub/null STC.
832 {
833 TTSTestState state(Thread::Current(), dst_type);
834
835 // First check the null case. This should _never_ create an STC.
836 state.InvokeEagerlySpecializedStub(null_test);
837 state.InvokeExistingStub(null_test);
838 EXPECT(state.last_stc().IsNull());
839
840 state.InvokeEagerlySpecializedStub(test_case);
841 if (test_case.expected_result == kNewSTCEntry) {
842 // When eagerly specializing, the first invocation always adds to the STC.
843 state.InvokeExistingStub(STCCheck(test_case));
844 } else {
845 // Other cases should be idempotent.
846 state.InvokeExistingStub(test_case);
847 }
848 }
849}
static TTSTestCase STCCheck(const TTSTestCase &original)
const TTSTestResult expected_result

◆ RV_A()

static constexpr Extension dart::RV_A ( )
staticconstexpr

◆ RV_C()

static constexpr Extension dart::RV_C ( )
staticconstexpr

◆ RV_D()

static constexpr Extension dart::RV_D ( )
staticconstexpr

◆ RV_F()

static constexpr Extension dart::RV_F ( )
staticconstexpr

◆ RV_I()

static constexpr Extension dart::RV_I ( )
staticconstexpr

◆ RV_M()

static constexpr Extension dart::RV_M ( )
staticconstexpr

◆ RV_Zba()

static constexpr Extension dart::RV_Zba ( )
staticconstexpr

◆ RV_Zbb()

static constexpr Extension dart::RV_Zbb ( )
staticconstexpr

◆ RV_Zbc()

static constexpr Extension dart::RV_Zbc ( )
staticconstexpr

◆ RV_Zbs()

static constexpr Extension dart::RV_Zbs ( )
staticconstexpr

◆ SafelyAdjust()

static bool dart::SafelyAdjust ( Zone zone,
InductionVar lower_bound,
int64_t  lower_bound_offset,
InductionVar upper_bound,
int64_t  upper_bound_offset,
InductionVar **  min,
InductionVar **  max 
)
static

Definition at line 167 of file loops.cc.

173 {
174 bool success = false;
175 int64_t lval = 0;
176 int64_t uval = 0;
177 if (InductionVar::IsConstant(lower_bound, &lval)) {
178 const int64_t l = lval + lower_bound_offset;
179 if (InductionVar::IsConstant(upper_bound, &uval)) {
180 // Make sure a proper new range [l,u] results. Even if bounds
181 // were subject to arithmetic wrap-around, we preserve the
182 // property that the minimum is in l and the maximum in u.
183 const int64_t u = uval + upper_bound_offset;
184 success = (l <= u);
185 } else if (InductionVar::IsInvariant(upper_bound) &&
186 upper_bound->mult() == 1 &&
187 Definition::IsArrayLength(upper_bound->def())) {
188 // No arithmetic wrap-around on the lower bound, and a properly
189 // non-positive offset on an array length, which is always >= 0.
190 const int64_t c = upper_bound->offset() + upper_bound_offset;
191 success = ((lower_bound_offset >= 0 && lval <= l) ||
192 (lower_bound_offset < 0 && lval > l)) &&
193 (c <= 0);
194 }
195 }
196 if (success) {
197 *min = (lower_bound_offset == 0)
198 ? lower_bound
199 : new (zone) InductionVar(lval + lower_bound_offset);
200 *max = (upper_bound_offset == 0)
201 ? upper_bound
202 : new (zone)
203 InductionVar(upper_bound->offset() + upper_bound_offset,
204 upper_bound->mult(), upper_bound->def());
205 }
206 return success;
207}
int64_t mult() const
Definition loops.h:112
int64_t offset() const
Definition loops.h:108
Definition * def() const
Definition loops.h:116

◆ SafeTypeArgumentsToCString()

static const char * dart::SafeTypeArgumentsToCString ( const TypeArguments args)
static

Definition at line 12843 of file object.cc.

12843 {
12844 return (args.ptr() == TypeArguments::null()) ? "<null>" : args.ToCString();
12845}

◆ SamplesPerSecond()

static intptr_t dart::SamplesPerSecond ( )
static

Definition at line 631 of file profiler.cc.

631 {
632 const intptr_t kMicrosPerSec = 1000000;
633 return kMicrosPerSec / FLAG_profile_period;
634}

◆ ScanUntilDash()

static const char * dart::ScanUntilDash ( const char *  s)
static

Definition at line 603 of file service.cc.

603 {
604 if ((s == nullptr) || (*s == '\0')) {
605 // Empty string.
606 return nullptr;
607 }
608 while (*s != '\0') {
609 if (*s == '-') {
610 return s;
611 }
612 s++;
613 }
614 return nullptr;
615}

◆ SecretKeeper_KeepSecret()

void FUNCTION_NAME() dart::SecretKeeper_KeepSecret ( Dart_NativeArguments  native_args)

Definition at line 4429 of file dart_api_impl_test.cc.

4429 {
4430 Dart_Handle receiver = Dart_GetNativeArgument(native_args, 0);
4431 int64_t secret = 0;
4432 Dart_GetNativeIntegerArgument(native_args, 1, &secret);
4433 EXPECT_VALID(Dart_SetNativeInstanceField(receiver, 0, secret));
4434}
DART_EXPORT Dart_Handle Dart_GetNativeIntegerArgument(Dart_NativeArguments args, int index, int64_t *value)

◆ SecretKeeperFfiNativeResolver()

static void * dart::SecretKeeperFfiNativeResolver ( const char *  name,
uintptr_t  argn 
)
static

Definition at line 4446 of file dart_api_impl_test.cc.

4446 {
4447 if (strcmp(name, "returnPtrAsInt") == 0 && argn == 1) {
4448 return reinterpret_cast<void*>(&ReturnPtrAsInt);
4449 }
4450 return nullptr;
4451}
static intptr_t ReturnPtrAsInt(void *ptr)

◆ SecretKeeperNativeResolver()

static Dart_NativeFunction dart::SecretKeeperNativeResolver ( Dart_Handle  name,
int  argument_count,
bool *  auto_setup_scope 
)
static

Definition at line 4436 of file dart_api_impl_test.cc.

4438 {
4439 return reinterpret_cast<Dart_NativeFunction>(Builtin_SecretKeeper_KeepSecret);
4440}

◆ SegmentLength()

static intptr_t dart::SegmentLength ( const char *  input)
static

Definition at line 268 of file uri.cc.

268 {
269 const char* cp = input;
270
271 // Include initial slash in the segment, if any.
272 if (*cp == '/') {
273 cp++;
274 }
275
276 // Don't include trailing slash in the segment.
277 cp += strcspn(cp, "/");
278 return cp - input;
279}

◆ SemanticsUpdateBuilderUpdateNode()

DART_EXPORT void dart::SemanticsUpdateBuilderUpdateNode ( void *  this_,
int  id,
int  flags,
int  actions,
int  maxValueLength,
int  currentValueLength,
int  textSelectionBase,
int  textSelectionExtent,
int  platformViewId,
int  scrollChildren,
int  scrollIndex,
double  scrollPosition,
double  scrollExtentMax,
double  scrollExtentMin,
double  left,
double  top,
double  right,
double  bottom,
double  elevation,
double  thickness,
Dart_Handle  label,
Dart_Handle  labelAttributes,
Dart_Handle  value,
Dart_Handle  valueAttributes,
Dart_Handle  increasedValue,
Dart_Handle  increasedValueAttributes,
Dart_Handle  decreasedValue,
Dart_Handle  decreasedValueAttributes,
Dart_Handle  hint,
Dart_Handle  hintAttributes,
Dart_Handle  tooltip,
int  textDirection,
Dart_Handle  transform,
Dart_Handle  childrenInTraversalOrder,
Dart_Handle  childrenInHitTestOrder,
Dart_Handle  localContextActions 
)

Definition at line 1368 of file ffi_test_functions_vmspecific.cc.

1404 {
1405 if (!Dart_IsString(tooltip)) {
1406 FATAL("expected Dart_IsString(tooltip)");
1407 }
1408 const char* cstr;
1409 auto to_cstring_result = Dart_StringToCString(tooltip, &cstr);
1410 if (Dart_IsError(to_cstring_result)) {
1411 FATAL(Dart_GetError(to_cstring_result));
1412 }
1413 if (strcmp(cstr, "tooltip") != 0) {
1414 printf("cstr %s\n", cstr);
1415 FATAL("cstr not equal to \"tooltip\"");
1416 }
1417}

◆ SendMessages()

static void dart::SendMessages ( uword  param)
static

Definition at line 336 of file message_handler_test.cc.

336 {
337 ThreadStartInfo* info = reinterpret_cast<ThreadStartInfo*>(param);
338 info->join_id = OSThread::GetCurrentThreadJoinId(OSThread::Current());
339 MessageHandler* handler = info->handler;
340 MessageHandlerTestPeer handler_peer(handler);
341 for (int i = 0; i < info->count; i++) {
342 handler_peer.PostMessage(
343 BlankMessage(info->ports[i], Message::kNormalPriority));
344 }
345}
static std::unique_ptr< Message > BlankMessage(Dart_Port dest, Message::Priority priority)

◆ SendNull()

static void dart::SendNull ( const SendPort port)
static

Definition at line 121 of file developer.cc.

121 {
122 const Dart_Port destination_port_id = port.Id();
123 PortMap::PostMessage(Message::New(destination_port_id, Object::null(),
124 Message::kNormalPriority));
125}

◆ SENTINEL_TOKEN_DESCRIPTORS()

dart::SENTINEL_TOKEN_DESCRIPTORS ( DEFINE_VALUES  )

◆ SerializeAndDeserializeMint()

Dart_CObject * dart::SerializeAndDeserializeMint ( Zone zone,
const Mint mint 
)

Definition at line 191 of file snapshot_test.cc.

191 {
192 // Write snapshot with object content.
193 std::unique_ptr<Message> message = WriteMessage(
194 /* same_group */ false, mint, ILLEGAL_PORT, Message::kNormalPriority);
195
196 {
197 // Switch to a regular zone, where VM handle allocation is allowed.
198 Thread* thread = Thread::Current();
199 StackZone zone(thread);
200 // Read object back from the snapshot.
201 const Object& serialized_object =
202 Object::Handle(ReadMessage(thread, message.get()));
203 EXPECT(serialized_object.IsMint());
204 }
205
206 // Read object back from the snapshot into a C structure.
207 Dart_CObject* root = ReadApiMessage(zone, message.get());
208 EXPECT_NOTNULL(root);
209 CheckEncodeDecodeMessage(zone, root);
210 return root;
211}

◆ SerializeMessage() [1/2]

static std::unique_ptr< Message > dart::SerializeMessage ( Dart_Port  dest_port,
const Instance obj 
)
static

Definition at line 121 of file isolate.cc.

122 {
123 return WriteMessage(/* same_group */ false, obj, dest_port,
124 Message::kNormalPriority);
125}

◆ SerializeMessage() [2/2]

static std::unique_ptr< Message > dart::SerializeMessage ( Zone zone,
Dart_Port  dest_port,
Dart_CObject obj 
)
static

Definition at line 127 of file isolate.cc.

129 {
130 return WriteApiMessage(zone, obj, dest_port, Message::kNormalPriority);
131}

◆ SetArgumentTo42()

DART_EXPORT void dart::SetArgumentTo42 ( void *  token)

Definition at line 1127 of file ffi_test_functions_vmspecific.cc.

1127 {
1128 *reinterpret_cast<intptr_t*>(token) = 42;
1129}

◆ SetBreakpoint()

void dart::SetBreakpoint ( Dart_NativeArguments  args)

Definition at line 5638 of file object_test.cc.

5638 {
5639 // Refers to the DeoptimizeFramesWhenSettingBreakpoint function below.
5640 const int kBreakpointLine = 8;
5641
5642 // This will force deoptimization of functions on stack.
5643 // Function on stack has to be optimized, since we want to trigger debuggers
5644 // on-stack deoptimization flow when we set a breakpoint.
5646 Dart_SetBreakpoint(NewString(TestCase::url()), kBreakpointLine);
5648}
Dart_Handle Dart_SetBreakpoint(Dart_Handle script_url_in, intptr_t line_number)

◆ SetBreakpointResolver()

static Dart_NativeFunction dart::SetBreakpointResolver ( Dart_Handle  name,
int  argument_count,
bool *  auto_setup_scope 
)
static

Definition at line 5650 of file object_test.cc.

5652 {
5653 ASSERT(auto_setup_scope != nullptr);
5654 *auto_setup_scope = true;
5655 const char* cstr = nullptr;
5658 EXPECT_STREQ(cstr, "setBreakpoint");
5659 return &SetBreakpoint;
5660}
void SetBreakpoint(Dart_NativeArguments args)

◆ SetBreakpointState()

static void dart::SetBreakpointState ( Thread thread,
JSONStream js 
)
static

Definition at line 5571 of file service.cc.

5571 {
5572 Isolate* isolate = thread->isolate();
5573 const char* bpt_id = js->LookupParam("breakpointId");
5574 bool enable = BoolParameter::Parse(js->LookupParam("enable"), true);
5575 ObjectIdRing::LookupResult lookup_result;
5576 Breakpoint* bpt = LookupBreakpoint(isolate, bpt_id, &lookup_result);
5577 // TODO(bkonyi): Should we return a different error for bpts which
5578 // have been already removed?
5579 if (bpt == nullptr) {
5580 PrintInvalidParamError(js, "breakpointId");
5581 return;
5582 }
5583 if (isolate->debugger()->SetBreakpointState(bpt, enable)) {
5584 if (Service::debug_stream.enabled()) {
5585 ServiceEvent event(isolate, ServiceEvent::kBreakpointUpdated);
5586 event.set_breakpoint(bpt);
5587 Service::HandleEvent(&event);
5588 }
5589 }
5590 bpt->PrintJSON(js);
5591}
void PrintJSON(JSONStream *stream)
Definition debugger.cc:191
bool SetBreakpointState(Breakpoint *bpt, bool enable)
Definition debugger.cc:3927

◆ SetDartVmNode()

void dart::SetDartVmNode ( std::unique_ptr< inspect::Node >  node)

◆ SetEdgeWeight()

static void dart::SetEdgeWeight ( BlockEntryInstr block,
BlockEntryInstr successor,
const Array edge_counters,
intptr_t  entry_count 
)
static

Definition at line 24 of file block_scheduler.cc.

27 {
28 ASSERT(entry_count != 0);
29 if (auto target = successor->AsTargetEntry()) {
30 // If this block ends in a goto, the edge count of this edge is the same
31 // as the count on the single outgoing edge. This is true as long as the
32 // block does not throw an exception.
33 intptr_t count = GetEdgeCount(edge_counters, target->preorder_number());
34 if (count >= 0) {
35 double weight =
36 static_cast<double>(count) / static_cast<double>(entry_count);
37 target->set_edge_weight(weight);
38 }
39 } else if (auto jump = block->last_instruction()->AsGoto()) {
40 intptr_t count = GetEdgeCount(edge_counters, block->preorder_number());
41 if (count >= 0) {
42 double weight =
43 static_cast<double>(count) / static_cast<double>(entry_count);
44 jump->set_edge_weight(weight);
45 }
46 }
47}
static intptr_t GetEdgeCount(const Array &edge_counters, intptr_t edge_id)

◆ SetExceptionPauseMode()

static void dart::SetExceptionPauseMode ( Thread thread,
JSONStream js 
)
static

Definition at line 5505 of file service.cc.

5505 {
5506 const char* mode = js->LookupParam("mode");
5507 if (mode == nullptr) {
5508 PrintMissingParamError(js, "mode");
5509 return;
5510 }
5511 Dart_ExceptionPauseInfo info =
5512 EnumMapper(mode, exception_pause_mode_names, exception_pause_mode_values);
5513 if (info == kInvalidExceptionPauseInfo) {
5514 PrintInvalidParamError(js, "mode");
5515 return;
5516 }
5517 Isolate* isolate = thread->isolate();
5518 isolate->debugger()->SetExceptionPauseInfo(info);
5519 if (Service::debug_stream.enabled()) {
5520 ServiceEvent event(isolate, ServiceEvent::kDebuggerSettingsUpdate);
5521 Service::HandleEvent(&event);
5522 }
5523 PrintSuccess(js);
5524}
void SetExceptionPauseInfo(Dart_ExceptionPauseInfo pause_info)
Definition debugger.cc:1860

◆ SetFfiNativeResolverForTest()

DART_EXPORT void dart::SetFfiNativeResolverForTest ( Dart_Handle  url)

Definition at line 1281 of file ffi_test_functions_vmspecific.cc.

1281 {
1282 Dart_Handle library = Dart_LookupLibrary(url);
1283 ENSURE(!Dart_IsError(library));
1284 Dart_Handle result = Dart_SetFfiNativeResolver(library, &FfiNativeResolver);
1286}
DART_EXPORT Dart_Handle Dart_SetFfiNativeResolver(Dart_Handle library, Dart_FfiNativeResolver resolver)

◆ SetFlag()

static void dart::SetFlag ( Thread thread,
JSONStream js 
)
static

Definition at line 5607 of file service.cc.

5607 {
5608 const char* flag_name = js->LookupParam("name");
5609 if (flag_name == nullptr) {
5610 PrintMissingParamError(js, "name");
5611 return;
5612 }
5613 const char* flag_value = js->LookupParam("value");
5614 if (flag_value == nullptr) {
5615 PrintMissingParamError(js, "value");
5616 return;
5617 }
5618
5619 if (Flags::Lookup(flag_name) == nullptr) {
5620 JSONObject jsobj(js);
5621 jsobj.AddProperty("type", "Error");
5622 jsobj.AddProperty("message", "Cannot set flag: flag not found");
5623 return;
5624 }
5625
5626 // Changing most flags at runtime is dangerous because e.g., it may leave the
5627 // behavior generated code and the runtime out of sync.
5628 const uintptr_t kProfilePeriodIndex = 3;
5629 const uintptr_t kProfilerIndex = 4;
5630 const char* kAllowedFlags[] = {
5631 "pause_isolates_on_start",
5632 "pause_isolates_on_exit",
5633 "pause_isolates_on_unhandled_exceptions",
5634 "profile_period",
5635 "profiler",
5636 };
5637
5638 bool allowed = false;
5639 bool profile_period = false;
5640 bool profiler = false;
5641 for (size_t i = 0; i < ARRAY_SIZE(kAllowedFlags); i++) {
5642 if (strcmp(flag_name, kAllowedFlags[i]) == 0) {
5643 allowed = true;
5644 profile_period = (i == kProfilePeriodIndex);
5645 profiler = (i == kProfilerIndex);
5646 break;
5647 }
5648 }
5649
5650 if (!allowed) {
5651 JSONObject jsobj(js);
5652 jsobj.AddProperty("type", "Error");
5653 jsobj.AddProperty("message", "Cannot set flag: cannot change at runtime");
5654 return;
5655 }
5656
5657 const char* error = nullptr;
5658 if (Flags::SetFlag(flag_name, flag_value, &error)) {
5659 PrintSuccess(js);
5660 if (profile_period) {
5661 // FLAG_profile_period has already been set to the new value. Now we need
5662 // to notify the ThreadInterrupter to pick up the change.
5663 Profiler::UpdateSamplePeriod();
5664 } else if (profiler) {
5665 // FLAG_profiler has already been set to the new value.
5666 Profiler::UpdateRunningState();
5667 }
5668 if (Service::vm_stream.enabled()) {
5669 ServiceEvent event(ServiceEvent::kVMFlagUpdate);
5670 event.set_flag_name(flag_name);
5671 event.set_flag_new_value(flag_value);
5672 Service::HandleEvent(&event);
5673 }
5674 } else {
5675 JSONObject jsobj(js);
5676 jsobj.AddProperty("type", "Error");
5677 jsobj.AddProperty("message", error);
5678 }
5679}

◆ SetGlobalVar()

DART_EXPORT void dart::SetGlobalVar ( int32_t  v)

Definition at line 55 of file ffi_test_functions.cc.

55 {
56 globalInt = v;
57}

◆ SetIsolatePauseMode()

static void dart::SetIsolatePauseMode ( Thread thread,
JSONStream js 
)
static

Definition at line 5533 of file service.cc.

5533 {
5534 bool state_changed = false;
5535 const char* exception_pause_mode = js->LookupParam("exceptionPauseMode");
5536 if (exception_pause_mode != nullptr) {
5538 EnumMapper(exception_pause_mode, exception_pause_mode_names,
5539 exception_pause_mode_values);
5540 if (info == kInvalidExceptionPauseInfo) {
5541 PrintInvalidParamError(js, "exceptionPauseMode");
5542 return;
5543 }
5544 Isolate* isolate = thread->isolate();
5545 isolate->debugger()->SetExceptionPauseInfo(info);
5546 state_changed = true;
5547 }
5548
5549 const char* pause_isolate_on_exit = js->LookupParam("shouldPauseOnExit");
5550 if (pause_isolate_on_exit != nullptr) {
5551 bool enable = BoolParameter::Parse(pause_isolate_on_exit, false);
5552 thread->isolate()->message_handler()->set_should_pause_on_exit(enable);
5553 state_changed = true;
5554 }
5555
5556 if (state_changed && Service::debug_stream.enabled()) {
5557 ServiceEvent event(thread->isolate(),
5558 ServiceEvent::kDebuggerSettingsUpdate);
5559 Service::HandleEvent(&event);
5560 }
5561 PrintSuccess(js);
5562}
void set_should_pause_on_exit(bool should_pause_on_exit)
Dart_ExceptionPauseInfo
Definition debugger.h:502

◆ SetLibraryDebuggable()

static void dart::SetLibraryDebuggable ( Thread thread,
JSONStream js 
)
static

Definition at line 5688 of file service.cc.

5688 {
5689 const char* lib_id = js->LookupParam("libraryId");
5690 ObjectIdRing::LookupResult lookup_result;
5691 Object& obj =
5692 Object::Handle(LookupHeapObject(thread, lib_id, &lookup_result));
5693 const bool is_debuggable =
5694 BoolParameter::Parse(js->LookupParam("isDebuggable"), false);
5695 if (obj.IsLibrary()) {
5696 const Library& lib = Library::Cast(obj);
5697 lib.set_debuggable(is_debuggable);
5698 PrintSuccess(js);
5699 return;
5700 }
5701 PrintInvalidParamError(js, "libraryId");
5702}

◆ SetMode_native_lookup()

static Dart_NativeFunction dart::SetMode_native_lookup ( Dart_Handle  name,
int  argument_count,
bool *  auto_setup_scope 
)
static

Definition at line 9771 of file dart_api_impl_test.cc.

9775 {
9777 EXPECT_EQ(true, result);
9778 JSONStream js;
9779 JSONObject obj(&js);
9780 JSONArray jstream(&obj, "available");
9781 Timeline::PrintFlagsToJSONArray(&jstream);
9782 const char* js_str = js.ToCString();

◆ SetName()

static void dart::SetName ( Thread thread,
JSONStream js 
)
static

Definition at line 5710 of file service.cc.

5710 {
5711 Isolate* isolate = thread->isolate();
5712 isolate->set_name(js->LookupParam("name"));
5713 if (Service::isolate_stream.enabled()) {
5714 ServiceEvent event(isolate, ServiceEvent::kIsolateUpdate);
5715 Service::HandleEvent(&event);
5716 }
5717 PrintSuccess(js);
5718 return;
5719}
void set_name(const char *name)
Definition isolate.cc:1941

◆ SetNewSpaceTaggingWord()

DART_FORCE_INLINE void dart::SetNewSpaceTaggingWord ( ObjectPtr  to,
classid_t  cid,
uint32_t  size 
)

Definition at line 229 of file object_graph_copy.cc.

229 {
230 uword tags = 0;
231
232 tags = UntaggedObject::SizeTag::update(size, tags);
233 tags = UntaggedObject::ClassIdTag::update(cid, tags);
234 tags = UntaggedObject::AlwaysSetBit::update(true, tags);
235 tags = UntaggedObject::NotMarkedBit::update(true, tags);
236 tags = UntaggedObject::OldAndNotRememberedBit::update(false, tags);
237 tags = UntaggedObject::CanonicalBit::update(false, tags);
238 tags = UntaggedObject::NewBit::update(true, tags);
239 tags = UntaggedObject::ImmutableBit::update(
241#if defined(HASH_IN_OBJECT_HEADER)
242 tags = UntaggedObject::HashTag::update(0, tags);
243#endif
244 to.untag()->tags_ = tags;
245}

◆ SetPerformanceModeDefault()

static void dart::SetPerformanceModeDefault ( Dart_NativeArguments  args)
static

Definition at line 9764 of file dart_api_impl_test.cc.

◆ SetPerformanceModeLatency()

static void dart::SetPerformanceModeLatency ( Dart_NativeArguments  args)
static

Definition at line 9767 of file dart_api_impl_test.cc.

◆ SetPlaceId()

static DART_FORCE_INLINE void dart::SetPlaceId ( Instruction instr,
intptr_t  id 
)
static

Definition at line 1356 of file redundancy_elimination.cc.

1356 {
1357 instr->SetPassSpecificId(CompilerPass::kCSE, id);
1358}
void SetPassSpecificId(CompilerPass::Id pass, intptr_t id)
Definition il.h:1223

◆ SetResourceFinalizer()

void dart::SetResourceFinalizer ( Dart_Handle  handle,
intptr_t *  resource 
)

Definition at line 1179 of file ffi_test_functions_vmspecific.cc.

1179 {
1180 Dart_NewFinalizableHandle(handle, resource, sizeof(Dart_FinalizableHandle),
1181 DummyResourceFinalizer);
1182}
DART_EXPORT Dart_FinalizableHandle Dart_NewFinalizableHandle(Dart_Handle object, void *peer, intptr_t external_allocation_size, Dart_HandleFinalizer callback)
struct _Dart_FinalizableHandle * Dart_FinalizableHandle
Definition dart_api.h:261

◆ SetStreamIncludePrivateMembers()

static void dart::SetStreamIncludePrivateMembers ( Thread thread,
JSONStream js 
)
static

Definition at line 1564 of file service.cc.

1564 {
1565 const char* stream_id = js->LookupParam("streamId");
1566 if (stream_id == nullptr) {
1567 PrintMissingParamError(js, "streamId");
1568 return;
1569 }
1570 bool include_private_members =
1571 BoolParameter::Parse(js->LookupParam("includePrivateMembers"), false);
1572 intptr_t num_streams = sizeof(streams_) / sizeof(streams_[0]);
1573 for (intptr_t i = 0; i < num_streams; i++) {
1574 if (strcmp(stream_id, streams_[i]->id()) == 0) {
1575 streams_[i]->set_include_private_members(include_private_members);
1576 break;
1577 }
1578 }
1579 PrintSuccess(js);
1580}
void set_include_private_members(bool value)
Definition service.h:82

◆ SetTraceClassAllocation()

static void dart::SetTraceClassAllocation ( Thread thread,
JSONStream js 
)
static

Definition at line 5746 of file service.cc.

5746 {
5747 const char* class_id = js->LookupParam("classId");
5748 const bool enable = BoolParameter::Parse(js->LookupParam("enable"));
5749 intptr_t cid = -1;
5750 GetPrefixedIntegerId(class_id, "classes/", &cid);
5751 Isolate* isolate = thread->isolate();
5752 if (!IsValidClassId(isolate, cid)) {
5753 PrintInvalidParamError(js, "classId");
5754 return;
5755 }
5756 const Class& cls = Class::Handle(GetClassForId(isolate, cid));
5757 ASSERT(!cls.IsNull());
5758 cls.SetTraceAllocation(enable);
5759 PrintSuccess(js);
5760}

◆ SetupArguments()

static Dart_Handle dart::SetupArguments ( Thread thread,
int  num_args,
Dart_Handle arguments,
int  extra_args,
Array args 
)
static

Definition at line 4444 of file dart_api_impl.cc.

4448 {
4449 Zone* zone = thread->zone();
4450 // Check for malformed arguments in the arguments list.
4451 *args = Array::New(num_args + extra_args);
4452 Object& arg = Object::Handle(zone);
4453 for (int i = 0; i < num_args; i++) {
4454 arg = Api::UnwrapHandle(arguments[i]);
4455 if (!arg.IsNull() && !arg.IsInstance()) {
4456 *args = Array::null();
4457 if (arg.IsError()) {
4458 return Api::NewHandle(thread, arg.ptr());
4459 } else {
4460 return Api::NewError(
4461 "%s expects arguments[%d] to be an Instance handle.", "Dart_Invoke",
4462 i);
4463 }
4464 }
4465 args->SetAt((i + extra_args), arg);
4466 }
4467 return Api::Success();
4468}

◆ SetupCoreLibrariesForUnitTest()

void dart::SetupCoreLibrariesForUnitTest ( )

Definition at line 148 of file unit_test.cc.

148 {
149 TransitionVMToNative transition(Thread::Current());
150
152 bool ok = bin::DartUtils::SetOriginalWorkingDirectory();
154 Dart_Handle result = bin::DartUtils::PrepareForScriptLoading(
155 /*is_service_isolate=*/false,
156 /*trace_loading=*/false);
158
160}

◆ SetupFfiFlowgraph()

FlowGraph * dart::SetupFfiFlowgraph ( TestPipeline pipeline,
const compiler::ffi::CallMarshaller marshaller,
uword  native_entry,
bool  is_leaf 
)

Definition at line 864 of file il_test.cc.

867 {
868 FlowGraph* flow_graph = pipeline->RunPasses({CompilerPass::kComputeSSA});
869
870 {
871 // Locate the placeholder call.
872 StaticCallInstr* static_call = nullptr;
873 {
874 ILMatcher cursor(flow_graph, flow_graph->graph_entry()->normal_entry(),
875 /*trace=*/false);
876 cursor.TryMatch({kMoveGlob, {kMatchStaticCall, &static_call}});
877 }
878 RELEASE_ASSERT(static_call != nullptr);
879
880 // Store the native entry as an unboxed constant and convert it to an
881 // untagged pointer for the FfiCall.
882 Zone* const Z = flow_graph->zone();
883 auto* const load_entry_point = new (Z) IntConverterInstr(
884 kUnboxedIntPtr, kUntagged,
885 new (Z) Value(flow_graph->GetConstant(
886 Integer::Handle(Z, Integer::NewCanonical(native_entry)),
887 kUnboxedIntPtr)),
888 DeoptId::kNone);
889 flow_graph->InsertBefore(static_call, load_entry_point, /*env=*/nullptr,
890 FlowGraph::kValue);
891
892 // Make an FfiCall based on ffi_trampoline that calls our native function.
893 const intptr_t num_arguments =
894 FfiCallInstr::InputCountForMarshaller(marshaller);
895 RELEASE_ASSERT(num_arguments == 1);
896 InputsArray arguments(num_arguments);
897 arguments.Add(new (Z) Value(load_entry_point));
898 auto* const ffi_call = new (Z)
899 FfiCallInstr(DeoptId::kNone, marshaller, is_leaf, std::move(arguments));
901 ffi_call->InputAt(ffi_call->TargetAddressIndex())->definition() ==
902 load_entry_point);
903 flow_graph->InsertBefore(static_call, ffi_call, /*env=*/nullptr,
904 FlowGraph::kEffect);
905
906 // Remove the placeholder call.
907 static_call->RemoveFromGraph(/*return_previous=*/false);
908 }
909
910 // Run remaining relevant compiler passes.
911 pipeline->RunAdditionalPasses({
912 CompilerPass::kApplyICData,
913 CompilerPass::kTryOptimizePatterns,
914 CompilerPass::kSetOuterInliningId,
915 CompilerPass::kTypePropagation,
916 // Skipping passes that don't seem to do anything for this test.
917 CompilerPass::kWidenSmiToInt32,
918 CompilerPass::kSelectRepresentations,
919 // Skipping passes that don't seem to do anything for this test.
920 CompilerPass::kTypePropagation,
921 CompilerPass::kRangeAnalysis,
922 // Skipping passes that don't seem to do anything for this test.
923 CompilerPass::kFinalizeGraph,
924 CompilerPass::kCanonicalize,
925 CompilerPass::kAllocateRegisters,
926 CompilerPass::kReorderBlocks,
927 });
928
929 return flow_graph;
930}
void RunAdditionalPasses(std::initializer_list< CompilerPass::Id > passes)
FlowGraph * RunPasses(std::initializer_list< CompilerPass::Id > passes)

◆ SetupSample()

static Sample * dart::SetupSample ( Thread thread,
bool  allocation_sample,
ThreadId  tid 
)
static

Definition at line 1229 of file profiler.cc.

1231 {
1232 ASSERT(thread != nullptr);
1233 Isolate* isolate = thread->isolate();
1234 SampleBlockBuffer* buffer = Profiler::sample_block_buffer();
1235 Sample* sample = allocation_sample ? buffer->ReserveAllocationSample(isolate)
1236 : buffer->ReserveCPUSample(isolate);
1237 if (sample == nullptr) {
1238 return nullptr;
1239 }
1240 sample->Init(isolate->main_port(), OS::GetCurrentMonotonicMicros(), tid);
1241 uword vm_tag = thread->vm_tag();
1242#if defined(USING_SIMULATOR)
1243 // When running in the simulator, the runtime entry function address
1244 // (stored as the vm tag) is the address of a redirect function.
1245 // Attempt to find the real runtime entry function address and use that.
1246 uword redirect_vm_tag = Simulator::FunctionForRedirect(vm_tag);
1247 if (redirect_vm_tag != 0) {
1248 vm_tag = redirect_vm_tag;
1249 }
1250#endif
1251 sample->set_vm_tag(vm_tag);
1252 sample->set_user_tag(isolate->user_tag());
1253 sample->set_thread_task(thread->task_kind());
1254 return sample;
1255}
uword user_tag() const
Definition isolate.h:1280
void set_vm_tag(uword tag)
Definition profiler.h:266
void set_user_tag(uword tag)
Definition profiler.h:272
uword vm_tag() const
Definition thread.h:808
TaskKind task_kind() const
Definition thread.h:478

◆ SetVMName()

static void dart::SetVMName ( Thread thread,
JSONStream js 
)
static

Definition at line 5727 of file service.cc.

5727 {
5728 const char* name_param = js->LookupParam("name");
5729 free(vm_name);
5730 vm_name = Utils::StrDup(name_param);
5731 if (Service::vm_stream.enabled()) {
5732 ServiceEvent event(ServiceEvent::kVMUpdate);
5733 Service::HandleEvent(&event);
5734 }
5735 PrintSuccess(js);
5736 return;
5737}
static char * vm_name
Definition service.cc:356

◆ SetVMTimelineFlags()

static void dart::SetVMTimelineFlags ( Thread thread,
JSONStream js 
)
static

Definition at line 4241 of file service.cc.

4241 {
4242#if !defined(SUPPORT_TIMELINE)
4243 PrintSuccess(js);
4244#else
4245 Isolate* isolate = thread->isolate();
4246 ASSERT(isolate != nullptr);
4247 StackZone zone(thread);
4248
4249 char* recorded_streams = Utils::StrDup(js->LookupParam("recordedStreams"));
4250 Service::EnableTimelineStreams(recorded_streams);
4251 free(recorded_streams);
4252
4253 PrintSuccess(js);
4254#endif
4255}

◆ ShiftArgs()

void dart::ShiftArgs ( int argc,
const char **  argv 
)

Definition at line 290 of file run_vm_tests.cc.

290 {
291 // Remove the first flag from the list by shifting all arguments down.
292 for (intptr_t i = 1; i < *argc - 1; i++) {
293 argv[i] = argv[i + 1];
294 }
295 argv[*argc - 1] = nullptr;
296 (*argc)--;
297}

◆ ShiftOperationHelper()

static IntegerPtr dart::ShiftOperationHelper ( Token::Kind  kind,
const Integer value,
const Integer amount 
)
static

Definition at line 206 of file integers.cc.

208 {
209 if (amount.AsInt64Value() < 0) {
210 Exceptions::ThrowArgumentError(amount);
211 }
212 return value.ShiftOp(kind, amount, Heap::kNew);
213}
virtual int64_t AsInt64Value() const
Definition object.cc:23137

◆ ShortCutEmitCharacterPair()

static bool dart::ShortCutEmitCharacterPair ( RegExpMacroAssembler macro_assembler,
bool  one_byte,
uint16_t  c1,
uint16_t  c2,
BlockLabel on_failure 
)
static

Definition at line 935 of file regexp.cc.

939 {
940 uint16_t char_mask;
941 if (one_byte) {
942 char_mask = Symbols::kMaxOneCharCodeSymbol;
943 } else {
944 char_mask = Utf16::kMaxCodeUnit;
945 }
946 uint16_t exor = c1 ^ c2;
947 // Check whether exor has only one bit set.
948 if (((exor - 1) & exor) == 0) {
949 // If c1 and c2 differ only by one bit.
950 // Ecma262UnCanonicalize always gives the highest number last.
951 ASSERT(c2 > c1);
952 uint16_t mask = char_mask ^ exor;
953 macro_assembler->CheckNotCharacterAfterAnd(c1, mask, on_failure);
954 return true;
955 }
956 ASSERT(c2 > c1);
957 uint16_t diff = c2 - c1;
958 if (((diff - 1) & diff) == 0 && c1 >= diff) {
959 // If the characters differ by 2^n but don't differ by one bit then
960 // subtract the difference from the found character, then do the or
961 // trick. We avoid the theoretical case where negative numbers are
962 // involved in order to simplify code generation.
963 uint16_t mask = char_mask ^ diff;
964 macro_assembler->CheckNotCharacterAfterMinusAnd(c1 - diff, diff, mask,
965 on_failure);
966 return true;
967 }
968 return false;
969}
virtual void CheckNotCharacterAfterAnd(unsigned c, unsigned and_with, BlockLabel *on_not_equal)=0
virtual void CheckNotCharacterAfterMinusAnd(uint16_t c, uint16_t minus, uint16_t and_with, BlockLabel *on_not_equal)=0

◆ ShouldBeAllocatedBefore()

static bool dart::ShouldBeAllocatedBefore ( LiveRange a,
LiveRange b 
)
inlinestatic

Definition at line 2837 of file linearscan.cc.

2837 {
2838 // TODO(vegorov): consider first hint position when ordering live ranges.
2839 return a->Start() <= b->Start();
2840}

◆ ShouldBePrivate()

static bool dart::ShouldBePrivate ( const String name)
static

Definition at line 13818 of file object.cc.

13818 {
13819 return (name.Length() >= 1 && name.CharAt(0) == '_') ||
13820 (name.Length() >= 5 &&
13821 (name.CharAt(4) == '_' &&
13822 (name.CharAt(0) == 'g' || name.CharAt(0) == 's') &&
13823 name.CharAt(1) == 'e' && name.CharAt(2) == 't' &&
13824 name.CharAt(3) == ':'));
13825}

◆ ShouldHaveImmutabilityBitSetCid()

bool dart::ShouldHaveImmutabilityBitSetCid ( intptr_t  predefined_cid)
inline

Definition at line 507 of file class_id.h.

507 {
508 ASSERT(predefined_cid < kNumPredefinedCids);
509 return IsDeeplyImmutableCid(predefined_cid) ||
510 IsShallowlyImmutableCid(predefined_cid);
511}
bool IsShallowlyImmutableCid(intptr_t predefined_cid)
Definition class_id.h:500
bool IsDeeplyImmutableCid(intptr_t predefined_cid)
Definition class_id.h:485

◆ ShouldInlineSimd() [1/2]

static bool dart::ShouldInlineSimd ( )
static

Definition at line 1932 of file flow_graph.cc.

1932 {
1933 return FlowGraphCompiler::SupportsUnboxedSimd128();
1934}

◆ ShouldInlineSimd() [2/2]

static bool dart::ShouldInlineSimd ( )
static

Definition at line 29 of file call_specializer.cc.

29 {
30 return FlowGraphCompiler::SupportsUnboxedSimd128();
31}

◆ ShouldReorderBlocks()

static bool dart::ShouldReorderBlocks ( const Function function,
FlowGraph::CompilationMode  mode 
)
static

Definition at line 37 of file flow_graph.cc.

38 {
39 return (mode == FlowGraph::CompilationMode::kOptimized) &&
40 FLAG_reorder_basic_blocks && !function.IsFfiCallbackTrampoline();
41}

◆ ShouldSpecializeForDouble()

static bool dart::ShouldSpecializeForDouble ( const BinaryFeedback binary_feedback)
static

Definition at line 45 of file call_specializer.cc.

45 {
46 // Don't specialize for double if we can't unbox them.
47 if (!CanUnboxDouble()) {
48 return false;
49 }
50
51 // Unboxed double operation can't handle case of two smis.
52 if (binary_feedback.IncludesOperands(kSmiCid)) {
53 return false;
54 }
55
56 // Check that the call site has seen only smis and doubles.
57 return binary_feedback.OperandsAreSmiOrDouble();
58}
bool IncludesOperands(intptr_t cid) const
Definition il.h:880
bool OperandsAreSmiOrDouble() const
Definition il.h:871

◆ ShouldSuspend()

static bool dart::ShouldSuspend ( bool  isolate_shutdown,
Thread thread 
)
static

Definition at line 407 of file thread.cc.

407 {
408 // Must destroy thread.
409 if (isolate_shutdown) return false;
410
411 // Must retain thread.
412 if (thread->HasActiveState() || thread->OwnsSafepoint()) return true;
413
414 // Could do either. When there are few isolates suspend to avoid work
415 // entering and leaving. When there are many isolate, destroy the thread to
416 // avoid the root set growing too big.
417 const intptr_t kMaxSuspendedThreads = 20;
418 auto group = thread->isolate_group();
419 return group->thread_registry()->active_isolates_count() <
420 kMaxSuspendedThreads;
421}
bool OwnsSafepoint() const
Definition thread.cc:1301
bool HasActiveState()
Definition thread.cc:349

◆ ShutdownIsolate()

static void dart::ShutdownIsolate ( uword  parameter)
static

Definition at line 2363 of file isolate.cc.

2363 {
2364 Dart_EnterIsolate(reinterpret_cast<Dart_Isolate>(parameter));
2366}

◆ sign_extend() [1/4]

intx_t dart::sign_extend ( int32_t  x)
inline

Definition at line 693 of file constants_riscv.h.

693 {
694 return static_cast<intx_t>(x);
695}

◆ sign_extend() [2/4]

intx_t dart::sign_extend ( int64_t  x)
inline

Definition at line 696 of file constants_riscv.h.

696 {
697 return static_cast<intx_t>(x);
698}

◆ sign_extend() [3/4]

intx_t dart::sign_extend ( uint32_t  x)
inline

Definition at line 699 of file constants_riscv.h.

699 {
700 return static_cast<intx_t>(static_cast<int32_t>(x));
701}

◆ sign_extend() [4/4]

intx_t dart::sign_extend ( uint64_t  x)
inline

Definition at line 702 of file constants_riscv.h.

702 {
703 return static_cast<intx_t>(static_cast<int64_t>(x));
704}

◆ SignExtend()

int32_t dart::SignExtend ( int  N,
int32_t  value 
)
inline

Definition at line 688 of file constants_riscv.h.

688 {
689 return static_cast<int32_t>(static_cast<uint32_t>(value) << (32 - N)) >>
690 (32 - N);
691}
#define N
Definition beziers.cpp:19

◆ SimdRepresentation()

static constexpr Representation dart::SimdRepresentation ( Representation  rep)
staticconstexpr

Definition at line 8259 of file il.cc.

8259 {
8260 // Keep the old semantics where kUnboxedInt8 was a locally created
8261 // alias for kUnboxedInt32, and pass everything else through unchanged.
8262 return rep == kUnboxedInt8 ? kUnboxedInt32 : rep;
8263}

◆ SimpleInstanceOfType()

bool dart::SimpleInstanceOfType ( const AbstractType type)

Definition at line 372 of file flow_graph_builder.cc.

372 {
373 // Bail if the type is still uninstantiated at compile time.
374 if (!type.IsInstantiated()) return false;
375
376 // Bail if the type is a function, record or a Dart Function type.
377 if (type.IsFunctionType() || type.IsRecordType() ||
378 type.IsDartFunctionType()) {
379 return false;
380 }
381
382 ASSERT(type.HasTypeClass());
383 auto* const zone = Thread::Current()->zone();
384 const Class& type_class = Class::Handle(zone, type.type_class());
385
386 // Bail if the type has any type parameters.
387 if (type_class.IsGeneric()) {
388 // If the interface type is a supertype of the rare type, as any instances
389 // are guaranteed to be subtypes of the rare type, then we can still use
390 // the _simpleInstanceOf implementation (see also
391 // runtime/lib/object.cc:Object_SimpleInstanceOf).
392 // See #52848 for why the type might be a supertype and not strictly equal.
393 const auto& rare_type = Type::Handle(zone, type_class.RareType());
394 return rare_type.IsSubtypeOf(type, Heap::kNew);
395 }
396
397 // Finally a simple class for instance of checking.
398 return true;
399}

◆ SimpleInvoke()

int64_t dart::SimpleInvoke ( Dart_Handle  lib,
const char *  method 
)

Definition at line 23 of file isolate_reload_test.cc.

23 {
24 Dart_Handle result = Dart_Invoke(lib, NewString(method), 0, nullptr);
27 int64_t integer_result = 0;
28 result = Dart_IntegerToInt64(result, &integer_result);
30 return integer_result;
31}

◆ SimpleInvokeError()

Dart_Handle dart::SimpleInvokeError ( Dart_Handle  lib,
const char *  method 
)

Definition at line 41 of file isolate_reload_test.cc.

41 {
42 Dart_Handle result = Dart_Invoke(lib, NewString(method), 0, nullptr);
44 return result;
45}

◆ SimpleInvokeStr()

const char * dart::SimpleInvokeStr ( Dart_Handle  lib,
const char *  method 
)

Definition at line 33 of file isolate_reload_test.cc.

33 {
34 Dart_Handle result = Dart_Invoke(lib, NewString(method), 0, nullptr);
35 const char* result_str = nullptr;
38 return result_str;
39}

◆ SizeOfStruct3BytesPackedInt()

DART_EXPORT uint64_t dart::SizeOfStruct3BytesPackedInt ( )

Definition at line 1216 of file ffi_test_functions.cc.

◆ SleepOnAnyOS()

DART_EXPORT void dart::SleepOnAnyOS ( intptr_t  seconds)

Definition at line 437 of file ffi_test_functions_vmspecific.cc.

437 {
438#if defined(DART_HOST_OS_WINDOWS)
439 Sleep(1000 * seconds);
440#else
441 sleep(seconds);
442#endif
443}

◆ SlotIndexToFpRelativeOffset()

static intptr_t dart::SlotIndexToFpRelativeOffset ( intptr_t  slot)
static

Definition at line 385 of file exceptions.cc.

385 {
386 return SlotIndexToFrameIndex(slot) * compiler::target::kWordSize;
387}
static intptr_t SlotIndexToFrameIndex(intptr_t slot)

◆ SlotIndexToFrameIndex()

static intptr_t dart::SlotIndexToFrameIndex ( intptr_t  slot)
static

Definition at line 381 of file exceptions.cc.

381 {
383}

◆ SlowFinalizer()

static void dart::SlowFinalizer ( void *  isolate_callback_data,
void *  peer 
)
static

Definition at line 3174 of file dart_api_impl_test.cc.

3174 {
3175 OS::Sleep(10);
3176 intptr_t* count = reinterpret_cast<intptr_t*>(peer);
3177 (*count)++;
3178}

◆ SlowWeakPersistentHandle()

static void dart::SlowWeakPersistentHandle ( void *  isolate_callback_data,
void *  peer 
)
static

Definition at line 3199 of file dart_api_impl_test.cc.

3199 {
3200 OS::Sleep(10);
3201 intptr_t* count = reinterpret_cast<intptr_t*>(peer);
3202 (*count)++;
3203}

◆ SmallDouble()

DART_EXPORT double dart::SmallDouble ( )

Definition at line 75 of file ffi_test_functions_vmspecific.cc.

75 {
76 Dart_ExecuteInternalCommand("gc-on-nth-allocation",
77 reinterpret_cast<void*>(1));
78 return 0x80000000 * -1.0;
79}

◆ SmearBitsRight()

static uint32_t dart::SmearBitsRight ( uint32_t  v)
inlinestatic

Definition at line 1589 of file regexp.cc.

1589 {
1590 v |= v >> 1;
1591 v |= v >> 2;
1592 v |= v >> 4;
1593 v |= v >> 8;
1594 v |= v >> 16;
1595 return v;
1596}

◆ SmiFitsInDouble()

static bool dart::SmiFitsInDouble ( )
static

Definition at line 369 of file call_specializer.cc.

369 {
370 return compiler::target::kSmiBits < 53;
371}

◆ SpaceForExternal()

Heap::Space dart::SpaceForExternal ( FinalizerEntryPtr  raw_entry)

Definition at line 42 of file gc_shared.cc.

42 {
43 // As with WeakTables, Smis are "old".
44 return raw_entry->untag()->value()->IsImmediateOrOldObject() ? Heap::kOld
45 : Heap::kNew;
46}

◆ SpaceForRuntimeAllocation()

static Heap::Space dart::SpaceForRuntimeAllocation ( )
static

Definition at line 367 of file runtime_entry.cc.

367 {
368 return UNLIKELY(FLAG_runtime_allocate_old) ? Heap::kOld : Heap::kNew;
369}

◆ SpecialCharacter()

template<typename type >
static type dart::SpecialCharacter ( type  value)
static

Definition at line 530 of file object.cc.

530 {
531 if (value == '"') {
532 return '"';
533 } else if (value == '\n') {
534 return 'n';
535 } else if (value == '\f') {
536 return 'f';
537 } else if (value == '\b') {
538 return 'b';
539 } else if (value == '\t') {
540 return 't';
541 } else if (value == '\v') {
542 return 'v';
543 } else if (value == '\r') {
544 return 'r';
545 } else if (value == '\\') {
546 return '\\';
547 } else if (value == '$') {
548 return '$';
549 }
550 UNREACHABLE();
551 return '\0';
552}

◆ SplitByTypeArgumentsFieldOffset()

static void dart::SplitByTypeArgumentsFieldOffset ( Thread T,
const Class type_class,
const CidRangeVector ranges,
GrowableArray< CidRangeVector * > *  output 
)
static

Definition at line 774 of file type_testing_stubs.cc.

778 {
779 ASSERT(output != nullptr);
780 ASSERT(!ranges.is_empty());
781
782 Zone* const Z = T->zone();
783 ClassTable* const class_table = T->isolate_group()->class_table();
784 IntMap<CidRangeVector*> offset_map(Z);
785 IntMap<intptr_t> predefined_offsets(Z);
786 IntMap<intptr_t> user_defined_offsets(Z);
787
788 auto add_to_vector = [&](intptr_t tav_offset, const CidRange& range) {
789 if (range.cid_start == -1) return;
790 ASSERT(tav_offset != compiler::target::Class::kNoTypeArguments);
791 if (CidRangeVector* vector = offset_map.Lookup(tav_offset)) {
792 vector->Add(range);
793 } else {
794 vector = new CidRangeVector(1);
795 vector->Add(range);
796 offset_map.Insert(tav_offset, vector);
797 }
798 };
799
800 auto increment_count = [&](intptr_t cid, intptr_t tav_offset) {
801 if (cid <= kNumPredefinedCids) {
802 predefined_offsets.Update(
803 {tav_offset, predefined_offsets.Lookup(tav_offset) + 1});
804 } else if (auto* const kv = predefined_offsets.LookupPair(tav_offset)) {
805 predefined_offsets.Update({kv->key, kv->value + 1});
806 } else {
807 user_defined_offsets.Update(
808 {tav_offset, user_defined_offsets.Lookup(tav_offset) + 1});
809 }
810 };
811
812 // First populate offset_map.
813 auto& cls = Class::Handle(Z);
814 for (const auto& range : ranges) {
815 intptr_t last_offset = compiler::target::Class::kNoTypeArguments;
816 intptr_t cid_start = -1;
817 intptr_t cid_end = -1;
818 for (intptr_t cid = range.cid_start; cid <= range.cid_end; cid++) {
819 if (!class_table->HasValidClassAt(cid)) continue;
820 cls = class_table->At(cid);
821 if (cls.is_abstract()) continue;
822 // Only finalized concrete classes are present due to the conditions on
823 // returning kInstanceTypeArgumentsAreSubtypes in SubtypeChecksForClass.
824 ASSERT(cls.is_finalized());
825 const intptr_t tav_offset =
826 compiler::target::Class::TypeArgumentsFieldOffset(cls);
827 if (tav_offset == compiler::target::Class::kNoTypeArguments) continue;
828 if (tav_offset == last_offset && cid_start >= 0) {
829 cid_end = cid;
830 increment_count(cid, tav_offset);
831 continue;
832 }
833 add_to_vector(last_offset, {cid_start, cid_end});
834 last_offset = tav_offset;
835 cid_start = cid_end = cid;
836 increment_count(cid, tav_offset);
837 }
838 add_to_vector(last_offset, {cid_start, cid_end});
839 }
840
841 ASSERT(!offset_map.IsEmpty());
842
843 // Add the CidRangeVector for the type_class's offset, if it has one.
844 if (!type_class.is_abstract() && type_class.is_finalized()) {
845 const intptr_t type_class_offset =
846 compiler::target::Class::TypeArgumentsFieldOffset(type_class);
847 ASSERT(predefined_offsets.LookupPair(type_class_offset) != nullptr ||
848 user_defined_offsets.LookupPair(type_class_offset) != nullptr);
849 CidRangeVector* const vector = offset_map.Lookup(type_class_offset);
850 ASSERT(vector != nullptr);
851 output->Add(vector);
852 // Remove this CidRangeVector from consideration in the following loops.
853 predefined_offsets.Remove(type_class_offset);
854 user_defined_offsets.Remove(type_class_offset);
855 }
856 // Now add CidRangeVectors that include predefined cids.
857 // For now, we do this in an arbitrary order, but we could use the counts
858 // to prioritize offsets that are more shared if desired.
859 auto predefined_it = predefined_offsets.GetIterator();
860 while (auto* const kv = predefined_it.Next()) {
861 CidRangeVector* const vector = offset_map.Lookup(kv->key);
862 ASSERT(vector != nullptr);
863 output->Add(vector);
864 }
865 // Finally, add CidRangeVectors that only include user-defined cids.
866 // For now, we do this in an arbitrary order, but we could use the counts
867 // to prioritize offsets that are more shared if desired.
868 auto user_defined_it = user_defined_offsets.GetIterator();
869 while (auto* const kv = user_defined_it.Next()) {
870 CidRangeVector* const vector = offset_map.Lookup(kv->key);
871 ASSERT(vector != nullptr);
872 output->Add(vector);
873 }
874 ASSERT(output->length() > 0);
875}

◆ SplitListOfPositions()

template<typename PositionType >
PositionType * dart::SplitListOfPositions ( PositionType **  head,
intptr_t  split_pos,
bool  split_at_start 
)

Definition at line 1869 of file linearscan.cc.

1871 {
1872 PositionType* last_before_split = nullptr;
1873 PositionType* pos = *head;
1874 if (split_at_start) {
1875 while ((pos != nullptr) && (pos->pos() < split_pos)) {
1876 last_before_split = pos;
1877 pos = pos->next();
1878 }
1879 } else {
1880 while ((pos != nullptr) && (pos->pos() <= split_pos)) {
1881 last_before_split = pos;
1882 pos = pos->next();
1883 }
1884 }
1885
1886 if (last_before_split == nullptr) {
1887 *head = nullptr;
1888 } else {
1889 last_before_split->set_next(nullptr);
1890 }
1891
1892 return pos;
1893}

◆ SplitOnTypeArgumentTests()

static void dart::SplitOnTypeArgumentTests ( HierarchyInfo hi,
const Type type,
const Class type_class,
const CidRangeVector ranges,
CidRangeVector cid_check_only,
CidRangeVector type_argument_checks,
CidRangeVector not_checked 
)
static

Definition at line 902 of file type_testing_stubs.cc.

908 {
909 ASSERT(type_class.is_implemented()); // No need to split if not implemented.
910 ASSERT(cid_check_only->is_empty());
911 ASSERT(type_argument_checks->is_empty());
912 ASSERT(not_checked->is_empty());
913 ClassTable* const class_table = hi->thread()->isolate_group()->class_table();
914 Zone* const zone = hi->thread()->zone();
915 auto& to_check = Class::Handle(zone);
916 auto add_cid_range = [&](CheckType check, const CidRange& range) {
917 if (range.cid_start == -1) return;
918 switch (check) {
919 case CheckType::kCidCheckOnly:
920 cid_check_only->Add(range);
921 break;
922 case CheckType::kInstanceTypeArgumentsAreSubtypes:
923 type_argument_checks->Add(range);
924 break;
925 default:
926 not_checked->Add(range);
927 }
928 };
929 for (const auto& range : ranges) {
930 CheckType last_check = CheckType::kCannotBeChecked;
931 classid_t cid_start = -1, cid_end = -1;
932 for (classid_t cid = range.cid_start; cid <= range.cid_end; cid++) {
933 // Invalid entries can be included to keep range count low.
934 if (!class_table->HasValidClassAt(cid)) continue;
935 to_check = class_table->At(cid);
936 if (to_check.is_abstract()) continue;
937 const CheckType current_check =
938 SubtypeChecksForClass(zone, type, type_class, to_check);
939 ASSERT(current_check != CheckType::kInstanceTypeArgumentsAreSubtypes ||
940 to_check.is_finalized());
941 if (last_check == current_check && cid_start >= 0) {
942 cid_end = cid;
943 continue;
944 }
945 add_cid_range(last_check, {cid_start, cid_end});
946 last_check = current_check;
947 cid_start = cid_end = cid;
948 }
949 add_cid_range(last_check, {cid_start, cid_end});
950 }
951}

◆ SplitSearchSpace()

static void dart::SplitSearchSpace ( ZoneGrowableArray< uint16_t > *  ranges,
intptr_t  start_index,
intptr_t  end_index,
intptr_t *  new_start_index,
intptr_t *  new_end_index,
uint16_t *  border 
)
static

Definition at line 1148 of file regexp.cc.

1153 {
1154 const intptr_t kSize = RegExpMacroAssembler::kTableSize;
1155 const intptr_t kMask = RegExpMacroAssembler::kTableMask;
1156
1157 uint16_t first = ranges->At(start_index);
1158 uint16_t last = ranges->At(end_index) - 1;
1159
1160 *new_start_index = start_index;
1161 *border = (ranges->At(start_index) & ~kMask) + kSize;
1162 while (*new_start_index < end_index) {
1163 if (ranges->At(*new_start_index) > *border) break;
1164 (*new_start_index)++;
1165 }
1166 // new_start_index is the index of the first edge that is beyond the
1167 // current kSize space.
1168
1169 // For very large search spaces we do a binary chop search of the non-Latin1
1170 // space instead of just going to the end of the current kSize space. The
1171 // heuristics are complicated a little by the fact that any 128-character
1172 // encoding space can be quickly tested with a table lookup, so we don't
1173 // wish to do binary chop search at a smaller granularity than that. A
1174 // 128-character space can take up a lot of space in the ranges array if,
1175 // for example, we only want to match every second character (eg. the lower
1176 // case characters on some Unicode pages).
1177 intptr_t binary_chop_index = (end_index + start_index) / 2;
1178 // The first test ensures that we get to the code that handles the Latin1
1179 // range with a single not-taken branch, speeding up this important
1180 // character range (even non-Latin1 charset-based text has spaces and
1181 // punctuation).
1182 if (*border - 1 > Symbols::kMaxOneCharCodeSymbol && // Latin1 case.
1183 end_index - start_index > (*new_start_index - start_index) * 2 &&
1184 last - first > kSize * 2 && binary_chop_index > *new_start_index &&
1185 ranges->At(binary_chop_index) >= first + 2 * kSize) {
1186 intptr_t scan_forward_for_section_border = binary_chop_index;
1187 intptr_t new_border = (ranges->At(binary_chop_index) | kMask) + 1;
1188
1189 while (scan_forward_for_section_border < end_index) {
1190 if (ranges->At(scan_forward_for_section_border) > new_border) {
1191 *new_start_index = scan_forward_for_section_border;
1192 *border = new_border;
1193 break;
1194 }
1195 scan_forward_for_section_border++;
1196 }
1197 }
1198
1199 ASSERT(*new_start_index > start_index);
1200 *new_end_index = *new_start_index - 1;
1201 if (ranges->At(*new_end_index) == *border) {
1202 (*new_end_index)--;
1203 }
1204 if (*border >= ranges->At(end_index)) {
1205 *border = ranges->At(end_index);
1206 *new_start_index = end_index; // Won't be used.
1207 *new_end_index = end_index - 1;
1208 }
1209}

◆ StackAllocatedDestructionHelper()

static void dart::StackAllocatedDestructionHelper ( int ptr)
static

Definition at line 70 of file allocation_test.cc.

70 {
71 TestValueObject stacked(ptr);
72 EXPECT_EQ(2, *ptr);
73 *ptr = 3;
74}

◆ StackAllocatedLongJumpHelper()

static void dart::StackAllocatedLongJumpHelper ( int ptr,
LongJumpScope jump 
)
static

Definition at line 82 of file allocation_test.cc.

82 {
83 TestValueObject stacked(ptr);
84 EXPECT_EQ(2, *ptr);
85 *ptr = 3;
86 const Error& error = Error::Handle(LanguageError::New(
87 String::Handle(String::New("StackAllocatedLongJump"))));
88 jump->Jump(1, error);
90}

◆ StackedStackResourceDestructionHelper()

static void dart::StackedStackResourceDestructionHelper ( int ptr)
static

Definition at line 104 of file allocation_test.cc.

104 {
105 TestStackedStackResource stacked(ptr);
106 EXPECT_EQ(4, *ptr);
107 *ptr = 5;
108}

◆ StackedStackResourceLongJumpHelper()

static void dart::StackedStackResourceLongJumpHelper ( int ptr,
LongJumpScope jump 
)
static

Definition at line 125 of file allocation_test.cc.

125 {
126 TestStackedStackResource stacked(ptr);
127 EXPECT_EQ(4, *ptr);
128 *ptr = 5;
129 const Error& error = Error::Handle(LanguageError::New(
130 String::Handle(String::New("StackedStackResourceLongJump"))));
131 jump->Jump(1, error);
132 UNREACHABLE();
133}

◆ StackFrame_accessFrame()

static void dart::StackFrame_accessFrame ( Dart_NativeArguments  args)
static

Definition at line 265 of file benchmark_test.cc.

265 {
266 Timer timer;
267 timer.Start();
268 {
269 Thread* thread = Thread::Current();
270 TransitionNativeToVM transition(thread);
271 const int kNumIterations = 100;
272 Code& code = Code::Handle(thread->zone());
273 for (int i = 0; i < kNumIterations; i++) {
274 StackFrameIterator frames(ValidationPolicy::kDontValidateFrames, thread,
275 StackFrameIterator::kNoCrossThreadIteration);
276 StackFrame* frame = frames.NextFrame();
277 while (frame != nullptr) {
278 if (frame->IsStubFrame()) {
279 code = frame->LookupDartCode();
280 EXPECT(code.function() == Function::null());
281 } else if (frame->IsDartFrame()) {
282 code = frame->LookupDartCode();
283 EXPECT(code.function() != Function::null());
284 }
285 frame = frames.NextFrame();
286 }
287 }
288 }
289 timer.Stop();
290 int64_t elapsed_time = timer.TotalElapsedTime();
292}

◆ StackFrame_dartFrameCount()

void FUNCTION_NAME() dart::StackFrame_dartFrameCount ( Dart_NativeArguments  args)

Definition at line 69 of file stack_frame_test.cc.

69 {
70 TransitionNativeToVM transition(Thread::Current());
71 int count = 0;
72 DartFrameIterator frames(Thread::Current(),
73 StackFrameIterator::kNoCrossThreadIteration);
74 while (frames.NextFrame() != nullptr) {
75 count += 1; // Count the dart frame.
76 }
77 VerifyPointersVisitor::VerifyPointers("StackFrame_dartFrameCount_Test");
78 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args);
79 arguments->SetReturn(Object::Handle(Smi::New(count)));
80}

◆ StackFrame_equals()

void FUNCTION_NAME() dart::StackFrame_equals ( Dart_NativeArguments  args)

Definition at line 40 of file stack_frame_test.cc.

40 {
41 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args);
42 TransitionNativeToVM transition(arguments->thread());
43 Zone* zone = arguments->thread()->zone();
44 const Instance& expected =
45 Instance::CheckedHandle(zone, arguments->NativeArgAt(0));
46 const Instance& actual =
47 Instance::CheckedHandle(zone, arguments->NativeArgAt(1));
48 if (!expected.OperatorEquals(actual)) {
49 OS::PrintErr("expected: '%s' actual: '%s'\n", expected.ToCString(),
50 actual.ToCString());
51 EXPECT(false);
52 }
53}
virtual bool OperatorEquals(const Instance &other) const
Definition object.cc:20896

◆ StackFrame_frameCount()

void FUNCTION_NAME() dart::StackFrame_frameCount ( Dart_NativeArguments  args)

Definition at line 55 of file stack_frame_test.cc.

55 {
56 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args);
57 TransitionNativeToVM transition(arguments->thread());
58 int count = 0;
59 StackFrameIterator frames(ValidationPolicy::kValidateFrames,
60 arguments->thread(),
61 StackFrameIterator::kNoCrossThreadIteration);
62 while (frames.NextFrame() != nullptr) {
63 count += 1; // Count the frame.
64 }
65 VerifyPointersVisitor::VerifyPointers("StackFrame_frameCount_Test");
66 arguments->SetReturn(Object::Handle(Smi::New(count)));
67}

◆ StackFrame_validateFrame()

void FUNCTION_NAME() dart::StackFrame_validateFrame ( Dart_NativeArguments  args)

Definition at line 82 of file stack_frame_test.cc.

82 {
83 Thread* thread = Thread::Current();
84 Zone* zone = thread->zone();
85
88
89 TransitionNativeToVM transition(thread);
90 const Smi& frame_index_smi =
91 Smi::CheckedHandle(zone, Api::UnwrapHandle(index));
92 const char* expected_name =
93 String::CheckedHandle(zone, Api::UnwrapHandle(name)).ToCString();
94 int frame_index = frame_index_smi.Value();
95 int count = 0;
96 DartFrameIterator frames(thread, StackFrameIterator::kNoCrossThreadIteration);
97 StackFrame* frame = frames.NextFrame();
98 while (frame != nullptr) {
99 if (count == frame_index) {
100 // Find the function corresponding to this frame and check if it
101 // matches the function name passed in.
102 const Function& function =
103 Function::Handle(zone, frame->LookupDartFunction());
104 if (function.IsNull()) {
105 FATAL("StackFrame_validateFrame fails, invalid dart frame.\n");
106 }
107 const char* name = function.ToFullyQualifiedCString();
108 // Currently all unit tests are loaded as being part of dart:core-lib.
109 String& url = String::Handle(zone, String::New(TestCase::url()));
110 const Library& lib =
111 Library::Handle(zone, Library::LookupLibrary(thread, url));
112 ASSERT(!lib.IsNull());
113 const char* lib_name = String::Handle(zone, lib.url()).ToCString();
114 char* full_name = OS::SCreate(zone, "%s_%s", lib_name, expected_name);
115 EXPECT_STREQ(full_name, name);
116 return;
117 }
118 count += 1; // Count the dart frames.
119 frame = frames.NextFrame();
120 }
121 FATAL("StackFrame_validateFrame fails, frame count < index passed in.\n");
122}

◆ StackFrameNativeResolver()

static Dart_NativeFunction dart::StackFrameNativeResolver ( Dart_Handle  name,
int  arg_count,
bool *  auto_setup_scope 
)
static

Definition at line 294 of file benchmark_test.cc.

296 {
297 ASSERT(auto_setup_scope != nullptr);
298 *auto_setup_scope = false;
300}
static void StackFrame_accessFrame(Dart_NativeArguments args)

◆ StackResourceDestructionHelper()

static void dart::StackResourceDestructionHelper ( int ptr)
static

Definition at line 110 of file allocation_test.cc.

110 {
111 TestStackResource stacked(ptr);
112 EXPECT_EQ(2, *ptr);
113 *ptr = 3;
115 EXPECT_EQ(6, *ptr);
116 // Do not set data because the LongJump version does not return control here.
117}
static void StackedStackResourceDestructionHelper(int *ptr)

◆ StackResourceLongJumpHelper()

static void dart::StackResourceLongJumpHelper ( int ptr,
LongJumpScope jump 
)
static

Definition at line 135 of file allocation_test.cc.

135 {
136 TestStackResource stacked(ptr);
137 EXPECT_EQ(2, *ptr);
138 *ptr = 3;
140 UNREACHABLE();
141}
static void StackedStackResourceLongJumpHelper(int *ptr, LongJumpScope *jump)

◆ StartWorkSimulator()

DART_EXPORT void dart::StartWorkSimulator ( )

Definition at line 596 of file ffi_test_functions_vmspecific.cc.

596 {
597 SimulateWork::StartWorkSimulator();
598}

◆ StartWorkSimulator2()

DART_EXPORT void dart::StartWorkSimulator2 ( )

Definition at line 878 of file ffi_test_functions_vmspecific.cc.

878 {
879 SimulateWork2::StartWorkSimulator();
880}

◆ StaticNativeFoo1()

static void dart::StaticNativeFoo1 ( Dart_NativeArguments  args)
static

Definition at line 8767 of file dart_api_impl_test.cc.

8768 :external-name', 'NativeFoo3')
8769 external int foo3([int k = 10000, int l = 1]);
8770
8771 @pragma('vm:external-name', 'NativeFoo4')
8772 external int foo4(int i, [int j = 10, int k = 1]);
8773
static void NativeFoo4(Dart_NativeArguments args)
static void NativeFoo3(Dart_NativeArguments args)

◆ StaticNativeFoo2()

static void dart::StaticNativeFoo2 ( Dart_NativeArguments  args)
static

Definition at line 8775 of file dart_api_impl_test.cc.

8775 { var func = foo2; return func(i); }
8776 int bar30() { var func = foo3; return func(); }
8777 int bar31(int i) { var func = foo3; return func(i); }
8778 int bar32(int i, int j) { var func = foo3; return func(i, j); }
8779 int bar41(int i) {
8780 var func = foo4; return func(i); }
8781 int bar42(int i, int j) {
8782 var func = foo4; return func(i, j); }

◆ StaticNativeFoo3()

static void dart::StaticNativeFoo3 ( Dart_NativeArguments  args)
static

Definition at line 8784 of file dart_api_impl_test.cc.

8786 {
8787 static equals(a, b) {
8788 if (a != b) {
8789 throw 'not equal. expected: $a, got: $b';
8790 }
8791 }
8792 }
static bool equals(T *a, T *b)

◆ StaticNativeFoo4()

static void dart::StaticNativeFoo4 ( Dart_NativeArguments  args)
static

Definition at line 8794 of file dart_api_impl_test.cc.

◆ STCCheck()

static TTSTestCase dart::STCCheck ( const TTSTestCase original)
static

Definition at line 370 of file type_testing_stubs_test.cc.

370 {
371 return TTSTestCase(original.instance, original.instantiator_tav,
372 original.function_tav, kExistingSTCEntry);
373}

◆ StopWorkSimulator()

DART_EXPORT void dart::StopWorkSimulator ( )

Definition at line 600 of file ffi_test_functions_vmspecific.cc.

600 {
601 SimulateWork::StopWorkSimulator();
602}

◆ StopWorkSimulator2()

DART_EXPORT void dart::StopWorkSimulator2 ( )

Definition at line 882 of file ffi_test_functions_vmspecific.cc.

882 {
883 SimulateWork2::StopWorkSimulator();
884}

◆ StoreDestination()

static Definition * dart::StoreDestination ( Value use)
static

Definition at line 3398 of file redundancy_elimination.cc.

3398 {
3399 if (auto* const alloc = use->instruction()->AsAllocation()) {
3400 return alloc;
3401 }
3402 if (auto* const store = use->instruction()->AsStoreField()) {
3403 return store->instance()->definition();
3404 }
3405 if (auto* const store = use->instruction()->AsStoreIndexed()) {
3406 return store->array()->definition();
3407 }
3408 return nullptr;
3409}

◆ StoreError()

static MessageHandler::MessageStatus dart::StoreError ( Thread thread,
const Error error 
)
static

Definition at line 1482 of file isolate.cc.

1483 {
1484 thread->set_sticky_error(error);
1485 if (error.IsUnwindError()) {
1486 const UnwindError& unwind = UnwindError::Cast(error);
1487 if (!unwind.is_user_initiated()) {
1488 return MessageHandler::kShutdown;
1489 }
1490 }
1491 return MessageHandler::kError;
1492}
bool is_user_initiated() const
Definition object.h:8150

◆ StoreUnaligned()

template<typename T >
static void dart::StoreUnaligned ( T ptr,
T  value 
)
inlinestatic

Definition at line 22 of file unaligned.h.

22 {
23 memcpy(reinterpret_cast<void*>(ptr), // NOLINT
24 reinterpret_cast<const void*>(&value), sizeof(value));
25}

◆ StrengthenAlignment()

static AlignmentType dart::StrengthenAlignment ( intptr_t  cid,
AlignmentType  alignment 
)
static

Definition at line 6813 of file il.cc.

6814 {
6815 switch (RepresentationUtils::RepresentationOfArrayElement(cid)) {
6816 case kUnboxedInt8:
6817 case kUnboxedUint8:
6818 // Don't need to worry about alignment for accessing bytes.
6819 return kAlignedAccess;
6820 case kUnboxedFloat32x4:
6821 case kUnboxedInt32x4:
6822 case kUnboxedFloat64x2:
6823 // TODO(rmacnak): Investigate alignment requirements of floating point
6824 // loads.
6825 return kAlignedAccess;
6826 default:
6827 return alignment;
6828 }
6829}

◆ StrictCompareSentinel()

void dart::StrictCompareSentinel ( Thread thread,
bool  negate,
bool  non_sentinel_on_left 
)

Definition at line 289 of file constant_propagator_test.cc.

291 {
292 const char* kScript = R"(
293 late final int x = 4;
294 )";
295 Zone* const Z = Thread::Current()->zone();
296 const auto& root_library = Library::CheckedHandle(Z, LoadTestScript(kScript));
297 const auto& toplevel = Class::Handle(Z, root_library.toplevel_class());
298 const auto& field_x = Field::Handle(
299 Z, toplevel.LookupStaticField(String::Handle(Z, String::New("x"))));
300
302 CompilerState S(thread, /*is_aot=*/false, /*is_optimizing=*/true);
304
305 auto b1 = H.flow_graph()->graph_entry()->normal_entry();
306
307 {
308 BlockBuilder builder(H.flow_graph(), b1);
309 auto v_load = builder.AddDefinition(new LoadStaticFieldInstr(
310 field_x, {},
311 /*calls_initializer=*/true, S.GetNextDeoptId()));
312 auto v_sentinel = H.flow_graph()->GetConstant(Object::sentinel());
313 Value* const left_value =
314 non_sentinel_on_left ? new Value(v_load) : new Value(v_sentinel);
315 Value* const right_value =
316 non_sentinel_on_left ? new Value(v_sentinel) : new Value(v_load);
317 auto v_compare = builder.AddDefinition(new StrictCompareInstr(
318 {}, negate ? Token::kNE_STRICT : Token::kEQ_STRICT, left_value,
319 right_value,
320 /*needs_number_check=*/false, S.GetNextDeoptId()));
321 builder.AddReturn(new Value(v_compare));
322 }
323
324 H.FinishGraph();
325
326 FlowGraphPrinter::PrintGraph("Before TypePropagator", H.flow_graph());
327 FlowGraphTypePropagator::Propagate(H.flow_graph());
328 FlowGraphPrinter::PrintGraph("After TypePropagator", H.flow_graph());
329 GrowableArray<BlockEntryInstr*> ignored;
330 ConstantPropagator::Optimize(H.flow_graph());
331 FlowGraphPrinter::PrintGraph("After ConstantPropagator", H.flow_graph());
332
333 DartReturnInstr* ret = nullptr;
334
335 ILMatcher cursor(H.flow_graph(),
336 H.flow_graph()->graph_entry()->normal_entry(), true);
337 RELEASE_ASSERT(cursor.TryMatch({
338 kMatchAndMoveFunctionEntry,
339 kMatchAndMoveLoadStaticField,
340 // The StrictCompare instruction should be removed.
341 {kMatchDartReturn, &ret},
342 }));
343
344 EXPECT_PROPERTY(ret, it.value()->BindsToConstant());
345 EXPECT_PROPERTY(&ret->value()->BoundConstant(), it.IsBool());
346 EXPECT_PROPERTY(&ret->value()->BoundConstant(),
347 Bool::Cast(it).value() == negate);
348}

◆ String2UTF8()

static const char * dart::String2UTF8 ( const String str)
static

Definition at line 857 of file isolate.cc.

857 {
858 intptr_t len = Utf8::Length(str);
859 char* result = new char[len + 1];
860 str.ToUTF8(reinterpret_cast<uint8_t*>(result), len);
861 result[len] = 0;
862
863 return result;
864}
void ToUTF8(uint8_t *utf8_array, intptr_t array_len) const
Definition object.cc:24225

◆ StringFrom() [1/2]

StringPtr dart::StringFrom ( const uint16_t *  data,
intptr_t  len,
Heap::Space  space 
)

Definition at line 42 of file symbols.cc.

42 {
43 return String::FromUTF16(data, len, space);
44}

◆ StringFrom() [2/2]

StringPtr dart::StringFrom ( const uint8_t *  data,
intptr_t  len,
Heap::Space  space 
)

Definition at line 38 of file symbols.cc.

38 {
39 return String::FromLatin1(data, len, space);
40}

◆ StringLower()

static void dart::StringLower ( char *  str)
static

Definition at line 128 of file uri.cc.

128 {
129 const intptr_t len = strlen(str);
130 intptr_t i = 0;
131 while (i < len) {
132 int escaped_value = GetEscapedValue(str, i, len);
133 if (escaped_value >= 0) {
134 // Don't lowercase escape sequences.
135 i += 3;
136 } else {
137 // I don't use tolower() because I don't want the locale
138 // transforming any non-ascii characters.
139 char c = str[i];
140 if (c >= 'A' && c <= 'Z') {
141 str[i] = c + ('a' - 'A');
142 }
143 i++;
144 }
145 }
146}

◆ StringValueAt()

static uint16_t dart::StringValueAt ( const String str,
const Integer index 
)
static

Definition at line 430 of file string.cc.

430 {
431 if (index.IsSmi()) {
432 const intptr_t index_value = Smi::Cast(index).Value();
433 if ((0 <= index_value) && (index_value < str.Length())) {
434 return str.CharAt(index_value);
435 }
436 }
437
438 // An index larger than Smi is always illegal.
439 Exceptions::ThrowRangeError("index", index, 0, str.Length() - 1);
440 return 0;
441}

◆ StripTokenPositions()

void dart::StripTokenPositions ( char *  buffer)

Definition at line 799 of file unit_test.cc.

799 {
800 ElideJSONSubstring(",\"tokenPos\":", buffer, buffer, ",");
801 ElideJSONSubstring(",\"endTokenPos\":", buffer, buffer, "}");
802}

◆ StubEntryFor()

static const Code & dart::StubEntryFor ( const ICData ic_data,
bool  optimized 
)
static

Definition at line 1486 of file flow_graph_compiler.cc.

1486 {
1487 switch (ic_data.NumArgsTested()) {
1488 case 1:
1489 if (ic_data.is_tracking_exactness()) {
1490 if (optimized) {
1491 return StubCode::OneArgOptimizedCheckInlineCacheWithExactnessCheck();
1492 } else {
1493 return StubCode::OneArgCheckInlineCacheWithExactnessCheck();
1494 }
1495 }
1496 return optimized ? StubCode::OneArgOptimizedCheckInlineCache()
1497 : StubCode::OneArgCheckInlineCache();
1498 case 2:
1499 ASSERT(!ic_data.is_tracking_exactness());
1500 return optimized ? StubCode::TwoArgsOptimizedCheckInlineCache()
1501 : StubCode::TwoArgsCheckInlineCache();
1502 default:
1503 ic_data.Print();
1504 UNIMPLEMENTED();
1505 return Code::Handle();
1506 }
1507}
bool is_tracking_exactness() const
Definition object.h:2463
void Print() const
Definition object.cc:2681

◆ SubtypeChecksForClass()

static CheckType dart::SubtypeChecksForClass ( Zone zone,
const Type type,
const Class type_class,
const Class to_check 
)
static

Definition at line 474 of file type_testing_stubs.cc.

477 {
478 ASSERT_EQUAL(type.type_class_id(), type_class.id());
479 ASSERT(type_class.is_type_finalized());
480 ASSERT(!to_check.is_abstract());
481 ASSERT(to_check.is_type_finalized());
482 ASSERT(AbstractType::Handle(zone, to_check.RareType())
483 .IsSubtypeOf(AbstractType::Handle(zone, type_class.RareType()),
484 Heap::kNew));
485 if (!type_class.IsGeneric()) {
486 // All instances of [to_check] are subtypes of [type].
487 return CheckType::kCidCheckOnly;
488 }
489 if (to_check.FindInstantiationOf(zone, type_class,
490 /*only_super_classes=*/true)) {
491 // No need to check for type argument consistency, as [to_check] is the same
492 // as or a subclass of [type_class].
493 return to_check.is_finalized()
494 ? CheckType::kInstanceTypeArgumentsAreSubtypes
495 : CheckType::kCannotBeChecked;
496 }
497 auto& calculated_type =
498 Type::Handle(zone, to_check.GetInstantiationOf(zone, type_class));
499 if (calculated_type.IsInstantiated()) {
500 if (type.IsInstantiated()) {
501 return calculated_type.IsSubtypeOf(type, Heap::kNew)
502 ? CheckType::kCidCheckOnly
503 : CheckType::kNotSubtype;
504 }
505 // TODO(dartbug.com/46920): Requires walking both types, checking
506 // corresponding instantiated parts at compile time (assuming uninstantiated
507 // parts check successfully) and then creating appropriate runtime checks
508 // for uninstantiated parts of [type].
509 return CheckType::kCannotBeChecked;
510 }
511 if (!to_check.is_finalized()) {
512 return CheckType::kNeedsFinalization;
513 }
514 ASSERT(to_check.NumTypeArguments() > 0);
515 ASSERT(compiler::target::Class::TypeArgumentsFieldOffset(to_check) !=
516 compiler::target::Class::kNoTypeArguments);
517 // If the calculated type arguments are a prefix of the declaration type
518 // arguments, then we can just treat the instance type arguments as if they
519 // were used to instantiate the type class during checking.
520 const auto& decl_type_args = TypeArguments::Handle(
521 zone, to_check.GetDeclarationInstanceTypeArguments());
522 const auto& calculated_type_args = TypeArguments::Handle(
523 zone, calculated_type.GetInstanceTypeArguments(Thread::Current(),
524 /*canonicalize=*/false));
525 const bool type_args_consistent = calculated_type_args.IsSubvectorEquivalent(
526 decl_type_args, 0, type_class.NumTypeArguments(),
527 TypeEquality::kCanonical);
528 // TODO(dartbug.com/46920): Currently we require subtyping to be checkable
529 // by comparing the instance type arguments against the type arguments of
530 // [type] piecewise, but we could check other cases as well.
531 return type_args_consistent ? CheckType::kInstanceTypeArgumentsAreSubtypes
532 : CheckType::kCannotBeChecked;
533}
TypePtr GetInstantiationOf(Zone *zone, const Class &cls) const
Definition object.cc:12776
TypeArgumentsPtr GetDeclarationInstanceTypeArguments() const
Definition object.cc:3526
bool is_type_finalized() const
Definition object.h:1711
bool FindInstantiationOf(Zone *zone, const Class &cls, GrowableArray< const Type * > *path, bool consider_only_super_classes=false) const
Definition object.cc:12723

◆ SubtypeTestCacheCheckContents()

static void dart::SubtypeTestCacheCheckContents ( Zone zone,
const SubtypeTestCache cache 
)
static

Definition at line 8200 of file object_test.cc.

8201 {
8202 const intptr_t kNumClasses = 100000;
8203 static_assert(kNumClasses > TypeArguments::Cache::kMaxLinearCacheEntries,
8204 "too few classes to trigger change to a hash-based cache");
8205 TypeArgumentsHashCacheTest(thread, kNumClasses);
8206}
8207#endif
8208
8209#undef EXPECT_TYPES_SYNTACTICALLY_EQUIVALENT
8210
8211static void SubtypeTestCacheCheckContents(Zone* zone,
8212 const SubtypeTestCache& cache) {
8213 const intptr_t used_inputs = cache.num_inputs();
8214 if (used_inputs < 1 || used_inputs > SubtypeTestCache::kMaxInputs) {
8215 FAIL("Invalid number of used inputs: %" Pd "", used_inputs);
8216 return;
8217 }
8218 const auto& array = Array::Handle(zone, cache.cache());
8219 for (intptr_t i = 0; i < cache.NumEntries(); i++) {
8220 if (!cache.IsOccupied(i)) continue;
8221 const intptr_t entry_start = i * SubtypeTestCache::kTestEntryLength;
8222 {
8223 const intptr_t cid =
8224 array.At(entry_start + SubtypeTestCache::kTestResult)
8225 ->GetClassIdMayBeSmi();
8226 EXPECT(cid == kNullCid || cid == kBoolCid);
8227 }
8228
8229 // Used to make sure all the cases are in the correct order below.
8230 int check_ordering = used_inputs;
8231 // Input: the value of SubtypeTestCache::Entries for this input
8232 // ExpectedCids is an expression where [cid] is bound to the contents cid.
8233#define USED_INPUT_CASE(Input, ExpectedCids) \
8234 case (Input) + 1: { \
8235 RELEASE_ASSERT((Input) + 1 == check_ordering); \
8236 const intptr_t cid = \
8237 array.At(entry_start + (Input))->GetClassIdMayBeSmi(); \
8238 if (!(ExpectedCids)) { \
8239 FAIL("expected: " #ExpectedCids ", got: cid %" Pd "", cid); \
8240 } \
8241 --check_ordering; \
8242 }
8243
8244 switch (used_inputs) {
8245 USED_INPUT_CASE(SubtypeTestCache::kDestinationType,
8248 USED_INPUT_CASE(SubtypeTestCache::kInstanceDelayedFunctionTypeArguments,
8249 cid == kNullCid || cid == kTypeArgumentsCid);
8251 USED_INPUT_CASE(SubtypeTestCache::kInstanceParentFunctionTypeArguments,
8252 cid == kNullCid || cid == kTypeArgumentsCid);
8254 USED_INPUT_CASE(SubtypeTestCache::kFunctionTypeArguments,
8255 cid == kNullCid || cid == kTypeArgumentsCid);
8257 USED_INPUT_CASE(SubtypeTestCache::kInstantiatorTypeArguments,
8258 cid == kNullCid || cid == kTypeArgumentsCid);
8260 USED_INPUT_CASE(SubtypeTestCache::kInstanceTypeArguments,
8261 cid == kNullCid || cid == kTypeArgumentsCid);
8263 USED_INPUT_CASE(SubtypeTestCache::kInstanceCidOrSignature,
8264 cid == kSmiCid || cid == kFunctionTypeCid);
8265 break;
8266 default:
8267 UNREACHABLE();
8268 }
8269
8270#undef USED_INPUT_CASE
8271 RELEASE_ASSERT(0 == check_ordering);
8272
bool IsConcreteTypeClassId(intptr_t index)
Definition class_id.h:325
static void TypeArgumentsHashCacheTest(Thread *thread, intptr_t num_classes)
#define USED_INPUT_CASE(Input, ExpectedCids)

◆ SubtypeTestCacheEntryMatches()

static bool dart::SubtypeTestCacheEntryMatches ( const SubtypeTestCacheTable::TupleView t,
intptr_t  num_inputs,
const Object instance_class_id_or_signature,
const AbstractType destination_type,
const TypeArguments instance_type_arguments,
const TypeArguments instantiator_type_arguments,
const TypeArguments function_type_arguments,
const TypeArguments instance_parent_function_type_arguments,
const TypeArguments instance_delayed_type_arguments 
)
inlinestatic

Definition at line 19116 of file object.cc.

19125 {
19126 switch (num_inputs) {
19127 case 7:
19128 if (t.Get<SubtypeTestCache::kDestinationType>() !=
19129 destination_type.ptr()) {
19130 return false;
19131 }
19133 case 6:
19134 if (t.Get<SubtypeTestCache::kInstanceDelayedFunctionTypeArguments>() !=
19135 instance_delayed_type_arguments.ptr()) {
19136 return false;
19137 }
19139 case 5:
19140 if (t.Get<SubtypeTestCache::kInstanceParentFunctionTypeArguments>() !=
19141 instance_parent_function_type_arguments.ptr()) {
19142 return false;
19143 }
19145 case 4:
19146 if (t.Get<SubtypeTestCache::kFunctionTypeArguments>() !=
19147 function_type_arguments.ptr()) {
19148 return false;
19149 }
19151 case 3:
19152 if (t.Get<SubtypeTestCache::kInstantiatorTypeArguments>() !=
19153 instantiator_type_arguments.ptr()) {
19154 return false;
19155 }
19157 case 2:
19158 if (t.Get<SubtypeTestCache::kInstanceTypeArguments>() !=
19159 instance_type_arguments.ptr()) {
19160 return false;
19161 }
19163 case 1:
19164 // We don't need to perform load-acquire semantics when re-retrieving
19165 // the kInstanceCidOrSignature field, as this is performed only if the
19166 // entry is occupied, and occupied entries never change.
19167 return t.Get<SubtypeTestCache::kInstanceCidOrSignature>() ==
19168 instance_class_id_or_signature.ptr();
19169 default:
19170 UNREACHABLE();
19171 }
19172}
std::tuple_element< kElement, TupleT >::type::ObjectPtrType Get() const
Definition object.h:13449

◆ SubtypeTestCacheEntryTest()

static void dart::SubtypeTestCacheEntryTest ( Thread thread,
const SubtypeTestCache cache,
const Object instance_class_id_or_signature,
const AbstractType destination_type,
const TypeArguments instance_type_arguments,
const TypeArguments instantiator_type_arguments,
const TypeArguments function_type_arguments,
const TypeArguments parent_function_type_arguments,
const TypeArguments delayed_type_arguments,
const Bool expected_result,
Bool got_result 
)
static

Definition at line 8274 of file object_test.cc.

8274 {
8275 // Since we sometimes use Array::NewUninitialized() for allocations of
8276 // STCs and never set unused inputs, the only thing we know is that the
8277 // entry is GC-safe. Since we don't expect valid values for unused inputs,
8278 // we just check if it's either a Smi or null.
8279 const intptr_t cid = array.At(entry_start + i)->GetClassIdMayBeSmi();
8280 EXPECT(cid == kSmiCid || cid == kNullCid);
8281 }
8282 }
8283}
8284
8285static void SubtypeTestCacheEntryTest(
8286 Thread* thread,
8287 const SubtypeTestCache& cache,
8288 const Object& instance_class_id_or_signature,
8289 const AbstractType& destination_type,
8290 const TypeArguments& instance_type_arguments,
8291 const TypeArguments& instantiator_type_arguments,
8292 const TypeArguments& function_type_arguments,
8293 const TypeArguments& parent_function_type_arguments,
8294 const TypeArguments& delayed_type_arguments,
8295 const Bool& expected_result,
8296 Bool* got_result) {
8297 const auto& tav_null = TypeArguments::null_type_arguments();
8298 const intptr_t num_inputs = cache.num_inputs();
8299 const bool was_hash = cache.IsHash();
8300 const intptr_t old_count = cache.NumberOfChecks();
8301 intptr_t expected_index, got_index;
8302
8303 EXPECT(!cache.HasCheck(
8304 instance_class_id_or_signature, destination_type, instance_type_arguments,
8305 instantiator_type_arguments, function_type_arguments,
8306 parent_function_type_arguments, delayed_type_arguments, /*index=*/nullptr,
8307 /*result=*/nullptr));
8308 {
8309 SafepointMutexLocker ml(
8310 thread->isolate_group()->subtype_test_cache_mutex());
8311 expected_index =
8312 cache.AddCheck(instance_class_id_or_signature, destination_type,
8313 instance_type_arguments, instantiator_type_arguments,
8314 function_type_arguments, parent_function_type_arguments,
8315 delayed_type_arguments, expected_result);
8316 EXPECT(expected_index >= 0);
8317 }
8318 EXPECT_EQ(old_count + 1, cache.NumberOfChecks());
8319 EXPECT(cache.HasCheck(instance_class_id_or_signature, destination_type,
8320 instance_type_arguments, instantiator_type_arguments,
8321 function_type_arguments, parent_function_type_arguments,
8322 delayed_type_arguments, &got_index, got_result));
8323 EXPECT_EQ(expected_index, got_index);
8324 EXPECT(got_result->ptr() == expected_result.ptr());
8325 if (num_inputs < (SubtypeTestCache::kInstanceTypeArguments + 1)) {
8326 // Match replacing unused instance type arguments with null.
8327 EXPECT(cache.HasCheck(instance_class_id_or_signature, destination_type,
8328 tav_null, instantiator_type_arguments,
8329 function_type_arguments,
8330 parent_function_type_arguments,
8331 delayed_type_arguments, &got_index, got_result));
8332 EXPECT_EQ(expected_index, got_index);
8333 EXPECT(got_result->ptr() == expected_result.ptr());
8334 } else {
8335 // No match replacing used instance type arguments with null.
8336 EXPECT(!cache.HasCheck(
8337 instance_class_id_or_signature, destination_type, tav_null,
8338 instantiator_type_arguments, function_type_arguments,
8339 parent_function_type_arguments, delayed_type_arguments,
8340 /*index=*/nullptr, /*result=*/nullptr));
8341 }
8342 if (num_inputs < (SubtypeTestCache::kInstantiatorTypeArguments + 1)) {
8343 // Match replacing unused instantiator type arguments with null.
8344 EXPECT(cache.HasCheck(instance_class_id_or_signature, destination_type,
8345 instance_type_arguments, tav_null,
8346 function_type_arguments,
8347 parent_function_type_arguments,
8348 delayed_type_arguments, &got_index, got_result));
8349 EXPECT_EQ(expected_index, got_index);
8350 EXPECT(got_result->ptr() == expected_result.ptr());
8351 } else {
8352 // No match replacing used instantiator type arguments with null.
8353 EXPECT(!cache.HasCheck(
8354 instance_class_id_or_signature, destination_type,
8355 instance_type_arguments, tav_null, function_type_arguments,
8356 parent_function_type_arguments, delayed_type_arguments,
8357 /*index=*/nullptr, /*result=*/nullptr));
8358 }
8359 if (num_inputs < (SubtypeTestCache::kFunctionTypeArguments + 1)) {
8360 // Match replacing unused function type arguments with null.
8361 EXPECT(cache.HasCheck(instance_class_id_or_signature, destination_type,
8362 instance_type_arguments, instantiator_type_arguments,
8363 tav_null, parent_function_type_arguments,
8364 delayed_type_arguments, &got_index, got_result));
8365 EXPECT_EQ(expected_index, got_index);
8366 EXPECT(got_result->ptr() == expected_result.ptr());
8367 } else {
8368 // No match replacing used function type arguments with null.
8369 EXPECT(!cache.HasCheck(instance_class_id_or_signature, destination_type,
8370 instance_type_arguments, instantiator_type_arguments,
8371 tav_null, parent_function_type_arguments,
8372 delayed_type_arguments,
8373 /*index=*/nullptr, /*result=*/nullptr));
8374 }
8375 if (num_inputs <
8376 (SubtypeTestCache::kInstanceParentFunctionTypeArguments + 1)) {
8377 // Match replacing unused parent function type arguments with null.
8378 EXPECT(cache.HasCheck(instance_class_id_or_signature, destination_type,
8379 instance_type_arguments, instantiator_type_arguments,
8380 function_type_arguments, tav_null,
8381 delayed_type_arguments, &got_index, got_result));
8382 EXPECT_EQ(expected_index, got_index);
8383 EXPECT(got_result->ptr() == expected_result.ptr());
8384 } else {
8385 // No match replacing used parent function type arguments with null.
8386 EXPECT(!cache.HasCheck(instance_class_id_or_signature, destination_type,
8387 instance_type_arguments, instantiator_type_arguments,
8388 function_type_arguments, tav_null,
8389 delayed_type_arguments, /*index=*/nullptr,
8390 /*result=*/nullptr));
8391 }
8392 if (num_inputs <
8393 (SubtypeTestCache::kInstanceDelayedFunctionTypeArguments + 1)) {
8394 // Match replacing unused delayed type arguments with null.
8395 EXPECT(cache.HasCheck(instance_class_id_or_signature, destination_type,
8396 instance_type_arguments, instantiator_type_arguments,
8397 function_type_arguments,
8398 parent_function_type_arguments, tav_null, &got_index,
8399 got_result));
8400 EXPECT_EQ(expected_index, got_index);
8401 EXPECT(got_result->ptr() == expected_result.ptr());
8402 } else {
8403 // No match replacing used delayed type arguments with null.
8404 EXPECT(!cache.HasCheck(instance_class_id_or_signature, destination_type,
8405 instance_type_arguments, instantiator_type_arguments,
8406 function_type_arguments,
8407 parent_function_type_arguments, tav_null,
8408 /*index=*/nullptr, /*result=*/nullptr));
8409 }
8410 // Make sure we're not accidentally using the same type as the input below.
8411 RELEASE_ASSERT(destination_type.ptr() != Type::VoidType());
8412 if (num_inputs < (SubtypeTestCache::kDestinationType + 1)) {
8413 // Match replacing unused destination type argument with the null type.
8414 EXPECT(cache.HasCheck(instance_class_id_or_signature, Object::void_type(),
8415 instance_type_arguments, instantiator_type_arguments,
8416 function_type_arguments,
8417 parent_function_type_arguments,
8418 delayed_type_arguments, &got_index, got_result));
8419 EXPECT_EQ(expected_index, got_index);
8420 EXPECT(got_result->ptr() == expected_result.ptr());
8421 } else {
static void SubtypeTestCacheEntryTest(Thread *thread, const SubtypeTestCache &cache, const Object &instance_class_id_or_signature, const AbstractType &destination_type, const TypeArguments &instance_type_arguments, const TypeArguments &instantiator_type_arguments, const TypeArguments &function_type_arguments, const TypeArguments &parent_function_type_arguments, const TypeArguments &delayed_type_arguments, const Bool &expected_result, Bool *got_result)

◆ SubtypeTestCacheTest()

static void dart::SubtypeTestCacheTest ( Thread thread,
intptr_t  num_classes,
bool  expect_hash 
)
static

Definition at line 8423 of file object_test.cc.

8436 {
8437 TextBuffer buffer(MB);
8438 buffer.AddString("class D {}\n");
8439 buffer.AddString("D createInstanceD() => D();");
8440 buffer.AddString("D Function() createClosureD() => () => D();\n");
8441 for (intptr_t i = 0; i < num_classes; i++) {
8442 buffer.Printf(R"(class C%)" Pd R"( extends D {}
8443)"
8444 R"(C%)" Pd R"( createInstanceC%)" Pd R"(() => C%)" Pd
8445 R"(();
8446)"
8447 R"(C%)" Pd R"( Function() createClosureC%)" Pd
8448 R"(() => () => C%)" Pd
8449 R"(();
8450)",
8451 i, i, i, i, i, i, i);
8452 }
8453
8454 Dart_Handle api_lib = TestCase::LoadTestScript(buffer.buffer(), nullptr);
8455 EXPECT_VALID(api_lib);
8456
8457 // D + C0...CN, where N = kNumClasses - 1
8458 EXPECT(IsolateGroup::Current()->class_table()->NumCids() > num_classes);
8459
8460 TransitionNativeToVM transition(thread);
8461 Zone* const zone = thread->zone();
8462
8463 const auto& root_lib =
8464 Library::CheckedHandle(zone, Api::UnwrapHandle(api_lib));
8465 EXPECT(!root_lib.IsNull());
8466
8467 const auto& class_d = Class::Handle(zone, GetClass(root_lib, "D"));
8468 ASSERT(!class_d.IsNull());
8469 {
8470 SafepointWriteRwLocker ml(thread, thread->isolate_group()->program_lock());
8471 ClassFinalizer::FinalizeClass(class_d);
8472 }
8473 const auto& instance_d =
8474 Instance::CheckedHandle(zone, Invoke(root_lib, "createInstanceD"));
8475 auto& type_instance_d_int =
8476 Type::CheckedHandle(zone, instance_d.GetType(Heap::kNew));
8477 const auto& closure_d =
8478 Instance::CheckedHandle(zone, Invoke(root_lib, "createClosureD"));
8479 ASSERT(!closure_d.IsNull());
8480 auto& type_closure_d_int =
8481 FunctionType::CheckedHandle(zone, closure_d.GetType(Heap::kNew));
8482
8483 // Test all the possible input values.
8484 const SubtypeTestCache* stcs[SubtypeTestCache::kMaxInputs];
8485 for (intptr_t i = 0; i < SubtypeTestCache::kMaxInputs; i++) {
8486 stcs[i] = &SubtypeTestCache::Handle(zone, SubtypeTestCache::New(i + 1));
8487 }
8488
8489 auto& class_c = Class::Handle(zone);
8490 auto& instance_c = Instance::Handle(zone);
8491 auto& closure_c = Closure::Handle(zone);
8492 auto& instance_class_id_or_signature = Object::Handle(zone);
8493 // Set up unique tavs for each of the TAV inputs.
8494 auto& instance_type_arguments =
8495 TypeArguments::Handle(zone, TypeArguments::New(1));
8496 instance_type_arguments.SetTypeAt(0, Type::Handle(zone, Type::SmiType()));
8497 instance_type_arguments = instance_type_arguments.Canonicalize(thread);
8498 auto& instantiator_type_arguments =
8499 TypeArguments::Handle(zone, TypeArguments::New(1));
8500 instantiator_type_arguments.SetTypeAt(0, Type::Handle(zone, Type::IntType()));
8501 instantiator_type_arguments =
8502 instantiator_type_arguments.Canonicalize(thread);
8503 auto& function_type_arguments =
8504 TypeArguments::Handle(zone, TypeArguments::New(1));
8505 function_type_arguments.SetTypeAt(0, Type::Handle(zone, Type::Double()));
8506 function_type_arguments = function_type_arguments.Canonicalize(thread);
8507 auto& parent_function_type_arguments =
8508 TypeArguments::Handle(zone, TypeArguments::New(1));
8509 parent_function_type_arguments.SetTypeAt(
8510 0, Type::Handle(zone, Type::StringType()));
8511 parent_function_type_arguments =
8512 parent_function_type_arguments.Canonicalize(thread);
8513 auto& delayed_type_arguments =
8514 TypeArguments::Handle(zone, TypeArguments::New(1));
8515 delayed_type_arguments.SetTypeAt(0, Type::Handle(zone, Type::BoolType()));
8516 delayed_type_arguments = delayed_type_arguments.Canonicalize(thread);
8517 auto& got_result = Bool::Handle(zone);
8518 for (intptr_t i = 0; i < num_classes; ++i) {
8519 // Just so we're testing both true and false values, as we're not actually
8520 // using the results to determine subtype/assignability.
8521 const auto& expected_result = (i % 2 == 0) ? Bool::True() : Bool::False();
8522
8523 auto const class_name = OS::SCreate(zone, "C%" Pd "", i);
8524 class_c = GetClass(root_lib, class_name);
8525 ASSERT(!class_c.IsNull());
8526 {
8527 SafepointWriteRwLocker ml(thread,
8528 thread->isolate_group()->program_lock());
8529 ClassFinalizer::FinalizeClass(class_c);
8530 }
8531 auto const instance_name = OS::SCreate(zone, "createInstanceC%" Pd "", i);
8532 instance_c ^= Invoke(root_lib, instance_name);
8533 EXPECT(!instance_c.IsClosure());
8534 instance_class_id_or_signature = Smi::New(instance_c.GetClassId());
8535
8536 for (intptr_t i = 0; i < 5; i++) {
8538 thread, *stcs[i], instance_class_id_or_signature, type_instance_d_int,
8539 instance_type_arguments, instantiator_type_arguments,
8540 function_type_arguments, parent_function_type_arguments,
8541 delayed_type_arguments, expected_result, &got_result);
8542 }
8543
8544 auto const function_name = OS::SCreate(zone, "createClosureC%" Pd "", i);
8545 closure_c ^= Invoke(root_lib, function_name);
8546
8547 instance_class_id_or_signature = closure_c.function();
8548 instance_class_id_or_signature =
8549 Function::Cast(instance_class_id_or_signature).signature();
8550

◆ SumFloatsAndDoubles()

DART_EXPORT double dart::SumFloatsAndDoubles ( float  a,
double  b,
float  c 
)

Definition at line 315 of file ffi_test_functions.cc.

315 {
316 std::cout << "SumFloatsAndDoubles(" << a << ", " << b << ", " << c << ")\n";
317 const double retval = a + b + c;
318 std::cout << "returning " << retval << "\n";
319 return retval;
320}

◆ SumManyDoubles()

DART_EXPORT double dart::SumManyDoubles ( double  a,
double  b,
double  c,
double  d,
double  e,
double  f,
double  g,
double  h,
double  i,
double  j 
)

Definition at line 484 of file ffi_test_functions.cc.

493 {
494 std::cout << "SumManyDoubles(" << a << ", " << b << ", " << c << ", " << d
495 << ", " << e << ", " << f << ", " << g << ", " << h << ", " << i
496 << ", " << j << ")\n";
497 const double retval = a + b + c + d + e + f + g + h + i + j;
498 std::cout << "returning " << retval << "\n";
499 return retval;
500}

◆ SumManyInts()

DART_EXPORT intptr_t dart::SumManyInts ( intptr_t  a,
intptr_t  b,
intptr_t  c,
intptr_t  d,
intptr_t  e,
intptr_t  f,
intptr_t  g,
intptr_t  h,
intptr_t  i,
intptr_t  j 
)

Definition at line 274 of file ffi_test_functions.cc.

283 {
284 std::cout << "SumManyInts(" << a << ", " << b << ", " << c << ", " << d
285 << ", " << e << ", " << f << ", " << g << ", " << h << ", " << i
286 << ", " << j << ")\n";
287 const intptr_t retval = a + b + c + d + e + f + g + h + i + j;
288 std::cout << "returning " << retval << "\n";
289 return retval;
290}

◆ SumManyIntsOdd()

DART_EXPORT intptr_t dart::SumManyIntsOdd ( intptr_t  a,
intptr_t  b,
intptr_t  c,
intptr_t  d,
intptr_t  e,
intptr_t  f,
intptr_t  g,
intptr_t  h,
intptr_t  i,
intptr_t  j,
intptr_t  k 
)

Definition at line 456 of file ffi_test_functions.cc.

466 {
467 std::cout << "SumManyInts(" << a << ", " << b << ", " << c << ", " << d
468 << ", " << e << ", " << f << ", " << g << ", " << h << ", " << i
469 << ", " << j << ", " << k << ")\n";
470 const intptr_t retval =
471 static_cast<uintptr_t>(a) + static_cast<uintptr_t>(b) +
472 static_cast<uintptr_t>(c) + static_cast<uintptr_t>(d) +
473 static_cast<uintptr_t>(e) + static_cast<uintptr_t>(f) +
474 static_cast<uintptr_t>(g) + static_cast<uintptr_t>(h) +
475 static_cast<uintptr_t>(i) + static_cast<uintptr_t>(j) +
476 static_cast<uintptr_t>(k);
477 std::cout << "returning " << retval << "\n";
478 return retval;
479}

◆ SumManyNumbers()

DART_EXPORT double dart::SumManyNumbers ( intptr_t  a,
float  b,
intptr_t  c,
double  d,
intptr_t  e,
float  f,
intptr_t  g,
double  h,
intptr_t  i,
float  j,
intptr_t  k,
double  l,
intptr_t  m,
float  n,
intptr_t  o,
double  p,
intptr_t  q,
float  r,
intptr_t  s,
double  t 
)

Definition at line 505 of file ffi_test_functions.cc.

524 {
525 std::cout << "SumManyNumbers(" << a << ", " << b << ", " << c << ", " << d
526 << ", " << e << ", " << f << ", " << g << ", " << h << ", " << i
527 << ", " << j << ", " << k << ", " << l << ", " << m << ", " << n
528 << ", " << o << ", " << p << ", " << q << ", " << r << ", " << s
529 << ", " << t << ")\n";
530 const double retval = a + b + c + d + e + f + g + h + i + j + k + l + m + n +
531 o + p + q + r + s + t;
532 std::cout << "returning " << retval << "\n";
533 return retval;
534}

◆ SumManySmallInts()

DART_EXPORT int16_t dart::SumManySmallInts ( int8_t  a,
int16_t  b,
int8_t  c,
int16_t  d,
int8_t  e,
int16_t  f,
int8_t  g,
int16_t  h,
int8_t  i,
int16_t  j 
)

Definition at line 295 of file ffi_test_functions.cc.

304 {
305 std::cout << "SumManySmallInts(" << static_cast<int>(a) << ", " << b << ", "
306 << static_cast<int>(c) << ", " << d << ", " << static_cast<int>(e)
307 << ", " << f << ", " << static_cast<int>(g) << ", " << h << ", "
308 << static_cast<int>(i) << ", " << j << ")\n";
309 const int16_t retval = a + b + c + d + e + f + g + h + i + j;
310 std::cout << "returning " << retval << "\n";
311 return retval;
312}

◆ SumPlus42()

DART_EXPORT int32_t dart::SumPlus42 ( int32_t  a,
int32_t  b 
)

Definition at line 71 of file ffi_test_functions.cc.

71 {
72 std::cout << "SumPlus42(" << a << ", " << b << ")\n";
73 const int32_t retval = 42 + a + b;
74 std::cout << "returning " << retval << "\n";
75 return retval;
76}

◆ SumReturnStruct9Uint8()

DART_EXPORT int64_t dart::SumReturnStruct9Uint8 ( Struct9Uint8(*)(Struct9Uint8 *)  callback,
Struct9Uint8 in 
)

Definition at line 736 of file ffi_test_functions.cc.

737 {
738 std::cout << "SumReturnStruct9Uint8 in (" << in->a0 << ", " << in->a1 << ", "
739 << in->a2 << ", " << in->a3 << ", " << in->a4 << ", " << in->a5
740 << ", " << in->a6 << ", " << in->a7 << ", " << in->a8 << ")\n";
741
742 Struct9Uint8 out = callback(in);
743
744 std::cout << "SumReturnStruct9Uint8 out (" << out.a0 << ", " << out.a1 << ", "
745 << out.a2 << ", " << out.a3 << ", " << out.a4 << ", " << out.a5
746 << ", " << out.a6 << ", " << out.a7 << ", " << out.a8 << ")\n";
747
748 return out.a0 + out.a1 + out.a2 + out.a3 + out.a4 + out.a5 + out.a6 + out.a7 +
749 out.a8;
750}

◆ SumSmallNumbers()

DART_EXPORT int64_t dart::SumSmallNumbers ( int8_t  a,
int16_t  b,
int32_t  c,
uint8_t  d,
uint16_t  e,
uint32_t  f 
)

Definition at line 792 of file ffi_test_functions.cc.

797 {
798 std::cout << "SumSmallNumbers(" << static_cast<int>(a) << ", " << b << ", "
799 << c << ", " << static_cast<int>(d) << ", " << e << ", " << f
800 << ")\n";
801 int64_t retval = 0;
802 retval += a;
803 retval += b;
804 retval += c;
805 retval += d;
806 retval += e;
807 retval += f;
808 std::cout << "returning " << retval << "\n";
809 return retval;
810}

◆ SumStruct9Uint8()

DART_EXPORT int64_t dart::SumStruct9Uint8 ( Struct9Uint8  s9)

Definition at line 731 of file ffi_test_functions.cc.

731 {
732 return s9.a0 + s9.a1 + s9.a2 + s9.a3 + s9.a4 + s9.a5 + s9.a6 + s9.a7 + s9.a8;
733}

◆ SumVeryLargeStruct()

DART_EXPORT int64_t dart::SumVeryLargeStruct ( VeryLargeStruct vls)

Definition at line 653 of file ffi_test_functions.cc.

653 {
654 std::cout << "SumVeryLargeStruct(" << vls << ")\n";
655 std::cout << "offsetof(a): " << offsetof(VeryLargeStruct, a) << "\n";
656 std::cout << "offsetof(b): " << offsetof(VeryLargeStruct, b) << "\n";
657 std::cout << "offsetof(c): " << offsetof(VeryLargeStruct, c) << "\n";
658 std::cout << "offsetof(d): " << offsetof(VeryLargeStruct, d) << "\n";
659 std::cout << "offsetof(e): " << offsetof(VeryLargeStruct, e) << "\n";
660 std::cout << "offsetof(f): " << offsetof(VeryLargeStruct, f) << "\n";
661 std::cout << "offsetof(g): " << offsetof(VeryLargeStruct, g) << "\n";
662 std::cout << "offsetof(h): " << offsetof(VeryLargeStruct, h) << "\n";
663 std::cout << "offsetof(i): " << offsetof(VeryLargeStruct, i) << "\n";
664 std::cout << "offsetof(j): " << offsetof(VeryLargeStruct, j) << "\n";
665 std::cout << "offsetof(k): " << offsetof(VeryLargeStruct, k) << "\n";
666 std::cout << "offsetof(parent): " << offsetof(VeryLargeStruct, parent)
667 << "\n";
668 std::cout << "offsetof(numChildren): "
669 << offsetof(VeryLargeStruct, numChildren) << "\n";
670 std::cout << "offsetof(children): " << offsetof(VeryLargeStruct, children)
671 << "\n";
672 std::cout << "offsetof(smallLastField): "
673 << offsetof(VeryLargeStruct, smallLastField) << "\n";
674 std::cout << "sizeof(VeryLargeStruct): " << sizeof(VeryLargeStruct) << "\n";
675
676 std::cout << "vls->a: " << static_cast<int>(vls->a) << "\n";
677 std::cout << "vls->b: " << vls->b << "\n";
678 std::cout << "vls->c: " << vls->c << "\n";
679 std::cout << "vls->d: " << vls->d << "\n";
680 std::cout << "vls->e: " << static_cast<int>(vls->e) << "\n";
681 std::cout << "vls->f: " << vls->f << "\n";
682 std::cout << "vls->g: " << vls->g << "\n";
683 std::cout << "vls->h: " << vls->h << "\n";
684 std::cout << "vls->i: " << vls->i << "\n";
685 std::cout << "vls->j: " << vls->j << "\n";
686 std::cout << "vls->k: " << vls->k << "\n";
687 std::cout << "vls->parent: " << vls->parent << "\n";
688 std::cout << "vls->numChildren: " << vls->numChildren << "\n";
689 std::cout << "vls->children: " << vls->children << "\n";
690 std::cout << "vls->smallLastField: " << static_cast<int>(vls->smallLastField)
691 << "\n";
692
693 int64_t retval = 0;
694 retval += 0x0L + vls->a;
695 retval += vls->b;
696 retval += vls->c;
697 retval += vls->d;
698 retval += vls->e;
699 retval += vls->f;
700 retval += vls->g;
701 retval += vls->h;
702 retval += vls->i;
703 retval += vls->j;
704 retval += vls->k;
705 retval += vls->smallLastField;
706 std::cout << retval << "\n";
707 if (vls->parent != nullptr) {
708 std::cout << "has parent\n";
709 retval += vls->parent->a;
710 }
711 std::cout << "has " << vls->numChildren << " children\n";
712 for (intptr_t i = 0; i < vls->numChildren; i++) {
713 retval += vls->children[i].a;
714 }
715 std::cout << "returning " << retval << "\n";
716 return retval;
717}

◆ SumVeryManyFloatsDoubles()

DART_EXPORT double dart::SumVeryManyFloatsDoubles ( float  a01,
double  a02,
float  a03,
double  a04,
float  a05,
double  a06,
float  a07,
double  a08,
float  a09,
double  a10,
float  a11,
double  a12,
float  a13,
double  a14,
float  a15,
double  a16,
float  a17,
double  a18,
float  a19,
double  a20,
float  a21,
double  a22,
float  a23,
double  a24,
float  a25,
double  a26,
float  a27,
double  a28,
float  a29,
double  a30,
float  a31,
double  a32,
float  a33,
double  a34,
float  a35,
double  a36,
float  a37,
double  a38,
float  a39,
double  a40 
)

Definition at line 394 of file ffi_test_functions.cc.

433 {
434 std::cout << "SumVeryManyFloatsDoubles(" << a01 << ", " << a02 << ", " << a03
435 << ", " << a04 << ", " << a05 << ", " << a06 << ", " << a07 << ", "
436 << a08 << ", " << a09 << ", " << a10 << ", " << a11 << ", " << a12
437 << ", " << a13 << ", " << a14 << ", " << a15 << ", " << a16 << ", "
438 << a17 << ", " << a18 << ", " << a19 << ", " << a20 << ", " << a21
439 << ", " << a22 << ", " << a23 << ", " << a24 << ", " << a25 << ", "
440 << a26 << ", " << a27 << ", " << a28 << ", " << a29 << ", " << a30
441 << ", " << a31 << ", " << a32 << ", " << a33 << ", " << a34 << ", "
442 << a35 << ", " << a36 << ", " << a37 << ", " << a38 << ", " << a39
443 << ", " << a40 << ")\n";
444 const double retval = a01 + a02 + a03 + a04 + a05 + a06 + a07 + a08 + a09 +
445 a10 + a11 + a12 + a13 + a14 + a15 + a16 + a17 + a18 +
446 a19 + a20 + a21 + a22 + a23 + a24 + a25 + a26 + a27 +
447 a28 + a29 + a30 + a31 + a32 + a33 + a34 + a35 + a36 +
448 a37 + a38 + a39 + a40;
449 std::cout << "returning " << retval << "\n";
450 return retval;
451}

◆ SumVeryManySmallInts()

DART_EXPORT int16_t dart::SumVeryManySmallInts ( int8_t  a01,
int16_t  a02,
int8_t  a03,
int16_t  a04,
int8_t  a05,
int16_t  a06,
int8_t  a07,
int16_t  a08,
int8_t  a09,
int16_t  a10,
int8_t  a11,
int16_t  a12,
int8_t  a13,
int16_t  a14,
int8_t  a15,
int16_t  a16,
int8_t  a17,
int16_t  a18,
int8_t  a19,
int16_t  a20,
int8_t  a21,
int16_t  a22,
int8_t  a23,
int16_t  a24,
int8_t  a25,
int16_t  a26,
int8_t  a27,
int16_t  a28,
int8_t  a29,
int16_t  a30,
int8_t  a31,
int16_t  a32,
int8_t  a33,
int16_t  a34,
int8_t  a35,
int16_t  a36,
int8_t  a37,
int16_t  a38,
int8_t  a39,
int16_t  a40 
)

Definition at line 323 of file ffi_test_functions.cc.

362 {
363 std::cout << "SumVeryManySmallInts(" << static_cast<int>(a01) << ", " << a02
364 << ", " << static_cast<int>(a03) << ", " << a04 << ", "
365 << static_cast<int>(a05) << ", " << a06 << ", "
366 << static_cast<int>(a07) << ", " << a08 << ", "
367 << static_cast<int>(a09) << ", " << a10 << ", "
368 << static_cast<int>(a11) << ", " << a12 << ", "
369 << static_cast<int>(a13) << ", " << a14 << ", "
370 << static_cast<int>(a15) << ", " << a16 << ", "
371 << static_cast<int>(a17) << ", " << a18 << ", "
372 << static_cast<int>(a19) << ", " << a20 << ", "
373 << static_cast<int>(a21) << ", " << a22 << ", "
374 << static_cast<int>(a23) << ", " << a24 << ", "
375 << static_cast<int>(a25) << ", " << a26 << ", "
376 << static_cast<int>(a27) << ", " << a28 << ", "
377 << static_cast<int>(a29) << ", " << a30 << ", "
378 << static_cast<int>(a31) << ", " << a32 << ", "
379 << static_cast<int>(a33) << ", " << a34 << ", "
380 << static_cast<int>(a35) << ", " << a36 << ", "
381 << static_cast<int>(a37) << ", " << a38 << ", "
382 << static_cast<int>(a39) << ", " << a40 << ")\n";
383 const int16_t retval = a01 + a02 + a03 + a04 + a05 + a06 + a07 + a08 + a09 +
384 a10 + a11 + a12 + a13 + a14 + a15 + a16 + a17 + a18 +
385 a19 + a20 + a21 + a22 + a23 + a24 + a25 + a26 + a27 +
386 a28 + a29 + a30 + a31 + a32 + a33 + a34 + a35 + a36 +
387 a37 + a38 + a39 + a40;
388 std::cout << "returning " << retval << "\n";
389 return retval;
390}

◆ SymbolExists()

static bool dart::SymbolExists ( void *  handle,
const char *  symbol 
)
static

Definition at line 145 of file ffi_dynamic_library.cc.

145 {
146 char* error = nullptr;
147#if !defined(DART_HOST_OS_WINDOWS)
148 Utils::ResolveSymbolInDynamicLibrary(handle, symbol, &error);
149#else
150 if (handle == nullptr) {
151 LookupSymbolInProcess(symbol, &error);
152 } else {
153 Utils::ResolveSymbolInDynamicLibrary(handle, symbol, &error);
154 }
155#endif
156 if (error != nullptr) {
157 free(error);
158 return false;
159 }
160 return true;
161}

◆ TagsFromUntaggedObject()

DART_FORCE_INLINE uword dart::TagsFromUntaggedObject ( UntaggedObject obj)

Definition at line 224 of file object_graph_copy.cc.

224 {
225 return obj->tags_;
226}

◆ TakeBoolPointer()

DART_EXPORT bool dart::TakeBoolPointer ( bool *  data,
size_t  length 
)

Definition at line 810 of file ffi_test_functions_generated_2.cc.

810 {
811 bool result = false;
812 if (length > 100) {
813 std::cout << "Mangled arguments\n";
814 return result;
815 }
816 for (size_t i = 0; i < length; i++) {
817 std::cout << "data[" << i << "] = " << static_cast<int>(data[i]) << "\n";
818 result ^= static_cast<int>(data[i]);
819 }
820 return result;
821}

◆ TakeBoolPointerMany()

DART_EXPORT bool dart::TakeBoolPointerMany ( bool *  data0,
bool *  data1,
bool *  data2,
bool *  data3,
bool *  data4,
bool *  data5,
bool *  data6,
bool *  data7,
bool *  data8,
bool *  data9,
bool *  data10,
bool *  data11,
bool *  data12,
bool *  data13,
bool *  data14,
bool *  data15,
bool *  data16,
bool *  data17,
bool *  data18,
bool *  data19 
)

Definition at line 823 of file ffi_test_functions_generated_2.cc.

842 {
843 bool result = false;
844 std::cout << "data0[0] = " << static_cast<int>(data0[0]) << "\n";
845 result ^= static_cast<int>(data0[0]);
846 std::cout << "data1[0] = " << static_cast<int>(data1[0]) << "\n";
847 result ^= static_cast<int>(data1[0]);
848 std::cout << "data2[0] = " << static_cast<int>(data2[0]) << "\n";
849 result ^= static_cast<int>(data2[0]);
850 std::cout << "data3[0] = " << static_cast<int>(data3[0]) << "\n";
851 result ^= static_cast<int>(data3[0]);
852 std::cout << "data4[0] = " << static_cast<int>(data4[0]) << "\n";
853 result ^= static_cast<int>(data4[0]);
854 std::cout << "data5[0] = " << static_cast<int>(data5[0]) << "\n";
855 result ^= static_cast<int>(data5[0]);
856 std::cout << "data6[0] = " << static_cast<int>(data6[0]) << "\n";
857 result ^= static_cast<int>(data6[0]);
858 std::cout << "data7[0] = " << static_cast<int>(data7[0]) << "\n";
859 result ^= static_cast<int>(data7[0]);
860 std::cout << "data8[0] = " << static_cast<int>(data8[0]) << "\n";
861 result ^= static_cast<int>(data8[0]);
862 std::cout << "data9[0] = " << static_cast<int>(data9[0]) << "\n";
863 result ^= static_cast<int>(data9[0]);
864 std::cout << "data10[0] = " << static_cast<int>(data10[0]) << "\n";
865 result ^= static_cast<int>(data10[0]);
866 std::cout << "data11[0] = " << static_cast<int>(data11[0]) << "\n";
867 result ^= static_cast<int>(data11[0]);
868 std::cout << "data12[0] = " << static_cast<int>(data12[0]) << "\n";
869 result ^= static_cast<int>(data12[0]);
870 std::cout << "data13[0] = " << static_cast<int>(data13[0]) << "\n";
871 result ^= static_cast<int>(data13[0]);
872 std::cout << "data14[0] = " << static_cast<int>(data14[0]) << "\n";
873 result ^= static_cast<int>(data14[0]);
874 std::cout << "data15[0] = " << static_cast<int>(data15[0]) << "\n";
875 result ^= static_cast<int>(data15[0]);
876 std::cout << "data16[0] = " << static_cast<int>(data16[0]) << "\n";
877 result ^= static_cast<int>(data16[0]);
878 std::cout << "data17[0] = " << static_cast<int>(data17[0]) << "\n";
879 result ^= static_cast<int>(data17[0]);
880 std::cout << "data18[0] = " << static_cast<int>(data18[0]) << "\n";
881 result ^= static_cast<int>(data18[0]);
882 std::cout << "data19[0] = " << static_cast<int>(data19[0]) << "\n";
883 result ^= static_cast<int>(data19[0]);
884 return result;
885}

◆ TakeDartVmNode()

std::unique_ptr< inspect::Node > dart::TakeDartVmNode ( )

◆ TakeDoublePointer()

DART_EXPORT double dart::TakeDoublePointer ( double *  data,
size_t  length 
)

Definition at line 733 of file ffi_test_functions_generated_2.cc.

733 {
734 double result = 0.0;
735 if (length > 100) {
736 std::cout << "Mangled arguments\n";
737 return result;
738 }
739 for (size_t i = 0; i < length; i++) {
740 std::cout << "data[" << i << "] = " << data[i] << "\n";
741 result += data[i];
742 }
743 return result;
744}

◆ TakeDoublePointerMany()

DART_EXPORT double dart::TakeDoublePointerMany ( double *  data0,
double *  data1,
double *  data2,
double *  data3,
double *  data4,
double *  data5,
double *  data6,
double *  data7,
double *  data8,
double *  data9,
double *  data10,
double *  data11,
double *  data12,
double *  data13,
double *  data14,
double *  data15,
double *  data16,
double *  data17,
double *  data18,
double *  data19 
)

Definition at line 746 of file ffi_test_functions_generated_2.cc.

765 {
766 double result = 0.0;
767 std::cout << "data0[0] = " << data0[0] << "\n";
768 result += data0[0];
769 std::cout << "data1[0] = " << data1[0] << "\n";
770 result += data1[0];
771 std::cout << "data2[0] = " << data2[0] << "\n";
772 result += data2[0];
773 std::cout << "data3[0] = " << data3[0] << "\n";
774 result += data3[0];
775 std::cout << "data4[0] = " << data4[0] << "\n";
776 result += data4[0];
777 std::cout << "data5[0] = " << data5[0] << "\n";
778 result += data5[0];
779 std::cout << "data6[0] = " << data6[0] << "\n";
780 result += data6[0];
781 std::cout << "data7[0] = " << data7[0] << "\n";
782 result += data7[0];
783 std::cout << "data8[0] = " << data8[0] << "\n";
784 result += data8[0];
785 std::cout << "data9[0] = " << data9[0] << "\n";
786 result += data9[0];
787 std::cout << "data10[0] = " << data10[0] << "\n";
788 result += data10[0];
789 std::cout << "data11[0] = " << data11[0] << "\n";
790 result += data11[0];
791 std::cout << "data12[0] = " << data12[0] << "\n";
792 result += data12[0];
793 std::cout << "data13[0] = " << data13[0] << "\n";
794 result += data13[0];
795 std::cout << "data14[0] = " << data14[0] << "\n";
796 result += data14[0];
797 std::cout << "data15[0] = " << data15[0] << "\n";
798 result += data15[0];
799 std::cout << "data16[0] = " << data16[0] << "\n";
800 result += data16[0];
801 std::cout << "data17[0] = " << data17[0] << "\n";
802 result += data17[0];
803 std::cout << "data18[0] = " << data18[0] << "\n";
804 result += data18[0];
805 std::cout << "data19[0] = " << data19[0] << "\n";
806 result += data19[0];
807 return result;
808}

◆ TakeFloatPointer()

DART_EXPORT float dart::TakeFloatPointer ( float *  data,
size_t  length 
)

Definition at line 656 of file ffi_test_functions_generated_2.cc.

656 {
657 float result = 0.0;
658 if (length > 100) {
659 std::cout << "Mangled arguments\n";
660 return result;
661 }
662 for (size_t i = 0; i < length; i++) {
663 std::cout << "data[" << i << "] = " << data[i] << "\n";
664 result += data[i];
665 }
666 return result;
667}

◆ TakeFloatPointerMany()

DART_EXPORT float dart::TakeFloatPointerMany ( float *  data0,
float *  data1,
float *  data2,
float *  data3,
float *  data4,
float *  data5,
float *  data6,
float *  data7,
float *  data8,
float *  data9,
float *  data10,
float *  data11,
float *  data12,
float *  data13,
float *  data14,
float *  data15,
float *  data16,
float *  data17,
float *  data18,
float *  data19 
)

Definition at line 669 of file ffi_test_functions_generated_2.cc.

688 {
689 float result = 0.0;
690 std::cout << "data0[0] = " << data0[0] << "\n";
691 result += data0[0];
692 std::cout << "data1[0] = " << data1[0] << "\n";
693 result += data1[0];
694 std::cout << "data2[0] = " << data2[0] << "\n";
695 result += data2[0];
696 std::cout << "data3[0] = " << data3[0] << "\n";
697 result += data3[0];
698 std::cout << "data4[0] = " << data4[0] << "\n";
699 result += data4[0];
700 std::cout << "data5[0] = " << data5[0] << "\n";
701 result += data5[0];
702 std::cout << "data6[0] = " << data6[0] << "\n";
703 result += data6[0];
704 std::cout << "data7[0] = " << data7[0] << "\n";
705 result += data7[0];
706 std::cout << "data8[0] = " << data8[0] << "\n";
707 result += data8[0];
708 std::cout << "data9[0] = " << data9[0] << "\n";
709 result += data9[0];
710 std::cout << "data10[0] = " << data10[0] << "\n";
711 result += data10[0];
712 std::cout << "data11[0] = " << data11[0] << "\n";
713 result += data11[0];
714 std::cout << "data12[0] = " << data12[0] << "\n";
715 result += data12[0];
716 std::cout << "data13[0] = " << data13[0] << "\n";
717 result += data13[0];
718 std::cout << "data14[0] = " << data14[0] << "\n";
719 result += data14[0];
720 std::cout << "data15[0] = " << data15[0] << "\n";
721 result += data15[0];
722 std::cout << "data16[0] = " << data16[0] << "\n";
723 result += data16[0];
724 std::cout << "data17[0] = " << data17[0] << "\n";
725 result += data17[0];
726 std::cout << "data18[0] = " << data18[0] << "\n";
727 result += data18[0];
728 std::cout << "data19[0] = " << data19[0] << "\n";
729 result += data19[0];
730 return result;
731}

◆ TakeInt16Pointer()

DART_EXPORT int16_t dart::TakeInt16Pointer ( int16_t *  data,
size_t  length 
)

Definition at line 117 of file ffi_test_functions_generated_2.cc.

117 {
118 int16_t result = 0;
119 if (length > 100) {
120 std::cout << "Mangled arguments\n";
121 return result;
122 }
123 for (size_t i = 0; i < length; i++) {
124 std::cout << "data[" << i << "] = " << data[i] << "\n";
125 result += data[i];
126 }
127 return result;
128}

◆ TakeInt16PointerMany()

DART_EXPORT int16_t dart::TakeInt16PointerMany ( int16_t *  data0,
int16_t *  data1,
int16_t *  data2,
int16_t *  data3,
int16_t *  data4,
int16_t *  data5,
int16_t *  data6,
int16_t *  data7,
int16_t *  data8,
int16_t *  data9,
int16_t *  data10,
int16_t *  data11,
int16_t *  data12,
int16_t *  data13,
int16_t *  data14,
int16_t *  data15,
int16_t *  data16,
int16_t *  data17,
int16_t *  data18,
int16_t *  data19 
)

Definition at line 130 of file ffi_test_functions_generated_2.cc.

149 {
150 int16_t result = 0;
151 std::cout << "data0[0] = " << data0[0] << "\n";
152 result += data0[0];
153 std::cout << "data1[0] = " << data1[0] << "\n";
154 result += data1[0];
155 std::cout << "data2[0] = " << data2[0] << "\n";
156 result += data2[0];
157 std::cout << "data3[0] = " << data3[0] << "\n";
158 result += data3[0];
159 std::cout << "data4[0] = " << data4[0] << "\n";
160 result += data4[0];
161 std::cout << "data5[0] = " << data5[0] << "\n";
162 result += data5[0];
163 std::cout << "data6[0] = " << data6[0] << "\n";
164 result += data6[0];
165 std::cout << "data7[0] = " << data7[0] << "\n";
166 result += data7[0];
167 std::cout << "data8[0] = " << data8[0] << "\n";
168 result += data8[0];
169 std::cout << "data9[0] = " << data9[0] << "\n";
170 result += data9[0];
171 std::cout << "data10[0] = " << data10[0] << "\n";
172 result += data10[0];
173 std::cout << "data11[0] = " << data11[0] << "\n";
174 result += data11[0];
175 std::cout << "data12[0] = " << data12[0] << "\n";
176 result += data12[0];
177 std::cout << "data13[0] = " << data13[0] << "\n";
178 result += data13[0];
179 std::cout << "data14[0] = " << data14[0] << "\n";
180 result += data14[0];
181 std::cout << "data15[0] = " << data15[0] << "\n";
182 result += data15[0];
183 std::cout << "data16[0] = " << data16[0] << "\n";
184 result += data16[0];
185 std::cout << "data17[0] = " << data17[0] << "\n";
186 result += data17[0];
187 std::cout << "data18[0] = " << data18[0] << "\n";
188 result += data18[0];
189 std::cout << "data19[0] = " << data19[0] << "\n";
190 result += data19[0];
191 return result;
192}

◆ TakeInt32Pointer()

DART_EXPORT int32_t dart::TakeInt32Pointer ( int32_t *  data,
size_t  length 
)

Definition at line 194 of file ffi_test_functions_generated_2.cc.

194 {
195 int32_t result = 0;
196 if (length > 100) {
197 std::cout << "Mangled arguments\n";
198 return result;
199 }
200 for (size_t i = 0; i < length; i++) {
201 std::cout << "data[" << i << "] = " << data[i] << "\n";
202 result += data[i];
203 }
204 return result;
205}

◆ TakeInt32PointerMany()

DART_EXPORT int32_t dart::TakeInt32PointerMany ( int32_t *  data0,
int32_t *  data1,
int32_t *  data2,
int32_t *  data3,
int32_t *  data4,
int32_t *  data5,
int32_t *  data6,
int32_t *  data7,
int32_t *  data8,
int32_t *  data9,
int32_t *  data10,
int32_t *  data11,
int32_t *  data12,
int32_t *  data13,
int32_t *  data14,
int32_t *  data15,
int32_t *  data16,
int32_t *  data17,
int32_t *  data18,
int32_t *  data19 
)

Definition at line 207 of file ffi_test_functions_generated_2.cc.

226 {
227 int32_t result = 0;
228 std::cout << "data0[0] = " << data0[0] << "\n";
229 result += data0[0];
230 std::cout << "data1[0] = " << data1[0] << "\n";
231 result += data1[0];
232 std::cout << "data2[0] = " << data2[0] << "\n";
233 result += data2[0];
234 std::cout << "data3[0] = " << data3[0] << "\n";
235 result += data3[0];
236 std::cout << "data4[0] = " << data4[0] << "\n";
237 result += data4[0];
238 std::cout << "data5[0] = " << data5[0] << "\n";
239 result += data5[0];
240 std::cout << "data6[0] = " << data6[0] << "\n";
241 result += data6[0];
242 std::cout << "data7[0] = " << data7[0] << "\n";
243 result += data7[0];
244 std::cout << "data8[0] = " << data8[0] << "\n";
245 result += data8[0];
246 std::cout << "data9[0] = " << data9[0] << "\n";
247 result += data9[0];
248 std::cout << "data10[0] = " << data10[0] << "\n";
249 result += data10[0];
250 std::cout << "data11[0] = " << data11[0] << "\n";
251 result += data11[0];
252 std::cout << "data12[0] = " << data12[0] << "\n";
253 result += data12[0];
254 std::cout << "data13[0] = " << data13[0] << "\n";
255 result += data13[0];
256 std::cout << "data14[0] = " << data14[0] << "\n";
257 result += data14[0];
258 std::cout << "data15[0] = " << data15[0] << "\n";
259 result += data15[0];
260 std::cout << "data16[0] = " << data16[0] << "\n";
261 result += data16[0];
262 std::cout << "data17[0] = " << data17[0] << "\n";
263 result += data17[0];
264 std::cout << "data18[0] = " << data18[0] << "\n";
265 result += data18[0];
266 std::cout << "data19[0] = " << data19[0] << "\n";
267 result += data19[0];
268 return result;
269}

◆ TakeInt64Pointer()

DART_EXPORT int64_t dart::TakeInt64Pointer ( int64_t *  data,
size_t  length 
)

Definition at line 271 of file ffi_test_functions_generated_2.cc.

271 {
272 int64_t result = 0;
273 if (length > 100) {
274 std::cout << "Mangled arguments\n";
275 return result;
276 }
277 for (size_t i = 0; i < length; i++) {
278 std::cout << "data[" << i << "] = " << data[i] << "\n";
279 result += data[i];
280 }
281 return result;
282}

◆ TakeInt64PointerMany()

DART_EXPORT int64_t dart::TakeInt64PointerMany ( int64_t *  data0,
int64_t *  data1,
int64_t *  data2,
int64_t *  data3,
int64_t *  data4,
int64_t *  data5,
int64_t *  data6,
int64_t *  data7,
int64_t *  data8,
int64_t *  data9,
int64_t *  data10,
int64_t *  data11,
int64_t *  data12,
int64_t *  data13,
int64_t *  data14,
int64_t *  data15,
int64_t *  data16,
int64_t *  data17,
int64_t *  data18,
int64_t *  data19 
)

Definition at line 284 of file ffi_test_functions_generated_2.cc.

303 {
304 int64_t result = 0;
305 std::cout << "data0[0] = " << data0[0] << "\n";
306 result += data0[0];
307 std::cout << "data1[0] = " << data1[0] << "\n";
308 result += data1[0];
309 std::cout << "data2[0] = " << data2[0] << "\n";
310 result += data2[0];
311 std::cout << "data3[0] = " << data3[0] << "\n";
312 result += data3[0];
313 std::cout << "data4[0] = " << data4[0] << "\n";
314 result += data4[0];
315 std::cout << "data5[0] = " << data5[0] << "\n";
316 result += data5[0];
317 std::cout << "data6[0] = " << data6[0] << "\n";
318 result += data6[0];
319 std::cout << "data7[0] = " << data7[0] << "\n";
320 result += data7[0];
321 std::cout << "data8[0] = " << data8[0] << "\n";
322 result += data8[0];
323 std::cout << "data9[0] = " << data9[0] << "\n";
324 result += data9[0];
325 std::cout << "data10[0] = " << data10[0] << "\n";
326 result += data10[0];
327 std::cout << "data11[0] = " << data11[0] << "\n";
328 result += data11[0];
329 std::cout << "data12[0] = " << data12[0] << "\n";
330 result += data12[0];
331 std::cout << "data13[0] = " << data13[0] << "\n";
332 result += data13[0];
333 std::cout << "data14[0] = " << data14[0] << "\n";
334 result += data14[0];
335 std::cout << "data15[0] = " << data15[0] << "\n";
336 result += data15[0];
337 std::cout << "data16[0] = " << data16[0] << "\n";
338 result += data16[0];
339 std::cout << "data17[0] = " << data17[0] << "\n";
340 result += data17[0];
341 std::cout << "data18[0] = " << data18[0] << "\n";
342 result += data18[0];
343 std::cout << "data19[0] = " << data19[0] << "\n";
344 result += data19[0];
345 return result;
346}

◆ TakeInt8Pointer()

DART_EXPORT int8_t dart::TakeInt8Pointer ( int8_t *  data,
size_t  length 
)

Definition at line 40 of file ffi_test_functions_generated_2.cc.

40 {
41 int8_t result = 0;
42 if (length > 100) {
43 std::cout << "Mangled arguments\n";
44 return result;
45 }
46 for (size_t i = 0; i < length; i++) {
47 std::cout << "data[" << i << "] = " << static_cast<int>(data[i]) << "\n";
48 result += data[i];
49 }
50 return result;
51}

◆ TakeInt8PointerMany()

DART_EXPORT int8_t dart::TakeInt8PointerMany ( int8_t *  data0,
int8_t *  data1,
int8_t *  data2,
int8_t *  data3,
int8_t *  data4,
int8_t *  data5,
int8_t *  data6,
int8_t *  data7,
int8_t *  data8,
int8_t *  data9,
int8_t *  data10,
int8_t *  data11,
int8_t *  data12,
int8_t *  data13,
int8_t *  data14,
int8_t *  data15,
int8_t *  data16,
int8_t *  data17,
int8_t *  data18,
int8_t *  data19 
)

Definition at line 53 of file ffi_test_functions_generated_2.cc.

72 {
73 int8_t result = 0;
74 std::cout << "data0[0] = " << static_cast<int>(data0[0]) << "\n";
75 result += data0[0];
76 std::cout << "data1[0] = " << static_cast<int>(data1[0]) << "\n";
77 result += data1[0];
78 std::cout << "data2[0] = " << static_cast<int>(data2[0]) << "\n";
79 result += data2[0];
80 std::cout << "data3[0] = " << static_cast<int>(data3[0]) << "\n";
81 result += data3[0];
82 std::cout << "data4[0] = " << static_cast<int>(data4[0]) << "\n";
83 result += data4[0];
84 std::cout << "data5[0] = " << static_cast<int>(data5[0]) << "\n";
85 result += data5[0];
86 std::cout << "data6[0] = " << static_cast<int>(data6[0]) << "\n";
87 result += data6[0];
88 std::cout << "data7[0] = " << static_cast<int>(data7[0]) << "\n";
89 result += data7[0];
90 std::cout << "data8[0] = " << static_cast<int>(data8[0]) << "\n";
91 result += data8[0];
92 std::cout << "data9[0] = " << static_cast<int>(data9[0]) << "\n";
93 result += data9[0];
94 std::cout << "data10[0] = " << static_cast<int>(data10[0]) << "\n";
95 result += data10[0];
96 std::cout << "data11[0] = " << static_cast<int>(data11[0]) << "\n";
97 result += data11[0];
98 std::cout << "data12[0] = " << static_cast<int>(data12[0]) << "\n";
99 result += data12[0];
100 std::cout << "data13[0] = " << static_cast<int>(data13[0]) << "\n";
101 result += data13[0];
102 std::cout << "data14[0] = " << static_cast<int>(data14[0]) << "\n";
103 result += data14[0];
104 std::cout << "data15[0] = " << static_cast<int>(data15[0]) << "\n";
105 result += data15[0];
106 std::cout << "data16[0] = " << static_cast<int>(data16[0]) << "\n";
107 result += data16[0];
108 std::cout << "data17[0] = " << static_cast<int>(data17[0]) << "\n";
109 result += data17[0];
110 std::cout << "data18[0] = " << static_cast<int>(data18[0]) << "\n";
111 result += data18[0];
112 std::cout << "data19[0] = " << static_cast<int>(data19[0]) << "\n";
113 result += data19[0];
114 return result;
115}

◆ TakeMaxUint16()

DART_EXPORT intptr_t dart::TakeMaxUint16 ( uint16_t  x)

Definition at line 142 of file ffi_test_functions.cc.

142 {
143 std::cout << "TakeMaxUint16(" << x << ")\n";
144 return x == 0xffff ? 1 : 0;
145}

◆ TakeMaxUint32()

DART_EXPORT intptr_t dart::TakeMaxUint32 ( uint32_t  x)

Definition at line 147 of file ffi_test_functions.cc.

147 {
148 std::cout << "TakeMaxUint32(" << x << ")\n";
149 return x == 0xffffffff ? 1 : 0;
150}

◆ TakeMaxUint8()

DART_EXPORT intptr_t dart::TakeMaxUint8 ( uint8_t  x)

Definition at line 137 of file ffi_test_functions.cc.

137 {
138 std::cout << "TakeMaxUint8(" << static_cast<int>(x) << ")\n";
139 return x == 0xff ? 1 : 0;
140}

◆ TakeMaxUint8x10()

DART_EXPORT intptr_t dart::TakeMaxUint8x10 ( uint8_t  a,
uint8_t  b,
uint8_t  c,
uint8_t  d,
uint8_t  e,
uint8_t  f,
uint8_t  g,
uint8_t  h,
uint8_t  i,
uint8_t  j 
)

Definition at line 174 of file ffi_test_functions.cc.

183 {
184 std::cout << "TakeMaxUint8x10(" << static_cast<int>(a) << ", "
185 << static_cast<int>(b) << ", " << static_cast<int>(c) << ", "
186 << static_cast<int>(d) << ", " << static_cast<int>(e) << ", "
187 << static_cast<int>(f) << ", " << static_cast<int>(g) << ", "
188 << static_cast<int>(h) << ", " << static_cast<int>(i) << ", "
189 << static_cast<int>(j) << ")\n";
190 return (a == 0xff && b == 0xff && c == 0xff && d == 0xff && e == 0xff &&
191 f == 0xff && g == 0xff && h == 0xff && i == 0xff && j == 0xff)
192 ? 1
193 : 0;
194}

◆ TakeMinInt16()

DART_EXPORT intptr_t dart::TakeMinInt16 ( int16_t  x)

Definition at line 159 of file ffi_test_functions.cc.

159 {
160 std::cout << "TakeMinInt16(" << x << ")\n";
161 const int64_t expected = -0x8000;
162 const int64_t received = x;
163 return expected == received ? 1 : 0;
164}

◆ TakeMinInt32()

DART_EXPORT intptr_t dart::TakeMinInt32 ( int32_t  x)

Definition at line 166 of file ffi_test_functions.cc.

166 {
167 std::cout << "TakeMinInt32(" << x << ")\n";
168 const int64_t expected = INT32_MIN;
169 const int64_t received = x;
170 return expected == received ? 1 : 0;
171}

◆ TakeMinInt8()

DART_EXPORT intptr_t dart::TakeMinInt8 ( int8_t  x)

Definition at line 152 of file ffi_test_functions.cc.

152 {
153 std::cout << "TakeMinInt8(" << static_cast<int>(x) << ")\n";
154 const int64_t expected = -0x80;
155 const int64_t received = x;
156 return expected == received ? 1 : 0;
157}

◆ TakeString()

DART_EXPORT char dart::TakeString ( char *  my_string)

Definition at line 1334 of file ffi_test_functions.cc.

1334 {
1335 std::cout << "TakeString(" << my_string << ")\n";
1336 return my_string[4];
1337}

◆ TakeStruct2BytesIntPointerMany()

DART_EXPORT int16_t dart::TakeStruct2BytesIntPointerMany ( Struct2BytesInt data0,
Struct2BytesInt data1,
Struct2BytesInt data2,
Struct2BytesInt data3,
Struct2BytesInt data4,
Struct2BytesInt data5,
Struct2BytesInt data6,
Struct2BytesInt data7,
Struct2BytesInt data8,
Struct2BytesInt data9,
Struct2BytesInt data10,
Struct2BytesInt data11,
Struct2BytesInt data12,
Struct2BytesInt data13,
Struct2BytesInt data14,
Struct2BytesInt data15,
Struct2BytesInt data16,
Struct2BytesInt data17,
Struct2BytesInt data18,
Struct2BytesInt data19 
)

Definition at line 891 of file ffi_test_functions_generated_2.cc.

910 {
911 int16_t result = 0;
912 std::cout << "data0->a0 = " << data0->a0 << "\n";
913 result += data0->a0;
914 std::cout << "data1->a0 = " << data1->a0 << "\n";
915 result += data1->a0;
916 std::cout << "data2->a0 = " << data2->a0 << "\n";
917 result += data2->a0;
918 std::cout << "data3->a0 = " << data3->a0 << "\n";
919 result += data3->a0;
920 std::cout << "data4->a0 = " << data4->a0 << "\n";
921 result += data4->a0;
922 std::cout << "data5->a0 = " << data5->a0 << "\n";
923 result += data5->a0;
924 std::cout << "data6->a0 = " << data6->a0 << "\n";
925 result += data6->a0;
926 std::cout << "data7->a0 = " << data7->a0 << "\n";
927 result += data7->a0;
928 std::cout << "data8->a0 = " << data8->a0 << "\n";
929 result += data8->a0;
930 std::cout << "data9->a0 = " << data9->a0 << "\n";
931 result += data9->a0;
932 std::cout << "data10->a0 = " << data10->a0 << "\n";
933 result += data10->a0;
934 std::cout << "data11->a0 = " << data11->a0 << "\n";
935 result += data11->a0;
936 std::cout << "data12->a0 = " << data12->a0 << "\n";
937 result += data12->a0;
938 std::cout << "data13->a0 = " << data13->a0 << "\n";
939 result += data13->a0;
940 std::cout << "data14->a0 = " << data14->a0 << "\n";
941 result += data14->a0;
942 std::cout << "data15->a0 = " << data15->a0 << "\n";
943 result += data15->a0;
944 std::cout << "data16->a0 = " << data16->a0 << "\n";
945 result += data16->a0;
946 std::cout << "data17->a0 = " << data17->a0 << "\n";
947 result += data17->a0;
948 std::cout << "data18->a0 = " << data18->a0 << "\n";
949 result += data18->a0;
950 std::cout << "data19->a0 = " << data19->a0 << "\n";
951 result += data19->a0;
952 return result;
953}

◆ TakeUint16Pointer()

DART_EXPORT uint16_t dart::TakeUint16Pointer ( uint16_t *  data,
size_t  length 
)

Definition at line 425 of file ffi_test_functions_generated_2.cc.

425 {
426 uint16_t result = 0;
427 if (length > 100) {
428 std::cout << "Mangled arguments\n";
429 return result;
430 }
431 for (size_t i = 0; i < length; i++) {
432 std::cout << "data[" << i << "] = " << data[i] << "\n";
433 result += data[i];
434 }
435 return result;
436}

◆ TakeUint16PointerMany()

DART_EXPORT uint16_t dart::TakeUint16PointerMany ( uint16_t *  data0,
uint16_t *  data1,
uint16_t *  data2,
uint16_t *  data3,
uint16_t *  data4,
uint16_t *  data5,
uint16_t *  data6,
uint16_t *  data7,
uint16_t *  data8,
uint16_t *  data9,
uint16_t *  data10,
uint16_t *  data11,
uint16_t *  data12,
uint16_t *  data13,
uint16_t *  data14,
uint16_t *  data15,
uint16_t *  data16,
uint16_t *  data17,
uint16_t *  data18,
uint16_t *  data19 
)

Definition at line 438 of file ffi_test_functions_generated_2.cc.

457 {
458 uint16_t result = 0;
459 std::cout << "data0[0] = " << data0[0] << "\n";
460 result += data0[0];
461 std::cout << "data1[0] = " << data1[0] << "\n";
462 result += data1[0];
463 std::cout << "data2[0] = " << data2[0] << "\n";
464 result += data2[0];
465 std::cout << "data3[0] = " << data3[0] << "\n";
466 result += data3[0];
467 std::cout << "data4[0] = " << data4[0] << "\n";
468 result += data4[0];
469 std::cout << "data5[0] = " << data5[0] << "\n";
470 result += data5[0];
471 std::cout << "data6[0] = " << data6[0] << "\n";
472 result += data6[0];
473 std::cout << "data7[0] = " << data7[0] << "\n";
474 result += data7[0];
475 std::cout << "data8[0] = " << data8[0] << "\n";
476 result += data8[0];
477 std::cout << "data9[0] = " << data9[0] << "\n";
478 result += data9[0];
479 std::cout << "data10[0] = " << data10[0] << "\n";
480 result += data10[0];
481 std::cout << "data11[0] = " << data11[0] << "\n";
482 result += data11[0];
483 std::cout << "data12[0] = " << data12[0] << "\n";
484 result += data12[0];
485 std::cout << "data13[0] = " << data13[0] << "\n";
486 result += data13[0];
487 std::cout << "data14[0] = " << data14[0] << "\n";
488 result += data14[0];
489 std::cout << "data15[0] = " << data15[0] << "\n";
490 result += data15[0];
491 std::cout << "data16[0] = " << data16[0] << "\n";
492 result += data16[0];
493 std::cout << "data17[0] = " << data17[0] << "\n";
494 result += data17[0];
495 std::cout << "data18[0] = " << data18[0] << "\n";
496 result += data18[0];
497 std::cout << "data19[0] = " << data19[0] << "\n";
498 result += data19[0];
499 return result;
500}

◆ TakeUint32Pointer()

DART_EXPORT uint32_t dart::TakeUint32Pointer ( uint32_t *  data,
size_t  length 
)

Definition at line 502 of file ffi_test_functions_generated_2.cc.

502 {
503 uint32_t result = 0;
504 if (length > 100) {
505 std::cout << "Mangled arguments\n";
506 return result;
507 }
508 for (size_t i = 0; i < length; i++) {
509 std::cout << "data[" << i << "] = " << data[i] << "\n";
510 result += data[i];
511 }
512 return result;
513}

◆ TakeUint32PointerMany()

DART_EXPORT uint32_t dart::TakeUint32PointerMany ( uint32_t *  data0,
uint32_t *  data1,
uint32_t *  data2,
uint32_t *  data3,
uint32_t *  data4,
uint32_t *  data5,
uint32_t *  data6,
uint32_t *  data7,
uint32_t *  data8,
uint32_t *  data9,
uint32_t *  data10,
uint32_t *  data11,
uint32_t *  data12,
uint32_t *  data13,
uint32_t *  data14,
uint32_t *  data15,
uint32_t *  data16,
uint32_t *  data17,
uint32_t *  data18,
uint32_t *  data19 
)

Definition at line 515 of file ffi_test_functions_generated_2.cc.

534 {
535 uint32_t result = 0;
536 std::cout << "data0[0] = " << data0[0] << "\n";
537 result += data0[0];
538 std::cout << "data1[0] = " << data1[0] << "\n";
539 result += data1[0];
540 std::cout << "data2[0] = " << data2[0] << "\n";
541 result += data2[0];
542 std::cout << "data3[0] = " << data3[0] << "\n";
543 result += data3[0];
544 std::cout << "data4[0] = " << data4[0] << "\n";
545 result += data4[0];
546 std::cout << "data5[0] = " << data5[0] << "\n";
547 result += data5[0];
548 std::cout << "data6[0] = " << data6[0] << "\n";
549 result += data6[0];
550 std::cout << "data7[0] = " << data7[0] << "\n";
551 result += data7[0];
552 std::cout << "data8[0] = " << data8[0] << "\n";
553 result += data8[0];
554 std::cout << "data9[0] = " << data9[0] << "\n";
555 result += data9[0];
556 std::cout << "data10[0] = " << data10[0] << "\n";
557 result += data10[0];
558 std::cout << "data11[0] = " << data11[0] << "\n";
559 result += data11[0];
560 std::cout << "data12[0] = " << data12[0] << "\n";
561 result += data12[0];
562 std::cout << "data13[0] = " << data13[0] << "\n";
563 result += data13[0];
564 std::cout << "data14[0] = " << data14[0] << "\n";
565 result += data14[0];
566 std::cout << "data15[0] = " << data15[0] << "\n";
567 result += data15[0];
568 std::cout << "data16[0] = " << data16[0] << "\n";
569 result += data16[0];
570 std::cout << "data17[0] = " << data17[0] << "\n";
571 result += data17[0];
572 std::cout << "data18[0] = " << data18[0] << "\n";
573 result += data18[0];
574 std::cout << "data19[0] = " << data19[0] << "\n";
575 result += data19[0];
576 return result;
577}

◆ TakeUint64Pointer()

DART_EXPORT uint64_t dart::TakeUint64Pointer ( uint64_t *  data,
size_t  length 
)

Definition at line 579 of file ffi_test_functions_generated_2.cc.

579 {
580 uint64_t result = 0;
581 if (length > 100) {
582 std::cout << "Mangled arguments\n";
583 return result;
584 }
585 for (size_t i = 0; i < length; i++) {
586 std::cout << "data[" << i << "] = " << data[i] << "\n";
587 result += data[i];
588 }
589 return result;
590}

◆ TakeUint64PointerMany()

DART_EXPORT uint64_t dart::TakeUint64PointerMany ( uint64_t *  data0,
uint64_t *  data1,
uint64_t *  data2,
uint64_t *  data3,
uint64_t *  data4,
uint64_t *  data5,
uint64_t *  data6,
uint64_t *  data7,
uint64_t *  data8,
uint64_t *  data9,
uint64_t *  data10,
uint64_t *  data11,
uint64_t *  data12,
uint64_t *  data13,
uint64_t *  data14,
uint64_t *  data15,
uint64_t *  data16,
uint64_t *  data17,
uint64_t *  data18,
uint64_t *  data19 
)

Definition at line 592 of file ffi_test_functions_generated_2.cc.

611 {
612 uint64_t result = 0;
613 std::cout << "data0[0] = " << data0[0] << "\n";
614 result += data0[0];
615 std::cout << "data1[0] = " << data1[0] << "\n";
616 result += data1[0];
617 std::cout << "data2[0] = " << data2[0] << "\n";
618 result += data2[0];
619 std::cout << "data3[0] = " << data3[0] << "\n";
620 result += data3[0];
621 std::cout << "data4[0] = " << data4[0] << "\n";
622 result += data4[0];
623 std::cout << "data5[0] = " << data5[0] << "\n";
624 result += data5[0];
625 std::cout << "data6[0] = " << data6[0] << "\n";
626 result += data6[0];
627 std::cout << "data7[0] = " << data7[0] << "\n";
628 result += data7[0];
629 std::cout << "data8[0] = " << data8[0] << "\n";
630 result += data8[0];
631 std::cout << "data9[0] = " << data9[0] << "\n";
632 result += data9[0];
633 std::cout << "data10[0] = " << data10[0] << "\n";
634 result += data10[0];
635 std::cout << "data11[0] = " << data11[0] << "\n";
636 result += data11[0];
637 std::cout << "data12[0] = " << data12[0] << "\n";
638 result += data12[0];
639 std::cout << "data13[0] = " << data13[0] << "\n";
640 result += data13[0];
641 std::cout << "data14[0] = " << data14[0] << "\n";
642 result += data14[0];
643 std::cout << "data15[0] = " << data15[0] << "\n";
644 result += data15[0];
645 std::cout << "data16[0] = " << data16[0] << "\n";
646 result += data16[0];
647 std::cout << "data17[0] = " << data17[0] << "\n";
648 result += data17[0];
649 std::cout << "data18[0] = " << data18[0] << "\n";
650 result += data18[0];
651 std::cout << "data19[0] = " << data19[0] << "\n";
652 result += data19[0];
653 return result;
654}

◆ TakeUint8Pointer()

DART_EXPORT uint8_t dart::TakeUint8Pointer ( uint8_t *  data,
size_t  length 
)

Definition at line 348 of file ffi_test_functions_generated_2.cc.

348 {
349 uint8_t result = 0;
350 if (length > 100) {
351 std::cout << "Mangled arguments\n";
352 return result;
353 }
354 for (size_t i = 0; i < length; i++) {
355 std::cout << "data[" << i << "] = " << static_cast<int>(data[i]) << "\n";
356 result += data[i];
357 }
358 return result;
359}

◆ TakeUint8PointerMany()

DART_EXPORT uint8_t dart::TakeUint8PointerMany ( uint8_t *  data0,
uint8_t *  data1,
uint8_t *  data2,
uint8_t *  data3,
uint8_t *  data4,
uint8_t *  data5,
uint8_t *  data6,
uint8_t *  data7,
uint8_t *  data8,
uint8_t *  data9,
uint8_t *  data10,
uint8_t *  data11,
uint8_t *  data12,
uint8_t *  data13,
uint8_t *  data14,
uint8_t *  data15,
uint8_t *  data16,
uint8_t *  data17,
uint8_t *  data18,
uint8_t *  data19 
)

Definition at line 361 of file ffi_test_functions_generated_2.cc.

380 {
381 uint8_t result = 0;
382 std::cout << "data0[0] = " << static_cast<int>(data0[0]) << "\n";
383 result += data0[0];
384 std::cout << "data1[0] = " << static_cast<int>(data1[0]) << "\n";
385 result += data1[0];
386 std::cout << "data2[0] = " << static_cast<int>(data2[0]) << "\n";
387 result += data2[0];
388 std::cout << "data3[0] = " << static_cast<int>(data3[0]) << "\n";
389 result += data3[0];
390 std::cout << "data4[0] = " << static_cast<int>(data4[0]) << "\n";
391 result += data4[0];
392 std::cout << "data5[0] = " << static_cast<int>(data5[0]) << "\n";
393 result += data5[0];
394 std::cout << "data6[0] = " << static_cast<int>(data6[0]) << "\n";
395 result += data6[0];
396 std::cout << "data7[0] = " << static_cast<int>(data7[0]) << "\n";
397 result += data7[0];
398 std::cout << "data8[0] = " << static_cast<int>(data8[0]) << "\n";
399 result += data8[0];
400 std::cout << "data9[0] = " << static_cast<int>(data9[0]) << "\n";
401 result += data9[0];
402 std::cout << "data10[0] = " << static_cast<int>(data10[0]) << "\n";
403 result += data10[0];
404 std::cout << "data11[0] = " << static_cast<int>(data11[0]) << "\n";
405 result += data11[0];
406 std::cout << "data12[0] = " << static_cast<int>(data12[0]) << "\n";
407 result += data12[0];
408 std::cout << "data13[0] = " << static_cast<int>(data13[0]) << "\n";
409 result += data13[0];
410 std::cout << "data14[0] = " << static_cast<int>(data14[0]) << "\n";
411 result += data14[0];
412 std::cout << "data15[0] = " << static_cast<int>(data15[0]) << "\n";
413 result += data15[0];
414 std::cout << "data16[0] = " << static_cast<int>(data16[0]) << "\n";
415 result += data16[0];
416 std::cout << "data17[0] = " << static_cast<int>(data17[0]) << "\n";
417 result += data17[0];
418 std::cout << "data18[0] = " << static_cast<int>(data18[0]) << "\n";
419 result += data18[0];
420 std::cout << "data19[0] = " << static_cast<int>(data19[0]) << "\n";
421 result += data19[0];
422 return result;
423}

◆ TakeUnion2BytesIntPointerMany()

DART_EXPORT int16_t dart::TakeUnion2BytesIntPointerMany ( Union2BytesInt data0,
Union2BytesInt data1,
Union2BytesInt data2,
Union2BytesInt data3,
Union2BytesInt data4,
Union2BytesInt data5,
Union2BytesInt data6,
Union2BytesInt data7,
Union2BytesInt data8,
Union2BytesInt data9,
Union2BytesInt data10,
Union2BytesInt data11,
Union2BytesInt data12,
Union2BytesInt data13,
Union2BytesInt data14,
Union2BytesInt data15,
Union2BytesInt data16,
Union2BytesInt data17,
Union2BytesInt data18,
Union2BytesInt data19 
)

Definition at line 959 of file ffi_test_functions_generated_2.cc.

978 {
979 int16_t result = 0;
980 std::cout << "data0->a0 = " << data0->a0 << "\n";
981 result += data0->a0;
982 std::cout << "data1->a0 = " << data1->a0 << "\n";
983 result += data1->a0;
984 std::cout << "data2->a0 = " << data2->a0 << "\n";
985 result += data2->a0;
986 std::cout << "data3->a0 = " << data3->a0 << "\n";
987 result += data3->a0;
988 std::cout << "data4->a0 = " << data4->a0 << "\n";
989 result += data4->a0;
990 std::cout << "data5->a0 = " << data5->a0 << "\n";
991 result += data5->a0;
992 std::cout << "data6->a0 = " << data6->a0 << "\n";
993 result += data6->a0;
994 std::cout << "data7->a0 = " << data7->a0 << "\n";
995 result += data7->a0;
996 std::cout << "data8->a0 = " << data8->a0 << "\n";
997 result += data8->a0;
998 std::cout << "data9->a0 = " << data9->a0 << "\n";
999 result += data9->a0;
1000 std::cout << "data10->a0 = " << data10->a0 << "\n";
1001 result += data10->a0;
1002 std::cout << "data11->a0 = " << data11->a0 << "\n";
1003 result += data11->a0;
1004 std::cout << "data12->a0 = " << data12->a0 << "\n";
1005 result += data12->a0;
1006 std::cout << "data13->a0 = " << data13->a0 << "\n";
1007 result += data13->a0;
1008 std::cout << "data14->a0 = " << data14->a0 << "\n";
1009 result += data14->a0;
1010 std::cout << "data15->a0 = " << data15->a0 << "\n";
1011 result += data15->a0;
1012 std::cout << "data16->a0 = " << data16->a0 << "\n";
1013 result += data16->a0;
1014 std::cout << "data17->a0 = " << data17->a0 << "\n";
1015 result += data17->a0;
1016 std::cout << "data18->a0 = " << data18->a0 << "\n";
1017 result += data18->a0;
1018 std::cout << "data19->a0 = " << data19->a0 << "\n";
1019 result += data19->a0;
1020 return result;
1021}

◆ TEST_CASE() [1/600]

dart::TEST_CASE ( AbstractType_InstantiatedFutureOrIsNormalized  )

Definition at line 7738 of file object_test.cc.

7738 {
7739 const auto& type_nullable_int =
7740 Type::Handle(object_store->nullable_int_type());
7741 const auto& expected = Type::Handle(
7742 CreateFutureOrType(type_nullable_int, Nullability::kNonNullable));
7743 const auto& got = AbstractType::Handle(
7744 normalized_future_or(type_nullable_int, Nullability::kNullable));
7746 }
7747}
7748
7749TEST_CASE(AbstractType_InstantiatedFutureOrIsNormalized) {
7750 const char* kScript = R"(
7751import 'dart:async';
7752
7753FutureOr<T>? foo<T>() { return null; }
7754FutureOr<T?> bar<T>() { return null; }
7755)";
7756
7757 Dart_Handle api_lib = TestCase::LoadTestScript(kScript, nullptr);
7758 EXPECT_VALID(api_lib);
7759 TransitionNativeToVM transition(thread);
7760 Zone* const zone = thread->zone();
7761 ObjectStore* const object_store = IsolateGroup::Current()->object_store();
7762
7763 const auto& null_tav = Object::null_type_arguments();
7764 auto instantiate_future_or =
7765 [&](const AbstractType& generic,
7766 const AbstractType& param) -> AbstractTypePtr {
7767 const auto& tav = TypeArguments::Handle(TypeArguments::New(1));
7768 tav.SetTypeAt(0, param);
7769 return generic.InstantiateFrom(null_tav, tav, kCurrentAndEnclosingFree,
7770 Heap::kNew);
7771 };
7772
7773 const auto& root_lib =
7774 Library::CheckedHandle(zone, Api::UnwrapHandle(api_lib));
7775 EXPECT(!root_lib.IsNull());
7776 const auto& foo = Function::Handle(zone, GetFunction(root_lib, "foo"));
7777 const auto& bar = Function::Handle(zone, GetFunction(root_lib, "bar"));
7778 const auto& foo_sig = FunctionType::Handle(zone, foo.signature());
7779 const auto& bar_sig = FunctionType::Handle(zone, bar.signature());
7780
7781 const auto& nullable_future_or_T =
7782 AbstractType::Handle(zone, foo_sig.result_type());
7783 const auto& future_or_nullable_T =
7784 AbstractType::Handle(zone, bar_sig.result_type());
7785
7786 const auto& type_nullable_object =
7787 Type::Handle(object_store->nullable_object_type());
7788 const auto& type_non_nullable_object =
7789 Type::Handle(object_store->non_nullable_object_type());
7790 const auto& type_legacy_object =
7791 Type::Handle(object_store->legacy_object_type());
7792
7793 // Testing same cases as AbstractType_NormalizeFutureOrType.
7794
7795 // FutureOr<T>?[top type] = top type
7796
7797 {
7798 const auto& got = AbstractType::Handle(
7799 instantiate_future_or(nullable_future_or_T, Object::dynamic_type()));
7800 EXPECT_TYPES_SYNTACTICALLY_EQUIVALENT(Object::dynamic_type(), got);
7801 }
7802
7803 {
7804 const auto& got = AbstractType::Handle(
7805 instantiate_future_or(nullable_future_or_T, Object::void_type()));
7806 EXPECT_TYPES_SYNTACTICALLY_EQUIVALENT(Object::void_type(), got);
7807 }
7808
7809 {
7810 const auto& got = AbstractType::Handle(
7811 instantiate_future_or(nullable_future_or_T, type_nullable_object));
7812 EXPECT_TYPES_SYNTACTICALLY_EQUIVALENT(type_nullable_object, got);
7813 }
7814
7815 // FutureOr<T?>[top type] = top type
7816
7817 {
7818 const auto& got = AbstractType::Handle(
7819 instantiate_future_or(future_or_nullable_T, Object::dynamic_type()));
7820 EXPECT_TYPES_SYNTACTICALLY_EQUIVALENT(Object::dynamic_type(), got);
7821 }
7822
7823 {
7824 const auto& got = AbstractType::Handle(
7825 instantiate_future_or(future_or_nullable_T, Object::void_type()));
7826 EXPECT_TYPES_SYNTACTICALLY_EQUIVALENT(Object::void_type(), got);
7827 }
7828
7829 {
7830 const auto& got = AbstractType::Handle(
7831 instantiate_future_or(future_or_nullable_T, type_nullable_object));
7832 EXPECT_TYPES_SYNTACTICALLY_EQUIVALENT(type_nullable_object, got);
7833 }
7834
7835 // FutureOr<T?>[Object] = Object?
7836
7837 {
7838 const auto& got = AbstractType::Handle(
7839 instantiate_future_or(future_or_nullable_T, type_non_nullable_object));
7840 EXPECT_TYPES_SYNTACTICALLY_EQUIVALENT(type_nullable_object, got);
7841 }
7842
7843 // FutureOr<T?>[Object*] = Object?
7844
7845 {
7846 const auto& got = AbstractType::Handle(
7847 instantiate_future_or(future_or_nullable_T, type_legacy_object));
7848 EXPECT_TYPES_SYNTACTICALLY_EQUIVALENT(type_nullable_object, got);
7849 }
7850
7851 // FutureOr<T>?[Object] = Object?
7852
7853 {
7854 const auto& got = AbstractType::Handle(
7855 instantiate_future_or(nullable_future_or_T, type_non_nullable_object));
7856 EXPECT_TYPES_SYNTACTICALLY_EQUIVALENT(type_nullable_object, got);
7857 }
7858
7859 // FutureOr<T>?[Object*] = Object?
7860
7861 {
7862 const auto& got = AbstractType::Handle(
7863 instantiate_future_or(nullable_future_or_T, type_legacy_object));
7864 EXPECT_TYPES_SYNTACTICALLY_EQUIVALENT(type_nullable_object, got);
7865 }
7866
7867 const auto& type_never = Type::Handle(object_store->never_type());
7868 const auto& type_null = Type::Handle(object_store->null_type());
7869
7870 // FutureOr<T?>[Never] = Future<Null>?
7871
7872 {
7873 const auto& expected =
7874 Type::Handle(CreateFutureType(type_null, Nullability::kNullable));
7875 const auto& got = AbstractType::Handle(
7876 instantiate_future_or(future_or_nullable_T, type_never));
7878 }
7879
7880 // FutureOr<T>?[Never] = Future<Never>?
7881
7882 {
7883 const auto& expected =
7884 Type::Handle(CreateFutureType(type_never, Nullability::kNullable));
7885 const auto& got = AbstractType::Handle(
7886 instantiate_future_or(nullable_future_or_T, type_never));
7888 }
7889
7890 // FutureOr<T?>[Null] = Future<Null>?
7891
7892 {
7893 const auto& expected =
7894 Type::Handle(CreateFutureType(type_null, Nullability::kNullable));
7895 const auto& got = AbstractType::Handle(
7896 instantiate_future_or(future_or_nullable_T, type_null));
7898 }
7899
7900 // FutureOr<T>?[Null] = Future<Null>?
7901
7902 {
7903 const auto& expected =
7904 Type::Handle(CreateFutureType(type_null, Nullability::kNullable));
7905 const auto& got = AbstractType::Handle(
7906 instantiate_future_or(nullable_future_or_T, type_null));
7908 }
7909
7910 const auto& type_nullable_int =
7911 Type::Handle(object_store->nullable_int_type());
7912 const auto& type_non_nullable_int =
7913 Type::Handle(object_store->non_nullable_int_type());
7914
7915 // FutureOr<T?>[int] = FutureOr<int?>
7916
7917 {
7918 const auto& expected = Type::Handle(
7919 CreateFutureOrType(type_nullable_int, Nullability::kNonNullable));
7920 const auto& got = AbstractType::Handle(
7921 instantiate_future_or(future_or_nullable_T, type_non_nullable_int));
7923 }
7924
7925 // FutureOr<T?>[int?] = FutureOr<int?>
7926
7927 {
7928 const auto& expected = Type::Handle(
7929 CreateFutureOrType(type_nullable_int, Nullability::kNonNullable));
7930 const auto& got = AbstractType::Handle(
7931 instantiate_future_or(future_or_nullable_T, type_nullable_int));
7933 }
7934
7935 // FutureOr<T>?[int?] = FutureOr<int?>
7936
7937 {
7938 const auto& expected = Type::Handle(
7939 CreateFutureOrType(type_nullable_int, Nullability::kNonNullable));
7940 const auto& got = AbstractType::Handle(
7941 instantiate_future_or(nullable_future_or_T, type_nullable_int));
7943 }

◆ TEST_CASE() [2/600]

dart::TEST_CASE ( AMA_Test  )

Definition at line 15 of file ama_test.cc.

15 {
16 // NOTE: These are expectations we should strive to maintain. Please reach out
17 // to go/dart-ama before changing them.
18#if defined(TARGET_ARCH_ARM64)
19 COMPILE_ASSERT(R27 == PP);
20 COMPILE_ASSERT(R15 == SPREG);
21 COMPILE_ASSERT(R26 == THR);
22 COMPILE_ASSERT(R21 == DISPATCH_TABLE_REG);
23#endif
24}

◆ TEST_CASE() [3/600]

dart::TEST_CASE ( ArrayLengthMaxElements  )

Definition at line 1907 of file object_test.cc.

1907 {
1908 char buffer[1024];
1909 Utils::SNPrint(buffer, sizeof(buffer),
1910 "main() {\n"
1911 " return List.filled(%" Pd
1912 ", null);\n"
1913 "}\n",
1914 Array::kMaxElements);
1915 Dart_Handle lib = TestCase::LoadTestScript(buffer, nullptr);
1916 EXPECT_VALID(lib);
1917 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, nullptr);
1918 if (Dart_IsError(result)) {
1919 EXPECT_ERROR(result, "Out of Memory");
1920 } else {
1921 const intptr_t kExpected = Array::kMaxElements;
1922 intptr_t actual = 0;
1924 EXPECT_EQ(kExpected, actual);
1925 }
1926}

◆ TEST_CASE() [4/600]

dart::TEST_CASE ( ArrayLengthNegativeOne  )

Definition at line 1883 of file object_test.cc.

1883 {
1885}
static void TestIllegalArrayLength(intptr_t length)

◆ TEST_CASE() [5/600]

dart::TEST_CASE ( ArrayLengthOneTooMany  )

Definition at line 1890 of file object_test.cc.

1890 {
1891 const intptr_t kOneTooMany = Array::kMaxElements + 1;
1892 ASSERT(kOneTooMany >= 0);
1893
1894 char buffer[1024];
1895 Utils::SNPrint(buffer, sizeof(buffer),
1896 "main() {\n"
1897 " return List.filled(%" Pd
1898 ", null);\n"
1899 "}\n",
1900 kOneTooMany);
1901 Dart_Handle lib = TestCase::LoadTestScript(buffer, nullptr);
1902 EXPECT_VALID(lib);
1903 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, nullptr);
1904 EXPECT_ERROR(result, "Out of Memory");
1905}

◆ TEST_CASE() [6/600]

dart::TEST_CASE ( ArrayLengthSmiMin  )

Definition at line 1886 of file object_test.cc.

1886 {
1887 TestIllegalArrayLength(kSmiMin);
1888}

◆ TEST_CASE() [7/600]

dart::TEST_CASE ( Base64Decode  )

Definition at line 12 of file base64_test.cc.

12 {
13 intptr_t decoded_len;
14 uint8_t* decoded_bytes = DecodeBase64("SGVsbG8sIHdvcmxkIQo=", &decoded_len);
15 const char expected_bytes[] = "Hello, world!\n";
16 intptr_t expected_len = strlen(expected_bytes);
17 EXPECT(!memcmp(expected_bytes, decoded_bytes, expected_len));
18 EXPECT_EQ(expected_len, decoded_len);
19 free(decoded_bytes);
20}

◆ TEST_CASE() [8/600]

dart::TEST_CASE ( Base64DecodeEmpty  )

Definition at line 27 of file base64_test.cc.

27 {
28 intptr_t decoded_len;
29 EXPECT(DecodeBase64("", &decoded_len) == nullptr);
30}

◆ TEST_CASE() [9/600]

dart::TEST_CASE ( Base64DecodeMalformed  )

Definition at line 22 of file base64_test.cc.

22 {
23 intptr_t decoded_len;
24 EXPECT(DecodeBase64("SomethingMalformed", &decoded_len) == nullptr);
25}

◆ TEST_CASE() [10/600]

dart::TEST_CASE ( BaseWriteStream_Write  )

Definition at line 31 of file datastream_test.cc.

31 {
32 MallocWriteStream writer(1 * KB);
33 for (intptr_t i = kSignedStart; i < kSignedEnd; i++) {
34 writer.Write(i);
35 }
36 DEFINE_LARGE_CONSTANTS(intptr_t);
37 writer.Write(all_ones);
38 writer.Write(min);
39 writer.Write(max);
40 writer.Write(half_min);
41 writer.Write(half_max);
42 ReadStream reader(writer.buffer(), writer.bytes_written());
43 for (intptr_t i = kSignedStart; i < kSignedEnd; i++) {
44 const intptr_t r = reader.Read<intptr_t>();
45 EXPECT_EQ(i, r);
46 }
47 const intptr_t read_all_ones = reader.Read<intptr_t>();
48 EXPECT_EQ(all_ones, read_all_ones);
49 const intptr_t read_min = reader.Read<intptr_t>();
50 EXPECT_EQ(min, read_min);
51 const intptr_t read_max = reader.Read<intptr_t>();
52 EXPECT_EQ(max, read_max);
53 const intptr_t read_half_min = reader.Read<intptr_t>();
54 EXPECT_EQ(half_min, read_half_min);
55 const intptr_t read_half_max = reader.Read<intptr_t>();
56 EXPECT_EQ(half_max, read_half_max);
57}
#define DEFINE_LARGE_CONSTANTS(T)
static constexpr intptr_t kSignedEnd

◆ TEST_CASE() [11/600]

dart::TEST_CASE ( BaseWriteStream_WriteLEB128  )

Definition at line 129 of file datastream_test.cc.

129 {
130 MallocWriteStream writer(1 * KB);
131 for (uintptr_t i = 0; i < kUnsignedEnd; i++) {
132 writer.WriteLEB128(i);
133 }
134 DEFINE_LARGE_CONSTANTS(uintptr_t);
135 writer.WriteLEB128(all_ones);
136 writer.WriteLEB128(min);
137 writer.WriteLEB128(max);
138 writer.WriteLEB128(half_min);
139 writer.WriteLEB128(half_max);
140 ReadStream reader(writer.buffer(), writer.bytes_written());
141 for (uintptr_t i = 0; i < kUnsignedEnd; i++) {
142 const uintptr_t r = reader.ReadLEB128();
143 EXPECT_EQ(i, r);
144 }
145 const uintptr_t read_all_ones = reader.ReadLEB128();
146 EXPECT_EQ(all_ones, read_all_ones);
147 const uintptr_t read_min = reader.ReadLEB128();
148 EXPECT_EQ(min, read_min);
149 const uintptr_t read_max = reader.ReadLEB128();
150 EXPECT_EQ(max, read_max);
151 const uintptr_t read_half_min = reader.ReadLEB128();
152 EXPECT_EQ(half_min, read_half_min);
153 const uintptr_t read_half_max = reader.ReadLEB128();
154 EXPECT_EQ(half_max, read_half_max);
155}
static constexpr intptr_t kUnsignedEnd

◆ TEST_CASE() [12/600]

dart::TEST_CASE ( BaseWriteStream_WriteSLEB128  )

Definition at line 157 of file datastream_test.cc.

157 {
158 MallocWriteStream writer(1 * KB);
159 for (intptr_t i = kSignedStart; i < kSignedEnd; i++) {
160 writer.WriteSLEB128(i);
161 }
162 DEFINE_LARGE_CONSTANTS(intptr_t);
163 writer.WriteSLEB128(all_ones);
164 writer.WriteSLEB128(min);
165 writer.WriteSLEB128(max);
166 writer.WriteSLEB128(half_min);
167 writer.WriteSLEB128(half_max);
168 ReadStream reader(writer.buffer(), writer.bytes_written());
169 for (intptr_t i = kSignedStart; i < kSignedEnd; i++) {
170 const intptr_t r = reader.ReadSLEB128();
171 EXPECT_EQ(i, r);
172 }
173 const intptr_t read_all_ones = reader.ReadSLEB128();
174 EXPECT_EQ(all_ones, read_all_ones);
175 const intptr_t read_min = reader.ReadSLEB128();
176 EXPECT_EQ(min, read_min);
177 const intptr_t read_max = reader.ReadSLEB128();
178 EXPECT_EQ(max, read_max);
179 const intptr_t read_half_min = reader.ReadSLEB128();
180 EXPECT_EQ(half_min, read_half_min);
181 const intptr_t read_half_max = reader.ReadSLEB128();
182 EXPECT_EQ(half_max, read_half_max);
183}

◆ TEST_CASE() [13/600]

dart::TEST_CASE ( BaseWriteStream_WriteUnsigned  )

Definition at line 59 of file datastream_test.cc.

59 {
60 MallocWriteStream writer(1 * KB);
61 for (uintptr_t i = 0; i < kUnsignedEnd; i++) {
62 writer.WriteUnsigned(i);
63 }
64 DEFINE_LARGE_CONSTANTS(uintptr_t);
65 writer.WriteUnsigned(all_ones);
66 writer.WriteUnsigned(min);
67 writer.WriteUnsigned(max);
68 writer.WriteUnsigned(half_min);
69 writer.WriteUnsigned(half_max);
70 ReadStream reader(writer.buffer(), writer.bytes_written());
71 for (uintptr_t i = 0; i < kUnsignedEnd; i++) {
72 const uintptr_t r = reader.ReadUnsigned<uintptr_t>();
73 EXPECT_EQ(i, r);
74 }
75 const uintptr_t read_all_ones = reader.ReadUnsigned<uintptr_t>();
76 EXPECT_EQ(all_ones, read_all_ones);
77 const uintptr_t read_min = reader.ReadUnsigned<uintptr_t>();
78 EXPECT_EQ(min, read_min);
79 const uintptr_t read_max = reader.ReadUnsigned<uintptr_t>();
80 EXPECT_EQ(max, read_max);
81 const uintptr_t read_half_min = reader.ReadUnsigned<uintptr_t>();
82 EXPECT_EQ(half_min, read_half_min);
83 const uintptr_t read_half_max = reader.ReadUnsigned<uintptr_t>();
84 EXPECT_EQ(half_max, read_half_max);
85}

◆ TEST_CASE() [14/600]

dart::TEST_CASE ( BitSetBasic  )

Definition at line 43 of file bit_set_test.cc.

43 {
44 TestBitSet<8>();
45 TestBitSet<42>();
46 TestBitSet<128>();
47 TestBitSet<200>();
48}

◆ TEST_CASE() [15/600]

dart::TEST_CASE ( BitVector  )

Definition at line 13 of file bit_vector_test.cc.

13 {
14 {
15 BitVector* v = new BitVector(Z, 15);
16 v->Add(1);
17 EXPECT_EQ(true, v->Contains(1));
18 EXPECT_EQ(false, v->Contains(0));
19 {
20 BitVector::Iterator iter(v);
21 EXPECT_EQ(1, iter.Current());
22 iter.Advance();
23 EXPECT(iter.Done());
24 }
25 v->Add(0);
26 v->Add(1);
27 EXPECT_EQ(true, v->Contains(0));
28 EXPECT_EQ(true, v->Contains(1));
29 {
30 BitVector::Iterator iter(v);
31 EXPECT_EQ(0, iter.Current());
32 iter.Advance();
33 EXPECT_EQ(1, iter.Current());
34 iter.Advance();
35 EXPECT(iter.Done());
36 }
37 }
38
39 {
40 BitVector* v = new BitVector(Z, 128);
41 v->Add(49);
42 v->Add(62);
43 v->Add(63);
44 v->Add(65);
45 EXPECT_EQ(true, v->Contains(49));
46 EXPECT_EQ(true, v->Contains(62));
47 EXPECT_EQ(true, v->Contains(63));
48 EXPECT_EQ(true, v->Contains(65));
49 EXPECT_EQ(false, v->Contains(64));
50 BitVector::Iterator iter(v);
51 EXPECT_EQ(49, iter.Current());
52 iter.Advance();
53 EXPECT_EQ(62, iter.Current());
54 iter.Advance();
55 EXPECT_EQ(63, iter.Current());
56 iter.Advance();
57 EXPECT_EQ(65, iter.Current());
58 iter.Advance();
59 EXPECT(iter.Done());
60 }
61
62 {
63 BitVector* a = new BitVector(Z, 128);
64 BitVector* b = new BitVector(Z, 128);
65 BitVector* c = new BitVector(Z, 128);
66 b->Add(0);
67 b->Add(32);
68 b->Add(64);
69 a->AddAll(b);
70 EXPECT_EQ(true, a->Contains(0));
71 EXPECT_EQ(true, a->Contains(32));
72 EXPECT_EQ(true, a->Contains(64));
73 EXPECT_EQ(false, a->Contains(96));
74 EXPECT_EQ(false, a->Contains(127));
75 b->Add(96);
76 b->Add(127);
77 c->Add(127);
78 a->KillAndAdd(c, b);
79 EXPECT_EQ(true, a->Contains(0));
80 EXPECT_EQ(true, a->Contains(32));
81 EXPECT_EQ(true, a->Contains(64));
82 EXPECT_EQ(true, a->Contains(96));
83 EXPECT_EQ(false, a->Contains(127));
84 a->Remove(0);
85 a->Remove(32);
86 a->Remove(64);
87 a->Remove(96);
88 EXPECT_EQ(false, a->Contains(0));
89 EXPECT_EQ(false, a->Contains(32));
90 EXPECT_EQ(false, a->Contains(64));
91 EXPECT_EQ(false, a->Contains(96));
92 }
93
94 {
95 BitVector* a = new BitVector(Z, 34);
96 BitVector* b = new BitVector(Z, 34);
97 a->SetAll();
98 b->Add(0);
99 b->Add(1);
100 b->Add(31);
101 b->Add(32);
102 a->Intersect(b);
103 EXPECT_EQ(true, a->Equals(*b));
104 }
105
106 {
107 BitVector* a = new BitVector(Z, 2);
108 BitVector* b = new BitVector(Z, 2);
109 a->SetAll();
110 a->Remove(0);
111 a->Remove(1);
112 EXPECT_EQ(true, a->Equals(*b));
113 }
114
115 {
116 BitVector* a = new BitVector(Z, 128);
117 BitVector* b = new BitVector(Z, 128);
118 b->Add(0);
119 b->Add(32);
120 b->Add(64);
121 a->Add(0);
122 a->Add(64);
123 b->RemoveAll(a);
124 EXPECT_EQ(false, b->Contains(0));
125 EXPECT_EQ(true, b->Contains(32));
126 EXPECT_EQ(false, b->Contains(64));
127 }
128}

◆ TEST_CASE() [16/600]

dart::TEST_CASE ( CheckHandleValidity  )

Definition at line 82 of file handles_test.cc.

82 {
83#if defined(DEBUG)
84 FLAG_trace_handles = true;
85#endif
86 Dart_Handle handle = nullptr;
87 // Check validity using zone handles.
88 {
89 TransitionNativeToVM transition(thread);
90 StackZone sz(thread);
91 handle = reinterpret_cast<Dart_Handle>(&Smi::ZoneHandle(Smi::New(1)));
92 {
93 TransitionVMToNative to_native(thread);
94 EXPECT_VALID(handle);
95 }
96 }
97 EXPECT(!Api::IsValid(handle));
98
99 // Check validity using scoped handles.
100 {
102 {
103 TransitionNativeToVM transition(thread);
104 HANDLESCOPE(thread);
105 handle = reinterpret_cast<Dart_Handle>(&Smi::Handle(Smi::New(1)));
106 {
107 TransitionVMToNative to_native(thread);
108 EXPECT_VALID(handle);
109 }
110 }
112 }
113 EXPECT(!Api::IsValid(handle));
114
115 // Check validity using persistent handle.
116 Dart_Handle scoped_handle;
117 {
118 TransitionNativeToVM transition(thread);
119 scoped_handle = Api::NewHandle(thread, Smi::New(1));
120 }
121 Dart_PersistentHandle persistent_handle =
122 Dart_NewPersistentHandle(scoped_handle);
123 EXPECT_VALID(persistent_handle);
124
125 Dart_DeletePersistentHandle(persistent_handle);
126 EXPECT(!Api::IsValid(persistent_handle));
127
128 // Check validity using weak persistent handle.
129 handle = reinterpret_cast<Dart_Handle>(Dart_NewWeakPersistentHandle(
130 Dart_NewStringFromCString("foo"), nullptr, 0, NoopCallback));
131
132 EXPECT_NOTNULL(handle);
133 EXPECT_VALID(handle);
134
136 reinterpret_cast<Dart_WeakPersistentHandle>(handle));
137 EXPECT(!Api::IsValid(handle));
138}

◆ TEST_CASE() [17/600]

dart::TEST_CASE ( Class_EndTokenPos  )

Definition at line 284 of file object_test.cc.

284 {
285 const char* kScript =
286 "\n"
287 "class A {\n"
288 " /**\n"
289 " * Description of foo().\n"
290 " */\n"
291 " foo(a) { return '''\"}'''; }\n"
292 " // }\n"
293 " var bar = '\\'}';\n"
294 "}\n";
295 Dart_Handle lib_h = TestCase::LoadTestScript(kScript, nullptr);
296 EXPECT_VALID(lib_h);
297 TransitionNativeToVM transition(thread);
298 Library& lib = Library::Handle();
299 lib ^= Api::UnwrapHandle(lib_h);
300 EXPECT(!lib.IsNull());
301 const Class& cls =
302 Class::Handle(lib.LookupClass(String::Handle(String::New("A"))));
303 EXPECT(!cls.IsNull());
304 const Error& error = Error::Handle(cls.EnsureIsFinalized(thread));
305 EXPECT(error.IsNull());
306 const TokenPosition end_token_pos = cls.end_token_pos();
307 const Script& scr = Script::Handle(cls.script());
308 intptr_t line;
309 intptr_t col;
310 EXPECT(scr.GetTokenLocation(end_token_pos, &line, &col));
311 EXPECT_EQ(9, line);
312 EXPECT_EQ(1, col);
313}
TokenPosition end_token_pos() const
Definition object.h:1293
bool GetTokenLocation(const TokenPosition &token_pos, intptr_t *line, intptr_t *column=nullptr) const
Definition object.cc:13330

◆ TEST_CASE() [18/600]

dart::TEST_CASE ( Class_GetInstantiationOf  )

Definition at line 7531 of file object_test.cc.

7542 {
7543 const char* kScript = R"(
7544 class B<T> {}
7545 class A1<X, Y> implements B<List<Y>> {}
7546 class A2<X, Y> extends A1<Y, X> {}
7547 )";
7548 Dart_Handle api_lib = TestCase::LoadTestScript(kScript, nullptr);
7549 EXPECT_VALID(api_lib);
7550 TransitionNativeToVM transition(thread);
7551 Zone* const zone = thread->zone();
7552
7553 const auto& root_lib =
7554 Library::CheckedHandle(zone, Api::UnwrapHandle(api_lib));
7555 EXPECT(!root_lib.IsNull());
7556 const auto& class_b = Class::Handle(zone, GetClass(root_lib, "B"));
7557 const auto& class_a1 = Class::Handle(zone, GetClass(root_lib, "A1"));
7558 const auto& class_a2 = Class::Handle(zone, GetClass(root_lib, "A2"));
7559
7560 const auto& core_lib = Library::Handle(zone, Library::CoreLibrary());
7561 const auto& class_list = Class::Handle(zone, GetClass(core_lib, "List"));
7562
7563 const auto& decl_type_b = Type::Handle(zone, class_b.DeclarationType());
7564 const auto& decl_type_list = Type::Handle(zone, class_list.DeclarationType());
7565 const auto& null_tav = Object::null_type_arguments();
7566
7567 // Test that A1.GetInstantiationOf(B) returns B<List<A1::Y>>.
7568 {
7569 const auto& decl_type_a1 = Type::Handle(zone, class_a1.DeclarationType());
7570 const auto& decl_type_args_a1 =
7571 TypeArguments::Handle(zone, decl_type_a1.arguments());
7572 const auto& type_arg_a1_y =
7573 TypeParameter::CheckedHandle(zone, decl_type_args_a1.TypeAt(1));
7574 auto& tav_a1_y = TypeArguments::Handle(TypeArguments::New(1));
7575 tav_a1_y.SetTypeAt(0, type_arg_a1_y);
7576 tav_a1_y = tav_a1_y.Canonicalize(thread);
7577 auto& type_list_a1_y = Type::CheckedHandle(
7578 zone, decl_type_list.InstantiateFrom(tav_a1_y, null_tav, kAllFree,
7579 Heap::kNew));
7580 type_list_a1_y ^= type_list_a1_y.Canonicalize(thread);
7581 auto& tav_list_a1_y = TypeArguments::Handle(TypeArguments::New(1));
7582 tav_list_a1_y.SetTypeAt(0, type_list_a1_y);
7583 tav_list_a1_y = tav_list_a1_y.Canonicalize(thread);
7584 auto& type_b_list_a1_y = Type::CheckedHandle(
7585 zone, decl_type_b.InstantiateFrom(tav_list_a1_y, null_tav, kAllFree,
7586 Heap::kNew));
7587 type_b_list_a1_y ^= type_b_list_a1_y.Canonicalize(thread);
7588
7589 const auto& inst_b_a1 =
7590 Type::Handle(zone, class_a1.GetInstantiationOf(zone, class_b));
7591 EXPECT(!inst_b_a1.IsNull());
7592 EXPECT_TYPES_EQUAL(type_b_list_a1_y, inst_b_a1);
7593 }
7594
7595 // Test that A2.GetInstantiationOf(B) returns B<List<A2::X>>.
7596 {
7597 const auto& decl_type_a2 = Type::Handle(zone, class_a2.DeclarationType());
7598 const auto& decl_type_args_a2 =
7599 TypeArguments::Handle(zone, decl_type_a2.arguments());
7600 const auto& type_arg_a2_x =
7601 TypeParameter::CheckedHandle(zone, decl_type_args_a2.TypeAt(0));
7602 auto& tav_a2_x = TypeArguments::Handle(TypeArguments::New(1));
7603 tav_a2_x.SetTypeAt(0, type_arg_a2_x);
7604 tav_a2_x = tav_a2_x.Canonicalize(thread);
7605 auto& type_list_a2_x = Type::CheckedHandle(
7606 zone, decl_type_list.InstantiateFrom(tav_a2_x, null_tav, kAllFree,
7607 Heap::kNew));
7608 type_list_a2_x ^= type_list_a2_x.Canonicalize(thread);
7609 auto& tav_list_a2_x = TypeArguments::Handle(TypeArguments::New(1));
7610 tav_list_a2_x.SetTypeAt(0, type_list_a2_x);
7611 tav_list_a2_x = tav_list_a2_x.Canonicalize(thread);
#define EXPECT_TYPES_EQUAL(expected, got)

◆ TEST_CASE() [19/600]

dart::TEST_CASE ( ClassHeapStats  )

Definition at line 103 of file heap_test.cc.

103 {
104 const char* kScriptChars =
105 "class A {\n"
106 " var a;\n"
107 " var b;\n"
108 "}\n"
109 ""
110 "main() {\n"
111 " var x = new A();\n"
112 " return new A();\n"
113 "}\n";
114 Dart_Handle h_lib = TestCase::LoadTestScript(kScriptChars, nullptr);
115 auto isolate_group = IsolateGroup::Current();
116 ClassTable* class_table = isolate_group->class_table();
117 {
118 // GC before main so allocations during the tests don't cause unexpected GC.
119 TransitionNativeToVM transition(thread);
120 GCTestHelper::CollectAllGarbage();
121 }
123 Dart_Handle result = Dart_Invoke(h_lib, NewString("main"), 0, nullptr);
126 intptr_t cid;
127 {
128 TransitionNativeToVM transition(thread);
129 Library& lib = Library::Handle();
130 lib ^= Api::UnwrapHandle(h_lib);
131 EXPECT(!lib.IsNull());
132 const Class& cls = Class::Handle(GetClass(lib, "A"));
133 ASSERT(!cls.IsNull());
134 cid = cls.id();
135
136 {
137 // Verify preconditions: allocated twice in new space.
138 CountObjectsVisitor visitor(thread, class_table->NumCids());
139 HeapIterationScope iter(thread);
140 iter.IterateObjects(&visitor);
141 isolate_group->VisitWeakPersistentHandles(&visitor);
142 EXPECT_EQ(2, visitor.new_count_[cid]);
143 EXPECT_EQ(0, visitor.old_count_[cid]);
144 }
145
146 // Perform GC.
147 GCTestHelper::CollectNewSpace();
148
149 {
150 // Verify postconditions: Only one survived.
151 CountObjectsVisitor visitor(thread, class_table->NumCids());
152 HeapIterationScope iter(thread);
153 iter.IterateObjects(&visitor);
154 isolate_group->VisitWeakPersistentHandles(&visitor);
155 EXPECT_EQ(1, visitor.new_count_[cid]);
156 EXPECT_EQ(0, visitor.old_count_[cid]);
157 }
158
159 // Perform GC. The following is heavily dependent on the behaviour
160 // of the GC: Retained instance of A will be promoted.
161 GCTestHelper::CollectNewSpace();
162
163 {
164 // Verify postconditions: One promoted instance.
165 CountObjectsVisitor visitor(thread, class_table->NumCids());
166 HeapIterationScope iter(thread);
167 iter.IterateObjects(&visitor);
168 isolate_group->VisitWeakPersistentHandles(&visitor);
169 EXPECT_EQ(0, visitor.new_count_[cid]);
170 EXPECT_EQ(1, visitor.old_count_[cid]);
171 }
172
173 // Perform a GC on new space.
174 GCTestHelper::CollectNewSpace();
175
176 {
177 // Verify postconditions:
178 CountObjectsVisitor visitor(thread, class_table->NumCids());
179 HeapIterationScope iter(thread);
180 iter.IterateObjects(&visitor);
181 isolate_group->VisitWeakPersistentHandles(&visitor);
182 EXPECT_EQ(0, visitor.new_count_[cid]);
183 EXPECT_EQ(1, visitor.old_count_[cid]);
184 }
185
186 GCTestHelper::CollectOldSpace();
187
188 {
189 // Verify postconditions:
190 CountObjectsVisitor visitor(thread, class_table->NumCids());
191 HeapIterationScope iter(thread);
192 iter.IterateObjects(&visitor);
193 isolate_group->VisitWeakPersistentHandles(&visitor);
194 EXPECT_EQ(0, visitor.new_count_[cid]);
195 EXPECT_EQ(1, visitor.old_count_[cid]);
196 }
197 }
198 // Exit scope, freeing instance.
200 {
201 TransitionNativeToVM transition(thread);
202 // Perform GC.
203 GCTestHelper::CollectOldSpace();
204 {
205 // Verify postconditions:
206 CountObjectsVisitor visitor(thread, class_table->NumCids());
207 HeapIterationScope iter(thread);
208 iter.IterateObjects(&visitor);
209 isolate_group->VisitWeakPersistentHandles(&visitor);
210 EXPECT_EQ(0, visitor.new_count_[cid]);
211 EXPECT_EQ(0, visitor.old_count_[cid]);
212 }
213 }
214}

◆ TEST_CASE() [20/600]

dart::TEST_CASE ( ClassHierarchyAnalysis  )

Definition at line 17 of file cha_test.cc.

17 {
18 const char* kScriptChars =
19 "class A {"
20 " foo() { }"
21 " bar() { }"
22 "}\n"
23 "class B extends A {"
24 "}\n"
25 "class C extends B {"
26 " foo() { }"
27 "}\n"
28 "class D extends A {"
29 " foo() { }"
30 " bar() { }"
31 "}\n";
32
33 TestCase::LoadTestScript(kScriptChars, nullptr);
34
35 TransitionNativeToVM transition(thread);
36 EXPECT(ClassFinalizer::ProcessPendingClasses());
37 const String& name = String::Handle(String::New(TestCase::url()));
38 const Library& lib = Library::Handle(Library::LookupLibrary(thread, name));
39 EXPECT(!lib.IsNull());
40
41 const Class& class_a =
42 Class::Handle(lib.LookupClass(String::Handle(Symbols::New(thread, "A"))));
43 EXPECT(!class_a.IsNull());
44 EXPECT(class_a.EnsureIsFinalized(thread) == Error::null());
45
46 const Class& class_b =
47 Class::Handle(lib.LookupClass(String::Handle(Symbols::New(thread, "B"))));
48 EXPECT(!class_b.IsNull());
49
50 const Class& class_c =
51 Class::Handle(lib.LookupClass(String::Handle(Symbols::New(thread, "C"))));
52 EXPECT(!class_c.IsNull());
53 EXPECT(class_c.EnsureIsFinalized(thread) == Error::null());
54
55 const Class& class_d =
56 Class::Handle(lib.LookupClass(String::Handle(Symbols::New(thread, "D"))));
57 EXPECT(!class_d.IsNull());
58 EXPECT(class_d.EnsureIsFinalized(thread) == Error::null());
59
60 const String& function_foo_name = String::Handle(String::New("foo"));
61 const String& function_bar_name = String::Handle(String::New("bar"));
62
63 const Function& class_a_foo = Function::Handle(
64 Resolver::ResolveDynamicFunction(Z, class_a, function_foo_name));
65 EXPECT(!class_a_foo.IsNull());
66
67 const Function& class_a_bar = Function::Handle(
68 Resolver::ResolveDynamicFunction(Z, class_a, function_bar_name));
69 EXPECT(!class_a_bar.IsNull());
70
71 const Function& class_c_foo = Function::Handle(
72 Resolver::ResolveDynamicFunction(Z, class_c, function_foo_name));
73 EXPECT(!class_c_foo.IsNull());
74
75 const Function& class_d_foo = Function::Handle(
76 Resolver::ResolveDynamicFunction(Z, class_d, function_foo_name));
77 EXPECT(!class_d_foo.IsNull());
78
79 const Function& class_d_bar = Function::Handle(
80 Resolver::ResolveDynamicFunction(Z, class_d, function_bar_name));
81 EXPECT(!class_d_bar.IsNull());
82
83 CHA cha(thread);
84
85 EXPECT(cha.HasSubclasses(kInstanceCid));
86 EXPECT(!cha.HasSubclasses(kSmiCid));
87 EXPECT(!cha.HasSubclasses(kNullCid));
88
89 EXPECT(CHA::HasSubclasses(class_a));
90 EXPECT(CHA::HasSubclasses(class_b));
91 EXPECT(!CHA::HasSubclasses(class_c));
92 cha.AddToGuardedClassesForSubclassCount(class_c, /*subclass_count=*/0);
93 EXPECT(!CHA::HasSubclasses(class_d));
94 cha.AddToGuardedClassesForSubclassCount(class_d, /*subclass_count=*/0);
95
96 EXPECT(!cha.IsGuardedClass(class_a.id()));
97 EXPECT(!cha.IsGuardedClass(class_b.id()));
98 EXPECT(cha.IsGuardedClass(class_c.id()));
99 EXPECT(cha.IsGuardedClass(class_d.id()));
100
101 const Class& closure_class =
102 Class::Handle(IsolateGroup::Current()->object_store()->closure_class());
103 EXPECT(!cha.HasSubclasses(closure_class.id()));
104}
#define Z
Definition cha_test.cc:15

◆ TEST_CASE() [21/600]

dart::TEST_CASE ( CompareAndSwapUint32  )

Definition at line 82 of file atomic_test.cc.

82 {
83 uint32_t old_value = 42;
84 RelaxedAtomic<uint32_t> variable = {old_value};
85 uint32_t new_value = 100;
86 bool success = variable.compare_exchange_strong(old_value, new_value);
87 EXPECT_EQ(true, success);
88 EXPECT_EQ(static_cast<uword>(42), old_value);
89
90 old_value = 50;
91 success = variable.compare_exchange_strong(old_value, new_value);
92 EXPECT_EQ(false, success);
93 EXPECT_EQ(static_cast<uword>(100), old_value);
94}
bool compare_exchange_strong(T &expected, T desired, std::memory_order order=std::memory_order_relaxed)
Definition atomic.h:64

◆ TEST_CASE() [22/600]

dart::TEST_CASE ( CompareAndSwapWord  )

Definition at line 68 of file atomic_test.cc.

68 {
69 uword old_value = 42;
70 RelaxedAtomic<uword> variable = {old_value};
71 uword new_value = 100;
72 bool success = variable.compare_exchange_strong(old_value, new_value);
73 EXPECT_EQ(true, success);
74 EXPECT_EQ(static_cast<uword>(42), old_value);
75
76 old_value = 50;
77 success = variable.compare_exchange_strong(old_value, new_value);
78 EXPECT_EQ(false, success);
79 EXPECT_EQ(static_cast<uword>(100), old_value);
80}

◆ TEST_CASE() [23/600]

dart::TEST_CASE ( ConstMap_larger  )

Definition at line 6969 of file object_test.cc.

6969 {1: 42, 'foo': 499, null: 'bar'};
6970
6971nonConstValue() => {1: 42, 'foo': 499, null: 'bar'};
6972
6973void init() {
6974 constValue()[null];
6975}
6976)";
6977 HashMapNonConstEqualsConst(kScript);
6978}
6979
6980TEST_CASE(ConstMap_larger) {
6981 const char* kScript = R"(
6982enum ExperimentalFlag {
6983 alternativeInvalidationStrategy,
6984 constFunctions,
6985 constantUpdate2018,
6986 constructorTearoffs,
6987 controlFlowCollections,
6988 extensionMethods,
6989 extensionTypes,
6990 genericMetadata,
6991 nonNullable,
6992 nonfunctionTypeAliases,
6993 setLiterals,
6994 spreadCollections,
6995 testExperiment,
6996 tripleShift,
6997 valueClass,
6998 variance,
6999}
7000
7001const Map<ExperimentalFlag, bool> expiredExperimentalFlags = {
7002 ExperimentalFlag.alternativeInvalidationStrategy: false,
7003 ExperimentalFlag.constFunctions: false,
7004 ExperimentalFlag.constantUpdate2018: true,
7005 ExperimentalFlag.constructorTearoffs: false,
7006 ExperimentalFlag.controlFlowCollections: true,
7007 ExperimentalFlag.extensionMethods: false,
7008 ExperimentalFlag.extensionTypes: false,
7009 ExperimentalFlag.genericMetadata: false,
7010 ExperimentalFlag.nonNullable: false,
7011 ExperimentalFlag.nonfunctionTypeAliases: false,
7012 ExperimentalFlag.setLiterals: true,
7013 ExperimentalFlag.spreadCollections: true,
7014 ExperimentalFlag.testExperiment: false,
7015 ExperimentalFlag.tripleShift: false,
7016 ExperimentalFlag.valueClass: false,
7017 ExperimentalFlag.variance: false,
7018};
7019
7020final Map<ExperimentalFlag, bool> expiredExperimentalFlagsNonConst = {
7021 ExperimentalFlag.alternativeInvalidationStrategy: false,
7022 ExperimentalFlag.constFunctions: false,
7023 ExperimentalFlag.constantUpdate2018: true,
7024 ExperimentalFlag.constructorTearoffs: false,
7025 ExperimentalFlag.controlFlowCollections: true,
7026 ExperimentalFlag.extensionMethods: false,
7027 ExperimentalFlag.extensionTypes: false,
7028 ExperimentalFlag.genericMetadata: false,
7029 ExperimentalFlag.nonNullable: false,
7030 ExperimentalFlag.nonfunctionTypeAliases: false,
7031 ExperimentalFlag.setLiterals: true,
7032 ExperimentalFlag.spreadCollections: true,
7033 ExperimentalFlag.testExperiment: false,
7034 ExperimentalFlag.tripleShift: false,
7035 ExperimentalFlag.valueClass: false,
7036 ExperimentalFlag.variance: false,
7037};
init(device_serial, adb_binary)
Definition _adb_path.py:12

◆ TEST_CASE() [24/600]

dart::TEST_CASE ( ConstMap_nested  )

Definition at line 7039 of file object_test.cc.

7043 {
7044 constValue()[null];
7045}
7046)";
7047 HashMapNonConstEqualsConst(kScript);
7048}
7049
7050TEST_CASE(ConstMap_nested) {
7051 const char* kScript = R"(
7052enum Abi {
7053 wordSize64,
7054 wordSize32Align32,
7055 wordSize32Align64,
7056}
7057
7058enum NativeType {
7059 kNativeType,
7060 kNativeInteger,
7061 kNativeDouble,
7062 kPointer,
7063 kNativeFunction,
7064 kInt8,
7065 kInt16,
7066 kInt32,
7067 kInt64,
7068 kUint8,
7069 kUint16,
7070 kUint32,
7071 kUint64,
7072 kIntptr,
7073 kFloat,
7074 kDouble,
7075 kVoid,
7076 kOpaque,
7077 kStruct,
7078 kHandle,
7079}
7080
7081const nonSizeAlignment = <Abi, Map<NativeType, int>>{
7082 Abi.wordSize64: {},
7083 Abi.wordSize32Align32: {
7084 NativeType.kDouble: 4,
7085 NativeType.kInt64: 4,
7086 NativeType.kUint64: 4
7087 },
7088 Abi.wordSize32Align64: {},
7089};
7090
7091final nonSizeAlignmentNonConst = <Abi, Map<NativeType, int>>{
7092 Abi.wordSize64: {},
7093 Abi.wordSize32Align32: {
7094 NativeType.kDouble: 4,
7095 NativeType.kInt64: 4,
7096 NativeType.kUint64: 4
7097 },
7098 Abi.wordSize32Align64: {},
7099};

◆ TEST_CASE() [25/600]

dart::TEST_CASE ( ConstMap_null  )

Definition at line 6956 of file object_test.cc.

6956 {1: 42, 'foo': 499, 2: 'bar'};
6957
6958nonConstValue() => {1: 42, 'foo': 499, 2: 'bar'};
6959
6960void init() {
6961 constValue()[null];
6962}
6963)";
6964 HashMapNonConstEqualsConst(kScript);
6965}
6966
6967TEST_CASE(ConstMap_null) {

◆ TEST_CASE() [26/600]

dart::TEST_CASE ( ConstMap_small  )

Definition at line 6943 of file object_test.cc.

6945 {
6946 HashBaseNonConstEqualsConst<Map, kMapCid, kConstMapCid>(script, check_data);
6947}
6948
6949static void HashSetNonConstEqualsConst(const char* script,
6950 bool check_data = true) {
6951 HashBaseNonConstEqualsConst<Set, kSetCid, kConstSetCid>(script, check_data);
6952}
6953
6954TEST_CASE(ConstMap_small) {

◆ TEST_CASE() [27/600]

dart::TEST_CASE ( ConstMap_vm  )

Definition at line 6769 of file object_test.cc.

6780 {
6781 const char* kScript = R"(
6782enum ExperimentalFlag {
6783 alternativeInvalidationStrategy,
6784 constFunctions,
6785 constantUpdate2018,
6786 constructorTearoffs,
6787 controlFlowCollections,
6788 extensionMethods,
6789 extensionTypes,
6790 genericMetadata,
6791 nonNullable,
6792 nonfunctionTypeAliases,
6793 setLiterals,
6794 spreadCollections,
6795 testExperiment,
6796 tripleShift,
6797 valueClass,
6798 variance,
6799}
6800
6801final Map<ExperimentalFlag?, bool> expiredExperimentalFlagsNonConst = {
6802 ExperimentalFlag.alternativeInvalidationStrategy: false,
6803 ExperimentalFlag.constFunctions: false,
6804 ExperimentalFlag.constantUpdate2018: true,
6805 ExperimentalFlag.constructorTearoffs: false,
6806 ExperimentalFlag.controlFlowCollections: true,
6807 ExperimentalFlag.extensionMethods: false,
6808 ExperimentalFlag.extensionTypes: false,
6809 ExperimentalFlag.genericMetadata: false,
6810 ExperimentalFlag.nonNullable: false,
6811 ExperimentalFlag.nonfunctionTypeAliases: false,
6812 ExperimentalFlag.setLiterals: true,
6813 ExperimentalFlag.spreadCollections: true,
6814 ExperimentalFlag.testExperiment: false,
6815 ExperimentalFlag.tripleShift: false,
6816 ExperimentalFlag.valueClass: false,
6817 ExperimentalFlag.variance: false,
6818};
6819
6820makeNonConstMap() {
6821 return expiredExperimentalFlagsNonConst;
6822}
6823
6824firstKey() {
6825 return ExperimentalFlag.alternativeInvalidationStrategy;
6826}
6827
6828firstKeyHashCode() {
6829 return firstKey().hashCode;
6830}
6831
6832firstKeyIdentityHashCode() {
6833 return identityHashCode(firstKey());
6834}
6835
6836bool lookupSpreadCollections(Map map) =>
6837 map[ExperimentalFlag.spreadCollections];
6838
6839bool? lookupNull(Map map) => map[null];
6840)";
6841 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
6842 EXPECT_VALID(lib);
6843 Dart_Handle non_const_result =
6844 Dart_Invoke(lib, NewString("makeNonConstMap"), 0, nullptr);
6845 EXPECT_VALID(non_const_result);
6846 Dart_Handle first_key_result =
6847 Dart_Invoke(lib, NewString("firstKey"), 0, nullptr);
6848 EXPECT_VALID(first_key_result);
6849 Dart_Handle first_key_hashcode_result =
6850 Dart_Invoke(lib, NewString("firstKeyHashCode"), 0, nullptr);
6851 EXPECT_VALID(first_key_hashcode_result);
6852 Dart_Handle first_key_identity_hashcode_result =
6853 Dart_Invoke(lib, NewString("firstKeyIdentityHashCode"), 0, nullptr);
6854 EXPECT_VALID(first_key_identity_hashcode_result);
6855
6856 Dart_Handle const_argument;
6857
6858 {
6859 TransitionNativeToVM transition(thread);
6860 const auto& non_const_map =
6861 Map::Cast(Object::Handle(Api::UnwrapHandle(non_const_result)));
6862 const auto& non_const_type_args =
6863 TypeArguments::Handle(non_const_map.GetTypeArguments());
6864 const auto& non_const_data = Array::Handle(non_const_map.data());
6865 const auto& const_map = Map::Handle(ConstructImmutableMap(
6866 non_const_data, Smi::Value(non_const_map.used_data()),
6867 non_const_type_args));
6868 ASSERT(non_const_map.GetClassId() == kMapCid);
6869 ASSERT(const_map.GetClassId() == kConstMapCid);
6870 ASSERT(!non_const_map.IsCanonical());
6871 ASSERT(const_map.IsCanonical());
6872
6873 const_argument = Api::NewHandle(thread, const_map.ptr());
6874 }
6875
6876 Dart_Handle lookup_result = Dart_Invoke(
6877 lib, NewString("lookupSpreadCollections"), 1, &const_argument);
6878 EXPECT_VALID(lookup_result);
6879 EXPECT_TRUE(lookup_result);
6880
6881 Dart_Handle lookup_null_result =
6882 Dart_Invoke(lib, NewString("lookupNull"), 1, &const_argument);
6883 EXPECT_VALID(lookup_null_result);
6884 EXPECT_NULL(lookup_null_result);
6885
6886 {
6887 TransitionNativeToVM transition(thread);
6888 const auto& non_const_object =
6889 Object::Handle(Api::UnwrapHandle(non_const_result));
6890 const auto& non_const_map = Map::Cast(non_const_object);
#define EXPECT_NULL(handle)
Definition unit_test.h:701
#define EXPECT_TRUE(handle)
Definition unit_test.h:685

◆ TEST_CASE() [28/600]

dart::TEST_CASE ( ConstSet_larger  )

Definition at line 7228 of file object_test.cc.

7228 {1, 2, 3, 5, 8, 13};
7229
7230nonConstValue() => {1, 2, 3, 5, 8, 13};
7231
7232void init() {
7233 constValue().contains(null);
7234}
7235)";
7236 HashSetNonConstEqualsConst(kScript);
7237}
7238
7239TEST_CASE(ConstSet_larger) {
7240 const char* kScript = R"(
7241const Set<String> tokensThatMayFollowTypeArg = {
7242 '(',
7243 ')',
7244 ']',
7245 '}',
7246 ':',
7247 ';',
7248 ',',
7249 '.',
7250 '?',
7251 '==',
7252 '!=',
7253 '..',
7254 '?.',
7255 '\?\?',
7256 '?..',
7257 '&',
7258 '|',
7259 '^',
7260 '+',
7261 '*',
7262 '%',
7263 '/',
7264 '~/'
7265};
7266
7267final Set<String> tokensThatMayFollowTypeArgNonConst = {
7268 '(',
7269 ')',
7270 ']',
7271 '}',
7272 ':',
7273 ';',
7274 ',',
7275 '.',
7276 '?',
7277 '==',
7278 '!=',
7279 '..',
7280 '?.',
7281 '\?\?',
7282 '?..',
7283 '&',
7284 '|',
7285 '^',
7286 '+',
7287 '*',
7288 '%',
7289 '/',
7290 '~/'
7291};

◆ TEST_CASE() [29/600]

dart::TEST_CASE ( ConstSet_small  )

Definition at line 7215 of file object_test.cc.

7226 {

◆ TEST_CASE() [30/600]

dart::TEST_CASE ( ConstSet_vm  )

Definition at line 7157 of file object_test.cc.

7168 {
7169 const char* kScript = R"(
7170makeNonConstSet() {
7171 return {1, 2, 3, 5, 8, 13};
7172}
7173
7174bool containsFive(Set set) => set.contains(5);
7175)";
7176 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
7177 EXPECT_VALID(lib);
7178 Dart_Handle non_const_result =
7179 Dart_Invoke(lib, NewString("makeNonConstSet"), 0, nullptr);
7180 EXPECT_VALID(non_const_result);
7181
7182 Dart_Handle const_argument;
7183
7184 {
7185 TransitionNativeToVM transition(thread);
7186 const auto& non_const_object =
7187 Object::Handle(Api::UnwrapHandle(non_const_result));
7188 const auto& non_const_set = Set::Cast(non_const_object);
7189 ASSERT(non_const_set.GetClassId() == kSetCid);
7190 ASSERT(!non_const_set.IsCanonical());
7191
7192 const auto& non_const_data = Array::Handle(non_const_set.data());
7193 const auto& non_const_type_args =
7194 TypeArguments::Handle(non_const_set.GetTypeArguments());
7195 const auto& const_set = Set::Handle(ConstructImmutableSet(
7196 non_const_data, Smi::Value(non_const_set.used_data()),
7197 non_const_type_args));
7198 ASSERT(const_set.GetClassId() == kConstSetCid);
7199 ASSERT(const_set.IsCanonical());
7200
7201 const_argument = Api::NewHandle(thread, const_set.ptr());
7202 }
7203
7204 Dart_Handle contains_5_result =
7205 Dart_Invoke(lib, NewString("containsFive"), 1, &const_argument);
7206 EXPECT_VALID(contains_5_result);
7207 EXPECT_TRUE(contains_5_result);
7208
7209 {
7210 TransitionNativeToVM transition(thread);
7211 const auto& non_const_object =
7212 Object::Handle(Api::UnwrapHandle(non_const_result));
7213 const auto& non_const_set = Set::Cast(non_const_object);
static SetPtr ConstructImmutableSet(const Array &input_data, intptr_t used_data, const TypeArguments &type_arguments)

◆ TEST_CASE() [31/600]

dart::TEST_CASE ( CStringIntMap  )

Definition at line 264 of file hash_map_test.cc.

264 {
265 const char* const kConst1 = "test";
266 const char* const kConst2 = "test 2";
267
268 char* const str1 = OS::SCreate(nullptr, "%s", kConst1);
269 char* const str2 = OS::SCreate(nullptr, "%s", kConst2);
270 char* const str3 = OS::SCreate(nullptr, "%s", kConst1);
271
272 // Make sure these strings are pointer-distinct, but C-string-equal.
273 EXPECT_NE(str1, str3);
274 EXPECT_STREQ(str1, str3);
275
276 const intptr_t i1 = 1;
277 const intptr_t i2 = 2;
278
279 CStringIntMap map;
280 EXPECT(map.IsEmpty());
281
282 map.Insert({str1, i1});
283 EXPECT_NOTNULL(map.Lookup(str1));
284 EXPECT_EQ(i1, map.LookupValue(str1));
285 EXPECT_NULLPTR(map.Lookup(str2));
286 EXPECT_NOTNULL(map.Lookup(str3));
287 EXPECT_EQ(i1, map.LookupValue(str3));
288
289 map.Insert({str2, i2});
290 EXPECT_NOTNULL(map.Lookup(str1));
291 EXPECT_EQ(i1, map.LookupValue(str1));
292 EXPECT_NOTNULL(map.Lookup(str2));
293 EXPECT_EQ(i2, map.LookupValue(str2));
294 EXPECT_NOTNULL(map.Lookup(str3));
295 EXPECT_EQ(i1, map.LookupValue(str3));
296
297 EXPECT(map.Remove(str3));
298 EXPECT_NULLPTR(map.Lookup(str1));
299 EXPECT_NOTNULL(map.Lookup(str2));
300 EXPECT_EQ(i2, map.LookupValue(str2));
301 EXPECT_NULLPTR(map.Lookup(str3));
302
303 EXPECT(!map.Remove(str3));
304 EXPECT(map.Remove(str2));
305 EXPECT(map.IsEmpty());
306
307 free(str3);
308 free(str2);
309 free(str1);
310}

◆ TEST_CASE() [32/600]

dart::TEST_CASE ( CStringIntMapUpdate  )

Definition at line 312 of file hash_map_test.cc.

312 {
313 const char* const kConst1 = "test";
314 const char* const kConst2 = "test 2";
315
316 char* str1 = OS::SCreate(nullptr, "%s", kConst1);
317 char* str2 = OS::SCreate(nullptr, "%s", kConst2);
318 char* str3 = OS::SCreate(nullptr, "%s", kConst1);
319 char* str4 = OS::SCreate(nullptr, "%s", kConst1); // Only used for lookup.
320
321 // Make sure these strings are pointer-distinct, but C-string-equal.
322 EXPECT_NE(str1, str3);
323 EXPECT_NE(str1, str4);
324 EXPECT_NE(str3, str4);
325 EXPECT_STREQ(str1, str3);
326 EXPECT_STREQ(str1, str4);
327
329 CStringIntMapKeyValueTrait::Pair p2{str2, 2};
330 CStringIntMapKeyValueTrait::Pair p3{str3, 3};
331
332 CStringIntMap map;
333 EXPECT(map.IsEmpty());
334
335 map.Update(p1);
336 EXPECT_NOTNULL(map.Lookup(str1));
337 EXPECT_EQ(p1.value, map.LookupValue(str1));
338 EXPECT_NULLPTR(map.Lookup(str2));
339 EXPECT_NOTNULL(map.Lookup(str3));
340 EXPECT_EQ(p1.value, map.LookupValue(str3));
341 EXPECT_NOTNULL(map.Lookup(str4));
342 EXPECT_EQ(p1.value, map.LookupValue(str4));
343
344 map.Update(p2);
345 EXPECT_NOTNULL(map.Lookup(str1));
346 EXPECT_EQ(p1.value, map.LookupValue(str1));
347 EXPECT_NOTNULL(map.Lookup(str2));
348 EXPECT_EQ(p2.value, map.LookupValue(str2));
349 EXPECT_NOTNULL(map.Lookup(str3));
350 EXPECT_EQ(p1.value, map.LookupValue(str3));
351 EXPECT_NOTNULL(map.Lookup(str4));
352 EXPECT_EQ(p1.value, map.LookupValue(str4));
353
354 // Check Lookup after Update.
355 map.Update(p3);
356 EXPECT_NOTNULL(map.Lookup(str1));
357 EXPECT_EQ(p3.value, map.LookupValue(str1));
358 EXPECT_NOTNULL(map.Lookup(str2));
359 EXPECT_EQ(p2.value, map.LookupValue(str2));
360 EXPECT_NOTNULL(map.Lookup(str3));
361 EXPECT_EQ(p3.value, map.LookupValue(str3));
362 EXPECT_NOTNULL(map.Lookup(str4));
363 EXPECT_EQ(p3.value, map.LookupValue(str4));
364
365 // Check that single Remove after only Updates ensures Lookup fails after.
366 EXPECT(map.Remove(str3));
367 EXPECT_NULLPTR(map.Lookup(str1));
368 EXPECT_NOTNULL(map.Lookup(str2));
369 EXPECT_EQ(p2.value, map.LookupValue(str2));
370 EXPECT_NULLPTR(map.Lookup(str3));
371 EXPECT_NULLPTR(map.Lookup(str4));
372
373 EXPECT(!map.Remove(str3));
374 EXPECT(map.Remove(str2));
375 EXPECT(map.IsEmpty());
376
377 // Quick double-check that these weren't side-effected by the implementation
378 // of hash maps (p1 especially).
379 EXPECT_EQ(str1, p1.key);
380 EXPECT_EQ(1, p1.value);
381 EXPECT_EQ(str2, p2.key);
382 EXPECT_EQ(2, p2.value);
383 EXPECT_EQ(str3, p3.key);
384 EXPECT_EQ(3, p3.value);
385
386 free(str4);
387 free(str3);
388 free(str2);
389 free(str1);
390}

◆ TEST_CASE() [33/600]

dart::TEST_CASE ( Dart_KillIsolate  )

Definition at line 138 of file dart_api_impl_test.cc.

138 {
139 const char* kScriptChars =
140 "int testMain() {\n"
141 " return 42;\n"
142 "}\n";
143 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
144 EXPECT_VALID(lib);
145 Dart_Handle result = Dart_Invoke(lib, NewString("testMain"), 0, nullptr);
147 int64_t value = 0;
149 EXPECT_EQ(42, value);
150 Dart_Isolate isolate = reinterpret_cast<Dart_Isolate>(Isolate::Current());
151 Dart_KillIsolate(isolate);
152 result = Dart_Invoke(lib, NewString("testMain"), 0, nullptr);
154 EXPECT_STREQ("isolate terminated by Isolate.kill", Dart_GetError(result));
155}
DART_EXPORT void Dart_KillIsolate(Dart_Isolate isolate)

◆ TEST_CASE() [34/600]

dart::TEST_CASE ( Dart_KillIsolatePriority  )

Definition at line 191 of file dart_api_impl_test.cc.

191 {
192 Monitor monitor;
193 bool interrupted = false;
194 Dart_Isolate isolate;
195 Dart::thread_pool()->Run<InfiniteLoopTask>(&isolate, &monitor, &interrupted);
196 {
197 MonitorLocker ml(&monitor);
198 ml.Wait();
199 }
200
201 Dart_KillIsolate(isolate);
202
203 {
204 MonitorLocker ml(&monitor);
205 while (!interrupted) {
206 ml.Wait();
207 }
208 }
209 EXPECT(interrupted);
210}

◆ TEST_CASE() [35/600]

dart::TEST_CASE ( Dart_SetFfiNativeResolver  )

Definition at line 10126 of file dart_api_impl_test.cc.

10130 {
10131 ml.Wait();
10132 }
10133}
10134
10135#if !defined(PRODUCT)
10136static void ReportTimelineEvents() {
10137 intptr_t flow_id_count = 1;
10138 const int64_t flow_ids[1] = {123};
10139
10140 Dart_RecordTimelineEvent("T1", 0, 1, /*flow_id_count=*/0, nullptr,
10141 Dart_Timeline_Event_Begin, 0, nullptr, nullptr);
10142 Dart_RecordTimelineEvent("T1", 10, 1, /*flow_id_count=*/0, nullptr,
10143 Dart_Timeline_Event_End, /*argument_count=*/0,
10144 nullptr, nullptr);
10145
10146 Dart_RecordTimelineEvent("T2", 20, 2, /*flow_id_count=*/0, nullptr,
DART_EXPORT void Dart_RecordTimelineEvent(const char *label, int64_t timestamp0, int64_t timestamp1_or_id, intptr_t flow_id_count, const int64_t *flow_ids, Dart_Timeline_Event_Type type, intptr_t argument_count, const char **argument_names, const char **argument_values)
static void ReportTimelineEvents()

◆ TEST_CASE() [36/600]

dart::TEST_CASE ( Dart_SetFfiNativeResolver_DoesNotResolve  )

Definition at line 10169 of file dart_api_impl_test.cc.

◆ TEST_CASE() [37/600]

dart::TEST_CASE ( Dart_SetFfiNativeResolver_MissingResolver  )

Definition at line 10148 of file dart_api_impl_test.cc.

◆ TEST_CASE() [38/600]

dart::TEST_CASE ( DartAPI_ArrayValues  )

Definition at line 1527 of file dart_api_impl_test.cc.

1527 {
1529 const int kArrayLength = 10;
1530 Dart_Handle str = NewString("test");
1531 EXPECT(!Dart_IsList(str));
1532 Dart_Handle val = Dart_NewList(kArrayLength);
1533 EXPECT(Dart_IsList(val));
1534 intptr_t len = 0;
1535 Dart_Handle result = Dart_ListLength(val, &len);
1537 EXPECT_EQ(kArrayLength, len);
1538
1539 // Check invalid array access.
1540 result = Dart_ListSetAt(val, (kArrayLength + 10), Dart_NewInteger(10));
1542 result = Dart_ListSetAt(val, -10, Dart_NewInteger(10));
1544 result = Dart_ListGetAt(val, (kArrayLength + 10));
1546 result = Dart_ListGetAt(val, -10);
1548
1549 for (int i = 0; i < kArrayLength; i++) {
1552 }
1553 for (int i = 0; i < kArrayLength; i++) {
1554 result = Dart_ListGetAt(val, i);
1556 int64_t value;
1559 EXPECT_EQ(i, value);
1560 }
1561}

◆ TEST_CASE() [39/600]

dart::TEST_CASE ( DartAPI_BooleanConstants  )

Definition at line 1340 of file dart_api_impl_test.cc.

1340 {
1341 Dart_Handle true_handle = Dart_True();
1342 EXPECT_VALID(true_handle);
1343 EXPECT(Dart_IsBoolean(true_handle));
1344
1345 bool value = false;
1346 Dart_Handle result = Dart_BooleanValue(true_handle, &value);
1348 EXPECT(value);
1349
1350 Dart_Handle false_handle = Dart_False();
1351 EXPECT_VALID(false_handle);
1352 EXPECT(Dart_IsBoolean(false_handle));
1353
1354 result = Dart_BooleanValue(false_handle, &value);
1356 EXPECT(!value);
1357}
DART_EXPORT bool Dart_IsBoolean(Dart_Handle object)
DART_EXPORT Dart_Handle Dart_BooleanValue(Dart_Handle boolean_obj, bool *value)

◆ TEST_CASE() [40/600]

dart::TEST_CASE ( DartAPI_BooleanValues  )

Definition at line 1317 of file dart_api_impl_test.cc.

1317 {
1318 Dart_Handle str = NewString("test");
1319 EXPECT(!Dart_IsBoolean(str));
1320
1321 bool value = false;
1322 Dart_Handle result = Dart_BooleanValue(str, &value);
1324
1325 Dart_Handle val1 = Dart_NewBoolean(true);
1326 EXPECT(Dart_IsBoolean(val1));
1327
1328 result = Dart_BooleanValue(val1, &value);
1330 EXPECT(value);
1331
1332 Dart_Handle val2 = Dart_NewBoolean(false);
1333 EXPECT(Dart_IsBoolean(val2));
1334
1335 result = Dart_BooleanValue(val2, &value);
1337 EXPECT(!value);
1338}
DART_EXPORT Dart_Handle Dart_NewBoolean(bool value)

◆ TEST_CASE() [41/600]

dart::TEST_CASE ( DartAPI_BreakpointLockRace  )

Definition at line 5756 of file object_test.cc.

5761 :
5762 IsolateGroup* isolate_group_;
5763 Dart_Isolate isolate_;
5764 std::atomic<bool>* done_;
5765};
5766
5767TEST_CASE(DartAPI_BreakpointLockRace) {
5768 const char* kScriptChars =
5769 "class A {\n"
5770 " a() {\n"
5771 " }\n"
5772 " b() {\n"
5773 " a();\n" // This is line 5.
5774 " }\n"
5775 "}\n"
5776 "test() {\n"
5777 " new A().b();\n"
5778 "}";
5779 // Create a test library and Load up a test script in it.
5780 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
5781 EXPECT_VALID(lib);
5782
5783 // Run function A.b one time.
5784 Dart_Handle result = Dart_Invoke(lib, NewString("test"), 0, nullptr);
5786
5787 // Launch second isolate so that running with stopped mutators during
5788 // deoptimizattion requests a safepoint.
5791 char* error = nullptr;
5792 Dart_Isolate child = Dart_CreateIsolateInGroup(parent, "child",
5793 /*shutdown_callback=*/nullptr,
5794 /*cleanup_callback=*/nullptr,
5795 /*peer=*/nullptr, &error);
5796 EXPECT_NE(nullptr, child);
5797 EXPECT_EQ(nullptr, error);
5799 Dart_EnterIsolate(parent);
5800
5801 // Run function A.b one time.
5802 std::atomic<bool> done = false;
5803 Dart::thread_pool()->Run<ToggleBreakpointTask>(IsolateGroup::Current(), child,
5804 &done);
5805
5806 while (!done) {
5807 ReloadParticipationScope allow_reload(thread);
5808 {
5809 TransitionNativeToVM transition(thread);
5810 const String& name = String::Handle(String::New(TestCase::url()));
5811 const Library& vmlib =
5812 Library::Handle(Library::LookupLibrary(thread, name));
5813 EXPECT(!vmlib.IsNull());
5814 const Class& class_a = Class::Handle(
5815 vmlib.LookupClass(String::Handle(Symbols::New(thread, "A"))));
5816 Function& func_b = Function::Handle(GetFunction(class_a, "b"));
5817 func_b.CanBeInlined();
5818 }
5819 }
5820
5821 // Make sure child isolate finishes.

◆ TEST_CASE() [42/600]

dart::TEST_CASE ( DartAPI_ByteBufferAccess  )

Definition at line 2156 of file dart_api_impl_test.cc.

2156 {
2159 EXPECT_VALID(byte_array);
2160 // Set through the List API.
2161 for (intptr_t i = 0; i < 10; ++i) {
2162 EXPECT_VALID(Dart_ListSetAt(byte_array, i, Dart_NewInteger(i + 1)));
2163 }
2164 Dart_Handle byte_buffer = Dart_NewByteBuffer(byte_array);
2165 EXPECT_VALID(byte_buffer);
2166 EXPECT(Dart_IsByteBuffer(byte_buffer));
2167 EXPECT(!Dart_IsTypedData(byte_buffer));
2168
2169 Dart_Handle byte_buffer_data = Dart_GetDataFromByteBuffer(byte_buffer);
2170 EXPECT_VALID(byte_buffer_data);
2171 EXPECT(!Dart_IsByteBuffer(byte_buffer_data));
2172 EXPECT(Dart_IsTypedData(byte_buffer_data));
2173
2174 intptr_t length = 0;
2175 Dart_Handle result = Dart_ListLength(byte_buffer_data, &length);
2177 EXPECT_EQ(10, length);
2178
2179 for (intptr_t i = 0; i < 10; ++i) {
2180 // Get through the List API.
2181 Dart_Handle integer_obj = Dart_ListGetAt(byte_buffer_data, i);
2182 EXPECT_VALID(integer_obj);
2183 int64_t int64_t_value = -1;
2184 EXPECT_VALID(Dart_IntegerToInt64(integer_obj, &int64_t_value));
2185 EXPECT_EQ(i + 1, int64_t_value);
2186 }
2187
2188 // Some negative tests.
2191 result = Dart_NewByteBuffer(byte_buffer);
2195 result = Dart_GetDataFromByteBuffer(byte_array);
2197}
DART_EXPORT bool Dart_IsByteBuffer(Dart_Handle object)
DART_EXPORT Dart_Handle Dart_GetDataFromByteBuffer(Dart_Handle byte_buffer)
DART_EXPORT Dart_Handle Dart_NewByteBuffer(Dart_Handle typed_data)
DART_EXPORT bool Dart_IsTypedData(Dart_Handle object)

◆ TEST_CASE() [43/600]

dart::TEST_CASE ( DartAPI_ByteDataAccess  )

Definition at line 2218 of file dart_api_impl_test.cc.

2218 {
2219 const char* kScriptChars = R"(
2220import 'dart:typed_data';
2221class Expect {
2222 static equals(a, b) {
2223 if (a != b) {
2224 throw 'not equal. expected: $a, got: $b';
2225 }
2226 }
2227}
2228@pragma("vm:external-name", "CreateByteData")
2229external ByteData createByteData();
2230ByteData main() {
2231 var length = 16;
2232 var a = createByteData();
2233 Expect.equals(length, a.lengthInBytes);
2234 for (int i = 0; i < length; i+=1) {
2235 a.setInt8(i, 0x42);
2236 }
2237 for (int i = 0; i < length; i+=2) {
2238 Expect.equals(0x4242, a.getInt16(i));
2239 }
2240 return a;
2241}
2242)";
2243 // Create a test library and Load up a test script in it.
2244 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
2245
2247 Dart_SetNativeResolver(lib, &ByteDataNativeResolver, nullptr);
2249
2250 // Invoke 'main' function.
2251 result = Dart_Invoke(lib, NewString("main"), 0, nullptr);
2253}

◆ TEST_CASE() [44/600]

dart::TEST_CASE ( DartAPI_ByteDataDirectAccessUnverified  )

Definition at line 2795 of file dart_api_impl_test.cc.

2795 {
2796 FLAG_verify_acquired_data = false;
2798}
static void TestByteDataDirectAccess()

◆ TEST_CASE() [45/600]

dart::TEST_CASE ( DartAPI_ByteDataDirectAccessVerified  )

Definition at line 2800 of file dart_api_impl_test.cc.

2800 {
2801 FLAG_verify_acquired_data = true;
2803}

◆ TEST_CASE() [46/600]

dart::TEST_CASE ( DartAPI_ClassLibrary  )

Definition at line 1304 of file dart_api_impl_test.cc.

1304 {
1305 Dart_Handle lib = Dart_LookupLibrary(NewString("dart:core"));
1306 EXPECT_VALID(lib);
1307 Dart_Handle type = Dart_GetNonNullableType(lib, NewString("int"), 0, nullptr);
1312 const char* str = nullptr;
1313 Dart_StringToCString(lib_url, &str);
1314 EXPECT_STREQ("dart:core", str);
1315}
DART_EXPORT Dart_Handle Dart_ClassLibrary(Dart_Handle cls_type)

◆ TEST_CASE() [47/600]

dart::TEST_CASE ( DartAPI_ClosureFunction  )

Definition at line 1229 of file dart_api_impl_test.cc.

1229 {
1230 const char* kScriptChars = "int getInt() { return 1; }\n";
1231 // Create a test library and Load up a test script in it.
1232 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
1233 EXPECT_VALID(lib);
1234
1235 Dart_Handle closure = Dart_GetField(lib, NewString("getInt"));
1236 EXPECT_VALID(closure);
1237 EXPECT(Dart_IsClosure(closure));
1238 Dart_Handle closure_str = Dart_ToString(closure);
1239 const char* result = "";
1240 Dart_StringToCString(closure_str, &result);
1241 EXPECT(strstr(result, "getInt") != nullptr);
1242
1247 Dart_StringToCString(func_str, &result);
1248 EXPECT(strstr(result, "getInt"));
1249}
DART_EXPORT bool Dart_IsFunction(Dart_Handle handle)
DART_EXPORT Dart_Handle Dart_ClosureFunction(Dart_Handle closure)

◆ TEST_CASE() [48/600]

dart::TEST_CASE ( DartAPI_CollectOneNewSpacePeer  )

Definition at line 8965 of file dart_api_impl_test.cc.

8987 {
8988 uint8_t chars8[1] = {'a'};
8989 uint16_t chars16[1] = {'a'};
8990 int32_t chars32[1] = {'a'};
8991
8993 "expects argument 'length' to be in the range");
8994 EXPECT_ERROR(Dart_NewList(Array::kMaxElements + 1),
8995 "expects argument 'length' to be in the range");
8997 "expects argument 'length' to be in the range");
8998 EXPECT_ERROR(Dart_NewStringFromUTF8(chars8, OneByteString::kMaxElements + 1),

◆ TEST_CASE() [49/600]

dart::TEST_CASE ( DartAPI_CollectOneOldSpacePeer  )

Definition at line 9189 of file dart_api_impl_test.cc.

9201 {
9202 TransitionNativeToVM transition(thread);
9203 GCTestHelper::CollectNewSpace();
9204 EXPECT_EQ(0, heap->PeerCount());
9205 }
9206}
9207
9208// Allocates several objects in new space. Performs successive
9209// garbage collections and checks that the peer count is stable.
9210TEST_CASE(DartAPI_CopyNewSpacePeers) {
9211 const int kPeerCount = 10;
9212 Heap* heap = IsolateGroup::Current()->heap();
9213 Dart_Handle s[kPeerCount];
9214 for (int i = 0; i < kPeerCount; ++i) {
9215 s[i] = NewString("a string");
9216 EXPECT_VALID(s[i]);
9217 EXPECT(Dart_IsString(s[i]));
9218 void* o = &o;
9219 EXPECT_VALID(Dart_GetPeer(s[i], &o));
9220 EXPECT(o == nullptr);
9221 }
9222 EXPECT_EQ(0, heap->PeerCount());
DART_EXPORT Dart_Handle Dart_GetPeer(Dart_Handle object, void **peer)

◆ TEST_CASE() [50/600]

dart::TEST_CASE ( DartAPI_CollectTwoNewSpacePeers  )

Definition at line 9042 of file dart_api_impl_test.cc.

9068 {
9069 Heap* heap = IsolateGroup::Current()->heap();
9070 Dart_Handle str = NewString("a string");
9071 EXPECT_VALID(str);
9072 EXPECT(Dart_IsString(str));
9073 EXPECT_EQ(0, heap->PeerCount());
9074 void* out = &out;
9075 EXPECT_VALID(Dart_GetPeer(str, &out));
9076 EXPECT(out == nullptr);
9077 int peer = 1234;
9078 EXPECT_VALID(Dart_SetPeer(str, &peer));
int64_t PeerCount() const
Definition heap.cc:879
DART_EXPORT Dart_Handle Dart_SetPeer(Dart_Handle object, void *peer)

◆ TEST_CASE() [51/600]

dart::TEST_CASE ( DartAPI_CollectTwoOldSpacePeers  )

Definition at line 9270 of file dart_api_impl_test.cc.

9285 {
9286 Heap* heap = IsolateGroup::Current()->heap();
9287 Dart_Handle str = AllocateOldString("str");
9288 EXPECT_VALID(str);
9289 EXPECT(Dart_IsString(str));
9290 EXPECT_EQ(0, heap->PeerCount());
9291 void* out = &out;
9292 EXPECT(Dart_GetPeer(str, &out));
9293 EXPECT(out == nullptr);
9294 int peer = 1234;
9295 EXPECT_VALID(Dart_SetPeer(str, &peer));
9296 EXPECT_EQ(1, heap->PeerCount());
9297 out = &out;
9298 EXPECT_VALID(Dart_GetPeer(str, &out));
9299 EXPECT(out == reinterpret_cast<void*>(&peer));
9300 {
9301 TransitionNativeToVM transition(thread);
9302 GCTestHelper::CollectOldSpace();
9303 EXPECT_EQ(1, heap->PeerCount());
9304 }
9305 EXPECT_VALID(Dart_GetPeer(str, &out));
9306 EXPECT(out == reinterpret_cast<void*>(&peer));
9307 EXPECT_VALID(Dart_SetPeer(str, nullptr));
9308 out = &out;
9309 EXPECT_VALID(Dart_GetPeer(str, &out));
static Dart_Handle AllocateOldString(const char *c_str)

◆ TEST_CASE() [52/600]

dart::TEST_CASE ( DartAPI_CopyNewSpacePeers  )

Definition at line 9082 of file dart_api_impl_test.cc.

9093 {
9094 Heap* heap = IsolateGroup::Current()->heap();
9096 {
9097 CHECK_API_SCOPE(thread);
9098 Dart_Handle str = NewString("a string");
9099 EXPECT_VALID(str);
9100 EXPECT(Dart_IsString(str));
9101 EXPECT_EQ(0, heap->PeerCount());
9102 void* out = &out;
9103 EXPECT_VALID(Dart_GetPeer(str, &out));
9104 EXPECT(out == nullptr);
9105 int peer = 1234;
9106 EXPECT_VALID(Dart_SetPeer(str, &peer));
9107 EXPECT_EQ(1, heap->PeerCount());
9108 out = &out;
9109 EXPECT_VALID(Dart_GetPeer(str, &out));
9110 EXPECT(out == reinterpret_cast<void*>(&peer));
9111 {

◆ TEST_CASE() [53/600]

dart::TEST_CASE ( DartAPI_CopyUTF8EncodingOfString  )

Definition at line 1684 of file dart_api_impl_test.cc.

1684 {
1685 const char* kScriptChars =
1686 "String lowSurrogate() {"
1687 " return '\\u{1D11E}'[1];"
1688 "}";
1689
1690 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
1691 Dart_Handle str1 = Dart_Invoke(lib, NewString("lowSurrogate"), 0, nullptr);
1692 EXPECT_VALID(str1);
1693
1694 uint8_t* utf8_encoded = nullptr;
1695 intptr_t utf8_length = 0;
1696 Dart_Handle result = Dart_StringToUTF8(str1, &utf8_encoded, &utf8_length);
1698 EXPECT_EQ(3, utf8_length);
1699
1700 intptr_t utf8_copy_length = 0;
1701 result = Dart_StringUTF8Length(str1, &utf8_copy_length);
1702 uint8_t* utf8_encoded_copy = Dart_ScopeAllocate(utf8_copy_length);
1703 result =
1704 Dart_CopyUTF8EncodingOfString(str1, utf8_encoded_copy, utf8_copy_length);
1706 EXPECT_EQ(0, memcmp(utf8_encoded, utf8_encoded_copy, utf8_length));
1707}
DART_EXPORT Dart_Handle Dart_StringToUTF8(Dart_Handle str, uint8_t **utf8_array, intptr_t *length)
DART_EXPORT uint8_t * Dart_ScopeAllocate(intptr_t size)
DART_EXPORT Dart_Handle Dart_StringUTF8Length(Dart_Handle str, intptr_t *length)
DART_EXPORT Dart_Handle Dart_CopyUTF8EncodingOfString(Dart_Handle str, uint8_t *utf8_array, intptr_t length)

◆ TEST_CASE() [54/600]

dart::TEST_CASE ( DartAPI_CurrentStackTraceInfo  )

Definition at line 591 of file dart_api_impl_test.cc.

591 {
592 const char* kScriptChars = R"(
593@pragma("vm:external-name", "CurrentStackTraceNative")
594external inspectStack();
595foo(n) => n == 1 ? inspectStack() : foo(n-1);
596testMain() => foo(100);
597 )";
598
599 Dart_Handle lib =
600 TestCase::LoadTestScript(kScriptChars, &CurrentStackTraceNativeLookup);
601 Dart_Handle result = Dart_Invoke(lib, NewString("testMain"), 0, nullptr);
604 int64_t value = 0;
606 EXPECT_EQ(42, value);
607}

◆ TEST_CASE() [55/600]

dart::TEST_CASE ( DartAPI_DebugName  )

Definition at line 4840 of file dart_api_impl_test.cc.

4840 {
4841 Dart_Handle debug_name = Dart_DebugName();
4842 EXPECT_VALID(debug_name);
4843 EXPECT(Dart_IsString(debug_name));
4844}
DART_EXPORT Dart_Handle Dart_DebugName(void)

◆ TEST_CASE() [56/600]

dart::TEST_CASE ( DartAPI_DeepStackTraceInfo  )

Definition at line 318 of file dart_api_impl_test.cc.

318 {
319 const char* kScriptChars =
320 "foo(n) => n == 1 ? throw new Error() : foo(n-1);\n"
321 "testMain() => foo(100);\n";
322
323 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
324 Dart_Handle error = Dart_Invoke(lib, NewString("testMain"), 0, nullptr);
325
327
328 Dart_StackTrace stacktrace;
331
332 intptr_t frame_count = 0;
333 result = Dart_StackTraceLength(stacktrace, &frame_count);
335 EXPECT_EQ(101, frame_count);
336 // Test something bigger than the preallocated size to verify nothing was
337 // truncated.
338 EXPECT(101 > StackTrace::kPreallocatedStackdepth);
339
341 Dart_Handle script_url;
342 intptr_t line_number = 0;
343 intptr_t column_number = 0;
344 const char* cstr = "";
345
346 // Top frame at positioned at throw.
348 result = Dart_GetActivationFrame(stacktrace, 0, &frame);
350 result = Dart_ActivationFrameInfo(frame, &function_name, &script_url,
351 &line_number, &column_number);
353 Dart_StringToCString(function_name, &cstr);
354 EXPECT_STREQ("foo", cstr);
355 Dart_StringToCString(script_url, &cstr);
356 EXPECT_SUBSTRING("test-lib", cstr);
357 EXPECT_EQ(1, line_number);
358 EXPECT_EQ(20, column_number);
359
360 // Middle frames positioned at the recursive call.
361 for (intptr_t frame_index = 1; frame_index < (frame_count - 1);
362 frame_index++) {
363 result = Dart_GetActivationFrame(stacktrace, frame_index, &frame);
365 result = Dart_ActivationFrameInfo(frame, &function_name, &script_url,
366 &line_number, &column_number);
368 Dart_StringToCString(function_name, &cstr);
369 EXPECT_STREQ("foo", cstr);
370 Dart_StringToCString(script_url, &cstr);
371 EXPECT_SUBSTRING("test-lib", cstr);
372 EXPECT_EQ(1, line_number);
373 EXPECT_EQ(40, column_number);
374 }
375
376 // Bottom frame positioned at testMain().
377 result = Dart_GetActivationFrame(stacktrace, frame_count - 1, &frame);
379 result = Dart_ActivationFrameInfo(frame, &function_name, &script_url,
380 &line_number, &column_number);
382 Dart_StringToCString(function_name, &cstr);
383 EXPECT_STREQ("testMain", cstr);
384 Dart_StringToCString(script_url, &cstr);
385 EXPECT_SUBSTRING("test-lib", cstr);
386 EXPECT_EQ(2, line_number);
387 EXPECT_EQ(15, column_number);
388
389 // Out-of-bounds frames.
390 result = Dart_GetActivationFrame(stacktrace, frame_count, &frame);
392 result = Dart_GetActivationFrame(stacktrace, -1, &frame);
394}
Dart_Handle Dart_GetStackTraceFromError(Dart_Handle handle, Dart_StackTrace *trace)

◆ TEST_CASE() [57/600]

dart::TEST_CASE ( DartAPI_DoubleValues  )

Definition at line 1359 of file dart_api_impl_test.cc.

1359 {
1360 const double kDoubleVal1 = 201.29;
1361 const double kDoubleVal2 = 101.19;
1362 Dart_Handle val1 = Dart_NewDouble(kDoubleVal1);
1363 EXPECT(Dart_IsDouble(val1));
1364 Dart_Handle val2 = Dart_NewDouble(kDoubleVal2);
1365 EXPECT(Dart_IsDouble(val2));
1366 double out1, out2;
1367 Dart_Handle result = Dart_DoubleValue(val1, &out1);
1369 EXPECT_EQ(kDoubleVal1, out1);
1370 result = Dart_DoubleValue(val2, &out2);
1372 EXPECT_EQ(kDoubleVal2, out2);
1373}
DART_EXPORT Dart_Handle Dart_DoubleValue(Dart_Handle double_obj, double *value)
DART_EXPORT bool Dart_IsDouble(Dart_Handle object)

◆ TEST_CASE() [58/600]

dart::TEST_CASE ( DartAPI_EmptyString  )

Definition at line 926 of file dart_api_impl_test.cc.

926 {
931 intptr_t length = -1;
933 EXPECT_EQ(0, length);
934}
DART_EXPORT Dart_Handle Dart_StringLength(Dart_Handle str, intptr_t *length)
DART_EXPORT Dart_Handle Dart_EmptyString(void)

◆ TEST_CASE() [59/600]

dart::TEST_CASE ( DartAPI_EnsureUnwindErrorHandled_WhenKilled  )

Definition at line 727 of file dart_api_impl_test.cc.

727 {
728 const char* kScriptChars = R"(
729import 'dart:isolate';
730
731exitRightNow() {
732 Isolate.current.kill(priority: Isolate.immediate);
733}
734
735@pragma("vm:external-name", "Test_nativeFunc")
736external void nativeFunc(closure);
737
738void Func1() {
739 nativeFunc(() => exitRightNow());
740}
741)";
742 Dart_Handle lib =
743 TestCase::LoadTestScript(kScriptChars, &JustPropagateError_lookup);
745
746 result = Dart_Invoke(lib, NewString("Func1"), 0, nullptr);
748 EXPECT_SUBSTRING("isolate terminated by Isolate.kill", Dart_GetError(result));
749
750 result = Dart_Invoke(lib, NewString("Func1"), 0, nullptr);
752 EXPECT_SUBSTRING("No api calls are allowed while unwind is in progress",
754}

◆ TEST_CASE() [60/600]

dart::TEST_CASE ( DartAPI_EnsureUnwindErrorHandled_WhenSendAndExit  )

Definition at line 756 of file dart_api_impl_test.cc.

756 {
757 const char* kScriptChars = R"(
758import 'dart:isolate';
759
760sendAndExitNow() {
761 final receivePort = ReceivePort();
762 Isolate.exit(receivePort.sendPort, true);
763}
764
765@pragma("vm:external-name", "Test_nativeFunc")
766external void nativeFunc(closure);
767
768void Func1() {
769 nativeFunc(() => sendAndExitNow());
770}
771)";
772 Dart_Handle lib =
773 TestCase::LoadTestScript(kScriptChars, &JustPropagateError_lookup);
775
776 result = Dart_Invoke(lib, NewString("Func1"), 0, nullptr);
778 EXPECT_SUBSTRING("isolate terminated by Isolate.exit", Dart_GetError(result));
779
780 result = Dart_Invoke(lib, NewString("Func1"), 0, nullptr);
782 EXPECT_SUBSTRING("No api calls are allowed while unwind is in progress",
784}

◆ TEST_CASE() [61/600]

dart::TEST_CASE ( DartAPI_Error  )

Definition at line 906 of file dart_api_impl_test.cc.

906 {
908 {
909 TransitionNativeToVM transition(thread);
910 error = Api::NewError("An %s", "error");
911 }
913 EXPECT_STREQ("An error", Dart_GetError(error));
914}

◆ TEST_CASE() [62/600]

dart::TEST_CASE ( DartAPI_ErrorHandleBasics  )

Definition at line 212 of file dart_api_impl_test.cc.

212 {
213 const char* kScriptChars =
214 "void testMain() {\n"
215 " throw new Exception(\"bad news\");\n"
216 "}\n";
217
218 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
219
221 Dart_Handle error = Api::NewError("myerror");
222 Dart_Handle exception = Dart_Invoke(lib, NewString("testMain"), 0, nullptr);
223
226 EXPECT(Dart_IsError(exception));
227
230 EXPECT(Dart_ErrorHasException(exception));
231
232 EXPECT_STREQ("", Dart_GetError(instance));
233 EXPECT_STREQ("myerror", Dart_GetError(error));
234 EXPECT_STREQ(ZONE_STR("Unhandled exception:\n"
235 "Exception: bad news\n"
236 "#0 testMain (%s:2:3)",
237 TestCase::url()),
238 Dart_GetError(exception));
239
246}
DART_EXPORT Dart_Handle Dart_ErrorGetStackTrace(Dart_Handle handle)
#define ZONE_STR(FMT,...)
Definition unit_test.h:226

◆ TEST_CASE() [63/600]

dart::TEST_CASE ( DartAPI_ErrorHandleTypes  )

Definition at line 611 of file dart_api_impl_test.cc.

611 {
612 Dart_Handle not_error = NewString("NotError");
613 Dart_Handle api_error = Dart_NewApiError("ApiError");
614 Dart_Handle exception_error =
616 Dart_Handle compile_error = Dart_NewCompilationError("CompileError");
617 Dart_Handle fatal_error;
618 {
619 TransitionNativeToVM transition(thread);
620 const String& fatal_message = String::Handle(String::New("FatalError"));
621 fatal_error = Api::NewHandle(thread, UnwindError::New(fatal_message));
622 }
623
624 EXPECT_VALID(not_error);
625 EXPECT(Dart_IsError(api_error));
626 EXPECT(Dart_IsError(exception_error));
627 EXPECT(Dart_IsError(compile_error));
628 EXPECT(Dart_IsError(fatal_error));
629
630 EXPECT(!Dart_IsApiError(not_error));
631 EXPECT(Dart_IsApiError(api_error));
632 EXPECT(!Dart_IsApiError(exception_error));
633 EXPECT(!Dart_IsApiError(compile_error));
634 EXPECT(!Dart_IsApiError(fatal_error));
635
638 EXPECT(Dart_IsUnhandledExceptionError(exception_error));
639 EXPECT(!Dart_IsUnhandledExceptionError(compile_error));
641
642 EXPECT(!Dart_IsCompilationError(not_error));
643 EXPECT(!Dart_IsCompilationError(api_error));
644 EXPECT(!Dart_IsCompilationError(exception_error));
645 EXPECT(Dart_IsCompilationError(compile_error));
646 EXPECT(!Dart_IsCompilationError(fatal_error));
647
648 EXPECT(!Dart_IsFatalError(not_error));
649 EXPECT(!Dart_IsFatalError(api_error));
650 EXPECT(!Dart_IsFatalError(exception_error));
651 EXPECT(!Dart_IsFatalError(compile_error));
652 EXPECT(Dart_IsFatalError(fatal_error));
653
654 EXPECT_STREQ("", Dart_GetError(not_error));
655 EXPECT_STREQ("ApiError", Dart_GetError(api_error));
656 EXPECT_SUBSTRING("Unhandled exception:\nExceptionError",
657 Dart_GetError(exception_error));
658 EXPECT_STREQ("CompileError", Dart_GetError(compile_error));
659 EXPECT_STREQ("FatalError", Dart_GetError(fatal_error));
660}
DART_EXPORT bool Dart_IsApiError(Dart_Handle handle)
DART_EXPORT Dart_Handle Dart_NewUnhandledExceptionError(Dart_Handle exception)
DART_EXPORT bool Dart_IsCompilationError(Dart_Handle handle)
DART_EXPORT Dart_Handle Dart_NewCompilationError(const char *error)

◆ TEST_CASE() [64/600]

dart::TEST_CASE ( DartAPI_ExternalAllocationDuringNoCallbackScope  )

Definition at line 3011 of file dart_api_impl_test.cc.

3011 {
3013 EXPECT_VALID(bytes);
3014
3015 intptr_t gc_count_before = Thread::Current()->heap()->Collections(Heap::kNew);
3016
3018 void* data;
3019 intptr_t len;
3020 Dart_Handle result = Dart_TypedDataAcquireData(bytes, &type, &data, &len);
3022
3024 Dart_NewWeakPersistentHandle(bytes, nullptr, 100 * MB, NopCallback);
3025 EXPECT_VALID(reinterpret_cast<Dart_Handle>(weak));
3026
3027 EXPECT_EQ(gc_count_before,
3028 Thread::Current()->heap()->Collections(Heap::kNew));
3029
3032
3033 EXPECT_LT(gc_count_before,
3034 Thread::Current()->heap()->Collections(Heap::kNew));
3035}

◆ TEST_CASE() [65/600]

dart::TEST_CASE ( DartAPI_ExternalByteDataAccess  )

Definition at line 2281 of file dart_api_impl_test.cc.

2281 {
2282 // TODO(asiva): Once we have getInt16LE and getInt16BE support use the
2283 // appropriate getter instead of the host endian format used now.
2284 const char* kScriptChars = R"(
2285import 'dart:typed_data';
2286class Expect {
2287 static equals(a, b) {
2288 if (a != b) {
2289 throw 'not equal. expected: $a, got: $b';
2290 }
2291 }
2292}
2293@pragma("vm:external-name", "CreateExternalByteData")
2294external ByteData createExternalByteData();
2295ByteData main() {
2296 var length = 16;
2297 var a = createExternalByteData();
2298 Expect.equals(length, a.lengthInBytes);
2299 for (int i = 0; i < length; i+=2) {
2300 Expect.equals(0x4241, a.getInt16(i, Endian.little));
2301 }
2302 for (int i = 0; i < length; i+=2) {
2303 a.setInt8(i, 0x24);
2304 a.setInt8(i + 1, 0x28);
2305 }
2306 for (int i = 0; i < length; i+=2) {
2307 Expect.equals(0x2824, a.getInt16(i, Endian.little));
2308 }
2309 return a;
2310}
2311)";
2312 // Create a test library and Load up a test script in it.
2313 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
2314
2316 Dart_SetNativeResolver(lib, &ExternalByteDataNativeResolver, nullptr);
2318
2319 // Invoke 'main' function.
2320 result = Dart_Invoke(lib, NewString("main"), 0, nullptr);
2322
2323 for (intptr_t i = 0; i < kExtLength; i += 2) {
2324 EXPECT_EQ(0x24, data[i]);
2325 EXPECT_EQ(0x28, data[i + 1]);
2326 }
2327}
static constexpr intptr_t kExtLength

◆ TEST_CASE() [66/600]

dart::TEST_CASE ( DartAPI_ExternalByteDataFinalizer  )

Definition at line 2336 of file dart_api_impl_test.cc.

2336 {
2337 // Check finalizer associated with the underlying array instead of the
2338 // wrapper.
2339 const char* kScriptChars =
2340 "var array;\n"
2341 "extractAndSaveArray(byteData) {\n"
2342 " array = byteData.buffer.asUint8List();\n"
2343 "}\n"
2344 "releaseArray() {\n"
2345 " array = null;\n"
2346 "}\n";
2347 // Create a test library and Load up a test script in it.
2348 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
2349
2350 {
2352
2353 const intptr_t kBufferSize = 100;
2354 void* buffer = malloc(kBufferSize);
2355 // The buffer becomes readable by Dart, so ensure it is initialized to
2356 // satisfy our eager MSAN check.
2357 memset(buffer, 0, kBufferSize);
2360 ByteDataFinalizer);
2361
2363 Dart_Invoke(lib, NewString("extractAndSaveArray"), 1, &byte_data);
2365
2366 // ByteData wrapper is still reachable from the scoped handle.
2367 EXPECT(!byte_data_finalizer_run);
2368
2369 // The ByteData wrapper is now unreachable, but the underlying
2370 // ExternalUint8List is still alive.
2372 }
2373
2374 {
2375 TransitionNativeToVM transition(Thread::Current());
2376 GCTestHelper::CollectAllGarbage();
2377 }
2378
2379 EXPECT(!byte_data_finalizer_run);
2380
2381 Dart_Handle result = Dart_Invoke(lib, NewString("releaseArray"), 0, nullptr);
2383
2384 {
2385 TransitionNativeToVM transition(Thread::Current());
2386 GCTestHelper::CollectAllGarbage();
2387 }
2388
2389 EXPECT(byte_data_finalizer_run);
2390}

◆ TEST_CASE() [67/600]

dart::TEST_CASE ( DartAPI_ExternalClampedTypedDataAccess  )

Definition at line 3102 of file dart_api_impl_test.cc.

3102 {
3103 uint8_t data[] = {0, 11, 22, 33, 44, 55, 66, 77};
3104 intptr_t data_length = ARRAY_SIZE(data);
3105
3107 data, data_length);
3108 ExternalTypedDataAccessTests(obj, Dart_TypedData_kUint8Clamped, data,
3109 data_length);
3110}

◆ TEST_CASE() [68/600]

dart::TEST_CASE ( DartAPI_ExternalTypedDataAccess  )

Definition at line 3093 of file dart_api_impl_test.cc.

3093 {
3094 uint8_t data[] = {0, 11, 22, 33, 44, 55, 66, 77};
3095 intptr_t data_length = ARRAY_SIZE(data);
3096
3097 Dart_Handle obj =
3099 ExternalTypedDataAccessTests(obj, Dart_TypedData_kUint8, data, data_length);
3100}

◆ TEST_CASE() [69/600]

dart::TEST_CASE ( DartAPI_ExternalTypedDataCallback  )

Definition at line 3155 of file dart_api_impl_test.cc.

3155 {
3156 int peer = 0;
3157 {
3159 uint8_t data[] = {1, 2, 3, 4};
3161 Dart_TypedData_kUint8, data, ARRAY_SIZE(data), &peer, sizeof(data),
3162 ExternalTypedDataFinalizer);
3163 EXPECT_VALID(obj);
3165 }
3166 {
3167 TransitionNativeToVM transition(thread);
3168 EXPECT(peer == 0);
3169 GCTestHelper::CollectNewSpace();
3170 EXPECT(peer == 42);
3171 }
3172}

◆ TEST_CASE() [70/600]

dart::TEST_CASE ( DartAPI_ExternalTypedDataPretenure  )

Definition at line 1709 of file dart_api_impl_test.cc.

1709 {
1710 {
1712 const int kBigLength = 16 * MB / 8;
1713 int64_t* big_data = new int64_t[kBigLength]();
1714 Dart_Handle big =
1715 Dart_NewExternalTypedData(Dart_TypedData_kInt64, big_data, kBigLength);
1716 EXPECT_VALID(big);
1717 const int kSmallLength = 16 * KB / 8;
1718 int64_t* small_data = new int64_t[kSmallLength]();
1720 small_data, kSmallLength);
1721 EXPECT_VALID(small);
1722 {
1723 CHECK_API_SCOPE(thread);
1724 TransitionNativeToVM transition(thread);
1725 HANDLESCOPE(thread);
1726 ExternalTypedData& handle = ExternalTypedData::Handle();
1727 handle ^= Api::UnwrapHandle(big);
1728 EXPECT(handle.IsOld());
1729 handle ^= Api::UnwrapHandle(small);
1730 EXPECT(handle.IsNew());
1731 }
1733 delete[] big_data;
1734 delete[] small_data;
1735 }
1736}
bool IsNew() const
Definition object.h:390
bool IsOld() const
Definition object.h:391
constexpr intptr_t KB
Definition globals.h:528

◆ TEST_CASE() [71/600]

dart::TEST_CASE ( DartAPI_ExternalUint8ClampedArrayAccess  )

Definition at line 3112 of file dart_api_impl_test.cc.

3112 {
3113 const char* kScriptChars =
3114 "testClamped(List a) {\n"
3115 " if (a[1] != 11) return false;\n"
3116 " a[1] = 3;\n"
3117 " if (a[1] != 3) return false;\n"
3118 " a[1] = -12;\n"
3119 " if (a[1] != 0) return false;\n"
3120 " a[1] = 1200;\n"
3121 " if (a[1] != 255) return false;\n"
3122 " return true;\n"
3123 "}\n";
3124
3125 uint8_t data[] = {0, 11, 22, 33, 44, 55, 66, 77};
3126 intptr_t data_length = ARRAY_SIZE(data);
3128 data, data_length);
3129 EXPECT_VALID(obj);
3131 // Create a test library and Load up a test script in it.
3132 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
3133 Dart_Handle args[1];
3134 args[0] = obj;
3135 result = Dart_Invoke(lib, NewString("testClamped"), 1, args);
3136
3137 // Check that result is true.
3140 bool value = false;
3141 result = Dart_BooleanValue(result, &value);
3143 EXPECT(value);
3144}

◆ TEST_CASE() [72/600]

dart::TEST_CASE ( DartAPI_FieldAccess  )

Definition at line 5149 of file dart_api_impl_test.cc.

5149 {
5150 const char* kScriptChars =
5151 "class BaseFields {\n"
5152 " BaseFields()\n"
5153 " : this.inherited_fld = 'inherited' {\n"
5154 " }\n"
5155 " var inherited_fld;\n"
5156 " static var non_inherited_fld;\n"
5157 "}\n"
5158 "\n"
5159 "class Fields extends BaseFields {\n"
5160 " Fields()\n"
5161 " : this.instance_fld = 'instance',\n"
5162 " this._instance_fld = 'hidden instance',\n"
5163 " this.final_instance_fld = 'final instance',\n"
5164 " this._final_instance_fld = 'hidden final instance' {\n"
5165 " instance_getset_fld = 'instance getset';\n"
5166 " _instance_getset_fld = 'hidden instance getset';\n"
5167 " }\n"
5168 "\n"
5169 " static Init() {\n"
5170 " static_fld = 'static';\n"
5171 " _static_fld = 'hidden static';\n"
5172 " static_getset_fld = 'static getset';\n"
5173 " _static_getset_fld = 'hidden static getset';\n"
5174 " }\n"
5175 "\n"
5176 " var instance_fld;\n"
5177 " var _instance_fld;\n"
5178 " final final_instance_fld;\n"
5179 " final _final_instance_fld;\n"
5180 " static var static_fld;\n"
5181 " static var _static_fld;\n"
5182 " static const const_static_fld = 'const static';\n"
5183 " static const _const_static_fld = 'hidden const static';\n"
5184 "\n"
5185 " get instance_getset_fld { return _gs_fld1; }\n"
5186 " void set instance_getset_fld(var value) { _gs_fld1 = value; }\n"
5187 " get _instance_getset_fld { return _gs_fld2; }\n"
5188 " void set _instance_getset_fld(var value) { _gs_fld2 = value; }\n"
5189 " var _gs_fld1;\n"
5190 " var _gs_fld2;\n"
5191 "\n"
5192 " static get static_getset_fld { return _gs_fld3; }\n"
5193 " static void set static_getset_fld(var value) { _gs_fld3 = value; }\n"
5194 " static get _static_getset_fld { return _gs_fld4; }\n"
5195 " static void set _static_getset_fld(var value) { _gs_fld4 = value; }\n"
5196 " static var _gs_fld3;\n"
5197 " static var _gs_fld4;\n"
5198 "}\n"
5199 "var top_fld;\n"
5200 "var _top_fld;\n"
5201 "const const_top_fld = 'const top';\n"
5202 "const _const_top_fld = 'hidden const top';\n"
5203 "\n"
5204 "get top_getset_fld { return _gs_fld5; }\n"
5205 "void set top_getset_fld(var value) { _gs_fld5 = value; }\n"
5206 "get _top_getset_fld { return _gs_fld6; }\n"
5207 "void set _top_getset_fld(var value) { _gs_fld6 = value; }\n"
5208 "var _gs_fld5;\n"
5209 "var _gs_fld6;\n"
5210 "\n"
5211 "Fields test() {\n"
5212 " Fields.Init();\n"
5213 " top_fld = 'top';\n"
5214 " _top_fld = 'hidden top';\n"
5215 " top_getset_fld = 'top getset';\n"
5216 " _top_getset_fld = 'hidden top getset';\n"
5217 " return new Fields();\n"
5218 "}\n";
5219 const char* kImportedScriptChars =
5220 "library library_name;\n"
5221 "var imported_fld = 'imported';\n"
5222 "var _imported_fld = 'hidden imported';\n"
5223 "get imported_getset_fld { return _gs_fld1; }\n"
5224 "void set imported_getset_fld(var value) { _gs_fld1 = value; }\n"
5225 "get _imported_getset_fld { return _gs_fld2; }\n"
5226 "void set _imported_getset_fld(var value) { _gs_fld2 = value; }\n"
5227 "var _gs_fld1;\n"
5228 "var _gs_fld2;\n"
5229 "void test2() {\n"
5230 " imported_getset_fld = 'imported getset';\n"
5231 " _imported_getset_fld = 'hidden imported getset';\n"
5232 "}\n";
5233
5234 // Shared setup.
5235 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
5237 Dart_GetNonNullableType(lib, NewString("Fields"), 0, nullptr);
5239 Dart_Handle instance = Dart_Invoke(lib, NewString("test"), 0, nullptr);
5242
5243 // Load imported lib.
5244 Dart_Handle imported_lib =
5245 TestCase::LoadTestLibrary("library_url", kImportedScriptChars);
5246 EXPECT_VALID(imported_lib);
5249 result = Dart_Invoke(imported_lib, NewString("test2"), 0, nullptr);
5251
5252 // Instance field.
5253 name = NewString("instance_fld");
5254 TestFieldNotFound(lib, name);
5256 TestFieldOk(instance, name, false, "instance");
5257
5258 // Hidden instance field.
5259 name = NewString("_instance_fld");
5260 TestFieldNotFound(lib, name);
5262 TestFieldOk(instance, name, false, "hidden instance");
5263
5264 // Final instance field.
5265 name = NewString("final_instance_fld");
5266 TestFieldNotFound(lib, name);
5268 TestFieldOk(instance, name, true, "final instance");
5269
5270 // Hidden final instance field.
5271 name = NewString("_final_instance_fld");
5272 TestFieldNotFound(lib, name);
5274 TestFieldOk(instance, name, true, "hidden final instance");
5275
5276 // Inherited field.
5277 name = NewString("inherited_fld");
5278 TestFieldNotFound(lib, name);
5280 TestFieldOk(instance, name, false, "inherited");
5281
5282 // Instance get/set field.
5283 name = NewString("instance_getset_fld");
5284 TestFieldNotFound(lib, name);
5286 TestFieldOk(instance, name, false, "instance getset");
5287
5288 // Hidden instance get/set field.
5289 name = NewString("_instance_getset_fld");
5290 TestFieldNotFound(lib, name);
5292 TestFieldOk(instance, name, false, "hidden instance getset");
5293
5294 // Static field.
5295 name = NewString("static_fld");
5296 TestFieldNotFound(lib, name);
5298 TestFieldOk(type, name, false, "static");
5299
5300 // Hidden static field.
5301 name = NewString("_static_fld");
5302 TestFieldNotFound(lib, name);
5304 TestFieldOk(type, name, false, "hidden static");
5305
5306 // Static final field.
5307 name = NewString("const_static_fld");
5308 TestFieldNotFound(lib, name);
5310 TestFieldOk(type, name, true, "const static");
5311
5312 // Hidden static const field.
5313 name = NewString("_const_static_fld");
5314 TestFieldNotFound(lib, name);
5316 TestFieldOk(type, name, true, "hidden const static");
5317
5318 // Static non-inherited field. Not found at any level.
5319 name = NewString("non_inherited_fld");
5320 TestFieldNotFound(lib, name);
5323
5324 // Static get/set field.
5325 name = NewString("static_getset_fld");
5326 TestFieldNotFound(lib, name);
5328 TestFieldOk(type, name, false, "static getset");
5329
5330 // Hidden static get/set field.
5331 name = NewString("_static_getset_fld");
5332 TestFieldNotFound(lib, name);
5334 TestFieldOk(type, name, false, "hidden static getset");
5335
5336 // Top-Level field.
5337 name = NewString("top_fld");
5340 TestFieldOk(lib, name, false, "top");
5341
5342 // Hidden top-level field.
5343 name = NewString("_top_fld");
5346 TestFieldOk(lib, name, false, "hidden top");
5347
5348 // Top-Level final field.
5349 name = NewString("const_top_fld");
5352 TestFieldOk(lib, name, true, "const top");
5353
5354 // Hidden top-level final field.
5355 name = NewString("_const_top_fld");
5358 TestFieldOk(lib, name, true, "hidden const top");
5359
5360 // Top-Level get/set field.
5361 name = NewString("top_getset_fld");
5364 TestFieldOk(lib, name, false, "top getset");
5365
5366 // Hidden top-level get/set field.
5367 name = NewString("_top_getset_fld");
5370 TestFieldOk(lib, name, false, "hidden top getset");
5371
5372 // Imported top-Level field.
5373 name = NewString("imported_fld");
5376 TestFieldNotFound(lib, name);
5377
5378 // Hidden imported top-level field. Not found at any level.
5379 name = NewString("_imported_fld");
5382 TestFieldNotFound(lib, name);
5383
5384 // Imported top-Level get/set field.
5385 name = NewString("imported_getset_fld");
5388 TestFieldNotFound(lib, name);
5389
5390 // Hidden imported top-level get/set field. Not found at any level.
5391 name = NewString("_imported_getset_fld");
5394 TestFieldNotFound(lib, name);
5395}
static void TestFieldOk(Dart_Handle container, Dart_Handle name, bool final, const char *initial_value)
static void TestFieldNotFound(Dart_Handle container, Dart_Handle name)

◆ TEST_CASE() [73/600]

dart::TEST_CASE ( DartAPI_FinalizableHandle  )

Definition at line 3604 of file dart_api_impl_test.cc.

3604 {
3605 void* peer = reinterpret_cast<void*>(0);
3606 Dart_Handle local_new_ref = Dart_Null();
3607 finalizable_new_ref = Dart_NewFinalizableHandle(local_new_ref, peer, 0,
3608 FinalizableHandleCallback);
3610
3611 peer = reinterpret_cast<void*>(1);
3612 Dart_Handle local_old_ref = Dart_Null();
3613 finalizable_old_ref = Dart_NewFinalizableHandle(local_old_ref, peer, 0,
3614 FinalizableHandleCallback);
3616
3617 {
3619
3620 Dart_Handle new_ref, old_ref;
3621 {
3622 // GCs due to allocations or weak handle creation can cause early
3623 // promotion and interfere with the scenario this test is verifying.
3624 ForceGrowthScope force_growth(thread);
3625
3626 // Create an object in new space.
3627 new_ref = AllocateNewString("new string");
3628 EXPECT_VALID(new_ref);
3629
3630 // Create an object in old space.
3631 old_ref = AllocateOldString("old string");
3632 EXPECT_VALID(old_ref);
3633
3634 // Create a weak ref to the new space object.
3635 peer = reinterpret_cast<void*>(2);
3637 new_ref, peer, 0, FinalizableHandleCallback);
3639
3640 // Create a weak ref to the old space object.
3641 peer = reinterpret_cast<void*>(3);
3643 old_ref, peer, 0, FinalizableHandleCallback);
3645 }
3646
3647 {
3648 TransitionNativeToVM transition(thread);
3649 // Garbage collect new space.
3650 GCTestHelper::CollectNewSpace();
3651 }
3652
3653 // Nothing should be invalidated or cleared.
3654 EXPECT_VALID(new_ref);
3655 EXPECT(!Dart_IsNull(new_ref));
3656 EXPECT_VALID(old_ref);
3657 EXPECT(!Dart_IsNull(old_ref));
3658
3659 {
3660 TransitionNativeToVM transition(thread);
3661 // Garbage collect old space.
3662 GCTestHelper::CollectOldSpace();
3663 }
3664
3665 // Nothing should be invalidated or cleared.
3666 EXPECT_VALID(new_ref);
3667 EXPECT(!Dart_IsNull(new_ref));
3668 EXPECT_VALID(old_ref);
3669 EXPECT(!Dart_IsNull(old_ref));
3670
3671 // Delete local (strong) references.
3673 }
3674
3675 {
3676 TransitionNativeToVM transition(thread);
3677 // Garbage collect new space again.
3678 GCTestHelper::CollectNewSpace();
3679 }
3680
3681 {
3683 // Weak ref to new space object should now be cleared.
3684 EXPECT(finalizable_new_ref == nullptr);
3686 }
3687
3688 {
3689 TransitionNativeToVM transition(thread);
3690 // Garbage collect old space again.
3691 GCTestHelper::CollectOldSpace();
3692 }
3693
3694 {
3696 // Weak ref to old space object should now be cleared.
3697 EXPECT(finalizable_new_ref == nullptr);
3698 EXPECT(finalizable_old_ref == nullptr);
3700 }
3701
3702 {
3703 TransitionNativeToVM transition(thread);
3704 GCTestHelper::CollectAllGarbage();
3705 }
3706}
static Dart_Handle AllocateNewString(const char *c_str)
static void * finalizable_old_ref_peer
static Dart_FinalizableHandle finalizable_old_ref

◆ TEST_CASE() [74/600]

dart::TEST_CASE ( DartAPI_FinalizableHandleCallback  )

Definition at line 3957 of file dart_api_impl_test.cc.

3957 {
3958 int peer = 0;
3959 {
3961 Dart_Handle obj = NewString("new string");
3962 EXPECT_VALID(obj);
3963 Dart_NewFinalizableHandle(obj, &peer, 0, FinalizableHandlePeerFinalizer);
3964 EXPECT(peer == 0);
3966 }
3967 {
3968 TransitionNativeToVM transition(thread);
3969 GCTestHelper::CollectNewSpace();
3970 EXPECT(peer == 42);
3971 }
3972}

◆ TEST_CASE() [75/600]

dart::TEST_CASE ( DartAPI_FinalizableHandleCleanupFinalizer  )

Definition at line 3897 of file dart_api_impl_test.cc.

3897 {
3898 Heap* heap = IsolateGroup::Current()->heap();
3899
3900 const char* kTestString1 = "Test String1";
3902 CHECK_API_SCOPE(thread);
3903 Dart_Handle ref1 = Dart_NewStringFromCString(kTestString1);
3905 Dart_Handle ref2 = Dart_NewStringFromCString(kTestString1);
3906 int peer2 = 0;
3908 Dart_NewWeakPersistentHandle(ref2, &peer2, 0, NopCallback);
3909 int peer3 = 0;
3910 {
3912 Dart_Handle ref3 = Dart_NewStringFromCString(kTestString1);
3914 ref3, &peer3, 0, FinalizableHandlePeerCleanupFinalizer);
3916 }
3917 {
3918 TransitionNativeToVM transition(thread);
3919 GCTestHelper::CollectAllGarbage();
3920 EXPECT(heap->ExternalInWords(Heap::kOld) == 0);
3921 EXPECT(peer3 == 42);
3922 }
3924}
intptr_t ExternalInWords(Space space) const
Definition heap.cc:800
static Dart_WeakPersistentHandle weak_persistent_handle2
static Dart_FinalizableHandle finalizable_handle3
static Dart_PersistentHandle persistent_handle1

◆ TEST_CASE() [76/600]

dart::TEST_CASE ( DartAPI_FinalizableHandleErrors  )

Definition at line 3768 of file dart_api_impl_test.cc.

3768 {
3770
3771 // nullptr callback.
3772 Dart_Handle obj1 = NewString("new string");
3773 EXPECT_VALID(obj1);
3775 Dart_NewFinalizableHandle(obj1, nullptr, 0, nullptr);
3776 EXPECT_EQ(ref1, static_cast<void*>(nullptr));
3777
3778 // Immediate object.
3779 Dart_Handle obj2 = Dart_NewInteger(0);
3780 EXPECT_VALID(obj2);
3782 Dart_NewFinalizableHandle(obj2, nullptr, 0, FinalizableHandleCallback);
3783 EXPECT_EQ(ref2, static_cast<void*>(nullptr));
3784
3785 // Pointer object.
3786 Dart_Handle ffi_lib = Dart_LookupLibrary(NewString("dart:ffi"));
3787 Dart_Handle pointer_type =
3788 Dart_GetNonNullableType(ffi_lib, NewString("Pointer"), 0, nullptr);
3789 Dart_Handle obj3 = Dart_Allocate(pointer_type);
3790 EXPECT_VALID(obj3);
3792 Dart_NewFinalizableHandle(obj3, nullptr, 0, FinalizableHandleCallback);
3793 EXPECT_EQ(ref3, static_cast<void*>(nullptr));
3794
3795 // Subtype of Struct or Union object.
3796 const char* kScriptChars = R"(
3797 import 'dart:ffi';
3798
3799 final class MyStruct extends Struct {
3800 external Pointer notEmpty;
3801 }
3802
3803 final class MyUnion extends Union {
3804 external Pointer notEmpty;
3805 }
3806 )";
3807 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
3808
3809 Dart_Handle my_struct_type =
3810 Dart_GetNonNullableType(lib, NewString("MyStruct"), 0, nullptr);
3811 Dart_Handle obj4 = Dart_Allocate(my_struct_type);
3812 EXPECT_VALID(obj4);
3814 Dart_NewFinalizableHandle(obj4, nullptr, 0, FinalizableHandleCallback);
3815 EXPECT_EQ(ref4, static_cast<void*>(nullptr));
3816
3817 Dart_Handle my_union_type =
3818 Dart_GetNonNullableType(lib, NewString("MyUnion"), 0, nullptr);
3819 Dart_Handle obj5 = Dart_Allocate(my_union_type);
3820 EXPECT_VALID(obj5);
3822 Dart_NewFinalizableHandle(obj4, nullptr, 0, FinalizableHandleCallback);
3823 EXPECT_EQ(ref5, static_cast<void*>(nullptr));
3824
3826}
DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_Allocate(Dart_Handle type)

◆ TEST_CASE() [77/600]

dart::TEST_CASE ( DartAPI_FinalizableHandleExternalAllocationSize  )

Definition at line 4144 of file dart_api_impl_test.cc.

4144 {
4145 Heap* heap = IsolateGroup::Current()->heap();
4146 EXPECT_EQ(heap->ExternalInWords(Heap::kNew), 0);
4147 EXPECT_EQ(heap->ExternalInWords(Heap::kOld), 0);
4148 const intptr_t kWeak1ExternalSize = 1 * KB;
4149 {
4151 Dart_Handle obj = NewString("weakly referenced string");
4152 EXPECT_VALID(obj);
4153 Dart_NewFinalizableHandle(obj, nullptr, kWeak1ExternalSize, NopCallback);
4155 }
4156 Dart_PersistentHandle strong_ref = nullptr;
4157 const intptr_t kWeak2ExternalSize = 2 * KB;
4158 {
4160 Dart_Handle obj = NewString("strongly referenced string");
4161 EXPECT_VALID(obj);
4162 strong_ref = Dart_NewPersistentHandle(obj);
4163 Dart_NewFinalizableHandle(obj, nullptr, kWeak2ExternalSize, NopCallback);
4164 EXPECT_VALID(AsHandle(strong_ref));
4166 }
4167 {
4168 TransitionNativeToVM transition(thread);
4169 EXPECT_EQ(heap->ExternalInWords(Heap::kNew),
4170 (kWeak1ExternalSize + kWeak2ExternalSize) / kWordSize);
4171 EXPECT_EQ(heap->ExternalInWords(Heap::kOld), 0);
4172 // Collect weakly referenced string.
4173 GCTestHelper::CollectNewSpace();
4174 EXPECT_EQ(heap->ExternalInWords(Heap::kNew),
4175 kWeak2ExternalSize / kWordSize);
4176 EXPECT_EQ(heap->ExternalInWords(Heap::kOld), 0);
4177 // Promote strongly referenced string.
4178 GCTestHelper::CollectNewSpace();
4179 EXPECT_EQ(heap->ExternalInWords(Heap::kNew), 0);
4180 EXPECT_EQ(heap->ExternalInWords(Heap::kOld),
4181 kWeak2ExternalSize / kWordSize);
4182 }
4183 Dart_DeletePersistentHandle(strong_ref);
4184 {
4185 TransitionNativeToVM transition(thread);
4186 GCTestHelper::CollectOldSpace();
4187 EXPECT_EQ(heap->ExternalInWords(Heap::kNew), 0);
4188 EXPECT_EQ(heap->ExternalInWords(Heap::kOld), 0);
4189 }
4190}

◆ TEST_CASE() [78/600]

dart::TEST_CASE ( DartAPI_FinalizableHandleExternalAllocationSizeNewspaceGC  )

Definition at line 4234 of file dart_api_impl_test.cc.

4234 {
4235 Heap* heap = IsolateGroup::Current()->heap();
4236 Dart_FinalizableHandle weak1 = nullptr;
4237 Dart_PersistentHandle strong1 = nullptr;
4238 // Large enough to exceed any new space limit. Not actually allocated.
4239 const intptr_t kWeak1ExternalSize = 500 * MB;
4240 {
4242 Dart_Handle obj = NewString("weakly referenced string");
4243 EXPECT_VALID(obj);
4244 // Triggers a scavenge immediately, since kWeak1ExternalSize is above limit.
4245 weak1 = Dart_NewFinalizableHandle(obj, nullptr, kWeak1ExternalSize,
4246 NopCallback);
4247 strong1 = Dart_NewPersistentHandle(obj);
4248 // ... but the object is still alive and not yet promoted, so external size
4249 // in new space is still above the limit. Thus, even the following tiny
4250 // external allocation will trigger another scavenge.
4251 Dart_FinalizableHandle trigger =
4252 Dart_NewFinalizableHandle(obj, nullptr, 1, NopCallback);
4253 Dart_DeleteFinalizableHandle(trigger, obj);
4254 // After the two scavenges above, 'obj' should now be promoted, hence its
4255 // external size charged to old space.
4256 {
4257 CHECK_API_SCOPE(thread);
4258 TransitionNativeToVM transition(thread);
4259 HANDLESCOPE(thread);
4260 String& handle = String::Handle(thread->zone());
4261 handle ^= Api::UnwrapHandle(obj);
4262 EXPECT(handle.IsOld());
4263 }
4264 EXPECT(heap->ExternalInWords(Heap::kNew) == 0);
4265 EXPECT(heap->ExternalInWords(Heap::kOld) == kWeak1ExternalSize / kWordSize);
4267 }
4268 Dart_DeleteFinalizableHandle(weak1, strong1);
4270 {
4271 TransitionNativeToVM transition(thread);
4272 GCTestHelper::CollectOldSpace();
4273 EXPECT_EQ(0, heap->ExternalInWords(Heap::kOld));
4274 }
4275}
DART_EXPORT void Dart_DeleteFinalizableHandle(Dart_FinalizableHandle object, Dart_Handle strong_ref_to_object)

◆ TEST_CASE() [79/600]

dart::TEST_CASE ( DartAPI_FinalizableHandleExternalAllocationSizeOddReferents  )

Definition at line 4391 of file dart_api_impl_test.cc.

4391 {
4392 Heap* heap = IsolateGroup::Current()->heap();
4393 Dart_FinalizableHandle weak1 = nullptr;
4394 Dart_PersistentHandle strong1 = nullptr;
4395 const intptr_t kWeak1ExternalSize = 1 * KB;
4396 Dart_FinalizableHandle weak2 = nullptr;
4397 Dart_PersistentHandle strong2 = nullptr;
4398 const intptr_t kWeak2ExternalSize = 2 * KB;
4399 EXPECT_EQ(0, heap->ExternalInWords(Heap::kOld));
4400 {
4402 Dart_Handle dart_true = Dart_True(); // VM heap object.
4403 EXPECT_VALID(dart_true);
4404 weak1 = Dart_NewFinalizableHandle(dart_true, nullptr, kWeak1ExternalSize,
4405 UnreachedCallback);
4406 strong1 = Dart_NewPersistentHandle(dart_true);
4407 Dart_Handle zero = Dart_False(); // VM heap object.
4408 EXPECT_VALID(zero);
4409 weak2 = Dart_NewFinalizableHandle(zero, nullptr, kWeak2ExternalSize,
4410 UnreachedCallback);
4411 strong2 = Dart_NewPersistentHandle(zero);
4412 // Both should be charged to old space.
4413 EXPECT(heap->ExternalInWords(Heap::kOld) ==
4414 (kWeak1ExternalSize + kWeak2ExternalSize) / kWordSize);
4416 }
4417 Dart_DeleteFinalizableHandle(weak1, strong1);
4419 Dart_DeleteFinalizableHandle(weak2, strong2);
4421 EXPECT_EQ(0, heap->ExternalInWords(Heap::kOld));
4422 {
4423 TransitionNativeToVM transition(thread);
4424 GCTestHelper::CollectOldSpace();
4425 EXPECT_EQ(0, heap->ExternalInWords(Heap::kOld));
4426 }
4427}
static Dart_WeakPersistentHandle weak2

◆ TEST_CASE() [80/600]

dart::TEST_CASE ( DartAPI_FinalizableHandleExternalAllocationSizeOldspaceGC  )

Definition at line 4320 of file dart_api_impl_test.cc.

4320 {
4321 // Check that external allocation in old space can trigger GC.
4322 Heap* heap = IsolateGroup::Current()->heap();
4324 Dart_Handle live = AllocateOldString("live");
4325 EXPECT_VALID(live);
4326 {
4327 TransitionNativeToVM transition(thread);
4328 GCTestHelper::WaitForGCTasks(); // Finalize GC for accurate live size.
4329 EXPECT_EQ(0, heap->ExternalInWords(Heap::kOld));
4330 }
4331 const intptr_t kSmallExternalSize = 1 * KB;
4332 {
4334 Dart_Handle dead = AllocateOldString("dead");
4335 EXPECT_VALID(dead);
4336 Dart_NewFinalizableHandle(dead, nullptr, kSmallExternalSize, NopCallback);
4338 }
4339 {
4340 TransitionNativeToVM transition(thread);
4341 GCTestHelper::WaitForGCTasks(); // Finalize GC for accurate live size.
4342 EXPECT_EQ(kSmallExternalSize,
4343 heap->ExternalInWords(Heap::kOld) * kWordSize);
4344 }
4345 // Large enough to trigger GC in old space. Not actually allocated.
4346 const intptr_t kHugeExternalSize = (kWordSize == 4) ? 513 * MB : 1025 * MB;
4347 Dart_NewFinalizableHandle(live, nullptr, kHugeExternalSize, NopCallback);
4348 {
4349 TransitionNativeToVM transition(thread);
4350 GCTestHelper::WaitForGCTasks(); // Finalize GC for accurate live size.
4351 // Expect small garbage to be collected.
4352 EXPECT_EQ(kHugeExternalSize, heap->ExternalInWords(Heap::kOld) * kWordSize);
4353 }
4355}

◆ TEST_CASE() [81/600]

dart::TEST_CASE ( DartAPI_FinalizableHandleNoCallback  )

Definition at line 3998 of file dart_api_impl_test.cc.

3998 {
3999 Dart_FinalizableHandle weak_ref = nullptr;
4000 Dart_PersistentHandle strong_ref = nullptr;
4001 int peer = 0;
4002 {
4004 Dart_Handle obj = NewString("new string");
4005 EXPECT_VALID(obj);
4006 weak_ref = Dart_NewFinalizableHandle(obj, &peer, 0,
4007 FinalizableHandlePeerFinalizer);
4008 strong_ref = Dart_NewPersistentHandle(obj);
4010 }
4011 // A finalizer is not invoked on a deleted handle. Therefore, the
4012 // peer value should not change after the referent is collected.
4013 Dart_DeleteFinalizableHandle(weak_ref, strong_ref);
4014 Dart_DeletePersistentHandle(strong_ref);
4015 EXPECT(peer == 0);
4016 {
4017 TransitionNativeToVM transition(thread);
4018 GCTestHelper::CollectOldSpace();
4019 EXPECT(peer == 0);
4020 GCTestHelper::CollectNewSpace();
4021 EXPECT(peer == 0);
4022 }
4023}

◆ TEST_CASE() [82/600]

dart::TEST_CASE ( DartAPI_Float32x4List  )

Definition at line 3246 of file dart_api_impl_test.cc.

3246 {
3247 const char* kScriptChars =
3248 "import 'dart:typed_data';\n"
3249 "Float32x4List float32x4() {\n"
3250 " return new Float32x4List(10);\n"
3251 "}\n";
3252 // Create a test library and Load up a test script in it.
3253 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
3254
3255 Dart_Handle obj = Dart_Invoke(lib, NewString("float32x4"), 0, nullptr);
3256 EXPECT_VALID(obj);
3257 CheckFloat32x4Data(obj);
3258
3260 EXPECT_VALID(obj);
3261 CheckFloat32x4Data(obj);
3262
3263 int peer = 0;
3264 float data[] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
3265 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
3266 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
3267 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
3268 // Push a scope so that we can collect the local handle created as part of
3269 // Dart_NewExternalTypedData.
3271 {
3273 Dart_TypedData_kFloat32x4, data, 10, &peer, sizeof(data),
3274 ExternalTypedDataFinalizer);
3275 CheckFloat32x4Data(lcl);
3276 }
3278 {
3279 TransitionNativeToVM transition(thread);
3280 GCTestHelper::CollectNewSpace();
3281 EXPECT(peer == 42);
3282 }
3283}
static void CheckFloat32x4Data(Dart_Handle obj)

◆ TEST_CASE() [83/600]

dart::TEST_CASE ( DartAPI_FunctionIsStatic  )

Definition at line 1191 of file dart_api_impl_test.cc.

1191 {
1192 const char* kScriptChars =
1193 "int getInt() { return 1; }\n"
1194 "class Foo { String getString() => 'foobar'; }\n";
1195 // Create a test library and Load up a test script in it.
1196 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
1197 EXPECT_VALID(lib);
1198
1199 Dart_Handle closure = Dart_GetField(lib, NewString("getInt"));
1200 EXPECT_VALID(closure);
1201 if (Dart_IsClosure(closure)) {
1202 closure = Dart_ClosureFunction(closure);
1203 EXPECT_VALID(closure);
1204 }
1205
1206 bool is_static = false;
1207 Dart_Handle result = Dart_FunctionIsStatic(closure, &is_static);
1209 EXPECT(is_static);
1210
1211 Dart_Handle klass =
1212 Dart_GetNonNullableType(lib, NewString("Foo"), 0, nullptr);
1213 EXPECT_VALID(klass);
1214
1216
1217 closure = Dart_GetField(instance, NewString("getString"));
1218 EXPECT_VALID(closure);
1219 if (Dart_IsClosure(closure)) {
1220 closure = Dart_ClosureFunction(closure);
1221 EXPECT_VALID(closure);
1222 }
1223
1224 result = Dart_FunctionIsStatic(closure, &is_static);
1226 EXPECT(!is_static);
1227}
DART_EXPORT Dart_Handle Dart_FunctionIsStatic(Dart_Handle function, bool *is_static)

◆ TEST_CASE() [84/600]

dart::TEST_CASE ( DartAPI_FunctionName  )

Definition at line 1089 of file dart_api_impl_test.cc.

1089 {
1090 const char* kScriptChars = "int getInt() { return 1; }\n";
1091 // Create a test library and Load up a test script in it.
1092 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
1093 EXPECT_VALID(lib);
1094
1095 Dart_Handle closure = Dart_GetField(lib, NewString("getInt"));
1096 EXPECT_VALID(closure);
1097 if (Dart_IsClosure(closure)) {
1098 closure = Dart_ClosureFunction(closure);
1099 EXPECT_VALID(closure);
1100 }
1101
1104 const char* result_str = "";
1105 Dart_StringToCString(name, &result_str);
1106 EXPECT_STREQ(result_str, "getInt");
1107}
DART_EXPORT Dart_Handle Dart_FunctionName(Dart_Handle function)

◆ TEST_CASE() [85/600]

dart::TEST_CASE ( DartAPI_FunctionOwner  )

Definition at line 1109 of file dart_api_impl_test.cc.

1109 {
1110 const char* kScriptChars = "int getInt() { return 1; }\n";
1111 // Create a test library and Load up a test script in it.
1112 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
1113 EXPECT_VALID(lib);
1114
1115 Dart_Handle closure = Dart_GetField(lib, NewString("getInt"));
1116 EXPECT_VALID(closure);
1117 if (Dart_IsClosure(closure)) {
1118 closure = Dart_ClosureFunction(closure);
1119 EXPECT_VALID(closure);
1120 }
1121
1122 const char* url = "";
1123 Dart_Handle owner = Dart_FunctionOwner(closure);
1124 EXPECT_VALID(owner);
1125 Dart_Handle owner_url = Dart_LibraryUrl(owner);
1126 EXPECT_VALID(owner_url);
1127 Dart_StringToCString(owner_url, &url);
1128
1129 const char* lib_url = "";
1130 Dart_Handle library_url = Dart_LibraryUrl(lib);
1131 EXPECT_VALID(library_url);
1132 Dart_StringToCString(library_url, &lib_url);
1133
1134 EXPECT_STREQ(url, lib_url);
1135}
DART_EXPORT Dart_Handle Dart_FunctionOwner(Dart_Handle function)

◆ TEST_CASE() [86/600]

dart::TEST_CASE ( DartAPI_GetField_CheckIsolate  )

Definition at line 5928 of file dart_api_impl_test.cc.

5928 {
5929 const char* kScriptChars =
5930 "class TestClass {\n"
5931 " static int fld2 = 11;\n"
5932 " static void testMain() {\n"
5933 " }\n"
5934 "}\n";
5936 int64_t value = 0;
5937
5938 // Create a test library and Load up a test script in it.
5939 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
5941 Dart_GetNonNullableType(lib, NewString("TestClass"), 0, nullptr);
5943
5944 result = Dart_GetField(type, NewString("fld2"));
5947 EXPECT_EQ(11, value);
5948}

◆ TEST_CASE() [87/600]

dart::TEST_CASE ( DartAPI_GetNativeArgumentCount  )

Definition at line 7269 of file dart_api_impl_test.cc.

7272 {
7273 const char* kScriptChars = R"(
7274class MyObject {
7275 @pragma("vm:external-name", "Name_Does_Not_Matter")
7276 external int method1(int i, int j);
7277}
7278testMain() {
7279 MyObject obj = new MyObject();
7280 return obj.method1(77, 125);
7281})";
7282
7283 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, gnac_lookup);
7284
7285 Dart_Handle result = Dart_Invoke(lib, NewString("testMain"), 0, nullptr);
7288
7289 int64_t value = 0;

◆ TEST_CASE() [88/600]

dart::TEST_CASE ( DartAPI_GetNativeArguments  )

Definition at line 7212 of file dart_api_impl_test.cc.

7215 {
7216 const char* kScriptChars = R"(
7217import 'dart:nativewrappers';
7218base class MyObject extends NativeFieldWrapperClass2 {
7219 @pragma("vm:external-name", "NativeArgument_Create")
7220 external static MyObject createObject();
7221 @pragma("vm:external-name", "NativeArgument_Access")
7222 external int accessFields(int arg1,
7223 int arg2,
7224 bool arg3,
7225 double arg4,
7226 String arg5,
7227 String arg6,
7228 MyObject arg7);
7229}
7230int testMain(String extstr) {
7231 String str = 'abcdefg';
7232 MyObject obj1 = MyObject.createObject();
7233 MyObject obj2 = MyObject.createObject();
7234 return obj1.accessFields(77,
7235 0x8000000000000000,
7236 true,
7237 3.14,
7238 str,
7239 extstr,
7240 obj2);
7241})";
7242
7243 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, native_args_lookup);
7244
7245 const char* ascii_str = "string";
7246 intptr_t ascii_str_length = strlen(ascii_str);
7248 reinterpret_cast<const uint8_t*>(ascii_str), ascii_str_length);
7249
7250 Dart_Handle args[1];
7251 args[0] = str;
7252 Dart_Handle result = Dart_Invoke(lib, NewString("testMain"), 1, args);

◆ TEST_CASE() [89/600]

dart::TEST_CASE ( DartAPI_GetNonNullableType  )

Definition at line 7411 of file dart_api_impl_test.cc.

7414 {
7415 const char* kScriptChars =
7416 "library testlib;\n"
7417 "class Class {\n"
7418 " static var name = 'Class';\n"
7419 "}\n"
7420 "\n"
7421 "class _Class {\n"
7422 " static var name = '_Class';\n"
7423 "}\n";
7424
7425 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
7426
7427 // Lookup a class.
7429 Dart_GetNonNullableType(lib, NewString("Class"), 0, nullptr);
7431 bool result = false;
7433 EXPECT(result);
7436 const char* name_cstr = "";
7438 EXPECT_STREQ("Class", name_cstr);
7439
7440 name = Dart_GetField(type, NewString("name"));
7443 EXPECT_STREQ("Class", name_cstr);
7444
7445 // Lookup a private class.
7446 type = Dart_GetNonNullableType(lib, NewString("_Class"), 0, nullptr);
7448 result = false;
7450 EXPECT(result);
7451
7452 name = Dart_GetField(type, NewString("name"));
7454 name_cstr = "";
7456 EXPECT_STREQ("_Class", name_cstr);
7457
7458 // Lookup a class that does not exist.
7459 type = Dart_GetNonNullableType(lib, NewString("DoesNotExist"), 0, nullptr);
7461 EXPECT_STREQ("Type 'DoesNotExist' not found in library 'testlib'.",
7463
7464 // Lookup a class from an error library. The error propagates.
7465 type = Dart_GetNonNullableType(Api::NewError("myerror"), NewString("Class"),
7466 0, nullptr);
7468 EXPECT_STREQ("myerror", Dart_GetError(type));
7469
7470 // Lookup a type using an error class name. The error propagates.
7471 type = Dart_GetNonNullableType(lib, Api::NewError("myerror"), 0, nullptr);
DART_EXPORT Dart_Handle Dart_IsNonNullableType(Dart_Handle type, bool *result)

◆ TEST_CASE() [90/600]

dart::TEST_CASE ( DartAPI_GetNullableType  )

Definition at line 7351 of file dart_api_impl_test.cc.

7354 {
7355 const char* kScriptChars =
7356 "library testlib;\n"
7357 "class Class {\n"
7358 " static var name = 'Class';\n"
7359 "}\n"
7360 "\n"
7361 "class _Class {\n"
7362 " static var name = '_Class';\n"
7363 "}\n";
7364
7365 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
7366
7367 // Lookup a class.
7368 Dart_Handle type = Dart_GetNullableType(lib, NewString("Class"), 0, nullptr);
7370 bool result = false;
7372 EXPECT(result);
7375 const char* name_cstr = "";
7377 EXPECT_STREQ("Class?", name_cstr);
7378
7379 name = Dart_GetField(type, NewString("name"));
7382 EXPECT_STREQ("Class", name_cstr);
7383
7384 // Lookup a private class.
7385 type = Dart_GetNullableType(lib, NewString("_Class"), 0, nullptr);
7387 result = false;
7389
7390 name = Dart_GetField(type, NewString("name"));
7392 name_cstr = "";
7394 EXPECT_STREQ("_Class", name_cstr);
7395
7396 // Lookup a class that does not exist.
7397 type = Dart_GetNullableType(lib, NewString("DoesNotExist"), 0, nullptr);
7399 EXPECT_STREQ("Type 'DoesNotExist' not found in library 'testlib'.",
7401
7402 // Lookup a class from an error library. The error propagates.
7403 type = Dart_GetNullableType(Api::NewError("myerror"), NewString("Class"), 0,
7404 nullptr);
7406 EXPECT_STREQ("myerror", Dart_GetError(type));
7407
7408 // Lookup a type using an error class name. The error propagates.
7409 type = Dart_GetNullableType(lib, Api::NewError("myerror"), 0, nullptr);
DART_EXPORT Dart_Handle Dart_IsNullableType(Dart_Handle type, bool *result)
DART_EXPORT Dart_Handle Dart_GetNullableType(Dart_Handle library, Dart_Handle class_name, intptr_t number_of_type_arguments, Dart_Handle *type_arguments)

◆ TEST_CASE() [91/600]

dart::TEST_CASE ( DartAPI_GetStaticField_RunsInitializer  )

Definition at line 5886 of file dart_api_impl_test.cc.

5886 {
5887 const char* kScriptChars =
5888 "class TestClass {\n"
5889 " static const int fld1 = 7;\n"
5890 " static int fld2 = 11;\n"
5891 " static void testMain() {\n"
5892 " }\n"
5893 "}\n";
5895 // Create a test library and Load up a test script in it.
5896 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
5898 Dart_GetNonNullableType(lib, NewString("TestClass"), 0, nullptr);
5900
5901 // Invoke a function which returns an object.
5902 result = Dart_Invoke(type, NewString("testMain"), 0, nullptr);
5904
5905 // For uninitialized fields, the getter is returned
5906 result = Dart_GetField(type, NewString("fld1"));
5908 int64_t value = 0;
5910 EXPECT_EQ(7, value);
5911
5912 result = Dart_GetField(type, NewString("fld2"));
5915 EXPECT_EQ(11, value);
5916
5917 // Overwrite fld2
5920
5921 // We now get the new value for fld2, not the initializer
5922 result = Dart_GetField(type, NewString("fld2"));
5925 EXPECT_EQ(13, value);
5926}

◆ TEST_CASE() [92/600]

dart::TEST_CASE ( DartAPI_GetStaticMethodClosure  )

Definition at line 1251 of file dart_api_impl_test.cc.

1251 {
1252 const char* kScriptChars =
1253 "class Foo {\n"
1254 " static int getInt() {\n"
1255 " return 1;\n"
1256 " }\n"
1257 " double getDouble() {\n"
1258 " return 1.0;\n"
1259 " }\n"
1260 "}\n";
1261 // Create a test library and Load up a test script in it.
1262 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
1263 EXPECT_VALID(lib);
1264 Dart_Handle foo_cls = Dart_GetClass(lib, NewString("Foo"));
1265 EXPECT_VALID(foo_cls);
1266
1267 Dart_Handle closure =
1268 Dart_GetStaticMethodClosure(lib, foo_cls, NewString("getInt"));
1269 EXPECT_VALID(closure);
1270 EXPECT(Dart_IsClosure(closure));
1271 Dart_Handle closure_str = Dart_ToString(closure);
1272 const char* result = "";
1273 Dart_StringToCString(closure_str, &result);
1274 EXPECT_SUBSTRING("getInt", result);
1275
1280 Dart_StringToCString(func_str, &result);
1281 EXPECT_SUBSTRING("getInt", result);
1282
1284 EXPECT_VALID(cls);
1285 EXPECT(Dart_IsInstance(cls));
1286 Dart_Handle cls_str = Dart_ClassName(cls);
1287 Dart_StringToCString(cls_str, &result);
1288 EXPECT_SUBSTRING("Foo", result);
1289
1291 "Dart_ClassName expects argument 'cls_type' to be non-null.");
1293 Dart_GetStaticMethodClosure(Dart_Null(), foo_cls, NewString("getInt")),
1294 "Dart_GetStaticMethodClosure expects argument 'library' to be non-null.");
1297 "Dart_GetStaticMethodClosure expects argument 'cls_type' to be "
1298 "non-null.");
1300 "Dart_GetStaticMethodClosure expects argument 'function_name' "
1301 "to be non-null.");
1302}
DART_EXPORT Dart_Handle Dart_GetStaticMethodClosure(Dart_Handle library, Dart_Handle cls_type, Dart_Handle function_name)
DART_EXPORT Dart_Handle Dart_ClassName(Dart_Handle cls_type)

◆ TEST_CASE() [93/600]

dart::TEST_CASE ( DartAPI_HeapSampling_APIAllocations  )

Definition at line 10324 of file dart_api_impl_test.cc.

10326 {
10327 return nullptr;
10328}
10329
10330TEST_CASE(Dart_SetFfiNativeResolver_DoesNotResolve) {
10331 const char* kScriptChars = R"(
10332 import 'dart:ffi';
10333 @Native<Void Function()>(symbol: 'DoesNotResolve')
10334 external void doesNotResolve();
10335 main() => doesNotResolve();
10336 )";
10337 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
10338 EXPECT_VALID(lib);
10339
10340 Dart_Handle result = Dart_SetFfiNativeResolver(lib, &NopResolver);
10342
10343 result = Dart_Invoke(lib, NewString("main"), 0, nullptr);
10344 EXPECT_ERROR(result, "Couldn't resolve function: 'DoesNotResolve'");
10345}
10346
10347TEST_CASE(DartAPI_UserTags) {
10348 Dart_Handle default_tag = Dart_GetDefaultUserTag();
10349 EXPECT_VALID(default_tag);
10350
10351 auto default_label =
10352 Utils::CStringUniquePtr(Dart_GetUserTagLabel(default_tag), std::free);
10353 EXPECT_STREQ(default_label.get(), "Default");
10354
10355 Dart_Handle current_tag = Dart_GetCurrentUserTag();
10356 EXPECT(Dart_IdentityEquals(default_tag, current_tag));
10357
10358 auto current_label =
10359 Utils::CStringUniquePtr(Dart_GetUserTagLabel(current_tag), std::free);
10360 EXPECT_STREQ(default_label.get(), current_label.get());
10361
10362 Dart_Handle new_tag = Dart_NewUserTag("Foo");
10363 EXPECT_VALID(new_tag);
10364
10365 auto new_tag_label =
10366 Utils::CStringUniquePtr(Dart_GetUserTagLabel(new_tag), std::free);
10367 EXPECT_STREQ(new_tag_label.get(), "Foo");
10368
10369 Dart_Handle old_tag = Dart_SetCurrentUserTag(new_tag);
10370 EXPECT_VALID(old_tag);
10371
10372 auto old_label =
10373 Utils::CStringUniquePtr(Dart_GetUserTagLabel(old_tag), std::free);
10374 EXPECT_STREQ(old_label.get(), default_label.get());
10375
10376 current_tag = Dart_GetCurrentUserTag();
10377 EXPECT(Dart_IdentityEquals(new_tag, current_tag));
10378
10379 current_label =
10380 Utils::CStringUniquePtr(Dart_GetUserTagLabel(current_tag), std::free);
10381 EXPECT_STREQ(current_label.get(), new_tag_label.get());
10382
10383 EXPECT(Dart_GetUserTagLabel(Dart_Null()) == nullptr);
10384
10386 "Dart_NewUserTag expects argument 'label' to be non-null");
10387
10390 "Dart_SetCurrentUserTag expects argument 'user_tag' to be non-null");
10391}
10392
10393#endif // !PRODUCT
10394
10395#if !defined(PRODUCT) || defined(FORCE_INCLUDE_SAMPLING_HEAP_PROFILER)
10396
10397static void* last_allocation_context = nullptr;
DART_EXPORT Dart_Handle Dart_GetCurrentUserTag()
DART_EXPORT Dart_Handle Dart_GetDefaultUserTag()
DART_EXPORT Dart_Handle Dart_SetCurrentUserTag(Dart_Handle user_tag)
DART_EXPORT DART_WARN_UNUSED_RESULT char * Dart_GetUserTagLabel(Dart_Handle user_tag)
DART_EXPORT Dart_Handle Dart_NewUserTag(const char *label)
static void * last_allocation_context

◆ TEST_CASE() [94/600]

dart::TEST_CASE ( DartAPI_HeapSampling_NonTrivialSamplingPeriod  )

Definition at line 10399 of file dart_api_impl_test.cc.

10406 {
10407 last_allocation_cls = cls_name;
10408 return strdup(cls_name);
10409}
10410
10411static void HeapSamplingDelete(void* data) {
10412 free(data);
10413}
10414
10415void HeapSamplingReport(void* context, void* data) {
10416 last_allocation_context = context;
10417 if (strcmp(reinterpret_cast<char*>(data), expected_allocation_cls) == 0) {
10418 found_allocation = true;
10419 }
10420 heap_samples++;
10421}
10422
10423void ResetHeapSamplingState(const char* expected_cls = nullptr) {
10424 heap_samples = 0;
10425 expected_allocation_cls = expected_cls;
10426 found_allocation = false;
10427 last_allocation_context = nullptr;
10428 last_allocation_cls = nullptr;
10429}
10430
10431// Threads won't pick up heap sampling profiler state changes until they
10432// process outstanding VM interrupts. Invoke this method after calling
10433// any of the following APIs in a test to ensure changes are applied:
10434//
10435// - Dart_EnableHeapSampling()
10436// - Dart_DisableHeapSampling()
10437// - Dart_SetHeapSamplingPeriod(...)
10438void HandleInterrupts(Thread* thread) {
10439 TransitionNativeToVM transition(thread);
10440 thread->HandleInterrupts();
10441}
10442
10443void InitHeapSampling(Thread* thread, const char* expected_cls) {
10444 ResetHeapSamplingState(expected_cls);
10445 Dart_RegisterHeapSamplingCallback(HeapSamplingCreate, HeapSamplingDelete);
10447 // Start with sampling on every byte allocated.
10449 HandleInterrupts(thread);
10450}
10451
10452TEST_CASE(DartAPI_HeapSampling_UserDefinedClass) {
10453 DisableBackgroundCompilationScope scope;
10454 const char* kScriptChars = R"(
10455 class Bar {}
10456 final list = [];
10457 foo() {
10458 for (int i = 0; i < 100000; ++i) {
10459 list.add(Bar());
10460 }
10461 }
DART_EXPORT void Dart_SetHeapSamplingPeriod(intptr_t bytes)
DART_EXPORT void Dart_RegisterHeapSamplingCallback(Dart_HeapSamplingCreateCallback create_callback, Dart_HeapSamplingDeleteCallback delete_callback)
DART_EXPORT void Dart_EnableHeapSampling(void)
static const char * last_allocation_cls
void ResetHeapSamplingState(const char *expected_cls=nullptr)
static intptr_t heap_samples
static bool found_allocation
void HandleInterrupts(Thread *thread)
void InitHeapSampling(Thread *thread, const char *expected_cls)
static const char * expected_allocation_cls
void HeapSamplingReport(void *context, void *data)

◆ TEST_CASE() [95/600]

dart::TEST_CASE ( DartAPI_HeapSampling_UserDefinedClass  )

Definition at line 10291 of file dart_api_impl_test.cc.

10309 {
10310 const char* kScriptChars = R"(
10311 import 'dart:ffi';
10312 @Native<IntPtr Function(Double)>(symbol: 'EchoInt', isLeaf:true)
10313 external int echoInt(double x);
10314 main() => echoInt(7.0);
10315 )";
10316 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
10317 EXPECT_VALID(lib);
10318
10319 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, nullptr);
10320
10321 // With no resolver, we resolve in process. Expect to not find the symbol
10322 // in processes. Error message depends on architecture.

◆ TEST_CASE() [96/600]

dart::TEST_CASE ( DartAPI_IdentityEquals  )

Definition at line 972 of file dart_api_impl_test.cc.

972 {
974 Dart_Handle five_again = Dart_NewInteger(5);
975 Dart_Handle mint = Dart_NewInteger(0xFFFFFFFF);
976 Dart_Handle mint_again = Dart_NewInteger(0xFFFFFFFF);
977 Dart_Handle abc = NewString("abc");
978 Dart_Handle abc_again = NewString("abc");
979 Dart_Handle xyz = NewString("xyz");
980 Dart_Handle dart_core = NewString("dart:core");
981 Dart_Handle dart_mirrors = NewString("dart:mirrors");
982
983 // Same objects.
984 EXPECT(Dart_IdentityEquals(five, five));
985 EXPECT(Dart_IdentityEquals(mint, mint));
986 EXPECT(Dart_IdentityEquals(abc, abc));
987 EXPECT(Dart_IdentityEquals(xyz, xyz));
988
989 // Equal objects with special spec rules.
990 EXPECT(Dart_IdentityEquals(five, five_again));
991 EXPECT(Dart_IdentityEquals(mint, mint_again));
992
993 // Equal objects without special spec rules.
994 EXPECT(!Dart_IdentityEquals(abc, abc_again));
995
996 // Different objects.
997 EXPECT(!Dart_IdentityEquals(five, mint));
998 EXPECT(!Dart_IdentityEquals(abc, xyz));
999
1000 // Case where identical() is not the same as pointer equality.
1001 Dart_Handle nan1 = Dart_NewDouble(NAN);
1002 Dart_Handle nan2 = Dart_NewDouble(NAN);
1003 EXPECT(Dart_IdentityEquals(nan1, nan2));
1004
1005 // Non-instance objects.
1006 {
1007 CHECK_API_SCOPE(thread);
1008 Dart_Handle lib1 = Dart_LookupLibrary(dart_core);
1009 Dart_Handle lib2 = Dart_LookupLibrary(dart_mirrors);
1010
1011 EXPECT(Dart_IdentityEquals(lib1, lib1));
1012 EXPECT(Dart_IdentityEquals(lib2, lib2));
1013 EXPECT(!Dart_IdentityEquals(lib1, lib2));
1014
1015 // Mix instance and non-instance.
1016 EXPECT(!Dart_IdentityEquals(lib1, nan1));
1017 EXPECT(!Dart_IdentityEquals(nan1, lib1));
1018 }
1019}

◆ TEST_CASE() [97/600]

dart::TEST_CASE ( DartAPI_IllegalNewSendPort  )

Definition at line 7990 of file dart_api_impl_test.cc.

◆ TEST_CASE() [98/600]

dart::TEST_CASE ( DartAPI_IllegalPost  )

Definition at line 7996 of file dart_api_impl_test.cc.

◆ TEST_CASE() [99/600]

dart::TEST_CASE ( DartAPI_ImplicitNativeFieldAccess  )

Definition at line 5775 of file dart_api_impl_test.cc.

5775 {
5776 const char* nullable_tag = TestCase::NullableTag();
5777 // clang-format off
5778 auto kScriptChars = Utils::CStringUniquePtr(
5779 OS::SCreate(nullptr,
5780 "import 'dart:nativewrappers';"
5781 "final class NativeFields extends "
5782 "NativeFieldWrapperClass4 {\n"
5783 " NativeFields(int i, int j) : fld1 = i, fld2 = j {}\n"
5784 " int%s fld0;\n"
5785 " int fld1;\n"
5786 " final int fld2;\n"
5787 " static int%s fld3;\n"
5788 " static const int fld4 = 10;\n"
5789 "}\n"
5790 "NativeFields testMain() {\n"
5791 " NativeFields obj = new NativeFields(10, 20);\n"
5792 " return obj;\n"
5793 "}\n",
5794 nullable_tag, nullable_tag),
5795 std::free);
5796 // clang-format on
5797 // Load up a test script in the test library.
5798 Dart_Handle lib =
5799 TestCase::LoadTestScript(kScriptChars.get(), native_field_lookup);
5800
5801 // Invoke a function which returns an object of type NativeFields.
5802 Dart_Handle retobj = Dart_Invoke(lib, NewString("testMain"), 0, nullptr);
5803 EXPECT_VALID(retobj);
5804
5805 // Now access and set various instance fields of the returned object.
5806 TestNativeFields(retobj);
5807}
static void TestNativeFields(Dart_Handle retobj)

◆ TEST_CASE() [100/600]

dart::TEST_CASE ( DartAPI_ImplicitReferencesNewSpace  )

Definition at line 4596 of file dart_api_impl_test.cc.

4596 {
4597 Dart_PersistentHandle strong = nullptr;
4598 Dart_WeakPersistentHandle strong_weak = nullptr;
4599
4601 {
4602 CHECK_API_SCOPE(thread);
4603
4604 Dart_Handle local = AllocateOldString("strongly reachable");
4605 strong = Dart_NewPersistentHandle(local);
4606 strong_weak = Dart_NewWeakPersistentHandle(local, nullptr, 0, NopCallback);
4607
4608 EXPECT(!Dart_IsNull(AsHandle(strong)));
4609 EXPECT_VALID(AsHandle(strong));
4610 EXPECT(!Dart_IsNull(AsHandle(strong_weak)));
4611 EXPECT_VALID(AsHandle(strong_weak));
4612 EXPECT(Dart_IdentityEquals(AsHandle(strong), AsHandle(strong_weak)))
4613
4614 weak1 =
4615 Dart_NewWeakPersistentHandle(AllocateNewString("weakly reachable 1"),
4616 &weak1, 0, ImplicitReferencesCallback);
4617 EXPECT(!Dart_IsNull(AsHandle(weak1)));
4618 EXPECT_VALID(AsHandle(weak1));
4619
4620 weak2 =
4621 Dart_NewWeakPersistentHandle(AllocateNewString("weakly reachable 2"),
4622 &weak2, 0, ImplicitReferencesCallback);
4623 EXPECT(!Dart_IsNull(AsHandle(weak2)));
4624 EXPECT_VALID(AsHandle(weak2));
4625
4626 weak3 =
4627 Dart_NewWeakPersistentHandle(AllocateNewString("weakly reachable 3"),
4628 &weak3, 0, ImplicitReferencesCallback);
4629 EXPECT(!Dart_IsNull(AsHandle(weak3)));
4630 EXPECT_VALID(AsHandle(weak3));
4631 }
4633
4634 {
4636 EXPECT_VALID(AsHandle(strong_weak));
4637 EXPECT_VALID(AsHandle(weak1));
4638 EXPECT_VALID(AsHandle(weak2));
4639 EXPECT_VALID(AsHandle(weak3));
4641 }
4642
4647}
static Dart_Handle AsHandle(Dart_PersistentHandle weak)

◆ TEST_CASE() [101/600]

dart::TEST_CASE ( DartAPI_ImplicitReferencesOldSpace  )

Definition at line 4528 of file dart_api_impl_test.cc.

4528 {
4529 Dart_PersistentHandle strong = nullptr;
4530 Dart_WeakPersistentHandle strong_weak = nullptr;
4531
4533 {
4534 CHECK_API_SCOPE(thread);
4535
4536 Dart_Handle local = AllocateOldString("strongly reachable");
4537 strong = Dart_NewPersistentHandle(local);
4538 strong_weak = Dart_NewWeakPersistentHandle(local, nullptr, 0, NopCallback);
4539
4540 EXPECT(!Dart_IsNull(AsHandle(strong)));
4541 EXPECT_VALID(AsHandle(strong));
4542 EXPECT(!Dart_IsNull(AsHandle(strong_weak)));
4543 EXPECT_VALID(AsHandle(strong_weak));
4544 EXPECT(Dart_IdentityEquals(AsHandle(strong), AsHandle(strong_weak)))
4545
4546 weak1 =
4547 Dart_NewWeakPersistentHandle(AllocateOldString("weakly reachable 1"),
4548 &weak1, 0, ImplicitReferencesCallback);
4549 EXPECT(!Dart_IsNull(AsHandle(weak1)));
4550 EXPECT_VALID(AsHandle(weak1));
4551
4552 weak2 =
4553 Dart_NewWeakPersistentHandle(AllocateOldString("weakly reachable 2"),
4554 &weak2, 0, ImplicitReferencesCallback);
4555 EXPECT(!Dart_IsNull(AsHandle(weak2)));
4556 EXPECT_VALID(AsHandle(weak2));
4557
4558 weak3 =
4559 Dart_NewWeakPersistentHandle(AllocateOldString("weakly reachable 3"),
4560 &weak3, 0, ImplicitReferencesCallback);
4561 EXPECT(!Dart_IsNull(AsHandle(weak3)));
4562 EXPECT_VALID(AsHandle(weak3));
4563 }
4565
4566 {
4568 EXPECT_VALID(AsHandle(strong_weak));
4569 EXPECT_VALID(AsHandle(weak1));
4570 EXPECT_VALID(AsHandle(weak2));
4571 EXPECT_VALID(AsHandle(weak3));
4573 }
4574
4575 {
4576 TransitionNativeToVM transition(thread);
4577 GCTestHelper::CollectNewSpace();
4578 }
4579
4580 {
4582 // New space collection should not affect old space objects
4583 EXPECT_VALID(AsHandle(strong_weak));
4584 EXPECT(!Dart_IsNull(AsHandle(weak1)));
4585 EXPECT(!Dart_IsNull(AsHandle(weak2)));
4586 EXPECT(!Dart_IsNull(AsHandle(weak3)));
4588 }
4589
4594}

◆ TEST_CASE() [102/600]

dart::TEST_CASE ( DartAPI_ImportLibrary2  )

Definition at line 7757 of file dart_api_impl_test.cc.

7771 {
7772 const char* kScriptChars =
7773 "import 'library1_dart';\n"
7774 "var foo;\n"
7775 "main() { foo = 0; }\n";
7776 const char* kLibrary1Chars =
7777 "library library1_dart;\n"
7778 "import 'library2_dart';\n"
7779 "var foo;\n";
7780 const char* kLibrary2Chars =
7781 "library library2_dart;\n"
7782 "import 'library1_dart';\n"
7783 "var foo;\n";
7785 Dart_Handle lib;
7786
7787 // Create a test library and Load up a test script in it.
7788 Dart_SourceFile sourcefiles[] = {

◆ TEST_CASE() [103/600]

dart::TEST_CASE ( DartAPI_ImportLibrary3  )

Definition at line 7792 of file dart_api_impl_test.cc.

7806 {
7807 const char* kScriptChars =
7808 "import 'file:///library2_dart';\n"
7809 "import 'file:///library1_dart';\n"
7810 "var foo_top = 10; // foo has dup def. So should be an error.\n"
7811 "main() { foo = 0; }\n";
7812 const char* kLibrary1Chars =
7813 "library library1_dart;\n"
7814 "var foo;";
7815 const char* kLibrary2Chars =
7816 "library library2_dart;\n"
7817 "var foo;";
7819 Dart_Handle lib;
7820
7821 // Create a test library and Load up a test script in it.
7822 Dart_SourceFile sourcefiles[] = {
7823 {RESOLVED_USER_TEST_URI, kScriptChars},
7824 {"file:///library2_dart", kLibrary2Chars},
7825 {"file:///library1_dart", kLibrary1Chars},
7826 };

◆ TEST_CASE() [104/600]

dart::TEST_CASE ( DartAPI_ImportLibrary4  )

Definition at line 7830 of file dart_api_impl_test.cc.

7831 :4:10:"
7832 " Error: Setter not found: 'foo'");
7833 return;
7834
7835 result = Dart_FinalizeLoading(false);
7836 EXPECT_VALID(result);
7837 result = Dart_Invoke(lib, NewString("main"), 0, nullptr);
7838 EXPECT(Dart_IsError(result));
7839 EXPECT_SUBSTRING("NoSuchMethodError", Dart_GetError(result));
7840}
7841
7842// Test that if the same name is imported from two libraries, it is
7843// not an error if that name is not used.
7844TEST_CASE(DartAPI_ImportLibrary4) {
7845 const char* kScriptChars =
7846 "import 'library2_dart';\n"
7847 "import 'library1_dart';\n"
7848 "main() { }\n";
7849 const char* kLibrary1Chars =
7850 "library library1_dart;\n"
7851 "var foo;";
7852 const char* kLibrary2Chars =
7853 "library library2_dart;\n"
7854 "var foo;";
7855 Dart_Handle result;
7856 Dart_Handle lib;
7857
7858 // Create a test library and Load up a test script in it.
7859 Dart_SourceFile sourcefiles[] = {

◆ TEST_CASE() [105/600]

dart::TEST_CASE ( DartAPI_ImportLibrary5  )

Definition at line 7861 of file dart_api_impl_test.cc.

7861 {"file:///library2_dart", kLibrary2Chars},
7862 {"file:///library1_dart", kLibrary1Chars},
7863 };
7864 int sourcefiles_count = sizeof(sourcefiles) / sizeof(Dart_SourceFile);
7865 lib = TestCase::LoadTestScriptWithDFE(sourcefiles_count, sourcefiles, nullptr,
7866 true);
7867 EXPECT_VALID(lib);
7868
7871 result = Dart_Invoke(lib, NewString("main"), 0, nullptr);
7873}
7874
7875TEST_CASE(DartAPI_ImportLibrary5) {
7876 const char* kScriptChars =
7877 "import 'lib.dart';\n"
7878 "abstract class Y {\n"
7879 " void set handler(void callback(List<int> x));\n"
7880 "}\n"
7881 "void main() {}\n";
7882 const char* kLibraryChars =
7883 "library lib.dart;\n"
7884 "abstract class X {\n"
7885 " void set handler(void callback(List<int> x));\n"
7886 "}\n";
7888 Dart_Handle lib;
7889
7890 // Create a test library and Load up a test script in it.

◆ TEST_CASE() [106/600]

dart::TEST_CASE ( DartAPI_InjectNativeFields2  )

Definition at line 5452 of file dart_api_impl_test.cc.

5452 {
5453 // clang-format off
5454 auto kScriptChars = Utils::CStringUniquePtr(
5455 OS::SCreate(nullptr,
5456 "class NativeFields extends NativeFieldsWrapper {\n"
5457 " NativeFields(int i, int j) : fld1 = i, fld2 = j {}\n"
5458 " int fld1;\n"
5459 " final int fld;\n"
5460 " static int%s fld3;\n"
5461 " static const int fld4 = 10;\n"
5462 "}\n"
5463 "NativeFields testMain() {\n"
5464 " NativeFields obj = new NativeFields(10, 20);\n"
5465 " return obj;\n"
5466 "}\n",
5467 TestCase::NullableTag()), std::free);
5468 // clang-format on
5469
5471 // Create a test library and Load up a test script in it.
5472 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars.get(), nullptr,
5473 USER_TEST_URI, false);
5474
5475 // Invoke a function which returns an object of type NativeFields.
5476 result = Dart_Invoke(lib, NewString("testMain"), 0, nullptr);
5477
5478 // We expect this to fail as class "NativeFields" extends
5479 // "NativeFieldsWrapper" and there is no definition of it either
5480 // in the dart code or through the native field injection mechanism.
5482}
#define USER_TEST_URI
Definition unit_test.h:316

◆ TEST_CASE() [107/600]

dart::TEST_CASE ( DartAPI_InjectNativeFields3  )

Definition at line 5484 of file dart_api_impl_test.cc.

5484 {
5485 // clang-format off
5486 auto kScriptChars = Utils::CStringUniquePtr(
5487 OS::SCreate(nullptr,
5488 "import 'dart:nativewrappers';"
5489 "final class NativeFields "
5490 "extends NativeFieldWrapperClass2 {\n"
5491 " NativeFields(int i, int j) : fld1 = i, fld2 = j {}\n"
5492 " int fld1;\n"
5493 " final int fld2;\n"
5494 " static int%s fld3;\n"
5495 " static const int fld4 = 10;\n"
5496 "}\n"
5497 "NativeFields testMain() {\n"
5498 " NativeFields obj = new NativeFields(10, 20);\n"
5499 " return obj;\n"
5500 "}\n",
5501 TestCase::NullableTag()), std::free);
5502 // clang-format on
5504 const int kNumNativeFields = 2;
5505
5506 // Load up a test script in the test library.
5507 Dart_Handle lib =
5508 TestCase::LoadTestScript(kScriptChars.get(), native_field_lookup);
5509
5510 // Invoke a function which returns an object of type NativeFields.
5511 result = Dart_Invoke(lib, NewString("testMain"), 0, nullptr);
5513 CHECK_API_SCOPE(thread);
5514 TransitionNativeToVM transition(thread);
5515 HANDLESCOPE(thread);
5516 Instance& obj = Instance::Handle();
5517 obj ^= Api::UnwrapHandle(result);
5518 const Class& cls = Class::Handle(obj.clazz());
5519 // We expect the newly created "NativeFields" object to have
5520 // 2 dart instance fields (fld1, fld2) and a reference to the native fields.
5521 // Hence the size of an instance of "NativeFields" should be
5522 // (1 + 2) * kWordSize + size of object header.
5523 // We check to make sure the instance size computed by the VM matches
5524 // our expectations.
5525 intptr_t header_size = sizeof(UntaggedObject);
5526 EXPECT_EQ(
5527 Utils::RoundUp(((1 + 2) * kWordSize) + header_size, kObjectAlignment),
5528 cls.host_instance_size());
5529 EXPECT_EQ(kNumNativeFields, cls.num_native_fields());
5530}
uint16_t num_native_fields() const
Definition object.h:1790

◆ TEST_CASE() [108/600]

dart::TEST_CASE ( DartAPI_InjectNativeFields4  )

Definition at line 5532 of file dart_api_impl_test.cc.

5532 {
5533 // clang-format off
5534 auto kScriptChars = Utils::CStringUniquePtr(
5535 OS::SCreate(nullptr,
5536 "class NativeFields extends NativeFieldsWrapperClass2 {\n"
5537 " NativeFields(int i, int j) : fld1 = i, fld2 = j {}\n"
5538 " int fld1;\n"
5539 " final int fld;\n"
5540 " static int%s fld3;\n"
5541 " static const int fld4 = 10;\n"
5542 "}\n"
5543 "NativeFields testMain() {\n"
5544 " NativeFields obj = new NativeFields(10, 20);\n"
5545 " return obj;\n"
5546 "}\n",
5547 TestCase::NullableTag()), std::free);
5548 // clang-format on
5550 // Load up a test script in the test library.
5551 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars.get(), nullptr);
5552
5553 // Invoke a function which returns an object of type NativeFields.
5554 result = Dart_Invoke(lib, NewString("testMain"), 0, nullptr);
5555
5556 USE(result);
5557#if 0
5558 // TODO(12455) Need better validation.
5559 // We expect the test script to fail finalization with the error below:
5561 Dart_Handle expected_error = DartUtils::NewError(
5562 "'dart:test-lib': Error: line 1 pos 36: "
5563 "class 'NativeFields' is trying to extend a native fields class, "
5564 "but library '%s' has no native resolvers",
5565 TestCase::url());
5566 EXPECT_SUBSTRING(Dart_GetError(expected_error), Dart_GetError(result));
5567#endif
5568}

◆ TEST_CASE() [109/600]

dart::TEST_CASE ( DartAPI_InjectNativeFieldsSuperClass  )

Definition at line 5671 of file dart_api_impl_test.cc.

5671 {
5672 const char* kScriptChars =
5673 "import 'dart:nativewrappers';"
5674 "base class NativeFieldsSuper extends NativeFieldWrapperClass1 {\n"
5675 " NativeFieldsSuper() : fld1 = 42 {}\n"
5676 " int fld1;\n"
5677 "}\n"
5678 "base class NativeFields extends NativeFieldsSuper {\n"
5679 " fld() => fld1;\n"
5680 "}\n"
5681 "int testMain() {\n"
5682 " NativeFields obj = new NativeFields();\n"
5683 " return obj.fld();\n"
5684 "}\n";
5686 // Load up a test script in the test library.
5687 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, native_field_lookup);
5688
5689 // Invoke a function which returns an object of type NativeFields.
5690 result = Dart_Invoke(lib, NewString("testMain"), 0, nullptr);
5691
5694 int64_t value = 0;
5697 EXPECT_EQ(42, value);
5698}

◆ TEST_CASE() [110/600]

dart::TEST_CASE ( DartAPI_InstanceGetType  )

Definition at line 1053 of file dart_api_impl_test.cc.

1053 {
1054 Zone* zone = thread->zone();
1055 // Get the handle from a valid instance handle.
1059 {
1060 TransitionNativeToVM transition(thread);
1061 const Type& null_type_obj = Api::UnwrapTypeHandle(zone, type);
1062 EXPECT(null_type_obj.ptr() == Type::NullType());
1063 }
1064
1069 {
1070 TransitionNativeToVM transition(thread);
1071 const Type& bool_type_obj = Api::UnwrapTypeHandle(zone, type);
1072 EXPECT(bool_type_obj.ptr() == Type::BoolType());
1073 }
1074
1075 // Errors propagate.
1076 Dart_Handle error = Dart_NewApiError("MyError");
1078 EXPECT_ERROR(error_type, "MyError");
1079
1080 // Get the handle from a non-instance handle.
1081 Dart_Handle dart_core = NewString("dart:core");
1082 Dart_Handle obj = Dart_LookupLibrary(dart_core);
1083 Dart_Handle type_type = Dart_InstanceGetType(obj);
1084 EXPECT_ERROR(type_type,
1085 "Dart_InstanceGetType expects argument 'instance' to be of "
1086 "type Instance.");
1087}
DART_EXPORT bool Dart_IsType(Dart_Handle handle)
DART_EXPORT Dart_Handle Dart_InstanceGetType(Dart_Handle instance)

◆ TEST_CASE() [111/600]

dart::TEST_CASE ( DartAPI_InstanceOf  )

Definition at line 7473 of file dart_api_impl_test.cc.

7476 {
7477 const char* kScriptChars =
7478 "class OtherClass {\n"
7479 " static returnNull() { return null; }\n"
7480 "}\n"
7481 "class InstanceOfTest {\n"
7482 " InstanceOfTest() {}\n"
7483 " static InstanceOfTest testMain() {\n"
7484 " return new InstanceOfTest();\n"
7485 " }\n"
7486 "}\n";
7488 // Create a test library and Load up a test script in it.
7489 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
7490
7491 // Fetch InstanceOfTest class.
7493 Dart_GetNonNullableType(lib, NewString("InstanceOfTest"), 0, nullptr);
7495
7496 // Invoke a function which returns an object of type InstanceOf..
7497 Dart_Handle instanceOfTestObj =
7498 Dart_Invoke(type, NewString("testMain"), 0, nullptr);
7499 EXPECT_VALID(instanceOfTestObj);
7500
7501 // Now check instanceOfTestObj reported as an instance of
7502 // InstanceOfTest class.
7503 bool is_instance = false;
7504 result = Dart_ObjectIsType(instanceOfTestObj, type, &is_instance);
7506 EXPECT(is_instance);
7507
7508 // Fetch OtherClass and check if instanceOfTestObj is instance of it.
7509 Dart_Handle otherType =
7510 Dart_GetNonNullableType(lib, NewString("OtherClass"), 0, nullptr);
7511 EXPECT_VALID(otherType);
7512
7513 result = Dart_ObjectIsType(instanceOfTestObj, otherType, &is_instance);
7515 EXPECT(!is_instance);
7516
7517 // Check that primitives are not instances of InstanceOfTest class.
7518 result = Dart_ObjectIsType(NewString("a string"), otherType, &is_instance);
7520 EXPECT(!is_instance);
7521
7522 result = Dart_ObjectIsType(Dart_NewInteger(42), otherType, &is_instance);
7524 EXPECT(!is_instance);
7525
7526 result = Dart_ObjectIsType(Dart_NewBoolean(true), otherType, &is_instance);
7528 EXPECT(!is_instance);
7529
7530 // Check that null is not an instance of InstanceOfTest class.
7531 Dart_Handle null =
7532 Dart_Invoke(otherType, NewString("returnNull"), 0, nullptr);
7533 EXPECT_VALID(null);
7534
7535 result = Dart_ObjectIsType(null, otherType, &is_instance);
7537 EXPECT(!is_instance);
7538
7539 // Check that error is returned if null is passed as a class argument.
DART_EXPORT Dart_Handle Dart_ObjectIsType(Dart_Handle object, Dart_Handle type, bool *instanceof)

◆ TEST_CASE() [112/600]

dart::TEST_CASE ( DartAPI_InstanceValues  )

Definition at line 1045 of file dart_api_impl_test.cc.

1045 {
1048
1049 // By convention, our Is*() functions exclude null.
1051}

◆ TEST_CASE() [113/600]

dart::TEST_CASE ( DartAPI_IntegerFitsIntoInt64  )

Definition at line 1483 of file dart_api_impl_test.cc.

1483 {
1484 Dart_Handle max = Dart_NewInteger(kMaxInt64);
1486 bool fits = false;
1489 EXPECT(fits);
1490
1491 Dart_Handle above_max = Dart_NewIntegerFromHexCString("0x10000000000000000");
1492 EXPECT(Dart_IsApiError(above_max));
1493
1494 Dart_Handle min = Dart_NewInteger(kMinInt64);
1496 fits = false;
1499 EXPECT(fits);
1500
1501 Dart_Handle below_min = Dart_NewIntegerFromHexCString("-0x10000000000000001");
1502 EXPECT(Dart_IsApiError(below_min));
1503}
DART_EXPORT Dart_Handle Dart_IntegerFitsIntoInt64(Dart_Handle integer, bool *fits)
DART_EXPORT Dart_Handle Dart_NewIntegerFromHexCString(const char *value)

◆ TEST_CASE() [114/600]

dart::TEST_CASE ( DartAPI_IntegerFitsIntoUint64  )

Definition at line 1505 of file dart_api_impl_test.cc.

1505 {
1508
1509 Dart_Handle above_max = Dart_NewIntegerFromHexCString("0x10000000000000000");
1510 EXPECT(Dart_IsApiError(above_max));
1511
1514 bool fits = false;
1517 EXPECT(fits);
1518
1520 EXPECT(Dart_IsInteger(below_min));
1521 fits = true;
1522 result = Dart_IntegerFitsIntoUint64(below_min, &fits);
1524 EXPECT(!fits);
1525}
DART_EXPORT Dart_Handle Dart_NewIntegerFromUint64(uint64_t value)
DART_EXPORT Dart_Handle Dart_IntegerFitsIntoUint64(Dart_Handle integer, bool *fits)

◆ TEST_CASE() [115/600]

dart::TEST_CASE ( DartAPI_IntegerToHexCString  )

Definition at line 1455 of file dart_api_impl_test.cc.

1455 {
1456 const struct {
1457 int64_t i;
1458 const char* s;
1459 } kIntTestCases[] = {
1460 {0, "0x0"},
1461 {1, "0x1"},
1462 {-1, "-0x1"},
1463 {0x123, "0x123"},
1464 {-0xABCDEF, "-0xABCDEF"},
1465 {DART_INT64_C(-0x7FFFFFFFFFFFFFFF), "-0x7FFFFFFFFFFFFFFF"},
1466 {kMaxInt64, "0x7FFFFFFFFFFFFFFF"},
1467 {kMinInt64, "-0x8000000000000000"},
1468 };
1469
1470 const size_t kNumberOfIntTestCases =
1471 sizeof(kIntTestCases) / sizeof(kIntTestCases[0]);
1472
1473 for (size_t i = 0; i < kNumberOfIntTestCases; ++i) {
1474 Dart_Handle val = Dart_NewInteger(kIntTestCases[i].i);
1475 EXPECT_VALID(val);
1476 const char* chars = nullptr;
1479 EXPECT_STREQ(kIntTestCases[i].s, chars);
1480 }
1481}
DART_EXPORT Dart_Handle Dart_IntegerToHexCString(Dart_Handle integer, const char **value)
#define DART_INT64_C(x)
Definition globals.h:433

◆ TEST_CASE() [116/600]

dart::TEST_CASE ( DartAPI_IntegerValues  )

Definition at line 1407 of file dart_api_impl_test.cc.

1407 {
1408 const int64_t kIntegerVal1 = 100;
1409 const int64_t kIntegerVal2 = 0xffffffff;
1410 const char* kIntegerVal3 = "0x123456789123456789123456789";
1411 const uint64_t kIntegerVal4 = 0xffffffffffffffff;
1412 const int64_t kIntegerVal5 = -0x7fffffffffffffff;
1413
1414 Dart_Handle val1 = Dart_NewInteger(kIntegerVal1);
1415 EXPECT(Dart_IsInteger(val1));
1416 bool fits = false;
1419 EXPECT(fits);
1420
1421 int64_t out = 0;
1422 result = Dart_IntegerToInt64(val1, &out);
1424 EXPECT_EQ(kIntegerVal1, out);
1425
1426 Dart_Handle val2 = Dart_NewInteger(kIntegerVal2);
1427 EXPECT(Dart_IsInteger(val2));
1428 result = Dart_IntegerFitsIntoInt64(val2, &fits);
1430 EXPECT(fits);
1431
1432 result = Dart_IntegerToInt64(val2, &out);
1434 EXPECT_EQ(kIntegerVal2, out);
1435
1436 Dart_Handle val3 = Dart_NewIntegerFromHexCString(kIntegerVal3);
1437 EXPECT(Dart_IsApiError(val3));
1438
1439 Dart_Handle val4 = Dart_NewIntegerFromUint64(kIntegerVal4);
1440 EXPECT(Dart_IsApiError(val4));
1441
1442 Dart_Handle val5 = Dart_NewInteger(-1);
1443 EXPECT_VALID(val5);
1444 uint64_t out5 = 0;
1445 result = Dart_IntegerToUint64(val5, &out5);
1447
1448 Dart_Handle val6 = Dart_NewInteger(kIntegerVal5);
1449 EXPECT_VALID(val6);
1450 uint64_t out6 = 0;
1451 result = Dart_IntegerToUint64(val6, &out6);
1453}
DART_EXPORT Dart_Handle Dart_IntegerToUint64(Dart_Handle integer, uint64_t *value)

◆ TEST_CASE() [117/600]

dart::TEST_CASE ( DartAPI_InvalidGetSetPeer  )

Definition at line 8909 of file dart_api_impl_test.cc.

8910 {
8911 @pragma('vm:external-name', 'StaticNativeFoo1')
8912 external static int foo1();
8913
8914 @pragma('vm:external-name', 'StaticNativeFoo2')
8915 external static int foo2(int i);
8916
8917 @pragma('vm:external-name', 'StaticNativeFoo3')
8918 external static int foo3([int k = 10000, int l = 1]);
8919
8920 @pragma('vm:external-name', 'StaticNativeFoo4')
8921 external static int foo4(int i, [int j = 10, int k = 1]);
8922
8923 int bar1() { var func = foo1; return func(); }
8924 int bar2(int i) { var func = foo2; return func(i); }
8925 int bar30() { var func = foo3; return func(); }
8926 int bar31(int i) { var func = foo3; return func(i); }
8927 int bar32(int i, int j) { var func = foo3; return func(i, j); }
8928 int bar41(int i) {
8929 var func = foo4; return func(i); }
8930 int bar42(int i, int j) {
8931 var func = foo4; return func(i, j); }
8932 int bar43(int i, int j, int k) {
8933 var func = foo4; return func(i, j, k); }
8934 }
8935 class Expect {

◆ TEST_CASE() [118/600]

dart::TEST_CASE ( DartAPI_Invoke  )

Definition at line 6592 of file dart_api_impl_test.cc.

6592 {
6593 const char* kScriptChars =
6594 "class BaseMethods {\n"
6595 " inheritedMethod(arg) => 'inherited $arg';\n"
6596 " static nonInheritedMethod(arg) => 'noninherited $arg';\n"
6597 "}\n"
6598 "\n"
6599 "class Methods extends BaseMethods {\n"
6600 " instanceMethod(arg) => 'instance $arg';\n"
6601 " _instanceMethod(arg) => 'hidden instance $arg';\n"
6602 " static staticMethod(arg) => 'static $arg';\n"
6603 " static _staticMethod(arg) => 'hidden static $arg';\n"
6604 "}\n"
6605 "\n"
6606 "topMethod(arg) => 'top $arg';\n"
6607 "_topMethod(arg) => 'hidden top $arg';\n"
6608 "\n"
6609 "Methods test() {\n"
6610 " return new Methods();\n"
6611 "}\n";
6612
6613 // Shared setup.
6614 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
6616 Dart_GetNonNullableType(lib, NewString("Methods"), 0, nullptr);
6618 Dart_Handle instance = Dart_Invoke(lib, NewString("test"), 0, nullptr);
6620 Dart_Handle args[1];
6621 args[0] = NewString("!!!");
6622 Dart_Handle bad_args[2];
6623 bad_args[0] = NewString("bad1");
6624 bad_args[1] = NewString("bad2");
6627 const char* str;
6628
6629 // Instance method.
6630 name = NewString("instanceMethod");
6636 EXPECT_STREQ("instance !!!", str);
6637
6638 // Instance method, wrong arg count.
6639 EXPECT_ERROR(Dart_Invoke(instance, name, 2, bad_args),
6640 "Class 'Methods' has no instance method 'instanceMethod'"
6641 " with matching arguments");
6642
6643 name = PrivateLibName(lib, "_instanceMethod");
6649 EXPECT_STREQ("hidden instance !!!", str);
6650
6651 // Inherited method.
6652 name = NewString("inheritedMethod");
6658 EXPECT_STREQ("inherited !!!", str);
6659
6660 // Static method.
6661 name = NewString("staticMethod");
6667 EXPECT_STREQ("static !!!", str);
6668
6669 // Static method, wrong arg count.
6670 EXPECT_ERROR(Dart_Invoke(type, name, 2, bad_args),
6671 "NoSuchMethodError: No static method 'staticMethod' with "
6672 "matching arguments");
6673
6674 // Hidden static method.
6675 name = NewString("_staticMethod");
6681 EXPECT_STREQ("hidden static !!!", str);
6682
6683 // Static non-inherited method. Not found at any level.
6684 name = NewString("non_inheritedMethod");
6688
6689 // Top-Level method.
6690 name = NewString("topMethod");
6693 result = Dart_Invoke(lib, name, 1, args);
6696 EXPECT_STREQ("top !!!", str);
6697
6698 // Top-level method, wrong arg count.
6699 EXPECT_ERROR(Dart_Invoke(lib, name, 2, bad_args),
6700 "NoSuchMethodError: No top-level method 'topMethod' with "
6701 "matching arguments");
6702
6703 // Hidden top-level method.
6704 name = NewString("_topMethod");
6707 result = Dart_Invoke(lib, name, 1, args);
6710 EXPECT_STREQ("hidden top !!!", str);
6711}
static Dart_Handle PrivateLibName(Dart_Handle lib, const char *str)

◆ TEST_CASE() [119/600]

dart::TEST_CASE ( DartAPI_Invoke_BadArgs  )

Definition at line 6785 of file dart_api_impl_test.cc.

6785 {
6786 const char* kScriptChars =
6787 "class BaseMethods {\n"
6788 " inheritedMethod(int arg) => 'inherited $arg';\n"
6789 " static nonInheritedMethod(int arg) => 'noninherited $arg';\n"
6790 "}\n"
6791 "\n"
6792 "class Methods extends BaseMethods {\n"
6793 " instanceMethod(int arg) => 'instance $arg';\n"
6794 " _instanceMethod(int arg) => 'hidden instance $arg';\n"
6795 " static staticMethod(int arg) => 'static $arg';\n"
6796 " static _staticMethod(int arg) => 'hidden static $arg';\n"
6797 "}\n"
6798 "\n"
6799 "topMethod(int arg) => 'top $arg';\n"
6800 "_topMethod(int arg) => 'hidden top $arg';\n"
6801 "\n"
6802 "Methods test() {\n"
6803 " return new Methods();\n"
6804 "}\n";
6805
6806#if defined(PRODUCT)
6807 const char* error_msg =
6808 "type '_OneByteString' is not a subtype of type 'int' of 'arg'";
6809#else
6810 const char* error_msg =
6811 "type 'String' is not a subtype of type 'int' of 'arg'";
6812#endif // defined(PRODUCT)
6813
6814 // Shared setup.
6815 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
6817 Dart_GetNonNullableType(lib, NewString("Methods"), 0, nullptr);
6819 Dart_Handle instance = Dart_Invoke(lib, NewString("test"), 0, nullptr);
6821 Dart_Handle args[1];
6822 args[0] = NewString("!!!");
6825
6826 // Instance method.
6827 name = NewString("instanceMethod");
6830 EXPECT_SUBSTRING(error_msg, Dart_GetError(result));
6831
6832 name = PrivateLibName(lib, "_instanceMethod");
6835 EXPECT_SUBSTRING(error_msg, Dart_GetError(result));
6836
6837 // Inherited method.
6838 name = NewString("inheritedMethod");
6841 EXPECT_SUBSTRING(error_msg, Dart_GetError(result));
6842
6843 // Static method.
6844 name = NewString("staticMethod");
6847 EXPECT_SUBSTRING(error_msg, Dart_GetError(result));
6848
6849 // Hidden static method.
6850 name = NewString("_staticMethod");
6853 EXPECT_SUBSTRING(error_msg, Dart_GetError(result));
6854
6855 // Top-Level method.
6856 name = NewString("topMethod");
6857 result = Dart_Invoke(lib, name, 1, args);
6859 EXPECT_SUBSTRING(error_msg, Dart_GetError(result));
6860
6861 // Hidden top-level method.
6862 name = NewString("_topMethod");
6863 result = Dart_Invoke(lib, name, 1, args);
6865 EXPECT_SUBSTRING(error_msg, Dart_GetError(result));
6866}

◆ TEST_CASE() [120/600]

dart::TEST_CASE ( DartAPI_Invoke_FunnyArgs  )

Definition at line 6739 of file dart_api_impl_test.cc.

6739 {
6740 const char* kScriptChars = "test(arg) => 'hello $arg';\n";
6741
6742 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
6743 Dart_Handle func_name = NewString("test");
6744 Dart_Handle args[1];
6745 const char* str;
6746
6747 // Make sure that valid args yield valid results.
6748 args[0] = NewString("!!!");
6749 Dart_Handle result = Dart_Invoke(lib, func_name, 1, args);
6752 EXPECT_STREQ("hello !!!", str);
6753
6754 // Make sure that null is legal.
6755 args[0] = Dart_Null();
6756 result = Dart_Invoke(lib, func_name, 1, args);
6759 EXPECT_STREQ("hello null", str);
6760
6761 // Pass an error handle as the target. The error is propagated.
6762 result = Dart_Invoke(Api::NewError("myerror"), func_name, 1, args);
6764 EXPECT_STREQ("myerror", Dart_GetError(result));
6765
6766 // Pass an error handle as the function name. The error is propagated.
6767 result = Dart_Invoke(lib, Api::NewError("myerror"), 1, args);
6769 EXPECT_STREQ("myerror", Dart_GetError(result));
6770
6771 // Pass a non-instance handle as a parameter..
6772 args[0] = lib;
6773 result = Dart_Invoke(lib, func_name, 1, args);
6775 EXPECT_STREQ("Dart_Invoke expects arguments[0] to be an Instance handle.",
6777
6778 // Pass an error handle as a parameter. The error is propagated.
6779 args[0] = Api::NewError("myerror");
6780 result = Dart_Invoke(lib, func_name, 1, args);
6782 EXPECT_STREQ("myerror", Dart_GetError(result));
6783}

◆ TEST_CASE() [121/600]

dart::TEST_CASE ( DartAPI_Invoke_Null  )

Definition at line 6868 of file dart_api_impl_test.cc.

6868 {
6870 Dart_Invoke(Dart_Null(), NewString("toString"), 0, nullptr);
6873
6874 const char* value = "";
6876 EXPECT_STREQ("null", value);
6877
6879 result = Dart_Invoke(Dart_Null(), function_name, 0, nullptr);
6882
6883 result = Dart_GetField(Dart_Null(), NewString("toString"));
6886
6887 result =
6888 Dart_SetField(Dart_Null(), NewString("nullHasNoSetters"), Dart_Null());
6889 // Not that Dart_SetField expects a non-null receiver.
6891 result,
6892 "NoSuchMethodError: The setter 'nullHasNoSetters=' was called on null");
6893}

◆ TEST_CASE() [122/600]

dart::TEST_CASE ( DartAPI_Invoke_PrivateStatic  )

Definition at line 6713 of file dart_api_impl_test.cc.

6713 {
6714 const char* kScriptChars =
6715 "class Methods {\n"
6716 " static _staticMethod(arg) => 'hidden static $arg';\n"
6717 "}\n"
6718 "\n";
6719
6720 // Shared setup.
6721 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
6723 Dart_GetNonNullableType(lib, NewString("Methods"), 0, nullptr);
6726 Dart_Handle name = NewString("_staticMethod");
6728
6729 Dart_Handle args[1];
6730 args[0] = NewString("!!!");
6733
6734 const char* str = nullptr;
6736 EXPECT_STREQ("hidden static !!!", str);
6737}

◆ TEST_CASE() [123/600]

dart::TEST_CASE ( DartAPI_InvokeClosure  )

Definition at line 6963 of file dart_api_impl_test.cc.

6963 {
6964 const char* kScriptChars =
6965 "class InvokeClosure {\n"
6966 " InvokeClosure(int i, int j) : fld1 = i, fld2 = j {}\n"
6967 " Function method1(int i) {\n"
6968 " f(int j) => j + i + fld1 + fld2 + fld4; \n"
6969 " return f;\n"
6970 " }\n"
6971 " static Function method2(int i) {\n"
6972 " n(int j) { throw new Exception('I am an exception'); return 1; }\n"
6973 " return n;\n"
6974 " }\n"
6975 " int fld1;\n"
6976 " final int fld2;\n"
6977 " static const int fld4 = 10;\n"
6978 "}\n"
6979 "Function testMain1() {\n"
6980 " InvokeClosure obj = new InvokeClosure(10, 20);\n"
6981 " return obj.method1(10);\n"
6982 "}\n"
6983 "Function testMain2() {\n"
6984 " return InvokeClosure.method2(10);\n"
6985 "}\n";
6987 CHECK_API_SCOPE(thread);
6988
6989 // Create a test library and Load up a test script in it.
6990 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
6991
6992 // Invoke a function which returns a closure.
6993 Dart_Handle retobj = Dart_Invoke(lib, NewString("testMain1"), 0, nullptr);
6994 EXPECT_VALID(retobj);
6995
6996 EXPECT(Dart_IsClosure(retobj));
6998
6999 // Now invoke the closure and check the result.
7000 Dart_Handle dart_arguments[1];
7001 dart_arguments[0] = Dart_NewInteger(1);
7002 result = Dart_InvokeClosure(retobj, 1, dart_arguments);
7005 int64_t value = 0;
7007 EXPECT_EQ(51, value);
7008
7009 // Invoke closure with wrong number of args, should result in exception.
7010 result = Dart_InvokeClosure(retobj, 0, nullptr);
7013
7014 // Invoke a function which returns a closure.
7015 retobj = Dart_Invoke(lib, NewString("testMain2"), 0, nullptr);
7016 EXPECT_VALID(retobj);
7017
7018 EXPECT(Dart_IsClosure(retobj));
7019 EXPECT(!Dart_IsClosure(NewString("abcdef")));
7020
7021 // Now invoke the closure and check the result (should be an exception).
7022 dart_arguments[0] = Dart_NewInteger(1);
7023 result = Dart_InvokeClosure(retobj, 1, dart_arguments);
7026}

◆ TEST_CASE() [124/600]

dart::TEST_CASE ( DartAPI_InvokeClosure_Issue44205  )

Definition at line 6354 of file dart_api_impl_test.cc.

6354 {
6355 const char* kScriptChars =
6356 "class InvokeClosure {\n"
6357 " InvokeClosure(int i, int j) : fld1 = i, fld2 = j {}\n"
6358 " Function method1(int i) {\n"
6359 " f(int j) => j + i + fld1 + fld2 + fld4; \n"
6360 " return f;\n"
6361 " }\n"
6362 " int fld1;\n"
6363 " final int fld2;\n"
6364 " static const int fld4 = 10;\n"
6365 "}\n"
6366 "Function testMain1() {\n"
6367 " InvokeClosure obj = new InvokeClosure(10, 20);\n"
6368 " return obj.method1(10);\n"
6369 "}\n";
6371 CHECK_API_SCOPE(thread);
6372
6373 // Create a test library and Load up a test script in it.
6374 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
6375 EXPECT_VALID(lib);
6376
6377 // Invoke a function which returns a closure.
6378 Dart_Handle retobj = Dart_Invoke(lib, NewString("testMain1"), 0, nullptr);
6379 EXPECT_VALID(retobj);
6380
6381 // Now invoke the closure and check the result.
6382 Dart_Handle dart_arguments[1];
6383 dart_arguments[0] = Dart_EmptyString();
6384 result = Dart_InvokeClosure(retobj, 1, dart_arguments);
6385 EXPECT_ERROR(result, "String' is not a subtype of type 'int' of 'j'");
6386}

◆ TEST_CASE() [125/600]

dart::TEST_CASE ( DartAPI_InvokeConstructor_Issue44205  )

Definition at line 6310 of file dart_api_impl_test.cc.

6310 {
6311 const char* kScriptChars =
6312 "class MyIntClass {\n"
6313 " MyIntClass(this.value);\n"
6314 " int value;\n"
6315 "}\n"
6316 "\n"
6317 "class MyClass<T> {\n"
6318 " T value;\n"
6319 " MyClass(this.value);\n"
6320 "}\n"
6321 "\n"
6322 "Type getIntType() { return int; }\n"
6323 "\n";
6324
6325 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
6326 EXPECT_VALID(lib);
6327 Dart_Handle int_wrapper_type =
6328 Dart_GetNonNullableType(lib, NewString("MyIntClass"), 0, nullptr);
6329 EXPECT_VALID(int_wrapper_type);
6330
6331 Dart_Handle args[1];
6332 args[0] = Dart_EmptyString();
6333 Dart_Handle result = Dart_Allocate(int_wrapper_type);
6335
6337 EXPECT_ERROR(result, "String' is not a subtype of type 'int' of 'value'");
6338
6339 Dart_Handle int_type = Dart_Invoke(lib, NewString("getIntType"), 0, args);
6340 EXPECT_VALID(int_type);
6341 Dart_Handle type_args = Dart_NewList(1);
6342 EXPECT_VALID(type_args);
6343 EXPECT_VALID(Dart_ListSetAt(type_args, 0, int_type));
6344 Dart_Handle my_class_type =
6345 Dart_GetNonNullableType(lib, NewString("MyClass"), 1, &type_args);
6346 EXPECT_VALID(my_class_type);
6347
6348 result = Dart_Allocate(my_class_type);
6351 EXPECT_ERROR(result, "String' is not a subtype of type 'int' of 'value'");
6352}
DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_InvokeConstructor(Dart_Handle object, Dart_Handle name, int number_of_arguments, Dart_Handle *arguments)

◆ TEST_CASE() [126/600]

dart::TEST_CASE ( DartAPI_InvokeImportedFunction  )

Definition at line 9846 of file dart_api_impl_test.cc.

9859 {
9861}
9862
9863static Dart_NativeFunction NotifyDestroyed_native_lookup(
9865 int argument_count,
9866 bool* auto_setup_scope) {
DART_EXPORT void Dart_NotifyDestroyed(void)

◆ TEST_CASE() [127/600]

dart::TEST_CASE ( DartAPI_InvokeNoSuchMethod  )

Definition at line 6895 of file dart_api_impl_test.cc.

6895 {
6896 const char* kScriptChars =
6897 "class Expect {\n"
6898 " static equals(a, b) {\n"
6899 " if (a != b) {\n"
6900 " throw 'not equal. expected: $a, got: $b';\n"
6901 " }\n"
6902 " }\n"
6903 "}\n"
6904 "class TestClass {\n"
6905 " static int fld1 = 0;\n"
6906 " void noSuchMethod(Invocation invocation) {\n"
6907 // This relies on the Symbol.toString() method returning a String of the
6908 // form 'Symbol("name")'. This is to avoid having to import
6909 // dart:_internal just to get access to the name of the symbol.
6910 " var name = invocation.memberName.toString();\n"
6911 " name = name.split('\"')[1];\n"
6912 " if (name == 'fld') {\n"
6913 " Expect.equals(true, invocation.isGetter);\n"
6914 " Expect.equals(false, invocation.isMethod);\n"
6915 " Expect.equals(false, invocation.isSetter);\n"
6916 " } else if (name == 'setfld') {\n"
6917 " Expect.equals(true, invocation.isSetter);\n"
6918 " Expect.equals(false, invocation.isMethod);\n"
6919 " Expect.equals(false, invocation.isGetter);\n"
6920 " } else if (name == 'method') {\n"
6921 " Expect.equals(true, invocation.isMethod);\n"
6922 " Expect.equals(false, invocation.isSetter);\n"
6923 " Expect.equals(false, invocation.isGetter);\n"
6924 " }\n"
6925 " TestClass.fld1 += 1;\n"
6926 " }\n"
6927 " static TestClass testMain() {\n"
6928 " return new TestClass();\n"
6929 " }\n"
6930 "}\n";
6933 // Create a test library and Load up a test script in it.
6934 // The test library must have a dart: url so it can import dart:_internal.
6935 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
6937 Dart_GetNonNullableType(lib, NewString("TestClass"), 0, nullptr);
6939
6940 // Invoke a function which returns an object.
6941 instance = Dart_Invoke(type, NewString("testMain"), 0, nullptr);
6943
6944 // Try to get a field that does not exist, should call noSuchMethod.
6947
6948 // Try to set a field that does not exist, should call noSuchMethod.
6951
6952 // Try to invoke a method that does not exist, should call noSuchMethod.
6953 result = Dart_Invoke(instance, NewString("method"), 0, nullptr);
6955
6956 result = Dart_GetField(type, NewString("fld1"));
6958 int64_t value = 0;
6960 EXPECT_EQ(3, value);
6961}

◆ TEST_CASE() [128/600]

dart::TEST_CASE ( DartAPI_InvokeVMServiceMethod  )

Definition at line 9868 of file dart_api_impl_test.cc.

9870 {
9871 const char* kScriptChars = R"(
9872import 'dart:isolate';
9873@pragma("vm:external-name", "Test_nativeFunc")
9874external void notifyDetach();
9875void main() {
9876 var v;
9877 for (var i = 0; i < 100; i++) {
9878 var t = [];
9879 for (var j = 0; j < 10000; j++) {
9880 t.add(List.filled(100, null));
9881 }
9882 v = t;
9883 notifyDetach();
9884 }
9885})";
9886 Dart_Handle lib =
9887 TestCase::LoadTestScript(kScriptChars, &NotifyDestroyed_native_lookup);
9888 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, nullptr);
9890}
9891
9892static void SetPerformanceModeDefault(Dart_NativeArguments args) {
9894}
@ Dart_PerformanceMode_Default
Definition dart_api.h:1372
@ Dart_PerformanceMode_Latency
Definition dart_api.h:1379
DART_EXPORT Dart_PerformanceMode Dart_SetPerformanceMode(Dart_PerformanceMode mode)
static void SetPerformanceModeLatency(Dart_NativeArguments args)

◆ TEST_CASE() [129/600]

dart::TEST_CASE ( DartAPI_InvokeVMServiceMethod_Loop  )

Definition at line 9933 of file dart_api_impl_test.cc.

9936 {
9938}
9939
9940static Dart_NativeFunction NotifyLowMemory_native_lookup(
DART_EXPORT void Dart_NotifyLowMemory(void)

◆ TEST_CASE() [130/600]

dart::TEST_CASE ( DartAPI_IsFuture  )

Definition at line 1980 of file dart_api_impl_test.cc.

1980 {
1981 const char* kScriptChars =
1982 "import 'dart:async';"
1983 "Future testMain() {"
1984 " return new Completer().future;"
1985 "}";
1987
1988 // Create a test library and Load up a test script in it.
1989 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
1990
1991 // Invoke a function which returns an object of type Future.
1992 result = Dart_Invoke(lib, NewString("testMain"), 0, nullptr);
1995
1996 EXPECT(!Dart_IsFuture(lib)); // Non-instance.
1997 Dart_Handle anInteger = Dart_NewInteger(0);
1998 EXPECT(!Dart_IsFuture(anInteger));
1999 Dart_Handle aString = NewString("I am not a Future");
2000 EXPECT(!Dart_IsFuture(aString));
2001 Dart_Handle null = Dart_Null();
2002 EXPECT(!Dart_IsFuture(null));
2003}
DART_EXPORT bool Dart_IsFuture(Dart_Handle object)

◆ TEST_CASE() [131/600]

dart::TEST_CASE ( DartAPI_IsolateServiceID  )

Definition at line 4846 of file dart_api_impl_test.cc.

4846 {
4848 const char* id = Dart_IsolateServiceId(isolate);
4849 EXPECT(id != nullptr);
4850 int64_t main_port = Dart_GetMainPortId();
4851 EXPECT_STREQ(ZONE_STR("isolates/%" Pd64, main_port), id);
4852 free(const_cast<char*>(id));
4853}
DART_EXPORT const char * Dart_IsolateServiceId(Dart_Isolate isolate)
DART_EXPORT Dart_Port Dart_GetMainPortId(void)

◆ TEST_CASE() [132/600]

dart::TEST_CASE ( DartAPI_IsString  )

Definition at line 1563 of file dart_api_impl_test.cc.

1563 {
1564 uint8_t latin1[] = {'o', 'n', 'e', 0xC2, 0xA2};
1565
1566 Dart_Handle latin1str = Dart_NewStringFromUTF8(latin1, ARRAY_SIZE(latin1));
1567 EXPECT_VALID(latin1str);
1568 EXPECT(Dart_IsString(latin1str));
1569 EXPECT(Dart_IsStringLatin1(latin1str));
1570 intptr_t len = -1;
1571 EXPECT_VALID(Dart_StringLength(latin1str, &len));
1572 EXPECT_EQ(4, len);
1573 intptr_t char_size;
1574 intptr_t str_len;
1575 void* peer;
1577 Dart_StringGetProperties(latin1str, &char_size, &str_len, &peer));
1578 EXPECT_EQ(1, char_size);
1579 EXPECT_EQ(4, str_len);
1580 EXPECT(!peer);
1581
1582 uint8_t data8[] = {'o', 'n', 'e', 0x7F};
1583
1584 Dart_Handle str8 = Dart_NewStringFromUTF8(data8, ARRAY_SIZE(data8));
1585 EXPECT_VALID(str8);
1586 EXPECT(Dart_IsString(str8));
1588
1589 uint8_t latin1_array[] = {0, 0, 0, 0, 0};
1590 len = 5;
1591 Dart_Handle result = Dart_StringToLatin1(str8, latin1_array, &len);
1593 EXPECT_EQ(4, len);
1594 for (intptr_t i = 0; i < len; i++) {
1595 EXPECT_EQ(data8[i], latin1_array[i]);
1596 }
1597
1598 uint16_t data16[] = {'t', 'w', 'o', 0xFFFF};
1599
1600 Dart_Handle str16 = Dart_NewStringFromUTF16(data16, ARRAY_SIZE(data16));
1601 EXPECT_VALID(str16);
1602 EXPECT(Dart_IsString(str16));
1603 EXPECT(!Dart_IsStringLatin1(str16));
1604 EXPECT_VALID(Dart_StringGetProperties(str16, &char_size, &str_len, &peer));
1605 EXPECT_EQ(2, char_size);
1606 EXPECT_EQ(4, str_len);
1607 EXPECT(!peer);
1608
1609 int32_t data32[] = {'f', 'o', 'u', 'r', 0x10FFFF};
1610
1611 Dart_Handle str32 = Dart_NewStringFromUTF32(data32, ARRAY_SIZE(data32));
1612 EXPECT_VALID(str32);
1613 EXPECT(Dart_IsString(str32));
1614}
DART_EXPORT bool Dart_IsStringLatin1(Dart_Handle object)
DART_EXPORT Dart_Handle Dart_NewStringFromUTF32(const int32_t *utf32_array, intptr_t length)
DART_EXPORT Dart_Handle Dart_StringToLatin1(Dart_Handle str, uint8_t *latin1_array, intptr_t *length)
DART_EXPORT Dart_Handle Dart_NewStringFromUTF16(const uint16_t *utf16_array, intptr_t length)
DART_EXPORT Dart_Handle Dart_StringGetProperties(Dart_Handle str, intptr_t *char_size, intptr_t *str_len, void **peer)

◆ TEST_CASE() [133/600]

dart::TEST_CASE ( DartAPI_IsTearOff  )

Definition at line 1137 of file dart_api_impl_test.cc.

1137 {
1138 const char* kScriptChars =
1139 "int getInt() { return 1; }\n"
1140 "getTearOff() => getInt;\n"
1141 "Function foo = () { print('baz'); };\n"
1142 "class Baz {\n"
1143 " static int foo() => 42;\n"
1144 " getTearOff() => bar;\n"
1145 " int bar() => 24;\n"
1146 "}\n"
1147 "Baz getBaz() => Baz();\n";
1148 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
1149 EXPECT_VALID(lib);
1150
1151 // Check tear-off of top-level static method.
1152 Dart_Handle get_tear_off = Dart_GetField(lib, NewString("getTearOff"));
1153 EXPECT_VALID(get_tear_off);
1154 EXPECT(Dart_IsTearOff(get_tear_off));
1155 Dart_Handle tear_off = Dart_InvokeClosure(get_tear_off, 0, nullptr);
1156 EXPECT_VALID(tear_off);
1157 EXPECT(Dart_IsTearOff(tear_off));
1158
1159 // Check anonymous closures are not considered tear-offs.
1160 Dart_Handle anonymous_closure = Dart_GetField(lib, NewString("foo"));
1161 EXPECT_VALID(anonymous_closure);
1162 EXPECT(!Dart_IsTearOff(anonymous_closure));
1163
1164 Dart_Handle baz_cls = Dart_GetClass(lib, NewString("Baz"));
1165 EXPECT_VALID(baz_cls);
1166
1167 // Check tear-off for a static method in a class.
1168 Dart_Handle closure =
1169 Dart_GetStaticMethodClosure(lib, baz_cls, NewString("foo"));
1170 EXPECT_VALID(closure);
1171 EXPECT(Dart_IsTearOff(closure));
1172
1173 // Flutter will use Dart_IsTearOff in conjunction with Dart_ClosureFunction
1174 // and Dart_FunctionIsStatic to prevent anonymous closures from being used to
1175 // generate callback handles. We'll test that case here, just to be sure.
1178 bool is_static = false;
1181 EXPECT(is_static);
1182
1183 // Check tear-off for an instance method in a class.
1184 Dart_Handle instance = Dart_Invoke(lib, NewString("getBaz"), 0, nullptr);
1186 closure = Dart_Invoke(instance, NewString("getTearOff"), 0, nullptr);
1187 EXPECT_VALID(closure);
1188 EXPECT(Dart_IsTearOff(closure));
1189}
DART_EXPORT bool Dart_IsTearOff(Dart_Handle object)

◆ TEST_CASE() [134/600]

dart::TEST_CASE ( DartAPI_LibraryUrl  )

Definition at line 7630 of file dart_api_impl_test.cc.

7630 : library 'noodles.dart' not found.");
7631}
7632
7633TEST_CASE(DartAPI_LibraryUrl) {
7634 const char* kLibrary1Chars = "library library1_name;";
7635 Dart_Handle lib = TestCase::LoadTestLibrary("library1_url", kLibrary1Chars);
7636 Dart_Handle error = Dart_NewApiError("incoming error");
7637 EXPECT_VALID(lib);
7638
7639 Dart_Handle result = Dart_LibraryUrl(Dart_Null());
7640 EXPECT_ERROR(result,
7641 "Dart_LibraryUrl expects argument 'library' to be non-null.");
7642
7643 result = Dart_LibraryUrl(Dart_True());
7644 EXPECT_ERROR(
7645 result,
7646 "Dart_LibraryUrl expects argument 'library' to be of type Library.");
7647
7648 result = Dart_LibraryUrl(error);
7649 EXPECT(Dart_IsError(result));
7650 EXPECT_STREQ("incoming error", Dart_GetError(result));
7651
7652 result = Dart_LibraryUrl(lib);
7653 EXPECT_VALID(result);
7654 EXPECT(Dart_IsString(result));
7655 const char* cstr = nullptr;

◆ TEST_CASE() [135/600]

dart::TEST_CASE ( DartAPI_ListAccess  )

Definition at line 1738 of file dart_api_impl_test.cc.

1738 {
1739 const char* kScriptChars =
1740 "List testMain() {"
1741 " List a = List.empty(growable: true);"
1742 " a.add(10);"
1743 " a.add(20);"
1744 " a.add(30);"
1745 " return a;"
1746 "}"
1747 ""
1748 "List immutable() {"
1749 " return const [0, 1, 2];"
1750 "}";
1752
1753 // Create a test library and Load up a test script in it.
1754 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
1755
1756 // Invoke a function which returns an object of type List.
1757 result = Dart_Invoke(lib, NewString("testMain"), 0, nullptr);
1759
1760 // First ensure that the returned object is an array.
1761 Dart_Handle list_access_test_obj = result;
1762
1763 EXPECT(Dart_IsList(list_access_test_obj));
1764
1765 // Get length of array object.
1766 intptr_t len = 0;
1767 result = Dart_ListLength(list_access_test_obj, &len);
1769 EXPECT_EQ(3, len);
1770
1771 // Access elements in the array.
1772 int64_t value;
1773
1774 result = Dart_ListGetAt(list_access_test_obj, 0);
1778 EXPECT_EQ(10, value);
1779
1780 result = Dart_ListGetAt(list_access_test_obj, 1);
1784 EXPECT_EQ(20, value);
1785
1786 result = Dart_ListGetAt(list_access_test_obj, 2);
1790 EXPECT_EQ(30, value);
1791
1792 // Set some elements in the array.
1793 result = Dart_ListSetAt(list_access_test_obj, 0, Dart_NewInteger(0));
1795 result = Dart_ListSetAt(list_access_test_obj, 1, Dart_NewInteger(1));
1797 result = Dart_ListSetAt(list_access_test_obj, 2, Dart_NewInteger(2));
1799
1800 // Get length of array object.
1801 result = Dart_ListLength(list_access_test_obj, &len);
1803 EXPECT_EQ(3, len);
1804
1805 // Now try and access these elements in the array.
1806 result = Dart_ListGetAt(list_access_test_obj, 0);
1810 EXPECT_EQ(0, value);
1811
1812 result = Dart_ListGetAt(list_access_test_obj, 1);
1816 EXPECT_EQ(1, value);
1817
1818 result = Dart_ListGetAt(list_access_test_obj, 2);
1822 EXPECT_EQ(2, value);
1823
1824 uint8_t native_array[3];
1825 result = Dart_ListGetAsBytes(list_access_test_obj, 0, native_array, 3);
1827 EXPECT_EQ(0, native_array[0]);
1828 EXPECT_EQ(1, native_array[1]);
1829 EXPECT_EQ(2, native_array[2]);
1830
1831 native_array[0] = 10;
1832 native_array[1] = 20;
1833 native_array[2] = 30;
1834 result = Dart_ListSetAsBytes(list_access_test_obj, 0, native_array, 3);
1836 result = Dart_ListGetAsBytes(list_access_test_obj, 0, native_array, 3);
1838 EXPECT_EQ(10, native_array[0]);
1839 EXPECT_EQ(20, native_array[1]);
1840 EXPECT_EQ(30, native_array[2]);
1841 result = Dart_ListGetAt(list_access_test_obj, 2);
1845 EXPECT_EQ(30, value);
1846
1847 // Check if we get an exception when accessing beyond limit.
1848 result = Dart_ListGetAt(list_access_test_obj, 4);
1850
1851 // Check if we can get a range of values.
1852 result = Dart_ListGetRange(list_access_test_obj, 8, 4, nullptr);
1854 const int kRangeOffset = 1;
1855 const int kRangeLength = 2;
1856 Dart_Handle values[kRangeLength];
1857
1858 result = Dart_ListGetRange(list_access_test_obj, 8, 4, values);
1860
1861 result = Dart_ListGetRange(list_access_test_obj, kRangeOffset, kRangeLength,
1862 values);
1864
1865 result = Dart_IntegerToInt64(values[0], &value);
1867 EXPECT_EQ(20, value);
1868
1869 result = Dart_IntegerToInt64(values[1], &value);
1871 EXPECT_EQ(30, value);
1872
1873 // Check that we get an exception (and not a fatal error) when
1874 // calling ListSetAt and ListSetAsBytes with an immutable list.
1875 list_access_test_obj = Dart_Invoke(lib, NewString("immutable"), 0, nullptr);
1876 EXPECT_VALID(list_access_test_obj);
1877 EXPECT(Dart_IsList(list_access_test_obj));
1878
1879 result = Dart_ListSetAsBytes(list_access_test_obj, 0, native_array, 3);
1882
1883 result = Dart_ListSetAt(list_access_test_obj, 0, Dart_NewInteger(42));
1886}
DART_EXPORT Dart_Handle Dart_ListSetAsBytes(Dart_Handle list, intptr_t offset, const uint8_t *native_array, intptr_t length)
DART_EXPORT Dart_Handle Dart_ListGetRange(Dart_Handle list, intptr_t offset, intptr_t length, Dart_Handle *result)
DART_EXPORT Dart_Handle Dart_ListGetAsBytes(Dart_Handle list, intptr_t offset, uint8_t *native_array, intptr_t length)

◆ TEST_CASE() [136/600]

dart::TEST_CASE ( DartAPI_LookupLibrary  )

Definition at line 7588 of file dart_api_impl_test.cc.

7591 {
7592 const char* kScriptChars =
7593 "import 'library1_dart';"
7594 "main() {}";
7595 const char* kLibrary1 = "file:///library1_dart";
7596 const char* kLibrary1Chars =
7597 "library library1;"
7598 "final x = 0;";
7599
7600 Dart_Handle url;
7602
7603 // Create a test library and load up a test script in it.
7604 TestCase::AddTestLib("file:///library1_dart", kLibrary1Chars);
7605 // LoadTestScript resets the LibraryTagHandler, which we don't want when
7606 // using the VM compiler, so we only use it with the Dart frontend for this
7607 // test.
7608 result = TestCase::LoadTestScript(kScriptChars, nullptr, TestCase::url());
7610
7611 url = NewString(kLibrary1);
7614
7617 "Dart_LookupLibrary expects argument 'url' to be non-null.");
7618
7621 result,
7622 "Dart_LookupLibrary expects argument 'url' to be of type String.");
7623
7624 result = Dart_LookupLibrary(Dart_NewApiError("incoming error"));
7626 EXPECT_STREQ("incoming error", Dart_GetError(result));
7627
7628 url = NewString("noodles.dart");

◆ TEST_CASE() [137/600]

dart::TEST_CASE ( DartAPI_MalformedStringToUTF8  )

Definition at line 1637 of file dart_api_impl_test.cc.

1637 {
1638 // 1D11E = treble clef
1639 // [0] should be high surrogate D834
1640 // [1] should be low surrogate DD1E
1641 // Strings are allowed to have individual or out of order surrogates, even
1642 // if that doesn't make sense as renderable characters.
1643 const char* kScriptChars =
1644 "String lowSurrogate() {"
1645 " return '\\u{1D11E}'[1];"
1646 "}"
1647 "String highSurrogate() {"
1648 " return '\\u{1D11E}'[0];"
1649 "}"
1650 "String reversed() => lowSurrogate() + highSurrogate();";
1651
1652 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
1653 Dart_Handle str1 = Dart_Invoke(lib, NewString("lowSurrogate"), 0, nullptr);
1654 EXPECT_VALID(str1);
1655
1656 uint8_t* utf8_encoded = nullptr;
1657 intptr_t utf8_length = 0;
1658 Dart_Handle result = Dart_StringToUTF8(str1, &utf8_encoded, &utf8_length);
1660 EXPECT_EQ(3, utf8_length);
1661 // Unpaired surrogate is encoded as replacement character.
1662 EXPECT_EQ(239, static_cast<intptr_t>(utf8_encoded[0]));
1663 EXPECT_EQ(191, static_cast<intptr_t>(utf8_encoded[1]));
1664 EXPECT_EQ(189, static_cast<intptr_t>(utf8_encoded[2]));
1665
1666 Dart_Handle str2 = Dart_NewStringFromUTF8(utf8_encoded, utf8_length);
1667 EXPECT_VALID(str2); // Replacement character, but still valid
1668
1669 Dart_Handle reversed = Dart_Invoke(lib, NewString("reversed"), 0, nullptr);
1670 EXPECT_VALID(reversed); // This is also allowed.
1671 uint8_t* utf8_encoded_reversed = nullptr;
1672 intptr_t utf8_length_reversed = 0;
1673 result = Dart_StringToUTF8(reversed, &utf8_encoded_reversed,
1674 &utf8_length_reversed);
1676 EXPECT_EQ(6, utf8_length_reversed);
1677 // Two unpaired surrogates are encoded as two replacement characters.
1678 uint8_t expected[6] = {239, 191, 189, 239, 191, 189};
1679 for (int i = 0; i < 6; i++) {
1680 EXPECT_EQ(expected[i], utf8_encoded_reversed[i]);
1681 }
1682}

◆ TEST_CASE() [138/600]

dart::TEST_CASE ( DartAPI_MapAccess  )

Definition at line 1888 of file dart_api_impl_test.cc.

1888 {
1890 const char* kScriptChars =
1891 "Map testMain() {"
1892 " return {"
1893 " 'a' : 1,"
1894 " 'b' : null,"
1895 " };"
1896 "}";
1898
1899 // Create a test library and Load up a test script in it.
1900 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
1901
1902 // Invoke a function which returns an object of type Map.
1903 result = Dart_Invoke(lib, NewString("testMain"), 0, nullptr);
1905
1906 // First ensure that the returned object is a map.
1907 Dart_Handle map = result;
1908 Dart_Handle a = NewString("a");
1909 Dart_Handle b = NewString("b");
1910 Dart_Handle c = NewString("c");
1911
1912 EXPECT(Dart_IsMap(map));
1913 EXPECT(!Dart_IsMap(a));
1914
1915 // Access values in the map.
1916 int64_t value;
1917 result = Dart_MapGetAt(map, a);
1921 EXPECT_EQ(value, 1);
1922
1923 result = Dart_MapGetAt(map, b);
1925
1926 result = Dart_MapGetAt(map, c);
1928
1930
1931 // Test for presence of keys.
1932 bool contains = false;
1938
1939 contains = false;
1945
1946 contains = true;
1951 EXPECT(!contains);
1952
1954
1955 // Enumerate keys. (Note literal maps guarantee key order.)
1956 Dart_Handle keys = Dart_MapKeys(map);
1957 EXPECT_VALID(keys);
1958
1959 intptr_t len = 0;
1960 bool equals;
1961 result = Dart_ListLength(keys, &len);
1963 EXPECT_EQ(2, len);
1964
1965 result = Dart_ListGetAt(keys, 0);
1967 equals = false;
1969 EXPECT(equals);
1970
1971 result = Dart_ListGetAt(keys, 1);
1973 equals = false;
1975 EXPECT(equals);
1976
1978}
static bool contains(const SkRect &r, SkPoint p)
DART_EXPORT Dart_Handle Dart_MapKeys(Dart_Handle map)
DART_EXPORT Dart_Handle Dart_MapContainsKey(Dart_Handle map, Dart_Handle key)
DART_EXPORT Dart_Handle Dart_ObjectEquals(Dart_Handle obj1, Dart_Handle obj2, bool *equal)
DART_EXPORT Dart_Handle Dart_MapGetAt(Dart_Handle map, Dart_Handle key)
DART_EXPORT bool Dart_IsMap(Dart_Handle object)

◆ TEST_CASE() [139/600]

dart::TEST_CASE ( DartAPI_Multiroot_FailWhenUriIsWrong  )

Definition at line 7934 of file dart_api_impl_test.cc.

7935 {
7936 script ^= lib_scripts.At(i);
7937 uri = script.url();
7938 const char* uri_str = uri.ToCString();
7939 EXPECT(strstr(uri_str, "foo:///") == uri_str);
7940 }
7941 }
7944 result = Dart_Invoke(lib, NewString("main"), 0, nullptr);
7946}
7947
7948TEST_CASE(DartAPI_Multiroot_FailWhenUriIsWrong) {
7949 const char* kScriptChars =
7950 "import 'lib.dart';\n"
7951 "void main() {}\n";
7952 const char* kLibraryChars = "library lib.dart;\n";
7953 Dart_Handle lib;
7954
7955 Dart_SourceFile sourcefiles[] = {
7956 {"file:///bar/main.dart", kScriptChars},

◆ TEST_CASE() [140/600]

dart::TEST_CASE ( DartAPI_Multiroot_Valid  )

Definition at line 7892 of file dart_api_impl_test.cc.

7892 {RESOLVED_USER_TEST_URI, kScriptChars},
7893 {"file:///lib.dart", kLibraryChars},
7894 };
7895 int sourcefiles_count = sizeof(sourcefiles) / sizeof(Dart_SourceFile);
7896 lib = TestCase::LoadTestScriptWithDFE(sourcefiles_count, sourcefiles, nullptr,
7897 true);
7898 EXPECT_VALID(lib);
7899
7902 result = Dart_Invoke(lib, NewString("main"), 0, nullptr);
7904}
7905
7906TEST_CASE(DartAPI_Multiroot_Valid) {
7907 const char* kScriptChars =
7908 "import 'lib.dart';\n"
7909 "void main() {}\n";
7910 const char* kLibraryChars = "library lib.dart;\n";
7912 Dart_Handle lib;
7913
7914 Dart_SourceFile sourcefiles[] = {
7915 {"file:///bar/main.dart", kScriptChars},
7916 {"file:///baz/lib.dart", kLibraryChars},
7917 {"file:///bar/.packages", ""},
7918 };
7919 int sourcefiles_count = sizeof(sourcefiles) / sizeof(Dart_SourceFile);
7920 lib = TestCase::LoadTestScriptWithDFE(
7921 sourcefiles_count, sourcefiles, nullptr, /* finalize= */ true,
7922 /* incrementally= */ true, /* allow_compile_errors= */ false,
7923 "foo:///main.dart",
7924 /* multiroot_filepaths= */ "/bar,/baz",
7925 /* multiroot_scheme= */ "foo");
7926 EXPECT_VALID(lib);
7927 {
7928 TransitionNativeToVM transition(thread);
7929 Library& lib_obj = Library::Handle();
7930 lib_obj ^= Api::UnwrapHandle(lib);
7931 EXPECT_STREQ("foo:///main.dart", String::Handle(lib_obj.url()).ToCString());
7932 const Array& lib_scripts = Array::Handle(lib_obj.LoadedScripts());

◆ TEST_CASE() [141/600]

dart::TEST_CASE ( DartAPI_NativeFieldAccess  )

Definition at line 4453 of file dart_api_impl_test.cc.

4453 {
4454 const char* kScriptChars = R"(
4455 import 'dart:ffi';
4456 import 'dart:nativewrappers';
4457 base class SecretKeeper extends NativeFieldWrapperClass1 {
4458 SecretKeeper(int secret) { _keepSecret(secret); }
4459 @pragma("vm:external-name", "SecretKeeper_KeepSecret")
4460 external void _keepSecret(int secret);
4461 }
4462 // Argument auto-conversion will wrap `o` in `_getNativeField()`.
4463 @Native<IntPtr Function(Pointer<Void>)>(symbol: 'returnPtrAsInt')
4464 external int returnPtrAsInt(NativeFieldWrapperClass1 o);
4465 main() => returnPtrAsInt(SecretKeeper(321));
4466 )";
4467
4469 Dart_Handle lib =
4470 TestCase::LoadTestScript(kScriptChars, SecretKeeperNativeResolver);
4471
4472 result = Dart_SetFfiNativeResolver(lib, &SecretKeeperFfiNativeResolver);
4474
4475 result = Dart_Invoke(lib, NewString("main"), 0, nullptr);
4476
4479 int64_t value = 0;
4482 EXPECT_EQ(321, value);
4483}

◆ TEST_CASE() [142/600]

dart::TEST_CASE ( DartAPI_NativeFieldAccess_Throws  )

Definition at line 4487 of file dart_api_impl_test.cc.

4487 {
4488 const char* kScriptChars = R"(
4489 import 'dart:ffi';
4490 import 'dart:nativewrappers';
4491 base class ForgetfulSecretKeeper extends NativeFieldWrapperClass1 {
4492 ForgetfulSecretKeeper(int secret) { /* Forget to init. native field. */ }
4493 }
4494 // Argument auto-conversion will wrap `o` in `_getNativeField()`.
4495 @Native<IntPtr Function(Pointer<Void>)>(symbol: 'returnPtrAsInt')
4496 external int returnPtrAsInt(NativeFieldWrapperClass1 o);
4497 main() => returnPtrAsInt(ForgetfulSecretKeeper(321));
4498 )";
4499
4501 Dart_Handle lib =
4502 TestCase::LoadTestScript(kScriptChars, SecretKeeperNativeResolver);
4503
4504 result = Dart_SetFfiNativeResolver(lib, &SecretKeeperFfiNativeResolver);
4506
4507 result = Dart_Invoke(lib, NewString("main"), 0, nullptr);
4508
4511}

◆ TEST_CASE() [143/600]

dart::TEST_CASE ( DartAPI_NativeFunctionClosure  )

Definition at line 8744 of file dart_api_impl_test.cc.

8744 {
8745 return &NativeFoo1;
8746 } else if (strncmp(function_name, kNativeFoo2, strlen(kNativeFoo2)) == 0) {
8747 return &NativeFoo2;
8748 } else if (strncmp(function_name, kNativeFoo3, strlen(kNativeFoo3)) == 0) {
8749 return &NativeFoo3;
8750 } else if (strncmp(function_name, kNativeFoo4, strlen(kNativeFoo4)) == 0) {
8751 return &NativeFoo4;
8752 } else {
8753 UNREACHABLE();
8754 return nullptr;
8755 }
8756}
8757
8758TEST_CASE(DartAPI_NativeFunctionClosure) {
8759 const char* kScriptChars =
8760 R"(
8761 class Test {
8762 @pragma('vm:external-name', 'NativeFoo1')
8763 external int foo1();
8764
8765 @pragma('vm:external-name', 'NativeFoo2')
static void NativeFoo1(Dart_NativeArguments args)

◆ TEST_CASE() [144/600]

dart::TEST_CASE ( DartAPI_NativePort_Loop  )

Definition at line 9964 of file dart_api_impl_test.cc.

◆ TEST_CASE() [145/600]

dart::TEST_CASE ( DartAPI_NativePortPostExternalTypedData  )

Definition at line 8243 of file dart_api_impl_test.cc.

8248 {
8249 EXPECT_EQ((0x41 + i), message->value.as_typed_data.values[i]);
8250 }
8251}
8252
8253static void FinalizeTypedData(void* isolate_callback_data, void* peer) {
8254 delete[] reinterpret_cast<int8_t*>(peer);
8255}
8256
8257TEST_CASE(DartAPI_NativePortPostExternalTypedData) {
8258 int8_t* extTypedData = new int8_t[kSendLength];
8259 for (int i = 0; i < kSendLength; i++) {
8260 extTypedData[i] = 0x41 + i;
8261 }
8262 const char* kScriptChars =
8263 "import 'dart:typed_data';\n"
8264 "import 'dart:isolate';\n"
8265 "void callPort(SendPort port, Uint8List data) {\n"
8266 " port.send(data);\n"
8267 "}\n";
8268 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
8270
8271 Dart_Port port_id =
8272 Dart_NewNativePort("Port123", NewNativePort_ExternalTypedData, true);
8273
8274 Dart_Handle send_port = Dart_NewSendPort(port_id);
8275 EXPECT_VALID(send_port);
8276
8278 Dart_TypedData_kUint8, extTypedData, kSendLength, extTypedData,
8279 kSendLength, FinalizeTypedData);
8280 EXPECT_VALID(extdata);
8281
static constexpr intptr_t kSendLength
static void FinalizeTypedData(void *isolate_callback_data, void *peer)

◆ TEST_CASE() [146/600]

dart::TEST_CASE ( DartAPI_NativePortPostInteger  )

Definition at line 8108 of file dart_api_impl_test.cc.

8111 {
8112 // Gets a null message.
8113 EXPECT_NOTNULL(message);
8114 EXPECT_EQ(Dart_CObject_kArray, message->type);
8115 EXPECT_EQ(Dart_CObject_kSendPort, message->value.as_array.values[0]->type);
8116
8117 // Post integer value.
8118 Dart_PostInteger(message->value.as_array.values[0]->value.as_send_port.id,
8119 321);
8120}
8121
8122TEST_CASE(DartAPI_NativePortPostInteger) {
8123 const char* kScriptChars =
8124 "import 'dart:isolate';\n"
8125 "void callPort(SendPort port) {\n"
8126 " var receivePort = new RawReceivePort();\n"
8127 " var replyPort = receivePort.sendPort;\n"
8128 " port.send(<dynamic>[replyPort]);\n"
8129 " receivePort.handler = (message) {\n"
8130 " receivePort.close();\n"
8131 " throw new Exception(message);\n"
8132 " };\n"
8133 "}\n";
8134 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
8136
8137 Dart_Port port_id1 =
8138 Dart_NewNativePort("Port123", NewNativePort_sendInteger123, true);
8139 Dart_Port port_id2 =
8140 Dart_NewNativePort("Port321", NewNativePort_sendInteger321, true);
8141
8142 Dart_Handle send_port1 = Dart_NewSendPort(port_id1);
8143 EXPECT_VALID(send_port1);
8144 Dart_Handle send_port2 = Dart_NewSendPort(port_id2);
8145 EXPECT_VALID(send_port2);
8146
8147 // Test first port.
8148 Dart_Handle dart_args[1];
8149 dart_args[0] = send_port1;
8150 Dart_Handle result = Dart_Invoke(lib, NewString("callPort"), 1, dart_args);
8152 result = Dart_RunLoop();
8155 EXPECT_SUBSTRING("Exception: 123\n", Dart_GetError(result));
8156
8157 // result second port.

◆ TEST_CASE() [147/600]

dart::TEST_CASE ( DartAPI_NativePortPostTransferrableTypedData  )

Definition at line 8184 of file dart_api_impl_test.cc.

8185 {
8186 // Gets a send port message.
8187 EXPECT_NOTNULL(message);
8188 EXPECT_EQ(Dart_CObject_kArray, message->type);
8189 EXPECT_EQ(1, message->value.as_array.length);
8191 EXPECT_EQ(Dart_CObject_kTypedData, cobj->type);
8193 EXPECT_EQ(10, cobj->value.as_typed_data.length);
8194 EXPECT_EQ(42, cobj->value.as_typed_data.values[0]);
8195 free(const_cast<uint8_t*>(cobj->value.as_typed_data.values));
8196}
8197
8198TEST_CASE(DartAPI_NativePortPostTransferrableTypedData) {
8199 const char* kScriptChars =
8200 "import 'dart:typed_data';\n"
8201 "import 'dart:isolate';\n"
8202 "void callPort(SendPort port1, SendPort port2) {\n"
8203 " final td1 ="
8204 " TransferableTypedData.fromList([Uint8List(10)..[0] = 42]);\n"
8205 " final td2 ="
8206 " TransferableTypedData.fromList([Uint8List(10)..[0] = 42]);\n"
8207 " port1.send(td1);\n"
8208 " port2.send([td2]);\n"
8209 "}\n";
8210 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
8212
8213 Dart_Port port_id1 =
8214 Dart_NewNativePort("Port123", NewNativePort_Transferrable1, true);
8215 Dart_Port port_id2 =
8216 Dart_NewNativePort("Port321", NewNativePort_Transferrable2, true);
8217
8218 Dart_Handle send_port1 = Dart_NewSendPort(port_id1);
8219 EXPECT_VALID(send_port1);
8220 Dart_Handle send_port2 = Dart_NewSendPort(port_id2);
8221 EXPECT_VALID(send_port2);
8222
8223 // Test first port.

◆ TEST_CASE() [148/600]

dart::TEST_CASE ( DartAPI_NativePortPostUserClass  )

Definition at line 8288 of file dart_api_impl_test.cc.

8298 {
8299 UNREACHABLE();
8300}
8301
8302TEST_CASE(DartAPI_NativePortPostUserClass) {
8303 const char* kScriptChars =
8304 "import 'dart:isolate';\n"
8305 "class ABC {}\n"
8306 "void callPort(SendPort port) {\n"
8307 " port.send(new ABC());\n"
8308 "}\n";
8309 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
8311
8312 Dart_Port port_id =
8313 Dart_NewNativePort("Port123", UnreachableMessageHandler, true);
8314
8315 // Test send with port open.
8316 {
8317 Dart_Handle send_port = Dart_NewSendPort(port_id);
8318 EXPECT_VALID(send_port);
8319 Dart_Handle dart_args[1];
8320 dart_args[0] = send_port;
8321 Dart_Handle result = Dart_Invoke(lib, NewString("callPort"), 1, dart_args);
8322 EXPECT_ERROR(result, "Invalid argument");
8323 }

◆ TEST_CASE() [149/600]

dart::TEST_CASE ( DartAPI_NativePortReceiveInteger  )

Definition at line 8391 of file dart_api_impl_test.cc.

8391 {
8392 EXPECT_NOTNULL(message);
8393
8394 if ((message->type == Dart_CObject_kArray) &&
8395 (message->value.as_array.values[0]->type == Dart_CObject_kSendPort)) {
8396 // Post integer value.
8397 Dart_PostInteger(message->value.as_array.values[0]->value.as_send_port.id,
8398 123);
8399 } else {
8400 EXPECT_EQ(message->type, Dart_CObject_kInt32);
8401 EXPECT_EQ(message->value.as_int32, 321);
8402 }
8403}
8404
8405TEST_CASE(DartAPI_NativePortReceiveInteger) {
8406 const char* kScriptChars =
8407 "import 'dart:isolate';\n"
8408 "void callPort(SendPort port) {\n"
8409 " var receivePort = new RawReceivePort();\n"
8410 " var replyPort = receivePort.sendPort;\n"
8411 " port.send(321);\n"
8412 " port.send(<dynamic>[replyPort]);\n"
8413 " receivePort.handler = (message) {\n"
8414 " receivePort.close();\n"
8415 " throw new Exception(message);\n"
8416 " };\n"
8417 "}\n";
8418 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
8420
8421 Dart_Port port_id1 =
8422 Dart_NewNativePort("PortNull", NewNativePort_nativeReceiveInteger, true);
8423 Dart_Handle send_port1 = Dart_NewSendPort(port_id1);
8424 EXPECT_VALID(send_port1);
8425
8426 // Test first port.

◆ TEST_CASE() [150/600]

dart::TEST_CASE ( DartAPI_NativePortReceiveNull  )

Definition at line 8339 of file dart_api_impl_test.cc.

8340 {
8341 EXPECT_NOTNULL(message);
8342
8343 if ((message->type == Dart_CObject_kArray) &&
8344 (message->value.as_array.values[0]->type == Dart_CObject_kSendPort)) {
8345 // Post integer value.
8346 Dart_PostInteger(message->value.as_array.values[0]->value.as_send_port.id,
8347 123);
8348 } else {
8349 EXPECT_EQ(message->type, Dart_CObject_kNull);
8350 }
8351}
8352
8353TEST_CASE(DartAPI_NativePortReceiveNull) {
8354 const char* kScriptChars =
8355 "import 'dart:isolate';\n"
8356 "void callPort(SendPort port) {\n"
8357 " var receivePort = new RawReceivePort();\n"
8358 " var replyPort = receivePort.sendPort;\n"
8359 " port.send(null);\n"
8360 " port.send(<dynamic>[replyPort]);\n"
8361 " receivePort.handler = (message) {\n"
8362 " receivePort.close();\n"
8363 " throw new Exception(message);\n"
8364 " };\n"
8365 "}\n";
8366 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
8368
8369 Dart_Port port_id1 =
8370 Dart_NewNativePort("PortNull", NewNativePort_nativeReceiveNull, true);
8371 Dart_Handle send_port1 = Dart_NewSendPort(port_id1);
8372 EXPECT_VALID(send_port1);
8373
8374 // Test first port.

◆ TEST_CASE() [151/600]

dart::TEST_CASE ( DartAPI_NativeStaticFunctionClosure  )

Definition at line 8836 of file dart_api_impl_test.cc.

8838 {
8840 intptr_t i = Dart_GetNativeArgumentCount(args);
8841 EXPECT_EQ(0, i);
8844}
8845
8846static void StaticNativeFoo2(Dart_NativeArguments args) {
8848 intptr_t i = Dart_GetNativeArgumentCount(args);
8849 EXPECT_EQ(1, i);
8851 Dart_SetReturnValue(args, Dart_NewInteger(GetValue(arg)));
8853}
8854
8857 intptr_t i = Dart_GetNativeArgumentCount(args);
static void StaticNativeFoo3(Dart_NativeArguments args)

◆ TEST_CASE() [152/600]

dart::TEST_CASE ( DartAPI_NegativeNativeFieldAccess  )

Definition at line 5809 of file dart_api_impl_test.cc.

5809 {
5810 // clang-format off
5811 auto kScriptChars = Utils::CStringUniquePtr(
5812 OS::SCreate(nullptr,
5813 "import 'dart:nativewrappers';\n"
5814 "class NativeFields {\n"
5815 " NativeFields(int i, int j) : fld1 = i, fld2 = j {}\n"
5816 " int fld1;\n"
5817 " final int fld2;\n"
5818 " static int%s fld3;\n"
5819 " static const int fld4 = 10;\n"
5820 "}\n"
5821 "NativeFields testMain1() {\n"
5822 " NativeFields obj = new NativeFields(10, 20);\n"
5823 " return obj;\n"
5824 "}\n"
5825 "Function testMain2() {\n"
5826 " return () {};\n"
5827 "}\n",
5828 TestCase::NullableTag()),
5829 std::free);
5830 // clang-format on
5831
5833 CHECK_API_SCOPE(thread);
5834
5835 // Create a test library and Load up a test script in it.
5836 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars.get(), nullptr);
5837
5838 // Invoke a function which returns an object of type NativeFields.
5839 Dart_Handle retobj = Dart_Invoke(lib, NewString("testMain1"), 0, nullptr);
5840 EXPECT_VALID(retobj);
5841
5842 // Now access and set various native instance fields of the returned object.
5843 // All of these tests are expected to return failure as there are no
5844 // native fields in an instance of NativeFields.
5845 const int kNativeFld0 = 0;
5846 const int kNativeFld1 = 1;
5847 const int kNativeFld2 = 2;
5848 const int kNativeFld3 = 3;
5849 const int kNativeFld4 = 4;
5850 intptr_t value = 0;
5851 result = Dart_GetNativeInstanceField(retobj, kNativeFld4, &value);
5853 result = Dart_GetNativeInstanceField(retobj, kNativeFld0, &value);
5855 result = Dart_GetNativeInstanceField(retobj, kNativeFld1, &value);
5857 result = Dart_GetNativeInstanceField(retobj, kNativeFld2, &value);
5859 result = Dart_SetNativeInstanceField(retobj, kNativeFld4, 40);
5861 result = Dart_SetNativeInstanceField(retobj, kNativeFld3, 40);
5863 result = Dart_SetNativeInstanceField(retobj, kNativeFld0, 400);
5865
5866 // Invoke a function which returns a closure object.
5867 retobj = Dart_Invoke(lib, NewString("testMain2"), 0, nullptr);
5868 EXPECT_VALID(retobj);
5869
5870 result = Dart_GetNativeInstanceField(retobj, kNativeFld4, &value);
5872 result = Dart_GetNativeInstanceField(retobj, kNativeFld0, &value);
5874 result = Dart_GetNativeInstanceField(retobj, kNativeFld1, &value);
5876 result = Dart_GetNativeInstanceField(retobj, kNativeFld2, &value);
5878 result = Dart_SetNativeInstanceField(retobj, kNativeFld4, 40);
5880 result = Dart_SetNativeInstanceField(retobj, kNativeFld3, 40);
5882 result = Dart_SetNativeInstanceField(retobj, kNativeFld0, 400);
5884}

◆ TEST_CASE() [153/600]

dart::TEST_CASE ( DartAPI_New  )

Definition at line 5975 of file dart_api_impl_test.cc.

5975 {
5976 const char* kScriptChars =
5977 "class MyClass implements MyExtraHop {\n"
5978 " MyClass() : foo = 7 {}\n"
5979 " MyClass.named(value) : foo = value {}\n"
5980 " MyClass._hidden(value) : foo = -value {}\n"
5981 " MyClass.exception(value) : foo = value {\n"
5982 " throw 'ConstructorDeath';\n"
5983 " }\n"
5984 " factory MyClass.multiply(value) {\n"
5985 " return new MyClass.named(value * 100);\n"
5986 " }\n"
5987 " var foo;\n"
5988 "}\n"
5989 "\n"
5990 "abstract class MyExtraHop implements MyInterface {\n"
5991 " factory MyExtraHop.hop(value) = MyClass.named;\n"
5992 "}\n"
5993 "\n"
5994 "abstract class MyInterface {\n"
5995 " factory MyInterface.named(value) = MyExtraHop.hop;\n"
5996 " factory MyInterface.multiply(value) = MyClass.multiply;\n"
5997 " MyInterface.notfound(value);\n"
5998 "}\n"
5999 "\n"
6000 "class _MyClass {\n"
6001 " _MyClass._() : foo = 7 {}\n"
6002 " var foo;\n"
6003 "}\n"
6004 "\n";
6005
6006 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
6008 Dart_GetNonNullableType(lib, NewString("MyClass"), 0, nullptr);
6010 Dart_Handle intf =
6011 Dart_GetNonNullableType(lib, NewString("MyInterface"), 0, nullptr);
6012 EXPECT_VALID(intf);
6013 Dart_Handle private_type =
6014 Dart_GetNonNullableType(lib, NewString("_MyClass"), 0, nullptr);
6015 EXPECT_VALID(private_type);
6016
6017 Dart_Handle args[1];
6018 args[0] = Dart_NewInteger(11);
6019 Dart_Handle bad_args[1];
6020 bad_args[0] = Dart_NewApiError("myerror");
6021
6022 // Allocate and Invoke the unnamed constructor passing in Dart_Null.
6023 Dart_Handle result = Dart_New(type, Dart_Null(), 0, nullptr);
6025 bool instanceOf = false;
6026 EXPECT_VALID(Dart_ObjectIsType(result, type, &instanceOf));
6027 EXPECT(instanceOf);
6028 int64_t int_value = 0;
6030 EXPECT_VALID(Dart_IntegerToInt64(foo, &int_value));
6031 EXPECT_EQ(7, int_value);
6032
6033 // Allocate without a constructor.
6035 EXPECT_VALID(obj);
6036 instanceOf = false;
6037 EXPECT_VALID(Dart_ObjectIsType(obj, type, &instanceOf));
6038 EXPECT(instanceOf);
6039 foo = Dart_GetField(obj, NewString("foo"));
6040 EXPECT(Dart_IsNull(foo));
6041
6042 // Allocate and Invoke the unnamed constructor passing in an empty string.
6043 result = Dart_New(type, Dart_EmptyString(), 0, nullptr);
6045 instanceOf = false;
6046 EXPECT_VALID(Dart_ObjectIsType(result, type, &instanceOf));
6047 EXPECT(instanceOf);
6048 int_value = 0;
6049 foo = Dart_GetField(result, NewString("foo"));
6050 EXPECT_VALID(Dart_IntegerToInt64(foo, &int_value));
6051 EXPECT_EQ(7, int_value);
6052
6053 // Allocate object and invoke the unnamed constructor with an empty string.
6054 obj = Dart_Allocate(type);
6055 EXPECT_VALID(obj);
6056 instanceOf = false;
6057 EXPECT_VALID(Dart_ObjectIsType(obj, type, &instanceOf));
6058 EXPECT(instanceOf);
6059 // Use the empty string to invoke the unnamed constructor.
6060 result = Dart_InvokeConstructor(obj, Dart_EmptyString(), 0, nullptr);
6062 int_value = 0;
6063 foo = Dart_GetField(result, NewString("foo"));
6064 EXPECT_VALID(Dart_IntegerToInt64(foo, &int_value));
6065 EXPECT_EQ(7, int_value);
6066 // use Dart_Null to invoke the unnamed constructor.
6067 result = Dart_InvokeConstructor(obj, Dart_Null(), 0, nullptr);
6069 int_value = 0;
6070 foo = Dart_GetField(result, NewString("foo"));
6071 EXPECT_VALID(Dart_IntegerToInt64(foo, &int_value));
6072 EXPECT_EQ(7, int_value);
6073
6074 // Invoke a named constructor.
6075 result = Dart_New(type, NewString("named"), 1, args);
6077 EXPECT_VALID(Dart_ObjectIsType(result, type, &instanceOf));
6078 EXPECT(instanceOf);
6079 int_value = 0;
6080 foo = Dart_GetField(result, NewString("foo"));
6081 EXPECT_VALID(Dart_IntegerToInt64(foo, &int_value));
6082 EXPECT_EQ(11, int_value);
6083
6084 // Allocate object and invoke a named constructor.
6085 obj = Dart_Allocate(type);
6086 EXPECT_VALID(obj);
6087 instanceOf = false;
6088 EXPECT_VALID(Dart_ObjectIsType(obj, type, &instanceOf));
6089 EXPECT(instanceOf);
6090 result = Dart_InvokeConstructor(obj, NewString("named"), 1, args);
6092 int_value = 0;
6093 foo = Dart_GetField(result, NewString("foo"));
6094 EXPECT_VALID(Dart_IntegerToInt64(foo, &int_value));
6095 EXPECT_EQ(11, int_value);
6096
6097 // Invoke a hidden named constructor.
6098 result = Dart_New(type, NewString("_hidden"), 1, args);
6100 EXPECT_VALID(Dart_ObjectIsType(result, type, &instanceOf));
6101 EXPECT(instanceOf);
6102 int_value = 0;
6103 foo = Dart_GetField(result, NewString("foo"));
6104 EXPECT_VALID(Dart_IntegerToInt64(foo, &int_value));
6105 EXPECT_EQ(-11, int_value);
6106
6107 // Invoke a hidden named constructor on a hidden type.
6108 result = Dart_New(private_type, NewString("_"), 0, nullptr);
6110 int_value = 0;
6111 foo = Dart_GetField(result, NewString("foo"));
6112 EXPECT_VALID(Dart_IntegerToInt64(foo, &int_value));
6113 EXPECT_EQ(7, int_value);
6114
6115 // Allocate object and invoke a hidden named constructor.
6116 obj = Dart_Allocate(type);
6117 EXPECT_VALID(obj);
6118 instanceOf = false;
6119 EXPECT_VALID(Dart_ObjectIsType(obj, type, &instanceOf));
6120 EXPECT(instanceOf);
6121 result = Dart_InvokeConstructor(obj, NewString("_hidden"), 1, args);
6123 int_value = 0;
6124 foo = Dart_GetField(result, NewString("foo"));
6125 EXPECT_VALID(Dart_IntegerToInt64(foo, &int_value));
6126 EXPECT_EQ(-11, int_value);
6127
6128 // Allocate object and Invoke a constructor which throws an exception.
6129 obj = Dart_Allocate(type);
6130 EXPECT_VALID(obj);
6131 instanceOf = false;
6132 EXPECT_VALID(Dart_ObjectIsType(obj, type, &instanceOf));
6133 EXPECT(instanceOf);
6134 result = Dart_InvokeConstructor(obj, NewString("exception"), 1, args);
6135 EXPECT_ERROR(result, "ConstructorDeath");
6136
6137 // Invoke a factory constructor.
6138 result = Dart_New(type, NewString("multiply"), 1, args);
6140 EXPECT_VALID(Dart_ObjectIsType(result, type, &instanceOf));
6141 EXPECT(instanceOf);
6142 int_value = 0;
6143 foo = Dart_GetField(result, NewString("foo"));
6144 EXPECT_VALID(Dart_IntegerToInt64(foo, &int_value));
6145 EXPECT_EQ(1100, int_value);
6146
6147 // Pass an error class object. Error is passed through.
6148 result = Dart_New(Dart_NewApiError("myerror"), NewString("named"), 1, args);
6149 EXPECT_ERROR(result, "myerror");
6150
6151 // Pass a bad class object.
6152 result = Dart_New(Dart_Null(), NewString("named"), 1, args);
6153 EXPECT_ERROR(result, "Dart_New expects argument 'type' to be non-null.");
6154
6155 // Pass a negative arg count.
6156 result = Dart_New(type, NewString("named"), -1, args);
6158 result,
6159 "Dart_New expects argument 'number_of_arguments' to be non-negative.");
6160
6161 // Pass the wrong arg count.
6162 result = Dart_New(type, NewString("named"), 0, nullptr);
6164 result,
6165 "Dart_New: wrong argument count for constructor 'MyClass.named': "
6166 "0 passed, 1 expected.");
6167
6168 // Pass a bad argument. Error is passed through.
6169 result = Dart_New(type, NewString("named"), 1, bad_args);
6170 EXPECT_ERROR(result, "myerror");
6171
6172 // Pass a bad constructor name.
6175 result,
6176 "Dart_New expects argument 'constructor_name' to be of type String.");
6177
6178 // Invoke a missing constructor.
6179 result = Dart_New(type, NewString("missing"), 1, args);
6181 "Dart_New: could not find constructor 'MyClass.missing'.");
6182
6183 // Invoke a constructor which throws an exception.
6184 result = Dart_New(type, NewString("exception"), 1, args);
6185 EXPECT_ERROR(result, "ConstructorDeath");
6186
6187 // Invoke a constructor that is missing in the interface.
6188 result = Dart_New(intf, Dart_Null(), 0, nullptr);
6189 EXPECT_ERROR(result, "Dart_New: could not find constructor 'MyInterface.'.");
6190
6191 // Invoke abstract constructor that is present in the interface.
6192 result = Dart_New(intf, NewString("notfound"), 1, args);
6194 EXPECT_VALID(Dart_ObjectIsType(result, type, &instanceOf));
6195 EXPECT(!instanceOf);
6196}
DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_New(Dart_Handle type, Dart_Handle constructor_name, int number_of_arguments, Dart_Handle *arguments)

◆ TEST_CASE() [154/600]

dart::TEST_CASE ( DartAPI_New_Issue42939  )

Definition at line 6200 of file dart_api_impl_test.cc.

6200 {
6201 const char* kScriptChars =
6202 "class MyClass implements MyExtraHop {\n"
6203 " MyClass() : foo = 7 {}\n"
6204 " MyClass.named(value) : foo = value {}\n"
6205 " MyClass._hidden(value) : foo = -value {}\n"
6206 " MyClass.exception(value) : foo = value {\n"
6207 " throw 'ConstructorDeath';\n"
6208 " }\n"
6209 " factory MyClass.multiply(value) {\n"
6210 " return new MyClass.named(value * 100);\n"
6211 " }\n"
6212 " var foo;\n"
6213 "}\n"
6214 "\n"
6215 "abstract class MyExtraHop implements MyInterface {\n"
6216 " factory MyExtraHop.hop(value) = MyClass.named;\n"
6217 "}\n"
6218 "\n"
6219 "abstract class MyInterface {\n"
6220 " factory MyInterface.named(value) = MyExtraHop.hop;\n"
6221 " factory MyInterface.multiply(value) = MyClass.multiply;\n"
6222 " MyInterface.notfound(value);\n"
6223 "}\n"
6224 "\n";
6225
6226 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
6228 Dart_GetNonNullableType(lib, NewString("MyClass"), 0, nullptr);
6230 Dart_Handle intf =
6231 Dart_GetNonNullableType(lib, NewString("MyInterface"), 0, nullptr);
6232 EXPECT_VALID(intf);
6233
6234 Dart_Handle args[1];
6235 args[0] = Dart_NewInteger(11);
6236
6237 // Invoke two-hop redirecting factory constructor.
6238 bool instanceOf = false;
6239 Dart_Handle result = Dart_New(intf, NewString("named"), 1, args);
6241 if (!Dart_IsError(result)) {
6242 EXPECT_VALID(Dart_ObjectIsType(result, type, &instanceOf));
6243 EXPECT(instanceOf);
6244 int64_t int_value = 0;
6246 EXPECT_VALID(Dart_IntegerToInt64(foo, &int_value));
6247 EXPECT_EQ(11, int_value);
6248 }
6249
6250 // Invoke one-hop redirecting factory constructor.
6251 result = Dart_New(intf, NewString("multiply"), 1, args);
6253 if (!Dart_IsError(result)) {
6254 EXPECT_VALID(Dart_ObjectIsType(result, type, &instanceOf));
6255 EXPECT(instanceOf);
6256 int64_t int_value = 0;
6258 EXPECT_VALID(Dart_IntegerToInt64(foo, &int_value));
6259 EXPECT_EQ(1100, int_value);
6260 }
6261}

◆ TEST_CASE() [155/600]

dart::TEST_CASE ( DartAPI_New_Issue44205  )

Definition at line 6263 of file dart_api_impl_test.cc.

6263 {
6264 const char* kScriptChars =
6265 "class MyIntClass {\n"
6266 " MyIntClass(this.value);\n"
6267 " int value;\n"
6268 "}\n"
6269 "\n"
6270 "class MyClass<T> {\n"
6271 " T value;\n"
6272 " MyClass(this.value);\n"
6273 " factory MyClass.foo(T x) => MyClass<T>(x);\n"
6274 "}\n"
6275 "\n"
6276 "Type getIntType() { return int; }\n"
6277 "\n";
6278
6279 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
6280 EXPECT_VALID(lib);
6281 Dart_Handle int_wrapper_type =
6282 Dart_GetNonNullableType(lib, NewString("MyIntClass"), 0, nullptr);
6283 EXPECT_VALID(int_wrapper_type);
6284
6285 Dart_Handle args[1];
6286 args[0] = Dart_EmptyString();
6287
6288 Dart_Handle result = Dart_New(int_wrapper_type, Dart_EmptyString(), 1, args);
6289 EXPECT_ERROR(result, "String' is not a subtype of type 'int' of 'value'");
6290
6291 Dart_Handle int_type = Dart_Invoke(lib, NewString("getIntType"), 0, args);
6292 EXPECT_VALID(int_type);
6293 Dart_Handle type_args = Dart_NewList(1);
6294 EXPECT_VALID(type_args);
6295 EXPECT_VALID(Dart_ListSetAt(type_args, 0, int_type));
6296 Dart_Handle my_class_type =
6297 Dart_GetNonNullableType(lib, NewString("MyClass"), 1, &type_args);
6298 EXPECT_VALID(my_class_type);
6299
6300 // Generic generative constructor
6301 args[0] = Dart_EmptyString();
6302 result = Dart_New(my_class_type, Dart_EmptyString(), 1, args);
6303 EXPECT_ERROR(result, "String' is not a subtype of type 'int' of 'value'");
6304
6305 // Generic factory constructor
6306 result = Dart_New(my_class_type, NewString("foo"), 1, args);
6307 EXPECT_ERROR(result, "String' is not a subtype of type 'int' of 'x'");
6308}

◆ TEST_CASE() [156/600]

dart::TEST_CASE ( DartAPI_NewListOf  )

Definition at line 6388 of file dart_api_impl_test.cc.

6388 {
6389 const char* kScriptChars =
6390 "String expectListOfString(List<String> o) => '${o.first}';\n"
6391 "String expectListOfDynamic(List<dynamic> o) => '${o.first}';\n"
6392 "String expectListOfInt(List<int> o) => '${o.first}';\n";
6393 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
6394
6395 const int kNumArgs = 1;
6396 Dart_Handle args[kNumArgs];
6397 const char* str;
6400 if (!Dart_IsError(string_list)) {
6401 args[0] = string_list;
6403 Dart_Invoke(lib, NewString("expectListOfString"), kNumArgs, args);
6407 EXPECT_STREQ("null", str);
6408 } else {
6409 EXPECT_ERROR(string_list,
6410 "Cannot use legacy types with --sound-null-safety enabled. "
6411 "Use Dart_NewListOfType or Dart_NewListOfTypeFilled instead.");
6412 }
6413
6415 EXPECT_VALID(dynamic_list);
6416 args[0] = dynamic_list;
6417 result = Dart_Invoke(lib, NewString("expectListOfDynamic"), kNumArgs, args);
6420 EXPECT_STREQ("null", str);
6421
6423 if (!Dart_IsError(int_list)) {
6424 args[0] = int_list;
6425 result = Dart_Invoke(lib, NewString("expectListOfInt"), kNumArgs, args);
6428 EXPECT_STREQ("null", str);
6429 } else {
6430 EXPECT_ERROR(int_list,
6431 "Cannot use legacy types with --sound-null-safety enabled. "
6432 "Use Dart_NewListOfType or Dart_NewListOfTypeFilled instead.");
6433 }
6434}
@ Dart_CoreType_Int
Definition dart_api.h:2425
@ Dart_CoreType_String
Definition dart_api.h:2426

◆ TEST_CASE() [157/600]

dart::TEST_CASE ( DartAPI_NewListOfType  )

Definition at line 6436 of file dart_api_impl_test.cc.

6436 {
6437 const char* kScriptChars =
6438 "class ZXHandle {}\n"
6439 "class ChannelReadResult {\n"
6440 " final List<ZXHandle?> handles;\n"
6441 " ChannelReadResult(this.handles);\n"
6442 "}\n"
6443 "void expectListOfString(List<String> _) {}\n"
6444 "void expectListOfDynamic(List<dynamic> _) {}\n"
6445 "void expectListOfVoid(List<void> _) {}\n"
6446 "void expectListOfNever(List<Never> _) {}\n";
6447 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
6448
6449 Dart_Handle zxhandle_type =
6450 Dart_GetNullableType(lib, NewString("ZXHandle"), 0, nullptr);
6451 EXPECT_VALID(zxhandle_type);
6452
6453 Dart_Handle zxhandle = Dart_New(zxhandle_type, Dart_Null(), 0, nullptr);
6454 EXPECT_VALID(zxhandle);
6455
6456 Dart_Handle zxhandle_list = Dart_NewListOfType(zxhandle_type, 1);
6457 EXPECT_VALID(zxhandle_list);
6458
6459 EXPECT_VALID(Dart_ListSetAt(zxhandle_list, 0, zxhandle));
6460
6461 Dart_Handle readresult_type =
6462 Dart_GetNonNullableType(lib, NewString("ChannelReadResult"), 0, nullptr);
6463 EXPECT_VALID(zxhandle_type);
6464
6465 const int kNumArgs = 1;
6466 Dart_Handle args[kNumArgs];
6467 args[0] = zxhandle_list;
6468 EXPECT_VALID(Dart_New(readresult_type, Dart_Null(), kNumArgs, args));
6469
6472 "Dart_NewListOfType expects argument 'element_type' to be non-null.");
6475 "Dart_NewListOfType expects argument 'element_type' to be of type Type.");
6476
6477 Dart_Handle dart_core = Dart_LookupLibrary(NewString("dart:core"));
6478 EXPECT_VALID(dart_core);
6479
6480 Dart_Handle string_type =
6481 Dart_GetNonNullableType(dart_core, NewString("String"), 0, nullptr);
6482 EXPECT_VALID(string_type);
6483 Dart_Handle string_list = Dart_NewListOfType(string_type, 0);
6484 EXPECT_VALID(string_list);
6485 args[0] = string_list;
6487 Dart_Invoke(lib, NewString("expectListOfString"), kNumArgs, args));
6488
6489 Dart_Handle dynamic_type = Dart_TypeDynamic();
6490 EXPECT_VALID(dynamic_type);
6491 Dart_Handle dynamic_list = Dart_NewListOfType(dynamic_type, 0);
6492 EXPECT_VALID(dynamic_list);
6493 args[0] = dynamic_list;
6495 Dart_Invoke(lib, NewString("expectListOfDynamic"), kNumArgs, args));
6496
6497 Dart_Handle void_type = Dart_TypeVoid();
6498 EXPECT_VALID(void_type);
6499 Dart_Handle void_list = Dart_NewListOfType(void_type, 0);
6500 EXPECT_VALID(void_list);
6501 args[0] = void_list;
6502 EXPECT_VALID(Dart_Invoke(lib, NewString("expectListOfVoid"), kNumArgs, args));
6503
6504 Dart_Handle never_type = Dart_TypeNever();
6505 EXPECT_VALID(never_type);
6506 Dart_Handle never_list = Dart_NewListOfType(never_type, 0);
6507 EXPECT_VALID(never_list);
6508 args[0] = never_list;
6510 Dart_Invoke(lib, NewString("expectListOfNever"), kNumArgs, args));
6511}
DART_EXPORT Dart_Handle Dart_TypeNever(void)
DART_EXPORT Dart_Handle Dart_TypeVoid(void)
DART_EXPORT Dart_Handle Dart_TypeDynamic(void)
DART_EXPORT Dart_Handle Dart_NewListOfType(Dart_Handle element_type, intptr_t length)

◆ TEST_CASE() [158/600]

dart::TEST_CASE ( DartAPI_NewListOfTypeFilled  )

Definition at line 6513 of file dart_api_impl_test.cc.

6513 {
6514 const char* kScriptChars =
6515 "class ZXHandle {}\n"
6516 "class ChannelReadResult {\n"
6517 " final List<ZXHandle> handles;\n"
6518 " ChannelReadResult(this.handles);\n"
6519 "}\n";
6520 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
6521
6522 Dart_Handle zxhandle_type =
6523 Dart_GetNonNullableType(lib, NewString("ZXHandle"), 0, nullptr);
6524 EXPECT_VALID(zxhandle_type);
6525
6526 Dart_Handle nullable_zxhandle_type =
6527 Dart_GetNullableType(lib, NewString("ZXHandle"), 0, nullptr);
6528 EXPECT_VALID(nullable_zxhandle_type);
6529
6530 Dart_Handle integer = Dart_NewInteger(42);
6531 EXPECT_VALID(integer);
6532
6533 Dart_Handle zxhandle = Dart_New(zxhandle_type, Dart_Null(), 0, nullptr);
6534 EXPECT_VALID(zxhandle);
6535
6536 Dart_Handle zxhandle_list =
6537 Dart_NewListOfTypeFilled(zxhandle_type, zxhandle, 1);
6538 EXPECT_VALID(zxhandle_list);
6539
6540 Dart_Handle result = Dart_ListGetAt(zxhandle_list, 0);
6542
6543 EXPECT(Dart_IdentityEquals(result, zxhandle));
6544
6545 Dart_Handle readresult_type =
6546 Dart_GetNonNullableType(lib, NewString("ChannelReadResult"), 0, nullptr);
6547 EXPECT_VALID(zxhandle_type);
6548
6549 const int kNumArgs = 1;
6550 Dart_Handle args[kNumArgs];
6551 args[0] = zxhandle_list;
6552 EXPECT_VALID(Dart_New(readresult_type, Dart_Null(), kNumArgs, args));
6553
6555 "Dart_NewListOfTypeFilled expects argument 'element_type' to be "
6556 "non-null.");
6558 "Dart_NewListOfTypeFilled expects argument 'element_type' to be "
6559 "of type Type.");
6561 Dart_NewListOfTypeFilled(zxhandle_type, Dart_Null(), 1),
6562 "Dart_NewListOfTypeFilled expects argument 'fill_object' to be non-null"
6563 " for a non-nullable 'element_type'");
6565 Dart_NewListOfTypeFilled(zxhandle_type, integer, 1),
6566 "Dart_NewListOfTypeFilled expects argument 'fill_object' to have the same"
6567 " type as 'element_type'.");
6568
6570 Dart_NewListOfTypeFilled(nullable_zxhandle_type, Dart_Null(), 1));
6571
6572 // Null is always valid as the fill argument if we're creating an empty list.
6573 EXPECT_VALID(Dart_NewListOfTypeFilled(zxhandle_type, Dart_Null(), 0));
6574
6575 // Test creation of a non nullable list of strings.
6576 Dart_Handle corelib = Dart_LookupLibrary(NewString("dart:core"));
6577 EXPECT_VALID(corelib);
6578 Dart_Handle string_type =
6579 Dart_GetNonNullableType(corelib, NewString("String"), 0, nullptr);
6581}
DART_EXPORT Dart_Handle Dart_NewListOfTypeFilled(Dart_Handle element_type, Dart_Handle fill_object, intptr_t length)

◆ TEST_CASE() [159/600]

dart::TEST_CASE ( DartAPI_NewString  )

Definition at line 1616 of file dart_api_impl_test.cc.

1616 {
1617 const char* ascii = "string";
1618 Dart_Handle ascii_str = NewString(ascii);
1619 EXPECT_VALID(ascii_str);
1620 EXPECT(Dart_IsString(ascii_str));
1621
1622 const char* null = nullptr;
1623 Dart_Handle null_str = NewString(null);
1624 EXPECT(Dart_IsError(null_str));
1625
1626 uint8_t data[] = {0xE4, 0xBA, 0x8c}; // U+4E8C.
1627 Dart_Handle utf8_str = Dart_NewStringFromUTF8(data, ARRAY_SIZE(data));
1628 EXPECT_VALID(utf8_str);
1629 EXPECT(Dart_IsString(utf8_str));
1630
1631 uint8_t invalid[] = {0xE4, 0xBA}; // underflow.
1632 Dart_Handle invalid_str =
1634 EXPECT(Dart_IsError(invalid_str));
1635}
static bool invalid(const SkISize &size)

◆ TEST_CASE() [160/600]

dart::TEST_CASE ( DartAPI_NewString_Null  )

Definition at line 8884 of file dart_api_impl_test.cc.

8885 {
8886 return nullptr;
8887 }
8888 const char* function_name = obj.ToCString();
8889 const char* kNativeFoo1 = "StaticNativeFoo1";
8890 const char* kNativeFoo2 = "StaticNativeFoo2";
8891 const char* kNativeFoo3 = "StaticNativeFoo3";
8892 const char* kNativeFoo4 = "StaticNativeFoo4";
8893 if (strncmp(function_name, kNativeFoo1, strlen(kNativeFoo1)) == 0) {
8894 return &StaticNativeFoo1;
8895 } else if (strncmp(function_name, kNativeFoo2, strlen(kNativeFoo2)) == 0) {
8896 return &StaticNativeFoo2;
8897 } else if (strncmp(function_name, kNativeFoo3, strlen(kNativeFoo3)) == 0) {
8898 return &StaticNativeFoo3;
8899 } else if (strncmp(function_name, kNativeFoo4, strlen(kNativeFoo4)) == 0) {
8900 return &StaticNativeFoo4;
8901 } else {
8902 UNREACHABLE();
8903 return nullptr;
8904 }
8905}
static void StaticNativeFoo4(Dart_NativeArguments args)
static void StaticNativeFoo2(Dart_NativeArguments args)

◆ TEST_CASE() [161/600]

dart::TEST_CASE ( DartAPI_NewUnmodifiableExternalTypedDataWithFinalizer  )

Definition at line 2805 of file dart_api_impl_test.cc.

2805 {
2806 const char* kScriptChars = R"(
2807class Expect {
2808 static equals(a, b) {
2809 if (a != b) {
2810 throw 'not equal. expected: $a, got: $b';
2811 }
2812 }
2813 static throws(block) {
2814 bool threw = false;
2815 try { block(); } catch (e) { threw = true; }
2816 if (!threw) throw 'did not throw';
2817 }
2818}
2819testList(data) {
2820 for (var i = 0; i < data.length; i++) {
2821 Expect.equals(i, data[i]);
2822 Expect.throws(() => data[i] = 0);
2823 }
2824}
2825testBytes(data) {
2826 for (var i = 0; i < data.length; i++) {
2827 Expect.equals(i, data.getUint8(i));
2828 Expect.throws(() => data.setUint8(i, 0));
2829 }
2830})";
2831 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
2832
2833 {
2834 uint8_t data[] = {0, 1, 2, 3};
2836 Dart_TypedData_kUint8, &data[0], ARRAY_SIZE(data), nullptr, 0, nullptr);
2837 EXPECT_VALID(typed_data);
2838 EXPECT_EQ(Dart_TypedData_kUint8, Dart_GetTypeOfTypedData(typed_data));
2839 Dart_Handle args[1];
2840 args[0] = typed_data;
2842 Dart_Invoke(lib, NewString("testList"), ARRAY_SIZE(args), args);
2844 }
2845
2846 {
2847 int8_t data[] = {0, 1, 2, 3};
2849 Dart_TypedData_kInt8, &data[0], ARRAY_SIZE(data), nullptr, 0, nullptr);
2850 EXPECT_VALID(typed_data);
2851 EXPECT_EQ(Dart_TypedData_kInt8, Dart_GetTypeOfTypedData(typed_data));
2852 Dart_Handle args[1];
2853 args[0] = typed_data;
2855 Dart_Invoke(lib, NewString("testList"), ARRAY_SIZE(args), args);
2857 }
2858
2859 {
2860 uint16_t data[] = {0, 1, 2, 3};
2862 Dart_TypedData_kUint16, &data[0], ARRAY_SIZE(data), nullptr, 0,
2863 nullptr);
2864 EXPECT_VALID(typed_data);
2865 EXPECT_EQ(Dart_TypedData_kUint16, Dart_GetTypeOfTypedData(typed_data));
2866 Dart_Handle args[1];
2867 args[0] = typed_data;
2869 Dart_Invoke(lib, NewString("testList"), ARRAY_SIZE(args), args);
2871 }
2872
2873 {
2874 int16_t data[] = {0, 1, 2, 3};
2876 Dart_TypedData_kInt16, &data[0], ARRAY_SIZE(data), nullptr, 0, nullptr);
2877 EXPECT_VALID(typed_data);
2878 EXPECT_EQ(Dart_TypedData_kInt16, Dart_GetTypeOfTypedData(typed_data));
2879 Dart_Handle args[1];
2880 args[0] = typed_data;
2882 Dart_Invoke(lib, NewString("testList"), ARRAY_SIZE(args), args);
2884 }
2885
2886 {
2887 uint32_t data[] = {0, 1, 2, 3};
2889 Dart_TypedData_kUint32, &data[0], ARRAY_SIZE(data), nullptr, 0,
2890 nullptr);
2891 EXPECT_VALID(typed_data);
2892 EXPECT_EQ(Dart_TypedData_kUint32, Dart_GetTypeOfTypedData(typed_data));
2893 Dart_Handle args[1];
2894 args[0] = typed_data;
2896 Dart_Invoke(lib, NewString("testList"), ARRAY_SIZE(args), args);
2898 }
2899
2900 {
2901 int32_t data[] = {0, 1, 2, 3};
2903 Dart_TypedData_kInt32, &data[0], ARRAY_SIZE(data), nullptr, 0, nullptr);
2904 EXPECT_VALID(typed_data);
2905 EXPECT_EQ(Dart_TypedData_kInt32, Dart_GetTypeOfTypedData(typed_data));
2906 Dart_Handle args[1];
2907 args[0] = typed_data;
2909 Dart_Invoke(lib, NewString("testList"), ARRAY_SIZE(args), args);
2911 }
2912
2913 {
2914 uint64_t data[] = {0, 1, 2, 3};
2916 Dart_TypedData_kUint64, &data[0], ARRAY_SIZE(data), nullptr, 0,
2917 nullptr);
2918 EXPECT_VALID(typed_data);
2919 EXPECT_EQ(Dart_TypedData_kUint64, Dart_GetTypeOfTypedData(typed_data));
2920 Dart_Handle args[1];
2921 args[0] = typed_data;
2923 Dart_Invoke(lib, NewString("testList"), ARRAY_SIZE(args), args);
2925 }
2926
2927 {
2928 int64_t data[] = {0, 1, 2, 3};
2930 Dart_TypedData_kInt64, &data[0], ARRAY_SIZE(data), nullptr, 0, nullptr);
2931 EXPECT_VALID(typed_data);
2932 EXPECT_EQ(Dart_TypedData_kInt64, Dart_GetTypeOfTypedData(typed_data));
2933 Dart_Handle args[1];
2934 args[0] = typed_data;
2936 Dart_Invoke(lib, NewString("testList"), ARRAY_SIZE(args), args);
2938 }
2939
2940 {
2941 float data[] = {0.0f, 1.0f, 2.0f, 3.0f};
2943 Dart_TypedData_kFloat32, &data[0], ARRAY_SIZE(data), nullptr, 0,
2944 nullptr);
2945 EXPECT_VALID(typed_data);
2946 EXPECT_EQ(Dart_TypedData_kFloat32, Dart_GetTypeOfTypedData(typed_data));
2948 Dart_Invoke(lib, NewString("testList"), 1, &typed_data);
2951 }
2952
2953 {
2954 double data[] = {0.0, 1.0, 2.0, 3.0};
2956 Dart_TypedData_kFloat64, &data[0], ARRAY_SIZE(data), nullptr, 0,
2957 nullptr);
2958 EXPECT_VALID(typed_data);
2959 EXPECT_EQ(Dart_TypedData_kFloat64, Dart_GetTypeOfTypedData(typed_data));
2960 Dart_Handle args[1];
2961 args[0] = typed_data;
2963 Dart_Invoke(lib, NewString("testList"), ARRAY_SIZE(args), args);
2965 }
2966
2967 {
2968 uint8_t data[] = {0, 1, 2, 3};
2970 Dart_TypedData_kByteData, &data[0], ARRAY_SIZE(data), nullptr, 0,
2971 nullptr);
2972 EXPECT_VALID(typed_data);
2973 EXPECT_EQ(Dart_TypedData_kByteData, Dart_GetTypeOfTypedData(typed_data));
2974 Dart_Handle args[1];
2975 args[0] = typed_data;
2977 Dart_Invoke(lib, NewString("testBytes"), ARRAY_SIZE(args), args);
2979 }
2980}
DART_EXPORT Dart_Handle Dart_NewUnmodifiableExternalTypedDataWithFinalizer(Dart_TypedData_Type type, const void *data, intptr_t length, void *peer, intptr_t external_allocation_size, Dart_HandleFinalizer callback)

◆ TEST_CASE() [162/600]

dart::TEST_CASE ( DartAPI_NotifyDestroyed  )

Definition at line 9742 of file dart_api_impl_test.cc.

9757 {
9759 EXPECT_EQ(true, result);
9760 JSONStream js;
9761 JSONObject obj(&js);
9762 JSONArray jstream(&obj, "available");

◆ TEST_CASE() [163/600]

dart::TEST_CASE ( DartAPI_NotifyIdleLong  )

Definition at line 9709 of file dart_api_impl_test.cc.

9717 {
9718 bool result;
9719 {
9721 EXPECT_EQ(true, result);
9722 JSONStream js;
9723 JSONObject obj(&js);
9724 JSONArray jstream(&obj, "available");
9725 Timeline::PrintFlagsToJSONArray(&jstream);
9726 const char* js_str = js.ToCString();
9727#define TIMELINE_STREAM_CHECK(name, ...) EXPECT_SUBSTRING(#name, js_str);
9728 TIMELINE_STREAM_LIST(TIMELINE_STREAM_CHECK)
9729#undef TIMELINE_STREAM_CHECK
#define TIMELINE_STREAM_CHECK(name,...)

◆ TEST_CASE() [164/600]

dart::TEST_CASE ( DartAPI_NotifyIdleShort  )

Definition at line 9677 of file dart_api_impl_test.cc.

9678 {
9679 ReportAsyncEventArguments& arguments =
9680 *reinterpret_cast<ReportAsyncEventArguments*>(arguments_ptr);
9681 Dart_RecordTimelineEvent("async2", /*timestamp0=*/0, /*async_id=*/2, 0,
9683 /*argument_count=*/0, nullptr, nullptr);
9684 MonitorLocker ml(&arguments.synchronization_monitor);
9685 arguments.join_id =
9686 OSThread::GetCurrentThreadJoinId(OSThread::Current());
9687 ml.Notify();
9688 },
9689 reinterpret_cast<uword>(&report_async_event_2_arguments));
9690 recorder.PrintPerfettoTimeline(&js, filter);
9691
9692 MonitorLocker ml(&synchronization_monitor);
9693 while (report_async_event_1_arguments.join_id ==
9694 OSThread::kInvalidThreadJoinId ||
9695 report_async_event_2_arguments.join_id ==
9696 OSThread::kInvalidThreadJoinId) {

◆ TEST_CASE() [165/600]

dart::TEST_CASE ( DartAPI_NotifyLowMemory  )

Definition at line 9819 of file dart_api_impl_test.cc.

9826 {
9828}
9829
9830static Dart_NativeFunction NotifyIdleLong_native_lookup(
9832 int argument_count,
9833 bool* auto_setup_scope) {
9834 return NotifyIdleLongNative;
9835}
9836
9837TEST_CASE(DartAPI_NotifyIdleLong) {
9838 const char* kScriptChars = R"(
9839@pragma("vm:external-name", "Test_nativeFunc")
DART_EXPORT void Dart_NotifyIdle(int64_t deadline)

◆ TEST_CASE() [166/600]

dart::TEST_CASE ( DartAPI_Null  )

Definition at line 916 of file dart_api_impl_test.cc.

916 {
917 Dart_Handle null = Dart_Null();
918 EXPECT_VALID(null);
919 EXPECT(Dart_IsNull(null));
920
921 Dart_Handle str = NewString("test");
922 EXPECT_VALID(str);
923 EXPECT(!Dart_IsNull(str));
924}

◆ TEST_CASE() [167/600]

dart::TEST_CASE ( DartAPI_NumberValues  )

Definition at line 1375 of file dart_api_impl_test.cc.

1375 {
1376 // TODO(antonm): add various kinds of ints (smi, mint, bigint).
1377 const char* kScriptChars =
1378 "int getInt() { return 1; }\n"
1379 "double getDouble() { return 1.0; }\n"
1380 "bool getBool() { return false; }\n"
1381 "getNull() { return null; }\n";
1383 // Create a test library and Load up a test script in it.
1384 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
1385
1386 // Check int case.
1387 result = Dart_Invoke(lib, NewString("getInt"), 0, nullptr);
1390
1391 // Check double case.
1392 result = Dart_Invoke(lib, NewString("getDouble"), 0, nullptr);
1395
1396 // Check bool case.
1397 result = Dart_Invoke(lib, NewString("getBool"), 0, nullptr);
1400
1401 // Check null case.
1402 result = Dart_Invoke(lib, NewString("getNull"), 0, nullptr);
1405}
DART_EXPORT bool Dart_IsNumber(Dart_Handle object)

◆ TEST_CASE() [168/600]

dart::TEST_CASE ( DartAPI_ObjectEquals  )

Definition at line 1021 of file dart_api_impl_test.cc.

1021 {
1022 bool equal = false;
1023 Dart_Handle five = NewString("5");
1024 Dart_Handle five_again = NewString("5");
1025 Dart_Handle seven = NewString("7");
1026
1027 // Same objects.
1028 EXPECT_VALID(Dart_ObjectEquals(five, five, &equal));
1029 EXPECT(equal);
1030
1031 // Equal objects.
1032 EXPECT_VALID(Dart_ObjectEquals(five, five_again, &equal));
1033 EXPECT(equal);
1034
1035 // Different objects.
1036 EXPECT_VALID(Dart_ObjectEquals(five, seven, &equal));
1037 EXPECT(!equal);
1038
1039 // Case where identity is not equality.
1040 Dart_Handle nan = Dart_NewDouble(NAN);
1042 EXPECT(!equal);
1043}
static bool equal(const SkBitmap &a, const SkBitmap &b)

◆ TEST_CASE() [169/600]

dart::TEST_CASE ( DartAPI_OneNewSpacePeer  )

Definition at line 8940 of file dart_api_impl_test.cc.

8942 {
8943 Test obj = new Test();
8944 Expect.equals(0, Test.foo1());
8945 Expect.equals(0, obj.bar1());
8946
8947 Expect.equals(10, Test.foo2(10));
8948 Expect.equals(10, obj.bar2(10));
8949
8950 Expect.equals(10001, Test.foo3());
8951 Expect.equals(10001, obj.bar30());
8952 Expect.equals(2, Test.foo3(1));
8953 Expect.equals(2, obj.bar31(1));
8954 Expect.equals(4, Test.foo3(2, 2));
8955 Expect.equals(4, obj.bar32(2, 2));
8956
8957 Expect.equals(12, Test.foo4(1));
8958 Expect.equals(12, obj.bar41(1));
8959 Expect.equals(3, Test.foo4(1, 1));
8960 Expect.equals(3, obj.bar42(1, 1));

◆ TEST_CASE() [170/600]

dart::TEST_CASE ( DartAPI_OneOldSpacePeer  )

Definition at line 9157 of file dart_api_impl_test.cc.

9170 {
9171 Heap* heap = IsolateGroup::Current()->heap();
9173 {
9174 CHECK_API_SCOPE(thread);
9175 Dart_Handle s1 = NewString("s1");
9176 EXPECT_VALID(s1);
9177 EXPECT(Dart_IsString(s1));
9178 EXPECT_EQ(0, heap->PeerCount());
9179 void* o1 = &o1;
9180 EXPECT(Dart_GetPeer(s1, &o1));
9181 EXPECT(o1 == nullptr);
9182 int p1 = 1234;
9183 EXPECT_VALID(Dart_SetPeer(s1, &p1));
9184 EXPECT_EQ(1, heap->PeerCount());

◆ TEST_CASE() [171/600]

dart::TEST_CASE ( DartAPI_OnePromotedPeer  )

Definition at line 9116 of file dart_api_impl_test.cc.

9121 {
9122 TransitionNativeToVM transition(thread);
9123 GCTestHelper::CollectNewSpace();
9124 EXPECT_EQ(0, heap->PeerCount());
9125 }
9126}
9127
9128// Allocates two objects in new space and assigns them peers. Removes
9129// the peers and checks that the count of peer objects is decremented
9130// by two.
9131TEST_CASE(DartAPI_TwoNewSpacePeers) {
9132 Heap* heap = IsolateGroup::Current()->heap();
9133 Dart_Handle s1 = NewString("s1");
9134 EXPECT_VALID(s1);
9135 EXPECT(Dart_IsString(s1));
9136 void* o1 = &o1;
9137 EXPECT_VALID(Dart_GetPeer(s1, &o1));
9138 EXPECT(o1 == nullptr);
9139 EXPECT_EQ(0, heap->PeerCount());
9140 int p1 = 1234;
9141 EXPECT_VALID(Dart_SetPeer(s1, &p1));
9142 EXPECT_EQ(1, heap->PeerCount());
9143 EXPECT_VALID(Dart_GetPeer(s1, &o1));
9144 EXPECT(o1 == reinterpret_cast<void*>(&p1));
9145 Dart_Handle s2 = NewString("a string");
9146 EXPECT_VALID(s2);
9147 EXPECT(Dart_IsString(s2));
9148 EXPECT_EQ(1, heap->PeerCount());
9149 void* o2 = &o2;
9150 EXPECT(Dart_GetPeer(s2, &o2));
9151 EXPECT(o2 == nullptr);
9152 int p2 = 5678;

◆ TEST_CASE() [172/600]

dart::TEST_CASE ( DartAPI_OptimizedExternalByteDataAccess  )

Definition at line 2420 of file dart_api_impl_test.cc.

2420 {
2421 const char* kScriptChars = R"(
2422import 'dart:typed_data';
2423class Expect {
2424 static equals(a, b) {
2425 if (a != b) {
2426 throw 'not equal. expected: $a, got: $b';
2427 }
2428 }
2429}
2430@pragma("vm:external-name", "CreateExternalByteData")
2431external ByteData createExternalByteData();
2432access(ByteData a) {
2433 Expect.equals(0x04030201, a.getUint32(0, Endian.little));
2434 Expect.equals(0x08070605, a.getUint32(4, Endian.little));
2435 Expect.equals(0x0c0b0a09, a.getUint32(8, Endian.little));
2436 Expect.equals(0x100f0e0d, a.getUint32(12, Endian.little));
2437}
2438ByteData main() {
2439 var length = 16;
2440 var a = createExternalByteData();
2441 Expect.equals(length, a.lengthInBytes);
2442 for (int i = 0; i < 20; i++) {
2443 access(a);
2444 }
2445 return a;
2446}
2447)";
2448 // Create a test library and Load up a test script in it.
2449 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
2450
2452 Dart_SetNativeResolver(lib, &OptExternalByteDataNativeResolver, nullptr);
2454
2455 // Invoke 'main' function.
2456 int old_oct = FLAG_optimization_counter_threshold;
2457 FLAG_optimization_counter_threshold = 5;
2458 result = Dart_Invoke(lib, NewString("main"), 0, nullptr);
2460 FLAG_optimization_counter_threshold = old_oct;
2461}

◆ TEST_CASE() [173/600]

dart::TEST_CASE ( DartAPI_OutOfMemoryStackTraceInfo  )

Definition at line 477 of file dart_api_impl_test.cc.

477 {
478 const char* kScriptChars =
479 "var number_of_ints = 134000000;\n"
480 "testMain() {\n"
481 " new List<int>(number_of_ints)\n"
482 "}\n";
483
484 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
485 Dart_Handle error = Dart_Invoke(lib, NewString("testMain"), 0, nullptr);
486
488
489 Dart_StackTrace stacktrace;
491 EXPECT(Dart_IsError(result)); // No StackTrace for OutOfMemory.
492}

◆ TEST_CASE() [174/600]

dart::TEST_CASE ( DartAPI_PostCObject_DoesNotRunFinalizerOnFailure  )

Definition at line 8006 of file dart_api_impl_test.cc.

8010 {
8012 bool success = Dart_Post(ILLEGAL_PORT, message);
8013 EXPECT(!success);
8014}
8015
8016static void UnreachableFinalizer(void* isolate_callback_data, void* peer) {
8017 UNREACHABLE();
8018}
8019
8020TEST_CASE(DartAPI_PostCObject_DoesNotRunFinalizerOnFailure) {
8021 char* my_str =
8022 Utils::StrDup("Ownership of this memory remains with the caller");
8023
DART_EXPORT bool Dart_Post(Dart_Port port_id, Dart_Handle object)

◆ TEST_CASE() [175/600]

dart::TEST_CASE ( DartAPI_PropagateCompileTimeError  )

Definition at line 818 of file dart_api_impl_test.cc.

818 {
819 const char* kScriptChars = R"(
820raiseCompileError() {
821 return missing_semicolon
822}
823
824@pragma("vm:external-name", "Test_nativeFunc")
825external void nativeFunc(closure);
826
827void Func1() {
828 nativeFunc(() => raiseCompileError());
829}
830)";
831 Dart_Handle lib =
832 TestCase::LoadTestScript(kScriptChars, &PropagateError_native_lookup);
834
835 // Use Dart_PropagateError to propagate the error.
836 use_throw_exception = false;
837 use_set_return = false;
838
839 result = Dart_Invoke(lib, NewString("Func1"), 0, nullptr);
841
842 EXPECT_SUBSTRING("Expected ';' after this.", Dart_GetError(result));
843
844 // Use Dart_SetReturnValue to propagate the error.
845 use_throw_exception = false;
846 use_set_return = true;
847
848 result = Dart_Invoke(lib, NewString("Func1"), 0, nullptr);
850 EXPECT_SUBSTRING("Expected ';' after this.", Dart_GetError(result));
851
852 // Use Dart_ThrowException to propagate the error.
853 use_throw_exception = true;
854 use_set_return = false;
855
856 result = Dart_Invoke(lib, NewString("Func1"), 0, nullptr);
858 EXPECT_SUBSTRING("Expected ';' after this.", Dart_GetError(result));
859}
static bool use_set_return
static bool use_throw_exception

◆ TEST_CASE() [176/600]

dart::TEST_CASE ( DartAPI_PropagateError  )

Definition at line 861 of file dart_api_impl_test.cc.

861 {
862 const char* kScriptChars = R"(
863void throwException() {
864 throw new Exception('myException');
865}
866
867@pragma("vm:external-name", "Test_nativeFunc")
868external void nativeFunc(closure);
869
870void Func2() {
871 nativeFunc(() => throwException());
872}
873)";
874 Dart_Handle lib =
875 TestCase::LoadTestScript(kScriptChars, &PropagateError_native_lookup);
877
878 // Use Dart_PropagateError to propagate the error.
879 use_throw_exception = false;
880 use_set_return = false;
881
882 result = Dart_Invoke(lib, NewString("Func2"), 0, nullptr);
885 EXPECT_SUBSTRING("myException", Dart_GetError(result));
886
887 // Use Dart_SetReturnValue to propagate the error.
888 use_throw_exception = false;
889 use_set_return = true;
890
891 result = Dart_Invoke(lib, NewString("Func2"), 0, nullptr);
894 EXPECT_SUBSTRING("myException", Dart_GetError(result));
895
896 // Use Dart_ThrowException to propagate the error.
897 use_throw_exception = true;
898 use_set_return = false;
899
900 result = Dart_Invoke(lib, NewString("Func2"), 0, nullptr);
903 EXPECT_SUBSTRING("myException", Dart_GetError(result));
904}

◆ TEST_CASE() [177/600]

dart::TEST_CASE ( DartAPI_RangeLimits  )

Definition at line 8859 of file dart_api_impl_test.cc.

8865 {
8867 intptr_t i = Dart_GetNativeArgumentCount(args);
8868 EXPECT_EQ(3, i);
8873 args, Dart_NewInteger(GetValue(arg1) + GetValue(arg2) + GetValue(arg3)));
8875}
8876
8877static Dart_NativeFunction MyStaticNativeClosureResolver(
8879 int arg_count,
8880 bool* auto_setup_scope) {
8881 ASSERT(auto_setup_scope != nullptr);
8882 *auto_setup_scope = false;

◆ TEST_CASE() [178/600]

dart::TEST_CASE ( DartAPI_RootLibrary  )

Definition at line 7541 of file dart_api_impl_test.cc.

7544 {
7545 const char* kScriptChars =
7546 "library testlib;"
7547 "main() {"
7548 " return 12345;"
7549 "}";
7550
7551 Dart_Handle root_lib = Dart_RootLibrary();
7552 EXPECT_VALID(root_lib);
7553 EXPECT(Dart_IsNull(root_lib));
7554
7555 // Load a script.
7556 EXPECT_VALID(LoadScript(TestCase::url(), kScriptChars));
7557
7558 root_lib = Dart_RootLibrary();
7559 Dart_Handle lib_uri = Dart_LibraryUrl(root_lib);
7560 EXPECT_VALID(lib_uri);
7561 EXPECT(!Dart_IsNull(lib_uri));
7562 const char* uri_cstr = "";
7563 EXPECT_VALID(Dart_StringToCString(lib_uri, &uri_cstr));
7564 EXPECT_STREQ(TestCase::url(), uri_cstr);
7565
7566 Dart_Handle core_uri = Dart_NewStringFromCString("dart:core");
7567 Dart_Handle core_lib = Dart_LookupLibrary(core_uri);
7568 EXPECT_VALID(core_lib);
7569 EXPECT(Dart_IsLibrary(core_lib));
7570
7571 Dart_Handle result = Dart_SetRootLibrary(core_uri); // Not a library.
7573 root_lib = Dart_RootLibrary();
7574 lib_uri = Dart_LibraryUrl(root_lib);
7575 EXPECT_VALID(Dart_StringToCString(lib_uri, &uri_cstr));
7576 EXPECT_STREQ(TestCase::url(), uri_cstr); // Root library didn't change.
7577
7578 result = Dart_SetRootLibrary(core_lib);
7580 root_lib = Dart_RootLibrary();
7581 lib_uri = Dart_LibraryUrl(root_lib);
7582 EXPECT_VALID(Dart_StringToCString(lib_uri, &uri_cstr));
7583 EXPECT_STREQ("dart:core", uri_cstr); // Root library did change.
7584
DART_EXPORT Dart_Handle Dart_SetRootLibrary(Dart_Handle library)
static Dart_Handle LoadScript(const char *url_str, const char *source)

◆ TEST_CASE() [179/600]

dart::TEST_CASE ( DartAPI_SetField_BadType  )

Definition at line 5429 of file dart_api_impl_test.cc.

5429 {
5430 const char* kScriptChars =
5431 TestCase::IsNNBD() ? "late int foo;\n" : "int foo;\n";
5432 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
5433 Dart_Handle name = NewString("foo");
5436 EXPECT_SUBSTRING("type 'bool' is not a subtype of type 'int' of 'foo'",
5438}

◆ TEST_CASE() [180/600]

dart::TEST_CASE ( DartAPI_SetField_CheckIsolate  )

Definition at line 5950 of file dart_api_impl_test.cc.

5950 {
5951 const char* kScriptChars =
5952 "class TestClass {\n"
5953 " static int fld2 = 11;\n"
5954 " static void testMain() {\n"
5955 " }\n"
5956 "}\n";
5958 int64_t value = 0;
5959
5960 // Create a test library and Load up a test script in it.
5961 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
5963 Dart_GetNonNullableType(lib, NewString("TestClass"), 0, nullptr);
5965
5968
5969 result = Dart_GetField(type, NewString("fld2"));
5972 EXPECT_EQ(13, value);
5973}

◆ TEST_CASE() [181/600]

dart::TEST_CASE ( DartAPI_SetField_FunnyValue  )

Definition at line 5397 of file dart_api_impl_test.cc.

5397 {
5398 const char* kScriptChars = "var top;\n";
5399
5400 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
5401 Dart_Handle name = NewString("top");
5402 bool value;
5403
5404 // Test that you can set the field to a good value.
5410 EXPECT(value);
5411
5412 // Test that you can set the field to null
5414 result = Dart_GetField(lib, name);
5417
5418 // Pass a non-instance handle.
5419 result = Dart_SetField(lib, name, lib);
5421 result, "Dart_SetField expects argument 'value' to be of type Instance.");
5422
5423 // Pass an error handle. The error is contagious.
5424 result = Dart_SetField(lib, name, Api::NewError("myerror"));
5426 EXPECT_STREQ("myerror", Dart_GetError(result));
5427}

◆ TEST_CASE() [182/600]

dart::TEST_CASE ( DartAPI_SetNativeResolver  )

Definition at line 7685 of file dart_api_impl_test.cc.

7688 {
7689 const char* kScriptChars =
7690 R"(
7691 class Test {
7692 @pragma('vm:external-name', 'SomeNativeFunction')
7693 external static foo();
7694
7695 @pragma('vm:external-name', 'SomeNativeFunction2')
7696 external static bar();
7697
7698 @pragma('vm:external-name', 'SomeNativeFunction3')
7699 external static baz();
7700 }
7701 )";
7702 Dart_Handle error = Dart_NewApiError("incoming error");
7704
7705 // Load a test script.
7706 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
7707 EXPECT_VALID(lib);
7710 EXPECT(Dart_IsLibrary(lib));
7712 Dart_GetNonNullableType(lib, NewString("Test"), 0, nullptr);
7714
7715 result = Dart_SetNativeResolver(Dart_Null(), &MyNativeResolver1, nullptr);
7717 result,
7718 "Dart_SetNativeResolver expects argument 'library' to be non-null.");
7719
7720 result = Dart_SetNativeResolver(Dart_True(), &MyNativeResolver1, nullptr);
7722 "Dart_SetNativeResolver expects argument 'library' to be of "
7723 "type Library.");
7724
7725 result = Dart_SetNativeResolver(error, &MyNativeResolver1, nullptr);
7727 EXPECT_STREQ("incoming error", Dart_GetError(result));
7728
7729 result = Dart_SetNativeResolver(lib, &MyNativeResolver1, nullptr);
7731
7732 // Call a function and make sure native resolution works.
7733 result = Dart_Invoke(type, NewString("foo"), 0, nullptr);
7736 int64_t value = 0;
7738 EXPECT_EQ(654321, value);
7739
7740 // A second call succeeds.
7741 result = Dart_SetNativeResolver(lib, &MyNativeResolver2, nullptr);
7743
7744 // 'foo' has already been resolved so gets the old value.
7745 result = Dart_Invoke(type, NewString("foo"), 0, nullptr);
7748 value = 0;
7750 EXPECT_EQ(654321, value);
7751
7752 // 'bar' has not yet been resolved so gets the new value.
7753 result = Dart_Invoke(type, NewString("bar"), 0, nullptr);

◆ TEST_CASE() [183/600]

dart::TEST_CASE ( DartAPI_SetPerformanceMode  )

Definition at line 9784 of file dart_api_impl_test.cc.

9794 {
9796}
9797
9798static Dart_NativeFunction NotifyIdleShort_native_lookup(
9800 int argument_count,
9801 bool* auto_setup_scope) {
9802 return NotifyIdleShortNative;
9803}
9804
9805TEST_CASE(DartAPI_NotifyIdleShort) {
9806 const char* kScriptChars = R"(

◆ TEST_CASE() [184/600]

dart::TEST_CASE ( DartAPI_SetStickyError  )

Definition at line 4865 of file dart_api_impl_test.cc.

4865 {
4866 const char* kScriptChars = "main() => throw 'HI';";
4867 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
4868 Dart_Handle retobj = Dart_Invoke(lib, NewString("main"), 0, nullptr);
4869 EXPECT(Dart_IsError(retobj));
4873 Dart_SetStickyError(retobj);
4879}
DART_EXPORT Dart_Handle Dart_GetStickyError(void)

◆ TEST_CASE() [185/600]

dart::TEST_CASE ( DartAPI_SlowFinalizer  )

Definition at line 3180 of file dart_api_impl_test.cc.

3180 {
3181 intptr_t count = 0;
3182 for (intptr_t i = 0; i < 10; i++) {
3184 Dart_Handle str1 = Dart_NewStringFromCString("Live fast");
3185 Dart_NewFinalizableHandle(str1, &count, 0, SlowFinalizer);
3186 Dart_Handle str2 = Dart_NewStringFromCString("Die young");
3187 Dart_NewFinalizableHandle(str2, &count, 0, SlowFinalizer);
3189
3190 {
3191 TransitionNativeToVM transition(thread);
3192 GCTestHelper::CollectAllGarbage();
3193 }
3194 }
3195
3196 EXPECT_EQ(20, count);
3197}

◆ TEST_CASE() [186/600]

dart::TEST_CASE ( DartAPI_SlowWeakPersistentHandle  )

Definition at line 3205 of file dart_api_impl_test.cc.

3205 {
3206 Dart_WeakPersistentHandle handles[20];
3207 intptr_t count = 0;
3208
3209 for (intptr_t i = 0; i < 10; i++) {
3211 Dart_Handle str1 = Dart_NewStringFromCString("Live fast");
3212 handles[i] =
3213 Dart_NewWeakPersistentHandle(str1, &count, 0, SlowWeakPersistentHandle);
3214 Dart_Handle str2 = Dart_NewStringFromCString("Die young");
3215 handles[i + 10] =
3216 Dart_NewWeakPersistentHandle(str2, &count, 0, SlowWeakPersistentHandle);
3218
3219 {
3220 TransitionNativeToVM transition(thread);
3221 GCTestHelper::CollectAllGarbage();
3222 }
3223 }
3224
3225 EXPECT_EQ(20, count);
3226
3227 for (intptr_t i = 0; i < 20; i++) {
3229 }
3230}

◆ TEST_CASE() [187/600]

dart::TEST_CASE ( DartAPI_StackOverflowStackTraceInfoArrowFunction  )

Definition at line 466 of file dart_api_impl_test.cc.

466 {
467 int line = 2;
468 int col = 3;
470 "class C {\n"
471 " static foo(int i) => foo(i);\n"
472 "}\n"
473 "testMain() => C.foo(10);\n",
474 "C.foo", "testMain", line, col);
475}
void VerifyStackOverflowStackTraceInfo(const char *script, const char *top_frame_func_name, const char *entry_func_name, int expected_line_number, int expected_column_number)

◆ TEST_CASE() [188/600]

dart::TEST_CASE ( DartAPI_StackOverflowStackTraceInfoBraceFunction1  )

Definition at line 442 of file dart_api_impl_test.cc.

442 {
443 int line = 2;
444 int col = 3;
446 "class C {\n"
447 " static foo(int i) { foo(i); }\n"
448 "}\n"
449 "testMain() => C.foo(10);\n",
450 "C.foo", "testMain", line, col);
451}

◆ TEST_CASE() [189/600]

dart::TEST_CASE ( DartAPI_StackOverflowStackTraceInfoBraceFunction2  )

Definition at line 453 of file dart_api_impl_test.cc.

453 {
454 int line = 2;
455 int col = 3;
457 "class C {\n"
458 " static foo(int i, int j) {\n"
459 " foo(i, j);\n"
460 " }\n"
461 "}\n"
462 "testMain() => C.foo(10, 11);\n",
463 "C.foo", "testMain", line, col);
464}

◆ TEST_CASE() [190/600]

dart::TEST_CASE ( DartAPI_StackTraceInfo  )

Definition at line 248 of file dart_api_impl_test.cc.

248 {
249 const char* kScriptChars =
250 "bar() => throw new Error();\n"
251 "foo() => bar();\n"
252 "testMain() => foo();\n";
253
254 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
255 Dart_Handle error = Dart_Invoke(lib, NewString("testMain"), 0, nullptr);
256
258
259 Dart_StackTrace stacktrace;
262
263 intptr_t frame_count = 0;
264 result = Dart_StackTraceLength(stacktrace, &frame_count);
266 EXPECT_EQ(3, frame_count);
267
269 Dart_Handle script_url;
270 intptr_t line_number = 0;
271 intptr_t column_number = 0;
272 const char* cstr = "";
273
275 result = Dart_GetActivationFrame(stacktrace, 0, &frame);
277 result = Dart_ActivationFrameInfo(frame, &function_name, &script_url,
278 &line_number, &column_number);
280 Dart_StringToCString(function_name, &cstr);
281 EXPECT_STREQ("bar", cstr);
282 Dart_StringToCString(script_url, &cstr);
283 EXPECT_SUBSTRING("test-lib", cstr);
284 EXPECT_EQ(1, line_number);
285 EXPECT_EQ(10, column_number);
286
287 result = Dart_GetActivationFrame(stacktrace, 1, &frame);
289 result = Dart_ActivationFrameInfo(frame, &function_name, &script_url,
290 &line_number, &column_number);
292 Dart_StringToCString(function_name, &cstr);
293 EXPECT_STREQ("foo", cstr);
294 Dart_StringToCString(script_url, &cstr);
295 EXPECT_SUBSTRING("test-lib", cstr);
296 EXPECT_EQ(2, line_number);
297 EXPECT_EQ(10, column_number);
298
299 result = Dart_GetActivationFrame(stacktrace, 2, &frame);
301 result = Dart_ActivationFrameInfo(frame, &function_name, &script_url,
302 &line_number, &column_number);
304 Dart_StringToCString(function_name, &cstr);
305 EXPECT_STREQ("testMain", cstr);
306 Dart_StringToCString(script_url, &cstr);
307 EXPECT_SUBSTRING("test-lib", cstr);
308 EXPECT_EQ(3, line_number);
309 EXPECT_EQ(15, column_number);
310
311 // Out-of-bounds frames.
312 result = Dart_GetActivationFrame(stacktrace, frame_count, &frame);
314 result = Dart_GetActivationFrame(stacktrace, -1, &frame);
316}

◆ TEST_CASE() [191/600]

dart::TEST_CASE ( DartAPI_StringFromExternalTypedData  )

Definition at line 9311 of file dart_api_impl_test.cc.

9317 {
9318 Heap* heap = IsolateGroup::Current()->heap();
9320 {
9321 Thread* T = Thread::Current();
9323 Dart_Handle str = AllocateOldString("str");
9324 EXPECT_VALID(str);
9325 EXPECT(Dart_IsString(str));
9326 EXPECT_EQ(0, heap->PeerCount());
9327 void* out = &out;
9328 EXPECT(Dart_GetPeer(str, &out));
9329 EXPECT(out == nullptr);
9330 int peer = 1234;
9331 EXPECT_VALID(Dart_SetPeer(str, &peer));
9332 EXPECT_EQ(1, heap->PeerCount());
9333 out = &out;
9334 EXPECT_VALID(Dart_GetPeer(str, &out));
9335 EXPECT(out == reinterpret_cast<void*>(&peer));
9336 {
9337 TransitionNativeToVM transition(thread);
9338 GCTestHelper::CollectOldSpace();
9339 EXPECT_EQ(1, heap->PeerCount());
9340 }
9341 EXPECT_VALID(Dart_GetPeer(str, &out));
9342 EXPECT(out == reinterpret_cast<void*>(&peer));
9343 }
9345 {
9346 TransitionNativeToVM transition(thread);
9347 GCTestHelper::CollectOldSpace();
9348 EXPECT_EQ(0, heap->PeerCount());
9349 }
9350}
9351
9352// Allocates two objects in old space and assigns them peers. Removes
9353// the peers and checks that the count of peer objects is decremented
9354// by two.
9355TEST_CASE(DartAPI_TwoOldSpacePeers) {
9356 Heap* heap = IsolateGroup::Current()->heap();
9357 Dart_Handle s1 = AllocateOldString("s1");
9358 EXPECT_VALID(s1);
9359 EXPECT(Dart_IsString(s1));
9360 EXPECT_EQ(0, heap->PeerCount());
9361 void* o1 = &o1;
9362 EXPECT(Dart_GetPeer(s1, &o1));
9363 EXPECT(o1 == nullptr);
9364 int p1 = 1234;
9365 EXPECT_VALID(Dart_SetPeer(s1, &p1));
9366 EXPECT_EQ(1, heap->PeerCount());
9367 o1 = &o1;
9368 EXPECT_VALID(Dart_GetPeer(s1, &o1));
9369 EXPECT(o1 == reinterpret_cast<void*>(&p1));
9370 Dart_Handle s2 = AllocateOldString("s2");
9371 EXPECT_VALID(s2);
9372 EXPECT(Dart_IsString(s2));
9373 EXPECT_EQ(1, heap->PeerCount());
9374 void* o2 = &o2;
9375 EXPECT(Dart_GetPeer(s2, &o2));
9376 EXPECT(o2 == nullptr);
9377 int p2 = 5678;
9378 EXPECT_VALID(Dart_SetPeer(s2, &p2));
9379 EXPECT_EQ(2, heap->PeerCount());
9380 o2 = &o2;
9381 EXPECT_VALID(Dart_GetPeer(s2, &o2));
9382 EXPECT(o2 == reinterpret_cast<void*>(&p2));
9383 EXPECT_VALID(Dart_SetPeer(s1, nullptr));
9384 EXPECT_EQ(1, heap->PeerCount());
9385 o1 = &o1;
9386 EXPECT(Dart_GetPeer(s1, &o1));

◆ TEST_CASE() [192/600]

dart::TEST_CASE ( DartAPI_TestNativeFieldsAccess  )

Definition at line 5627 of file dart_api_impl_test.cc.

5627 {
5628 const char* nullable_tag = TestCase::NullableTag();
5629 // clang-format off
5630 auto kScriptChars = Utils::CStringUniquePtr(
5631 OS::SCreate(
5632 nullptr, R"(
5633 import 'dart:nativewrappers';
5634 base class NativeFields extends NativeFieldWrapperClass2 {
5635 NativeFields(int i, int j) : fld1 = i, fld2 = j {}
5636 int fld1;
5637 final int fld2;
5638 static int%s fld3;
5639 static const int fld4 = 10;
5640 @pragma('vm:external-name', 'TestNativeFieldsAccess_init')
5641 external int%s initNativeFlds();
5642 @pragma('vm:external-name', 'TestNativeFieldsAccess_access')
5643 external int%s accessNativeFlds(int%s i);
5644 }
5645 class NoNativeFields {
5646 int neitherATypedDataNorNull = 0;
5647 @pragma('vm:external-name', 'TestNativeFieldsAccess_invalidAccess')
5648 external invalidAccess();
5649 }
5650 NativeFields testMain() {
5651 NativeFields obj = new NativeFields(10, 20);
5652 obj.initNativeFlds();
5653 obj.accessNativeFlds(null);
5654 new NoNativeFields().invalidAccess();
5655 return obj;
5656 }
5657 )",
5658 nullable_tag, nullable_tag, nullable_tag, nullable_tag),
5659 std::free);
5660 // clang-format on
5661
5662 // Load up a test script in the test library.
5663 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars.get(),
5664 TestNativeFieldsAccess_lookup);
5665
5666 // Invoke a function which returns an object of type NativeFields.
5667 Dart_Handle result = Dart_Invoke(lib, NewString("testMain"), 0, nullptr);
5669}

◆ TEST_CASE() [193/600]

dart::TEST_CASE ( DartAPI_ThrowException  )

Definition at line 7042 of file dart_api_impl_test.cc.

7042 {
7043 const char* kScriptChars =
7044 R"(
7045 @pragma('vm:external-name', 'ThrowException_native')
7046 external int test();
7047 )";
7048
7050 intptr_t size = thread->ZoneSizeInBytes();
7051 Dart_EnterScope(); // Start a Dart API scope for invoking API functions.
7052
7053 // Load up a test script which extends the native wrapper class.
7054 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, native_lookup);
7055
7056 // Throwing an exception here should result in an error.
7057 result = Dart_ThrowException(NewString("This doesn't work"));
7058 EXPECT_ERROR(result, "No Dart frames on stack, cannot throw exception");
7060
7061 // Invoke 'test' and check for an uncaught exception.
7062 result = Dart_Invoke(lib, NewString("test"), 0, nullptr);
7063 EXPECT_ERROR(result, "Hello from ExceptionNative!");
7065

◆ TEST_CASE() [194/600]

dart::TEST_CASE ( DartAPI_TimelineAsync  )

Definition at line 9487 of file dart_api_impl_test.cc.

9495 {
9496 uint16_t data[64];
9497 for (int i = 0; i < 64; i++) {
9498 data[i] = 0x2000 + i * 4;
9499 }
9500 // Non-LATIN-1 in external Uint16List.
9501 Dart_Handle external =
9503 EXPECT_VALID(external);
9504 Dart_Handle dart_args[1];
9505 dart_args[0] = external;
9506 Dart_Handle result = Dart_Invoke(lib, NewString("test"), 1, dart_args);

◆ TEST_CASE() [195/600]

dart::TEST_CASE ( DartAPI_TimelineAsyncDisabled  )

Definition at line 9470 of file dart_api_impl_test.cc.

9475 {
9476 uint16_t data[64];
9477 for (int i = 0; i < 64; i++) {
9478 data[i] = i * 4;
9479 }
9480 // LATIN-1 in external Uint16List.
9481 Dart_Handle external =
9483 EXPECT_VALID(external);
9484 Dart_Handle dart_args[1];
9485 dart_args[0] = external;

◆ TEST_CASE() [196/600]

dart::TEST_CASE ( DartAPI_TimelineBegin  )

Definition at line 9411 of file dart_api_impl_test.cc.

◆ TEST_CASE() [197/600]

dart::TEST_CASE ( DartAPI_TimelineCategories  )

Definition at line 9589 of file dart_api_impl_test.cc.

9593 :\"testInstantEvent\"", json);
9594 EXPECT_SUBSTRING("\"ph\":\"i\"", json);
9595 EXPECT_SUBSTRING("\"ts\":1000", json);
9596}
9597
9598TEST_CASE(DartAPI_TimelineAsyncDisabled) {
9599 // Grab embedder stream.
9600 TimelineStream* stream = Timeline::GetEmbedderStream();
9601 // Make sure it is disabled.
9602 stream->set_enabled(false);
9603 int64_t async_id = 99;
9604 Dart_RecordTimelineEvent("testAsyncEvent", 0, async_id, 0, nullptr,
9606 nullptr);
9607 // Check that testAsync is not in the output.
9608 TimelineEventRecorder* recorder = Timeline::recorder();
9609 JSONStream js;
9610 TimelineEventFilter filter;
9611 recorder->PrintJSON(&js, &filter);
9612 EXPECT_NOTSUBSTRING("testAsyncEvent", js.ToCString());
9613}
9614
9615TEST_CASE(DartAPI_TimelineAsync) {
9616 Isolate* isolate = Isolate::Current();
9617 // Grab embedder stream.
9618 TimelineStream* stream = Timeline::GetEmbedderStream();
9619 // Make sure it is enabled.
9620 stream->set_enabled(true);
9621 int64_t async_id = 99;
9622 Dart_RecordTimelineEvent("testAsyncEvent", 1000, async_id, 0, nullptr,
9624 nullptr);
9625
9626 // Check that it is in the output.
9627 TimelineEventRecorder* recorder = Timeline::recorder();
9628 JSONStream js;
9629 IsolateTimelineEventFilter filter(isolate->main_port());
9630 recorder->PrintJSON(&js, &filter);
9631 const char* json = js.ToCString();
9632 EXPECT_SUBSTRING("\"name\":\"testAsyncEvent\"", json);
9633 EXPECT_SUBSTRING("\"ph\":\"b\"", json);
9634 EXPECT_SUBSTRING("\"ts\":1000", json);
9635 EXPECT_SUBSTRING("\"id\":\"63\"", json); // Hex for some reason.
9636}
9637
9638#if defined(SUPPORT_PERFETTO) && !defined(PRODUCT)
9639TEST_CASE(DartAPI_TimelineAsyncInstantRace) {
9640 struct ReportAsyncEventArguments {
9641 Monitor& synchronization_monitor;
9642 ThreadJoinId join_id = OSThread::kInvalidThreadJoinId;
9643 };
9644
9645 Monitor synchronization_monitor;
9646 ReportAsyncEventArguments report_async_event_1_arguments{
9647 synchronization_monitor};
9648 ReportAsyncEventArguments report_async_event_2_arguments{
9649 synchronization_monitor};
9650 TimelineEventRecorder& recorder = *Timeline::recorder();
9651 JSONStream js;
9652 TimelineEventFilter filter;
9653
9654 // Grab embedder stream.
9655 TimelineStream* stream = Timeline::GetEmbedderStream();
9656 // Make sure it is enabled.
9657 stream->set_enabled(true);
9658 // Try concurrently writing async events and reading from the async track
9659 // metadata map. It is not possible to assert anything about the outcome,
9660 // because of scheduling uncertainty. This test is just used to ensure that
9661 // TSAN checks the async track metadata map code.
9662 OSThread::Start(
9663 "ReportAsyncEvent1",
9664 [](uword arguments_ptr) {
pthread_t ThreadJoinId

◆ TEST_CASE() [198/600]

dart::TEST_CASE ( DartAPI_TimelineClock  )

Definition at line 9576 of file dart_api_impl_test.cc.

9576 :1000", json);
9577}
9578
9579TEST_CASE(DartAPI_TimelineInstant) {
9580 Isolate* isolate = Isolate::Current();
9581 // Grab embedder stream.
9582 TimelineStream* stream = Timeline::GetEmbedderStream();
9583 // Make sure it is enabled.
9584 stream->set_enabled(true);
9585 Dart_RecordTimelineEvent("testInstantEvent", 1000, 1, 0, nullptr,
9586 Dart_Timeline_Event_Instant, 0, nullptr, nullptr);
9587 // Check that it is in the output.

◆ TEST_CASE() [199/600]

dart::TEST_CASE ( DartAPI_TimelineDuration  )

Definition at line 9390 of file dart_api_impl_test.cc.

9398 {
9399 Heap* heap = IsolateGroup::Current()->heap();
9401 {
9402 Thread* T = Thread::Current();
9404 Dart_Handle s1 = AllocateOldString("s1");
9405 EXPECT_VALID(s1);
9406 EXPECT(Dart_IsString(s1));
9407 EXPECT_EQ(0, heap->PeerCount());
9408 void* o1 = &o1;
9409 EXPECT(Dart_GetPeer(s1, &o1));

◆ TEST_CASE() [200/600]

dart::TEST_CASE ( DartAPI_TimelineEnd  )

Definition at line 9431 of file dart_api_impl_test.cc.

9432 {
9433 TransitionNativeToVM transition(thread);
9434 GCTestHelper::CollectOldSpace();
9435 EXPECT_EQ(0, heap->PeerCount());
9436 }
9437}
9438
9439TEST_CASE(DartAPI_StringFromExternalTypedData) {
9440 const char* kScriptChars =
9441 "test(external) {\n"
9442 " var str1 = new String.fromCharCodes(external);\n"
9443 " var str2 = new String.fromCharCodes(new List.from(external));\n"
9444 " if (str2 != str1) throw 'FAIL';\n"
9445 " return str1;\n"
9446 "}\n"
9447 "testView8(external) {\n"
9448 " return test(external.buffer.asUint8List());\n"
9449 "}\n"

◆ TEST_CASE() [201/600]

dart::TEST_CASE ( DartAPI_TimelineEvents_Serialization  )

Definition at line 10038 of file dart_api_impl_test.cc.

10059 {

◆ TEST_CASE() [202/600]

dart::TEST_CASE ( DartAPI_TimelineInstant  )

Definition at line 9451 of file dart_api_impl_test.cc.

9455 {
9456 uint8_t data[64];
9457 for (int i = 0; i < 64; i++) {
9458 data[i] = i * 4;
9459 }
9460 // LATIN-1 in external Uint8List.
9461 Dart_Handle external =
9463 EXPECT_VALID(external);
9464 Dart_Handle dart_args[1];
9465 dart_args[0] = external;
9466 Dart_Handle result = Dart_Invoke(lib, NewString("test"), 1, dart_args);

◆ TEST_CASE() [203/600]

dart::TEST_CASE ( DartAPI_TwoNewSpacePeers  )

Definition at line 9003 of file dart_api_impl_test.cc.

9012 {
9013 Dart_Handle str = Dart_NewStringFromUTF8(nullptr, 0);
9014 EXPECT_VALID(str);
9015 EXPECT(Dart_IsString(str));
9016 intptr_t len = -1;
9017 EXPECT_VALID(Dart_StringLength(str, &len));
9018 EXPECT_EQ(0, len);
9019
9020 str = Dart_NewStringFromUTF16(nullptr, 0);
9021 EXPECT_VALID(str);
9022 EXPECT(Dart_IsString(str));
9023 len = -1;
9024 EXPECT_VALID(Dart_StringLength(str, &len));
9025 EXPECT_EQ(0, len);
9026
9027 str = Dart_NewStringFromUTF32(nullptr, 0);
9028 EXPECT_VALID(str);
9029 EXPECT(Dart_IsString(str));
9030 len = -1;
9031 EXPECT_VALID(Dart_StringLength(str, &len));
9032 EXPECT_EQ(0, len);
9033}
9034
9035// Try to allocate a peer with a handles to objects of prohibited
9036// subtypes.
9037TEST_CASE(DartAPI_InvalidGetSetPeer) {

◆ TEST_CASE() [204/600]

dart::TEST_CASE ( DartAPI_TwoOldSpacePeers  )

Definition at line 9227 of file dart_api_impl_test.cc.

9232 {
9233 TransitionNativeToVM transition(thread);
9234 GCTestHelper::CollectNewSpace();
9235 EXPECT_EQ(kPeerCount, heap->PeerCount());
9236 GCTestHelper::CollectNewSpace();
9237 EXPECT_EQ(kPeerCount, heap->PeerCount());
9238 }
9239}
9240
9241// Allocates an object in new space and assigns it a peer. Promotes
9242// the peer to old space. Removes the peer and check that the count
9243// of peer objects is decremented by one.
9244TEST_CASE(DartAPI_OnePromotedPeer) {
9245 Heap* heap = IsolateGroup::Current()->heap();
9246 Dart_Handle str = NewString("a string");
9247 EXPECT_VALID(str);
9248 EXPECT(Dart_IsString(str));
9249 EXPECT_EQ(0, heap->PeerCount());
9250 void* out = &out;
9251 EXPECT(Dart_GetPeer(str, &out));
9252 EXPECT(out == nullptr);
9253 int peer = 1234;
9254 EXPECT_VALID(Dart_SetPeer(str, &peer));
9255 out = &out;
9256 EXPECT(Dart_GetPeer(str, &out));
9257 EXPECT(out == reinterpret_cast<void*>(&peer));
9258 EXPECT_EQ(1, heap->PeerCount());
9259 {
9260 TransitionNativeToVM transition(thread);
9261 GCTestHelper::CollectNewSpace();
9262 GCTestHelper::CollectNewSpace();
9263 }
9264 {
9265 CHECK_API_SCOPE(thread);

◆ TEST_CASE() [205/600]

dart::TEST_CASE ( DartAPI_TypedDataAccess  )

Definition at line 2083 of file dart_api_impl_test.cc.

2083 {
2085 EXPECT_EQ(Dart_TypedData_kInvalid,
2088 EXPECT_VALID(byte_array1);
2089 EXPECT_EQ(Dart_TypedData_kUint8, Dart_GetTypeOfTypedData(byte_array1));
2090 EXPECT_EQ(Dart_TypedData_kInvalid,
2091 Dart_GetTypeOfExternalTypedData(byte_array1));
2092 EXPECT(Dart_IsList(byte_array1));
2094 EXPECT(Dart_IsTypedData(byte_array1));
2095 EXPECT(!Dart_IsByteBuffer(byte_array1));
2096
2097 intptr_t length = 0;
2098 Dart_Handle result = Dart_ListLength(byte_array1, &length);
2100 EXPECT_EQ(10, length);
2101
2102 result = Dart_ListSetAt(byte_array1, -1, Dart_NewInteger(1));
2104
2105 result = Dart_ListSetAt(byte_array1, 10, Dart_NewInteger(1));
2107
2108 // Set through the List API.
2109 for (intptr_t i = 0; i < 10; ++i) {
2110 EXPECT_VALID(Dart_ListSetAt(byte_array1, i, Dart_NewInteger(i + 1)));
2111 }
2112 for (intptr_t i = 0; i < 10; ++i) {
2113 // Get through the List API.
2114 Dart_Handle integer_obj = Dart_ListGetAt(byte_array1, i);
2115 EXPECT_VALID(integer_obj);
2116 int64_t int64_t_value = -1;
2117 EXPECT_VALID(Dart_IntegerToInt64(integer_obj, &int64_t_value));
2118 EXPECT_EQ(i + 1, int64_t_value);
2119 }
2120
2122 bool is_equal = false;
2123 Dart_ObjectEquals(byte_array1, byte_array2, &is_equal);
2124 EXPECT(!is_equal);
2125
2126 // Set through the List API.
2127 for (intptr_t i = 0; i < 10; ++i) {
2128 result = Dart_ListSetAt(byte_array1, i, Dart_NewInteger(i + 2));
2130 result = Dart_ListSetAt(byte_array2, i, Dart_NewInteger(i + 2));
2132 }
2133 for (intptr_t i = 0; i < 10; ++i) {
2134 // Get through the List API.
2135 Dart_Handle e1 = Dart_ListGetAt(byte_array1, i);
2136 Dart_Handle e2 = Dart_ListGetAt(byte_array2, i);
2137 is_equal = false;
2140 }
2141
2142 uint8_t data[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
2143 for (intptr_t i = 0; i < 10; ++i) {
2144 EXPECT_VALID(Dart_ListSetAt(byte_array1, i, Dart_NewInteger(10 - i)));
2145 }
2146 Dart_ListGetAsBytes(byte_array1, 0, data, 10);
2147 for (intptr_t i = 0; i < 10; ++i) {
2148 Dart_Handle integer_obj = Dart_ListGetAt(byte_array1, i);
2149 EXPECT_VALID(integer_obj);
2150 int64_t int64_t_value = -1;
2151 EXPECT_VALID(Dart_IntegerToInt64(integer_obj, &int64_t_value));
2152 EXPECT_EQ(10 - i, int64_t_value);
2153 }
2154}
float e1
static bool is_equal(SkSurface *a, SkSurface *b)

◆ TEST_CASE() [206/600]

dart::TEST_CASE ( DartAPI_TypedDataDirectAccess1Unverified  )

Definition at line 2646 of file dart_api_impl_test.cc.

2646 {
2647 FLAG_verify_acquired_data = false;
2649}
static void TestTypedDataDirectAccess1()

◆ TEST_CASE() [207/600]

dart::TEST_CASE ( DartAPI_TypedDataDirectAccess1Verified  )

Definition at line 2651 of file dart_api_impl_test.cc.

2651 {
2652 FLAG_verify_acquired_data = true;
2654}

◆ TEST_CASE() [208/600]

dart::TEST_CASE ( DartAPI_TypedDataDirectAccessUnverified  )

Definition at line 2504 of file dart_api_impl_test.cc.

2504 {
2505 FLAG_verify_acquired_data = false;
2507}
static void TestTypedDataDirectAccess()

◆ TEST_CASE() [209/600]

dart::TEST_CASE ( DartAPI_TypedDataDirectAccessVerified  )

Definition at line 2509 of file dart_api_impl_test.cc.

2509 {
2510 FLAG_verify_acquired_data = true;
2512}

◆ TEST_CASE() [210/600]

dart::TEST_CASE ( DartAPI_TypedDataViewDirectAccessUnverified  )

Definition at line 2694 of file dart_api_impl_test.cc.

2694 {
2695 FLAG_verify_acquired_data = false;
2697}
static void TestTypedDataViewDirectAccess()

◆ TEST_CASE() [211/600]

dart::TEST_CASE ( DartAPI_TypedDataViewDirectAccessVerified  )

Definition at line 2699 of file dart_api_impl_test.cc.

2699 {
2700 FLAG_verify_acquired_data = true;
2702}

◆ TEST_CASE() [212/600]

dart::TEST_CASE ( DartAPI_TypedDataViewListGetAsBytes  )

Definition at line 2005 of file dart_api_impl_test.cc.

2005 {
2006 const int kSize = 1000;
2007
2008 const char* kScriptChars =
2009 "import 'dart:typed_data';\n"
2010 "List testMain(int size) {\n"
2011 " var a = new Int8List(size);\n"
2012 " var view = new Int8List.view(a.buffer, 0, size);\n"
2013 " return view;\n"
2014 "}\n";
2015 // Create a test library and Load up a test script in it.
2016 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
2017
2018 // Test with a typed data view object.
2019 Dart_Handle dart_args[1];
2020 dart_args[0] = Dart_NewInteger(kSize);
2021 Dart_Handle view_obj = Dart_Invoke(lib, NewString("testMain"), 1, dart_args);
2022 EXPECT_VALID(view_obj);
2023 for (intptr_t i = 0; i < kSize; ++i) {
2024 EXPECT_VALID(Dart_ListSetAt(view_obj, i, Dart_NewInteger(i & 0xff)));
2025 }
2026 uint8_t* data = new uint8_t[kSize];
2027 EXPECT_VALID(Dart_ListGetAsBytes(view_obj, 0, data, kSize));
2028 for (intptr_t i = 0; i < kSize; ++i) {
2029 EXPECT_EQ(i & 0xff, data[i]);
2030 }
2031
2032 Dart_Handle result = Dart_ListGetAsBytes(view_obj, 0, data, kSize + 1);
2034 delete[] data;
2035}

◆ TEST_CASE() [213/600]

dart::TEST_CASE ( DartAPI_TypedDataViewListIsTypedData  )

Definition at line 2037 of file dart_api_impl_test.cc.

2037 {
2038 const int kSize = 1000;
2039
2040 const char* kScriptChars =
2041 "import 'dart:typed_data';\n"
2042 "List testMain(int size) {\n"
2043 " var a = new Int8List(size);\n"
2044 " var view = new Int8List.view(a.buffer, 0, size);\n"
2045 " return view;\n"
2046 "}\n";
2047 // Create a test library and Load up a test script in it.
2048 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
2049
2050 // Create a typed data view object.
2051 Dart_Handle dart_args[1];
2052 dart_args[0] = Dart_NewInteger(kSize);
2053 Dart_Handle view_obj = Dart_Invoke(lib, NewString("testMain"), 1, dart_args);
2054 EXPECT_VALID(view_obj);
2055 // Test that the API considers it a TypedData object.
2056 EXPECT(Dart_IsTypedData(view_obj));
2057 EXPECT_EQ(Dart_TypedData_kInt8, Dart_GetTypeOfTypedData(view_obj));
2058}

◆ TEST_CASE() [214/600]

dart::TEST_CASE ( DartAPI_TypeDynamic  )

Definition at line 936 of file dart_api_impl_test.cc.

936 {
940
942 EXPECT_VALID(str);
943 const char* cstr = nullptr;
945 EXPECT_STREQ("dynamic", cstr);
946}

◆ TEST_CASE() [215/600]

dart::TEST_CASE ( DartAPI_TypeGetNonParametricTypes  )

Definition at line 4881 of file dart_api_impl_test.cc.

4881 {
4882 const char* kScriptChars =
4883 "class MyClass0 {\n"
4884 "}\n"
4885 "\n"
4886 "class MyClass1 implements MyInterface1 {\n"
4887 "}\n"
4888 "\n"
4889 "class MyClass2 implements MyInterface0, MyInterface1 {\n"
4890 "}\n"
4891 "\n"
4892 "abstract class MyInterface0 {\n"
4893 "}\n"
4894 "\n"
4895 "abstract class MyInterface1 implements MyInterface0 {\n"
4896 "}\n"
4897 "MyClass0 getMyClass0() { return new MyClass0(); }\n"
4898 "MyClass1 getMyClass1() { return new MyClass1(); }\n"
4899 "MyClass2 getMyClass2() { return new MyClass2(); }\n"
4900 "Type getMyClass0Type() { return new MyClass0().runtimeType; }\n"
4901 "Type getMyClass1Type() { return new MyClass1().runtimeType; }\n"
4902 "Type getMyClass2Type() { return new MyClass2().runtimeType; }\n";
4903 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
4904 bool instanceOf = false;
4905
4906 // First get the type objects of these non parameterized types.
4907 Dart_Handle type0 =
4908 Dart_GetNonNullableType(lib, NewString("MyClass0"), 0, nullptr);
4909 EXPECT_VALID(type0);
4910 Dart_Handle type1 =
4911 Dart_GetNonNullableType(lib, NewString("MyClass1"), 0, nullptr);
4912 EXPECT_VALID(type1);
4913 Dart_Handle type2 =
4914 Dart_GetNonNullableType(lib, NewString("MyClass2"), 0, nullptr);
4915 EXPECT_VALID(type2);
4916 Dart_Handle type3 =
4917 Dart_GetNonNullableType(lib, NewString("MyInterface0"), 0, nullptr);
4918 EXPECT_VALID(type3);
4919 Dart_Handle type4 =
4920 Dart_GetNonNullableType(lib, NewString("MyInterface1"), 0, nullptr);
4921 EXPECT_VALID(type4);
4922
4923 // Now create objects of these non parameterized types and check
4924 // that the validity of the type of the created object.
4925 // MyClass0 type.
4926 Dart_Handle type0_obj =
4927 Dart_Invoke(lib, NewString("getMyClass0"), 0, nullptr);
4928 EXPECT_VALID(type0_obj);
4929 EXPECT_VALID(Dart_ObjectIsType(type0_obj, type0, &instanceOf));
4930 EXPECT(instanceOf);
4931 EXPECT_VALID(Dart_ObjectIsType(type0_obj, type1, &instanceOf));
4932 EXPECT(!instanceOf);
4933 EXPECT_VALID(Dart_ObjectIsType(type0_obj, type2, &instanceOf));
4934 EXPECT(!instanceOf);
4935 EXPECT_VALID(Dart_ObjectIsType(type0_obj, type3, &instanceOf));
4936 EXPECT(!instanceOf);
4937 EXPECT_VALID(Dart_ObjectIsType(type0_obj, type4, &instanceOf));
4938 EXPECT(!instanceOf);
4939 type0_obj = Dart_Invoke(lib, NewString("getMyClass0Type"), 0, nullptr);
4940 EXPECT_VALID(type0_obj);
4941 EXPECT(Dart_IdentityEquals(type0, type0_obj));
4942
4943 // MyClass1 type.
4944 Dart_Handle type1_obj =
4945 Dart_Invoke(lib, NewString("getMyClass1"), 0, nullptr);
4946 EXPECT_VALID(type1_obj);
4947 EXPECT_VALID(Dart_ObjectIsType(type1_obj, type1, &instanceOf));
4948 EXPECT(instanceOf);
4949 EXPECT_VALID(Dart_ObjectIsType(type1_obj, type0, &instanceOf));
4950 EXPECT(!instanceOf);
4951 EXPECT_VALID(Dart_ObjectIsType(type1_obj, type2, &instanceOf));
4952 EXPECT(!instanceOf);
4953 EXPECT_VALID(Dart_ObjectIsType(type1_obj, type3, &instanceOf));
4954 EXPECT(instanceOf);
4955 EXPECT_VALID(Dart_ObjectIsType(type1_obj, type4, &instanceOf));
4956 EXPECT(instanceOf);
4957 type1_obj = Dart_Invoke(lib, NewString("getMyClass1Type"), 0, nullptr);
4958 EXPECT_VALID(type1_obj);
4959 EXPECT(Dart_IdentityEquals(type1, type1_obj));
4960
4961 // MyClass2 type.
4962 Dart_Handle type2_obj =
4963 Dart_Invoke(lib, NewString("getMyClass2"), 0, nullptr);
4964 EXPECT_VALID(type2_obj);
4965 EXPECT_VALID(Dart_ObjectIsType(type2_obj, type2, &instanceOf));
4966 EXPECT(instanceOf);
4967 EXPECT_VALID(Dart_ObjectIsType(type2_obj, type0, &instanceOf));
4968 EXPECT(!instanceOf);
4969 EXPECT_VALID(Dart_ObjectIsType(type2_obj, type1, &instanceOf));
4970 EXPECT(!instanceOf);
4971 EXPECT_VALID(Dart_ObjectIsType(type2_obj, type3, &instanceOf));
4972 EXPECT(instanceOf);
4973 EXPECT_VALID(Dart_ObjectIsType(type2_obj, type4, &instanceOf));
4974 EXPECT(instanceOf);
4975 type2_obj = Dart_Invoke(lib, NewString("getMyClass2Type"), 0, nullptr);
4976 EXPECT_VALID(type2_obj);
4977 EXPECT(Dart_IdentityEquals(type2, type2_obj));
4978}

◆ TEST_CASE() [216/600]

dart::TEST_CASE ( DartAPI_TypeGetParameterizedTypes  )

Definition at line 4980 of file dart_api_impl_test.cc.

4980 {
4981 const char* kScriptChars =
4982 "class MyClass0<A, B> {\n"
4983 "}\n"
4984 "\n"
4985 "class MyClass1<A, C> {\n"
4986 "}\n"
4987 "Type type<T>() => T;"
4988 "MyClass0 getMyClass0() {\n"
4989 " return new MyClass0<int, double>();\n"
4990 "}\n"
4991 "Type getMyClass0Type() {\n"
4992 " return type<MyClass0<int, double>>();\n"
4993 "}\n"
4994 "MyClass1 getMyClass1() {\n"
4995 " return new MyClass1<List<int>, List>();\n"
4996 "}\n"
4997 "Type getMyClass1Type() {\n"
4998 " return type<MyClass1<List<int>, List>>();\n"
4999 "}\n"
5000 "MyClass0 getMyClass0_1() {\n"
5001 " return new MyClass0<double, int>();\n"
5002 "}\n"
5003 "Type getMyClass0_1Type() {\n"
5004 " return type<MyClass0<double, int>>();\n"
5005 "}\n"
5006 "MyClass1 getMyClass1_1() {\n"
5007 " return new MyClass1<List<int>, List<double>>();\n"
5008 "}\n"
5009 "Type getMyClass1_1Type() {\n"
5010 " return type<MyClass1<List<int>, List<double>>>();\n"
5011 "}\n"
5012 "Type getIntType() { return int; }\n"
5013 "Type getDoubleType() { return double; }\n"
5014 "Type getListIntType() { return type<List<int>>(); }\n"
5015 "Type getListType() { return List; }\n";
5016
5017 Dart_Handle corelib = Dart_LookupLibrary(NewString("dart:core"));
5018 EXPECT_VALID(corelib);
5019
5020 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
5021
5022 // Now instantiate MyClass0 and MyClass1 types with the same type arguments
5023 // used in the code above.
5024 Dart_Handle type_args = Dart_NewList(2);
5025 Dart_Handle int_type = Dart_Invoke(lib, NewString("getIntType"), 0, nullptr);
5026 EXPECT_VALID(int_type);
5027 EXPECT_VALID(Dart_ListSetAt(type_args, 0, int_type));
5028 Dart_Handle double_type =
5029 Dart_Invoke(lib, NewString("getDoubleType"), 0, nullptr);
5030 EXPECT_VALID(double_type);
5031 EXPECT_VALID(Dart_ListSetAt(type_args, 1, double_type));
5032 Dart_Handle myclass0_type =
5033 TestCase::IsNNBD()
5034 ? Dart_GetNonNullableType(lib, NewString("MyClass0"), 2, &type_args)
5035 : Dart_GetType(lib, NewString("MyClass0"), 2, &type_args);
5036 EXPECT_VALID(myclass0_type);
5037
5038 type_args = Dart_NewList(2);
5039 Dart_Handle list_int_type =
5040 Dart_Invoke(lib, NewString("getListIntType"), 0, nullptr);
5041 EXPECT_VALID(list_int_type);
5042 EXPECT_VALID(Dart_ListSetAt(type_args, 0, list_int_type));
5043 Dart_Handle list_type =
5044 Dart_Invoke(lib, NewString("getListType"), 0, nullptr);
5045 EXPECT_VALID(list_type);
5046 EXPECT_VALID(Dart_ListSetAt(type_args, 1, list_type));
5047 Dart_Handle myclass1_type =
5048 TestCase::IsNNBD()
5049 ? Dart_GetNonNullableType(lib, NewString("MyClass1"), 2, &type_args)
5050 : Dart_GetType(lib, NewString("MyClass1"), 2, &type_args);
5051 EXPECT_VALID(myclass1_type);
5052
5053 // Now create objects of the type and validate the object type matches
5054 // the one returned above. Also get the runtime type of the object and
5055 // verify that it matches the type returned above. Note: we use
5056 // Dart_ObjectEquals instead of Dart_IdentityEquals since we are comparing
5057 // type literals with non-literals which would fail in unsound null safety
5058 // mode.
5059 // MyClass0<int, double> type.
5060 Dart_Handle type0_obj =
5061 Dart_Invoke(lib, NewString("getMyClass0"), 0, nullptr);
5062 EXPECT_VALID(type0_obj);
5063 bool instanceOf = false;
5064 EXPECT_VALID(Dart_ObjectIsType(type0_obj, myclass0_type, &instanceOf));
5065 EXPECT(instanceOf);
5066 type0_obj = Dart_Invoke(lib, NewString("getMyClass0Type"), 0, nullptr);
5067 EXPECT_VALID(type0_obj);
5068
5069 bool equal = false;
5070 EXPECT_VALID(Dart_ObjectEquals(type0_obj, myclass0_type, &equal));
5071 EXPECT(equal);
5072
5073 // MyClass1<List<int>, List> type.
5074 Dart_Handle type1_obj =
5075 Dart_Invoke(lib, NewString("getMyClass1"), 0, nullptr);
5076 EXPECT_VALID(type1_obj);
5077 EXPECT_VALID(Dart_ObjectIsType(type1_obj, myclass1_type, &instanceOf));
5078 EXPECT(instanceOf);
5079 type1_obj = Dart_Invoke(lib, NewString("getMyClass1Type"), 0, nullptr);
5080 EXPECT_VALID(type1_obj);
5081
5082 EXPECT_VALID(Dart_ObjectEquals(type1_obj, myclass1_type, &equal));
5083 EXPECT(equal);
5084
5085 // MyClass0<double, int> type.
5086 type0_obj = Dart_Invoke(lib, NewString("getMyClass0_1"), 0, nullptr);
5087 EXPECT_VALID(type0_obj);
5088 EXPECT_VALID(Dart_ObjectIsType(type0_obj, myclass0_type, &instanceOf));
5089 EXPECT(!instanceOf);
5090 type0_obj = Dart_Invoke(lib, NewString("getMyClass0_1Type"), 0, nullptr);
5091 EXPECT_VALID(type0_obj);
5092 EXPECT_VALID(Dart_ObjectEquals(type0_obj, myclass0_type, &equal));
5093 EXPECT(!equal);
5094
5095 // MyClass1<List<int>, List<double>> type.
5096 type1_obj = Dart_Invoke(lib, NewString("getMyClass1_1"), 0, nullptr);
5097 EXPECT_VALID(type1_obj);
5098 EXPECT_VALID(Dart_ObjectIsType(type1_obj, myclass1_type, &instanceOf));
5099 EXPECT(instanceOf);
5100 type1_obj = Dart_Invoke(lib, NewString("getMyClass1_1Type"), 0, nullptr);
5101 EXPECT_VALID(type1_obj);
5102 EXPECT_VALID(Dart_ObjectEquals(type1_obj, myclass1_type, &equal));
5103 EXPECT(!equal);
5104}
DART_EXPORT Dart_Handle Dart_GetType(Dart_Handle library, Dart_Handle class_name, intptr_t number_of_type_arguments, Dart_Handle *type_arguments)

◆ TEST_CASE() [217/600]

dart::TEST_CASE ( DartAPI_TypeNever  )

Definition at line 960 of file dart_api_impl_test.cc.

960 {
964
966 EXPECT_VALID(str);
967 const char* cstr = nullptr;
969 EXPECT_STREQ("Never", cstr);
970}

◆ TEST_CASE() [218/600]

dart::TEST_CASE ( DartAPI_TypeToNullability  )

Definition at line 7292 of file dart_api_impl_test.cc.

7295 {
7296 const char* kScriptChars =
7297 "library testlib;\n"
7298 "class Class {\n"
7299 " static var name = 'Class';\n"
7300 "}\n";
7301
7302 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
7303
7304 const Dart_Handle name = NewString("Class");
7305 // Lookup the legacy type for Class.
7306 Dart_Handle type = Dart_GetType(lib, name, 0, nullptr);
7307 Dart_Handle nonNullableType;
7308 Dart_Handle nullableType;
7309 if (Dart_IsError(type)) {
7311 type,
7312 "Cannot use legacy types with --sound-null-safety enabled. "
7313 "Use Dart_GetNullableType or Dart_GetNonNullableType instead.");
7314
7315 nonNullableType = Dart_GetNonNullableType(lib, name, 0, nullptr);
7316 EXPECT_VALID(nonNullableType);
7317 nullableType = Dart_GetNullableType(lib, name, 0, nullptr);
7318 } else {
7320 bool result = false;
7322 EXPECT(result);
7323
7324 // Legacy -> Nullable
7325 nullableType = Dart_TypeToNullableType(type);
7326 EXPECT_VALID(nullableType);
7327 result = false;
7328 EXPECT_VALID(Dart_IsNullableType(nullableType, &result));
7329 EXPECT(result);
7330 EXPECT(Dart_IdentityEquals(nullableType,
7331 Dart_GetNullableType(lib, name, 0, nullptr)));
7332
7333 // Legacy -> Non-Nullable
7334 nonNullableType = Dart_TypeToNonNullableType(type);
7335 EXPECT_VALID(nonNullableType);
7336 result = false;
7337 EXPECT_VALID(Dart_IsNonNullableType(nonNullableType, &result));
7338 EXPECT(result);
7339 EXPECT(Dart_IdentityEquals(nonNullableType,
7340 Dart_GetNonNullableType(lib, name, 0, nullptr)));
7341 }
7342
7343 // Nullable -> Non-Nullable
7345 nonNullableType,
7347
7348 // Non-Nullable -> Nullable
DART_EXPORT Dart_Handle Dart_TypeToNonNullableType(Dart_Handle type)
DART_EXPORT Dart_Handle Dart_IsLegacyType(Dart_Handle type, bool *result)
DART_EXPORT Dart_Handle Dart_TypeToNullableType(Dart_Handle type)

◆ TEST_CASE() [219/600]

dart::TEST_CASE ( DartAPI_TypeVoid  )

Definition at line 948 of file dart_api_impl_test.cc.

948 {
952
954 EXPECT_VALID(str);
955 const char* cstr = nullptr;
957 EXPECT_STREQ("void", cstr);
958}

◆ TEST_CASE() [220/600]

dart::TEST_CASE ( DartAPI_UnhandleExceptionError  )

Definition at line 662 of file dart_api_impl_test.cc.

662 {
663 const char* exception_cstr = "";
664
665 // Test with an API Error.
666 const char* kApiError = "Api Error Exception Test.";
667 Dart_Handle api_error = Dart_NewApiError(kApiError);
668 Dart_Handle exception_error = Dart_NewUnhandledExceptionError(api_error);
669 EXPECT(!Dart_IsApiError(exception_error));
670 EXPECT(Dart_IsUnhandledExceptionError(exception_error));
673 &exception_cstr));
674 EXPECT_STREQ(kApiError, exception_cstr);
675
676 // Test with a Compilation Error.
677 const char* kCompileError = "CompileError Exception Test.";
679 exception_error = Dart_NewUnhandledExceptionError(compile_error);
680 EXPECT(!Dart_IsApiError(exception_error));
681 EXPECT(Dart_IsUnhandledExceptionError(exception_error));
684 &exception_cstr));
685 EXPECT_STREQ(kCompileError, exception_cstr);
686
687 // Test with a Fatal Error.
688 Dart_Handle fatal_error;
689 {
690 TransitionNativeToVM transition(thread);
691 const String& fatal_message =
692 String::Handle(String::New("FatalError Exception Test."));
693 fatal_error = Api::NewHandle(thread, UnwindError::New(fatal_message));
694 }
695 exception_error = Dart_NewUnhandledExceptionError(fatal_error);
696 EXPECT(Dart_IsError(exception_error));
697 EXPECT(!Dart_IsUnhandledExceptionError(exception_error));
698
699 // Test with a Regular object.
700 const char* kRegularString = "Regular String Exception Test.";
701 exception_error = Dart_NewUnhandledExceptionError(NewString(kRegularString));
702 EXPECT(!Dart_IsApiError(exception_error));
703 EXPECT(Dart_IsUnhandledExceptionError(exception_error));
706 &exception_cstr));
707 EXPECT_STREQ(kRegularString, exception_cstr);
708}

◆ TEST_CASE() [221/600]

dart::TEST_CASE ( DartAPI_UnmodifiableTypedData_PassByReference  )

Definition at line 2982 of file dart_api_impl_test.cc.

2982 {
2983 const char* kScriptChars = R"(
2984import 'dart:isolate';
2985test(original) {
2986 var port = new RawReceivePort();
2987 port.handler = (msg) {
2988 port.close();
2989 if (!identical(original, msg)) throw "got a copy";
2990 };
2991 port.sendPort.send(original);
2992})";
2993 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
2994
2995 uint8_t data[] = {0, 1, 2, 3};
2997 Dart_TypedData_kUint8, &data[0], ARRAY_SIZE(data), nullptr, 0, nullptr);
2998 EXPECT_VALID(typed_data);
2999 EXPECT_EQ(Dart_TypedData_kUint8, Dart_GetTypeOfTypedData(typed_data));
3000 Dart_Handle args[1];
3001 args[0] = typed_data;
3003 Dart_Invoke(lib, NewString("test"), ARRAY_SIZE(args), args);
3005 result = Dart_RunLoop();
3007}

◆ TEST_CASE() [222/600]

dart::TEST_CASE ( DartAPI_UnmodifiableTypedDataViewDirectAccessUnverified  )

Definition at line 2747 of file dart_api_impl_test.cc.

2747 {
2748 FLAG_verify_acquired_data = false;
2750}
static void TestUnmodifiableTypedDataViewDirectAccess()

◆ TEST_CASE() [223/600]

dart::TEST_CASE ( DartAPI_UnmodifiableTypedDataViewDirectAccessVerified  )

Definition at line 2752 of file dart_api_impl_test.cc.

2752 {
2753 FLAG_verify_acquired_data = true;
2755}

◆ TEST_CASE() [224/600]

dart::TEST_CASE ( DartAPI_UnmodifiableTypedDataViewListIsTypedData  )

Definition at line 2060 of file dart_api_impl_test.cc.

2060 {
2061 const int kSize = 1000;
2062
2063 const char* kScriptChars =
2064 "import 'dart:typed_data';\n"
2065 "List testMain(int size) {\n"
2066 " var a = new Int8List(size);\n"
2067 " var view = new UnmodifiableInt8ListView(a);\n"
2068 " return view;\n"
2069 "}\n";
2070 // Create a test library and Load up a test script in it.
2071 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
2072
2073 // Create a typed data view object.
2074 Dart_Handle dart_args[1];
2075 dart_args[0] = Dart_NewInteger(kSize);
2076 Dart_Handle view_obj = Dart_Invoke(lib, NewString("testMain"), 1, dart_args);
2077 EXPECT_VALID(view_obj);
2078 // Test that the API considers it a TypedData object.
2079 EXPECT(Dart_IsTypedData(view_obj));
2080 EXPECT_EQ(Dart_TypedData_kInt8, Dart_GetTypeOfTypedData(view_obj));
2081}

◆ TEST_CASE() [225/600]

dart::TEST_CASE ( DartAPI_UserTags  )

Definition at line 10186 of file dart_api_impl_test.cc.

10199 {
10200 // We do not check the contents of the JSON output here because we have
10201 // pkg/vm_service/test/get_perfetto_vm_timeline_rpc_test.dart and
10202 // runtime/observatory/tests/get_vm_timeline_rpc_test.dart for that. This test
10203 // is used to ensure that assertions in timeline code are checked by debug
10204 // tryjobs, and that the sanitizers run on the timeline code.
10205
10206 // Grab embedder stream.
10207 TimelineStream* stream = Timeline::GetEmbedderStream();
10208 // Make sure it is enabled.
10209 stream->set_enabled(true);
10210
10212 TimelineEventRecorder* recorder = Timeline::recorder();
10213 JSONStream js_chrome_timeline;
10214 JSONStream js_perfetto_timeline;
10215 TimelineEventFilter filter;
10216 recorder->PrintJSON(&js_chrome_timeline, &filter);
10217#if defined(SUPPORT_PERFETTO)
10218 recorder->PrintPerfettoTimeline(&js_perfetto_timeline, filter);
10219#endif // defined(SUPPORT_PERFETTO)
10220}
10221
10222static void CreateTimelineEvents(uword param) {
10223 {
10224 MonitorLocker ml(loop_test_lock);
10225 loop_test_exit = true;
10226 ml.Notify();
10227 }
10228 do {
10230 } while (true);

◆ TEST_CASE() [226/600]

dart::TEST_CASE ( DartAPI_WeakPersistentHandle  )

Definition at line 3468 of file dart_api_impl_test.cc.

3468 {
3469 Dart_WeakPersistentHandle weak_new_ref = nullptr;
3470 Dart_WeakPersistentHandle weak_old_ref = nullptr;
3471
3472 {
3474
3475 Dart_Handle new_ref, old_ref;
3476 {
3477 // GCs due to allocations or weak handle creation can cause early
3478 // promotion and interfere with the scenario this test is verifying.
3479 ForceGrowthScope force_growth(thread);
3480
3481 // Create an object in new space.
3482 new_ref = AllocateNewString("new string");
3483 EXPECT_VALID(new_ref);
3484
3485 // Create an object in old space.
3486 old_ref = AllocateOldString("old string");
3487 EXPECT_VALID(old_ref);
3488
3489 // Create a weak ref to the new space object.
3490 weak_new_ref =
3491 Dart_NewWeakPersistentHandle(new_ref, nullptr, 0, NopCallback);
3492 EXPECT_VALID(AsHandle(weak_new_ref));
3493 EXPECT(!Dart_IsNull(AsHandle(weak_new_ref)));
3494
3495 // Create a weak ref to the old space object.
3496 weak_old_ref =
3497 Dart_NewWeakPersistentHandle(old_ref, nullptr, 0, NopCallback);
3498
3499 EXPECT_VALID(AsHandle(weak_old_ref));
3500 EXPECT(!Dart_IsNull(AsHandle(weak_old_ref)));
3501 }
3502
3503 {
3504 TransitionNativeToVM transition(thread);
3505 // Garbage collect new space.
3506 GCTestHelper::CollectNewSpace();
3507 }
3508
3509 // Nothing should be invalidated or cleared.
3510 EXPECT_VALID(new_ref);
3511 EXPECT(!Dart_IsNull(new_ref));
3512 EXPECT_VALID(old_ref);
3513 EXPECT(!Dart_IsNull(old_ref));
3514
3515 EXPECT_VALID(AsHandle(weak_new_ref));
3516 EXPECT(!Dart_IsNull(AsHandle(weak_new_ref)));
3517 EXPECT(Dart_IdentityEquals(new_ref, AsHandle(weak_new_ref)));
3518
3519 EXPECT_VALID(AsHandle(weak_old_ref));
3520 EXPECT(!Dart_IsNull(AsHandle(weak_old_ref)));
3521 EXPECT(Dart_IdentityEquals(old_ref, AsHandle(weak_old_ref)));
3522
3523 {
3524 TransitionNativeToVM transition(thread);
3525 // Garbage collect old space.
3526 GCTestHelper::CollectOldSpace();
3527 }
3528
3529 // Nothing should be invalidated or cleared.
3530 EXPECT_VALID(new_ref);
3531 EXPECT(!Dart_IsNull(new_ref));
3532 EXPECT_VALID(old_ref);
3533 EXPECT(!Dart_IsNull(old_ref));
3534
3535 EXPECT_VALID(AsHandle(weak_new_ref));
3536 EXPECT(!Dart_IsNull(AsHandle(weak_new_ref)));
3537 EXPECT(Dart_IdentityEquals(new_ref, AsHandle(weak_new_ref)));
3538
3539 EXPECT_VALID(AsHandle(weak_old_ref));
3540 EXPECT(!Dart_IsNull(AsHandle(weak_old_ref)));
3541 EXPECT(Dart_IdentityEquals(old_ref, AsHandle(weak_old_ref)));
3542
3543 // Delete local (strong) references.
3545 }
3546
3547 {
3548 TransitionNativeToVM transition(thread);
3549 // Garbage collect new space again.
3550 GCTestHelper::CollectNewSpace();
3551 }
3552
3553 {
3555 // Weak ref to new space object should now be cleared.
3556 EXPECT_VALID(AsHandle(weak_new_ref));
3557 EXPECT(Dart_IsNull(AsHandle(weak_new_ref)));
3558 EXPECT_VALID(AsHandle(weak_old_ref));
3559 EXPECT(!Dart_IsNull(AsHandle(weak_old_ref)));
3561 }
3562
3563 {
3564 TransitionNativeToVM transition(thread);
3565 // Garbage collect old space again.
3566 GCTestHelper::CollectOldSpace();
3567 }
3568
3569 {
3571 // Weak ref to old space object should now be cleared.
3572 EXPECT_VALID(AsHandle(weak_new_ref));
3573 EXPECT(Dart_IsNull(AsHandle(weak_new_ref)));
3574 EXPECT_VALID(AsHandle(weak_old_ref));
3575 EXPECT(Dart_IsNull(AsHandle(weak_old_ref)));
3577 }
3578
3579 {
3580 TransitionNativeToVM transition(thread);
3581 // Garbage collect one last time to revisit deleted handles.
3582 GCTestHelper::CollectAllGarbage();
3583 }
3584
3585 Dart_DeleteWeakPersistentHandle(weak_new_ref);
3586 Dart_DeleteWeakPersistentHandle(weak_old_ref);
3587}

◆ TEST_CASE() [227/600]

dart::TEST_CASE ( DartAPI_WeakPersistentHandleCallback  )

Definition at line 3931 of file dart_api_impl_test.cc.

3931 {
3932 Dart_WeakPersistentHandle weak_ref = nullptr;
3933 int peer = 0;
3934 {
3936 Dart_Handle obj = NewString("new string");
3937 EXPECT_VALID(obj);
3938 weak_ref = Dart_NewWeakPersistentHandle(obj, &peer, 0,
3939 WeakPersistentHandlePeerFinalizer);
3940 EXPECT_VALID(AsHandle(weak_ref));
3941 EXPECT(peer == 0);
3943 }
3944 {
3945 TransitionNativeToVM transition(thread);
3946 GCTestHelper::CollectNewSpace();
3947 EXPECT(peer == 42);
3948 }
3950}

◆ TEST_CASE() [228/600]

dart::TEST_CASE ( DartAPI_WeakPersistentHandleCallbackSelfDelete  )

Definition at line 4042 of file dart_api_impl_test.cc.

4042 {
4043 int peer = 0;
4044 {
4046 Dart_Handle obj = NewString("new string");
4047 EXPECT_VALID(obj);
4049 obj, &peer, 0, DeleteWeakHandleOnFinalization);
4050 EXPECT_VALID(AsHandle(delete_on_finalization));
4051 EXPECT(peer == 0);
4053 }
4054 {
4055 TransitionNativeToVM transition(thread);
4056 GCTestHelper::CollectNewSpace();
4057 EXPECT(peer == 42);
4058 ASSERT(delete_on_finalization == nullptr);
4059 }
4060}

◆ TEST_CASE() [229/600]

dart::TEST_CASE ( DartAPI_WeakPersistentHandleCleanupFinalizer  )

Definition at line 3857 of file dart_api_impl_test.cc.

3857 {
3858 Heap* heap = IsolateGroup::Current()->heap();
3859
3860 const char* kTestString1 = "Test String1";
3862 CHECK_API_SCOPE(thread);
3863 Dart_Handle ref1 = Dart_NewStringFromCString(kTestString1);
3865 Dart_Handle ref2 = Dart_NewStringFromCString(kTestString1);
3866 int peer2 = 0;
3868 Dart_NewWeakPersistentHandle(ref2, &peer2, 0, NopCallback);
3869 int peer3 = 0;
3870 {
3872 Dart_Handle ref3 = Dart_NewStringFromCString(kTestString1);
3874 ref3, &peer3, 0, WeakPersistentHandlePeerCleanupFinalizer);
3876 }
3877 {
3878 TransitionNativeToVM transition(thread);
3879 GCTestHelper::CollectAllGarbage();
3880 EXPECT(heap->ExternalInWords(Heap::kOld) == 0);
3881 EXPECT(peer3 == 42);
3882 }
3884
3885 Dart_DeleteWeakPersistentHandle(weak_persistent_handle3);
3886}
static Dart_WeakPersistentHandle weak_persistent_handle3

◆ TEST_CASE() [230/600]

dart::TEST_CASE ( DartAPI_WeakPersistentHandleCleanupFinalizerAtShutdown  )

Definition at line 3838 of file dart_api_impl_test.cc.

3838 {
3839 const char* kTestString1 = "Test String1";
3840 int peer3 = 0;
3842 CHECK_API_SCOPE(thread);
3843 Dart_Handle ref3 = Dart_NewStringFromCString(kTestString1);
3845 ref3, &peer3, 0, WeakPersistentHandlePeerCleanupEnsuresIGFinalizer);
3847}

◆ TEST_CASE() [231/600]

dart::TEST_CASE ( DartAPI_WeakPersistentHandleErrors  )

Definition at line 3708 of file dart_api_impl_test.cc.

3708 {
3710
3711 // nullptr callback.
3712 Dart_Handle obj1 = NewString("new string");
3713 EXPECT_VALID(obj1);
3715 Dart_NewWeakPersistentHandle(obj1, nullptr, 0, nullptr);
3716 EXPECT_EQ(ref1, static_cast<void*>(nullptr));
3717
3718 // Immediate object.
3719 Dart_Handle obj2 = Dart_NewInteger(0);
3720 EXPECT_VALID(obj2);
3722 Dart_NewWeakPersistentHandle(obj2, nullptr, 0, NopCallback);
3723 EXPECT_EQ(ref2, static_cast<void*>(nullptr));
3724
3725 // Pointer object.
3726 Dart_Handle ffi_lib = Dart_LookupLibrary(NewString("dart:ffi"));
3727 Dart_Handle pointer_type =
3728 Dart_GetNonNullableType(ffi_lib, NewString("Pointer"), 0, nullptr);
3729 Dart_Handle obj3 = Dart_Allocate(pointer_type);
3730 EXPECT_VALID(obj3);
3732 Dart_NewWeakPersistentHandle(obj3, nullptr, 0, FinalizableHandleCallback);
3733 EXPECT_EQ(ref3, static_cast<void*>(nullptr));
3734
3735 // Subtype of Struct or Union object.
3736 const char* kScriptChars = R"(
3737 import 'dart:ffi';
3738
3739 final class MyStruct extends Struct {
3740 external Pointer notEmpty;
3741 }
3742
3743 final class MyUnion extends Union {
3744 external Pointer notEmpty;
3745 }
3746 )";
3747 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
3748
3749 Dart_Handle my_struct_type =
3750 Dart_GetNonNullableType(lib, NewString("MyStruct"), 0, nullptr);
3751 Dart_Handle obj4 = Dart_Allocate(my_struct_type);
3752 EXPECT_VALID(obj4);
3754 Dart_NewWeakPersistentHandle(obj4, nullptr, 0, FinalizableHandleCallback);
3755 EXPECT_EQ(ref4, static_cast<void*>(nullptr));
3756
3757 Dart_Handle my_union_type =
3758 Dart_GetNonNullableType(lib, NewString("MyUnion"), 0, nullptr);
3759 Dart_Handle obj5 = Dart_Allocate(my_union_type);
3760 EXPECT_VALID(obj5);
3762 Dart_NewWeakPersistentHandle(obj4, nullptr, 0, FinalizableHandleCallback);
3763 EXPECT_EQ(ref5, static_cast<void*>(nullptr));
3764
3766}

◆ TEST_CASE() [232/600]

dart::TEST_CASE ( DartAPI_WeakPersistentHandleExternalAllocationSize  )

Definition at line 4088 of file dart_api_impl_test.cc.

4088 {
4089 Heap* heap = IsolateGroup::Current()->heap();
4090 EXPECT_EQ(heap->ExternalInWords(Heap::kNew), 0);
4091 EXPECT_EQ(heap->ExternalInWords(Heap::kOld), 0);
4093 const intptr_t kWeak1ExternalSize = 1 * KB;
4094 {
4096 Dart_Handle obj = NewString("weakly referenced string");
4097 EXPECT_VALID(obj);
4098 weak1 = Dart_NewWeakPersistentHandle(obj, nullptr, kWeak1ExternalSize,
4099 NopCallback);
4100 EXPECT_VALID(AsHandle(weak1));
4102 }
4103 Dart_PersistentHandle strong_ref = nullptr;
4104 Dart_WeakPersistentHandle weak2 = nullptr;
4105 const intptr_t kWeak2ExternalSize = 2 * KB;
4106 {
4108 Dart_Handle obj = NewString("strongly referenced string");
4109 EXPECT_VALID(obj);
4110 strong_ref = Dart_NewPersistentHandle(obj);
4111 weak2 = Dart_NewWeakPersistentHandle(obj, nullptr, kWeak2ExternalSize,
4112 NopCallback);
4113 EXPECT_VALID(AsHandle(strong_ref));
4114 EXPECT_VALID(AsHandle(weak2));
4116 }
4117 {
4118 TransitionNativeToVM transition(thread);
4119 EXPECT_EQ(heap->ExternalInWords(Heap::kNew),
4120 (kWeak1ExternalSize + kWeak2ExternalSize) / kWordSize);
4121 EXPECT_EQ(heap->ExternalInWords(Heap::kOld), 0);
4122 // Collect weakly referenced string.
4123 GCTestHelper::CollectNewSpace();
4124 EXPECT_EQ(heap->ExternalInWords(Heap::kNew),
4125 kWeak2ExternalSize / kWordSize);
4126 EXPECT_EQ(heap->ExternalInWords(Heap::kOld), 0);
4127 // Promote strongly referenced string.
4128 GCTestHelper::CollectNewSpace();
4129 EXPECT_EQ(heap->ExternalInWords(Heap::kNew), 0);
4130 EXPECT_EQ(heap->ExternalInWords(Heap::kOld),
4131 kWeak2ExternalSize / kWordSize);
4132 }
4133 Dart_DeletePersistentHandle(strong_ref);
4134 {
4135 TransitionNativeToVM transition(thread);
4136 GCTestHelper::CollectOldSpace();
4137 EXPECT_EQ(heap->ExternalInWords(Heap::kNew), 0);
4138 EXPECT_EQ(heap->ExternalInWords(Heap::kOld), 0);
4139 }
4142}

◆ TEST_CASE() [233/600]

dart::TEST_CASE ( DartAPI_WeakPersistentHandleExternalAllocationSizeNewspaceGC  )

Definition at line 4192 of file dart_api_impl_test.cc.

4192 {
4193 Heap* heap = IsolateGroup::Current()->heap();
4195 // Large enough to exceed any new space limit. Not actually allocated.
4196 const intptr_t kWeak1ExternalSize = 500 * MB;
4197 {
4199 Dart_Handle obj = NewString("weakly referenced string");
4200 EXPECT_VALID(obj);
4201 // Triggers a scavenge immediately, since kWeak1ExternalSize is above limit.
4202 weak1 = Dart_NewWeakPersistentHandle(obj, nullptr, kWeak1ExternalSize,
4203 NopCallback);
4204 EXPECT_VALID(AsHandle(weak1));
4205 // ... but the object is still alive and not yet promoted, so external size
4206 // in new space is still above the limit. Thus, even the following tiny
4207 // external allocation will trigger another scavenge.
4209 Dart_NewWeakPersistentHandle(obj, nullptr, 1, NopCallback);
4210 EXPECT_VALID(AsHandle(trigger));
4212 // After the two scavenges above, 'obj' should now be promoted, hence its
4213 // external size charged to old space.
4214 {
4215 CHECK_API_SCOPE(thread);
4216 TransitionNativeToVM transition(thread);
4217 HANDLESCOPE(thread);
4218 String& handle = String::Handle(thread->zone());
4219 handle ^= Api::UnwrapHandle(obj);
4220 EXPECT(handle.IsOld());
4221 }
4222 EXPECT(heap->ExternalInWords(Heap::kNew) == 0);
4223 EXPECT(heap->ExternalInWords(Heap::kOld) == kWeak1ExternalSize / kWordSize);
4225 }
4227 {
4228 TransitionNativeToVM transition(thread);
4229 GCTestHelper::CollectOldSpace();
4230 EXPECT_EQ(0, heap->ExternalInWords(Heap::kOld));
4231 }
4232}

◆ TEST_CASE() [234/600]

dart::TEST_CASE ( DartAPI_WeakPersistentHandleExternalAllocationSizeOddReferents  )

Definition at line 4357 of file dart_api_impl_test.cc.

4357 {
4358 Heap* heap = IsolateGroup::Current()->heap();
4360 const intptr_t kWeak1ExternalSize = 1 * KB;
4362 const intptr_t kWeak2ExternalSize = 2 * KB;
4363 EXPECT_EQ(0, heap->ExternalInWords(Heap::kOld));
4364 {
4366 Dart_Handle dart_true = Dart_True(); // VM heap object.
4367 EXPECT_VALID(dart_true);
4368 weak1 = Dart_NewWeakPersistentHandle(dart_true, nullptr, kWeak1ExternalSize,
4369 UnreachedCallback);
4370 EXPECT_VALID(AsHandle(weak1));
4371 Dart_Handle zero = Dart_False(); // VM heap object.
4372 EXPECT_VALID(zero);
4373 weak2 = Dart_NewWeakPersistentHandle(zero, nullptr, kWeak2ExternalSize,
4374 UnreachedCallback);
4375 EXPECT_VALID(AsHandle(weak2));
4376 // Both should be charged to old space.
4377 EXPECT(heap->ExternalInWords(Heap::kOld) ==
4378 (kWeak1ExternalSize + kWeak2ExternalSize) / kWordSize);
4380 }
4383 EXPECT_EQ(0, heap->ExternalInWords(Heap::kOld));
4384 {
4385 TransitionNativeToVM transition(thread);
4386 GCTestHelper::CollectOldSpace();
4387 EXPECT_EQ(0, heap->ExternalInWords(Heap::kOld));
4388 }
4389}

◆ TEST_CASE() [235/600]

dart::TEST_CASE ( DartAPI_WeakPersistentHandleExternalAllocationSizeOldspaceGC  )

Definition at line 4277 of file dart_api_impl_test.cc.

4277 {
4278 // Check that external allocation in old space can trigger GC.
4279 Heap* heap = IsolateGroup::Current()->heap();
4281 Dart_Handle live = AllocateOldString("live");
4282 EXPECT_VALID(live);
4283 Dart_WeakPersistentHandle weak = nullptr;
4284 {
4285 TransitionNativeToVM transition(thread);
4286 GCTestHelper::WaitForGCTasks(); // Finalize GC for accurate live size.
4287 EXPECT_EQ(0, heap->ExternalInWords(Heap::kOld));
4288 }
4289 const intptr_t kSmallExternalSize = 1 * KB;
4290 {
4292 Dart_Handle dead = AllocateOldString("dead");
4293 EXPECT_VALID(dead);
4294 weak = Dart_NewWeakPersistentHandle(dead, nullptr, kSmallExternalSize,
4295 NopCallback);
4296 EXPECT_VALID(AsHandle(weak));
4298 }
4299 {
4300 TransitionNativeToVM transition(thread);
4301 GCTestHelper::WaitForGCTasks(); // Finalize GC for accurate live size.
4302 EXPECT_EQ(kSmallExternalSize,
4303 heap->ExternalInWords(Heap::kOld) * kWordSize);
4304 }
4305 // Large enough to trigger GC in old space. Not actually allocated.
4306 const intptr_t kHugeExternalSize = (kWordSize == 4) ? 513 * MB : 1025 * MB;
4308 live, nullptr, kHugeExternalSize, NopCallback);
4309 {
4310 TransitionNativeToVM transition(thread);
4311 GCTestHelper::WaitForGCTasks(); // Finalize GC for accurate live size.
4312 // Expect small garbage to be collected.
4313 EXPECT_EQ(kHugeExternalSize, heap->ExternalInWords(Heap::kOld) * kWordSize);
4314 }
4318}

◆ TEST_CASE() [236/600]

dart::TEST_CASE ( DartAPI_WeakPersistentHandleNoCallback  )

Definition at line 3974 of file dart_api_impl_test.cc.

3974 {
3975 Dart_WeakPersistentHandle weak_ref = nullptr;
3976 int peer = 0;
3977 {
3979 Dart_Handle obj = NewString("new string");
3980 EXPECT_VALID(obj);
3981 weak_ref = Dart_NewWeakPersistentHandle(obj, &peer, 0,
3982 WeakPersistentHandlePeerFinalizer);
3984 }
3985 // A finalizer is not invoked on a deleted handle. Therefore, the
3986 // peer value should not change after the referent is collected.
3988 EXPECT(peer == 0);
3989 {
3990 TransitionNativeToVM transition(thread);
3991 GCTestHelper::CollectOldSpace();
3992 EXPECT(peer == 0);
3993 GCTestHelper::CollectNewSpace();
3994 EXPECT(peer == 0);
3995 }
3996}

◆ TEST_CASE() [237/600]

dart::TEST_CASE ( DeoptimizeFramesWhenSettingBreakpoint  )

Definition at line 5662 of file object_test.cc.

5662 {
5663 const char* kOriginalScript = "test() {}";
5664
5665 Dart_Handle lib = TestCase::LoadTestScript(kOriginalScript, nullptr);
5666 EXPECT_VALID(lib);
5667 Dart_SetNativeResolver(lib, &SetBreakpointResolver, nullptr);
5668
5669 // Get unoptimized code for functions so they can be optimized.
5670 Dart_Handle result = Dart_Invoke(lib, NewString("test"), 0, nullptr);
5672
5673 // Launch second isolate so that running with stopped mutators during
5674 // deoptimizattion requests a safepoint.
5677 char* error = nullptr;
5678 Dart_Isolate child = Dart_CreateIsolateInGroup(parent, "child",
5679 /*shutdown_callback=*/nullptr,
5680 /*cleanup_callback=*/nullptr,
5681 /*peer=*/nullptr, &error);
5682 EXPECT_NE(nullptr, child);
5683 EXPECT_EQ(nullptr, error);
5685 Dart_EnterIsolate(parent);
5686
5687 const char* kReloadScript =
5688 R"(
5689 @pragma("vm:external-name", "setBreakpoint")
5690 external setBreakpoint();
5691 baz() {}
5692 test() {
5693 if (true) {
5694 setBreakpoint();
5695 } else {
5696 baz(); // this line gets a breakpoint
5697 }
5698 }
5699 )";
5700 lib = TestCase::ReloadTestScript(kReloadScript);
5701 EXPECT_VALID(lib);
5702
5703 {
5704 TransitionNativeToVM transition(thread);
5705 const String& name = String::Handle(String::New(TestCase::url()));
5706 const Library& vmlib =
5707 Library::Handle(Library::LookupLibrary(thread, name));
5708 EXPECT(!vmlib.IsNull());
5709 Function& func_test = Function::Handle(GetFunction(vmlib, "test"));
5710 Compiler::EnsureUnoptimizedCode(thread, func_test);
5711 Compiler::CompileOptimizedFunction(thread, func_test);
5712 func_test.set_unoptimized_code(Code::Handle(Code::null()));
5713 }
5714
5715 result = Dart_Invoke(lib, NewString("test"), 0, nullptr);
5717
5718 // Make sure child isolate finishes.
void set_unoptimized_code(const Code &value) const
Definition object.cc:8096

◆ TEST_CASE() [238/600]

dart::TEST_CASE ( DirectChainedHashMap  )

Definition at line 23 of file hash_map_test.cc.

23 {
25 EXPECT(map.IsEmpty());
26 TestValue v1(0);
27 TestValue v2(1);
28 TestValue v3(0);
29 map.Insert(&v1);
30 EXPECT(map.LookupValue(&v1) == &v1);
31 map.Insert(&v2);
32 EXPECT(map.LookupValue(&v1) == &v1);
33 EXPECT(map.LookupValue(&v2) == &v2);
34 EXPECT(map.LookupValue(&v3) == &v1);
35 EXPECT(map.Remove(&v1));
36 EXPECT(map.Lookup(&v1) == nullptr);
37 map.Insert(&v1);
39 EXPECT(map2.LookupValue(&v1) == &v1);
40 EXPECT(map2.LookupValue(&v2) == &v2);
41 EXPECT(map2.LookupValue(&v3) == &v1);
42}

◆ TEST_CASE() [239/600]

dart::TEST_CASE ( DirectChainedHashMapInsertRemove  )

Definition at line 44 of file hash_map_test.cc.

44 {
46 EXPECT(map.IsEmpty());
47 TestValue v1(1);
48 TestValue v2(3); // Note: v1, v2, v3 should have the same hash.
49 TestValue v3(5);
50
51 // Start with adding and removing the same element.
52 map.Insert(&v1);
53 EXPECT(map.LookupValue(&v1) == &v1);
54 EXPECT(map.Remove(&v1));
55 EXPECT(map.Lookup(&v1) == nullptr);
56
57 // Inserting v2 first should put it at the head of the list.
58 map.Insert(&v2);
59 map.Insert(&v1);
60 EXPECT(map.LookupValue(&v2) == &v2);
61 EXPECT(map.LookupValue(&v1) == &v1);
62
63 // Check to see if removing the head of the list causes issues.
64 EXPECT(map.Remove(&v2));
65 EXPECT(map.Lookup(&v2) == nullptr);
66 EXPECT(map.LookupValue(&v1) == &v1);
67
68 // Reinsert v2, which will place it at the back of the hash map list.
69 map.Insert(&v2);
70 EXPECT(map.LookupValue(&v2) == &v2);
71
72 // Remove from the back of the hash map list.
73 EXPECT(map.Remove(&v2));
74 EXPECT(map.Lookup(&v2) == nullptr);
75 EXPECT(map.Remove(&v1));
76 EXPECT(map.Lookup(&v1) == nullptr);
77
78 // Check to see that removing an invalid element returns false.
79 EXPECT(!map.Remove(&v1));
80
81 // One last case: remove from the middle of a hash map list.
82 map.Insert(&v1);
83 map.Insert(&v2);
84 map.Insert(&v3);
85
86 EXPECT(map.LookupValue(&v1) == &v1);
87 EXPECT(map.LookupValue(&v2) == &v2);
88 EXPECT(map.LookupValue(&v3) == &v3);
89
90 EXPECT(map.Remove(&v2));
91 EXPECT(map.LookupValue(&v1) == &v1);
92 EXPECT(map.Lookup(&v2) == nullptr);
93 EXPECT(map.LookupValue(&v3) == &v3);
94
95 EXPECT(map.Remove(&v1));
96 EXPECT(map.Remove(&v3));
97
98 EXPECT(map.IsEmpty());
99}

◆ TEST_CASE() [240/600]

dart::TEST_CASE ( DirectChainedHashMapIterator  )

Definition at line 157 of file hash_map_test.cc.

157 {
158 IntptrPair p1(1, 1);
159 IntptrPair p2(2, 2);
160 IntptrPair p3(3, 3);
161 IntptrPair p4(4, 4);
162 IntptrPair p5(5, 5);
164 EXPECT(map.IsEmpty());
166 map.GetIterator();
167 EXPECT(it.Next() == nullptr);
168 it.Reset();
169
170 map.Insert(p1);
171 EXPECT(*it.Next() == p1);
172 it.Reset();
173
174 map.Insert(p2);
175 map.Insert(p3);
176 map.Insert(p4);
177 map.Insert(p5);
178 intptr_t count = 0;
179 intptr_t sum = 0;
180 while (true) {
181 IntptrPair* p = it.Next();
182 if (p == nullptr) {
183 break;
184 }
185 count++;
186 sum += p->second();
187 }
188
189 EXPECT(count == 5);
190 EXPECT(sum == 15);
191}

◆ TEST_CASE() [241/600]

dart::TEST_CASE ( DirectChainedHashMapIteratorWithCollisionInLastBucket  )

Definition at line 193 of file hash_map_test.cc.

193 {
194 intptr_t values[] = {65, 325, 329, 73, 396, 207, 215, 93, 227, 39,
195 431, 112, 176, 313, 188, 317, 61, 127, 447};
196 IntMap<intptr_t> map;
197
198 for (intptr_t value : values) {
199 map.Insert(value, value);
200 }
201
202 bool visited[ARRAY_SIZE(values)] = {};
203 intptr_t count = 0;
204 auto it = map.GetIterator();
205 for (auto* p = it.Next(); p != nullptr; p = it.Next()) {
206 ++count;
207 bool found = false;
208 intptr_t i = 0;
209 for (intptr_t v : values) {
210 if (v == p->key) {
211 EXPECT(v == p->value);
212 EXPECT(!visited[i]);
213 visited[i] = true;
214 found = true;
215 break;
216 }
217 ++i;
218 }
219 EXPECT(found);
220 }
221 EXPECT(count == ARRAY_SIZE(values));
222 for (bool is_visited : visited) {
223 EXPECT(is_visited);
224 }
225}

◆ TEST_CASE() [242/600]

dart::TEST_CASE ( DirectoryCreateDelete  )

Definition at line 78 of file directory_test.cc.

78 {
79 const char* kTempDirName = "create_delete_test_name";
80
81 const char* system_temp = dart::bin::Directory::SystemTemp(nullptr);
82 EXPECT_NOTNULL(system_temp);
83
84 const intptr_t name_len =
85 snprintf(nullptr, 0, "%s/%s", system_temp, kTempDirName);
86 ASSERT(name_len > 0);
87 char* name = new char[name_len + 1];
88 snprintf(name, name_len + 1, "%s/%s", system_temp, kTempDirName);
89
90 // Make a directory.
92
93 // Make sure it exists.
96 EXPECT_EQ(dart::bin::Directory::EXISTS, r);
97
98 // Cleanup.
100 delete[] name;
101}
static bool Create(Namespace *namespc, const char *path)
static ExistsResult Exists(Namespace *namespc, const char *path)
static bool Delete(Namespace *namespc, const char *path, bool recursive)
static const char * SystemTemp(Namespace *namespc)

◆ TEST_CASE() [243/600]

dart::TEST_CASE ( DirectoryCreateTemp  )

Definition at line 46 of file directory_test.cc.

46 {
47 const char* kTempPrefix = "test_prefix";
48 const char* system_temp = dart::bin::Directory::SystemTemp(nullptr);
49 EXPECT_NOTNULL(system_temp);
50
51 const char* temp_dir = dart::bin::Directory::CreateTemp(nullptr, kTempPrefix);
52 EXPECT_NOTNULL(temp_dir);
53
54 // Make sure temp_dir contains test_prefix.
55 EXPECT_NOTNULL(strstr(temp_dir, kTempPrefix));
56
57 // Cleanup.
58 EXPECT(dart::bin::Directory::Delete(nullptr, temp_dir, false));
59}
static const char * CreateTemp(Namespace *namespc, const char *path)

◆ TEST_CASE() [244/600]

dart::TEST_CASE ( DirectoryCurrent  )

Definition at line 18 of file directory_test.cc.

18 {
19 const char* current = dart::bin::Directory::Current(nullptr);
20 EXPECT_NOTNULL(current);
21}
static const char * Current(Namespace *namespc)
Definition directory.cc:558

◆ TEST_CASE() [245/600]

dart::TEST_CASE ( DirectoryExists  )

Definition at line 23 of file directory_test.cc.

23 {
24 const char* current = dart::bin::Directory::Current(nullptr);
25 EXPECT_NOTNULL(current);
26
28 dart::bin::Directory::Exists(nullptr, current);
29 EXPECT_EQ(dart::bin::Directory::EXISTS, r);
30}

◆ TEST_CASE() [246/600]

dart::TEST_CASE ( DirectoryRename  )

Definition at line 103 of file directory_test.cc.

103 {
104 const char* kTempDirName = "rename_test_name";
105
106 const char* system_temp = dart::bin::Directory::SystemTemp(nullptr);
107 EXPECT_NOTNULL(system_temp);
108
109 const intptr_t name_len =
110 snprintf(nullptr, 0, "%s/%s", system_temp, kTempDirName);
111 ASSERT(name_len > 0);
112 char* name = new char[name_len + 1];
113 snprintf(name, name_len + 1, "%s/%s", system_temp, kTempDirName);
114
115 // Make a directory.
117
118 // Make sure it exists.
121 EXPECT_EQ(dart::bin::Directory::EXISTS, r);
122
123 const intptr_t new_name_len =
124 snprintf(nullptr, 0, "%s/%snewname", system_temp, kTempDirName);
125 ASSERT(new_name_len > 0);
126 char* new_name = new char[new_name_len + 1];
127 snprintf(new_name, new_name_len + 1, "%s/%snewname", system_temp,
128 kTempDirName);
129
130 EXPECT(dart::bin::Directory::Rename(nullptr, name, new_name));
131
132 r = dart::bin::Directory::Exists(nullptr, new_name);
133 EXPECT_EQ(dart::bin::Directory::EXISTS, r);
134
137
138 EXPECT(dart::bin::Directory::Delete(nullptr, new_name, false));
139 delete[] name;
140 delete[] new_name;
141}
static bool Rename(Namespace *namespc, const char *path, const char *new_path)

◆ TEST_CASE() [247/600]

dart::TEST_CASE ( DirectorySetCurrent  )

Definition at line 61 of file directory_test.cc.

61 {
62 const char* current = dart::bin::Directory::Current(nullptr);
63 EXPECT_NOTNULL(current);
64
65 const char* system_temp = dart::bin::Directory::SystemTemp(nullptr);
66 EXPECT_NOTNULL(system_temp);
67
68 EXPECT(dart::bin::Directory::SetCurrent(nullptr, system_temp));
69
70 const char* new_current = dart::bin::Directory::Current(nullptr);
71 EXPECT_NOTNULL(new_current);
72
73 EXPECT_NOTNULL(strstr(new_current, system_temp));
74
76}
static bool SetCurrent(Namespace *namespc, const char *path)
Definition directory.cc:562

◆ TEST_CASE() [248/600]

dart::TEST_CASE ( DirectorySystemTemp  )

Definition at line 32 of file directory_test.cc.

32 {
33 const char* system_temp = dart::bin::Directory::SystemTemp(nullptr);
34 EXPECT_NOTNULL(system_temp);
35}

◆ TEST_CASE() [249/600]

dart::TEST_CASE ( DirectorySystemTempExists  )

Definition at line 37 of file directory_test.cc.

37 {
38 const char* system_temp = dart::bin::Directory::SystemTemp(nullptr);
39 EXPECT_NOTNULL(system_temp);
40
42 dart::bin::Directory::Exists(nullptr, system_temp);
43 EXPECT_EQ(dart::bin::Directory::EXISTS, r);
44}

◆ TEST_CASE() [250/600]

dart::TEST_CASE ( EvalExpression  )

Definition at line 177 of file compiler_test.cc.

177 {
178 const char* kScriptChars =
179 "int ten = 2 * 5; \n"
180 "get dot => '.'; \n"
181 "class A { \n"
182 " var apa = 'Herr Nilsson'; \n"
183 " calc(x) => '${x*ten}'; \n"
184 "} \n"
185 "makeObj() => new A(); \n";
186
187 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
188 Dart_Handle obj_handle =
189 Dart_Invoke(lib, Dart_NewStringFromCString("makeObj"), 0, nullptr);
190 EXPECT_VALID(obj_handle);
191 TransitionNativeToVM transition(thread);
192 const Object& obj = Object::Handle(Api::UnwrapHandle(obj_handle));
193 EXPECT(!obj.IsNull());
194 EXPECT(obj.IsInstance());
195
196 String& expr_text = String::Handle();
197 expr_text = String::New("apa + ' ${calc(10)}' + dot");
198 Object& val = Object::Handle();
199 const Class& receiver_cls = Class::Handle(obj.clazz());
200
201 if (!KernelIsolate::IsRunning()) {
202 UNREACHABLE();
203 } else {
204 LibraryPtr raw_library = Library::RawCast(Api::UnwrapHandle(lib));
205 Library& lib_handle = Library::ZoneHandle(raw_library);
206
207 Dart_KernelCompilationResult compilation_result =
208 KernelIsolate::CompileExpressionToKernel(
209 /*platform_kernel=*/nullptr, /*platform_kernel_size=*/0,
210 expr_text.ToCString(), Array::empty_array(), Array::empty_array(),
211 Array::empty_array(), Array::empty_array(), Array::empty_array(),
212 String::Handle(lib_handle.url()).ToCString(), "A",
213 /* method= */ nullptr,
214 /* token_pos= */ TokenPosition::kNoSource,
215 /* script_uri= */ String::Handle(lib_handle.url()).ToCString(),
216 /* is_static= */ false);
217 EXPECT_EQ(Dart_KernelCompilationStatus_Ok, compilation_result.status);
218
219 const ExternalTypedData& kernel_buffer =
220 ExternalTypedData::Handle(ExternalTypedData::NewFinalizeWithFree(
221 const_cast<uint8_t*>(compilation_result.kernel),
222 compilation_result.kernel_size));
223
224 val = Instance::Cast(obj).EvaluateCompiledExpression(
225 receiver_cls, kernel_buffer, Array::empty_array(), Array::empty_array(),
226 TypeArguments::null_type_arguments());
227 }
228 EXPECT(!val.IsNull());
229 EXPECT(!val.IsError());
230 EXPECT(val.IsString());
231 EXPECT_STREQ("Herr Nilsson 100.", val.ToCString());
232}

◆ TEST_CASE() [251/600]

dart::TEST_CASE ( FailSerializeLargeArray  )

Definition at line 472 of file snapshot_test.cc.

472 {
473 Dart_CObject root;
474 root.type = Dart_CObject_kArray;
475 root.value.as_array.length = Array::kMaxElements + 1;
476 root.value.as_array.values = nullptr;
477 ApiNativeScope scope;
478 ExpectEncodeFail(scope.zone(), &root);
479}
static void ExpectEncodeFail(Zone *zone, Dart_CObject *root)

◆ TEST_CASE() [252/600]

dart::TEST_CASE ( FailSerializeLargeExternalTypedData  )

Definition at line 515 of file snapshot_test.cc.

515 {
516 Dart_CObject root;
518 root.value.as_external_typed_data.type = Dart_TypedData_kUint8;
519 root.value.as_external_typed_data.length =
520 ExternalTypedData::MaxElements(kExternalTypedDataUint8ArrayCid) + 1;
521 ApiNativeScope scope;
522 ExpectEncodeFail(scope.zone(), &root);
523}

◆ TEST_CASE() [253/600]

dart::TEST_CASE ( FailSerializeLargeNestedArray  )

Definition at line 481 of file snapshot_test.cc.

481 {
482 Dart_CObject parent;
483 Dart_CObject child;
484 Dart_CObject* values[1] = {&child};
485
486 parent.type = Dart_CObject_kArray;
487 parent.value.as_array.length = 1;
488 parent.value.as_array.values = values;
490 child.value.as_array.length = Array::kMaxElements + 1;
491 ApiNativeScope scope;
492 ExpectEncodeFail(scope.zone(), &parent);
493}

◆ TEST_CASE() [254/600]

dart::TEST_CASE ( FailSerializeLargeTypedDataInt8  )

Definition at line 495 of file snapshot_test.cc.

495 {
496 Dart_CObject root;
497 root.type = Dart_CObject_kTypedData;
498 root.value.as_typed_data.type = Dart_TypedData_kInt8;
499 root.value.as_typed_data.length =
500 TypedData::MaxElements(kTypedDataInt8ArrayCid) + 1;
501 ApiNativeScope scope;
502 ExpectEncodeFail(scope.zone(), &root);
503}

◆ TEST_CASE() [255/600]

dart::TEST_CASE ( FailSerializeLargeTypedDataUint8  )

Definition at line 505 of file snapshot_test.cc.

505 {
506 Dart_CObject root;
507 root.type = Dart_CObject_kTypedData;
508 root.value.as_typed_data.type = Dart_TypedData_kUint8;
509 root.value.as_typed_data.length =
510 TypedData::MaxElements(kTypedDataUint8ArrayCid) + 1;
511 ApiNativeScope scope;
512 ExpectEncodeFail(scope.zone(), &root);
513}

◆ TEST_CASE() [256/600]

dart::TEST_CASE ( FailSerializeLargeUnmodifiableExternalTypedData  )

Definition at line 525 of file snapshot_test.cc.

525 {
526 Dart_CObject root;
528 root.value.as_external_typed_data.type = Dart_TypedData_kUint8;
529 root.value.as_external_typed_data.length =
530 ExternalTypedData::MaxElements(kExternalTypedDataUint8ArrayCid) + 1;
531 ApiNativeScope scope;
532 ExpectEncodeFail(scope.zone(), &root);
533}
@ Dart_CObject_kUnmodifiableExternalTypedData

◆ TEST_CASE() [257/600]

dart::TEST_CASE ( FileLength  )

Definition at line 211 of file file_test.cc.

211 {
212 const char* kFilename =
213 bin::test::GetFileName("runtime/tests/vm/data/fixed_length_file");
214 bin::File* file = bin::File::Open(nullptr, kFilename, bin::File::kRead);
215 EXPECT(file != nullptr);
216 EXPECT_EQ(42, file->Length());
217 file->Release();
218}

◆ TEST_CASE() [258/600]

dart::TEST_CASE ( FilePosition  )

Definition at line 220 of file file_test.cc.

220 {
221 char buf[42];
222 const char* kFilename =
223 bin::test::GetFileName("runtime/tests/vm/data/fixed_length_file");
224 bin::File* file = bin::File::Open(nullptr, kFilename, bin::File::kRead);
225 EXPECT(file != nullptr);
226 EXPECT(file->ReadFully(buf, 12));
227 EXPECT_EQ(12, file->Position());
228 EXPECT(file->ReadFully(buf, 6));
229 EXPECT_EQ(18, file->Position());
230 file->Release();
231}

◆ TEST_CASE() [259/600]

dart::TEST_CASE ( FreeList  )

Definition at line 84 of file freelist_test.cc.

84 {
85 FreeList* free_list = new FreeList();
86 const intptr_t kBlobSize = 1 * MB;
87 VirtualMemory* region = VirtualMemory::Allocate(
88 kBlobSize, /* is_executable */ false, /* is_compressed */ false, "test");
89
90 TestFreeList(region, free_list, false);
91
92 // Delete the memory associated with the test.
93 delete region;
94 delete free_list;
95}
static void TestFreeList(VirtualMemory *region, FreeList *free_list, bool is_protected)

◆ TEST_CASE() [260/600]

dart::TEST_CASE ( FreeListProtected  )

Definition at line 97 of file freelist_test.cc.

97 {
98 FreeList* free_list = new FreeList();
99 const intptr_t kBlobSize = 1 * MB;
100 VirtualMemory* region = VirtualMemory::Allocate(
101 kBlobSize, /*is_executable*/ false, /*is_compressed*/ false, "test");
102
103 TestFreeList(region, free_list, true);
104
105 // Delete the memory associated with the test.
106 delete region;
107 delete free_list;
108}

◆ TEST_CASE() [261/600]

dart::TEST_CASE ( FreeListProtectedTinyObjects  )

Definition at line 110 of file freelist_test.cc.

110 {
111 FreeList* free_list = new FreeList();
112 const intptr_t kBlobSize = 1 * MB;
113 const intptr_t kObjectSize = 2 * kWordSize;
114 uword* objects = new uword[kBlobSize / kObjectSize];
115
116 VirtualMemory* blob = VirtualMemory::Allocate(
117 kBlobSize, /*is_executable*/ false, /*is_compressed*/ false, "test");
118 ASSERT(Utils::IsAligned(blob->start(), 4096));
119 blob->Protect(VirtualMemory::kReadWrite);
120
121 // Enqueue the large blob as one free block.
122 free_list->Free(blob->start(), blob->size());
123
124 // Write protect the whole region.
125 blob->Protect(VirtualMemory::kReadExecute);
126
127 // Allocate small objects.
128 for (intptr_t i = 0; i < blob->size() / kObjectSize; i++) {
129 objects[i] = Allocate(free_list, kObjectSize, true); // is_protected
130 }
131
132 // All space is occupied. Expect failed allocation.
133 ASSERT(Allocate(free_list, kObjectSize, true) == 0);
134
135 // Free all objects again. Make the whole region writable for this.
136 blob->Protect(VirtualMemory::kReadWrite);
137 for (intptr_t i = 0; i < blob->size() / kObjectSize; i++) {
138 free_list->Free(objects[i], kObjectSize);
139 }
140
141 // Delete the memory associated with the test.
142 delete blob;
143 delete free_list;
144 delete[] objects;
145}
static void Protect(void *address, intptr_t size, Protection mode)
intptr_t size() const
uword start() const
static uword Allocate(FreeList *free_list, intptr_t size, bool is_protected)

◆ TEST_CASE() [262/600]

dart::TEST_CASE ( FreeListProtectedVariableSizeObjects  )

Definition at line 147 of file freelist_test.cc.

147 {
148 FreeList* free_list = new FreeList();
149 const intptr_t kBlobSize = 16 * KB;
150 ASSERT(kBlobSize >= VirtualMemory::PageSize());
151 const intptr_t kMinSize = 2 * kWordSize;
152 uword* objects = new uword[kBlobSize / kMinSize];
153 for (intptr_t i = 0; i < kBlobSize / kMinSize; ++i) {
154 objects[i] = 0;
155 }
156
157 VirtualMemory* blob = VirtualMemory::Allocate(
158 kBlobSize, /*is_executable*/ false, /*is_compressed*/ false, "test");
159 blob->Protect(VirtualMemory::kReadWrite);
160
161 // Enqueue the large blob as one free block.
162 free_list->Free(blob->start(), blob->size());
163
164 // Write protect the whole region.
165 blob->Protect(VirtualMemory::kReadOnly);
166
167 // Allocate and free objects so that free list has > 1 elements.
168 uword e0 = Allocate(free_list, 2 * KB, true);
169 ASSERT(e0);
170 uword e1 = Allocate(free_list, 6 * KB, true);
171 ASSERT(e1);
172 uword e2 = Allocate(free_list, 4 * KB, true);
173 ASSERT(e2);
174 uword e3 = Allocate(free_list, 4 * KB, true);
175 ASSERT(e3);
176
177 Free(free_list, e1, 6 * KB, true);
178 Free(free_list, e2, 4 * KB, true);
179 e0 = Allocate(free_list, 6 * KB - 2 * kWordSize, true);
180 ASSERT(e0);
181
182 // Delete the memory associated with the test.
183 delete blob;
184 delete free_list;
185 delete[] objects;
186}
float e0

◆ TEST_CASE() [263/600]

dart::TEST_CASE ( FunctionSourceFingerprint  )

Definition at line 5507 of file object_test.cc.

5507 {
5508 const char* kScriptChars =
5509 "class A {\n"
5510 " static test1(int a) {\n"
5511 " return a > 1 ? a + 1 : a;\n"
5512 " }\n"
5513 " static test2(a) {\n"
5514 " return a > 1 ? a + 1 : a;\n"
5515 " }\n"
5516 " static test3(b) {\n"
5517 " return b > 1 ? b + 1 : b;\n"
5518 " }\n"
5519 " static test4(b) {\n"
5520 " return b > 1 ? b - 1 : b;\n"
5521 " }\n"
5522 " static test5(b) {\n"
5523 " return b > 1 ? b - 2 : b;\n"
5524 " }\n"
5525 " test6(int a) {\n"
5526 " return a > 1 ? a + 1 : a;\n"
5527 " }\n"
5528 "}\n"
5529 "class B {\n"
5530 " static /* Different declaration style. */\n"
5531 " test1(int a) {\n"
5532 " /* Returns a + 1 for a > 1, a otherwise. */\n"
5533 " return a > 1 ?\n"
5534 " a + 1 :\n"
5535 " a;\n"
5536 " }\n"
5537 " static test5(b) {\n"
5538 " return b > 1 ?\n"
5539 " b - 2 : b;\n"
5540 " }\n"
5541 " test6(int a) {\n"
5542 " return a > 1 ? a + 1 : a;\n"
5543 " }\n"
5544 "}";
5545 TestCase::LoadTestScript(kScriptChars, nullptr);
5546 TransitionNativeToVM transition(thread);
5547 EXPECT(ClassFinalizer::ProcessPendingClasses());
5548 const String& name = String::Handle(String::New(TestCase::url()));
5549 const Library& lib = Library::Handle(Library::LookupLibrary(thread, name));
5550 EXPECT(!lib.IsNull());
5551
5552 const Class& class_a =
5553 Class::Handle(lib.LookupClass(String::Handle(Symbols::New(thread, "A"))));
5554 const Class& class_b =
5555 Class::Handle(lib.LookupClass(String::Handle(Symbols::New(thread, "B"))));
5556 const Function& a_test1 =
5557 Function::Handle(GetStaticFunction(class_a, "test1"));
5558 const Function& b_test1 =
5559 Function::Handle(GetStaticFunction(class_b, "test1"));
5560 const Function& a_test2 =
5561 Function::Handle(GetStaticFunction(class_a, "test2"));
5562 const Function& a_test3 =
5563 Function::Handle(GetStaticFunction(class_a, "test3"));
5564 const Function& a_test4 =
5565 Function::Handle(GetStaticFunction(class_a, "test4"));
5566 const Function& a_test5 =
5567 Function::Handle(GetStaticFunction(class_a, "test5"));
5568 const Function& b_test5 =
5569 Function::Handle(GetStaticFunction(class_b, "test5"));
5570 const Function& a_test6 = Function::Handle(GetFunction(class_a, "test6"));
5571 const Function& b_test6 = Function::Handle(GetFunction(class_b, "test6"));
5572
5573 EXPECT_EQ(a_test1.SourceFingerprint(), b_test1.SourceFingerprint());
5574 EXPECT_NE(a_test1.SourceFingerprint(), a_test2.SourceFingerprint());
5575 EXPECT_NE(a_test2.SourceFingerprint(), a_test3.SourceFingerprint());
5576 EXPECT_NE(a_test3.SourceFingerprint(), a_test4.SourceFingerprint());
5577 EXPECT_NE(a_test4.SourceFingerprint(), a_test5.SourceFingerprint());
5578 EXPECT_EQ(a_test5.SourceFingerprint(), b_test5.SourceFingerprint());
5579 // Although a_test6's receiver type is different than b_test6's receiver type,
5580 // the fingerprints are identical. The token stream does not reflect the
5581 // receiver's type. This is not a problem, since we recognize functions
5582 // of a given class and of a given name.
5583 EXPECT_EQ(a_test6.SourceFingerprint(), b_test6.SourceFingerprint());
5584}
int32_t SourceFingerprint() const
Definition object.cc:11227
static FunctionPtr GetStaticFunction(const Class &cls, const char *name)

◆ TEST_CASE() [264/600]

dart::TEST_CASE ( FunctionWithBreakpointNotInlined  )

Definition at line 5588 of file object_test.cc.

5588 {
5589 const char* kScriptChars =
5590 "class A {\n"
5591 " a() {\n"
5592 " }\n"
5593 " b() {\n"
5594 " a();\n" // This is line 5.
5595 " }\n"
5596 "}\n"
5597 "test() {\n"
5598 " new A().b();\n"
5599 "}";
5600 const int kBreakpointLine = 5;
5601 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
5602 EXPECT_VALID(lib);
5603
5604 // Run function A.b one time.
5605 Dart_Handle result = Dart_Invoke(lib, NewString("test"), 0, nullptr);
5607
5608 // With no breakpoint, function A.b is inlineable.
5609 {
5610 TransitionNativeToVM transition(thread);
5611 const String& name = String::Handle(String::New(TestCase::url()));
5612 const Library& vmlib =
5613 Library::Handle(Library::LookupLibrary(thread, name));
5614 EXPECT(!vmlib.IsNull());
5615 const Class& class_a = Class::Handle(
5616 vmlib.LookupClass(String::Handle(Symbols::New(thread, "A"))));
5617 Function& func_b = Function::Handle(GetFunction(class_a, "b"));
5618 EXPECT(func_b.CanBeInlined());
5619 }
5620
5621 result = Dart_SetBreakpoint(NewString(TestCase::url()), kBreakpointLine);
5623
5624 // After setting a breakpoint in a function A.b, it is no longer inlineable.
5625 {
5626 TransitionNativeToVM transition(thread);
5627 const String& name = String::Handle(String::New(TestCase::url()));
5628 const Library& vmlib =
5629 Library::Handle(Library::LookupLibrary(thread, name));
5630 EXPECT(!vmlib.IsNull());
5631 const Class& class_a = Class::Handle(
5632 vmlib.LookupClass(String::Handle(Symbols::New(thread, "A"))));
5633 Function& func_b = Function::Handle(GetFunction(class_a, "b"));
5634 EXPECT(!func_b.CanBeInlined());
5635 }
5636}
bool CanBeInlined() const
Definition object.cc:9257

◆ TEST_CASE() [265/600]

dart::TEST_CASE ( GrowableArray  )

Definition at line 68 of file growable_array_test.cc.

68 {
69 TestGrowableArray<GrowableArray<int>, GrowableArray<int64_t> >();
70}

◆ TEST_CASE() [266/600]

dart::TEST_CASE ( GrowableArrayMoveAssign  )

Definition at line 126 of file growable_array_test.cc.

126 {
128 a.Add(1);
129 a.Add(2);
130 a.Add(3);
131 b.Add(7);
132 int* a_data = a.data();
133 int* b_data = b.data();
134
135 a = std::move(b);
136
137 EXPECT_EQ(1, a.length());
138 EXPECT_EQ(b_data, a.data());
139 EXPECT_EQ(3, b.length());
140 EXPECT_EQ(a_data, b.data());
141}

◆ TEST_CASE() [267/600]

dart::TEST_CASE ( GrowableArrayMoveCtor  )

Definition at line 112 of file growable_array_test.cc.

112 {
114 a.Add(4);
115 a.Add(5);
116 int* a_data = a.data();
117
118 GrowableArray<int> b(std::move(a));
119
120 EXPECT_EQ(0, a.length());
121 EXPECT_EQ((int*)nullptr, a.data());
122 EXPECT_EQ(2, b.length());
123 EXPECT_EQ(a_data, b.data());
124}

◆ TEST_CASE() [268/600]

dart::TEST_CASE ( GrowableArraySort  )

Definition at line 86 of file growable_array_test.cc.

86 {
88 g.Add(12);
89 g.Add(4);
90 g.Add(64);
91 g.Add(8);
92 g.Sort(greatestFirst);
93 EXPECT_EQ(64, g[0]);
94 EXPECT_EQ(4, g.Last());
95}
void Sort(int compare(const T *, const T *))

◆ TEST_CASE() [269/600]

dart::TEST_CASE ( GuardFieldConstructor2Test  )

Definition at line 245 of file guard_field_test.cc.

245 {
246 const char* script_chars =
247 "import 'dart:typed_data';\n"
248 "class A {\n"
249 " final f3;\n"
250 " A(x) : f3 = x;\n"
251 " foo() {\n"
252 " }\n"
253 " bar() {\n"
254 " }\n"
255 "}\n"
256 "\n"
257 "runFoo() {\n"
258 " var l = new Float32List(5);\n"
259 " for (int i = 0; i < 2000; i++) {\n"
260 " var a = new A(l);\n"
261 " }\n"
262 "}\n"
263 "\n"
264 "runBar() {\n"
265 " var l = new Float32List(99);\n"
266 " var a = new A(l);\n"
267 "}\n"
268 "main() {\n"
269 " for (int i = 0; i < 100; i++) {\n"
270 " runFoo();\n"
271 " runBar();\n"
272 " }\n"
273 "}\n";
274 Dart_Handle lib = TestCase::LoadTestScript(script_chars, nullptr);
275 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, nullptr);
277 TransitionNativeToVM transition(thread);
278 Field& f3 = Field::ZoneHandle(LookupField(lib, "A", "f3"));
279 const intptr_t no_length = Field::kNoFixedLength;
280 EXPECT_EQ(no_length, f3.guarded_list_length());
281 EXPECT_EQ(kTypedDataFloat32ArrayCid, f3.guarded_cid());
282 EXPECT_EQ(false, f3.is_nullable());
283}
bool is_nullable() const
Definition object.cc:11821
intptr_t guarded_cid() const
Definition object.cc:11800
intptr_t guarded_list_length() const
Definition object.cc:12152
FieldPtr LookupField(Dart_Handle library, const char *class_name, const char *field_name)

◆ TEST_CASE() [270/600]

dart::TEST_CASE ( GuardFieldConstructorTest  )

Definition at line 187 of file guard_field_test.cc.

187 {
188 const char* script_chars =
189 "import 'dart:typed_data';\n"
190 "class A {\n"
191 " var f1 = 3.0;\n"
192 " dynamic f2 = 3;\n"
193 " final f3;\n"
194 " A(x) : f3 = x;\n"
195 " foo() {\n"
196 " f1 = f1 + f1;\n"
197 " }\n"
198 " bar() {\n"
199 " f2 = null;\n"
200 " f2 = 3.0;\n"
201 " }\n"
202 "}\n"
203 "\n"
204 "runFoo() {\n"
205 " var l = new Float32List(5);\n"
206 " for (int i = 0; i < 2000; i++) {\n"
207 " var a = new A(l);\n"
208 " a.foo();\n"
209 " }\n"
210 "}\n"
211 "\n"
212 "runBar() {\n"
213 " var l = new Float32List(5);\n"
214 " var a = new A(l);\n"
215 " for (int i = 0; i < 2000; i++) {\n"
216 " a.bar();\n"
217 " }\n"
218 "}\n"
219 "main() {\n"
220 " for (int i = 0; i < 100; i++) {\n"
221 " runFoo();\n"
222 " runBar();\n"
223 " }\n"
224 "}\n";
225 Dart_Handle lib = TestCase::LoadTestScript(script_chars, nullptr);
226 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, nullptr);
228 TransitionNativeToVM transition(thread);
229 Field& f1 = Field::ZoneHandle(LookupField(lib, "A", "f1"));
230 Field& f2 = Field::ZoneHandle(LookupField(lib, "A", "f2"));
231 Field& f3 = Field::ZoneHandle(LookupField(lib, "A", "f3"));
232 const intptr_t no_length = Field::kNoFixedLength;
233 EXPECT_EQ(no_length, f1.guarded_list_length());
234 EXPECT_EQ(kDoubleCid, f1.guarded_cid());
235 EXPECT_EQ(false, f1.is_nullable());
236 EXPECT_EQ(no_length, f2.guarded_list_length());
237 EXPECT_EQ(kDynamicCid, f2.guarded_cid());
238 EXPECT_EQ(true, f2.is_nullable());
239 const intptr_t length = 5;
240 EXPECT_EQ(length, f3.guarded_list_length());
241 EXPECT_EQ(kTypedDataFloat32ArrayCid, f3.guarded_cid());
242 EXPECT_EQ(false, f3.is_nullable());
243}

◆ TEST_CASE() [271/600]

dart::TEST_CASE ( GuardFieldFinalListTest  )

Definition at line 81 of file guard_field_test.cc.

81 {
82 const char* script_chars =
83 "class A {\n"
84 " var f1 = 3.0;\n"
85 " dynamic f2 = 3;\n"
86 " final f3 = List<dynamic>.filled(4, null);\n"
87 " foo() {\n"
88 " f1 = f1 + f1;\n"
89 " }\n"
90 " bar() {\n"
91 " f2 = null;\n"
92 " f2 = 3.0;\n"
93 " }\n"
94 "}\n"
95 "\n"
96 "runFoo() {\n"
97 " var a = A();\n"
98 " for (int i = 0; i < 2000; i++) {\n"
99 " a.foo();\n"
100 " }\n"
101 "}\n"
102 "\n"
103 "runBar() {\n"
104 " var a = A();\n"
105 " for (int i = 0; i < 2000; i++) {\n"
106 " a.bar();\n"
107 " }\n"
108 "}\n"
109 "main() {\n"
110 " for (int i = 0; i < 100; i++) {\n"
111 " runFoo();\n"
112 " runBar();\n"
113 " }\n"
114 "}\n";
115 Dart_Handle lib = TestCase::LoadTestScript(script_chars, nullptr);
116 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, nullptr);
118 TransitionNativeToVM transition(thread);
119 Field& f1 = Field::ZoneHandle(LookupField(lib, "A", "f1"));
120 Field& f2 = Field::ZoneHandle(LookupField(lib, "A", "f2"));
121 Field& f3 = Field::ZoneHandle(LookupField(lib, "A", "f3"));
122 const intptr_t no_length = Field::kNoFixedLength;
123 EXPECT_EQ(no_length, f1.guarded_list_length());
124 EXPECT_EQ(kDoubleCid, f1.guarded_cid());
125 EXPECT_EQ(false, f1.is_nullable());
126 EXPECT_EQ(no_length, f2.guarded_list_length());
127 EXPECT_EQ(kDynamicCid, f2.guarded_cid());
128 EXPECT_EQ(true, f2.is_nullable());
129 EXPECT_EQ(4, f3.guarded_list_length());
130 EXPECT_EQ(kArrayCid, f3.guarded_cid());
131 EXPECT_EQ(false, f3.is_nullable());
132}

◆ TEST_CASE() [272/600]

dart::TEST_CASE ( GuardFieldFinalVariableLengthListTest  )

Definition at line 134 of file guard_field_test.cc.

134 {
135 const char* script_chars =
136 "class A {\n"
137 " var f1 = 3.0;\n"
138 " dynamic f2 = 3;\n"
139 " final f3 = List.empty(growable: true);\n"
140 " foo() {\n"
141 " f1 = f1 + f1;\n"
142 " }\n"
143 " bar() {\n"
144 " f2 = null;\n"
145 " f2 = 3.0;\n"
146 " }\n"
147 "}\n"
148 "\n"
149 "runFoo() {\n"
150 " var a = A();\n"
151 " for (int i = 0; i < 2000; i++) {\n"
152 " a.foo();\n"
153 " }\n"
154 "}\n"
155 "\n"
156 "runBar() {\n"
157 " var a = A();\n"
158 " for (int i = 0; i < 2000; i++) {\n"
159 " a.bar();\n"
160 " }\n"
161 "}\n"
162 "main() {\n"
163 " for (int i = 0; i < 100; i++) {\n"
164 " runFoo();\n"
165 " runBar();\n"
166 " }\n"
167 "}\n";
168 Dart_Handle lib = TestCase::LoadTestScript(script_chars, nullptr);
169 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, nullptr);
171 TransitionNativeToVM transition(thread);
172 Field& f1 = Field::ZoneHandle(LookupField(lib, "A", "f1"));
173 Field& f2 = Field::ZoneHandle(LookupField(lib, "A", "f2"));
174 Field& f3 = Field::ZoneHandle(LookupField(lib, "A", "f3"));
175 const intptr_t no_length = Field::kNoFixedLength;
176 EXPECT_EQ(no_length, f1.guarded_list_length());
177 EXPECT_EQ(kDoubleCid, f1.guarded_cid());
178 EXPECT_EQ(false, f1.is_nullable());
179 EXPECT_EQ(no_length, f2.guarded_list_length());
180 EXPECT_EQ(kDynamicCid, f2.guarded_cid());
181 EXPECT_EQ(true, f2.is_nullable());
182 EXPECT_EQ(no_length, f3.guarded_list_length());
183 EXPECT_EQ(kGrowableObjectArrayCid, f3.guarded_cid());
184 EXPECT_EQ(false, f3.is_nullable());
185}

◆ TEST_CASE() [273/600]

dart::TEST_CASE ( GuardFieldSimpleTest  )

Definition at line 30 of file guard_field_test.cc.

30 {
31 const char* script_chars =
32 "class A {\n"
33 " var f1 = 3.0;\n"
34 " dynamic f2 = 3;\n"
35 " var f3 = List<dynamic>.filled(4, null);\n"
36 " foo() {\n"
37 " f1 = f1 + f1;\n"
38 " }\n"
39 " bar() {\n"
40 " f2 = null;\n"
41 " f2 = 3.0;\n"
42 " }\n"
43 "}\n"
44 "\n"
45 "runFoo() {\n"
46 " var a = A();\n"
47 " for (int i = 0; i < 2000; i++) {\n"
48 " a.foo();\n"
49 " }\n"
50 "}\n"
51 "\n"
52 "runBar() {\n"
53 " var a = A();\n"
54 " for (int i = 0; i < 2000; i++) {\n"
55 " a.bar();\n"
56 " }\n"
57 "}\n"
58 "main() {\n"
59 " for (int i = 0; i < 100; i++) {\n"
60 " runFoo();\n"
61 " runBar();\n"
62 " }\n"
63 "}\n";
64 Dart_Handle lib = TestCase::LoadTestScript(script_chars, nullptr);
65 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, nullptr);
67 TransitionNativeToVM transition(thread);
68 Field& f1 = Field::ZoneHandle(LookupField(lib, "A", "f1"));
69 Field& f2 = Field::ZoneHandle(LookupField(lib, "A", "f2"));
70 Field& f3 = Field::ZoneHandle(LookupField(lib, "A", "f3"));
71 const intptr_t no_length = Field::kNoFixedLength;
72 EXPECT_EQ(no_length, f1.guarded_list_length());
73 EXPECT_EQ(kDoubleCid, f1.guarded_cid());
74 EXPECT_EQ(false, f1.is_nullable());
75 EXPECT_EQ(no_length, f2.guarded_list_length());
76 EXPECT_EQ(kDynamicCid, f2.guarded_cid());
77 EXPECT_EQ(true, f2.is_nullable());
78 EXPECT_EQ(no_length, f3.guarded_list_length());
79}

◆ TEST_CASE() [274/600]

dart::TEST_CASE ( HashCode  )

Definition at line 6423 of file object_test.cc.

6434 {
6435 // Ensure C++ overrides of Instance::HashCode match the Dart implementations.
6436 const char* kScript =
6437 "foo() {\n"
6438 " return \"foo\".hashCode;\n"
6439 "}";
6440
6441 Dart_Handle h_lib = TestCase::LoadTestScript(kScript, nullptr);
6442 EXPECT_VALID(h_lib);

◆ TEST_CASE() [275/600]

dart::TEST_CASE ( HashCode_Double  )

Definition at line 6528 of file object_test.cc.

6539 {
6540 const char* kScript =
6541 "value() {\n"
6542 " return 1.0;\n"
6543 "}\n";

◆ TEST_CASE() [276/600]

dart::TEST_CASE ( HashCode_Mint  )

Definition at line 6545 of file object_test.cc.

6549 {
6550 TransitionNativeToVM transition(thread);
6551 kInt1HashCode = Integer::Handle(Integer::New(1)).CanonicalizeHash();

◆ TEST_CASE() [277/600]

dart::TEST_CASE ( HashCode_Null  )

Definition at line 6553 of file object_test.cc.

6556 {
6557 const char* kScript =
6558 "value() {\n"
6559 " return 0x8000000;\n"

◆ TEST_CASE() [278/600]

dart::TEST_CASE ( HashCode_Smi  )

Definition at line 6561 of file object_test.cc.

6564 {
6565 const char* kScript =
6566 "value() {\n"
6567 " return null;\n"

◆ TEST_CASE() [279/600]

dart::TEST_CASE ( HashCode_String  )

Definition at line 6569 of file object_test.cc.

6572 {
6573 const char* kScript =
6574 "value() {\n"
6575 " return 123;\n"

◆ TEST_CASE() [280/600]

dart::TEST_CASE ( HashCode_Symbol  )

Definition at line 6577 of file object_test.cc.

6580 {
6581 const char* kScript =
6582 "value() {\n"
6583 " return 'asdf';\n"
6584 "}\n";

◆ TEST_CASE() [281/600]

dart::TEST_CASE ( HashCode_True  )

Definition at line 6586 of file object_test.cc.

6588 {
6589 const char* kScript =
6590 "value() {\n"
6591 " return #A;\n"
6592 "}\n";

◆ TEST_CASE() [282/600]

dart::TEST_CASE ( HashCode_Type_Dynamic  )

Definition at line 6594 of file object_test.cc.

6597 {
6598 const char* kScript =
6599 "value() {\n"
6600 " return true;\n"
6601 "}\n";
6603}
static bool HashCodeEqualsCanonicalizeHash(const char *value_script, uint32_t hashcode_canonicalize_vm=kCalculateCanonicalizeHash, bool check_identity=true, bool check_hashcode=true)

◆ TEST_CASE() [283/600]

dart::TEST_CASE ( HashCode_Type_Int  )

Definition at line 6605 of file object_test.cc.

6605 {
6606 const char* kScript =
6607 "const type = dynamic;\n"
6608 "\n"
6609 "value() {\n"
6610 " return type;\n"
6611 "}\n";
6612 EXPECT(HashCodeEqualsCanonicalizeHash(kScript, kCalculateCanonicalizeHash,
6613 /*check_identity=*/false));
6614}

◆ TEST_CASE() [284/600]

dart::TEST_CASE ( ImplementorCid  )

Definition at line 5181 of file object_test.cc.

5181 {
5182 const char* kScriptChars = R"(
5183abstract class AInterface {}
5184
5185abstract class BInterface {}
5186class BImplementation implements BInterface {}
5187
5188abstract class CInterface {}
5189class CImplementation1 implements CInterface {}
5190class CImplementation2 implements CInterface {}
5191
5192abstract class DInterface {}
5193abstract class DSubinterface implements DInterface {}
5194
5195abstract class EInterface {}
5196abstract class ESubinterface implements EInterface {}
5197class EImplementation implements ESubinterface {}
5198
5199abstract class FInterface {}
5200abstract class FSubinterface implements FInterface {}
5201class FImplementation1 implements FSubinterface {}
5202class FImplementation2 implements FSubinterface {}
5203
5204main() {
5205 new BImplementation();
5206 new CImplementation1();
5207 new CImplementation2();
5208 new EImplementation();
5209 new FImplementation1();
5210 new FImplementation2();
5211}
5212)";
5213 Dart_Handle h_lib = TestCase::LoadTestScript(kScriptChars, nullptr);
5214 EXPECT_VALID(h_lib);
5215 Dart_Handle result = Dart_Invoke(h_lib, NewString("main"), 0, nullptr);
5217
5218 TransitionNativeToVM transition(thread);
5219 const Library& lib =
5220 Library::CheckedHandle(thread->zone(), Api::UnwrapHandle(h_lib));
5221 EXPECT(!lib.IsNull());
5222
5223 const Class& AInterface = Class::Handle(GetClass(lib, "AInterface"));
5224 EXPECT_EQ(AInterface.implementor_cid(), kIllegalCid);
5225
5226 const Class& BInterface = Class::Handle(GetClass(lib, "BInterface"));
5227 const Class& BImplementation =
5228 Class::Handle(GetClass(lib, "BImplementation"));
5229 EXPECT_EQ(BInterface.implementor_cid(), BImplementation.id());
5230 EXPECT_EQ(BImplementation.implementor_cid(), BImplementation.id());
5231
5232 const Class& CInterface = Class::Handle(GetClass(lib, "CInterface"));
5233 const Class& CImplementation1 =
5234 Class::Handle(GetClass(lib, "CImplementation1"));
5235 const Class& CImplementation2 =
5236 Class::Handle(GetClass(lib, "CImplementation2"));
5237 EXPECT_EQ(CInterface.implementor_cid(), kDynamicCid);
5238 EXPECT_EQ(CImplementation1.implementor_cid(), CImplementation1.id());
5239 EXPECT_EQ(CImplementation2.implementor_cid(), CImplementation2.id());
5240
5241 const Class& DInterface = Class::Handle(GetClass(lib, "DInterface"));
5242 const Class& DSubinterface = Class::Handle(GetClass(lib, "DSubinterface"));
5243 EXPECT_EQ(DInterface.implementor_cid(), kIllegalCid);
5244 EXPECT_EQ(DSubinterface.implementor_cid(), kIllegalCid);
5245
5246 const Class& EInterface = Class::Handle(GetClass(lib, "EInterface"));
5247 const Class& ESubinterface = Class::Handle(GetClass(lib, "ESubinterface"));
5248 const Class& EImplementation =
5249 Class::Handle(GetClass(lib, "EImplementation"));
5250 EXPECT_EQ(EInterface.implementor_cid(), EImplementation.id());
5251 EXPECT_EQ(ESubinterface.implementor_cid(), EImplementation.id());
5252 EXPECT_EQ(EImplementation.implementor_cid(), EImplementation.id());
5253
5254 const Class& FInterface = Class::Handle(GetClass(lib, "FInterface"));
5255 const Class& FSubinterface = Class::Handle(GetClass(lib, "FSubinterface"));
5256 const Class& FImplementation1 =
5257 Class::Handle(GetClass(lib, "FImplementation1"));
5258 const Class& FImplementation2 =
5259 Class::Handle(GetClass(lib, "FImplementation2"));
5260 EXPECT_EQ(FInterface.implementor_cid(), kDynamicCid);
5261 EXPECT_EQ(FSubinterface.implementor_cid(), kDynamicCid);
5262 EXPECT_EQ(FImplementation1.implementor_cid(), FImplementation1.id());
5263 EXPECT_EQ(FImplementation2.implementor_cid(), FImplementation2.id());
5264}
intptr_t implementor_cid() const
Definition object.h:1247

◆ TEST_CASE() [285/600]

dart::TEST_CASE ( Inliner_InlineAndRunForceOptimized  )

Definition at line 548 of file inliner_test.cc.

548 {
549 auto check_handle = [](Dart_Handle handle) {
550 if (Dart_IsError(handle)) {
551 OS::PrintErr("Encountered unexpected error: %s\n", Dart_GetError(handle));
552 FATAL("Aborting");
553 }
554 return handle;
555 };
556
557 auto get_integer = [&](Dart_Handle lib, const char* name) {
558 Dart_Handle handle = Dart_GetField(lib, check_handle(NewString(name)));
559 check_handle(handle);
560
561 int64_t value = 0;
562 handle = Dart_IntegerToInt64(handle, &value);
563 check_handle(handle);
564 OS::Print("Field '%s': %" Pd64 "\n", name, value);
565 return value;
566 };
567
568 const char* kScriptChars = R"(
569import 'dart:ffi';
570import 'dart:_internal';
571
572int _add(int a, int b) => a + b;
573
574@pragma('vm:external-name', "testPrint")
575external void print(String s);
576
577@pragma("vm:external-name", "InspectStack")
578external InspectStack();
579
580@pragma('vm:never-inline')
581void nop() {}
582
583int prologueCount = 0;
584int epilogueCount = 0;
585
586@pragma('vm:never-inline')
587void countPrologue() {
588 prologueCount++;
589 print('countPrologue: $prologueCount');
590}
591
592@pragma('vm:never-inline')
593void countEpilogue() {
594 epilogueCount++;
595 print('countEpilogue: $epilogueCount');
596}
597
598@pragma('vm:force-optimize')
599@pragma('vm:idempotent')
600@pragma('vm:prefer-inline')
601int idempotentForceOptimizedFunction(int x) {
602 countPrologue();
603 print('deoptimizing');
604
605 InspectStack();
606 VMInternalsForTesting.deoptimizeFunctionsOnStack();
607 InspectStack();
608 print('deoptimizing after');
609 countEpilogue();
610 return _add(x, 1);
611}
612
613@pragma('vm:never-inline')
614int foo(int x, {bool onlyOptimizeFunction = false}) {
615 if (onlyOptimizeFunction) {
616 print('Optimizing `foo`');
617 for (int i = 0; i < 100000; i++) nop();
618 }
619 print('Running `foo`');
620 return x + idempotentForceOptimizedFunction(x+1) + 1;
621}
622
623void main() {
624 for (int i = 0; i < 100; i++) {
625 print('\n\nround=$i');
626
627 // Get the `foo` function optimized while leaving prologue/epilogue counters
628 // untouched.
629 final (a, b) = (prologueCount, epilogueCount);
630 foo(i, onlyOptimizeFunction: true);
631 prologueCount = a;
632 epilogueCount = b;
633
634 // Execute the optimized function `foo` function (which has the
635 // `idempotentForceOptimizedFunction` inlined).
636 final result = foo(i);
637 if (result != (2 * i + 3)) throw 'Expected ${2 * i + 3} but got $result!';
638 }
639}
640 )";
641 DisableBackgroundCompilationScope scope;
642
643 Dart_Handle lib =
644 check_handle(TestCase::LoadTestScript(kScriptChars, nullptr));
645 Dart_SetNativeResolver(lib, &PrintAndInspectResolver, nullptr);
646
647 // We disable OSR to ensure we control when the function gets optimized,
648 // namely afer a call to `foo(..., onlyOptimizeFunction:true)` it will be
649 // optimized and during a call to `foo(...)` it will get deoptimized.
650 IsolateGroup::Current()->set_use_osr(false);
651
652 // Run the test.
653 check_handle(Dart_Invoke(lib, NewString("main"), 0, nullptr));
654
655 // Examine the result.
656 const int64_t prologue_count = get_integer(lib, "prologueCount");
657 const int64_t epilogue_count = get_integer(lib, "epilogueCount");
658
659 // We always call the "foo" function when its optimized (and it's optimized
660 // code has the call to `idempotentForceOptimizedFunction` inlined).
661 //
662 // The `idempotentForceOptimizedFunction` will always execute prologue,
663 // lazy-deoptimize the `foo` frame, that will make the `foo` re-try the call
664 // to `idempotentForceOptimizedFunction`.
665 // = > We should see the prologue of the force-optimized function to be
666 // executed twice as many times as epilogue.
667 EXPECT_EQ(epilogue_count * 2, prologue_count);
668}

◆ TEST_CASE() [286/600]

dart::TEST_CASE ( InstanceEquality  )

Definition at line 6394 of file object_test.cc.

6396 {\"type\":\"Sentinel\","
6397 "\"kind\":\"BeingInitialized\","
6398 "\"valueAsString\":\"<being initialized>\"}",
6399 js.ToCString());
6400 }
6401}
6402
6403#endif // !PRODUCT
6404
6405TEST_CASE(InstanceEquality) {
6406 // Test that Instance::OperatorEquals can call a user-defined operator==.
6407 const char* kScript =
6408 "class A {\n"
6409 " bool operator==(covariant A other) { return true; }\n"
6410 "}\n"
6411 "main() {\n"
6412 " A a = new A();\n"
6413 "}";
6414
6415 Dart_Handle h_lib = TestCase::LoadTestScript(kScript, nullptr);
6416 EXPECT_VALID(h_lib);
6417 Dart_Handle result = Dart_Invoke(h_lib, NewString("main"), 0, nullptr);
6419
6420 TransitionNativeToVM transition(thread);
6421 Library& lib = Library::Handle();

◆ TEST_CASE() [287/600]

dart::TEST_CASE ( Int8ListLengthMaxElements  )

Definition at line 1971 of file object_test.cc.

1971 {
1972 const intptr_t max_elements = TypedData::MaxElements(kTypedDataInt8ArrayCid);
1973 char buffer[1024];
1974 Utils::SNPrint(buffer, sizeof(buffer),
1975 "import 'dart:typed_data';\n"
1976 "main() {\n"
1977 " return new Int8List(%" Pd
1978 ");\n"
1979 "}\n",
1980 max_elements);
1981 Dart_Handle lib = TestCase::LoadTestScript(buffer, nullptr);
1982 EXPECT_VALID(lib);
1983 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, nullptr);
1984 if (Dart_IsError(result)) {
1985 EXPECT_ERROR(result, "Out of Memory");
1986 } else {
1987 intptr_t actual = 0;
1989 EXPECT_EQ(max_elements, actual);
1990 }
1991}

◆ TEST_CASE() [288/600]

dart::TEST_CASE ( Int8ListLengthNegativeOne  )

Definition at line 1946 of file object_test.cc.

1946 {
1947 TestIllegalTypedDataLength("Int8List", -1);
1948}
static void TestIllegalTypedDataLength(const char *class_name, intptr_t length)

◆ TEST_CASE() [289/600]

dart::TEST_CASE ( Int8ListLengthOneTooMany  )

Definition at line 1952 of file object_test.cc.

1952 {
1953 const intptr_t kOneTooMany =
1954 TypedData::MaxElements(kTypedDataInt8ArrayCid) + 1;
1955 ASSERT(kOneTooMany >= 0);
1956
1957 char buffer[1024];
1958 Utils::SNPrint(buffer, sizeof(buffer),
1959 "import 'dart:typed_data';\n"
1960 "main() {\n"
1961 " return new Int8List(%" Pd
1962 ");\n"
1963 "}\n",
1964 kOneTooMany);
1965 Dart_Handle lib = TestCase::LoadTestScript(buffer, nullptr);
1966 EXPECT_VALID(lib);
1967 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, nullptr);
1968 EXPECT_ERROR(result, "Out of Memory");
1969}

◆ TEST_CASE() [290/600]

dart::TEST_CASE ( Int8ListLengthSmiMin  )

Definition at line 1949 of file object_test.cc.

1949 {
1950 TestIllegalTypedDataLength("Int8List", kSmiMin);
1951}

◆ TEST_CASE() [291/600]

dart::TEST_CASE ( IsIsolateUnsendable  )

Definition at line 5145 of file object_test.cc.

5145 {
5146 Zone* const zone = Thread::Current()->zone();
5147
5148 const char* kScript = R"(
5149import 'dart:ffi';
5150
5151class AImpl implements A {}
5152class ASub extends A {}
5153// Wonky class order and non-alphabetic naming on purpose.
5154class C extends Z {}
5155class E extends D {}
5156class A implements Finalizable {}
5157class Z implements A {}
5158class D implements C {}
5159class X extends E {}
5160)";
5161 Dart_Handle h_lib = TestCase::LoadTestScript(kScript, nullptr);
5162 EXPECT_VALID(h_lib);
5163
5164 TransitionNativeToVM transition(thread);
5165 const Library& lib = Library::CheckedHandle(zone, Api::UnwrapHandle(h_lib));
5166 EXPECT(!lib.IsNull());
5167
5168 const auto& class_x = Class::Handle(zone, GetClass(lib, "X"));
5169 class_x.EnsureIsFinalized(thread);
5170 EXPECT(class_x.is_isolate_unsendable());
5171
5172 const auto& class_a_impl = Class::Handle(zone, GetClass(lib, "AImpl"));
5173 class_a_impl.EnsureIsFinalized(thread);
5174 EXPECT(class_a_impl.is_isolate_unsendable());
5175
5176 const auto& class_a_sub = Class::Handle(zone, GetClass(lib, "ASub"));
5177 class_a_sub.EnsureIsFinalized(thread);
5178 EXPECT(class_a_sub.is_isolate_unsendable());
5179}

◆ TEST_CASE() [292/600]

dart::TEST_CASE ( IsKernelNegative  )

Definition at line 2042 of file snapshot_test.cc.

2042 {
2043 EXPECT(!Dart_IsKernel(nullptr, 0));
2044
2045 uint8_t buffer[4] = {0, 0, 0, 0};
2047}

◆ TEST_CASE() [293/600]

dart::TEST_CASE ( IsolateReload_AddNewStaticField  )

Definition at line 5341 of file isolate_reload_test.cc.

5343 {\n"
5344 " T%s x;\n"
5345 "}\n"
5346 "%s Foo value1;\n"
5347 "%s Foo value2;\n"
5348 "main() {\n"
5349 " value1 = Foo<String>();\n"
5350 " value2 = Foo<int>();\n"
5351 " return 'Okay';\n"
5352 "}\n",
5353 nullable_tag, late_tag, late_tag),
5354 std::free);
5355 // clang-format on
5356
5357 Dart_Handle lib = TestCase::LoadTestScript(kScript.get(), nullptr);
5358 EXPECT_VALID(lib);
5359 EXPECT_STREQ("Okay", SimpleInvokeStr(lib, "main"));
5360
5361 // clang-format off
5362 auto kReloadScript = Utils::CStringUniquePtr(
5363 OS::SCreate(nullptr,
5364 "class Foo<T> {\n"

◆ TEST_CASE() [294/600]

dart::TEST_CASE ( IsolateReload_BadClass  )

Definition at line 364 of file isolate_reload_test.cc.

364 {
365 const char* kScript =
366 "class Foo {\n"
367 " final a;\n"
368 " Foo(this.a);\n"
369 "}\n"
370 "main() {\n"
371 " new Foo(5);\n"
372 " return 4;\n"
373 "}\n";
374
375 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
376 EXPECT_VALID(lib);
377 EXPECT_EQ(4, SimpleInvoke(lib, "main"));
378
379 const char* kReloadScript =
380 "var _unused;"
381 "class Foo {\n"
382 " final a kjsdf ksjdf ;\n"
383 " Foo(this.a);\n"
384 "}\n"
385 "main() {\n"
386 " new Foo(5);\n"
387 " return 10;\n"
388 "}\n";
389
390 Dart_Handle result = TestCase::ReloadTestScript(kReloadScript);
391 EXPECT_ERROR(result, "Expected ';' after this");
392 EXPECT_EQ(4, SimpleInvoke(lib, "main"));
393}

◆ TEST_CASE() [295/600]

dart::TEST_CASE ( IsolateReload_CallDeleted_ClassFactoryConstructor  )

Definition at line 3082 of file isolate_reload_test.cc.

3082 {
3083 const char* kScript =
3084 "class C { factory C.deleted() => new C(); C(); }\n"
3085 "var retained;\n"
3086 "main() {\n"
3087 " retained = () => C.deleted().toString();\n"
3088 " return retained();\n"
3089 "}\n";
3090
3091 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
3092 EXPECT_VALID(lib);
3093 EXPECT_STREQ("Instance of \'C\'", SimpleInvokeStr(lib, "main"));
3094
3095 const char* kReloadScript =
3096 "class C {}\n"
3097 "var retained;\n"
3098 "main() {\n"
3099 " try {\n"
3100 " return retained();\n"
3101 " } catch (e) {\n"
3102 " return e.toString();\n"
3103 " }\n"
3104 "}\n";
3105
3106 lib = TestCase::ReloadTestScript(kReloadScript);
3107 EXPECT_VALID(lib);
3108 const char* result = SimpleInvokeStr(lib, "main");
3109 EXPECT_SUBSTRING("NoSuchMethodError", result);
3110 EXPECT_SUBSTRING("deleted", result);
3111}
const char * SimpleInvokeStr(Dart_Handle lib, const char *method)

◆ TEST_CASE() [296/600]

dart::TEST_CASE ( IsolateReload_CallDeleted_ClassFactoryConstructorArityChange  )

Definition at line 3113 of file isolate_reload_test.cc.

3113 {
3114 const char* kScript =
3115 "class C { factory C.deleted() => new C(); C(); }\n"
3116 "var retained;\n"
3117 "main() {\n"
3118 " retained = () => C.deleted().toString();\n"
3119 " return retained();\n"
3120 "}\n";
3121
3122 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
3123 EXPECT_VALID(lib);
3124 EXPECT_STREQ("Instance of \'C\'", SimpleInvokeStr(lib, "main"));
3125
3126 const char* kReloadScript =
3127 "class C { factory C.deleted(newParameter) => new C(); C(); }\n"
3128 "var retained;\n"
3129 "main() {\n"
3130 " try {\n"
3131 " return retained();\n"
3132 " } catch (e) {\n"
3133 " return e.toString();\n"
3134 " }\n"
3135 "}\n";
3136
3137 lib = TestCase::ReloadTestScript(kReloadScript);
3138 EXPECT_VALID(lib);
3139 const char* result = SimpleInvokeStr(lib, "main");
3140 EXPECT_SUBSTRING("NoSuchMethodError", result);
3141 EXPECT_SUBSTRING("deleted", result);
3142}

◆ TEST_CASE() [297/600]

dart::TEST_CASE ( IsolateReload_CallDeleted_ClassFactoryConstructorClassDeleted  )

Definition at line 3144 of file isolate_reload_test.cc.

3144 {
3145 const char* kScript =
3146 "class C { factory C.deleted() => new C(); C(); }\n"
3147 "var retained;\n"
3148 "main() {\n"
3149 " retained = () => C.deleted().toString();\n"
3150 " return retained();\n"
3151 "}\n";
3152
3153 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
3154 EXPECT_VALID(lib);
3155 EXPECT_STREQ("Instance of \'C\'", SimpleInvokeStr(lib, "main"));
3156
3157 const char* kReloadScript =
3158 "var retained;\n"
3159 "main() {\n"
3160 " try {\n"
3161 " return retained();\n"
3162 " } catch (e) {\n"
3163 " return e.toString();\n"
3164 " }\n"
3165 "}\n";
3166
3167 lib = TestCase::ReloadTestScript(kReloadScript);
3168 EXPECT_VALID(lib);
3169 const char* result = SimpleInvokeStr(lib, "main");
3170 EXPECT_SUBSTRING("NoSuchMethodError", result);
3171 EXPECT_SUBSTRING("deleted", result);
3172}

◆ TEST_CASE() [298/600]

dart::TEST_CASE ( IsolateReload_CallDeleted_ClassFunction  )

Definition at line 2806 of file isolate_reload_test.cc.

2806 {
2807 const char* kScript =
2808 "class C { static deleted() { return 'hello'; } }\n"
2809 "var retained;\n"
2810 "main() {\n"
2811 " retained = () => C.deleted();\n"
2812 " return retained();\n"
2813 "}\n";
2814
2815 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
2816 EXPECT_VALID(lib);
2817 EXPECT_STREQ("hello", SimpleInvokeStr(lib, "main"));
2818
2819 const char* kReloadScript =
2820 "var retained;\n"
2821 "main() {\n"
2822 " try {\n"
2823 " return retained();\n"
2824 " } catch (e) {\n"
2825 " return e.toString();\n"
2826 " }\n"
2827 "}\n";
2828
2829 lib = TestCase::ReloadTestScript(kReloadScript);
2830 EXPECT_VALID(lib);
2831 const char* result = SimpleInvokeStr(lib, "main");
2832 EXPECT_SUBSTRING("NoSuchMethodError", result);
2833 EXPECT_SUBSTRING("deleted", result);
2834}

◆ TEST_CASE() [299/600]

dart::TEST_CASE ( IsolateReload_CallDeleted_ClassFunctionArityChange  )

Definition at line 2836 of file isolate_reload_test.cc.

2836 {
2837 const char* kScript =
2838 "class C { static deleted() { return 'hello'; } }\n"
2839 "var retained;\n"
2840 "main() {\n"
2841 " retained = () => C.deleted();\n"
2842 " return retained();\n"
2843 "}\n";
2844
2845 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
2846 EXPECT_VALID(lib);
2847 EXPECT_STREQ("hello", SimpleInvokeStr(lib, "main"));
2848
2849 const char* kReloadScript =
2850 "class C { static deleted(newParameter) { return 'hello'; } }\n"
2851 "var retained;\n"
2852 "main() {\n"
2853 " try {\n"
2854 " return retained();\n"
2855 " } catch (e) {\n"
2856 " return e.toString();\n"
2857 " }\n"
2858 "}\n";
2859
2860 lib = TestCase::ReloadTestScript(kReloadScript);
2861 EXPECT_VALID(lib);
2862 const char* result = SimpleInvokeStr(lib, "main");
2863 EXPECT_SUBSTRING("NoSuchMethodError", result);
2864 EXPECT_SUBSTRING("deleted", result);
2865}

◆ TEST_CASE() [300/600]

dart::TEST_CASE ( IsolateReload_CallDeleted_ClassFunctionEvaluationOrder  )

Definition at line 2867 of file isolate_reload_test.cc.

2867 {
2868 const char* kScript =
2869 "first(flag) { if (flag) throw 'first!'; }\n"
2870 "class C { static deleted(_) { return 'hello'; } }\n"
2871 "var retained;\n"
2872 "main() {\n"
2873 " retained = (bool flag) => C.deleted(first(flag));\n"
2874 " return retained(false);\n"
2875 "}\n";
2876
2877 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
2878 EXPECT_VALID(lib);
2879 EXPECT_STREQ("hello", SimpleInvokeStr(lib, "main"));
2880
2881 const char* kReloadScript =
2882 "first(flag) { if (flag) throw 'first!'; }\n"
2883 "class C { }\n"
2884 "var retained;\n"
2885 "main() {\n"
2886 " try {\n"
2887 " return retained(true);\n"
2888 " } catch (e) {\n"
2889 " return e.toString();\n"
2890 " }\n"
2891 "}\n";
2892
2893 lib = TestCase::ReloadTestScript(kReloadScript);
2894 EXPECT_VALID(lib);
2895 const char* result = SimpleInvokeStr(lib, "main");
2896 EXPECT_STREQ("first!", result); // Not NoSuchMethodError
2897}

◆ TEST_CASE() [301/600]

dart::TEST_CASE ( IsolateReload_CallDeleted_ClassGenerativeConstructor  )

Definition at line 2990 of file isolate_reload_test.cc.

2990 {
2991 const char* kScript =
2992 "class C { C.deleted(); }\n"
2993 "var retained;\n"
2994 "main() {\n"
2995 " retained = () => C.deleted().toString();\n"
2996 " return retained();\n"
2997 "}\n";
2998
2999 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
3000 EXPECT_VALID(lib);
3001 EXPECT_STREQ("Instance of \'C\'", SimpleInvokeStr(lib, "main"));
3002
3003 const char* kReloadScript =
3004 "class C {}\n"
3005 "var retained;\n"
3006 "main() {\n"
3007 " try {\n"
3008 " return retained();\n"
3009 " } catch (e) {\n"
3010 " return e.toString();\n"
3011 " }\n"
3012 "}\n";
3013
3014 lib = TestCase::ReloadTestScript(kReloadScript);
3015 EXPECT_VALID(lib);
3016 const char* result = SimpleInvokeStr(lib, "main");
3017 EXPECT_SUBSTRING("NoSuchMethodError", result);
3018 EXPECT_SUBSTRING("deleted", result);
3019}

◆ TEST_CASE() [302/600]

dart::TEST_CASE ( IsolateReload_CallDeleted_ClassGenerativeConstructorArityChange  )

Definition at line 3021 of file isolate_reload_test.cc.

3021 {
3022 const char* kScript =
3023 "class C { C.deleted(); }\n"
3024 "var retained;\n"
3025 "main() {\n"
3026 " retained = () => C.deleted().toString();\n"
3027 " return retained();\n"
3028 "}\n";
3029
3030 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
3031 EXPECT_VALID(lib);
3032 EXPECT_STREQ("Instance of \'C\'", SimpleInvokeStr(lib, "main"));
3033
3034 const char* kReloadScript =
3035 "class C { C.deleted(newParameter); }\n"
3036 "var retained;\n"
3037 "main() {\n"
3038 " try {\n"
3039 " return retained();\n"
3040 " } catch (e) {\n"
3041 " return e.toString();\n"
3042 " }\n"
3043 "}\n";
3044
3045 lib = TestCase::ReloadTestScript(kReloadScript);
3046 EXPECT_VALID(lib);
3047 const char* result = SimpleInvokeStr(lib, "main");
3048 EXPECT_SUBSTRING("NoSuchMethodError", result);
3049 EXPECT_SUBSTRING("deleted", result);
3050}

◆ TEST_CASE() [303/600]

dart::TEST_CASE ( IsolateReload_CallDeleted_ClassGenerativeConstructorClassDeleted  )

Definition at line 3052 of file isolate_reload_test.cc.

3052 {
3053 const char* kScript =
3054 "class C { C.deleted(); }\n"
3055 "var retained;\n"
3056 "main() {\n"
3057 " retained = () => C.deleted().toString();\n"
3058 " return retained();\n"
3059 "}\n";
3060
3061 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
3062 EXPECT_VALID(lib);
3063 EXPECT_STREQ("Instance of \'C\'", SimpleInvokeStr(lib, "main"));
3064
3065 const char* kReloadScript =
3066 "var retained;\n"
3067 "main() {\n"
3068 " try {\n"
3069 " return retained();\n"
3070 " } catch (e) {\n"
3071 " return e.toString();\n"
3072 " }\n"
3073 "}\n";
3074
3075 lib = TestCase::ReloadTestScript(kReloadScript);
3076 EXPECT_VALID(lib);
3077 const char* result = SimpleInvokeStr(lib, "main");
3078 EXPECT_SUBSTRING("NoSuchMethodError", result);
3079 EXPECT_SUBSTRING("deleted", result);
3080}

◆ TEST_CASE() [304/600]

dart::TEST_CASE ( IsolateReload_CallDeleted_ClassGetter  )

Definition at line 2899 of file isolate_reload_test.cc.

2899 {
2900 const char* kScript =
2901 "class C { static get deleted { return 'hello'; } }\n"
2902 "var retained;\n"
2903 "main() {\n"
2904 " retained = () => C.deleted;\n"
2905 " return retained();\n"
2906 "}\n";
2907
2908 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
2909 EXPECT_VALID(lib);
2910 EXPECT_STREQ("hello", SimpleInvokeStr(lib, "main"));
2911
2912 const char* kReloadScript =
2913 "var retained;\n"
2914 "main() {\n"
2915 " try {\n"
2916 " return retained();\n"
2917 " } catch (e) {\n"
2918 " return e.toString();\n"
2919 " }\n"
2920 "}\n";
2921
2922 lib = TestCase::ReloadTestScript(kReloadScript);
2923 EXPECT_VALID(lib);
2924 const char* result = SimpleInvokeStr(lib, "main");
2925 EXPECT_SUBSTRING("NoSuchMethodError", result);
2926 EXPECT_SUBSTRING("deleted", result);
2927}

◆ TEST_CASE() [305/600]

dart::TEST_CASE ( IsolateReload_CallDeleted_ClassSetter  )

Definition at line 2929 of file isolate_reload_test.cc.

2929 {
2930 const char* kScript =
2931 "class C { static set deleted(x) {}}\n"
2932 "var retained;\n"
2933 "main() {\n"
2934 " retained = () => C.deleted = 'hello';\n"
2935 " return retained();\n"
2936 "}\n";
2937
2938 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
2939 EXPECT_VALID(lib);
2940 EXPECT_STREQ("hello", SimpleInvokeStr(lib, "main"));
2941
2942 const char* kReloadScript =
2943 "var retained;\n"
2944 "main() {\n"
2945 " try {\n"
2946 " return retained();\n"
2947 " } catch (e) {\n"
2948 " return e.toString();\n"
2949 " }\n"
2950 "}\n";
2951
2952 lib = TestCase::ReloadTestScript(kReloadScript);
2953 EXPECT_VALID(lib);
2954 const char* result = SimpleInvokeStr(lib, "main");
2955 EXPECT_SUBSTRING("NoSuchMethodError", result);
2956 EXPECT_SUBSTRING("deleted", result);
2957}

◆ TEST_CASE() [306/600]

dart::TEST_CASE ( IsolateReload_CallDeleted_ClassSetterEvaluationOrder  )

Definition at line 2959 of file isolate_reload_test.cc.

2959 {
2960 const char* kScript =
2961 "first(flag) { if (flag) throw 'first!'; return 'hello'; }\n"
2962 "class C { static set deleted(x) {}}\n"
2963 "var retained;\n"
2964 "main() {\n"
2965 " retained = (bool flag) => C.deleted = first(flag);\n"
2966 " return retained(false);\n"
2967 "}\n";
2968
2969 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
2970 EXPECT_VALID(lib);
2971 EXPECT_STREQ("hello", SimpleInvokeStr(lib, "main"));
2972
2973 const char* kReloadScript =
2974 "first(flag) { if (flag) throw 'first!'; return 'hello'; }\n"
2975 "var retained;\n"
2976 "main() {\n"
2977 " try {\n"
2978 " return retained(true);\n"
2979 " } catch (e) {\n"
2980 " return e.toString();\n"
2981 " }\n"
2982 "}\n";
2983
2984 lib = TestCase::ReloadTestScript(kReloadScript);
2985 EXPECT_VALID(lib);
2986 const char* result = SimpleInvokeStr(lib, "main");
2987 EXPECT_STREQ("first!", result);
2988}

◆ TEST_CASE() [307/600]

dart::TEST_CASE ( IsolateReload_CallDeleted_SuperFieldGetter  )

Definition at line 3306 of file isolate_reload_test.cc.

3306 {
3307 const char* kScript =
3308 "class C { var deleted = 'hello'; }\n"
3309 "class D extends C { curry() => () => super.deleted; }\n"
3310 "var retained;\n"
3311 "main() {\n"
3312 " retained = new D().curry();\n"
3313 " return retained();\n"
3314 "}\n";
3315
3316 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
3317 EXPECT_VALID(lib);
3318 EXPECT_STREQ("hello", SimpleInvokeStr(lib, "main"));
3319
3320 const char* kReloadScript =
3321 "class C {}\n"
3322 "class D extends C {}\n"
3323 "var retained;\n"
3324 "main() {\n"
3325 " try {\n"
3326 " return retained();\n"
3327 " } catch (e) {\n"
3328 " return e.toString();\n"
3329 " }\n"
3330 "}\n";
3331
3332 lib = TestCase::ReloadTestScript(kReloadScript);
3333 EXPECT_VALID(lib);
3334 const char* result = SimpleInvokeStr(lib, "main");
3335 EXPECT_SUBSTRING("NoSuchMethodError", result);
3336 EXPECT_SUBSTRING("deleted", result);
3337}

◆ TEST_CASE() [308/600]

dart::TEST_CASE ( IsolateReload_CallDeleted_SuperFieldSetter  )

Definition at line 3339 of file isolate_reload_test.cc.

3339 {
3340 const char* kScript =
3341 "class C { var deleted; }\n"
3342 "class D extends C { curry() => () => super.deleted = 'hello'; }\n"
3343 "var retained;\n"
3344 "main() {\n"
3345 " retained = new D().curry();\n"
3346 " return retained();\n"
3347 "}\n";
3348
3349 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
3350 EXPECT_VALID(lib);
3351 EXPECT_STREQ("hello", SimpleInvokeStr(lib, "main"));
3352
3353 const char* kReloadScript =
3354 "class C {}\n"
3355 "class D extends C {}\n"
3356 "var retained;\n"
3357 "main() {\n"
3358 " try {\n"
3359 " return retained();\n"
3360 " } catch (e) {\n"
3361 " return e.toString();\n"
3362 " }\n"
3363 "}\n";
3364
3365 lib = TestCase::ReloadTestScript(kReloadScript);
3366 EXPECT_VALID(lib);
3367 const char* result = SimpleInvokeStr(lib, "main");
3368 EXPECT_SUBSTRING("NoSuchMethodError", result);
3369 EXPECT_SUBSTRING("deleted", result);
3370}

◆ TEST_CASE() [309/600]

dart::TEST_CASE ( IsolateReload_CallDeleted_SuperFunction  )

Definition at line 3174 of file isolate_reload_test.cc.

3174 {
3175 const char* kScript =
3176 "class C { deleted() { return 'hello'; } }\n"
3177 "class D extends C { curry() => () => super.deleted(); }\n"
3178 "var retained;\n"
3179 "main() {\n"
3180 " retained = new D().curry();\n"
3181 " return retained();\n"
3182 "}\n";
3183
3184 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
3185 EXPECT_VALID(lib);
3186 EXPECT_STREQ("hello", SimpleInvokeStr(lib, "main"));
3187
3188 const char* kReloadScript =
3189 "class C {}\n"
3190 "class D extends C {}\n"
3191 "var retained;\n"
3192 "main() {\n"
3193 " try {\n"
3194 " return retained();\n"
3195 " } catch (e) {\n"
3196 " return e.toString();\n"
3197 " }\n"
3198 "}\n";
3199
3200 lib = TestCase::ReloadTestScript(kReloadScript);
3201 EXPECT_VALID(lib);
3202 const char* result = SimpleInvokeStr(lib, "main");
3203 EXPECT_SUBSTRING("NoSuchMethodError", result);
3204 EXPECT_SUBSTRING("deleted", result);
3205}

◆ TEST_CASE() [310/600]

dart::TEST_CASE ( IsolateReload_CallDeleted_SuperFunctionArityChange  )

Definition at line 3207 of file isolate_reload_test.cc.

3207 {
3208 const char* kScript =
3209 "class C { deleted() { return 'hello'; } }\n"
3210 "class D extends C { curry() => () => super.deleted(); }\n"
3211 "var retained;\n"
3212 "main() {\n"
3213 " retained = new D().curry();\n"
3214 " return retained();\n"
3215 "}\n";
3216
3217 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
3218 EXPECT_VALID(lib);
3219 EXPECT_STREQ("hello", SimpleInvokeStr(lib, "main"));
3220
3221 const char* kReloadScript =
3222 "class C { deleted(newParameter) { return 'hello'; } }\n"
3223 "class D extends C {}\n"
3224 "var retained;\n"
3225 "main() {\n"
3226 " try {\n"
3227 " return retained();\n"
3228 " } catch (e) {\n"
3229 " return e.toString();\n"
3230 " }\n"
3231 "}\n";
3232
3233 lib = TestCase::ReloadTestScript(kReloadScript);
3234 EXPECT_VALID(lib);
3235 const char* result = SimpleInvokeStr(lib, "main");
3236 EXPECT_SUBSTRING("NoSuchMethodError", result);
3237 EXPECT_SUBSTRING("deleted", result);
3238}

◆ TEST_CASE() [311/600]

dart::TEST_CASE ( IsolateReload_CallDeleted_SuperGetter  )

Definition at line 3240 of file isolate_reload_test.cc.

3240 {
3241 const char* kScript =
3242 "class C { get deleted { return 'hello'; } }\n"
3243 "class D extends C { curry() => () => super.deleted; }\n"
3244 "var retained;\n"
3245 "main() {\n"
3246 " retained = new D().curry();\n"
3247 " return retained();\n"
3248 "}\n";
3249
3250 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
3251 EXPECT_VALID(lib);
3252 EXPECT_STREQ("hello", SimpleInvokeStr(lib, "main"));
3253
3254 const char* kReloadScript =
3255 "class C {}\n"
3256 "class D extends C {}\n"
3257 "var retained;\n"
3258 "main() {\n"
3259 " try {\n"
3260 " return retained();\n"
3261 " } catch (e) {\n"
3262 " return e.toString();\n"
3263 " }\n"
3264 "}\n";
3265
3266 lib = TestCase::ReloadTestScript(kReloadScript);
3267 EXPECT_VALID(lib);
3268 const char* result = SimpleInvokeStr(lib, "main");
3269 EXPECT_SUBSTRING("NoSuchMethodError", result);
3270 EXPECT_SUBSTRING("deleted", result);
3271}

◆ TEST_CASE() [312/600]

dart::TEST_CASE ( IsolateReload_CallDeleted_SuperSetter  )

Definition at line 3273 of file isolate_reload_test.cc.

3273 {
3274 const char* kScript =
3275 "class C { set deleted(x) {} }\n"
3276 "class D extends C { curry() => () => super.deleted = 'hello'; }\n"
3277 "var retained;\n"
3278 "main() {\n"
3279 " retained = new D().curry();\n"
3280 " return retained();\n"
3281 "}\n";
3282
3283 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
3284 EXPECT_VALID(lib);
3285 EXPECT_STREQ("hello", SimpleInvokeStr(lib, "main"));
3286
3287 const char* kReloadScript =
3288 "class C {}\n"
3289 "class D extends C {}\n"
3290 "var retained;\n"
3291 "main() {\n"
3292 " try {\n"
3293 " return retained();\n"
3294 " } catch (e) {\n"
3295 " return e.toString();\n"
3296 " }\n"
3297 "}\n";
3298
3299 lib = TestCase::ReloadTestScript(kReloadScript);
3300 EXPECT_VALID(lib);
3301 const char* result = SimpleInvokeStr(lib, "main");
3302 EXPECT_SUBSTRING("NoSuchMethodError", result);
3303 EXPECT_SUBSTRING("deleted", result);
3304}

◆ TEST_CASE() [313/600]

dart::TEST_CASE ( IsolateReload_CallDeleted_TopLevelAddTypeArguments  )

Definition at line 2530 of file isolate_reload_test.cc.

2530 {
2531 const char* kScript =
2532 "deleted() { return 'hello'; }\n"
2533 "var retained;\n"
2534 "main() {\n"
2535 " retained = () => deleted();\n"
2536 " return retained();\n"
2537 "}\n";
2538
2539 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
2540 EXPECT_VALID(lib);
2541 EXPECT_STREQ("hello", SimpleInvokeStr(lib, "main"));
2542
2543 const char* kReloadScript =
2544 "deleted<A, B, C>() { return 'hello'; }\n"
2545 "var retained;\n"
2546 "main() {\n"
2547 " try {\n"
2548 " return retained();\n"
2549 " } catch (e) {\n"
2550 " return e.toString();\n"
2551 " }\n"
2552 "}\n";
2553
2554 lib = TestCase::ReloadTestScript(kReloadScript);
2555 EXPECT_VALID(lib);
2556 EXPECT_STREQ("hello", SimpleInvokeStr(lib, "main"));
2557}

◆ TEST_CASE() [314/600]

dart::TEST_CASE ( IsolateReload_CallDeleted_TopLevelFunction  )

Definition at line 2469 of file isolate_reload_test.cc.

2469 {
2470 const char* kScript =
2471 "deleted() { return 'hello'; }\n"
2472 "var retained;\n"
2473 "main() {\n"
2474 " retained = () => deleted();\n"
2475 " return retained();\n"
2476 "}\n";
2477
2478 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
2479 EXPECT_VALID(lib);
2480 EXPECT_STREQ("hello", SimpleInvokeStr(lib, "main"));
2481
2482 const char* kReloadScript =
2483 "var retained;\n"
2484 "main() {\n"
2485 " try {\n"
2486 " return retained();\n"
2487 " } catch (e) {\n"
2488 " return e.toString();\n"
2489 " }\n"
2490 "}\n";
2491
2492 lib = TestCase::ReloadTestScript(kReloadScript);
2493 EXPECT_VALID(lib);
2494 const char* result = SimpleInvokeStr(lib, "main");
2495 EXPECT_SUBSTRING("NoSuchMethodError", result);
2496 EXPECT_SUBSTRING("deleted", result);
2497}

◆ TEST_CASE() [315/600]

dart::TEST_CASE ( IsolateReload_CallDeleted_TopLevelFunctionArityChange  )

Definition at line 2499 of file isolate_reload_test.cc.

2499 {
2500 const char* kScript =
2501 "deleted() { return 'hello'; }\n"
2502 "var retained;\n"
2503 "main() {\n"
2504 " retained = () => deleted();\n"
2505 " return retained();\n"
2506 "}\n";
2507
2508 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
2509 EXPECT_VALID(lib);
2510 EXPECT_STREQ("hello", SimpleInvokeStr(lib, "main"));
2511
2512 const char* kReloadScript =
2513 "deleted(newParameter) { return 'hello'; }\n"
2514 "var retained;\n"
2515 "main() {\n"
2516 " try {\n"
2517 " return retained();\n"
2518 " } catch (e) {\n"
2519 " return e.toString();\n"
2520 " }\n"
2521 "}\n";
2522
2523 lib = TestCase::ReloadTestScript(kReloadScript);
2524 EXPECT_VALID(lib);
2525 const char* result = SimpleInvokeStr(lib, "main");
2526 EXPECT_SUBSTRING("NoSuchMethodError", result);
2527 EXPECT_SUBSTRING("deleted", result);
2528}

◆ TEST_CASE() [316/600]

dart::TEST_CASE ( IsolateReload_CallDeleted_TopLevelFunctionEvaluationOrder  )

Definition at line 2620 of file isolate_reload_test.cc.

2620 {
2621 const char* kScript =
2622 "first(flag) { if (flag) throw 'first!'; }\n"
2623 "deleted(_) { return 'hello'; }\n"
2624 "var retained;\n"
2625 "main() {\n"
2626 " retained = (bool flag) => deleted(first(flag));\n"
2627 " return retained(false);\n"
2628 "}\n";
2629
2630 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
2631 EXPECT_VALID(lib);
2632 EXPECT_STREQ("hello", SimpleInvokeStr(lib, "main"));
2633
2634 const char* kReloadScript =
2635 "first(flag) { if (flag) throw 'first!'; }\n"
2636 "var retained;\n"
2637 "main() {\n"
2638 " try {\n"
2639 " return retained(true);\n"
2640 " } catch (e) {\n"
2641 " return e.toString();\n"
2642 " }\n"
2643 "}\n";
2644
2645 lib = TestCase::ReloadTestScript(kReloadScript);
2646 EXPECT_VALID(lib);
2647 const char* result = SimpleInvokeStr(lib, "main");
2648 EXPECT_STREQ("first!", result); // Not NoSuchMethodError
2649}

◆ TEST_CASE() [317/600]

dart::TEST_CASE ( IsolateReload_CallDeleted_TopLevelFunctionLibraryDeleted  )

Definition at line 2651 of file isolate_reload_test.cc.

2651 {
2652 // clang-format off
2653 Dart_SourceFile sourcefiles[] = {
2654 {
2655 "file:///test-app.dart",
2656
2657 "import 'test-lib.dart';\n"
2658 "var retained;\n"
2659 "main() {\n"
2660 " retained = () => deleted();\n"
2661 " return retained();\n"
2662 "}\n",
2663 },
2664 {
2665 "file:///test-lib.dart",
2666
2667 "deleted() { return 'hello'; }\n",
2668 },
2669 };
2670 // clang-format on
2671
2672 Dart_Handle lib = TestCase::LoadTestScriptWithDFE(
2673 sizeof(sourcefiles) / sizeof(Dart_SourceFile), sourcefiles,
2674 NULL /* resolver */, true /* finalize */, true /* incrementally */);
2675 EXPECT_VALID(lib);
2676 EXPECT_STREQ("hello", SimpleInvokeStr(lib, "main"));
2677
2678 // clang-format off
2679 Dart_SourceFile updated_sourcefiles[] = {
2680 {
2681 "file:///test-app.dart",
2682
2683 "var retained;\n"
2684 "main() {\n"
2685 " try {\n"
2686 " return retained();\n"
2687 " } catch (e) {\n"
2688 " return e.toString();\n"
2689 " }\n"
2690 "}\n",
2691 },
2692 };
2693 // clang-format on
2694
2695 const uint8_t* kernel_buffer = NULL;
2696 intptr_t kernel_buffer_size = 0;
2697 char* error = TestCase::CompileTestScriptWithDFE(
2698 "file:///test-app.dart",
2699 sizeof(updated_sourcefiles) / sizeof(Dart_SourceFile),
2700 updated_sourcefiles, &kernel_buffer, &kernel_buffer_size,
2701 true /* incrementally */);
2702 EXPECT(error == NULL);
2703 EXPECT_NOTNULL(kernel_buffer);
2704 lib = TestCase::ReloadTestKernel(kernel_buffer, kernel_buffer_size);
2705 EXPECT_VALID(lib);
2706 const char* result = SimpleInvokeStr(lib, "main");
2707 // What actually happens because we don't re-search imported libraries.
2708 EXPECT_STREQ(result, "hello");
2709
2710 // What should happen and what did happen with the old VM frontend:
2711 // EXPECT_SUBSTRING("NoSuchMethodError", result);
2712 // EXPECT_SUBSTRING("deleted", result);
2713}

◆ TEST_CASE() [318/600]

dart::TEST_CASE ( IsolateReload_CallDeleted_TopLevelGetter  )

Definition at line 2715 of file isolate_reload_test.cc.

2715 {
2716 const char* kScript =
2717 "get deleted { return 'hello'; }\n"
2718 "var retained;\n"
2719 "main() {\n"
2720 " retained = () => deleted;\n"
2721 " return retained();\n"
2722 "}\n";
2723
2724 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
2725 EXPECT_VALID(lib);
2726 EXPECT_STREQ("hello", SimpleInvokeStr(lib, "main"));
2727
2728 const char* kReloadScript =
2729 "var retained;\n"
2730 "main() {\n"
2731 " try {\n"
2732 " return retained();\n"
2733 " } catch (e) {\n"
2734 " return e.toString();\n"
2735 " }\n"
2736 "}\n";
2737
2738 lib = TestCase::ReloadTestScript(kReloadScript);
2739 EXPECT_VALID(lib);
2740 const char* result = SimpleInvokeStr(lib, "main");
2741 EXPECT_SUBSTRING("NoSuchMethodError", result);
2742 EXPECT_SUBSTRING("deleted", result);
2743}

◆ TEST_CASE() [319/600]

dart::TEST_CASE ( IsolateReload_CallDeleted_TopLevelMissingPassingTypeArguments  )

Definition at line 2590 of file isolate_reload_test.cc.

2590 {
2591 const char* kScript =
2592 "deleted<A, B, C>() { return 'hello'; }\n"
2593 "var retained;\n"
2594 "main() {\n"
2595 " retained = () => deleted<int, int, int>();\n"
2596 " return retained();\n"
2597 "}\n";
2598
2599 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
2600 EXPECT_VALID(lib);
2601 EXPECT_STREQ("hello", SimpleInvokeStr(lib, "main"));
2602
2603 const char* kReloadScript =
2604 "var retained;\n"
2605 "main() {\n"
2606 " try {\n"
2607 " return retained();\n"
2608 " } catch (e) {\n"
2609 " return e.toString();\n"
2610 " }\n"
2611 "}\n";
2612
2613 lib = TestCase::ReloadTestScript(kReloadScript);
2614 EXPECT_VALID(lib);
2615 const char* result = SimpleInvokeStr(lib, "main");
2616 EXPECT_SUBSTRING("NoSuchMethodError", result);
2617 EXPECT_SUBSTRING("deleted", result);
2618}

◆ TEST_CASE() [320/600]

dart::TEST_CASE ( IsolateReload_CallDeleted_TopLevelRemoveTypeArguments  )

Definition at line 2559 of file isolate_reload_test.cc.

2559 {
2560 const char* kScript =
2561 "deleted<A, B, C>() { return 'hello'; }\n"
2562 "var retained;\n"
2563 "main() {\n"
2564 " retained = () => deleted<int, int, int>();\n"
2565 " return retained();\n"
2566 "}\n";
2567
2568 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
2569 EXPECT_VALID(lib);
2570 EXPECT_STREQ("hello", SimpleInvokeStr(lib, "main"));
2571
2572 const char* kReloadScript =
2573 "deleted() { return 'hello'; }\n"
2574 "var retained;\n"
2575 "main() {\n"
2576 " try {\n"
2577 " return retained();\n"
2578 " } catch (e) {\n"
2579 " return e.toString();\n"
2580 " }\n"
2581 "}\n";
2582
2583 lib = TestCase::ReloadTestScript(kReloadScript);
2584 EXPECT_VALID(lib);
2585 const char* result = SimpleInvokeStr(lib, "main");
2586 EXPECT_SUBSTRING("NoSuchMethodError", result);
2587 EXPECT_SUBSTRING("deleted", result);
2588}

◆ TEST_CASE() [321/600]

dart::TEST_CASE ( IsolateReload_CallDeleted_TopLevelSetter  )

Definition at line 2745 of file isolate_reload_test.cc.

2745 {
2746 const char* kScript =
2747 "set deleted(x) {}\n"
2748 "var retained;\n"
2749 "main() {\n"
2750 " retained = () => deleted = 'hello';\n"
2751 " return retained();\n"
2752 "}\n";
2753
2754 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
2755 EXPECT_VALID(lib);
2756 EXPECT_STREQ("hello", SimpleInvokeStr(lib, "main"));
2757
2758 const char* kReloadScript =
2759 "var retained;\n"
2760 "main() {\n"
2761 " try {\n"
2762 " return retained();\n"
2763 " } catch (e) {\n"
2764 " return e.toString();\n"
2765 " }\n"
2766 "}\n";
2767
2768 lib = TestCase::ReloadTestScript(kReloadScript);
2769 EXPECT_VALID(lib);
2770 const char* result = SimpleInvokeStr(lib, "main");
2771 EXPECT_SUBSTRING("NoSuchMethodError", result);
2772 EXPECT_SUBSTRING("deleted", result);
2773}

◆ TEST_CASE() [322/600]

dart::TEST_CASE ( IsolateReload_CallDeleted_TopLevelSetterEvaluationOrder  )

Definition at line 2775 of file isolate_reload_test.cc.

2775 {
2776 const char* kScript =
2777 "first(flag) { if (flag) throw 'first!'; return 'hello'; }\n"
2778 "set deleted(x) {}\n"
2779 "var retained;\n"
2780 "main() {\n"
2781 " retained = (bool flag) => deleted = first(flag);\n"
2782 " return retained(false);\n"
2783 "}\n";
2784
2785 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
2786 EXPECT_VALID(lib);
2787 EXPECT_STREQ("hello", SimpleInvokeStr(lib, "main"));
2788
2789 const char* kReloadScript =
2790 "first(flag) { if (flag) throw 'first!'; return 'hello'; }\n"
2791 "var retained;\n"
2792 "main() {\n"
2793 " try {\n"
2794 " return retained(true);\n"
2795 " } catch (e) {\n"
2796 " return e.toString();\n"
2797 " }\n"
2798 "}\n";
2799
2800 lib = TestCase::ReloadTestScript(kReloadScript);
2801 EXPECT_VALID(lib);
2802 const char* result = SimpleInvokeStr(lib, "main");
2803 EXPECT_STREQ("first!", result); // Not NoSuchMethodError
2804}

◆ TEST_CASE() [323/600]

dart::TEST_CASE ( IsolateReload_ChangeInstanceFormat0  )

Definition at line 3632 of file isolate_reload_test.cc.

3632 {
3633 const char* kScript =
3634 "class Foo {\n"
3635 " var a;\n"
3636 " var b;\n"
3637 " var c;\n"
3638 "}\n"
3639 "var f;\n"
3640 "main() {\n"
3641 " f = new Foo();\n"
3642 " f.c = 42;\n"
3643 " return f.c;\n"
3644 "}\n";
3645
3646 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
3647 EXPECT_VALID(lib);
3648 EXPECT_EQ(42, SimpleInvoke(lib, "main"));
3649
3650 const char* kReloadScript =
3651 "class Foo {\n"
3652 " var c;\n"
3653 "}\n"
3654 "var f;\n"
3655 "main() {\n"
3656 " return f.c;\n"
3657 "}\n";
3658
3659 lib = TestCase::ReloadTestScript(kReloadScript);
3660 EXPECT_VALID(lib);
3661 EXPECT_EQ(42, SimpleInvoke(lib, "main"));
3662}

◆ TEST_CASE() [324/600]

dart::TEST_CASE ( IsolateReload_ChangeInstanceFormat1  )

Definition at line 3667 of file isolate_reload_test.cc.

3667 {
3668 const char* kScript =
3669 "class Foo {\n"
3670 "}\n"
3671 "var f;\n"
3672 "main() {\n"
3673 " f = new Foo();\n"
3674 " return 42;\n"
3675 "}\n";
3676
3677 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
3678 EXPECT_VALID(lib);
3679 EXPECT_EQ(42, SimpleInvoke(lib, "main"));
3680
3681 const char* kReloadScript =
3682 "class Foo {\n"
3683 " var c;\n"
3684 "}\n"
3685 "var f;\n"
3686 "main() {\n"
3687 " return (f.c == null) ? 42: 21;\n"
3688 "}\n";
3689
3690 lib = TestCase::ReloadTestScript(kReloadScript);
3691 EXPECT_VALID(lib);
3692 EXPECT_EQ(42, SimpleInvoke(lib, "main"));
3693}

◆ TEST_CASE() [325/600]

dart::TEST_CASE ( IsolateReload_ChangeInstanceFormat2  )

Definition at line 3698 of file isolate_reload_test.cc.

3698 {
3699 const char* kScript =
3700 "class Foo {\n"
3701 " var c;\n"
3702 "}\n"
3703 "var f;\n"
3704 "main() {\n"
3705 " f = new Foo();\n"
3706 " f.c = 42;\n"
3707 " return f.c;\n"
3708 "}\n";
3709
3710 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
3711 EXPECT_VALID(lib);
3712 EXPECT_EQ(42, SimpleInvoke(lib, "main"));
3713
3714 const char* kReloadScript =
3715 "class Foo {\n"
3716 "}\n"
3717 "var f;\n"
3718 "main() {\n"
3719 " try {\n"
3720 " return f.c;\n"
3721 " } catch (e) {\n"
3722 " return 24;\n"
3723 " }\n"
3724 "}\n";
3725
3726 lib = TestCase::ReloadTestScript(kReloadScript);
3727 EXPECT_VALID(lib);
3728 EXPECT_EQ(24, SimpleInvoke(lib, "main"));
3729}

◆ TEST_CASE() [326/600]

dart::TEST_CASE ( IsolateReload_ChangeInstanceFormat3  )

Definition at line 3734 of file isolate_reload_test.cc.

3734 {
3735 const char* kScript =
3736 "class Foo<A,B> {\n"
3737 " var a;\n"
3738 " var b;\n"
3739 " var c;\n"
3740 " var d;\n"
3741 "}\n"
3742 "var f;\n"
3743 "main() {\n"
3744 " f = new Foo();\n"
3745 " f.a = 1;\n"
3746 " f.b = 2;\n"
3747 " f.c = 3;\n"
3748 " f.d = 4;\n"
3749 " return f.c;\n"
3750 "}\n";
3751
3752 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
3753 EXPECT_VALID(lib);
3754 EXPECT_EQ(3, SimpleInvoke(lib, "main"));
3755
3756 const char* kReloadScript =
3757 "class Foo<A,B> {\n"
3758 " var c;\n"
3759 " var g;\n"
3760 "}\n"
3761 "var f;\n"
3762 "main() {\n"
3763 " return f.c;\n"
3764 "}\n";
3765
3766 lib = TestCase::ReloadTestScript(kReloadScript);
3767 EXPECT_VALID(lib);
3768 EXPECT_EQ(3, SimpleInvoke(lib, "main"));
3769}

◆ TEST_CASE() [327/600]

dart::TEST_CASE ( IsolateReload_ChangeInstanceFormat4  )

Definition at line 3774 of file isolate_reload_test.cc.

3774 {
3775 const char* kScript =
3776 "class Bar{\n"
3777 " var c;\n"
3778 "}\n"
3779 "class Foo extends Bar{\n"
3780 " var d;\n"
3781 " var e;\n"
3782 "}\n"
3783 "var f;\n"
3784 "main() {\n"
3785 " f = new Foo();\n"
3786 " f.c = 44;\n"
3787 " return f.c;\n"
3788 "}\n";
3789
3790 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
3791 EXPECT_VALID(lib);
3792 EXPECT_EQ(44, SimpleInvoke(lib, "main"));
3793
3794 const char* kReloadScript =
3795 "class Foo {\n"
3796 " var c;\n"
3797 "}\n"
3798 "var f;\n"
3799 "main() {\n"
3800 " return f.c;\n"
3801 "}\n";
3802
3803 lib = TestCase::ReloadTestScript(kReloadScript);
3804 EXPECT_VALID(lib);
3805 EXPECT_EQ(44, SimpleInvoke(lib, "main"));
3806}

◆ TEST_CASE() [328/600]

dart::TEST_CASE ( IsolateReload_ChangeInstanceFormat5  )

Definition at line 3811 of file isolate_reload_test.cc.

3811 {
3812 const char* kScript =
3813 "class Bar{\n"
3814 " var a;\n"
3815 " var b;\n"
3816 "}\n"
3817 "class Foo extends Bar{\n"
3818 " var c;\n"
3819 "}\n"
3820 "var f;\n"
3821 "main() {\n"
3822 " f = new Foo();\n"
3823 " f.c = 44;\n"
3824 " return f.c;\n"
3825 "}\n";
3826
3827 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
3828 EXPECT_VALID(lib);
3829 EXPECT_EQ(44, SimpleInvoke(lib, "main"));
3830
3831 const char* kReloadScript =
3832 "class Bar{\n"
3833 " var c;\n"
3834 "}\n"
3835 "class Foo extends Bar {\n"
3836 "}\n"
3837 "var f;\n"
3838 "main() {\n"
3839 " return f.c;\n"
3840 "}\n";
3841
3842 lib = TestCase::ReloadTestScript(kReloadScript);
3843 EXPECT_VALID(lib);
3844 EXPECT_EQ(44, SimpleInvoke(lib, "main"));
3845}

◆ TEST_CASE() [329/600]

dart::TEST_CASE ( IsolateReload_ChangeInstanceFormat6  )

Definition at line 3850 of file isolate_reload_test.cc.

3850 {
3851 const char* kScript =
3852 "class Foo<A, B> {\n"
3853 " var a;\n"
3854 " var b;\n"
3855 "}\n"
3856 "main() {\n"
3857 " new Foo();\n"
3858 " return 43;\n"
3859 "}\n";
3860
3861 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
3862 EXPECT_VALID(lib);
3863 EXPECT_EQ(43, SimpleInvoke(lib, "main"));
3864
3865 const char* kReloadScript =
3866 "class Foo<A> {\n"
3867 " var a;\n"
3868 "}\n";
3869 lib = TestCase::ReloadTestScript(kReloadScript);
3870 EXPECT_ERROR(lib, "type parameters have changed");
3871}

◆ TEST_CASE() [330/600]

dart::TEST_CASE ( IsolateReload_ChangeInstanceFormat7  )

Definition at line 3877 of file isolate_reload_test.cc.

3877 {
3878 const char* kScript =
3879 "class Foo<A, B> {\n"
3880 " var a;\n"
3881 " var b;\n"
3882 "}\n";
3883
3884 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
3885 EXPECT_VALID(lib);
3886
3887 const char* kReloadScript =
3888 "class Foo<A> {\n"
3889 " var a;\n"
3890 "}\n";
3891 lib = TestCase::ReloadTestScript(kReloadScript);
3892 EXPECT_VALID(lib);
3893}

◆ TEST_CASE() [331/600]

dart::TEST_CASE ( IsolateReload_ChangeInstanceFormat8  )

Definition at line 3897 of file isolate_reload_test.cc.

3897 {
3898 const char* kScript =
3899 "class A{\n"
3900 " var x;\n"
3901 "}\n"
3902 "class B {\n"
3903 " var x, y, z, w;\n"
3904 "}\n"
3905 "var a, b;\n"
3906 "main() {\n"
3907 " a = new A();\n"
3908 " b = new B();\n"
3909 " return '$a $b';\n"
3910 "}\n";
3911
3912 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
3913 EXPECT_VALID(lib);
3914 EXPECT_STREQ("Instance of 'A' Instance of 'B'", SimpleInvokeStr(lib, "main"));
3915
3916 const char* kReloadScript =
3917 "class A{\n"
3918 " var x, y;\n"
3919 "}\n"
3920 "class B {\n"
3921 " var x, y, z, w, v;\n"
3922 "}\n"
3923 "var a, b;\n"
3924 "main() {\n"
3925 " return '$a $b';\n"
3926 "}\n";
3927
3928 lib = TestCase::ReloadTestScript(kReloadScript);
3929 EXPECT_VALID(lib);
3930 EXPECT_STREQ("Instance of 'A' Instance of 'B'", SimpleInvokeStr(lib, "main"));
3931}

◆ TEST_CASE() [332/600]

dart::TEST_CASE ( IsolateReload_ChangeInstanceFormat9  )

Definition at line 3936 of file isolate_reload_test.cc.

3936 {
3937 const char* kScript =
3938 "class Foo<A> {\n"
3939 " var a;\n"
3940 "}\n"
3941 "class Bar<B, C> extends Foo<B> {}\n"
3942 "class Baz extends Foo<String> {}"
3943 "main() {\n"
3944 " new Baz();\n"
3945 " return 43;\n"
3946 "}\n";
3947
3948 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
3949 EXPECT_VALID(lib);
3950 EXPECT_EQ(43, SimpleInvoke(lib, "main"));
3951
3952 const char* kReloadScript =
3953 "class Foo<A> {\n"
3954 " var a;\n"
3955 "}\n"
3956 "class Bar<B, C> extends Foo<B> {}\n"
3957 "class Baz extends Bar<String, double> {}"
3958 "main() {\n"
3959 " new Baz();\n"
3960 " return 43;\n"
3961 "}\n";
3962 lib = TestCase::ReloadTestScript(kReloadScript);
3963 EXPECT_ERROR(lib, "type parameters have changed");
3964}

◆ TEST_CASE() [333/600]

dart::TEST_CASE ( IsolateReload_ClassAdded  )

Definition at line 568 of file isolate_reload_test.cc.

568 {
569 const char* kScript =
570 "main() {\n"
571 " return 'hello';\n"
572 "}\n";
573
574 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
575 EXPECT_VALID(lib);
576 EXPECT_STREQ("hello", SimpleInvokeStr(lib, "main"));
577
578 const char* kReloadScript =
579 "var _unused;"
580 "class A {\n"
581 " toString() => 'hello from A';\n"
582 "}\n"
583 "main() {\n"
584 " return new A().toString();\n"
585 "}\n";
586
587 lib = TestCase::ReloadTestScript(kReloadScript);
588 EXPECT_VALID(lib);
589 EXPECT_STREQ("hello from A", SimpleInvokeStr(lib, "main"));
590}

◆ TEST_CASE() [334/600]

dart::TEST_CASE ( IsolateReload_ClassFieldAdded  )

Definition at line 479 of file isolate_reload_test.cc.

479 {
480 const char* kScript =
481 "class Foo {\n"
482 " var x;\n"
483 "}\n"
484 "main() {\n"
485 " new Foo();\n"
486 " return 44;\n"
487 "}\n";
488
489 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
490 EXPECT_VALID(lib);
491 EXPECT_EQ(44, SimpleInvoke(lib, "main"));
492
493 const char* kReloadScript =
494 "class Foo {\n"
495 " var x;\n"
496 " var y;\n"
497 "}\n"
498 "main() {\n"
499 " new Foo();\n"
500 " return 44;\n"
501 "}\n";
502
503 lib = TestCase::ReloadTestScript(kReloadScript);
504 EXPECT_VALID(lib);
505 EXPECT_EQ(44, SimpleInvoke(lib, "main"));
506}

◆ TEST_CASE() [335/600]

dart::TEST_CASE ( IsolateReload_ClassFieldAdded2  )

Definition at line 508 of file isolate_reload_test.cc.

508 {
509 const char* kScript =
510 "class Foo {\n"
511 " var x;\n"
512 " var y;\n"
513 "}\n"
514 "main() {\n"
515 " new Foo();\n"
516 " return 44;\n"
517 "}\n";
518
519 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
520 EXPECT_VALID(lib);
521 EXPECT_EQ(44, SimpleInvoke(lib, "main"));
522
523 const char* kReloadScript =
524 "class Foo {\n"
525 " var x;\n"
526 " var y;\n"
527 " var z;\n"
528 "}\n"
529 "main() {\n"
530 " new Foo();\n"
531 " return 44;\n"
532 "}\n";
533
534 lib = TestCase::ReloadTestScript(kReloadScript);
535 EXPECT_VALID(lib);
536 EXPECT_EQ(44, SimpleInvoke(lib, "main"));
537}

◆ TEST_CASE() [336/600]

dart::TEST_CASE ( IsolateReload_ClassFieldRemoved  )

Definition at line 539 of file isolate_reload_test.cc.

539 {
540 const char* kScript =
541 "class Foo {\n"
542 " var x;\n"
543 " var y;\n"
544 "}\n"
545 "main() {\n"
546 " new Foo();\n"
547 " return 44;\n"
548 "}\n";
549
550 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
551 EXPECT_VALID(lib);
552 EXPECT_EQ(44, SimpleInvoke(lib, "main"));
553
554 const char* kReloadScript =
555 "class Foo {\n"
556 " var x;\n"
557 "}\n"
558 "main() {\n"
559 " new Foo();\n"
560 " return 44;\n"
561 "}\n";
562
563 lib = TestCase::ReloadTestScript(kReloadScript);
564 EXPECT_VALID(lib);
565 EXPECT_EQ(44, SimpleInvoke(lib, "main"));
566}

◆ TEST_CASE() [337/600]

dart::TEST_CASE ( IsolateReload_ClassRemoved  )

Definition at line 592 of file isolate_reload_test.cc.

592 {
593 const char* kScript =
594 "class A {\n"
595 " toString() => 'hello from A';\n"
596 "}\n"
597 "List<dynamic> list = <dynamic>[];"
598 "main() {\n"
599 " list.add(new A());\n"
600 " return list[0].toString();\n"
601 "}\n";
602
603 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
604 EXPECT_VALID(lib);
605 EXPECT_STREQ("hello from A", SimpleInvokeStr(lib, "main"));
606
607 const char* kReloadScript =
608 "List<dynamic> list = <dynamic>[];\n"
609 "main() {\n"
610 " return list[0].toString();\n"
611 "}\n";
612
613 lib = TestCase::ReloadTestScript(kReloadScript);
614 EXPECT_VALID(lib);
615 EXPECT_STREQ("hello from A", SimpleInvokeStr(lib, "main"));
616}

◆ TEST_CASE() [338/600]

dart::TEST_CASE ( IsolateReload_ComplexInheritanceChange  )

Definition at line 973 of file isolate_reload_test.cc.

973 {
974 const char* kScript =
975 "class A {\n"
976 " String name;\n"
977 " A(this.name);\n"
978 "}\n"
979 "class B extends A {\n"
980 " B(name) : super(name);\n"
981 "}\n"
982 "class C extends B {\n"
983 " C(name) : super(name);\n"
984 "}\n"
985 "var list = <dynamic>[ new A('a'), new B('b'), new C('c') ];\n"
986 "main() {\n"
987 " return (list.map((x) {\n"
988 " return '${x.name} is A(${x is A})/ B(${x is B})/ C(${x is C})';\n"
989 " })).toString();\n"
990 "}\n";
991
992 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
993 EXPECT_VALID(lib);
994 EXPECT_STREQ(
995 "(a is A(true)/ B(false)/ C(false),"
996 " b is A(true)/ B(true)/ C(false),"
997 " c is A(true)/ B(true)/ C(true))",
998 SimpleInvokeStr(lib, "main"));
999
1000 const char* kReloadScript =
1001 "class C {\n"
1002 " String name;\n"
1003 " C(this.name);\n"
1004 "}\n"
1005 "class X extends C {\n"
1006 " X(name) : super(name);\n"
1007 "}\n"
1008 "class A extends X {\n"
1009 " A(name) : super(name);\n"
1010 "}\n"
1011 "var list;\n"
1012 "main() {\n"
1013 " list.add(new X('x'));\n"
1014 " return (list.map((x) {\n"
1015 " return '${x.name} is A(${x is A})/ C(${x is C})/ X(${x is X})';\n"
1016 " })).toString();\n"
1017 "}\n";
1018
1019 lib = TestCase::ReloadTestScript(kReloadScript);
1020 EXPECT_VALID(lib);
1021 EXPECT_STREQ(
1022 "(a is A(true)/ C(true)/ X(true),"
1023 " b is A(true)/ C(true)/ X(true)," // still extends A...
1024 " c is A(false)/ C(true)/ X(false),"
1025 " x is A(false)/ C(true)/ X(true))",
1026 SimpleInvokeStr(lib, "main"));
1027
1028 // Revive the class B and make sure all allocated instances take
1029 // their place in the inheritance hierarchy.
1030 const char* kReloadScript2 =
1031 "class X {\n"
1032 " String name;\n"
1033 " X(this.name);\n"
1034 "}\n"
1035 "class A extends X{\n"
1036 " A(name) : super(name);\n"
1037 "}\n"
1038 "class B extends X {\n"
1039 " B(name) : super(name);\n"
1040 "}\n"
1041 "class C extends A {\n"
1042 " C(name) : super(name);\n"
1043 "}\n"
1044 "var list;\n"
1045 "main() {\n"
1046 " return (list.map((x) {\n"
1047 " return '${x.name} is '\n"
1048 " 'A(${x is A})/ B(${x is B})/ C(${x is C})/ X(${x is X})';\n"
1049 " })).toString();\n"
1050 "}\n";
1051
1052 lib = TestCase::ReloadTestScript(kReloadScript2);
1053 EXPECT_VALID(lib);
1054 EXPECT_STREQ(
1055 "(a is A(true)/ B(false)/ C(false)/ X(true),"
1056 " b is A(false)/ B(true)/ C(false)/ X(true),"
1057 " c is A(true)/ B(false)/ C(true)/ X(true),"
1058 " x is A(false)/ B(false)/ C(false)/ X(true))",
1059 SimpleInvokeStr(lib, "main"));
1060}

◆ TEST_CASE() [339/600]

dart::TEST_CASE ( IsolateReload_ConstantIdentical  )

Definition at line 2432 of file isolate_reload_test.cc.

2432 {
2433 const char* kScript =
2434 "class Fruit {\n"
2435 " final String name;\n"
2436 " const Fruit(this.name);\n"
2437 " String toString() => name;\n"
2438 "}\n"
2439 "var x;\n"
2440 "main() {\n"
2441 " x = const Fruit('Pear');\n"
2442 " return x.toString();\n"
2443 "}\n";
2444
2445 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
2446 EXPECT_VALID(lib);
2447 EXPECT_STREQ("Pear", SimpleInvokeStr(lib, "main"));
2448
2449 const char* kReloadScript =
2450 "class Fruit {\n"
2451 " final String name;\n"
2452 " const Fruit(this.name);\n"
2453 " String toString() => name;\n"
2454 "}\n"
2455 "var x;\n"
2456 "main() {\n"
2457 " if (identical(x, const Fruit('Pear'))) {\n"
2458 " return 'yes';\n"
2459 " } else {\n"
2460 " return 'no';\n"
2461 " }\n"
2462 "}\n";
2463
2464 lib = TestCase::ReloadTestScript(kReloadScript);
2465 EXPECT_VALID(lib);
2466 EXPECT_STREQ("yes", SimpleInvokeStr(lib, "main"));
2467}

◆ TEST_CASE() [340/600]

dart::TEST_CASE ( IsolateReload_ConstFieldUpdate  )

Definition at line 4656 of file isolate_reload_test.cc.

4663 :exportlib", kReloadExportScript);
4664
4665 const char* kReloadScript =
4666 "import 'test:importlib';\n"
4667 "main() {\n"
4668 " return exportedFunc() + ' pants';\n"
4669 "}\n";
4670
4671 Dart_SetFileModifiedCallback(&ExportModifiedCallback);
4672 lib = TestCase::ReloadTestScript(kReloadScript);
4673 EXPECT_VALID(lib);
4674 Dart_SetFileModifiedCallback(nullptr);
4675
4676 // Modification of an exported library propagates.

◆ TEST_CASE() [341/600]

dart::TEST_CASE ( IsolateReload_ConstructorChanged  )

Definition at line 730 of file isolate_reload_test.cc.

730 {
731 const char* late_tag = TestCase::LateTag();
732 // clang-format off
733 auto kScript = Utils::CStringUniquePtr(
734 OS::SCreate(nullptr,
735 "class A {\n"
736 " %s int field;\n"
737 " A() { field = 20; }\n"
738 "}\n"
739 "var savedA = A();\n"
740 "main() {\n"
741 " var newA = A();\n"
742 " return 'saved:${savedA.field} new:${newA.field}';\n"
743 "}\n",
744 late_tag),
745 std::free);
746 // clang-format on
747
748 Dart_Handle lib = TestCase::LoadTestScript(kScript.get(), nullptr);
749 EXPECT_VALID(lib);
750 EXPECT_STREQ("saved:20 new:20", SimpleInvokeStr(lib, "main"));
751
752 // clang-format off
753 auto kReloadScript = Utils::CStringUniquePtr(
754 OS::SCreate(nullptr,
755 "var _unused;"
756 "class A {\n"
757 " %s int field;\n"
758 " A() { field = 10; }\n"
759 "}\n"
760 "var savedA = A();\n"
761 "main() {\n"
762 " var newA = A();\n"
763 " return 'saved:${savedA.field} new:${newA.field}';\n"
764 "}\n",
765 late_tag),
766 std::free);
767 // clang-format on
768
769 lib = TestCase::ReloadTestScript(kReloadScript.get());
770 EXPECT_VALID(lib);
771 EXPECT_STREQ("saved:20 new:10", SimpleInvokeStr(lib, "main"));
772}

◆ TEST_CASE() [342/600]

dart::TEST_CASE ( IsolateReload_ConstToNonConstClass  )

Definition at line 4351 of file isolate_reload_test.cc.

4351 :deeply-immutable')
4352 final class B {
4353 final int x;
4354 B(this.x);
4355 }
4356 )"
4357 }};
4358 // clang-format on
4359
4360 Dart_Handle lib = TestCase::LoadTestScriptWithDFE(
4361 sizeof(sourcefiles) / sizeof(Dart_SourceFile), sourcefiles,
4362 nullptr /* resolver */, true /* finalize */, true /* incrementally */);
4363 EXPECT_VALID(lib);
4364 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, nullptr);
4365 int64_t value = 0;
4366 result = Dart_IntegerToInt64(result, &value);
4367 EXPECT_VALID(result);
4368 EXPECT_EQ(42, value);
4369
4370 // clang-format off
4371 Dart_SourceFile updated_sourcefiles[] = {
4372 {
4373 "file:///test-lib.dart",
4374 R"(
4375 final class B {
4376 final int x;
4377 B(this.x);
4378 }
4379 )"
4380 }};
4381 // clang-format on
4382
4383 {

◆ TEST_CASE() [343/600]

dart::TEST_CASE ( IsolateReload_ConstToNonConstClass_Empty  )

Definition at line 4385 of file isolate_reload_test.cc.

4387 :///test-app.dart",
4388 sizeof(updated_sourcefiles) / sizeof(Dart_SourceFile),
4389 updated_sourcefiles, &kernel_buffer, &kernel_buffer_size,
4390 true /* incrementally */);
4391 // This is rejected by class A being recompiled and the validator failing.
4392 EXPECT(error != nullptr);
4393 EXPECT_NULLPTR(kernel_buffer);
4394 }
4395}
4396
4397TEST_CASE(IsolateReload_ConstToNonConstClass) {
4398 const char* kScript = R"(
4399 class A {
4400 final dynamic x;
4401 const A(this.x);
4402 }
4403 dynamic a;
4404 main() {
4405 a = const A(1);
4406 return 'okay';
4407 }
4408 )";
4409
4410 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
4411 EXPECT_VALID(lib);
4412 EXPECT_STREQ("okay", SimpleInvokeStr(lib, "main"));
4413
4414 const char* kReloadScript = R"(
4415 class A {
4416 dynamic x;

◆ TEST_CASE() [344/600]

dart::TEST_CASE ( IsolateReload_DeeplyImmutableChange  )

Definition at line 4193 of file isolate_reload_test.cc.

4193 {
4194 const char* kScript = R"(
4195 @pragma('vm:deeply-immutable')
4196 final class A {
4197 final int x;
4198 A(this.x);
4199 }
4200 String main () {
4201 A(123);
4202 return 'okay';
4203 }
4204 )";
4205
4206 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
4207 EXPECT_VALID(lib);
4208 EXPECT_STREQ("okay", SimpleInvokeStr(lib, "main"));
4209
4210 const char* kReloadScript = R"(
4211 final class A {
4212 final int x;
4213 A(this.x);
4214 }
4215 String main () {
4216 A(123);
4217 return 'okay';
4218 }
4219 )";
4220
4221 lib = TestCase::ReloadTestScript(kReloadScript);
4222 EXPECT_ERROR(lib,
4223 "Classes cannot change their @pragma('vm:deeply-immutable'): "
4224 "Library:'file:///test-lib' Class: A");
4225}

◆ TEST_CASE() [345/600]

dart::TEST_CASE ( IsolateReload_DeeplyImmutableChange_2  )

Definition at line 4227 of file isolate_reload_test.cc.

4227 {
4228 const char* kScript = R"(
4229 final class A {
4230 final int x;
4231 A(this.x);
4232 }
4233 String main () {
4234 A(123);
4235 return 'okay';
4236 }
4237 )";
4238
4239 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
4240 EXPECT_VALID(lib);
4241 EXPECT_STREQ("okay", SimpleInvokeStr(lib, "main"));
4242
4243 const char* kReloadScript = R"(
4244 @pragma('vm:deeply-immutable')
4245 final class A {
4246 final int x;
4247 A(this.x);
4248 }
4249 String main () {
4250 A(123);
4251 return 'okay';
4252 }
4253 )";
4254
4255 lib = TestCase::ReloadTestScript(kReloadScript);
4256 EXPECT_ERROR(lib,
4257 "Classes cannot change their @pragma('vm:deeply-immutable'): "
4258 "Library:'file:///test-lib' Class: A");
4259}

◆ TEST_CASE() [346/600]

dart::TEST_CASE ( IsolateReload_DeeplyImmutableChange_MultiLib  )

Definition at line 4261 of file isolate_reload_test.cc.

4261 {
4262 // clang-format off
4263 Dart_SourceFile sourcefiles[] = {
4264 {
4265 "file:///test-app.dart",
4266 R"(
4267 import 'test-lib.dart';
4268
4269 @pragma('vm:deeply-immutable')
4270 final class A {
4271 final B b;
4272 A(this.b);
4273 }
4274 int main () {
4275 A(B(123));
4276 return 42;
4277 }
4278 )",
4279 },
4280 {
4281 "file:///test-lib.dart",
4282 R"(
4283 @pragma('vm:deeply-immutable')
4284 final class B {
4285 final int x;
4286 B(this.x);
4287 }
4288 )"
4289 }};
4290 // clang-format on
4291
4292 Dart_Handle lib = TestCase::LoadTestScriptWithDFE(
4293 sizeof(sourcefiles) / sizeof(Dart_SourceFile), sourcefiles,
4294 nullptr /* resolver */, true /* finalize */, true /* incrementally */);
4295 EXPECT_VALID(lib);
4296 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, nullptr);
4297 int64_t value = 0;
4300 EXPECT_EQ(42, value);
4301
4302 // clang-format off
4303 Dart_SourceFile updated_sourcefiles[] = {
4304 {

◆ TEST_CASE() [347/600]

dart::TEST_CASE ( IsolateReload_DeeplyImmutableChange_TypeBound  )

Definition at line 4306 of file isolate_reload_test.cc.

4307 {
4308 final int x;
4309 B(this.x);
4310 }
4311 )"
4312 }};
4313 // clang-format on
4314
4315 {
4316 const uint8_t* kernel_buffer = nullptr;
4317 intptr_t kernel_buffer_size = 0;
4318 char* error = TestCase::CompileTestScriptWithDFE(
4319 "file:///test-app.dart",
4320 sizeof(updated_sourcefiles) / sizeof(Dart_SourceFile),
4321 updated_sourcefiles, &kernel_buffer, &kernel_buffer_size,
4322 true /* incrementally */);
4323 // This is rejected by class A being recompiled and the validator failing.
4324 EXPECT(error != nullptr);
4325 EXPECT_NULLPTR(kernel_buffer);
4326 }
4327}
4328
4329TEST_CASE(IsolateReload_DeeplyImmutableChange_TypeBound) {
4330 // clang-format off
4331 Dart_SourceFile sourcefiles[] = {
4332 {
4333 "file:///test-app.dart",
4334 R"(
4335 import 'test-lib.dart';
4336
4337 @pragma('vm:deeply-immutable')
4338 final class A<T extends B> {
4339 final T b;
4340 A(this.b);
4341 }
4342 int main () {
4343 A(B(123));
4344 return 42;
4345 }
4346 )",
4347 },
4348 {
4349 "file:///test-lib.dart",
#define B

◆ TEST_CASE() [348/600]

dart::TEST_CASE ( IsolateReload_DeleteStaticField  )

Definition at line 5411 of file isolate_reload_test.cc.

5412 {
5413 const char* kScript =
5414 "class C {\n"
5415 " static var x = 42;\n"
5416 "}\n"
5417 "main() {\n"
5418 " return '${C.x}';\n"
5419 "}\n";
5420
5421 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
5422 EXPECT_VALID(lib);
5423 EXPECT_STREQ("42", SimpleInvokeStr(lib, "main"));
5424
5425 const char* kReloadScript =
5426 "class C {\n"
5427 " static var x = 13;\n"
5428 "}\n"
5429 "main() {\n"
5430 " return '${C.x}';\n"
5431 "}\n";
5432
5433 lib = TestCase::ReloadTestScript(kReloadScript);
5434 EXPECT_VALID(lib);
5435 // Newly loaded field maintained old static value
5436 EXPECT_STREQ("42", SimpleInvokeStr(lib, "main"));
5437}
5438
5439class CidCountingVisitor : public ObjectVisitor {
5440 public:
5441 explicit CidCountingVisitor(intptr_t cid) : cid_(cid) {}
5442 virtual ~CidCountingVisitor() {}
5443
5444 virtual void VisitObject(ObjectPtr obj) {
5445 if (obj->GetClassId() == cid_) {
5446 count_++;
5447 }
5448 }
5449
5450 intptr_t count() const { return count_; }
5451
5452 private:
5453 intptr_t cid_;
5454 intptr_t count_ = 0;
5455};
5456
5457TEST_CASE(IsolateReload_DeleteStaticField) {
5458 const char* kScript =
5459 "class C {\n"
5460 "}\n"
5461 "class Foo {\n"
5462 "static var x = C();\n"
5463 "}\n"

◆ TEST_CASE() [349/600]

dart::TEST_CASE ( IsolateReload_EnumAddition  )

Definition at line 2096 of file isolate_reload_test.cc.

2096 {
2097 const char* kScript =
2098 "enum Fruit {\n"
2099 " Apple,\n"
2100 " Banana,\n"
2101 "}\n"
2102 "var x;\n"
2103 "main() {\n"
2104 " return Fruit.Apple.toString();\n"
2105 "}\n";
2106
2107 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
2108 EXPECT_VALID(lib);
2109 EXPECT_STREQ("Fruit.Apple", SimpleInvokeStr(lib, "main"));
2110
2111 const char* kReloadScript =
2112 "enum Fruit {\n"
2113 " Apple,\n"
2114 " Cantaloupe,\n"
2115 " Banana,\n"
2116 "}\n"
2117 "var x;\n"
2118 "main() {\n"
2119 " String r = '${Fruit.Apple.index}/${Fruit.Apple} ';\n"
2120 " r += '${Fruit.Cantaloupe.index}/${Fruit.Cantaloupe} ';\n"
2121 " r += '${Fruit.Banana.index}/${Fruit.Banana}';\n"
2122 " return r;\n"
2123 "}\n";
2124
2125 lib = TestCase::ReloadTestScript(kReloadScript);
2126 EXPECT_VALID(lib);
2127 EXPECT_STREQ("0/Fruit.Apple 1/Fruit.Cantaloupe 2/Fruit.Banana",
2128 SimpleInvokeStr(lib, "main"));
2129}

◆ TEST_CASE() [350/600]

dart::TEST_CASE ( IsolateReload_EnumDelete  )

Definition at line 2181 of file isolate_reload_test.cc.

2181 {
2182 const char* kScript =
2183 "enum Fruit {\n"
2184 " Apple,\n"
2185 " Banana,\n"
2186 " Cantaloupe,\n"
2187 "}\n"
2188 "var x;\n"
2189 "main() {\n"
2190 " x = Fruit.Cantaloupe;\n"
2191 " return Fruit.Apple.toString();\n"
2192 "}\n";
2193
2194 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
2195 EXPECT_VALID(lib);
2196 EXPECT_STREQ("Fruit.Apple", SimpleInvokeStr(lib, "main"));
2197
2198 // Delete 'Cantaloupe' but make sure that we can still invoke toString,
2199 // and access the hashCode and index properties.
2200
2201 const char* kReloadScript =
2202 "enum Fruit {\n"
2203 " Apple,\n"
2204 " Banana,\n"
2205 "}\n"
2206 "var x;\n"
2207 "main() {\n"
2208 " String r = '$x ${x.hashCode is int} ${x.index}';\n"
2209 " return r;\n"
2210 "}\n";
2211
2212 lib = TestCase::ReloadTestScript(kReloadScript);
2213 EXPECT_VALID(lib);
2214 EXPECT_STREQ("Fruit.Deleted enum value from Fruit true -1",
2215 SimpleInvokeStr(lib, "main"));
2216}

◆ TEST_CASE() [351/600]

dart::TEST_CASE ( IsolateReload_EnumEquality  )

Definition at line 1990 of file isolate_reload_test.cc.

1990 {
1991 const char* kScript =
1992 "enum Fruit {\n"
1993 " Apple,\n"
1994 " Banana,\n"
1995 "}\n"
1996 "var x;\n"
1997 "main() {\n"
1998 " x = Fruit.Banana;\n"
1999 " return Fruit.Apple.toString();\n"
2000 "}\n";
2001
2002 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
2003 EXPECT_VALID(lib);
2004
2005 EXPECT_STREQ("Fruit.Apple", SimpleInvokeStr(lib, "main"));
2006
2007 const char* kReloadScript =
2008 "enum Fruit {\n"
2009 " Apple,\n"
2010 " Banana,\n"
2011 "}\n"
2012 "var x;\n"
2013 "main() {\n"
2014 " if (x == Fruit.Banana) {\n"
2015 " return 'yes';\n"
2016 " } else {\n"
2017 " return 'no';\n"
2018 " }\n"
2019 "}\n";
2020
2021 lib = TestCase::ReloadTestScript(kReloadScript);
2022 EXPECT_VALID(lib);
2023 EXPECT_STREQ("yes", SimpleInvokeStr(lib, "main"));
2024}

◆ TEST_CASE() [352/600]

dart::TEST_CASE ( IsolateReload_EnumIdentical  )

Definition at line 2026 of file isolate_reload_test.cc.

2026 {
2027 const char* kScript =
2028 "enum Fruit {\n"
2029 " Apple,\n"
2030 " Banana,\n"
2031 "}\n"
2032 "var x;\n"
2033 "main() {\n"
2034 " x = Fruit.Banana;\n"
2035 " return Fruit.Apple.toString();\n"
2036 "}\n";
2037
2038 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
2039 EXPECT_VALID(lib);
2040 EXPECT_STREQ("Fruit.Apple", SimpleInvokeStr(lib, "main"));
2041
2042 const char* kReloadScript =
2043 "enum Fruit {\n"
2044 " Apple,\n"
2045 " Banana,\n"
2046 "}\n"
2047 "var x;\n"
2048 "main() {\n"
2049 " if (identical(x, Fruit.Banana)) {\n"
2050 " return 'yes';\n"
2051 " } else {\n"
2052 " return 'no';\n"
2053 " }\n"
2054 "}\n";
2055
2056 lib = TestCase::ReloadTestScript(kReloadScript);
2057 EXPECT_VALID(lib);
2058 EXPECT_STREQ("yes", SimpleInvokeStr(lib, "main"));
2059}

◆ TEST_CASE() [353/600]

dart::TEST_CASE ( IsolateReload_EnumIdentityReload  )

Definition at line 2218 of file isolate_reload_test.cc.

2218 {
2219 const char* kScript =
2220 "enum Fruit {\n"
2221 " Apple,\n"
2222 " Banana,\n"
2223 " Cantaloupe,\n"
2224 "}\n"
2225 "var x;\n"
2226 "var y;\n"
2227 "var z;\n"
2228 "var w;\n"
2229 "main() {\n"
2230 " x = { Fruit.Apple: Fruit.Apple.index,\n"
2231 " Fruit.Banana: Fruit.Banana.index,\n"
2232 " Fruit.Cantaloupe: Fruit.Cantaloupe.index};\n"
2233 " y = Fruit.Apple;\n"
2234 " z = Fruit.Banana;\n"
2235 " w = Fruit.Cantaloupe;\n"
2236 " return Fruit.Apple.toString();\n"
2237 "}\n";
2238
2239 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
2240 EXPECT_VALID(lib);
2241 EXPECT_STREQ("Fruit.Apple", SimpleInvokeStr(lib, "main"));
2242
2243 const char* kReloadScript =
2244 "enum Fruit {\n"
2245 " Apple,\n"
2246 " Banana,\n"
2247 " Cantaloupe,\n"
2248 "}\n"
2249 "var x;\n"
2250 "var y;\n"
2251 "var z;\n"
2252 "var w;\n"
2253 "bool identityCheck(Fruit f, int index) {\n"
2254 " return identical(Fruit.values[index], f);\n"
2255 "}\n"
2256 "main() {\n"
2257 " String r = '';\n"
2258 " x.forEach((key, value) {\n"
2259 " r += '${identityCheck(key, value)} ';\n"
2260 " });\n"
2261 " r += '${x[Fruit.Apple] == Fruit.Apple.index} ';\n"
2262 " r += '${x[Fruit.Banana] == Fruit.Banana.index} ';\n"
2263 " r += '${x[Fruit.Cantaloupe] == Fruit.Cantaloupe.index} ';\n"
2264 " r += '${identical(y, Fruit.values[x[Fruit.Apple]])} ';\n"
2265 " r += '${identical(z, Fruit.values[x[Fruit.Banana]])} ';\n"
2266 " r += '${identical(w, Fruit.values[x[Fruit.Cantaloupe]])} ';\n"
2267 " return r;\n"
2268 "}\n";
2269
2270 lib = TestCase::ReloadTestScript(kReloadScript);
2271 EXPECT_VALID(lib);
2272 EXPECT_STREQ("true true true true true true true true true ",
2273 SimpleInvokeStr(lib, "main"));
2274}

◆ TEST_CASE() [354/600]

dart::TEST_CASE ( IsolateReload_EnumInMainLibraryModified  )

Definition at line 6303 of file isolate_reload_test.cc.

6305 {
6306 f.fn();
6307 return "okay";
6308 }
6309 )";
6310
6311 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
6312 EXPECT_VALID(lib);
6313 EXPECT_STREQ("okay", SimpleInvokeStr(lib, "main"));
6314
6315 lib = TestCase::ReloadTestScript(kScript);
6316 EXPECT_VALID(lib);
6317 EXPECT_STREQ("okay", SimpleInvokeStr(lib, "main"));
6318}
6319
6320// Regression test for https://github.com/dart-lang/sdk/issues/51215.
6321TEST_CASE(IsolateReload_ImplicitGetterWithLoadGuard) {
6322 const char* kLibScript = R"(
6323 import 'file:///test:isolate_reload_helper';
6324
6325 class A {
6326 int x;
6327 A(this.x);
6328 A.withUinitializedObject(int Function() callback) : x = callback();

◆ TEST_CASE() [355/600]

dart::TEST_CASE ( IsolateReload_EnumReferentShapeChangeAdd  )

Definition at line 2370 of file isolate_reload_test.cc.

2370 {
2371 const char* kScript =
2372 "class Box {\n"
2373 " final x;\n"
2374 " const Box(this.x);\n"
2375 "}\n"
2376 "enum Fruit {\n"
2377 " Apple('Apple', const Box('A')),\n"
2378 " Banana('Banana', const Box('B')),\n"
2379 " Cherry('Cherry', const Box('C')),\n"
2380 " Durian('Durian', const Box('D')),\n"
2381 " Elderberry('Elderberry', const Box('E')),\n"
2382 " Fig('Fig', const Box('F')),\n"
2383 " Grape('Grape', const Box('G')),\n"
2384 " Huckleberry('Huckleberry', const Box('H')),\n"
2385 " Jackfruit('Jackfruit', const Box('J'));\n"
2386 " const Fruit(this.name, this.initial);\n"
2387 " final String name;\n"
2388 " final Box initial;\n"
2389 "}\n"
2390 "var retained;\n"
2391 "main() {\n"
2392 " retained = Fruit.Apple;\n"
2393 " return retained.toString();\n"
2394 "}\n";
2395
2396 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
2397 EXPECT_VALID(lib);
2398 EXPECT_STREQ("Fruit.Apple", SimpleInvokeStr(lib, "main"));
2399
2400 const char* kReloadScript =
2401 "class Box {\n"
2402 " final x;\n"
2403 " final y;\n"
2404 " final z;\n"
2405 " const Box(this.x, this.y, this.z);\n"
2406 "}\n"
2407 "enum Fruit {\n"
2408 " Apple('Apple', const Box('A', 0, 0)),\n"
2409 " Banana('Banana', const Box('B', 0, 0)),\n"
2410 " Cherry('Cherry', const Box('C', 0, 0)),\n"
2411 " Durian('Durian', const Box('D', 0, 0)),\n"
2412 " Elderberry('Elderberry', const Box('E', 0, 0)),\n"
2413 " Fig('Fig', const Box('F', 0, 0)),\n"
2414 " Grape('Grape', const Box('G', 0, 0)),\n"
2415 " Huckleberry('Huckleberry', const Box('H', 0, 0)),\n"
2416 " Jackfruit('Jackfruit', const Box('J', 0, 0)),\n"
2417 " Lemon('Lemon', const Box('L', 0, 0));\n"
2418 " const Fruit(this.name, this.initial);\n"
2419 " final String name;\n"
2420 " final Box initial;\n"
2421 "}\n"
2422 "var retained;\n"
2423 "main() {\n"
2424 " return retained.toString();\n"
2425 "}\n";
2426
2427 lib = TestCase::ReloadTestScript(kReloadScript);
2428 EXPECT_VALID(lib);
2429 EXPECT_STREQ("Fruit.Apple", SimpleInvokeStr(lib, "main"));
2430}

◆ TEST_CASE() [356/600]

dart::TEST_CASE ( IsolateReload_EnumReorderIdentical  )

Definition at line 2061 of file isolate_reload_test.cc.

2061 {
2062 const char* kScript =
2063 "enum Fruit {\n"
2064 " Apple,\n"
2065 " Banana,\n"
2066 "}\n"
2067 "var x;\n"
2068 "main() {\n"
2069 " x = Fruit.Banana;\n"
2070 " return Fruit.Apple.toString();\n"
2071 "}\n";
2072
2073 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
2074 EXPECT_VALID(lib);
2075 EXPECT_STREQ("Fruit.Apple", SimpleInvokeStr(lib, "main"));
2076
2077 const char* kReloadScript =
2078 "enum Fruit {\n"
2079 " Banana,\n"
2080 " Apple,\n"
2081 "}\n"
2082 "var x;\n"
2083 "main() {\n"
2084 " if (identical(x, Fruit.Banana)) {\n"
2085 " return 'yes';\n"
2086 " } else {\n"
2087 " return 'no';\n"
2088 " }\n"
2089 "}\n";
2090
2091 lib = TestCase::ReloadTestScript(kReloadScript);
2092 EXPECT_VALID(lib);
2093 EXPECT_STREQ("yes", SimpleInvokeStr(lib, "main"));
2094}

◆ TEST_CASE() [357/600]

dart::TEST_CASE ( IsolateReload_EnumShapeChange  )

Definition at line 2276 of file isolate_reload_test.cc.

2276 {
2277 const char* kScript =
2278 "enum Fruit { Apple, Banana }\n"
2279 "var retained;\n"
2280 "main() {\n"
2281 " retained = Fruit.Apple;\n"
2282 " return retained.toString();\n"
2283 "}\n";
2284
2285 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
2286 EXPECT_VALID(lib);
2287 EXPECT_STREQ("Fruit.Apple", SimpleInvokeStr(lib, "main"));
2288
2289 const char* kReloadScript =
2290 "enum Fruit {\n"
2291 " Apple('Apple', 'A'),\n"
2292 " Banana('Banana', 'B');\n"
2293 " const Fruit(this.name, this.initial);\n"
2294 " final String name;\n"
2295 " final String initial;\n"
2296 "}\n"
2297 "var retained;\n"
2298 "main() {\n"
2299 " return retained.initial;\n"
2300 "}\n";
2301
2302 lib = TestCase::ReloadTestScript(kReloadScript);
2303 EXPECT_VALID(lib);
2304 EXPECT_STREQ("A", SimpleInvokeStr(lib, "main"));
2305}

◆ TEST_CASE() [358/600]

dart::TEST_CASE ( IsolateReload_EnumShapeChangeAdd  )

Definition at line 2307 of file isolate_reload_test.cc.

2307 {
2308 const char* kScript =
2309 "enum Fruit { Apple, Banana }\n"
2310 "var retained;\n"
2311 "main() {\n"
2312 " retained = Fruit.Apple;\n"
2313 " return retained.toString();\n"
2314 "}\n";
2315
2316 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
2317 EXPECT_VALID(lib);
2318 EXPECT_STREQ("Fruit.Apple", SimpleInvokeStr(lib, "main"));
2319
2320 const char* kReloadScript =
2321 "enum Fruit {\n"
2322 " Apple('Apple', 'A'),\n"
2323 " Banana('Banana', 'B'),\n"
2324 " Cherry('Cherry', 'C');\n"
2325 " const Fruit(this.name, this.initial);\n"
2326 " final String name;\n"
2327 " final String initial;\n"
2328 "}\n"
2329 "var retained;\n"
2330 "main() {\n"
2331 " return Fruit.Cherry.initial;\n"
2332 "}\n";
2333
2334 lib = TestCase::ReloadTestScript(kReloadScript);
2335 EXPECT_VALID(lib);
2336 EXPECT_STREQ("C", SimpleInvokeStr(lib, "main"));
2337}

◆ TEST_CASE() [359/600]

dart::TEST_CASE ( IsolateReload_EnumShapeChangeRemove  )

Definition at line 2339 of file isolate_reload_test.cc.

2339 {
2340 const char* kScript =
2341 "enum Fruit { Apple, Banana }\n"
2342 "var retained;\n"
2343 "main() {\n"
2344 " retained = Fruit.Banana;\n"
2345 " return retained.toString();\n"
2346 "}\n";
2347
2348 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
2349 EXPECT_VALID(lib);
2350 EXPECT_STREQ("Fruit.Banana", SimpleInvokeStr(lib, "main"));
2351
2352 const char* kReloadScript =
2353 "enum Fruit {\n"
2354 " Apple('Apple', 'A');\n"
2355 " const Fruit(this.name, this.initial);\n"
2356 " final String name;\n"
2357 " final String initial;\n"
2358 "}\n"
2359 "var retained;\n"
2360 "main() {\n"
2361 " return retained.toString();\n"
2362 "}\n";
2363
2364 lib = TestCase::ReloadTestScript(kReloadScript);
2365 EXPECT_VALID(lib);
2366 EXPECT_STREQ("Fruit.Deleted enum value from Fruit",
2367 SimpleInvokeStr(lib, "main"));
2368}

◆ TEST_CASE() [360/600]

dart::TEST_CASE ( IsolateReload_EnumToNotEnum  )

Definition at line 2131 of file isolate_reload_test.cc.

2131 {
2132 const char* kScript =
2133 "enum Fruit {\n"
2134 " Apple\n"
2135 "}\n"
2136 "main() {\n"
2137 " return Fruit.Apple.toString();\n"
2138 "}\n";
2139
2140 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
2141 EXPECT_VALID(lib);
2142 EXPECT_STREQ("Fruit.Apple", SimpleInvokeStr(lib, "main"));
2143
2144 const char* kReloadScript =
2145 "class Fruit {\n"
2146 " final int zero = 0;\n"
2147 "}\n"
2148 "main() {\n"
2149 " return new Fruit().zero.toString();\n"
2150 "}\n";
2151
2152 Dart_Handle result = TestCase::ReloadTestScript(kReloadScript);
2153 EXPECT_ERROR(result, "Enum class cannot be redefined to be a non-enum class");
2154}

◆ TEST_CASE() [361/600]

dart::TEST_CASE ( IsolateReload_EnumValuesToString  )

Definition at line 3372 of file isolate_reload_test.cc.

3372 {
3373 const char* kScript =
3374 "enum Fruit {\n"
3375 " Apple,\n"
3376 " Banana,\n"
3377 "}\n"
3378 "var x;\n"
3379 "main() {\n"
3380 " String r = '';\n"
3381 " r += Fruit.Apple.toString();\n"
3382 " r += ' ';\n"
3383 " r += Fruit.Banana.toString();\n"
3384 " return r;\n"
3385 "}\n";
3386
3387 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
3388 EXPECT_VALID(lib);
3389 EXPECT_STREQ("Fruit.Apple Fruit.Banana", SimpleInvokeStr(lib, "main"));
3390
3391 // Insert 'Cantaloupe'.
3392
3393 const char* kReloadScript =
3394 "enum Fruit {\n"
3395 " Apple,\n"
3396 " Cantaloupe,\n"
3397 " Banana\n"
3398 "}\n"
3399 "var x;\n"
3400 "main() {\n"
3401 " String r = '';\n"
3402 " r += Fruit.Apple.toString();\n"
3403 " r += ' ';\n"
3404 " r += Fruit.Cantaloupe.toString();\n"
3405 " r += ' ';\n"
3406 " r += Fruit.Banana.toString();\n"
3407 " return r;\n"
3408 "}\n";
3409
3410 lib = TestCase::ReloadTestScript(kReloadScript);
3411 EXPECT_VALID(lib);
3412 EXPECT_STREQ("Fruit.Apple Fruit.Cantaloupe Fruit.Banana",
3413 SimpleInvokeStr(lib, "main"));
3414}

◆ TEST_CASE() [362/600]

dart::TEST_CASE ( IsolateReload_EnumWithSet  )

Definition at line 6382 of file isolate_reload_test.cc.

6382 {\n"
6383 " return Foo().toString();\n"
6384 "}\n";
6385
6386 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
6387 EXPECT_VALID(lib);
6388 EXPECT_VALID(Dart_FinalizeAllClasses());
6389 EXPECT_STREQ("foo", SimpleInvokeStr(lib, "main"));
6390
6391 const char* kReloadScript =
6392 "enum Bar { bar }\n"
6393 "class Foo { int? a; String? b; toString() => 'foo'; }"
6394 "main() {\n"
6395 " return Foo().toString();\n"
6396 "}\n";
6397
6398 lib = TestCase::ReloadTestScript(kReloadScript);
6399 EXPECT_VALID(lib);
6400
6401 // Modification of an imported library propagates to the importing library.
6402 EXPECT_STREQ("foo", SimpleInvokeStr(lib, "main"));
6403}
6404
6405TEST_CASE(IsolateReload_KeepPragma1) {
6406 // Old version of closure function bar() has a pragma.
6407 const char* kScript =
6408 "import 'file:///test:isolate_reload_helper';\n"
6409 "foo() {\n"
6410 " @pragma('vm:prefer-inline')\n"
6411 " void bar() {}\n"
6412 " return bar;\n"
6413 "}"
6414 "main() {\n"
6415 " reloadTest();\n"
6416 "}\n";
6417
6418 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
6419 EXPECT_VALID(lib);
6420
6421 // New version of closure function bar() doesn't have a pragma.
6422 const char* kReloadScript =
6423 "import 'file:///test:isolate_reload_helper';\n"
6424 "foo() {\n"
6425 " void bar() {}\n"
6426 " return bar;\n"
6427 "}"
6428 "main() {\n"
6429 " reloadTest();\n"
6430 "}\n";
6431
6432 EXPECT_VALID(TestCase::SetReloadTestScript(kReloadScript));
6433
6434 Dart_Handle foo1_result = Dart_Invoke(lib, NewString("foo"), 0, nullptr);
6435 EXPECT_VALID(foo1_result);
6436
6437 EXPECT_VALID(Dart_Invoke(lib, NewString("main"), 0, nullptr));
6438
6439 Dart_Handle foo2_result = Dart_Invoke(lib, NewString("foo"), 0, nullptr);
6440 EXPECT_VALID(foo2_result);
6441
6442 TransitionNativeToVM transition(thread);
6443 const auto& bar1 = Function::Handle(
6444 Closure::Handle(Closure::RawCast(Api::UnwrapHandle(foo1_result)))
6445 .function());
6446 const auto& bar2 = Function::Handle(
6447 Closure::Handle(Closure::RawCast(Api::UnwrapHandle(foo2_result)))
6448 .function());
6449 // Pragma should be retained on the old function,
6450 // and should not appear on the new function.
6451 EXPECT(Library::FindPragma(thread, /*only_core=*/false, bar1,
6452 Symbols::vm_prefer_inline()));
6453 EXPECT(!Library::FindPragma(thread, /*only_core=*/false, bar2,

◆ TEST_CASE() [363/600]

dart::TEST_CASE ( IsolateReload_ExistingFieldBoxedToUnboxed  )

Definition at line 5554 of file isolate_reload_test.cc.

5558 :typed_data';
5559
5560 void doubleEq(double got, double expected) {
5561 if (got != expected) throw 'expected $expected got $got';
5562 }
5563

◆ TEST_CASE() [364/600]

dart::TEST_CASE ( IsolateReload_ExistingFieldChangesType  )

Definition at line 5528 of file isolate_reload_test.cc.

5528 {
5529 if (got.equal(expected).signMask != 0xf) throw 'expected $expected got $got';
5530 }
5531
5532 class Foo {

◆ TEST_CASE() [365/600]

dart::TEST_CASE ( IsolateReload_ExistingFieldChangesTypeIndirect  )

Definition at line 5608 of file isolate_reload_test.cc.

5612 {
5614 /*prefix=*/"double a = 1.5;",
5615 /*suffix=*/"Float32x4 b = Float32x4(1.0, 2.0, 3.0, 4.0);", /*verify=*/
5616 "doubleEq(value.a, 1.5); float32x4Eq(value.b, Float32x4(1.0, 2.0, 3.0, "
5617 "4.0));",
5618 /*from_type=*/"double", /*from_init=*/"42.0", /*to_type=*/"String",
5619 /*to_init=*/"'42'");
5620}
5621
5622TEST_CASE(IsolateReload_ExistingFieldBoxedToUnboxed) {
5623 // Note: underlying field will not actually be unboxed.
5624 TestReloadWithFieldChange(
5625 /*prefix=*/"double a = 1.5;",
5626 /*suffix=*/"Float32x4 b = Float32x4(1.0, 2.0, 3.0, 4.0);", /*verify=*/
5627 "doubleEq(value.a, 1.5); float32x4Eq(value.b, Float32x4(1.0, 2.0, 3.0, "
5628 "4.0));",
5629 /*from_type=*/"String", /*from_init=*/"'42.0'", /*to_type=*/"double",
5630 /*to_init=*/"42.0");
5631}
5632
5633TEST_CASE(IsolateReload_ExistingFieldUnboxedToUnboxed) {
5634 // Note: underlying field will not actually be unboxed.
5636 /*prefix=*/"double a = 1.5;",
5637 /*suffix=*/"Float32x4 b = Float32x4(1.0, 2.0, 3.0, 4.0);", /*verify=*/
5638 "doubleEq(value.a, 1.5); float32x4Eq(value.b, Float32x4(1.0, 2.0, 3.0, "
5639 "4.0));",
5640 /*from_type=*/"double", /*from_init=*/"42.0", /*to_type=*/"Float32x4",
5641 /*to_init=*/"Float32x4(1.0, 2.0, 3.0, 4.0)");
5642}
5643
5644TEST_CASE(IsolateReload_ExistingStaticFieldChangesType) {
5645 const char* kScript = R"(
5646 int value = init();
5647 init() => 42;
5648 main() {
5649 return value.toString();
5650 }
5651 )";
5652
5653 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
5654 EXPECT_VALID(lib);
static void TestReloadWithFieldChange(const char *prefix, const char *suffix, const char *verify, const char *from_type, const char *from_init, const char *to_type, const char *to_init)

◆ TEST_CASE() [366/600]

dart::TEST_CASE ( IsolateReload_ExistingFieldChangesTypeIndirectFunction  )

Definition at line 5778 of file isolate_reload_test.cc.

5785 {}
5786 class B {}
5787 class Foo {
5788 List<A> x;
5789 Foo(this.x);
5790 }
5791 %s Foo value;
5792 main() {
5793 try {
5794 return value.x.toString();
5795 } catch (e) {
5796 return e.toString();
5797 }
5798 }
5799 )", late_tag), std::free);
5800 // clang-format on
5801
5802 lib = TestCase::ReloadTestScript(kReloadScript.get());
5803 EXPECT_VALID(lib);
5804 EXPECT_STREQ(
5805 "type 'List<B>' is not a subtype of type 'List<A>' of 'function result'",
5806 SimpleInvokeStr(lib, "main"));
5807}
5808
5809TEST_CASE(IsolateReload_ExistingStaticFieldChangesTypeIndirectGeneric) {
5810 const char* kScript = R"(
5811 class A {}
5812 class B extends A {}
5813 List<A> value = init();
5814 init() => List<B>.empty();
5815 main() {
5816 return value.toString();
5817 }
5818 )";
5819
5820 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
5821 EXPECT_VALID(lib);
5822 EXPECT_STREQ("[]", SimpleInvokeStr(lib, "main"));
5823
5824 // B is no longer a subtype of A.
5825 const char* kReloadScript = R"(
5826 class A {}
5827 class B {}
5828 List<A> value = init();

◆ TEST_CASE() [367/600]

dart::TEST_CASE ( IsolateReload_ExistingFieldChangesTypeIndirectGeneric  )

Definition at line 5692 of file isolate_reload_test.cc.

5701 {}
5702 class B {}
5703 class Foo {
5704 A x;
5705 Foo(this.x);
5706 }
5707 %s Foo value;
5708 main() {
5709 try {
5710 return value.x.toString();
5711 } catch (e) {
5712 return e.toString();
5713 }
5714 }
5715 )", late_tag), std::free);
5716 // clang-format on
5717
5718 lib = TestCase::ReloadTestScript(kReloadScript.get());
5719 EXPECT_VALID(lib);
5720 EXPECT_STREQ("type 'B' is not a subtype of type 'A' of 'function result'",
5721 SimpleInvokeStr(lib, "main"));
5722}
5723
5724TEST_CASE(IsolateReload_ExistingStaticFieldChangesTypeIndirect) {
5725 const char* kScript = R"(
5726 class A {}
5727 class B extends A {}
5728 A value = init();
5729 init() => new B();
5730 main() {
5731 return value.toString();
5732 }
5733 )";
5734
5735 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
5736 EXPECT_VALID(lib);
5737 EXPECT_STREQ("Instance of 'B'", SimpleInvokeStr(lib, "main"));
5738
5739 // B is no longer a subtype of A.

◆ TEST_CASE() [368/600]

dart::TEST_CASE ( IsolateReload_ExistingFieldChangesTypeWithOtherUnboxedFields  )

Definition at line 5534 of file isolate_reload_test.cc.

5538 {
5539 value = Foo();
5540 %s
5541 return 'Okay';
5542 }

◆ TEST_CASE() [369/600]

dart::TEST_CASE ( IsolateReload_ExistingFieldUnboxedToBoxed  )

Definition at line 5544 of file isolate_reload_test.cc.

◆ TEST_CASE() [370/600]

dart::TEST_CASE ( IsolateReload_ExistingFieldUnboxedToUnboxed  )

Definition at line 5565 of file isolate_reload_test.cc.

5568 {
5569 %s
5570 %s x = %s;
5571 %s
5572 }
5573 %s Foo value;
5574 main() {

◆ TEST_CASE() [371/600]

dart::TEST_CASE ( IsolateReload_ExistingStaticFieldChangesType  )

Definition at line 5576 of file isolate_reload_test.cc.

5578 {
5579 return e.toString();
5580 }
5581 }
5582 )", prefix, to_type, to_init, suffix,
5583 late_tag, verify), std::free);
5584 // clang-format on
5585
5586 lib = TestCase::ReloadTestScript(kReloadScript.get());
5587 EXPECT_VALID(lib);
5588 EXPECT_STREQ(
5589 OS::SCreate(
5590 Thread::Current()->zone(),
5591 "type '%s' is not a subtype of type '%s' of 'function result'",
5592 from_type, to_type),
5593 SimpleInvokeStr(lib, "main"));
5594}
5595
5596TEST_CASE(IsolateReload_ExistingFieldChangesType) {
5597 TestReloadWithFieldChange(/*prefix=*/"", /*suffix=*/"", /*verify=*/"",
5598 /*from_type=*/"int", /*from_init=*/"42",
5599 /*to_type=*/"double", /*to_init=*/"42.0");
5600}
5601
5602TEST_CASE(IsolateReload_ExistingFieldChangesTypeWithOtherUnboxedFields) {
5603 TestReloadWithFieldChange(
5604 /*prefix=*/"double a = 1.5;",
5605 /*suffix=*/"Float32x4 b = Float32x4(1.0, 2.0, 3.0, 4.0);", /*verify=*/
5606 "doubleEq(value.a, 1.5); float32x4Eq(value.b, Float32x4(1.0, 2.0, 3.0, "

◆ TEST_CASE() [372/600]

dart::TEST_CASE ( IsolateReload_ExistingStaticFieldChangesTypeIndirect  )

Definition at line 5656 of file isolate_reload_test.cc.

5660 {
5661 try {
5662 return value.toString();
5663 } catch (e) {
5664 return e.toString();
5665 }
5666 }
5667 )";
5668
5669 lib = TestCase::ReloadTestScript(kReloadScript);
5670 EXPECT_VALID(lib);
5671 EXPECT_STREQ(
5672 "type 'int' is not a subtype of type 'double' of 'function result'",
5673 SimpleInvokeStr(lib, "main"));
5674}
5675
5676TEST_CASE(IsolateReload_ExistingFieldChangesTypeIndirect) {
5677 const char* late_tag = TestCase::LateTag();
5678 // clang-format off
5679 auto kScript = Utils::CStringUniquePtr(OS::SCreate(nullptr, R"(
5680 class A {}
5681 class B extends A {}
5682 class Foo {
5683 A x;
5684 Foo(this.x);
5685 }
5686 %s Foo value;
5687 main() {
5688 value = Foo(B());
5689 return 'Okay';
5690 }

◆ TEST_CASE() [373/600]

dart::TEST_CASE ( IsolateReload_ExistingStaticFieldChangesTypeIndirectFunction  )

Definition at line 5830 of file isolate_reload_test.cc.

5830 {
5831 try {
5832 return value.toString();
5833 } catch (e) {
5834 return e.toString();
5835 }
5836 }
5837 )";
5838
5839 lib = TestCase::ReloadTestScript(kReloadScript);
5840 EXPECT_VALID(lib);
5841 EXPECT_STREQ(
5842 "type 'List<B>' is not a subtype of type 'List<A>' of 'function result'",
5843 SimpleInvokeStr(lib, "main"));
5844}
5845
5846TEST_CASE(IsolateReload_ExistingFieldChangesTypeIndirectFunction) {
5847 const char* late_tag = TestCase::LateTag();
5848 // clang-format off
5849 auto kScript = Utils::CStringUniquePtr(OS::SCreate(nullptr, R"(
5850 class A {}
5851 class B extends A {}
5852 typedef bool Predicate(B b);
5853 class Foo {
5854 Predicate x;
5855 Foo(this.x);
5856 }
5857 %s Foo value;
5858 main() {
5859 value = Foo((A a) => true);
5860 return 'Okay';
5861 }
5862 )", late_tag), std::free);
5863 // clang-format on
5864
5865 Dart_Handle lib = TestCase::LoadTestScript(kScript.get(), nullptr);
5866 EXPECT_VALID(lib);
5867 EXPECT_STREQ("Okay", SimpleInvokeStr(lib, "main"));
5868

◆ TEST_CASE() [374/600]

dart::TEST_CASE ( IsolateReload_ExistingStaticFieldChangesTypeIndirectGeneric  )

Definition at line 5741 of file isolate_reload_test.cc.

5741 {}
5742 class B {}
5743 A value = init();
5744 init() => new A();
5745 main() {
5746 try {
5747 return value.toString();
5748 } catch (e) {
5749 return e.toString();
5750 }
5751 }
5752 )";
5753
5754 lib = TestCase::ReloadTestScript(kReloadScript);
5755 EXPECT_VALID(lib);
5756 EXPECT_STREQ("type 'B' is not a subtype of type 'A' of 'function result'",
5757 SimpleInvokeStr(lib, "main"));
5758}
5759
5760TEST_CASE(IsolateReload_ExistingFieldChangesTypeIndirectGeneric) {
5761 const char* late_tag = TestCase::LateTag();
5762 // clang-format off
5763 auto kScript = Utils::CStringUniquePtr(OS::SCreate(nullptr, R"(
5764 class A {}
5765 class B extends A {}
5766 class Foo {
5767 List<A> x;
5768 Foo(this.x);
5769 }
5770 %s Foo value;
5771 main() {
5772 value = Foo(List<B>.empty());
5773 return 'Okay';
5774 }
5775 )", late_tag), std::free);
5776 // clang-format on

◆ TEST_CASE() [375/600]

dart::TEST_CASE ( IsolateReload_ExportedLibModified  )

Definition at line 4599 of file isolate_reload_test.cc.

4605 {
4606 const char* kImportScript = "importedFunc() => 'fancy';";
4607 TestCase::AddTestLib("test:lib1", kImportScript);
4608
4609 const char* kScript =
4610 "import 'test:lib1' as cobra;\n"
4611 "main() {\n"
4612 " return cobra.importedFunc() + ' feast';\n"
4613 "}\n";
4614
4615 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
4616 EXPECT_VALID(lib);
4617 EXPECT_STREQ("fancy feast", SimpleInvokeStr(lib, "main"));
4618
4619 const char* kReloadImportScript = "importedFunc() => 'bossy';";
4620 TestCase::AddTestLib("test:lib1", kReloadImportScript);
4621
4622 const char* kReloadScript =
4623 "import 'test:lib1' as cobra;\n"
4624 "main() {\n"
4625 " return cobra.importedFunc() + ' pants';\n"
4626 "}\n";
4627
4628 Dart_SetFileModifiedCallback(&ImportModifiedCallback);
4629 lib = TestCase::ReloadTestScript(kReloadScript);
4630 EXPECT_VALID(lib);
4632
DART_EXPORT char * Dart_SetFileModifiedCallback(Dart_FileModifiedCallback file_modified_callback)

◆ TEST_CASE() [376/600]

dart::TEST_CASE ( IsolateReload_FunctionReplacement  )

Definition at line 47 of file isolate_reload_test.cc.

47 {
48 const char* kScript =
49 "main() {\n"
50 " return 4;\n"
51 "}\n";
52
53 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
54 EXPECT_VALID(lib);
55
56 EXPECT_EQ(4, SimpleInvoke(lib, "main"));
57
58 const char* kReloadScript =
59 "var _unused;"
60 "main() {\n"
61 " return 10;\n"
62 "}\n";
63
64 lib = TestCase::ReloadTestScript(kReloadScript);
65 EXPECT_VALID(lib);
66 EXPECT_EQ(10, SimpleInvoke(lib, "main"));
67}

◆ TEST_CASE() [377/600]

dart::TEST_CASE ( IsolateReload_GenericConstructorTearOff  )

Definition at line 6212 of file isolate_reload_test.cc.

6213 {
6214 struct Component {
6216 const uint8_t* kernel_buffer;
6217 intptr_t kernel_buffer_size;
6218 };
6219
6220 // clang-format off
6221 std::array<Component, 2> components = {{
6222 {{
6223 "file:///test-app",
6224 R"(
6225 class A {}
6226 void main() {
6227 A();
6228 }
6229 )"
6230 }, nullptr, 0},
6231 {{
6232 "file:///library",
6233 R"(
6234 class B {}
6235 )"
6236 }, nullptr, 0}
6237 }};
6238 // clang-format on
6239
6240 for (auto& component : components) {
6241 CompileToKernel(component.source, &component.kernel_buffer,
6242 &component.kernel_buffer_size);
6243 TestCaseBase::AddToKernelBuffers(component.kernel_buffer);

◆ TEST_CASE() [378/600]

dart::TEST_CASE ( IsolateReload_Generics  )

Definition at line 805 of file isolate_reload_test.cc.

805 {
806 // Reload a program with generics without changing the source. We
807 // do this to produce duplication TypeArguments and make sure that
808 // the system doesn't die.
809 const char* kScript =
810 "class A {\n"
811 "}\n"
812 "class B<T extends A> {\n"
813 "}\n"
814 "main() {\n"
815 " return new B<A>().toString();\n"
816 "}\n";
817
818 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
819 EXPECT_VALID(lib);
820 EXPECT_STREQ("Instance of 'B<A>'", SimpleInvokeStr(lib, "main"));
821
822 const char* kReloadScript =
823 "class A {\n"
824 "}\n"
825 "class B<T extends A> {\n"
826 "}\n"
827 "main() {\n"
828 " return new B<A>().toString();\n"
829 "}\n";
830
831 lib = TestCase::ReloadTestScript(kReloadScript);
832 EXPECT_VALID(lib);
833 EXPECT_STREQ("Instance of 'B<A>'", SimpleInvokeStr(lib, "main"));
834}

◆ TEST_CASE() [379/600]

dart::TEST_CASE ( IsolateReload_ImplicitConstructorChanged  )

Definition at line 697 of file isolate_reload_test.cc.

697 {
698 // Note that we are checking that the value 20 gets cleared from the
699 // compile-time constants cache. To make this test work, "20" and
700 // "10" need to be at the same token position.
701 const char* kScript =
702 "class A {\n"
703 " int field = 20;\n"
704 "}\n"
705 "var savedA = new A();\n"
706 "main() {\n"
707 " var newA = new A();\n"
708 " return 'saved:${savedA.field} new:${newA.field}';\n"
709 "}\n";
710
711 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
712 EXPECT_VALID(lib);
713 EXPECT_STREQ("saved:20 new:20", SimpleInvokeStr(lib, "main"));
714
715 const char* kReloadScript =
716 "class A {\n"
717 " int field = 10;\n"
718 "}\n"
719 "var savedA = new A();\n"
720 "main() {\n"
721 " var newA = new A();\n"
722 " return 'saved:${savedA.field} new:${newA.field}';\n"
723 "}\n";
724
725 lib = TestCase::ReloadTestScript(kReloadScript);
726 EXPECT_VALID(lib);
727 EXPECT_STREQ("saved:20 new:10", SimpleInvokeStr(lib, "main"));
728}

◆ TEST_CASE() [380/600]

dart::TEST_CASE ( IsolateReload_ImplicitGetterWithLoadGuard  )

Definition at line 6246 of file isolate_reload_test.cc.

6248 : components) {
6249 kernel_buffer_size += component.kernel_buffer_size;
6250 }
6251 uint8_t* kernel_buffer = static_cast<uint8_t*>(malloc(kernel_buffer_size));
6252 TestCaseBase::AddToKernelBuffers(kernel_buffer);
6253 intptr_t pos = 0;
6254 for (auto component : components) {
6255 memcpy(kernel_buffer + pos, component.kernel_buffer, // NOLINT
6256 component.kernel_buffer_size);
6257 pos += component.kernel_buffer_size;
6258 }
6259
6260 // Load the first component into the isolate (to have something set as
6261 // root library).
6263 components[0].kernel_buffer, components[0].kernel_buffer_size);
6264 EXPECT_VALID(lib);
6266
6267 {
6268 KernelTagHandler handler(kernel_buffer, kernel_buffer_size);
6269 {
6270 // Additional API scope to prevent handles leaking into outer scope.
6272 // root_script_url does not really matter.
6273 TestCase::TriggerReload(/*root_script_url=*/"something.dill");
6275 }
6276 EXPECT(handler.was_called());
6277
6278 // Check that triggering GC does not cause finalizer registered by
6279 // tag handler to fire - meaning that kernel binary continues to live.
6280 TransitionNativeToVM transition(thread);
6281 GCTestHelper::CollectAllGarbage();
6282 EXPECT(!handler.was_finalized());
6283 }
6284}
6285
6286// Regression test for https://github.com/dart-lang/sdk/issues/50148.
6287TEST_CASE(IsolateReload_GenericConstructorTearOff) {
6288 const char* kScript = R"(
6289 typedef Create<T, R> = T Function(R ref);
6290
6291 class Base<Input> {
6292 Base(void Function(Create<void, Input> create) factory) : _factory = factory;
6293
6294 final void Function(Create<void, Input> create) _factory;
6295
6296 void fn() => _factory((ref) {});
6297 }
6298
6299 class Check<T> {
6300 Check(Create<Object?, List<T>> create);
DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_LoadLibraryFromKernel(const uint8_t *kernel_buffer, intptr_t kernel_buffer_size)

◆ TEST_CASE() [381/600]

dart::TEST_CASE ( IsolateReload_ImportedLibModified  )

Definition at line 4527 of file isolate_reload_test.cc.

4528 :///test-lib") == 0)) {
4529 return true;
4530 }
4531 return false;
4532}
4533
4534TEST_CASE(IsolateReload_MainLibModified) {
4535 const char* kImportScript = "importedFunc() => 'fancy';";
4536 TestCase::AddTestLib("test:lib1", kImportScript);
4537
4538 const char* kScript =
4539 "import 'test:lib1';\n"
4540 "main() {\n"
4541 " return importedFunc() + ' feast';\n"
4542 "}\n";
4543
4544 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
4545 EXPECT_VALID(lib);
4546 EXPECT_STREQ("fancy feast", SimpleInvokeStr(lib, "main"));
4547
4548 const char* kReloadImportScript = "importedFunc() => 'bossy';";
4549 TestCase::AddTestLib("test:lib1", kReloadImportScript);
4550
4551 const char* kReloadScript =
4552 "import 'test:lib1';\n"
4553 "main() {\n"
4554 " return importedFunc() + ' pants';\n"
4555 "}\n";
4556
4557 Dart_SetFileModifiedCallback(&MainModifiedCallback);

◆ TEST_CASE() [382/600]

dart::TEST_CASE ( IsolateReload_ImportedMixinFunction  )

Definition at line 1233 of file isolate_reload_test.cc.

1233 {
1234 const char* kImportScript =
1235 "mixin ImportedMixin {\n"
1236 " mixinFunc() => 'mixin';\n"
1237 "}\n";
1238 TestCase::AddTestLib("test:lib1", kImportScript);
1239
1240 const char* kScript =
1241 "import 'test:lib1' show ImportedMixin;\n"
1242 "class A extends Object with ImportedMixin {\n"
1243 "}"
1244 "var func = new A().mixinFunc;\n"
1245 "main() {\n"
1246 " return func();\n"
1247 "}\n";
1248
1249 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
1250 EXPECT_VALID(lib);
1251
1252 EXPECT_STREQ("mixin", SimpleInvokeStr(lib, "main"));
1253
1254 const char* kReloadScript =
1255 "import 'test:lib1' show ImportedMixin;\n"
1256 "class A extends Object with ImportedMixin {\n"
1257 "}"
1258 "var func;\n"
1259 "main() {\n"
1260 " return func();\n"
1261 "}\n";
1262
1263 lib = TestCase::ReloadTestScript(kReloadScript);
1264 EXPECT_VALID(lib);
1265 EXPECT_STREQ("mixin", SimpleInvokeStr(lib, "main"));
1266}

◆ TEST_CASE() [383/600]

dart::TEST_CASE ( IsolateReload_IncrementalCompile  )

Definition at line 69 of file isolate_reload_test.cc.

69 {
70 const char* kScriptChars =
71 "main() {\n"
72 " return 42;\n"
73 "}\n";
74 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
75 EXPECT_VALID(lib);
76 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, nullptr);
77 int64_t value = 0;
80 EXPECT_EQ(42, value);
81
82 const char* kUpdatedScriptChars =
83 "main() {\n"
84 " return 24;\n"
85 "}\n"
86 "";
87 lib = TestCase::ReloadTestScript(kUpdatedScriptChars);
88 EXPECT_VALID(lib);
89 result = Dart_Invoke(lib, NewString("main"), 0, nullptr);
92 EXPECT_EQ(24, value);
93}

◆ TEST_CASE() [384/600]

dart::TEST_CASE ( IsolateReload_KeepPragma1  )

Definition at line 6330 of file isolate_reload_test.cc.

6333 {
6334 int sum = 0;
6335 // Trigger OSR and optimize this function.
6336 for (int i = 0; i < 30000; ++i) {
6337 sum += i;
6338 }
6339 // Make sure A.get:x is compiled.
6340 int y = a.x;
6341 // Reload while having an uninitialized
6342 // object A on the stack. This should result in
6343 // a load guard for A.x.
6344 A.withUinitializedObject(() {
6345 reloadTest();
6346 return 4;
6347 });
6348 // Trigger OSR and optimize this function once again.
6349 for (int i = 0; i < 30000; ++i) {
6350 sum += i;
6351 }
6352 // Trigger deoptimization in A.get:x.
6353 // It should correctly deoptimize into an implicit
6354 // getter with a load guard.
6355 a.x = 0x8070605040302010;
6356 int z = a.x & 0xffff;
6357 return "y: $y, z: $z";
6358 }
6359 )";
6360
6361 Dart_Handle lib1 =
6362 TestCase::LoadTestLibrary("test_lib1.dart", kLibScript, nullptr);
6363 EXPECT_VALID(lib1);
6364
6365 const char* kMainScript = R"(
6366 main() {}
6367 )";
6368
6369 // Trigger hot reload during execution of 'main' from test_lib1
6370 // without reloading test_lib1, so its unoptimized code is retained.
6371 EXPECT_VALID(TestCase::LoadTestScript(kMainScript, nullptr));
6372 EXPECT_VALID(TestCase::SetReloadTestScript(kMainScript));
6373
6374 EXPECT_STREQ("y: 3, z: 8208", SimpleInvokeStr(lib1, "main"));
6375}
6376
6377// Regression test for https://github.com/dart-lang/sdk/issues/51835
6378TEST_CASE(IsolateReload_EnumInMainLibraryModified) {
6379 const char* kScript =
6380 "enum Bar { bar }\n"

◆ TEST_CASE() [385/600]

dart::TEST_CASE ( IsolateReload_KeepPragma2  )

Definition at line 6455 of file isolate_reload_test.cc.

6457 {
6458 const char* kScript =
6459 "enum Enum1 {\n"
6460 " member1({Enum2.member1, Enum2.member2}),\n"
6461 " member2({Enum2.member2}),\n"
6462 " member3({Enum2.member1}),\n"
6463 " member4({Enum2.member2, Enum2.member1}),\n"
6464 " member5({Enum2.member1}),\n"
6465 " member6({Enum2.member1});\n"
6466 " const Enum1(this.set);\n"
6467 " final Set<Enum2> set;\n"
6468 "}\n"
6469 "enum Enum2 { member1, member2; }\n"
6470 "var retained;\n"
6471 "main() {\n"
6472 " retained = Enum1.member4;\n"
6473 " return 'ok';\n"
6474 "}\n";
6475 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
6476 EXPECT_VALID(lib);
6477 EXPECT_STREQ("ok", SimpleInvokeStr(lib, "main"));
6478
6479 const char* kReloadScript =
6480 "enum Enum2 { member1, member2; }\n"
6481 "enum Enum1 {\n"
6482 " member1({Enum2.member1, Enum2.member2}),\n"
6483 " member2({Enum2.member2}),\n"
6484 " member3({Enum2.member1}),\n"
6485 " member4({Enum2.member2, Enum2.member1}),\n"
6486 " member5({Enum2.member1}),\n"
6487 " member6({Enum2.member1});\n"
6488 " const Enum1(this.set);\n"
6489 " final Set<Enum2> set;\n"
6490 "}\n"
6491 "var retained;\n"
6492 "foo(e) {\n"
6493 " return switch (e as Enum1) {\n"
6494 " Enum1.member1 => \"a\",\n"
6495 " Enum1.member2 => \"b\",\n"
6496 " Enum1.member3 => \"c\",\n"
6497 " Enum1.member4 => \"d\",\n"
6498 " Enum1.member5 => \"e\",\n"
6499 " Enum1.member6 => \"f\",\n"
6500 " };\n"
6501 "}\n"
6502 "main() {\n"
6503 " return foo(retained);\n"
6504 "}\n";
6505
6506 lib = TestCase::ReloadTestScript(kReloadScript);
6507 EXPECT_VALID(lib);
6508

◆ TEST_CASE() [386/600]

dart::TEST_CASE ( IsolateReload_KeepPragma3  )

Definition at line 6510 of file isolate_reload_test.cc.

6522 {
6523 constants.SetAt(i, Object::sentinel());
6524 }
6525 }
6526
6527 EXPECT_STREQ("d", SimpleInvokeStr(lib, "main"));
6528}
6529
6530TEST_CASE(IsolateReload_KeepPragma2) {
6531 // Old version of closure function bar() has a pragma.
6532 const char* kScript =
6533 "import 'file:///test:isolate_reload_helper';\n"
6534 "foo() {\n"
6535 " @pragma('vm:prefer-inline')\n"
6536 " void bar() {}\n"
6537 " return bar;\n"
6538 "}"
6539 "main() {\n"
6540 " reloadTest();\n"
6541 "}\n";
6542
6543 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
6544 EXPECT_VALID(lib);
6545
6546 // New version of closure function bar() has a different pragma.
6547 const char* kReloadScript =
6548 "import 'file:///test:isolate_reload_helper';\n"
6549 "foo() {\n"
6550 " @pragma('vm:never-inline')\n"
6551 " void bar() {}\n"
6552 " return bar;\n"
6553 "}"
6554 "main() {\n"
6555 " reloadTest();\n"
6556 "}\n";
6557
6558 EXPECT_VALID(TestCase::SetReloadTestScript(kReloadScript));
6559

◆ TEST_CASE() [387/600]

dart::TEST_CASE ( IsolateReload_KernelIncrementalCompile  )

Definition at line 95 of file isolate_reload_test.cc.

95 {
96 // clang-format off
97 Dart_SourceFile sourcefiles[] = {
98 {
99 "file:///test-app",
100 "main() {\n"
101 " return 42;\n"
102 "}\n",
103 }};
104 // clang-format on
105
106 Dart_Handle lib = TestCase::LoadTestScriptWithDFE(
107 sizeof(sourcefiles) / sizeof(Dart_SourceFile), sourcefiles,
108 nullptr /* resolver */, true /* finalize */, true /* incrementally */);
109 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, nullptr);
110 int64_t value = 0;
113 EXPECT_EQ(42, value);
114
115 // clang-format off
116 Dart_SourceFile updated_sourcefiles[] = {
117 {
118 "file:///test-app",
119 "main() {\n"
120 " return 24;\n"
121 "}\n"
122 ""
123 }};
124 // clang-format on
125 {
126 const uint8_t* kernel_buffer = nullptr;
127 intptr_t kernel_buffer_size = 0;
128 char* error = TestCase::CompileTestScriptWithDFE(
129 "file:///test-app",
130 sizeof(updated_sourcefiles) / sizeof(Dart_SourceFile),
131 updated_sourcefiles, &kernel_buffer, &kernel_buffer_size,
132 true /* incrementally */);
133 EXPECT(error == nullptr);
134 EXPECT_NOTNULL(kernel_buffer);
135
136 lib = TestCase::ReloadTestKernel(kernel_buffer, kernel_buffer_size);
137 EXPECT_VALID(lib);
138 }
139 result = Dart_Invoke(lib, NewString("main"), 0, nullptr);
142 EXPECT_EQ(24, value);
143}

◆ TEST_CASE() [388/600]

dart::TEST_CASE ( IsolateReload_KernelIncrementalCompileAppAndLib  )

Definition at line 145 of file isolate_reload_test.cc.

145 {
146 // clang-format off
147 Dart_SourceFile sourcefiles[] = {
148 {
149 "file:///test-app.dart",
150 "import 'test-lib.dart';\n"
151 "main() {\n"
152 " return WhatsTheMeaningOfAllThis();\n"
153 "}\n",
154 },
155 {
156 "file:///test-lib.dart",
157 "WhatsTheMeaningOfAllThis() {\n"
158 " return 42;\n"
159 "}\n",
160 }};
161 // clang-format on
162
163 Dart_Handle lib = TestCase::LoadTestScriptWithDFE(
164 sizeof(sourcefiles) / sizeof(Dart_SourceFile), sourcefiles,
165 nullptr /* resolver */, true /* finalize */, true /* incrementally */);
166 EXPECT_VALID(lib);
167 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, nullptr);
168 int64_t value = 0;
171 EXPECT_EQ(42, value);
172
173 // clang-format off
174 Dart_SourceFile updated_sourcefiles[] = {
175 {
176 "file:///test-lib.dart",
177 "WhatsTheMeaningOfAllThis() {\n"
178 " return 24;\n"
179 "}\n"
180 ""
181 }};
182 // clang-format on
183
184 {
185 const uint8_t* kernel_buffer = nullptr;
186 intptr_t kernel_buffer_size = 0;
187 char* error = TestCase::CompileTestScriptWithDFE(
188 "file:///test-app.dart",
189 sizeof(updated_sourcefiles) / sizeof(Dart_SourceFile),
190 updated_sourcefiles, &kernel_buffer, &kernel_buffer_size,
191 true /* incrementally */);
192 EXPECT(error == nullptr);
193 EXPECT_NOTNULL(kernel_buffer);
194
195 lib = TestCase::ReloadTestKernel(kernel_buffer, kernel_buffer_size);
196 EXPECT_VALID(lib);
197 }
198 result = Dart_Invoke(lib, NewString("main"), 0, nullptr);
201 EXPECT_EQ(24, value);
202}

◆ TEST_CASE() [389/600]

dart::TEST_CASE ( IsolateReload_KernelIncrementalCompileBaseClass  )

Definition at line 278 of file isolate_reload_test.cc.

278 {
279 const char* nullable_tag = TestCase::NullableTag();
280 // clang-format off
281 auto kSourceFile1 =
282 Utils::CStringUniquePtr(OS::SCreate(nullptr,
283 "class State<T, U> {\n"
284 " T%s t;\n"
285 " U%s u;\n"
286 " State(List l) {\n"
287 " t = l[0] is T ? l[0] : null;\n"
288 " u = l[1] is U ? l[1] : null;\n"
289 " }\n"
290 "}\n",
291 nullable_tag, nullable_tag),
292 std::free);
293 Dart_SourceFile sourcefiles[3] = {
294 {
295 "file:///test-app.dart",
296 "import 'test-util.dart';\n"
297 "main() {\n"
298 " var v = doWork();"
299 " return v == 42 ? 1 : v == null ? -1 : 0;\n"
300 "}\n",
301 },
302 {
303 "file:///test-lib.dart",
304 kSourceFile1.get()
305 },
306 {
307 "file:///test-util.dart",
308 "import 'test-lib.dart';\n"
309 "class MyAccountState extends State<int, String> {\n"
310 " MyAccountState(List l): super(l) {}\n"
311 " first() => t;\n"
312 "}\n"
313 "doWork() => new MyAccountState(<dynamic>[42, 'abc']).first();\n"
314 }
315 };
316 // clang-format on
317
318 Dart_Handle lib = TestCase::LoadTestScriptWithDFE(
319 sizeof(sourcefiles) / sizeof(Dart_SourceFile), sourcefiles,
320 nullptr /* resolver */, true /* finalize */, true /* incrementally */);
321 EXPECT_VALID(lib);
322 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, nullptr);
323 int64_t value = 0;
326 EXPECT_EQ(1, value);
327
328 auto kUpdatedSourceFile =
329 Utils::CStringUniquePtr(OS::SCreate(nullptr,
330 "class State<U, T> {\n"
331 " T%s t;\n"
332 " U%s u;\n"
333 " State(List l) {\n"
334 " t = l[0] is T ? l[0] : null;\n"
335 " u = l[1] is U ? l[1] : null;\n"
336 " }\n"
337 "}\n",
338 nullable_tag, nullable_tag),
339 std::free);
340 Dart_SourceFile updated_sourcefiles[1] = {{
341 "file:///test-lib.dart",
342 kUpdatedSourceFile.get(),
343 }};
344 {
345 const uint8_t* kernel_buffer = nullptr;
346 intptr_t kernel_buffer_size = 0;
347 char* error = TestCase::CompileTestScriptWithDFE(
348 "file:///test-app.dart",
349 sizeof(updated_sourcefiles) / sizeof(Dart_SourceFile),
350 updated_sourcefiles, &kernel_buffer, &kernel_buffer_size,
351 true /* incrementally */);
352 EXPECT(error == nullptr);
353 EXPECT_NOTNULL(kernel_buffer);
354
355 lib = TestCase::ReloadTestKernel(kernel_buffer, kernel_buffer_size);
356 EXPECT_VALID(lib);
357 }
358 result = Dart_Invoke(lib, NewString("main"), 0, nullptr);
361 EXPECT_EQ(-1, value);
362}

◆ TEST_CASE() [390/600]

dart::TEST_CASE ( IsolateReload_KernelIncrementalCompileGenerics  )

Definition at line 204 of file isolate_reload_test.cc.

204 {
205 // clang-format off
206 Dart_SourceFile sourcefiles[] = {
207 {
208 "file:///test-app.dart",
209 "import 'test-lib.dart';\n"
210 "class Account {\n"
211 " int balance() => 42;\n"
212 "}\n"
213 "class MyAccountState extends State<Account> {\n"
214 " MyAccountState(Account a): super(a) {}\n"
215 "}\n"
216 "main() {\n"
217 " return (new MyAccountState(new Account()))\n"
218 " .howAreTheThings().balance();\n"
219 "}\n",
220 },
221 {
222 "file:///test-lib.dart",
223 "class State<T> {\n"
224 " T t;"
225 " State(this.t);\n"
226 " T howAreTheThings() => t;\n"
227 "}\n",
228 }};
229 // clang-format on
230
231 Dart_Handle lib = TestCase::LoadTestScriptWithDFE(
232 sizeof(sourcefiles) / sizeof(Dart_SourceFile), sourcefiles,
233 nullptr /* resolver */, true /* finalize */, true /* incrementally */);
234 EXPECT_VALID(lib);
235 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, nullptr);
236 int64_t value = 0;
239 EXPECT_EQ(42, value);
240
241 // clang-format off
242 Dart_SourceFile updated_sourcefiles[] = {
243 {
244 "file:///test-app.dart",
245 "import 'test-lib.dart';\n"
246 "class Account {\n"
247 " int balance() => 24;\n"
248 "}\n"
249 "class MyAccountState extends State<Account> {\n"
250 " MyAccountState(Account a): super(a) {}\n"
251 "}\n"
252 "main() {\n"
253 " return (new MyAccountState(new Account()))\n"
254 " .howAreTheThings().balance();\n"
255 "}\n",
256 }};
257 // clang-format on
258 {
259 const uint8_t* kernel_buffer = nullptr;
260 intptr_t kernel_buffer_size = 0;
261 char* error = TestCase::CompileTestScriptWithDFE(
262 "file:///test-app.dart",
263 sizeof(updated_sourcefiles) / sizeof(Dart_SourceFile),
264 updated_sourcefiles, &kernel_buffer, &kernel_buffer_size,
265 true /* incrementally */);
266 EXPECT(error == nullptr);
267 EXPECT_NOTNULL(kernel_buffer);
268
269 lib = TestCase::ReloadTestKernel(kernel_buffer, kernel_buffer_size);
270 EXPECT_VALID(lib);
271 }
272 result = Dart_Invoke(lib, NewString("main"), 0, nullptr);
275 EXPECT_EQ(24, value);
276}

◆ TEST_CASE() [391/600]

dart::TEST_CASE ( IsolateReload_LibraryDebuggable  )

Definition at line 659 of file isolate_reload_test.cc.

659 {
660 const char* kScript =
661 "main() {\n"
662 " return 1;\n"
663 "}\n";
664
665 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
666 EXPECT_VALID(lib);
667
668 // The library is by default debuggable. Make it not debuggable.
669 intptr_t lib_id = -1;
670 bool debuggable = false;
671 EXPECT_VALID(Dart_LibraryId(lib, &lib_id));
672 EXPECT_VALID(Dart_GetLibraryDebuggable(lib_id, &debuggable));
673 EXPECT_EQ(true, debuggable);
675 EXPECT_VALID(Dart_GetLibraryDebuggable(lib_id, &debuggable));
676 EXPECT_EQ(false, debuggable);
677
678 EXPECT_EQ(1, SimpleInvoke(lib, "main"));
679
680 const char* kReloadScript =
681 "main() {\n"
682 " return 2;\n"
683 "}\n";
684
685 lib = TestCase::ReloadTestScript(kReloadScript);
686 EXPECT_VALID(lib);
687
688 EXPECT_EQ(2, SimpleInvoke(lib, "main"));
689
690 // Library debuggability is preserved.
691 intptr_t new_lib_id = -1;
692 EXPECT_VALID(Dart_LibraryId(lib, &new_lib_id));
693 EXPECT_VALID(Dart_GetLibraryDebuggable(new_lib_id, &debuggable));
694 EXPECT_EQ(false, debuggable);
695}
Dart_Handle Dart_GetLibraryDebuggable(intptr_t library_id, bool *is_debuggable)
Dart_Handle Dart_SetLibraryDebuggable(intptr_t library_id, bool is_debuggable)
Dart_Handle Dart_LibraryId(Dart_Handle library, intptr_t *library_id)

◆ TEST_CASE() [392/600]

dart::TEST_CASE ( IsolateReload_LibraryHide  )

Definition at line 1136 of file isolate_reload_test.cc.

1136 {
1137 const char* kImportScript = "importedFunc() => 'a';\n";
1138 TestCase::AddTestLib("test:lib1", kImportScript);
1139
1140 // Import 'test:lib1' with importedFunc hidden. Will result in an
1141 // error.
1142 const char* kScript =
1143 "import 'test:lib1' hide importedFunc;\n"
1144 "main() {\n"
1145 " return importedFunc();\n"
1146 "}\n";
1147
1148 // Dart_Handle result;
1149
1150 Dart_Handle lib = TestCase::LoadTestScriptWithErrors(kScript);
1151 EXPECT_VALID(lib);
1152 EXPECT_ERROR(SimpleInvokeError(lib, "main"), "importedFunc");
1153
1154 // Import 'test:lib1'.
1155 const char* kReloadScript =
1156 "import 'test:lib1';\n"
1157 "main() {\n"
1158 " return importedFunc();\n"
1159 "}\n";
1160
1161 lib = TestCase::ReloadTestScript(kReloadScript);
1162 EXPECT_VALID(lib);
1163 EXPECT_STREQ("a", SimpleInvokeStr(lib, "main"));
1164}
Dart_Handle SimpleInvokeError(Dart_Handle lib, const char *method)

◆ TEST_CASE() [393/600]

dart::TEST_CASE ( IsolateReload_LibraryImportAdded  )

Definition at line 618 of file isolate_reload_test.cc.

618 {
619 const char* kScript =
620 "main() {\n"
621 " return max(3, 4);\n"
622 "}\n";
623
624 const char* kReloadScript =
625 "import 'dart:math';\n"
626 "main() {\n"
627 " return max(3, 4);\n"
628 "}\n";
629
630 Dart_Handle lib = TestCase::LoadTestScriptWithErrors(kScript);
631 EXPECT_VALID(lib);
632 EXPECT_ERROR(SimpleInvokeError(lib, "main"), "max");
633
634 lib = TestCase::ReloadTestScript(kReloadScript);
635 EXPECT_VALID(lib);
636 EXPECT_EQ(4, SimpleInvoke(lib, "main"));
637}

◆ TEST_CASE() [394/600]

dart::TEST_CASE ( IsolateReload_LibraryImportRemoved  )

Definition at line 639 of file isolate_reload_test.cc.

639 {
640 const char* kScript =
641 "import 'dart:math';\n"
642 "main() {\n"
643 " return max(3, 4);\n"
644 "}\n";
645
646 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
647 EXPECT_VALID(lib);
648 EXPECT_EQ(4, SimpleInvoke(lib, "main"));
649
650 const char* kReloadScript =
651 "main() {\n"
652 " return max(3, 4);\n"
653 "}\n";
654
655 lib = TestCase::ReloadTestScript(kReloadScript);
656 EXPECT_ERROR(SimpleInvokeError(lib, "main"), "max");
657}

◆ TEST_CASE() [395/600]

dart::TEST_CASE ( IsolateReload_LibraryLookup  )

Definition at line 1095 of file isolate_reload_test.cc.

1095 {
1096 const char* kImportScript = "importedFunc() => 'a';\n";
1097 TestCase::AddTestLib("test:lib1", kImportScript);
1098
1099 const char* kScript =
1100 "main() {\n"
1101 " return 'b';\n"
1102 "}\n";
1104 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
1105 EXPECT_VALID(lib);
1106 EXPECT_STREQ("b", SimpleInvokeStr(lib, "main"));
1107
1108 // Fail to find 'test:lib1' in the isolate.
1109 result = Dart_LookupLibrary(NewString("test:lib1"));
1111
1112 const char* kReloadScript =
1113 "import 'test:lib1';\n"
1114 "main() {\n"
1115 " return importedFunc();\n"
1116 "}\n";
1117
1118 // Reload and add 'test:lib1' to isolate.
1119 lib = TestCase::ReloadTestScript(kReloadScript);
1120 EXPECT_VALID(lib);
1121 EXPECT_STREQ("a", SimpleInvokeStr(lib, "main"));
1122
1123 // Find 'test:lib1' in the isolate.
1124 result = Dart_LookupLibrary(NewString("test:lib1"));
1126
1127 // Reload and remove 'test:lib1' from isolate.
1128 lib = TestCase::ReloadTestScript(kScript);
1129 EXPECT_VALID(lib);
1130
1131 // Fail to find 'test:lib1' in the isolate.
1132 result = Dart_LookupLibrary(NewString("test:lib1"));
1134}

◆ TEST_CASE() [396/600]

dart::TEST_CASE ( IsolateReload_LibraryShow  )

Definition at line 1166 of file isolate_reload_test.cc.

1166 {
1167 const char* kImportScript =
1168 "importedFunc() => 'a';\n"
1169 "importedIntFunc() => 4;\n";
1170 TestCase::AddTestLib("test:lib1", kImportScript);
1171
1172 // Import 'test:lib1' with importedIntFunc visible. Will result in
1173 // an error when 'main' is invoked.
1174 const char* kScript =
1175 "import 'test:lib1' show importedIntFunc;\n"
1176 "main() {\n"
1177 " return importedFunc();\n"
1178 "}\n"
1179 "mainInt() {\n"
1180 " return importedIntFunc();\n"
1181 "}\n";
1182
1183 Dart_Handle lib = TestCase::LoadTestScriptWithErrors(kScript);
1184 EXPECT_VALID(lib);
1185
1186 // Works.
1187 EXPECT_EQ(4, SimpleInvoke(lib, "mainInt"));
1188 // Results in an error.
1189 EXPECT_ERROR(SimpleInvokeError(lib, "main"), "importedFunc");
1190
1191 // Import 'test:lib1' with importedFunc visible. Will result in
1192 // an error when 'mainInt' is invoked.
1193 const char* kReloadScript =
1194 "import 'test:lib1' show importedFunc;\n"
1195 "main() {\n"
1196 " return importedFunc();\n"
1197 "}\n"
1198 "mainInt() {\n"
1199 " return importedIntFunc();\n"
1200 "}\n";
1201
1202 lib = TestCase::ReloadTestScript(kReloadScript);
1203 EXPECT_ERROR(lib, "importedIntFunc");
1204}

◆ TEST_CASE() [397/600]

dart::TEST_CASE ( IsolateReload_LiveStack  )

Definition at line 1062 of file isolate_reload_test.cc.

1062 {
1063 const char* kScript =
1064 "import 'file:///test:isolate_reload_helper';\n"
1065 "helper() => 7;\n"
1066 "alpha() { var x = helper(); reloadTest(); return x + helper(); }\n"
1067 "foo() => alpha();\n"
1068 "bar() => foo();\n"
1069 "main() {\n"
1070 " return bar();\n"
1071 "}\n";
1072
1073 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
1074 EXPECT_VALID(lib);
1075
1076 const char* kReloadScript =
1077 "import 'file:///test:isolate_reload_helper';\n"
1078 "helper() => 100;\n"
1079 "alpha() => 5 + helper();\n"
1080 "foo() => alpha();\n"
1081 "bar() => foo();\n"
1082 "main() {\n"
1083 " return bar();\n"
1084 "}\n";
1085
1086 EXPECT_VALID(TestCase::SetReloadTestScript(kReloadScript));
1087
1088 EXPECT_EQ(107, SimpleInvoke(lib, "main"));
1089
1090 lib = Dart_RootLibrary();
1091 EXPECT_NON_NULL(lib);
1092 EXPECT_EQ(105, SimpleInvoke(lib, "main"));
1093}
#define EXPECT_NON_NULL(handle)
Definition unit_test.h:710

◆ TEST_CASE() [398/600]

dart::TEST_CASE ( IsolateReload_MainLibModified  )

Definition at line 4488 of file isolate_reload_test.cc.

4490 {
4491 return false;
4492}
4493
4494TEST_CASE(IsolateReload_NoLibsModified) {
4495 const char* kImportScript = "importedFunc() => 'fancy';";
4496 TestCase::AddTestLib("test:lib1", kImportScript);
4497
4498 const char* kScript =
4499 "import 'test:lib1';\n"
4500 "main() {\n"
4501 " return importedFunc() + ' feast';\n"
4502 "}\n";
4503
4504 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
4505 EXPECT_VALID(lib);
4506 EXPECT_STREQ("fancy feast", SimpleInvokeStr(lib, "main"));
4507
4508 const char* kReloadImportScript = "importedFunc() => 'bossy';";
4509 TestCase::AddTestLib("test:lib1", kReloadImportScript);
4510
4511 const char* kReloadScript =
4512 "import 'test:lib1';\n"
4513 "main() {\n"
4514 " return importedFunc() + ' pants';\n"
4515 "}\n";
4516
4517 Dart_SetFileModifiedCallback(&NothingModifiedCallback);
4518 lib = TestCase::ReloadTestScript(kReloadScript);

◆ TEST_CASE() [399/600]

dart::TEST_CASE ( IsolateReload_MixinChanged  )

Definition at line 931 of file isolate_reload_test.cc.

931 {
932 const char* kScript =
933 "mixin Mixin1 {\n"
934 " var field = 'mixin1';\n"
935 " func() => 'mixin1';\n"
936 "}\n"
937 "class B extends Object with Mixin1 {\n"
938 "}\n"
939 "var saved = new B();\n"
940 "main() {\n"
941 " return 'saved:field=${saved.field},func=${saved.func()}';\n"
942 "}\n";
943
944 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
945 EXPECT_VALID(lib);
946 EXPECT_STREQ("saved:field=mixin1,func=mixin1", SimpleInvokeStr(lib, "main"));
947
948 const char* kReloadScript =
949 "mixin Mixin2 {\n"
950 " var field = 'mixin2';\n"
951 " func() => 'mixin2';\n"
952 "}\n"
953 "class B extends Object with Mixin2 {\n"
954 "}\n"
955 "var saved = new B();\n"
956 "main() {\n"
957 " var newer = new B();\n"
958 " return 'saved:field=${saved.field},func=${saved.func()} '\n"
959 " 'newer:field=${newer.field},func=${newer.func()}';\n"
960 "}\n";
961
962 lib = TestCase::ReloadTestScript(kReloadScript);
963 EXPECT_VALID(lib);
964
965 // The saved instance of B retains its old field value from mixin1,
966 // but it gets the new implementation of func from mixin2.
967 EXPECT_STREQ(
968 "saved:field=mixin1,func=mixin2 "
969 "newer:field=mixin2,func=mixin2",
970 SimpleInvokeStr(lib, "main"));
971}

◆ TEST_CASE() [400/600]

dart::TEST_CASE ( IsolateReload_NoLibsModified  )

Definition at line 4448 of file isolate_reload_test.cc.

4448 {
4449 dynamic x;
4450 A(this.x);
4451 }
4452 dynamic a;
4453 main() {
4454 a.x = 10;
4455 }
4456 )";
4457
4458 lib = TestCase::ReloadTestScript(kReloadScript);
4459 EXPECT_ERROR(lib,
4460 "Const class cannot become non-const: "
4461 "Library:'file:///test-lib' Class: A");
4462}
4463
4464TEST_CASE(IsolateReload_StaticTearOffRetainsHash) {
4465 const char* kScript =
4466 "foo() {}\n"
4467 "var hash1, hash2;\n"
4468 "main() {\n"
4469 " hash1 = foo.hashCode;\n"
4470 " return 'okay';\n"
4471 "}\n";
4472
4473 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
4474 EXPECT_VALID(lib);
4475 EXPECT_STREQ("okay", SimpleInvokeStr(lib, "main"));
4476
4477 const char* kReloadScript =
4478 "foo() {}\n"

◆ TEST_CASE() [401/600]

dart::TEST_CASE ( IsolateReload_NotEnumToEnum  )

Definition at line 2156 of file isolate_reload_test.cc.

2156 {
2157 const char* kScript =
2158 "class Fruit {\n"
2159 " final int zero = 0;\n"
2160 "}\n"
2161 "main() {\n"
2162 " return new Fruit().zero.toString();\n"
2163 "}\n";
2164
2165 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
2166 EXPECT_VALID(lib);
2167 EXPECT_STREQ("0", SimpleInvokeStr(lib, "main"));
2168
2169 const char* kReloadScript =
2170 "enum Fruit {\n"
2171 " Apple\n"
2172 "}\n"
2173 "main() {\n"
2174 " return Fruit.Apple.toString();\n"
2175 "}\n";
2176
2177 Dart_Handle result = TestCase::ReloadTestScript(kReloadScript);
2178 EXPECT_ERROR(result, "Class cannot be redefined to be a enum class");
2179}

◆ TEST_CASE() [402/600]

dart::TEST_CASE ( IsolateReload_NotTypedefToTypedef  )

Definition at line 5896 of file isolate_reload_test.cc.

5898 {
5899 const char* kScript = R"(
5900 class A {}
5901 class B extends A {}
5902 typedef bool Predicate(B b);
5903 Predicate value = init();
5904 init() => (A a) => true;
5905 main() {
5906 return value.toString();
5907 }
5908 )";
5909
5910 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
5911 EXPECT_VALID(lib);
5912 EXPECT_STREQ("Closure: (A) => bool", SimpleInvokeStr(lib, "main"));
5913
5914 // B is no longer a subtype of A.
5915 const char* kReloadScript = R"(
5916 class A {}
5917 class B {}
5918 typedef bool Predicate(B b);
5919 Predicate value = init();
5920 init() => (B a) => true;

◆ TEST_CASE() [403/600]

dart::TEST_CASE ( IsolateReload_PatchStaticInitializerWithClosure  )

Definition at line 5946 of file isolate_reload_test.cc.

5953 {\n"
5954 " bool call(dynamic x) { return false; }\n"
5955 "}\n"
5956 "main() {\n"
5957 " return (42 is Predicate).toString();\n"
5958 "}\n";
5959
5960 Dart_Handle result = TestCase::ReloadTestScript(kReloadScript);
5961 EXPECT_VALID(result);
5962}
5963
5964TEST_CASE(IsolateReload_NotTypedefToTypedef) {
5965 const char* kScript =
5966 "class Predicate {\n"
5967 " bool call(dynamic x) { return false; }\n"
5968 "}\n"
5969 "main() {\n"

◆ TEST_CASE() [404/600]

dart::TEST_CASE ( IsolateReload_PendingConstructorCall_AbstractToConcrete  )

Definition at line 1381 of file isolate_reload_test.cc.

1381 {
1382 const char* kScript =
1383 "import 'file:///test:isolate_reload_helper';\n"
1384 "abstract class Foo {}\n"
1385 "class C {\n"
1386 " test() {\n"
1387 " reloadTest();\n"
1388 " }\n"
1389 "}\n"
1390 "main() {\n"
1391 " try {\n"
1392 " new C().test();\n"
1393 " return 'okay';\n"
1394 " } catch (e) {\n"
1395 " return 'exception';\n"
1396 " }\n"
1397 "}\n";
1398
1399 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
1400 EXPECT_VALID(lib);
1401
1402 const char* kReloadScript =
1403 "import 'file:///test:isolate_reload_helper';\n"
1404 "class Foo {}\n"
1405 "class C {\n"
1406 " test() {\n"
1407 " reloadTest();\n"
1408 " return new Foo();\n"
1409 " }\n"
1410 "}\n"
1411 "main() {\n"
1412 " try {\n"
1413 " new C().test();\n"
1414 " return 'okay';\n"
1415 " } catch (e) {\n"
1416 " return 'exception';\n"
1417 " }\n"
1418 "}\n";
1419
1420 EXPECT_VALID(TestCase::SetReloadTestScript(kReloadScript));
1421
1422 const char* expected = "okay";
1423 const char* result = SimpleInvokeStr(lib, "main");
1424 EXPECT_STREQ(expected, result);
1425
1426 // Bail out if we've already failed so we don't crash in the tag handler.
1427 if ((result == nullptr) || (strcmp(expected, result) != 0)) {
1428 return;
1429 }
1430
1431 lib = Dart_RootLibrary();
1432 EXPECT_NON_NULL(lib);
1433 EXPECT_STREQ(expected, SimpleInvokeStr(lib, "main"));
1434}

◆ TEST_CASE() [405/600]

dart::TEST_CASE ( IsolateReload_PendingConstructorCall_ConcreteToAbstract  )

Definition at line 1436 of file isolate_reload_test.cc.

1436 {
1437 const char* kScript =
1438 "import 'file:///test:isolate_reload_helper';\n"
1439 "class Foo {}\n"
1440 "class C {\n"
1441 " test() {\n"
1442 " reloadTest();\n"
1443 " return new Foo();\n"
1444 " }\n"
1445 "}\n"
1446 "main() {\n"
1447 " try {\n"
1448 " new C().test();\n"
1449 " return 'okay';\n"
1450 " } catch (e) {\n"
1451 " return 'exception';\n"
1452 " }\n"
1453 "}\n";
1454
1455 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
1456 EXPECT_VALID(lib);
1457
1458 const char* kReloadScript =
1459 "import 'file:///test:isolate_reload_helper';\n"
1460 "abstract class Foo {}\n"
1461 "class C {\n"
1462 " test() {\n"
1463 " reloadTest();\n"
1464 " return new Foo();\n"
1465 " }\n"
1466 "}\n"
1467 "main() {\n"
1468 " try {\n"
1469 " new C().test();\n"
1470 " return 'okay';\n"
1471 " } catch (e) {\n"
1472 " return 'exception';\n"
1473 " }\n"
1474 "}\n";
1475
1476 EXPECT_VALID(TestCase::SetReloadTestScript(kReloadScript));
1477 EXPECT_ERROR(SimpleInvokeError(lib, "main"), "is abstract");
1478}

◆ TEST_CASE() [406/600]

dart::TEST_CASE ( IsolateReload_PendingStaticCall_DefinedToNSM  )

Definition at line 1480 of file isolate_reload_test.cc.

1480 {
1481 const char* kScript =
1482 "import 'file:///test:isolate_reload_helper';\n"
1483 "class C {\n"
1484 " static foo() => 'static';\n"
1485 " test() {\n"
1486 " reloadTest();\n"
1487 " return C.foo();\n"
1488 " }\n"
1489 "}\n"
1490 "main() {\n"
1491 " try {\n"
1492 " return new C().test();\n"
1493 " } catch (e) {\n"
1494 " return 'exception';\n"
1495 " }\n"
1496 "}\n";
1497
1498 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
1499 EXPECT_VALID(lib);
1500
1501 const char* kReloadScript =
1502 "import 'file:///test:isolate_reload_helper';\n"
1503 "class C {\n"
1504 " test() {\n"
1505 " reloadTest();\n"
1506 " return C.foo();\n"
1507 " }\n"
1508 "}\n"
1509 "main() {\n"
1510 " try {\n"
1511 " return new C().test();\n"
1512 " } catch (e) {\n"
1513 " return 'exception';\n"
1514 " }\n"
1515 "}\n";
1516
1517 EXPECT_VALID(TestCase::SetReloadTestScript(kReloadScript));
1518 const char* expected = "exception";
1519 const char* result = SimpleInvokeStr(lib, "main");
1520 EXPECT_NOTNULL(result);
1521
1522 // Bail out if we've already failed so we don't crash in StringEquals.
1523 if (result == nullptr) {
1524 return;
1525 }
1526 EXPECT_STREQ(expected, result);
1527
1528 lib = Dart_RootLibrary();
1529 EXPECT_NON_NULL(lib);
1530 EXPECT_STREQ(expected, SimpleInvokeStr(lib, "main"));
1531}

◆ TEST_CASE() [407/600]

dart::TEST_CASE ( IsolateReload_PendingStaticCall_NSMToDefined  )

Definition at line 1533 of file isolate_reload_test.cc.

1533 {
1534 const char* kScript =
1535 "import 'file:///test:isolate_reload_helper';\n"
1536 "class C {\n"
1537 " test() {\n"
1538 " reloadTest();\n"
1539 " return C.foo();\n"
1540 " }\n"
1541 "}\n"
1542 "main() {\n"
1543 " try {\n"
1544 " return new C().test();\n"
1545 " } catch (e) {\n"
1546 " return 'exception';\n"
1547 " }\n"
1548 "}\n";
1549
1550 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
1551 EXPECT_VALID(lib);
1552
1553 const char* kReloadScript =
1554 "import 'file:///test:isolate_reload_helper';\n"
1555 "class C {\n"
1556 " static foo() => 'static';\n"
1557 " test() {\n"
1558 " reloadTest();\n"
1559 " return C.foo();\n"
1560 " }\n"
1561 "}\n"
1562 "main() {\n"
1563 " try {\n"
1564 " return new C().test();\n"
1565 " } catch (e) {\n"
1566 " return 'exception';\n"
1567 " }\n"
1568 "}\n";
1569
1570 EXPECT_VALID(TestCase::SetReloadTestScript(kReloadScript));
1571
1572 const char* expected = "static";
1573 const char* result = SimpleInvokeStr(lib, "main");
1574
1575 // Bail out if we've already failed so we don't crash in the tag handler.
1576 if (result == nullptr) {
1577 return;
1578 }
1579 EXPECT_STREQ(expected, result);
1580
1581 lib = Dart_RootLibrary();
1582 EXPECT_NON_NULL(lib);
1583 EXPECT_STREQ(expected, SimpleInvokeStr(lib, "main"));
1584}

◆ TEST_CASE() [408/600]

dart::TEST_CASE ( IsolateReload_PendingSuperCall  )

Definition at line 1586 of file isolate_reload_test.cc.

1586 {
1587 const char* kScript =
1588 "import 'file:///test:isolate_reload_helper';\n"
1589 "class S {\n"
1590 " foo() => 1;\n"
1591 "}\n"
1592 "class C extends S {\n"
1593 " foo() => 100;\n"
1594 " test() {\n"
1595 " var n = super.foo();\n"
1596 " reloadTest();\n"
1597 " return n + super.foo();\n"
1598 " }\n"
1599 "}\n"
1600 "main() {\n"
1601 " return new C().test();\n"
1602 "}\n";
1603
1604 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
1605 EXPECT_VALID(lib);
1606
1607 const char* kReloadScript =
1608 "import 'file:///test:isolate_reload_helper';\n"
1609 "class S {\n"
1610 " foo() => 10;\n"
1611 "}\n"
1612 "class C extends S {\n"
1613 " foo() => 100;\n"
1614 " test() {\n"
1615 " var n = super.foo();\n"
1616 " reloadTest();\n"
1617 " return n + super.foo();\n"
1618 " }\n"
1619 "}\n"
1620 "main() {\n"
1621 " return new C().test();\n"
1622 "}\n";
1623
1624 EXPECT_VALID(TestCase::SetReloadTestScript(kReloadScript));
1625
1626 EXPECT_EQ(11, SimpleInvoke(lib, "main"));
1627}

◆ TEST_CASE() [409/600]

dart::TEST_CASE ( IsolateReload_PendingUnqualifiedCall_InstanceToStatic  )

Definition at line 1336 of file isolate_reload_test.cc.

1336 {
1337 const char* kScript =
1338 "import 'file:///test:isolate_reload_helper';\n"
1339 "class C {\n"
1340 " foo() => 'instance';\n"
1341 " test() {\n"
1342 " reloadTest();\n"
1343 " return foo();\n"
1344 " }\n"
1345 "}\n"
1346 "main() {\n"
1347 " return new C().test();\n"
1348 "}\n";
1349
1350 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
1351 EXPECT_VALID(lib);
1352
1353 const char* kReloadScript =
1354 "import 'file:///test:isolate_reload_helper';\n"
1355 "class C {\n"
1356 " static foo() => 'static';\n"
1357 " test() {\n"
1358 " reloadTest();\n"
1359 " return foo();\n"
1360 " }\n"
1361 "}\n"
1362 "main() {\n"
1363 " return new C().test();\n"
1364 "}\n";
1365
1366 EXPECT_VALID(TestCase::SetReloadTestScript(kReloadScript));
1367 const char* expected = "static";
1368 const char* result = SimpleInvokeStr(lib, "main");
1369 EXPECT_NOTNULL(result);
1370 // Bail out if we've already failed so we don't crash in StringEquals.
1371 if (result == nullptr) {
1372 return;
1373 }
1374 EXPECT_STREQ(expected, result);
1375
1376 lib = Dart_RootLibrary();
1377 EXPECT_NON_NULL(lib);
1378 EXPECT_STREQ(expected, SimpleInvokeStr(lib, "main"));
1379}

◆ TEST_CASE() [410/600]

dart::TEST_CASE ( IsolateReload_PendingUnqualifiedCall_StaticToInstance  )

Definition at line 1290 of file isolate_reload_test.cc.

1290 {
1291 const char* kScript =
1292 "import 'file:///test:isolate_reload_helper';\n"
1293 "class C {\n"
1294 " static foo() => 'static';\n"
1295 " test() {\n"
1296 " reloadTest();\n"
1297 " return foo();\n"
1298 " }\n"
1299 "}\n"
1300 "main() {\n"
1301 " return new C().test();\n"
1302 "}\n";
1303
1304 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
1305 EXPECT_VALID(lib);
1306
1307 const char* kReloadScript =
1308 "import 'file:///test:isolate_reload_helper';\n"
1309 "class C {\n"
1310 " foo() => 'instance';\n"
1311 " test() {\n"
1312 " reloadTest();\n"
1313 " return foo();\n"
1314 " }\n"
1315 "}\n"
1316 "main() {\n"
1317 " return new C().test();\n"
1318 "}\n";
1319
1320 EXPECT_VALID(TestCase::SetReloadTestScript(kReloadScript));
1321
1322 const char* expected = "instance";
1323 const char* result = SimpleInvokeStr(lib, "main");
1324 EXPECT_STREQ(expected, result);
1325
1326 // Bail out if we've already failed so we don't crash in the tag handler.
1327 if ((result == nullptr) || (strcmp(expected, result) != 0)) {
1328 return;
1329 }
1330
1331 lib = Dart_RootLibrary();
1332 EXPECT_NON_NULL(lib);
1333 EXPECT_STREQ(expected, SimpleInvokeStr(lib, "main"));
1334}

◆ TEST_CASE() [411/600]

dart::TEST_CASE ( IsolateReload_PrefixImportedLibModified  )

Definition at line 4559 of file isolate_reload_test.cc.

4566 {
4567 if (strcmp(url, "test:lib1") == 0) {
4568 return true;
4569 }
4570 return false;
4571}
4572
4573TEST_CASE(IsolateReload_ImportedLibModified) {
4574 const char* kImportScript = "importedFunc() => 'fancy';";
4575 TestCase::AddTestLib("test:lib1", kImportScript);
4576
4577 const char* kScript =
4578 "import 'test:lib1';\n"
4579 "main() {\n"
4580 " return importedFunc() + ' feast';\n"
4581 "}\n";
4582
4583 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
4584 EXPECT_VALID(lib);
4585 EXPECT_STREQ("fancy feast", SimpleInvokeStr(lib, "main"));
4586
4587 const char* kReloadImportScript = "importedFunc() => 'bossy';";
4588 TestCase::AddTestLib("test:lib1", kReloadImportScript);
4589
4590 const char* kReloadScript =

◆ TEST_CASE() [412/600]

dart::TEST_CASE ( IsolateReload_RegressB179030011  )

Definition at line 6145 of file isolate_reload_test.cc.

6146 {
6147 Dart_SourceFile sources[] = {source};
6148 char* error = TestCase::CompileTestScriptWithDFE(
6149 sources[0].uri, ARRAY_SIZE(sources), sources, kernel_buffer,
6150 kernel_buffer_size,
6151 /*incrementally=*/false);
6152 EXPECT(error == nullptr);
6153 EXPECT_NOTNULL(kernel_buffer);
6154}
6155
6156// LibraryTagHandler which returns a fixed Kernel binary back every time it
6157// receives a Dart_kKernelTag request. The binary is wrapped in an external
6158// typed data with a finalizer attached to it. If this finalizer is called
6159// it will set |was_finalized_| to true.
6160class KernelTagHandler {
6161 public:
6162 KernelTagHandler(uint8_t* kernel_buffer, intptr_t kernel_buffer_size)
6163 : kernel_buffer_(kernel_buffer), kernel_buffer_size_(kernel_buffer_size) {
6164 Dart_SetLibraryTagHandler(&LibraryTagHandler);
6165 instance_ = this;
6166 }
6167
6168 ~KernelTagHandler() {
6170 instance_ = nullptr;
6171 }
6172
6173 static KernelTagHandler* Current() { return instance_; }
6174
6175 bool was_called() const { return was_called_; }
6176 bool was_finalized() const { return was_finalized_; }
6177
6178 private:
6179 static void Finalizer(void* isolate_callback_data, void* peer) {
6180 if (auto handler = KernelTagHandler::Current()) {
6181 handler->was_finalized_ = true;
6182 }
6183 }
6184
6185 static Dart_Handle LibraryTagHandler(Dart_LibraryTag tag,
6186 Dart_Handle library,
6187 Dart_Handle url) {
6188 if (tag == Dart_kKernelTag) {
6189 auto handler = KernelTagHandler::Current();
6190 handler->was_called_ = true;
6191
6193 Dart_TypedData_kUint8, handler->kernel_buffer_,
6194 handler->kernel_buffer_size_);
6195 Dart_NewFinalizableHandle(result, handler->kernel_buffer_,
6196 handler->kernel_buffer_size_, &Finalizer);
6197 return result;
6198 }
6199 UNREACHABLE();
6200 return Dart_Null();
6201 }
6202
6203 static KernelTagHandler* instance_;
6204 uint8_t* kernel_buffer_;
6205 intptr_t kernel_buffer_size_;
6206 bool was_finalized_ = false;
6207 bool was_called_ = false;
6208};
6209
Dart_LibraryTag
Definition dart_api.h:3339
@ Dart_kKernelTag
Definition dart_api.h:3342

◆ TEST_CASE() [413/600]

dart::TEST_CASE ( IsolateReload_RunNewFieldInitializers  )

Definition at line 4678 of file isolate_reload_test.cc.

4680 {
4681 const char* kScript =
4682 "const value = 'a';\n"
4683 "main() {\n"
4684 " return 'value=${value}';\n"
4685 "}\n";
4686
4687 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
4688 EXPECT_VALID(lib);
4689 EXPECT_STREQ("value=a", SimpleInvokeStr(lib, "main"));
4690
4691 const char* kReloadScript =
4692 "const value = 'b';\n"
4693 "main() {\n"
4694 " return 'value=${value}';\n"
4695 "}\n";
4696
4697 lib = TestCase::ReloadTestScript(kReloadScript);
4698 EXPECT_VALID(lib);
4699 EXPECT_STREQ("value=b", SimpleInvokeStr(lib, "main"));
4700}
4701
4702TEST_CASE(IsolateReload_ConstFieldUpdate) {
4703 const char* kScript =
4704 "const value = const Duration(seconds: 1);\n"
4705 "main() {\n"
4706 " return 'value=${value}';\n"
4707 "}\n";
4708
4709 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
4710 EXPECT_VALID(lib);
4711 EXPECT_STREQ("value=0:00:01.000000", SimpleInvokeStr(lib, "main"));
4712
4713 const char* kReloadScript =
4714 "const value = const Duration(seconds: 2);\n"
4715 "main() {\n"
4716 " return 'value=${value}';\n"
4717 "}\n";

◆ TEST_CASE() [414/600]

dart::TEST_CASE ( IsolateReload_RunNewFieldInitializersCyclicInitialization  )

Definition at line 4992 of file isolate_reload_test.cc.

4992 {
4993 const char* late_tag = TestCase::LateTag();
4994 // clang-format off
4995 auto kScript = Utils::CStringUniquePtr(OS::SCreate(nullptr,
4996 "class Foo {\n"
4997 " int x = 4;\n"
4998 "}\n"
4999 "%s Foo value;\n"
5000 "main() {\n"
5001 " value = Foo();\n"
5002 " return value.x;\n"
5003 "}\n",
5004 late_tag),
5005 std::free);
5006 // clang-format on
5007
5008 Dart_Handle lib = TestCase::LoadTestScript(kScript.get(), nullptr);
5009 EXPECT_VALID(lib);
5010 EXPECT_EQ(4, SimpleInvoke(lib, "main"));
5011
5012 // Add the field y.
5013 // clang-format off
5014 auto kReloadScript =
5015 Utils::CStringUniquePtr(OS::SCreate(nullptr,
5016 "class Foo {\n"
5017 " int x = 4;\n"
5018 " int y = throw 'exception';\n"
5019 "}\n"
5020 "%s Foo value;\n"
5021 "main() {\n"
5022 " try {\n"
5023 " return value.y.toString();\n"
5024 " } catch (e) {\n"
5025 " return e.toString();\n"
5026 " }\n"
5027 "}\n",
5028 late_tag),
5029 std::free);
5030 // clang-format on
5031
5032 lib = TestCase::ReloadTestScript(kReloadScript.get());
5033 EXPECT_VALID(lib);
5034 // Verify that we ran field initializers on existing instances.

◆ TEST_CASE() [415/600]

dart::TEST_CASE ( IsolateReload_RunNewFieldInitializersLazy  )

Definition at line 4764 of file isolate_reload_test.cc.

4765 {
4766 const char* late_tag = TestCase::LateTag();
4767 // clang-format off
4768 auto kScript =
4769 Utils::CStringUniquePtr(OS::SCreate(nullptr,
4770 "int myInitialValue = 8 * 7;\n"
4771 "class Foo {\n"
4772 " int x = 4;\n"
4773 "}\n"
4774 "%s Foo value;\n"
4775 "main() {\n"
4776 " value = Foo();\n"
4777 " return value.x;\n"
4778 "}\n",
4779 late_tag),
4780 std::free);
4781 // clang-format on
4782
4783 Dart_Handle lib = TestCase::LoadTestScript(kScript.get(), nullptr);
4784 EXPECT_VALID(lib);
4785 EXPECT_EQ(4, SimpleInvoke(lib, "main"));
4786
4787 // Add the field y.
4788 // clang-format off
4789 auto kReloadScript =
4790 Utils::CStringUniquePtr(OS::SCreate(nullptr,
4791 "int myInitialValue = 8 * 7;\n"
4792 "class Foo {\n"
4793 " int x = 4;\n"
4794 " int y = myInitialValue;\n"
4795 "}\n"
4796 "%s Foo value;\n"
4797 "main() {\n"
4798 " return value.y;\n"
4799 "}\n",
4800 late_tag),
4801 std::free);
4802 // clang-format on
4803
4804 lib = TestCase::ReloadTestScript(kReloadScript.get());
4805 EXPECT_VALID(lib);
4806 // Verify that we ran field initializers on existing instances.
4807 EXPECT_EQ(56, SimpleInvoke(lib, "main"));
4808}
4809
4810TEST_CASE(IsolateReload_RunNewFieldInitializersLazy) {
4811 const char* late_tag = TestCase::LateTag();

◆ TEST_CASE() [416/600]

dart::TEST_CASE ( IsolateReload_RunNewFieldInitializersLazyConst  )

Definition at line 4813 of file isolate_reload_test.cc.

4816 {\n"
4817 " int x = 4;\n"
4818 "}\n"
4819 "%s Foo value;\n"
4820 "%s Foo value1;\n"
4821 "main() {\n"
4822 " value = Foo();\n"
4823 " value1 = Foo();\n"
4824 " return value.x;\n"
4825 "}\n",
4826 late_tag, late_tag),
4827 std::free);
4828 // clang-format on
4829
4830 Dart_Handle lib = TestCase::LoadTestScript(kScript.get(), nullptr);
4831 EXPECT_VALID(lib);
4832 EXPECT_EQ(4, SimpleInvoke(lib, "main"));
4833
4834 // Add the field y.
4835 // clang-format off
4836 auto kReloadScript = Utils::CStringUniquePtr(
4837 OS::SCreate(nullptr,
4838 "int myInitialValue = 8 * 7;\n"
4839 "class Foo {\n"
4840 " int x = 4;\n"
4841 " int y = myInitialValue++;\n"
4842 "}\n"
4843 "%s Foo value;\n"
4844 "%s Foo value1;\n"
4845 "main() {\n"
4846 " return '${myInitialValue} ${value.y} ${value1.y} "
4847 "${myInitialValue}';\n"
4848 "}\n",
4849 late_tag, late_tag),
4850 std::free);
4851 // clang-format on
4852
4853 lib = TestCase::ReloadTestScript(kReloadScript.get());
4854 EXPECT_VALID(lib);
4855 // Verify that field initializers ran lazily.
4856 EXPECT_STREQ("56 56 57 58", SimpleInvokeStr(lib, "main"));
4857}
4858
4859TEST_CASE(IsolateReload_RunNewFieldInitializersLazyConst) {
4860 const char* late_tag = TestCase::LateTag();
4861 // clang-format off
4862 auto kScript = Utils::CStringUniquePtr(OS::SCreate(nullptr,
4863 "class Foo {\n"
4864 " int x = 4;\n"
4865 "}\n"
4866 "%s Foo value;\n"
4867 "main() {\n"
4868 " value = Foo();\n"
4869 " return value.x;\n"
4870 "}\n",
4871 late_tag),
4872 std::free);

◆ TEST_CASE() [417/600]

dart::TEST_CASE ( IsolateReload_RunNewFieldInitializersLazyTransitive  )

Definition at line 4874 of file isolate_reload_test.cc.

4885 {\n"
4886 " int x = 4;\n"
4887 " int y = 5;\n"
4888 "}\n"
4889 "%s Foo value;\n"
4890 "main() {\n"
4891 " return 0;\n"
4892 "}\n",
4893 late_tag),
4894 std::free);
4895 // clang-format on
4896
4897 lib = TestCase::ReloadTestScript(kReloadScript.get());
4898 EXPECT_VALID(lib);
4899 EXPECT_EQ(0, SimpleInvoke(lib, "main"));
4900
4901 // Change y's initializer and check this new initializer is used.
4902 auto kReloadScript2 =
4903 Utils::CStringUniquePtr(OS::SCreate(nullptr,
4904 "class Foo {\n"
4905 " int x = 4;\n"
4906 " int y = 6;\n"
4907 "}\n"
4908 "%s Foo value;\n"
4909 "main() {\n"
4910 " return value.y;\n"
4911 "}\n",
4912 late_tag),
4913 std::free);
4914
4915 lib = TestCase::ReloadTestScript(kReloadScript2.get());
4916 EXPECT_VALID(lib);
4917 EXPECT_EQ(6, SimpleInvoke(lib, "main"));
4918}
4919
4920TEST_CASE(IsolateReload_RunNewFieldInitializersLazyTransitive) {
4921 const char* late_tag = TestCase::LateTag();
4922 // clang-format off
4923 auto kScript =
4924 Utils::CStringUniquePtr(OS::SCreate(nullptr,
4925 "int myInitialValue = 8 * 7;\n"
4926 "class Foo {\n"
4927 " int x = 4;\n"
4928 "}\n"
4929 "%s Foo value;\n"
4930 "%s Foo value1;\n"
4931 "main() {\n"
4932 " value = Foo();\n"
4933 " value1 = Foo();\n"
4934 " return value.x;\n"
4935 "}\n",
4936 late_tag, late_tag),
4937 std::free);
4938 // clang-format on
4939
4940 Dart_Handle lib = TestCase::LoadTestScript(kScript.get(), nullptr);
4941 EXPECT_VALID(lib);
4942 EXPECT_EQ(4, SimpleInvoke(lib, "main"));
4943
4944 // Add the field y. Do not touch y.

◆ TEST_CASE() [418/600]

dart::TEST_CASE ( IsolateReload_RunNewFieldInitializersReferenceStaticField  )

Definition at line 4719 of file isolate_reload_test.cc.

4721 :00:02.000000", SimpleInvokeStr(lib, "main"));
4722}
4723
4724TEST_CASE(IsolateReload_RunNewFieldInitializers) {
4725 const char* late_tag = TestCase::LateTag();
4726 // clang-format off
4727 auto kScript = Utils::CStringUniquePtr(OS::SCreate(nullptr,
4728 "class Foo {\n"
4729 " int x = 4;\n"
4730 "}\n"
4731 "%s Foo value;\n"
4732 "main() {\n"
4733 " value = Foo();\n"
4734 " return value.x;\n"
4735 "}\n",
4736 late_tag),
4737 std::free);
4738 // clang-format on
4739
4740 Dart_Handle lib = TestCase::LoadTestScript(kScript.get(), nullptr);
4741 EXPECT_VALID(lib);
4742 EXPECT_EQ(4, SimpleInvoke(lib, "main"));
4743
4744 // Add the field y.
4745 // clang-format off
4746 auto kReloadScript = Utils::CStringUniquePtr(OS::SCreate(nullptr,
4747 "class Foo {\n"
4748 " int x = 4;\n"
4749 " int y = 7;\n"
4750 "}\n"
4751 "%s Foo value;\n"
4752 "main() {\n"
4753 " return value.y;\n"
4754 "}\n",
4755 late_tag),
4756 std::free);
4757 // clang-format on
4758
4759 lib = TestCase::ReloadTestScript(kReloadScript.get());
4760 EXPECT_VALID(lib);
4761 // Verify that we ran field initializers on existing instances.
4762 EXPECT_EQ(7, SimpleInvoke(lib, "main"));

◆ TEST_CASE() [419/600]

dart::TEST_CASE ( IsolateReload_RunNewFieldInitializersSuperClass  )

Definition at line 5174 of file isolate_reload_test.cc.

5175 {
5176 const char* late_tag = TestCase::LateTag();
5177 // clang-format off
5178 auto kScript = Utils::CStringUniquePtr(
5179 OS::SCreate(nullptr,
5180 "class Foo {\n"
5181 " Foo() { /* default constructor */ }\n"
5182 " int x = 4;\n"
5183 "}\n"
5184 "%s Foo value;\n"
5185 "main() {\n"
5186 " value = Foo();\n"
5187 " return value.x;\n"
5188 "}\n",
5189 late_tag),
5190 std::free);
5191 // clang-format on
5192
5193 Dart_Handle lib = TestCase::LoadTestScript(kScript.get(), nullptr);
5194 EXPECT_VALID(lib);
5195 EXPECT_EQ(4, SimpleInvoke(lib, "main"));
5196
5197 // Add the field y with a syntax error in the initializing expression.
5198 // clang-format off
5199 auto kReloadScript = Utils::CStringUniquePtr(
5200 OS::SCreate(nullptr,
5201 "class Foo {\n"
5202 " Foo() { /* default constructor */ }\n"
5203 " int x = 4;\n"
5204 " int y = ......\n"
5205 "}\n"
5206 "%s Foo value;\n"
5207 "main() {\n"
5208 " return '${value.y == null}';"
5209 "}\n",
5210 late_tag),
5211 std::free);
5212 // clang-format on
5213
5214 // The reload fails because the initializing expression is parsed at
5215 // class finalization time.
5216 lib = TestCase::ReloadTestScript(kReloadScript.get());
5217 EXPECT_ERROR(lib, "......");
5218}
5219
5220TEST_CASE(IsolateReload_RunNewFieldInitializersSuperClass) {
5221 const char* late_tag = TestCase::LateTag();
5222 // clang-format off
5223 auto kScript =
5224 Utils::CStringUniquePtr(OS::SCreate(nullptr,
5225 "class Super {\n"
5226 " static var foo = 'right';\n"
5227 "}\n"

◆ TEST_CASE() [420/600]

dart::TEST_CASE ( IsolateReload_RunNewFieldInitializersSyntaxError  )

Definition at line 5038 of file isolate_reload_test.cc.

5038 {
5039 const char* late_tag = TestCase::LateTag();
5040 // clang-format off
5041 auto kScript = Utils::CStringUniquePtr(OS::SCreate(nullptr,
5042 "class Foo {\n"
5043 " int x = 4;\n"
5044 "}\n"
5045 "%s Foo value;\n"
5046 "main() {\n"
5047 " value = Foo();\n"
5048 " return value.x;\n"
5049 "}\n",
5050 late_tag),
5051 std::free);
5052 // clang-format on
5053
5054 Dart_Handle lib = TestCase::LoadTestScript(kScript.get(), nullptr);
5055 EXPECT_VALID(lib);
5056 EXPECT_EQ(4, SimpleInvoke(lib, "main"));
5057
5058 // Add the field y.
5059 // clang-format off
5060 auto kReloadScript =
5061 Utils::CStringUniquePtr(OS::SCreate(nullptr,
5062 "class Foo {\n"
5063 " int x = 4;\n"
5064 " int y = value.y;\n"
5065 "}\n"
5066 "%s Foo value;\n"
5067 "main() {\n"
5068 " try {\n"
5069 " return value.y.toString();\n"
5070 " } catch (e) {\n"
5071 " return e.toString();\n"
5072 " }\n"
5073 "}\n",
5074 late_tag),
5075 std::free);
5076 // clang-format on
5077 lib = TestCase::ReloadTestScript(kReloadScript.get());
5078 EXPECT_VALID(lib);

◆ TEST_CASE() [421/600]

dart::TEST_CASE ( IsolateReload_RunNewFieldInitializersSyntaxError2  )

Definition at line 5082 of file isolate_reload_test.cc.

5084 {
5085 const char* late_tag = TestCase::LateTag();
5086 // clang-format off
5087 auto kScript = Utils::CStringUniquePtr(OS::SCreate(nullptr,
5088 "class Foo {\n"
5089 " int x = 4;\n"
5090 "}\n"
5091 "%s Foo value;\n"
5092 "main() {\n"
5093 " value = Foo();\n"
5094 " return value.x;\n"
5095 "}\n",
5096 late_tag),
5097 std::free);
5098 // clang-format on
5099
5100 Dart_Handle lib = TestCase::LoadTestScript(kScript.get(), nullptr);
5101 EXPECT_VALID(lib);
5102 EXPECT_EQ(4, SimpleInvoke(lib, "main"));
5103
5104 // Add the field y with a syntax error in the initializing expression.
5105 // clang-format off
5106 auto kReloadScript =
5107 Utils::CStringUniquePtr(OS::SCreate(nullptr,
5108 "class Foo {\n"
5109 " int x = 4;\n"
5110 " int y = ......;\n"
5111 "}\n"
5112 "%s Foo value;\n"
5113 "main() {\n"
5114 " return '${value.y == null}';"
5115 "}\n",
5116 late_tag),
5117 std::free);
5118 // clang-format on
5119
5120 // The reload fails because the initializing expression is parsed at
5121 // class finalization time.
5122 lib = TestCase::ReloadTestScript(kReloadScript.get());
5123 EXPECT_ERROR(lib, "...");
5124}
5125

◆ TEST_CASE() [422/600]

dart::TEST_CASE ( IsolateReload_RunNewFieldInitializersSyntaxError3  )

Definition at line 5129 of file isolate_reload_test.cc.

5133 {\n"
5134 " Foo() { /* default constructor */ }\n"
5135 " int x = 4;\n"
5136 "}\n"
5137 "%s Foo value;\n"
5138 "main() {\n"
5139 " value = Foo();\n"
5140 " return value.x;\n"
5141 "}\n",
5142 late_tag),
5143 std::free);
5144 // clang-format on
5145
5146 Dart_Handle lib = TestCase::LoadTestScript(kScript.get(), nullptr);
5147 EXPECT_VALID(lib);
5148 EXPECT_EQ(4, SimpleInvoke(lib, "main"));
5149
5150 // Add the field y with a syntax error in the initializing expression.
5151 // clang-format off
5152 auto kReloadScript = Utils::CStringUniquePtr(
5153 OS::SCreate(nullptr,
5154 "class Foo {\n"
5155 " Foo() { /* default constructor */ }\n"
5156 " int x = 4;\n"
5157 " int y = ......;\n"
5158 "}\n"
5159 "%s Foo value;\n"
5160 "main() {\n"
5161 " return '${value.y == null}';"
5162 "}\n",
5163 late_tag),
5164 std::free);
5165 // clang-format on
5166
5167 // The reload fails because the initializing expression is parsed at
5168 // class finalization time.
5169 lib = TestCase::ReloadTestScript(kReloadScript.get());
5170 EXPECT_ERROR(lib, "...");
5171}
5172

◆ TEST_CASE() [423/600]

dart::TEST_CASE ( IsolateReload_RunNewFieldInitializersThrows  )

Definition at line 4946 of file isolate_reload_test.cc.

4949 {\n"
4950 " int x = 4;\n"
4951 " int y = myInitialValue++;\n"
4952 "}\n"
4953 "%s Foo value;\n"
4954 "%s Foo value1;\n"
4955 "main() {\n"
4956 " return '${myInitialValue}';\n"
4957 "}\n",
4958 late_tag, late_tag),
4959 std::free);
4960 // clang-format on
4961
4962 lib = TestCase::ReloadTestScript(kReloadScript.get());
4963 EXPECT_VALID(lib);
4964 EXPECT_STREQ("56", SimpleInvokeStr(lib, "main"));
4965
4966 // Reload again. Field y's getter still needs to keep for initialization even
4967 // though it is no longer new.
4968 // clang-format off
4969 auto kReloadScript2 = Utils::CStringUniquePtr(
4970 OS::SCreate(nullptr,
4971 "int myInitialValue = 8 * 7;\n"
4972 "class Foo {\n"
4973 " int x = 4;\n"
4974 " int y = myInitialValue++;\n"
4975 "}\n"
4976 "%s Foo value;\n"
4977 "%s Foo value1;\n"
4978 "main() {\n"
4979 " return '${myInitialValue} ${value.y} ${value1.y} "
4980 "${myInitialValue}';\n"
4981 "}\n",
4982 late_tag, late_tag),
4983 std::free);
4984 // clang-format on
4985
4986 lib = TestCase::ReloadTestScript(kReloadScript2.get());
4987 EXPECT_VALID(lib);
4988 // Verify that field initializers ran lazily.
4989 EXPECT_STREQ("56 56 57 58", SimpleInvokeStr(lib, "main"));
4990}

◆ TEST_CASE() [424/600]

dart::TEST_CASE ( IsolateReload_RunNewFieldInitializersWithConsts  )

Definition at line 5229 of file isolate_reload_test.cc.

5232 {\n"
5233 " Super.foo;\n"
5234 " Foo.foo;\n"
5235 " value = Foo();\n"
5236 " return 0;\n"
5237 "}\n",
5238 late_tag),
5239 std::free);
5240 // clang-format on
5241
5242 Dart_Handle lib = TestCase::LoadTestScript(kScript.get(), nullptr);
5243 EXPECT_VALID(lib);
5244 EXPECT_EQ(0, SimpleInvoke(lib, "main"));
5245
5246 // clang-format on
5247 auto kReloadScript =
5248 Utils::CStringUniquePtr(OS::SCreate(nullptr,
5249 "class Super {\n"
5250 " static var foo = 'right';\n"
5251 " var newField = foo;\n"
5252 "}\n"
5253 "class Foo extends Super {\n"
5254 " static var foo = 'wrong';\n"
5255 "}\n"
5256 "%s Foo value;\n"
5257 "main() {\n"
5258 " return value.newField;\n"
5259 "}\n",
5260 late_tag),
5261 std::free);
5262 // clang-format off
5263
5264 lib = TestCase::ReloadTestScript(kReloadScript.get());
5265 EXPECT_VALID(lib);
5266 // Verify that we ran field initializers on existing instances in the
5267 // correct scope.
5268 const char* actual = SimpleInvokeStr(lib, "main");
5269 EXPECT(actual != nullptr);
5270 if (actual != nullptr) {
5271 EXPECT_STREQ("right", actual);
5272 }
5273}
5274
5275TEST_CASE(IsolateReload_RunNewFieldInitializersWithConsts) {
5276 const char* late_tag = TestCase::LateTag();
5277 // clang-format off
5278 auto kScript =
5279 Utils::CStringUniquePtr(OS::SCreate(nullptr,
5280 "class C {\n"
5281 " final x;\n"
5282 " const C(this.x);\n"
5283 "}\n"
5284 "var a = const C(const C(1));\n"
5285 "var b = const C(const C(2));\n"
5286 "var c = const C(const C(3));\n"
5287 "var d = const C(const C(4));\n"
5288 "class Foo {\n"
5289 "}\n"
#define C(TEST_CATEGORY)
Definition colrv1.cpp:247

◆ TEST_CASE() [425/600]

dart::TEST_CASE ( IsolateReload_RunNewFieldInitializersWithGenerics  )

Definition at line 5291 of file isolate_reload_test.cc.

5291 {\n"
5292 " value = Foo();\n"
5293 " a; b; c; d;\n"
5294 " return 'Okay';\n"
5295 "}\n",
5296 late_tag),
5297 std::free);
5298 // clang-format on
5299
5300 Dart_Handle lib = TestCase::LoadTestScript(kScript.get(), nullptr);
5301 EXPECT_VALID(lib);
5302 EXPECT_STREQ("Okay", SimpleInvokeStr(lib, "main"));
5303
5304 // clang-format off
5305 auto kReloadScript = Utils::CStringUniquePtr(
5306 OS::SCreate(
5307 nullptr,
5308 "class C {\n"
5309 " final x;\n"
5310 " const C(this.x);\n"
5311 "}\n"
5312 "var a = const C(const C(1));\n"
5313 "var b = const C(const C(2));\n"
5314 "var c = const C(const C(3));\n"
5315 "var d = const C(const C(4));\n"
5316 "class Foo {\n"
5317 " var d = const C(const C(4));\n"
5318 " var c = const C(const C(3));\n"
5319 " var b = const C(const C(2));\n"
5320 " var a = const C(const C(1));\n"
5321 "}\n"
5322 "%s Foo value;\n"
5323 "main() {\n"
5324 " return '${identical(a, value.a)} ${identical(b, value.b)}'"
5325 " ' ${identical(c, value.c)} ${identical(d, value.d)}';\n"
5326 "}\n",
5327 late_tag),
5328 std::free);
5329 // clang-format on
5330 lib = TestCase::ReloadTestScript(kReloadScript.get());
5331 EXPECT_VALID(lib);
5332 // Verify that we ran field initializers on existing instances and the const
5333 // expressions were properly canonicalized.
5334 EXPECT_STREQ("true true true true", SimpleInvokeStr(lib, "main"));
5335}
5336
5337TEST_CASE(IsolateReload_RunNewFieldInitializersWithGenerics) {
5338 const char* nullable_tag = TestCase::NullableTag();
5339 const char* late_tag = TestCase::LateTag();

◆ TEST_CASE() [426/600]

dart::TEST_CASE ( IsolateReload_SavedClosure  )

Definition at line 422 of file isolate_reload_test.cc.

422 {
423 // Create a closure in main which only exists in the original source.
424 const char* kScript =
425 "magic() {\n"
426 " var x = 'ante';\n"
427 " return x + 'diluvian';\n"
428 "}\n"
429 "var closure;\n"
430 "main() {\n"
431 " closure = () { return magic().toString() + '!'; };\n"
432 " return closure();\n"
433 "}\n";
434
435 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
436 EXPECT_VALID(lib);
437 EXPECT_STREQ("antediluvian!", SimpleInvokeStr(lib, "main"));
438
439 // Remove the original closure from the source code. The closure is
440 // able to be recompiled because its source is preserved in a
441 // special patch class.
442 const char* kReloadScript =
443 "magic() {\n"
444 " return 'postapocalyptic';\n"
445 "}\n"
446 "var closure;\n"
447 "main() {\n"
448 " return closure();\n"
449 "}\n";
450
451 lib = TestCase::ReloadTestScript(kReloadScript);
452 EXPECT_VALID(lib);
453 EXPECT_STREQ("postapocalyptic!", SimpleInvokeStr(lib, "main"));
454}

◆ TEST_CASE() [427/600]

dart::TEST_CASE ( IsolateReload_ShapeChange_Const_AddSlot  )

Definition at line 4071 of file isolate_reload_test.cc.

4071 {
4072 // On IA32, instructions can contain direct pointers to const objects. We need
4073 // to be careful that if the const objects are reallocated because of a shape
4074 // change, they are allocated old. Because instructions normally contain
4075 // pointers only to old objects, the scavenger does not bother to ensure code
4076 // pages are writable when visiting the remembered set. Visiting the
4077 // remembered involves writing to update the pointer for any target that gets
4078 // promoted.
4079 const char* kScript = R"(
4080 import 'file:///test:isolate_reload_helper';
4081 class A {
4082 final x;
4083 const A(this.x);
4084 }
4085 var a;
4086 main() {
4087 a = const A(1);
4088 collectNewSpace();
4089 return 'okay';
4090 }
4091 )";
4092
4093 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
4094 EXPECT_VALID(lib);
4095 EXPECT_STREQ("okay", SimpleInvokeStr(lib, "main"));
4096
4097 const char* kReloadScript = R"(
4098 import 'file:///test:isolate_reload_helper';
4099 class A {
4100 final x, y, z;
4101 const A(this.x, this.y, this.z);
4102 }
4103 var a;
4104 main() {
4105 a = const A(1, null, null);
4106 collectNewSpace();
4107 return 'okay';
4108 }
4109 )";
4110
4111 lib = TestCase::ReloadTestScript(kReloadScript);
4112 EXPECT_VALID(lib);
4113 EXPECT_STREQ("okay", SimpleInvokeStr(lib, "main"));
4114
4115 const char* kReloadScript2 = R"(
4116 import 'file:///test:isolate_reload_helper';
4117 class A {
4118 final x, y, z, w, u;
4119 const A(this.x, this.y, this.z, this.w, this.u);
4120 }
4121 var a;
4122 main() {
4123 a = const A(1, null, null, null, null);
4124 collectNewSpace();
4125 return 'okay';
4126 }
4127 )";
4128
4129 lib = TestCase::ReloadTestScript(kReloadScript2);
4130 EXPECT_VALID(lib);
4131 EXPECT_STREQ("okay", SimpleInvokeStr(lib, "main"));
4132}

◆ TEST_CASE() [428/600]

dart::TEST_CASE ( IsolateReload_ShapeChange_Const_RemoveSlot  )

Definition at line 4134 of file isolate_reload_test.cc.

4134 {
4135 const char* kScript = R"(
4136 import 'file:///test:isolate_reload_helper';
4137 class A {
4138 final x, y, z;
4139 const A(this.x, this.y, this.z);
4140 }
4141 var a;
4142 main() {
4143 a = const A(1, 2, 3);
4144 collectNewSpace();
4145 return 'okay';
4146 }
4147 )";
4148
4149 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
4150 EXPECT_VALID(lib);
4151 EXPECT_STREQ("okay", SimpleInvokeStr(lib, "main"));
4152
4153 const char* kReloadScript = R"(
4154 import 'file:///test:isolate_reload_helper';
4155 class A {
4156 final x, y;
4157 const A(this.x, this.y);
4158 }
4159 var a;
4160 main() {
4161 a = const A(1, null);
4162 collectNewSpace();
4163 return 'okay';
4164 }
4165 )";
4166
4167 lib = TestCase::ReloadTestScript(kReloadScript);
4168 EXPECT_ERROR(lib,
4169 "Const class cannot remove fields: "
4170 "Library:'file:///test-lib' Class: A");
4171
4172 // Rename is seen by the VM is unrelated add and remove.
4173 const char* kReloadScript2 = R"(
4174 import 'file:///test:isolate_reload_helper';
4175 class A {
4176 final x, y, w;
4177 const A(this.x, this.y, this.w);
4178 }
4179 var a;
4180 main() {
4181 a = const A(1, null, null);
4182 collectNewSpace();
4183 return 'okay';
4184 }
4185 )";
4186
4187 lib = TestCase::ReloadTestScript(kReloadScript2);
4188 EXPECT_ERROR(lib,
4189 "Const class cannot remove fields: "
4190 "Library:'file:///test-lib' Class: A");
4191}

◆ TEST_CASE() [429/600]

dart::TEST_CASE ( IsolateReload_ShapeChangeMutualReference  )

Definition at line 3966 of file isolate_reload_test.cc.

3966 {
3967 const char* kScript =
3968 "class A{\n"
3969 " var x;\n"
3970 " get yourself => this;\n"
3971 "}\n"
3972 "var retained1;\n"
3973 "var retained2;\n"
3974 "main() {\n"
3975 " retained1 = new A();\n"
3976 " retained2 = new A();\n"
3977 " retained1.x = retained2;\n"
3978 " retained2.x = retained1;\n"
3979 " return '${identical(retained1.x.yourself, retained2)}'\n"
3980 " '${identical(retained2.x.yourself, retained1)}';\n"
3981 "}\n";
3982
3983 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
3984 EXPECT_VALID(lib);
3985 EXPECT_STREQ("truetrue", SimpleInvokeStr(lib, "main"));
3986
3987 const char* kReloadScript =
3988 "class A{\n"
3989 " var x;\n"
3990 " var y;\n"
3991 " var z;\n"
3992 " var w;\n"
3993 " get yourself => this;\n"
3994 "}\n"
3995 "var retained1;\n"
3996 "var retained2;\n"
3997 "main() {\n"
3998 " return '${identical(retained1.x.yourself, retained2)}'\n"
3999 " '${identical(retained2.x.yourself, retained1)}';\n"
4000 "}\n";
4001
4002 lib = TestCase::ReloadTestScript(kReloadScript);
4003 EXPECT_VALID(lib);
4004 EXPECT_STREQ("truetrue", SimpleInvokeStr(lib, "main"));
4005}

◆ TEST_CASE() [430/600]

dart::TEST_CASE ( IsolateReload_ShapeChangeRetainsHash  )

Definition at line 4007 of file isolate_reload_test.cc.

4007 {
4008 const char* kScript =
4009 "class A{\n"
4010 " var x;\n"
4011 "}\n"
4012 "var a, hash1, hash2;\n"
4013 "main() {\n"
4014 " a = new A();\n"
4015 " hash1 = a.hashCode;\n"
4016 " return 'okay';\n"
4017 "}\n";
4018
4019 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
4020 EXPECT_VALID(lib);
4021 EXPECT_STREQ("okay", SimpleInvokeStr(lib, "main"));
4022
4023 const char* kReloadScript =
4024 "class A{\n"
4025 " var x, y, z;\n"
4026 "}\n"
4027 "var a, hash1, hash2;\n"
4028 "main() {\n"
4029 " hash2 = a.hashCode;\n"
4030 " return (hash1 == hash2).toString();\n"
4031 "}\n";
4032
4033 lib = TestCase::ReloadTestScript(kReloadScript);
4034 EXPECT_VALID(lib);
4035 EXPECT_STREQ("true", SimpleInvokeStr(lib, "main"));
4036}

◆ TEST_CASE() [431/600]

dart::TEST_CASE ( IsolateReload_ShapeChangeRetainsHash_Const  )

Definition at line 4038 of file isolate_reload_test.cc.

4038 {
4039 const char* kScript =
4040 "class A {\n"
4041 " final x;\n"
4042 " const A(this.x);\n"
4043 "}\n"
4044 "var a, hash1, hash2;\n"
4045 "main() {\n"
4046 " a = const A(1);\n"
4047 " hash1 = a.hashCode;\n"
4048 " return 'okay';\n"
4049 "}\n";
4050
4051 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
4052 EXPECT_VALID(lib);
4053 EXPECT_STREQ("okay", SimpleInvokeStr(lib, "main"));
4054
4055 const char* kReloadScript =
4056 "class A {\n"
4057 " final x, y, z;\n"
4058 " const A(this.x, this.y, this.z);\n"
4059 "}\n"
4060 "var a, hash1, hash2;\n"
4061 "main() {\n"
4062 " hash2 = a.hashCode;\n"
4063 " return (hash1 == hash2).toString();\n"
4064 "}\n";
4065
4066 lib = TestCase::ReloadTestScript(kReloadScript);
4067 EXPECT_VALID(lib);
4068 EXPECT_STREQ("true", SimpleInvokeStr(lib, "main"));
4069}

◆ TEST_CASE() [432/600]

dart::TEST_CASE ( IsolateReload_SimpleConstFieldUpdate  )

Definition at line 4634 of file isolate_reload_test.cc.

4638 {
4639 if (strcmp(url, "test:exportlib") == 0) {
4640 return true;
4641 }
4642 return false;
4643}
4644
4645TEST_CASE(IsolateReload_ExportedLibModified) {
4646 const char* kImportScript = "export 'test:exportlib';";
4647 TestCase::AddTestLib("test:importlib", kImportScript);
4648
4649 const char* kExportScript = "exportedFunc() => 'fancy';";
4650 TestCase::AddTestLib("test:exportlib", kExportScript);
4651
4652 const char* kScript =
4653 "import 'test:importlib';\n"
4654 "main() {\n"

◆ TEST_CASE() [433/600]

dart::TEST_CASE ( IsolateReload_SmiFastPathStubs  )

Definition at line 1208 of file isolate_reload_test.cc.

1208 {
1209 const char* kImportScript = "importedIntFunc() => 4;\n";
1210 TestCase::AddTestLib("test:lib1", kImportScript);
1211
1212 const char* kScript =
1213 "import 'file:///test:isolate_reload_helper';\n"
1214 "import 'test:lib1' show importedIntFunc;\n"
1215 "main() {\n"
1216 " var x = importedIntFunc();\n"
1217 " var y = importedIntFunc();\n"
1218 " reloadTest();\n"
1219 " return x + y;\n"
1220 "}\n";
1221
1222 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
1223 EXPECT_VALID(lib);
1224
1225 // Identity reload.
1226 EXPECT_VALID(TestCase::SetReloadTestScript(kScript));
1227
1228 EXPECT_EQ(8, SimpleInvoke(lib, "main"));
1229}

◆ TEST_CASE() [434/600]

dart::TEST_CASE ( IsolateReload_StaticFieldInitialValueDoesnotChange  )

Definition at line 5366 of file isolate_reload_test.cc.

5367 {};"
5368 "}\n"
5369 "%s Foo value1;\n"
5370 "%s Foo value2;\n"
5371 "main() {\n"
5372 " return '${value1.y.runtimeType} ${value1.z.runtimeType}'"
5373 " ' ${value2.y.runtimeType} ${value2.z.runtimeType}';\n"
5374 "}\n",
5375 nullable_tag, late_tag, late_tag),
5376 std::free);
5377 // clang-format on
5378
5379 lib = TestCase::ReloadTestScript(kReloadScript.get());
5380 EXPECT_VALID(lib);
5381 // Verify that we ran field initializers on existing instances and
5382 // correct type arguments were used.
5383 EXPECT_STREQ("List<String> _Map<String, String> List<int> _Map<int, int>",
5384 SimpleInvokeStr(lib, "main"));
5385}
5386
5387TEST_CASE(IsolateReload_AddNewStaticField) {
5388 const char* kScript =
5389 "class C {\n"
5390 "}\n"
5391 "main() {\n"

◆ TEST_CASE() [435/600]

dart::TEST_CASE ( IsolateReload_StaticTargetArityChange  )

Definition at line 5971 of file isolate_reload_test.cc.

5982 {\n"
5983 " return (42 is Predicate).toString();\n"
5984 "}\n";
5985
5986 Dart_Handle result = TestCase::ReloadTestScript(kReloadScript);
5987 EXPECT_VALID(result);
5988}
5989
5990TEST_CASE(IsolateReload_TypedefAddParameter) {
5991 const char* kScript =
5992 "typedef bool Predicate(dynamic x);\n"
5993 "main() {\n"
5994 " bool foo(x) => true;\n"
5995 " return (foo is Predicate).toString();\n"
5996 "}\n";
5997
5998 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
5999 EXPECT_VALID(lib);
6000 EXPECT_STREQ("true", SimpleInvokeStr(lib, "main"));
6001
6002 const char* kReloadScript =
6003 "typedef bool Predicate(dynamic x, dynamic y);\n"
6004 "main() {\n"
6005 " bool foo(x) => true;\n"
6006 " return (foo is Predicate).toString();\n"
6007 "}\n";
6008
6009 Dart_Handle result = TestCase::ReloadTestScript(kReloadScript);
6010 EXPECT_VALID(result);
6011 EXPECT_STREQ("false", SimpleInvokeStr(lib, "main"));
6012}
6013

◆ TEST_CASE() [436/600]

dart::TEST_CASE ( IsolateReload_StaticTearOffRetainsHash  )

Definition at line 4418 of file isolate_reload_test.cc.

4420 {
4421 a.x = 10;
4422 }
4423 )";
4424
4425 lib = TestCase::ReloadTestScript(kReloadScript);
4426 EXPECT_ERROR(lib,
4427 "Const class cannot become non-const: "
4428 "Library:'file:///test-lib' Class: A");
4429}
4430
4431TEST_CASE(IsolateReload_ConstToNonConstClass_Empty) {
4432 const char* kScript = R"(
4433 class A {
4434 const A();
4435 }
4436 dynamic a;
4437 main() {
4438 a = const A();
4439 return 'okay';
4440 }
4441 )";
4442

◆ TEST_CASE() [437/600]

dart::TEST_CASE ( IsolateReload_StaticValuePreserved  )

Definition at line 395 of file isolate_reload_test.cc.

395 {
396 const char* kScript =
397 "init() => 'old value';\n"
398 "var value = init();\n"
399 "main() {\n"
400 " return 'init()=${init()},value=${value}';\n"
401 "}\n";
402
403 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
404 EXPECT_VALID(lib);
405 EXPECT_STREQ("init()=old value,value=old value",
406 SimpleInvokeStr(lib, "main"));
407
408 const char* kReloadScript =
409 "var _unused;"
410 "init() => 'new value';\n"
411 "var value = init();\n"
412 "main() {\n"
413 " return 'init()=${init()},value=${value}';\n"
414 "}\n";
415
416 lib = TestCase::ReloadTestScript(kReloadScript);
417 EXPECT_VALID(lib);
418 EXPECT_STREQ("init()=new value,value=old value",
419 SimpleInvokeStr(lib, "main"));
420}

◆ TEST_CASE() [438/600]

dart::TEST_CASE ( IsolateReload_SuperClassChanged  )

Definition at line 774 of file isolate_reload_test.cc.

774 {
775 const char* kScript =
776 "class A {\n"
777 "}\n"
778 "class B extends A {\n"
779 "}\n"
780 "var list = [ new A(), new B() ];\n"
781 "main() {\n"
782 " return (list.map((x) => '${x is A}/${x is B}')).toString();\n"
783 "}\n";
784
785 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
786 EXPECT_VALID(lib);
787 EXPECT_STREQ("(true/false, true/true)", SimpleInvokeStr(lib, "main"));
788
789 const char* kReloadScript =
790 "var _unused;"
791 "class B{\n"
792 "}\n"
793 "class A extends B {\n"
794 "}\n"
795 "var list = [ new A(), new B() ];\n"
796 "main() {\n"
797 " return (list.map((x) => '${x is A}/${x is B}')).toString();\n"
798 "}\n";
799
800 lib = TestCase::ReloadTestScript(kReloadScript);
801 EXPECT_VALID(lib);
802 EXPECT_STREQ("(true/true, false/true)", SimpleInvokeStr(lib, "main"));
803}

◆ TEST_CASE() [439/600]

dart::TEST_CASE ( IsolateReload_SuperGetterReboundToMethod  )

Definition at line 6015 of file isolate_reload_test.cc.

6017 {\n"
6018 " dynamic f = field;\n"
6019 " return f('b');\n"
6020 "}\n";
6021
6022 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
6023 EXPECT_VALID(lib);
6024 EXPECT_STREQ("ab", SimpleInvokeStr(lib, "main"));
6025
6026 const char* kReloadScript =
6027 "extraFunction() => 'Just here to change kernel offsets';\n"
6028 "dynamic field = (_, __) => 'Not executed';\n"
6029 "main() {\n"
6030 " dynamic f = field;\n"
6031 " return f('c');\n"
6032 "}\n";
6033
6034 lib = TestCase::ReloadTestScript(kReloadScript);
6035 EXPECT_VALID(lib);
6036 EXPECT_STREQ("ac", SimpleInvokeStr(lib, "main"));
6037}
6038
6039TEST_CASE(IsolateReload_StaticTargetArityChange) {
6040 const char* kScript = R"(
6041 class A {
6042 final x;
6043 final y;
6044 const A(this.x, this.y);
6045 }
6046
6047 dynamic closure;
6048
6049 main() {
6050 closure = () => A(1, 2);
6051 return "okay";
6052 }
6053 )";
6054
6055 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
6056 EXPECT_VALID(lib);
6057 EXPECT_STREQ("okay", SimpleInvokeStr(lib, "main"));
6058
6059 const char* kReloadScript = R"(
6060 class A {
6061 final x;
6062 const A(this.x);
6063 }
6064
6065 dynamic closure;
#define __

◆ TEST_CASE() [440/600]

dart::TEST_CASE ( IsolateReload_TearOff_AddArguments  )

Definition at line 1878 of file isolate_reload_test.cc.

1878 {
1879 const char* kScript =
1880 "import 'file:///test:isolate_reload_helper';\n"
1881 "class C {\n"
1882 " foo(x) => x;\n"
1883 "}\n"
1884 "invoke(f, a) {\n"
1885 " try {\n"
1886 " return f(a);\n"
1887 " } catch (e) {\n"
1888 " return e.toString().split('\\n').first;\n"
1889 " }\n"
1890 "}\n"
1891 "main() {\n"
1892 " var c = new C();\n"
1893 " var f = c.foo;\n"
1894 " var r1 = invoke(f, 1);\n"
1895 " reloadTest();\n"
1896 " var r2 = invoke(f, 1);\n"
1897 " return '$r1 $r2';\n"
1898 "}\n";
1899
1900 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
1901 EXPECT_VALID(lib);
1902
1903 const char* kReloadScript =
1904 "import 'file:///test:isolate_reload_helper';\n"
1905 "class C {\n"
1906 " foo(x, y, z) => x + y + z;\n"
1907 "}\n"
1908 "invoke(f, a) {\n"
1909 " try {\n"
1910 " return f(a);\n"
1911 " } catch (e) {\n"
1912 " return e.toString().split('\\n').first;\n"
1913 " }\n"
1914 "}\n"
1915 "main() {\n"
1916 " var c = new C();\n"
1917 " var f = c.foo;\n"
1918 " var r1 = invoke(f, 1);\n"
1919 " reloadTest();\n"
1920 " var r2 = invoke(f, 1);\n"
1921 " return '$r1 $r2';\n"
1922 "}\n";
1923
1924 EXPECT_VALID(TestCase::SetReloadTestScript(kReloadScript));
1925
1926 EXPECT_STREQ(
1927 "1 NoSuchMethodError: Class 'C' has no instance method "
1928 "'foo' with matching arguments.",
1929 SimpleInvokeStr(lib, "main"));
1930
1931 lib = Dart_RootLibrary();
1932 EXPECT_NON_NULL(lib);
1933}

◆ TEST_CASE() [441/600]

dart::TEST_CASE ( IsolateReload_TearOff_AddArguments2  )

Definition at line 1935 of file isolate_reload_test.cc.

1935 {
1936 const char* kScript =
1937 "import 'file:///test:isolate_reload_helper';\n"
1938 "class C {\n"
1939 " static foo(x) => x;\n"
1940 "}\n"
1941 "invoke(f, a) {\n"
1942 " try {\n"
1943 " return f(a);\n"
1944 " } catch (e) {\n"
1945 " return e.toString().split('\\n').first;\n"
1946 " }\n"
1947 "}\n"
1948 "main() {\n"
1949 " var f = C.foo;\n"
1950 " var r1 = invoke(f, 1);\n"
1951 " reloadTest();\n"
1952 " var r2 = invoke(f, 1);\n"
1953 " return '$r1 $r2';\n"
1954 "}\n";
1955
1956 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
1957 EXPECT_VALID(lib);
1958
1959 const char* kReloadScript =
1960 "import 'file:///test:isolate_reload_helper';\n"
1961 "class C {\n"
1962 " static foo(x, y, z) => x + y + z;\n"
1963 "}\n"
1964 "invoke(f, a) {\n"
1965 " try {\n"
1966 " return f(a);\n"
1967 " } catch (e) {\n"
1968 " return e.toString().split('\\n').first;\n"
1969 " }\n"
1970 "}\n"
1971 "main() {\n"
1972 " var f = C.foo;\n"
1973 " var r1 = invoke(f, 1);\n"
1974 " reloadTest();\n"
1975 " var r2 = invoke(f, 1);\n"
1976 " return '$r1 $r2';\n"
1977 "}\n";
1978
1979 EXPECT_VALID(TestCase::SetReloadTestScript(kReloadScript));
1980
1981 EXPECT_STREQ(
1982 "1 NoSuchMethodError: Closure call with mismatched arguments: "
1983 "function 'C.foo'",
1984 SimpleInvokeStr(lib, "main"));
1985
1986 lib = Dart_RootLibrary();
1987 EXPECT_NON_NULL(lib);
1988}

◆ TEST_CASE() [442/600]

dart::TEST_CASE ( IsolateReload_TearOff_Class_Identity  )

Definition at line 1743 of file isolate_reload_test.cc.

1743 {
1744 const char* kScript =
1745 "import 'file:///test:isolate_reload_helper';\n"
1746 "class C {\n"
1747 " static foo() => 'old';\n"
1748 "}\n"
1749 "getFoo() => C.foo;\n"
1750 "main() {\n"
1751 " var f1 = getFoo();\n"
1752 " reloadTest();\n"
1753 " var f2 = getFoo();\n"
1754 " return '${f1()} ${f2()} ${f1 == f2} ${identical(f1, f2)}';\n"
1755 "}\n";
1756
1757 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
1758 EXPECT_VALID(lib);
1759
1760 const char* kReloadScript =
1761 "import 'file:///test:isolate_reload_helper';\n"
1762 "class C {\n"
1763 " static foo() => 'new';\n"
1764 "}\n"
1765 "getFoo() => C.foo;\n"
1766 "main() {\n"
1767 " var f1 = getFoo();\n"
1768 " reloadTest();\n"
1769 " var f2 = getFoo();\n"
1770 " return '${f1()} ${f2()} ${f1 == f2} ${identical(f1, f2)}';\n"
1771 "}\n";
1772
1773 EXPECT_VALID(TestCase::SetReloadTestScript(kReloadScript));
1774
1775 EXPECT_STREQ("new new true true", SimpleInvokeStr(lib, "main"));
1776
1777 lib = Dart_RootLibrary();
1778 EXPECT_NON_NULL(lib);
1779}

◆ TEST_CASE() [443/600]

dart::TEST_CASE ( IsolateReload_TearOff_Instance_Equality  )

Definition at line 1629 of file isolate_reload_test.cc.

1629 {
1630 const char* kScript =
1631 "import 'file:///test:isolate_reload_helper';\n"
1632 "class C {\n"
1633 " foo() => 'old';\n"
1634 "}\n"
1635 "main() {\n"
1636 " var c = new C();\n"
1637 " var f1 = c.foo;\n"
1638 " reloadTest();\n"
1639 " var f2 = c.foo;\n"
1640 " return '${f1()} ${f2()} ${f1 == f2} ${identical(f1, f2)}';\n"
1641 "}\n";
1642
1643 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
1644 EXPECT_VALID(lib);
1645
1646 const char* kReloadScript =
1647 "import 'file:///test:isolate_reload_helper';\n"
1648 "class C {\n"
1649 " foo() => 'new';\n"
1650 "}\n"
1651 "main() {\n"
1652 " var c = new C();\n"
1653 " var f1 = c.foo;\n"
1654 " reloadTest();\n"
1655 " var f2 = c.foo;\n"
1656 " return '${f1()} ${f2()} ${f1 == f2} ${identical(f1, f2)}';\n"
1657 "}\n";
1658
1659 EXPECT_VALID(TestCase::SetReloadTestScript(kReloadScript));
1660
1661 EXPECT_STREQ("new new true false", SimpleInvokeStr(lib, "main"));
1662
1663 lib = Dart_RootLibrary();
1664 EXPECT_NON_NULL(lib);
1665}

◆ TEST_CASE() [444/600]

dart::TEST_CASE ( IsolateReload_TearOff_Library_Identity  )

Definition at line 1781 of file isolate_reload_test.cc.

1781 {
1782 const char* kScript =
1783 "import 'file:///test:isolate_reload_helper';\n"
1784 "foo() => 'old';\n"
1785 "getFoo() => foo;\n"
1786 "main() {\n"
1787 " var f1 = getFoo();\n"
1788 " reloadTest();\n"
1789 " var f2 = getFoo();\n"
1790 " return '${f1()} ${f2()} ${f1 == f2} ${identical(f1, f2)}';\n"
1791 "}\n";
1792
1793 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
1794 EXPECT_VALID(lib);
1795
1796 const char* kReloadScript =
1797 "import 'file:///test:isolate_reload_helper';\n"
1798 "foo() => 'new';\n"
1799 "getFoo() => foo;\n"
1800 "main() {\n"
1801 " var f1 = getFoo();\n"
1802 " reloadTest();\n"
1803 " var f2 = getFoo();\n"
1804 " return '${f1()} ${f2()} ${f1 == f2} ${identical(f1, f2)}';\n"
1805 "}\n";
1806
1807 EXPECT_VALID(TestCase::SetReloadTestScript(kReloadScript));
1808
1809 EXPECT_STREQ("new new true true", SimpleInvokeStr(lib, "main"));
1810
1811 lib = Dart_RootLibrary();
1812 EXPECT_NON_NULL(lib);
1813}

◆ TEST_CASE() [445/600]

dart::TEST_CASE ( IsolateReload_TearOff_List_Set  )

Definition at line 1815 of file isolate_reload_test.cc.

1815 {
1816 const char* kScript =
1817 "import 'file:///test:isolate_reload_helper';\n"
1818 "class C {\n"
1819 " foo() => 'old';\n"
1820 "}\n"
1821 "List list = List<dynamic>.filled(2, null);\n"
1822 "Set set = Set();\n"
1823 "main() {\n"
1824 " var c = C();\n"
1825 " list[0] = c.foo;\n"
1826 " list[1] = c.foo;\n"
1827 " set.add(c.foo);\n"
1828 " set.add(c.foo);\n"
1829 " int countBefore = set.length;\n"
1830 " reloadTest();\n"
1831 " list[1] = c.foo;\n"
1832 " set.add(c.foo);\n"
1833 " set.add(c.foo);\n"
1834 " int countAfter = set.length;\n"
1835 " return '${list[0]()} ${list[1]()} ${list[0] == list[1]} '\n"
1836 " '${countBefore == 1} ${countAfter == 1} ${(set.first)()} '\n"
1837 " '${set.first == c.foo} ${set.first == c.foo} '\n"
1838 " '${set.remove(c.foo)}';\n"
1839 "}\n";
1840
1841 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
1842 EXPECT_VALID(lib);
1843
1844 const char* kReloadScript =
1845 "import 'file:///test:isolate_reload_helper';\n"
1846 "class C {\n"
1847 " foo() => 'new';\n"
1848 "}\n"
1849 "List list = List<dynamic>.filled(2, null);\n"
1850 "Set set = Set();\n"
1851 "main() {\n"
1852 " var c = C();\n"
1853 " list[0] = c.foo;\n"
1854 " list[1] = c.foo;\n"
1855 " set.add(c.foo);\n"
1856 " set.add(c.foo);\n"
1857 " int countBefore = set.length;\n"
1858 " reloadTest();\n"
1859 " list[1] = c.foo;\n"
1860 " set.add(c.foo);\n"
1861 " set.add(c.foo);\n"
1862 " int countAfter = set.length;\n"
1863 " return '${list[0]()} ${list[1]()} ${list[0] == list[1]} '\n"
1864 " '${countBefore == 1} ${countAfter == 1} ${(set.first)()} '\n"
1865 " '${set.first == c.foo} ${set.first == c.foo} '\n"
1866 " '${set.remove(c.foo)}';\n"
1867 "}\n";
1868
1869 EXPECT_VALID(TestCase::SetReloadTestScript(kReloadScript));
1870
1871 EXPECT_STREQ("new new true true true new true true true",
1872 SimpleInvokeStr(lib, "main"));
1873
1874 lib = Dart_RootLibrary();
1875 EXPECT_NON_NULL(lib);
1876}

◆ TEST_CASE() [446/600]

dart::TEST_CASE ( IsolateReload_TearOff_Parameter_Count_Mismatch  )

Definition at line 1667 of file isolate_reload_test.cc.

1667 {
1668 const char* kScript =
1669 "import 'file:///test:isolate_reload_helper';\n"
1670 "class C {\n"
1671 " static foo() => 'old';\n"
1672 "}\n"
1673 "main() {\n"
1674 " var f1 = C.foo;\n"
1675 " reloadTest();\n"
1676 " return f1();\n"
1677 "}\n";
1678
1679 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
1680 EXPECT_VALID(lib);
1681
1682 const char* kReloadScript =
1683 "import 'file:///test:isolate_reload_helper';\n"
1684 "class C {\n"
1685 " static foo(i) => 'new:$i';\n"
1686 "}\n"
1687 "main() {\n"
1688 " var f1 = C.foo;\n"
1689 " reloadTest();\n"
1690 " return f1();\n"
1691 "}\n";
1692
1693 TestCase::SetReloadTestScript(kReloadScript);
1694 Dart_Handle error_handle = SimpleInvokeError(lib, "main");
1695
1696 const char* error;
1697 error =
1698 "/test-lib:8:12: Error: Too few positional"
1699 " arguments: 1 required, 0 given.\n"
1700 " return f1();";
1701 EXPECT_ERROR(error_handle, error);
1702}

◆ TEST_CASE() [447/600]

dart::TEST_CASE ( IsolateReload_TearOff_Remove  )

Definition at line 1704 of file isolate_reload_test.cc.

1704 {
1705 const char* kScript =
1706 "import 'file:///test:isolate_reload_helper';\n"
1707 "class C {\n"
1708 " static foo({String bar = 'bar'}) => 'old';\n"
1709 "}\n"
1710 "main() {\n"
1711 " var f1 = C.foo;\n"
1712 " reloadTest();\n"
1713 " try {\n"
1714 " return f1();\n"
1715 " } catch(e) { return '$e'; }\n"
1716 "}\n";
1717
1718 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
1719 EXPECT_VALID(lib);
1720
1721 const char* kReloadScript =
1722 "import 'file:///test:isolate_reload_helper';\n"
1723 "class C {\n"
1724 "}\n"
1725 "main() {\n"
1726 " var f1;\n"
1727 " reloadTest();\n"
1728 " try {\n"
1729 " return f1();\n"
1730 " } catch(e) { return '$e'; }\n"
1731 "}\n";
1732
1733 TestCase::SetReloadTestScript(kReloadScript);
1734
1735 EXPECT_SUBSTRING(
1736 "NoSuchMethodError: No static method 'foo' declared in class 'C'.",
1737 SimpleInvokeStr(lib, "main"));
1738
1739 lib = Dart_RootLibrary();
1740 EXPECT_NON_NULL(lib);
1741}

◆ TEST_CASE() [448/600]

dart::TEST_CASE ( IsolateReload_TopLevelFieldAdded  )

Definition at line 456 of file isolate_reload_test.cc.

456 {
457 const char* kScript =
458 "var value1 = 10;\n"
459 "main() {\n"
460 " return 'value1=${value1}';\n"
461 "}\n";
462
463 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
464 EXPECT_VALID(lib);
465 EXPECT_STREQ("value1=10", SimpleInvokeStr(lib, "main"));
466
467 const char* kReloadScript =
468 "var value1 = 10;\n"
469 "var value2 = 20;\n"
470 "main() {\n"
471 " return 'value1=${value1},value2=${value2}';\n"
472 "}\n";
473
474 lib = TestCase::ReloadTestScript(kReloadScript);
475 EXPECT_VALID(lib);
476 EXPECT_STREQ("value1=10,value2=20", SimpleInvokeStr(lib, "main"));
477}

◆ TEST_CASE() [449/600]

dart::TEST_CASE ( IsolateReload_TopLevelParseError  )

Definition at line 1268 of file isolate_reload_test.cc.

1268 {
1269 const char* kScript =
1270 "main() {\n"
1271 " return 4;\n"
1272 "}\n";
1273
1274 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
1275 EXPECT_VALID(lib);
1276 EXPECT_EQ(4, SimpleInvoke(lib, "main"));
1277
1278 const char* kReloadScript =
1279 "kjsadkfjaksldfjklsadf;\n"
1280 "main() {\n"
1281 " return 4;\n"
1282 "}\n";
1283
1284 lib = TestCase::ReloadTestScript(kReloadScript);
1285 EXPECT_ERROR(lib,
1286 "Variables must be declared using the keywords"
1287 " 'const', 'final', 'var' or a type name.");
1288}

◆ TEST_CASE() [450/600]

dart::TEST_CASE ( IsolateReload_TypedefAddParameter  )

Definition at line 5922 of file isolate_reload_test.cc.

5922 {
5923 return value.toString();
5924 } catch (e) {
5925 return e.toString();
5926 }
5927 }
5928 )";
5929
5930 lib = TestCase::ReloadTestScript(kReloadScript);
5931 EXPECT_VALID(lib);
5932 EXPECT_STREQ(
5933 "type '(A) => bool' is not a subtype of type '(B) => bool' of 'function "
5934 "result'",
5935 SimpleInvokeStr(lib, "main"));
5936}
5937
5938TEST_CASE(IsolateReload_TypedefToNotTypedef) {
5939 // The CFE lowers typedefs to function types and as such the VM will not see
5940 // any name collision between a class and a typedef class (which doesn't exist
5941 // anymore).
5942 const char* kScript =
5943 "typedef bool Predicate(dynamic x);\n"
5944 "main() {\n"

◆ TEST_CASE() [451/600]

dart::TEST_CASE ( IsolateReload_TypedefToNotTypedef  )

Definition at line 5870 of file isolate_reload_test.cc.

5872 {}
5873 class B {}
5874 typedef bool Predicate(B b);
5875 class Foo {
5876 Predicate x;
5877 Foo(this.x);
5878 }
5879 %s Foo value;
5880 main() {
5881 try {
5882 return value.x.toString();
5883 } catch (e) {
5884 return e.toString();
5885 }
5886 }
5887 )", late_tag), std::free);
5888 // clang-format on
5889
5890 lib = TestCase::ReloadTestScript(kReloadScript.get());
5891 EXPECT_VALID(lib);
5892 EXPECT_STREQ(
5893 "type '(A) => bool' is not a subtype of type '(B) => bool' of 'function "
5894 "result'",

◆ TEST_CASE() [452/600]

dart::TEST_CASE ( IsolateReload_TypeIdentity  )

Definition at line 836 of file isolate_reload_test.cc.

836 {
837 const char* kScript =
838 "import 'file:///test:isolate_reload_helper';\n"
839 "class T { }\n"
840 "getType() => T;\n"
841 "main() {\n"
842 " var oldType = getType();\n"
843 " reloadTest();\n"
844 " var newType = getType();\n"
845 " return identical(oldType, newType).toString();\n"
846 "}\n";
847
848 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
849 EXPECT_VALID(lib);
850
851 const char* kReloadScript =
852 "import 'file:///test:isolate_reload_helper';\n"
853 "class T extends Stopwatch { }\n"
854 "getType() => T;\n"
855 "main() {\n"
856 " var oldType = getType();\n"
857 " reloadTest();\n"
858 " var newType = getType();\n"
859 " return identical(oldType, newType).toString();\n"
860 "}\n";
861
862 EXPECT_VALID(TestCase::SetReloadTestScript(kReloadScript));
863
864 EXPECT_STREQ("true", SimpleInvokeStr(lib, "main"));
865}

◆ TEST_CASE() [453/600]

dart::TEST_CASE ( IsolateReload_TypeIdentityGeneric  )

Definition at line 867 of file isolate_reload_test.cc.

867 {
868 const char* kScript =
869 "import 'file:///test:isolate_reload_helper';\n"
870 "class T<G> { }\n"
871 "getType() => new T<int>().runtimeType;\n"
872 "main() {\n"
873 " var oldType = getType();\n"
874 " reloadTest();\n"
875 " var newType = getType();\n"
876 " return identical(oldType, newType).toString();\n"
877 "}\n";
878
879 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
880 EXPECT_VALID(lib);
881
882 const char* kReloadScript =
883 "import 'file:///test:isolate_reload_helper';\n"
884 "class T<G> extends Stopwatch { }\n"
885 "getType() => new T<int>().runtimeType;\n"
886 "main() {\n"
887 " var oldType = getType();\n"
888 " reloadTest();\n"
889 " var newType = getType();\n"
890 " return identical(oldType, newType).toString();\n"
891 "}\n";
892
893 EXPECT_VALID(TestCase::SetReloadTestScript(kReloadScript));
894
895 EXPECT_STREQ("true", SimpleInvokeStr(lib, "main"));
896}

◆ TEST_CASE() [454/600]

dart::TEST_CASE ( IsolateReload_TypeIdentityParameter  )

Definition at line 898 of file isolate_reload_test.cc.

898 {
899 const char* kScript =
900 "import 'dart:mirrors';\n"
901 "import 'file:///test:isolate_reload_helper';\n"
902 "class T<G> { }\n"
903 "getTypeVar() => reflectType(T).typeVariables[0];\n"
904 "main() {\n"
905 " var oldType = getTypeVar();\n"
906 " reloadTest();\n"
907 " var newType = getTypeVar();\n"
908 " return (oldType == newType).toString();\n"
909 "}\n";
910
911 Dart_Handle lib = TestCase::LoadTestScript(kScript, nullptr);
912 EXPECT_VALID(lib);
913
914 const char* kReloadScript =
915 "import 'dart:mirrors';\n"
916 "import 'file:///test:isolate_reload_helper';\n"
917 "class T<G> extends Stopwatch { }\n"
918 "getTypeVar() => reflectType(T).typeVariables[0];\n"
919 "main() {\n"
920 " var oldType = getTypeVar();\n"
921 " reloadTest();\n"
922 " var newType = getTypeVar();\n"
923 " return (oldType == newType).toString();\n"
924 "}\n";
925
926 EXPECT_VALID(TestCase::SetReloadTestScript(kReloadScript));
927
928 EXPECT_STREQ("true", SimpleInvokeStr(lib, "main"));
929}

◆ TEST_CASE() [455/600]

dart::TEST_CASE ( IsolateSpawn_FileUri  )

Definition at line 102 of file isolate_test.cc.

102 {
103 IsolateSpawn("file:/a.dart");
104}
void IsolateSpawn(const char *platform_script_value)

◆ TEST_CASE() [456/600]

dart::TEST_CASE ( IsolateSpawn_PackageUri  )

Definition at line 106 of file isolate_test.cc.

106 {
107 IsolateSpawn("package:/a.dart");
108}

◆ TEST_CASE() [457/600]

dart::TEST_CASE ( JSON_JSONStream_Array  )

Definition at line 84 of file json_test.cc.

84 {
85 JSONStream js;
86 {
87 JSONArray jsarr(&js);
88 jsarr.AddValue(true);
89 jsarr.AddValue(false);
90 }
91 EXPECT_STREQ("[true,false]", js.ToCString());
92}

◆ TEST_CASE() [458/600]

dart::TEST_CASE ( JSON_JSONStream_ArrayArray  )

Definition at line 141 of file json_test.cc.

141 {
142 JSONStream js;
143 {
144 JSONArray jsarr(&js);
145 {
146 JSONArray jsarr1(&jsarr);
147 jsarr1.AddValue(static_cast<intptr_t>(4));
148 }
149 {
150 JSONArray jsarr1(&jsarr);
151 jsarr1.AddValue(false);
152 }
153 }
154 EXPECT_STREQ("[[4],[false]]", js.ToCString());
155}

◆ TEST_CASE() [459/600]

dart::TEST_CASE ( JSON_JSONStream_Base64String  )

Definition at line 94 of file json_test.cc.

94 {
95 JSONStream js;
96 {
97 JSONBase64String jsonBase64String(&js);
98 jsonBase64String.AppendBytes(reinterpret_cast<const uint8_t*>("Hello"), 5);
99 jsonBase64String.AppendBytes(reinterpret_cast<const uint8_t*>(", "), 2);
100 jsonBase64String.AppendBytes(reinterpret_cast<const uint8_t*>("world!"), 6);
101 }
102 EXPECT_STREQ("\"SGVsbG8sIHdvcmxkIQ==\"", js.ToCString());
103}

◆ TEST_CASE() [460/600]

dart::TEST_CASE ( JSON_JSONStream_DartString  )

Definition at line 224 of file json_test.cc.

224 {
225 const char* kScriptChars =
226 "var ascii = 'Hello, World!';\n"
227 "var unicode = '\\u00CE\\u00F1\\u0163\\u00E9r\\u00F1\\u00E5\\u0163"
228 "\\u00EE\\u00F6\\u00F1\\u00E5\\u013C\\u00EE\\u017E\\u00E5\\u0163"
229 "\\u00EE\\u1EDD\\u00F1';\n"
230 "var surrogates = '\\u{1D11E}\\u{1D11E}\\u{1D11E}"
231 "\\u{1D11E}\\u{1D11E}';\n"
232 "var wrongEncoding = '\\u{1D11E}' + surrogates[0] + '\\u{1D11E}';"
233 "var nullInMiddle = 'This has\\u0000 four words.';";
234
235 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
236 EXPECT_VALID(lib);
237
239 TransitionNativeToVM transition1(thread);
240 String& obj = String::Handle();
241
242 auto do_test = [&](const char* field_name, const char* expected) {
243 {
244 TransitionVMToNative to_native(thread);
245 result = Dart_GetField(lib, NewString(field_name));
247 }
248
249 obj ^= Api::UnwrapHandle(result);
250
251 {
252 JSONStream js;
253 {
254 JSONObject jsobj(&js);
255 EXPECT(!jsobj.AddPropertyStr(field_name, obj));
256 }
257 EXPECT_STREQ(expected, js.ToCString());
258 }
259 };
260
261 {
262 TransitionVMToNative to_native(thread);
263 result = Dart_GetField(lib, NewString("ascii"));
265 }
266
267 obj ^= Api::UnwrapHandle(result);
268
269 {
270 JSONStream js;
271 {
272 JSONObject jsobj(&js);
273 EXPECT(jsobj.AddPropertyStr("subrange", obj, 1, 4));
274 }
275 EXPECT_STREQ("{\"subrange\":\"ello\"}", js.ToCString());
276 }
277
278 do_test("ascii", "{\"ascii\":\"Hello, World!\"}");
279 do_test("unicode", "{\"unicode\":\"Îñţérñåţîöñåļîžåţîờñ\"}");
280 do_test("surrogates", "{\"surrogates\":\"𝄞𝄞𝄞𝄞𝄞\"}");
281 do_test("wrongEncoding", "{\"wrongEncoding\":\"𝄞\\uD834𝄞\"}");
282 do_test("nullInMiddle", "{\"nullInMiddle\":\"This has\\u0000 four words.\"}");
283}

◆ TEST_CASE() [461/600]

dart::TEST_CASE ( JSON_JSONStream_EscapedString  )

Definition at line 215 of file json_test.cc.

215 {
216 JSONStream js;
217 {
218 JSONArray jsarr(&js);
219 jsarr.AddValue("Hel\"\"lo\r\n\t");
220 }
221 EXPECT_STREQ("[\"Hel\\\"\\\"lo\\r\\n\\t\"]", js.ToCString());
222}

◆ TEST_CASE() [462/600]

dart::TEST_CASE ( JSON_JSONStream_NestedObject  )

Definition at line 115 of file json_test.cc.

115 {
116 JSONStream js;
117 {
118 JSONObject jsobj(&js);
119 JSONObject jsobj1(&jsobj, "key");
120 jsobj1.AddProperty("key1", "d");
121 }
122 EXPECT_STREQ("{\"key\":{\"key1\":\"d\"}}", js.ToCString());
123}

◆ TEST_CASE() [463/600]

dart::TEST_CASE ( JSON_JSONStream_Object  )

Definition at line 105 of file json_test.cc.

105 {
106 JSONStream js;
107 {
108 JSONObject jsobj(&js);
109 jsobj.AddProperty("key1", "a");
110 jsobj.AddProperty("key2", "b");
111 }
112 EXPECT_STREQ("{\"key1\":\"a\",\"key2\":\"b\"}", js.ToCString());
113}

◆ TEST_CASE() [464/600]

dart::TEST_CASE ( JSON_JSONStream_ObjectArray  )

Definition at line 125 of file json_test.cc.

125 {
126 JSONStream js;
127 {
128 JSONArray jsarr(&js);
129 {
130 JSONObject jsobj(&jsarr);
131 jsobj.AddProperty("key", "e");
132 }
133 {
134 JSONObject jsobj(&jsarr);
135 jsobj.AddProperty("yek", "f");
136 }
137 }
138 EXPECT_STREQ("[{\"key\":\"e\"},{\"yek\":\"f\"}]", js.ToCString());
139}

◆ TEST_CASE() [465/600]

dart::TEST_CASE ( JSON_JSONStream_ObjectPrintf  )

Definition at line 166 of file json_test.cc.

166 {
167 JSONStream js;
168 {
169 JSONObject jsobj(&js);
170 jsobj.AddPropertyF("key", "%d %s", 2, "hello");
171 }
172 EXPECT_STREQ("{\"key\":\"2 hello\"}", js.ToCString());
173}

◆ TEST_CASE() [466/600]

dart::TEST_CASE ( JSON_JSONStream_Params  )

Definition at line 285 of file json_test.cc.

285 {
286 const char* param_keys[] = {"dog", "cat"};
287 const char* param_values[] = {"apple", "banana"};
288
289 JSONStream js;
290 EXPECT(js.num_params() == 0);
291 js.SetParams(&param_keys[0], &param_values[0], 2);
292 EXPECT(js.num_params() == 2);
293 EXPECT(!js.HasParam("lizard"));
294 EXPECT(js.HasParam("dog"));
295 EXPECT(js.HasParam("cat"));
296 EXPECT(js.ParamIs("cat", "banana"));
297 EXPECT(!js.ParamIs("dog", "banana"));
298}

◆ TEST_CASE() [467/600]

dart::TEST_CASE ( JSON_JSONStream_Primitives  )

Definition at line 23 of file json_test.cc.

23 {
24 {
25 JSONStream js;
26 { JSONObject jsobj(&js); }
27 EXPECT_STREQ("{}", js.ToCString());
28 }
29 {
30 JSONStream js;
31 { JSONArray jsarr(&js); }
32 EXPECT_STREQ("[]", js.ToCString());
33 }
34 {
35 JSONStream js;
36 {
37 JSONArray jsarr(&js);
38 jsarr.AddValue(true);
39 }
40 EXPECT_STREQ("[true]", js.ToCString());
41 }
42 {
43 JSONStream js;
44 {
45 JSONArray jsarr(&js);
46 jsarr.AddValue(false);
47 }
48 EXPECT_STREQ("[false]", js.ToCString());
49 }
50 {
51 JSONStream js;
52 {
53 JSONArray jsarr(&js);
54 jsarr.AddValue(static_cast<intptr_t>(4));
55 }
56 EXPECT_STREQ("[4]", js.ToCString());
57 }
58 {
59 JSONStream js;
60 {
61 JSONArray jsarr(&js);
62 jsarr.AddValue(1.0);
63 }
64 EXPECT_STREQ("[1.0]", js.ToCString());
65 }
66 {
67 JSONStream js;
68 {
69 JSONArray jsarr(&js);
70 jsarr.AddValue("hello");
71 }
72 EXPECT_STREQ("[\"hello\"]", js.ToCString());
73 }
74 {
75 JSONStream js;
76 {
77 JSONArray jsarr(&js);
78 jsarr.AddValueF("h%s", "elo");
79 }
80 EXPECT_STREQ("[\"helo\"]", js.ToCString());
81 }
82}

◆ TEST_CASE() [468/600]

dart::TEST_CASE ( JSON_JSONStream_Printf  )

Definition at line 157 of file json_test.cc.

157 {
158 JSONStream js;
159 {
160 JSONArray jsarr(&js);
161 jsarr.AddValueF("%d %s", 2, "hello");
162 }
163 EXPECT_STREQ("[\"2 hello\"]", js.ToCString());
164}

◆ TEST_CASE() [469/600]

dart::TEST_CASE ( JSON_TextBuffer  )

Definition at line 15 of file json_test.cc.

15 {
16 TextBuffer w(5); // Small enough to make buffer grow at least once.
17 w.Printf("{ \"%s\" : %d", "length", 175);
18 EXPECT_STREQ("{ \"length\" : 175", w.buffer());
19 w.Printf(", \"%s\" : \"%s\" }", "command", "stopIt");
20 EXPECT_STREQ("{ \"length\" : 175, \"command\" : \"stopIt\" }", w.buffer());
21}

◆ TEST_CASE() [470/600]

dart::TEST_CASE ( LargeSweep  )

Definition at line 71 of file heap_test.cc.

71 {
72 const char* kScriptChars =
73 "main() {\n"
74 " return List.filled(8 * 1024 * 1024, null);\n"
75 "}\n";
76 NOT_IN_PRODUCT(FLAG_verbose_gc = true);
77 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
79 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, nullptr);
80
84 {
85 TransitionNativeToVM transition(thread);
86 GCTestHelper::CollectOldSpace();
87 }
89 {
90 TransitionNativeToVM transition(thread);
91 GCTestHelper::CollectOldSpace();
92 }
93}
#define NOT_IN_PRODUCT(code)
Definition globals.h:84

◆ TEST_CASE() [471/600]

dart::TEST_CASE ( Log_Basic  )

Definition at line 61 of file log_test.cc.

61 {
62 test_output_ = nullptr;
63 Log* log = new Log(TestPrinter);
64
65 EXPECT_EQ(static_cast<const char*>(nullptr), test_output_);
66 log->Print("Hello %s", "World");
67 EXPECT_STREQ("Hello World", test_output_);
68
69 delete log;
70 LogTestHelper::FreeTestOutput();
71}
static const char * test_output_
Definition log_test.cc:20

◆ TEST_CASE() [472/600]

dart::TEST_CASE ( Log_Block  )

Definition at line 73 of file log_test.cc.

73 {
74 test_output_ = nullptr;
75 Log* log = new Log(TestPrinter);
76
77 EXPECT_EQ(static_cast<const char*>(nullptr), test_output_);
78 {
79 LogBlock ba(thread, log);
80 log->Print("APPLE");
81 EXPECT_EQ(static_cast<const char*>(nullptr), test_output_);
82 {
83 LogBlock ba(thread, log);
84 log->Print("BANANA");
85 EXPECT_EQ(static_cast<const char*>(nullptr), test_output_);
86 }
87 EXPECT_EQ(static_cast<const char*>(nullptr), test_output_);
88 {
89 LogBlock ba(thread, log);
90 log->Print("PEAR");
91 EXPECT_EQ(static_cast<const char*>(nullptr), test_output_);
92 }
93 EXPECT_EQ(static_cast<const char*>(nullptr), test_output_);
94 }
95 EXPECT_STREQ("APPLEBANANAPEAR", test_output_);
96 delete log;
97 LogTestHelper::FreeTestOutput();
98}

◆ TEST_CASE() [473/600]

dart::TEST_CASE ( Log_Macro  )

Definition at line 49 of file log_test.cc.

49 {
50 test_output_ = nullptr;
51 Log* log = Log::Current();
52 LogTestHelper::SetPrinter(log, TestPrinter);
53
54 THR_Print("Hello %s", "World");
55 EXPECT_STREQ("Hello World", test_output_);
56 THR_Print("SingleArgument");
57 EXPECT_STREQ("SingleArgument", test_output_);
58 LogTestHelper::FreeTestOutput();
59}

◆ TEST_CASE() [474/600]

dart::TEST_CASE ( MallocDirectChainedHashMap  )

Definition at line 101 of file hash_map_test.cc.

101 {
103 EXPECT(map.IsEmpty());
104 TestValue v1(0);
105 TestValue v2(1);
106 TestValue v3(0);
107 map.Insert(&v1);
108 EXPECT(map.LookupValue(&v1) == &v1);
109 map.Insert(&v2);
110 EXPECT(map.LookupValue(&v1) == &v1);
111 EXPECT(map.LookupValue(&v2) == &v2);
112 EXPECT(map.LookupValue(&v3) == &v1);
114 EXPECT(map2.LookupValue(&v1) == &v1);
115 EXPECT(map2.LookupValue(&v2) == &v2);
116 EXPECT(map2.LookupValue(&v3) == &v1);
117}

◆ TEST_CASE() [475/600]

dart::TEST_CASE ( MallocGrowableArray  )

Definition at line 72 of file growable_array_test.cc.

72 {
73 TestGrowableArray<MallocGrowableArray<int>, MallocGrowableArray<int64_t> >();
74}

◆ TEST_CASE() [476/600]

dart::TEST_CASE ( ManyClasses  )

Definition at line 292 of file compiler_test.cc.

292 {
293 // Limit is 20 bits. Check only more than 16 bits so test completes in
294 // reasonable time.
295 const intptr_t kNumClasses = (1 << 16) + 1;
296
297 TextBuffer buffer(MB);
298 for (intptr_t i = 0; i < kNumClasses; i++) {
299 buffer.Printf("class C%" Pd " { String toString() => 'C%" Pd "'; }\n", i,
300 i);
301 }
302 buffer.Printf("main() {\n");
303 for (intptr_t i = 0; i < kNumClasses; i++) {
304 buffer.Printf(" new C%" Pd "().toString();\n", i);
305 }
306 buffer.Printf("}\n");
307
308 Dart_Handle lib = TestCase::LoadTestScript(buffer.buffer(), nullptr);
309 EXPECT_VALID(lib);
310 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, nullptr);
312
313 EXPECT(IsolateGroup::Current()->class_table()->NumCids() >= kNumClasses);
314}

◆ TEST_CASE() [477/600]

dart::TEST_CASE ( Map_iteration  )

Definition at line 6616 of file object_test.cc.

6616 {
6617 const char* kScript =
6618 "const type = int;\n"
6619 "\n"
6620 "value() {\n"
6621 " return type;\n"
6622 "}\n";
6623 EXPECT(HashCodeEqualsCanonicalizeHash(kScript, kCalculateCanonicalizeHash,
6624 /*check_identity=*/false));
6625}
6626
6627TEST_CASE(Map_iteration) {
6628 const char* kScript =
6629 "makeMap() {\n"
6630 " var map = {'x': 3, 'y': 4, 'z': 5, 'w': 6};\n"
6631 " map.remove('y');\n"
6632 " map.remove('w');\n"
6633 " return map;\n"
6634 "}";
6635 Dart_Handle h_lib = TestCase::LoadTestScript(kScript, nullptr);
6636 EXPECT_VALID(h_lib);
6637 Dart_Handle h_result = Dart_Invoke(h_lib, NewString("makeMap"), 0, nullptr);
6638 EXPECT_VALID(h_result);
6639
6640 TransitionNativeToVM transition(thread);
6641 Instance& dart_map = Instance::Handle();
6642 dart_map ^= Api::UnwrapHandle(h_result);
6643 ASSERT(dart_map.IsMap());
6644 const Map& cc_map = Map::Cast(dart_map);
6645
6646 EXPECT_EQ(2, cc_map.Length());
6647
6648 Map::Iterator iterator(cc_map);
6649 Object& object = Object::Handle();
6650
6651 EXPECT(iterator.MoveNext());
6652 object = iterator.CurrentKey();
6653 EXPECT_STREQ("x", object.ToCString());

◆ TEST_CASE() [478/600]

dart::TEST_CASE ( MessageQueue_BasicOperations  )

Definition at line 15 of file message_test.cc.

15 {
17 EXPECT(queue.IsEmpty());
18 MessageQueue::Iterator it(&queue);
19 // Queue is empty.
20 EXPECT(!it.HasNext());
21
22 Dart_Port port = 1;
23
24 const char* str1 = "msg1";
25 const char* str2 = "msg2";
26 const char* str3 = "msg3";
27 const char* str4 = "msg4";
28 const char* str5 = "msg5";
29 const char* str6 = "msg6";
30
31 // Add two messages.
32 std::unique_ptr<Message> msg =
33 Message::New(port, AllocMsg(str1), strlen(str1) + 1, nullptr,
34 Message::kNormalPriority);
35 Message* msg1 = msg.get();
36 queue.Enqueue(std::move(msg), false);
37 EXPECT(queue.Length() == 1);
38 EXPECT(!queue.IsEmpty());
39 it.Reset(&queue);
40 EXPECT(it.HasNext());
41 EXPECT(it.Next() == msg1);
42 EXPECT(!it.HasNext());
43
44 msg = Message::New(port, AllocMsg(str2), strlen(str2) + 1, nullptr,
45 Message::kNormalPriority);
46 Message* msg2 = msg.get();
47 queue.Enqueue(std::move(msg), false);
48 EXPECT(queue.Length() == 2);
49 EXPECT(!queue.IsEmpty());
50 it.Reset(&queue);
51 EXPECT(it.HasNext());
52 EXPECT(it.Next() == msg1);
53 EXPECT(it.HasNext());
54 EXPECT(it.Next() == msg2);
55 EXPECT(!it.HasNext());
56
57 // Lookup messages by id.
58 EXPECT(queue.FindMessageById(reinterpret_cast<intptr_t>(msg1)) == msg1);
59 EXPECT(queue.FindMessageById(reinterpret_cast<intptr_t>(msg2)) == msg2);
60
61 // Lookup bad id.
62 EXPECT(queue.FindMessageById(0x1) == nullptr);
63
64 // Remove message 1
65 msg = queue.Dequeue();
66 EXPECT(msg != nullptr);
67 EXPECT_STREQ(str1, reinterpret_cast<char*>(msg->snapshot()));
68 EXPECT(!queue.IsEmpty());
69
70 it.Reset(&queue);
71 EXPECT(it.HasNext());
72 EXPECT(it.Next() == msg2);
73
74 // Remove message 2
75 msg = queue.Dequeue();
76 EXPECT(msg != nullptr);
77 EXPECT_STREQ(str2, reinterpret_cast<char*>(msg->snapshot()));
78 EXPECT(queue.IsEmpty());
79
80 msg = Message::New(Message::kIllegalPort, AllocMsg(str3), strlen(str3) + 1,
81 nullptr, Message::kNormalPriority);
82 queue.Enqueue(std::move(msg), true);
83 EXPECT(!queue.IsEmpty());
84
85 msg = Message::New(Message::kIllegalPort, AllocMsg(str4), strlen(str4) + 1,
86 nullptr, Message::kNormalPriority);
87 queue.Enqueue(std::move(msg), true);
88 EXPECT(!queue.IsEmpty());
89
90 msg = Message::New(port, AllocMsg(str5), strlen(str5) + 1, nullptr,
91 Message::kNormalPriority);
92 queue.Enqueue(std::move(msg), false);
93 EXPECT(!queue.IsEmpty());
94
95 msg = Message::New(Message::kIllegalPort, AllocMsg(str6), strlen(str6) + 1,
96 nullptr, Message::kNormalPriority);
97 queue.Enqueue(std::move(msg), true);
98 EXPECT(!queue.IsEmpty());
99
100 msg = queue.Dequeue();
101 EXPECT(msg != nullptr);
102 EXPECT_STREQ(str3, reinterpret_cast<char*>(msg->snapshot()));
103 EXPECT(!queue.IsEmpty());
104
105 msg = queue.Dequeue();
106 EXPECT(msg != nullptr);
107 EXPECT_STREQ(str4, reinterpret_cast<char*>(msg->snapshot()));
108 EXPECT(!queue.IsEmpty());
109
110 msg = queue.Dequeue();
111 EXPECT(msg != nullptr);
112 EXPECT_STREQ(str6, reinterpret_cast<char*>(msg->snapshot()));
113 EXPECT(!queue.IsEmpty());
114
115 msg = queue.Dequeue();
116 EXPECT(msg != nullptr);
117 EXPECT_STREQ(str5, reinterpret_cast<char*>(msg->snapshot()));
118 EXPECT(queue.IsEmpty());
119}
VkQueue queue
Definition main.cc:55
static uint8_t * AllocMsg(const char *str)

◆ TEST_CASE() [479/600]

dart::TEST_CASE ( MessageQueue_Clear  )

Definition at line 121 of file message_test.cc.

121 {
123 Dart_Port port1 = 1;
124 Dart_Port port2 = 2;
125
126 const char* str1 = "msg1";
127 const char* str2 = "msg2";
128
129 // Add two messages.
130 std::unique_ptr<Message> msg;
131 msg = Message::New(port1, AllocMsg(str1), strlen(str1) + 1, nullptr,
132 Message::kNormalPriority);
133 queue.Enqueue(std::move(msg), false);
134 msg = Message::New(port2, AllocMsg(str2), strlen(str2) + 1, nullptr,
135 Message::kNormalPriority);
136 queue.Enqueue(std::move(msg), false);
137
138 EXPECT(!queue.IsEmpty());
139 queue.Clear();
140 EXPECT(queue.IsEmpty());
141}

◆ TEST_CASE() [480/600]

dart::TEST_CASE ( Metadata  )

Definition at line 5427 of file object_test.cc.

5427 {
5428 // clang-format off
5429 auto kScriptChars =
5430 Utils::CStringUniquePtr(OS::SCreate(nullptr,
5431 "@metafoo \n"
5432 "class Meta { \n"
5433 " final m; \n"
5434 " const Meta(this.m); \n"
5435 "} \n"
5436 " \n"
5437 "const metafoo = 'metafoo'; \n"
5438 "const metabar = 'meta' 'bar'; \n"
5439 " \n"
5440 "@metafoo \n"
5441 "@Meta(0) String%s gVar; \n"
5442 " \n"
5443 "@metafoo \n"
5444 "get tlGetter => gVar; \n"
5445 " \n"
5446 "@metabar \n"
5447 "class A { \n"
5448 " @metafoo \n"
5449 " @metabar \n"
5450 " @Meta('baz') \n"
5451 " var aField; \n"
5452 " \n"
5453 " @metabar @Meta('baa') \n"
5454 " int aFunc(a,b) => a + b; \n"
5455 "} \n"
5456 " \n"
5457 "@Meta('main') \n"
5458 "A main() { \n"
5459 " return A(); \n"
5460 "} \n",
5461 TestCase::NullableTag()), std::free);
5462 // clang-format on
5463
5464 Dart_Handle h_lib = TestCase::LoadTestScript(kScriptChars.get(), nullptr);
5465 EXPECT_VALID(h_lib);
5466 Dart_Handle result = Dart_Invoke(h_lib, NewString("main"), 0, nullptr);
5468 TransitionNativeToVM transition(thread);
5469 Library& lib = Library::Handle();
5470 lib ^= Api::UnwrapHandle(h_lib);
5471 EXPECT(!lib.IsNull());
5472 const Class& class_a = Class::Handle(GetClass(lib, "A"));
5473 Object& res = Object::Handle(lib.GetMetadata(class_a));
5474 PrintMetadata("A", res);
5475
5476 const Class& class_meta = Class::Handle(GetClass(lib, "Meta"));
5477 res = lib.GetMetadata(class_meta);
5478 PrintMetadata("Meta", res);
5479
5480 Field& field = Field::Handle(GetField(class_a, "aField"));
5481 res = lib.GetMetadata(field);
5482 PrintMetadata("A.aField", res);
5483
5484 Function& func = Function::Handle(GetFunction(class_a, "aFunc"));
5485 res = lib.GetMetadata(func);
5486 PrintMetadata("A.aFunc", res);
5487
5488 func = lib.LookupFunctionAllowPrivate(
5489 String::Handle(Symbols::New(thread, "main")));
5490 EXPECT(!func.IsNull());
5491 res = lib.GetMetadata(func);
5492 PrintMetadata("main", res);
5493
5494 func = lib.LookupFunctionAllowPrivate(
5495 String::Handle(Symbols::New(thread, "get:tlGetter")));
5496 EXPECT(!func.IsNull());
5497 res = lib.GetMetadata(func);
5498 PrintMetadata("tlGetter", res);
5499
5500 field =
5501 lib.LookupFieldAllowPrivate(String::Handle(Symbols::New(thread, "gVar")));
5502 EXPECT(!field.IsNull());
5503 res = lib.GetMetadata(field);
5504 PrintMetadata("gVar", res);
5505}
FieldPtr LookupFieldAllowPrivate(const String &name) const
Definition object.cc:14122
static FieldPtr GetField(const Class &cls, const char *name)
static void PrintMetadata(const char *name, const Object &data)

◆ TEST_CASE() [481/600]

dart::TEST_CASE ( Mixin_PrivateSuperResolution  )

Definition at line 12 of file mixin_test.cc.

12 {
13 // clang-format off
14 Dart_SourceFile sourcefiles[] = {
15 {
16 "file:///test-app.dart",
17 "class A {\n"
18 " _bar() => 42;\n"
19 "}\n"
20 "mixin M on A {\n"
21 " bar() => -1;\n"
22 "}\n"
23 "class B extends A {\n"
24 " foo() => 6;\n"
25 "}\n"
26 "class C extends B with M {\n"
27 " bar() => super._bar();\n"
28 "}\n"
29 "main() {\n"
30 " return new C().bar();\n"
31 "}\n",
32 }};
33 // clang-format on
34
35 Dart_Handle lib = TestCase::LoadTestScriptWithDFE(
36 sizeof(sourcefiles) / sizeof(Dart_SourceFile), sourcefiles,
37 /* resolver= */ nullptr, /* finalize= */ true, /* incrementally= */ true);
38 EXPECT_VALID(lib);
39 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, nullptr);
40 int64_t value = 0;
43 EXPECT_EQ(42, value);
44}

◆ TEST_CASE() [482/600]

dart::TEST_CASE ( Mixin_PrivateSuperResolutionCrossLibraryShouldFail  )

Definition at line 46 of file mixin_test.cc.

46 {
47 // clang-format off
48 Dart_SourceFile sourcefiles[] = {
49 {
50 "file:///test-app.dart",
51 "import 'test-lib.dart';\n"
52 "class D extends B with M {\n"
53 " bar() => super._bar();\n"
54 "}\n"
55 "main() {\n"
56 " try {\n"
57 " return new D().bar();\n"
58 " } catch (e) {\n"
59 " return e.toString().split('\\n').first;\n"
60 " }\n"
61 "}\n",
62 },
63 {
64 "file:///test-lib.dart",
65 "class A {\n"
66 " foo() => 4;\n"
67 " _bar() => 42;\n"
68 "}\n"
69 "mixin M on A {\n"
70 " bar() => -1;\n"
71 "}\n"
72 "class B extends A {\n"
73 " foo() => 6;\n"
74 "}\n"
75 "class C extends B with M {\n"
76 " bar() => super._bar();\n"
77 "}\n"
78 },
79 {
80 "file:///.packages", "untitled:/"
81 }};
82 // clang-format on
83
84 Dart_Handle lib = TestCase::LoadTestScriptWithDFE(
85 sizeof(sourcefiles) / sizeof(Dart_SourceFile), sourcefiles,
86 /* resolver= */ nullptr, /* finalize= */ true, /* incrementally= */ true);
87 EXPECT_ERROR(lib, "Error: Superclass has no method named '_bar'.");
88}

◆ TEST_CASE() [483/600]

dart::TEST_CASE ( ObjectIdRingScavengeMoveTest  )

Definition at line 124 of file object_id_ring_test.cc.

124 {
125 const char* kScriptChars =
126 "main() {\n"
127 " return [1, 2, 3];\n"
128 "}\n";
129 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
130 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, nullptr);
131 Dart_Handle moved_handle;
132 intptr_t list_length = 0;
136 EXPECT_VALID(Dart_ListLength(result, &list_length));
137 EXPECT_EQ(3, list_length);
138
139 Isolate* isolate = thread->isolate();
140 ObjectIdRing* ring = isolate->EnsureObjectIdRing();
141 ObjectIdRing::LookupResult kind = ObjectIdRing::kInvalid;
142
143 {
144 TransitionNativeToVM to_vm(thread);
145 ObjectPtr raw_obj = Api::UnwrapHandle(result);
146 // Located in new heap.
147 EXPECT(raw_obj->IsNewObject());
148 EXPECT_NE(Object::null(), raw_obj);
149 intptr_t raw_obj_id1 = ring->GetIdForObject(raw_obj);
150 EXPECT_EQ(0, raw_obj_id1);
151 // Get id 0 again.
152 EXPECT_EQ(raw_obj_id1,
153 ring->GetIdForObject(raw_obj, ObjectIdRing::kReuseId));
154 // Add to ring a second time.
155 intptr_t raw_obj_id2 = ring->GetIdForObject(raw_obj);
156 EXPECT_EQ(1, raw_obj_id2);
157 // Get id 0 again.
158 EXPECT_EQ(raw_obj_id1,
159 ring->GetIdForObject(raw_obj, ObjectIdRing::kReuseId));
160 ObjectPtr raw_obj1 = ring->GetObjectForId(raw_obj_id1, &kind);
161 EXPECT_EQ(ObjectIdRing::kValid, kind);
162 ObjectPtr raw_obj2 = ring->GetObjectForId(raw_obj_id2, &kind);
163 EXPECT_EQ(ObjectIdRing::kValid, kind);
164 EXPECT_NE(Object::null(), raw_obj1);
165 EXPECT_NE(Object::null(), raw_obj2);
166 EXPECT_EQ(UntaggedObject::ToAddr(raw_obj),
167 UntaggedObject::ToAddr(raw_obj1));
168 EXPECT_EQ(UntaggedObject::ToAddr(raw_obj),
169 UntaggedObject::ToAddr(raw_obj2));
170 // Force a scavenge.
171 GCTestHelper::CollectNewSpace();
172 ObjectPtr raw_object_moved1 = ring->GetObjectForId(raw_obj_id1, &kind);
173 EXPECT_EQ(ObjectIdRing::kValid, kind);
174 ObjectPtr raw_object_moved2 = ring->GetObjectForId(raw_obj_id2, &kind);
175 EXPECT_EQ(ObjectIdRing::kValid, kind);
176 EXPECT_NE(Object::null(), raw_object_moved1);
177 EXPECT_NE(Object::null(), raw_object_moved2);
178 EXPECT_EQ(UntaggedObject::ToAddr(raw_object_moved1),
179 UntaggedObject::ToAddr(raw_object_moved2));
180 // Test that objects have moved.
181 EXPECT_NE(UntaggedObject::ToAddr(raw_obj1),
182 UntaggedObject::ToAddr(raw_object_moved1));
183 EXPECT_NE(UntaggedObject::ToAddr(raw_obj2),
184 UntaggedObject::ToAddr(raw_object_moved2));
185 // Test that we still point at the same list.
186 moved_handle = Api::NewHandle(thread, raw_object_moved1);
187 // Test id reuse.
188 EXPECT_EQ(raw_obj_id1,
189 ring->GetIdForObject(raw_object_moved1, ObjectIdRing::kReuseId));
190 }
191 EXPECT_VALID(moved_handle);
192 EXPECT(!Dart_IsNull(moved_handle));
193 EXPECT(Dart_IsList(moved_handle));
194 EXPECT_VALID(Dart_ListLength(moved_handle, &list_length));
195 EXPECT_EQ(3, list_length);
196}

◆ TEST_CASE() [484/600]

dart::TEST_CASE ( OldGC  )

Definition at line 29 of file heap_test.cc.

29 {
30 const char* kScriptChars =
31 "main() {\n"
32 " return [1, 2, 3];\n"
33 "}\n";
34 NOT_IN_PRODUCT(FLAG_verbose_gc = true);
35 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
36 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, nullptr);
37
41 TransitionNativeToVM transition(thread);
42 GCTestHelper::CollectOldSpace();
43}

◆ TEST_CASE() [485/600]

dart::TEST_CASE ( OldGC_Unsync  )

Definition at line 46 of file heap_test.cc.

46 {
47 // Finalize any GC in progress as it is unsafe to change FLAG_marker_tasks
48 // when incremental marking is in progress.
49 {
50 TransitionNativeToVM transition(thread);
51 GCTestHelper::CollectAllGarbage();
52 }
53 FLAG_marker_tasks = 0;
54
55 const char* kScriptChars =
56 "main() {\n"
57 " return [1, 2, 3];\n"
58 "}\n";
59 FLAG_verbose_gc = true;
60 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
61 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, nullptr);
62
66 TransitionNativeToVM transition(thread);
67 GCTestHelper::CollectOldSpace();
68}

◆ TEST_CASE() [486/600]

dart::TEST_CASE ( OpenUri_AbsoluteFilename  )

Definition at line 55 of file file_test.cc.

55 {
56 const char* kRelativeFilename =
57 bin::test::GetFileName("runtime/bin/file_test.cc");
58 const char* kFilename =
59 bin::File::GetCanonicalPath(nullptr, kRelativeFilename);
60 EXPECT_NOTNULL(kFilename);
61 char* encoded = reinterpret_cast<char*>(
62 bin::DartUtils::ScopedCString(strlen(kFilename) * 3 + 1));
63 char* t = encoded;
64 // percent-encode all characters 'c'
65 for (const char* p = kFilename; *p != '\0'; p++) {
66 if (*p == 'c') {
67 *t++ = '%';
68 *t++ = '6';
69 *t++ = '3';
70 } else {
71 *t++ = *p;
72 }
73 }
74 *t = 0;
75 bin::File* file = bin::File::OpenUri(nullptr, encoded, bin::File::kRead);
76 EXPECT(file != nullptr);
77 char buffer[16];
78 buffer[0] = '\0';
79 EXPECT(file->ReadFully(buffer, 13)); // ReadFully returns true.
80 buffer[13] = '\0';
81 EXPECT_STREQ("// Copyright ", buffer);
82 EXPECT(!file->WriteByte(1)); // Cannot write to a read-only file.
83 file->Release();
84}

◆ TEST_CASE() [487/600]

dart::TEST_CASE ( OpenUri_InvalidUriPercentEncoding  )

Definition at line 171 of file file_test.cc.

171 {
172 const char* kFilename = bin::test::GetFileName("runtime/bin/file_test.cc");
173 char* encoded = reinterpret_cast<char*>(
174 bin::DartUtils::ScopedCString(strlen(kFilename) * 3 + 1));
175 char* t = encoded;
176 // percent-encode all characters 'c'
177 for (const char* p = kFilename; *p != '\0'; p++) {
178 if (*p == 'c') {
179 *t++ = '%';
180 *t++ = 'f';
181 *t++ = 'o';
182 } else {
183 *t++ = *p;
184 }
185 }
186 *t = 0;
187 bin::File* file = bin::File::OpenUri(nullptr, encoded, bin::File::kRead);
188 EXPECT(file == nullptr);
189}

◆ TEST_CASE() [488/600]

dart::TEST_CASE ( OpenUri_RelativeFilename  )

Definition at line 28 of file file_test.cc.

28 {
29 const char* kFilename = bin::test::GetFileName("runtime/bin/file_test.cc");
30 char* encoded = reinterpret_cast<char*>(
31 bin::DartUtils::ScopedCString(strlen(kFilename) * 3 + 1));
32 char* t = encoded;
33 // percent-encode all characters 'c'
34 for (const char* p = kFilename; *p != '\0'; p++) {
35 if (*p == 'c') {
36 *t++ = '%';
37 *t++ = '6';
38 *t++ = '3';
39 } else {
40 *t++ = *p;
41 }
42 }
43 *t = 0;
44 bin::File* file = bin::File::OpenUri(nullptr, encoded, bin::File::kRead);
45 EXPECT(file != nullptr);
46 char buffer[16];
47 buffer[0] = '\0';
48 EXPECT(file->ReadFully(buffer, 13)); // ReadFully returns true.
49 buffer[13] = '\0';
50 EXPECT_STREQ("// Copyright ", buffer);
51 EXPECT(!file->WriteByte(1)); // Cannot write to a read-only file.
52 file->Release();
53}

◆ TEST_CASE() [489/600]

dart::TEST_CASE ( OpenUri_TruncatedUriPercentEncoding  )

Definition at line 191 of file file_test.cc.

191 {
192 const char* kFilename = bin::test::GetFileName("runtime/bin/file_test.cc");
193 char* encoded = reinterpret_cast<char*>(
194 bin::DartUtils::ScopedCString(strlen(kFilename) * 3 + 1));
195 char* t = encoded;
196 // percent-encode all characters 'c'
197 for (const char* p = kFilename; *p != '\0'; p++) {
198 if (*p == 'c') {
199 *t++ = '%';
200 *t++ = 'f';
201 *t++ = 'o';
202 } else {
203 *t++ = *p;
204 }
205 }
206 *(t - 1) = 0; // truncate last uri encoding
207 bin::File* file = bin::File::OpenUri(nullptr, encoded, bin::File::kRead);
208 EXPECT(file == nullptr);
209}

◆ TEST_CASE() [490/600]

dart::TEST_CASE ( OpenUri_UriWithSpaces  )

Definition at line 127 of file file_test.cc.

127 {
128 const char* kRelativeFilename =
129 bin::test::GetFileName("runtime/bin/file_test.cc");
130 const char* strSystemTemp = bin::Directory::SystemTemp(nullptr);
131 EXPECT_NOTNULL(strSystemTemp);
132 const char* kTempDir = Concat(strSystemTemp, "/foo bar");
133 const char* strTempDir = bin::Directory::CreateTemp(nullptr, kTempDir);
134 EXPECT_NOTNULL(strTempDir);
135 const char* kTargetFilename = Concat(strTempDir, "/file test.cc");
136 bool result = bin::File::Copy(nullptr, kRelativeFilename, kTargetFilename);
137 EXPECT(result);
138
139 const char* kAbsoluteFilename =
140 bin::File::GetCanonicalPath(nullptr, kTargetFilename);
141 EXPECT_NOTNULL(kAbsoluteFilename);
142 const char* kFilename = Concat("file:///", kAbsoluteFilename);
143
144 char* encoded = reinterpret_cast<char*>(
145 bin::DartUtils::ScopedCString(strlen(kFilename) * 3 + 1));
146 char* t = encoded;
147 // percent-encode all spaces
148 for (const char* p = kFilename; *p != '\0'; p++) {
149 if (*p == ' ') {
150 *t++ = '%';
151 *t++ = '2';
152 *t++ = '0';
153 } else {
154 *t++ = *p;
155 }
156 }
157 *t = 0;
158 printf("encoded: %s\n", encoded);
159 bin::File* file = bin::File::OpenUri(nullptr, encoded, bin::File::kRead);
160 EXPECT(file != nullptr);
161 char buffer[16];
162 buffer[0] = '\0';
163 EXPECT(file->ReadFully(buffer, 13)); // ReadFully returns true.
164 buffer[13] = '\0';
165 EXPECT_STREQ("// Copyright ", buffer);
166 EXPECT(!file->WriteByte(1)); // Cannot write to a read-only file.
167 file->Release();
168 bin::Directory::Delete(nullptr, strTempDir, /* recursive= */ true);
169}
static const char * Concat(const char *a, const char *b)
Definition file_test.cc:86

◆ TEST_CASE() [491/600]

dart::TEST_CASE ( OpenUri_ValidUri  )

Definition at line 94 of file file_test.cc.

94 {
95 const char* kRelativeFilename =
96 bin::test::GetFileName("runtime/bin/file_test.cc");
97 const char* kAbsoluteFilename =
98 bin::File::GetCanonicalPath(nullptr, kRelativeFilename);
99 EXPECT_NOTNULL(kAbsoluteFilename);
100 const char* kFilename = Concat("file:///", kAbsoluteFilename);
101
102 char* encoded = reinterpret_cast<char*>(
103 bin::DartUtils::ScopedCString(strlen(kFilename) * 3 + 1));
104 char* t = encoded;
105 // percent-encode all characters 'c'
106 for (const char* p = kFilename; *p != '\0'; p++) {
107 if (*p == 'c') {
108 *t++ = '%';
109 *t++ = '6';
110 *t++ = '3';
111 } else {
112 *t++ = *p;
113 }
114 }
115 *t = 0;
116 bin::File* file = bin::File::OpenUri(nullptr, encoded, bin::File::kRead);
117 EXPECT(file != nullptr);
118 char buffer[16];
119 buffer[0] = '\0';
120 EXPECT(file->ReadFully(buffer, 13)); // ReadFully returns true.
121 buffer[13] = '\0';
122 EXPECT_STREQ("// Copyright ", buffer);
123 EXPECT(!file->WriteByte(1)); // Cannot write to a read-only file.
124 file->Release();
125}

◆ TEST_CASE() [492/600]

dart::TEST_CASE ( ParseUri_BrokenEscapeSequence  )

Definition at line 276 of file uri_test.cc.

276 {
277 ParsedUri uri;
278 EXPECT(ParseUri("scheme:/%1g", &uri));
279 EXPECT_STREQ("scheme", uri.scheme);
280 EXPECT(uri.userinfo == nullptr);
281 EXPECT(uri.host == nullptr);
282 EXPECT(uri.port == nullptr);
283 EXPECT_STREQ("/%1g", uri.path); // Broken sequence is unchanged.
284 EXPECT(uri.query == nullptr);
285 EXPECT(uri.fragment == nullptr);
286}

◆ TEST_CASE() [493/600]

dart::TEST_CASE ( ParseUri_LowerCaseScheme  )

Definition at line 215 of file uri_test.cc.

215 {
216 ParsedUri uri;
217 EXPECT(ParseUri("ScHeMe:path", &uri));
218 EXPECT_STREQ("scheme", uri.scheme);
219 EXPECT(uri.userinfo == nullptr);
220 EXPECT(uri.host == nullptr);
221 EXPECT(uri.port == nullptr);
222 EXPECT_STREQ("path", uri.path);
223 EXPECT(uri.query == nullptr);
224 EXPECT(uri.fragment == nullptr);
225}

◆ TEST_CASE() [494/600]

dart::TEST_CASE ( ParseUri_NormalizeEscapes_Authority  )

Definition at line 252 of file uri_test.cc.

252 {
253 ParsedUri uri;
254 EXPECT(ParseUri("scheme://UsEr N%61%4de@h%4FsT.c%6fm:80/", &uri));
255 EXPECT_STREQ("scheme", uri.scheme);
256 EXPECT_STREQ("UsEr%20NaMe", uri.userinfo); // Normalized, case preserved.
257 EXPECT_STREQ("host.com", uri.host); // Normalized, lower-cased.
258 EXPECT_STREQ("80", uri.port);
259 EXPECT_STREQ("/", uri.path);
260 EXPECT(uri.query == nullptr);
261 EXPECT(uri.fragment == nullptr);
262}

◆ TEST_CASE() [495/600]

dart::TEST_CASE ( ParseUri_NormalizeEscapes_PathQueryFragment  )

Definition at line 227 of file uri_test.cc.

227 {
228 ParsedUri uri;
229 EXPECT(ParseUri("scheme:/This%09Is A P%61th?This%09Is A Qu%65ry#A Fr%61gment",
230 &uri));
231 EXPECT_STREQ("scheme", uri.scheme);
232 EXPECT(uri.userinfo == nullptr);
233 EXPECT(uri.host == nullptr);
234 EXPECT(uri.port == nullptr);
235 EXPECT_STREQ("/This%09Is%20A%20Path", uri.path);
236 EXPECT_STREQ("This%09Is%20A%20Query", uri.query);
237 EXPECT_STREQ("A%20Fragment", uri.fragment);
238}

◆ TEST_CASE() [496/600]

dart::TEST_CASE ( ParseUri_NormalizeEscapes_UppercaseEscapeInHost  )

Definition at line 264 of file uri_test.cc.

264 {
265 ParsedUri uri;
266 EXPECT(ParseUri("scheme://tEst%1b/", &uri));
267 EXPECT_STREQ("scheme", uri.scheme);
268 EXPECT(uri.userinfo == nullptr);
269 EXPECT_STREQ("test%1B", uri.host); // Notice that %1B is upper-cased.
270 EXPECT(uri.port == nullptr);
271 EXPECT_STREQ("/", uri.path);
272 EXPECT(uri.query == nullptr);
273 EXPECT(uri.fragment == nullptr);
274}

◆ TEST_CASE() [497/600]

dart::TEST_CASE ( ParseUri_NormalizeEscapes_UppercaseEscapesPreferred  )

Definition at line 240 of file uri_test.cc.

240 {
241 ParsedUri uri;
242 EXPECT(ParseUri("scheme:/%1b%1B", &uri));
243 EXPECT_STREQ("scheme", uri.scheme);
244 EXPECT(uri.userinfo == nullptr);
245 EXPECT(uri.host == nullptr);
246 EXPECT(uri.port == nullptr);
247 EXPECT_STREQ("/%1B%1B", uri.path);
248 EXPECT(uri.query == nullptr);
249 EXPECT(uri.fragment == nullptr);
250}

◆ TEST_CASE() [498/600]

dart::TEST_CASE ( ParseUri_NoScheme_AbsPath_NoAuthority  )

Definition at line 131 of file uri_test.cc.

131 {
132 ParsedUri uri;
133 EXPECT(ParseUri("/over/there", &uri));
134 EXPECT(uri.scheme == nullptr);
135 EXPECT(uri.userinfo == nullptr);
136 EXPECT(uri.host == nullptr);
137 EXPECT(uri.port == nullptr);
138 EXPECT_STREQ("/over/there", uri.path);
139 EXPECT(uri.query == nullptr);
140 EXPECT(uri.fragment == nullptr);
141}

◆ TEST_CASE() [499/600]

dart::TEST_CASE ( ParseUri_NoScheme_AbsPath_StrayColon  )

Definition at line 144 of file uri_test.cc.

144 {
145 ParsedUri uri;
146 EXPECT(ParseUri("/ov:er/there", &uri));
147 EXPECT(uri.scheme == nullptr);
148 EXPECT(uri.userinfo == nullptr);
149 EXPECT(uri.host == nullptr);
150 EXPECT(uri.port == nullptr);
151 EXPECT_STREQ("/ov:er/there", uri.path);
152 EXPECT(uri.query == nullptr);
153}

◆ TEST_CASE() [500/600]

dart::TEST_CASE ( ParseUri_NoScheme_AbsPath_WithAuthority  )

Definition at line 119 of file uri_test.cc.

119 {
120 ParsedUri uri;
121 EXPECT(ParseUri("//example.com:8042/over/there", &uri));
122 EXPECT(uri.scheme == nullptr);
123 EXPECT(uri.userinfo == nullptr);
124 EXPECT_STREQ("example.com", uri.host);
125 EXPECT_STREQ("8042", uri.port);
126 EXPECT_STREQ("/over/there", uri.path);
127 EXPECT(uri.query == nullptr);
128 EXPECT(uri.fragment == nullptr);
129}

◆ TEST_CASE() [501/600]

dart::TEST_CASE ( ParseUri_NoScheme_Empty  )

Definition at line 179 of file uri_test.cc.

179 {
180 ParsedUri uri;
181 EXPECT(ParseUri("", &uri));
182 EXPECT(uri.scheme == nullptr);
183 EXPECT(uri.userinfo == nullptr);
184 EXPECT(uri.host == nullptr);
185 EXPECT(uri.port == nullptr);
186 EXPECT_STREQ("", uri.path);
187 EXPECT(uri.query == nullptr);
188 EXPECT(uri.fragment == nullptr);
189}

◆ TEST_CASE() [502/600]

dart::TEST_CASE ( ParseUri_NoScheme_FragmentOnly  )

Definition at line 203 of file uri_test.cc.

203 {
204 ParsedUri uri;
205 EXPECT(ParseUri("#fragment", &uri));
206 EXPECT(uri.scheme == nullptr);
207 EXPECT(uri.userinfo == nullptr);
208 EXPECT(uri.host == nullptr);
209 EXPECT(uri.port == nullptr);
210 EXPECT_STREQ("", uri.path);
211 EXPECT(uri.query == nullptr);
212 EXPECT_STREQ("fragment", uri.fragment);
213}

◆ TEST_CASE() [503/600]

dart::TEST_CASE ( ParseUri_NoScheme_QueryOnly  )

Definition at line 191 of file uri_test.cc.

191 {
192 ParsedUri uri;
193 EXPECT(ParseUri("?name=ferret", &uri));
194 EXPECT(uri.scheme == nullptr);
195 EXPECT(uri.userinfo == nullptr);
196 EXPECT(uri.host == nullptr);
197 EXPECT(uri.port == nullptr);
198 EXPECT_STREQ("", uri.path);
199 EXPECT_STREQ("name=ferret", uri.query);
200 EXPECT(uri.fragment == nullptr);
201}

◆ TEST_CASE() [504/600]

dart::TEST_CASE ( ParseUri_NoScheme_Rootless1  )

Definition at line 155 of file uri_test.cc.

155 {
156 ParsedUri uri;
157 EXPECT(ParseUri("here", &uri));
158 EXPECT(uri.scheme == nullptr);
159 EXPECT(uri.userinfo == nullptr);
160 EXPECT(uri.host == nullptr);
161 EXPECT(uri.port == nullptr);
162 EXPECT_STREQ("here", uri.path);
163 EXPECT(uri.query == nullptr);
164 EXPECT(uri.fragment == nullptr);
165}

◆ TEST_CASE() [505/600]

dart::TEST_CASE ( ParseUri_NoScheme_Rootless2  )

Definition at line 167 of file uri_test.cc.

167 {
168 ParsedUri uri;
169 EXPECT(ParseUri("or/here", &uri));
170 EXPECT(uri.scheme == nullptr);
171 EXPECT(uri.userinfo == nullptr);
172 EXPECT(uri.host == nullptr);
173 EXPECT(uri.port == nullptr);
174 EXPECT_STREQ("or/here", uri.path);
175 EXPECT(uri.query == nullptr);
176 EXPECT(uri.fragment == nullptr);
177}

◆ TEST_CASE() [506/600]

dart::TEST_CASE ( ParseUri_WithScheme_EmptyPath  )

Definition at line 83 of file uri_test.cc.

83 {
84 ParsedUri uri;
85 EXPECT(ParseUri("foo://example.com:8042", &uri));
86 EXPECT_STREQ("foo", uri.scheme);
87 EXPECT(uri.userinfo == nullptr);
88 EXPECT_STREQ("example.com", uri.host);
89 EXPECT_STREQ("8042", uri.port);
90 EXPECT_STREQ("", uri.path);
91 EXPECT(uri.query == nullptr);
92 EXPECT(uri.fragment == nullptr);
93}

◆ TEST_CASE() [507/600]

dart::TEST_CASE ( ParseUri_WithScheme_NoQueryNoUser  )

Definition at line 10 of file uri_test.cc.

10 {
11 ParsedUri uri;
12 EXPECT(ParseUri("foo://example.com:8042/over/there", &uri));
13 EXPECT_STREQ("foo", uri.scheme);
14 EXPECT(uri.userinfo == nullptr);
15 EXPECT_STREQ("example.com", uri.host);
16 EXPECT_STREQ("8042", uri.port);
17 EXPECT_STREQ("/over/there", uri.path);
18 EXPECT(uri.query == nullptr);
19 EXPECT(uri.fragment == nullptr);
20}

◆ TEST_CASE() [508/600]

dart::TEST_CASE ( ParseUri_WithScheme_Rootless1  )

Definition at line 95 of file uri_test.cc.

95 {
96 ParsedUri uri;
97 EXPECT(ParseUri("foo:here", &uri));
98 EXPECT_STREQ("foo", uri.scheme);
99 EXPECT(uri.userinfo == nullptr);
100 EXPECT(uri.host == nullptr);
101 EXPECT(uri.port == nullptr);
102 EXPECT_STREQ("here", uri.path);
103 EXPECT(uri.query == nullptr);
104 EXPECT(uri.fragment == nullptr);
105}

◆ TEST_CASE() [509/600]

dart::TEST_CASE ( ParseUri_WithScheme_Rootless2  )

Definition at line 107 of file uri_test.cc.

107 {
108 ParsedUri uri;
109 EXPECT(ParseUri("foo:or/here", &uri));
110 EXPECT_STREQ("foo", uri.scheme);
111 EXPECT(uri.userinfo == nullptr);
112 EXPECT(uri.host == nullptr);
113 EXPECT(uri.port == nullptr);
114 EXPECT_STREQ("or/here", uri.path);
115 EXPECT(uri.query == nullptr);
116 EXPECT(uri.fragment == nullptr);
117}

◆ TEST_CASE() [510/600]

dart::TEST_CASE ( ParseUri_WithScheme_ShortPath  )

Definition at line 71 of file uri_test.cc.

71 {
72 ParsedUri uri;
73 EXPECT(ParseUri("foo://example.com:8042/", &uri));
74 EXPECT_STREQ("foo", uri.scheme);
75 EXPECT(uri.userinfo == nullptr);
76 EXPECT_STREQ("example.com", uri.host);
77 EXPECT_STREQ("8042", uri.port);
78 EXPECT_STREQ("/", uri.path);
79 EXPECT(uri.query == nullptr);
80 EXPECT(uri.fragment == nullptr);
81}

◆ TEST_CASE() [511/600]

dart::TEST_CASE ( ParseUri_WithScheme_WithFragment  )

Definition at line 34 of file uri_test.cc.

34 {
35 ParsedUri uri;
36 EXPECT(ParseUri("foo://example.com:8042/over/there#fragment", &uri));
37 EXPECT_STREQ("foo", uri.scheme);
38 EXPECT(uri.userinfo == nullptr);
39 EXPECT_STREQ("example.com", uri.host);
40 EXPECT_STREQ("8042", uri.port);
41 EXPECT_STREQ("/over/there", uri.path);
42 EXPECT(uri.query == nullptr);
43 EXPECT_STREQ("fragment", uri.fragment);
44}

◆ TEST_CASE() [512/600]

dart::TEST_CASE ( ParseUri_WithScheme_WithQuery  )

Definition at line 22 of file uri_test.cc.

22 {
23 ParsedUri uri;
24 EXPECT(ParseUri("foo://example.com:8042/over/there?name=ferret", &uri));
25 EXPECT_STREQ("foo", uri.scheme);
26 EXPECT(uri.userinfo == nullptr);
27 EXPECT_STREQ("example.com", uri.host);
28 EXPECT_STREQ("8042", uri.port);
29 EXPECT_STREQ("/over/there", uri.path);
30 EXPECT_STREQ("name=ferret", uri.query);
31 EXPECT(uri.fragment == nullptr);
32}

◆ TEST_CASE() [513/600]

dart::TEST_CASE ( ParseUri_WithScheme_WithQueryWithFragment  )

Definition at line 46 of file uri_test.cc.

46 {
47 ParsedUri uri;
48 EXPECT(
49 ParseUri("foo://example.com:8042/over/there?name=ferret#fragment", &uri));
50 EXPECT_STREQ("foo", uri.scheme);
51 EXPECT(uri.userinfo == nullptr);
52 EXPECT_STREQ("example.com", uri.host);
53 EXPECT_STREQ("8042", uri.port);
54 EXPECT_STREQ("/over/there", uri.path);
55 EXPECT_STREQ("name=ferret", uri.query);
56 EXPECT_STREQ("fragment", uri.fragment);
57}

◆ TEST_CASE() [514/600]

dart::TEST_CASE ( ParseUri_WithScheme_WithUser  )

Definition at line 59 of file uri_test.cc.

59 {
60 ParsedUri uri;
61 EXPECT(ParseUri("foo://user@example.com:8042/over/there", &uri));
62 EXPECT_STREQ("foo", uri.scheme);
63 EXPECT_STREQ("user", uri.userinfo);
64 EXPECT_STREQ("example.com", uri.host);
65 EXPECT_STREQ("8042", uri.port);
66 EXPECT_STREQ("/over/there", uri.path);
67 EXPECT(uri.query == nullptr);
68 EXPECT(uri.fragment == nullptr);
69}

◆ TEST_CASE() [515/600]

dart::TEST_CASE ( PortMap_ClosePorts  )

Definition at line 54 of file port_test.cc.

54 {
56 Dart_Port port1 = PortMap::CreatePort(&handler);
57 Dart_Port port2 = PortMap::CreatePort(&handler);
58 EXPECT(PortMap::PortExists(port1));
59 EXPECT(PortMap::PortExists(port2));
60
61 // Close all ports at once.
62 PortMap::ClosePorts(&handler);
63 EXPECT(!PortMap::PortExists(port1));
64 EXPECT(!PortMap::PortExists(port2));
65}

◆ TEST_CASE() [516/600]

dart::TEST_CASE ( PortMap_CreateAndCloseOnePort  )

Definition at line 25 of file port_test.cc.

25 {
27 Dart_Port port = PortMap::CreatePort(&handler);
28 EXPECT_NE(0, port);
29 EXPECT(PortMap::PortExists(port));
30
31 PortMap::ClosePort(port);
32 EXPECT(!PortMap::PortExists(port));
33}

◆ TEST_CASE() [517/600]

dart::TEST_CASE ( PortMap_CreateAndCloseTwoPorts  )

Definition at line 35 of file port_test.cc.

35 {
37 Dart_Port port1 = PortMap::CreatePort(&handler);
38 Dart_Port port2 = PortMap::CreatePort(&handler);
39 EXPECT(PortMap::PortExists(port1));
40 EXPECT(PortMap::PortExists(port2));
41
42 // Uniqueness.
43 EXPECT_NE(port1, port2);
44
45 PortMap::ClosePort(port1);
46 EXPECT(!PortMap::PortExists(port1));
47 EXPECT(PortMap::PortExists(port2));
48
49 PortMap::ClosePort(port2);
50 EXPECT(!PortMap::PortExists(port1));
51 EXPECT(!PortMap::PortExists(port2));
52}

◆ TEST_CASE() [518/600]

dart::TEST_CASE ( PortMap_CreateManyPorts  )

Definition at line 67 of file port_test.cc.

67 {
69 for (int i = 0; i < 32; i++) {
70 Dart_Port port = PortMap::CreatePort(&handler);
71 EXPECT(PortMap::PortExists(port));
72 PortMap::ClosePort(port);
73 EXPECT(!PortMap::PortExists(port));
74 }
75}

◆ TEST_CASE() [519/600]

dart::TEST_CASE ( PortMap_PostIntegerMessage  )

Definition at line 94 of file port_test.cc.

94 {
96 Dart_Port port = PortMap::CreatePort(&handler);
97 EXPECT_EQ(0, handler.notify_count);
98
99 EXPECT(PortMap::PostMessage(
100 Message::New(port, Smi::New(42), Message::kNormalPriority)));
101
102 // Check that the message notify callback was called.
103 EXPECT_EQ(1, handler.notify_count);
104 PortMap::ClosePorts(&handler);
105}

◆ TEST_CASE() [520/600]

dart::TEST_CASE ( PortMap_PostMessage  )

Definition at line 77 of file port_test.cc.

77 {
79 Dart_Port port = PortMap::CreatePort(&handler);
80 EXPECT_EQ(0, handler.notify_count);
81
82 const char* message = "msg";
83 intptr_t message_len = strlen(message) + 1;
84
85 EXPECT(PortMap::PostMessage(
86 Message::New(port, reinterpret_cast<uint8_t*>(Utils::StrDup(message)),
87 message_len, nullptr, Message::kNormalPriority)));
88
89 // Check that the message notify callback was called.
90 EXPECT_EQ(1, handler.notify_count);
91 PortMap::ClosePorts(&handler);
92}

◆ TEST_CASE() [521/600]

dart::TEST_CASE ( PortMap_PostMessageClosedPort  )

Definition at line 120 of file port_test.cc.

120 {
121 // Create a port id and make it invalid.
123 Dart_Port port = PortMap::CreatePort(&handler);
124 PortMap::ClosePort(port);
125
126 const char* message = "msg";
127 intptr_t message_len = strlen(message) + 1;
128
129 EXPECT(!PortMap::PostMessage(
130 Message::New(port, reinterpret_cast<uint8_t*>(Utils::StrDup(message)),
131 message_len, nullptr, Message::kNormalPriority)));
132}

◆ TEST_CASE() [522/600]

dart::TEST_CASE ( PortMap_PostNullMessage  )

Definition at line 107 of file port_test.cc.

107 {
109 Dart_Port port = PortMap::CreatePort(&handler);
110 EXPECT_EQ(0, handler.notify_count);
111
112 EXPECT(PortMap::PostMessage(
113 Message::New(port, Object::null(), Message::kNormalPriority)));
114
115 // Check that the message notify callback was called.
116 EXPECT_EQ(1, handler.notify_count);
117 PortMap::ClosePorts(&handler);
118}

◆ TEST_CASE() [523/600]

dart::TEST_CASE ( PrintToString  )

Definition at line 185 of file zone_test.cc.

185 {
186 TransitionNativeToVM transition(Thread::Current());
187 StackZone zone(Thread::Current());
188 const char* result = zone.GetZone()->PrintToString("Hello %s!", "World");
189 EXPECT_STREQ("Hello World!", result);
190}

◆ TEST_CASE() [524/600]

dart::TEST_CASE ( Profiler_AllocationSampleTest  )

Definition at line 198 of file profiler_test.cc.

198 {
199 Isolate* isolate = Isolate::Current();
200 SampleBlockBuffer* sample_buffer = new SampleBlockBuffer(1, 1);
201 Sample* sample = sample_buffer->ReserveAllocationSample(isolate);
202 sample->Init(isolate->main_port(), 0, 0);
203 sample->set_metadata(99);
204 sample->set_is_allocation_sample(true);
205 EXPECT_EQ(99, sample->allocation_cid());
206 isolate->set_current_allocation_sample_block(nullptr);
207 delete sample_buffer;
208}
Sample * ReserveAllocationSample(Isolate *isolate)
Definition profiler.cc:815
void set_is_allocation_sample(bool allocation_sample)
Definition profiler.h:310
intptr_t allocation_cid() const
Definition profiler.h:341
void set_metadata(intptr_t metadata)
Definition profiler.h:353

◆ TEST_CASE() [525/600]

dart::TEST_CASE ( Profiler_SampleBufferIterateTest  )

Definition at line 154 of file profiler_test.cc.

154 {
155 Isolate* isolate = Isolate::Current();
156
158 SampleBlockBuffer* sample_buffer = Profiler::sample_block_buffer();
159
160 Dart_Port i = 123;
162
163 sample_buffer->VisitSamples(&visitor);
164 EXPECT_EQ(0, visitor.visited());
165 Sample* s;
166 s = sample_buffer->ReserveCPUSample(isolate);
167 EXPECT_NOTNULL(s);
168 s->Init(i, kValidTimeStamp, 0);
169 s->SetAt(0, kValidPc);
170 VisitSamples(sample_buffer, &visitor);
171 EXPECT_EQ(1, visitor.visited());
172
173 s = sample_buffer->ReserveCPUSample(isolate);
174 EXPECT_NOTNULL(s);
175 s->Init(i, kValidTimeStamp, 0);
176 s->SetAt(0, kValidPc);
177 VisitSamples(sample_buffer, &visitor);
178 EXPECT_EQ(2, visitor.visited());
179
180 s = sample_buffer->ReserveCPUSample(isolate);
181 EXPECT_NOTNULL(s);
182 s->Init(i, kValidTimeStamp, 0);
183 s->SetAt(0, kValidPc);
184 VisitSamples(sample_buffer, &visitor);
185 EXPECT_EQ(3, visitor.visited());
186
187 s = sample_buffer->ReserveCPUSample(isolate);
188 EXPECT_NOTNULL(s);
189 s->Init(i, kValidTimeStamp, 0);
190 s->SetAt(0, kValidPc);
191 VisitSamples(sample_buffer, &visitor);
192 EXPECT_EQ(3, visitor.visited());
193
194 // The overridden sample buffer will be freed before isolate shutdown.
195 isolate->set_current_sample_block(nullptr);
196}
Sample * ReserveCPUSample(Isolate *isolate)
Definition profiler.cc:811
static void VisitSamples(SampleBlockBuffer *buffer, SampleVisitor *visitor)

◆ TEST_CASE() [526/600]

dart::TEST_CASE ( Profiler_SampleBufferWrapTest  )

Definition at line 106 of file profiler_test.cc.

106 {
107 Isolate* isolate = Isolate::Current();
108
110 SampleBlockBuffer* sample_buffer = Profiler::sample_block_buffer();
111
112 Dart_Port i = 123;
114
115 VisitSamples(sample_buffer, &visitor);
116 EXPECT_EQ(0, visitor.sum());
117 Sample* s;
118
119 s = sample_buffer->ReserveCPUSample(isolate);
120 EXPECT_NOTNULL(s);
121 s->Init(i, kValidTimeStamp, 0);
122 s->SetAt(0, 2);
123 VisitSamples(sample_buffer, &visitor);
124 EXPECT_EQ(2, visitor.sum());
125
126 s = sample_buffer->ReserveCPUSample(isolate);
127 EXPECT_NOTNULL(s);
128 s->Init(i, kValidTimeStamp, 0);
129 s->SetAt(0, 4);
130 VisitSamples(sample_buffer, &visitor);
131 EXPECT_EQ(6, visitor.sum());
132
133 s = sample_buffer->ReserveCPUSample(isolate);
134 EXPECT_NOTNULL(s);
135 s->Init(i, kValidTimeStamp, 0);
136 s->SetAt(0, 6);
137 VisitSamples(sample_buffer, &visitor);
138 EXPECT_EQ(12, visitor.sum());
139
140 // Mark the completed blocks as free so they can be re-used.
141 sample_buffer->FreeCompletedBlocks();
142
143 s = sample_buffer->ReserveCPUSample(isolate);
144 EXPECT_NOTNULL(s);
145 s->Init(i, kValidTimeStamp, 0);
146 s->SetAt(0, 8);
147 VisitSamples(sample_buffer, &visitor);
148 EXPECT_EQ(18, visitor.sum());
149
150 // The overridden sample buffer will be freed before isolate shutdown.
151 isolate->set_current_sample_block(nullptr);
152}

◆ TEST_CASE() [527/600]

dart::TEST_CASE ( RangeAdd  )

Definition at line 263 of file range_analysis_test.cc.

263 {
264#define TEST_RANGE_ADD(l_min, l_max, r_min, r_max, result_min, result_max) \
265 { \
266 RangeBoundary min, max; \
267 Range* left_range = new Range(RangeBoundary::FromConstant(l_min), \
268 RangeBoundary::FromConstant(l_max)); \
269 Range* right_range = new Range(RangeBoundary::FromConstant(r_min), \
270 RangeBoundary::FromConstant(r_max)); \
271 EXPECT(left_range->min().ConstantValue() == l_min); \
272 EXPECT(left_range->max().ConstantValue() == l_max); \
273 EXPECT(right_range->min().ConstantValue() == r_min); \
274 EXPECT(right_range->max().ConstantValue() == r_max); \
275 Range::Add(left_range, right_range, &min, &max, nullptr); \
276 EXPECT(min.Equals(result_min)); \
277 if (FLAG_support_il_printer && !min.Equals(result_min)) { \
278 OS::PrintErr("%s != %s\n", min.ToCString(), result_min.ToCString()); \
279 } \
280 EXPECT(max.Equals(result_max)); \
281 if (FLAG_support_il_printer && !max.Equals(result_max)) { \
282 OS::PrintErr("%s != %s\n", max.ToCString(), result_max.ToCString()); \
283 } \
284 }
285
286 // [kMaxInt32, kMaxInt32 + 15] + [10, 20] = [kMaxInt32 + 10, kMaxInt32 + 35].
287 TEST_RANGE_ADD(static_cast<int64_t>(kMaxInt32),
288 static_cast<int64_t>(kMaxInt32) + 15, static_cast<int64_t>(10),
289 static_cast<int64_t>(20),
290 RangeBoundary(static_cast<int64_t>(kMaxInt32) + 10),
291 RangeBoundary(static_cast<int64_t>(kMaxInt32) + 35));
292
293 // [kMaxInt32 - 15, kMaxInt32 + 15] + [15, -15] = [kMaxInt32, kMaxInt32].
294 TEST_RANGE_ADD(static_cast<int64_t>(kMaxInt32) - 15,
295 static_cast<int64_t>(kMaxInt32) + 15, static_cast<int64_t>(15),
296 static_cast<int64_t>(-15),
297 RangeBoundary(static_cast<int64_t>(kMaxInt32)),
298 RangeBoundary(static_cast<int64_t>(kMaxInt32)));
299
300 // [kMaxInt32, kMaxInt32 + 15] + [10, kMaxInt64] = [kMinInt64, kMaxInt64].
301 TEST_RANGE_ADD(static_cast<int64_t>(kMaxInt32),
302 static_cast<int64_t>(kMaxInt32) + 15, static_cast<int64_t>(10),
303 static_cast<int64_t>(kMaxInt64), RangeBoundary(kMinInt64),
304 RangeBoundary(kMaxInt64));
305
306 // [kMinInt64, kMaxInt32 + 15] + [10, 20] = [kMinInt64 + 10, kMaxInt32 + 35].
307 TEST_RANGE_ADD(static_cast<int64_t>(kMinInt64),
308 static_cast<int64_t>(kMaxInt32) + 15, static_cast<int64_t>(10),
309 static_cast<int64_t>(20),
310 RangeBoundary(static_cast<int64_t>(kMinInt64) + 10),
311 RangeBoundary(static_cast<int64_t>(kMaxInt32) + 35));
312
313 // [0, 0] + [kMinInt64, kMaxInt64] = [kMinInt64, kMaxInt64].
314 TEST_RANGE_ADD(static_cast<int64_t>(0), static_cast<int64_t>(0),
315 static_cast<int64_t>(kMinInt64),
316 static_cast<int64_t>(kMaxInt64), RangeBoundary(kMinInt64),
317 RangeBoundary(kMaxInt64));
318
319 // Overflows.
320
321 // [-1, 1] + [kMinInt64, kMaxInt64] = [kMinInt64, kMaxInt64].
322 TEST_RANGE_ADD(static_cast<int64_t>(-1), static_cast<int64_t>(1),
323 static_cast<int64_t>(kMinInt64),
324 static_cast<int64_t>(kMaxInt64), RangeBoundary(kMinInt64),
325 RangeBoundary(kMaxInt64));
326
327 // [kMaxInt64, kMaxInt64] + [kMaxInt64, kMaxInt64] = [kMinInt64, kMaxInt64].
329 static_cast<int64_t>(kMaxInt64), static_cast<int64_t>(kMaxInt64),
330 static_cast<int64_t>(kMaxInt64), static_cast<int64_t>(kMaxInt64),
331 RangeBoundary(kMinInt64), RangeBoundary(kMaxInt64));
332
333 // [kMaxInt64, kMaxInt64] + [1, 1] = [kMinInt64, kMaxInt64].
334 TEST_RANGE_ADD(static_cast<int64_t>(kMaxInt64),
335 static_cast<int64_t>(kMaxInt64), static_cast<int64_t>(1),
336 static_cast<int64_t>(1), RangeBoundary(kMinInt64),
337 RangeBoundary(kMaxInt64));
338
339#undef TEST_RANGE_ADD
340}
#define TEST_RANGE_ADD(l_min, l_max, r_min, r_max, result_min, result_max)

◆ TEST_CASE() [528/600]

dart::TEST_CASE ( RangeAnd  )

Definition at line 395 of file range_analysis_test.cc.

395 {
396#define TEST_RANGE_AND(l_min, l_max, r_min, r_max, result_min, result_max) \
397 { \
398 RangeBoundary min, max; \
399 Range* left_range = new Range(RangeBoundary::FromConstant(l_min), \
400 RangeBoundary::FromConstant(l_max)); \
401 Range* right_range = new Range(RangeBoundary::FromConstant(r_min), \
402 RangeBoundary::FromConstant(r_max)); \
403 EXPECT(left_range->min().ConstantValue() == l_min); \
404 EXPECT(left_range->max().ConstantValue() == l_max); \
405 EXPECT(right_range->min().ConstantValue() == r_min); \
406 EXPECT(right_range->max().ConstantValue() == r_max); \
407 Range::And(left_range, right_range, &min, &max); \
408 EXPECT(min.Equals(result_min)); \
409 if (FLAG_support_il_printer && !min.Equals(result_min)) { \
410 OS::PrintErr("%s != %s\n", min.ToCString(), result_min.ToCString()); \
411 } \
412 EXPECT(max.Equals(result_max)); \
413 if (FLAG_support_il_printer && !max.Equals(result_max)) { \
414 OS::PrintErr("%s != %s\n", max.ToCString(), result_max.ToCString()); \
415 } \
416 }
417
418 // [0xff, 0xfff] & [0xf, 0xf] = [0x0, 0xf].
419 TEST_RANGE_AND(static_cast<int64_t>(0xff), static_cast<int64_t>(0xfff),
420 static_cast<int64_t>(0xf), static_cast<int64_t>(0xf),
421 RangeBoundary::FromConstant(0), RangeBoundary(0xf));
422
423 // [0xffffffff, 0xffffffff] & [0xfffffffff, 0xfffffffff] = [0x0, 0xfffffffff].
425 static_cast<int64_t>(0xffffffff), static_cast<int64_t>(0xffffffff),
426 static_cast<int64_t>(0xfffffffff), static_cast<int64_t>(0xfffffffff),
427 RangeBoundary::FromConstant(0),
428 RangeBoundary(static_cast<int64_t>(0xfffffffff)));
429
430 // [0xffffffff, 0xffffffff] & [-20, 20] = [0x0, 0xffffffff].
431 TEST_RANGE_AND(static_cast<int64_t>(0xffffffff),
432 static_cast<int64_t>(0xffffffff), static_cast<int64_t>(-20),
433 static_cast<int64_t>(20), RangeBoundary::FromConstant(0),
434 RangeBoundary(static_cast<int64_t>(0xffffffff)));
435
436 // [-20, 20] & [0xffffffff, 0xffffffff] = [0x0, 0xffffffff].
437 TEST_RANGE_AND(static_cast<int64_t>(-20), static_cast<int64_t>(20),
438 static_cast<int64_t>(0xffffffff),
439 static_cast<int64_t>(0xffffffff),
440 RangeBoundary::FromConstant(0),
441 RangeBoundary(static_cast<int64_t>(0xffffffff)));
442
443 // Test that [-20, 20] & [-20, 20] = [-32, 31].
444 TEST_RANGE_AND(static_cast<int64_t>(-20), static_cast<int64_t>(20),
445 static_cast<int64_t>(-20), static_cast<int64_t>(20),
446 RangeBoundary(-32), RangeBoundary(31));
447
448#undef TEST_RANGE_AND
449}
#define TEST_RANGE_AND(l_min, l_max, r_min, r_max, result_min, result_max)

◆ TEST_CASE() [529/600]

dart::TEST_CASE ( RangeBinaryOp  )

Definition at line 210 of file range_analysis_test.cc.

210 {
211 Range* range_a = new Range(RangeBoundary::FromConstant(-1),
212 RangeBoundary::FromConstant(RangeBoundary::kMax));
213 range_a->Clamp(RangeBoundary::kRangeBoundaryInt32);
214 EXPECT(range_a->min().ConstantValue() == -1);
215 EXPECT(range_a->max().ConstantValue() == kMaxInt32);
216 range_a->set_max(RangeBoundary::FromConstant(RangeBoundary::kMax));
217
218 Range* range_b = new Range(RangeBoundary::FromConstant(RangeBoundary::kMin),
219 RangeBoundary::FromConstant(1));
220 range_b->Clamp(RangeBoundary::kRangeBoundaryInt32);
221 EXPECT(range_b->min().ConstantValue() == kMinInt32);
222 EXPECT(range_b->max().ConstantValue() == 1);
223 range_b->set_min(RangeBoundary::FromConstant(RangeBoundary::kMin));
224
225 {
227 Range::BinaryOp(Token::kADD, range_a, range_b, nullptr, &result);
228 ASSERT(!Range::IsUnknown(&result));
229 EXPECT(result.min().Equals(
230 RangeBoundary::MinConstant(RangeBoundary::kRangeBoundaryInt64)));
231 EXPECT(result.max().Equals(
232 RangeBoundary::MaxConstant(RangeBoundary::kRangeBoundaryInt64)));
233 }
234
235 // Test that [5, 10] + [0, 5] = [5, 15].
236 Range* range_c = new Range(RangeBoundary::FromConstant(5),
237 RangeBoundary::FromConstant(10));
238 Range* range_d =
239 new Range(RangeBoundary::FromConstant(0), RangeBoundary::FromConstant(5));
240
241 {
242 Range result;
243 Range::BinaryOp(Token::kADD, range_c, range_d, nullptr, &result);
244 ASSERT(!Range::IsUnknown(&result));
245 EXPECT(result.min().ConstantValue() == 5);
246 EXPECT(result.max().ConstantValue() == 15);
247 }
248
249 // Test that [0xff, 0xfff] & [0xf, 0xf] = [0x0, 0xf].
250 Range* range_e = new Range(RangeBoundary::FromConstant(0xff),
251 RangeBoundary::FromConstant(0xfff));
252 Range* range_f = new Range(RangeBoundary::FromConstant(0xf),
253 RangeBoundary::FromConstant(0xf));
254 {
255 Range result;
256 Range::BinaryOp(Token::kBIT_AND, range_e, range_f, nullptr, &result);
257 ASSERT(!Range::IsUnknown(&result));
258 EXPECT(result.min().ConstantValue() == 0x0);
259 EXPECT(result.max().ConstantValue() == 0xf);
260 }
261}
void Clamp(RangeBoundary::RangeSize size)

◆ TEST_CASE() [530/600]

dart::TEST_CASE ( RangeIntersectionMinMax  )

Definition at line 451 of file range_analysis_test.cc.

451 {
452 // Test IntersectionMin and IntersectionMax methods which for constants are
453 // simply defined as Max/Min respectively.
454
455 // Constants.
456 // MIN(0, 1) == 0
457 EXPECT(RangeBoundary::IntersectionMax(RangeBoundary::FromConstant(0),
458 RangeBoundary::FromConstant(1))
459 .ConstantValue() == 0);
460 // MIN(0, -1) == -1
461 EXPECT(RangeBoundary::IntersectionMax(RangeBoundary::FromConstant(0),
462 RangeBoundary::FromConstant(-1))
463 .ConstantValue() == -1);
464
465 // MIN(1, 0) == 0
466 EXPECT(RangeBoundary::IntersectionMax(RangeBoundary::FromConstant(1),
467 RangeBoundary::FromConstant(0))
468 .ConstantValue() == 0);
469 // MIN(-1, 0) == -1
470 EXPECT(RangeBoundary::IntersectionMax(RangeBoundary::FromConstant(-1),
471 RangeBoundary::FromConstant(0))
472 .ConstantValue() == -1);
473
474 // MAX(0, 1) == 1
475 EXPECT(RangeBoundary::IntersectionMin(RangeBoundary::FromConstant(0),
476 RangeBoundary::FromConstant(1))
477 .ConstantValue() == 1);
478
479 // MAX(0, -1) == 0
480 EXPECT(RangeBoundary::IntersectionMin(RangeBoundary::FromConstant(0),
481 RangeBoundary::FromConstant(-1))
482 .ConstantValue() == 0);
483
484 // MAX(1, 0) == 1
485 EXPECT(RangeBoundary::IntersectionMin(RangeBoundary::FromConstant(1),
486 RangeBoundary::FromConstant(0))
487 .ConstantValue() == 1);
488 // MAX(-1, 0) == 0
489 EXPECT(RangeBoundary::IntersectionMin(RangeBoundary::FromConstant(-1),
490 RangeBoundary::FromConstant(0))
491 .ConstantValue() == 0);
492
493 // Constants vs. kMinInt64 / kMaxInt64.
494 EXPECT(RangeBoundary::IntersectionMin(RangeBoundary(kMinInt64),
495 RangeBoundary::FromConstant(-1))
496 .ConstantValue() == -1);
497
498 EXPECT(RangeBoundary::IntersectionMin(RangeBoundary::FromConstant(-1),
499 RangeBoundary(kMinInt64))
500 .ConstantValue() == -1);
501
502 EXPECT(RangeBoundary::IntersectionMin(RangeBoundary::FromConstant(1),
503 RangeBoundary(kMinInt64))
504 .ConstantValue() == 1);
505
506 EXPECT(RangeBoundary::IntersectionMin(RangeBoundary(kMinInt64),
507 RangeBoundary::FromConstant(1))
508 .ConstantValue() == 1);
509
510 EXPECT(RangeBoundary::IntersectionMax(RangeBoundary(kMaxInt64),
511 RangeBoundary::FromConstant(-1))
512 .ConstantValue() == -1);
513
514 EXPECT(RangeBoundary::IntersectionMax(RangeBoundary::FromConstant(-1),
515 RangeBoundary(kMaxInt64))
516 .ConstantValue() == -1);
517
518 EXPECT(RangeBoundary::IntersectionMax(RangeBoundary::FromConstant(1),
519 RangeBoundary(kMaxInt64))
520 .ConstantValue() == 1);
521
522 EXPECT(RangeBoundary::IntersectionMax(RangeBoundary(kMaxInt64),
523 RangeBoundary::FromConstant(1))
524 .ConstantValue() == 1);
525}

◆ TEST_CASE() [531/600]

dart::TEST_CASE ( RangeJoinMinMax  )

Definition at line 527 of file range_analysis_test.cc.

527 {
528 // Test IntersectionMin and IntersectionMax methods which for constants are
529 // simply defined as Min/Max respectively.
530 const RangeBoundary::RangeSize size = RangeBoundary::kRangeBoundarySmi;
531
532 // Constants.
533 EXPECT(RangeBoundary::JoinMax(RangeBoundary::FromConstant(0),
534 RangeBoundary::FromConstant(1), size)
535 .ConstantValue() == 1);
536 EXPECT(RangeBoundary::JoinMax(RangeBoundary::FromConstant(0),
537 RangeBoundary::FromConstant(-1), size)
538 .ConstantValue() == 0);
539 EXPECT(RangeBoundary::JoinMax(RangeBoundary::FromConstant(1),
540 RangeBoundary::FromConstant(0), size)
541 .ConstantValue() == 1);
542 EXPECT(RangeBoundary::JoinMax(RangeBoundary::FromConstant(-1),
543 RangeBoundary::FromConstant(0), size)
544 .ConstantValue() == 0);
545 EXPECT(RangeBoundary::JoinMin(RangeBoundary::FromConstant(0),
546 RangeBoundary::FromConstant(1), size)
547 .ConstantValue() == 0);
548 EXPECT(RangeBoundary::JoinMin(RangeBoundary::FromConstant(0),
549 RangeBoundary::FromConstant(-1), size)
550 .ConstantValue() == -1);
551 EXPECT(RangeBoundary::JoinMin(RangeBoundary::FromConstant(1),
552 RangeBoundary::FromConstant(0), size)
553 .ConstantValue() == 0);
554 EXPECT(RangeBoundary::JoinMin(RangeBoundary::FromConstant(-1),
555 RangeBoundary::FromConstant(0), size)
556 .ConstantValue() == -1);
557
558 // Constants vs. kMinInt64 / kMaxInt64.
559 EXPECT(RangeBoundary::JoinMin(RangeBoundary(kMinInt64),
560 RangeBoundary::FromConstant(-1), size)
561 .IsMinimumOrBelow(size));
562
563 EXPECT(RangeBoundary::JoinMin(RangeBoundary::FromConstant(-1),
564 RangeBoundary(kMinInt64), size)
565 .IsMinimumOrBelow(size));
566
567 EXPECT(RangeBoundary::JoinMin(RangeBoundary::FromConstant(1),
568 RangeBoundary(kMinInt64), size)
569 .IsMinimumOrBelow(size));
570
571 EXPECT(RangeBoundary::JoinMin(RangeBoundary(kMinInt64),
572 RangeBoundary::FromConstant(1), size)
573 .IsMinimumOrBelow(size));
574
575 EXPECT(RangeBoundary::JoinMax(RangeBoundary(kMaxInt64),
576 RangeBoundary::FromConstant(-1), size)
577 .IsMaximumOrAbove(size));
578
579 EXPECT(RangeBoundary::JoinMax(RangeBoundary::FromConstant(-1),
580 RangeBoundary(kMaxInt64), size)
581 .IsMaximumOrAbove(size));
582
583 EXPECT(RangeBoundary::JoinMax(RangeBoundary::FromConstant(1),
584 RangeBoundary(kMaxInt64), size)
585 .IsMaximumOrAbove(size));
586
587 EXPECT(RangeBoundary::JoinMax(RangeBoundary(kMaxInt64),
588 RangeBoundary::FromConstant(1), size)
589 .IsMaximumOrAbove(size));
590}

◆ TEST_CASE() [532/600]

dart::TEST_CASE ( RangeSub  )

Definition at line 342 of file range_analysis_test.cc.

342 {
343#define TEST_RANGE_SUB(l_min, l_max, r_min, r_max, result_min, result_max) \
344 { \
345 RangeBoundary min, max; \
346 Range* left_range = new Range(RangeBoundary::FromConstant(l_min), \
347 RangeBoundary::FromConstant(l_max)); \
348 Range* right_range = new Range(RangeBoundary::FromConstant(r_min), \
349 RangeBoundary::FromConstant(r_max)); \
350 EXPECT(left_range->min().ConstantValue() == l_min); \
351 EXPECT(left_range->max().ConstantValue() == l_max); \
352 EXPECT(right_range->min().ConstantValue() == r_min); \
353 EXPECT(right_range->max().ConstantValue() == r_max); \
354 Range::Sub(left_range, right_range, &min, &max, nullptr); \
355 EXPECT(min.Equals(result_min)); \
356 if (FLAG_support_il_printer && !min.Equals(result_min)) { \
357 OS::PrintErr("%s != %s\n", min.ToCString(), result_min.ToCString()); \
358 } \
359 EXPECT(max.Equals(result_max)); \
360 if (FLAG_support_il_printer && !max.Equals(result_max)) { \
361 OS::PrintErr("%s != %s\n", max.ToCString(), result_max.ToCString()); \
362 } \
363 }
364
365 // [kMaxInt32, kMaxInt32 + 15] - [10, 20] = [kMaxInt32 - 20, kMaxInt32 + 5].
366 TEST_RANGE_SUB(static_cast<int64_t>(kMaxInt32),
367 static_cast<int64_t>(kMaxInt32) + 15, static_cast<int64_t>(10),
368 static_cast<int64_t>(20),
369 RangeBoundary(static_cast<int64_t>(kMaxInt32) - 20),
370 RangeBoundary(static_cast<int64_t>(kMaxInt32) + 5));
371
372 // [kMintInt64, kMintInt64] - [1, 1] = [kMinInt64, kMaxInt64].
373 TEST_RANGE_SUB(static_cast<int64_t>(kMinInt64),
374 static_cast<int64_t>(kMinInt64), static_cast<int64_t>(1),
375 static_cast<int64_t>(1), RangeBoundary(kMinInt64),
376 RangeBoundary(kMaxInt64));
377
378 // [1, 1] - [kMintInt64, kMintInt64] = [kMinInt64, kMaxInt64].
379 TEST_RANGE_SUB(static_cast<int64_t>(1), static_cast<int64_t>(1),
380 static_cast<int64_t>(kMinInt64),
381 static_cast<int64_t>(kMinInt64), RangeBoundary(kMinInt64),
382 RangeBoundary(kMaxInt64));
383
384 // [kMaxInt32 + 10, kMaxInt32 + 20] - [-20, -20] =
385 // [kMaxInt32 + 30, kMaxInt32 + 40].
386 TEST_RANGE_SUB(static_cast<int64_t>(kMaxInt32) + 10,
387 static_cast<int64_t>(kMaxInt32) + 20,
388 static_cast<int64_t>(-20), static_cast<int64_t>(-20),
389 RangeBoundary(static_cast<int64_t>(kMaxInt32) + 30),
390 RangeBoundary(static_cast<int64_t>(kMaxInt32) + 40));
391
392#undef TEST_RANGE_SUB
393}
#define TEST_RANGE_SUB(l_min, l_max, r_min, r_max, result_min, result_max)

◆ TEST_CASE() [533/600]

dart::TEST_CASE ( RangeTests  )

Definition at line 11 of file range_analysis_test.cc.

11 {
12 Range* zero =
13 new Range(RangeBoundary::FromConstant(0), RangeBoundary::FromConstant(0));
14 Range* positive = new Range(RangeBoundary::FromConstant(0),
15 RangeBoundary::FromConstant(100));
16 Range* negative = new Range(RangeBoundary::FromConstant(-1),
17 RangeBoundary::FromConstant(-100));
18 Range* range_x = new Range(RangeBoundary::FromConstant(-15),
19 RangeBoundary::FromConstant(100));
20 EXPECT(positive->IsPositive());
21 EXPECT(zero->Overlaps(0, 0));
22 EXPECT(positive->Overlaps(0, 0));
23 EXPECT(!negative->Overlaps(0, 0));
24 EXPECT(range_x->Overlaps(0, 0));
25 EXPECT(range_x->IsWithin(-15, 100));
26 EXPECT(!range_x->IsWithin(-15, 99));
27 EXPECT(!range_x->IsWithin(-14, 100));
28
29#define TEST_RANGE_OP_(Op, l_min, l_max, r_min, r_max, Clamp, res_min, \
30 res_max) \
31 { \
32 RangeBoundary min, max; \
33 Range* left_range = new Range(RangeBoundary::FromConstant(l_min), \
34 RangeBoundary::FromConstant(l_max)); \
35 Range* shift_range = new Range(RangeBoundary::FromConstant(r_min), \
36 RangeBoundary::FromConstant(r_max)); \
37 Op(left_range, shift_range, &min, &max); \
38 min = Clamp(min); \
39 max = Clamp(max); \
40 EXPECT(min.Equals(res_min)); \
41 if (FLAG_support_il_printer && !min.Equals(res_min)) { \
42 OS::PrintErr("%s\n", min.ToCString()); \
43 } \
44 EXPECT(max.Equals(res_max)); \
45 if (FLAG_support_il_printer && !max.Equals(res_max)) { \
46 OS::PrintErr("%s\n", max.ToCString()); \
47 } \
48 }
49
50#define NO_CLAMP(b) (b)
51#define TEST_RANGE_OP(Op, l_min, l_max, r_min, r_max, result_min, result_max) \
52 TEST_RANGE_OP_(Op, l_min, l_max, r_min, r_max, NO_CLAMP, result_min, \
53 result_max)
54
55#define CLAMP_TO_SMI(b) (b.Clamp(RangeBoundary::kRangeBoundarySmi))
56#define TEST_RANGE_OP_SMI(Op, l_min, l_max, r_min, r_max, res_min, res_max) \
57 TEST_RANGE_OP_(Op, l_min, l_max, r_min, r_max, CLAMP_TO_SMI, res_min, res_max)
58
59 TEST_RANGE_OP(Range::Shl, -15, 100, 0, 2, RangeBoundary(-60),
60 RangeBoundary(400));
61 TEST_RANGE_OP(Range::Shl, -15, 100, -2, 2, RangeBoundary(-60),
62 RangeBoundary(400));
63 TEST_RANGE_OP(Range::Shl, -15, -10, 1, 2, RangeBoundary(-60),
64 RangeBoundary(-20));
65 TEST_RANGE_OP(Range::Shl, 5, 10, -2, 2, RangeBoundary(5), RangeBoundary(40));
66 TEST_RANGE_OP(Range::Shl, -15, 100, 0, 64, RangeBoundary(kMinInt64),
67 RangeBoundary(kMaxInt64));
68 TEST_RANGE_OP(Range::Shl, -1, 1, 63, 63, RangeBoundary(kMinInt64),
69 RangeBoundary(kMaxInt64));
70 if (compiler::target::kSmiBits == 62) {
71 TEST_RANGE_OP_SMI(Range::Shl, -1, 1, 62, 62,
72 RangeBoundary(compiler::target::kSmiMin),
73 RangeBoundary(compiler::target::kSmiMax));
74 TEST_RANGE_OP_SMI(Range::Shl, -1, 1, 30, 30, RangeBoundary(-(1 << 30)),
75 RangeBoundary(1 << 30));
76 } else {
77 ASSERT(compiler::target::kSmiBits == 30);
78 TEST_RANGE_OP_SMI(Range::Shl, -1, 1, 30, 30,
79 RangeBoundary(compiler::target::kSmiMin),
80 RangeBoundary(compiler::target::kSmiMax));
81 TEST_RANGE_OP_SMI(Range::Shl, -1, 1, 62, 62,
82 RangeBoundary(compiler::target::kSmiMin),
83 RangeBoundary(compiler::target::kSmiMax));
84 }
85 TEST_RANGE_OP(Range::Shl, 0, 100, 0, 64, RangeBoundary(kMinInt64),
86 RangeBoundary(kMaxInt64));
87 TEST_RANGE_OP(Range::Shl, -100, 0, 0, 64, RangeBoundary(kMinInt64),
88 RangeBoundary(kMaxInt64));
89
90 TEST_RANGE_OP(Range::Shr, -8, 8, 1, 2, RangeBoundary(-4), RangeBoundary(4));
91 TEST_RANGE_OP(Range::Shr, 1, 8, 1, 2, RangeBoundary::FromConstant(0),
92 RangeBoundary(4));
93 TEST_RANGE_OP(Range::Shr, -16, -8, 1, 2, RangeBoundary(-8),
94 RangeBoundary(-2));
95 TEST_RANGE_OP(Range::Shr, 2, 4, -1, 1, RangeBoundary(1), RangeBoundary(4));
96 TEST_RANGE_OP(Range::Shr, kMaxInt64, kMaxInt64, 0, 1,
97 RangeBoundary(kMaxInt64 >> 1), RangeBoundary(kMaxInt64));
98 TEST_RANGE_OP(Range::Shr, kMinInt64, kMinInt64, 0, 1,
99 RangeBoundary(kMinInt64), RangeBoundary(kMinInt64 >> 1));
100#undef TEST_RANGE_OP
101}
bool IsPositive() const
bool IsWithin(int64_t min_int, int64_t max_int) const
bool Overlaps(int64_t min_int, int64_t max_int) const
#define TEST_RANGE_OP(Op, l_min, l_max, r_min, r_max, result_min, result_max)
#define TEST_RANGE_OP_SMI(Op, l_min, l_max, r_min, r_max, res_min, res_max)

◆ TEST_CASE() [534/600]

dart::TEST_CASE ( RangeTestsInt64Range  )

Definition at line 103 of file range_analysis_test.cc.

103 {
104 const Range fullInt64Range = Range::Full(RangeBoundary::kRangeBoundaryInt64);
105
106 Range* all = new Range(RangeBoundary(kMinInt64), RangeBoundary(kMaxInt64));
107 EXPECT(all->Equals(&fullInt64Range));
108 EXPECT(all->Overlaps(0, 0));
109 EXPECT(all->Overlaps(-1, 1));
110 EXPECT(!all->IsWithin(0, 100));
111
112 Range* positive =
113 new Range(RangeBoundary::FromConstant(0), RangeBoundary(kMaxInt64));
114 EXPECT(positive->Overlaps(0, 1));
115 EXPECT(positive->Overlaps(1, 100));
116 EXPECT(positive->Overlaps(-1, 0));
117
118 Range* negative =
119 new Range(RangeBoundary(kMinInt64), RangeBoundary::FromConstant(-1));
120 EXPECT(negative->Overlaps(-1, 0));
121 EXPECT(negative->Overlaps(-2, -1));
122
123 Range* negpos =
124 new Range(RangeBoundary(kMinInt64), RangeBoundary::FromConstant(0));
125 EXPECT(!negpos->IsPositive());
126
127 Range* c =
128 new Range(RangeBoundary(kMinInt64), RangeBoundary::FromConstant(32));
129
131}
bool OnlyLessThanOrEqualTo(int64_t val) const

◆ TEST_CASE() [535/600]

dart::TEST_CASE ( RangeUtils  )

Definition at line 133 of file range_analysis_test.cc.

133 {
134 // Use kMin/kMax instead of +/-inf as any range with a +/-inf bound is
135 // converted to the full int64 range due to wrap-around.
136 const RangeBoundary negativeInfinity =
137 RangeBoundary::FromConstant(RangeBoundary::kMin);
138 const RangeBoundary positiveInfinity =
139 RangeBoundary::FromConstant(RangeBoundary::kMax);
140
141 // [-inf, +inf].
142 const Range& range_0 = *(new Range(negativeInfinity, positiveInfinity));
143 // [-inf, -1].
144 const Range& range_a =
145 *(new Range(negativeInfinity, RangeBoundary::FromConstant(-1)));
146 // [-inf, 0].
147 const Range& range_b =
148 *(new Range(negativeInfinity, RangeBoundary::FromConstant(0)));
149 // [-inf, 1].
150 const Range& range_c =
151 *(new Range(negativeInfinity, RangeBoundary::FromConstant(1)));
152 // [-1, +inf]
153 const Range& range_d =
154 *(new Range(RangeBoundary::FromConstant(-1), positiveInfinity));
155 // [0, +inf]
156 const Range& range_e =
157 *(new Range(RangeBoundary::FromConstant(0), positiveInfinity));
158 // [1, +inf].
159 const Range& range_f =
160 *(new Range(RangeBoundary::FromConstant(1), positiveInfinity));
161 // [1, 2].
162 const Range& range_g = *(new Range(RangeBoundary::FromConstant(1),
163 RangeBoundary::FromConstant(2)));
164 // [-1, -2].
165 const Range& range_h = *(new Range(RangeBoundary::FromConstant(-1),
166 RangeBoundary::FromConstant(-2)));
167 // [-1, 1].
168 const Range& range_i = *(new Range(RangeBoundary::FromConstant(-1),
169 RangeBoundary::FromConstant(1)));
170
171 // OnlyPositiveOrZero.
172 EXPECT(!Range::OnlyPositiveOrZero(range_a, range_b));
173 EXPECT(!Range::OnlyPositiveOrZero(range_b, range_c));
174 EXPECT(!Range::OnlyPositiveOrZero(range_c, range_d));
175 EXPECT(!Range::OnlyPositiveOrZero(range_d, range_e));
176 EXPECT(Range::OnlyPositiveOrZero(range_e, range_f));
177 EXPECT(!Range::OnlyPositiveOrZero(range_d, range_d));
178 EXPECT(Range::OnlyPositiveOrZero(range_e, range_e));
179 EXPECT(Range::OnlyPositiveOrZero(range_f, range_g));
180 EXPECT(!Range::OnlyPositiveOrZero(range_g, range_h));
181 EXPECT(!Range::OnlyPositiveOrZero(range_i, range_i));
182
183 // OnlyNegativeOrZero.
184 EXPECT(Range::OnlyNegativeOrZero(range_a, range_b));
185 EXPECT(!Range::OnlyNegativeOrZero(range_b, range_c));
186 EXPECT(Range::OnlyNegativeOrZero(range_b, range_b));
187 EXPECT(!Range::OnlyNegativeOrZero(range_c, range_c));
188 EXPECT(!Range::OnlyNegativeOrZero(range_c, range_d));
189 EXPECT(!Range::OnlyNegativeOrZero(range_d, range_e));
190 EXPECT(!Range::OnlyNegativeOrZero(range_e, range_f));
191 EXPECT(!Range::OnlyNegativeOrZero(range_f, range_g));
192 EXPECT(!Range::OnlyNegativeOrZero(range_g, range_h));
193 EXPECT(Range::OnlyNegativeOrZero(range_h, range_h));
194 EXPECT(!Range::OnlyNegativeOrZero(range_i, range_i));
195
196 // [-inf, +inf].
197 EXPECT(!Range::OnlyNegativeOrZero(range_0, range_0));
198 EXPECT(!Range::OnlyPositiveOrZero(range_0, range_0));
199
200 EXPECT(Range::ConstantAbsMax(&range_0) == RangeBoundary::kMax);
201 EXPECT(Range::ConstantAbsMax(&range_h) == 2);
202 EXPECT(Range::ConstantAbsMax(&range_i) == 1);
203
204 // RangeBoundary.Equals.
205 EXPECT(RangeBoundary::FromConstant(1).Equals(RangeBoundary::FromConstant(1)));
206 EXPECT(
207 !RangeBoundary::FromConstant(2).Equals(RangeBoundary::FromConstant(1)));
208}

◆ TEST_CASE() [536/600]

dart::TEST_CASE ( Read  )

Definition at line 15 of file file_test.cc.

15 {
16 const char* kFilename = bin::test::GetFileName("runtime/bin/file_test.cc");
17 bin::File* file = bin::File::Open(nullptr, kFilename, bin::File::kRead);
18 EXPECT(file != nullptr);
19 char buffer[16];
20 buffer[0] = '\0';
21 EXPECT(file->ReadFully(buffer, 13)); // ReadFully returns true.
22 buffer[13] = '\0';
23 EXPECT_STREQ("// Copyright ", buffer);
24 EXPECT(!file->WriteByte(1)); // Cannot write to a read-only file.
25 file->Release();
26}

◆ TEST_CASE() [537/600]

dart::TEST_CASE ( ReadStream_Read16  )

Definition at line 117 of file datastream_test.cc.

117 {
118 TestRaw<int16_t>();
119}

◆ TEST_CASE() [538/600]

dart::TEST_CASE ( ReadStream_Read32  )

Definition at line 121 of file datastream_test.cc.

121 {
122 TestRaw<int32_t>();
123}

◆ TEST_CASE() [539/600]

dart::TEST_CASE ( ReadStream_Read64  )

Definition at line 125 of file datastream_test.cc.

125 {
126 TestRaw<int64_t>();
127}

◆ TEST_CASE() [540/600]

dart::TEST_CASE ( Regress38528  )

Definition at line 231 of file freelist_test.cc.

231 {
232 for (const intptr_t i : {-2, -1, 0, 1, 2}) {
233 TestRegress38528(i);
234 }
235}

◆ TEST_CASE() [541/600]

dart::TEST_CASE ( ResolveUri_DataUri  )

Definition at line 452 of file uri_test.cc.

452 {
453 const char* data_uri =
454 "data:application/"
455 "dart;charset=utf-8,%20%20%20%20%20%20%20%20import%20%22dart:isolate%22;%"
456 "0A%0A%20%20%20%20%20%20%20%20import%20%22package:stream_channel/"
457 "stream_channel.dart%22;%0A%0A%20%20%20%20%20%20%20%20import%20%"
458 "22package:test/src/runner/plugin/"
459 "remote_platform_helpers.dart%22;%0A%20%20%20%20%20%20%20%20import%20%"
460 "22package:test/src/runner/vm/"
461 "catch_isolate_errors.dart%22;%0A%0A%20%20%20%20%20%20%20%20import%20%"
462 "22file:///home/sra/xxxx/dev_compiler/test/"
463 "all_tests.dart%22%20as%20test;%0A%0A%20%20%20%20%20%20%20%20void%20main("
464 "_,%20SendPort%20message)%20%7B%0A%20%20%20%20%20%20%20%20%20%20var%"
465 "20channel%20=%20serializeSuite(()%20%7B%0A%20%20%20%20%20%20%20%20%20%"
466 "20%20%20catchIsolateErrors();%0A%20%20%20%20%20%20%20%20%20%20%20%"
467 "20return%20test.main;%0A%20%20%20%20%20%20%20%20%20%20%7D);%0A%20%20%20%"
468 "20%20%20%20%20%20%20new%20IsolateChannel.connectSend(message).pipe("
469 "channel);%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20";
470
471 const char* target_uri;
472 EXPECT(ResolveUri(data_uri,
473 "bscheme://buser@bhost:11/base/path?baseQuery#bfragment",
474 &target_uri));
475 EXPECT_STREQ(data_uri, target_uri);
476}

◆ TEST_CASE() [542/600]

dart::TEST_CASE ( ResolveUri_MoreDotSegmentTests  )

Definition at line 567 of file uri_test.cc.

567 {
568 const char* base = "/";
569 EXPECT_STREQ("/a/g", TestResolve(base, "/a/b/c/./../../g"));
570 EXPECT_STREQ("/a/g", TestResolve(base, "/a/b/c/./../../g"));
571 EXPECT_STREQ("/mid/6", TestResolve(base, "mid/content=5/../6"));
572 EXPECT_STREQ("/a/b/e", TestResolve(base, "a/b/c/d/../../e"));
573 EXPECT_STREQ("/a/b/e", TestResolve(base, "../a/b/c/d/../../e"));
574 EXPECT_STREQ("/a/b/e", TestResolve(base, "./a/b/c/d/../../e"));
575 EXPECT_STREQ("/a/b/e", TestResolve(base, "../a/b/./c/d/../../e"));
576 EXPECT_STREQ("/a/b/e", TestResolve(base, "./a/b/./c/d/../../e"));
577 EXPECT_STREQ("/a/b/e/", TestResolve(base, "./a/b/./c/d/../../e/."));
578 EXPECT_STREQ("/a/b/e/", TestResolve(base, "./a/b/./c/d/../../e/./."));
579 EXPECT_STREQ("/a/b/e/", TestResolve(base, "./a/b/./c/d/../../e/././."));
580
581#define LH "http://localhost"
582 base = LH;
583 EXPECT_STREQ(LH "/a/g", TestResolve(base, "/a/b/c/./../../g"));
584 EXPECT_STREQ(LH "/a/g", TestResolve(base, "/a/b/c/./../../g"));
585 EXPECT_STREQ(LH "/mid/6", TestResolve(base, "mid/content=5/../6"));
586 EXPECT_STREQ(LH "/a/b/e", TestResolve(base, "a/b/c/d/../../e"));
587 EXPECT_STREQ(LH "/a/b/e", TestResolve(base, "../a/b/c/d/../../e"));
588 EXPECT_STREQ(LH "/a/b/e", TestResolve(base, "./a/b/c/d/../../e"));
589 EXPECT_STREQ(LH "/a/b/e", TestResolve(base, "../a/b/./c/d/../../e"));
590 EXPECT_STREQ(LH "/a/b/e", TestResolve(base, "./a/b/./c/d/../../e"));
591 EXPECT_STREQ(LH "/a/b/e/", TestResolve(base, "./a/b/./c/d/../../e/."));
592 EXPECT_STREQ(LH "/a/b/e/", TestResolve(base, "./a/b/./c/d/../../e/./."));
593 EXPECT_STREQ(LH "/a/b/e/", TestResolve(base, "./a/b/./c/d/../../e/././."));
594#undef LH
595}
static const char * TestResolve(const char *base_uri, const char *uri)
Definition uri_test.cc:505

◆ TEST_CASE() [543/600]

dart::TEST_CASE ( ResolveUri_NormalizeEscapes_Authority  )

Definition at line 436 of file uri_test.cc.

436 {
437 const char* target_uri;
438 EXPECT(
439 ResolveUri("", "scheme://UsEr N%61%4de@h%4FsT.c%6fm:80/", &target_uri));
440 // userinfo is normalized and case is preserved. host is normalized
441 // and lower-cased.
442 EXPECT_STREQ("scheme://UsEr%20NaMe@host.com:80/", target_uri);
443}

◆ TEST_CASE() [544/600]

dart::TEST_CASE ( ResolveUri_NormalizeEscapes_BrokenEscapeSequence  )

Definition at line 445 of file uri_test.cc.

445 {
446 const char* target_uri;
447 EXPECT(ResolveUri("", "scheme:/%1g", &target_uri));
448 // We don't change broken escape sequences.
449 EXPECT_STREQ("scheme:/%1g", target_uri);
450}

◆ TEST_CASE() [545/600]

dart::TEST_CASE ( ResolveUri_NormalizeEscapes_PathQueryFragment  )

Definition at line 420 of file uri_test.cc.

420 {
421 const char* target_uri;
422 EXPECT(ResolveUri("#A Fr%61gment",
423 "scheme:/This%09Is A P%61th?This%09Is A Qu%65ry",
424 &target_uri));
425 EXPECT_STREQ(
426 "scheme:/This%09Is%20A%20Path?This%09Is%20A%20Query#A%20Fragment",
427 target_uri);
428}

◆ TEST_CASE() [546/600]

dart::TEST_CASE ( ResolveUri_NormalizeEscapes_UppercaseHexPreferred  )

Definition at line 430 of file uri_test.cc.

430 {
431 const char* target_uri;
432 EXPECT(ResolveUri("", "scheme:/%1b%1B", &target_uri));
433 EXPECT_STREQ("scheme:/%1B%1B", target_uri);
434}

◆ TEST_CASE() [547/600]

dart::TEST_CASE ( ResolveUri_NoScheme_WithAuthority  )

Definition at line 304 of file uri_test.cc.

304 {
305 const char* target_uri;
306 EXPECT(ResolveUri("//ruser@rhost:22/ref/path",
307 "bscheme://buser@bhost:11/base/path?baseQuery",
308 &target_uri));
309 EXPECT_STREQ("bscheme://ruser@rhost:22/ref/path", target_uri);
310}

◆ TEST_CASE() [548/600]

dart::TEST_CASE ( ResolveUri_NoSchemeNoAuthority_AbsolutePath  )

Definition at line 312 of file uri_test.cc.

312 {
313 const char* target_uri;
314 EXPECT(ResolveUri("/ref/path", "bscheme://buser@bhost:11/base/path?baseQuery",
315 &target_uri));
316 EXPECT_STREQ("bscheme://buser@bhost:11/ref/path", target_uri);
317}

◆ TEST_CASE() [549/600]

dart::TEST_CASE ( ResolveUri_NoSchemeNoAuthority_EmptyPath  )

Definition at line 338 of file uri_test.cc.

338 {
339 const char* target_uri;
341 "bscheme://buser@bhost:11/base/path?baseQuery#bfragment",
342 &target_uri));
343 // Note that we drop the base fragment from the resolved uri.
344 EXPECT_STREQ("bscheme://buser@bhost:11/base/path?baseQuery", target_uri);
345}

◆ TEST_CASE() [550/600]

dart::TEST_CASE ( ResolveUri_NoSchemeNoAuthority_EmptyPathWithFragment  )

Definition at line 355 of file uri_test.cc.

355 {
356 const char* target_uri;
357 EXPECT(ResolveUri("#rfragment",
358 "bscheme://buser@bhost:11/base/path?baseQuery#bfragment",
359 &target_uri));
360 EXPECT_STREQ("bscheme://buser@bhost:11/base/path?baseQuery#rfragment",
361 target_uri);
362}

◆ TEST_CASE() [551/600]

dart::TEST_CASE ( ResolveUri_NoSchemeNoAuthority_EmptyPathWithQuery  )

Definition at line 347 of file uri_test.cc.

347 {
348 const char* target_uri;
349 EXPECT(ResolveUri("?refQuery",
350 "bscheme://buser@bhost:11/base/path?baseQuery#bfragment",
351 &target_uri));
352 EXPECT_STREQ("bscheme://buser@bhost:11/base/path?refQuery", target_uri);
353}

◆ TEST_CASE() [552/600]

dart::TEST_CASE ( ResolveUri_NoSchemeNoAuthority_RelativePath  )

Definition at line 319 of file uri_test.cc.

319 {
320 const char* target_uri;
321 EXPECT(ResolveUri("ref/path", "bscheme://buser@bhost:11/base/path?baseQuery",
322 &target_uri));
323 EXPECT_STREQ("bscheme://buser@bhost:11/base/ref/path", target_uri);
324}

◆ TEST_CASE() [553/600]

dart::TEST_CASE ( ResolveUri_NoSchemeNoAuthority_RelativePathEmptyBasePath  )

Definition at line 326 of file uri_test.cc.

326 {
327 const char* target_uri;
328 EXPECT(ResolveUri("ref/path", "bscheme://buser@bhost:11", &target_uri));
329 EXPECT_STREQ("bscheme://buser@bhost:11/ref/path", target_uri);
330}

◆ TEST_CASE() [554/600]

dart::TEST_CASE ( ResolveUri_NoSchemeNoAuthority_RelativePathWeirdBasePath  )

Definition at line 332 of file uri_test.cc.

332 {
333 const char* target_uri;
334 EXPECT(ResolveUri("ref/path", "bscheme:base", &target_uri));
335 EXPECT_STREQ("bscheme:ref/path", target_uri);
336}

◆ TEST_CASE() [555/600]

dart::TEST_CASE ( ResolveUri_RelativeBase_NotImplemented  )

Definition at line 481 of file uri_test.cc.

481 {
482 const char* target_uri;
483 EXPECT(!ResolveUri("../r1", "b1/b2", &target_uri));
484 EXPECT(target_uri == nullptr);
485
486 EXPECT(!ResolveUri("..", "b1/b2", &target_uri));
487 EXPECT(target_uri == nullptr);
488
489 EXPECT(!ResolveUri("../..", "b1/b2", &target_uri));
490 EXPECT(target_uri == nullptr);
491
492 EXPECT(!ResolveUri("../../..", "b1/b2", &target_uri));
493 EXPECT(target_uri == nullptr);
494
495 EXPECT(!ResolveUri("../../../r1", "b1/b2", &target_uri));
496 EXPECT(target_uri == nullptr);
497
498 EXPECT(!ResolveUri("../r1", "../../b1/b2/b3", &target_uri));
499 EXPECT(target_uri == nullptr);
500
501 EXPECT(!ResolveUri("../../../r1", "../../b1/b2/b3", &target_uri));
502 EXPECT(target_uri == nullptr);
503}

◆ TEST_CASE() [556/600]

dart::TEST_CASE ( ResolveUri_RemoveDots_RemoveDotSegmentsInitialPrefix  )

Definition at line 407 of file uri_test.cc.

407 {
408 const char* target_uri;
409 EXPECT(ResolveUri("../../../../refpath", "scheme://auth", &target_uri));
410 EXPECT_STREQ("scheme://auth/refpath", target_uri);
411}

◆ TEST_CASE() [557/600]

dart::TEST_CASE ( ResolveUri_RemoveDots_RemoveDotSegmentsMixed  )

Definition at line 413 of file uri_test.cc.

413 {
414 const char* target_uri;
415 EXPECT(ResolveUri("../../1/./2/../3/4/../5/././6/../7",
416 "scheme://auth/a/b/c/d/e", &target_uri));
417 EXPECT_STREQ("scheme://auth/a/b/1/3/5/7", target_uri);
418}

◆ TEST_CASE() [558/600]

dart::TEST_CASE ( ResolveUri_RemoveDots_RemoveDotSegmentsNothingLeft1  )

Definition at line 395 of file uri_test.cc.

395 {
396 const char* target_uri;
397 EXPECT(ResolveUri("../../../../..", "scheme://auth/a/b/c/d", &target_uri));
398 EXPECT_STREQ("scheme://auth/", target_uri);
399}

◆ TEST_CASE() [559/600]

dart::TEST_CASE ( ResolveUri_RemoveDots_RemoveDotSegmentsNothingLeft2  )

Definition at line 401 of file uri_test.cc.

401 {
402 const char* target_uri;
403 EXPECT(ResolveUri(".", "scheme://auth/", &target_uri));
404 EXPECT_STREQ("scheme://auth/", target_uri);
405}

◆ TEST_CASE() [560/600]

dart::TEST_CASE ( ResolveUri_RemoveDots_RemoveOneDotDotSegment  )

Definition at line 376 of file uri_test.cc.

376 {
377 const char* target_uri;
378 EXPECT(ResolveUri("../refpath", "scheme://auth/a/b/c/d", &target_uri));
379 EXPECT_STREQ("scheme://auth/a/b/refpath", target_uri);
380}

◆ TEST_CASE() [561/600]

dart::TEST_CASE ( ResolveUri_RemoveDots_RemoveOneDotSegment  )

Definition at line 364 of file uri_test.cc.

364 {
365 const char* target_uri;
366 EXPECT(ResolveUri("./refpath", "scheme://auth/a/b/c/d", &target_uri));
367 EXPECT_STREQ("scheme://auth/a/b/c/refpath", target_uri);
368}

◆ TEST_CASE() [562/600]

dart::TEST_CASE ( ResolveUri_RemoveDots_RemoveTooManyDotDotSegments  )

Definition at line 388 of file uri_test.cc.

388 {
389 const char* target_uri;
390 EXPECT(ResolveUri("../../../../../../../../../refpath",
391 "scheme://auth/a/b/c/d", &target_uri));
392 EXPECT_STREQ("scheme://auth/refpath", target_uri);
393}

◆ TEST_CASE() [563/600]

dart::TEST_CASE ( ResolveUri_RemoveDots_RemoveTwoDotDotSegments  )

Definition at line 382 of file uri_test.cc.

382 {
383 const char* target_uri;
384 EXPECT(ResolveUri("../../refpath", "scheme://auth/a/b/c/d", &target_uri));
385 EXPECT_STREQ("scheme://auth/a/refpath", target_uri);
386}

◆ TEST_CASE() [564/600]

dart::TEST_CASE ( ResolveUri_RemoveDots_RemoveTwoDotSegments  )

Definition at line 370 of file uri_test.cc.

370 {
371 const char* target_uri;
372 EXPECT(ResolveUri("././refpath", "scheme://auth/a/b/c/d", &target_uri));
373 EXPECT_STREQ("scheme://auth/a/b/c/refpath", target_uri);
374}

◆ TEST_CASE() [565/600]

dart::TEST_CASE ( ResolveUri_TestUriPerRFCs  )

Definition at line 512 of file uri_test.cc.

512 {
513 const char* base = "http://a/b/c/d;p?q";
514
515 // From RFC 3986
516 EXPECT_STREQ("g:h", TestResolve(base, "g:h"));
517 EXPECT_STREQ("http://a/b/c/g", TestResolve(base, "g"));
518 EXPECT_STREQ("http://a/b/c/g", TestResolve(base, "./g"));
519 EXPECT_STREQ("http://a/b/c/g/", TestResolve(base, "g/"));
520 EXPECT_STREQ("http://a/g", TestResolve(base, "/g"));
521 EXPECT_STREQ("http://g", TestResolve(base, "//g"));
522 EXPECT_STREQ("http://a/b/c/d;p?y", TestResolve(base, "?y"));
523 EXPECT_STREQ("http://a/b/c/g?y", TestResolve(base, "g?y"));
524 EXPECT_STREQ("http://a/b/c/d;p?q#s", TestResolve(base, "#s"));
525 EXPECT_STREQ("http://a/b/c/g#s", TestResolve(base, "g#s"));
526 EXPECT_STREQ("http://a/b/c/g?y#s", TestResolve(base, "g?y#s"));
527 EXPECT_STREQ("http://a/b/c/;x", TestResolve(base, ";x"));
528 EXPECT_STREQ("http://a/b/c/g;x", TestResolve(base, "g;x"));
529 EXPECT_STREQ("http://a/b/c/g;x?y#s", TestResolve(base, "g;x?y#s"));
530 EXPECT_STREQ("http://a/b/c/d;p?q", TestResolve(base, ""));
531 EXPECT_STREQ("http://a/b/c/", TestResolve(base, "."));
532 EXPECT_STREQ("http://a/b/c/", TestResolve(base, "./"));
533 EXPECT_STREQ("http://a/b/", TestResolve(base, ".."));
534 EXPECT_STREQ("http://a/b/", TestResolve(base, "../"));
535 EXPECT_STREQ("http://a/b/g", TestResolve(base, "../g"));
536 EXPECT_STREQ("http://a/", TestResolve(base, "../.."));
537 EXPECT_STREQ("http://a/", TestResolve(base, "../../"));
538 EXPECT_STREQ("http://a/g", TestResolve(base, "../../g"));
539 EXPECT_STREQ("http://a/g", TestResolve(base, "../../../g"));
540 EXPECT_STREQ("http://a/g", TestResolve(base, "../../../../g"));
541 EXPECT_STREQ("http://a/g", TestResolve(base, "/./g"));
542 EXPECT_STREQ("http://a/g", TestResolve(base, "/../g"));
543 EXPECT_STREQ("http://a/b/c/g.", TestResolve(base, "g."));
544 EXPECT_STREQ("http://a/b/c/.g", TestResolve(base, ".g"));
545 EXPECT_STREQ("http://a/b/c/g..", TestResolve(base, "g.."));
546 EXPECT_STREQ("http://a/b/c/..g", TestResolve(base, "..g"));
547 EXPECT_STREQ("http://a/b/g", TestResolve(base, "./../g"));
548 EXPECT_STREQ("http://a/b/c/g/", TestResolve(base, "./g/."));
549 EXPECT_STREQ("http://a/b/c/g/h", TestResolve(base, "g/./h"));
550 EXPECT_STREQ("http://a/b/c/h", TestResolve(base, "g/../h"));
551 EXPECT_STREQ("http://a/b/c/g;x=1/y", TestResolve(base, "g;x=1/./y"));
552 EXPECT_STREQ("http://a/b/c/y", TestResolve(base, "g;x=1/../y"));
553 EXPECT_STREQ("http://a/b/c/g?y/./x", TestResolve(base, "g?y/./x"));
554 EXPECT_STREQ("http://a/b/c/g?y/../x", TestResolve(base, "g?y/../x"));
555 EXPECT_STREQ("http://a/b/c/g#s/./x", TestResolve(base, "g#s/./x"));
556 EXPECT_STREQ("http://a/b/c/g#s/../x", TestResolve(base, "g#s/../x"));
557 EXPECT_STREQ("http:g", TestResolve(base, "http:g"));
558
559 // Additional tests (not from RFC 3986).
560 EXPECT_STREQ("http://a/b/g;p/h;s", TestResolve(base, "../g;p/h;s"));
561
562 base = "s:a/b";
563 EXPECT_STREQ("s:/c", TestResolve(base, "../c"));
564}

◆ TEST_CASE() [566/600]

dart::TEST_CASE ( ResolveUri_WindowsPaths_Backslash  )

Definition at line 615 of file uri_test.cc.

615 {
616 EXPECT_STREQ(
617 "file:///b.dll",
619 "file:///C:\\Users\\USERNA~1\\AppData\\Local\\Temp\\a\\out.dill",
620 "b.dll"));
621}

◆ TEST_CASE() [567/600]

dart::TEST_CASE ( ResolveUri_WindowsPaths_Forwardslash_FileScheme  )

Definition at line 607 of file uri_test.cc.

607 {
608 EXPECT_STREQ(
609 "file:///"
610 "C:/Users/USERNA~1/AppData/Local/Temp/a/b.dll",
611 TestResolve("file:///C:/Users/USERNA~1/AppData/Local/Temp/a/out.dill",
612 "b.dll"));
613}

◆ TEST_CASE() [568/600]

dart::TEST_CASE ( ResolveUri_WindowsPaths_Forwardslash_NoScheme  )

Definition at line 597 of file uri_test.cc.

597 {
598 EXPECT_STREQ(
599 "c:/Users/USERNA~1/AppData/Local/Temp/a/b.dll",
600 TestResolve("C:/Users/USERNA~1/AppData/Local/Temp/a/out.dill", "b.dll"));
601}

◆ TEST_CASE() [569/600]

dart::TEST_CASE ( ResolveUri_WithScheme_NoAuthorityNoQuery  )

Definition at line 288 of file uri_test.cc.

288 {
289 const char* target_uri;
290 EXPECT(ResolveUri("rscheme:/ref/path",
291 "bscheme://buser@bhost:11/base/path?baseQuery",
292 &target_uri));
293 EXPECT_STREQ("rscheme:/ref/path", target_uri);
294}

◆ TEST_CASE() [570/600]

dart::TEST_CASE ( ResolveUri_WithScheme_WithAuthorityWithQuery  )

Definition at line 296 of file uri_test.cc.

296 {
297 const char* target_uri;
298 EXPECT(ResolveUri("rscheme://ruser@rhost:22/ref/path?refQuery",
299 "bscheme://buser@bhost:11/base/path?baseQuery",
300 &target_uri));
301 EXPECT_STREQ("rscheme://ruser@rhost:22/ref/path?refQuery", target_uri);
302}

◆ TEST_CASE() [571/600]

dart::TEST_CASE ( RingBuffer  )

Definition at line 11 of file ring_buffer_test.cc.

11 {
13 EXPECT_EQ(0, buf.Size());
14 buf.Add(42);
15 EXPECT_EQ(1, buf.Size());
16 EXPECT_EQ(42, buf.Get(0));
17 buf.Add(87);
18 EXPECT_EQ(2, buf.Size());
19 EXPECT_EQ(87, buf.Get(0));
20 EXPECT_EQ(42, buf.Get(1));
21 buf.Add(-1);
22 EXPECT_EQ(2, buf.Size());
23 EXPECT_EQ(-1, buf.Get(0));
24 EXPECT_EQ(87, buf.Get(1));
25}
const T & Get(int i) const
Definition ring_buffer.h:22
int64_t Size() const
Definition ring_buffer.h:28
void Add(const T &t)
Definition ring_buffer.h:19

◆ TEST_CASE() [572/600]

dart::TEST_CASE ( SafepointTestDart  )

Definition at line 613 of file thread_test.cc.

613 {
614 Isolate* isolate = Thread::Current()->isolate();
615 Monitor monitor;
616 intptr_t expected_count = 0;
617 intptr_t total_done = 0;
618 intptr_t exited = 0;
619 for (int i = 0; i < SafepointTestTask::kTaskCount; i++) {
620 Dart::thread_pool()->Run<SafepointTestTask>(
621 isolate, &monitor, &expected_count, &total_done, &exited);
622 }
623// Run Dart code on the main thread long enough to allow all helpers
624// to get their verification done and exit. Use a specific UserTag
625// to enable the helpers to verify that the main thread is
626// successfully interrupted in the pure Dart loop.
627#if defined(USING_SIMULATOR)
628 const intptr_t kLoopCount = 12345678;
629#else
630 const intptr_t kLoopCount = 1234567890;
631#endif // defined(USING_SIMULATOR)
632 char buffer[1024];
633 Utils::SNPrint(buffer, sizeof(buffer),
634 "import 'dart:developer';\n"
635 "int dummy = 0;\n"
636 "main() {\n"
637 " new UserTag('foo').makeCurrent();\n"
638 " for (dummy = 0; dummy < %" Pd
639 "; ++dummy) {\n"
640 " dummy += (dummy & 1);\n"
641 " }\n"
642 "}\n",
643 kLoopCount);
644 Dart_Handle lib = TestCase::LoadTestScript(buffer, nullptr);
645 EXPECT_VALID(lib);
646 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, nullptr);
648 // Ensure we looped long enough to allow all helpers to succeed and exit.
649 {
650 MonitorLocker ml(&monitor);
651 while (exited != SafepointTestTask::kTaskCount) {
652 ml.Wait();
653 }
654 EXPECT_EQ(SafepointTestTask::kTaskCount, total_done);
655 EXPECT_EQ(SafepointTestTask::kTaskCount, exited);
656 }
657}

◆ TEST_CASE() [573/600]

dart::TEST_CASE ( Set_iteration  )

Definition at line 7101 of file object_test.cc.

7105 {
7106 constValue()[null];
7107}
7108)";
7109 HashMapNonConstEqualsConst(kScript, false);
7110}
7111
7112TEST_CASE(Set_iteration) {
7113 const char* kScript = R"(
7114makeSet() {
7115 var set = {'x', 'y', 'z', 'w'};
7116 set.remove('y');
7117 set.remove('w');
7118 return set;
7119}
7120)";
7121 Dart_Handle h_lib = TestCase::LoadTestScript(kScript, nullptr);
7122 EXPECT_VALID(h_lib);
7123 Dart_Handle h_result = Dart_Invoke(h_lib, NewString("makeSet"), 0, nullptr);
7124 EXPECT_VALID(h_result);
7125
7126 TransitionNativeToVM transition(thread);
7127 Instance& dart_set = Instance::Handle();
7128 dart_set ^= Api::UnwrapHandle(h_result);
7129 ASSERT(dart_set.IsSet());
7130 const Set& cc_set = Set::Cast(dart_set);
7131
7132 EXPECT_EQ(2, cc_set.Length());
7133
7134 Set::Iterator iterator(cc_set);
7135 Object& object = Object::Handle();

◆ TEST_CASE() [574/600]

dart::TEST_CASE ( SlotFromGuardedField  )

Definition at line 35 of file slot_test.cc.

35 {
36 if (!FLAG_use_field_guards) {
37 return;
38 }
39
40 TransitionNativeToVM transition(thread);
41 Zone* zone = thread->zone();
42
43 // Setup: create dummy class, function and a field.
44 const Class& dummy_class = Class::Handle(Class::New(
45 Library::Handle(), String::Handle(Symbols::New(thread, "DummyClass")),
46 Script::Handle(), TokenPosition::kNoSource));
47 dummy_class.set_is_synthesized_class_unsafe();
48
49 const FunctionType& signature = FunctionType::ZoneHandle(FunctionType::New());
50 const Function& dummy_function = Function::ZoneHandle(
51 Function::New(signature, String::Handle(Symbols::New(thread, "foo")),
52 UntaggedFunction::kRegularFunction, false, false, false,
53 false, false, dummy_class, TokenPosition::kMinSource));
54
55 const Field& field = Field::Handle(
56 Field::New(String::Handle(Symbols::New(thread, "field")),
57 /*is_static=*/false, /*is_final=*/false, /*is_const=*/false,
58 /*is_reflectable=*/true, /*is_late=*/false, dummy_class,
59 Object::dynamic_type(), TokenPosition::kMinSource,
60 TokenPosition::kMinSource));
61
62 // Set non-trivial guarded state on the field.
63 field.set_guarded_cid_unsafe(kSmiCid);
64 field.set_is_nullable_unsafe(false);
65
66 // Enter compiler state.
67 CompilerState compiler_state(thread, /*is_aot=*/false,
68 /*is_optimizing=*/true);
69
70 const Field& field_clone_1 = Field::ZoneHandle(field.CloneFromOriginal());
71 const Field& field_clone_2 = Field::ZoneHandle(field.CloneFromOriginal());
72
73 // Check that Slot::Get() returns correctly canonicalized and configured
74 // slot that matches properties of the field.
75 ParsedFunction* parsed_function =
76 new (zone) ParsedFunction(thread, dummy_function);
77 const Slot& slot1 = Slot::Get(field_clone_1, parsed_function);
78 const Slot& slot2 = Slot::Get(field_clone_2, parsed_function);
79 EXPECT_EQ(&slot1, &slot2);
80 EXPECT(slot1.is_guarded_field());
81 EXPECT(!slot1.type().is_nullable());
82 EXPECT_EQ(kSmiCid, slot1.type().ToCid());
83
84 // Check that the field was added (once) to the list of guarded fields.
85 EXPECT_EQ(1, parsed_function->guarded_fields()->Length());
86 EXPECT(parsed_function->guarded_fields()->HasKey(&field_clone_1));
87
88 // Change the guarded state of the field to "unknown" - emulating concurrent
89 // modification of the guarded state in mutator) and create a new clone of
90 // the field.
91 field.set_guarded_cid_unsafe(kDynamicCid);
92 field.set_is_nullable_unsafe(true);
93 const Field& field_clone_3 = Field::ZoneHandle(field.CloneFromOriginal());
94
95 // Slot::Get must return the same slot and add the field from which it
96 // was created to the guarded fields list.
97 ParsedFunction* parsed_function2 =
98 new (zone) ParsedFunction(thread, dummy_function);
99 const Slot& slot3 = Slot::Get(field_clone_3, parsed_function2);
100 EXPECT_EQ(&slot1, &slot3);
101 EXPECT_EQ(1, parsed_function2->guarded_fields()->Length());
102 EXPECT(parsed_function2->guarded_fields()->HasKey(&field_clone_1));
103}

◆ TEST_CASE() [575/600]

dart::TEST_CASE ( StackLimitInterrupts  )

Definition at line 156 of file isolate_test.cc.

156 {
157 ThreadBarrier* barrier = new ThreadBarrier(InterruptChecker::kTaskCount + 1,
158 InterruptChecker::kTaskCount + 1);
159 // Start all tasks. They will busy-wait until interrupted in the first round.
160 for (intptr_t task = 0; task < InterruptChecker::kTaskCount; task++) {
161 Dart::thread_pool()->Run<InterruptChecker>(thread, barrier);
162 }
163 // Wait for all tasks to get ready for the first round.
164 barrier->Sync();
165 for (intptr_t i = 0; i < InterruptChecker::kIterations; ++i) {
166 thread->ScheduleInterrupts(Thread::kVMInterrupt);
167 // Wait for all tasks to observe the interrupt.
168 barrier->Sync();
169 // Continue with next round.
170 uword interrupts = thread->GetAndClearInterrupts();
171 EXPECT((interrupts & Thread::kVMInterrupt) != 0);
172 }
173 barrier->Sync();
174 barrier->Release();
175}

◆ TEST_CASE() [576/600]

dart::TEST_CASE ( StackMapGC  )

Definition at line 42 of file code_descriptors_test.cc.

42 {
43 const char* kScriptChars = R"(
44class A {
45 @pragma("vm:external-name", "NativeFunc")
46 external static void func(var i, var k);
47 static foo() {
48 var i;
49 var s1;
50 var k;
51 var s2;
52 var s3;
53 i = 10; s1 = 'abcd'; k = 20; s2 = 'B'; s3 = 'C';
54 func(i, k);
55 return i + k; }
56 static void moo() {
57 var i = A.foo();
58 if (i != 30) throw '$i != 30';
59 }
60})";
61 // First setup the script and compile the script.
62 TestCase::LoadTestScript(kScriptChars, native_resolver);
63 TransitionNativeToVM transition(thread);
64
65 EXPECT(ClassFinalizer::ProcessPendingClasses());
66 const String& name = String::Handle(String::New(TestCase::url()));
67 const Library& lib = Library::Handle(Library::LookupLibrary(thread, name));
68 EXPECT(!lib.IsNull());
69 Class& cls =
70 Class::Handle(lib.LookupClass(String::Handle(Symbols::New(thread, "A"))));
71 EXPECT(!cls.IsNull());
72
73 // Now compile the two functions 'A.foo' and 'A.moo'
74 String& function_moo_name = String::Handle(String::New("moo"));
75 const auto& error = cls.EnsureIsFinalized(thread);
76 EXPECT(error == Error::null());
77 Function& function_moo =
78 Function::Handle(cls.LookupStaticFunction(function_moo_name));
79 EXPECT(CompilerTest::TestCompileFunction(function_moo));
80 EXPECT(function_moo.HasCode());
81
82 String& function_foo_name = String::Handle(String::New("foo"));
83 Function& function_foo =
84 Function::Handle(cls.LookupStaticFunction(function_foo_name));
85 EXPECT(CompilerTest::TestCompileFunction(function_foo));
86 EXPECT(function_foo.HasCode());
87
88 // Build and setup a stackmap for the call to 'func' in 'A.foo' in order
89 // to test the traversal of stack maps when a GC happens.
90 BitmapBuilder* stack_bitmap = new BitmapBuilder();
91 EXPECT(stack_bitmap != nullptr);
92 stack_bitmap->Set(0, false); // var i.
93 stack_bitmap->Set(1, true); // var s1.
94 stack_bitmap->Set(2, false); // var k.
95 stack_bitmap->Set(3, true); // var s2.
96 stack_bitmap->Set(4, true); // var s3.
97 const Code& code = Code::Handle(function_foo.unoptimized_code());
98 // Search for the pc of the call to 'func'.
99 const PcDescriptors& descriptors =
100 PcDescriptors::Handle(code.pc_descriptors());
101 int call_count = 0;
102 PcDescriptors::Iterator iter(descriptors,
103 UntaggedPcDescriptors::kUnoptStaticCall);
104 CompressedStackMapsBuilder compressed_maps_builder(thread->zone());
105 while (iter.MoveNext()) {
106 compressed_maps_builder.AddEntry(iter.PcOffset(), stack_bitmap, 0);
107 ++call_count;
108 }
109 // We can't easily check that we put the stackmap at the correct pc, but
110 // we did if there was exactly one call seen.
111 EXPECT(call_count == 1);
112 const auto& compressed_maps =
113 CompressedStackMaps::Handle(compressed_maps_builder.Finalize());
114 code.set_compressed_stackmaps(compressed_maps);
115
116 // Now invoke 'A.moo' and it will trigger a GC when the native function
117 // is called, this should then cause the stack map of function 'A.foo'
118 // to be traversed and the appropriate objects visited.
119 const Object& result = Object::Handle(
120 DartEntry::InvokeFunction(function_foo, Object::empty_array()));
121 EXPECT(!result.IsError());
122}

◆ TEST_CASE() [577/600]

dart::TEST_CASE ( StackTraceFormat  )

Definition at line 3338 of file object_test.cc.

3338 {
3339 const char* kScriptChars =
3340 "void baz() {\n"
3341 " throw 'MyException';\n"
3342 "}\n"
3343 "\n"
3344 "class _OtherClass {\n"
3345 " _OtherClass._named() {\n"
3346 " baz();\n"
3347 " }\n"
3348 "}\n"
3349 "\n"
3350 "set globalVar(var value) {\n"
3351 " new _OtherClass._named();\n"
3352 "}\n"
3353 "\n"
3354 "void _bar() {\n"
3355 " globalVar = null;\n"
3356 "}\n"
3357 "\n"
3358 "class MyClass {\n"
3359 " MyClass() {\n"
3360 " (() => foo())();\n"
3361 " }\n"
3362 "\n"
3363 " static get field {\n"
3364 " _bar();\n"
3365 " }\n"
3366 "\n"
3367 " static foo() {\n"
3368 " fooHelper() {\n"
3369 " field;\n"
3370 " }\n"
3371 " fooHelper();\n"
3372 " }\n"
3373 "}\n"
3374 "\n"
3375 "main() {\n"
3376 " (() => new MyClass())();\n"
3377 "}\n";
3378 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
3379 EXPECT_VALID(lib);
3380 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, nullptr);
3381
3382 const char* lib_url = "file:///test-lib";
3383 const size_t kBufferSize = 1024;
3384 char expected[kBufferSize];
3385 snprintf(expected, kBufferSize,
3386 "Unhandled exception:\n"
3387 "MyException\n"
3388 "#0 baz (%1$s:2:3)\n"
3389 "#1 new _OtherClass._named (%1$s:7:5)\n"
3390 "#2 globalVar= (%1$s:12:7)\n"
3391 "#3 _bar (%1$s:16:3)\n"
3392 "#4 MyClass.field (%1$s:25:5)\n"
3393 "#5 MyClass.foo.fooHelper (%1$s:30:7)\n"
3394 "#6 MyClass.foo (%1$s:32:5)\n"
3395 "#7 new MyClass.<anonymous closure> (%1$s:21:12)\n"
3396 "#8 new MyClass (%1$s:21:18)\n"
3397 "#9 main.<anonymous closure> (%1$s:37:14)\n"
3398 "#10 main (%1$s:37:24)",
3399 lib_url);
3400
3401 EXPECT_ERROR(result, expected);
3402}

◆ TEST_CASE() [578/600]

dart::TEST_CASE ( STC_HashLookup  )

Definition at line 8557 of file object_test.cc.

8559 {
8560 SubtypeTestCacheCheckContents(zone, *stcs[i]);
static void SubtypeTestCacheCheckContents(Zone *zone, const SubtypeTestCache &cache)

◆ TEST_CASE() [579/600]

dart::TEST_CASE ( STC_LinearLookup  )

Definition at line 8552 of file object_test.cc.

◆ TEST_CASE() [580/600]

dart::TEST_CASE ( StressMallocDirectly  )

Definition at line 218 of file zone_test.cc.

218 {
219#if defined(CHECK_RSS)
220 int64_t start_rss = Service::CurrentRSS();
221#endif
222
223 void* allocations[ARRAY_SIZE(kSizes)];
224 for (size_t i = 0; i < ((3u * GB) / (512u * KB)); i++) {
225 for (size_t j = 0; j < ARRAY_SIZE(kSizes); j++) {
226 allocations[j] = malloc(kSizes[j]);
227 }
228 for (size_t j = 0; j < ARRAY_SIZE(kSizes); j++) {
229 free(allocations[j]);
230 }
231 }
232
233#if defined(CHECK_RSS)
234 int64_t stop_rss = Service::CurrentRSS();
235 EXPECT_LT(stop_rss, start_rss + kRssSlack);
236#endif
237}

◆ TEST_CASE() [581/600]

dart::TEST_CASE ( ThreadIterator_AddFindRemove  )

Definition at line 755 of file thread_test.cc.

755 {
757 params.spawned_thread_id = OSThread::kInvalidThreadId;
758 params.monitor = new Monitor();
759
760 {
761 MonitorLocker ml(params.monitor);
762 EXPECT(params.spawned_thread_id == OSThread::kInvalidThreadId);
763 // Spawn thread and wait to receive the thread id.
764 OSThread::Start("ThreadIteratorTest", ThreadIteratorTestMain,
765 reinterpret_cast<uword>(&params));
766 while (params.spawned_thread_id == OSThread::kInvalidThreadId) {
767 ml.Wait();
768 }
769 EXPECT(params.spawned_thread_id != OSThread::kInvalidThreadId);
770 EXPECT(params.spawned_thread_join_id != OSThread::kInvalidThreadJoinId);
771 OSThread::Join(params.spawned_thread_join_id);
772 }
773
774 EXPECT(!OSThread::IsThreadInList(params.spawned_thread_id))
775
776 delete params.monitor;
777}

◆ TEST_CASE() [582/600]

dart::TEST_CASE ( ThreadRegistry  )

Definition at line 353 of file thread_test.cc.

353 {
354 Isolate* orig = Thread::Current()->isolate();
355 Zone* orig_zone = Thread::Current()->zone();
356 char* orig_str = orig_zone->PrintToString("foo");
358 // Create and enter a new isolate.
359 TestCase::CreateTestIsolate();
360 Zone* zone0 = Thread::Current()->zone();
361 EXPECT(zone0 != orig_zone);
363 // Create and enter yet another isolate.
364 TestCase::CreateTestIsolate();
365 {
366 // Create a stack resource this time, and exercise it.
367 TransitionNativeToVM transition(Thread::Current());
368 StackZone stack_zone(Thread::Current());
369 Zone* zone1 = Thread::Current()->zone();
370 EXPECT(zone1 != zone0);
371 EXPECT(zone1 != orig_zone);
372 }
374 Dart_EnterIsolate(reinterpret_cast<Dart_Isolate>(orig));
375 // Original zone should be preserved.
376 EXPECT_EQ(orig_zone, Thread::Current()->zone());
377 EXPECT_STREQ("foo", orig_str);
378}

◆ TEST_CASE() [583/600]

dart::TEST_CASE ( TimelineEventArguments  )

Definition at line 217 of file timeline_test.cc.

217 {
218 // Create a test stream.
219 TimelineStream stream("testStream", "testStream", false, true);
220
221 // Create a test event.
222 TimelineEvent event;
223 TimelineTestHelper::SetStream(&event, &stream);
224
225 // Allocate room for four arguments.
226 event.SetNumArguments(4);
227 // Reset.
228 event.Reset();
229
230 event.DurationBegin("apple");
231 event.SetNumArguments(2);
232 event.CopyArgument(0, "arg1", "value1");
233 event.CopyArgument(1, "arg2", "value2");
234 event.SetTimeEnd();
235}

◆ TEST_CASE() [584/600]

dart::TEST_CASE ( TimelineEventArgumentsPrintJSON  )

Definition at line 237 of file timeline_test.cc.

237 {
238 // Create a test stream.
239 TimelineStream stream("testStream", "testStream", false, true);
240
241 // Create a test event.
242 TimelineEvent event;
243 TimelineTestHelper::SetStream(&event, &stream);
244
245 event.DurationBegin("apple");
246 event.SetNumArguments(2);
247 event.CopyArgument(0, "arg1", "value1");
248 event.CopyArgument(1, "arg2", "value2");
249 event.SetTimeEnd();
250
251 {
252 // Test printing to JSON.
253 JSONStream js;
254 event.PrintJSON(&js);
255
256 // Check both arguments.
257 EXPECT_SUBSTRING("\"arg1\":\"value1\"", js.ToCString());
258 EXPECT_SUBSTRING("\"arg2\":\"value2\"", js.ToCString());
259 }
260}

◆ TEST_CASE() [585/600]

dart::TEST_CASE ( TimelineEventBufferPrintJSON  )

Definition at line 262 of file timeline_test.cc.

262 {
263 JSONStream js;
264 TimelineEventFilter filter;
265 Timeline::recorder()->PrintJSON(&js, &filter);
266 // Check the type.
267 EXPECT_SUBSTRING("\"type\":\"Timeline\"", js.ToCString());
268 // Check that there is a traceEvents array.
269 EXPECT_SUBSTRING("\"traceEvents\":[", js.ToCString());
270}

◆ TEST_CASE() [586/600]

dart::TEST_CASE ( TimelineEventCallbackRecorderBasic  )

Definition at line 289 of file timeline_test.cc.

289 {
291
292 // Initial counts are all zero.
293 for (intptr_t i = TimelineEvent::kNone + 1; i < TimelineEvent::kNumEventTypes;
294 i++) {
295 EXPECT_EQ(0, override.recorder()->CountFor(
296 static_cast<TimelineEvent::EventType>(i)));
297 }
298
299 // Create a test stream.
300 TimelineStream stream("testStream", "testStream", false, true);
301
302 TimelineEvent* event = nullptr;
303
304 event = stream.StartEvent();
305 EXPECT_EQ(0, override.recorder()->CountFor(TimelineEvent::kDuration));
306 event->DurationBegin("cabbage");
307 EXPECT_EQ(0, override.recorder()->CountFor(TimelineEvent::kDuration));
308 event->SetTimeEnd();
309 EXPECT_EQ(0, override.recorder()->CountFor(TimelineEvent::kDuration));
310 event->Complete();
311 EXPECT_EQ(1, override.recorder()->CountFor(TimelineEvent::kDuration));
312
313 event = stream.StartEvent();
314 EXPECT_EQ(0, override.recorder()->CountFor(TimelineEvent::kInstant));
315 event->Instant("instantCabbage");
316 EXPECT_EQ(0, override.recorder()->CountFor(TimelineEvent::kInstant));
317 event->Complete();
318 EXPECT_EQ(1, override.recorder()->CountFor(TimelineEvent::kInstant));
319
320 event = stream.StartEvent();
321 EXPECT_EQ(0, override.recorder()->CountFor(TimelineEvent::kAsyncBegin));
322 int64_t async_id = thread->GetNextTaskId();
323 EXPECT(async_id != 0);
324 event->AsyncBegin("asyncBeginCabbage", async_id);
325 EXPECT_EQ(0, override.recorder()->CountFor(TimelineEvent::kAsyncBegin));
326 event->Complete();
327 EXPECT_EQ(1, override.recorder()->CountFor(TimelineEvent::kAsyncBegin));
328
329 event = stream.StartEvent();
330 EXPECT_EQ(0, override.recorder()->CountFor(TimelineEvent::kAsyncInstant));
331 event->AsyncInstant("asyncInstantCabbage", async_id);
332 EXPECT_EQ(0, override.recorder()->CountFor(TimelineEvent::kAsyncInstant));
333 event->Complete();
334 EXPECT_EQ(1, override.recorder()->CountFor(TimelineEvent::kAsyncInstant));
335
336 event = stream.StartEvent();
337 EXPECT_EQ(0, override.recorder()->CountFor(TimelineEvent::kAsyncEnd));
338 event->AsyncEnd("asyncEndCabbage", async_id);
339 EXPECT_EQ(0, override.recorder()->CountFor(TimelineEvent::kAsyncEnd));
340 event->Complete();
341 EXPECT_EQ(1, override.recorder()->CountFor(TimelineEvent::kAsyncEnd));
342}

◆ TEST_CASE() [587/600]

dart::TEST_CASE ( TimelineEventDuration  )

Definition at line 128 of file timeline_test.cc.

128 {
129 // Create a test stream.
130 TimelineStream stream("testStream", "testStream", false, true);
131
132 // Create a test event.
133 TimelineEvent event;
134 TimelineTestHelper::SetStream(&event, &stream);
135 event.DurationBegin("apple");
136 // Measure the duration.
137 int64_t current_duration = event.TimeDuration();
138 event.SetTimeEnd();
139 // Verify that duration is larger.
140 EXPECT_GE(event.TimeDuration(), current_duration);
141}

◆ TEST_CASE() [588/600]

dart::TEST_CASE ( TimelineEventDurationPrintJSON  )

Definition at line 143 of file timeline_test.cc.

143 {
144 // Create a test stream.
145 TimelineStream stream("testStream", "testStream", false, true);
146
147 // Create a test event.
148 TimelineEvent event;
149 TimelineTestHelper::SetStream(&event, &stream);
150 event.DurationBegin("apple");
151 {
152 // Test printing to JSON.
153 JSONStream js;
154 event.PrintJSON(&js);
155 // Check category
156 EXPECT_SUBSTRING("\"cat\":\"testStream\"", js.ToCString());
157 // Check name.
158 EXPECT_SUBSTRING("\"name\":\"apple\"", js.ToCString());
159 // Check phase.
160 EXPECT_SUBSTRING("\"ph\":\"X\"", js.ToCString());
161 // Check that ts key is present.
162 EXPECT_SUBSTRING("\"ts\":", js.ToCString());
163 // Check that dur key is present.
164 EXPECT_SUBSTRING("\"dur\":", js.ToCString());
165 }
166 event.SetTimeEnd();
167}

◆ TEST_CASE() [589/600]

dart::TEST_CASE ( TimelineEventIsValid  )

Definition at line 109 of file timeline_test.cc.

109 {
110 // Create a test stream.
111 TimelineStream stream("testStream", "testStream", false, true);
112
113 TimelineEvent event;
114 TimelineTestHelper::SetStream(&event, &stream);
115
116 // Starts invalid.
117 EXPECT(!event.IsValid());
118
119 // Becomes valid.
120 event.Instant("hello");
121 EXPECT(event.IsValid());
122
123 // Becomes invalid.
124 event.Reset();
125 EXPECT(!event.IsValid());
126}

◆ TEST_CASE() [590/600]

dart::TEST_CASE ( TimelineRingRecorderJSONOrder  )

Definition at line 344 of file timeline_test.cc.

344 {
345 TimelineStream stream("testStream", "testStream", false, true);
346
347 TimelineEventRingRecorder* recorder =
348 new TimelineEventRingRecorder(TimelineEventBlock::kBlockSize * 2);
350
351 {
352 Mutex& recorder_lock = TimelineTestHelper::GetRecorderLock(*recorder);
353 MutexLocker ml(&recorder_lock);
354 TimelineEventBlock* block_0 = Timeline::recorder()->GetNewBlockLocked();
355 EXPECT(block_0 != nullptr);
356 TimelineEventBlock* block_1 = Timeline::recorder()->GetNewBlockLocked();
357 EXPECT(block_1 != nullptr);
358 // Test that we wrapped.
359 EXPECT(block_0 == Timeline::recorder()->GetNewBlockLocked());
360
361 // Emit the earlier event into block_1.
362 TimelineTestHelper::FakeThreadEvent(block_1, 2, "Alpha", &stream);
363 OS::Sleep(32);
364 // Emit the later event into block_0.
365 TimelineTestHelper::FakeThreadEvent(block_0, 2, "Beta", &stream);
366
367 TimelineTestHelper::FinishBlock(block_0);
368 TimelineTestHelper::FinishBlock(block_1);
369 }
370
371 JSONStream js;
372 TimelineEventFilter filter;
373 Timeline::recorder()->PrintJSON(&js, &filter);
374 // trace-event has a requirement that events for a thread must have
375 // monotonically increasing timestamps.
376 // Verify that "Alpha" comes before "Beta" even though "Beta" is in the first
377 // block.
378 const char* alpha = strstr(js.ToCString(), "Alpha");
379 const char* beta = strstr(js.ToCString(), "Beta");
380 EXPECT(alpha < beta);
381}

◆ TEST_CASE() [591/600]

dart::TEST_CASE ( TimelineRingRecorderRace  )

Definition at line 383 of file timeline_test.cc.

383 {
384 struct ReportEventsArguments {
385 Monitor& synchronization_monitor;
386 TimelineEventRecorder& recorder;
387 ThreadJoinId join_id = OSThread::kInvalidThreadJoinId;
388 };
389
390 // Note that |recorder| will be freed by |TimelineRecorderOverride|'s
391 // destructor.
392 TimelineEventRingRecorder& recorder =
393 *(new TimelineEventRingRecorder(2 * TimelineEventBlock::kBlockSize));
394 TimelineRecorderOverride<TimelineEventRingRecorder> override(&recorder);
395 Monitor synchronization_monitor;
396 JSONStream js;
397 TimelineEventFilter filter;
398 ReportEventsArguments report_events_1_arguments{synchronization_monitor,
399 recorder};
400 ReportEventsArguments report_events_2_arguments{synchronization_monitor,
401 recorder};
402
403 // Try concurrently writing events, serializing them, and clearing the
404 // timeline. It is not possible to assert anything about the outcome, because
405 // of scheduling uncertainty. This test is just used to ensure that TSAN
406 // checks the ring recorder code.
407 OSThread::Start(
408 "ReportEvents1",
409 [](uword arguments_ptr) {
410 ReportEventsArguments& arguments =
411 *reinterpret_cast<ReportEventsArguments*>(arguments_ptr);
412 for (intptr_t i = 0; i < 2 * TimelineEventBlock::kBlockSize; ++i) {
413 TimelineTestHelper::FakeDuration(&arguments.recorder, "testEvent",
414 /*start=*/0, /*end=*/1);
415 }
416 MonitorLocker ml(&arguments.synchronization_monitor);
417 arguments.join_id =
418 OSThread::GetCurrentThreadJoinId(OSThread::Current());
419 ml.Notify();
420 },
421 reinterpret_cast<uword>(&report_events_1_arguments));
422 OSThread::Start(
423 "ReportEvents2",
424 [](uword arguments_ptr) {
425 ReportEventsArguments& arguments =
426 *reinterpret_cast<ReportEventsArguments*>(arguments_ptr);
427 for (intptr_t i = 0; i < 2 * TimelineEventBlock::kBlockSize; ++i) {
428 TimelineTestHelper::FakeDuration(&arguments.recorder, "testEvent",
429 /*start=*/0, /*end=*/1);
430 }
431 MonitorLocker ml(&arguments.synchronization_monitor);
432 arguments.join_id =
433 OSThread::GetCurrentThreadJoinId(OSThread::Current());
434 ml.Notify();
435 },
436 reinterpret_cast<uword>(&report_events_2_arguments));
437 Timeline::Clear();
438 recorder.PrintJSON(&js, &filter);
439
440 MonitorLocker ml(&synchronization_monitor);
441 while (report_events_1_arguments.join_id == OSThread::kInvalidThreadJoinId ||
442 report_events_2_arguments.join_id == OSThread::kInvalidThreadJoinId) {
443 ml.Wait();
444 }
445 OSThread::Join(report_events_1_arguments.join_id);
446 OSThread::Join(report_events_2_arguments.join_id);
447}

◆ TEST_CASE() [592/600]

dart::TEST_CASE ( TimelineTrackMetadataRace  )

Definition at line 455 of file timeline_test.cc.

455 {
456 struct ReportMetadataArguments {
457 Monitor& synchronization_monitor;
458 TimelineEventRecorder& recorder;
459 ThreadJoinId join_id = OSThread::kInvalidThreadJoinId;
460 };
461
462 Monitor synchronization_monitor;
463 TimelineEventRecorder& recorder = *Timeline::recorder();
464
465 // Try concurrently reading from / writing to the metadata map. It is not
466 // possible to assert anything about the outcome, because of scheduling
467 // uncertainty. This test is just used to ensure that TSAN checks the metadata
468 // map code.
469 JSONStream js;
470 TimelineEventFilter filter;
471 ReportMetadataArguments report_metadata_1_arguments{synchronization_monitor,
472 recorder};
473 ReportMetadataArguments report_metadata_2_arguments{synchronization_monitor,
474 recorder};
475 OSThread::Start(
476 "ReportMetadata1",
477 [](uword arguments_ptr) {
478 ReportMetadataArguments& arguments =
479 *reinterpret_cast<ReportMetadataArguments*>(arguments_ptr);
480 arguments.recorder.AddTrackMetadataBasedOnThread(
481 FAKE_PROCESS_ID, FAKE_TRACE_ID, "Thread 1");
482 MonitorLocker ml(&arguments.synchronization_monitor);
483 arguments.join_id =
484 OSThread::GetCurrentThreadJoinId(OSThread::Current());
485 ml.Notify();
486 },
487 reinterpret_cast<uword>(&report_metadata_1_arguments));
488 OSThread::Start(
489 "ReportMetadata2",
490 [](uword arguments_ptr) {
491 ReportMetadataArguments& arguments =
492 *reinterpret_cast<ReportMetadataArguments*>(arguments_ptr);
493 arguments.recorder.AddTrackMetadataBasedOnThread(
494 FAKE_PROCESS_ID, FAKE_TRACE_ID, "Incorrect Name");
495 MonitorLocker ml(&arguments.synchronization_monitor);
496 arguments.join_id =
497 OSThread::GetCurrentThreadJoinId(OSThread::Current());
498 ml.Notify();
499 },
500 reinterpret_cast<uword>(&report_metadata_2_arguments));
501 recorder.PrintJSON(&js, &filter);
502 MonitorLocker ml(&synchronization_monitor);
503 while (
504 report_metadata_1_arguments.join_id == OSThread::kInvalidThreadJoinId ||
505 report_metadata_2_arguments.join_id == OSThread::kInvalidThreadJoinId) {
506 ml.Wait();
507 }
508 OSThread::Join(report_metadata_1_arguments.join_id);
509 OSThread::Join(report_metadata_2_arguments.join_id);
510}
#define FAKE_TRACE_ID
#define FAKE_PROCESS_ID

◆ TEST_CASE() [593/600]

dart::TEST_CASE ( TypeArguments_Cache_ManyInstantiations  )

Definition at line 8190 of file object_test.cc.

8191 {
8193 2 * TypeArguments::Cache::kMaxLinearCacheEntries);
8194}
8195

◆ TEST_CASE() [594/600]

dart::TEST_CASE ( TypeArguments_Cache_SomeInstantiations  )

Definition at line 8180 of file object_test.cc.

8181 : cache.IsHash());
8182 auto const loc =
8183 cache.FindKeyOrUnused(instantiator_type_args, function_type_args);

◆ TEST_CASE() [595/600]

dart::TEST_CASE ( TypeParameterTypeRef  )

Definition at line 7377 of file object_test.cc.

7380 {0, 0x0a, 0x0d, 0x7f, 0xff,
7381 0xffff, 0xd800, 0xdc00, 0xdbff, 0xdfff};
7382
7383 const String& str =
7384 String::Handle(String::FromUTF32(char_codes, ARRAY_SIZE(char_codes)));
7385 EXPECT(str.Equals(char_codes, ARRAY_SIZE(char_codes)));
7386}
7387
7388TEST_CASE(TypeParameterTypeRef) {
7389 // Regression test for issue 82890.
7390 const char* kScriptChars =
7391 "void foo<T extends C<T>>(T x) {}\n"
7392 "void bar<M extends U<M>>(M x) {}\n"
7393 "abstract class C<T> {}\n"
7394 "abstract class U<T> extends C<T> {}\n";
7395 TestCase::LoadTestScript(kScriptChars, nullptr);
7396 TransitionNativeToVM transition(thread);

◆ TEST_CASE() [596/600]

dart::TEST_CASE ( UnhandledExceptions  )

Definition at line 88 of file exceptions_test.cc.

88 {
89 const char* kScriptChars =
90 R"(
91 class UnhandledExceptions {
92 @pragma('vm:external-name', 'Unhandled_equals')
93 external static equals(var obj1, var obj2);

◆ TEST_CASE() [597/600]

dart::TEST_CASE ( ValidateNoSuchMethodStackFrameIteration  )

Definition at line 259 of file stack_frame_test.cc.

259 {
260 const char* kScriptChars;
261 // The true stack depends on which strategy we are using for noSuchMethod. The
262 // stacktrace as seen by Dart is the same either way because dispatcher
263 // methods are marked invisible.
264 if (FLAG_lazy_dispatchers) {
265 kScriptChars =
266 "class StackFrame {"
267 " @pragma('vm:external-name', 'StackFrame_equals')\n"
268 " external static equals(var obj1, var obj2);\n"
269 " @pragma('vm:external-name', 'StackFrame_frameCount')\n"
270 " external static int frameCount();\n"
271 " @pragma('vm:external-name', 'StackFrame_dartFrameCount')\n"
272 " external static int dartFrameCount();\n"
273 " @pragma('vm:external-name', 'StackFrame_validateFrame')\n"
274 " external static validateFrame(int index, String name);"
275 "} "
276 "class StackFrame2Test {"
277 " StackFrame2Test() {}"
278 " noSuchMethod(Invocation im) {"
279 " /* We should have 6 general frames and 4 dart frames as follows:"
280 " * exit frame"
281 " * dart frame corresponding to StackFrame.frameCount"
282 " * dart frame corresponding to StackFrame2Test.noSuchMethod"
283 " * frame for instance function invocation stub calling "
284 "noSuchMethod"
285 " * dart frame corresponding to StackFrame2Test.testMain"
286 " * entry frame"
287 " */"
288 " StackFrame.equals(6, StackFrame.frameCount());"
289 " StackFrame.equals(4, StackFrame.dartFrameCount());"
290 " StackFrame.validateFrame(0, \"StackFrame_validateFrame\");"
291 " StackFrame.validateFrame(1, \"StackFrame2Test_noSuchMethod\");"
292 " StackFrame.validateFrame(2, \"StackFrame2Test_foo\");"
293 " StackFrame.validateFrame(3, \"StackFrame2Test_testMain\");"
294 " return 5;"
295 " }"
296 " static testMain() {"
297 " /* Declare |obj| dynamic so that noSuchMethod can be"
298 " * called in strong mode. */"
299 " dynamic obj = new StackFrame2Test();"
300 " StackFrame.equals(5, obj.foo(101, 202));"
301 " }"
302 "}";
303 } else {
304 kScriptChars =
305 "class StackFrame {"
306 " @pragma('vm:external-name', 'StackFrame_equals')\n"
307 " external static equals(var obj1, var obj2);\n"
308 " @pragma('vm:external-name', 'StackFrame_frameCount')\n"
309 " external static int frameCount();\n"
310 " @pragma('vm:external-name', 'StackFrame_dartFrameCount')\n"
311 " external static int dartFrameCount();\n"
312 " @pragma('vm:external-name', 'StackFrame_validateFrame')\n"
313 " external static validateFrame(int index, String name);"
314 "} "
315 "class StackFrame2Test {"
316 " StackFrame2Test() {}"
317 " noSuchMethod(Invocation im) {"
318 " /* We should have 8 general frames and 3 dart frames as follows:"
319 " * exit frame"
320 " * dart frame corresponding to StackFrame.frameCount"
321 " * dart frame corresponding to StackFrame2Test.noSuchMethod"
322 " * entry frame"
323 " * exit frame (call to runtime NoSuchMethodFromCallStub)"
324 " * IC stub"
325 " * dart frame corresponding to StackFrame2Test.testMain"
326 " * entry frame"
327 " */"
328 " StackFrame.equals(8, StackFrame.frameCount());"
329 " StackFrame.equals(3, StackFrame.dartFrameCount());"
330 " StackFrame.validateFrame(0, \"StackFrame_validateFrame\");"
331 " StackFrame.validateFrame(1, \"StackFrame2Test_noSuchMethod\");"
332 " StackFrame.validateFrame(2, \"StackFrame2Test_testMain\");"
333 " return 5;"
334 " }"
335 " static testMain() {"
336 " /* Declare |obj| dynamic so that noSuchMethod can be"
337 " * called in strong mode. */"
338 " dynamic obj = new StackFrame2Test();"
339 " StackFrame.equals(5, obj.foo(101, 202));"
340 " }"
341 "}";
342 }
343 Dart_Handle lib = TestCase::LoadTestScript(
344 kScriptChars, reinterpret_cast<Dart_NativeEntryResolver>(native_lookup));
345 Dart_Handle cls = Dart_GetClass(lib, NewString("StackFrame2Test"));
346 EXPECT_VALID(Dart_Invoke(cls, NewString("testMain"), 0, nullptr));
347}
Dart_NativeFunction(* Dart_NativeEntryResolver)(Dart_Handle name, int num_of_arguments, bool *auto_setup_scope)
Definition dart_api.h:3225

◆ TEST_CASE() [598/600]

dart::TEST_CASE ( ValidateStackFrameIteration  )

Definition at line 161 of file stack_frame_test.cc.

161 {
162 const char* nullable_tag = TestCase::NullableTag();
163 // clang-format off
164 auto kScriptChars = Utils::CStringUniquePtr(
165 OS::SCreate(
166 nullptr,
167 "class StackFrame {"
168 " @pragma('vm:external-name', 'StackFrame_equals')\n"
169 " external static equals(var obj1, var obj2);\n"
170 " @pragma('vm:external-name', 'StackFrame_frameCount')\n"
171 " external static int frameCount();\n"
172 " @pragma('vm:external-name', 'StackFrame_dartFrameCount')\n"
173 " external static int dartFrameCount();\n"
174 " @pragma('vm:external-name', 'StackFrame_validateFrame')\n"
175 " external static validateFrame(int index, String name);"
176 "} "
177 "class First {"
178 " First() { }"
179 " int%s method1(int%s param) {"
180 " if (param == 1) {"
181 " param = method2(200);"
182 " } else {"
183 " param = method2(100);"
184 " }"
185 " }"
186 " int%s method2(int param) {"
187 " if (param == 200) {"
188 " First.staticmethod(this, param);"
189 " } else {"
190 " First.staticmethod(this, 10);"
191 " }"
192 " }"
193 " static int%s staticmethod(First obj, int param) {"
194 " if (param == 10) {"
195 " obj.method3(10);"
196 " } else {"
197 " obj.method3(200);"
198 " }"
199 " }"
200 " method3(int param) {"
201 " StackFrame.equals(9, StackFrame.frameCount());"
202 " StackFrame.equals(7, StackFrame.dartFrameCount());"
203 " StackFrame.validateFrame(0, \"StackFrame_validateFrame\");"
204 " StackFrame.validateFrame(1, \"First_method3\");"
205 " StackFrame.validateFrame(2, \"First_staticmethod\");"
206 " StackFrame.validateFrame(3, \"First_method2\");"
207 " StackFrame.validateFrame(4, \"First_method1\");"
208 " StackFrame.validateFrame(5, \"Second_method1\");"
209 " StackFrame.validateFrame(6, \"StackFrameTest_testMain\");"
210 " }"
211 "}"
212 "class Second {"
213 " Second() { }"
214 " int%s method1(int%s param) {"
215 " if (param == 1) {"
216 " param = method2(200);"
217 " } else {"
218 " First obj = new First();"
219 " param = obj.method1(1);"
220 " param = obj.method1(2);"
221 " }"
222 " }"
223 " int%s method2(int param) {"
224 " Second.staticmethod(this, param);"
225 " }"
226 " static int%s staticmethod(Second obj, int param) {"
227 " obj.method3(10);"
228 " }"
229 " method3(int param) {"
230 " StackFrame.equals(8, StackFrame.frameCount());"
231 " StackFrame.equals(6, StackFrame.dartFrameCount());"
232 " StackFrame.validateFrame(0, \"StackFrame_validateFrame\");"
233 " StackFrame.validateFrame(1, \"Second_method3\");"
234 " StackFrame.validateFrame(2, \"Second_staticmethod\");"
235 " StackFrame.validateFrame(3, \"Second_method2\");"
236 " StackFrame.validateFrame(4, \"Second_method1\");"
237 " StackFrame.validateFrame(5, \"StackFrameTest_testMain\");"
238 " }"
239 "}"
240 "class StackFrameTest {"
241 " static testMain() {"
242 " Second obj = new Second();"
243 " obj.method1(1);"
244 " obj.method1(2);"
245 " }"
246 "}",
247 nullable_tag, nullable_tag, nullable_tag, nullable_tag, nullable_tag,
248 nullable_tag, nullable_tag, nullable_tag),
249 std::free);
250 // clang-format on
251 Dart_Handle lib = TestCase::LoadTestScript(
252 kScriptChars.get(),
253 reinterpret_cast<Dart_NativeEntryResolver>(native_lookup));
254 Dart_Handle cls = Dart_GetClass(lib, NewString("StackFrameTest"));
255 EXPECT_VALID(Dart_Invoke(cls, NewString("testMain"), 0, nullptr));
256}

◆ TEST_CASE() [599/600]

dart::TEST_CASE ( ZoneCStringSet  )

Definition at line 227 of file hash_map_test.cc.

227 {
228 auto zone = thread->zone();
229
230 const char* const kConst1 = "test";
231 const char* const kConst2 = "test 2";
232
233 char* const str1 = OS::SCreate(zone, "%s", kConst1);
234 char* const str2 = OS::SCreate(zone, "%s", kConst2);
235 char* const str3 = OS::SCreate(zone, "%s", kConst1);
236
237 // Make sure these strings are pointer-distinct, but C-string-equal.
238 EXPECT_NE(str1, str3);
239 EXPECT_STREQ(str1, str3);
240
241 auto const set = new (zone) ZoneCStringSet(zone);
242 EXPECT(set->IsEmpty());
243
244 set->Insert(str1);
245 EXPECT_NOTNULL(set->Lookup(str1));
246 EXPECT_NULLPTR(set->Lookup(str2));
247 EXPECT_NOTNULL(set->Lookup(str3));
248
249 set->Insert(str2);
250 EXPECT_NOTNULL(set->Lookup(str1));
251 EXPECT_NOTNULL(set->Lookup(str2));
252 EXPECT_NOTNULL(set->Lookup(str3));
253
254 EXPECT(set->Remove(str3));
255 EXPECT_NULLPTR(set->Lookup(str1));
256 EXPECT_NOTNULL(set->Lookup(str2));
257 EXPECT_NULLPTR(set->Lookup(str3));
258
259 EXPECT(!set->Remove(str3));
260 EXPECT(set->Remove(str2));
261 EXPECT(set->IsEmpty());
262}

◆ TEST_CASE() [600/600]

dart::TEST_CASE ( ZoneDirectChainedHashMap  )

Definition at line 119 of file hash_map_test.cc.

119 {
120 auto zone = thread->zone();
121 auto const map = new (zone)
123 EXPECT(map->IsEmpty());
124 TestValue v1(0);
125 TestValue v2(1);
126 TestValue v3(0);
127 map->Insert(&v1);
128 EXPECT(map->LookupValue(&v1) == &v1);
129 map->Insert(&v2);
130 EXPECT(map->LookupValue(&v1) == &v1);
131 EXPECT(map->LookupValue(&v2) == &v2);
132 EXPECT(map->LookupValue(&v3) == &v1);
133}

◆ Test_CollectNewSpace()

void FUNCTION_NAME() dart::Test_CollectNewSpace ( Dart_NativeArguments  native_args)

Definition at line 277 of file unit_test.cc.

277 {
278 TransitionNativeToVM transition(Thread::Current());
279 GCTestHelper::CollectNewSpace();
280}

◆ Test_CollectOldSpace()

void FUNCTION_NAME() dart::Test_CollectOldSpace ( Dart_NativeArguments  native_args)

Definition at line 282 of file unit_test.cc.

282 {
283 TransitionNativeToVM transition(Thread::Current());
284 GCTestHelper::CollectOldSpace();
285}

◆ Test_Reload()

void FUNCTION_NAME() dart::Test_Reload ( Dart_NativeArguments  native_args)

Definition at line 269 of file unit_test.cc.

269 {
270 Dart_Handle result = TestCase::TriggerReload(/* kernel_buffer= */ nullptr,
271 /* kernel_buffer_size= */ 0);
272 if (Dart_IsError(result)) {
274 }
275}

◆ TestAliasingViaRedefinition()

static void dart::TestAliasingViaRedefinition ( Thread thread,
bool  make_it_escape,
std::function< Definition *(CompilerState *S, FlowGraph *, Definition *)>  make_redefinition 
)
static

Definition at line 222 of file redundancy_elimination_test.cc.

226 {
227 const char* script_chars = R"(
228 @pragma("vm:external-name", "BlackholeNative")
229 external dynamic blackhole([a, b, c, d, e, f]);
230 class K {
231 var field;
232 }
233 )";
234 const Library& lib =
235 Library::Handle(LoadTestScript(script_chars, NoopNativeLookup));
236
237 const Class& cls = Class::ZoneHandle(
238 lib.LookupClass(String::Handle(Symbols::New(thread, "K"))));
239 const Error& err = Error::Handle(cls.EnsureIsFinalized(thread));
240 EXPECT(err.IsNull());
241
242 const Field& original_field = Field::Handle(
243 cls.LookupField(String::Handle(Symbols::New(thread, "field"))));
244 EXPECT(!original_field.IsNull());
245 const Field& field = Field::Handle(original_field.CloneFromOriginal());
246
247 const Function& blackhole =
248 Function::ZoneHandle(GetFunction(lib, "blackhole"));
249
251 CompilerState S(thread, /*is_aot=*/false, /*is_optimizing=*/true);
253
254 // We are going to build the following graph:
255 //
256 // B0[graph_entry]
257 // B1[function_entry]:
258 // v0 <- AllocateObject(class K)
259 // v1 <- LoadField(v0, K.field)
260 // v2 <- make_redefinition(v0)
261 // MoveArgument(v1)
262 // #if make_it_escape
263 // MoveArgument(v2)
264 // #endif
265 // v3 <- StaticCall(blackhole, v1, v2)
266 // v4 <- LoadField(v2, K.field)
267 // Return v4
268
269 auto b1 = H.flow_graph()->graph_entry()->normal_entry();
271 LoadFieldInstr* v1;
272 StaticCallInstr* call;
274 DartReturnInstr* ret;
275
276 {
277 BlockBuilder builder(H.flow_graph(), b1);
278 auto& slot = Slot::Get(field, &H.flow_graph()->parsed_function());
279 v0 = builder.AddDefinition(
280 new AllocateObjectInstr(InstructionSource(), cls, S.GetNextDeoptId()));
281 v1 = builder.AddDefinition(
282 new LoadFieldInstr(new Value(v0), slot, InstructionSource()));
283 auto v2 = builder.AddDefinition(make_redefinition(&S, H.flow_graph(), v0));
284 InputsArray args(2);
285 args.Add(new Value(v1));
286 if (make_it_escape) {
287 args.Add(new Value(v2));
288 }
289 call = builder.AddInstruction(new StaticCallInstr(
290 InstructionSource(), blackhole, 0, Array::empty_array(),
291 std::move(args), S.GetNextDeoptId(), 0, ICData::RebindRule::kStatic));
292 v4 = builder.AddDefinition(
293 new LoadFieldInstr(new Value(v2), slot, InstructionSource()));
294 ret = builder.AddInstruction(new DartReturnInstr(
295 InstructionSource(), new Value(v4), S.GetNextDeoptId()));
296 }
297 H.FinishGraph();
298 DominatorBasedCSE::Optimize(H.flow_graph());
299
300 if (make_it_escape) {
301 // Allocation must be considered aliased.
302 EXPECT_PROPERTY(v0, !it.Identity().IsNotAliased());
303 } else {
304 // Allocation must be considered not-aliased.
305 EXPECT_PROPERTY(v0, it.Identity().IsNotAliased());
306 }
307
308 // v1 should have been removed from the graph and replaced with constant_null.
309 EXPECT_PROPERTY(v1, it.next() == nullptr && it.previous() == nullptr);
310 EXPECT_PROPERTY(call, it.ArgumentAt(0) == H.flow_graph()->constant_null());
311
312 if (make_it_escape) {
313 // v4 however should not be removed from the graph, because v0 escapes into
314 // blackhole.
315 EXPECT_PROPERTY(v4, it.next() != nullptr && it.previous() != nullptr);
316 EXPECT_PROPERTY(ret, it.value()->definition() == v4);
317 } else {
318 // If v0 it not aliased then v4 should also be removed from the graph.
319 EXPECT_PROPERTY(v4, it.next() == nullptr && it.previous() == nullptr);
321 ret, it.value()->definition() == H.flow_graph()->constant_null());
322 }
323}

◆ TestAliasingViaStore()

static void dart::TestAliasingViaStore ( Thread thread,
bool  make_it_escape,
bool  make_host_escape,
std::function< Definition *(CompilerState *S, FlowGraph *, Definition *)>  make_redefinition 
)
static

Definition at line 386 of file redundancy_elimination_test.cc.

391 {
392 const char* script_chars = R"(
393 @pragma("vm:external-name", "BlackholeNative")
394 external dynamic blackhole([a, b, c, d, e, f]);
395 class K {
396 var field;
397 }
398 )";
399 const Library& lib =
400 Library::Handle(LoadTestScript(script_chars, NoopNativeLookup));
401
402 const Class& cls = Class::ZoneHandle(
403 lib.LookupClass(String::Handle(Symbols::New(thread, "K"))));
404 const Error& err = Error::Handle(cls.EnsureIsFinalized(thread));
405 EXPECT(err.IsNull());
406
407 const Field& original_field = Field::Handle(
408 cls.LookupField(String::Handle(Symbols::New(thread, "field"))));
409 EXPECT(!original_field.IsNull());
410 const Field& field = Field::Handle(original_field.CloneFromOriginal());
411
412 const Function& blackhole =
413 Function::ZoneHandle(GetFunction(lib, "blackhole"));
414
416 CompilerState S(thread, /*is_aot=*/false, /*is_optimizing=*/true);
418
419 // We are going to build the following graph:
420 //
421 // B0[graph_entry]
422 // B1[function_entry]:
423 // v0 <- AllocateObject(class K)
424 // v5 <- AllocateObject(class K)
425 // #if !make_host_escape
426 // StoreField(v5 . K.field = v0)
427 // #endif
428 // v1 <- LoadField(v0, K.field)
429 // v2 <- REDEFINITION(v5)
430 // MoveArgument(v1)
431 // #if make_it_escape
432 // v6 <- LoadField(v2, K.field)
433 // MoveArgument(v6)
434 // #elif make_host_escape
435 // StoreField(v2 . K.field = v0)
436 // MoveArgument(v5)
437 // #endif
438 // v3 <- StaticCall(blackhole, v1, v6)
439 // v4 <- LoadField(v0, K.field)
440 // Return v4
441
442 auto b1 = H.flow_graph()->graph_entry()->normal_entry();
445 LoadFieldInstr* v1;
446 StaticCallInstr* call;
448 DartReturnInstr* ret;
449
450 {
451 BlockBuilder builder(H.flow_graph(), b1);
452 auto& slot = Slot::Get(field, &H.flow_graph()->parsed_function());
453 v0 = builder.AddDefinition(
454 new AllocateObjectInstr(InstructionSource(), cls, S.GetNextDeoptId()));
455 v5 = builder.AddDefinition(
456 new AllocateObjectInstr(InstructionSource(), cls, S.GetNextDeoptId()));
457 if (!make_host_escape) {
458 builder.AddInstruction(
459 new StoreFieldInstr(slot, new Value(v5), new Value(v0),
460 kEmitStoreBarrier, InstructionSource()));
461 }
462 v1 = builder.AddDefinition(
463 new LoadFieldInstr(new Value(v0), slot, InstructionSource()));
464 auto v2 = builder.AddDefinition(make_redefinition(&S, H.flow_graph(), v5));
465 InputsArray args(2);
466 args.Add(new Value(v1));
467 if (make_it_escape) {
468 auto v6 = builder.AddDefinition(
469 new LoadFieldInstr(new Value(v2), slot, InstructionSource()));
470 args.Add(new Value(v6));
471 } else if (make_host_escape) {
472 builder.AddInstruction(
473 new StoreFieldInstr(slot, new Value(v2), new Value(v0),
474 kEmitStoreBarrier, InstructionSource()));
475 args.Add(new Value(v5));
476 }
477 call = builder.AddInstruction(new StaticCallInstr(
478 InstructionSource(), blackhole, 0, Array::empty_array(),
479 std::move(args), S.GetNextDeoptId(), 0, ICData::RebindRule::kStatic));
480 v4 = builder.AddDefinition(
481 new LoadFieldInstr(new Value(v0), slot, InstructionSource()));
482 ret = builder.AddInstruction(new DartReturnInstr(
483 InstructionSource(), new Value(v4), S.GetNextDeoptId()));
484 }
485 H.FinishGraph();
486 DominatorBasedCSE::Optimize(H.flow_graph());
487
488 if (make_it_escape || make_host_escape) {
489 // Allocation must be considered aliased.
490 EXPECT_PROPERTY(v0, !it.Identity().IsNotAliased());
491 } else {
492 // Allocation must not be considered aliased.
493 EXPECT_PROPERTY(v0, it.Identity().IsNotAliased());
494 }
495
496 if (make_host_escape) {
497 EXPECT_PROPERTY(v5, !it.Identity().IsNotAliased());
498 } else {
499 EXPECT_PROPERTY(v5, it.Identity().IsNotAliased());
500 }
501
502 // v1 should have been removed from the graph and replaced with constant_null.
503 EXPECT_PROPERTY(v1, it.next() == nullptr && it.previous() == nullptr);
504 EXPECT_PROPERTY(call, it.ArgumentAt(0) == H.flow_graph()->constant_null());
505
506 if (make_it_escape || make_host_escape) {
507 // v4 however should not be removed from the graph, because v0 escapes into
508 // blackhole.
509 EXPECT_PROPERTY(v4, it.next() != nullptr && it.previous() != nullptr);
510 EXPECT_PROPERTY(ret, it.value()->definition() == v4);
511 } else {
512 // If v0 it not aliased then v4 should also be removed from the graph.
513 EXPECT_PROPERTY(v4, it.next() == nullptr && it.previous() == nullptr);
515 ret, it.value()->definition() == H.flow_graph()->constant_null());
516 }
517}

◆ TestAsyncPassDoublex6Struct16BytesMixedx4Int32()

DART_EXPORT void dart::TestAsyncPassDoublex6Struct16BytesMixedx4Int32 ( void(*)(double a0, double a1, double a2, double a3, double a4, double a5, Struct16BytesMixed a6, Struct16BytesMixed a7, Struct16BytesMixed a8, Struct16BytesMixed a9, int32_t a10)  f)

Definition at line 18201 of file ffi_test_functions_generated.cc.

18213 {
18214 double a0;
18215 double a1;
18216 double a2;
18217 double a3;
18218 double a4;
18219 double a5;
18220 Struct16BytesMixed a6 = {};
18221 Struct16BytesMixed a7 = {};
18222 Struct16BytesMixed a8 = {};
18223 Struct16BytesMixed a9 = {};
18224 int32_t a10;
18225
18226 a0 = -1.0;
18227 a1 = 2.0;
18228 a2 = -3.0;
18229 a3 = 4.0;
18230 a4 = -5.0;
18231 a5 = 6.0;
18232 a6.a0 = -7.0;
18233 a6.a1 = 8;
18234 a7.a0 = -9.0;
18235 a7.a1 = 10;
18236 a8.a0 = -11.0;
18237 a8.a1 = 12;
18238 a9.a0 = -13.0;
18239 a9.a1 = 14;
18240 a10 = -15;
18241
18242 std::cout << "Calling TestAsyncPassDoublex6Struct16BytesMixedx4Int32(" << "("
18243 << a0 << ", " << a1 << ", " << a2 << ", " << a3 << ", " << a4
18244 << ", " << a5 << ", (" << a6.a0 << ", " << a6.a1 << "), (" << a7.a0
18245 << ", " << a7.a1 << "), (" << a8.a0 << ", " << a8.a1 << "), ("
18246 << a9.a0 << ", " << a9.a1 << "), " << a10 << ")" << ")\n";
18247
18248 f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10);
18249}

◆ TestAsyncPassFloatStruct16BytesHomogeneousFloatFloatStruct1()

DART_EXPORT void dart::TestAsyncPassFloatStruct16BytesHomogeneousFloatFloatStruct1 ( void(*)(float a0, Struct16BytesHomogeneousFloat a1, float a2, Struct16BytesHomogeneousFloat a3, float a4, Struct16BytesHomogeneousFloat a5, float a6, Struct16BytesHomogeneousFloat a7, float a8)  f)

Definition at line 18033 of file ffi_test_functions_generated.cc.

18043 {
18044 float a0;
18046 float a2;
18047 Struct16BytesHomogeneousFloat a3 = {};
18048 float a4;
18049 Struct16BytesHomogeneousFloat a5 = {};
18050 float a6;
18051 Struct16BytesHomogeneousFloat a7 = {};
18052 float a8;
18053
18054 a0 = -1.0;
18055 a1.a0 = 2.0;
18056 a1.a1 = -3.0;
18057 a1.a2 = 4.0;
18058 a1.a3 = -5.0;
18059 a2 = 6.0;
18060 a3.a0 = -7.0;
18061 a3.a1 = 8.0;
18062 a3.a2 = -9.0;
18063 a3.a3 = 10.0;
18064 a4 = -11.0;
18065 a5.a0 = 12.0;
18066 a5.a1 = -13.0;
18067 a5.a2 = 14.0;
18068 a5.a3 = -15.0;
18069 a6 = 16.0;
18070 a7.a0 = -17.0;
18071 a7.a1 = 18.0;
18072 a7.a2 = -19.0;
18073 a7.a3 = 20.0;
18074 a8 = -21.0;
18075
18076 std::cout
18077 << "Calling TestAsyncPassFloatStruct16BytesHomogeneousFloatFloatStruct1("
18078 << "(" << a0 << ", (" << a1.a0 << ", " << a1.a1 << ", " << a1.a2 << ", "
18079 << a1.a3 << "), " << a2 << ", (" << a3.a0 << ", " << a3.a1 << ", "
18080 << a3.a2 << ", " << a3.a3 << "), " << a4 << ", (" << a5.a0 << ", "
18081 << a5.a1 << ", " << a5.a2 << ", " << a5.a3 << "), " << a6 << ", ("
18082 << a7.a0 << ", " << a7.a1 << ", " << a7.a2 << ", " << a7.a3 << "), " << a8
18083 << ")" << ")\n";
18084
18085 f(a0, a1, a2, a3, a4, a5, a6, a7, a8);
18086}

◆ TestAsyncPassFloatStruct32BytesHomogeneousDoubleFloatStruct()

DART_EXPORT void dart::TestAsyncPassFloatStruct32BytesHomogeneousDoubleFloatStruct ( void(*)(float a0, Struct32BytesHomogeneousDouble a1, float a2, Struct32BytesHomogeneousDouble a3, float a4, Struct32BytesHomogeneousDouble a5, float a6, Struct32BytesHomogeneousDouble a7, float a8)  f)

Definition at line 18090 of file ffi_test_functions_generated.cc.

18100 {
18101 float a0;
18103 float a2;
18104 Struct32BytesHomogeneousDouble a3 = {};
18105 float a4;
18106 Struct32BytesHomogeneousDouble a5 = {};
18107 float a6;
18108 Struct32BytesHomogeneousDouble a7 = {};
18109 float a8;
18110
18111 a0 = -1.0;
18112 a1.a0 = 2.0;
18113 a1.a1 = -3.0;
18114 a1.a2 = 4.0;
18115 a1.a3 = -5.0;
18116 a2 = 6.0;
18117 a3.a0 = -7.0;
18118 a3.a1 = 8.0;
18119 a3.a2 = -9.0;
18120 a3.a3 = 10.0;
18121 a4 = -11.0;
18122 a5.a0 = 12.0;
18123 a5.a1 = -13.0;
18124 a5.a2 = 14.0;
18125 a5.a3 = -15.0;
18126 a6 = 16.0;
18127 a7.a0 = -17.0;
18128 a7.a1 = 18.0;
18129 a7.a2 = -19.0;
18130 a7.a3 = 20.0;
18131 a8 = -21.0;
18132
18133 std::cout
18134 << "Calling TestAsyncPassFloatStruct32BytesHomogeneousDoubleFloatStruct("
18135 << "(" << a0 << ", (" << a1.a0 << ", " << a1.a1 << ", " << a1.a2 << ", "
18136 << a1.a3 << "), " << a2 << ", (" << a3.a0 << ", " << a3.a1 << ", "
18137 << a3.a2 << ", " << a3.a3 << "), " << a4 << ", (" << a5.a0 << ", "
18138 << a5.a1 << ", " << a5.a2 << ", " << a5.a3 << "), " << a6 << ", ("
18139 << a7.a0 << ", " << a7.a1 << ", " << a7.a2 << ", " << a7.a3 << "), " << a8
18140 << ")" << ")\n";
18141
18142 f(a0, a1, a2, a3, a4, a5, a6, a7, a8);
18143}

◆ TestAsyncPassInt32x4Struct16BytesMixedx4Double()

DART_EXPORT void dart::TestAsyncPassInt32x4Struct16BytesMixedx4Double ( void(*)(int32_t a0, int32_t a1, int32_t a2, int32_t a3, Struct16BytesMixed a4, Struct16BytesMixed a5, Struct16BytesMixed a6, Struct16BytesMixed a7, double a8)  f)

Definition at line 18255 of file ffi_test_functions_generated.cc.

18265 {
18266 int32_t a0;
18267 int32_t a1;
18268 int32_t a2;
18269 int32_t a3;
18270 Struct16BytesMixed a4 = {};
18271 Struct16BytesMixed a5 = {};
18272 Struct16BytesMixed a6 = {};
18273 Struct16BytesMixed a7 = {};
18274 double a8;
18275
18276 a0 = -1;
18277 a1 = 2;
18278 a2 = -3;
18279 a3 = 4;
18280 a4.a0 = -5.0;
18281 a4.a1 = 6;
18282 a5.a0 = -7.0;
18283 a5.a1 = 8;
18284 a6.a0 = -9.0;
18285 a6.a1 = 10;
18286 a7.a0 = -11.0;
18287 a7.a1 = 12;
18288 a8 = -13.0;
18289
18290 std::cout << "Calling TestAsyncPassInt32x4Struct16BytesMixedx4Double(" << "("
18291 << a0 << ", " << a1 << ", " << a2 << ", " << a3 << ", (" << a4.a0
18292 << ", " << a4.a1 << "), (" << a5.a0 << ", " << a5.a1 << "), ("
18293 << a6.a0 << ", " << a6.a1 << "), (" << a7.a0 << ", " << a7.a1
18294 << "), " << a8 << ")" << ")\n";
18295
18296 f(a0, a1, a2, a3, a4, a5, a6, a7, a8);
18297}

◆ TestAsyncPassInt32x8Doublex8Int64Int8Struct1ByteIntInt64Int()

DART_EXPORT void dart::TestAsyncPassInt32x8Doublex8Int64Int8Struct1ByteIntInt64Int ( void(*)(int32_t a0, int32_t a1, int32_t a2, int32_t a3, int32_t a4, int32_t a5, int32_t a6, int32_t a7, double a8, double a9, double a10, double a11, double a12, double a13, double a14, double a15, int64_t a16, int8_t a17, Struct1ByteInt a18, int64_t a19, int8_t a20, Struct4BytesHomogeneousInt16 a21, int64_t a22, int8_t a23, Struct8BytesInt a24, int64_t a25, int8_t a26, Struct8BytesHomogeneousFloat a27, int64_t a28, int8_t a29, Struct8BytesMixed a30, int64_t a31, int8_t a32, StructAlignmentInt16 a33, int64_t a34, int8_t a35, StructAlignmentInt32 a36, int64_t a37, int8_t a38, StructAlignmentInt64 a39)  f)

Definition at line 18332 of file ffi_test_functions_generated.cc.

18373 {
18374 int32_t a0;
18375 int32_t a1;
18376 int32_t a2;
18377 int32_t a3;
18378 int32_t a4;
18379 int32_t a5;
18380 int32_t a6;
18381 int32_t a7;
18382 double a8;
18383 double a9;
18384 double a10;
18385 double a11;
18386 double a12;
18387 double a13;
18388 double a14;
18389 double a15;
18390 int64_t a16;
18391 int8_t a17;
18392 Struct1ByteInt a18 = {};
18393 int64_t a19;
18394 int8_t a20;
18395 Struct4BytesHomogeneousInt16 a21 = {};
18396 int64_t a22;
18397 int8_t a23;
18398 Struct8BytesInt a24 = {};
18399 int64_t a25;
18400 int8_t a26;
18401 Struct8BytesHomogeneousFloat a27 = {};
18402 int64_t a28;
18403 int8_t a29;
18404 Struct8BytesMixed a30 = {};
18405 int64_t a31;
18406 int8_t a32;
18407 StructAlignmentInt16 a33 = {};
18408 int64_t a34;
18409 int8_t a35;
18410 StructAlignmentInt32 a36 = {};
18411 int64_t a37;
18412 int8_t a38;
18413 StructAlignmentInt64 a39 = {};
18414
18415 a0 = -1;
18416 a1 = 2;
18417 a2 = -3;
18418 a3 = 4;
18419 a4 = -5;
18420 a5 = 6;
18421 a6 = -7;
18422 a7 = 8;
18423 a8 = -9.0;
18424 a9 = 10.0;
18425 a10 = -11.0;
18426 a11 = 12.0;
18427 a12 = -13.0;
18428 a13 = 14.0;
18429 a14 = -15.0;
18430 a15 = 16.0;
18431 a16 = -17;
18432 a17 = 18;
18433 a18.a0 = -19;
18434 a19 = 20;
18435 a20 = -21;
18436 a21.a0 = 22;
18437 a21.a1 = -23;
18438 a22 = 24;
18439 a23 = -25;
18440 a24.a0 = 26;
18441 a24.a1 = -27;
18442 a24.a2 = 28;
18443 a25 = -29;
18444 a26 = 30;
18445 a27.a0 = -31.0;
18446 a27.a1 = 32.0;
18447 a28 = -33;
18448 a29 = 34;
18449 a30.a0 = -35.0;
18450 a30.a1 = 36;
18451 a30.a2 = -37;
18452 a31 = 38;
18453 a32 = -39;
18454 a33.a0 = 40;
18455 a33.a1 = -41;
18456 a33.a2 = 42;
18457 a34 = -43;
18458 a35 = 44;
18459 a36.a0 = -45;
18460 a36.a1 = 46;
18461 a36.a2 = -47;
18462 a37 = 48;
18463 a38 = -49;
18464 a39.a0 = 50;
18465 a39.a1 = -51;
18466 a39.a2 = 52;
18467
18468 std::cout
18469 << "Calling TestAsyncPassInt32x8Doublex8Int64Int8Struct1ByteIntInt64Int("
18470 << "(" << a0 << ", " << a1 << ", " << a2 << ", " << a3 << ", " << a4
18471 << ", " << a5 << ", " << a6 << ", " << a7 << ", " << a8 << ", " << a9
18472 << ", " << a10 << ", " << a11 << ", " << a12 << ", " << a13 << ", " << a14
18473 << ", " << a15 << ", " << a16 << ", " << static_cast<int>(a17) << ", ("
18474 << static_cast<int>(a18.a0) << "), " << a19 << ", "
18475 << static_cast<int>(a20) << ", (" << a21.a0 << ", " << a21.a1 << "), "
18476 << a22 << ", " << static_cast<int>(a23) << ", (" << a24.a0 << ", "
18477 << a24.a1 << ", " << a24.a2 << "), " << a25 << ", "
18478 << static_cast<int>(a26) << ", (" << a27.a0 << ", " << a27.a1 << "), "
18479 << a28 << ", " << static_cast<int>(a29) << ", (" << a30.a0 << ", "
18480 << a30.a1 << ", " << a30.a2 << "), " << a31 << ", "
18481 << static_cast<int>(a32) << ", (" << static_cast<int>(a33.a0) << ", "
18482 << a33.a1 << ", " << static_cast<int>(a33.a2) << "), " << a34 << ", "
18483 << static_cast<int>(a35) << ", (" << static_cast<int>(a36.a0) << ", "
18484 << a36.a1 << ", " << static_cast<int>(a36.a2) << "), " << a37 << ", "
18485 << static_cast<int>(a38) << ", (" << static_cast<int>(a39.a0) << ", "
18486 << a39.a1 << ", " << static_cast<int>(a39.a2) << "))" << ")\n";
18487
18488 f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16,
18489 a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27, a28, a29, a30, a31,
18490 a32, a33, a34, a35, a36, a37, a38, a39);
18491}

◆ TestAsyncPassInt64x7Struct12BytesHomogeneousInt32()

DART_EXPORT void dart::TestAsyncPassInt64x7Struct12BytesHomogeneousInt32 ( void(*)(int64_t a0, int64_t a1, int64_t a2, int64_t a3, int64_t a4, int64_t a5, int64_t a6, Struct12BytesHomogeneousInt32 a7)  f)

Definition at line 20702 of file ffi_test_functions_generated.cc.

20711 {
20712 int64_t a0;
20713 int64_t a1;
20714 int64_t a2;
20715 int64_t a3;
20716 int64_t a4;
20717 int64_t a5;
20718 int64_t a6;
20720
20721 a0 = -1;
20722 a1 = 2;
20723 a2 = -3;
20724 a3 = 4;
20725 a4 = -5;
20726 a5 = 6;
20727 a6 = -7;
20728 a7.a0 = 8;
20729 a7.a1 = -9;
20730 a7.a2 = 10;
20731
20732 std::cout << "Calling TestAsyncPassInt64x7Struct12BytesHomogeneousInt32("
20733 << "(" << a0 << ", " << a1 << ", " << a2 << ", " << a3 << ", " << a4
20734 << ", " << a5 << ", " << a6 << ", (" << a7.a0 << ", " << a7.a1
20735 << ", " << a7.a2 << "))" << ")\n";
20736
20737 f(a0, a1, a2, a3, a4, a5, a6, a7);
20738}

◆ TestAsyncPassInt8Struct16BytesMixedInt8Struct16BytesMixedIn()

DART_EXPORT void dart::TestAsyncPassInt8Struct16BytesMixedInt8Struct16BytesMixedIn ( void(*)(int8_t a0, Struct16BytesMixed a1, int8_t a2, Struct16BytesMixed a3, int8_t a4, Struct16BytesMixed a5, int8_t a6, Struct16BytesMixed a7, int8_t a8)  f)

Definition at line 18151 of file ffi_test_functions_generated.cc.

18161 {
18162 int8_t a0;
18163 Struct16BytesMixed a1 = {};
18164 int8_t a2;
18165 Struct16BytesMixed a3 = {};
18166 int8_t a4;
18167 Struct16BytesMixed a5 = {};
18168 int8_t a6;
18169 Struct16BytesMixed a7 = {};
18170 int8_t a8;
18171
18172 a0 = -1;
18173 a1.a0 = 2.0;
18174 a1.a1 = -3;
18175 a2 = 4;
18176 a3.a0 = -5.0;
18177 a3.a1 = 6;
18178 a4 = -7;
18179 a5.a0 = 8.0;
18180 a5.a1 = -9;
18181 a6 = 10;
18182 a7.a0 = -11.0;
18183 a7.a1 = 12;
18184 a8 = -13;
18185
18186 std::cout
18187 << "Calling TestAsyncPassInt8Struct16BytesMixedInt8Struct16BytesMixedIn("
18188 << "(" << static_cast<int>(a0) << ", (" << a1.a0 << ", " << a1.a1 << "), "
18189 << static_cast<int>(a2) << ", (" << a3.a0 << ", " << a3.a1 << "), "
18190 << static_cast<int>(a4) << ", (" << a5.a0 << ", " << a5.a1 << "), "
18191 << static_cast<int>(a6) << ", (" << a7.a0 << ", " << a7.a1 << "), "
18192 << static_cast<int>(a8) << ")" << ")\n";
18193
18194 f(a0, a1, a2, a3, a4, a5, a6, a7, a8);
18195}

◆ TestAsyncPassStruct1024BytesHomogeneousUint64()

DART_EXPORT void dart::TestAsyncPassStruct1024BytesHomogeneousUint64 ( void(*)(Struct1024BytesHomogeneousUint64 a0)  f)

Definition at line 17855 of file ffi_test_functions_generated.cc.

17857 {
17859
17860 a0.a0 = 1;
17861 a0.a1 = 2;
17862 a0.a2 = 3;
17863 a0.a3 = 4;
17864 a0.a4 = 5;
17865 a0.a5 = 6;
17866 a0.a6 = 7;
17867 a0.a7 = 8;
17868 a0.a8 = 9;
17869 a0.a9 = 10;
17870 a0.a10 = 11;
17871 a0.a11 = 12;
17872 a0.a12 = 13;
17873 a0.a13 = 14;
17874 a0.a14 = 15;
17875 a0.a15 = 16;
17876 a0.a16 = 17;
17877 a0.a17 = 18;
17878 a0.a18 = 19;
17879 a0.a19 = 20;
17880 a0.a20 = 21;
17881 a0.a21 = 22;
17882 a0.a22 = 23;
17883 a0.a23 = 24;
17884 a0.a24 = 25;
17885 a0.a25 = 26;
17886 a0.a26 = 27;
17887 a0.a27 = 28;
17888 a0.a28 = 29;
17889 a0.a29 = 30;
17890 a0.a30 = 31;
17891 a0.a31 = 32;
17892 a0.a32 = 33;
17893 a0.a33 = 34;
17894 a0.a34 = 35;
17895 a0.a35 = 36;
17896 a0.a36 = 37;
17897 a0.a37 = 38;
17898 a0.a38 = 39;
17899 a0.a39 = 40;
17900 a0.a40 = 41;
17901 a0.a41 = 42;
17902 a0.a42 = 43;
17903 a0.a43 = 44;
17904 a0.a44 = 45;
17905 a0.a45 = 46;
17906 a0.a46 = 47;
17907 a0.a47 = 48;
17908 a0.a48 = 49;
17909 a0.a49 = 50;
17910 a0.a50 = 51;
17911 a0.a51 = 52;
17912 a0.a52 = 53;
17913 a0.a53 = 54;
17914 a0.a54 = 55;
17915 a0.a55 = 56;
17916 a0.a56 = 57;
17917 a0.a57 = 58;
17918 a0.a58 = 59;
17919 a0.a59 = 60;
17920 a0.a60 = 61;
17921 a0.a61 = 62;
17922 a0.a62 = 63;
17923 a0.a63 = 64;
17924 a0.a64 = 65;
17925 a0.a65 = 66;
17926 a0.a66 = 67;
17927 a0.a67 = 68;
17928 a0.a68 = 69;
17929 a0.a69 = 70;
17930 a0.a70 = 71;
17931 a0.a71 = 72;
17932 a0.a72 = 73;
17933 a0.a73 = 74;
17934 a0.a74 = 75;
17935 a0.a75 = 76;
17936 a0.a76 = 77;
17937 a0.a77 = 78;
17938 a0.a78 = 79;
17939 a0.a79 = 80;
17940 a0.a80 = 81;
17941 a0.a81 = 82;
17942 a0.a82 = 83;
17943 a0.a83 = 84;
17944 a0.a84 = 85;
17945 a0.a85 = 86;
17946 a0.a86 = 87;
17947 a0.a87 = 88;
17948 a0.a88 = 89;
17949 a0.a89 = 90;
17950 a0.a90 = 91;
17951 a0.a91 = 92;
17952 a0.a92 = 93;
17953 a0.a93 = 94;
17954 a0.a94 = 95;
17955 a0.a95 = 96;
17956 a0.a96 = 97;
17957 a0.a97 = 98;
17958 a0.a98 = 99;
17959 a0.a99 = 100;
17960 a0.a100 = 101;
17961 a0.a101 = 102;
17962 a0.a102 = 103;
17963 a0.a103 = 104;
17964 a0.a104 = 105;
17965 a0.a105 = 106;
17966 a0.a106 = 107;
17967 a0.a107 = 108;
17968 a0.a108 = 109;
17969 a0.a109 = 110;
17970 a0.a110 = 111;
17971 a0.a111 = 112;
17972 a0.a112 = 113;
17973 a0.a113 = 114;
17974 a0.a114 = 115;
17975 a0.a115 = 116;
17976 a0.a116 = 117;
17977 a0.a117 = 118;
17978 a0.a118 = 119;
17979 a0.a119 = 120;
17980 a0.a120 = 121;
17981 a0.a121 = 122;
17982 a0.a122 = 123;
17983 a0.a123 = 124;
17984 a0.a124 = 125;
17985 a0.a125 = 126;
17986 a0.a126 = 127;
17987 a0.a127 = 128;
17988
17989 std::cout << "Calling TestAsyncPassStruct1024BytesHomogeneousUint64(" << "(("
17990 << a0.a0 << ", " << a0.a1 << ", " << a0.a2 << ", " << a0.a3 << ", "
17991 << a0.a4 << ", " << a0.a5 << ", " << a0.a6 << ", " << a0.a7 << ", "
17992 << a0.a8 << ", " << a0.a9 << ", " << a0.a10 << ", " << a0.a11
17993 << ", " << a0.a12 << ", " << a0.a13 << ", " << a0.a14 << ", "
17994 << a0.a15 << ", " << a0.a16 << ", " << a0.a17 << ", " << a0.a18
17995 << ", " << a0.a19 << ", " << a0.a20 << ", " << a0.a21 << ", "
17996 << a0.a22 << ", " << a0.a23 << ", " << a0.a24 << ", " << a0.a25
17997 << ", " << a0.a26 << ", " << a0.a27 << ", " << a0.a28 << ", "
17998 << a0.a29 << ", " << a0.a30 << ", " << a0.a31 << ", " << a0.a32
17999 << ", " << a0.a33 << ", " << a0.a34 << ", " << a0.a35 << ", "
18000 << a0.a36 << ", " << a0.a37 << ", " << a0.a38 << ", " << a0.a39
18001 << ", " << a0.a40 << ", " << a0.a41 << ", " << a0.a42 << ", "
18002 << a0.a43 << ", " << a0.a44 << ", " << a0.a45 << ", " << a0.a46
18003 << ", " << a0.a47 << ", " << a0.a48 << ", " << a0.a49 << ", "
18004 << a0.a50 << ", " << a0.a51 << ", " << a0.a52 << ", " << a0.a53
18005 << ", " << a0.a54 << ", " << a0.a55 << ", " << a0.a56 << ", "
18006 << a0.a57 << ", " << a0.a58 << ", " << a0.a59 << ", " << a0.a60
18007 << ", " << a0.a61 << ", " << a0.a62 << ", " << a0.a63 << ", "
18008 << a0.a64 << ", " << a0.a65 << ", " << a0.a66 << ", " << a0.a67
18009 << ", " << a0.a68 << ", " << a0.a69 << ", " << a0.a70 << ", "
18010 << a0.a71 << ", " << a0.a72 << ", " << a0.a73 << ", " << a0.a74
18011 << ", " << a0.a75 << ", " << a0.a76 << ", " << a0.a77 << ", "
18012 << a0.a78 << ", " << a0.a79 << ", " << a0.a80 << ", " << a0.a81
18013 << ", " << a0.a82 << ", " << a0.a83 << ", " << a0.a84 << ", "
18014 << a0.a85 << ", " << a0.a86 << ", " << a0.a87 << ", " << a0.a88
18015 << ", " << a0.a89 << ", " << a0.a90 << ", " << a0.a91 << ", "
18016 << a0.a92 << ", " << a0.a93 << ", " << a0.a94 << ", " << a0.a95
18017 << ", " << a0.a96 << ", " << a0.a97 << ", " << a0.a98 << ", "
18018 << a0.a99 << ", " << a0.a100 << ", " << a0.a101 << ", " << a0.a102
18019 << ", " << a0.a103 << ", " << a0.a104 << ", " << a0.a105 << ", "
18020 << a0.a106 << ", " << a0.a107 << ", " << a0.a108 << ", " << a0.a109
18021 << ", " << a0.a110 << ", " << a0.a111 << ", " << a0.a112 << ", "
18022 << a0.a113 << ", " << a0.a114 << ", " << a0.a115 << ", " << a0.a116
18023 << ", " << a0.a117 << ", " << a0.a118 << ", " << a0.a119 << ", "
18024 << a0.a120 << ", " << a0.a121 << ", " << a0.a122 << ", " << a0.a123
18025 << ", " << a0.a124 << ", " << a0.a125 << ", " << a0.a126 << ", "
18026 << a0.a127 << "))" << ")\n";
18027
18028 f(a0);
18029}

◆ TestAsyncPassStruct12BytesHomogeneousFloatx6()

Definition at line 17033 of file ffi_test_functions_generated.cc.

17040 {
17042 Struct12BytesHomogeneousFloat a1 = {};
17043 Struct12BytesHomogeneousFloat a2 = {};
17044 Struct12BytesHomogeneousFloat a3 = {};
17045 Struct12BytesHomogeneousFloat a4 = {};
17046 Struct12BytesHomogeneousFloat a5 = {};
17047
17048 a0.a0 = -1.0;
17049 a0.a1 = 2.0;
17050 a0.a2 = -3.0;
17051 a1.a0 = 4.0;
17052 a1.a1 = -5.0;
17053 a1.a2 = 6.0;
17054 a2.a0 = -7.0;
17055 a2.a1 = 8.0;
17056 a2.a2 = -9.0;
17057 a3.a0 = 10.0;
17058 a3.a1 = -11.0;
17059 a3.a2 = 12.0;
17060 a4.a0 = -13.0;
17061 a4.a1 = 14.0;
17062 a4.a2 = -15.0;
17063 a5.a0 = 16.0;
17064 a5.a1 = -17.0;
17065 a5.a2 = 18.0;
17066
17067 std::cout << "Calling TestAsyncPassStruct12BytesHomogeneousFloatx6(" << "(("
17068 << a0.a0 << ", " << a0.a1 << ", " << a0.a2 << "), (" << a1.a0
17069 << ", " << a1.a1 << ", " << a1.a2 << "), (" << a2.a0 << ", "
17070 << a2.a1 << ", " << a2.a2 << "), (" << a3.a0 << ", " << a3.a1
17071 << ", " << a3.a2 << "), (" << a4.a0 << ", " << a4.a1 << ", "
17072 << a4.a2 << "), (" << a5.a0 << ", " << a5.a1 << ", " << a5.a2
17073 << "))" << ")\n";
17074
17075 f(a0, a1, a2, a3, a4, a5);
17076}

◆ TestAsyncPassStruct15BytesInlineArrayMixed()

DART_EXPORT void dart::TestAsyncPassStruct15BytesInlineArrayMixed ( void(*)(Struct15BytesInlineArrayMixed a0)  f)

Definition at line 20186 of file ffi_test_functions_generated.cc.

20188 {
20190
20191 a0.a0[0].a0 = -1.0;
20192 a0.a0[0].a1 = 2;
20193 a0.a0[1].a0 = -3.0;
20194 a0.a0[1].a1 = 4;
20195 a0.a0[2].a0 = -5.0;
20196 a0.a0[2].a1 = 6;
20197
20198 std::cout << "Calling TestAsyncPassStruct15BytesInlineArrayMixed(" << "(([("
20199 << a0.a0[0].a0 << ", " << static_cast<int>(a0.a0[0].a1) << "), ("
20200 << a0.a0[1].a0 << ", " << static_cast<int>(a0.a0[1].a1) << "), ("
20201 << a0.a0[2].a0 << ", " << static_cast<int>(a0.a0[2].a1) << ")]))"
20202 << ")\n";
20203
20204 f(a0);
20205}

◆ TestAsyncPassStruct16BytesHomogeneousFloatx5()

Definition at line 17082 of file ffi_test_functions_generated.cc.

17088 {
17090 Struct16BytesHomogeneousFloat a1 = {};
17091 Struct16BytesHomogeneousFloat a2 = {};
17092 Struct16BytesHomogeneousFloat a3 = {};
17093 Struct16BytesHomogeneousFloat a4 = {};
17094
17095 a0.a0 = -1.0;
17096 a0.a1 = 2.0;
17097 a0.a2 = -3.0;
17098 a0.a3 = 4.0;
17099 a1.a0 = -5.0;
17100 a1.a1 = 6.0;
17101 a1.a2 = -7.0;
17102 a1.a3 = 8.0;
17103 a2.a0 = -9.0;
17104 a2.a1 = 10.0;
17105 a2.a2 = -11.0;
17106 a2.a3 = 12.0;
17107 a3.a0 = -13.0;
17108 a3.a1 = 14.0;
17109 a3.a2 = -15.0;
17110 a3.a3 = 16.0;
17111 a4.a0 = -17.0;
17112 a4.a1 = 18.0;
17113 a4.a2 = -19.0;
17114 a4.a3 = 20.0;
17115
17116 std::cout << "Calling TestAsyncPassStruct16BytesHomogeneousFloatx5(" << "(("
17117 << a0.a0 << ", " << a0.a1 << ", " << a0.a2 << ", " << a0.a3
17118 << "), (" << a1.a0 << ", " << a1.a1 << ", " << a1.a2 << ", "
17119 << a1.a3 << "), (" << a2.a0 << ", " << a2.a1 << ", " << a2.a2
17120 << ", " << a2.a3 << "), (" << a3.a0 << ", " << a3.a1 << ", "
17121 << a3.a2 << ", " << a3.a3 << "), (" << a4.a0 << ", " << a4.a1
17122 << ", " << a4.a2 << ", " << a4.a3 << "))" << ")\n";
17123
17124 f(a0, a1, a2, a3, a4);
17125}

◆ TestAsyncPassStruct16BytesMixed2x10()

Definition at line 17192 of file ffi_test_functions_generated.cc.

17203 {
17204 Struct16BytesMixed2 a0 = {};
17205 Struct16BytesMixed2 a1 = {};
17206 Struct16BytesMixed2 a2 = {};
17207 Struct16BytesMixed2 a3 = {};
17208 Struct16BytesMixed2 a4 = {};
17209 Struct16BytesMixed2 a5 = {};
17210 Struct16BytesMixed2 a6 = {};
17211 Struct16BytesMixed2 a7 = {};
17212 Struct16BytesMixed2 a8 = {};
17213 Struct16BytesMixed2 a9 = {};
17214
17215 a0.a0 = -1.0;
17216 a0.a1 = 2.0;
17217 a0.a2 = -3.0;
17218 a0.a3 = 4;
17219 a1.a0 = -5.0;
17220 a1.a1 = 6.0;
17221 a1.a2 = -7.0;
17222 a1.a3 = 8;
17223 a2.a0 = -9.0;
17224 a2.a1 = 10.0;
17225 a2.a2 = -11.0;
17226 a2.a3 = 12;
17227 a3.a0 = -13.0;
17228 a3.a1 = 14.0;
17229 a3.a2 = -15.0;
17230 a3.a3 = 16;
17231 a4.a0 = -17.0;
17232 a4.a1 = 18.0;
17233 a4.a2 = -19.0;
17234 a4.a3 = 20;
17235 a5.a0 = -21.0;
17236 a5.a1 = 22.0;
17237 a5.a2 = -23.0;
17238 a5.a3 = 24;
17239 a6.a0 = -25.0;
17240 a6.a1 = 26.0;
17241 a6.a2 = -27.0;
17242 a6.a3 = 28;
17243 a7.a0 = -29.0;
17244 a7.a1 = 30.0;
17245 a7.a2 = -31.0;
17246 a7.a3 = 32;
17247 a8.a0 = -33.0;
17248 a8.a1 = 34.0;
17249 a8.a2 = -35.0;
17250 a8.a3 = 36;
17251 a9.a0 = -37.0;
17252 a9.a1 = 38.0;
17253 a9.a2 = -39.0;
17254 a9.a3 = 40;
17255
17256 std::cout << "Calling TestAsyncPassStruct16BytesMixed2x10(" << "((" << a0.a0
17257 << ", " << a0.a1 << ", " << a0.a2 << ", " << a0.a3 << "), ("
17258 << a1.a0 << ", " << a1.a1 << ", " << a1.a2 << ", " << a1.a3
17259 << "), (" << a2.a0 << ", " << a2.a1 << ", " << a2.a2 << ", "
17260 << a2.a3 << "), (" << a3.a0 << ", " << a3.a1 << ", " << a3.a2
17261 << ", " << a3.a3 << "), (" << a4.a0 << ", " << a4.a1 << ", "
17262 << a4.a2 << ", " << a4.a3 << "), (" << a5.a0 << ", " << a5.a1
17263 << ", " << a5.a2 << ", " << a5.a3 << "), (" << a6.a0 << ", "
17264 << a6.a1 << ", " << a6.a2 << ", " << a6.a3 << "), (" << a7.a0
17265 << ", " << a7.a1 << ", " << a7.a2 << ", " << a7.a3 << "), ("
17266 << a8.a0 << ", " << a8.a1 << ", " << a8.a2 << ", " << a8.a3
17267 << "), (" << a9.a0 << ", " << a9.a1 << ", " << a9.a2 << ", "
17268 << a9.a3 << "))" << ")\n";
17269
17270 f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
17271}

◆ TestAsyncPassStruct16BytesMixedx10()

Definition at line 17132 of file ffi_test_functions_generated.cc.

17143 {
17144 Struct16BytesMixed a0 = {};
17145 Struct16BytesMixed a1 = {};
17146 Struct16BytesMixed a2 = {};
17147 Struct16BytesMixed a3 = {};
17148 Struct16BytesMixed a4 = {};
17149 Struct16BytesMixed a5 = {};
17150 Struct16BytesMixed a6 = {};
17151 Struct16BytesMixed a7 = {};
17152 Struct16BytesMixed a8 = {};
17153 Struct16BytesMixed a9 = {};
17154
17155 a0.a0 = -1.0;
17156 a0.a1 = 2;
17157 a1.a0 = -3.0;
17158 a1.a1 = 4;
17159 a2.a0 = -5.0;
17160 a2.a1 = 6;
17161 a3.a0 = -7.0;
17162 a3.a1 = 8;
17163 a4.a0 = -9.0;
17164 a4.a1 = 10;
17165 a5.a0 = -11.0;
17166 a5.a1 = 12;
17167 a6.a0 = -13.0;
17168 a6.a1 = 14;
17169 a7.a0 = -15.0;
17170 a7.a1 = 16;
17171 a8.a0 = -17.0;
17172 a8.a1 = 18;
17173 a9.a0 = -19.0;
17174 a9.a1 = 20;
17175
17176 std::cout << "Calling TestAsyncPassStruct16BytesMixedx10(" << "((" << a0.a0
17177 << ", " << a0.a1 << "), (" << a1.a0 << ", " << a1.a1 << "), ("
17178 << a2.a0 << ", " << a2.a1 << "), (" << a3.a0 << ", " << a3.a1
17179 << "), (" << a4.a0 << ", " << a4.a1 << "), (" << a5.a0 << ", "
17180 << a5.a1 << "), (" << a6.a0 << ", " << a6.a1 << "), (" << a7.a0
17181 << ", " << a7.a1 << "), (" << a8.a0 << ", " << a8.a1 << "), ("
17182 << a9.a0 << ", " << a9.a1 << "))" << ")\n";
17183
17184 f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
17185}

◆ TestAsyncPassStruct16BytesNestedIntx2()

DART_EXPORT void dart::TestAsyncPassStruct16BytesNestedIntx2 ( void(*)(Struct16BytesNestedInt a0, Struct16BytesNestedInt a1)  f)

Definition at line 18829 of file ffi_test_functions_generated.cc.

18831 {
18832 Struct16BytesNestedInt a0 = {};
18833 Struct16BytesNestedInt a1 = {};
18834
18835 a0.a0.a0.a0 = -1;
18836 a0.a0.a0.a1 = 2;
18837 a0.a0.a1.a0 = -3;
18838 a0.a0.a1.a1 = 4;
18839 a0.a1.a0.a0 = -5;
18840 a0.a1.a0.a1 = 6;
18841 a0.a1.a1.a0 = -7;
18842 a0.a1.a1.a1 = 8;
18843 a1.a0.a0.a0 = -9;
18844 a1.a0.a0.a1 = 10;
18845 a1.a0.a1.a0 = -11;
18846 a1.a0.a1.a1 = 12;
18847 a1.a1.a0.a0 = -13;
18848 a1.a1.a0.a1 = 14;
18849 a1.a1.a1.a0 = -15;
18850 a1.a1.a1.a1 = 16;
18851
18852 std::cout << "Calling TestAsyncPassStruct16BytesNestedIntx2(" << "(((("
18853 << a0.a0.a0.a0 << ", " << a0.a0.a0.a1 << "), (" << a0.a0.a1.a0
18854 << ", " << a0.a0.a1.a1 << ")), ((" << a0.a1.a0.a0 << ", "
18855 << a0.a1.a0.a1 << "), (" << a0.a1.a1.a0 << ", " << a0.a1.a1.a1
18856 << "))), (((" << a1.a0.a0.a0 << ", " << a1.a0.a0.a1 << "), ("
18857 << a1.a0.a1.a0 << ", " << a1.a0.a1.a1 << ")), ((" << a1.a1.a0.a0
18858 << ", " << a1.a1.a0.a1 << "), (" << a1.a1.a1.a0 << ", "
18859 << a1.a1.a1.a1 << "))))" << ")\n";
18860
18861 f(a0, a1);
18862}

◆ TestAsyncPassStruct17BytesIntx10()

Definition at line 17276 of file ffi_test_functions_generated.cc.

17287 {
17288 Struct17BytesInt a0 = {};
17289 Struct17BytesInt a1 = {};
17290 Struct17BytesInt a2 = {};
17291 Struct17BytesInt a3 = {};
17292 Struct17BytesInt a4 = {};
17293 Struct17BytesInt a5 = {};
17294 Struct17BytesInt a6 = {};
17295 Struct17BytesInt a7 = {};
17296 Struct17BytesInt a8 = {};
17297 Struct17BytesInt a9 = {};
17298
17299 a0.a0 = -1;
17300 a0.a1 = 2;
17301 a0.a2 = -3;
17302 a1.a0 = 4;
17303 a1.a1 = -5;
17304 a1.a2 = 6;
17305 a2.a0 = -7;
17306 a2.a1 = 8;
17307 a2.a2 = -9;
17308 a3.a0 = 10;
17309 a3.a1 = -11;
17310 a3.a2 = 12;
17311 a4.a0 = -13;
17312 a4.a1 = 14;
17313 a4.a2 = -15;
17314 a5.a0 = 16;
17315 a5.a1 = -17;
17316 a5.a2 = 18;
17317 a6.a0 = -19;
17318 a6.a1 = 20;
17319 a6.a2 = -21;
17320 a7.a0 = 22;
17321 a7.a1 = -23;
17322 a7.a2 = 24;
17323 a8.a0 = -25;
17324 a8.a1 = 26;
17325 a8.a2 = -27;
17326 a9.a0 = 28;
17327 a9.a1 = -29;
17328 a9.a2 = 30;
17329
17330 std::cout << "Calling TestAsyncPassStruct17BytesIntx10(" << "((" << a0.a0
17331 << ", " << a0.a1 << ", " << static_cast<int>(a0.a2) << "), ("
17332 << a1.a0 << ", " << a1.a1 << ", " << static_cast<int>(a1.a2)
17333 << "), (" << a2.a0 << ", " << a2.a1 << ", "
17334 << static_cast<int>(a2.a2) << "), (" << a3.a0 << ", " << a3.a1
17335 << ", " << static_cast<int>(a3.a2) << "), (" << a4.a0 << ", "
17336 << a4.a1 << ", " << static_cast<int>(a4.a2) << "), (" << a5.a0
17337 << ", " << a5.a1 << ", " << static_cast<int>(a5.a2) << "), ("
17338 << a6.a0 << ", " << a6.a1 << ", " << static_cast<int>(a6.a2)
17339 << "), (" << a7.a0 << ", " << a7.a1 << ", "
17340 << static_cast<int>(a7.a2) << "), (" << a8.a0 << ", " << a8.a1
17341 << ", " << static_cast<int>(a8.a2) << "), (" << a9.a0 << ", "
17342 << a9.a1 << ", " << static_cast<int>(a9.a2) << "))" << ")\n";
17343
17344 f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
17345}

◆ TestAsyncPassStruct19BytesHomogeneousUint8x10()

Definition at line 17351 of file ffi_test_functions_generated.cc.

17362 {
17364 Struct19BytesHomogeneousUint8 a1 = {};
17365 Struct19BytesHomogeneousUint8 a2 = {};
17366 Struct19BytesHomogeneousUint8 a3 = {};
17367 Struct19BytesHomogeneousUint8 a4 = {};
17368 Struct19BytesHomogeneousUint8 a5 = {};
17369 Struct19BytesHomogeneousUint8 a6 = {};
17370 Struct19BytesHomogeneousUint8 a7 = {};
17371 Struct19BytesHomogeneousUint8 a8 = {};
17372 Struct19BytesHomogeneousUint8 a9 = {};
17373
17374 a0.a0 = 1;
17375 a0.a1 = 2;
17376 a0.a2 = 3;
17377 a0.a3 = 4;
17378 a0.a4 = 5;
17379 a0.a5 = 6;
17380 a0.a6 = 7;
17381 a0.a7 = 8;
17382 a0.a8 = 9;
17383 a0.a9 = 10;
17384 a0.a10 = 11;
17385 a0.a11 = 12;
17386 a0.a12 = 13;
17387 a0.a13 = 14;
17388 a0.a14 = 15;
17389 a0.a15 = 16;
17390 a0.a16 = 17;
17391 a0.a17 = 18;
17392 a0.a18 = 19;
17393 a1.a0 = 20;
17394 a1.a1 = 21;
17395 a1.a2 = 22;
17396 a1.a3 = 23;
17397 a1.a4 = 24;
17398 a1.a5 = 25;
17399 a1.a6 = 26;
17400 a1.a7 = 27;
17401 a1.a8 = 28;
17402 a1.a9 = 29;
17403 a1.a10 = 30;
17404 a1.a11 = 31;
17405 a1.a12 = 32;
17406 a1.a13 = 33;
17407 a1.a14 = 34;
17408 a1.a15 = 35;
17409 a1.a16 = 36;
17410 a1.a17 = 37;
17411 a1.a18 = 38;
17412 a2.a0 = 39;
17413 a2.a1 = 40;
17414 a2.a2 = 41;
17415 a2.a3 = 42;
17416 a2.a4 = 43;
17417 a2.a5 = 44;
17418 a2.a6 = 45;
17419 a2.a7 = 46;
17420 a2.a8 = 47;
17421 a2.a9 = 48;
17422 a2.a10 = 49;
17423 a2.a11 = 50;
17424 a2.a12 = 51;
17425 a2.a13 = 52;
17426 a2.a14 = 53;
17427 a2.a15 = 54;
17428 a2.a16 = 55;
17429 a2.a17 = 56;
17430 a2.a18 = 57;
17431 a3.a0 = 58;
17432 a3.a1 = 59;
17433 a3.a2 = 60;
17434 a3.a3 = 61;
17435 a3.a4 = 62;
17436 a3.a5 = 63;
17437 a3.a6 = 64;
17438 a3.a7 = 65;
17439 a3.a8 = 66;
17440 a3.a9 = 67;
17441 a3.a10 = 68;
17442 a3.a11 = 69;
17443 a3.a12 = 70;
17444 a3.a13 = 71;
17445 a3.a14 = 72;
17446 a3.a15 = 73;
17447 a3.a16 = 74;
17448 a3.a17 = 75;
17449 a3.a18 = 76;
17450 a4.a0 = 77;
17451 a4.a1 = 78;
17452 a4.a2 = 79;
17453 a4.a3 = 80;
17454 a4.a4 = 81;
17455 a4.a5 = 82;
17456 a4.a6 = 83;
17457 a4.a7 = 84;
17458 a4.a8 = 85;
17459 a4.a9 = 86;
17460 a4.a10 = 87;
17461 a4.a11 = 88;
17462 a4.a12 = 89;
17463 a4.a13 = 90;
17464 a4.a14 = 91;
17465 a4.a15 = 92;
17466 a4.a16 = 93;
17467 a4.a17 = 94;
17468 a4.a18 = 95;
17469 a5.a0 = 96;
17470 a5.a1 = 97;
17471 a5.a2 = 98;
17472 a5.a3 = 99;
17473 a5.a4 = 100;
17474 a5.a5 = 101;
17475 a5.a6 = 102;
17476 a5.a7 = 103;
17477 a5.a8 = 104;
17478 a5.a9 = 105;
17479 a5.a10 = 106;
17480 a5.a11 = 107;
17481 a5.a12 = 108;
17482 a5.a13 = 109;
17483 a5.a14 = 110;
17484 a5.a15 = 111;
17485 a5.a16 = 112;
17486 a5.a17 = 113;
17487 a5.a18 = 114;
17488 a6.a0 = 115;
17489 a6.a1 = 116;
17490 a6.a2 = 117;
17491 a6.a3 = 118;
17492 a6.a4 = 119;
17493 a6.a5 = 120;
17494 a6.a6 = 121;
17495 a6.a7 = 122;
17496 a6.a8 = 123;
17497 a6.a9 = 124;
17498 a6.a10 = 125;
17499 a6.a11 = 126;
17500 a6.a12 = 127;
17501 a6.a13 = 128;
17502 a6.a14 = 129;
17503 a6.a15 = 130;
17504 a6.a16 = 131;
17505 a6.a17 = 132;
17506 a6.a18 = 133;
17507 a7.a0 = 134;
17508 a7.a1 = 135;
17509 a7.a2 = 136;
17510 a7.a3 = 137;
17511 a7.a4 = 138;
17512 a7.a5 = 139;
17513 a7.a6 = 140;
17514 a7.a7 = 141;
17515 a7.a8 = 142;
17516 a7.a9 = 143;
17517 a7.a10 = 144;
17518 a7.a11 = 145;
17519 a7.a12 = 146;
17520 a7.a13 = 147;
17521 a7.a14 = 148;
17522 a7.a15 = 149;
17523 a7.a16 = 150;
17524 a7.a17 = 151;
17525 a7.a18 = 152;
17526 a8.a0 = 153;
17527 a8.a1 = 154;
17528 a8.a2 = 155;
17529 a8.a3 = 156;
17530 a8.a4 = 157;
17531 a8.a5 = 158;
17532 a8.a6 = 159;
17533 a8.a7 = 160;
17534 a8.a8 = 161;
17535 a8.a9 = 162;
17536 a8.a10 = 163;
17537 a8.a11 = 164;
17538 a8.a12 = 165;
17539 a8.a13 = 166;
17540 a8.a14 = 167;
17541 a8.a15 = 168;
17542 a8.a16 = 169;
17543 a8.a17 = 170;
17544 a8.a18 = 171;
17545 a9.a0 = 172;
17546 a9.a1 = 173;
17547 a9.a2 = 174;
17548 a9.a3 = 175;
17549 a9.a4 = 176;
17550 a9.a5 = 177;
17551 a9.a6 = 178;
17552 a9.a7 = 179;
17553 a9.a8 = 180;
17554 a9.a9 = 181;
17555 a9.a10 = 182;
17556 a9.a11 = 183;
17557 a9.a12 = 184;
17558 a9.a13 = 185;
17559 a9.a14 = 186;
17560 a9.a15 = 187;
17561 a9.a16 = 188;
17562 a9.a17 = 189;
17563 a9.a18 = 190;
17564
17565 std::cout
17566 << "Calling TestAsyncPassStruct19BytesHomogeneousUint8x10(" << "(("
17567 << static_cast<int>(a0.a0) << ", " << static_cast<int>(a0.a1) << ", "
17568 << static_cast<int>(a0.a2) << ", " << static_cast<int>(a0.a3) << ", "
17569 << static_cast<int>(a0.a4) << ", " << static_cast<int>(a0.a5) << ", "
17570 << static_cast<int>(a0.a6) << ", " << static_cast<int>(a0.a7) << ", "
17571 << static_cast<int>(a0.a8) << ", " << static_cast<int>(a0.a9) << ", "
17572 << static_cast<int>(a0.a10) << ", " << static_cast<int>(a0.a11) << ", "
17573 << static_cast<int>(a0.a12) << ", " << static_cast<int>(a0.a13) << ", "
17574 << static_cast<int>(a0.a14) << ", " << static_cast<int>(a0.a15) << ", "
17575 << static_cast<int>(a0.a16) << ", " << static_cast<int>(a0.a17) << ", "
17576 << static_cast<int>(a0.a18) << "), (" << static_cast<int>(a1.a0) << ", "
17577 << static_cast<int>(a1.a1) << ", " << static_cast<int>(a1.a2) << ", "
17578 << static_cast<int>(a1.a3) << ", " << static_cast<int>(a1.a4) << ", "
17579 << static_cast<int>(a1.a5) << ", " << static_cast<int>(a1.a6) << ", "
17580 << static_cast<int>(a1.a7) << ", " << static_cast<int>(a1.a8) << ", "
17581 << static_cast<int>(a1.a9) << ", " << static_cast<int>(a1.a10) << ", "
17582 << static_cast<int>(a1.a11) << ", " << static_cast<int>(a1.a12) << ", "
17583 << static_cast<int>(a1.a13) << ", " << static_cast<int>(a1.a14) << ", "
17584 << static_cast<int>(a1.a15) << ", " << static_cast<int>(a1.a16) << ", "
17585 << static_cast<int>(a1.a17) << ", " << static_cast<int>(a1.a18) << "), ("
17586 << static_cast<int>(a2.a0) << ", " << static_cast<int>(a2.a1) << ", "
17587 << static_cast<int>(a2.a2) << ", " << static_cast<int>(a2.a3) << ", "
17588 << static_cast<int>(a2.a4) << ", " << static_cast<int>(a2.a5) << ", "
17589 << static_cast<int>(a2.a6) << ", " << static_cast<int>(a2.a7) << ", "
17590 << static_cast<int>(a2.a8) << ", " << static_cast<int>(a2.a9) << ", "
17591 << static_cast<int>(a2.a10) << ", " << static_cast<int>(a2.a11) << ", "
17592 << static_cast<int>(a2.a12) << ", " << static_cast<int>(a2.a13) << ", "
17593 << static_cast<int>(a2.a14) << ", " << static_cast<int>(a2.a15) << ", "
17594 << static_cast<int>(a2.a16) << ", " << static_cast<int>(a2.a17) << ", "
17595 << static_cast<int>(a2.a18) << "), (" << static_cast<int>(a3.a0) << ", "
17596 << static_cast<int>(a3.a1) << ", " << static_cast<int>(a3.a2) << ", "
17597 << static_cast<int>(a3.a3) << ", " << static_cast<int>(a3.a4) << ", "
17598 << static_cast<int>(a3.a5) << ", " << static_cast<int>(a3.a6) << ", "
17599 << static_cast<int>(a3.a7) << ", " << static_cast<int>(a3.a8) << ", "
17600 << static_cast<int>(a3.a9) << ", " << static_cast<int>(a3.a10) << ", "
17601 << static_cast<int>(a3.a11) << ", " << static_cast<int>(a3.a12) << ", "
17602 << static_cast<int>(a3.a13) << ", " << static_cast<int>(a3.a14) << ", "
17603 << static_cast<int>(a3.a15) << ", " << static_cast<int>(a3.a16) << ", "
17604 << static_cast<int>(a3.a17) << ", " << static_cast<int>(a3.a18) << "), ("
17605 << static_cast<int>(a4.a0) << ", " << static_cast<int>(a4.a1) << ", "
17606 << static_cast<int>(a4.a2) << ", " << static_cast<int>(a4.a3) << ", "
17607 << static_cast<int>(a4.a4) << ", " << static_cast<int>(a4.a5) << ", "
17608 << static_cast<int>(a4.a6) << ", " << static_cast<int>(a4.a7) << ", "
17609 << static_cast<int>(a4.a8) << ", " << static_cast<int>(a4.a9) << ", "
17610 << static_cast<int>(a4.a10) << ", " << static_cast<int>(a4.a11) << ", "
17611 << static_cast<int>(a4.a12) << ", " << static_cast<int>(a4.a13) << ", "
17612 << static_cast<int>(a4.a14) << ", " << static_cast<int>(a4.a15) << ", "
17613 << static_cast<int>(a4.a16) << ", " << static_cast<int>(a4.a17) << ", "
17614 << static_cast<int>(a4.a18) << "), (" << static_cast<int>(a5.a0) << ", "
17615 << static_cast<int>(a5.a1) << ", " << static_cast<int>(a5.a2) << ", "
17616 << static_cast<int>(a5.a3) << ", " << static_cast<int>(a5.a4) << ", "
17617 << static_cast<int>(a5.a5) << ", " << static_cast<int>(a5.a6) << ", "
17618 << static_cast<int>(a5.a7) << ", " << static_cast<int>(a5.a8) << ", "
17619 << static_cast<int>(a5.a9) << ", " << static_cast<int>(a5.a10) << ", "
17620 << static_cast<int>(a5.a11) << ", " << static_cast<int>(a5.a12) << ", "
17621 << static_cast<int>(a5.a13) << ", " << static_cast<int>(a5.a14) << ", "
17622 << static_cast<int>(a5.a15) << ", " << static_cast<int>(a5.a16) << ", "
17623 << static_cast<int>(a5.a17) << ", " << static_cast<int>(a5.a18) << "), ("
17624 << static_cast<int>(a6.a0) << ", " << static_cast<int>(a6.a1) << ", "
17625 << static_cast<int>(a6.a2) << ", " << static_cast<int>(a6.a3) << ", "
17626 << static_cast<int>(a6.a4) << ", " << static_cast<int>(a6.a5) << ", "
17627 << static_cast<int>(a6.a6) << ", " << static_cast<int>(a6.a7) << ", "
17628 << static_cast<int>(a6.a8) << ", " << static_cast<int>(a6.a9) << ", "
17629 << static_cast<int>(a6.a10) << ", " << static_cast<int>(a6.a11) << ", "
17630 << static_cast<int>(a6.a12) << ", " << static_cast<int>(a6.a13) << ", "
17631 << static_cast<int>(a6.a14) << ", " << static_cast<int>(a6.a15) << ", "
17632 << static_cast<int>(a6.a16) << ", " << static_cast<int>(a6.a17) << ", "
17633 << static_cast<int>(a6.a18) << "), (" << static_cast<int>(a7.a0) << ", "
17634 << static_cast<int>(a7.a1) << ", " << static_cast<int>(a7.a2) << ", "
17635 << static_cast<int>(a7.a3) << ", " << static_cast<int>(a7.a4) << ", "
17636 << static_cast<int>(a7.a5) << ", " << static_cast<int>(a7.a6) << ", "
17637 << static_cast<int>(a7.a7) << ", " << static_cast<int>(a7.a8) << ", "
17638 << static_cast<int>(a7.a9) << ", " << static_cast<int>(a7.a10) << ", "
17639 << static_cast<int>(a7.a11) << ", " << static_cast<int>(a7.a12) << ", "
17640 << static_cast<int>(a7.a13) << ", " << static_cast<int>(a7.a14) << ", "
17641 << static_cast<int>(a7.a15) << ", " << static_cast<int>(a7.a16) << ", "
17642 << static_cast<int>(a7.a17) << ", " << static_cast<int>(a7.a18) << "), ("
17643 << static_cast<int>(a8.a0) << ", " << static_cast<int>(a8.a1) << ", "
17644 << static_cast<int>(a8.a2) << ", " << static_cast<int>(a8.a3) << ", "
17645 << static_cast<int>(a8.a4) << ", " << static_cast<int>(a8.a5) << ", "
17646 << static_cast<int>(a8.a6) << ", " << static_cast<int>(a8.a7) << ", "
17647 << static_cast<int>(a8.a8) << ", " << static_cast<int>(a8.a9) << ", "
17648 << static_cast<int>(a8.a10) << ", " << static_cast<int>(a8.a11) << ", "
17649 << static_cast<int>(a8.a12) << ", " << static_cast<int>(a8.a13) << ", "
17650 << static_cast<int>(a8.a14) << ", " << static_cast<int>(a8.a15) << ", "
17651 << static_cast<int>(a8.a16) << ", " << static_cast<int>(a8.a17) << ", "
17652 << static_cast<int>(a8.a18) << "), (" << static_cast<int>(a9.a0) << ", "
17653 << static_cast<int>(a9.a1) << ", " << static_cast<int>(a9.a2) << ", "
17654 << static_cast<int>(a9.a3) << ", " << static_cast<int>(a9.a4) << ", "
17655 << static_cast<int>(a9.a5) << ", " << static_cast<int>(a9.a6) << ", "
17656 << static_cast<int>(a9.a7) << ", " << static_cast<int>(a9.a8) << ", "
17657 << static_cast<int>(a9.a9) << ", " << static_cast<int>(a9.a10) << ", "
17658 << static_cast<int>(a9.a11) << ", " << static_cast<int>(a9.a12) << ", "
17659 << static_cast<int>(a9.a13) << ", " << static_cast<int>(a9.a14) << ", "
17660 << static_cast<int>(a9.a15) << ", " << static_cast<int>(a9.a16) << ", "
17661 << static_cast<int>(a9.a17) << ", " << static_cast<int>(a9.a18) << "))"
17662 << ")\n";
17663
17664 f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
17665}

◆ TestAsyncPassStruct1ByteIntx10()

DART_EXPORT void dart::TestAsyncPassStruct1ByteIntx10 ( void(*)(Struct1ByteInt a0, Struct1ByteInt a1, Struct1ByteInt a2, Struct1ByteInt a3, Struct1ByteInt a4, Struct1ByteInt a5, Struct1ByteInt a6, Struct1ByteInt a7, Struct1ByteInt a8, Struct1ByteInt a9)  f)

Definition at line 16129 of file ffi_test_functions_generated.cc.

16140 {
16141 Struct1ByteInt a0 = {};
16142 Struct1ByteInt a1 = {};
16143 Struct1ByteInt a2 = {};
16144 Struct1ByteInt a3 = {};
16145 Struct1ByteInt a4 = {};
16146 Struct1ByteInt a5 = {};
16147 Struct1ByteInt a6 = {};
16148 Struct1ByteInt a7 = {};
16149 Struct1ByteInt a8 = {};
16150 Struct1ByteInt a9 = {};
16151
16152 a0.a0 = -1;
16153 a1.a0 = 2;
16154 a2.a0 = -3;
16155 a3.a0 = 4;
16156 a4.a0 = -5;
16157 a5.a0 = 6;
16158 a6.a0 = -7;
16159 a7.a0 = 8;
16160 a8.a0 = -9;
16161 a9.a0 = 10;
16162
16163 std::cout << "Calling TestAsyncPassStruct1ByteIntx10(" << "(("
16164 << static_cast<int>(a0.a0) << "), (" << static_cast<int>(a1.a0)
16165 << "), (" << static_cast<int>(a2.a0) << "), ("
16166 << static_cast<int>(a3.a0) << "), (" << static_cast<int>(a4.a0)
16167 << "), (" << static_cast<int>(a5.a0) << "), ("
16168 << static_cast<int>(a6.a0) << "), (" << static_cast<int>(a7.a0)
16169 << "), (" << static_cast<int>(a8.a0) << "), ("
16170 << static_cast<int>(a9.a0) << "))" << ")\n";
16171
16172 f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
16173}

◆ TestAsyncPassStruct20BytesHomogeneousFloat()

DART_EXPORT void dart::TestAsyncPassStruct20BytesHomogeneousFloat ( void(*)(Struct20BytesHomogeneousFloat a0)  f)

Definition at line 17767 of file ffi_test_functions_generated.cc.

17769 {
17771
17772 a0.a0 = -1.0;
17773 a0.a1 = 2.0;
17774 a0.a2 = -3.0;
17775 a0.a3 = 4.0;
17776 a0.a4 = -5.0;
17777
17778 std::cout << "Calling TestAsyncPassStruct20BytesHomogeneousFloat(" << "(("
17779 << a0.a0 << ", " << a0.a1 << ", " << a0.a2 << ", " << a0.a3 << ", "
17780 << a0.a4 << "))" << ")\n";
17781
17782 f(a0);
17783}

◆ TestAsyncPassStruct20BytesHomogeneousInt32x10()

Definition at line 17672 of file ffi_test_functions_generated.cc.

17683 {
17685 Struct20BytesHomogeneousInt32 a1 = {};
17686 Struct20BytesHomogeneousInt32 a2 = {};
17687 Struct20BytesHomogeneousInt32 a3 = {};
17688 Struct20BytesHomogeneousInt32 a4 = {};
17689 Struct20BytesHomogeneousInt32 a5 = {};
17690 Struct20BytesHomogeneousInt32 a6 = {};
17691 Struct20BytesHomogeneousInt32 a7 = {};
17692 Struct20BytesHomogeneousInt32 a8 = {};
17693 Struct20BytesHomogeneousInt32 a9 = {};
17694
17695 a0.a0 = -1;
17696 a0.a1 = 2;
17697 a0.a2 = -3;
17698 a0.a3 = 4;
17699 a0.a4 = -5;
17700 a1.a0 = 6;
17701 a1.a1 = -7;
17702 a1.a2 = 8;
17703 a1.a3 = -9;
17704 a1.a4 = 10;
17705 a2.a0 = -11;
17706 a2.a1 = 12;
17707 a2.a2 = -13;
17708 a2.a3 = 14;
17709 a2.a4 = -15;
17710 a3.a0 = 16;
17711 a3.a1 = -17;
17712 a3.a2 = 18;
17713 a3.a3 = -19;
17714 a3.a4 = 20;
17715 a4.a0 = -21;
17716 a4.a1 = 22;
17717 a4.a2 = -23;
17718 a4.a3 = 24;
17719 a4.a4 = -25;
17720 a5.a0 = 26;
17721 a5.a1 = -27;
17722 a5.a2 = 28;
17723 a5.a3 = -29;
17724 a5.a4 = 30;
17725 a6.a0 = -31;
17726 a6.a1 = 32;
17727 a6.a2 = -33;
17728 a6.a3 = 34;
17729 a6.a4 = -35;
17730 a7.a0 = 36;
17731 a7.a1 = -37;
17732 a7.a2 = 38;
17733 a7.a3 = -39;
17734 a7.a4 = 40;
17735 a8.a0 = -41;
17736 a8.a1 = 42;
17737 a8.a2 = -43;
17738 a8.a3 = 44;
17739 a8.a4 = -45;
17740 a9.a0 = 46;
17741 a9.a1 = -47;
17742 a9.a2 = 48;
17743 a9.a3 = -49;
17744 a9.a4 = 50;
17745
17746 std::cout << "Calling TestAsyncPassStruct20BytesHomogeneousInt32x10(" << "(("
17747 << a0.a0 << ", " << a0.a1 << ", " << a0.a2 << ", " << a0.a3 << ", "
17748 << a0.a4 << "), (" << a1.a0 << ", " << a1.a1 << ", " << a1.a2
17749 << ", " << a1.a3 << ", " << a1.a4 << "), (" << a2.a0 << ", "
17750 << a2.a1 << ", " << a2.a2 << ", " << a2.a3 << ", " << a2.a4
17751 << "), (" << a3.a0 << ", " << a3.a1 << ", " << a3.a2 << ", "
17752 << a3.a3 << ", " << a3.a4 << "), (" << a4.a0 << ", " << a4.a1
17753 << ", " << a4.a2 << ", " << a4.a3 << ", " << a4.a4 << "), ("
17754 << a5.a0 << ", " << a5.a1 << ", " << a5.a2 << ", " << a5.a3 << ", "
17755 << a5.a4 << "), (" << a6.a0 << ", " << a6.a1 << ", " << a6.a2
17756 << ", " << a6.a3 << ", " << a6.a4 << "), (" << a7.a0 << ", "
17757 << a7.a1 << ", " << a7.a2 << ", " << a7.a3 << ", " << a7.a4
17758 << "), (" << a8.a0 << ", " << a8.a1 << ", " << a8.a2 << ", "
17759 << a8.a3 << ", " << a8.a4 << "), (" << a9.a0 << ", " << a9.a1
17760 << ", " << a9.a2 << ", " << a9.a3 << ", " << a9.a4 << "))" << ")\n";
17761
17762 f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
17763}

◆ TestAsyncPassStruct32BytesHomogeneousDoublex5()

Definition at line 17788 of file ffi_test_functions_generated.cc.

17794 {
17796 Struct32BytesHomogeneousDouble a1 = {};
17797 Struct32BytesHomogeneousDouble a2 = {};
17798 Struct32BytesHomogeneousDouble a3 = {};
17799 Struct32BytesHomogeneousDouble a4 = {};
17800
17801 a0.a0 = -1.0;
17802 a0.a1 = 2.0;
17803 a0.a2 = -3.0;
17804 a0.a3 = 4.0;
17805 a1.a0 = -5.0;
17806 a1.a1 = 6.0;
17807 a1.a2 = -7.0;
17808 a1.a3 = 8.0;
17809 a2.a0 = -9.0;
17810 a2.a1 = 10.0;
17811 a2.a2 = -11.0;
17812 a2.a3 = 12.0;
17813 a3.a0 = -13.0;
17814 a3.a1 = 14.0;
17815 a3.a2 = -15.0;
17816 a3.a3 = 16.0;
17817 a4.a0 = -17.0;
17818 a4.a1 = 18.0;
17819 a4.a2 = -19.0;
17820 a4.a3 = 20.0;
17821
17822 std::cout << "Calling TestAsyncPassStruct32BytesHomogeneousDoublex5(" << "(("
17823 << a0.a0 << ", " << a0.a1 << ", " << a0.a2 << ", " << a0.a3
17824 << "), (" << a1.a0 << ", " << a1.a1 << ", " << a1.a2 << ", "
17825 << a1.a3 << "), (" << a2.a0 << ", " << a2.a1 << ", " << a2.a2
17826 << ", " << a2.a3 << "), (" << a3.a0 << ", " << a3.a1 << ", "
17827 << a3.a2 << ", " << a3.a3 << "), (" << a4.a0 << ", " << a4.a1
17828 << ", " << a4.a2 << ", " << a4.a3 << "))" << ")\n";
17829
17830 f(a0, a1, a2, a3, a4);
17831}

◆ TestAsyncPassStruct32BytesNestedIntx2()

DART_EXPORT void dart::TestAsyncPassStruct32BytesNestedIntx2 ( void(*)(Struct32BytesNestedInt a0, Struct32BytesNestedInt a1)  f)

Definition at line 18866 of file ffi_test_functions_generated.cc.

18868 {
18869 Struct32BytesNestedInt a0 = {};
18870 Struct32BytesNestedInt a1 = {};
18871
18872 a0.a0.a0.a0.a0 = -1;
18873 a0.a0.a0.a0.a1 = 2;
18874 a0.a0.a0.a1.a0 = -3;
18875 a0.a0.a0.a1.a1 = 4;
18876 a0.a0.a1.a0.a0 = -5;
18877 a0.a0.a1.a0.a1 = 6;
18878 a0.a0.a1.a1.a0 = -7;
18879 a0.a0.a1.a1.a1 = 8;
18880 a0.a1.a0.a0.a0 = -9;
18881 a0.a1.a0.a0.a1 = 10;
18882 a0.a1.a0.a1.a0 = -11;
18883 a0.a1.a0.a1.a1 = 12;
18884 a0.a1.a1.a0.a0 = -13;
18885 a0.a1.a1.a0.a1 = 14;
18886 a0.a1.a1.a1.a0 = -15;
18887 a0.a1.a1.a1.a1 = 16;
18888 a1.a0.a0.a0.a0 = -17;
18889 a1.a0.a0.a0.a1 = 18;
18890 a1.a0.a0.a1.a0 = -19;
18891 a1.a0.a0.a1.a1 = 20;
18892 a1.a0.a1.a0.a0 = -21;
18893 a1.a0.a1.a0.a1 = 22;
18894 a1.a0.a1.a1.a0 = -23;
18895 a1.a0.a1.a1.a1 = 24;
18896 a1.a1.a0.a0.a0 = -25;
18897 a1.a1.a0.a0.a1 = 26;
18898 a1.a1.a0.a1.a0 = -27;
18899 a1.a1.a0.a1.a1 = 28;
18900 a1.a1.a1.a0.a0 = -29;
18901 a1.a1.a1.a0.a1 = 30;
18902 a1.a1.a1.a1.a0 = -31;
18903 a1.a1.a1.a1.a1 = 32;
18904
18905 std::cout << "Calling TestAsyncPassStruct32BytesNestedIntx2(" << "((((("
18906 << a0.a0.a0.a0.a0 << ", " << a0.a0.a0.a0.a1 << "), ("
18907 << a0.a0.a0.a1.a0 << ", " << a0.a0.a0.a1.a1 << ")), (("
18908 << a0.a0.a1.a0.a0 << ", " << a0.a0.a1.a0.a1 << "), ("
18909 << a0.a0.a1.a1.a0 << ", " << a0.a0.a1.a1.a1 << "))), ((("
18910 << a0.a1.a0.a0.a0 << ", " << a0.a1.a0.a0.a1 << "), ("
18911 << a0.a1.a0.a1.a0 << ", " << a0.a1.a0.a1.a1 << ")), (("
18912 << a0.a1.a1.a0.a0 << ", " << a0.a1.a1.a0.a1 << "), ("
18913 << a0.a1.a1.a1.a0 << ", " << a0.a1.a1.a1.a1 << ")))), (((("
18914 << a1.a0.a0.a0.a0 << ", " << a1.a0.a0.a0.a1 << "), ("
18915 << a1.a0.a0.a1.a0 << ", " << a1.a0.a0.a1.a1 << ")), (("
18916 << a1.a0.a1.a0.a0 << ", " << a1.a0.a1.a0.a1 << "), ("
18917 << a1.a0.a1.a1.a0 << ", " << a1.a0.a1.a1.a1 << "))), ((("
18918 << a1.a1.a0.a0.a0 << ", " << a1.a1.a0.a0.a1 << "), ("
18919 << a1.a1.a0.a1.a0 << ", " << a1.a1.a0.a1.a1 << ")), (("
18920 << a1.a1.a1.a0.a0 << ", " << a1.a1.a1.a0.a1 << "), ("
18921 << a1.a1.a1.a1.a0 << ", " << a1.a1.a1.a1.a1 << ")))))" << ")\n";
18922
18923 f(a0, a1);
18924}

◆ TestAsyncPassStruct3BytesHomogeneousUint8x10()

Definition at line 16178 of file ffi_test_functions_generated.cc.

16189 {
16191 Struct3BytesHomogeneousUint8 a1 = {};
16192 Struct3BytesHomogeneousUint8 a2 = {};
16193 Struct3BytesHomogeneousUint8 a3 = {};
16194 Struct3BytesHomogeneousUint8 a4 = {};
16195 Struct3BytesHomogeneousUint8 a5 = {};
16196 Struct3BytesHomogeneousUint8 a6 = {};
16197 Struct3BytesHomogeneousUint8 a7 = {};
16198 Struct3BytesHomogeneousUint8 a8 = {};
16199 Struct3BytesHomogeneousUint8 a9 = {};
16200
16201 a0.a0 = 1;
16202 a0.a1 = 2;
16203 a0.a2 = 3;
16204 a1.a0 = 4;
16205 a1.a1 = 5;
16206 a1.a2 = 6;
16207 a2.a0 = 7;
16208 a2.a1 = 8;
16209 a2.a2 = 9;
16210 a3.a0 = 10;
16211 a3.a1 = 11;
16212 a3.a2 = 12;
16213 a4.a0 = 13;
16214 a4.a1 = 14;
16215 a4.a2 = 15;
16216 a5.a0 = 16;
16217 a5.a1 = 17;
16218 a5.a2 = 18;
16219 a6.a0 = 19;
16220 a6.a1 = 20;
16221 a6.a2 = 21;
16222 a7.a0 = 22;
16223 a7.a1 = 23;
16224 a7.a2 = 24;
16225 a8.a0 = 25;
16226 a8.a1 = 26;
16227 a8.a2 = 27;
16228 a9.a0 = 28;
16229 a9.a1 = 29;
16230 a9.a2 = 30;
16231
16232 std::cout << "Calling TestAsyncPassStruct3BytesHomogeneousUint8x10(" << "(("
16233 << static_cast<int>(a0.a0) << ", " << static_cast<int>(a0.a1)
16234 << ", " << static_cast<int>(a0.a2) << "), ("
16235 << static_cast<int>(a1.a0) << ", " << static_cast<int>(a1.a1)
16236 << ", " << static_cast<int>(a1.a2) << "), ("
16237 << static_cast<int>(a2.a0) << ", " << static_cast<int>(a2.a1)
16238 << ", " << static_cast<int>(a2.a2) << "), ("
16239 << static_cast<int>(a3.a0) << ", " << static_cast<int>(a3.a1)
16240 << ", " << static_cast<int>(a3.a2) << "), ("
16241 << static_cast<int>(a4.a0) << ", " << static_cast<int>(a4.a1)
16242 << ", " << static_cast<int>(a4.a2) << "), ("
16243 << static_cast<int>(a5.a0) << ", " << static_cast<int>(a5.a1)
16244 << ", " << static_cast<int>(a5.a2) << "), ("
16245 << static_cast<int>(a6.a0) << ", " << static_cast<int>(a6.a1)
16246 << ", " << static_cast<int>(a6.a2) << "), ("
16247 << static_cast<int>(a7.a0) << ", " << static_cast<int>(a7.a1)
16248 << ", " << static_cast<int>(a7.a2) << "), ("
16249 << static_cast<int>(a8.a0) << ", " << static_cast<int>(a8.a1)
16250 << ", " << static_cast<int>(a8.a2) << "), ("
16251 << static_cast<int>(a9.a0) << ", " << static_cast<int>(a9.a1)
16252 << ", " << static_cast<int>(a9.a2) << "))" << ")\n";
16253
16254 f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
16255}

◆ TestAsyncPassStruct3BytesInt2ByteAlignedx10()

Definition at line 16261 of file ffi_test_functions_generated.cc.

16272 {
16274 Struct3BytesInt2ByteAligned a1 = {};
16275 Struct3BytesInt2ByteAligned a2 = {};
16276 Struct3BytesInt2ByteAligned a3 = {};
16277 Struct3BytesInt2ByteAligned a4 = {};
16278 Struct3BytesInt2ByteAligned a5 = {};
16279 Struct3BytesInt2ByteAligned a6 = {};
16280 Struct3BytesInt2ByteAligned a7 = {};
16281 Struct3BytesInt2ByteAligned a8 = {};
16282 Struct3BytesInt2ByteAligned a9 = {};
16283
16284 a0.a0 = -1;
16285 a0.a1 = 2;
16286 a1.a0 = -3;
16287 a1.a1 = 4;
16288 a2.a0 = -5;
16289 a2.a1 = 6;
16290 a3.a0 = -7;
16291 a3.a1 = 8;
16292 a4.a0 = -9;
16293 a4.a1 = 10;
16294 a5.a0 = -11;
16295 a5.a1 = 12;
16296 a6.a0 = -13;
16297 a6.a1 = 14;
16298 a7.a0 = -15;
16299 a7.a1 = 16;
16300 a8.a0 = -17;
16301 a8.a1 = 18;
16302 a9.a0 = -19;
16303 a9.a1 = 20;
16304
16305 std::cout << "Calling TestAsyncPassStruct3BytesInt2ByteAlignedx10(" << "(("
16306 << a0.a0 << ", " << static_cast<int>(a0.a1) << "), (" << a1.a0
16307 << ", " << static_cast<int>(a1.a1) << "), (" << a2.a0 << ", "
16308 << static_cast<int>(a2.a1) << "), (" << a3.a0 << ", "
16309 << static_cast<int>(a3.a1) << "), (" << a4.a0 << ", "
16310 << static_cast<int>(a4.a1) << "), (" << a5.a0 << ", "
16311 << static_cast<int>(a5.a1) << "), (" << a6.a0 << ", "
16312 << static_cast<int>(a6.a1) << "), (" << a7.a0 << ", "
16313 << static_cast<int>(a7.a1) << "), (" << a8.a0 << ", "
16314 << static_cast<int>(a8.a1) << "), (" << a9.a0 << ", "
16315 << static_cast<int>(a9.a1) << "))" << ")\n";
16316
16317 f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
16318}

◆ TestAsyncPassStruct3BytesPackedIntx10()

Definition at line 19887 of file ffi_test_functions_generated.cc.

19898 {
19899 Struct3BytesPackedInt a0 = {};
19900 Struct3BytesPackedInt a1 = {};
19901 Struct3BytesPackedInt a2 = {};
19902 Struct3BytesPackedInt a3 = {};
19903 Struct3BytesPackedInt a4 = {};
19904 Struct3BytesPackedInt a5 = {};
19905 Struct3BytesPackedInt a6 = {};
19906 Struct3BytesPackedInt a7 = {};
19907 Struct3BytesPackedInt a8 = {};
19908 Struct3BytesPackedInt a9 = {};
19909
19910 a0.a0 = -1;
19911 a0.a1 = 2;
19912 a1.a0 = -3;
19913 a1.a1 = 4;
19914 a2.a0 = -5;
19915 a2.a1 = 6;
19916 a3.a0 = -7;
19917 a3.a1 = 8;
19918 a4.a0 = -9;
19919 a4.a1 = 10;
19920 a5.a0 = -11;
19921 a5.a1 = 12;
19922 a6.a0 = -13;
19923 a6.a1 = 14;
19924 a7.a0 = -15;
19925 a7.a1 = 16;
19926 a8.a0 = -17;
19927 a8.a1 = 18;
19928 a9.a0 = -19;
19929 a9.a1 = 20;
19930
19931 std::cout << "Calling TestAsyncPassStruct3BytesPackedIntx10(" << "(("
19932 << static_cast<int>(a0.a0) << ", " << a0.a1 << "), ("
19933 << static_cast<int>(a1.a0) << ", " << a1.a1 << "), ("
19934 << static_cast<int>(a2.a0) << ", " << a2.a1 << "), ("
19935 << static_cast<int>(a3.a0) << ", " << a3.a1 << "), ("
19936 << static_cast<int>(a4.a0) << ", " << a4.a1 << "), ("
19937 << static_cast<int>(a5.a0) << ", " << a5.a1 << "), ("
19938 << static_cast<int>(a6.a0) << ", " << a6.a1 << "), ("
19939 << static_cast<int>(a7.a0) << ", " << a7.a1 << "), ("
19940 << static_cast<int>(a8.a0) << ", " << a8.a1 << "), ("
19941 << static_cast<int>(a9.a0) << ", " << a9.a1 << "))" << ")\n";
19942
19943 f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
19944}

◆ TestAsyncPassStruct40BytesHomogeneousDouble()

DART_EXPORT void dart::TestAsyncPassStruct40BytesHomogeneousDouble ( void(*)(Struct40BytesHomogeneousDouble a0)  f)

Definition at line 17835 of file ffi_test_functions_generated.cc.

17837 {
17839
17840 a0.a0 = -1.0;
17841 a0.a1 = 2.0;
17842 a0.a2 = -3.0;
17843 a0.a3 = 4.0;
17844 a0.a4 = -5.0;
17845
17846 std::cout << "Calling TestAsyncPassStruct40BytesHomogeneousDouble(" << "(("
17847 << a0.a0 << ", " << a0.a1 << ", " << a0.a2 << ", " << a0.a3 << ", "
17848 << a0.a4 << "))" << ")\n";
17849
17850 f(a0);
17851}

◆ TestAsyncPassStruct40BytesHomogeneousDoubleStruct4BytesHomo()

DART_EXPORT void dart::TestAsyncPassStruct40BytesHomogeneousDoubleStruct4BytesHomo ( void(*)(Struct40BytesHomogeneousDouble a0, Struct4BytesHomogeneousInt16 a1, Struct8BytesHomogeneousFloat a2)  f)

Definition at line 18302 of file ffi_test_functions_generated.cc.

18306 {
18308 Struct4BytesHomogeneousInt16 a1 = {};
18309 Struct8BytesHomogeneousFloat a2 = {};
18310
18311 a0.a0 = -1.0;
18312 a0.a1 = 2.0;
18313 a0.a2 = -3.0;
18314 a0.a3 = 4.0;
18315 a0.a4 = -5.0;
18316 a1.a0 = 6;
18317 a1.a1 = -7;
18318 a2.a0 = 8.0;
18319 a2.a1 = -9.0;
18320
18321 std::cout
18322 << "Calling TestAsyncPassStruct40BytesHomogeneousDoubleStruct4BytesHomo("
18323 << "((" << a0.a0 << ", " << a0.a1 << ", " << a0.a2 << ", " << a0.a3
18324 << ", " << a0.a4 << "), (" << a1.a0 << ", " << a1.a1 << "), (" << a2.a0
18325 << ", " << a2.a1 << "))" << ")\n";
18326
18327 f(a0, a1, a2);
18328}

◆ TestAsyncPassStruct4BytesHomogeneousInt16x10()

Definition at line 16323 of file ffi_test_functions_generated.cc.

16334 {
16336 Struct4BytesHomogeneousInt16 a1 = {};
16337 Struct4BytesHomogeneousInt16 a2 = {};
16338 Struct4BytesHomogeneousInt16 a3 = {};
16339 Struct4BytesHomogeneousInt16 a4 = {};
16340 Struct4BytesHomogeneousInt16 a5 = {};
16341 Struct4BytesHomogeneousInt16 a6 = {};
16342 Struct4BytesHomogeneousInt16 a7 = {};
16343 Struct4BytesHomogeneousInt16 a8 = {};
16344 Struct4BytesHomogeneousInt16 a9 = {};
16345
16346 a0.a0 = -1;
16347 a0.a1 = 2;
16348 a1.a0 = -3;
16349 a1.a1 = 4;
16350 a2.a0 = -5;
16351 a2.a1 = 6;
16352 a3.a0 = -7;
16353 a3.a1 = 8;
16354 a4.a0 = -9;
16355 a4.a1 = 10;
16356 a5.a0 = -11;
16357 a5.a1 = 12;
16358 a6.a0 = -13;
16359 a6.a1 = 14;
16360 a7.a0 = -15;
16361 a7.a1 = 16;
16362 a8.a0 = -17;
16363 a8.a1 = 18;
16364 a9.a0 = -19;
16365 a9.a1 = 20;
16366
16367 std::cout << "Calling TestAsyncPassStruct4BytesHomogeneousInt16x10(" << "(("
16368 << a0.a0 << ", " << a0.a1 << "), (" << a1.a0 << ", " << a1.a1
16369 << "), (" << a2.a0 << ", " << a2.a1 << "), (" << a3.a0 << ", "
16370 << a3.a1 << "), (" << a4.a0 << ", " << a4.a1 << "), (" << a5.a0
16371 << ", " << a5.a1 << "), (" << a6.a0 << ", " << a6.a1 << "), ("
16372 << a7.a0 << ", " << a7.a1 << "), (" << a8.a0 << ", " << a8.a1
16373 << "), (" << a9.a0 << ", " << a9.a1 << "))" << ")\n";
16374
16375 f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
16376}

◆ TestAsyncPassStruct5BytesPackedMixed()

DART_EXPORT void dart::TestAsyncPassStruct5BytesPackedMixed ( void(*)(Struct5BytesPackedMixed a0)  f)

Definition at line 20131 of file ffi_test_functions_generated.cc.

20133 {
20135
20136 a0.a0 = -1.0;
20137 a0.a1 = 2;
20138
20139 std::cout << "Calling TestAsyncPassStruct5BytesPackedMixed(" << "((" << a0.a0
20140 << ", " << static_cast<int>(a0.a1) << "))" << ")\n";
20141
20142 f(a0);
20143}

◆ TestAsyncPassStruct6BytesInlineArrayInt()

DART_EXPORT void dart::TestAsyncPassStruct6BytesInlineArrayInt ( void(*)(Struct6BytesInlineArrayInt a0)  f)

Definition at line 20166 of file ffi_test_functions_generated.cc.

20168 {
20170
20171 a0.a0[0].a0 = -1;
20172 a0.a0[0].a1 = 2;
20173 a0.a0[1].a0 = -3;
20174 a0.a0[1].a1 = 4;
20175
20176 std::cout << "Calling TestAsyncPassStruct6BytesInlineArrayInt(" << "(([("
20177 << static_cast<int>(a0.a0[0].a0) << ", " << a0.a0[0].a1 << "), ("
20178 << static_cast<int>(a0.a0[1].a0) << ", " << a0.a0[1].a1 << ")]))"
20179 << ")\n";
20180
20181 f(a0);
20182}

◆ TestAsyncPassStruct7BytesHomogeneousUint8x10()

Definition at line 16381 of file ffi_test_functions_generated.cc.

16392 {
16394 Struct7BytesHomogeneousUint8 a1 = {};
16395 Struct7BytesHomogeneousUint8 a2 = {};
16396 Struct7BytesHomogeneousUint8 a3 = {};
16397 Struct7BytesHomogeneousUint8 a4 = {};
16398 Struct7BytesHomogeneousUint8 a5 = {};
16399 Struct7BytesHomogeneousUint8 a6 = {};
16400 Struct7BytesHomogeneousUint8 a7 = {};
16401 Struct7BytesHomogeneousUint8 a8 = {};
16402 Struct7BytesHomogeneousUint8 a9 = {};
16403
16404 a0.a0 = 1;
16405 a0.a1 = 2;
16406 a0.a2 = 3;
16407 a0.a3 = 4;
16408 a0.a4 = 5;
16409 a0.a5 = 6;
16410 a0.a6 = 7;
16411 a1.a0 = 8;
16412 a1.a1 = 9;
16413 a1.a2 = 10;
16414 a1.a3 = 11;
16415 a1.a4 = 12;
16416 a1.a5 = 13;
16417 a1.a6 = 14;
16418 a2.a0 = 15;
16419 a2.a1 = 16;
16420 a2.a2 = 17;
16421 a2.a3 = 18;
16422 a2.a4 = 19;
16423 a2.a5 = 20;
16424 a2.a6 = 21;
16425 a3.a0 = 22;
16426 a3.a1 = 23;
16427 a3.a2 = 24;
16428 a3.a3 = 25;
16429 a3.a4 = 26;
16430 a3.a5 = 27;
16431 a3.a6 = 28;
16432 a4.a0 = 29;
16433 a4.a1 = 30;
16434 a4.a2 = 31;
16435 a4.a3 = 32;
16436 a4.a4 = 33;
16437 a4.a5 = 34;
16438 a4.a6 = 35;
16439 a5.a0 = 36;
16440 a5.a1 = 37;
16441 a5.a2 = 38;
16442 a5.a3 = 39;
16443 a5.a4 = 40;
16444 a5.a5 = 41;
16445 a5.a6 = 42;
16446 a6.a0 = 43;
16447 a6.a1 = 44;
16448 a6.a2 = 45;
16449 a6.a3 = 46;
16450 a6.a4 = 47;
16451 a6.a5 = 48;
16452 a6.a6 = 49;
16453 a7.a0 = 50;
16454 a7.a1 = 51;
16455 a7.a2 = 52;
16456 a7.a3 = 53;
16457 a7.a4 = 54;
16458 a7.a5 = 55;
16459 a7.a6 = 56;
16460 a8.a0 = 57;
16461 a8.a1 = 58;
16462 a8.a2 = 59;
16463 a8.a3 = 60;
16464 a8.a4 = 61;
16465 a8.a5 = 62;
16466 a8.a6 = 63;
16467 a9.a0 = 64;
16468 a9.a1 = 65;
16469 a9.a2 = 66;
16470 a9.a3 = 67;
16471 a9.a4 = 68;
16472 a9.a5 = 69;
16473 a9.a6 = 70;
16474
16475 std::cout
16476 << "Calling TestAsyncPassStruct7BytesHomogeneousUint8x10(" << "(("
16477 << static_cast<int>(a0.a0) << ", " << static_cast<int>(a0.a1) << ", "
16478 << static_cast<int>(a0.a2) << ", " << static_cast<int>(a0.a3) << ", "
16479 << static_cast<int>(a0.a4) << ", " << static_cast<int>(a0.a5) << ", "
16480 << static_cast<int>(a0.a6) << "), (" << static_cast<int>(a1.a0) << ", "
16481 << static_cast<int>(a1.a1) << ", " << static_cast<int>(a1.a2) << ", "
16482 << static_cast<int>(a1.a3) << ", " << static_cast<int>(a1.a4) << ", "
16483 << static_cast<int>(a1.a5) << ", " << static_cast<int>(a1.a6) << "), ("
16484 << static_cast<int>(a2.a0) << ", " << static_cast<int>(a2.a1) << ", "
16485 << static_cast<int>(a2.a2) << ", " << static_cast<int>(a2.a3) << ", "
16486 << static_cast<int>(a2.a4) << ", " << static_cast<int>(a2.a5) << ", "
16487 << static_cast<int>(a2.a6) << "), (" << static_cast<int>(a3.a0) << ", "
16488 << static_cast<int>(a3.a1) << ", " << static_cast<int>(a3.a2) << ", "
16489 << static_cast<int>(a3.a3) << ", " << static_cast<int>(a3.a4) << ", "
16490 << static_cast<int>(a3.a5) << ", " << static_cast<int>(a3.a6) << "), ("
16491 << static_cast<int>(a4.a0) << ", " << static_cast<int>(a4.a1) << ", "
16492 << static_cast<int>(a4.a2) << ", " << static_cast<int>(a4.a3) << ", "
16493 << static_cast<int>(a4.a4) << ", " << static_cast<int>(a4.a5) << ", "
16494 << static_cast<int>(a4.a6) << "), (" << static_cast<int>(a5.a0) << ", "
16495 << static_cast<int>(a5.a1) << ", " << static_cast<int>(a5.a2) << ", "
16496 << static_cast<int>(a5.a3) << ", " << static_cast<int>(a5.a4) << ", "
16497 << static_cast<int>(a5.a5) << ", " << static_cast<int>(a5.a6) << "), ("
16498 << static_cast<int>(a6.a0) << ", " << static_cast<int>(a6.a1) << ", "
16499 << static_cast<int>(a6.a2) << ", " << static_cast<int>(a6.a3) << ", "
16500 << static_cast<int>(a6.a4) << ", " << static_cast<int>(a6.a5) << ", "
16501 << static_cast<int>(a6.a6) << "), (" << static_cast<int>(a7.a0) << ", "
16502 << static_cast<int>(a7.a1) << ", " << static_cast<int>(a7.a2) << ", "
16503 << static_cast<int>(a7.a3) << ", " << static_cast<int>(a7.a4) << ", "
16504 << static_cast<int>(a7.a5) << ", " << static_cast<int>(a7.a6) << "), ("
16505 << static_cast<int>(a8.a0) << ", " << static_cast<int>(a8.a1) << ", "
16506 << static_cast<int>(a8.a2) << ", " << static_cast<int>(a8.a3) << ", "
16507 << static_cast<int>(a8.a4) << ", " << static_cast<int>(a8.a5) << ", "
16508 << static_cast<int>(a8.a6) << "), (" << static_cast<int>(a9.a0) << ", "
16509 << static_cast<int>(a9.a1) << ", " << static_cast<int>(a9.a2) << ", "
16510 << static_cast<int>(a9.a3) << ", " << static_cast<int>(a9.a4) << ", "
16511 << static_cast<int>(a9.a5) << ", " << static_cast<int>(a9.a6) << "))"
16512 << ")\n";
16513
16514 f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
16515}

◆ TestAsyncPassStruct7BytesInt4ByteAlignedx10()

Definition at line 16521 of file ffi_test_functions_generated.cc.

16532 {
16534 Struct7BytesInt4ByteAligned a1 = {};
16535 Struct7BytesInt4ByteAligned a2 = {};
16536 Struct7BytesInt4ByteAligned a3 = {};
16537 Struct7BytesInt4ByteAligned a4 = {};
16538 Struct7BytesInt4ByteAligned a5 = {};
16539 Struct7BytesInt4ByteAligned a6 = {};
16540 Struct7BytesInt4ByteAligned a7 = {};
16541 Struct7BytesInt4ByteAligned a8 = {};
16542 Struct7BytesInt4ByteAligned a9 = {};
16543
16544 a0.a0 = -1;
16545 a0.a1 = 2;
16546 a0.a2 = -3;
16547 a1.a0 = 4;
16548 a1.a1 = -5;
16549 a1.a2 = 6;
16550 a2.a0 = -7;
16551 a2.a1 = 8;
16552 a2.a2 = -9;
16553 a3.a0 = 10;
16554 a3.a1 = -11;
16555 a3.a2 = 12;
16556 a4.a0 = -13;
16557 a4.a1 = 14;
16558 a4.a2 = -15;
16559 a5.a0 = 16;
16560 a5.a1 = -17;
16561 a5.a2 = 18;
16562 a6.a0 = -19;
16563 a6.a1 = 20;
16564 a6.a2 = -21;
16565 a7.a0 = 22;
16566 a7.a1 = -23;
16567 a7.a2 = 24;
16568 a8.a0 = -25;
16569 a8.a1 = 26;
16570 a8.a2 = -27;
16571 a9.a0 = 28;
16572 a9.a1 = -29;
16573 a9.a2 = 30;
16574
16575 std::cout << "Calling TestAsyncPassStruct7BytesInt4ByteAlignedx10(" << "(("
16576 << a0.a0 << ", " << a0.a1 << ", " << static_cast<int>(a0.a2)
16577 << "), (" << a1.a0 << ", " << a1.a1 << ", "
16578 << static_cast<int>(a1.a2) << "), (" << a2.a0 << ", " << a2.a1
16579 << ", " << static_cast<int>(a2.a2) << "), (" << a3.a0 << ", "
16580 << a3.a1 << ", " << static_cast<int>(a3.a2) << "), (" << a4.a0
16581 << ", " << a4.a1 << ", " << static_cast<int>(a4.a2) << "), ("
16582 << a5.a0 << ", " << a5.a1 << ", " << static_cast<int>(a5.a2)
16583 << "), (" << a6.a0 << ", " << a6.a1 << ", "
16584 << static_cast<int>(a6.a2) << "), (" << a7.a0 << ", " << a7.a1
16585 << ", " << static_cast<int>(a7.a2) << "), (" << a8.a0 << ", "
16586 << a8.a1 << ", " << static_cast<int>(a8.a2) << "), (" << a9.a0
16587 << ", " << a9.a1 << ", " << static_cast<int>(a9.a2) << "))"
16588 << ")\n";
16589
16590 f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
16591}

◆ TestAsyncPassStruct8BytesHomogeneousFloatx10()

Definition at line 16667 of file ffi_test_functions_generated.cc.

16678 {
16680 Struct8BytesHomogeneousFloat a1 = {};
16681 Struct8BytesHomogeneousFloat a2 = {};
16682 Struct8BytesHomogeneousFloat a3 = {};
16683 Struct8BytesHomogeneousFloat a4 = {};
16684 Struct8BytesHomogeneousFloat a5 = {};
16685 Struct8BytesHomogeneousFloat a6 = {};
16686 Struct8BytesHomogeneousFloat a7 = {};
16687 Struct8BytesHomogeneousFloat a8 = {};
16688 Struct8BytesHomogeneousFloat a9 = {};
16689
16690 a0.a0 = -1.0;
16691 a0.a1 = 2.0;
16692 a1.a0 = -3.0;
16693 a1.a1 = 4.0;
16694 a2.a0 = -5.0;
16695 a2.a1 = 6.0;
16696 a3.a0 = -7.0;
16697 a3.a1 = 8.0;
16698 a4.a0 = -9.0;
16699 a4.a1 = 10.0;
16700 a5.a0 = -11.0;
16701 a5.a1 = 12.0;
16702 a6.a0 = -13.0;
16703 a6.a1 = 14.0;
16704 a7.a0 = -15.0;
16705 a7.a1 = 16.0;
16706 a8.a0 = -17.0;
16707 a8.a1 = 18.0;
16708 a9.a0 = -19.0;
16709 a9.a1 = 20.0;
16710
16711 std::cout << "Calling TestAsyncPassStruct8BytesHomogeneousFloatx10(" << "(("
16712 << a0.a0 << ", " << a0.a1 << "), (" << a1.a0 << ", " << a1.a1
16713 << "), (" << a2.a0 << ", " << a2.a1 << "), (" << a3.a0 << ", "
16714 << a3.a1 << "), (" << a4.a0 << ", " << a4.a1 << "), (" << a5.a0
16715 << ", " << a5.a1 << "), (" << a6.a0 << ", " << a6.a1 << "), ("
16716 << a7.a0 << ", " << a7.a1 << "), (" << a8.a0 << ", " << a8.a1
16717 << "), (" << a9.a0 << ", " << a9.a1 << "))" << ")\n";
16718
16719 f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
16720}

◆ TestAsyncPassStruct8BytesInlineArrayIntx4()

DART_EXPORT void dart::TestAsyncPassStruct8BytesInlineArrayIntx4 ( void(*)(Struct8BytesInlineArrayInt a0, Struct8BytesInlineArrayInt a1, Struct8BytesInlineArrayInt a2, Struct8BytesInlineArrayInt a3)  f)

Definition at line 19207 of file ffi_test_functions_generated.cc.

19212 {
19214 Struct8BytesInlineArrayInt a1 = {};
19215 Struct8BytesInlineArrayInt a2 = {};
19216 Struct8BytesInlineArrayInt a3 = {};
19217
19218 a0.a0[0] = 1;
19219 a0.a0[1] = 2;
19220 a0.a0[2] = 3;
19221 a0.a0[3] = 4;
19222 a0.a0[4] = 5;
19223 a0.a0[5] = 6;
19224 a0.a0[6] = 7;
19225 a0.a0[7] = 8;
19226 a1.a0[0] = 9;
19227 a1.a0[1] = 10;
19228 a1.a0[2] = 11;
19229 a1.a0[3] = 12;
19230 a1.a0[4] = 13;
19231 a1.a0[5] = 14;
19232 a1.a0[6] = 15;
19233 a1.a0[7] = 16;
19234 a2.a0[0] = 17;
19235 a2.a0[1] = 18;
19236 a2.a0[2] = 19;
19237 a2.a0[3] = 20;
19238 a2.a0[4] = 21;
19239 a2.a0[5] = 22;
19240 a2.a0[6] = 23;
19241 a2.a0[7] = 24;
19242 a3.a0[0] = 25;
19243 a3.a0[1] = 26;
19244 a3.a0[2] = 27;
19245 a3.a0[3] = 28;
19246 a3.a0[4] = 29;
19247 a3.a0[5] = 30;
19248 a3.a0[6] = 31;
19249 a3.a0[7] = 32;
19250
19251 std::cout << "Calling TestAsyncPassStruct8BytesInlineArrayIntx4(" << "((["
19252 << static_cast<int>(a0.a0[0]) << ", " << static_cast<int>(a0.a0[1])
19253 << ", " << static_cast<int>(a0.a0[2]) << ", "
19254 << static_cast<int>(a0.a0[3]) << ", " << static_cast<int>(a0.a0[4])
19255 << ", " << static_cast<int>(a0.a0[5]) << ", "
19256 << static_cast<int>(a0.a0[6]) << ", " << static_cast<int>(a0.a0[7])
19257 << "]), ([" << static_cast<int>(a1.a0[0]) << ", "
19258 << static_cast<int>(a1.a0[1]) << ", " << static_cast<int>(a1.a0[2])
19259 << ", " << static_cast<int>(a1.a0[3]) << ", "
19260 << static_cast<int>(a1.a0[4]) << ", " << static_cast<int>(a1.a0[5])
19261 << ", " << static_cast<int>(a1.a0[6]) << ", "
19262 << static_cast<int>(a1.a0[7]) << "]), (["
19263 << static_cast<int>(a2.a0[0]) << ", " << static_cast<int>(a2.a0[1])
19264 << ", " << static_cast<int>(a2.a0[2]) << ", "
19265 << static_cast<int>(a2.a0[3]) << ", " << static_cast<int>(a2.a0[4])
19266 << ", " << static_cast<int>(a2.a0[5]) << ", "
19267 << static_cast<int>(a2.a0[6]) << ", " << static_cast<int>(a2.a0[7])
19268 << "]), ([" << static_cast<int>(a3.a0[0]) << ", "
19269 << static_cast<int>(a3.a0[1]) << ", " << static_cast<int>(a3.a0[2])
19270 << ", " << static_cast<int>(a3.a0[3]) << ", "
19271 << static_cast<int>(a3.a0[4]) << ", " << static_cast<int>(a3.a0[5])
19272 << ", " << static_cast<int>(a3.a0[6]) << ", "
19273 << static_cast<int>(a3.a0[7]) << "]))" << ")\n";
19274
19275 f(a0, a1, a2, a3);
19276}

◆ TestAsyncPassStruct8BytesIntx10()

DART_EXPORT void dart::TestAsyncPassStruct8BytesIntx10 ( void(*)(Struct8BytesInt a0, Struct8BytesInt a1, Struct8BytesInt a2, Struct8BytesInt a3, Struct8BytesInt a4, Struct8BytesInt a5, Struct8BytesInt a6, Struct8BytesInt a7, Struct8BytesInt a8, Struct8BytesInt a9)  f)

Definition at line 16596 of file ffi_test_functions_generated.cc.

16607 {
16608 Struct8BytesInt a0 = {};
16609 Struct8BytesInt a1 = {};
16610 Struct8BytesInt a2 = {};
16611 Struct8BytesInt a3 = {};
16612 Struct8BytesInt a4 = {};
16613 Struct8BytesInt a5 = {};
16614 Struct8BytesInt a6 = {};
16615 Struct8BytesInt a7 = {};
16616 Struct8BytesInt a8 = {};
16617 Struct8BytesInt a9 = {};
16618
16619 a0.a0 = -1;
16620 a0.a1 = 2;
16621 a0.a2 = -3;
16622 a1.a0 = 4;
16623 a1.a1 = -5;
16624 a1.a2 = 6;
16625 a2.a0 = -7;
16626 a2.a1 = 8;
16627 a2.a2 = -9;
16628 a3.a0 = 10;
16629 a3.a1 = -11;
16630 a3.a2 = 12;
16631 a4.a0 = -13;
16632 a4.a1 = 14;
16633 a4.a2 = -15;
16634 a5.a0 = 16;
16635 a5.a1 = -17;
16636 a5.a2 = 18;
16637 a6.a0 = -19;
16638 a6.a1 = 20;
16639 a6.a2 = -21;
16640 a7.a0 = 22;
16641 a7.a1 = -23;
16642 a7.a2 = 24;
16643 a8.a0 = -25;
16644 a8.a1 = 26;
16645 a8.a2 = -27;
16646 a9.a0 = 28;
16647 a9.a1 = -29;
16648 a9.a2 = 30;
16649
16650 std::cout << "Calling TestAsyncPassStruct8BytesIntx10(" << "((" << a0.a0
16651 << ", " << a0.a1 << ", " << a0.a2 << "), (" << a1.a0 << ", "
16652 << a1.a1 << ", " << a1.a2 << "), (" << a2.a0 << ", " << a2.a1
16653 << ", " << a2.a2 << "), (" << a3.a0 << ", " << a3.a1 << ", "
16654 << a3.a2 << "), (" << a4.a0 << ", " << a4.a1 << ", " << a4.a2
16655 << "), (" << a5.a0 << ", " << a5.a1 << ", " << a5.a2 << "), ("
16656 << a6.a0 << ", " << a6.a1 << ", " << a6.a2 << "), (" << a7.a0
16657 << ", " << a7.a1 << ", " << a7.a2 << "), (" << a8.a0 << ", "
16658 << a8.a1 << ", " << a8.a2 << "), (" << a9.a0 << ", " << a9.a1
16659 << ", " << a9.a2 << "))" << ")\n";
16660
16661 f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
16662}

◆ TestAsyncPassStruct8BytesMixedx10()

Definition at line 16725 of file ffi_test_functions_generated.cc.

16736 {
16737 Struct8BytesMixed a0 = {};
16738 Struct8BytesMixed a1 = {};
16739 Struct8BytesMixed a2 = {};
16740 Struct8BytesMixed a3 = {};
16741 Struct8BytesMixed a4 = {};
16742 Struct8BytesMixed a5 = {};
16743 Struct8BytesMixed a6 = {};
16744 Struct8BytesMixed a7 = {};
16745 Struct8BytesMixed a8 = {};
16746 Struct8BytesMixed a9 = {};
16747
16748 a0.a0 = -1.0;
16749 a0.a1 = 2;
16750 a0.a2 = -3;
16751 a1.a0 = 4.0;
16752 a1.a1 = -5;
16753 a1.a2 = 6;
16754 a2.a0 = -7.0;
16755 a2.a1 = 8;
16756 a2.a2 = -9;
16757 a3.a0 = 10.0;
16758 a3.a1 = -11;
16759 a3.a2 = 12;
16760 a4.a0 = -13.0;
16761 a4.a1 = 14;
16762 a4.a2 = -15;
16763 a5.a0 = 16.0;
16764 a5.a1 = -17;
16765 a5.a2 = 18;
16766 a6.a0 = -19.0;
16767 a6.a1 = 20;
16768 a6.a2 = -21;
16769 a7.a0 = 22.0;
16770 a7.a1 = -23;
16771 a7.a2 = 24;
16772 a8.a0 = -25.0;
16773 a8.a1 = 26;
16774 a8.a2 = -27;
16775 a9.a0 = 28.0;
16776 a9.a1 = -29;
16777 a9.a2 = 30;
16778
16779 std::cout << "Calling TestAsyncPassStruct8BytesMixedx10(" << "((" << a0.a0
16780 << ", " << a0.a1 << ", " << a0.a2 << "), (" << a1.a0 << ", "
16781 << a1.a1 << ", " << a1.a2 << "), (" << a2.a0 << ", " << a2.a1
16782 << ", " << a2.a2 << "), (" << a3.a0 << ", " << a3.a1 << ", "
16783 << a3.a2 << "), (" << a4.a0 << ", " << a4.a1 << ", " << a4.a2
16784 << "), (" << a5.a0 << ", " << a5.a1 << ", " << a5.a2 << "), ("
16785 << a6.a0 << ", " << a6.a1 << ", " << a6.a2 << "), (" << a7.a0
16786 << ", " << a7.a1 << ", " << a7.a2 << "), (" << a8.a0 << ", "
16787 << a8.a1 << ", " << a8.a2 << "), (" << a9.a0 << ", " << a9.a1
16788 << ", " << a9.a2 << "))" << ")\n";
16789
16790 f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
16791}

◆ TestAsyncPassStruct8BytesNestedFloat2x10()

Definition at line 18698 of file ffi_test_functions_generated.cc.

18709 {
18711 Struct8BytesNestedFloat2 a1 = {};
18712 Struct8BytesNestedFloat2 a2 = {};
18713 Struct8BytesNestedFloat2 a3 = {};
18714 Struct8BytesNestedFloat2 a4 = {};
18715 Struct8BytesNestedFloat2 a5 = {};
18716 Struct8BytesNestedFloat2 a6 = {};
18717 Struct8BytesNestedFloat2 a7 = {};
18718 Struct8BytesNestedFloat2 a8 = {};
18719 Struct8BytesNestedFloat2 a9 = {};
18720
18721 a0.a0.a0 = -1.0;
18722 a0.a1 = 2.0;
18723 a1.a0.a0 = -3.0;
18724 a1.a1 = 4.0;
18725 a2.a0.a0 = -5.0;
18726 a2.a1 = 6.0;
18727 a3.a0.a0 = -7.0;
18728 a3.a1 = 8.0;
18729 a4.a0.a0 = -9.0;
18730 a4.a1 = 10.0;
18731 a5.a0.a0 = -11.0;
18732 a5.a1 = 12.0;
18733 a6.a0.a0 = -13.0;
18734 a6.a1 = 14.0;
18735 a7.a0.a0 = -15.0;
18736 a7.a1 = 16.0;
18737 a8.a0.a0 = -17.0;
18738 a8.a1 = 18.0;
18739 a9.a0.a0 = -19.0;
18740 a9.a1 = 20.0;
18741
18742 std::cout << "Calling TestAsyncPassStruct8BytesNestedFloat2x10(" << "((("
18743 << a0.a0.a0 << "), " << a0.a1 << "), ((" << a1.a0.a0 << "), "
18744 << a1.a1 << "), ((" << a2.a0.a0 << "), " << a2.a1 << "), (("
18745 << a3.a0.a0 << "), " << a3.a1 << "), ((" << a4.a0.a0 << "), "
18746 << a4.a1 << "), ((" << a5.a0.a0 << "), " << a5.a1 << "), (("
18747 << a6.a0.a0 << "), " << a6.a1 << "), ((" << a7.a0.a0 << "), "
18748 << a7.a1 << "), ((" << a8.a0.a0 << "), " << a8.a1 << "), (("
18749 << a9.a0.a0 << "), " << a9.a1 << "))" << ")\n";
18750
18751 f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
18752}

◆ TestAsyncPassStruct8BytesNestedFloatx10()

Definition at line 18636 of file ffi_test_functions_generated.cc.

18647 {
18649 Struct8BytesNestedFloat a1 = {};
18650 Struct8BytesNestedFloat a2 = {};
18651 Struct8BytesNestedFloat a3 = {};
18652 Struct8BytesNestedFloat a4 = {};
18653 Struct8BytesNestedFloat a5 = {};
18654 Struct8BytesNestedFloat a6 = {};
18655 Struct8BytesNestedFloat a7 = {};
18656 Struct8BytesNestedFloat a8 = {};
18657 Struct8BytesNestedFloat a9 = {};
18658
18659 a0.a0.a0 = -1.0;
18660 a0.a1.a0 = 2.0;
18661 a1.a0.a0 = -3.0;
18662 a1.a1.a0 = 4.0;
18663 a2.a0.a0 = -5.0;
18664 a2.a1.a0 = 6.0;
18665 a3.a0.a0 = -7.0;
18666 a3.a1.a0 = 8.0;
18667 a4.a0.a0 = -9.0;
18668 a4.a1.a0 = 10.0;
18669 a5.a0.a0 = -11.0;
18670 a5.a1.a0 = 12.0;
18671 a6.a0.a0 = -13.0;
18672 a6.a1.a0 = 14.0;
18673 a7.a0.a0 = -15.0;
18674 a7.a1.a0 = 16.0;
18675 a8.a0.a0 = -17.0;
18676 a8.a1.a0 = 18.0;
18677 a9.a0.a0 = -19.0;
18678 a9.a1.a0 = 20.0;
18679
18680 std::cout << "Calling TestAsyncPassStruct8BytesNestedFloatx10(" << "((("
18681 << a0.a0.a0 << "), (" << a0.a1.a0 << ")), ((" << a1.a0.a0 << "), ("
18682 << a1.a1.a0 << ")), ((" << a2.a0.a0 << "), (" << a2.a1.a0
18683 << ")), ((" << a3.a0.a0 << "), (" << a3.a1.a0 << ")), (("
18684 << a4.a0.a0 << "), (" << a4.a1.a0 << ")), ((" << a5.a0.a0 << "), ("
18685 << a5.a1.a0 << ")), ((" << a6.a0.a0 << "), (" << a6.a1.a0
18686 << ")), ((" << a7.a0.a0 << "), (" << a7.a1.a0 << ")), (("
18687 << a8.a0.a0 << "), (" << a8.a1.a0 << ")), ((" << a9.a0.a0 << "), ("
18688 << a9.a1.a0 << ")))" << ")\n";
18689
18690 f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
18691}

◆ TestAsyncPassStruct8BytesNestedIntx10()

Definition at line 18550 of file ffi_test_functions_generated.cc.

18561 {
18562 Struct8BytesNestedInt a0 = {};
18563 Struct8BytesNestedInt a1 = {};
18564 Struct8BytesNestedInt a2 = {};
18565 Struct8BytesNestedInt a3 = {};
18566 Struct8BytesNestedInt a4 = {};
18567 Struct8BytesNestedInt a5 = {};
18568 Struct8BytesNestedInt a6 = {};
18569 Struct8BytesNestedInt a7 = {};
18570 Struct8BytesNestedInt a8 = {};
18571 Struct8BytesNestedInt a9 = {};
18572
18573 a0.a0.a0 = -1;
18574 a0.a0.a1 = 2;
18575 a0.a1.a0 = -3;
18576 a0.a1.a1 = 4;
18577 a1.a0.a0 = -5;
18578 a1.a0.a1 = 6;
18579 a1.a1.a0 = -7;
18580 a1.a1.a1 = 8;
18581 a2.a0.a0 = -9;
18582 a2.a0.a1 = 10;
18583 a2.a1.a0 = -11;
18584 a2.a1.a1 = 12;
18585 a3.a0.a0 = -13;
18586 a3.a0.a1 = 14;
18587 a3.a1.a0 = -15;
18588 a3.a1.a1 = 16;
18589 a4.a0.a0 = -17;
18590 a4.a0.a1 = 18;
18591 a4.a1.a0 = -19;
18592 a4.a1.a1 = 20;
18593 a5.a0.a0 = -21;
18594 a5.a0.a1 = 22;
18595 a5.a1.a0 = -23;
18596 a5.a1.a1 = 24;
18597 a6.a0.a0 = -25;
18598 a6.a0.a1 = 26;
18599 a6.a1.a0 = -27;
18600 a6.a1.a1 = 28;
18601 a7.a0.a0 = -29;
18602 a7.a0.a1 = 30;
18603 a7.a1.a0 = -31;
18604 a7.a1.a1 = 32;
18605 a8.a0.a0 = -33;
18606 a8.a0.a1 = 34;
18607 a8.a1.a0 = -35;
18608 a8.a1.a1 = 36;
18609 a9.a0.a0 = -37;
18610 a9.a0.a1 = 38;
18611 a9.a1.a0 = -39;
18612 a9.a1.a1 = 40;
18613
18614 std::cout << "Calling TestAsyncPassStruct8BytesNestedIntx10(" << "((("
18615 << a0.a0.a0 << ", " << a0.a0.a1 << "), (" << a0.a1.a0 << ", "
18616 << a0.a1.a1 << ")), ((" << a1.a0.a0 << ", " << a1.a0.a1 << "), ("
18617 << a1.a1.a0 << ", " << a1.a1.a1 << ")), ((" << a2.a0.a0 << ", "
18618 << a2.a0.a1 << "), (" << a2.a1.a0 << ", " << a2.a1.a1 << ")), (("
18619 << a3.a0.a0 << ", " << a3.a0.a1 << "), (" << a3.a1.a0 << ", "
18620 << a3.a1.a1 << ")), ((" << a4.a0.a0 << ", " << a4.a0.a1 << "), ("
18621 << a4.a1.a0 << ", " << a4.a1.a1 << ")), ((" << a5.a0.a0 << ", "
18622 << a5.a0.a1 << "), (" << a5.a1.a0 << ", " << a5.a1.a1 << ")), (("
18623 << a6.a0.a0 << ", " << a6.a0.a1 << "), (" << a6.a1.a0 << ", "
18624 << a6.a1.a1 << ")), ((" << a7.a0.a0 << ", " << a7.a0.a1 << "), ("
18625 << a7.a1.a0 << ", " << a7.a1.a1 << ")), ((" << a8.a0.a0 << ", "
18626 << a8.a0.a1 << "), (" << a8.a1.a0 << ", " << a8.a1.a1 << ")), (("
18627 << a9.a0.a0 << ", " << a9.a0.a1 << "), (" << a9.a1.a0 << ", "
18628 << a9.a1.a1 << ")))" << ")\n";
18629
18630 f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
18631}

◆ TestAsyncPassStruct8BytesNestedMixedx10()

Definition at line 18757 of file ffi_test_functions_generated.cc.

18768 {
18770 Struct8BytesNestedMixed a1 = {};
18771 Struct8BytesNestedMixed a2 = {};
18772 Struct8BytesNestedMixed a3 = {};
18773 Struct8BytesNestedMixed a4 = {};
18774 Struct8BytesNestedMixed a5 = {};
18775 Struct8BytesNestedMixed a6 = {};
18776 Struct8BytesNestedMixed a7 = {};
18777 Struct8BytesNestedMixed a8 = {};
18778 Struct8BytesNestedMixed a9 = {};
18779
18780 a0.a0.a0 = -1;
18781 a0.a0.a1 = 2;
18782 a0.a1.a0 = -3.0;
18783 a1.a0.a0 = 4;
18784 a1.a0.a1 = -5;
18785 a1.a1.a0 = 6.0;
18786 a2.a0.a0 = -7;
18787 a2.a0.a1 = 8;
18788 a2.a1.a0 = -9.0;
18789 a3.a0.a0 = 10;
18790 a3.a0.a1 = -11;
18791 a3.a1.a0 = 12.0;
18792 a4.a0.a0 = -13;
18793 a4.a0.a1 = 14;
18794 a4.a1.a0 = -15.0;
18795 a5.a0.a0 = 16;
18796 a5.a0.a1 = -17;
18797 a5.a1.a0 = 18.0;
18798 a6.a0.a0 = -19;
18799 a6.a0.a1 = 20;
18800 a6.a1.a0 = -21.0;
18801 a7.a0.a0 = 22;
18802 a7.a0.a1 = -23;
18803 a7.a1.a0 = 24.0;
18804 a8.a0.a0 = -25;
18805 a8.a0.a1 = 26;
18806 a8.a1.a0 = -27.0;
18807 a9.a0.a0 = 28;
18808 a9.a0.a1 = -29;
18809 a9.a1.a0 = 30.0;
18810
18811 std::cout << "Calling TestAsyncPassStruct8BytesNestedMixedx10(" << "((("
18812 << a0.a0.a0 << ", " << a0.a0.a1 << "), (" << a0.a1.a0 << ")), (("
18813 << a1.a0.a0 << ", " << a1.a0.a1 << "), (" << a1.a1.a0 << ")), (("
18814 << a2.a0.a0 << ", " << a2.a0.a1 << "), (" << a2.a1.a0 << ")), (("
18815 << a3.a0.a0 << ", " << a3.a0.a1 << "), (" << a3.a1.a0 << ")), (("
18816 << a4.a0.a0 << ", " << a4.a0.a1 << "), (" << a4.a1.a0 << ")), (("
18817 << a5.a0.a0 << ", " << a5.a0.a1 << "), (" << a5.a1.a0 << ")), (("
18818 << a6.a0.a0 << ", " << a6.a0.a1 << "), (" << a6.a1.a0 << ")), (("
18819 << a7.a0.a0 << ", " << a7.a0.a1 << "), (" << a7.a1.a0 << ")), (("
18820 << a8.a0.a0 << ", " << a8.a0.a1 << "), (" << a8.a1.a0 << ")), (("
18821 << a9.a0.a0 << ", " << a9.a0.a1 << "), (" << a9.a1.a0 << ")))"
18822 << ")\n";
18823
18824 f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
18825}

◆ TestAsyncPassStruct8BytesPackedIntx10()

Definition at line 19948 of file ffi_test_functions_generated.cc.

19959 {
19960 Struct8BytesPackedInt a0 = {};
19961 Struct8BytesPackedInt a1 = {};
19962 Struct8BytesPackedInt a2 = {};
19963 Struct8BytesPackedInt a3 = {};
19964 Struct8BytesPackedInt a4 = {};
19965 Struct8BytesPackedInt a5 = {};
19966 Struct8BytesPackedInt a6 = {};
19967 Struct8BytesPackedInt a7 = {};
19968 Struct8BytesPackedInt a8 = {};
19969 Struct8BytesPackedInt a9 = {};
19970
19971 a0.a0 = 1;
19972 a0.a1 = 2;
19973 a0.a2 = 3;
19974 a0.a3 = 4;
19975 a0.a4 = 5;
19976 a1.a0 = 6;
19977 a1.a1 = 7;
19978 a1.a2 = 8;
19979 a1.a3 = 9;
19980 a1.a4 = 10;
19981 a2.a0 = 11;
19982 a2.a1 = 12;
19983 a2.a2 = 13;
19984 a2.a3 = 14;
19985 a2.a4 = 15;
19986 a3.a0 = 16;
19987 a3.a1 = 17;
19988 a3.a2 = 18;
19989 a3.a3 = 19;
19990 a3.a4 = 20;
19991 a4.a0 = 21;
19992 a4.a1 = 22;
19993 a4.a2 = 23;
19994 a4.a3 = 24;
19995 a4.a4 = 25;
19996 a5.a0 = 26;
19997 a5.a1 = 27;
19998 a5.a2 = 28;
19999 a5.a3 = 29;
20000 a5.a4 = 30;
20001 a6.a0 = 31;
20002 a6.a1 = 32;
20003 a6.a2 = 33;
20004 a6.a3 = 34;
20005 a6.a4 = 35;
20006 a7.a0 = 36;
20007 a7.a1 = 37;
20008 a7.a2 = 38;
20009 a7.a3 = 39;
20010 a7.a4 = 40;
20011 a8.a0 = 41;
20012 a8.a1 = 42;
20013 a8.a2 = 43;
20014 a8.a3 = 44;
20015 a8.a4 = 45;
20016 a9.a0 = 46;
20017 a9.a1 = 47;
20018 a9.a2 = 48;
20019 a9.a3 = 49;
20020 a9.a4 = 50;
20021
20022 std::cout << "Calling TestAsyncPassStruct8BytesPackedIntx10(" << "(("
20023 << static_cast<int>(a0.a0) << ", " << a0.a1 << ", "
20024 << static_cast<int>(a0.a2) << ", " << static_cast<int>(a0.a3)
20025 << ", " << static_cast<int>(a0.a4) << "), ("
20026 << static_cast<int>(a1.a0) << ", " << a1.a1 << ", "
20027 << static_cast<int>(a1.a2) << ", " << static_cast<int>(a1.a3)
20028 << ", " << static_cast<int>(a1.a4) << "), ("
20029 << static_cast<int>(a2.a0) << ", " << a2.a1 << ", "
20030 << static_cast<int>(a2.a2) << ", " << static_cast<int>(a2.a3)
20031 << ", " << static_cast<int>(a2.a4) << "), ("
20032 << static_cast<int>(a3.a0) << ", " << a3.a1 << ", "
20033 << static_cast<int>(a3.a2) << ", " << static_cast<int>(a3.a3)
20034 << ", " << static_cast<int>(a3.a4) << "), ("
20035 << static_cast<int>(a4.a0) << ", " << a4.a1 << ", "
20036 << static_cast<int>(a4.a2) << ", " << static_cast<int>(a4.a3)
20037 << ", " << static_cast<int>(a4.a4) << "), ("
20038 << static_cast<int>(a5.a0) << ", " << a5.a1 << ", "
20039 << static_cast<int>(a5.a2) << ", " << static_cast<int>(a5.a3)
20040 << ", " << static_cast<int>(a5.a4) << "), ("
20041 << static_cast<int>(a6.a0) << ", " << a6.a1 << ", "
20042 << static_cast<int>(a6.a2) << ", " << static_cast<int>(a6.a3)
20043 << ", " << static_cast<int>(a6.a4) << "), ("
20044 << static_cast<int>(a7.a0) << ", " << a7.a1 << ", "
20045 << static_cast<int>(a7.a2) << ", " << static_cast<int>(a7.a3)
20046 << ", " << static_cast<int>(a7.a4) << "), ("
20047 << static_cast<int>(a8.a0) << ", " << a8.a1 << ", "
20048 << static_cast<int>(a8.a2) << ", " << static_cast<int>(a8.a3)
20049 << ", " << static_cast<int>(a8.a4) << "), ("
20050 << static_cast<int>(a9.a0) << ", " << a9.a1 << ", "
20051 << static_cast<int>(a9.a2) << ", " << static_cast<int>(a9.a3)
20052 << ", " << static_cast<int>(a9.a4) << "))" << ")\n";
20053
20054 f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
20055}

◆ TestAsyncPassStruct9BytesHomogeneousUint8x10()

Definition at line 16799 of file ffi_test_functions_generated.cc.

16810 {
16812 Struct9BytesHomogeneousUint8 a1 = {};
16813 Struct9BytesHomogeneousUint8 a2 = {};
16814 Struct9BytesHomogeneousUint8 a3 = {};
16815 Struct9BytesHomogeneousUint8 a4 = {};
16816 Struct9BytesHomogeneousUint8 a5 = {};
16817 Struct9BytesHomogeneousUint8 a6 = {};
16818 Struct9BytesHomogeneousUint8 a7 = {};
16819 Struct9BytesHomogeneousUint8 a8 = {};
16820 Struct9BytesHomogeneousUint8 a9 = {};
16821
16822 a0.a0 = 1;
16823 a0.a1 = 2;
16824 a0.a2 = 3;
16825 a0.a3 = 4;
16826 a0.a4 = 5;
16827 a0.a5 = 6;
16828 a0.a6 = 7;
16829 a0.a7 = 8;
16830 a0.a8 = 9;
16831 a1.a0 = 10;
16832 a1.a1 = 11;
16833 a1.a2 = 12;
16834 a1.a3 = 13;
16835 a1.a4 = 14;
16836 a1.a5 = 15;
16837 a1.a6 = 16;
16838 a1.a7 = 17;
16839 a1.a8 = 18;
16840 a2.a0 = 19;
16841 a2.a1 = 20;
16842 a2.a2 = 21;
16843 a2.a3 = 22;
16844 a2.a4 = 23;
16845 a2.a5 = 24;
16846 a2.a6 = 25;
16847 a2.a7 = 26;
16848 a2.a8 = 27;
16849 a3.a0 = 28;
16850 a3.a1 = 29;
16851 a3.a2 = 30;
16852 a3.a3 = 31;
16853 a3.a4 = 32;
16854 a3.a5 = 33;
16855 a3.a6 = 34;
16856 a3.a7 = 35;
16857 a3.a8 = 36;
16858 a4.a0 = 37;
16859 a4.a1 = 38;
16860 a4.a2 = 39;
16861 a4.a3 = 40;
16862 a4.a4 = 41;
16863 a4.a5 = 42;
16864 a4.a6 = 43;
16865 a4.a7 = 44;
16866 a4.a8 = 45;
16867 a5.a0 = 46;
16868 a5.a1 = 47;
16869 a5.a2 = 48;
16870 a5.a3 = 49;
16871 a5.a4 = 50;
16872 a5.a5 = 51;
16873 a5.a6 = 52;
16874 a5.a7 = 53;
16875 a5.a8 = 54;
16876 a6.a0 = 55;
16877 a6.a1 = 56;
16878 a6.a2 = 57;
16879 a6.a3 = 58;
16880 a6.a4 = 59;
16881 a6.a5 = 60;
16882 a6.a6 = 61;
16883 a6.a7 = 62;
16884 a6.a8 = 63;
16885 a7.a0 = 64;
16886 a7.a1 = 65;
16887 a7.a2 = 66;
16888 a7.a3 = 67;
16889 a7.a4 = 68;
16890 a7.a5 = 69;
16891 a7.a6 = 70;
16892 a7.a7 = 71;
16893 a7.a8 = 72;
16894 a8.a0 = 73;
16895 a8.a1 = 74;
16896 a8.a2 = 75;
16897 a8.a3 = 76;
16898 a8.a4 = 77;
16899 a8.a5 = 78;
16900 a8.a6 = 79;
16901 a8.a7 = 80;
16902 a8.a8 = 81;
16903 a9.a0 = 82;
16904 a9.a1 = 83;
16905 a9.a2 = 84;
16906 a9.a3 = 85;
16907 a9.a4 = 86;
16908 a9.a5 = 87;
16909 a9.a6 = 88;
16910 a9.a7 = 89;
16911 a9.a8 = 90;
16912
16913 std::cout
16914 << "Calling TestAsyncPassStruct9BytesHomogeneousUint8x10(" << "(("
16915 << static_cast<int>(a0.a0) << ", " << static_cast<int>(a0.a1) << ", "
16916 << static_cast<int>(a0.a2) << ", " << static_cast<int>(a0.a3) << ", "
16917 << static_cast<int>(a0.a4) << ", " << static_cast<int>(a0.a5) << ", "
16918 << static_cast<int>(a0.a6) << ", " << static_cast<int>(a0.a7) << ", "
16919 << static_cast<int>(a0.a8) << "), (" << static_cast<int>(a1.a0) << ", "
16920 << static_cast<int>(a1.a1) << ", " << static_cast<int>(a1.a2) << ", "
16921 << static_cast<int>(a1.a3) << ", " << static_cast<int>(a1.a4) << ", "
16922 << static_cast<int>(a1.a5) << ", " << static_cast<int>(a1.a6) << ", "
16923 << static_cast<int>(a1.a7) << ", " << static_cast<int>(a1.a8) << "), ("
16924 << static_cast<int>(a2.a0) << ", " << static_cast<int>(a2.a1) << ", "
16925 << static_cast<int>(a2.a2) << ", " << static_cast<int>(a2.a3) << ", "
16926 << static_cast<int>(a2.a4) << ", " << static_cast<int>(a2.a5) << ", "
16927 << static_cast<int>(a2.a6) << ", " << static_cast<int>(a2.a7) << ", "
16928 << static_cast<int>(a2.a8) << "), (" << static_cast<int>(a3.a0) << ", "
16929 << static_cast<int>(a3.a1) << ", " << static_cast<int>(a3.a2) << ", "
16930 << static_cast<int>(a3.a3) << ", " << static_cast<int>(a3.a4) << ", "
16931 << static_cast<int>(a3.a5) << ", " << static_cast<int>(a3.a6) << ", "
16932 << static_cast<int>(a3.a7) << ", " << static_cast<int>(a3.a8) << "), ("
16933 << static_cast<int>(a4.a0) << ", " << static_cast<int>(a4.a1) << ", "
16934 << static_cast<int>(a4.a2) << ", " << static_cast<int>(a4.a3) << ", "
16935 << static_cast<int>(a4.a4) << ", " << static_cast<int>(a4.a5) << ", "
16936 << static_cast<int>(a4.a6) << ", " << static_cast<int>(a4.a7) << ", "
16937 << static_cast<int>(a4.a8) << "), (" << static_cast<int>(a5.a0) << ", "
16938 << static_cast<int>(a5.a1) << ", " << static_cast<int>(a5.a2) << ", "
16939 << static_cast<int>(a5.a3) << ", " << static_cast<int>(a5.a4) << ", "
16940 << static_cast<int>(a5.a5) << ", " << static_cast<int>(a5.a6) << ", "
16941 << static_cast<int>(a5.a7) << ", " << static_cast<int>(a5.a8) << "), ("
16942 << static_cast<int>(a6.a0) << ", " << static_cast<int>(a6.a1) << ", "
16943 << static_cast<int>(a6.a2) << ", " << static_cast<int>(a6.a3) << ", "
16944 << static_cast<int>(a6.a4) << ", " << static_cast<int>(a6.a5) << ", "
16945 << static_cast<int>(a6.a6) << ", " << static_cast<int>(a6.a7) << ", "
16946 << static_cast<int>(a6.a8) << "), (" << static_cast<int>(a7.a0) << ", "
16947 << static_cast<int>(a7.a1) << ", " << static_cast<int>(a7.a2) << ", "
16948 << static_cast<int>(a7.a3) << ", " << static_cast<int>(a7.a4) << ", "
16949 << static_cast<int>(a7.a5) << ", " << static_cast<int>(a7.a6) << ", "
16950 << static_cast<int>(a7.a7) << ", " << static_cast<int>(a7.a8) << "), ("
16951 << static_cast<int>(a8.a0) << ", " << static_cast<int>(a8.a1) << ", "
16952 << static_cast<int>(a8.a2) << ", " << static_cast<int>(a8.a3) << ", "
16953 << static_cast<int>(a8.a4) << ", " << static_cast<int>(a8.a5) << ", "
16954 << static_cast<int>(a8.a6) << ", " << static_cast<int>(a8.a7) << ", "
16955 << static_cast<int>(a8.a8) << "), (" << static_cast<int>(a9.a0) << ", "
16956 << static_cast<int>(a9.a1) << ", " << static_cast<int>(a9.a2) << ", "
16957 << static_cast<int>(a9.a3) << ", " << static_cast<int>(a9.a4) << ", "
16958 << static_cast<int>(a9.a5) << ", " << static_cast<int>(a9.a6) << ", "
16959 << static_cast<int>(a9.a7) << ", " << static_cast<int>(a9.a8) << "))"
16960 << ")\n";
16961
16962 f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
16963}

◆ TestAsyncPassStruct9BytesInt4Or8ByteAlignedx10()

Definition at line 16970 of file ffi_test_functions_generated.cc.

16981 {
16983 Struct9BytesInt4Or8ByteAligned a1 = {};
16984 Struct9BytesInt4Or8ByteAligned a2 = {};
16985 Struct9BytesInt4Or8ByteAligned a3 = {};
16986 Struct9BytesInt4Or8ByteAligned a4 = {};
16987 Struct9BytesInt4Or8ByteAligned a5 = {};
16988 Struct9BytesInt4Or8ByteAligned a6 = {};
16989 Struct9BytesInt4Or8ByteAligned a7 = {};
16990 Struct9BytesInt4Or8ByteAligned a8 = {};
16991 Struct9BytesInt4Or8ByteAligned a9 = {};
16992
16993 a0.a0 = -1;
16994 a0.a1 = 2;
16995 a1.a0 = -3;
16996 a1.a1 = 4;
16997 a2.a0 = -5;
16998 a2.a1 = 6;
16999 a3.a0 = -7;
17000 a3.a1 = 8;
17001 a4.a0 = -9;
17002 a4.a1 = 10;
17003 a5.a0 = -11;
17004 a5.a1 = 12;
17005 a6.a0 = -13;
17006 a6.a1 = 14;
17007 a7.a0 = -15;
17008 a7.a1 = 16;
17009 a8.a0 = -17;
17010 a8.a1 = 18;
17011 a9.a0 = -19;
17012 a9.a1 = 20;
17013
17014 std::cout << "Calling TestAsyncPassStruct9BytesInt4Or8ByteAlignedx10(" << "(("
17015 << a0.a0 << ", " << static_cast<int>(a0.a1) << "), (" << a1.a0
17016 << ", " << static_cast<int>(a1.a1) << "), (" << a2.a0 << ", "
17017 << static_cast<int>(a2.a1) << "), (" << a3.a0 << ", "
17018 << static_cast<int>(a3.a1) << "), (" << a4.a0 << ", "
17019 << static_cast<int>(a4.a1) << "), (" << a5.a0 << ", "
17020 << static_cast<int>(a5.a1) << "), (" << a6.a0 << ", "
17021 << static_cast<int>(a6.a1) << "), (" << a7.a0 << ", "
17022 << static_cast<int>(a7.a1) << "), (" << a8.a0 << ", "
17023 << static_cast<int>(a8.a1) << "), (" << a9.a0 << ", "
17024 << static_cast<int>(a9.a1) << "))" << ")\n";
17025
17026 f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
17027}

◆ TestAsyncPassStruct9BytesPackedMixedx10DoubleInt32x2()

DART_EXPORT void dart::TestAsyncPassStruct9BytesPackedMixedx10DoubleInt32x2 ( void(*)(Struct9BytesPackedMixed a0, Struct9BytesPackedMixed a1, Struct9BytesPackedMixed a2, Struct9BytesPackedMixed a3, Struct9BytesPackedMixed a4, Struct9BytesPackedMixed a5, Struct9BytesPackedMixed a6, Struct9BytesPackedMixed a7, Struct9BytesPackedMixed a8, Struct9BytesPackedMixed a9, double a10, int32_t a11, int32_t a12)  f)

Definition at line 20060 of file ffi_test_functions_generated.cc.

20074 {
20076 Struct9BytesPackedMixed a1 = {};
20077 Struct9BytesPackedMixed a2 = {};
20078 Struct9BytesPackedMixed a3 = {};
20079 Struct9BytesPackedMixed a4 = {};
20080 Struct9BytesPackedMixed a5 = {};
20081 Struct9BytesPackedMixed a6 = {};
20082 Struct9BytesPackedMixed a7 = {};
20083 Struct9BytesPackedMixed a8 = {};
20084 Struct9BytesPackedMixed a9 = {};
20085 double a10;
20086 int32_t a11;
20087 int32_t a12;
20088
20089 a0.a0 = 1;
20090 a0.a1 = 2.0;
20091 a1.a0 = 3;
20092 a1.a1 = 4.0;
20093 a2.a0 = 5;
20094 a2.a1 = 6.0;
20095 a3.a0 = 7;
20096 a3.a1 = 8.0;
20097 a4.a0 = 9;
20098 a4.a1 = 10.0;
20099 a5.a0 = 11;
20100 a5.a1 = 12.0;
20101 a6.a0 = 13;
20102 a6.a1 = 14.0;
20103 a7.a0 = 15;
20104 a7.a1 = 16.0;
20105 a8.a0 = 17;
20106 a8.a1 = 18.0;
20107 a9.a0 = 19;
20108 a9.a1 = 20.0;
20109 a10 = -21.0;
20110 a11 = 22;
20111 a12 = -23;
20112
20113 std::cout << "Calling TestAsyncPassStruct9BytesPackedMixedx10DoubleInt32x2("
20114 << "((" << static_cast<int>(a0.a0) << ", " << a0.a1 << "), ("
20115 << static_cast<int>(a1.a0) << ", " << a1.a1 << "), ("
20116 << static_cast<int>(a2.a0) << ", " << a2.a1 << "), ("
20117 << static_cast<int>(a3.a0) << ", " << a3.a1 << "), ("
20118 << static_cast<int>(a4.a0) << ", " << a4.a1 << "), ("
20119 << static_cast<int>(a5.a0) << ", " << a5.a1 << "), ("
20120 << static_cast<int>(a6.a0) << ", " << a6.a1 << "), ("
20121 << static_cast<int>(a7.a0) << ", " << a7.a1 << "), ("
20122 << static_cast<int>(a8.a0) << ", " << a8.a1 << "), ("
20123 << static_cast<int>(a9.a0) << ", " << a9.a1 << "), " << a10 << ", "
20124 << a11 << ", " << a12 << ")" << ")\n";
20125
20126 f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12);
20127}

◆ TestAsyncPassStructAlignmentInt16()

DART_EXPORT void dart::TestAsyncPassStructAlignmentInt16 ( void(*)(StructAlignmentInt16 a0)  f)

Definition at line 18495 of file ffi_test_functions_generated.cc.

18497 {
18498 StructAlignmentInt16 a0 = {};
18499
18500 a0.a0 = -1;
18501 a0.a1 = 2;
18502 a0.a2 = -3;
18503
18504 std::cout << "Calling TestAsyncPassStructAlignmentInt16(" << "(("
18505 << static_cast<int>(a0.a0) << ", " << a0.a1 << ", "
18506 << static_cast<int>(a0.a2) << "))" << ")\n";
18507
18508 f(a0);
18509}

◆ TestAsyncPassStructAlignmentInt32()

DART_EXPORT void dart::TestAsyncPassStructAlignmentInt32 ( void(*)(StructAlignmentInt32 a0)  f)

Definition at line 18513 of file ffi_test_functions_generated.cc.

18515 {
18516 StructAlignmentInt32 a0 = {};
18517
18518 a0.a0 = -1;
18519 a0.a1 = 2;
18520 a0.a2 = -3;
18521
18522 std::cout << "Calling TestAsyncPassStructAlignmentInt32(" << "(("
18523 << static_cast<int>(a0.a0) << ", " << a0.a1 << ", "
18524 << static_cast<int>(a0.a2) << "))" << ")\n";
18525
18526 f(a0);
18527}

◆ TestAsyncPassStructAlignmentInt64()

DART_EXPORT void dart::TestAsyncPassStructAlignmentInt64 ( void(*)(StructAlignmentInt64 a0)  f)

Definition at line 18531 of file ffi_test_functions_generated.cc.

18533 {
18534 StructAlignmentInt64 a0 = {};
18535
18536 a0.a0 = -1;
18537 a0.a1 = 2;
18538 a0.a2 = -3;
18539
18540 std::cout << "Calling TestAsyncPassStructAlignmentInt64(" << "(("
18541 << static_cast<int>(a0.a0) << ", " << a0.a1 << ", "
18542 << static_cast<int>(a0.a2) << "))" << ")\n";
18543
18544 f(a0);
18545}

◆ TestAsyncPassStructInlineArray100Bytes()

DART_EXPORT void dart::TestAsyncPassStructInlineArray100Bytes ( void(*)(StructInlineArray100Bytes a0)  f)

Definition at line 19331 of file ffi_test_functions_generated.cc.

19333 {
19335
19336 a0.a0[0] = 1;
19337 a0.a0[1] = 2;
19338 a0.a0[2] = 3;
19339 a0.a0[3] = 4;
19340 a0.a0[4] = 5;
19341 a0.a0[5] = 6;
19342 a0.a0[6] = 7;
19343 a0.a0[7] = 8;
19344 a0.a0[8] = 9;
19345 a0.a0[9] = 10;
19346 a0.a0[10] = 11;
19347 a0.a0[11] = 12;
19348 a0.a0[12] = 13;
19349 a0.a0[13] = 14;
19350 a0.a0[14] = 15;
19351 a0.a0[15] = 16;
19352 a0.a0[16] = 17;
19353 a0.a0[17] = 18;
19354 a0.a0[18] = 19;
19355 a0.a0[19] = 20;
19356 a0.a0[20] = 21;
19357 a0.a0[21] = 22;
19358 a0.a0[22] = 23;
19359 a0.a0[23] = 24;
19360 a0.a0[24] = 25;
19361 a0.a0[25] = 26;
19362 a0.a0[26] = 27;
19363 a0.a0[27] = 28;
19364 a0.a0[28] = 29;
19365 a0.a0[29] = 30;
19366 a0.a0[30] = 31;
19367 a0.a0[31] = 32;
19368 a0.a0[32] = 33;
19369 a0.a0[33] = 34;
19370 a0.a0[34] = 35;
19371 a0.a0[35] = 36;
19372 a0.a0[36] = 37;
19373 a0.a0[37] = 38;
19374 a0.a0[38] = 39;
19375 a0.a0[39] = 40;
19376 a0.a0[40] = 41;
19377 a0.a0[41] = 42;
19378 a0.a0[42] = 43;
19379 a0.a0[43] = 44;
19380 a0.a0[44] = 45;
19381 a0.a0[45] = 46;
19382 a0.a0[46] = 47;
19383 a0.a0[47] = 48;
19384 a0.a0[48] = 49;
19385 a0.a0[49] = 50;
19386 a0.a0[50] = 51;
19387 a0.a0[51] = 52;
19388 a0.a0[52] = 53;
19389 a0.a0[53] = 54;
19390 a0.a0[54] = 55;
19391 a0.a0[55] = 56;
19392 a0.a0[56] = 57;
19393 a0.a0[57] = 58;
19394 a0.a0[58] = 59;
19395 a0.a0[59] = 60;
19396 a0.a0[60] = 61;
19397 a0.a0[61] = 62;
19398 a0.a0[62] = 63;
19399 a0.a0[63] = 64;
19400 a0.a0[64] = 65;
19401 a0.a0[65] = 66;
19402 a0.a0[66] = 67;
19403 a0.a0[67] = 68;
19404 a0.a0[68] = 69;
19405 a0.a0[69] = 70;
19406 a0.a0[70] = 71;
19407 a0.a0[71] = 72;
19408 a0.a0[72] = 73;
19409 a0.a0[73] = 74;
19410 a0.a0[74] = 75;
19411 a0.a0[75] = 76;
19412 a0.a0[76] = 77;
19413 a0.a0[77] = 78;
19414 a0.a0[78] = 79;
19415 a0.a0[79] = 80;
19416 a0.a0[80] = 81;
19417 a0.a0[81] = 82;
19418 a0.a0[82] = 83;
19419 a0.a0[83] = 84;
19420 a0.a0[84] = 85;
19421 a0.a0[85] = 86;
19422 a0.a0[86] = 87;
19423 a0.a0[87] = 88;
19424 a0.a0[88] = 89;
19425 a0.a0[89] = 90;
19426 a0.a0[90] = 91;
19427 a0.a0[91] = 92;
19428 a0.a0[92] = 93;
19429 a0.a0[93] = 94;
19430 a0.a0[94] = 95;
19431 a0.a0[95] = 96;
19432 a0.a0[96] = 97;
19433 a0.a0[97] = 98;
19434 a0.a0[98] = 99;
19435 a0.a0[99] = 100;
19436
19437 std::cout
19438 << "Calling TestAsyncPassStructInlineArray100Bytes(" << "((["
19439 << static_cast<int>(a0.a0[0]) << ", " << static_cast<int>(a0.a0[1])
19440 << ", " << static_cast<int>(a0.a0[2]) << ", "
19441 << static_cast<int>(a0.a0[3]) << ", " << static_cast<int>(a0.a0[4])
19442 << ", " << static_cast<int>(a0.a0[5]) << ", "
19443 << static_cast<int>(a0.a0[6]) << ", " << static_cast<int>(a0.a0[7])
19444 << ", " << static_cast<int>(a0.a0[8]) << ", "
19445 << static_cast<int>(a0.a0[9]) << ", " << static_cast<int>(a0.a0[10])
19446 << ", " << static_cast<int>(a0.a0[11]) << ", "
19447 << static_cast<int>(a0.a0[12]) << ", " << static_cast<int>(a0.a0[13])
19448 << ", " << static_cast<int>(a0.a0[14]) << ", "
19449 << static_cast<int>(a0.a0[15]) << ", " << static_cast<int>(a0.a0[16])
19450 << ", " << static_cast<int>(a0.a0[17]) << ", "
19451 << static_cast<int>(a0.a0[18]) << ", " << static_cast<int>(a0.a0[19])
19452 << ", " << static_cast<int>(a0.a0[20]) << ", "
19453 << static_cast<int>(a0.a0[21]) << ", " << static_cast<int>(a0.a0[22])
19454 << ", " << static_cast<int>(a0.a0[23]) << ", "
19455 << static_cast<int>(a0.a0[24]) << ", " << static_cast<int>(a0.a0[25])
19456 << ", " << static_cast<int>(a0.a0[26]) << ", "
19457 << static_cast<int>(a0.a0[27]) << ", " << static_cast<int>(a0.a0[28])
19458 << ", " << static_cast<int>(a0.a0[29]) << ", "
19459 << static_cast<int>(a0.a0[30]) << ", " << static_cast<int>(a0.a0[31])
19460 << ", " << static_cast<int>(a0.a0[32]) << ", "
19461 << static_cast<int>(a0.a0[33]) << ", " << static_cast<int>(a0.a0[34])
19462 << ", " << static_cast<int>(a0.a0[35]) << ", "
19463 << static_cast<int>(a0.a0[36]) << ", " << static_cast<int>(a0.a0[37])
19464 << ", " << static_cast<int>(a0.a0[38]) << ", "
19465 << static_cast<int>(a0.a0[39]) << ", " << static_cast<int>(a0.a0[40])
19466 << ", " << static_cast<int>(a0.a0[41]) << ", "
19467 << static_cast<int>(a0.a0[42]) << ", " << static_cast<int>(a0.a0[43])
19468 << ", " << static_cast<int>(a0.a0[44]) << ", "
19469 << static_cast<int>(a0.a0[45]) << ", " << static_cast<int>(a0.a0[46])
19470 << ", " << static_cast<int>(a0.a0[47]) << ", "
19471 << static_cast<int>(a0.a0[48]) << ", " << static_cast<int>(a0.a0[49])
19472 << ", " << static_cast<int>(a0.a0[50]) << ", "
19473 << static_cast<int>(a0.a0[51]) << ", " << static_cast<int>(a0.a0[52])
19474 << ", " << static_cast<int>(a0.a0[53]) << ", "
19475 << static_cast<int>(a0.a0[54]) << ", " << static_cast<int>(a0.a0[55])
19476 << ", " << static_cast<int>(a0.a0[56]) << ", "
19477 << static_cast<int>(a0.a0[57]) << ", " << static_cast<int>(a0.a0[58])
19478 << ", " << static_cast<int>(a0.a0[59]) << ", "
19479 << static_cast<int>(a0.a0[60]) << ", " << static_cast<int>(a0.a0[61])
19480 << ", " << static_cast<int>(a0.a0[62]) << ", "
19481 << static_cast<int>(a0.a0[63]) << ", " << static_cast<int>(a0.a0[64])
19482 << ", " << static_cast<int>(a0.a0[65]) << ", "
19483 << static_cast<int>(a0.a0[66]) << ", " << static_cast<int>(a0.a0[67])
19484 << ", " << static_cast<int>(a0.a0[68]) << ", "
19485 << static_cast<int>(a0.a0[69]) << ", " << static_cast<int>(a0.a0[70])
19486 << ", " << static_cast<int>(a0.a0[71]) << ", "
19487 << static_cast<int>(a0.a0[72]) << ", " << static_cast<int>(a0.a0[73])
19488 << ", " << static_cast<int>(a0.a0[74]) << ", "
19489 << static_cast<int>(a0.a0[75]) << ", " << static_cast<int>(a0.a0[76])
19490 << ", " << static_cast<int>(a0.a0[77]) << ", "
19491 << static_cast<int>(a0.a0[78]) << ", " << static_cast<int>(a0.a0[79])
19492 << ", " << static_cast<int>(a0.a0[80]) << ", "
19493 << static_cast<int>(a0.a0[81]) << ", " << static_cast<int>(a0.a0[82])
19494 << ", " << static_cast<int>(a0.a0[83]) << ", "
19495 << static_cast<int>(a0.a0[84]) << ", " << static_cast<int>(a0.a0[85])
19496 << ", " << static_cast<int>(a0.a0[86]) << ", "
19497 << static_cast<int>(a0.a0[87]) << ", " << static_cast<int>(a0.a0[88])
19498 << ", " << static_cast<int>(a0.a0[89]) << ", "
19499 << static_cast<int>(a0.a0[90]) << ", " << static_cast<int>(a0.a0[91])
19500 << ", " << static_cast<int>(a0.a0[92]) << ", "
19501 << static_cast<int>(a0.a0[93]) << ", " << static_cast<int>(a0.a0[94])
19502 << ", " << static_cast<int>(a0.a0[95]) << ", "
19503 << static_cast<int>(a0.a0[96]) << ", " << static_cast<int>(a0.a0[97])
19504 << ", " << static_cast<int>(a0.a0[98]) << ", "
19505 << static_cast<int>(a0.a0[99]) << "]))" << ")\n";
19506
19507 f(a0);
19508}

◆ TestAsyncPassStructInlineArrayIrregularx4()

DART_EXPORT void dart::TestAsyncPassStructInlineArrayIrregularx4 ( void(*)(StructInlineArrayIrregular a0, StructInlineArrayIrregular a1, StructInlineArrayIrregular a2, StructInlineArrayIrregular a3)  f)

Definition at line 19280 of file ffi_test_functions_generated.cc.

19285 {
19287 StructInlineArrayIrregular a1 = {};
19288 StructInlineArrayIrregular a2 = {};
19289 StructInlineArrayIrregular a3 = {};
19290
19291 a0.a0[0].a0 = -1;
19292 a0.a0[0].a1 = 2;
19293 a0.a0[1].a0 = -3;
19294 a0.a0[1].a1 = 4;
19295 a0.a1 = 5;
19296 a1.a0[0].a0 = 6;
19297 a1.a0[0].a1 = -7;
19298 a1.a0[1].a0 = 8;
19299 a1.a0[1].a1 = -9;
19300 a1.a1 = 10;
19301 a2.a0[0].a0 = -11;
19302 a2.a0[0].a1 = 12;
19303 a2.a0[1].a0 = -13;
19304 a2.a0[1].a1 = 14;
19305 a2.a1 = 15;
19306 a3.a0[0].a0 = 16;
19307 a3.a0[0].a1 = -17;
19308 a3.a0[1].a0 = 18;
19309 a3.a0[1].a1 = -19;
19310 a3.a1 = 20;
19311
19312 std::cout << "Calling TestAsyncPassStructInlineArrayIrregularx4(" << "(([("
19313 << a0.a0[0].a0 << ", " << static_cast<int>(a0.a0[0].a1) << "), ("
19314 << a0.a0[1].a0 << ", " << static_cast<int>(a0.a0[1].a1) << ")], "
19315 << static_cast<int>(a0.a1) << "), ([(" << a1.a0[0].a0 << ", "
19316 << static_cast<int>(a1.a0[0].a1) << "), (" << a1.a0[1].a0 << ", "
19317 << static_cast<int>(a1.a0[1].a1) << ")], "
19318 << static_cast<int>(a1.a1) << "), ([(" << a2.a0[0].a0 << ", "
19319 << static_cast<int>(a2.a0[0].a1) << "), (" << a2.a0[1].a0 << ", "
19320 << static_cast<int>(a2.a0[1].a1) << ")], "
19321 << static_cast<int>(a2.a1) << "), ([(" << a3.a0[0].a0 << ", "
19322 << static_cast<int>(a3.a0[0].a1) << "), (" << a3.a0[1].a0 << ", "
19323 << static_cast<int>(a3.a0[1].a1) << ")], "
19324 << static_cast<int>(a3.a1) << "))" << ")\n";
19325
19326 f(a0, a1, a2, a3);
19327}

◆ TestAsyncPassStructNestedAlignmentStruct5BytesPackedMixed()

DART_EXPORT void dart::TestAsyncPassStructNestedAlignmentStruct5BytesPackedMixed ( void(*)(StructNestedAlignmentStruct5BytesPackedMixed a0)  f)

Definition at line 20147 of file ffi_test_functions_generated.cc.

20149 {
20151
20152 a0.a0 = 1;
20153 a0.a1.a0 = 2.0;
20154 a0.a1.a1 = 3;
20155
20156 std::cout
20157 << "Calling TestAsyncPassStructNestedAlignmentStruct5BytesPackedMixed("
20158 << "((" << static_cast<int>(a0.a0) << ", (" << a0.a1.a0 << ", "
20159 << static_cast<int>(a0.a1.a1) << ")))" << ")\n";
20160
20161 f(a0);
20162}

◆ TestAsyncPassStructNestedIntStructAlignmentInt16()

DART_EXPORT void dart::TestAsyncPassStructNestedIntStructAlignmentInt16 ( void(*)(StructNestedIntStructAlignmentInt16 a0)  f)

Definition at line 18928 of file ffi_test_functions_generated.cc.

18930 {
18932
18933 a0.a0.a0 = -1;
18934 a0.a0.a1 = 2;
18935 a0.a0.a2 = -3;
18936 a0.a1.a0 = 4;
18937 a0.a1.a1 = -5;
18938 a0.a1.a2 = 6;
18939
18940 std::cout << "Calling TestAsyncPassStructNestedIntStructAlignmentInt16("
18941 << "(((" << static_cast<int>(a0.a0.a0) << ", " << a0.a0.a1 << ", "
18942 << static_cast<int>(a0.a0.a2) << "), ("
18943 << static_cast<int>(a0.a1.a0) << ", " << a0.a1.a1 << ", "
18944 << static_cast<int>(a0.a1.a2) << ")))" << ")\n";
18945
18946 f(a0);
18947}

◆ TestAsyncPassStructNestedIntStructAlignmentInt32()

DART_EXPORT void dart::TestAsyncPassStructNestedIntStructAlignmentInt32 ( void(*)(StructNestedIntStructAlignmentInt32 a0)  f)

Definition at line 18951 of file ffi_test_functions_generated.cc.

18953 {
18955
18956 a0.a0.a0 = -1;
18957 a0.a0.a1 = 2;
18958 a0.a0.a2 = -3;
18959 a0.a1.a0 = 4;
18960 a0.a1.a1 = -5;
18961 a0.a1.a2 = 6;
18962
18963 std::cout << "Calling TestAsyncPassStructNestedIntStructAlignmentInt32("
18964 << "(((" << static_cast<int>(a0.a0.a0) << ", " << a0.a0.a1 << ", "
18965 << static_cast<int>(a0.a0.a2) << "), ("
18966 << static_cast<int>(a0.a1.a0) << ", " << a0.a1.a1 << ", "
18967 << static_cast<int>(a0.a1.a2) << ")))" << ")\n";
18968
18969 f(a0);
18970}

◆ TestAsyncPassStructNestedIntStructAlignmentInt64()

DART_EXPORT void dart::TestAsyncPassStructNestedIntStructAlignmentInt64 ( void(*)(StructNestedIntStructAlignmentInt64 a0)  f)

Definition at line 18974 of file ffi_test_functions_generated.cc.

18976 {
18978
18979 a0.a0.a0 = -1;
18980 a0.a0.a1 = 2;
18981 a0.a0.a2 = -3;
18982 a0.a1.a0 = 4;
18983 a0.a1.a1 = -5;
18984 a0.a1.a2 = 6;
18985
18986 std::cout << "Calling TestAsyncPassStructNestedIntStructAlignmentInt64("
18987 << "(((" << static_cast<int>(a0.a0.a0) << ", " << a0.a0.a1 << ", "
18988 << static_cast<int>(a0.a0.a2) << "), ("
18989 << static_cast<int>(a0.a1.a0) << ", " << a0.a1.a1 << ", "
18990 << static_cast<int>(a0.a1.a2) << ")))" << ")\n";
18991
18992 f(a0);
18993}

◆ TestAsyncPassStructNestedIrregularEvenBiggerx4()

DART_EXPORT void dart::TestAsyncPassStructNestedIrregularEvenBiggerx4 ( void(*)(StructNestedIrregularEvenBigger a0, StructNestedIrregularEvenBigger a1, StructNestedIrregularEvenBigger a2, StructNestedIrregularEvenBigger a3)  f)

Definition at line 18997 of file ffi_test_functions_generated.cc.

19002 {
19004 StructNestedIrregularEvenBigger a1 = {};
19005 StructNestedIrregularEvenBigger a2 = {};
19006 StructNestedIrregularEvenBigger a3 = {};
19007
19008 a0.a0 = 1;
19009 a0.a1.a0.a0 = 2;
19010 a0.a1.a0.a1.a0.a0 = -3;
19011 a0.a1.a0.a1.a0.a1 = 4;
19012 a0.a1.a0.a1.a1.a0 = -5.0;
19013 a0.a1.a0.a2 = 6;
19014 a0.a1.a0.a3.a0.a0 = -7.0;
19015 a0.a1.a0.a3.a1 = 8.0;
19016 a0.a1.a0.a4 = 9;
19017 a0.a1.a0.a5.a0.a0 = 10.0;
19018 a0.a1.a0.a5.a1.a0 = -11.0;
19019 a0.a1.a0.a6 = 12;
19020 a0.a1.a1.a0.a0 = -13;
19021 a0.a1.a1.a0.a1 = 14;
19022 a0.a1.a1.a1.a0 = -15.0;
19023 a0.a1.a2 = 16.0;
19024 a0.a1.a3 = -17.0;
19025 a0.a2.a0.a0 = 18;
19026 a0.a2.a0.a1.a0.a0 = -19;
19027 a0.a2.a0.a1.a0.a1 = 20;
19028 a0.a2.a0.a1.a1.a0 = -21.0;
19029 a0.a2.a0.a2 = 22;
19030 a0.a2.a0.a3.a0.a0 = -23.0;
19031 a0.a2.a0.a3.a1 = 24.0;
19032 a0.a2.a0.a4 = 25;
19033 a0.a2.a0.a5.a0.a0 = 26.0;
19034 a0.a2.a0.a5.a1.a0 = -27.0;
19035 a0.a2.a0.a6 = 28;
19036 a0.a2.a1.a0.a0 = -29;
19037 a0.a2.a1.a0.a1 = 30;
19038 a0.a2.a1.a1.a0 = -31.0;
19039 a0.a2.a2 = 32.0;
19040 a0.a2.a3 = -33.0;
19041 a0.a3 = 34.0;
19042 a1.a0 = 35;
19043 a1.a1.a0.a0 = 36;
19044 a1.a1.a0.a1.a0.a0 = -37;
19045 a1.a1.a0.a1.a0.a1 = 38;
19046 a1.a1.a0.a1.a1.a0 = -39.0;
19047 a1.a1.a0.a2 = 40;
19048 a1.a1.a0.a3.a0.a0 = -41.0;
19049 a1.a1.a0.a3.a1 = 42.0;
19050 a1.a1.a0.a4 = 43;
19051 a1.a1.a0.a5.a0.a0 = 44.0;
19052 a1.a1.a0.a5.a1.a0 = -45.0;
19053 a1.a1.a0.a6 = 46;
19054 a1.a1.a1.a0.a0 = -47;
19055 a1.a1.a1.a0.a1 = 48;
19056 a1.a1.a1.a1.a0 = -49.0;
19057 a1.a1.a2 = 50.0;
19058 a1.a1.a3 = -51.0;
19059 a1.a2.a0.a0 = 52;
19060 a1.a2.a0.a1.a0.a0 = -53;
19061 a1.a2.a0.a1.a0.a1 = 54;
19062 a1.a2.a0.a1.a1.a0 = -55.0;
19063 a1.a2.a0.a2 = 56;
19064 a1.a2.a0.a3.a0.a0 = -57.0;
19065 a1.a2.a0.a3.a1 = 58.0;
19066 a1.a2.a0.a4 = 59;
19067 a1.a2.a0.a5.a0.a0 = 60.0;
19068 a1.a2.a0.a5.a1.a0 = -61.0;
19069 a1.a2.a0.a6 = 62;
19070 a1.a2.a1.a0.a0 = -63;
19071 a1.a2.a1.a0.a1 = 64;
19072 a1.a2.a1.a1.a0 = -65.0;
19073 a1.a2.a2 = 66.0;
19074 a1.a2.a3 = -67.0;
19075 a1.a3 = 68.0;
19076 a2.a0 = 69;
19077 a2.a1.a0.a0 = 70;
19078 a2.a1.a0.a1.a0.a0 = -71;
19079 a2.a1.a0.a1.a0.a1 = 72;
19080 a2.a1.a0.a1.a1.a0 = -73.0;
19081 a2.a1.a0.a2 = 74;
19082 a2.a1.a0.a3.a0.a0 = -75.0;
19083 a2.a1.a0.a3.a1 = 76.0;
19084 a2.a1.a0.a4 = 77;
19085 a2.a1.a0.a5.a0.a0 = 78.0;
19086 a2.a1.a0.a5.a1.a0 = -79.0;
19087 a2.a1.a0.a6 = 80;
19088 a2.a1.a1.a0.a0 = -81;
19089 a2.a1.a1.a0.a1 = 82;
19090 a2.a1.a1.a1.a0 = -83.0;
19091 a2.a1.a2 = 84.0;
19092 a2.a1.a3 = -85.0;
19093 a2.a2.a0.a0 = 86;
19094 a2.a2.a0.a1.a0.a0 = -87;
19095 a2.a2.a0.a1.a0.a1 = 88;
19096 a2.a2.a0.a1.a1.a0 = -89.0;
19097 a2.a2.a0.a2 = 90;
19098 a2.a2.a0.a3.a0.a0 = -91.0;
19099 a2.a2.a0.a3.a1 = 92.0;
19100 a2.a2.a0.a4 = 93;
19101 a2.a2.a0.a5.a0.a0 = 94.0;
19102 a2.a2.a0.a5.a1.a0 = -95.0;
19103 a2.a2.a0.a6 = 96;
19104 a2.a2.a1.a0.a0 = -97;
19105 a2.a2.a1.a0.a1 = 98;
19106 a2.a2.a1.a1.a0 = -99.0;
19107 a2.a2.a2 = 100.0;
19108 a2.a2.a3 = -101.0;
19109 a2.a3 = 102.0;
19110 a3.a0 = 103;
19111 a3.a1.a0.a0 = 104;
19112 a3.a1.a0.a1.a0.a0 = -105;
19113 a3.a1.a0.a1.a0.a1 = 106;
19114 a3.a1.a0.a1.a1.a0 = -107.0;
19115 a3.a1.a0.a2 = 108;
19116 a3.a1.a0.a3.a0.a0 = -109.0;
19117 a3.a1.a0.a3.a1 = 110.0;
19118 a3.a1.a0.a4 = 111;
19119 a3.a1.a0.a5.a0.a0 = 112.0;
19120 a3.a1.a0.a5.a1.a0 = -113.0;
19121 a3.a1.a0.a6 = 114;
19122 a3.a1.a1.a0.a0 = -115;
19123 a3.a1.a1.a0.a1 = 116;
19124 a3.a1.a1.a1.a0 = -117.0;
19125 a3.a1.a2 = 118.0;
19126 a3.a1.a3 = -119.0;
19127 a3.a2.a0.a0 = 120;
19128 a3.a2.a0.a1.a0.a0 = -121;
19129 a3.a2.a0.a1.a0.a1 = 122;
19130 a3.a2.a0.a1.a1.a0 = -123.0;
19131 a3.a2.a0.a2 = 124;
19132 a3.a2.a0.a3.a0.a0 = -125.0;
19133 a3.a2.a0.a3.a1 = 126.0;
19134 a3.a2.a0.a4 = 127;
19135 a3.a2.a0.a5.a0.a0 = 128.0;
19136 a3.a2.a0.a5.a1.a0 = -129.0;
19137 a3.a2.a0.a6 = 130;
19138 a3.a2.a1.a0.a0 = -131;
19139 a3.a2.a1.a0.a1 = 132;
19140 a3.a2.a1.a1.a0 = -133.0;
19141 a3.a2.a2 = 134.0;
19142 a3.a2.a3 = -135.0;
19143 a3.a3 = 136.0;
19144
19145 std::cout
19146 << "Calling TestAsyncPassStructNestedIrregularEvenBiggerx4(" << "(("
19147 << a0.a0 << ", ((" << a0.a1.a0.a0 << ", ((" << a0.a1.a0.a1.a0.a0 << ", "
19148 << a0.a1.a0.a1.a0.a1 << "), (" << a0.a1.a0.a1.a1.a0 << ")), "
19149 << a0.a1.a0.a2 << ", ((" << a0.a1.a0.a3.a0.a0 << "), " << a0.a1.a0.a3.a1
19150 << "), " << a0.a1.a0.a4 << ", ((" << a0.a1.a0.a5.a0.a0 << "), ("
19151 << a0.a1.a0.a5.a1.a0 << ")), " << a0.a1.a0.a6 << "), ((" << a0.a1.a1.a0.a0
19152 << ", " << a0.a1.a1.a0.a1 << "), (" << a0.a1.a1.a1.a0 << ")), "
19153 << a0.a1.a2 << ", " << a0.a1.a3 << "), ((" << a0.a2.a0.a0 << ", (("
19154 << a0.a2.a0.a1.a0.a0 << ", " << a0.a2.a0.a1.a0.a1 << "), ("
19155 << a0.a2.a0.a1.a1.a0 << ")), " << a0.a2.a0.a2 << ", (("
19156 << a0.a2.a0.a3.a0.a0 << "), " << a0.a2.a0.a3.a1 << "), " << a0.a2.a0.a4
19157 << ", ((" << a0.a2.a0.a5.a0.a0 << "), (" << a0.a2.a0.a5.a1.a0 << ")), "
19158 << a0.a2.a0.a6 << "), ((" << a0.a2.a1.a0.a0 << ", " << a0.a2.a1.a0.a1
19159 << "), (" << a0.a2.a1.a1.a0 << ")), " << a0.a2.a2 << ", " << a0.a2.a3
19160 << "), " << a0.a3 << "), (" << a1.a0 << ", ((" << a1.a1.a0.a0 << ", (("
19161 << a1.a1.a0.a1.a0.a0 << ", " << a1.a1.a0.a1.a0.a1 << "), ("
19162 << a1.a1.a0.a1.a1.a0 << ")), " << a1.a1.a0.a2 << ", (("
19163 << a1.a1.a0.a3.a0.a0 << "), " << a1.a1.a0.a3.a1 << "), " << a1.a1.a0.a4
19164 << ", ((" << a1.a1.a0.a5.a0.a0 << "), (" << a1.a1.a0.a5.a1.a0 << ")), "
19165 << a1.a1.a0.a6 << "), ((" << a1.a1.a1.a0.a0 << ", " << a1.a1.a1.a0.a1
19166 << "), (" << a1.a1.a1.a1.a0 << ")), " << a1.a1.a2 << ", " << a1.a1.a3
19167 << "), ((" << a1.a2.a0.a0 << ", ((" << a1.a2.a0.a1.a0.a0 << ", "
19168 << a1.a2.a0.a1.a0.a1 << "), (" << a1.a2.a0.a1.a1.a0 << ")), "
19169 << a1.a2.a0.a2 << ", ((" << a1.a2.a0.a3.a0.a0 << "), " << a1.a2.a0.a3.a1
19170 << "), " << a1.a2.a0.a4 << ", ((" << a1.a2.a0.a5.a0.a0 << "), ("
19171 << a1.a2.a0.a5.a1.a0 << ")), " << a1.a2.a0.a6 << "), ((" << a1.a2.a1.a0.a0
19172 << ", " << a1.a2.a1.a0.a1 << "), (" << a1.a2.a1.a1.a0 << ")), "
19173 << a1.a2.a2 << ", " << a1.a2.a3 << "), " << a1.a3 << "), (" << a2.a0
19174 << ", ((" << a2.a1.a0.a0 << ", ((" << a2.a1.a0.a1.a0.a0 << ", "
19175 << a2.a1.a0.a1.a0.a1 << "), (" << a2.a1.a0.a1.a1.a0 << ")), "
19176 << a2.a1.a0.a2 << ", ((" << a2.a1.a0.a3.a0.a0 << "), " << a2.a1.a0.a3.a1
19177 << "), " << a2.a1.a0.a4 << ", ((" << a2.a1.a0.a5.a0.a0 << "), ("
19178 << a2.a1.a0.a5.a1.a0 << ")), " << a2.a1.a0.a6 << "), ((" << a2.a1.a1.a0.a0
19179 << ", " << a2.a1.a1.a0.a1 << "), (" << a2.a1.a1.a1.a0 << ")), "
19180 << a2.a1.a2 << ", " << a2.a1.a3 << "), ((" << a2.a2.a0.a0 << ", (("
19181 << a2.a2.a0.a1.a0.a0 << ", " << a2.a2.a0.a1.a0.a1 << "), ("
19182 << a2.a2.a0.a1.a1.a0 << ")), " << a2.a2.a0.a2 << ", (("
19183 << a2.a2.a0.a3.a0.a0 << "), " << a2.a2.a0.a3.a1 << "), " << a2.a2.a0.a4
19184 << ", ((" << a2.a2.a0.a5.a0.a0 << "), (" << a2.a2.a0.a5.a1.a0 << ")), "
19185 << a2.a2.a0.a6 << "), ((" << a2.a2.a1.a0.a0 << ", " << a2.a2.a1.a0.a1
19186 << "), (" << a2.a2.a1.a1.a0 << ")), " << a2.a2.a2 << ", " << a2.a2.a3
19187 << "), " << a2.a3 << "), (" << a3.a0 << ", ((" << a3.a1.a0.a0 << ", (("
19188 << a3.a1.a0.a1.a0.a0 << ", " << a3.a1.a0.a1.a0.a1 << "), ("
19189 << a3.a1.a0.a1.a1.a0 << ")), " << a3.a1.a0.a2 << ", (("
19190 << a3.a1.a0.a3.a0.a0 << "), " << a3.a1.a0.a3.a1 << "), " << a3.a1.a0.a4
19191 << ", ((" << a3.a1.a0.a5.a0.a0 << "), (" << a3.a1.a0.a5.a1.a0 << ")), "
19192 << a3.a1.a0.a6 << "), ((" << a3.a1.a1.a0.a0 << ", " << a3.a1.a1.a0.a1
19193 << "), (" << a3.a1.a1.a1.a0 << ")), " << a3.a1.a2 << ", " << a3.a1.a3
19194 << "), ((" << a3.a2.a0.a0 << ", ((" << a3.a2.a0.a1.a0.a0 << ", "
19195 << a3.a2.a0.a1.a0.a1 << "), (" << a3.a2.a0.a1.a1.a0 << ")), "
19196 << a3.a2.a0.a2 << ", ((" << a3.a2.a0.a3.a0.a0 << "), " << a3.a2.a0.a3.a1
19197 << "), " << a3.a2.a0.a4 << ", ((" << a3.a2.a0.a5.a0.a0 << "), ("
19198 << a3.a2.a0.a5.a1.a0 << ")), " << a3.a2.a0.a6 << "), ((" << a3.a2.a1.a0.a0
19199 << ", " << a3.a2.a1.a0.a1 << "), (" << a3.a2.a1.a1.a0 << ")), "
19200 << a3.a2.a2 << ", " << a3.a2.a3 << "), " << a3.a3 << "))" << ")\n";
19201
19202 f(a0, a1, a2, a3);
19203}

◆ TestAsyncPassStructStruct16BytesHomogeneousFloat2x5()

Definition at line 19513 of file ffi_test_functions_generated.cc.

19519 {
19521 StructStruct16BytesHomogeneousFloat2 a1 = {};
19522 StructStruct16BytesHomogeneousFloat2 a2 = {};
19523 StructStruct16BytesHomogeneousFloat2 a3 = {};
19524 StructStruct16BytesHomogeneousFloat2 a4 = {};
19525
19526 a0.a0.a0 = -1.0;
19527 a0.a1[0].a0 = 2.0;
19528 a0.a1[1].a0 = -3.0;
19529 a0.a2 = 4.0;
19530 a1.a0.a0 = -5.0;
19531 a1.a1[0].a0 = 6.0;
19532 a1.a1[1].a0 = -7.0;
19533 a1.a2 = 8.0;
19534 a2.a0.a0 = -9.0;
19535 a2.a1[0].a0 = 10.0;
19536 a2.a1[1].a0 = -11.0;
19537 a2.a2 = 12.0;
19538 a3.a0.a0 = -13.0;
19539 a3.a1[0].a0 = 14.0;
19540 a3.a1[1].a0 = -15.0;
19541 a3.a2 = 16.0;
19542 a4.a0.a0 = -17.0;
19543 a4.a1[0].a0 = 18.0;
19544 a4.a1[1].a0 = -19.0;
19545 a4.a2 = 20.0;
19546
19547 std::cout << "Calling TestAsyncPassStructStruct16BytesHomogeneousFloat2x5("
19548 << "(((" << a0.a0.a0 << "), [(" << a0.a1[0].a0 << "), ("
19549 << a0.a1[1].a0 << ")], " << a0.a2 << "), ((" << a1.a0.a0 << "), [("
19550 << a1.a1[0].a0 << "), (" << a1.a1[1].a0 << ")], " << a1.a2
19551 << "), ((" << a2.a0.a0 << "), [(" << a2.a1[0].a0 << "), ("
19552 << a2.a1[1].a0 << ")], " << a2.a2 << "), ((" << a3.a0.a0 << "), [("
19553 << a3.a1[0].a0 << "), (" << a3.a1[1].a0 << ")], " << a3.a2
19554 << "), ((" << a4.a0.a0 << "), [(" << a4.a1[0].a0 << "), ("
19555 << a4.a1[1].a0 << ")], " << a4.a2 << "))" << ")\n";
19556
19557 f(a0, a1, a2, a3, a4);
19558}

◆ TestAsyncPassStructStruct16BytesMixed3x10()

Definition at line 19615 of file ffi_test_functions_generated.cc.

19626 {
19628 StructStruct16BytesMixed3 a1 = {};
19629 StructStruct16BytesMixed3 a2 = {};
19630 StructStruct16BytesMixed3 a3 = {};
19631 StructStruct16BytesMixed3 a4 = {};
19632 StructStruct16BytesMixed3 a5 = {};
19633 StructStruct16BytesMixed3 a6 = {};
19634 StructStruct16BytesMixed3 a7 = {};
19635 StructStruct16BytesMixed3 a8 = {};
19636 StructStruct16BytesMixed3 a9 = {};
19637
19638 a0.a0.a0 = -1.0;
19639 a0.a1[0].a0 = 2.0;
19640 a0.a1[0].a1 = -3;
19641 a0.a1[0].a2 = 4;
19642 a0.a2[0] = -5;
19643 a0.a2[1] = 6;
19644 a1.a0.a0 = -7.0;
19645 a1.a1[0].a0 = 8.0;
19646 a1.a1[0].a1 = -9;
19647 a1.a1[0].a2 = 10;
19648 a1.a2[0] = -11;
19649 a1.a2[1] = 12;
19650 a2.a0.a0 = -13.0;
19651 a2.a1[0].a0 = 14.0;
19652 a2.a1[0].a1 = -15;
19653 a2.a1[0].a2 = 16;
19654 a2.a2[0] = -17;
19655 a2.a2[1] = 18;
19656 a3.a0.a0 = -19.0;
19657 a3.a1[0].a0 = 20.0;
19658 a3.a1[0].a1 = -21;
19659 a3.a1[0].a2 = 22;
19660 a3.a2[0] = -23;
19661 a3.a2[1] = 24;
19662 a4.a0.a0 = -25.0;
19663 a4.a1[0].a0 = 26.0;
19664 a4.a1[0].a1 = -27;
19665 a4.a1[0].a2 = 28;
19666 a4.a2[0] = -29;
19667 a4.a2[1] = 30;
19668 a5.a0.a0 = -31.0;
19669 a5.a1[0].a0 = 32.0;
19670 a5.a1[0].a1 = -33;
19671 a5.a1[0].a2 = 34;
19672 a5.a2[0] = -35;
19673 a5.a2[1] = 36;
19674 a6.a0.a0 = -37.0;
19675 a6.a1[0].a0 = 38.0;
19676 a6.a1[0].a1 = -39;
19677 a6.a1[0].a2 = 40;
19678 a6.a2[0] = -41;
19679 a6.a2[1] = 42;
19680 a7.a0.a0 = -43.0;
19681 a7.a1[0].a0 = 44.0;
19682 a7.a1[0].a1 = -45;
19683 a7.a1[0].a2 = 46;
19684 a7.a2[0] = -47;
19685 a7.a2[1] = 48;
19686 a8.a0.a0 = -49.0;
19687 a8.a1[0].a0 = 50.0;
19688 a8.a1[0].a1 = -51;
19689 a8.a1[0].a2 = 52;
19690 a8.a2[0] = -53;
19691 a8.a2[1] = 54;
19692 a9.a0.a0 = -55.0;
19693 a9.a1[0].a0 = 56.0;
19694 a9.a1[0].a1 = -57;
19695 a9.a1[0].a2 = 58;
19696 a9.a2[0] = -59;
19697 a9.a2[1] = 60;
19698
19699 std::cout << "Calling TestAsyncPassStructStruct16BytesMixed3x10(" << "((("
19700 << a0.a0.a0 << "), [(" << a0.a1[0].a0 << ", " << a0.a1[0].a1 << ", "
19701 << a0.a1[0].a2 << ")], [" << a0.a2[0] << ", " << a0.a2[1]
19702 << "]), ((" << a1.a0.a0 << "), [(" << a1.a1[0].a0 << ", "
19703 << a1.a1[0].a1 << ", " << a1.a1[0].a2 << ")], [" << a1.a2[0] << ", "
19704 << a1.a2[1] << "]), ((" << a2.a0.a0 << "), [(" << a2.a1[0].a0
19705 << ", " << a2.a1[0].a1 << ", " << a2.a1[0].a2 << ")], [" << a2.a2[0]
19706 << ", " << a2.a2[1] << "]), ((" << a3.a0.a0 << "), [("
19707 << a3.a1[0].a0 << ", " << a3.a1[0].a1 << ", " << a3.a1[0].a2
19708 << ")], [" << a3.a2[0] << ", " << a3.a2[1] << "]), ((" << a4.a0.a0
19709 << "), [(" << a4.a1[0].a0 << ", " << a4.a1[0].a1 << ", "
19710 << a4.a1[0].a2 << ")], [" << a4.a2[0] << ", " << a4.a2[1]
19711 << "]), ((" << a5.a0.a0 << "), [(" << a5.a1[0].a0 << ", "
19712 << a5.a1[0].a1 << ", " << a5.a1[0].a2 << ")], [" << a5.a2[0] << ", "
19713 << a5.a2[1] << "]), ((" << a6.a0.a0 << "), [(" << a6.a1[0].a0
19714 << ", " << a6.a1[0].a1 << ", " << a6.a1[0].a2 << ")], [" << a6.a2[0]
19715 << ", " << a6.a2[1] << "]), ((" << a7.a0.a0 << "), [("
19716 << a7.a1[0].a0 << ", " << a7.a1[0].a1 << ", " << a7.a1[0].a2
19717 << ")], [" << a7.a2[0] << ", " << a7.a2[1] << "]), ((" << a8.a0.a0
19718 << "), [(" << a8.a1[0].a0 << ", " << a8.a1[0].a1 << ", "
19719 << a8.a1[0].a2 << ")], [" << a8.a2[0] << ", " << a8.a2[1]
19720 << "]), ((" << a9.a0.a0 << "), [(" << a9.a1[0].a0 << ", "
19721 << a9.a1[0].a1 << ", " << a9.a1[0].a2 << ")], [" << a9.a2[0] << ", "
19722 << a9.a2[1] << "]))" << ")\n";
19723
19724 f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
19725}

◆ TestAsyncPassStructStruct32BytesHomogeneousDouble2x5()

Definition at line 19563 of file ffi_test_functions_generated.cc.

19569 {
19571 StructStruct32BytesHomogeneousDouble2 a1 = {};
19572 StructStruct32BytesHomogeneousDouble2 a2 = {};
19573 StructStruct32BytesHomogeneousDouble2 a3 = {};
19574 StructStruct32BytesHomogeneousDouble2 a4 = {};
19575
19576 a0.a0.a0 = -1.0;
19577 a0.a1[0].a0 = 2.0;
19578 a0.a1[1].a0 = -3.0;
19579 a0.a2 = 4.0;
19580 a1.a0.a0 = -5.0;
19581 a1.a1[0].a0 = 6.0;
19582 a1.a1[1].a0 = -7.0;
19583 a1.a2 = 8.0;
19584 a2.a0.a0 = -9.0;
19585 a2.a1[0].a0 = 10.0;
19586 a2.a1[1].a0 = -11.0;
19587 a2.a2 = 12.0;
19588 a3.a0.a0 = -13.0;
19589 a3.a1[0].a0 = 14.0;
19590 a3.a1[1].a0 = -15.0;
19591 a3.a2 = 16.0;
19592 a4.a0.a0 = -17.0;
19593 a4.a1[0].a0 = 18.0;
19594 a4.a1[1].a0 = -19.0;
19595 a4.a2 = 20.0;
19596
19597 std::cout << "Calling TestAsyncPassStructStruct32BytesHomogeneousDouble2x5("
19598 << "(((" << a0.a0.a0 << "), [(" << a0.a1[0].a0 << "), ("
19599 << a0.a1[1].a0 << ")], " << a0.a2 << "), ((" << a1.a0.a0 << "), [("
19600 << a1.a1[0].a0 << "), (" << a1.a1[1].a0 << ")], " << a1.a2
19601 << "), ((" << a2.a0.a0 << "), [(" << a2.a1[0].a0 << "), ("
19602 << a2.a1[1].a0 << ")], " << a2.a2 << "), ((" << a3.a0.a0 << "), [("
19603 << a3.a1[0].a0 << "), (" << a3.a1[1].a0 << ")], " << a3.a2
19604 << "), ((" << a4.a0.a0 << "), [(" << a4.a1[0].a0 << "), ("
19605 << a4.a1[1].a0 << ")], " << a4.a2 << "))" << ")\n";
19606
19607 f(a0, a1, a2, a3, a4);
19608}

◆ TestAsyncPassUint8Boolx9Struct10BytesHomogeneousBoolBool()

DART_EXPORT void dart::TestAsyncPassUint8Boolx9Struct10BytesHomogeneousBoolBool ( void(*)(uint8_t a0, bool a1, bool a2, bool a3, bool a4, bool a5, bool a6, bool a7, bool a8, bool a9, Struct10BytesHomogeneousBool a10, bool a11)  f)

Definition at line 20514 of file ffi_test_functions_generated.cc.

20527 {
20528 uint8_t a0;
20529 bool a1;
20530 bool a2;
20531 bool a3;
20532 bool a4;
20533 bool a5;
20534 bool a6;
20535 bool a7;
20536 bool a8;
20537 bool a9;
20539 bool a11;
20540
20541 a0 = 1;
20542 a1 = false;
20543 a2 = true;
20544 a3 = false;
20545 a4 = true;
20546 a5 = false;
20547 a6 = true;
20548 a7 = false;
20549 a8 = true;
20550 a9 = false;
20551 a10.a0 = true;
20552 a10.a1 = false;
20553 a10.a2 = true;
20554 a10.a3 = false;
20555 a10.a4 = true;
20556 a10.a5 = false;
20557 a10.a6 = true;
20558 a10.a7 = false;
20559 a10.a8 = true;
20560 a10.a9 = false;
20561 a11 = true;
20562
20563 std::cout
20564 << "Calling TestAsyncPassUint8Boolx9Struct10BytesHomogeneousBoolBool("
20565 << "(" << static_cast<int>(a0) << ", " << a1 << ", " << a2 << ", " << a3
20566 << ", " << a4 << ", " << a5 << ", " << a6 << ", " << a7 << ", " << a8
20567 << ", " << a9 << ", (" << a10.a0 << ", " << a10.a1 << ", " << a10.a2
20568 << ", " << a10.a3 << ", " << a10.a4 << ", " << a10.a5 << ", " << a10.a6
20569 << ", " << a10.a7 << ", " << a10.a8 << ", " << a10.a9 << "), " << a11
20570 << ")" << ")\n";
20571
20572 f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11);
20573}

◆ TestAsyncPassUint8Boolx9Struct10BytesInlineArrayBoolBool()

DART_EXPORT void dart::TestAsyncPassUint8Boolx9Struct10BytesInlineArrayBoolBool ( void(*)(uint8_t a0, bool a1, bool a2, bool a3, bool a4, bool a5, bool a6, bool a7, bool a8, bool a9, Struct10BytesInlineArrayBool a10, bool a11)  f)

Definition at line 20579 of file ffi_test_functions_generated.cc.

20592 {
20593 uint8_t a0;
20594 bool a1;
20595 bool a2;
20596 bool a3;
20597 bool a4;
20598 bool a5;
20599 bool a6;
20600 bool a7;
20601 bool a8;
20602 bool a9;
20604 bool a11;
20605
20606 a0 = 1;
20607 a1 = false;
20608 a2 = true;
20609 a3 = false;
20610 a4 = true;
20611 a5 = false;
20612 a6 = true;
20613 a7 = false;
20614 a8 = true;
20615 a9 = false;
20616 a10.a0[0] = true;
20617 a10.a0[1] = false;
20618 a10.a0[2] = true;
20619 a10.a0[3] = false;
20620 a10.a0[4] = true;
20621 a10.a0[5] = false;
20622 a10.a0[6] = true;
20623 a10.a0[7] = false;
20624 a10.a0[8] = true;
20625 a10.a0[9] = false;
20626 a11 = true;
20627
20628 std::cout
20629 << "Calling TestAsyncPassUint8Boolx9Struct10BytesInlineArrayBoolBool("
20630 << "(" << static_cast<int>(a0) << ", " << a1 << ", " << a2 << ", " << a3
20631 << ", " << a4 << ", " << a5 << ", " << a6 << ", " << a7 << ", " << a8
20632 << ", " << a9 << ", ([" << a10.a0[0] << ", " << a10.a0[1] << ", "
20633 << a10.a0[2] << ", " << a10.a0[3] << ", " << a10.a0[4] << ", "
20634 << a10.a0[5] << ", " << a10.a0[6] << ", " << a10.a0[7] << ", "
20635 << a10.a0[8] << ", " << a10.a0[9] << "]), " << a11 << ")" << ")\n";
20636
20637 f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11);
20638}

◆ TestAsyncPassUint8Struct1ByteBool()

DART_EXPORT void dart::TestAsyncPassUint8Struct1ByteBool ( void(*)(uint8_t a0, Struct1ByteBool a1)  f)

Definition at line 20642 of file ffi_test_functions_generated.cc.

20644 {
20645 uint8_t a0;
20646 Struct1ByteBool a1 = {};
20647
20648 a0 = 1;
20649 a1.a0 = false;
20650
20651 std::cout << "Calling TestAsyncPassUint8Struct1ByteBool(" << "("
20652 << static_cast<int>(a0) << ", (" << a1.a0 << "))" << ")\n";
20653
20654 f(a0, a1);
20655}

◆ TestAsyncPassUint8Struct32BytesInlineArrayMultiDimensionalI()

DART_EXPORT void dart::TestAsyncPassUint8Struct32BytesInlineArrayMultiDimensionalI ( void(*)(uint8_t a0, Struct32BytesInlineArrayMultiDimensionalInt a1, uint8_t a2, Struct8BytesInlineArrayMultiDimensionalInt a3, uint8_t a4, Struct8BytesInlineArrayMultiDimensionalInt a5, uint8_t a6)  f)

Definition at line 19729 of file ffi_test_functions_generated.cc.

19737 {
19738 uint8_t a0;
19740 uint8_t a2;
19741 Struct8BytesInlineArrayMultiDimensionalInt a3 = {};
19742 uint8_t a4;
19743 Struct8BytesInlineArrayMultiDimensionalInt a5 = {};
19744 uint8_t a6;
19745
19746 a0 = 1;
19747 a1.a0[0][0][0][0][0] = 2;
19748 a1.a0[0][0][0][0][1] = 3;
19749 a1.a0[0][0][0][1][0] = 4;
19750 a1.a0[0][0][0][1][1] = 5;
19751 a1.a0[0][0][1][0][0] = 6;
19752 a1.a0[0][0][1][0][1] = 7;
19753 a1.a0[0][0][1][1][0] = 8;
19754 a1.a0[0][0][1][1][1] = 9;
19755 a1.a0[0][1][0][0][0] = 10;
19756 a1.a0[0][1][0][0][1] = 11;
19757 a1.a0[0][1][0][1][0] = 12;
19758 a1.a0[0][1][0][1][1] = 13;
19759 a1.a0[0][1][1][0][0] = 14;
19760 a1.a0[0][1][1][0][1] = 15;
19761 a1.a0[0][1][1][1][0] = 16;
19762 a1.a0[0][1][1][1][1] = 17;
19763 a1.a0[1][0][0][0][0] = 18;
19764 a1.a0[1][0][0][0][1] = 19;
19765 a1.a0[1][0][0][1][0] = 20;
19766 a1.a0[1][0][0][1][1] = 21;
19767 a1.a0[1][0][1][0][0] = 22;
19768 a1.a0[1][0][1][0][1] = 23;
19769 a1.a0[1][0][1][1][0] = 24;
19770 a1.a0[1][0][1][1][1] = 25;
19771 a1.a0[1][1][0][0][0] = 26;
19772 a1.a0[1][1][0][0][1] = 27;
19773 a1.a0[1][1][0][1][0] = 28;
19774 a1.a0[1][1][0][1][1] = 29;
19775 a1.a0[1][1][1][0][0] = 30;
19776 a1.a0[1][1][1][0][1] = 31;
19777 a1.a0[1][1][1][1][0] = 32;
19778 a1.a0[1][1][1][1][1] = 33;
19779 a2 = 34;
19780 a3.a0[0][0][0] = 35;
19781 a3.a0[0][0][1] = 36;
19782 a3.a0[0][1][0] = 37;
19783 a3.a0[0][1][1] = 38;
19784 a3.a0[1][0][0] = 39;
19785 a3.a0[1][0][1] = 40;
19786 a3.a0[1][1][0] = 41;
19787 a3.a0[1][1][1] = 42;
19788 a4 = 43;
19789 a5.a0[0][0][0] = 44;
19790 a5.a0[0][0][1] = 45;
19791 a5.a0[0][1][0] = 46;
19792 a5.a0[0][1][1] = 47;
19793 a5.a0[1][0][0] = 48;
19794 a5.a0[1][0][1] = 49;
19795 a5.a0[1][1][0] = 50;
19796 a5.a0[1][1][1] = 51;
19797 a6 = 52;
19798
19799 std::cout
19800 << "Calling TestAsyncPassUint8Struct32BytesInlineArrayMultiDimensionalI("
19801 << "(" << static_cast<int>(a0) << ", ([[[[["
19802 << static_cast<int>(a1.a0[0][0][0][0][0]) << ", "
19803 << static_cast<int>(a1.a0[0][0][0][0][1]) << "], ["
19804 << static_cast<int>(a1.a0[0][0][0][1][0]) << ", "
19805 << static_cast<int>(a1.a0[0][0][0][1][1]) << "]], [["
19806 << static_cast<int>(a1.a0[0][0][1][0][0]) << ", "
19807 << static_cast<int>(a1.a0[0][0][1][0][1]) << "], ["
19808 << static_cast<int>(a1.a0[0][0][1][1][0]) << ", "
19809 << static_cast<int>(a1.a0[0][0][1][1][1]) << "]]], [[["
19810 << static_cast<int>(a1.a0[0][1][0][0][0]) << ", "
19811 << static_cast<int>(a1.a0[0][1][0][0][1]) << "], ["
19812 << static_cast<int>(a1.a0[0][1][0][1][0]) << ", "
19813 << static_cast<int>(a1.a0[0][1][0][1][1]) << "]], [["
19814 << static_cast<int>(a1.a0[0][1][1][0][0]) << ", "
19815 << static_cast<int>(a1.a0[0][1][1][0][1]) << "], ["
19816 << static_cast<int>(a1.a0[0][1][1][1][0]) << ", "
19817 << static_cast<int>(a1.a0[0][1][1][1][1]) << "]]]], [[[["
19818 << static_cast<int>(a1.a0[1][0][0][0][0]) << ", "
19819 << static_cast<int>(a1.a0[1][0][0][0][1]) << "], ["
19820 << static_cast<int>(a1.a0[1][0][0][1][0]) << ", "
19821 << static_cast<int>(a1.a0[1][0][0][1][1]) << "]], [["
19822 << static_cast<int>(a1.a0[1][0][1][0][0]) << ", "
19823 << static_cast<int>(a1.a0[1][0][1][0][1]) << "], ["
19824 << static_cast<int>(a1.a0[1][0][1][1][0]) << ", "
19825 << static_cast<int>(a1.a0[1][0][1][1][1]) << "]]], [[["
19826 << static_cast<int>(a1.a0[1][1][0][0][0]) << ", "
19827 << static_cast<int>(a1.a0[1][1][0][0][1]) << "], ["
19828 << static_cast<int>(a1.a0[1][1][0][1][0]) << ", "
19829 << static_cast<int>(a1.a0[1][1][0][1][1]) << "]], [["
19830 << static_cast<int>(a1.a0[1][1][1][0][0]) << ", "
19831 << static_cast<int>(a1.a0[1][1][1][0][1]) << "], ["
19832 << static_cast<int>(a1.a0[1][1][1][1][0]) << ", "
19833 << static_cast<int>(a1.a0[1][1][1][1][1]) << "]]]]]), "
19834 << static_cast<int>(a2) << ", ([[[" << static_cast<int>(a3.a0[0][0][0])
19835 << ", " << static_cast<int>(a3.a0[0][0][1]) << "], ["
19836 << static_cast<int>(a3.a0[0][1][0]) << ", "
19837 << static_cast<int>(a3.a0[0][1][1]) << "]], [["
19838 << static_cast<int>(a3.a0[1][0][0]) << ", "
19839 << static_cast<int>(a3.a0[1][0][1]) << "], ["
19840 << static_cast<int>(a3.a0[1][1][0]) << ", "
19841 << static_cast<int>(a3.a0[1][1][1]) << "]]]), " << static_cast<int>(a4)
19842 << ", ([[[" << static_cast<int>(a5.a0[0][0][0]) << ", "
19843 << static_cast<int>(a5.a0[0][0][1]) << "], ["
19844 << static_cast<int>(a5.a0[0][1][0]) << ", "
19845 << static_cast<int>(a5.a0[0][1][1]) << "]], [["
19846 << static_cast<int>(a5.a0[1][0][0]) << ", "
19847 << static_cast<int>(a5.a0[1][0][1]) << "], ["
19848 << static_cast<int>(a5.a0[1][1][0]) << ", "
19849 << static_cast<int>(a5.a0[1][1][1]) << "]]]), " << static_cast<int>(a6)
19850 << ")" << ")\n";
19851
19852 f(a0, a1, a2, a3, a4, a5, a6);
19853}

◆ TestAsyncPassUint8Struct4BytesInlineArrayMultiDimensionalIn()

DART_EXPORT void dart::TestAsyncPassUint8Struct4BytesInlineArrayMultiDimensionalIn ( void(*)(uint8_t a0, Struct4BytesInlineArrayMultiDimensionalInt a1, uint8_t a2)  f)

Definition at line 19857 of file ffi_test_functions_generated.cc.

19861 {
19862 uint8_t a0;
19864 uint8_t a2;
19865
19866 a0 = 1;
19867 a1.a0[0][0].a0 = 2;
19868 a1.a0[0][1].a0 = -3;
19869 a1.a0[1][0].a0 = 4;
19870 a1.a0[1][1].a0 = -5;
19871 a2 = 6;
19872
19873 std::cout
19874 << "Calling TestAsyncPassUint8Struct4BytesInlineArrayMultiDimensionalIn("
19875 << "(" << static_cast<int>(a0) << ", ([[("
19876 << static_cast<int>(a1.a0[0][0].a0) << "), ("
19877 << static_cast<int>(a1.a0[0][1].a0) << ")], [("
19878 << static_cast<int>(a1.a0[1][0].a0) << "), ("
19879 << static_cast<int>(a1.a0[1][1].a0) << ")]]), " << static_cast<int>(a2)
19880 << ")" << ")\n";
19881
19882 f(a0, a1, a2);
19883}

◆ TestAsyncPassUnion16BytesNestedFloatx10()

Definition at line 20454 of file ffi_test_functions_generated.cc.

20465 {
20467 Union16BytesNestedFloat a1 = {};
20468 Union16BytesNestedFloat a2 = {};
20469 Union16BytesNestedFloat a3 = {};
20470 Union16BytesNestedFloat a4 = {};
20471 Union16BytesNestedFloat a5 = {};
20472 Union16BytesNestedFloat a6 = {};
20473 Union16BytesNestedFloat a7 = {};
20474 Union16BytesNestedFloat a8 = {};
20475 Union16BytesNestedFloat a9 = {};
20476
20477 a0.a0.a0 = -1.0;
20478 a0.a0.a1 = 2.0;
20479 a1.a0.a0 = -3.0;
20480 a1.a0.a1 = 4.0;
20481 a2.a0.a0 = -5.0;
20482 a2.a0.a1 = 6.0;
20483 a3.a0.a0 = -7.0;
20484 a3.a0.a1 = 8.0;
20485 a4.a0.a0 = -9.0;
20486 a4.a0.a1 = 10.0;
20487 a5.a0.a0 = -11.0;
20488 a5.a0.a1 = 12.0;
20489 a6.a0.a0 = -13.0;
20490 a6.a0.a1 = 14.0;
20491 a7.a0.a0 = -15.0;
20492 a7.a0.a1 = 16.0;
20493 a8.a0.a0 = -17.0;
20494 a8.a0.a1 = 18.0;
20495 a9.a0.a0 = -19.0;
20496 a9.a0.a1 = 20.0;
20497
20498 std::cout << "Calling TestAsyncPassUnion16BytesNestedFloatx10(" << "((("
20499 << a0.a0.a0 << ", " << a0.a0.a1 << ")), ((" << a1.a0.a0 << ", "
20500 << a1.a0.a1 << ")), ((" << a2.a0.a0 << ", " << a2.a0.a1 << ")), (("
20501 << a3.a0.a0 << ", " << a3.a0.a1 << ")), ((" << a4.a0.a0 << ", "
20502 << a4.a0.a1 << ")), ((" << a5.a0.a0 << ", " << a5.a0.a1 << ")), (("
20503 << a6.a0.a0 << ", " << a6.a0.a1 << ")), ((" << a7.a0.a0 << ", "
20504 << a7.a0.a1 << ")), ((" << a8.a0.a0 << ", " << a8.a0.a1 << ")), (("
20505 << a9.a0.a0 << ", " << a9.a0.a1 << ")))" << ")\n";
20506
20507 f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
20508}

◆ TestAsyncPassUnion16BytesNestedInlineArrayFloatx10()

Definition at line 20369 of file ffi_test_functions_generated.cc.

20380 {
20382 Union16BytesNestedInlineArrayFloat a1 = {};
20383 Union16BytesNestedInlineArrayFloat a2 = {};
20384 Union16BytesNestedInlineArrayFloat a3 = {};
20385 Union16BytesNestedInlineArrayFloat a4 = {};
20386 Union16BytesNestedInlineArrayFloat a5 = {};
20387 Union16BytesNestedInlineArrayFloat a6 = {};
20388 Union16BytesNestedInlineArrayFloat a7 = {};
20389 Union16BytesNestedInlineArrayFloat a8 = {};
20390 Union16BytesNestedInlineArrayFloat a9 = {};
20391
20392 a0.a0[0] = -1.0;
20393 a0.a0[1] = 2.0;
20394 a0.a0[2] = -3.0;
20395 a0.a0[3] = 4.0;
20396 a1.a0[0] = -5.0;
20397 a1.a0[1] = 6.0;
20398 a1.a0[2] = -7.0;
20399 a1.a0[3] = 8.0;
20400 a2.a0[0] = -9.0;
20401 a2.a0[1] = 10.0;
20402 a2.a0[2] = -11.0;
20403 a2.a0[3] = 12.0;
20404 a3.a0[0] = -13.0;
20405 a3.a0[1] = 14.0;
20406 a3.a0[2] = -15.0;
20407 a3.a0[3] = 16.0;
20408 a4.a0[0] = -17.0;
20409 a4.a0[1] = 18.0;
20410 a4.a0[2] = -19.0;
20411 a4.a0[3] = 20.0;
20412 a5.a0[0] = -21.0;
20413 a5.a0[1] = 22.0;
20414 a5.a0[2] = -23.0;
20415 a5.a0[3] = 24.0;
20416 a6.a0[0] = -25.0;
20417 a6.a0[1] = 26.0;
20418 a6.a0[2] = -27.0;
20419 a6.a0[3] = 28.0;
20420 a7.a0[0] = -29.0;
20421 a7.a0[1] = 30.0;
20422 a7.a0[2] = -31.0;
20423 a7.a0[3] = 32.0;
20424 a8.a0[0] = -33.0;
20425 a8.a0[1] = 34.0;
20426 a8.a0[2] = -35.0;
20427 a8.a0[3] = 36.0;
20428 a9.a0[0] = -37.0;
20429 a9.a0[1] = 38.0;
20430 a9.a0[2] = -39.0;
20431 a9.a0[3] = 40.0;
20432
20433 std::cout << "Calling TestAsyncPassUnion16BytesNestedInlineArrayFloatx10("
20434 << "(([" << a0.a0[0] << ", " << a0.a0[1] << ", " << a0.a0[2] << ", "
20435 << a0.a0[3] << "]), ([" << a1.a0[0] << ", " << a1.a0[1] << ", "
20436 << a1.a0[2] << ", " << a1.a0[3] << "]), ([" << a2.a0[0] << ", "
20437 << a2.a0[1] << ", " << a2.a0[2] << ", " << a2.a0[3] << "]), (["
20438 << a3.a0[0] << ", " << a3.a0[1] << ", " << a3.a0[2] << ", "
20439 << a3.a0[3] << "]), ([" << a4.a0[0] << ", " << a4.a0[1] << ", "
20440 << a4.a0[2] << ", " << a4.a0[3] << "]), ([" << a5.a0[0] << ", "
20441 << a5.a0[1] << ", " << a5.a0[2] << ", " << a5.a0[3] << "]), (["
20442 << a6.a0[0] << ", " << a6.a0[1] << ", " << a6.a0[2] << ", "
20443 << a6.a0[3] << "]), ([" << a7.a0[0] << ", " << a7.a0[1] << ", "
20444 << a7.a0[2] << ", " << a7.a0[3] << "]), ([" << a8.a0[0] << ", "
20445 << a8.a0[1] << ", " << a8.a0[2] << ", " << a8.a0[3] << "]), (["
20446 << a9.a0[0] << ", " << a9.a0[1] << ", " << a9.a0[2] << ", "
20447 << a9.a0[3] << "]))" << ")\n";
20448
20449 f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
20450}

◆ TestAsyncPassUnion4BytesMixedx10()

Definition at line 20209 of file ffi_test_functions_generated.cc.

20220 {
20221 Union4BytesMixed a0 = {};
20222 Union4BytesMixed a1 = {};
20223 Union4BytesMixed a2 = {};
20224 Union4BytesMixed a3 = {};
20225 Union4BytesMixed a4 = {};
20226 Union4BytesMixed a5 = {};
20227 Union4BytesMixed a6 = {};
20228 Union4BytesMixed a7 = {};
20229 Union4BytesMixed a8 = {};
20230 Union4BytesMixed a9 = {};
20231
20232 a0.a0 = 1;
20233 a1.a0 = 2;
20234 a2.a0 = 3;
20235 a3.a0 = 4;
20236 a4.a0 = 5;
20237 a5.a0 = 6;
20238 a6.a0 = 7;
20239 a7.a0 = 8;
20240 a8.a0 = 9;
20241 a9.a0 = 10;
20242
20243 std::cout << "Calling TestAsyncPassUnion4BytesMixedx10(" << "((" << a0.a0
20244 << "), (" << a1.a0 << "), (" << a2.a0 << "), (" << a3.a0 << "), ("
20245 << a4.a0 << "), (" << a5.a0 << "), (" << a6.a0 << "), (" << a7.a0
20246 << "), (" << a8.a0 << "), (" << a9.a0 << "))" << ")\n";
20247
20248 f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
20249}

◆ TestAsyncPassUnion8BytesNestedFloatx10()

Definition at line 20253 of file ffi_test_functions_generated.cc.

20264 {
20265 Union8BytesNestedFloat a0 = {};
20266 Union8BytesNestedFloat a1 = {};
20267 Union8BytesNestedFloat a2 = {};
20268 Union8BytesNestedFloat a3 = {};
20269 Union8BytesNestedFloat a4 = {};
20270 Union8BytesNestedFloat a5 = {};
20271 Union8BytesNestedFloat a6 = {};
20272 Union8BytesNestedFloat a7 = {};
20273 Union8BytesNestedFloat a8 = {};
20274 Union8BytesNestedFloat a9 = {};
20275
20276 a0.a0 = -1.0;
20277 a1.a0 = 2.0;
20278 a2.a0 = -3.0;
20279 a3.a0 = 4.0;
20280 a4.a0 = -5.0;
20281 a5.a0 = 6.0;
20282 a6.a0 = -7.0;
20283 a7.a0 = 8.0;
20284 a8.a0 = -9.0;
20285 a9.a0 = 10.0;
20286
20287 std::cout << "Calling TestAsyncPassUnion8BytesNestedFloatx10(" << "(("
20288 << a0.a0 << "), (" << a1.a0 << "), (" << a2.a0 << "), (" << a3.a0
20289 << "), (" << a4.a0 << "), (" << a5.a0 << "), (" << a6.a0 << "), ("
20290 << a7.a0 << "), (" << a8.a0 << "), (" << a9.a0 << "))" << ")\n";
20291
20292 f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
20293}

◆ TestAsyncPassUnion9BytesNestedIntx10()

Definition at line 20297 of file ffi_test_functions_generated.cc.

20308 {
20309 Union9BytesNestedInt a0 = {};
20310 Union9BytesNestedInt a1 = {};
20311 Union9BytesNestedInt a2 = {};
20312 Union9BytesNestedInt a3 = {};
20313 Union9BytesNestedInt a4 = {};
20314 Union9BytesNestedInt a5 = {};
20315 Union9BytesNestedInt a6 = {};
20316 Union9BytesNestedInt a7 = {};
20317 Union9BytesNestedInt a8 = {};
20318 Union9BytesNestedInt a9 = {};
20319
20320 a0.a0.a0 = -1;
20321 a0.a0.a1 = 2;
20322 a0.a0.a2 = -3;
20323 a1.a0.a0 = 4;
20324 a1.a0.a1 = -5;
20325 a1.a0.a2 = 6;
20326 a2.a0.a0 = -7;
20327 a2.a0.a1 = 8;
20328 a2.a0.a2 = -9;
20329 a3.a0.a0 = 10;
20330 a3.a0.a1 = -11;
20331 a3.a0.a2 = 12;
20332 a4.a0.a0 = -13;
20333 a4.a0.a1 = 14;
20334 a4.a0.a2 = -15;
20335 a5.a0.a0 = 16;
20336 a5.a0.a1 = -17;
20337 a5.a0.a2 = 18;
20338 a6.a0.a0 = -19;
20339 a6.a0.a1 = 20;
20340 a6.a0.a2 = -21;
20341 a7.a0.a0 = 22;
20342 a7.a0.a1 = -23;
20343 a7.a0.a2 = 24;
20344 a8.a0.a0 = -25;
20345 a8.a0.a1 = 26;
20346 a8.a0.a2 = -27;
20347 a9.a0.a0 = 28;
20348 a9.a0.a1 = -29;
20349 a9.a0.a2 = 30;
20350
20351 std::cout << "Calling TestAsyncPassUnion9BytesNestedIntx10(" << "((("
20352 << a0.a0.a0 << ", " << a0.a0.a1 << ", " << a0.a0.a2 << ")), (("
20353 << a1.a0.a0 << ", " << a1.a0.a1 << ", " << a1.a0.a2 << ")), (("
20354 << a2.a0.a0 << ", " << a2.a0.a1 << ", " << a2.a0.a2 << ")), (("
20355 << a3.a0.a0 << ", " << a3.a0.a1 << ", " << a3.a0.a2 << ")), (("
20356 << a4.a0.a0 << ", " << a4.a0.a1 << ", " << a4.a0.a2 << ")), (("
20357 << a5.a0.a0 << ", " << a5.a0.a1 << ", " << a5.a0.a2 << ")), (("
20358 << a6.a0.a0 << ", " << a6.a0.a1 << ", " << a6.a0.a2 << ")), (("
20359 << a7.a0.a0 << ", " << a7.a0.a1 << ", " << a7.a0.a2 << ")), (("
20360 << a8.a0.a0 << ", " << a8.a0.a1 << ", " << a8.a0.a2 << ")), (("
20361 << a9.a0.a0 << ", " << a9.a0.a1 << ", " << a9.a0.a2 << ")))"
20362 << ")\n";
20363
20364 f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
20365}

◆ TestAsyncPassWCharStructInlineArrayIntUintPtrx2LongUnsigned()

DART_EXPORT void dart::TestAsyncPassWCharStructInlineArrayIntUintPtrx2LongUnsigned ( void(*)(wchar_t a0, StructInlineArrayInt a1, uintptr_t a2, uintptr_t a3, long a4, unsigned long a5)  f)

Definition at line 20659 of file ffi_test_functions_generated.cc.

20666 {
20667 wchar_t a0;
20668 StructInlineArrayInt a1 = {};
20669 uintptr_t a2;
20670 uintptr_t a3;
20671 /* NOLINT(runtime/int) */ long a4;
20672 /* NOLINT(runtime/int) */ unsigned long a5;
20673
20674 a0 = 1;
20675 a1.a0[0] = 2;
20676 a1.a0[1] = 3;
20677 a1.a0[2] = 4;
20678 a1.a0[3] = 5;
20679 a1.a0[4] = 6;
20680 a1.a0[5] = 7;
20681 a1.a0[6] = 8;
20682 a1.a0[7] = 9;
20683 a1.a0[8] = 10;
20684 a1.a0[9] = 11;
20685 a2 = 12;
20686 a3 = 13;
20687 a4 = 14;
20688 a5 = 15;
20689
20690 std::cout
20691 << "Calling TestAsyncPassWCharStructInlineArrayIntUintPtrx2LongUnsigned("
20692 << "(" << a0 << ", ([" << a1.a0[0] << ", " << a1.a0[1] << ", " << a1.a0[2]
20693 << ", " << a1.a0[3] << ", " << a1.a0[4] << ", " << a1.a0[5] << ", "
20694 << a1.a0[6] << ", " << a1.a0[7] << ", " << a1.a0[8] << ", " << a1.a0[9]
20695 << "]), " << a2 << ", " << a3 << ", " << a4 << ", " << a5 << ")" << ")\n";
20696
20697 f(a0, a1, a2, a3, a4, a5);
20698}

◆ TestAsyncReturnStruct1024BytesHomogeneousUint64()

DART_EXPORT void dart::TestAsyncReturnStruct1024BytesHomogeneousUint64 ( void(*)(uint64_t a0, uint64_t a1, uint64_t a2, uint64_t a3, uint64_t a4, uint64_t a5, uint64_t a6, uint64_t a7, uint64_t a8, uint64_t a9, uint64_t a10, uint64_t a11, uint64_t a12, uint64_t a13, uint64_t a14, uint64_t a15, uint64_t a16, uint64_t a17, uint64_t a18, uint64_t a19, uint64_t a20, uint64_t a21, uint64_t a22, uint64_t a23, uint64_t a24, uint64_t a25, uint64_t a26, uint64_t a27, uint64_t a28, uint64_t a29, uint64_t a30, uint64_t a31, uint64_t a32, uint64_t a33, uint64_t a34, uint64_t a35, uint64_t a36, uint64_t a37, uint64_t a38, uint64_t a39, uint64_t a40, uint64_t a41, uint64_t a42, uint64_t a43, uint64_t a44, uint64_t a45, uint64_t a46, uint64_t a47, uint64_t a48, uint64_t a49, uint64_t a50, uint64_t a51, uint64_t a52, uint64_t a53, uint64_t a54, uint64_t a55, uint64_t a56, uint64_t a57, uint64_t a58, uint64_t a59, uint64_t a60, uint64_t a61, uint64_t a62, uint64_t a63, uint64_t a64, uint64_t a65, uint64_t a66, uint64_t a67, uint64_t a68, uint64_t a69, uint64_t a70, uint64_t a71, uint64_t a72, uint64_t a73, uint64_t a74, uint64_t a75, uint64_t a76, uint64_t a77, uint64_t a78, uint64_t a79, uint64_t a80, uint64_t a81, uint64_t a82, uint64_t a83, uint64_t a84, uint64_t a85, uint64_t a86, uint64_t a87, uint64_t a88, uint64_t a89, uint64_t a90, uint64_t a91, uint64_t a92, uint64_t a93, uint64_t a94, uint64_t a95, uint64_t a96, uint64_t a97, uint64_t a98, uint64_t a99, uint64_t a100, uint64_t a101, uint64_t a102, uint64_t a103, uint64_t a104, uint64_t a105, uint64_t a106, uint64_t a107, uint64_t a108, uint64_t a109, uint64_t a110, uint64_t a111, uint64_t a112, uint64_t a113, uint64_t a114, uint64_t a115, uint64_t a116, uint64_t a117, uint64_t a118, uint64_t a119, uint64_t a120, uint64_t a121, uint64_t a122, uint64_t a123, uint64_t a124, uint64_t a125, uint64_t a126, uint64_t a127)  f)

Definition at line 21261 of file ffi_test_functions_generated.cc.

21390 {
21391 uint64_t a0;
21392 uint64_t a1;
21393 uint64_t a2;
21394 uint64_t a3;
21395 uint64_t a4;
21396 uint64_t a5;
21397 uint64_t a6;
21398 uint64_t a7;
21399 uint64_t a8;
21400 uint64_t a9;
21401 uint64_t a10;
21402 uint64_t a11;
21403 uint64_t a12;
21404 uint64_t a13;
21405 uint64_t a14;
21406 uint64_t a15;
21407 uint64_t a16;
21408 uint64_t a17;
21409 uint64_t a18;
21410 uint64_t a19;
21411 uint64_t a20;
21412 uint64_t a21;
21413 uint64_t a22;
21414 uint64_t a23;
21415 uint64_t a24;
21416 uint64_t a25;
21417 uint64_t a26;
21418 uint64_t a27;
21419 uint64_t a28;
21420 uint64_t a29;
21421 uint64_t a30;
21422 uint64_t a31;
21423 uint64_t a32;
21424 uint64_t a33;
21425 uint64_t a34;
21426 uint64_t a35;
21427 uint64_t a36;
21428 uint64_t a37;
21429 uint64_t a38;
21430 uint64_t a39;
21431 uint64_t a40;
21432 uint64_t a41;
21433 uint64_t a42;
21434 uint64_t a43;
21435 uint64_t a44;
21436 uint64_t a45;
21437 uint64_t a46;
21438 uint64_t a47;
21439 uint64_t a48;
21440 uint64_t a49;
21441 uint64_t a50;
21442 uint64_t a51;
21443 uint64_t a52;
21444 uint64_t a53;
21445 uint64_t a54;
21446 uint64_t a55;
21447 uint64_t a56;
21448 uint64_t a57;
21449 uint64_t a58;
21450 uint64_t a59;
21451 uint64_t a60;
21452 uint64_t a61;
21453 uint64_t a62;
21454 uint64_t a63;
21455 uint64_t a64;
21456 uint64_t a65;
21457 uint64_t a66;
21458 uint64_t a67;
21459 uint64_t a68;
21460 uint64_t a69;
21461 uint64_t a70;
21462 uint64_t a71;
21463 uint64_t a72;
21464 uint64_t a73;
21465 uint64_t a74;
21466 uint64_t a75;
21467 uint64_t a76;
21468 uint64_t a77;
21469 uint64_t a78;
21470 uint64_t a79;
21471 uint64_t a80;
21472 uint64_t a81;
21473 uint64_t a82;
21474 uint64_t a83;
21475 uint64_t a84;
21476 uint64_t a85;
21477 uint64_t a86;
21478 uint64_t a87;
21479 uint64_t a88;
21480 uint64_t a89;
21481 uint64_t a90;
21482 uint64_t a91;
21483 uint64_t a92;
21484 uint64_t a93;
21485 uint64_t a94;
21486 uint64_t a95;
21487 uint64_t a96;
21488 uint64_t a97;
21489 uint64_t a98;
21490 uint64_t a99;
21491 uint64_t a100;
21492 uint64_t a101;
21493 uint64_t a102;
21494 uint64_t a103;
21495 uint64_t a104;
21496 uint64_t a105;
21497 uint64_t a106;
21498 uint64_t a107;
21499 uint64_t a108;
21500 uint64_t a109;
21501 uint64_t a110;
21502 uint64_t a111;
21503 uint64_t a112;
21504 uint64_t a113;
21505 uint64_t a114;
21506 uint64_t a115;
21507 uint64_t a116;
21508 uint64_t a117;
21509 uint64_t a118;
21510 uint64_t a119;
21511 uint64_t a120;
21512 uint64_t a121;
21513 uint64_t a122;
21514 uint64_t a123;
21515 uint64_t a124;
21516 uint64_t a125;
21517 uint64_t a126;
21518 uint64_t a127;
21519
21520 a0 = 1;
21521 a1 = 2;
21522 a2 = 3;
21523 a3 = 4;
21524 a4 = 5;
21525 a5 = 6;
21526 a6 = 7;
21527 a7 = 8;
21528 a8 = 9;
21529 a9 = 10;
21530 a10 = 11;
21531 a11 = 12;
21532 a12 = 13;
21533 a13 = 14;
21534 a14 = 15;
21535 a15 = 16;
21536 a16 = 17;
21537 a17 = 18;
21538 a18 = 19;
21539 a19 = 20;
21540 a20 = 21;
21541 a21 = 22;
21542 a22 = 23;
21543 a23 = 24;
21544 a24 = 25;
21545 a25 = 26;
21546 a26 = 27;
21547 a27 = 28;
21548 a28 = 29;
21549 a29 = 30;
21550 a30 = 31;
21551 a31 = 32;
21552 a32 = 33;
21553 a33 = 34;
21554 a34 = 35;
21555 a35 = 36;
21556 a36 = 37;
21557 a37 = 38;
21558 a38 = 39;
21559 a39 = 40;
21560 a40 = 41;
21561 a41 = 42;
21562 a42 = 43;
21563 a43 = 44;
21564 a44 = 45;
21565 a45 = 46;
21566 a46 = 47;
21567 a47 = 48;
21568 a48 = 49;
21569 a49 = 50;
21570 a50 = 51;
21571 a51 = 52;
21572 a52 = 53;
21573 a53 = 54;
21574 a54 = 55;
21575 a55 = 56;
21576 a56 = 57;
21577 a57 = 58;
21578 a58 = 59;
21579 a59 = 60;
21580 a60 = 61;
21581 a61 = 62;
21582 a62 = 63;
21583 a63 = 64;
21584 a64 = 65;
21585 a65 = 66;
21586 a66 = 67;
21587 a67 = 68;
21588 a68 = 69;
21589 a69 = 70;
21590 a70 = 71;
21591 a71 = 72;
21592 a72 = 73;
21593 a73 = 74;
21594 a74 = 75;
21595 a75 = 76;
21596 a76 = 77;
21597 a77 = 78;
21598 a78 = 79;
21599 a79 = 80;
21600 a80 = 81;
21601 a81 = 82;
21602 a82 = 83;
21603 a83 = 84;
21604 a84 = 85;
21605 a85 = 86;
21606 a86 = 87;
21607 a87 = 88;
21608 a88 = 89;
21609 a89 = 90;
21610 a90 = 91;
21611 a91 = 92;
21612 a92 = 93;
21613 a93 = 94;
21614 a94 = 95;
21615 a95 = 96;
21616 a96 = 97;
21617 a97 = 98;
21618 a98 = 99;
21619 a99 = 100;
21620 a100 = 101;
21621 a101 = 102;
21622 a102 = 103;
21623 a103 = 104;
21624 a104 = 105;
21625 a105 = 106;
21626 a106 = 107;
21627 a107 = 108;
21628 a108 = 109;
21629 a109 = 110;
21630 a110 = 111;
21631 a111 = 112;
21632 a112 = 113;
21633 a113 = 114;
21634 a114 = 115;
21635 a115 = 116;
21636 a116 = 117;
21637 a117 = 118;
21638 a118 = 119;
21639 a119 = 120;
21640 a120 = 121;
21641 a121 = 122;
21642 a122 = 123;
21643 a123 = 124;
21644 a124 = 125;
21645 a125 = 126;
21646 a126 = 127;
21647 a127 = 128;
21648
21649 std::cout << "Calling TestAsyncReturnStruct1024BytesHomogeneousUint64(" << "("
21650 << a0 << ", " << a1 << ", " << a2 << ", " << a3 << ", " << a4
21651 << ", " << a5 << ", " << a6 << ", " << a7 << ", " << a8 << ", "
21652 << a9 << ", " << a10 << ", " << a11 << ", " << a12 << ", " << a13
21653 << ", " << a14 << ", " << a15 << ", " << a16 << ", " << a17 << ", "
21654 << a18 << ", " << a19 << ", " << a20 << ", " << a21 << ", " << a22
21655 << ", " << a23 << ", " << a24 << ", " << a25 << ", " << a26 << ", "
21656 << a27 << ", " << a28 << ", " << a29 << ", " << a30 << ", " << a31
21657 << ", " << a32 << ", " << a33 << ", " << a34 << ", " << a35 << ", "
21658 << a36 << ", " << a37 << ", " << a38 << ", " << a39 << ", " << a40
21659 << ", " << a41 << ", " << a42 << ", " << a43 << ", " << a44 << ", "
21660 << a45 << ", " << a46 << ", " << a47 << ", " << a48 << ", " << a49
21661 << ", " << a50 << ", " << a51 << ", " << a52 << ", " << a53 << ", "
21662 << a54 << ", " << a55 << ", " << a56 << ", " << a57 << ", " << a58
21663 << ", " << a59 << ", " << a60 << ", " << a61 << ", " << a62 << ", "
21664 << a63 << ", " << a64 << ", " << a65 << ", " << a66 << ", " << a67
21665 << ", " << a68 << ", " << a69 << ", " << a70 << ", " << a71 << ", "
21666 << a72 << ", " << a73 << ", " << a74 << ", " << a75 << ", " << a76
21667 << ", " << a77 << ", " << a78 << ", " << a79 << ", " << a80 << ", "
21668 << a81 << ", " << a82 << ", " << a83 << ", " << a84 << ", " << a85
21669 << ", " << a86 << ", " << a87 << ", " << a88 << ", " << a89 << ", "
21670 << a90 << ", " << a91 << ", " << a92 << ", " << a93 << ", " << a94
21671 << ", " << a95 << ", " << a96 << ", " << a97 << ", " << a98 << ", "
21672 << a99 << ", " << a100 << ", " << a101 << ", " << a102 << ", "
21673 << a103 << ", " << a104 << ", " << a105 << ", " << a106 << ", "
21674 << a107 << ", " << a108 << ", " << a109 << ", " << a110 << ", "
21675 << a111 << ", " << a112 << ", " << a113 << ", " << a114 << ", "
21676 << a115 << ", " << a116 << ", " << a117 << ", " << a118 << ", "
21677 << a119 << ", " << a120 << ", " << a121 << ", " << a122 << ", "
21678 << a123 << ", " << a124 << ", " << a125 << ", " << a126 << ", "
21679 << a127 << ")" << ")\n";
21680
21681 f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16,
21682 a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27, a28, a29, a30, a31,
21683 a32, a33, a34, a35, a36, a37, a38, a39, a40, a41, a42, a43, a44, a45, a46,
21684 a47, a48, a49, a50, a51, a52, a53, a54, a55, a56, a57, a58, a59, a60, a61,
21685 a62, a63, a64, a65, a66, a67, a68, a69, a70, a71, a72, a73, a74, a75, a76,
21686 a77, a78, a79, a80, a81, a82, a83, a84, a85, a86, a87, a88, a89, a90, a91,
21687 a92, a93, a94, a95, a96, a97, a98, a99, a100, a101, a102, a103, a104, a105,
21688 a106, a107, a108, a109, a110, a111, a112, a113, a114, a115, a116, a117,
21689 a118, a119, a120, a121, a122, a123, a124, a125, a126, a127);
21690}

◆ TestAsyncReturnStruct12BytesHomogeneousFloat()

DART_EXPORT void dart::TestAsyncReturnStruct12BytesHomogeneousFloat ( void(*)(float a0, float a1, float a2)  f)

Definition at line 20987 of file ffi_test_functions_generated.cc.

20989 {
20990 float a0;
20991 float a1;
20992 float a2;
20993
20994 a0 = -1.0;
20995 a1 = 2.0;
20996 a2 = -3.0;
20997
20998 std::cout << "Calling TestAsyncReturnStruct12BytesHomogeneousFloat(" << "("
20999 << a0 << ", " << a1 << ", " << a2 << ")" << ")\n";
21000
21001 f(a0, a1, a2);
21002}

◆ TestAsyncReturnStruct16BytesHomogeneousFloat()

DART_EXPORT void dart::TestAsyncReturnStruct16BytesHomogeneousFloat ( void(*)(float a0, float a1, float a2, float a3)  f)

Definition at line 21006 of file ffi_test_functions_generated.cc.

21008 {
21009 float a0;
21010 float a1;
21011 float a2;
21012 float a3;
21013
21014 a0 = -1.0;
21015 a1 = 2.0;
21016 a2 = -3.0;
21017 a3 = 4.0;
21018
21019 std::cout << "Calling TestAsyncReturnStruct16BytesHomogeneousFloat(" << "("
21020 << a0 << ", " << a1 << ", " << a2 << ", " << a3 << ")" << ")\n";
21021
21022 f(a0, a1, a2, a3);
21023}

◆ TestAsyncReturnStruct16BytesMixed()

DART_EXPORT void dart::TestAsyncReturnStruct16BytesMixed ( void(*)(double a0, int64_t a1)  f)

Definition at line 21027 of file ffi_test_functions_generated.cc.

21029 {
21030 double a0;
21031 int64_t a1;
21032
21033 a0 = -1.0;
21034 a1 = 2;
21035
21036 std::cout << "Calling TestAsyncReturnStruct16BytesMixed(" << "(" << a0 << ", "
21037 << a1 << ")" << ")\n";
21038
21039 f(a0, a1);
21040}

◆ TestAsyncReturnStruct16BytesMixed2()

DART_EXPORT void dart::TestAsyncReturnStruct16BytesMixed2 ( void(*)(float a0, float a1, float a2, int32_t a3)  f)

Definition at line 21045 of file ffi_test_functions_generated.cc.

21047 {
21048 float a0;
21049 float a1;
21050 float a2;
21051 int32_t a3;
21052
21053 a0 = -1.0;
21054 a1 = 2.0;
21055 a2 = -3.0;
21056 a3 = 4;
21057
21058 std::cout << "Calling TestAsyncReturnStruct16BytesMixed2(" << "(" << a0
21059 << ", " << a1 << ", " << a2 << ", " << a3 << ")" << ")\n";
21060
21061 f(a0, a1, a2, a3);
21062}

◆ TestAsyncReturnStruct16BytesNestedInt()

DART_EXPORT void dart::TestAsyncReturnStruct16BytesNestedInt ( void(*)(Struct8BytesNestedInt a0, Struct8BytesNestedInt a1)  f)

Definition at line 22189 of file ffi_test_functions_generated.cc.

22191 {
22192 Struct8BytesNestedInt a0 = {};
22193 Struct8BytesNestedInt a1 = {};
22194
22195 a0.a0.a0 = -1;
22196 a0.a0.a1 = 2;
22197 a0.a1.a0 = -3;
22198 a0.a1.a1 = 4;
22199 a1.a0.a0 = -5;
22200 a1.a0.a1 = 6;
22201 a1.a1.a0 = -7;
22202 a1.a1.a1 = 8;
22203
22204 std::cout << "Calling TestAsyncReturnStruct16BytesNestedInt(" << "((("
22205 << a0.a0.a0 << ", " << a0.a0.a1 << "), (" << a0.a1.a0 << ", "
22206 << a0.a1.a1 << ")), ((" << a1.a0.a0 << ", " << a1.a0.a1 << "), ("
22207 << a1.a1.a0 << ", " << a1.a1.a1 << ")))" << ")\n";
22208
22209 f(a0, a1);
22210}

◆ TestAsyncReturnStruct17BytesInt()

DART_EXPORT void dart::TestAsyncReturnStruct17BytesInt ( void(*)(int64_t a0, int64_t a1, int8_t a2)  f)

Definition at line 21068 of file ffi_test_functions_generated.cc.

21070 {
21071 int64_t a0;
21072 int64_t a1;
21073 int8_t a2;
21074
21075 a0 = -1;
21076 a1 = 2;
21077 a2 = -3;
21078
21079 std::cout << "Calling TestAsyncReturnStruct17BytesInt(" << "(" << a0 << ", "
21080 << a1 << ", " << static_cast<int>(a2) << ")" << ")\n";
21081
21082 f(a0, a1, a2);
21083}

◆ TestAsyncReturnStruct19BytesHomogeneousUint8()

DART_EXPORT void dart::TestAsyncReturnStruct19BytesHomogeneousUint8 ( void(*)(uint8_t a0, uint8_t a1, uint8_t a2, uint8_t a3, uint8_t a4, uint8_t a5, uint8_t a6, uint8_t a7, uint8_t a8, uint8_t a9, uint8_t a10, uint8_t a11, uint8_t a12, uint8_t a13, uint8_t a14, uint8_t a15, uint8_t a16, uint8_t a17, uint8_t a18)  f)

Definition at line 21089 of file ffi_test_functions_generated.cc.

21109 {
21110 uint8_t a0;
21111 uint8_t a1;
21112 uint8_t a2;
21113 uint8_t a3;
21114 uint8_t a4;
21115 uint8_t a5;
21116 uint8_t a6;
21117 uint8_t a7;
21118 uint8_t a8;
21119 uint8_t a9;
21120 uint8_t a10;
21121 uint8_t a11;
21122 uint8_t a12;
21123 uint8_t a13;
21124 uint8_t a14;
21125 uint8_t a15;
21126 uint8_t a16;
21127 uint8_t a17;
21128 uint8_t a18;
21129
21130 a0 = 1;
21131 a1 = 2;
21132 a2 = 3;
21133 a3 = 4;
21134 a4 = 5;
21135 a5 = 6;
21136 a6 = 7;
21137 a7 = 8;
21138 a8 = 9;
21139 a9 = 10;
21140 a10 = 11;
21141 a11 = 12;
21142 a12 = 13;
21143 a13 = 14;
21144 a14 = 15;
21145 a15 = 16;
21146 a16 = 17;
21147 a17 = 18;
21148 a18 = 19;
21149
21150 std::cout << "Calling TestAsyncReturnStruct19BytesHomogeneousUint8(" << "("
21151 << static_cast<int>(a0) << ", " << static_cast<int>(a1) << ", "
21152 << static_cast<int>(a2) << ", " << static_cast<int>(a3) << ", "
21153 << static_cast<int>(a4) << ", " << static_cast<int>(a5) << ", "
21154 << static_cast<int>(a6) << ", " << static_cast<int>(a7) << ", "
21155 << static_cast<int>(a8) << ", " << static_cast<int>(a9) << ", "
21156 << static_cast<int>(a10) << ", " << static_cast<int>(a11) << ", "
21157 << static_cast<int>(a12) << ", " << static_cast<int>(a13) << ", "
21158 << static_cast<int>(a14) << ", " << static_cast<int>(a15) << ", "
21159 << static_cast<int>(a16) << ", " << static_cast<int>(a17) << ", "
21160 << static_cast<int>(a18) << ")" << ")\n";
21161
21162 f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16,
21163 a17, a18);
21164}

◆ TestAsyncReturnStruct1ByteInt()

DART_EXPORT void dart::TestAsyncReturnStruct1ByteInt ( void(*)(int8_t a0)  f)

Definition at line 20742 of file ffi_test_functions_generated.cc.

20744 {
20745 int8_t a0;
20746
20747 a0 = -1;
20748
20749 std::cout << "Calling TestAsyncReturnStruct1ByteInt(" << "("
20750 << static_cast<int>(a0) << ")" << ")\n";
20751
20752 f(a0);
20753}

◆ TestAsyncReturnStruct20BytesHomogeneousFloat()

DART_EXPORT void dart::TestAsyncReturnStruct20BytesHomogeneousFloat ( void(*)(float a0, float a1, float a2, float a3, float a4)  f)

Definition at line 21192 of file ffi_test_functions_generated.cc.

21194 {
21195 float a0;
21196 float a1;
21197 float a2;
21198 float a3;
21199 float a4;
21200
21201 a0 = -1.0;
21202 a1 = 2.0;
21203 a2 = -3.0;
21204 a3 = 4.0;
21205 a4 = -5.0;
21206
21207 std::cout << "Calling TestAsyncReturnStruct20BytesHomogeneousFloat(" << "("
21208 << a0 << ", " << a1 << ", " << a2 << ", " << a3 << ", " << a4 << ")"
21209 << ")\n";
21210
21211 f(a0, a1, a2, a3, a4);
21212}

◆ TestAsyncReturnStruct20BytesHomogeneousInt32()

DART_EXPORT void dart::TestAsyncReturnStruct20BytesHomogeneousInt32 ( void(*)(int32_t a0, int32_t a1, int32_t a2, int32_t a3, int32_t a4)  f)

Definition at line 21168 of file ffi_test_functions_generated.cc.

21170 {
21171 int32_t a0;
21172 int32_t a1;
21173 int32_t a2;
21174 int32_t a3;
21175 int32_t a4;
21176
21177 a0 = -1;
21178 a1 = 2;
21179 a2 = -3;
21180 a3 = 4;
21181 a4 = -5;
21182
21183 std::cout << "Calling TestAsyncReturnStruct20BytesHomogeneousInt32(" << "("
21184 << a0 << ", " << a1 << ", " << a2 << ", " << a3 << ", " << a4 << ")"
21185 << ")\n";
21186
21187 f(a0, a1, a2, a3, a4);
21188}

◆ TestAsyncReturnStruct32BytesHomogeneousDouble()

DART_EXPORT void dart::TestAsyncReturnStruct32BytesHomogeneousDouble ( void(*)(double a0, double a1, double a2, double a3)  f)

Definition at line 21216 of file ffi_test_functions_generated.cc.

21218 {
21219 double a0;
21220 double a1;
21221 double a2;
21222 double a3;
21223
21224 a0 = -1.0;
21225 a1 = 2.0;
21226 a2 = -3.0;
21227 a3 = 4.0;
21228
21229 std::cout << "Calling TestAsyncReturnStruct32BytesHomogeneousDouble(" << "("
21230 << a0 << ", " << a1 << ", " << a2 << ", " << a3 << ")" << ")\n";
21231
21232 f(a0, a1, a2, a3);
21233}

◆ TestAsyncReturnStruct32BytesNestedInt()

DART_EXPORT void dart::TestAsyncReturnStruct32BytesNestedInt ( void(*)(Struct16BytesNestedInt a0, Struct16BytesNestedInt a1)  f)

Definition at line 22214 of file ffi_test_functions_generated.cc.

22216 {
22217 Struct16BytesNestedInt a0 = {};
22218 Struct16BytesNestedInt a1 = {};
22219
22220 a0.a0.a0.a0 = -1;
22221 a0.a0.a0.a1 = 2;
22222 a0.a0.a1.a0 = -3;
22223 a0.a0.a1.a1 = 4;
22224 a0.a1.a0.a0 = -5;
22225 a0.a1.a0.a1 = 6;
22226 a0.a1.a1.a0 = -7;
22227 a0.a1.a1.a1 = 8;
22228 a1.a0.a0.a0 = -9;
22229 a1.a0.a0.a1 = 10;
22230 a1.a0.a1.a0 = -11;
22231 a1.a0.a1.a1 = 12;
22232 a1.a1.a0.a0 = -13;
22233 a1.a1.a0.a1 = 14;
22234 a1.a1.a1.a0 = -15;
22235 a1.a1.a1.a1 = 16;
22236
22237 std::cout << "Calling TestAsyncReturnStruct32BytesNestedInt(" << "(((("
22238 << a0.a0.a0.a0 << ", " << a0.a0.a0.a1 << "), (" << a0.a0.a1.a0
22239 << ", " << a0.a0.a1.a1 << ")), ((" << a0.a1.a0.a0 << ", "
22240 << a0.a1.a0.a1 << "), (" << a0.a1.a1.a0 << ", " << a0.a1.a1.a1
22241 << "))), (((" << a1.a0.a0.a0 << ", " << a1.a0.a0.a1 << "), ("
22242 << a1.a0.a1.a0 << ", " << a1.a0.a1.a1 << ")), ((" << a1.a1.a0.a0
22243 << ", " << a1.a1.a0.a1 << "), (" << a1.a1.a1.a0 << ", "
22244 << a1.a1.a1.a1 << "))))" << ")\n";
22245
22246 f(a0, a1);
22247}

◆ TestAsyncReturnStruct3BytesHomogeneousUint8()

DART_EXPORT void dart::TestAsyncReturnStruct3BytesHomogeneousUint8 ( void(*)(uint8_t a0, uint8_t a1, uint8_t a2)  f)

Definition at line 20757 of file ffi_test_functions_generated.cc.

20759 {
20760 uint8_t a0;
20761 uint8_t a1;
20762 uint8_t a2;
20763
20764 a0 = 1;
20765 a1 = 2;
20766 a2 = 3;
20767
20768 std::cout << "Calling TestAsyncReturnStruct3BytesHomogeneousUint8(" << "("
20769 << static_cast<int>(a0) << ", " << static_cast<int>(a1) << ", "
20770 << static_cast<int>(a2) << ")" << ")\n";
20771
20772 f(a0, a1, a2);
20773}

◆ TestAsyncReturnStruct3BytesInt2ByteAligned()

DART_EXPORT void dart::TestAsyncReturnStruct3BytesInt2ByteAligned ( void(*)(int16_t a0, int8_t a1)  f)

Definition at line 20778 of file ffi_test_functions_generated.cc.

20780 {
20781 int16_t a0;
20782 int8_t a1;
20783
20784 a0 = -1;
20785 a1 = 2;
20786
20787 std::cout << "Calling TestAsyncReturnStruct3BytesInt2ByteAligned(" << "("
20788 << a0 << ", " << static_cast<int>(a1) << ")" << ")\n";
20789
20790 f(a0, a1);
20791}

◆ TestAsyncReturnStruct3BytesPackedInt()

DART_EXPORT void dart::TestAsyncReturnStruct3BytesPackedInt ( void(*)(int8_t a0, int16_t a1)  f)

Definition at line 21694 of file ffi_test_functions_generated.cc.

21696 {
21697 int8_t a0;
21698 int16_t a1;
21699
21700 a0 = -1;
21701 a1 = 2;
21702
21703 std::cout << "Calling TestAsyncReturnStruct3BytesPackedInt(" << "("
21704 << static_cast<int>(a0) << ", " << a1 << ")" << ")\n";
21705
21706 f(a0, a1);
21707}

◆ TestAsyncReturnStruct40BytesHomogeneousDouble()

DART_EXPORT void dart::TestAsyncReturnStruct40BytesHomogeneousDouble ( void(*)(double a0, double a1, double a2, double a3, double a4)  f)

Definition at line 21237 of file ffi_test_functions_generated.cc.

21239 {
21240 double a0;
21241 double a1;
21242 double a2;
21243 double a3;
21244 double a4;
21245
21246 a0 = -1.0;
21247 a1 = 2.0;
21248 a2 = -3.0;
21249 a3 = 4.0;
21250 a4 = -5.0;
21251
21252 std::cout << "Calling TestAsyncReturnStruct40BytesHomogeneousDouble(" << "("
21253 << a0 << ", " << a1 << ", " << a2 << ", " << a3 << ", " << a4 << ")"
21254 << ")\n";
21255
21256 f(a0, a1, a2, a3, a4);
21257}

◆ TestAsyncReturnStruct4BytesHomogeneousInt16()

DART_EXPORT void dart::TestAsyncReturnStruct4BytesHomogeneousInt16 ( void(*)(int16_t a0, int16_t a1)  f)

Definition at line 20795 of file ffi_test_functions_generated.cc.

20797 {
20798 int16_t a0;
20799 int16_t a1;
20800
20801 a0 = -1;
20802 a1 = 2;
20803
20804 std::cout << "Calling TestAsyncReturnStruct4BytesHomogeneousInt16(" << "("
20805 << a0 << ", " << a1 << ")" << ")\n";
20806
20807 f(a0, a1);
20808}

◆ TestAsyncReturnStruct7BytesHomogeneousUint8()

DART_EXPORT void dart::TestAsyncReturnStruct7BytesHomogeneousUint8 ( void(*)(uint8_t a0, uint8_t a1, uint8_t a2, uint8_t a3, uint8_t a4, uint8_t a5, uint8_t a6)  f)

Definition at line 20812 of file ffi_test_functions_generated.cc.

20820 {
20821 uint8_t a0;
20822 uint8_t a1;
20823 uint8_t a2;
20824 uint8_t a3;
20825 uint8_t a4;
20826 uint8_t a5;
20827 uint8_t a6;
20828
20829 a0 = 1;
20830 a1 = 2;
20831 a2 = 3;
20832 a3 = 4;
20833 a4 = 5;
20834 a5 = 6;
20835 a6 = 7;
20836
20837 std::cout << "Calling TestAsyncReturnStruct7BytesHomogeneousUint8(" << "("
20838 << static_cast<int>(a0) << ", " << static_cast<int>(a1) << ", "
20839 << static_cast<int>(a2) << ", " << static_cast<int>(a3) << ", "
20840 << static_cast<int>(a4) << ", " << static_cast<int>(a5) << ", "
20841 << static_cast<int>(a6) << ")" << ")\n";
20842
20843 f(a0, a1, a2, a3, a4, a5, a6);
20844}

◆ TestAsyncReturnStruct7BytesInt4ByteAligned()

DART_EXPORT void dart::TestAsyncReturnStruct7BytesInt4ByteAligned ( void(*)(int32_t a0, int16_t a1, int8_t a2)  f)

Definition at line 20849 of file ffi_test_functions_generated.cc.

20851 {
20852 int32_t a0;
20853 int16_t a1;
20854 int8_t a2;
20855
20856 a0 = -1;
20857 a1 = 2;
20858 a2 = -3;
20859
20860 std::cout << "Calling TestAsyncReturnStruct7BytesInt4ByteAligned(" << "("
20861 << a0 << ", " << a1 << ", " << static_cast<int>(a2) << ")" << ")\n";
20862
20863 f(a0, a1, a2);
20864}

◆ TestAsyncReturnStruct8BytesHomogeneousFloat()

DART_EXPORT void dart::TestAsyncReturnStruct8BytesHomogeneousFloat ( void(*)(float a0, float a1)  f)

Definition at line 20887 of file ffi_test_functions_generated.cc.

20889 {
20890 float a0;
20891 float a1;
20892
20893 a0 = -1.0;
20894 a1 = 2.0;
20895
20896 std::cout << "Calling TestAsyncReturnStruct8BytesHomogeneousFloat(" << "("
20897 << a0 << ", " << a1 << ")" << ")\n";
20898
20899 f(a0, a1);
20900}

◆ TestAsyncReturnStruct8BytesInt()

DART_EXPORT void dart::TestAsyncReturnStruct8BytesInt ( void(*)(int16_t a0, int16_t a1, int32_t a2)  f)

Definition at line 20868 of file ffi_test_functions_generated.cc.

20870 {
20871 int16_t a0;
20872 int16_t a1;
20873 int32_t a2;
20874
20875 a0 = -1;
20876 a1 = 2;
20877 a2 = -3;
20878
20879 std::cout << "Calling TestAsyncReturnStruct8BytesInt(" << "(" << a0 << ", "
20880 << a1 << ", " << a2 << ")" << ")\n";
20881
20882 f(a0, a1, a2);
20883}

◆ TestAsyncReturnStruct8BytesMixed()

DART_EXPORT void dart::TestAsyncReturnStruct8BytesMixed ( void(*)(float a0, int16_t a1, int16_t a2)  f)

Definition at line 20904 of file ffi_test_functions_generated.cc.

20906 {
20907 float a0;
20908 int16_t a1;
20909 int16_t a2;
20910
20911 a0 = -1.0;
20912 a1 = 2;
20913 a2 = -3;
20914
20915 std::cout << "Calling TestAsyncReturnStruct8BytesMixed(" << "(" << a0 << ", "
20916 << a1 << ", " << a2 << ")" << ")\n";
20917
20918 f(a0, a1, a2);
20919}

◆ TestAsyncReturnStruct8BytesNestedFloat()

DART_EXPORT void dart::TestAsyncReturnStruct8BytesNestedFloat ( void(*)(Struct4BytesFloat a0, Struct4BytesFloat a1)  f)

Definition at line 22136 of file ffi_test_functions_generated.cc.

22138 {
22139 Struct4BytesFloat a0 = {};
22140 Struct4BytesFloat a1 = {};
22141
22142 a0.a0 = -1.0;
22143 a1.a0 = 2.0;
22144
22145 std::cout << "Calling TestAsyncReturnStruct8BytesNestedFloat(" << "(("
22146 << a0.a0 << "), (" << a1.a0 << "))" << ")\n";
22147
22148 f(a0, a1);
22149}

◆ TestAsyncReturnStruct8BytesNestedFloat2()

DART_EXPORT void dart::TestAsyncReturnStruct8BytesNestedFloat2 ( void(*)(Struct4BytesFloat a0, float a1)  f)

Definition at line 22154 of file ffi_test_functions_generated.cc.

22156 {
22157 Struct4BytesFloat a0 = {};
22158 float a1;
22159
22160 a0.a0 = -1.0;
22161 a1 = 2.0;
22162
22163 std::cout << "Calling TestAsyncReturnStruct8BytesNestedFloat2(" << "(("
22164 << a0.a0 << "), " << a1 << ")" << ")\n";
22165
22166 f(a0, a1);
22167}

◆ TestAsyncReturnStruct8BytesNestedInt()

DART_EXPORT void dart::TestAsyncReturnStruct8BytesNestedInt ( void(*)(Struct4BytesHomogeneousInt16 a0, Struct4BytesHomogeneousInt16 a1)  f)

Definition at line 22115 of file ffi_test_functions_generated.cc.

22118 {
22120 Struct4BytesHomogeneousInt16 a1 = {};
22121
22122 a0.a0 = -1;
22123 a0.a1 = 2;
22124 a1.a0 = -3;
22125 a1.a1 = 4;
22126
22127 std::cout << "Calling TestAsyncReturnStruct8BytesNestedInt(" << "((" << a0.a0
22128 << ", " << a0.a1 << "), (" << a1.a0 << ", " << a1.a1 << "))"
22129 << ")\n";
22130
22131 f(a0, a1);
22132}

◆ TestAsyncReturnStruct8BytesNestedMixed()

DART_EXPORT void dart::TestAsyncReturnStruct8BytesNestedMixed ( void(*)(Struct4BytesHomogeneousInt16 a0, Struct4BytesFloat a1)  f)

Definition at line 22171 of file ffi_test_functions_generated.cc.

22173 {
22175 Struct4BytesFloat a1 = {};
22176
22177 a0.a0 = -1;
22178 a0.a1 = 2;
22179 a1.a0 = -3.0;
22180
22181 std::cout << "Calling TestAsyncReturnStruct8BytesNestedMixed(" << "(("
22182 << a0.a0 << ", " << a0.a1 << "), (" << a1.a0 << "))" << ")\n";
22183
22184 f(a0, a1);
22185}

◆ TestAsyncReturnStruct8BytesPackedInt()

DART_EXPORT void dart::TestAsyncReturnStruct8BytesPackedInt ( void(*)(uint8_t a0, uint32_t a1, uint8_t a2, uint8_t a3, uint8_t a4)  f)

Definition at line 21711 of file ffi_test_functions_generated.cc.

21713 {
21714 uint8_t a0;
21715 uint32_t a1;
21716 uint8_t a2;
21717 uint8_t a3;
21718 uint8_t a4;
21719
21720 a0 = 1;
21721 a1 = 2;
21722 a2 = 3;
21723 a3 = 4;
21724 a4 = 5;
21725
21726 std::cout << "Calling TestAsyncReturnStruct8BytesPackedInt(" << "("
21727 << static_cast<int>(a0) << ", " << a1 << ", "
21728 << static_cast<int>(a2) << ", " << static_cast<int>(a3) << ", "
21729 << static_cast<int>(a4) << ")" << ")\n";
21730
21731 f(a0, a1, a2, a3, a4);
21732}

◆ TestAsyncReturnStruct9BytesHomogeneousUint8()

DART_EXPORT void dart::TestAsyncReturnStruct9BytesHomogeneousUint8 ( void(*)(uint8_t a0, uint8_t a1, uint8_t a2, uint8_t a3, uint8_t a4, uint8_t a5, uint8_t a6, uint8_t a7, uint8_t a8)  f)

Definition at line 20925 of file ffi_test_functions_generated.cc.

20935 {
20936 uint8_t a0;
20937 uint8_t a1;
20938 uint8_t a2;
20939 uint8_t a3;
20940 uint8_t a4;
20941 uint8_t a5;
20942 uint8_t a6;
20943 uint8_t a7;
20944 uint8_t a8;
20945
20946 a0 = 1;
20947 a1 = 2;
20948 a2 = 3;
20949 a3 = 4;
20950 a4 = 5;
20951 a5 = 6;
20952 a6 = 7;
20953 a7 = 8;
20954 a8 = 9;
20955
20956 std::cout << "Calling TestAsyncReturnStruct9BytesHomogeneousUint8(" << "("
20957 << static_cast<int>(a0) << ", " << static_cast<int>(a1) << ", "
20958 << static_cast<int>(a2) << ", " << static_cast<int>(a3) << ", "
20959 << static_cast<int>(a4) << ", " << static_cast<int>(a5) << ", "
20960 << static_cast<int>(a6) << ", " << static_cast<int>(a7) << ", "
20961 << static_cast<int>(a8) << ")" << ")\n";
20962
20963 f(a0, a1, a2, a3, a4, a5, a6, a7, a8);
20964}

◆ TestAsyncReturnStruct9BytesInt4Or8ByteAligned()

DART_EXPORT void dart::TestAsyncReturnStruct9BytesInt4Or8ByteAligned ( void(*)(int64_t a0, int8_t a1)  f)

Definition at line 20969 of file ffi_test_functions_generated.cc.

20971 {
20972 int64_t a0;
20973 int8_t a1;
20974
20975 a0 = -1;
20976 a1 = 2;
20977
20978 std::cout << "Calling TestAsyncReturnStruct9BytesInt4Or8ByteAligned(" << "("
20979 << a0 << ", " << static_cast<int>(a1) << ")" << ")\n";
20980
20981 f(a0, a1);
20982}

◆ TestAsyncReturnStruct9BytesPackedMixed()

DART_EXPORT void dart::TestAsyncReturnStruct9BytesPackedMixed ( void(*)(uint8_t a0, double a1)  f)

Definition at line 21737 of file ffi_test_functions_generated.cc.

21739 {
21740 uint8_t a0;
21741 double a1;
21742
21743 a0 = 1;
21744 a1 = 2.0;
21745
21746 std::cout << "Calling TestAsyncReturnStruct9BytesPackedMixed(" << "("
21747 << static_cast<int>(a0) << ", " << a1 << ")" << ")\n";
21748
21749 f(a0, a1);
21750}

◆ TestAsyncReturnStructAlignmentInt16()

DART_EXPORT void dart::TestAsyncReturnStructAlignmentInt16 ( void(*)(int8_t a0, int16_t a1, int8_t a2)  f)

Definition at line 22055 of file ffi_test_functions_generated.cc.

22057 {
22058 int8_t a0;
22059 int16_t a1;
22060 int8_t a2;
22061
22062 a0 = -1;
22063 a1 = 2;
22064 a2 = -3;
22065
22066 std::cout << "Calling TestAsyncReturnStructAlignmentInt16(" << "("
22067 << static_cast<int>(a0) << ", " << a1 << ", "
22068 << static_cast<int>(a2) << ")" << ")\n";
22069
22070 f(a0, a1, a2);
22071}

◆ TestAsyncReturnStructAlignmentInt32()

DART_EXPORT void dart::TestAsyncReturnStructAlignmentInt32 ( void(*)(int8_t a0, int32_t a1, int8_t a2)  f)

Definition at line 22075 of file ffi_test_functions_generated.cc.

22077 {
22078 int8_t a0;
22079 int32_t a1;
22080 int8_t a2;
22081
22082 a0 = -1;
22083 a1 = 2;
22084 a2 = -3;
22085
22086 std::cout << "Calling TestAsyncReturnStructAlignmentInt32(" << "("
22087 << static_cast<int>(a0) << ", " << a1 << ", "
22088 << static_cast<int>(a2) << ")" << ")\n";
22089
22090 f(a0, a1, a2);
22091}

◆ TestAsyncReturnStructAlignmentInt64()

DART_EXPORT void dart::TestAsyncReturnStructAlignmentInt64 ( void(*)(int8_t a0, int64_t a1, int8_t a2)  f)

Definition at line 22095 of file ffi_test_functions_generated.cc.

22097 {
22098 int8_t a0;
22099 int64_t a1;
22100 int8_t a2;
22101
22102 a0 = -1;
22103 a1 = 2;
22104 a2 = -3;
22105
22106 std::cout << "Calling TestAsyncReturnStructAlignmentInt64(" << "("
22107 << static_cast<int>(a0) << ", " << a1 << ", "
22108 << static_cast<int>(a2) << ")" << ")\n";
22109
22110 f(a0, a1, a2);
22111}

◆ TestAsyncReturnStructArgumentInt32x8Struct1ByteInt()

DART_EXPORT void dart::TestAsyncReturnStructArgumentInt32x8Struct1ByteInt ( void(*)(int32_t a0, int32_t a1, int32_t a2, int32_t a3, int32_t a4, int32_t a5, int32_t a6, int32_t a7, Struct1ByteInt a8)  f)

Definition at line 21836 of file ffi_test_functions_generated.cc.

21846 {
21847 int32_t a0;
21848 int32_t a1;
21849 int32_t a2;
21850 int32_t a3;
21851 int32_t a4;
21852 int32_t a5;
21853 int32_t a6;
21854 int32_t a7;
21855 Struct1ByteInt a8 = {};
21856
21857 a0 = -1;
21858 a1 = 2;
21859 a2 = -3;
21860 a3 = 4;
21861 a4 = -5;
21862 a5 = 6;
21863 a6 = -7;
21864 a7 = 8;
21865 a8.a0 = -9;
21866
21867 std::cout << "Calling TestAsyncReturnStructArgumentInt32x8Struct1ByteInt("
21868 << "(" << a0 << ", " << a1 << ", " << a2 << ", " << a3 << ", " << a4
21869 << ", " << a5 << ", " << a6 << ", " << a7 << ", ("
21870 << static_cast<int>(a8.a0) << "))" << ")\n";
21871
21872 f(a0, a1, a2, a3, a4, a5, a6, a7, a8);
21873}

◆ TestAsyncReturnStructArgumentInt32x8Struct20BytesHomogeneou()

DART_EXPORT void dart::TestAsyncReturnStructArgumentInt32x8Struct20BytesHomogeneou ( void(*)(int32_t a0, int32_t a1, int32_t a2, int32_t a3, int32_t a4, int32_t a5, int32_t a6, int32_t a7, Struct20BytesHomogeneousInt32 a8)  f)

Definition at line 21918 of file ffi_test_functions_generated.cc.

21928 {
21929 int32_t a0;
21930 int32_t a1;
21931 int32_t a2;
21932 int32_t a3;
21933 int32_t a4;
21934 int32_t a5;
21935 int32_t a6;
21936 int32_t a7;
21938
21939 a0 = -1;
21940 a1 = 2;
21941 a2 = -3;
21942 a3 = 4;
21943 a4 = -5;
21944 a5 = 6;
21945 a6 = -7;
21946 a7 = 8;
21947 a8.a0 = -9;
21948 a8.a1 = 10;
21949 a8.a2 = -11;
21950 a8.a3 = 12;
21951 a8.a4 = -13;
21952
21953 std::cout
21954 << "Calling TestAsyncReturnStructArgumentInt32x8Struct20BytesHomogeneou("
21955 << "(" << a0 << ", " << a1 << ", " << a2 << ", " << a3 << ", " << a4
21956 << ", " << a5 << ", " << a6 << ", " << a7 << ", (" << a8.a0 << ", "
21957 << a8.a1 << ", " << a8.a2 << ", " << a8.a3 << ", " << a8.a4 << "))"
21958 << ")\n";
21959
21960 f(a0, a1, a2, a3, a4, a5, a6, a7, a8);
21961}

◆ TestAsyncReturnStructArgumentStruct1ByteInt()

DART_EXPORT void dart::TestAsyncReturnStructArgumentStruct1ByteInt ( void(*)(Struct1ByteInt a0)  f)

Definition at line 21819 of file ffi_test_functions_generated.cc.

21821 {
21822 Struct1ByteInt a0 = {};
21823
21824 a0.a0 = -1;
21825
21826 std::cout << "Calling TestAsyncReturnStructArgumentStruct1ByteInt(" << "(("
21827 << static_cast<int>(a0.a0) << "))" << ")\n";
21828
21829 f(a0);
21830}

◆ TestAsyncReturnStructArgumentStruct20BytesHomogeneousInt32()

DART_EXPORT void dart::TestAsyncReturnStructArgumentStruct20BytesHomogeneousInt32 ( void(*)(Struct20BytesHomogeneousInt32 a0)  f)

Definition at line 21896 of file ffi_test_functions_generated.cc.

21898 {
21900
21901 a0.a0 = -1;
21902 a0.a1 = 2;
21903 a0.a2 = -3;
21904 a0.a3 = 4;
21905 a0.a4 = -5;
21906
21907 std::cout
21908 << "Calling TestAsyncReturnStructArgumentStruct20BytesHomogeneousInt32("
21909 << "((" << a0.a0 << ", " << a0.a1 << ", " << a0.a2 << ", " << a0.a3
21910 << ", " << a0.a4 << "))" << ")\n";
21911
21912 f(a0);
21913}

◆ TestAsyncReturnStructArgumentStruct8BytesHomogeneousFloat()

DART_EXPORT void dart::TestAsyncReturnStructArgumentStruct8BytesHomogeneousFloat ( void(*)(Struct8BytesHomogeneousFloat a0)  f)

Definition at line 21879 of file ffi_test_functions_generated.cc.

21881 {
21883
21884 a0.a0 = -1.0;
21885 a0.a1 = 2.0;
21886
21887 std::cout
21888 << "Calling TestAsyncReturnStructArgumentStruct8BytesHomogeneousFloat("
21889 << "((" << a0.a0 << ", " << a0.a1 << "))" << ")\n";
21890
21891 f(a0);
21892}

◆ TestAsyncReturnStructArgumentStruct8BytesInlineArrayInt()

DART_EXPORT void dart::TestAsyncReturnStructArgumentStruct8BytesInlineArrayInt ( void(*)(Struct8BytesInlineArrayInt a0)  f)

Definition at line 21965 of file ffi_test_functions_generated.cc.

21967 {
21969
21970 a0.a0[0] = 1;
21971 a0.a0[1] = 2;
21972 a0.a0[2] = 3;
21973 a0.a0[3] = 4;
21974 a0.a0[4] = 5;
21975 a0.a0[5] = 6;
21976 a0.a0[6] = 7;
21977 a0.a0[7] = 8;
21978
21979 std::cout
21980 << "Calling TestAsyncReturnStructArgumentStruct8BytesInlineArrayInt("
21981 << "(([" << static_cast<int>(a0.a0[0]) << ", "
21982 << static_cast<int>(a0.a0[1]) << ", " << static_cast<int>(a0.a0[2])
21983 << ", " << static_cast<int>(a0.a0[3]) << ", "
21984 << static_cast<int>(a0.a0[4]) << ", " << static_cast<int>(a0.a0[5])
21985 << ", " << static_cast<int>(a0.a0[6]) << ", "
21986 << static_cast<int>(a0.a0[7]) << "]))" << ")\n";
21987
21988 f(a0);
21989}

◆ TestAsyncReturnStructArgumentStructStruct16BytesHomogeneous()

DART_EXPORT void dart::TestAsyncReturnStructArgumentStructStruct16BytesHomogeneous ( void(*)(StructStruct16BytesHomogeneousFloat2 a0)  f)

Definition at line 21993 of file ffi_test_functions_generated.cc.

21995 {
21997
21998 a0.a0.a0 = -1.0;
21999 a0.a1[0].a0 = 2.0;
22000 a0.a1[1].a0 = -3.0;
22001 a0.a2 = 4.0;
22002
22003 std::cout
22004 << "Calling TestAsyncReturnStructArgumentStructStruct16BytesHomogeneous("
22005 << "(((" << a0.a0.a0 << "), [(" << a0.a1[0].a0 << "), (" << a0.a1[1].a0
22006 << ")], " << a0.a2 << "))" << ")\n";
22007
22008 f(a0);
22009}

◆ TestAsyncReturnStructArgumentStructStruct16BytesMixed3()

DART_EXPORT void dart::TestAsyncReturnStructArgumentStructStruct16BytesMixed3 ( void(*)(StructStruct16BytesMixed3 a0)  f)

Definition at line 22033 of file ffi_test_functions_generated.cc.

22035 {
22037
22038 a0.a0.a0 = -1.0;
22039 a0.a1[0].a0 = 2.0;
22040 a0.a1[0].a1 = -3;
22041 a0.a1[0].a2 = 4;
22042 a0.a2[0] = -5;
22043 a0.a2[1] = 6;
22044
22045 std::cout << "Calling TestAsyncReturnStructArgumentStructStruct16BytesMixed3("
22046 << "(((" << a0.a0.a0 << "), [(" << a0.a1[0].a0 << ", "
22047 << a0.a1[0].a1 << ", " << a0.a1[0].a2 << ")], [" << a0.a2[0] << ", "
22048 << a0.a2[1] << "]))" << ")\n";
22049
22050 f(a0);
22051}

◆ TestAsyncReturnStructArgumentStructStruct32BytesHomogeneous()

DART_EXPORT void dart::TestAsyncReturnStructArgumentStructStruct32BytesHomogeneous ( void(*)(StructStruct32BytesHomogeneousDouble2 a0)  f)

Definition at line 22013 of file ffi_test_functions_generated.cc.

22015 {
22017
22018 a0.a0.a0 = -1.0;
22019 a0.a1[0].a0 = 2.0;
22020 a0.a1[1].a0 = -3.0;
22021 a0.a2 = 4.0;
22022
22023 std::cout
22024 << "Calling TestAsyncReturnStructArgumentStructStruct32BytesHomogeneous("
22025 << "(((" << a0.a0.a0 << "), [(" << a0.a1[0].a0 << "), (" << a0.a1[1].a0
22026 << ")], " << a0.a2 << "))" << ")\n";
22027
22028 f(a0);
22029}

◆ TestAsyncReturnStructNestedIntStructAlignmentInt16()

DART_EXPORT void dart::TestAsyncReturnStructNestedIntStructAlignmentInt16 ( void(*)(StructAlignmentInt16 a0, StructAlignmentInt16 a1)  f)

Definition at line 22251 of file ffi_test_functions_generated.cc.

22253 {
22254 StructAlignmentInt16 a0 = {};
22255 StructAlignmentInt16 a1 = {};
22256
22257 a0.a0 = -1;
22258 a0.a1 = 2;
22259 a0.a2 = -3;
22260 a1.a0 = 4;
22261 a1.a1 = -5;
22262 a1.a2 = 6;
22263
22264 std::cout << "Calling TestAsyncReturnStructNestedIntStructAlignmentInt16("
22265 << "((" << static_cast<int>(a0.a0) << ", " << a0.a1 << ", "
22266 << static_cast<int>(a0.a2) << "), (" << static_cast<int>(a1.a0)
22267 << ", " << a1.a1 << ", " << static_cast<int>(a1.a2) << "))"
22268 << ")\n";
22269
22270 f(a0, a1);
22271}

◆ TestAsyncReturnStructNestedIntStructAlignmentInt32()

DART_EXPORT void dart::TestAsyncReturnStructNestedIntStructAlignmentInt32 ( void(*)(StructAlignmentInt32 a0, StructAlignmentInt32 a1)  f)

Definition at line 22275 of file ffi_test_functions_generated.cc.

22277 {
22278 StructAlignmentInt32 a0 = {};
22279 StructAlignmentInt32 a1 = {};
22280
22281 a0.a0 = -1;
22282 a0.a1 = 2;
22283 a0.a2 = -3;
22284 a1.a0 = 4;
22285 a1.a1 = -5;
22286 a1.a2 = 6;
22287
22288 std::cout << "Calling TestAsyncReturnStructNestedIntStructAlignmentInt32("
22289 << "((" << static_cast<int>(a0.a0) << ", " << a0.a1 << ", "
22290 << static_cast<int>(a0.a2) << "), (" << static_cast<int>(a1.a0)
22291 << ", " << a1.a1 << ", " << static_cast<int>(a1.a2) << "))"
22292 << ")\n";
22293
22294 f(a0, a1);
22295}

◆ TestAsyncReturnStructNestedIntStructAlignmentInt64()

DART_EXPORT void dart::TestAsyncReturnStructNestedIntStructAlignmentInt64 ( void(*)(StructAlignmentInt64 a0, StructAlignmentInt64 a1)  f)

Definition at line 22299 of file ffi_test_functions_generated.cc.

22301 {
22302 StructAlignmentInt64 a0 = {};
22303 StructAlignmentInt64 a1 = {};
22304
22305 a0.a0 = -1;
22306 a0.a1 = 2;
22307 a0.a2 = -3;
22308 a1.a0 = 4;
22309 a1.a1 = -5;
22310 a1.a2 = 6;
22311
22312 std::cout << "Calling TestAsyncReturnStructNestedIntStructAlignmentInt64("
22313 << "((" << static_cast<int>(a0.a0) << ", " << a0.a1 << ", "
22314 << static_cast<int>(a0.a2) << "), (" << static_cast<int>(a1.a0)
22315 << ", " << a1.a1 << ", " << static_cast<int>(a1.a2) << "))"
22316 << ")\n";
22317
22318 f(a0, a1);
22319}

◆ TestAsyncReturnStructNestedIrregularEvenBigger()

DART_EXPORT void dart::TestAsyncReturnStructNestedIrregularEvenBigger ( void(*)(uint64_t a0, StructNestedIrregularBigger a1, StructNestedIrregularBigger a2, double a3)  f)

Definition at line 22323 of file ffi_test_functions_generated.cc.

22328 {
22329 uint64_t a0;
22331 StructNestedIrregularBigger a2 = {};
22332 double a3;
22333
22334 a0 = 1;
22335 a1.a0.a0 = 2;
22336 a1.a0.a1.a0.a0 = -3;
22337 a1.a0.a1.a0.a1 = 4;
22338 a1.a0.a1.a1.a0 = -5.0;
22339 a1.a0.a2 = 6;
22340 a1.a0.a3.a0.a0 = -7.0;
22341 a1.a0.a3.a1 = 8.0;
22342 a1.a0.a4 = 9;
22343 a1.a0.a5.a0.a0 = 10.0;
22344 a1.a0.a5.a1.a0 = -11.0;
22345 a1.a0.a6 = 12;
22346 a1.a1.a0.a0 = -13;
22347 a1.a1.a0.a1 = 14;
22348 a1.a1.a1.a0 = -15.0;
22349 a1.a2 = 16.0;
22350 a1.a3 = -17.0;
22351 a2.a0.a0 = 18;
22352 a2.a0.a1.a0.a0 = -19;
22353 a2.a0.a1.a0.a1 = 20;
22354 a2.a0.a1.a1.a0 = -21.0;
22355 a2.a0.a2 = 22;
22356 a2.a0.a3.a0.a0 = -23.0;
22357 a2.a0.a3.a1 = 24.0;
22358 a2.a0.a4 = 25;
22359 a2.a0.a5.a0.a0 = 26.0;
22360 a2.a0.a5.a1.a0 = -27.0;
22361 a2.a0.a6 = 28;
22362 a2.a1.a0.a0 = -29;
22363 a2.a1.a0.a1 = 30;
22364 a2.a1.a1.a0 = -31.0;
22365 a2.a2 = 32.0;
22366 a2.a3 = -33.0;
22367 a3 = 34.0;
22368
22369 std::cout << "Calling TestAsyncReturnStructNestedIrregularEvenBigger(" << "("
22370 << a0 << ", ((" << a1.a0.a0 << ", ((" << a1.a0.a1.a0.a0 << ", "
22371 << a1.a0.a1.a0.a1 << "), (" << a1.a0.a1.a1.a0 << ")), " << a1.a0.a2
22372 << ", ((" << a1.a0.a3.a0.a0 << "), " << a1.a0.a3.a1 << "), "
22373 << a1.a0.a4 << ", ((" << a1.a0.a5.a0.a0 << "), (" << a1.a0.a5.a1.a0
22374 << ")), " << a1.a0.a6 << "), ((" << a1.a1.a0.a0 << ", "
22375 << a1.a1.a0.a1 << "), (" << a1.a1.a1.a0 << ")), " << a1.a2 << ", "
22376 << a1.a3 << "), ((" << a2.a0.a0 << ", ((" << a2.a0.a1.a0.a0 << ", "
22377 << a2.a0.a1.a0.a1 << "), (" << a2.a0.a1.a1.a0 << ")), " << a2.a0.a2
22378 << ", ((" << a2.a0.a3.a0.a0 << "), " << a2.a0.a3.a1 << "), "
22379 << a2.a0.a4 << ", ((" << a2.a0.a5.a0.a0 << "), (" << a2.a0.a5.a1.a0
22380 << ")), " << a2.a0.a6 << "), ((" << a2.a1.a0.a0 << ", "
22381 << a2.a1.a0.a1 << "), (" << a2.a1.a1.a0 << ")), " << a2.a2 << ", "
22382 << a2.a3 << "), " << a3 << ")" << ")\n";
22383
22384 f(a0, a1, a2, a3);
22385}

◆ TestAsyncReturnUnion16BytesNestedFloat()

DART_EXPORT void dart::TestAsyncReturnUnion16BytesNestedFloat ( void(*)(Struct8BytesHomogeneousFloat a0)  f)

Definition at line 21801 of file ffi_test_functions_generated.cc.

21803 {
21805
21806 a0.a0 = -1.0;
21807 a0.a1 = 2.0;
21808
21809 std::cout << "Calling TestAsyncReturnUnion16BytesNestedFloat(" << "(("
21810 << a0.a0 << ", " << a0.a1 << "))" << ")\n";
21811
21812 f(a0);
21813}

◆ TestAsyncReturnUnion4BytesMixed()

DART_EXPORT void dart::TestAsyncReturnUnion4BytesMixed ( void(*)(uint32_t a0)  f)

Definition at line 21754 of file ffi_test_functions_generated.cc.

21756 {
21757 uint32_t a0;
21758
21759 a0 = 1;
21760
21761 std::cout << "Calling TestAsyncReturnUnion4BytesMixed(" << "(" << a0 << ")"
21762 << ")\n";
21763
21764 f(a0);
21765}

◆ TestAsyncReturnUnion8BytesNestedFloat()

DART_EXPORT void dart::TestAsyncReturnUnion8BytesNestedFloat ( void(*)(double a0)  f)

Definition at line 21769 of file ffi_test_functions_generated.cc.

21771 {
21772 double a0;
21773
21774 a0 = -1.0;
21775
21776 std::cout << "Calling TestAsyncReturnUnion8BytesNestedFloat(" << "(" << a0
21777 << ")" << ")\n";
21778
21779 f(a0);
21780}

◆ TestAsyncReturnUnion9BytesNestedInt()

DART_EXPORT void dart::TestAsyncReturnUnion9BytesNestedInt ( void(*)(Struct8BytesInt a0)  f)

Definition at line 21784 of file ffi_test_functions_generated.cc.

21786 {
21787 Struct8BytesInt a0 = {};
21788
21789 a0.a0 = -1;
21790 a0.a1 = 2;
21791 a0.a2 = -3;
21792
21793 std::cout << "Calling TestAsyncReturnUnion9BytesNestedInt(" << "((" << a0.a0
21794 << ", " << a0.a1 << ", " << a0.a2 << "))" << ")\n";
21795
21796 f(a0);
21797}

◆ TestBecomeForward()

void dart::TestBecomeForward ( Heap::Space  before_space,
Heap::Space  after_space 
)

Definition at line 15 of file become_test.cc.

15 {
16 // Allocate the container in old space to test the remembered set.
17 const Array& container = Array::Handle(Array::New(1, Heap::kOld));
18
19 const String& before_obj = String::Handle(String::New("old", before_space));
20 const String& after_obj = String::Handle(String::New("new", after_space));
21 container.SetAt(0, before_obj);
22 EXPECT(before_obj.ptr() != after_obj.ptr());
23
24 Become become;
25 become.Add(before_obj, after_obj);
26 become.Forward();
27
28 EXPECT(before_obj.ptr() == after_obj.ptr());
29 EXPECT(container.At(0) == after_obj.ptr());
30
31 GCTestHelper::CollectAllGarbage();
32
33 EXPECT(before_obj.ptr() == after_obj.ptr());
34 EXPECT(container.At(0) == after_obj.ptr());
35}

◆ TestBitSet()

template<intptr_t Size>
void dart::TestBitSet ( )

Definition at line 12 of file bit_set_test.cc.

12 {
13 BitSet<Size> set;
14 EXPECT_EQ(-1, set.Last());
15 for (int i = 0; i < Size; ++i) {
16 EXPECT_EQ(false, set.Test(i));
17 set.Set(i, true);
18 EXPECT_EQ(true, set.Test(i));
19 EXPECT_EQ(i, set.Last());
20 for (int j = 0; j < Size; ++j) {
21 intptr_t next = set.Next(j);
22 if (j <= i) {
23 EXPECT_EQ(i, next);
24 } else {
25 EXPECT_EQ(-1, next);
26 }
27 }
28 set.Set(i, false);
29 EXPECT_EQ(false, set.Test(i));
30 }
31 set.Reset();
32 for (int i = 0; i < Size - 1; ++i) {
33 set.Set(i, true);
34 for (int j = i + 1; j < Size; ++j) {
35 set.Set(j, true);
36 EXPECT_EQ(j, set.Last());
37 EXPECT_EQ(i, set.ClearLastAndFindPrevious(j));
38 EXPECT_EQ(false, set.Test(j));
39 }
40 }
41}
TSize< Scalar > Size
Definition size.h:137

◆ TestByteDataDirectAccess()

static void dart::TestByteDataDirectAccess ( )
static

Definition at line 2757 of file dart_api_impl_test.cc.

2757 {
2758 const char* kScriptChars =
2759 "import 'dart:typed_data';\n"
2760 "class Expect {\n"
2761 " static equals(a, b) {\n"
2762 " if (a != b) {\n"
2763 " throw 'not equal. expected: $a, got: $b';\n"
2764 " }\n"
2765 " }\n"
2766 "}\n"
2767 "void setMain(var list) {"
2768 " Expect.equals(10, list.length);"
2769 " for (var i = 0; i < 10; i++) {"
2770 " list.setInt8(i, i);"
2771 " }"
2772 "}\n"
2773 "bool testMain(var list) {"
2774 " Expect.equals(10, list.length);"
2775 " for (var i = 0; i < 10; i++) {"
2776 " Expect.equals((10 + i), list.getInt8(i));"
2777 " }"
2778 " return true;"
2779 "}\n"
2780 "ByteData main() {"
2781 " var a = new Int8List(100);"
2782 " var view = new ByteData.view(a.buffer, 50, 10);"
2783 " return view;"
2784 "}\n";
2785 // Create a test library and Load up a test script in it.
2786 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
2787
2788 // Test with a typed data view object.
2789 Dart_Handle list_access_test_obj;
2790 list_access_test_obj = Dart_Invoke(lib, NewString("main"), 0, nullptr);
2791 EXPECT_VALID(list_access_test_obj);
2792 TestDirectAccess(lib, list_access_test_obj, Dart_TypedData_kByteData, false);
2793}
static void TestDirectAccess(Dart_Handle lib, Dart_Handle array, Dart_TypedData_Type expected_type, bool is_external)

◆ TestCanonicalizationOfTypedDataViewFieldLoads()

static void dart::TestCanonicalizationOfTypedDataViewFieldLoads ( Thread thread,
TypeDataField  field_kind 
)
static

Definition at line 1255 of file il_test.cc.

1257 {
1258 const auto& typed_data_lib = Library::Handle(Library::TypedDataLibrary());
1259 const auto& view_cls = Class::Handle(
1260 typed_data_lib.LookupClassAllowPrivate(Symbols::_Float32ArrayView()));
1261 const Error& err = Error::Handle(view_cls.EnsureIsFinalized(thread));
1262 EXPECT(err.IsNull());
1263 const auto& factory =
1264 Function::ZoneHandle(view_cls.LookupFactoryAllowPrivate(String::Handle(
1265 String::Concat(Symbols::_Float32ArrayView(), Symbols::DotUnder()))));
1266 EXPECT(!factory.IsNull());
1267
1269 CompilerState S(thread, /*is_aot=*/false, /*is_optimizing=*/true);
1271
1272 const Slot* field = nullptr;
1273 switch (field_kind) {
1275 field = &Slot::TypedDataBase_length();
1276 break;
1278 field = &Slot::TypedDataView_offset_in_bytes();
1279 break;
1281 field = &Slot::TypedDataView_typed_data();
1282 break;
1283 }
1284
1285 auto b1 = H.flow_graph()->graph_entry()->normal_entry();
1286
1287 const auto constant_4 = H.IntConstant(4);
1288 const auto constant_1 = H.IntConstant(1);
1289
1290 Definition* array;
1291 Definition* load;
1292 DartReturnInstr* ret;
1293
1294 {
1295 BlockBuilder builder(H.flow_graph(), b1);
1296 // array <- AllocateTypedData(1)
1297 array = builder.AddDefinition(new AllocateTypedDataInstr(
1298 InstructionSource(), kTypedDataFloat64ArrayCid, new Value(constant_1),
1299 DeoptId::kNone));
1300 // view <- StaticCall(_Float32ArrayView._, null, array, 4, 1)
1301 const auto view = builder.AddDefinition(new StaticCallInstr(
1302 InstructionSource(), factory, 1, Array::empty_array(),
1303 {new Value(H.flow_graph()->constant_null()), new Value(array),
1304 new Value(constant_4), new Value(constant_1)},
1305 DeoptId::kNone, 1, ICData::RebindRule::kStatic));
1306 // array_alias <- LoadField(view.length)
1307 load = builder.AddDefinition(
1308 new LoadFieldInstr(new Value(view), *field, InstructionSource()));
1309 // Return(load)
1310 ret = builder.AddReturn(new Value(load));
1311 }
1312 H.FinishGraph();
1313 H.flow_graph()->Canonicalize();
1314
1315 switch (field_kind) {
1317 EXPECT_PROPERTY(ret->value()->definition(), &it == constant_1);
1318 break;
1320 EXPECT_PROPERTY(ret->value()->definition(), &it == constant_4);
1321 break;
1323 EXPECT_PROPERTY(ret->value()->definition(), &it == array);
1324 break;
1325 }
1326}

◆ TestCardRememberedArray()

static void dart::TestCardRememberedArray ( bool  immutable,
bool  compact 
)
static

Definition at line 1284 of file heap_test.cc.

1284 {
1285 constexpr intptr_t kNumElements = kNewAllocatableSize / kCompressedWordSize;
1286 Array& array = Array::Handle(Array::New(kNumElements));
1287 EXPECT(array.ptr()->untag()->IsCardRemembered());
1288 EXPECT(Page::Of(array.ptr())->is_large());
1289
1290 {
1291 HANDLESCOPE(Thread::Current());
1292 Object& element = Object::Handle();
1293 for (intptr_t i = 0; i < kNumElements; i++) {
1294 element = Double::New(i, Heap::kNew); // Garbage
1295 element = Double::New(i, Heap::kNew);
1296 array.SetAt(i, element);
1297 }
1298 if (immutable) {
1299 array.MakeImmutable();
1300 }
1301 }
1302
1303 GCTestHelper::CollectAllGarbage(compact);
1304 GCTestHelper::WaitForGCTasks();
1305
1306 {
1307 HANDLESCOPE(Thread::Current());
1308 Object& element = Object::Handle();
1309 for (intptr_t i = 0; i < kNumElements; i++) {
1310 element = array.At(i);
1311 EXPECT(element.IsDouble());
1312 EXPECT(Double::Cast(element).value() == i);
1313 }
1314 }
1315}

◆ TestCardRememberedWeakArray()

static void dart::TestCardRememberedWeakArray ( bool  compact)
static

Definition at line 1317 of file heap_test.cc.

1317 {
1318 constexpr intptr_t kNumElements = kNewAllocatableSize / kCompressedWordSize;
1319 WeakArray& weak = WeakArray::Handle(WeakArray::New(kNumElements));
1320 EXPECT(!weak.ptr()->untag()->IsCardRemembered());
1321 EXPECT(Page::Of(weak.ptr())->is_large());
1322 Array& strong = Array::Handle(Array::New(kNumElements));
1323
1324 {
1325 HANDLESCOPE(Thread::Current());
1326 Object& element = Object::Handle();
1327 for (intptr_t i = 0; i < kNumElements; i++) {
1328 element = Double::New(i, Heap::kNew); // Garbage
1329 element = Double::New(i, Heap::kNew);
1330 weak.SetAt(i, element);
1331 if ((i % 3) == 0) {
1332 strong.SetAt(i, element);
1333 }
1334 }
1335 }
1336
1337 GCTestHelper::CollectAllGarbage(compact);
1338 GCTestHelper::WaitForGCTasks();
1339
1340 {
1341 HANDLESCOPE(Thread::Current());
1342 Object& element = Object::Handle();
1343 for (intptr_t i = 0; i < kNumElements; i++) {
1344 element = weak.At(i);
1345 if ((i % 3) == 0) {
1346 EXPECT(element.IsDouble());
1347 EXPECT(Double::Cast(element).value() == i);
1348 } else {
1349 EXPECT(element.IsNull());
1350 }
1351 }
1352 }
1353}

◆ TestConstantFoldToSmi()

static void dart::TestConstantFoldToSmi ( const Library root_library,
const char *  function_name,
CompilerPass::PipelineMode  mode,
intptr_t  expected_value 
)
static

Definition at line 1099 of file il_test.cc.

1102 {
1103 const auto& function =
1104 Function::Handle(GetFunction(root_library, function_name));
1105
1106 TestPipeline pipeline(function, mode);
1107 FlowGraph* flow_graph = pipeline.RunPasses({});
1108
1109 auto entry = flow_graph->graph_entry()->normal_entry();
1110 EXPECT(entry != nullptr);
1111
1112 DartReturnInstr* ret = nullptr;
1113
1114 ILMatcher cursor(flow_graph, entry, true, ParallelMovesHandling::kSkip);
1115 RELEASE_ASSERT(cursor.TryMatch({
1116 kMoveGlob,
1117 {kMatchDartReturn, &ret},
1118 }));
1119
1120 ConstantInstr* constant = ret->value()->definition()->AsConstant();
1121 EXPECT(constant != nullptr);
1122 if (constant != nullptr) {
1123 const Object& value = constant->value();
1124 EXPECT(value.IsSmi());
1125 if (value.IsSmi()) {
1126 const intptr_t int_value = Smi::Cast(value).Value();
1127 EXPECT_EQ(expected_value, int_value);
1128 }
1129 }
1130}

◆ TestDeprecatedSymbols()

DART_EXPORT void dart::TestDeprecatedSymbols ( )

Definition at line 1363 of file ffi_test_functions_vmspecific.cc.

1363 {
1364 Dart_UpdateExternalSize_DL(nullptr, 0);
1365 Dart_UpdateFinalizableExternalSize_DL(nullptr, Dart_Null(), 0);
1366}

◆ TestDirectAccess()

static void dart::TestDirectAccess ( Dart_Handle  lib,
Dart_Handle  array,
Dart_TypedData_Type  expected_type,
bool  is_external 
)
static

Definition at line 2514 of file dart_api_impl_test.cc.

2517 {
2519
2520 // Invoke the dart function that sets initial values.
2521 Dart_Handle dart_args[1];
2522 dart_args[0] = array;
2523 result = Dart_Invoke(lib, NewString("setMain"), 1, dart_args);
2525
2526 // Now Get a direct access to this typed data object and check it's contents.
2527 const int kLength = 10;
2529 void* data;
2530 intptr_t len;
2531 result = Dart_TypedDataAcquireData(array, &type, &data, &len);
2532 EXPECT(!Thread::Current()->IsAtSafepoint());
2534 EXPECT_EQ(expected_type, type);
2535 EXPECT_EQ(kLength, len);
2536 int8_t* dataP = reinterpret_cast<int8_t*>(data);
2537 for (int i = 0; i < kLength; i++) {
2538 EXPECT_EQ(i, dataP[i]);
2539 }
2540
2541 // Now try allocating a string with outstanding Acquires and it should
2542 // return an error.
2543 result = NewString("We expect an error here");
2544 EXPECT_ERROR(result, "Callbacks into the Dart VM are currently prohibited");
2545
2546 // Now modify the values in the directly accessible array and then check
2547 // it we see the changes back in dart.
2548 for (int i = 0; i < kLength; i++) {
2549 dataP[i] += 10;
2550 }
2551
2552 // Release direct access to the typed data object.
2553 EXPECT(!Thread::Current()->IsAtSafepoint());
2556
2557 // Invoke the dart function in order to check the modified values.
2558 result = Dart_Invoke(lib, NewString("testMain"), 1, dart_args);
2560}
static int kLength

◆ TestEndFunction()

void dart::TestEndFunction ( uword  data)

Definition at line 127 of file message_handler_test.cc.

127 {
128 return (reinterpret_cast<TestMessageHandler*>(data))->End();
129}

◆ TestFieldNotFound()

static void dart::TestFieldNotFound ( Dart_Handle  container,
Dart_Handle  name 
)
static

Definition at line 5143 of file dart_api_impl_test.cc.

5143 {
5144 EXPECT_ERROR(Dart_GetField(container, name), "NoSuchMethodError");
5146 "NoSuchMethodError");
5147}

◆ TestFieldOk()

static void dart::TestFieldOk ( Dart_Handle  container,
Dart_Handle  name,
bool  final,
const char *  initial_value 
)
static

Definition at line 5106 of file dart_api_impl_test.cc.

5109 {
5111
5112 // Make sure we have the right initial value.
5113 result = Dart_GetField(container, name);
5115 const char* value = "";
5117 EXPECT_STREQ(initial_value, value);
5118
5119 // Use a unique expected value.
5120 static int counter = 0;
5121 char buffer[256];
5122 Utils::SNPrint(buffer, 256, "Expected%d", ++counter);
5123
5124 // Try to change the field value.
5125 result = Dart_SetField(container, name, NewString(buffer));
5126 if (final) {
5128 } else {
5130 }
5131
5132 // Make sure we have the right final value.
5133 result = Dart_GetField(container, name);
5136 if (final) {
5137 EXPECT_STREQ(initial_value, value);
5138 } else {
5139 EXPECT_STREQ(buffer, value);
5140 }
5141}

◆ TestFreeList()

static void dart::TestFreeList ( VirtualMemory region,
FreeList free_list,
bool  is_protected 
)
static

Definition at line 38 of file freelist_test.cc.

40 {
41 const intptr_t kSmallObjectSize = 4 * kWordSize;
42 const intptr_t kMediumObjectSize = 16 * kWordSize;
43 const intptr_t kLargeObjectSize = 8 * KB;
44 uword blob = region->start();
45 // Enqueue the large blob as one free block.
46 free_list->Free(blob, region->size());
47
48 if (is_protected) {
49 // Write protect the whole region.
50 region->Protect(VirtualMemory::kReadExecute);
51 }
52
53 // Allocate a small object. Expect it to be positioned as the first element.
54 uword small_object = Allocate(free_list, kSmallObjectSize, is_protected);
55 EXPECT_EQ(blob, small_object);
56 // Freeing and allocating should give us the same memory back.
57 Free(free_list, small_object, kSmallObjectSize, is_protected);
58 small_object = Allocate(free_list, kSmallObjectSize, is_protected);
59 EXPECT_EQ(blob, small_object);
60 // Splitting the remainder further with small and medium objects.
61 uword small_object2 = Allocate(free_list, kSmallObjectSize, is_protected);
62 EXPECT_EQ(blob + kSmallObjectSize, small_object2);
63 uword med_object = Allocate(free_list, kMediumObjectSize, is_protected);
64 EXPECT_EQ(small_object2 + kSmallObjectSize, med_object);
65 // Allocate a large object.
66 uword large_object = Allocate(free_list, kLargeObjectSize, is_protected);
67 EXPECT_EQ(med_object + kMediumObjectSize, large_object);
68 // Make sure that small objects can still split the remainder.
69 uword small_object3 = Allocate(free_list, kSmallObjectSize, is_protected);
70 EXPECT_EQ(large_object + kLargeObjectSize, small_object3);
71 // Split the large object.
72 Free(free_list, large_object, kLargeObjectSize, is_protected);
73 uword small_object4 = Allocate(free_list, kSmallObjectSize, is_protected);
74 EXPECT_EQ(large_object, small_object4);
75 // Get the full remainder of the large object.
76 large_object =
77 Allocate(free_list, kLargeObjectSize - kSmallObjectSize, is_protected);
78 EXPECT_EQ(small_object4 + kSmallObjectSize, large_object);
79 // Get another large object from the large unallocated remainder.
80 uword large_object2 = Allocate(free_list, kLargeObjectSize, is_protected);
81 EXPECT_EQ(small_object3 + kSmallObjectSize, large_object2);
82}

◆ testFunction()

static int dart::testFunction ( int  x)
static

Definition at line 95 of file virtual_memory_test.cc.

95 {
96 return x * 2;
97}

◆ TestGC()

DART_EXPORT intptr_t dart::TestGC ( void(*)()  do_gc)

Definition at line 202 of file ffi_test_functions_vmspecific.cc.

202 {
203 ClobberAndCall(do_gc);
204 return 0;
205}
void ClobberAndCall(void(*fn)())

◆ TestGrowableArray()

template<class GrowableArrayInt , class GrowableArrayInt64 >
void dart::TestGrowableArray ( )

Definition at line 15 of file growable_array_test.cc.

15 {
16 GrowableArrayInt g;
17 EXPECT_EQ(0, g.length());
18 EXPECT(g.is_empty());
19 g.Add(5);
20 EXPECT_EQ(5, g[0]);
21 EXPECT_EQ(1, g.length());
22 EXPECT(!g.is_empty());
23 g.Add(3);
24 const GrowableArrayInt& temp = g;
25 EXPECT_EQ(5, temp[0]);
26 EXPECT_EQ(3, temp[1]);
27 for (int i = 0; i < 10000; i++) {
28 g.Add(i);
29 }
30 EXPECT_EQ(10002, g.length());
31 EXPECT_EQ(10000 - 1, g.Last());
32
33 GrowableArrayInt64 f(10);
34 EXPECT_EQ(0, f.length());
35 f.Add(-1LL);
36 f.Add(15LL);
37 EXPECT_EQ(2, f.length());
38 for (int64_t l = 0; l < 100; l++) {
39 f.Add(l);
40 }
41 EXPECT_EQ(102, f.length());
42 EXPECT_EQ(100 - 1, f.Last());
43 EXPECT_EQ(-1LL, f[0]);
44
45 GrowableArrayInt h;
46 EXPECT_EQ(0, h.length());
47 h.Add(101);
48 h.Add(102);
49 h.Add(103);
50 EXPECT_EQ(3, h.length());
51 EXPECT_EQ(103, h.Last());
52 h.RemoveLast();
53 EXPECT_EQ(2, h.length());
54 EXPECT_EQ(102, h.Last());
55 h.RemoveLast();
56 EXPECT_EQ(1, h.length());
57 EXPECT_EQ(101, h.Last());
58 h.RemoveLast();
59 EXPECT_EQ(0, h.length());
60 EXPECT(h.is_empty());
61 h.Add(-8899);
62 h.Add(7908);
63 EXPECT(!h.is_empty());
64 h.Clear();
65 EXPECT(h.is_empty());
66}

◆ TestIllegalArrayLength()

static void dart::TestIllegalArrayLength ( intptr_t  length)
static

Definition at line 1864 of file object_test.cc.

1864 {
1865 char buffer[1024];
1866 Utils::SNPrint(buffer, sizeof(buffer),
1867 "main() {\n"
1868 " List.filled(%" Pd
1869 ", null);\n"
1870 "}\n",
1871 length);
1872 Dart_Handle lib = TestCase::LoadTestScript(buffer, nullptr);
1873 EXPECT_VALID(lib);
1874 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, nullptr);
1875 Utils::SNPrint(buffer, sizeof(buffer),
1876 "Unhandled exception:\n"
1877 "RangeError (length): Invalid value: "
1878 "Not in inclusive range 0..%" Pd ": %" Pd,
1879 Array::kMaxElements, length);
1881}

◆ TestIllegalTypedDataLength()

static void dart::TestIllegalTypedDataLength ( const char *  class_name,
intptr_t  length 
)
static

Definition at line 1928 of file object_test.cc.

1929 {
1930 char buffer[1024];
1931 Utils::SNPrint(buffer, sizeof(buffer),
1932 "import 'dart:typed_data';\n"
1933 "main() {\n"
1934 " new %s(%" Pd
1935 ");\n"
1936 "}\n",
1937 class_name, length);
1938 Dart_Handle lib = TestCase::LoadTestScript(buffer, nullptr);
1939 EXPECT_VALID(lib);
1940 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, nullptr);
1941 Utils::SNPrint(buffer, sizeof(buffer), "%" Pd, length);
1942 EXPECT_ERROR(result, "RangeError (length): Invalid value");
1944}

◆ TestIntComputation()

DART_EXPORT intptr_t dart::TestIntComputation ( int64_t(*)(int8_t, int16_t, int32_t, int64_t)  fn)

Definition at line 910 of file ffi_test_functions.cc.

910 {
911 const int64_t result = fn(125, 250, 500, 1000);
912 std::cout << "result " << result << "\n";
913 CHECK_EQ(result, 625);
914 CHECK_EQ(0x7FFFFFFFFFFFFFFFLL, fn(0, 0, 0, 0x7FFFFFFFFFFFFFFFLL));
915 CHECK_EQ(((int64_t)0x8000000000000000LL), fn(0, 0, 0, 0x8000000000000000LL));
916 return 0;
917}
#define CHECK_EQ(X, Y)

◆ TestIntConverterCanonicalizationRule()

bool dart::TestIntConverterCanonicalizationRule ( Thread thread,
int64_t  min_value,
int64_t  max_value,
Representation  initial,
Representation  intermediate,
Representation  final 
)

Definition at line 196 of file il_test.cc.

201 {
203
204 CompilerState S(thread, /*is_aot=*/false, /*is_optimizing=*/true);
205
206 FlowGraphBuilderHelper H(/*num_parameters=*/1);
207 H.AddVariable("v0", AbstractType::ZoneHandle(Type::IntType()));
208
209 auto normal_entry = H.flow_graph()->graph_entry()->normal_entry();
210
211 Definition* v0;
212 DartReturnInstr* ret;
213
214 {
215 BlockBuilder builder(H.flow_graph(), normal_entry);
216 v0 = builder.AddParameter(0, initial);
217 v0->set_range(Range(RangeBoundary::FromConstant(min_value),
218 RangeBoundary::FromConstant(max_value)));
219 auto conv1 = builder.AddDefinition(new IntConverterInstr(
220 initial, intermediate, new Value(v0), S.GetNextDeoptId()));
221 auto conv2 = builder.AddDefinition(new IntConverterInstr(
222 intermediate, initial, new Value(conv1), S.GetNextDeoptId()));
223 ret = builder.AddReturn(new Value(conv2));
224 }
225
226 H.FinishGraph();
227
228 H.flow_graph()->Canonicalize();
229 H.flow_graph()->Canonicalize();
230
231 return ret->value()->definition() == v0;
232}
void set_range(const Range &)

◆ TestLargeFrame()

void dart::TestLargeFrame ( const char *  type,
const char *  zero,
const char *  one,
const char *  main 
)

Definition at line 201 of file flow_graph_test.cc.

204 {
205 SetFlagScope<int> sfs(&FLAG_optimization_counter_threshold, 1000);
206 TextBuffer printer(256 * KB);
207
208 intptr_t num_locals = 2000;
209 printer.Printf("import 'dart:typed_data';\n");
210 printer.Printf("@pragma('vm:never-inline')\n");
211 printer.Printf("%s one() { return %s; }\n", type, one);
212 printer.Printf("@pragma('vm:never-inline')\n");
213 printer.Printf("%s largeFrame(int n) {\n", type);
214 for (intptr_t i = 0; i < num_locals; i++) {
215 printer.Printf(" %s local%" Pd " = %s;\n", type, i, zero);
216 }
217 printer.Printf(" for (int i = 0; i < n; i++) {\n");
218 for (intptr_t i = 0; i < num_locals; i++) {
219 printer.Printf(" local%" Pd " += one();\n", i);
220 }
221 printer.Printf(" }\n");
222 printer.Printf(" %s sum = %s;\n", type, zero);
223 for (intptr_t i = 0; i < num_locals; i++) {
224 printer.Printf(" sum += local%" Pd ";\n", i);
225 }
226 printer.Printf(" return sum;\n");
227 printer.Printf("}\n");
228
229 printer.AddString(main);
230
231 const auto& root_library = Library::Handle(LoadTestScript(printer.buffer()));
232 Invoke(root_library, "main");
233}

◆ TestManyArgs()

DART_EXPORT intptr_t dart::TestManyArgs ( double(*)(intptr_t a, float b, intptr_t c, double d, intptr_t e, float f, intptr_t g, double h, intptr_t i, float j, intptr_t k, double l, intptr_t m, float n, intptr_t o, double p, intptr_t q, float r, intptr_t s, double t)  fn)

Definition at line 965 of file ffi_test_functions.cc.

984 {
985 CHECK(210.0 == fn(1, 2.0, 3, 4.0, 5, 6.0, 7, 8.0, 9, 10.0, 11, 12.0, 13, 14.0,
986 15, 16.0, 17, 18.0, 19, 20.0));
987 return 0;
988}
#define CHECK(X)

◆ TestManyDoubles()

DART_EXPORT intptr_t dart::TestManyDoubles ( double(*)(double, double, double, double, double, double, double, double, double, double)  fn)

Definition at line 951 of file ffi_test_functions.cc.

960 {
961 CHECK_EQ(55, fn(1, 2, 3, 4, 5, 6, 7, 8, 9, 10));
962 return 0;
963}

◆ TestManyInts()

DART_EXPORT intptr_t dart::TestManyInts ( intptr_t(*)(intptr_t, intptr_t, intptr_t, intptr_t, intptr_t, intptr_t, intptr_t, intptr_t, intptr_t, intptr_t)  fn)

Definition at line 937 of file ffi_test_functions.cc.

946 {
947 CHECK_EQ(55, fn(1, 2, 3, 4, 5, 6, 7, 8, 9, 10));
948 return 0;
949}

◆ TestMap()

template<typename Map >
void dart::TestMap ( intptr_t  initial_capacity,
bool  ordered 
)

Definition at line 217 of file hash_table_test.cc.

217 {
218 std::map<std::string, int> expected;
219 Map actual(HashTables::New<Map>(initial_capacity));
220 // Insert the following (strings, int) mapping:
221 // aaa...aaa -> 26
222 // bbb..bbb -> 25
223 // ...
224 // yy -> 2
225 // z -> 1
226 for (int i = 0; i < 2; ++i) {
227 for (char ch = 'a'; ch <= 'z'; ++ch) {
228 int length = 'z' - ch + 1;
229 std::string key(length, ch);
230 // Map everything to zero initially, then update to their final values.
231 int value = length * i;
232 expected[key] = value;
233 bool present =
234 actual.UpdateOrInsert(String::Handle(String::New(key.c_str())),
235 Smi::Handle(Smi::New(value)));
236 EXPECT_EQ((i != 0), present);
237 Validate(actual);
238 VerifyStringMapsEqual(expected, actual, ordered);
239 }
240 }
241 actual.Clear();
242 EXPECT_EQ(0, actual.NumOccupied());
243 actual.Release();
244}
void VerifyStringMapsEqual(const std::map< std::string, int > &expected, const Map &actual, bool ordered)

◆ TestNativeFields()

static void dart::TestNativeFields ( Dart_Handle  retobj)
static

Definition at line 5700 of file dart_api_impl_test.cc.

5700 {
5701 // Access and set various instance fields of the object.
5702 Dart_Handle result = Dart_GetField(retobj, NewString("fld3"));
5704 result = Dart_GetField(retobj, NewString("fld0"));
5707 result = Dart_GetField(retobj, NewString("fld1"));
5709 int64_t value = 0;
5711 EXPECT_EQ(10, value);
5712 result = Dart_GetField(retobj, NewString("fld2"));
5715 EXPECT_EQ(20, value);
5716 result = Dart_SetField(retobj, NewString("fld2"), Dart_NewInteger(40));
5718 result = Dart_SetField(retobj, NewString("fld1"), Dart_NewInteger(40));
5720 result = Dart_GetField(retobj, NewString("fld1"));
5723 EXPECT_EQ(40, value);
5724
5725 // Now access and set various native instance fields of the returned object.
5726 const int kNativeFld0 = 0;
5727 const int kNativeFld1 = 1;
5728 const int kNativeFld2 = 2;
5729 const int kNativeFld3 = 3;
5730 const int kNativeFld4 = 4;
5731 int field_count = 0;
5732 intptr_t field_value = 0;
5733 EXPECT_VALID(Dart_GetNativeInstanceFieldCount(retobj, &field_count));
5734 EXPECT_EQ(4, field_count);
5735 result = Dart_GetNativeInstanceField(retobj, kNativeFld4, &field_value);
5737 result = Dart_GetNativeInstanceField(retobj, kNativeFld0, &field_value);
5739 EXPECT_EQ(0, field_value);
5740 result = Dart_GetNativeInstanceField(retobj, kNativeFld1, &field_value);
5742 EXPECT_EQ(0, field_value);
5743 result = Dart_GetNativeInstanceField(retobj, kNativeFld2, &field_value);
5745 EXPECT_EQ(0, field_value);
5746 result = Dart_GetNativeInstanceField(retobj, kNativeFld3, &field_value);
5748 EXPECT_EQ(0, field_value);
5749 result = Dart_SetNativeInstanceField(retobj, kNativeFld4, 40);
5751 result = Dart_SetNativeInstanceField(retobj, kNativeFld0, 4);
5753 result = Dart_SetNativeInstanceField(retobj, kNativeFld1, 40);
5755 result = Dart_SetNativeInstanceField(retobj, kNativeFld2, 400);
5757 result = Dart_SetNativeInstanceField(retobj, kNativeFld3, 4000);
5759 result = Dart_GetNativeInstanceField(retobj, kNativeFld3, &field_value);
5761 EXPECT_EQ(4000, field_value);
5762
5763 // Now re-access various dart instance fields of the returned object
5764 // to ensure that there was no corruption while setting native fields.
5765 result = Dart_GetField(retobj, NewString("fld1"));
5768 EXPECT_EQ(40, value);
5769 result = Dart_GetField(retobj, NewString("fld2"));
5772 EXPECT_EQ(20, value);
5773}

◆ TestNativeFieldsAccess_access()

void dart::TestNativeFieldsAccess_access ( Dart_NativeArguments  args)

Definition at line 5580 of file dart_api_impl_test.cc.

5580 {
5581 intptr_t field_values[kTestNumNativeFields];
5583 args, 0, kTestNumNativeFields, field_values);
5585 EXPECT_EQ(kNativeField1Value, field_values[0]);
5586 EXPECT_EQ(kNativeField2Value, field_values[1]);
5587 result = Dart_GetNativeFieldsOfArgument(args, 1, kTestNumNativeFields,
5588 field_values);
5590 EXPECT_EQ(0, field_values[0]);
5591 EXPECT_EQ(0, field_values[1]);
5592}
DART_EXPORT Dart_Handle Dart_GetNativeFieldsOfArgument(Dart_NativeArguments args, int arg_index, int num_fields, intptr_t *field_values)
static constexpr int kTestNumNativeFields

◆ TestNativeFieldsAccess_init()

void dart::TestNativeFieldsAccess_init ( Dart_NativeArguments  args)

Definition at line 5574 of file dart_api_impl_test.cc.

5574 {
5576 Dart_SetNativeInstanceField(receiver, 0, kNativeField1Value);
5577 Dart_SetNativeInstanceField(receiver, 1, kNativeField2Value);
5578}

◆ TestNativeFieldsAccess_invalidAccess()

void dart::TestNativeFieldsAccess_invalidAccess ( Dart_NativeArguments  args)

Definition at line 5594 of file dart_api_impl_test.cc.

5594 {
5595 intptr_t field_values[kTestNumNativeFields];
5597 args, 0, kTestNumNativeFields, field_values);
5599 "Dart_GetNativeFieldsOfArgument: "
5600 "expected 0 'num_fields' but was passed in 2");
5601}

◆ TestNativeFieldsAccess_lookup()

static Dart_NativeFunction dart::TestNativeFieldsAccess_lookup ( Dart_Handle  name,
int  argument_count,
bool *  auto_scope 
)
static

Definition at line 5603 of file dart_api_impl_test.cc.

5605 {
5606 ASSERT(auto_scope != nullptr);
5607 *auto_scope = true;
5608 TransitionNativeToVM transition(Thread::Current());
5609 const Object& obj = Object::Handle(Api::UnwrapHandle(name));
5610 if (!obj.IsString()) {
5611 return nullptr;
5612 }
5613 const char* function_name = obj.ToCString();
5614 ASSERT(function_name != nullptr);
5615 if (strcmp(function_name, "TestNativeFieldsAccess_init") == 0) {
5616 return TestNativeFieldsAccess_init;
5617 } else if (strcmp(function_name, "TestNativeFieldsAccess_access") == 0) {
5619 } else if (strcmp(function_name, "TestNativeFieldsAccess_invalidAccess") ==
5620 0) {
5622 } else {
5623 return nullptr;
5624 }
5625}
void TestNativeFieldsAccess_access(Dart_NativeArguments args)
void TestNativeFieldsAccess_invalidAccess(Dart_NativeArguments args)

◆ TestNonNullSmiSum()

void dart::TestNonNullSmiSum ( Dart_NativeArguments  args)

Definition at line 55 of file native_entry_test.cc.

55 {
56 int64_t result = 0;
57 int arg_count = Dart_GetNativeArgumentCount(args);
58 // Test the lower level macro GET_NATIVE_ARGUMENT.
59 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args);
60 Zone* zone = Thread::Current()->zone(); // Used by GET_NATIVE_ARGUMENT.
61 for (int i = 0; i < arg_count; i++) {
63 GET_NATIVE_ARGUMENT(Integer, argument, arguments->NativeArgAt(i));
64 EXPECT(argument.IsInteger()); // May be null.
65 EXPECT_EQ(Api::UnwrapHandle(arg), argument.ptr()); // May be null.
66 int64_t arg_value = -1;
67 if (argument.IsNull()) {
68 EXPECT_ERROR(Dart_IntegerToInt64(arg, &arg_value),
69 "Dart_IntegerToInt64 expects argument 'integer' "
70 "to be non-null.");
71 } else {
72 EXPECT_VALID(Dart_IntegerToInt64(arg, &arg_value));
73 EXPECT_EQ(arg_value, argument.AsInt64Value());
74 // Ignoring overflow in the addition below.
75 result += arg_value;
76 }
77 }
79}

◆ TestNotSignExtendedBitField()

template<typename T >
static void dart::TestNotSignExtendedBitField ( )
static

Definition at line 48 of file bitfield_test.cc.

48 {
49 class F1 : public BitField<T, intptr_t, 0, 8, /*sign_extend=*/false> {};
50 class F2
51 : public BitField<T, uintptr_t, F1::kNextBit, 8, /*sign_extend=*/false> {
52 };
53 class F3
54 : public BitField<T, intptr_t, F2::kNextBit, 8, /*sign_extend=*/false> {};
55 class F4
56 : public BitField<T, uintptr_t, F3::kNextBit, 8, /*sign_extend=*/false> {
57 };
58
59 const uint32_t value =
60 F1::encode(-1) | F2::encode(1) | F3::encode(-2) | F4::encode(2);
61 EXPECT_EQ(0x02fe01ffU, value);
62 EXPECT_EQ(3, F1::decode(value));
63 EXPECT_EQ(1, F2::decode(value));
64 EXPECT_EQ(2, F3::decode(value));
65 EXPECT_EQ(2, F3::decode(value));
66}
static void F2(DFData *curr, int width)
static constexpr F F1

◆ TestNullAwareEqualityCompareCanonicalization()

static void dart::TestNullAwareEqualityCompareCanonicalization ( Thread thread,
bool  allow_representation_change 
)
static

Definition at line 396 of file il_test.cc.

398 {
400
401 CompilerState S(thread, /*is_aot=*/true, /*is_optimizing=*/true);
402
403 FlowGraphBuilderHelper H(/*num_parameters=*/2);
404 H.AddVariable("v0", AbstractType::ZoneHandle(Type::IntType()));
405 H.AddVariable("v1", AbstractType::ZoneHandle(Type::IntType()));
406
407 auto normal_entry = H.flow_graph()->graph_entry()->normal_entry();
408
409 EqualityCompareInstr* compare = nullptr;
410 {
411 BlockBuilder builder(H.flow_graph(), normal_entry);
412 Definition* v0 = builder.AddParameter(0, kUnboxedInt64);
413 Definition* v1 = builder.AddParameter(1, kUnboxedInt64);
414 Definition* box0 = builder.AddDefinition(new BoxInt64Instr(new Value(v0)));
415 Definition* box1 = builder.AddDefinition(new BoxInt64Instr(new Value(v1)));
416
417 compare = builder.AddDefinition(new EqualityCompareInstr(
418 InstructionSource(), Token::kEQ, new Value(box0), new Value(box1),
419 kMintCid, S.GetNextDeoptId(), /*null_aware=*/true));
420 builder.AddReturn(new Value(compare));
421 }
422
423 H.FinishGraph();
424
425 if (!allow_representation_change) {
426 H.flow_graph()->disallow_unmatched_representations();
427 }
428
429 H.flow_graph()->Canonicalize();
430
431 EXPECT(compare->is_null_aware() == !allow_representation_change);
432}

◆ TestNullPointers()

DART_EXPORT intptr_t dart::TestNullPointers ( int64_t *(*)(int64_t *ptr)  fn)

Definition at line 1109 of file ffi_test_functions.cc.

1109 {
1110 CHECK_EQ(fn(nullptr), reinterpret_cast<void*>(sizeof(int64_t)));
1111 int64_t p[2] = {0};
1112 CHECK_EQ(fn(p), p + 1);
1113 return 0;
1114}

◆ TestPassDoublex6Struct16BytesMixedx4Int32()

DART_EXPORT intptr_t dart::TestPassDoublex6Struct16BytesMixedx4Int32 ( double(*)(double a0, double a1, double a2, double a3, double a4, double a5, Struct16BytesMixed a6, Struct16BytesMixed a7, Struct16BytesMixed a8, Struct16BytesMixed a9, int32_t a10)  f)

Definition at line 8937 of file ffi_test_functions_generated.cc.

8949 {
8950 double a0;
8951 double a1;
8952 double a2;
8953 double a3;
8954 double a4;
8955 double a5;
8956 Struct16BytesMixed a6 = {};
8957 Struct16BytesMixed a7 = {};
8958 Struct16BytesMixed a8 = {};
8959 Struct16BytesMixed a9 = {};
8960 int32_t a10;
8961
8962 a0 = -1.0;
8963 a1 = 2.0;
8964 a2 = -3.0;
8965 a3 = 4.0;
8966 a4 = -5.0;
8967 a5 = 6.0;
8968 a6.a0 = -7.0;
8969 a6.a1 = 8;
8970 a7.a0 = -9.0;
8971 a7.a1 = 10;
8972 a8.a0 = -11.0;
8973 a8.a1 = 12;
8974 a9.a0 = -13.0;
8975 a9.a1 = 14;
8976 a10 = -15;
8977
8978 std::cout << "Calling TestPassDoublex6Struct16BytesMixedx4Int32(" << "(" << a0
8979 << ", " << a1 << ", " << a2 << ", " << a3 << ", " << a4 << ", "
8980 << a5 << ", (" << a6.a0 << ", " << a6.a1 << "), (" << a7.a0 << ", "
8981 << a7.a1 << "), (" << a8.a0 << ", " << a8.a1 << "), (" << a9.a0
8982 << ", " << a9.a1 << "), " << a10 << ")" << ")\n";
8983
8984 double result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10);
8985
8986 std::cout << "result = " << result << "\n";
8987
8988 CHECK_APPROX(-8.0, result);
8989
8990 // Pass argument that will make the Dart callback throw.
8991 a0 = 42;
8992
8993 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10);
8994
8995 CHECK_APPROX(0.0, result);
8996
8997 // Pass argument that will make the Dart callback return null.
8998 a0 = 84;
8999
9000 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10);
9001
9002 CHECK_APPROX(0.0, result);
9003
9004 return 0;
9005}
#define CHECK_APPROX(EXPECTED, ACTUAL)

◆ TestPassFloatStruct16BytesHomogeneousFloatFloatStruct1()

DART_EXPORT intptr_t dart::TestPassFloatStruct16BytesHomogeneousFloatFloatStruct1 ( float(*)(float a0, Struct16BytesHomogeneousFloat a1, float a2, Struct16BytesHomogeneousFloat a3, float a4, Struct16BytesHomogeneousFloat a5, float a6, Struct16BytesHomogeneousFloat a7, float a8)  f)

Definition at line 8712 of file ffi_test_functions_generated.cc.

8722 {
8723 float a0;
8725 float a2;
8726 Struct16BytesHomogeneousFloat a3 = {};
8727 float a4;
8728 Struct16BytesHomogeneousFloat a5 = {};
8729 float a6;
8730 Struct16BytesHomogeneousFloat a7 = {};
8731 float a8;
8732
8733 a0 = -1.0;
8734 a1.a0 = 2.0;
8735 a1.a1 = -3.0;
8736 a1.a2 = 4.0;
8737 a1.a3 = -5.0;
8738 a2 = 6.0;
8739 a3.a0 = -7.0;
8740 a3.a1 = 8.0;
8741 a3.a2 = -9.0;
8742 a3.a3 = 10.0;
8743 a4 = -11.0;
8744 a5.a0 = 12.0;
8745 a5.a1 = -13.0;
8746 a5.a2 = 14.0;
8747 a5.a3 = -15.0;
8748 a6 = 16.0;
8749 a7.a0 = -17.0;
8750 a7.a1 = 18.0;
8751 a7.a2 = -19.0;
8752 a7.a3 = 20.0;
8753 a8 = -21.0;
8754
8755 std::cout << "Calling TestPassFloatStruct16BytesHomogeneousFloatFloatStruct1("
8756 << "(" << a0 << ", (" << a1.a0 << ", " << a1.a1 << ", " << a1.a2
8757 << ", " << a1.a3 << "), " << a2 << ", (" << a3.a0 << ", " << a3.a1
8758 << ", " << a3.a2 << ", " << a3.a3 << "), " << a4 << ", (" << a5.a0
8759 << ", " << a5.a1 << ", " << a5.a2 << ", " << a5.a3 << "), " << a6
8760 << ", (" << a7.a0 << ", " << a7.a1 << ", " << a7.a2 << ", " << a7.a3
8761 << "), " << a8 << ")" << ")\n";
8762
8763 float result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8);
8764
8765 std::cout << "result = " << result << "\n";
8766
8767 CHECK_APPROX(-11.0, result);
8768
8769 // Pass argument that will make the Dart callback throw.
8770 a0 = 42;
8771
8772 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8);
8773
8774 CHECK_APPROX(0.0, result);
8775
8776 // Pass argument that will make the Dart callback return null.
8777 a0 = 84;
8778
8779 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8);
8780
8781 CHECK_APPROX(0.0, result);
8782
8783 return 0;
8784}

◆ TestPassFloatStruct32BytesHomogeneousDoubleFloatStruct()

DART_EXPORT intptr_t dart::TestPassFloatStruct32BytesHomogeneousDoubleFloatStruct ( double(*)(float a0, Struct32BytesHomogeneousDouble a1, float a2, Struct32BytesHomogeneousDouble a3, float a4, Struct32BytesHomogeneousDouble a5, float a6, Struct32BytesHomogeneousDouble a7, float a8)  f)

Definition at line 8788 of file ffi_test_functions_generated.cc.

8798 {
8799 float a0;
8801 float a2;
8802 Struct32BytesHomogeneousDouble a3 = {};
8803 float a4;
8804 Struct32BytesHomogeneousDouble a5 = {};
8805 float a6;
8806 Struct32BytesHomogeneousDouble a7 = {};
8807 float a8;
8808
8809 a0 = -1.0;
8810 a1.a0 = 2.0;
8811 a1.a1 = -3.0;
8812 a1.a2 = 4.0;
8813 a1.a3 = -5.0;
8814 a2 = 6.0;
8815 a3.a0 = -7.0;
8816 a3.a1 = 8.0;
8817 a3.a2 = -9.0;
8818 a3.a3 = 10.0;
8819 a4 = -11.0;
8820 a5.a0 = 12.0;
8821 a5.a1 = -13.0;
8822 a5.a2 = 14.0;
8823 a5.a3 = -15.0;
8824 a6 = 16.0;
8825 a7.a0 = -17.0;
8826 a7.a1 = 18.0;
8827 a7.a2 = -19.0;
8828 a7.a3 = 20.0;
8829 a8 = -21.0;
8830
8831 std::cout << "Calling TestPassFloatStruct32BytesHomogeneousDoubleFloatStruct("
8832 << "(" << a0 << ", (" << a1.a0 << ", " << a1.a1 << ", " << a1.a2
8833 << ", " << a1.a3 << "), " << a2 << ", (" << a3.a0 << ", " << a3.a1
8834 << ", " << a3.a2 << ", " << a3.a3 << "), " << a4 << ", (" << a5.a0
8835 << ", " << a5.a1 << ", " << a5.a2 << ", " << a5.a3 << "), " << a6
8836 << ", (" << a7.a0 << ", " << a7.a1 << ", " << a7.a2 << ", " << a7.a3
8837 << "), " << a8 << ")" << ")\n";
8838
8839 double result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8);
8840
8841 std::cout << "result = " << result << "\n";
8842
8843 CHECK_APPROX(-11.0, result);
8844
8845 // Pass argument that will make the Dart callback throw.
8846 a0 = 42;
8847
8848 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8);
8849
8850 CHECK_APPROX(0.0, result);
8851
8852 // Pass argument that will make the Dart callback return null.
8853 a0 = 84;
8854
8855 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8);
8856
8857 CHECK_APPROX(0.0, result);
8858
8859 return 0;
8860}

◆ TestPassInt32x4Struct16BytesMixedx4Double()

DART_EXPORT intptr_t dart::TestPassInt32x4Struct16BytesMixedx4Double ( double(*)(int32_t a0, int32_t a1, int32_t a2, int32_t a3, Struct16BytesMixed a4, Struct16BytesMixed a5, Struct16BytesMixed a6, Struct16BytesMixed a7, double a8)  f)

Definition at line 9011 of file ffi_test_functions_generated.cc.

9021 {
9022 int32_t a0;
9023 int32_t a1;
9024 int32_t a2;
9025 int32_t a3;
9026 Struct16BytesMixed a4 = {};
9027 Struct16BytesMixed a5 = {};
9028 Struct16BytesMixed a6 = {};
9029 Struct16BytesMixed a7 = {};
9030 double a8;
9031
9032 a0 = -1;
9033 a1 = 2;
9034 a2 = -3;
9035 a3 = 4;
9036 a4.a0 = -5.0;
9037 a4.a1 = 6;
9038 a5.a0 = -7.0;
9039 a5.a1 = 8;
9040 a6.a0 = -9.0;
9041 a6.a1 = 10;
9042 a7.a0 = -11.0;
9043 a7.a1 = 12;
9044 a8 = -13.0;
9045
9046 std::cout << "Calling TestPassInt32x4Struct16BytesMixedx4Double(" << "(" << a0
9047 << ", " << a1 << ", " << a2 << ", " << a3 << ", (" << a4.a0 << ", "
9048 << a4.a1 << "), (" << a5.a0 << ", " << a5.a1 << "), (" << a6.a0
9049 << ", " << a6.a1 << "), (" << a7.a0 << ", " << a7.a1 << "), " << a8
9050 << ")" << ")\n";
9051
9052 double result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8);
9053
9054 std::cout << "result = " << result << "\n";
9055
9056 CHECK_APPROX(-7.0, result);
9057
9058 // Pass argument that will make the Dart callback throw.
9059 a0 = 42;
9060
9061 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8);
9062
9063 CHECK_APPROX(0.0, result);
9064
9065 // Pass argument that will make the Dart callback return null.
9066 a0 = 84;
9067
9068 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8);
9069
9070 CHECK_APPROX(0.0, result);
9071
9072 return 0;
9073}

◆ TestPassInt32x8Doublex8Int64Int8Struct1ByteIntInt64Int()

DART_EXPORT intptr_t dart::TestPassInt32x8Doublex8Int64Int8Struct1ByteIntInt64Int ( double(*)(int32_t a0, int32_t a1, int32_t a2, int32_t a3, int32_t a4, int32_t a5, int32_t a6, int32_t a7, double a8, double a9, double a10, double a11, double a12, double a13, double a14, double a15, int64_t a16, int8_t a17, Struct1ByteInt a18, int64_t a19, int8_t a20, Struct4BytesHomogeneousInt16 a21, int64_t a22, int8_t a23, Struct8BytesInt a24, int64_t a25, int8_t a26, Struct8BytesHomogeneousFloat a27, int64_t a28, int8_t a29, Struct8BytesMixed a30, int64_t a31, int8_t a32, StructAlignmentInt16 a33, int64_t a34, int8_t a35, StructAlignmentInt32 a36, int64_t a37, int8_t a38, StructAlignmentInt64 a39)  f)

Definition at line 9127 of file ffi_test_functions_generated.cc.

9168 {
9169 int32_t a0;
9170 int32_t a1;
9171 int32_t a2;
9172 int32_t a3;
9173 int32_t a4;
9174 int32_t a5;
9175 int32_t a6;
9176 int32_t a7;
9177 double a8;
9178 double a9;
9179 double a10;
9180 double a11;
9181 double a12;
9182 double a13;
9183 double a14;
9184 double a15;
9185 int64_t a16;
9186 int8_t a17;
9187 Struct1ByteInt a18 = {};
9188 int64_t a19;
9189 int8_t a20;
9190 Struct4BytesHomogeneousInt16 a21 = {};
9191 int64_t a22;
9192 int8_t a23;
9193 Struct8BytesInt a24 = {};
9194 int64_t a25;
9195 int8_t a26;
9196 Struct8BytesHomogeneousFloat a27 = {};
9197 int64_t a28;
9198 int8_t a29;
9199 Struct8BytesMixed a30 = {};
9200 int64_t a31;
9201 int8_t a32;
9202 StructAlignmentInt16 a33 = {};
9203 int64_t a34;
9204 int8_t a35;
9205 StructAlignmentInt32 a36 = {};
9206 int64_t a37;
9207 int8_t a38;
9208 StructAlignmentInt64 a39 = {};
9209
9210 a0 = -1;
9211 a1 = 2;
9212 a2 = -3;
9213 a3 = 4;
9214 a4 = -5;
9215 a5 = 6;
9216 a6 = -7;
9217 a7 = 8;
9218 a8 = -9.0;
9219 a9 = 10.0;
9220 a10 = -11.0;
9221 a11 = 12.0;
9222 a12 = -13.0;
9223 a13 = 14.0;
9224 a14 = -15.0;
9225 a15 = 16.0;
9226 a16 = -17;
9227 a17 = 18;
9228 a18.a0 = -19;
9229 a19 = 20;
9230 a20 = -21;
9231 a21.a0 = 22;
9232 a21.a1 = -23;
9233 a22 = 24;
9234 a23 = -25;
9235 a24.a0 = 26;
9236 a24.a1 = -27;
9237 a24.a2 = 28;
9238 a25 = -29;
9239 a26 = 30;
9240 a27.a0 = -31.0;
9241 a27.a1 = 32.0;
9242 a28 = -33;
9243 a29 = 34;
9244 a30.a0 = -35.0;
9245 a30.a1 = 36;
9246 a30.a2 = -37;
9247 a31 = 38;
9248 a32 = -39;
9249 a33.a0 = 40;
9250 a33.a1 = -41;
9251 a33.a2 = 42;
9252 a34 = -43;
9253 a35 = 44;
9254 a36.a0 = -45;
9255 a36.a1 = 46;
9256 a36.a2 = -47;
9257 a37 = 48;
9258 a38 = -49;
9259 a39.a0 = 50;
9260 a39.a1 = -51;
9261 a39.a2 = 52;
9262
9263 std::cout << "Calling TestPassInt32x8Doublex8Int64Int8Struct1ByteIntInt64Int("
9264 << "(" << a0 << ", " << a1 << ", " << a2 << ", " << a3 << ", " << a4
9265 << ", " << a5 << ", " << a6 << ", " << a7 << ", " << a8 << ", "
9266 << a9 << ", " << a10 << ", " << a11 << ", " << a12 << ", " << a13
9267 << ", " << a14 << ", " << a15 << ", " << a16 << ", "
9268 << static_cast<int>(a17) << ", (" << static_cast<int>(a18.a0)
9269 << "), " << a19 << ", " << static_cast<int>(a20) << ", (" << a21.a0
9270 << ", " << a21.a1 << "), " << a22 << ", " << static_cast<int>(a23)
9271 << ", (" << a24.a0 << ", " << a24.a1 << ", " << a24.a2 << "), "
9272 << a25 << ", " << static_cast<int>(a26) << ", (" << a27.a0 << ", "
9273 << a27.a1 << "), " << a28 << ", " << static_cast<int>(a29) << ", ("
9274 << a30.a0 << ", " << a30.a1 << ", " << a30.a2 << "), " << a31
9275 << ", " << static_cast<int>(a32) << ", ("
9276 << static_cast<int>(a33.a0) << ", " << a33.a1 << ", "
9277 << static_cast<int>(a33.a2) << "), " << a34 << ", "
9278 << static_cast<int>(a35) << ", (" << static_cast<int>(a36.a0)
9279 << ", " << a36.a1 << ", " << static_cast<int>(a36.a2) << "), "
9280 << a37 << ", " << static_cast<int>(a38) << ", ("
9281 << static_cast<int>(a39.a0) << ", " << a39.a1 << ", "
9282 << static_cast<int>(a39.a2) << "))" << ")\n";
9283
9284 double result =
9285 f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15,
9286 a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27, a28, a29,
9287 a30, a31, a32, a33, a34, a35, a36, a37, a38, a39);
9288
9289 std::cout << "result = " << result << "\n";
9290
9291 CHECK_APPROX(26.0, result);
9292
9293 // Pass argument that will make the Dart callback throw.
9294 a0 = 42;
9295
9296 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14,
9297 a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27,
9298 a28, a29, a30, a31, a32, a33, a34, a35, a36, a37, a38, a39);
9299
9300 CHECK_APPROX(0.0, result);
9301
9302 // Pass argument that will make the Dart callback return null.
9303 a0 = 84;
9304
9305 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14,
9306 a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27,
9307 a28, a29, a30, a31, a32, a33, a34, a35, a36, a37, a38, a39);
9308
9309 CHECK_APPROX(0.0, result);
9310
9311 return 0;
9312}

◆ TestPassInt64x7Struct12BytesHomogeneousInt32()

DART_EXPORT intptr_t dart::TestPassInt64x7Struct12BytesHomogeneousInt32 ( int64_t(*)(int64_t a0, int64_t a1, int64_t a2, int64_t a3, int64_t a4, int64_t a5, int64_t a6, Struct12BytesHomogeneousInt32 a7)  f)

Definition at line 12260 of file ffi_test_functions_generated.cc.

12269 {
12270 int64_t a0;
12271 int64_t a1;
12272 int64_t a2;
12273 int64_t a3;
12274 int64_t a4;
12275 int64_t a5;
12276 int64_t a6;
12278
12279 a0 = -1;
12280 a1 = 2;
12281 a2 = -3;
12282 a3 = 4;
12283 a4 = -5;
12284 a5 = 6;
12285 a6 = -7;
12286 a7.a0 = 8;
12287 a7.a1 = -9;
12288 a7.a2 = 10;
12289
12290 std::cout << "Calling TestPassInt64x7Struct12BytesHomogeneousInt32(" << "("
12291 << a0 << ", " << a1 << ", " << a2 << ", " << a3 << ", " << a4
12292 << ", " << a5 << ", " << a6 << ", (" << a7.a0 << ", " << a7.a1
12293 << ", " << a7.a2 << "))" << ")\n";
12294
12295 int64_t result = f(a0, a1, a2, a3, a4, a5, a6, a7);
12296
12297 std::cout << "result = " << result << "\n";
12298
12299 CHECK_EQ(5, result);
12300
12301 // Pass argument that will make the Dart callback throw.
12302 a0 = 42;
12303
12304 result = f(a0, a1, a2, a3, a4, a5, a6, a7);
12305
12306 CHECK_EQ(0, result);
12307
12308 // Pass argument that will make the Dart callback return null.
12309 a0 = 84;
12310
12311 result = f(a0, a1, a2, a3, a4, a5, a6, a7);
12312
12313 CHECK_EQ(0, result);
12314
12315 return 0;
12316}
#define CHECK_EQ(X, Y)

◆ TestPassInt8Struct16BytesMixedInt8Struct16BytesMixedIn()

DART_EXPORT intptr_t dart::TestPassInt8Struct16BytesMixedInt8Struct16BytesMixedIn ( double(*)(int8_t a0, Struct16BytesMixed a1, int8_t a2, Struct16BytesMixed a3, int8_t a4, Struct16BytesMixed a5, int8_t a6, Struct16BytesMixed a7, int8_t a8)  f)

Definition at line 8868 of file ffi_test_functions_generated.cc.

8878 {
8879 int8_t a0;
8880 Struct16BytesMixed a1 = {};
8881 int8_t a2;
8882 Struct16BytesMixed a3 = {};
8883 int8_t a4;
8884 Struct16BytesMixed a5 = {};
8885 int8_t a6;
8886 Struct16BytesMixed a7 = {};
8887 int8_t a8;
8888
8889 a0 = -1;
8890 a1.a0 = 2.0;
8891 a1.a1 = -3;
8892 a2 = 4;
8893 a3.a0 = -5.0;
8894 a3.a1 = 6;
8895 a4 = -7;
8896 a5.a0 = 8.0;
8897 a5.a1 = -9;
8898 a6 = 10;
8899 a7.a0 = -11.0;
8900 a7.a1 = 12;
8901 a8 = -13;
8902
8903 std::cout << "Calling TestPassInt8Struct16BytesMixedInt8Struct16BytesMixedIn("
8904 << "(" << static_cast<int>(a0) << ", (" << a1.a0 << ", " << a1.a1
8905 << "), " << static_cast<int>(a2) << ", (" << a3.a0 << ", " << a3.a1
8906 << "), " << static_cast<int>(a4) << ", (" << a5.a0 << ", " << a5.a1
8907 << "), " << static_cast<int>(a6) << ", (" << a7.a0 << ", " << a7.a1
8908 << "), " << static_cast<int>(a8) << ")" << ")\n";
8909
8910 double result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8);
8911
8912 std::cout << "result = " << result << "\n";
8913
8914 CHECK_APPROX(-7.0, result);
8915
8916 // Pass argument that will make the Dart callback throw.
8917 a0 = 42;
8918
8919 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8);
8920
8921 CHECK_APPROX(0.0, result);
8922
8923 // Pass argument that will make the Dart callback return null.
8924 a0 = 84;
8925
8926 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8);
8927
8928 CHECK_APPROX(0.0, result);
8929
8930 return 0;
8931}

◆ TestPassStruct1024BytesHomogeneousUint64()

DART_EXPORT intptr_t dart::TestPassStruct1024BytesHomogeneousUint64 ( uint64_t(*)(Struct1024BytesHomogeneousUint64 a0)  f)

Definition at line 8514 of file ffi_test_functions_generated.cc.

8516 {
8518
8519 a0.a0 = 1;
8520 a0.a1 = 2;
8521 a0.a2 = 3;
8522 a0.a3 = 4;
8523 a0.a4 = 5;
8524 a0.a5 = 6;
8525 a0.a6 = 7;
8526 a0.a7 = 8;
8527 a0.a8 = 9;
8528 a0.a9 = 10;
8529 a0.a10 = 11;
8530 a0.a11 = 12;
8531 a0.a12 = 13;
8532 a0.a13 = 14;
8533 a0.a14 = 15;
8534 a0.a15 = 16;
8535 a0.a16 = 17;
8536 a0.a17 = 18;
8537 a0.a18 = 19;
8538 a0.a19 = 20;
8539 a0.a20 = 21;
8540 a0.a21 = 22;
8541 a0.a22 = 23;
8542 a0.a23 = 24;
8543 a0.a24 = 25;
8544 a0.a25 = 26;
8545 a0.a26 = 27;
8546 a0.a27 = 28;
8547 a0.a28 = 29;
8548 a0.a29 = 30;
8549 a0.a30 = 31;
8550 a0.a31 = 32;
8551 a0.a32 = 33;
8552 a0.a33 = 34;
8553 a0.a34 = 35;
8554 a0.a35 = 36;
8555 a0.a36 = 37;
8556 a0.a37 = 38;
8557 a0.a38 = 39;
8558 a0.a39 = 40;
8559 a0.a40 = 41;
8560 a0.a41 = 42;
8561 a0.a42 = 43;
8562 a0.a43 = 44;
8563 a0.a44 = 45;
8564 a0.a45 = 46;
8565 a0.a46 = 47;
8566 a0.a47 = 48;
8567 a0.a48 = 49;
8568 a0.a49 = 50;
8569 a0.a50 = 51;
8570 a0.a51 = 52;
8571 a0.a52 = 53;
8572 a0.a53 = 54;
8573 a0.a54 = 55;
8574 a0.a55 = 56;
8575 a0.a56 = 57;
8576 a0.a57 = 58;
8577 a0.a58 = 59;
8578 a0.a59 = 60;
8579 a0.a60 = 61;
8580 a0.a61 = 62;
8581 a0.a62 = 63;
8582 a0.a63 = 64;
8583 a0.a64 = 65;
8584 a0.a65 = 66;
8585 a0.a66 = 67;
8586 a0.a67 = 68;
8587 a0.a68 = 69;
8588 a0.a69 = 70;
8589 a0.a70 = 71;
8590 a0.a71 = 72;
8591 a0.a72 = 73;
8592 a0.a73 = 74;
8593 a0.a74 = 75;
8594 a0.a75 = 76;
8595 a0.a76 = 77;
8596 a0.a77 = 78;
8597 a0.a78 = 79;
8598 a0.a79 = 80;
8599 a0.a80 = 81;
8600 a0.a81 = 82;
8601 a0.a82 = 83;
8602 a0.a83 = 84;
8603 a0.a84 = 85;
8604 a0.a85 = 86;
8605 a0.a86 = 87;
8606 a0.a87 = 88;
8607 a0.a88 = 89;
8608 a0.a89 = 90;
8609 a0.a90 = 91;
8610 a0.a91 = 92;
8611 a0.a92 = 93;
8612 a0.a93 = 94;
8613 a0.a94 = 95;
8614 a0.a95 = 96;
8615 a0.a96 = 97;
8616 a0.a97 = 98;
8617 a0.a98 = 99;
8618 a0.a99 = 100;
8619 a0.a100 = 101;
8620 a0.a101 = 102;
8621 a0.a102 = 103;
8622 a0.a103 = 104;
8623 a0.a104 = 105;
8624 a0.a105 = 106;
8625 a0.a106 = 107;
8626 a0.a107 = 108;
8627 a0.a108 = 109;
8628 a0.a109 = 110;
8629 a0.a110 = 111;
8630 a0.a111 = 112;
8631 a0.a112 = 113;
8632 a0.a113 = 114;
8633 a0.a114 = 115;
8634 a0.a115 = 116;
8635 a0.a116 = 117;
8636 a0.a117 = 118;
8637 a0.a118 = 119;
8638 a0.a119 = 120;
8639 a0.a120 = 121;
8640 a0.a121 = 122;
8641 a0.a122 = 123;
8642 a0.a123 = 124;
8643 a0.a124 = 125;
8644 a0.a125 = 126;
8645 a0.a126 = 127;
8646 a0.a127 = 128;
8647
8648 std::cout << "Calling TestPassStruct1024BytesHomogeneousUint64(" << "(("
8649 << a0.a0 << ", " << a0.a1 << ", " << a0.a2 << ", " << a0.a3 << ", "
8650 << a0.a4 << ", " << a0.a5 << ", " << a0.a6 << ", " << a0.a7 << ", "
8651 << a0.a8 << ", " << a0.a9 << ", " << a0.a10 << ", " << a0.a11
8652 << ", " << a0.a12 << ", " << a0.a13 << ", " << a0.a14 << ", "
8653 << a0.a15 << ", " << a0.a16 << ", " << a0.a17 << ", " << a0.a18
8654 << ", " << a0.a19 << ", " << a0.a20 << ", " << a0.a21 << ", "
8655 << a0.a22 << ", " << a0.a23 << ", " << a0.a24 << ", " << a0.a25
8656 << ", " << a0.a26 << ", " << a0.a27 << ", " << a0.a28 << ", "
8657 << a0.a29 << ", " << a0.a30 << ", " << a0.a31 << ", " << a0.a32
8658 << ", " << a0.a33 << ", " << a0.a34 << ", " << a0.a35 << ", "
8659 << a0.a36 << ", " << a0.a37 << ", " << a0.a38 << ", " << a0.a39
8660 << ", " << a0.a40 << ", " << a0.a41 << ", " << a0.a42 << ", "
8661 << a0.a43 << ", " << a0.a44 << ", " << a0.a45 << ", " << a0.a46
8662 << ", " << a0.a47 << ", " << a0.a48 << ", " << a0.a49 << ", "
8663 << a0.a50 << ", " << a0.a51 << ", " << a0.a52 << ", " << a0.a53
8664 << ", " << a0.a54 << ", " << a0.a55 << ", " << a0.a56 << ", "
8665 << a0.a57 << ", " << a0.a58 << ", " << a0.a59 << ", " << a0.a60
8666 << ", " << a0.a61 << ", " << a0.a62 << ", " << a0.a63 << ", "
8667 << a0.a64 << ", " << a0.a65 << ", " << a0.a66 << ", " << a0.a67
8668 << ", " << a0.a68 << ", " << a0.a69 << ", " << a0.a70 << ", "
8669 << a0.a71 << ", " << a0.a72 << ", " << a0.a73 << ", " << a0.a74
8670 << ", " << a0.a75 << ", " << a0.a76 << ", " << a0.a77 << ", "
8671 << a0.a78 << ", " << a0.a79 << ", " << a0.a80 << ", " << a0.a81
8672 << ", " << a0.a82 << ", " << a0.a83 << ", " << a0.a84 << ", "
8673 << a0.a85 << ", " << a0.a86 << ", " << a0.a87 << ", " << a0.a88
8674 << ", " << a0.a89 << ", " << a0.a90 << ", " << a0.a91 << ", "
8675 << a0.a92 << ", " << a0.a93 << ", " << a0.a94 << ", " << a0.a95
8676 << ", " << a0.a96 << ", " << a0.a97 << ", " << a0.a98 << ", "
8677 << a0.a99 << ", " << a0.a100 << ", " << a0.a101 << ", " << a0.a102
8678 << ", " << a0.a103 << ", " << a0.a104 << ", " << a0.a105 << ", "
8679 << a0.a106 << ", " << a0.a107 << ", " << a0.a108 << ", " << a0.a109
8680 << ", " << a0.a110 << ", " << a0.a111 << ", " << a0.a112 << ", "
8681 << a0.a113 << ", " << a0.a114 << ", " << a0.a115 << ", " << a0.a116
8682 << ", " << a0.a117 << ", " << a0.a118 << ", " << a0.a119 << ", "
8683 << a0.a120 << ", " << a0.a121 << ", " << a0.a122 << ", " << a0.a123
8684 << ", " << a0.a124 << ", " << a0.a125 << ", " << a0.a126 << ", "
8685 << a0.a127 << "))" << ")\n";
8686
8687 uint64_t result = f(a0);
8688
8689 std::cout << "result = " << result << "\n";
8690
8691 CHECK_EQ(8256, result);
8692
8693 // Pass argument that will make the Dart callback throw.
8694 a0.a0 = 42;
8695
8696 result = f(a0);
8697
8698 CHECK_EQ(0, result);
8699
8700 // Pass argument that will make the Dart callback return null.
8701 a0.a0 = 84;
8702
8703 result = f(a0);
8704
8705 CHECK_EQ(0, result);
8706
8707 return 0;
8708}

◆ TestPassStruct12BytesHomogeneousFloatx6()

Definition at line 7492 of file ffi_test_functions_generated.cc.

7499 {
7501 Struct12BytesHomogeneousFloat a1 = {};
7502 Struct12BytesHomogeneousFloat a2 = {};
7503 Struct12BytesHomogeneousFloat a3 = {};
7504 Struct12BytesHomogeneousFloat a4 = {};
7505 Struct12BytesHomogeneousFloat a5 = {};
7506
7507 a0.a0 = -1.0;
7508 a0.a1 = 2.0;
7509 a0.a2 = -3.0;
7510 a1.a0 = 4.0;
7511 a1.a1 = -5.0;
7512 a1.a2 = 6.0;
7513 a2.a0 = -7.0;
7514 a2.a1 = 8.0;
7515 a2.a2 = -9.0;
7516 a3.a0 = 10.0;
7517 a3.a1 = -11.0;
7518 a3.a2 = 12.0;
7519 a4.a0 = -13.0;
7520 a4.a1 = 14.0;
7521 a4.a2 = -15.0;
7522 a5.a0 = 16.0;
7523 a5.a1 = -17.0;
7524 a5.a2 = 18.0;
7525
7526 std::cout << "Calling TestPassStruct12BytesHomogeneousFloatx6(" << "(("
7527 << a0.a0 << ", " << a0.a1 << ", " << a0.a2 << "), (" << a1.a0
7528 << ", " << a1.a1 << ", " << a1.a2 << "), (" << a2.a0 << ", "
7529 << a2.a1 << ", " << a2.a2 << "), (" << a3.a0 << ", " << a3.a1
7530 << ", " << a3.a2 << "), (" << a4.a0 << ", " << a4.a1 << ", "
7531 << a4.a2 << "), (" << a5.a0 << ", " << a5.a1 << ", " << a5.a2
7532 << "))" << ")\n";
7533
7534 float result = f(a0, a1, a2, a3, a4, a5);
7535
7536 std::cout << "result = " << result << "\n";
7537
7538 CHECK_APPROX(9.0, result);
7539
7540 // Pass argument that will make the Dart callback throw.
7541 a0.a0 = 42;
7542
7543 result = f(a0, a1, a2, a3, a4, a5);
7544
7545 CHECK_APPROX(0.0, result);
7546
7547 // Pass argument that will make the Dart callback return null.
7548 a0.a0 = 84;
7549
7550 result = f(a0, a1, a2, a3, a4, a5);
7551
7552 CHECK_APPROX(0.0, result);
7553
7554 return 0;
7555}

◆ TestPassStruct15BytesInlineArrayMixed()

DART_EXPORT intptr_t dart::TestPassStruct15BytesInlineArrayMixed ( double(*)(Struct15BytesInlineArrayMixed a0)  f)

Definition at line 11546 of file ffi_test_functions_generated.cc.

11548 {
11550
11551 a0.a0[0].a0 = -1.0;
11552 a0.a0[0].a1 = 2;
11553 a0.a0[1].a0 = -3.0;
11554 a0.a0[1].a1 = 4;
11555 a0.a0[2].a0 = -5.0;
11556 a0.a0[2].a1 = 6;
11557
11558 std::cout << "Calling TestPassStruct15BytesInlineArrayMixed(" << "(([("
11559 << a0.a0[0].a0 << ", " << static_cast<int>(a0.a0[0].a1) << "), ("
11560 << a0.a0[1].a0 << ", " << static_cast<int>(a0.a0[1].a1) << "), ("
11561 << a0.a0[2].a0 << ", " << static_cast<int>(a0.a0[2].a1) << ")]))"
11562 << ")\n";
11563
11564 double result = f(a0);
11565
11566 std::cout << "result = " << result << "\n";
11567
11568 CHECK_APPROX(3.0, result);
11569
11570 // Pass argument that will make the Dart callback throw.
11571 a0.a0[0].a0 = 42;
11572
11573 result = f(a0);
11574
11575 CHECK_APPROX(0.0, result);
11576
11577 // Pass argument that will make the Dart callback return null.
11578 a0.a0[0].a0 = 84;
11579
11580 result = f(a0);
11581
11582 CHECK_APPROX(0.0, result);
11583
11584 return 0;
11585}

◆ TestPassStruct16BytesHomogeneousFloatx5()

Definition at line 7561 of file ffi_test_functions_generated.cc.

7567 {
7569 Struct16BytesHomogeneousFloat a1 = {};
7570 Struct16BytesHomogeneousFloat a2 = {};
7571 Struct16BytesHomogeneousFloat a3 = {};
7572 Struct16BytesHomogeneousFloat a4 = {};
7573
7574 a0.a0 = -1.0;
7575 a0.a1 = 2.0;
7576 a0.a2 = -3.0;
7577 a0.a3 = 4.0;
7578 a1.a0 = -5.0;
7579 a1.a1 = 6.0;
7580 a1.a2 = -7.0;
7581 a1.a3 = 8.0;
7582 a2.a0 = -9.0;
7583 a2.a1 = 10.0;
7584 a2.a2 = -11.0;
7585 a2.a3 = 12.0;
7586 a3.a0 = -13.0;
7587 a3.a1 = 14.0;
7588 a3.a2 = -15.0;
7589 a3.a3 = 16.0;
7590 a4.a0 = -17.0;
7591 a4.a1 = 18.0;
7592 a4.a2 = -19.0;
7593 a4.a3 = 20.0;
7594
7595 std::cout << "Calling TestPassStruct16BytesHomogeneousFloatx5(" << "(("
7596 << a0.a0 << ", " << a0.a1 << ", " << a0.a2 << ", " << a0.a3
7597 << "), (" << a1.a0 << ", " << a1.a1 << ", " << a1.a2 << ", "
7598 << a1.a3 << "), (" << a2.a0 << ", " << a2.a1 << ", " << a2.a2
7599 << ", " << a2.a3 << "), (" << a3.a0 << ", " << a3.a1 << ", "
7600 << a3.a2 << ", " << a3.a3 << "), (" << a4.a0 << ", " << a4.a1
7601 << ", " << a4.a2 << ", " << a4.a3 << "))" << ")\n";
7602
7603 float result = f(a0, a1, a2, a3, a4);
7604
7605 std::cout << "result = " << result << "\n";
7606
7607 CHECK_APPROX(10.0, result);
7608
7609 // Pass argument that will make the Dart callback throw.
7610 a0.a0 = 42;
7611
7612 result = f(a0, a1, a2, a3, a4);
7613
7614 CHECK_APPROX(0.0, result);
7615
7616 // Pass argument that will make the Dart callback return null.
7617 a0.a0 = 84;
7618
7619 result = f(a0, a1, a2, a3, a4);
7620
7621 CHECK_APPROX(0.0, result);
7622
7623 return 0;
7624}

◆ TestPassStruct16BytesMixed2x10()

Definition at line 7711 of file ffi_test_functions_generated.cc.

7722 {
7723 Struct16BytesMixed2 a0 = {};
7724 Struct16BytesMixed2 a1 = {};
7725 Struct16BytesMixed2 a2 = {};
7726 Struct16BytesMixed2 a3 = {};
7727 Struct16BytesMixed2 a4 = {};
7728 Struct16BytesMixed2 a5 = {};
7729 Struct16BytesMixed2 a6 = {};
7730 Struct16BytesMixed2 a7 = {};
7731 Struct16BytesMixed2 a8 = {};
7732 Struct16BytesMixed2 a9 = {};
7733
7734 a0.a0 = -1.0;
7735 a0.a1 = 2.0;
7736 a0.a2 = -3.0;
7737 a0.a3 = 4;
7738 a1.a0 = -5.0;
7739 a1.a1 = 6.0;
7740 a1.a2 = -7.0;
7741 a1.a3 = 8;
7742 a2.a0 = -9.0;
7743 a2.a1 = 10.0;
7744 a2.a2 = -11.0;
7745 a2.a3 = 12;
7746 a3.a0 = -13.0;
7747 a3.a1 = 14.0;
7748 a3.a2 = -15.0;
7749 a3.a3 = 16;
7750 a4.a0 = -17.0;
7751 a4.a1 = 18.0;
7752 a4.a2 = -19.0;
7753 a4.a3 = 20;
7754 a5.a0 = -21.0;
7755 a5.a1 = 22.0;
7756 a5.a2 = -23.0;
7757 a5.a3 = 24;
7758 a6.a0 = -25.0;
7759 a6.a1 = 26.0;
7760 a6.a2 = -27.0;
7761 a6.a3 = 28;
7762 a7.a0 = -29.0;
7763 a7.a1 = 30.0;
7764 a7.a2 = -31.0;
7765 a7.a3 = 32;
7766 a8.a0 = -33.0;
7767 a8.a1 = 34.0;
7768 a8.a2 = -35.0;
7769 a8.a3 = 36;
7770 a9.a0 = -37.0;
7771 a9.a1 = 38.0;
7772 a9.a2 = -39.0;
7773 a9.a3 = 40;
7774
7775 std::cout << "Calling TestPassStruct16BytesMixed2x10(" << "((" << a0.a0
7776 << ", " << a0.a1 << ", " << a0.a2 << ", " << a0.a3 << "), ("
7777 << a1.a0 << ", " << a1.a1 << ", " << a1.a2 << ", " << a1.a3
7778 << "), (" << a2.a0 << ", " << a2.a1 << ", " << a2.a2 << ", "
7779 << a2.a3 << "), (" << a3.a0 << ", " << a3.a1 << ", " << a3.a2
7780 << ", " << a3.a3 << "), (" << a4.a0 << ", " << a4.a1 << ", "
7781 << a4.a2 << ", " << a4.a3 << "), (" << a5.a0 << ", " << a5.a1
7782 << ", " << a5.a2 << ", " << a5.a3 << "), (" << a6.a0 << ", "
7783 << a6.a1 << ", " << a6.a2 << ", " << a6.a3 << "), (" << a7.a0
7784 << ", " << a7.a1 << ", " << a7.a2 << ", " << a7.a3 << "), ("
7785 << a8.a0 << ", " << a8.a1 << ", " << a8.a2 << ", " << a8.a3
7786 << "), (" << a9.a0 << ", " << a9.a1 << ", " << a9.a2 << ", "
7787 << a9.a3 << "))" << ")\n";
7788
7789 float result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
7790
7791 std::cout << "result = " << result << "\n";
7792
7793 CHECK_APPROX(20.0, result);
7794
7795 // Pass argument that will make the Dart callback throw.
7796 a0.a0 = 42;
7797
7798 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
7799
7800 CHECK_APPROX(0.0, result);
7801
7802 // Pass argument that will make the Dart callback return null.
7803 a0.a0 = 84;
7804
7805 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
7806
7807 CHECK_APPROX(0.0, result);
7808
7809 return 0;
7810}

◆ TestPassStruct16BytesMixedx10()

Definition at line 7631 of file ffi_test_functions_generated.cc.

7642 {
7643 Struct16BytesMixed a0 = {};
7644 Struct16BytesMixed a1 = {};
7645 Struct16BytesMixed a2 = {};
7646 Struct16BytesMixed a3 = {};
7647 Struct16BytesMixed a4 = {};
7648 Struct16BytesMixed a5 = {};
7649 Struct16BytesMixed a6 = {};
7650 Struct16BytesMixed a7 = {};
7651 Struct16BytesMixed a8 = {};
7652 Struct16BytesMixed a9 = {};
7653
7654 a0.a0 = -1.0;
7655 a0.a1 = 2;
7656 a1.a0 = -3.0;
7657 a1.a1 = 4;
7658 a2.a0 = -5.0;
7659 a2.a1 = 6;
7660 a3.a0 = -7.0;
7661 a3.a1 = 8;
7662 a4.a0 = -9.0;
7663 a4.a1 = 10;
7664 a5.a0 = -11.0;
7665 a5.a1 = 12;
7666 a6.a0 = -13.0;
7667 a6.a1 = 14;
7668 a7.a0 = -15.0;
7669 a7.a1 = 16;
7670 a8.a0 = -17.0;
7671 a8.a1 = 18;
7672 a9.a0 = -19.0;
7673 a9.a1 = 20;
7674
7675 std::cout << "Calling TestPassStruct16BytesMixedx10(" << "((" << a0.a0 << ", "
7676 << a0.a1 << "), (" << a1.a0 << ", " << a1.a1 << "), (" << a2.a0
7677 << ", " << a2.a1 << "), (" << a3.a0 << ", " << a3.a1 << "), ("
7678 << a4.a0 << ", " << a4.a1 << "), (" << a5.a0 << ", " << a5.a1
7679 << "), (" << a6.a0 << ", " << a6.a1 << "), (" << a7.a0 << ", "
7680 << a7.a1 << "), (" << a8.a0 << ", " << a8.a1 << "), (" << a9.a0
7681 << ", " << a9.a1 << "))" << ")\n";
7682
7683 double result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
7684
7685 std::cout << "result = " << result << "\n";
7686
7687 CHECK_APPROX(10.0, result);
7688
7689 // Pass argument that will make the Dart callback throw.
7690 a0.a0 = 42;
7691
7692 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
7693
7694 CHECK_APPROX(0.0, result);
7695
7696 // Pass argument that will make the Dart callback return null.
7697 a0.a0 = 84;
7698
7699 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
7700
7701 CHECK_APPROX(0.0, result);
7702
7703 return 0;
7704}

◆ TestPassStruct16BytesNestedIntx2()

DART_EXPORT intptr_t dart::TestPassStruct16BytesNestedIntx2 ( int64_t(*)(Struct16BytesNestedInt a0, Struct16BytesNestedInt a1)  f)

Definition at line 9790 of file ffi_test_functions_generated.cc.

9792 {
9793 Struct16BytesNestedInt a0 = {};
9794 Struct16BytesNestedInt a1 = {};
9795
9796 a0.a0.a0.a0 = -1;
9797 a0.a0.a0.a1 = 2;
9798 a0.a0.a1.a0 = -3;
9799 a0.a0.a1.a1 = 4;
9800 a0.a1.a0.a0 = -5;
9801 a0.a1.a0.a1 = 6;
9802 a0.a1.a1.a0 = -7;
9803 a0.a1.a1.a1 = 8;
9804 a1.a0.a0.a0 = -9;
9805 a1.a0.a0.a1 = 10;
9806 a1.a0.a1.a0 = -11;
9807 a1.a0.a1.a1 = 12;
9808 a1.a1.a0.a0 = -13;
9809 a1.a1.a0.a1 = 14;
9810 a1.a1.a1.a0 = -15;
9811 a1.a1.a1.a1 = 16;
9812
9813 std::cout << "Calling TestPassStruct16BytesNestedIntx2(" << "(((("
9814 << a0.a0.a0.a0 << ", " << a0.a0.a0.a1 << "), (" << a0.a0.a1.a0
9815 << ", " << a0.a0.a1.a1 << ")), ((" << a0.a1.a0.a0 << ", "
9816 << a0.a1.a0.a1 << "), (" << a0.a1.a1.a0 << ", " << a0.a1.a1.a1
9817 << "))), (((" << a1.a0.a0.a0 << ", " << a1.a0.a0.a1 << "), ("
9818 << a1.a0.a1.a0 << ", " << a1.a0.a1.a1 << ")), ((" << a1.a1.a0.a0
9819 << ", " << a1.a1.a0.a1 << "), (" << a1.a1.a1.a0 << ", "
9820 << a1.a1.a1.a1 << "))))" << ")\n";
9821
9822 int64_t result = f(a0, a1);
9823
9824 std::cout << "result = " << result << "\n";
9825
9826 CHECK_EQ(8, result);
9827
9828 // Pass argument that will make the Dart callback throw.
9829 a0.a0.a0.a0 = 42;
9830
9831 result = f(a0, a1);
9832
9833 CHECK_EQ(0, result);
9834
9835 // Pass argument that will make the Dart callback return null.
9836 a0.a0.a0.a0 = 84;
9837
9838 result = f(a0, a1);
9839
9840 CHECK_EQ(0, result);
9841
9842 return 0;
9843}

◆ TestPassStruct17BytesIntx10()

Definition at line 7815 of file ffi_test_functions_generated.cc.

7826 {
7827 Struct17BytesInt a0 = {};
7828 Struct17BytesInt a1 = {};
7829 Struct17BytesInt a2 = {};
7830 Struct17BytesInt a3 = {};
7831 Struct17BytesInt a4 = {};
7832 Struct17BytesInt a5 = {};
7833 Struct17BytesInt a6 = {};
7834 Struct17BytesInt a7 = {};
7835 Struct17BytesInt a8 = {};
7836 Struct17BytesInt a9 = {};
7837
7838 a0.a0 = -1;
7839 a0.a1 = 2;
7840 a0.a2 = -3;
7841 a1.a0 = 4;
7842 a1.a1 = -5;
7843 a1.a2 = 6;
7844 a2.a0 = -7;
7845 a2.a1 = 8;
7846 a2.a2 = -9;
7847 a3.a0 = 10;
7848 a3.a1 = -11;
7849 a3.a2 = 12;
7850 a4.a0 = -13;
7851 a4.a1 = 14;
7852 a4.a2 = -15;
7853 a5.a0 = 16;
7854 a5.a1 = -17;
7855 a5.a2 = 18;
7856 a6.a0 = -19;
7857 a6.a1 = 20;
7858 a6.a2 = -21;
7859 a7.a0 = 22;
7860 a7.a1 = -23;
7861 a7.a2 = 24;
7862 a8.a0 = -25;
7863 a8.a1 = 26;
7864 a8.a2 = -27;
7865 a9.a0 = 28;
7866 a9.a1 = -29;
7867 a9.a2 = 30;
7868
7869 std::cout << "Calling TestPassStruct17BytesIntx10(" << "((" << a0.a0 << ", "
7870 << a0.a1 << ", " << static_cast<int>(a0.a2) << "), (" << a1.a0
7871 << ", " << a1.a1 << ", " << static_cast<int>(a1.a2) << "), ("
7872 << a2.a0 << ", " << a2.a1 << ", " << static_cast<int>(a2.a2)
7873 << "), (" << a3.a0 << ", " << a3.a1 << ", "
7874 << static_cast<int>(a3.a2) << "), (" << a4.a0 << ", " << a4.a1
7875 << ", " << static_cast<int>(a4.a2) << "), (" << a5.a0 << ", "
7876 << a5.a1 << ", " << static_cast<int>(a5.a2) << "), (" << a6.a0
7877 << ", " << a6.a1 << ", " << static_cast<int>(a6.a2) << "), ("
7878 << a7.a0 << ", " << a7.a1 << ", " << static_cast<int>(a7.a2)
7879 << "), (" << a8.a0 << ", " << a8.a1 << ", "
7880 << static_cast<int>(a8.a2) << "), (" << a9.a0 << ", " << a9.a1
7881 << ", " << static_cast<int>(a9.a2) << "))" << ")\n";
7882
7883 int64_t result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
7884
7885 std::cout << "result = " << result << "\n";
7886
7887 CHECK_EQ(15, result);
7888
7889 // Pass argument that will make the Dart callback throw.
7890 a0.a0 = 42;
7891
7892 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
7893
7894 CHECK_EQ(0, result);
7895
7896 // Pass argument that will make the Dart callback return null.
7897 a0.a0 = 84;
7898
7899 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
7900
7901 CHECK_EQ(0, result);
7902
7903 return 0;
7904}

◆ TestPassStruct19BytesHomogeneousUint8x10()

Definition at line 7910 of file ffi_test_functions_generated.cc.

7921 {
7923 Struct19BytesHomogeneousUint8 a1 = {};
7924 Struct19BytesHomogeneousUint8 a2 = {};
7925 Struct19BytesHomogeneousUint8 a3 = {};
7926 Struct19BytesHomogeneousUint8 a4 = {};
7927 Struct19BytesHomogeneousUint8 a5 = {};
7928 Struct19BytesHomogeneousUint8 a6 = {};
7929 Struct19BytesHomogeneousUint8 a7 = {};
7930 Struct19BytesHomogeneousUint8 a8 = {};
7931 Struct19BytesHomogeneousUint8 a9 = {};
7932
7933 a0.a0 = 1;
7934 a0.a1 = 2;
7935 a0.a2 = 3;
7936 a0.a3 = 4;
7937 a0.a4 = 5;
7938 a0.a5 = 6;
7939 a0.a6 = 7;
7940 a0.a7 = 8;
7941 a0.a8 = 9;
7942 a0.a9 = 10;
7943 a0.a10 = 11;
7944 a0.a11 = 12;
7945 a0.a12 = 13;
7946 a0.a13 = 14;
7947 a0.a14 = 15;
7948 a0.a15 = 16;
7949 a0.a16 = 17;
7950 a0.a17 = 18;
7951 a0.a18 = 19;
7952 a1.a0 = 20;
7953 a1.a1 = 21;
7954 a1.a2 = 22;
7955 a1.a3 = 23;
7956 a1.a4 = 24;
7957 a1.a5 = 25;
7958 a1.a6 = 26;
7959 a1.a7 = 27;
7960 a1.a8 = 28;
7961 a1.a9 = 29;
7962 a1.a10 = 30;
7963 a1.a11 = 31;
7964 a1.a12 = 32;
7965 a1.a13 = 33;
7966 a1.a14 = 34;
7967 a1.a15 = 35;
7968 a1.a16 = 36;
7969 a1.a17 = 37;
7970 a1.a18 = 38;
7971 a2.a0 = 39;
7972 a2.a1 = 40;
7973 a2.a2 = 41;
7974 a2.a3 = 42;
7975 a2.a4 = 43;
7976 a2.a5 = 44;
7977 a2.a6 = 45;
7978 a2.a7 = 46;
7979 a2.a8 = 47;
7980 a2.a9 = 48;
7981 a2.a10 = 49;
7982 a2.a11 = 50;
7983 a2.a12 = 51;
7984 a2.a13 = 52;
7985 a2.a14 = 53;
7986 a2.a15 = 54;
7987 a2.a16 = 55;
7988 a2.a17 = 56;
7989 a2.a18 = 57;
7990 a3.a0 = 58;
7991 a3.a1 = 59;
7992 a3.a2 = 60;
7993 a3.a3 = 61;
7994 a3.a4 = 62;
7995 a3.a5 = 63;
7996 a3.a6 = 64;
7997 a3.a7 = 65;
7998 a3.a8 = 66;
7999 a3.a9 = 67;
8000 a3.a10 = 68;
8001 a3.a11 = 69;
8002 a3.a12 = 70;
8003 a3.a13 = 71;
8004 a3.a14 = 72;
8005 a3.a15 = 73;
8006 a3.a16 = 74;
8007 a3.a17 = 75;
8008 a3.a18 = 76;
8009 a4.a0 = 77;
8010 a4.a1 = 78;
8011 a4.a2 = 79;
8012 a4.a3 = 80;
8013 a4.a4 = 81;
8014 a4.a5 = 82;
8015 a4.a6 = 83;
8016 a4.a7 = 84;
8017 a4.a8 = 85;
8018 a4.a9 = 86;
8019 a4.a10 = 87;
8020 a4.a11 = 88;
8021 a4.a12 = 89;
8022 a4.a13 = 90;
8023 a4.a14 = 91;
8024 a4.a15 = 92;
8025 a4.a16 = 93;
8026 a4.a17 = 94;
8027 a4.a18 = 95;
8028 a5.a0 = 96;
8029 a5.a1 = 97;
8030 a5.a2 = 98;
8031 a5.a3 = 99;
8032 a5.a4 = 100;
8033 a5.a5 = 101;
8034 a5.a6 = 102;
8035 a5.a7 = 103;
8036 a5.a8 = 104;
8037 a5.a9 = 105;
8038 a5.a10 = 106;
8039 a5.a11 = 107;
8040 a5.a12 = 108;
8041 a5.a13 = 109;
8042 a5.a14 = 110;
8043 a5.a15 = 111;
8044 a5.a16 = 112;
8045 a5.a17 = 113;
8046 a5.a18 = 114;
8047 a6.a0 = 115;
8048 a6.a1 = 116;
8049 a6.a2 = 117;
8050 a6.a3 = 118;
8051 a6.a4 = 119;
8052 a6.a5 = 120;
8053 a6.a6 = 121;
8054 a6.a7 = 122;
8055 a6.a8 = 123;
8056 a6.a9 = 124;
8057 a6.a10 = 125;
8058 a6.a11 = 126;
8059 a6.a12 = 127;
8060 a6.a13 = 128;
8061 a6.a14 = 129;
8062 a6.a15 = 130;
8063 a6.a16 = 131;
8064 a6.a17 = 132;
8065 a6.a18 = 133;
8066 a7.a0 = 134;
8067 a7.a1 = 135;
8068 a7.a2 = 136;
8069 a7.a3 = 137;
8070 a7.a4 = 138;
8071 a7.a5 = 139;
8072 a7.a6 = 140;
8073 a7.a7 = 141;
8074 a7.a8 = 142;
8075 a7.a9 = 143;
8076 a7.a10 = 144;
8077 a7.a11 = 145;
8078 a7.a12 = 146;
8079 a7.a13 = 147;
8080 a7.a14 = 148;
8081 a7.a15 = 149;
8082 a7.a16 = 150;
8083 a7.a17 = 151;
8084 a7.a18 = 152;
8085 a8.a0 = 153;
8086 a8.a1 = 154;
8087 a8.a2 = 155;
8088 a8.a3 = 156;
8089 a8.a4 = 157;
8090 a8.a5 = 158;
8091 a8.a6 = 159;
8092 a8.a7 = 160;
8093 a8.a8 = 161;
8094 a8.a9 = 162;
8095 a8.a10 = 163;
8096 a8.a11 = 164;
8097 a8.a12 = 165;
8098 a8.a13 = 166;
8099 a8.a14 = 167;
8100 a8.a15 = 168;
8101 a8.a16 = 169;
8102 a8.a17 = 170;
8103 a8.a18 = 171;
8104 a9.a0 = 172;
8105 a9.a1 = 173;
8106 a9.a2 = 174;
8107 a9.a3 = 175;
8108 a9.a4 = 176;
8109 a9.a5 = 177;
8110 a9.a6 = 178;
8111 a9.a7 = 179;
8112 a9.a8 = 180;
8113 a9.a9 = 181;
8114 a9.a10 = 182;
8115 a9.a11 = 183;
8116 a9.a12 = 184;
8117 a9.a13 = 185;
8118 a9.a14 = 186;
8119 a9.a15 = 187;
8120 a9.a16 = 188;
8121 a9.a17 = 189;
8122 a9.a18 = 190;
8123
8124 std::cout
8125 << "Calling TestPassStruct19BytesHomogeneousUint8x10(" << "(("
8126 << static_cast<int>(a0.a0) << ", " << static_cast<int>(a0.a1) << ", "
8127 << static_cast<int>(a0.a2) << ", " << static_cast<int>(a0.a3) << ", "
8128 << static_cast<int>(a0.a4) << ", " << static_cast<int>(a0.a5) << ", "
8129 << static_cast<int>(a0.a6) << ", " << static_cast<int>(a0.a7) << ", "
8130 << static_cast<int>(a0.a8) << ", " << static_cast<int>(a0.a9) << ", "
8131 << static_cast<int>(a0.a10) << ", " << static_cast<int>(a0.a11) << ", "
8132 << static_cast<int>(a0.a12) << ", " << static_cast<int>(a0.a13) << ", "
8133 << static_cast<int>(a0.a14) << ", " << static_cast<int>(a0.a15) << ", "
8134 << static_cast<int>(a0.a16) << ", " << static_cast<int>(a0.a17) << ", "
8135 << static_cast<int>(a0.a18) << "), (" << static_cast<int>(a1.a0) << ", "
8136 << static_cast<int>(a1.a1) << ", " << static_cast<int>(a1.a2) << ", "
8137 << static_cast<int>(a1.a3) << ", " << static_cast<int>(a1.a4) << ", "
8138 << static_cast<int>(a1.a5) << ", " << static_cast<int>(a1.a6) << ", "
8139 << static_cast<int>(a1.a7) << ", " << static_cast<int>(a1.a8) << ", "
8140 << static_cast<int>(a1.a9) << ", " << static_cast<int>(a1.a10) << ", "
8141 << static_cast<int>(a1.a11) << ", " << static_cast<int>(a1.a12) << ", "
8142 << static_cast<int>(a1.a13) << ", " << static_cast<int>(a1.a14) << ", "
8143 << static_cast<int>(a1.a15) << ", " << static_cast<int>(a1.a16) << ", "
8144 << static_cast<int>(a1.a17) << ", " << static_cast<int>(a1.a18) << "), ("
8145 << static_cast<int>(a2.a0) << ", " << static_cast<int>(a2.a1) << ", "
8146 << static_cast<int>(a2.a2) << ", " << static_cast<int>(a2.a3) << ", "
8147 << static_cast<int>(a2.a4) << ", " << static_cast<int>(a2.a5) << ", "
8148 << static_cast<int>(a2.a6) << ", " << static_cast<int>(a2.a7) << ", "
8149 << static_cast<int>(a2.a8) << ", " << static_cast<int>(a2.a9) << ", "
8150 << static_cast<int>(a2.a10) << ", " << static_cast<int>(a2.a11) << ", "
8151 << static_cast<int>(a2.a12) << ", " << static_cast<int>(a2.a13) << ", "
8152 << static_cast<int>(a2.a14) << ", " << static_cast<int>(a2.a15) << ", "
8153 << static_cast<int>(a2.a16) << ", " << static_cast<int>(a2.a17) << ", "
8154 << static_cast<int>(a2.a18) << "), (" << static_cast<int>(a3.a0) << ", "
8155 << static_cast<int>(a3.a1) << ", " << static_cast<int>(a3.a2) << ", "
8156 << static_cast<int>(a3.a3) << ", " << static_cast<int>(a3.a4) << ", "
8157 << static_cast<int>(a3.a5) << ", " << static_cast<int>(a3.a6) << ", "
8158 << static_cast<int>(a3.a7) << ", " << static_cast<int>(a3.a8) << ", "
8159 << static_cast<int>(a3.a9) << ", " << static_cast<int>(a3.a10) << ", "
8160 << static_cast<int>(a3.a11) << ", " << static_cast<int>(a3.a12) << ", "
8161 << static_cast<int>(a3.a13) << ", " << static_cast<int>(a3.a14) << ", "
8162 << static_cast<int>(a3.a15) << ", " << static_cast<int>(a3.a16) << ", "
8163 << static_cast<int>(a3.a17) << ", " << static_cast<int>(a3.a18) << "), ("
8164 << static_cast<int>(a4.a0) << ", " << static_cast<int>(a4.a1) << ", "
8165 << static_cast<int>(a4.a2) << ", " << static_cast<int>(a4.a3) << ", "
8166 << static_cast<int>(a4.a4) << ", " << static_cast<int>(a4.a5) << ", "
8167 << static_cast<int>(a4.a6) << ", " << static_cast<int>(a4.a7) << ", "
8168 << static_cast<int>(a4.a8) << ", " << static_cast<int>(a4.a9) << ", "
8169 << static_cast<int>(a4.a10) << ", " << static_cast<int>(a4.a11) << ", "
8170 << static_cast<int>(a4.a12) << ", " << static_cast<int>(a4.a13) << ", "
8171 << static_cast<int>(a4.a14) << ", " << static_cast<int>(a4.a15) << ", "
8172 << static_cast<int>(a4.a16) << ", " << static_cast<int>(a4.a17) << ", "
8173 << static_cast<int>(a4.a18) << "), (" << static_cast<int>(a5.a0) << ", "
8174 << static_cast<int>(a5.a1) << ", " << static_cast<int>(a5.a2) << ", "
8175 << static_cast<int>(a5.a3) << ", " << static_cast<int>(a5.a4) << ", "
8176 << static_cast<int>(a5.a5) << ", " << static_cast<int>(a5.a6) << ", "
8177 << static_cast<int>(a5.a7) << ", " << static_cast<int>(a5.a8) << ", "
8178 << static_cast<int>(a5.a9) << ", " << static_cast<int>(a5.a10) << ", "
8179 << static_cast<int>(a5.a11) << ", " << static_cast<int>(a5.a12) << ", "
8180 << static_cast<int>(a5.a13) << ", " << static_cast<int>(a5.a14) << ", "
8181 << static_cast<int>(a5.a15) << ", " << static_cast<int>(a5.a16) << ", "
8182 << static_cast<int>(a5.a17) << ", " << static_cast<int>(a5.a18) << "), ("
8183 << static_cast<int>(a6.a0) << ", " << static_cast<int>(a6.a1) << ", "
8184 << static_cast<int>(a6.a2) << ", " << static_cast<int>(a6.a3) << ", "
8185 << static_cast<int>(a6.a4) << ", " << static_cast<int>(a6.a5) << ", "
8186 << static_cast<int>(a6.a6) << ", " << static_cast<int>(a6.a7) << ", "
8187 << static_cast<int>(a6.a8) << ", " << static_cast<int>(a6.a9) << ", "
8188 << static_cast<int>(a6.a10) << ", " << static_cast<int>(a6.a11) << ", "
8189 << static_cast<int>(a6.a12) << ", " << static_cast<int>(a6.a13) << ", "
8190 << static_cast<int>(a6.a14) << ", " << static_cast<int>(a6.a15) << ", "
8191 << static_cast<int>(a6.a16) << ", " << static_cast<int>(a6.a17) << ", "
8192 << static_cast<int>(a6.a18) << "), (" << static_cast<int>(a7.a0) << ", "
8193 << static_cast<int>(a7.a1) << ", " << static_cast<int>(a7.a2) << ", "
8194 << static_cast<int>(a7.a3) << ", " << static_cast<int>(a7.a4) << ", "
8195 << static_cast<int>(a7.a5) << ", " << static_cast<int>(a7.a6) << ", "
8196 << static_cast<int>(a7.a7) << ", " << static_cast<int>(a7.a8) << ", "
8197 << static_cast<int>(a7.a9) << ", " << static_cast<int>(a7.a10) << ", "
8198 << static_cast<int>(a7.a11) << ", " << static_cast<int>(a7.a12) << ", "
8199 << static_cast<int>(a7.a13) << ", " << static_cast<int>(a7.a14) << ", "
8200 << static_cast<int>(a7.a15) << ", " << static_cast<int>(a7.a16) << ", "
8201 << static_cast<int>(a7.a17) << ", " << static_cast<int>(a7.a18) << "), ("
8202 << static_cast<int>(a8.a0) << ", " << static_cast<int>(a8.a1) << ", "
8203 << static_cast<int>(a8.a2) << ", " << static_cast<int>(a8.a3) << ", "
8204 << static_cast<int>(a8.a4) << ", " << static_cast<int>(a8.a5) << ", "
8205 << static_cast<int>(a8.a6) << ", " << static_cast<int>(a8.a7) << ", "
8206 << static_cast<int>(a8.a8) << ", " << static_cast<int>(a8.a9) << ", "
8207 << static_cast<int>(a8.a10) << ", " << static_cast<int>(a8.a11) << ", "
8208 << static_cast<int>(a8.a12) << ", " << static_cast<int>(a8.a13) << ", "
8209 << static_cast<int>(a8.a14) << ", " << static_cast<int>(a8.a15) << ", "
8210 << static_cast<int>(a8.a16) << ", " << static_cast<int>(a8.a17) << ", "
8211 << static_cast<int>(a8.a18) << "), (" << static_cast<int>(a9.a0) << ", "
8212 << static_cast<int>(a9.a1) << ", " << static_cast<int>(a9.a2) << ", "
8213 << static_cast<int>(a9.a3) << ", " << static_cast<int>(a9.a4) << ", "
8214 << static_cast<int>(a9.a5) << ", " << static_cast<int>(a9.a6) << ", "
8215 << static_cast<int>(a9.a7) << ", " << static_cast<int>(a9.a8) << ", "
8216 << static_cast<int>(a9.a9) << ", " << static_cast<int>(a9.a10) << ", "
8217 << static_cast<int>(a9.a11) << ", " << static_cast<int>(a9.a12) << ", "
8218 << static_cast<int>(a9.a13) << ", " << static_cast<int>(a9.a14) << ", "
8219 << static_cast<int>(a9.a15) << ", " << static_cast<int>(a9.a16) << ", "
8220 << static_cast<int>(a9.a17) << ", " << static_cast<int>(a9.a18) << "))"
8221 << ")\n";
8222
8223 int64_t result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
8224
8225 std::cout << "result = " << result << "\n";
8226
8227 CHECK_EQ(18145, result);
8228
8229 // Pass argument that will make the Dart callback throw.
8230 a0.a0 = 42;
8231
8232 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
8233
8234 CHECK_EQ(0, result);
8235
8236 // Pass argument that will make the Dart callback return null.
8237 a0.a0 = 84;
8238
8239 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
8240
8241 CHECK_EQ(0, result);
8242
8243 return 0;
8244}

◆ TestPassStruct1ByteIntx10()

DART_EXPORT intptr_t dart::TestPassStruct1ByteIntx10 ( int64_t(*)(Struct1ByteInt a0, Struct1ByteInt a1, Struct1ByteInt a2, Struct1ByteInt a3, Struct1ByteInt a4, Struct1ByteInt a5, Struct1ByteInt a6, Struct1ByteInt a7, Struct1ByteInt a8, Struct1ByteInt a9)  f)

Definition at line 6368 of file ffi_test_functions_generated.cc.

6379 {
6380 Struct1ByteInt a0 = {};
6381 Struct1ByteInt a1 = {};
6382 Struct1ByteInt a2 = {};
6383 Struct1ByteInt a3 = {};
6384 Struct1ByteInt a4 = {};
6385 Struct1ByteInt a5 = {};
6386 Struct1ByteInt a6 = {};
6387 Struct1ByteInt a7 = {};
6388 Struct1ByteInt a8 = {};
6389 Struct1ByteInt a9 = {};
6390
6391 a0.a0 = -1;
6392 a1.a0 = 2;
6393 a2.a0 = -3;
6394 a3.a0 = 4;
6395 a4.a0 = -5;
6396 a5.a0 = 6;
6397 a6.a0 = -7;
6398 a7.a0 = 8;
6399 a8.a0 = -9;
6400 a9.a0 = 10;
6401
6402 std::cout << "Calling TestPassStruct1ByteIntx10(" << "(("
6403 << static_cast<int>(a0.a0) << "), (" << static_cast<int>(a1.a0)
6404 << "), (" << static_cast<int>(a2.a0) << "), ("
6405 << static_cast<int>(a3.a0) << "), (" << static_cast<int>(a4.a0)
6406 << "), (" << static_cast<int>(a5.a0) << "), ("
6407 << static_cast<int>(a6.a0) << "), (" << static_cast<int>(a7.a0)
6408 << "), (" << static_cast<int>(a8.a0) << "), ("
6409 << static_cast<int>(a9.a0) << "))" << ")\n";
6410
6411 int64_t result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
6412
6413 std::cout << "result = " << result << "\n";
6414
6415 CHECK_EQ(5, result);
6416
6417 // Pass argument that will make the Dart callback throw.
6418 a0.a0 = 42;
6419
6420 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
6421
6422 CHECK_EQ(0, result);
6423
6424 // Pass argument that will make the Dart callback return null.
6425 a0.a0 = 84;
6426
6427 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
6428
6429 CHECK_EQ(0, result);
6430
6431 return 0;
6432}

◆ TestPassStruct20BytesHomogeneousFloat()

DART_EXPORT intptr_t dart::TestPassStruct20BytesHomogeneousFloat ( float(*)(Struct20BytesHomogeneousFloat a0)  f)

Definition at line 8366 of file ffi_test_functions_generated.cc.

8368 {
8370
8371 a0.a0 = -1.0;
8372 a0.a1 = 2.0;
8373 a0.a2 = -3.0;
8374 a0.a3 = 4.0;
8375 a0.a4 = -5.0;
8376
8377 std::cout << "Calling TestPassStruct20BytesHomogeneousFloat(" << "((" << a0.a0
8378 << ", " << a0.a1 << ", " << a0.a2 << ", " << a0.a3 << ", " << a0.a4
8379 << "))" << ")\n";
8380
8381 float result = f(a0);
8382
8383 std::cout << "result = " << result << "\n";
8384
8385 CHECK_APPROX(-3.0, result);
8386
8387 // Pass argument that will make the Dart callback throw.
8388 a0.a0 = 42;
8389
8390 result = f(a0);
8391
8392 CHECK_APPROX(0.0, result);
8393
8394 // Pass argument that will make the Dart callback return null.
8395 a0.a0 = 84;
8396
8397 result = f(a0);
8398
8399 CHECK_APPROX(0.0, result);
8400
8401 return 0;
8402}

◆ TestPassStruct20BytesHomogeneousInt32x10()

Definition at line 8251 of file ffi_test_functions_generated.cc.

8262 {
8264 Struct20BytesHomogeneousInt32 a1 = {};
8265 Struct20BytesHomogeneousInt32 a2 = {};
8266 Struct20BytesHomogeneousInt32 a3 = {};
8267 Struct20BytesHomogeneousInt32 a4 = {};
8268 Struct20BytesHomogeneousInt32 a5 = {};
8269 Struct20BytesHomogeneousInt32 a6 = {};
8270 Struct20BytesHomogeneousInt32 a7 = {};
8271 Struct20BytesHomogeneousInt32 a8 = {};
8272 Struct20BytesHomogeneousInt32 a9 = {};
8273
8274 a0.a0 = -1;
8275 a0.a1 = 2;
8276 a0.a2 = -3;
8277 a0.a3 = 4;
8278 a0.a4 = -5;
8279 a1.a0 = 6;
8280 a1.a1 = -7;
8281 a1.a2 = 8;
8282 a1.a3 = -9;
8283 a1.a4 = 10;
8284 a2.a0 = -11;
8285 a2.a1 = 12;
8286 a2.a2 = -13;
8287 a2.a3 = 14;
8288 a2.a4 = -15;
8289 a3.a0 = 16;
8290 a3.a1 = -17;
8291 a3.a2 = 18;
8292 a3.a3 = -19;
8293 a3.a4 = 20;
8294 a4.a0 = -21;
8295 a4.a1 = 22;
8296 a4.a2 = -23;
8297 a4.a3 = 24;
8298 a4.a4 = -25;
8299 a5.a0 = 26;
8300 a5.a1 = -27;
8301 a5.a2 = 28;
8302 a5.a3 = -29;
8303 a5.a4 = 30;
8304 a6.a0 = -31;
8305 a6.a1 = 32;
8306 a6.a2 = -33;
8307 a6.a3 = 34;
8308 a6.a4 = -35;
8309 a7.a0 = 36;
8310 a7.a1 = -37;
8311 a7.a2 = 38;
8312 a7.a3 = -39;
8313 a7.a4 = 40;
8314 a8.a0 = -41;
8315 a8.a1 = 42;
8316 a8.a2 = -43;
8317 a8.a3 = 44;
8318 a8.a4 = -45;
8319 a9.a0 = 46;
8320 a9.a1 = -47;
8321 a9.a2 = 48;
8322 a9.a3 = -49;
8323 a9.a4 = 50;
8324
8325 std::cout << "Calling TestPassStruct20BytesHomogeneousInt32x10(" << "(("
8326 << a0.a0 << ", " << a0.a1 << ", " << a0.a2 << ", " << a0.a3 << ", "
8327 << a0.a4 << "), (" << a1.a0 << ", " << a1.a1 << ", " << a1.a2
8328 << ", " << a1.a3 << ", " << a1.a4 << "), (" << a2.a0 << ", "
8329 << a2.a1 << ", " << a2.a2 << ", " << a2.a3 << ", " << a2.a4
8330 << "), (" << a3.a0 << ", " << a3.a1 << ", " << a3.a2 << ", "
8331 << a3.a3 << ", " << a3.a4 << "), (" << a4.a0 << ", " << a4.a1
8332 << ", " << a4.a2 << ", " << a4.a3 << ", " << a4.a4 << "), ("
8333 << a5.a0 << ", " << a5.a1 << ", " << a5.a2 << ", " << a5.a3 << ", "
8334 << a5.a4 << "), (" << a6.a0 << ", " << a6.a1 << ", " << a6.a2
8335 << ", " << a6.a3 << ", " << a6.a4 << "), (" << a7.a0 << ", "
8336 << a7.a1 << ", " << a7.a2 << ", " << a7.a3 << ", " << a7.a4
8337 << "), (" << a8.a0 << ", " << a8.a1 << ", " << a8.a2 << ", "
8338 << a8.a3 << ", " << a8.a4 << "), (" << a9.a0 << ", " << a9.a1
8339 << ", " << a9.a2 << ", " << a9.a3 << ", " << a9.a4 << "))" << ")\n";
8340
8341 int32_t result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
8342
8343 std::cout << "result = " << result << "\n";
8344
8345 CHECK_EQ(25, result);
8346
8347 // Pass argument that will make the Dart callback throw.
8348 a0.a0 = 42;
8349
8350 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
8351
8352 CHECK_EQ(0, result);
8353
8354 // Pass argument that will make the Dart callback return null.
8355 a0.a0 = 84;
8356
8357 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
8358
8359 CHECK_EQ(0, result);
8360
8361 return 0;
8362}

◆ TestPassStruct32BytesHomogeneousDoublex5()

Definition at line 8407 of file ffi_test_functions_generated.cc.

8413 {
8415 Struct32BytesHomogeneousDouble a1 = {};
8416 Struct32BytesHomogeneousDouble a2 = {};
8417 Struct32BytesHomogeneousDouble a3 = {};
8418 Struct32BytesHomogeneousDouble a4 = {};
8419
8420 a0.a0 = -1.0;
8421 a0.a1 = 2.0;
8422 a0.a2 = -3.0;
8423 a0.a3 = 4.0;
8424 a1.a0 = -5.0;
8425 a1.a1 = 6.0;
8426 a1.a2 = -7.0;
8427 a1.a3 = 8.0;
8428 a2.a0 = -9.0;
8429 a2.a1 = 10.0;
8430 a2.a2 = -11.0;
8431 a2.a3 = 12.0;
8432 a3.a0 = -13.0;
8433 a3.a1 = 14.0;
8434 a3.a2 = -15.0;
8435 a3.a3 = 16.0;
8436 a4.a0 = -17.0;
8437 a4.a1 = 18.0;
8438 a4.a2 = -19.0;
8439 a4.a3 = 20.0;
8440
8441 std::cout << "Calling TestPassStruct32BytesHomogeneousDoublex5(" << "(("
8442 << a0.a0 << ", " << a0.a1 << ", " << a0.a2 << ", " << a0.a3
8443 << "), (" << a1.a0 << ", " << a1.a1 << ", " << a1.a2 << ", "
8444 << a1.a3 << "), (" << a2.a0 << ", " << a2.a1 << ", " << a2.a2
8445 << ", " << a2.a3 << "), (" << a3.a0 << ", " << a3.a1 << ", "
8446 << a3.a2 << ", " << a3.a3 << "), (" << a4.a0 << ", " << a4.a1
8447 << ", " << a4.a2 << ", " << a4.a3 << "))" << ")\n";
8448
8449 double result = f(a0, a1, a2, a3, a4);
8450
8451 std::cout << "result = " << result << "\n";
8452
8453 CHECK_APPROX(10.0, result);
8454
8455 // Pass argument that will make the Dart callback throw.
8456 a0.a0 = 42;
8457
8458 result = f(a0, a1, a2, a3, a4);
8459
8460 CHECK_APPROX(0.0, result);
8461
8462 // Pass argument that will make the Dart callback return null.
8463 a0.a0 = 84;
8464
8465 result = f(a0, a1, a2, a3, a4);
8466
8467 CHECK_APPROX(0.0, result);
8468
8469 return 0;
8470}

◆ TestPassStruct32BytesNestedIntx2()

DART_EXPORT intptr_t dart::TestPassStruct32BytesNestedIntx2 ( int64_t(*)(Struct32BytesNestedInt a0, Struct32BytesNestedInt a1)  f)

Definition at line 9847 of file ffi_test_functions_generated.cc.

9849 {
9850 Struct32BytesNestedInt a0 = {};
9851 Struct32BytesNestedInt a1 = {};
9852
9853 a0.a0.a0.a0.a0 = -1;
9854 a0.a0.a0.a0.a1 = 2;
9855 a0.a0.a0.a1.a0 = -3;
9856 a0.a0.a0.a1.a1 = 4;
9857 a0.a0.a1.a0.a0 = -5;
9858 a0.a0.a1.a0.a1 = 6;
9859 a0.a0.a1.a1.a0 = -7;
9860 a0.a0.a1.a1.a1 = 8;
9861 a0.a1.a0.a0.a0 = -9;
9862 a0.a1.a0.a0.a1 = 10;
9863 a0.a1.a0.a1.a0 = -11;
9864 a0.a1.a0.a1.a1 = 12;
9865 a0.a1.a1.a0.a0 = -13;
9866 a0.a1.a1.a0.a1 = 14;
9867 a0.a1.a1.a1.a0 = -15;
9868 a0.a1.a1.a1.a1 = 16;
9869 a1.a0.a0.a0.a0 = -17;
9870 a1.a0.a0.a0.a1 = 18;
9871 a1.a0.a0.a1.a0 = -19;
9872 a1.a0.a0.a1.a1 = 20;
9873 a1.a0.a1.a0.a0 = -21;
9874 a1.a0.a1.a0.a1 = 22;
9875 a1.a0.a1.a1.a0 = -23;
9876 a1.a0.a1.a1.a1 = 24;
9877 a1.a1.a0.a0.a0 = -25;
9878 a1.a1.a0.a0.a1 = 26;
9879 a1.a1.a0.a1.a0 = -27;
9880 a1.a1.a0.a1.a1 = 28;
9881 a1.a1.a1.a0.a0 = -29;
9882 a1.a1.a1.a0.a1 = 30;
9883 a1.a1.a1.a1.a0 = -31;
9884 a1.a1.a1.a1.a1 = 32;
9885
9886 std::cout << "Calling TestPassStruct32BytesNestedIntx2(" << "((((("
9887 << a0.a0.a0.a0.a0 << ", " << a0.a0.a0.a0.a1 << "), ("
9888 << a0.a0.a0.a1.a0 << ", " << a0.a0.a0.a1.a1 << ")), (("
9889 << a0.a0.a1.a0.a0 << ", " << a0.a0.a1.a0.a1 << "), ("
9890 << a0.a0.a1.a1.a0 << ", " << a0.a0.a1.a1.a1 << "))), ((("
9891 << a0.a1.a0.a0.a0 << ", " << a0.a1.a0.a0.a1 << "), ("
9892 << a0.a1.a0.a1.a0 << ", " << a0.a1.a0.a1.a1 << ")), (("
9893 << a0.a1.a1.a0.a0 << ", " << a0.a1.a1.a0.a1 << "), ("
9894 << a0.a1.a1.a1.a0 << ", " << a0.a1.a1.a1.a1 << ")))), (((("
9895 << a1.a0.a0.a0.a0 << ", " << a1.a0.a0.a0.a1 << "), ("
9896 << a1.a0.a0.a1.a0 << ", " << a1.a0.a0.a1.a1 << ")), (("
9897 << a1.a0.a1.a0.a0 << ", " << a1.a0.a1.a0.a1 << "), ("
9898 << a1.a0.a1.a1.a0 << ", " << a1.a0.a1.a1.a1 << "))), ((("
9899 << a1.a1.a0.a0.a0 << ", " << a1.a1.a0.a0.a1 << "), ("
9900 << a1.a1.a0.a1.a0 << ", " << a1.a1.a0.a1.a1 << ")), (("
9901 << a1.a1.a1.a0.a0 << ", " << a1.a1.a1.a0.a1 << "), ("
9902 << a1.a1.a1.a1.a0 << ", " << a1.a1.a1.a1.a1 << ")))))" << ")\n";
9903
9904 int64_t result = f(a0, a1);
9905
9906 std::cout << "result = " << result << "\n";
9907
9908 CHECK_EQ(16, result);
9909
9910 // Pass argument that will make the Dart callback throw.
9911 a0.a0.a0.a0.a0 = 42;
9912
9913 result = f(a0, a1);
9914
9915 CHECK_EQ(0, result);
9916
9917 // Pass argument that will make the Dart callback return null.
9918 a0.a0.a0.a0.a0 = 84;
9919
9920 result = f(a0, a1);
9921
9922 CHECK_EQ(0, result);
9923
9924 return 0;
9925}

◆ TestPassStruct3BytesHomogeneousUint8x10()

Definition at line 6437 of file ffi_test_functions_generated.cc.

6448 {
6450 Struct3BytesHomogeneousUint8 a1 = {};
6451 Struct3BytesHomogeneousUint8 a2 = {};
6452 Struct3BytesHomogeneousUint8 a3 = {};
6453 Struct3BytesHomogeneousUint8 a4 = {};
6454 Struct3BytesHomogeneousUint8 a5 = {};
6455 Struct3BytesHomogeneousUint8 a6 = {};
6456 Struct3BytesHomogeneousUint8 a7 = {};
6457 Struct3BytesHomogeneousUint8 a8 = {};
6458 Struct3BytesHomogeneousUint8 a9 = {};
6459
6460 a0.a0 = 1;
6461 a0.a1 = 2;
6462 a0.a2 = 3;
6463 a1.a0 = 4;
6464 a1.a1 = 5;
6465 a1.a2 = 6;
6466 a2.a0 = 7;
6467 a2.a1 = 8;
6468 a2.a2 = 9;
6469 a3.a0 = 10;
6470 a3.a1 = 11;
6471 a3.a2 = 12;
6472 a4.a0 = 13;
6473 a4.a1 = 14;
6474 a4.a2 = 15;
6475 a5.a0 = 16;
6476 a5.a1 = 17;
6477 a5.a2 = 18;
6478 a6.a0 = 19;
6479 a6.a1 = 20;
6480 a6.a2 = 21;
6481 a7.a0 = 22;
6482 a7.a1 = 23;
6483 a7.a2 = 24;
6484 a8.a0 = 25;
6485 a8.a1 = 26;
6486 a8.a2 = 27;
6487 a9.a0 = 28;
6488 a9.a1 = 29;
6489 a9.a2 = 30;
6490
6491 std::cout << "Calling TestPassStruct3BytesHomogeneousUint8x10(" << "(("
6492 << static_cast<int>(a0.a0) << ", " << static_cast<int>(a0.a1)
6493 << ", " << static_cast<int>(a0.a2) << "), ("
6494 << static_cast<int>(a1.a0) << ", " << static_cast<int>(a1.a1)
6495 << ", " << static_cast<int>(a1.a2) << "), ("
6496 << static_cast<int>(a2.a0) << ", " << static_cast<int>(a2.a1)
6497 << ", " << static_cast<int>(a2.a2) << "), ("
6498 << static_cast<int>(a3.a0) << ", " << static_cast<int>(a3.a1)
6499 << ", " << static_cast<int>(a3.a2) << "), ("
6500 << static_cast<int>(a4.a0) << ", " << static_cast<int>(a4.a1)
6501 << ", " << static_cast<int>(a4.a2) << "), ("
6502 << static_cast<int>(a5.a0) << ", " << static_cast<int>(a5.a1)
6503 << ", " << static_cast<int>(a5.a2) << "), ("
6504 << static_cast<int>(a6.a0) << ", " << static_cast<int>(a6.a1)
6505 << ", " << static_cast<int>(a6.a2) << "), ("
6506 << static_cast<int>(a7.a0) << ", " << static_cast<int>(a7.a1)
6507 << ", " << static_cast<int>(a7.a2) << "), ("
6508 << static_cast<int>(a8.a0) << ", " << static_cast<int>(a8.a1)
6509 << ", " << static_cast<int>(a8.a2) << "), ("
6510 << static_cast<int>(a9.a0) << ", " << static_cast<int>(a9.a1)
6511 << ", " << static_cast<int>(a9.a2) << "))" << ")\n";
6512
6513 int64_t result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
6514
6515 std::cout << "result = " << result << "\n";
6516
6517 CHECK_EQ(465, result);
6518
6519 // Pass argument that will make the Dart callback throw.
6520 a0.a0 = 42;
6521
6522 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
6523
6524 CHECK_EQ(0, result);
6525
6526 // Pass argument that will make the Dart callback return null.
6527 a0.a0 = 84;
6528
6529 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
6530
6531 CHECK_EQ(0, result);
6532
6533 return 0;
6534}

◆ TestPassStruct3BytesInt2ByteAlignedx10()

Definition at line 6540 of file ffi_test_functions_generated.cc.

6551 {
6553 Struct3BytesInt2ByteAligned a1 = {};
6554 Struct3BytesInt2ByteAligned a2 = {};
6555 Struct3BytesInt2ByteAligned a3 = {};
6556 Struct3BytesInt2ByteAligned a4 = {};
6557 Struct3BytesInt2ByteAligned a5 = {};
6558 Struct3BytesInt2ByteAligned a6 = {};
6559 Struct3BytesInt2ByteAligned a7 = {};
6560 Struct3BytesInt2ByteAligned a8 = {};
6561 Struct3BytesInt2ByteAligned a9 = {};
6562
6563 a0.a0 = -1;
6564 a0.a1 = 2;
6565 a1.a0 = -3;
6566 a1.a1 = 4;
6567 a2.a0 = -5;
6568 a2.a1 = 6;
6569 a3.a0 = -7;
6570 a3.a1 = 8;
6571 a4.a0 = -9;
6572 a4.a1 = 10;
6573 a5.a0 = -11;
6574 a5.a1 = 12;
6575 a6.a0 = -13;
6576 a6.a1 = 14;
6577 a7.a0 = -15;
6578 a7.a1 = 16;
6579 a8.a0 = -17;
6580 a8.a1 = 18;
6581 a9.a0 = -19;
6582 a9.a1 = 20;
6583
6584 std::cout << "Calling TestPassStruct3BytesInt2ByteAlignedx10(" << "(("
6585 << a0.a0 << ", " << static_cast<int>(a0.a1) << "), (" << a1.a0
6586 << ", " << static_cast<int>(a1.a1) << "), (" << a2.a0 << ", "
6587 << static_cast<int>(a2.a1) << "), (" << a3.a0 << ", "
6588 << static_cast<int>(a3.a1) << "), (" << a4.a0 << ", "
6589 << static_cast<int>(a4.a1) << "), (" << a5.a0 << ", "
6590 << static_cast<int>(a5.a1) << "), (" << a6.a0 << ", "
6591 << static_cast<int>(a6.a1) << "), (" << a7.a0 << ", "
6592 << static_cast<int>(a7.a1) << "), (" << a8.a0 << ", "
6593 << static_cast<int>(a8.a1) << "), (" << a9.a0 << ", "
6594 << static_cast<int>(a9.a1) << "))" << ")\n";
6595
6596 int64_t result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
6597
6598 std::cout << "result = " << result << "\n";
6599
6600 CHECK_EQ(10, result);
6601
6602 // Pass argument that will make the Dart callback throw.
6603 a0.a0 = 42;
6604
6605 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
6606
6607 CHECK_EQ(0, result);
6608
6609 // Pass argument that will make the Dart callback return null.
6610 a0.a0 = 84;
6611
6612 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
6613
6614 CHECK_EQ(0, result);
6615
6616 return 0;
6617}

◆ TestPassStruct3BytesPackedIntx10()

Definition at line 11128 of file ffi_test_functions_generated.cc.

11139 {
11140 Struct3BytesPackedInt a0 = {};
11141 Struct3BytesPackedInt a1 = {};
11142 Struct3BytesPackedInt a2 = {};
11143 Struct3BytesPackedInt a3 = {};
11144 Struct3BytesPackedInt a4 = {};
11145 Struct3BytesPackedInt a5 = {};
11146 Struct3BytesPackedInt a6 = {};
11147 Struct3BytesPackedInt a7 = {};
11148 Struct3BytesPackedInt a8 = {};
11149 Struct3BytesPackedInt a9 = {};
11150
11151 a0.a0 = -1;
11152 a0.a1 = 2;
11153 a1.a0 = -3;
11154 a1.a1 = 4;
11155 a2.a0 = -5;
11156 a2.a1 = 6;
11157 a3.a0 = -7;
11158 a3.a1 = 8;
11159 a4.a0 = -9;
11160 a4.a1 = 10;
11161 a5.a0 = -11;
11162 a5.a1 = 12;
11163 a6.a0 = -13;
11164 a6.a1 = 14;
11165 a7.a0 = -15;
11166 a7.a1 = 16;
11167 a8.a0 = -17;
11168 a8.a1 = 18;
11169 a9.a0 = -19;
11170 a9.a1 = 20;
11171
11172 std::cout << "Calling TestPassStruct3BytesPackedIntx10(" << "(("
11173 << static_cast<int>(a0.a0) << ", " << a0.a1 << "), ("
11174 << static_cast<int>(a1.a0) << ", " << a1.a1 << "), ("
11175 << static_cast<int>(a2.a0) << ", " << a2.a1 << "), ("
11176 << static_cast<int>(a3.a0) << ", " << a3.a1 << "), ("
11177 << static_cast<int>(a4.a0) << ", " << a4.a1 << "), ("
11178 << static_cast<int>(a5.a0) << ", " << a5.a1 << "), ("
11179 << static_cast<int>(a6.a0) << ", " << a6.a1 << "), ("
11180 << static_cast<int>(a7.a0) << ", " << a7.a1 << "), ("
11181 << static_cast<int>(a8.a0) << ", " << a8.a1 << "), ("
11182 << static_cast<int>(a9.a0) << ", " << a9.a1 << "))" << ")\n";
11183
11184 int64_t result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
11185
11186 std::cout << "result = " << result << "\n";
11187
11188 CHECK_EQ(10, result);
11189
11190 // Pass argument that will make the Dart callback throw.
11191 a0.a0 = 42;
11192
11193 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
11194
11195 CHECK_EQ(0, result);
11196
11197 // Pass argument that will make the Dart callback return null.
11198 a0.a0 = 84;
11199
11200 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
11201
11202 CHECK_EQ(0, result);
11203
11204 return 0;
11205}

◆ TestPassStruct40BytesHomogeneousDouble()

DART_EXPORT intptr_t dart::TestPassStruct40BytesHomogeneousDouble ( double(*)(Struct40BytesHomogeneousDouble a0)  f)

Definition at line 8474 of file ffi_test_functions_generated.cc.

8476 {
8478
8479 a0.a0 = -1.0;
8480 a0.a1 = 2.0;
8481 a0.a2 = -3.0;
8482 a0.a3 = 4.0;
8483 a0.a4 = -5.0;
8484
8485 std::cout << "Calling TestPassStruct40BytesHomogeneousDouble(" << "(("
8486 << a0.a0 << ", " << a0.a1 << ", " << a0.a2 << ", " << a0.a3 << ", "
8487 << a0.a4 << "))" << ")\n";
8488
8489 double result = f(a0);
8490
8491 std::cout << "result = " << result << "\n";
8492
8493 CHECK_APPROX(-3.0, result);
8494
8495 // Pass argument that will make the Dart callback throw.
8496 a0.a0 = 42;
8497
8498 result = f(a0);
8499
8500 CHECK_APPROX(0.0, result);
8501
8502 // Pass argument that will make the Dart callback return null.
8503 a0.a0 = 84;
8504
8505 result = f(a0);
8506
8507 CHECK_APPROX(0.0, result);
8508
8509 return 0;
8510}

◆ TestPassStruct40BytesHomogeneousDoubleStruct4BytesHomo()

DART_EXPORT intptr_t dart::TestPassStruct40BytesHomogeneousDoubleStruct4BytesHomo ( double(*)(Struct40BytesHomogeneousDouble a0, Struct4BytesHomogeneousInt16 a1, Struct8BytesHomogeneousFloat a2)  f)

Definition at line 9078 of file ffi_test_functions_generated.cc.

9082 {
9084 Struct4BytesHomogeneousInt16 a1 = {};
9085 Struct8BytesHomogeneousFloat a2 = {};
9086
9087 a0.a0 = -1.0;
9088 a0.a1 = 2.0;
9089 a0.a2 = -3.0;
9090 a0.a3 = 4.0;
9091 a0.a4 = -5.0;
9092 a1.a0 = 6;
9093 a1.a1 = -7;
9094 a2.a0 = 8.0;
9095 a2.a1 = -9.0;
9096
9097 std::cout << "Calling TestPassStruct40BytesHomogeneousDoubleStruct4BytesHomo("
9098 << "((" << a0.a0 << ", " << a0.a1 << ", " << a0.a2 << ", " << a0.a3
9099 << ", " << a0.a4 << "), (" << a1.a0 << ", " << a1.a1 << "), ("
9100 << a2.a0 << ", " << a2.a1 << "))" << ")\n";
9101
9102 double result = f(a0, a1, a2);
9103
9104 std::cout << "result = " << result << "\n";
9105
9106 CHECK_APPROX(-5.0, result);
9107
9108 // Pass argument that will make the Dart callback throw.
9109 a0.a0 = 42;
9110
9111 result = f(a0, a1, a2);
9112
9113 CHECK_APPROX(0.0, result);
9114
9115 // Pass argument that will make the Dart callback return null.
9116 a0.a0 = 84;
9117
9118 result = f(a0, a1, a2);
9119
9120 CHECK_APPROX(0.0, result);
9121
9122 return 0;
9123}

◆ TestPassStruct4BytesHomogeneousInt16x10()

Definition at line 6622 of file ffi_test_functions_generated.cc.

6633 {
6635 Struct4BytesHomogeneousInt16 a1 = {};
6636 Struct4BytesHomogeneousInt16 a2 = {};
6637 Struct4BytesHomogeneousInt16 a3 = {};
6638 Struct4BytesHomogeneousInt16 a4 = {};
6639 Struct4BytesHomogeneousInt16 a5 = {};
6640 Struct4BytesHomogeneousInt16 a6 = {};
6641 Struct4BytesHomogeneousInt16 a7 = {};
6642 Struct4BytesHomogeneousInt16 a8 = {};
6643 Struct4BytesHomogeneousInt16 a9 = {};
6644
6645 a0.a0 = -1;
6646 a0.a1 = 2;
6647 a1.a0 = -3;
6648 a1.a1 = 4;
6649 a2.a0 = -5;
6650 a2.a1 = 6;
6651 a3.a0 = -7;
6652 a3.a1 = 8;
6653 a4.a0 = -9;
6654 a4.a1 = 10;
6655 a5.a0 = -11;
6656 a5.a1 = 12;
6657 a6.a0 = -13;
6658 a6.a1 = 14;
6659 a7.a0 = -15;
6660 a7.a1 = 16;
6661 a8.a0 = -17;
6662 a8.a1 = 18;
6663 a9.a0 = -19;
6664 a9.a1 = 20;
6665
6666 std::cout << "Calling TestPassStruct4BytesHomogeneousInt16x10(" << "(("
6667 << a0.a0 << ", " << a0.a1 << "), (" << a1.a0 << ", " << a1.a1
6668 << "), (" << a2.a0 << ", " << a2.a1 << "), (" << a3.a0 << ", "
6669 << a3.a1 << "), (" << a4.a0 << ", " << a4.a1 << "), (" << a5.a0
6670 << ", " << a5.a1 << "), (" << a6.a0 << ", " << a6.a1 << "), ("
6671 << a7.a0 << ", " << a7.a1 << "), (" << a8.a0 << ", " << a8.a1
6672 << "), (" << a9.a0 << ", " << a9.a1 << "))" << ")\n";
6673
6674 int64_t result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
6675
6676 std::cout << "result = " << result << "\n";
6677
6678 CHECK_EQ(10, result);
6679
6680 // Pass argument that will make the Dart callback throw.
6681 a0.a0 = 42;
6682
6683 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
6684
6685 CHECK_EQ(0, result);
6686
6687 // Pass argument that will make the Dart callback return null.
6688 a0.a0 = 84;
6689
6690 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
6691
6692 CHECK_EQ(0, result);
6693
6694 return 0;
6695}

◆ TestPassStruct5BytesPackedMixed()

DART_EXPORT intptr_t dart::TestPassStruct5BytesPackedMixed ( double(*)(Struct5BytesPackedMixed a0)  f)

Definition at line 11432 of file ffi_test_functions_generated.cc.

11434 {
11436
11437 a0.a0 = -1.0;
11438 a0.a1 = 2;
11439
11440 std::cout << "Calling TestPassStruct5BytesPackedMixed(" << "((" << a0.a0
11441 << ", " << static_cast<int>(a0.a1) << "))" << ")\n";
11442
11443 double result = f(a0);
11444
11445 std::cout << "result = " << result << "\n";
11446
11447 CHECK_APPROX(1.0, result);
11448
11449 // Pass argument that will make the Dart callback throw.
11450 a0.a0 = 42;
11451
11452 result = f(a0);
11453
11454 CHECK_APPROX(0.0, result);
11455
11456 // Pass argument that will make the Dart callback return null.
11457 a0.a0 = 84;
11458
11459 result = f(a0);
11460
11461 CHECK_APPROX(0.0, result);
11462
11463 return 0;
11464}

◆ TestPassStruct6BytesInlineArrayInt()

DART_EXPORT intptr_t dart::TestPassStruct6BytesInlineArrayInt ( double(*)(Struct6BytesInlineArrayInt a0)  f)

Definition at line 11506 of file ffi_test_functions_generated.cc.

11508 {
11510
11511 a0.a0[0].a0 = -1;
11512 a0.a0[0].a1 = 2;
11513 a0.a0[1].a0 = -3;
11514 a0.a0[1].a1 = 4;
11515
11516 std::cout << "Calling TestPassStruct6BytesInlineArrayInt(" << "(([("
11517 << static_cast<int>(a0.a0[0].a0) << ", " << a0.a0[0].a1 << "), ("
11518 << static_cast<int>(a0.a0[1].a0) << ", " << a0.a0[1].a1 << ")]))"
11519 << ")\n";
11520
11521 double result = f(a0);
11522
11523 std::cout << "result = " << result << "\n";
11524
11525 CHECK_APPROX(2.0, result);
11526
11527 // Pass argument that will make the Dart callback throw.
11528 a0.a0[0].a0 = 42;
11529
11530 result = f(a0);
11531
11532 CHECK_APPROX(0.0, result);
11533
11534 // Pass argument that will make the Dart callback return null.
11535 a0.a0[0].a0 = 84;
11536
11537 result = f(a0);
11538
11539 CHECK_APPROX(0.0, result);
11540
11541 return 0;
11542}

◆ TestPassStruct7BytesHomogeneousUint8x10()

Definition at line 6700 of file ffi_test_functions_generated.cc.

6711 {
6713 Struct7BytesHomogeneousUint8 a1 = {};
6714 Struct7BytesHomogeneousUint8 a2 = {};
6715 Struct7BytesHomogeneousUint8 a3 = {};
6716 Struct7BytesHomogeneousUint8 a4 = {};
6717 Struct7BytesHomogeneousUint8 a5 = {};
6718 Struct7BytesHomogeneousUint8 a6 = {};
6719 Struct7BytesHomogeneousUint8 a7 = {};
6720 Struct7BytesHomogeneousUint8 a8 = {};
6721 Struct7BytesHomogeneousUint8 a9 = {};
6722
6723 a0.a0 = 1;
6724 a0.a1 = 2;
6725 a0.a2 = 3;
6726 a0.a3 = 4;
6727 a0.a4 = 5;
6728 a0.a5 = 6;
6729 a0.a6 = 7;
6730 a1.a0 = 8;
6731 a1.a1 = 9;
6732 a1.a2 = 10;
6733 a1.a3 = 11;
6734 a1.a4 = 12;
6735 a1.a5 = 13;
6736 a1.a6 = 14;
6737 a2.a0 = 15;
6738 a2.a1 = 16;
6739 a2.a2 = 17;
6740 a2.a3 = 18;
6741 a2.a4 = 19;
6742 a2.a5 = 20;
6743 a2.a6 = 21;
6744 a3.a0 = 22;
6745 a3.a1 = 23;
6746 a3.a2 = 24;
6747 a3.a3 = 25;
6748 a3.a4 = 26;
6749 a3.a5 = 27;
6750 a3.a6 = 28;
6751 a4.a0 = 29;
6752 a4.a1 = 30;
6753 a4.a2 = 31;
6754 a4.a3 = 32;
6755 a4.a4 = 33;
6756 a4.a5 = 34;
6757 a4.a6 = 35;
6758 a5.a0 = 36;
6759 a5.a1 = 37;
6760 a5.a2 = 38;
6761 a5.a3 = 39;
6762 a5.a4 = 40;
6763 a5.a5 = 41;
6764 a5.a6 = 42;
6765 a6.a0 = 43;
6766 a6.a1 = 44;
6767 a6.a2 = 45;
6768 a6.a3 = 46;
6769 a6.a4 = 47;
6770 a6.a5 = 48;
6771 a6.a6 = 49;
6772 a7.a0 = 50;
6773 a7.a1 = 51;
6774 a7.a2 = 52;
6775 a7.a3 = 53;
6776 a7.a4 = 54;
6777 a7.a5 = 55;
6778 a7.a6 = 56;
6779 a8.a0 = 57;
6780 a8.a1 = 58;
6781 a8.a2 = 59;
6782 a8.a3 = 60;
6783 a8.a4 = 61;
6784 a8.a5 = 62;
6785 a8.a6 = 63;
6786 a9.a0 = 64;
6787 a9.a1 = 65;
6788 a9.a2 = 66;
6789 a9.a3 = 67;
6790 a9.a4 = 68;
6791 a9.a5 = 69;
6792 a9.a6 = 70;
6793
6794 std::cout
6795 << "Calling TestPassStruct7BytesHomogeneousUint8x10(" << "(("
6796 << static_cast<int>(a0.a0) << ", " << static_cast<int>(a0.a1) << ", "
6797 << static_cast<int>(a0.a2) << ", " << static_cast<int>(a0.a3) << ", "
6798 << static_cast<int>(a0.a4) << ", " << static_cast<int>(a0.a5) << ", "
6799 << static_cast<int>(a0.a6) << "), (" << static_cast<int>(a1.a0) << ", "
6800 << static_cast<int>(a1.a1) << ", " << static_cast<int>(a1.a2) << ", "
6801 << static_cast<int>(a1.a3) << ", " << static_cast<int>(a1.a4) << ", "
6802 << static_cast<int>(a1.a5) << ", " << static_cast<int>(a1.a6) << "), ("
6803 << static_cast<int>(a2.a0) << ", " << static_cast<int>(a2.a1) << ", "
6804 << static_cast<int>(a2.a2) << ", " << static_cast<int>(a2.a3) << ", "
6805 << static_cast<int>(a2.a4) << ", " << static_cast<int>(a2.a5) << ", "
6806 << static_cast<int>(a2.a6) << "), (" << static_cast<int>(a3.a0) << ", "
6807 << static_cast<int>(a3.a1) << ", " << static_cast<int>(a3.a2) << ", "
6808 << static_cast<int>(a3.a3) << ", " << static_cast<int>(a3.a4) << ", "
6809 << static_cast<int>(a3.a5) << ", " << static_cast<int>(a3.a6) << "), ("
6810 << static_cast<int>(a4.a0) << ", " << static_cast<int>(a4.a1) << ", "
6811 << static_cast<int>(a4.a2) << ", " << static_cast<int>(a4.a3) << ", "
6812 << static_cast<int>(a4.a4) << ", " << static_cast<int>(a4.a5) << ", "
6813 << static_cast<int>(a4.a6) << "), (" << static_cast<int>(a5.a0) << ", "
6814 << static_cast<int>(a5.a1) << ", " << static_cast<int>(a5.a2) << ", "
6815 << static_cast<int>(a5.a3) << ", " << static_cast<int>(a5.a4) << ", "
6816 << static_cast<int>(a5.a5) << ", " << static_cast<int>(a5.a6) << "), ("
6817 << static_cast<int>(a6.a0) << ", " << static_cast<int>(a6.a1) << ", "
6818 << static_cast<int>(a6.a2) << ", " << static_cast<int>(a6.a3) << ", "
6819 << static_cast<int>(a6.a4) << ", " << static_cast<int>(a6.a5) << ", "
6820 << static_cast<int>(a6.a6) << "), (" << static_cast<int>(a7.a0) << ", "
6821 << static_cast<int>(a7.a1) << ", " << static_cast<int>(a7.a2) << ", "
6822 << static_cast<int>(a7.a3) << ", " << static_cast<int>(a7.a4) << ", "
6823 << static_cast<int>(a7.a5) << ", " << static_cast<int>(a7.a6) << "), ("
6824 << static_cast<int>(a8.a0) << ", " << static_cast<int>(a8.a1) << ", "
6825 << static_cast<int>(a8.a2) << ", " << static_cast<int>(a8.a3) << ", "
6826 << static_cast<int>(a8.a4) << ", " << static_cast<int>(a8.a5) << ", "
6827 << static_cast<int>(a8.a6) << "), (" << static_cast<int>(a9.a0) << ", "
6828 << static_cast<int>(a9.a1) << ", " << static_cast<int>(a9.a2) << ", "
6829 << static_cast<int>(a9.a3) << ", " << static_cast<int>(a9.a4) << ", "
6830 << static_cast<int>(a9.a5) << ", " << static_cast<int>(a9.a6) << "))"
6831 << ")\n";
6832
6833 int64_t result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
6834
6835 std::cout << "result = " << result << "\n";
6836
6837 CHECK_EQ(2485, result);
6838
6839 // Pass argument that will make the Dart callback throw.
6840 a0.a0 = 42;
6841
6842 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
6843
6844 CHECK_EQ(0, result);
6845
6846 // Pass argument that will make the Dart callback return null.
6847 a0.a0 = 84;
6848
6849 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
6850
6851 CHECK_EQ(0, result);
6852
6853 return 0;
6854}

◆ TestPassStruct7BytesInt4ByteAlignedx10()

Definition at line 6860 of file ffi_test_functions_generated.cc.

6871 {
6873 Struct7BytesInt4ByteAligned a1 = {};
6874 Struct7BytesInt4ByteAligned a2 = {};
6875 Struct7BytesInt4ByteAligned a3 = {};
6876 Struct7BytesInt4ByteAligned a4 = {};
6877 Struct7BytesInt4ByteAligned a5 = {};
6878 Struct7BytesInt4ByteAligned a6 = {};
6879 Struct7BytesInt4ByteAligned a7 = {};
6880 Struct7BytesInt4ByteAligned a8 = {};
6881 Struct7BytesInt4ByteAligned a9 = {};
6882
6883 a0.a0 = -1;
6884 a0.a1 = 2;
6885 a0.a2 = -3;
6886 a1.a0 = 4;
6887 a1.a1 = -5;
6888 a1.a2 = 6;
6889 a2.a0 = -7;
6890 a2.a1 = 8;
6891 a2.a2 = -9;
6892 a3.a0 = 10;
6893 a3.a1 = -11;
6894 a3.a2 = 12;
6895 a4.a0 = -13;
6896 a4.a1 = 14;
6897 a4.a2 = -15;
6898 a5.a0 = 16;
6899 a5.a1 = -17;
6900 a5.a2 = 18;
6901 a6.a0 = -19;
6902 a6.a1 = 20;
6903 a6.a2 = -21;
6904 a7.a0 = 22;
6905 a7.a1 = -23;
6906 a7.a2 = 24;
6907 a8.a0 = -25;
6908 a8.a1 = 26;
6909 a8.a2 = -27;
6910 a9.a0 = 28;
6911 a9.a1 = -29;
6912 a9.a2 = 30;
6913
6914 std::cout << "Calling TestPassStruct7BytesInt4ByteAlignedx10(" << "(("
6915 << a0.a0 << ", " << a0.a1 << ", " << static_cast<int>(a0.a2)
6916 << "), (" << a1.a0 << ", " << a1.a1 << ", "
6917 << static_cast<int>(a1.a2) << "), (" << a2.a0 << ", " << a2.a1
6918 << ", " << static_cast<int>(a2.a2) << "), (" << a3.a0 << ", "
6919 << a3.a1 << ", " << static_cast<int>(a3.a2) << "), (" << a4.a0
6920 << ", " << a4.a1 << ", " << static_cast<int>(a4.a2) << "), ("
6921 << a5.a0 << ", " << a5.a1 << ", " << static_cast<int>(a5.a2)
6922 << "), (" << a6.a0 << ", " << a6.a1 << ", "
6923 << static_cast<int>(a6.a2) << "), (" << a7.a0 << ", " << a7.a1
6924 << ", " << static_cast<int>(a7.a2) << "), (" << a8.a0 << ", "
6925 << a8.a1 << ", " << static_cast<int>(a8.a2) << "), (" << a9.a0
6926 << ", " << a9.a1 << ", " << static_cast<int>(a9.a2) << "))"
6927 << ")\n";
6928
6929 int64_t result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
6930
6931 std::cout << "result = " << result << "\n";
6932
6933 CHECK_EQ(15, result);
6934
6935 // Pass argument that will make the Dart callback throw.
6936 a0.a0 = 42;
6937
6938 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
6939
6940 CHECK_EQ(0, result);
6941
6942 // Pass argument that will make the Dart callback return null.
6943 a0.a0 = 84;
6944
6945 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
6946
6947 CHECK_EQ(0, result);
6948
6949 return 0;
6950}

◆ TestPassStruct8BytesHomogeneousFloatx10()

Definition at line 7046 of file ffi_test_functions_generated.cc.

7057 {
7059 Struct8BytesHomogeneousFloat a1 = {};
7060 Struct8BytesHomogeneousFloat a2 = {};
7061 Struct8BytesHomogeneousFloat a3 = {};
7062 Struct8BytesHomogeneousFloat a4 = {};
7063 Struct8BytesHomogeneousFloat a5 = {};
7064 Struct8BytesHomogeneousFloat a6 = {};
7065 Struct8BytesHomogeneousFloat a7 = {};
7066 Struct8BytesHomogeneousFloat a8 = {};
7067 Struct8BytesHomogeneousFloat a9 = {};
7068
7069 a0.a0 = -1.0;
7070 a0.a1 = 2.0;
7071 a1.a0 = -3.0;
7072 a1.a1 = 4.0;
7073 a2.a0 = -5.0;
7074 a2.a1 = 6.0;
7075 a3.a0 = -7.0;
7076 a3.a1 = 8.0;
7077 a4.a0 = -9.0;
7078 a4.a1 = 10.0;
7079 a5.a0 = -11.0;
7080 a5.a1 = 12.0;
7081 a6.a0 = -13.0;
7082 a6.a1 = 14.0;
7083 a7.a0 = -15.0;
7084 a7.a1 = 16.0;
7085 a8.a0 = -17.0;
7086 a8.a1 = 18.0;
7087 a9.a0 = -19.0;
7088 a9.a1 = 20.0;
7089
7090 std::cout << "Calling TestPassStruct8BytesHomogeneousFloatx10(" << "(("
7091 << a0.a0 << ", " << a0.a1 << "), (" << a1.a0 << ", " << a1.a1
7092 << "), (" << a2.a0 << ", " << a2.a1 << "), (" << a3.a0 << ", "
7093 << a3.a1 << "), (" << a4.a0 << ", " << a4.a1 << "), (" << a5.a0
7094 << ", " << a5.a1 << "), (" << a6.a0 << ", " << a6.a1 << "), ("
7095 << a7.a0 << ", " << a7.a1 << "), (" << a8.a0 << ", " << a8.a1
7096 << "), (" << a9.a0 << ", " << a9.a1 << "))" << ")\n";
7097
7098 float result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
7099
7100 std::cout << "result = " << result << "\n";
7101
7102 CHECK_APPROX(10.0, result);
7103
7104 // Pass argument that will make the Dart callback throw.
7105 a0.a0 = 42;
7106
7107 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
7108
7109 CHECK_APPROX(0.0, result);
7110
7111 // Pass argument that will make the Dart callback return null.
7112 a0.a0 = 84;
7113
7114 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
7115
7116 CHECK_APPROX(0.0, result);
7117
7118 return 0;
7119}

◆ TestPassStruct8BytesInlineArrayIntx4()

DART_EXPORT intptr_t dart::TestPassStruct8BytesInlineArrayIntx4 ( int32_t(*)(Struct8BytesInlineArrayInt a0, Struct8BytesInlineArrayInt a1, Struct8BytesInlineArrayInt a2, Struct8BytesInlineArrayInt a3)  f)

Definition at line 10288 of file ffi_test_functions_generated.cc.

10293 {
10295 Struct8BytesInlineArrayInt a1 = {};
10296 Struct8BytesInlineArrayInt a2 = {};
10297 Struct8BytesInlineArrayInt a3 = {};
10298
10299 a0.a0[0] = 1;
10300 a0.a0[1] = 2;
10301 a0.a0[2] = 3;
10302 a0.a0[3] = 4;
10303 a0.a0[4] = 5;
10304 a0.a0[5] = 6;
10305 a0.a0[6] = 7;
10306 a0.a0[7] = 8;
10307 a1.a0[0] = 9;
10308 a1.a0[1] = 10;
10309 a1.a0[2] = 11;
10310 a1.a0[3] = 12;
10311 a1.a0[4] = 13;
10312 a1.a0[5] = 14;
10313 a1.a0[6] = 15;
10314 a1.a0[7] = 16;
10315 a2.a0[0] = 17;
10316 a2.a0[1] = 18;
10317 a2.a0[2] = 19;
10318 a2.a0[3] = 20;
10319 a2.a0[4] = 21;
10320 a2.a0[5] = 22;
10321 a2.a0[6] = 23;
10322 a2.a0[7] = 24;
10323 a3.a0[0] = 25;
10324 a3.a0[1] = 26;
10325 a3.a0[2] = 27;
10326 a3.a0[3] = 28;
10327 a3.a0[4] = 29;
10328 a3.a0[5] = 30;
10329 a3.a0[6] = 31;
10330 a3.a0[7] = 32;
10331
10332 std::cout << "Calling TestPassStruct8BytesInlineArrayIntx4(" << "((["
10333 << static_cast<int>(a0.a0[0]) << ", " << static_cast<int>(a0.a0[1])
10334 << ", " << static_cast<int>(a0.a0[2]) << ", "
10335 << static_cast<int>(a0.a0[3]) << ", " << static_cast<int>(a0.a0[4])
10336 << ", " << static_cast<int>(a0.a0[5]) << ", "
10337 << static_cast<int>(a0.a0[6]) << ", " << static_cast<int>(a0.a0[7])
10338 << "]), ([" << static_cast<int>(a1.a0[0]) << ", "
10339 << static_cast<int>(a1.a0[1]) << ", " << static_cast<int>(a1.a0[2])
10340 << ", " << static_cast<int>(a1.a0[3]) << ", "
10341 << static_cast<int>(a1.a0[4]) << ", " << static_cast<int>(a1.a0[5])
10342 << ", " << static_cast<int>(a1.a0[6]) << ", "
10343 << static_cast<int>(a1.a0[7]) << "]), (["
10344 << static_cast<int>(a2.a0[0]) << ", " << static_cast<int>(a2.a0[1])
10345 << ", " << static_cast<int>(a2.a0[2]) << ", "
10346 << static_cast<int>(a2.a0[3]) << ", " << static_cast<int>(a2.a0[4])
10347 << ", " << static_cast<int>(a2.a0[5]) << ", "
10348 << static_cast<int>(a2.a0[6]) << ", " << static_cast<int>(a2.a0[7])
10349 << "]), ([" << static_cast<int>(a3.a0[0]) << ", "
10350 << static_cast<int>(a3.a0[1]) << ", " << static_cast<int>(a3.a0[2])
10351 << ", " << static_cast<int>(a3.a0[3]) << ", "
10352 << static_cast<int>(a3.a0[4]) << ", " << static_cast<int>(a3.a0[5])
10353 << ", " << static_cast<int>(a3.a0[6]) << ", "
10354 << static_cast<int>(a3.a0[7]) << "]))" << ")\n";
10355
10356 int32_t result = f(a0, a1, a2, a3);
10357
10358 std::cout << "result = " << result << "\n";
10359
10360 CHECK_EQ(528, result);
10361
10362 // Pass argument that will make the Dart callback throw.
10363 a0.a0[0] = 42;
10364
10365 result = f(a0, a1, a2, a3);
10366
10367 CHECK_EQ(0, result);
10368
10369 // Pass argument that will make the Dart callback return null.
10370 a0.a0[0] = 84;
10371
10372 result = f(a0, a1, a2, a3);
10373
10374 CHECK_EQ(0, result);
10375
10376 return 0;
10377}

◆ TestPassStruct8BytesIntx10()

DART_EXPORT intptr_t dart::TestPassStruct8BytesIntx10 ( int64_t(*)(Struct8BytesInt a0, Struct8BytesInt a1, Struct8BytesInt a2, Struct8BytesInt a3, Struct8BytesInt a4, Struct8BytesInt a5, Struct8BytesInt a6, Struct8BytesInt a7, Struct8BytesInt a8, Struct8BytesInt a9)  f)

Definition at line 6955 of file ffi_test_functions_generated.cc.

6966 {
6967 Struct8BytesInt a0 = {};
6968 Struct8BytesInt a1 = {};
6969 Struct8BytesInt a2 = {};
6970 Struct8BytesInt a3 = {};
6971 Struct8BytesInt a4 = {};
6972 Struct8BytesInt a5 = {};
6973 Struct8BytesInt a6 = {};
6974 Struct8BytesInt a7 = {};
6975 Struct8BytesInt a8 = {};
6976 Struct8BytesInt a9 = {};
6977
6978 a0.a0 = -1;
6979 a0.a1 = 2;
6980 a0.a2 = -3;
6981 a1.a0 = 4;
6982 a1.a1 = -5;
6983 a1.a2 = 6;
6984 a2.a0 = -7;
6985 a2.a1 = 8;
6986 a2.a2 = -9;
6987 a3.a0 = 10;
6988 a3.a1 = -11;
6989 a3.a2 = 12;
6990 a4.a0 = -13;
6991 a4.a1 = 14;
6992 a4.a2 = -15;
6993 a5.a0 = 16;
6994 a5.a1 = -17;
6995 a5.a2 = 18;
6996 a6.a0 = -19;
6997 a6.a1 = 20;
6998 a6.a2 = -21;
6999 a7.a0 = 22;
7000 a7.a1 = -23;
7001 a7.a2 = 24;
7002 a8.a0 = -25;
7003 a8.a1 = 26;
7004 a8.a2 = -27;
7005 a9.a0 = 28;
7006 a9.a1 = -29;
7007 a9.a2 = 30;
7008
7009 std::cout << "Calling TestPassStruct8BytesIntx10(" << "((" << a0.a0 << ", "
7010 << a0.a1 << ", " << a0.a2 << "), (" << a1.a0 << ", " << a1.a1
7011 << ", " << a1.a2 << "), (" << a2.a0 << ", " << a2.a1 << ", "
7012 << a2.a2 << "), (" << a3.a0 << ", " << a3.a1 << ", " << a3.a2
7013 << "), (" << a4.a0 << ", " << a4.a1 << ", " << a4.a2 << "), ("
7014 << a5.a0 << ", " << a5.a1 << ", " << a5.a2 << "), (" << a6.a0
7015 << ", " << a6.a1 << ", " << a6.a2 << "), (" << a7.a0 << ", "
7016 << a7.a1 << ", " << a7.a2 << "), (" << a8.a0 << ", " << a8.a1
7017 << ", " << a8.a2 << "), (" << a9.a0 << ", " << a9.a1 << ", "
7018 << a9.a2 << "))" << ")\n";
7019
7020 int64_t result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
7021
7022 std::cout << "result = " << result << "\n";
7023
7024 CHECK_EQ(15, result);
7025
7026 // Pass argument that will make the Dart callback throw.
7027 a0.a0 = 42;
7028
7029 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
7030
7031 CHECK_EQ(0, result);
7032
7033 // Pass argument that will make the Dart callback return null.
7034 a0.a0 = 84;
7035
7036 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
7037
7038 CHECK_EQ(0, result);
7039
7040 return 0;
7041}

◆ TestPassStruct8BytesMixedx10()

Definition at line 7124 of file ffi_test_functions_generated.cc.

7135 {
7136 Struct8BytesMixed a0 = {};
7137 Struct8BytesMixed a1 = {};
7138 Struct8BytesMixed a2 = {};
7139 Struct8BytesMixed a3 = {};
7140 Struct8BytesMixed a4 = {};
7141 Struct8BytesMixed a5 = {};
7142 Struct8BytesMixed a6 = {};
7143 Struct8BytesMixed a7 = {};
7144 Struct8BytesMixed a8 = {};
7145 Struct8BytesMixed a9 = {};
7146
7147 a0.a0 = -1.0;
7148 a0.a1 = 2;
7149 a0.a2 = -3;
7150 a1.a0 = 4.0;
7151 a1.a1 = -5;
7152 a1.a2 = 6;
7153 a2.a0 = -7.0;
7154 a2.a1 = 8;
7155 a2.a2 = -9;
7156 a3.a0 = 10.0;
7157 a3.a1 = -11;
7158 a3.a2 = 12;
7159 a4.a0 = -13.0;
7160 a4.a1 = 14;
7161 a4.a2 = -15;
7162 a5.a0 = 16.0;
7163 a5.a1 = -17;
7164 a5.a2 = 18;
7165 a6.a0 = -19.0;
7166 a6.a1 = 20;
7167 a6.a2 = -21;
7168 a7.a0 = 22.0;
7169 a7.a1 = -23;
7170 a7.a2 = 24;
7171 a8.a0 = -25.0;
7172 a8.a1 = 26;
7173 a8.a2 = -27;
7174 a9.a0 = 28.0;
7175 a9.a1 = -29;
7176 a9.a2 = 30;
7177
7178 std::cout << "Calling TestPassStruct8BytesMixedx10(" << "((" << a0.a0 << ", "
7179 << a0.a1 << ", " << a0.a2 << "), (" << a1.a0 << ", " << a1.a1
7180 << ", " << a1.a2 << "), (" << a2.a0 << ", " << a2.a1 << ", "
7181 << a2.a2 << "), (" << a3.a0 << ", " << a3.a1 << ", " << a3.a2
7182 << "), (" << a4.a0 << ", " << a4.a1 << ", " << a4.a2 << "), ("
7183 << a5.a0 << ", " << a5.a1 << ", " << a5.a2 << "), (" << a6.a0
7184 << ", " << a6.a1 << ", " << a6.a2 << "), (" << a7.a0 << ", "
7185 << a7.a1 << ", " << a7.a2 << "), (" << a8.a0 << ", " << a8.a1
7186 << ", " << a8.a2 << "), (" << a9.a0 << ", " << a9.a1 << ", "
7187 << a9.a2 << "))" << ")\n";
7188
7189 float result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
7190
7191 std::cout << "result = " << result << "\n";
7192
7193 CHECK_APPROX(15.0, result);
7194
7195 // Pass argument that will make the Dart callback throw.
7196 a0.a0 = 42;
7197
7198 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
7199
7200 CHECK_APPROX(0.0, result);
7201
7202 // Pass argument that will make the Dart callback return null.
7203 a0.a0 = 84;
7204
7205 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
7206
7207 CHECK_APPROX(0.0, result);
7208
7209 return 0;
7210}

◆ TestPassStruct8BytesNestedFloat2x10()

Definition at line 9619 of file ffi_test_functions_generated.cc.

9630 {
9632 Struct8BytesNestedFloat2 a1 = {};
9633 Struct8BytesNestedFloat2 a2 = {};
9634 Struct8BytesNestedFloat2 a3 = {};
9635 Struct8BytesNestedFloat2 a4 = {};
9636 Struct8BytesNestedFloat2 a5 = {};
9637 Struct8BytesNestedFloat2 a6 = {};
9638 Struct8BytesNestedFloat2 a7 = {};
9639 Struct8BytesNestedFloat2 a8 = {};
9640 Struct8BytesNestedFloat2 a9 = {};
9641
9642 a0.a0.a0 = -1.0;
9643 a0.a1 = 2.0;
9644 a1.a0.a0 = -3.0;
9645 a1.a1 = 4.0;
9646 a2.a0.a0 = -5.0;
9647 a2.a1 = 6.0;
9648 a3.a0.a0 = -7.0;
9649 a3.a1 = 8.0;
9650 a4.a0.a0 = -9.0;
9651 a4.a1 = 10.0;
9652 a5.a0.a0 = -11.0;
9653 a5.a1 = 12.0;
9654 a6.a0.a0 = -13.0;
9655 a6.a1 = 14.0;
9656 a7.a0.a0 = -15.0;
9657 a7.a1 = 16.0;
9658 a8.a0.a0 = -17.0;
9659 a8.a1 = 18.0;
9660 a9.a0.a0 = -19.0;
9661 a9.a1 = 20.0;
9662
9663 std::cout << "Calling TestPassStruct8BytesNestedFloat2x10(" << "((("
9664 << a0.a0.a0 << "), " << a0.a1 << "), ((" << a1.a0.a0 << "), "
9665 << a1.a1 << "), ((" << a2.a0.a0 << "), " << a2.a1 << "), (("
9666 << a3.a0.a0 << "), " << a3.a1 << "), ((" << a4.a0.a0 << "), "
9667 << a4.a1 << "), ((" << a5.a0.a0 << "), " << a5.a1 << "), (("
9668 << a6.a0.a0 << "), " << a6.a1 << "), ((" << a7.a0.a0 << "), "
9669 << a7.a1 << "), ((" << a8.a0.a0 << "), " << a8.a1 << "), (("
9670 << a9.a0.a0 << "), " << a9.a1 << "))" << ")\n";
9671
9672 float result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
9673
9674 std::cout << "result = " << result << "\n";
9675
9676 CHECK_APPROX(10.0, result);
9677
9678 // Pass argument that will make the Dart callback throw.
9679 a0.a0.a0 = 42;
9680
9681 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
9682
9683 CHECK_APPROX(0.0, result);
9684
9685 // Pass argument that will make the Dart callback return null.
9686 a0.a0.a0 = 84;
9687
9688 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
9689
9690 CHECK_APPROX(0.0, result);
9691
9692 return 0;
9693}

◆ TestPassStruct8BytesNestedFloatx10()

Definition at line 9537 of file ffi_test_functions_generated.cc.

9548 {
9550 Struct8BytesNestedFloat a1 = {};
9551 Struct8BytesNestedFloat a2 = {};
9552 Struct8BytesNestedFloat a3 = {};
9553 Struct8BytesNestedFloat a4 = {};
9554 Struct8BytesNestedFloat a5 = {};
9555 Struct8BytesNestedFloat a6 = {};
9556 Struct8BytesNestedFloat a7 = {};
9557 Struct8BytesNestedFloat a8 = {};
9558 Struct8BytesNestedFloat a9 = {};
9559
9560 a0.a0.a0 = -1.0;
9561 a0.a1.a0 = 2.0;
9562 a1.a0.a0 = -3.0;
9563 a1.a1.a0 = 4.0;
9564 a2.a0.a0 = -5.0;
9565 a2.a1.a0 = 6.0;
9566 a3.a0.a0 = -7.0;
9567 a3.a1.a0 = 8.0;
9568 a4.a0.a0 = -9.0;
9569 a4.a1.a0 = 10.0;
9570 a5.a0.a0 = -11.0;
9571 a5.a1.a0 = 12.0;
9572 a6.a0.a0 = -13.0;
9573 a6.a1.a0 = 14.0;
9574 a7.a0.a0 = -15.0;
9575 a7.a1.a0 = 16.0;
9576 a8.a0.a0 = -17.0;
9577 a8.a1.a0 = 18.0;
9578 a9.a0.a0 = -19.0;
9579 a9.a1.a0 = 20.0;
9580
9581 std::cout << "Calling TestPassStruct8BytesNestedFloatx10(" << "((("
9582 << a0.a0.a0 << "), (" << a0.a1.a0 << ")), ((" << a1.a0.a0 << "), ("
9583 << a1.a1.a0 << ")), ((" << a2.a0.a0 << "), (" << a2.a1.a0
9584 << ")), ((" << a3.a0.a0 << "), (" << a3.a1.a0 << ")), (("
9585 << a4.a0.a0 << "), (" << a4.a1.a0 << ")), ((" << a5.a0.a0 << "), ("
9586 << a5.a1.a0 << ")), ((" << a6.a0.a0 << "), (" << a6.a1.a0
9587 << ")), ((" << a7.a0.a0 << "), (" << a7.a1.a0 << ")), (("
9588 << a8.a0.a0 << "), (" << a8.a1.a0 << ")), ((" << a9.a0.a0 << "), ("
9589 << a9.a1.a0 << ")))" << ")\n";
9590
9591 float result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
9592
9593 std::cout << "result = " << result << "\n";
9594
9595 CHECK_APPROX(10.0, result);
9596
9597 // Pass argument that will make the Dart callback throw.
9598 a0.a0.a0 = 42;
9599
9600 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
9601
9602 CHECK_APPROX(0.0, result);
9603
9604 // Pass argument that will make the Dart callback return null.
9605 a0.a0.a0 = 84;
9606
9607 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
9608
9609 CHECK_APPROX(0.0, result);
9610
9611 return 0;
9612}

◆ TestPassStruct8BytesNestedIntx10()

Definition at line 9431 of file ffi_test_functions_generated.cc.

9442 {
9443 Struct8BytesNestedInt a0 = {};
9444 Struct8BytesNestedInt a1 = {};
9445 Struct8BytesNestedInt a2 = {};
9446 Struct8BytesNestedInt a3 = {};
9447 Struct8BytesNestedInt a4 = {};
9448 Struct8BytesNestedInt a5 = {};
9449 Struct8BytesNestedInt a6 = {};
9450 Struct8BytesNestedInt a7 = {};
9451 Struct8BytesNestedInt a8 = {};
9452 Struct8BytesNestedInt a9 = {};
9453
9454 a0.a0.a0 = -1;
9455 a0.a0.a1 = 2;
9456 a0.a1.a0 = -3;
9457 a0.a1.a1 = 4;
9458 a1.a0.a0 = -5;
9459 a1.a0.a1 = 6;
9460 a1.a1.a0 = -7;
9461 a1.a1.a1 = 8;
9462 a2.a0.a0 = -9;
9463 a2.a0.a1 = 10;
9464 a2.a1.a0 = -11;
9465 a2.a1.a1 = 12;
9466 a3.a0.a0 = -13;
9467 a3.a0.a1 = 14;
9468 a3.a1.a0 = -15;
9469 a3.a1.a1 = 16;
9470 a4.a0.a0 = -17;
9471 a4.a0.a1 = 18;
9472 a4.a1.a0 = -19;
9473 a4.a1.a1 = 20;
9474 a5.a0.a0 = -21;
9475 a5.a0.a1 = 22;
9476 a5.a1.a0 = -23;
9477 a5.a1.a1 = 24;
9478 a6.a0.a0 = -25;
9479 a6.a0.a1 = 26;
9480 a6.a1.a0 = -27;
9481 a6.a1.a1 = 28;
9482 a7.a0.a0 = -29;
9483 a7.a0.a1 = 30;
9484 a7.a1.a0 = -31;
9485 a7.a1.a1 = 32;
9486 a8.a0.a0 = -33;
9487 a8.a0.a1 = 34;
9488 a8.a1.a0 = -35;
9489 a8.a1.a1 = 36;
9490 a9.a0.a0 = -37;
9491 a9.a0.a1 = 38;
9492 a9.a1.a0 = -39;
9493 a9.a1.a1 = 40;
9494
9495 std::cout << "Calling TestPassStruct8BytesNestedIntx10(" << "(((" << a0.a0.a0
9496 << ", " << a0.a0.a1 << "), (" << a0.a1.a0 << ", " << a0.a1.a1
9497 << ")), ((" << a1.a0.a0 << ", " << a1.a0.a1 << "), (" << a1.a1.a0
9498 << ", " << a1.a1.a1 << ")), ((" << a2.a0.a0 << ", " << a2.a0.a1
9499 << "), (" << a2.a1.a0 << ", " << a2.a1.a1 << ")), ((" << a3.a0.a0
9500 << ", " << a3.a0.a1 << "), (" << a3.a1.a0 << ", " << a3.a1.a1
9501 << ")), ((" << a4.a0.a0 << ", " << a4.a0.a1 << "), (" << a4.a1.a0
9502 << ", " << a4.a1.a1 << ")), ((" << a5.a0.a0 << ", " << a5.a0.a1
9503 << "), (" << a5.a1.a0 << ", " << a5.a1.a1 << ")), ((" << a6.a0.a0
9504 << ", " << a6.a0.a1 << "), (" << a6.a1.a0 << ", " << a6.a1.a1
9505 << ")), ((" << a7.a0.a0 << ", " << a7.a0.a1 << "), (" << a7.a1.a0
9506 << ", " << a7.a1.a1 << ")), ((" << a8.a0.a0 << ", " << a8.a0.a1
9507 << "), (" << a8.a1.a0 << ", " << a8.a1.a1 << ")), ((" << a9.a0.a0
9508 << ", " << a9.a0.a1 << "), (" << a9.a1.a0 << ", " << a9.a1.a1
9509 << ")))" << ")\n";
9510
9511 int64_t result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
9512
9513 std::cout << "result = " << result << "\n";
9514
9515 CHECK_EQ(20, result);
9516
9517 // Pass argument that will make the Dart callback throw.
9518 a0.a0.a0 = 42;
9519
9520 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
9521
9522 CHECK_EQ(0, result);
9523
9524 // Pass argument that will make the Dart callback return null.
9525 a0.a0.a0 = 84;
9526
9527 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
9528
9529 CHECK_EQ(0, result);
9530
9531 return 0;
9532}

◆ TestPassStruct8BytesNestedMixedx10()

Definition at line 9698 of file ffi_test_functions_generated.cc.

9709 {
9711 Struct8BytesNestedMixed a1 = {};
9712 Struct8BytesNestedMixed a2 = {};
9713 Struct8BytesNestedMixed a3 = {};
9714 Struct8BytesNestedMixed a4 = {};
9715 Struct8BytesNestedMixed a5 = {};
9716 Struct8BytesNestedMixed a6 = {};
9717 Struct8BytesNestedMixed a7 = {};
9718 Struct8BytesNestedMixed a8 = {};
9719 Struct8BytesNestedMixed a9 = {};
9720
9721 a0.a0.a0 = -1;
9722 a0.a0.a1 = 2;
9723 a0.a1.a0 = -3.0;
9724 a1.a0.a0 = 4;
9725 a1.a0.a1 = -5;
9726 a1.a1.a0 = 6.0;
9727 a2.a0.a0 = -7;
9728 a2.a0.a1 = 8;
9729 a2.a1.a0 = -9.0;
9730 a3.a0.a0 = 10;
9731 a3.a0.a1 = -11;
9732 a3.a1.a0 = 12.0;
9733 a4.a0.a0 = -13;
9734 a4.a0.a1 = 14;
9735 a4.a1.a0 = -15.0;
9736 a5.a0.a0 = 16;
9737 a5.a0.a1 = -17;
9738 a5.a1.a0 = 18.0;
9739 a6.a0.a0 = -19;
9740 a6.a0.a1 = 20;
9741 a6.a1.a0 = -21.0;
9742 a7.a0.a0 = 22;
9743 a7.a0.a1 = -23;
9744 a7.a1.a0 = 24.0;
9745 a8.a0.a0 = -25;
9746 a8.a0.a1 = 26;
9747 a8.a1.a0 = -27.0;
9748 a9.a0.a0 = 28;
9749 a9.a0.a1 = -29;
9750 a9.a1.a0 = 30.0;
9751
9752 std::cout << "Calling TestPassStruct8BytesNestedMixedx10(" << "((("
9753 << a0.a0.a0 << ", " << a0.a0.a1 << "), (" << a0.a1.a0 << ")), (("
9754 << a1.a0.a0 << ", " << a1.a0.a1 << "), (" << a1.a1.a0 << ")), (("
9755 << a2.a0.a0 << ", " << a2.a0.a1 << "), (" << a2.a1.a0 << ")), (("
9756 << a3.a0.a0 << ", " << a3.a0.a1 << "), (" << a3.a1.a0 << ")), (("
9757 << a4.a0.a0 << ", " << a4.a0.a1 << "), (" << a4.a1.a0 << ")), (("
9758 << a5.a0.a0 << ", " << a5.a0.a1 << "), (" << a5.a1.a0 << ")), (("
9759 << a6.a0.a0 << ", " << a6.a0.a1 << "), (" << a6.a1.a0 << ")), (("
9760 << a7.a0.a0 << ", " << a7.a0.a1 << "), (" << a7.a1.a0 << ")), (("
9761 << a8.a0.a0 << ", " << a8.a0.a1 << "), (" << a8.a1.a0 << ")), (("
9762 << a9.a0.a0 << ", " << a9.a0.a1 << "), (" << a9.a1.a0 << ")))"
9763 << ")\n";
9764
9765 double result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
9766
9767 std::cout << "result = " << result << "\n";
9768
9769 CHECK_APPROX(15.0, result);
9770
9771 // Pass argument that will make the Dart callback throw.
9772 a0.a0.a0 = 42;
9773
9774 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
9775
9776 CHECK_APPROX(0.0, result);
9777
9778 // Pass argument that will make the Dart callback return null.
9779 a0.a0.a0 = 84;
9780
9781 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
9782
9783 CHECK_APPROX(0.0, result);
9784
9785 return 0;
9786}

◆ TestPassStruct8BytesPackedIntx10()

Definition at line 11209 of file ffi_test_functions_generated.cc.

11220 {
11221 Struct8BytesPackedInt a0 = {};
11222 Struct8BytesPackedInt a1 = {};
11223 Struct8BytesPackedInt a2 = {};
11224 Struct8BytesPackedInt a3 = {};
11225 Struct8BytesPackedInt a4 = {};
11226 Struct8BytesPackedInt a5 = {};
11227 Struct8BytesPackedInt a6 = {};
11228 Struct8BytesPackedInt a7 = {};
11229 Struct8BytesPackedInt a8 = {};
11230 Struct8BytesPackedInt a9 = {};
11231
11232 a0.a0 = 1;
11233 a0.a1 = 2;
11234 a0.a2 = 3;
11235 a0.a3 = 4;
11236 a0.a4 = 5;
11237 a1.a0 = 6;
11238 a1.a1 = 7;
11239 a1.a2 = 8;
11240 a1.a3 = 9;
11241 a1.a4 = 10;
11242 a2.a0 = 11;
11243 a2.a1 = 12;
11244 a2.a2 = 13;
11245 a2.a3 = 14;
11246 a2.a4 = 15;
11247 a3.a0 = 16;
11248 a3.a1 = 17;
11249 a3.a2 = 18;
11250 a3.a3 = 19;
11251 a3.a4 = 20;
11252 a4.a0 = 21;
11253 a4.a1 = 22;
11254 a4.a2 = 23;
11255 a4.a3 = 24;
11256 a4.a4 = 25;
11257 a5.a0 = 26;
11258 a5.a1 = 27;
11259 a5.a2 = 28;
11260 a5.a3 = 29;
11261 a5.a4 = 30;
11262 a6.a0 = 31;
11263 a6.a1 = 32;
11264 a6.a2 = 33;
11265 a6.a3 = 34;
11266 a6.a4 = 35;
11267 a7.a0 = 36;
11268 a7.a1 = 37;
11269 a7.a2 = 38;
11270 a7.a3 = 39;
11271 a7.a4 = 40;
11272 a8.a0 = 41;
11273 a8.a1 = 42;
11274 a8.a2 = 43;
11275 a8.a3 = 44;
11276 a8.a4 = 45;
11277 a9.a0 = 46;
11278 a9.a1 = 47;
11279 a9.a2 = 48;
11280 a9.a3 = 49;
11281 a9.a4 = 50;
11282
11283 std::cout << "Calling TestPassStruct8BytesPackedIntx10(" << "(("
11284 << static_cast<int>(a0.a0) << ", " << a0.a1 << ", "
11285 << static_cast<int>(a0.a2) << ", " << static_cast<int>(a0.a3)
11286 << ", " << static_cast<int>(a0.a4) << "), ("
11287 << static_cast<int>(a1.a0) << ", " << a1.a1 << ", "
11288 << static_cast<int>(a1.a2) << ", " << static_cast<int>(a1.a3)
11289 << ", " << static_cast<int>(a1.a4) << "), ("
11290 << static_cast<int>(a2.a0) << ", " << a2.a1 << ", "
11291 << static_cast<int>(a2.a2) << ", " << static_cast<int>(a2.a3)
11292 << ", " << static_cast<int>(a2.a4) << "), ("
11293 << static_cast<int>(a3.a0) << ", " << a3.a1 << ", "
11294 << static_cast<int>(a3.a2) << ", " << static_cast<int>(a3.a3)
11295 << ", " << static_cast<int>(a3.a4) << "), ("
11296 << static_cast<int>(a4.a0) << ", " << a4.a1 << ", "
11297 << static_cast<int>(a4.a2) << ", " << static_cast<int>(a4.a3)
11298 << ", " << static_cast<int>(a4.a4) << "), ("
11299 << static_cast<int>(a5.a0) << ", " << a5.a1 << ", "
11300 << static_cast<int>(a5.a2) << ", " << static_cast<int>(a5.a3)
11301 << ", " << static_cast<int>(a5.a4) << "), ("
11302 << static_cast<int>(a6.a0) << ", " << a6.a1 << ", "
11303 << static_cast<int>(a6.a2) << ", " << static_cast<int>(a6.a3)
11304 << ", " << static_cast<int>(a6.a4) << "), ("
11305 << static_cast<int>(a7.a0) << ", " << a7.a1 << ", "
11306 << static_cast<int>(a7.a2) << ", " << static_cast<int>(a7.a3)
11307 << ", " << static_cast<int>(a7.a4) << "), ("
11308 << static_cast<int>(a8.a0) << ", " << a8.a1 << ", "
11309 << static_cast<int>(a8.a2) << ", " << static_cast<int>(a8.a3)
11310 << ", " << static_cast<int>(a8.a4) << "), ("
11311 << static_cast<int>(a9.a0) << ", " << a9.a1 << ", "
11312 << static_cast<int>(a9.a2) << ", " << static_cast<int>(a9.a3)
11313 << ", " << static_cast<int>(a9.a4) << "))" << ")\n";
11314
11315 int64_t result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
11316
11317 std::cout << "result = " << result << "\n";
11318
11319 CHECK_EQ(1275, result);
11320
11321 // Pass argument that will make the Dart callback throw.
11322 a0.a0 = 42;
11323
11324 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
11325
11326 CHECK_EQ(0, result);
11327
11328 // Pass argument that will make the Dart callback return null.
11329 a0.a0 = 84;
11330
11331 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
11332
11333 CHECK_EQ(0, result);
11334
11335 return 0;
11336}

◆ TestPassStruct9BytesHomogeneousUint8x10()

Definition at line 7218 of file ffi_test_functions_generated.cc.

7229 {
7231 Struct9BytesHomogeneousUint8 a1 = {};
7232 Struct9BytesHomogeneousUint8 a2 = {};
7233 Struct9BytesHomogeneousUint8 a3 = {};
7234 Struct9BytesHomogeneousUint8 a4 = {};
7235 Struct9BytesHomogeneousUint8 a5 = {};
7236 Struct9BytesHomogeneousUint8 a6 = {};
7237 Struct9BytesHomogeneousUint8 a7 = {};
7238 Struct9BytesHomogeneousUint8 a8 = {};
7239 Struct9BytesHomogeneousUint8 a9 = {};
7240
7241 a0.a0 = 1;
7242 a0.a1 = 2;
7243 a0.a2 = 3;
7244 a0.a3 = 4;
7245 a0.a4 = 5;
7246 a0.a5 = 6;
7247 a0.a6 = 7;
7248 a0.a7 = 8;
7249 a0.a8 = 9;
7250 a1.a0 = 10;
7251 a1.a1 = 11;
7252 a1.a2 = 12;
7253 a1.a3 = 13;
7254 a1.a4 = 14;
7255 a1.a5 = 15;
7256 a1.a6 = 16;
7257 a1.a7 = 17;
7258 a1.a8 = 18;
7259 a2.a0 = 19;
7260 a2.a1 = 20;
7261 a2.a2 = 21;
7262 a2.a3 = 22;
7263 a2.a4 = 23;
7264 a2.a5 = 24;
7265 a2.a6 = 25;
7266 a2.a7 = 26;
7267 a2.a8 = 27;
7268 a3.a0 = 28;
7269 a3.a1 = 29;
7270 a3.a2 = 30;
7271 a3.a3 = 31;
7272 a3.a4 = 32;
7273 a3.a5 = 33;
7274 a3.a6 = 34;
7275 a3.a7 = 35;
7276 a3.a8 = 36;
7277 a4.a0 = 37;
7278 a4.a1 = 38;
7279 a4.a2 = 39;
7280 a4.a3 = 40;
7281 a4.a4 = 41;
7282 a4.a5 = 42;
7283 a4.a6 = 43;
7284 a4.a7 = 44;
7285 a4.a8 = 45;
7286 a5.a0 = 46;
7287 a5.a1 = 47;
7288 a5.a2 = 48;
7289 a5.a3 = 49;
7290 a5.a4 = 50;
7291 a5.a5 = 51;
7292 a5.a6 = 52;
7293 a5.a7 = 53;
7294 a5.a8 = 54;
7295 a6.a0 = 55;
7296 a6.a1 = 56;
7297 a6.a2 = 57;
7298 a6.a3 = 58;
7299 a6.a4 = 59;
7300 a6.a5 = 60;
7301 a6.a6 = 61;
7302 a6.a7 = 62;
7303 a6.a8 = 63;
7304 a7.a0 = 64;
7305 a7.a1 = 65;
7306 a7.a2 = 66;
7307 a7.a3 = 67;
7308 a7.a4 = 68;
7309 a7.a5 = 69;
7310 a7.a6 = 70;
7311 a7.a7 = 71;
7312 a7.a8 = 72;
7313 a8.a0 = 73;
7314 a8.a1 = 74;
7315 a8.a2 = 75;
7316 a8.a3 = 76;
7317 a8.a4 = 77;
7318 a8.a5 = 78;
7319 a8.a6 = 79;
7320 a8.a7 = 80;
7321 a8.a8 = 81;
7322 a9.a0 = 82;
7323 a9.a1 = 83;
7324 a9.a2 = 84;
7325 a9.a3 = 85;
7326 a9.a4 = 86;
7327 a9.a5 = 87;
7328 a9.a6 = 88;
7329 a9.a7 = 89;
7330 a9.a8 = 90;
7331
7332 std::cout
7333 << "Calling TestPassStruct9BytesHomogeneousUint8x10(" << "(("
7334 << static_cast<int>(a0.a0) << ", " << static_cast<int>(a0.a1) << ", "
7335 << static_cast<int>(a0.a2) << ", " << static_cast<int>(a0.a3) << ", "
7336 << static_cast<int>(a0.a4) << ", " << static_cast<int>(a0.a5) << ", "
7337 << static_cast<int>(a0.a6) << ", " << static_cast<int>(a0.a7) << ", "
7338 << static_cast<int>(a0.a8) << "), (" << static_cast<int>(a1.a0) << ", "
7339 << static_cast<int>(a1.a1) << ", " << static_cast<int>(a1.a2) << ", "
7340 << static_cast<int>(a1.a3) << ", " << static_cast<int>(a1.a4) << ", "
7341 << static_cast<int>(a1.a5) << ", " << static_cast<int>(a1.a6) << ", "
7342 << static_cast<int>(a1.a7) << ", " << static_cast<int>(a1.a8) << "), ("
7343 << static_cast<int>(a2.a0) << ", " << static_cast<int>(a2.a1) << ", "
7344 << static_cast<int>(a2.a2) << ", " << static_cast<int>(a2.a3) << ", "
7345 << static_cast<int>(a2.a4) << ", " << static_cast<int>(a2.a5) << ", "
7346 << static_cast<int>(a2.a6) << ", " << static_cast<int>(a2.a7) << ", "
7347 << static_cast<int>(a2.a8) << "), (" << static_cast<int>(a3.a0) << ", "
7348 << static_cast<int>(a3.a1) << ", " << static_cast<int>(a3.a2) << ", "
7349 << static_cast<int>(a3.a3) << ", " << static_cast<int>(a3.a4) << ", "
7350 << static_cast<int>(a3.a5) << ", " << static_cast<int>(a3.a6) << ", "
7351 << static_cast<int>(a3.a7) << ", " << static_cast<int>(a3.a8) << "), ("
7352 << static_cast<int>(a4.a0) << ", " << static_cast<int>(a4.a1) << ", "
7353 << static_cast<int>(a4.a2) << ", " << static_cast<int>(a4.a3) << ", "
7354 << static_cast<int>(a4.a4) << ", " << static_cast<int>(a4.a5) << ", "
7355 << static_cast<int>(a4.a6) << ", " << static_cast<int>(a4.a7) << ", "
7356 << static_cast<int>(a4.a8) << "), (" << static_cast<int>(a5.a0) << ", "
7357 << static_cast<int>(a5.a1) << ", " << static_cast<int>(a5.a2) << ", "
7358 << static_cast<int>(a5.a3) << ", " << static_cast<int>(a5.a4) << ", "
7359 << static_cast<int>(a5.a5) << ", " << static_cast<int>(a5.a6) << ", "
7360 << static_cast<int>(a5.a7) << ", " << static_cast<int>(a5.a8) << "), ("
7361 << static_cast<int>(a6.a0) << ", " << static_cast<int>(a6.a1) << ", "
7362 << static_cast<int>(a6.a2) << ", " << static_cast<int>(a6.a3) << ", "
7363 << static_cast<int>(a6.a4) << ", " << static_cast<int>(a6.a5) << ", "
7364 << static_cast<int>(a6.a6) << ", " << static_cast<int>(a6.a7) << ", "
7365 << static_cast<int>(a6.a8) << "), (" << static_cast<int>(a7.a0) << ", "
7366 << static_cast<int>(a7.a1) << ", " << static_cast<int>(a7.a2) << ", "
7367 << static_cast<int>(a7.a3) << ", " << static_cast<int>(a7.a4) << ", "
7368 << static_cast<int>(a7.a5) << ", " << static_cast<int>(a7.a6) << ", "
7369 << static_cast<int>(a7.a7) << ", " << static_cast<int>(a7.a8) << "), ("
7370 << static_cast<int>(a8.a0) << ", " << static_cast<int>(a8.a1) << ", "
7371 << static_cast<int>(a8.a2) << ", " << static_cast<int>(a8.a3) << ", "
7372 << static_cast<int>(a8.a4) << ", " << static_cast<int>(a8.a5) << ", "
7373 << static_cast<int>(a8.a6) << ", " << static_cast<int>(a8.a7) << ", "
7374 << static_cast<int>(a8.a8) << "), (" << static_cast<int>(a9.a0) << ", "
7375 << static_cast<int>(a9.a1) << ", " << static_cast<int>(a9.a2) << ", "
7376 << static_cast<int>(a9.a3) << ", " << static_cast<int>(a9.a4) << ", "
7377 << static_cast<int>(a9.a5) << ", " << static_cast<int>(a9.a6) << ", "
7378 << static_cast<int>(a9.a7) << ", " << static_cast<int>(a9.a8) << "))"
7379 << ")\n";
7380
7381 int64_t result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
7382
7383 std::cout << "result = " << result << "\n";
7384
7385 CHECK_EQ(4095, result);
7386
7387 // Pass argument that will make the Dart callback throw.
7388 a0.a0 = 42;
7389
7390 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
7391
7392 CHECK_EQ(0, result);
7393
7394 // Pass argument that will make the Dart callback return null.
7395 a0.a0 = 84;
7396
7397 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
7398
7399 CHECK_EQ(0, result);
7400
7401 return 0;
7402}

◆ TestPassStruct9BytesInt4Or8ByteAlignedx10()

Definition at line 7409 of file ffi_test_functions_generated.cc.

7420 {
7422 Struct9BytesInt4Or8ByteAligned a1 = {};
7423 Struct9BytesInt4Or8ByteAligned a2 = {};
7424 Struct9BytesInt4Or8ByteAligned a3 = {};
7425 Struct9BytesInt4Or8ByteAligned a4 = {};
7426 Struct9BytesInt4Or8ByteAligned a5 = {};
7427 Struct9BytesInt4Or8ByteAligned a6 = {};
7428 Struct9BytesInt4Or8ByteAligned a7 = {};
7429 Struct9BytesInt4Or8ByteAligned a8 = {};
7430 Struct9BytesInt4Or8ByteAligned a9 = {};
7431
7432 a0.a0 = -1;
7433 a0.a1 = 2;
7434 a1.a0 = -3;
7435 a1.a1 = 4;
7436 a2.a0 = -5;
7437 a2.a1 = 6;
7438 a3.a0 = -7;
7439 a3.a1 = 8;
7440 a4.a0 = -9;
7441 a4.a1 = 10;
7442 a5.a0 = -11;
7443 a5.a1 = 12;
7444 a6.a0 = -13;
7445 a6.a1 = 14;
7446 a7.a0 = -15;
7447 a7.a1 = 16;
7448 a8.a0 = -17;
7449 a8.a1 = 18;
7450 a9.a0 = -19;
7451 a9.a1 = 20;
7452
7453 std::cout << "Calling TestPassStruct9BytesInt4Or8ByteAlignedx10(" << "(("
7454 << a0.a0 << ", " << static_cast<int>(a0.a1) << "), (" << a1.a0
7455 << ", " << static_cast<int>(a1.a1) << "), (" << a2.a0 << ", "
7456 << static_cast<int>(a2.a1) << "), (" << a3.a0 << ", "
7457 << static_cast<int>(a3.a1) << "), (" << a4.a0 << ", "
7458 << static_cast<int>(a4.a1) << "), (" << a5.a0 << ", "
7459 << static_cast<int>(a5.a1) << "), (" << a6.a0 << ", "
7460 << static_cast<int>(a6.a1) << "), (" << a7.a0 << ", "
7461 << static_cast<int>(a7.a1) << "), (" << a8.a0 << ", "
7462 << static_cast<int>(a8.a1) << "), (" << a9.a0 << ", "
7463 << static_cast<int>(a9.a1) << "))" << ")\n";
7464
7465 int64_t result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
7466
7467 std::cout << "result = " << result << "\n";
7468
7469 CHECK_EQ(10, result);
7470
7471 // Pass argument that will make the Dart callback throw.
7472 a0.a0 = 42;
7473
7474 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
7475
7476 CHECK_EQ(0, result);
7477
7478 // Pass argument that will make the Dart callback return null.
7479 a0.a0 = 84;
7480
7481 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
7482
7483 CHECK_EQ(0, result);
7484
7485 return 0;
7486}

◆ TestPassStruct9BytesPackedMixedx10DoubleInt32x2()

DART_EXPORT intptr_t dart::TestPassStruct9BytesPackedMixedx10DoubleInt32x2 ( double(*)(Struct9BytesPackedMixed a0, Struct9BytesPackedMixed a1, Struct9BytesPackedMixed a2, Struct9BytesPackedMixed a3, Struct9BytesPackedMixed a4, Struct9BytesPackedMixed a5, Struct9BytesPackedMixed a6, Struct9BytesPackedMixed a7, Struct9BytesPackedMixed a8, Struct9BytesPackedMixed a9, double a10, int32_t a11, int32_t a12)  f)

Definition at line 11341 of file ffi_test_functions_generated.cc.

11355 {
11357 Struct9BytesPackedMixed a1 = {};
11358 Struct9BytesPackedMixed a2 = {};
11359 Struct9BytesPackedMixed a3 = {};
11360 Struct9BytesPackedMixed a4 = {};
11361 Struct9BytesPackedMixed a5 = {};
11362 Struct9BytesPackedMixed a6 = {};
11363 Struct9BytesPackedMixed a7 = {};
11364 Struct9BytesPackedMixed a8 = {};
11365 Struct9BytesPackedMixed a9 = {};
11366 double a10;
11367 int32_t a11;
11368 int32_t a12;
11369
11370 a0.a0 = 1;
11371 a0.a1 = 2.0;
11372 a1.a0 = 3;
11373 a1.a1 = 4.0;
11374 a2.a0 = 5;
11375 a2.a1 = 6.0;
11376 a3.a0 = 7;
11377 a3.a1 = 8.0;
11378 a4.a0 = 9;
11379 a4.a1 = 10.0;
11380 a5.a0 = 11;
11381 a5.a1 = 12.0;
11382 a6.a0 = 13;
11383 a6.a1 = 14.0;
11384 a7.a0 = 15;
11385 a7.a1 = 16.0;
11386 a8.a0 = 17;
11387 a8.a1 = 18.0;
11388 a9.a0 = 19;
11389 a9.a1 = 20.0;
11390 a10 = -21.0;
11391 a11 = 22;
11392 a12 = -23;
11393
11394 std::cout << "Calling TestPassStruct9BytesPackedMixedx10DoubleInt32x2("
11395 << "((" << static_cast<int>(a0.a0) << ", " << a0.a1 << "), ("
11396 << static_cast<int>(a1.a0) << ", " << a1.a1 << "), ("
11397 << static_cast<int>(a2.a0) << ", " << a2.a1 << "), ("
11398 << static_cast<int>(a3.a0) << ", " << a3.a1 << "), ("
11399 << static_cast<int>(a4.a0) << ", " << a4.a1 << "), ("
11400 << static_cast<int>(a5.a0) << ", " << a5.a1 << "), ("
11401 << static_cast<int>(a6.a0) << ", " << a6.a1 << "), ("
11402 << static_cast<int>(a7.a0) << ", " << a7.a1 << "), ("
11403 << static_cast<int>(a8.a0) << ", " << a8.a1 << "), ("
11404 << static_cast<int>(a9.a0) << ", " << a9.a1 << "), " << a10 << ", "
11405 << a11 << ", " << a12 << ")" << ")\n";
11406
11407 double result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12);
11408
11409 std::cout << "result = " << result << "\n";
11410
11411 CHECK_APPROX(188.0, result);
11412
11413 // Pass argument that will make the Dart callback throw.
11414 a0.a0 = 42;
11415
11416 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12);
11417
11418 CHECK_APPROX(0.0, result);
11419
11420 // Pass argument that will make the Dart callback return null.
11421 a0.a0 = 84;
11422
11423 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12);
11424
11425 CHECK_APPROX(0.0, result);
11426
11427 return 0;
11428}

◆ TestPassStructAlignmentInt16()

DART_EXPORT intptr_t dart::TestPassStructAlignmentInt16 ( int64_t(*)(StructAlignmentInt16 a0)  f)

Definition at line 9316 of file ffi_test_functions_generated.cc.

9318 {
9319 StructAlignmentInt16 a0 = {};
9320
9321 a0.a0 = -1;
9322 a0.a1 = 2;
9323 a0.a2 = -3;
9324
9325 std::cout << "Calling TestPassStructAlignmentInt16(" << "(("
9326 << static_cast<int>(a0.a0) << ", " << a0.a1 << ", "
9327 << static_cast<int>(a0.a2) << "))" << ")\n";
9328
9329 int64_t result = f(a0);
9330
9331 std::cout << "result = " << result << "\n";
9332
9333 CHECK_EQ(-2, result);
9334
9335 // Pass argument that will make the Dart callback throw.
9336 a0.a0 = 42;
9337
9338 result = f(a0);
9339
9340 CHECK_EQ(0, result);
9341
9342 // Pass argument that will make the Dart callback return null.
9343 a0.a0 = 84;
9344
9345 result = f(a0);
9346
9347 CHECK_EQ(0, result);
9348
9349 return 0;
9350}

◆ TestPassStructAlignmentInt32()

DART_EXPORT intptr_t dart::TestPassStructAlignmentInt32 ( int64_t(*)(StructAlignmentInt32 a0)  f)

Definition at line 9354 of file ffi_test_functions_generated.cc.

9356 {
9357 StructAlignmentInt32 a0 = {};
9358
9359 a0.a0 = -1;
9360 a0.a1 = 2;
9361 a0.a2 = -3;
9362
9363 std::cout << "Calling TestPassStructAlignmentInt32(" << "(("
9364 << static_cast<int>(a0.a0) << ", " << a0.a1 << ", "
9365 << static_cast<int>(a0.a2) << "))" << ")\n";
9366
9367 int64_t result = f(a0);
9368
9369 std::cout << "result = " << result << "\n";
9370
9371 CHECK_EQ(-2, result);
9372
9373 // Pass argument that will make the Dart callback throw.
9374 a0.a0 = 42;
9375
9376 result = f(a0);
9377
9378 CHECK_EQ(0, result);
9379
9380 // Pass argument that will make the Dart callback return null.
9381 a0.a0 = 84;
9382
9383 result = f(a0);
9384
9385 CHECK_EQ(0, result);
9386
9387 return 0;
9388}

◆ TestPassStructAlignmentInt64()

DART_EXPORT intptr_t dart::TestPassStructAlignmentInt64 ( int64_t(*)(StructAlignmentInt64 a0)  f)

Definition at line 9392 of file ffi_test_functions_generated.cc.

9394 {
9395 StructAlignmentInt64 a0 = {};
9396
9397 a0.a0 = -1;
9398 a0.a1 = 2;
9399 a0.a2 = -3;
9400
9401 std::cout << "Calling TestPassStructAlignmentInt64(" << "(("
9402 << static_cast<int>(a0.a0) << ", " << a0.a1 << ", "
9403 << static_cast<int>(a0.a2) << "))" << ")\n";
9404
9405 int64_t result = f(a0);
9406
9407 std::cout << "result = " << result << "\n";
9408
9409 CHECK_EQ(-2, result);
9410
9411 // Pass argument that will make the Dart callback throw.
9412 a0.a0 = 42;
9413
9414 result = f(a0);
9415
9416 CHECK_EQ(0, result);
9417
9418 // Pass argument that will make the Dart callback return null.
9419 a0.a0 = 84;
9420
9421 result = f(a0);
9422
9423 CHECK_EQ(0, result);
9424
9425 return 0;
9426}

◆ TestPassStructInlineArray100Bytes()

DART_EXPORT intptr_t dart::TestPassStructInlineArray100Bytes ( int32_t(*)(StructInlineArray100Bytes a0)  f)

Definition at line 10452 of file ffi_test_functions_generated.cc.

10454 {
10456
10457 a0.a0[0] = 1;
10458 a0.a0[1] = 2;
10459 a0.a0[2] = 3;
10460 a0.a0[3] = 4;
10461 a0.a0[4] = 5;
10462 a0.a0[5] = 6;
10463 a0.a0[6] = 7;
10464 a0.a0[7] = 8;
10465 a0.a0[8] = 9;
10466 a0.a0[9] = 10;
10467 a0.a0[10] = 11;
10468 a0.a0[11] = 12;
10469 a0.a0[12] = 13;
10470 a0.a0[13] = 14;
10471 a0.a0[14] = 15;
10472 a0.a0[15] = 16;
10473 a0.a0[16] = 17;
10474 a0.a0[17] = 18;
10475 a0.a0[18] = 19;
10476 a0.a0[19] = 20;
10477 a0.a0[20] = 21;
10478 a0.a0[21] = 22;
10479 a0.a0[22] = 23;
10480 a0.a0[23] = 24;
10481 a0.a0[24] = 25;
10482 a0.a0[25] = 26;
10483 a0.a0[26] = 27;
10484 a0.a0[27] = 28;
10485 a0.a0[28] = 29;
10486 a0.a0[29] = 30;
10487 a0.a0[30] = 31;
10488 a0.a0[31] = 32;
10489 a0.a0[32] = 33;
10490 a0.a0[33] = 34;
10491 a0.a0[34] = 35;
10492 a0.a0[35] = 36;
10493 a0.a0[36] = 37;
10494 a0.a0[37] = 38;
10495 a0.a0[38] = 39;
10496 a0.a0[39] = 40;
10497 a0.a0[40] = 41;
10498 a0.a0[41] = 42;
10499 a0.a0[42] = 43;
10500 a0.a0[43] = 44;
10501 a0.a0[44] = 45;
10502 a0.a0[45] = 46;
10503 a0.a0[46] = 47;
10504 a0.a0[47] = 48;
10505 a0.a0[48] = 49;
10506 a0.a0[49] = 50;
10507 a0.a0[50] = 51;
10508 a0.a0[51] = 52;
10509 a0.a0[52] = 53;
10510 a0.a0[53] = 54;
10511 a0.a0[54] = 55;
10512 a0.a0[55] = 56;
10513 a0.a0[56] = 57;
10514 a0.a0[57] = 58;
10515 a0.a0[58] = 59;
10516 a0.a0[59] = 60;
10517 a0.a0[60] = 61;
10518 a0.a0[61] = 62;
10519 a0.a0[62] = 63;
10520 a0.a0[63] = 64;
10521 a0.a0[64] = 65;
10522 a0.a0[65] = 66;
10523 a0.a0[66] = 67;
10524 a0.a0[67] = 68;
10525 a0.a0[68] = 69;
10526 a0.a0[69] = 70;
10527 a0.a0[70] = 71;
10528 a0.a0[71] = 72;
10529 a0.a0[72] = 73;
10530 a0.a0[73] = 74;
10531 a0.a0[74] = 75;
10532 a0.a0[75] = 76;
10533 a0.a0[76] = 77;
10534 a0.a0[77] = 78;
10535 a0.a0[78] = 79;
10536 a0.a0[79] = 80;
10537 a0.a0[80] = 81;
10538 a0.a0[81] = 82;
10539 a0.a0[82] = 83;
10540 a0.a0[83] = 84;
10541 a0.a0[84] = 85;
10542 a0.a0[85] = 86;
10543 a0.a0[86] = 87;
10544 a0.a0[87] = 88;
10545 a0.a0[88] = 89;
10546 a0.a0[89] = 90;
10547 a0.a0[90] = 91;
10548 a0.a0[91] = 92;
10549 a0.a0[92] = 93;
10550 a0.a0[93] = 94;
10551 a0.a0[94] = 95;
10552 a0.a0[95] = 96;
10553 a0.a0[96] = 97;
10554 a0.a0[97] = 98;
10555 a0.a0[98] = 99;
10556 a0.a0[99] = 100;
10557
10558 std::cout
10559 << "Calling TestPassStructInlineArray100Bytes(" << "((["
10560 << static_cast<int>(a0.a0[0]) << ", " << static_cast<int>(a0.a0[1])
10561 << ", " << static_cast<int>(a0.a0[2]) << ", "
10562 << static_cast<int>(a0.a0[3]) << ", " << static_cast<int>(a0.a0[4])
10563 << ", " << static_cast<int>(a0.a0[5]) << ", "
10564 << static_cast<int>(a0.a0[6]) << ", " << static_cast<int>(a0.a0[7])
10565 << ", " << static_cast<int>(a0.a0[8]) << ", "
10566 << static_cast<int>(a0.a0[9]) << ", " << static_cast<int>(a0.a0[10])
10567 << ", " << static_cast<int>(a0.a0[11]) << ", "
10568 << static_cast<int>(a0.a0[12]) << ", " << static_cast<int>(a0.a0[13])
10569 << ", " << static_cast<int>(a0.a0[14]) << ", "
10570 << static_cast<int>(a0.a0[15]) << ", " << static_cast<int>(a0.a0[16])
10571 << ", " << static_cast<int>(a0.a0[17]) << ", "
10572 << static_cast<int>(a0.a0[18]) << ", " << static_cast<int>(a0.a0[19])
10573 << ", " << static_cast<int>(a0.a0[20]) << ", "
10574 << static_cast<int>(a0.a0[21]) << ", " << static_cast<int>(a0.a0[22])
10575 << ", " << static_cast<int>(a0.a0[23]) << ", "
10576 << static_cast<int>(a0.a0[24]) << ", " << static_cast<int>(a0.a0[25])
10577 << ", " << static_cast<int>(a0.a0[26]) << ", "
10578 << static_cast<int>(a0.a0[27]) << ", " << static_cast<int>(a0.a0[28])
10579 << ", " << static_cast<int>(a0.a0[29]) << ", "
10580 << static_cast<int>(a0.a0[30]) << ", " << static_cast<int>(a0.a0[31])
10581 << ", " << static_cast<int>(a0.a0[32]) << ", "
10582 << static_cast<int>(a0.a0[33]) << ", " << static_cast<int>(a0.a0[34])
10583 << ", " << static_cast<int>(a0.a0[35]) << ", "
10584 << static_cast<int>(a0.a0[36]) << ", " << static_cast<int>(a0.a0[37])
10585 << ", " << static_cast<int>(a0.a0[38]) << ", "
10586 << static_cast<int>(a0.a0[39]) << ", " << static_cast<int>(a0.a0[40])
10587 << ", " << static_cast<int>(a0.a0[41]) << ", "
10588 << static_cast<int>(a0.a0[42]) << ", " << static_cast<int>(a0.a0[43])
10589 << ", " << static_cast<int>(a0.a0[44]) << ", "
10590 << static_cast<int>(a0.a0[45]) << ", " << static_cast<int>(a0.a0[46])
10591 << ", " << static_cast<int>(a0.a0[47]) << ", "
10592 << static_cast<int>(a0.a0[48]) << ", " << static_cast<int>(a0.a0[49])
10593 << ", " << static_cast<int>(a0.a0[50]) << ", "
10594 << static_cast<int>(a0.a0[51]) << ", " << static_cast<int>(a0.a0[52])
10595 << ", " << static_cast<int>(a0.a0[53]) << ", "
10596 << static_cast<int>(a0.a0[54]) << ", " << static_cast<int>(a0.a0[55])
10597 << ", " << static_cast<int>(a0.a0[56]) << ", "
10598 << static_cast<int>(a0.a0[57]) << ", " << static_cast<int>(a0.a0[58])
10599 << ", " << static_cast<int>(a0.a0[59]) << ", "
10600 << static_cast<int>(a0.a0[60]) << ", " << static_cast<int>(a0.a0[61])
10601 << ", " << static_cast<int>(a0.a0[62]) << ", "
10602 << static_cast<int>(a0.a0[63]) << ", " << static_cast<int>(a0.a0[64])
10603 << ", " << static_cast<int>(a0.a0[65]) << ", "
10604 << static_cast<int>(a0.a0[66]) << ", " << static_cast<int>(a0.a0[67])
10605 << ", " << static_cast<int>(a0.a0[68]) << ", "
10606 << static_cast<int>(a0.a0[69]) << ", " << static_cast<int>(a0.a0[70])
10607 << ", " << static_cast<int>(a0.a0[71]) << ", "
10608 << static_cast<int>(a0.a0[72]) << ", " << static_cast<int>(a0.a0[73])
10609 << ", " << static_cast<int>(a0.a0[74]) << ", "
10610 << static_cast<int>(a0.a0[75]) << ", " << static_cast<int>(a0.a0[76])
10611 << ", " << static_cast<int>(a0.a0[77]) << ", "
10612 << static_cast<int>(a0.a0[78]) << ", " << static_cast<int>(a0.a0[79])
10613 << ", " << static_cast<int>(a0.a0[80]) << ", "
10614 << static_cast<int>(a0.a0[81]) << ", " << static_cast<int>(a0.a0[82])
10615 << ", " << static_cast<int>(a0.a0[83]) << ", "
10616 << static_cast<int>(a0.a0[84]) << ", " << static_cast<int>(a0.a0[85])
10617 << ", " << static_cast<int>(a0.a0[86]) << ", "
10618 << static_cast<int>(a0.a0[87]) << ", " << static_cast<int>(a0.a0[88])
10619 << ", " << static_cast<int>(a0.a0[89]) << ", "
10620 << static_cast<int>(a0.a0[90]) << ", " << static_cast<int>(a0.a0[91])
10621 << ", " << static_cast<int>(a0.a0[92]) << ", "
10622 << static_cast<int>(a0.a0[93]) << ", " << static_cast<int>(a0.a0[94])
10623 << ", " << static_cast<int>(a0.a0[95]) << ", "
10624 << static_cast<int>(a0.a0[96]) << ", " << static_cast<int>(a0.a0[97])
10625 << ", " << static_cast<int>(a0.a0[98]) << ", "
10626 << static_cast<int>(a0.a0[99]) << "]))" << ")\n";
10627
10628 int32_t result = f(a0);
10629
10630 std::cout << "result = " << result << "\n";
10631
10632 CHECK_EQ(5050, result);
10633
10634 // Pass argument that will make the Dart callback throw.
10635 a0.a0[0] = 42;
10636
10637 result = f(a0);
10638
10639 CHECK_EQ(0, result);
10640
10641 // Pass argument that will make the Dart callback return null.
10642 a0.a0[0] = 84;
10643
10644 result = f(a0);
10645
10646 CHECK_EQ(0, result);
10647
10648 return 0;
10649}

◆ TestPassStructInlineArrayIrregularx4()

DART_EXPORT intptr_t dart::TestPassStructInlineArrayIrregularx4 ( int32_t(*)(StructInlineArrayIrregular a0, StructInlineArrayIrregular a1, StructInlineArrayIrregular a2, StructInlineArrayIrregular a3)  f)

Definition at line 10381 of file ffi_test_functions_generated.cc.

10386 {
10388 StructInlineArrayIrregular a1 = {};
10389 StructInlineArrayIrregular a2 = {};
10390 StructInlineArrayIrregular a3 = {};
10391
10392 a0.a0[0].a0 = -1;
10393 a0.a0[0].a1 = 2;
10394 a0.a0[1].a0 = -3;
10395 a0.a0[1].a1 = 4;
10396 a0.a1 = 5;
10397 a1.a0[0].a0 = 6;
10398 a1.a0[0].a1 = -7;
10399 a1.a0[1].a0 = 8;
10400 a1.a0[1].a1 = -9;
10401 a1.a1 = 10;
10402 a2.a0[0].a0 = -11;
10403 a2.a0[0].a1 = 12;
10404 a2.a0[1].a0 = -13;
10405 a2.a0[1].a1 = 14;
10406 a2.a1 = 15;
10407 a3.a0[0].a0 = 16;
10408 a3.a0[0].a1 = -17;
10409 a3.a0[1].a0 = 18;
10410 a3.a0[1].a1 = -19;
10411 a3.a1 = 20;
10412
10413 std::cout << "Calling TestPassStructInlineArrayIrregularx4(" << "(([("
10414 << a0.a0[0].a0 << ", " << static_cast<int>(a0.a0[0].a1) << "), ("
10415 << a0.a0[1].a0 << ", " << static_cast<int>(a0.a0[1].a1) << ")], "
10416 << static_cast<int>(a0.a1) << "), ([(" << a1.a0[0].a0 << ", "
10417 << static_cast<int>(a1.a0[0].a1) << "), (" << a1.a0[1].a0 << ", "
10418 << static_cast<int>(a1.a0[1].a1) << ")], "
10419 << static_cast<int>(a1.a1) << "), ([(" << a2.a0[0].a0 << ", "
10420 << static_cast<int>(a2.a0[0].a1) << "), (" << a2.a0[1].a0 << ", "
10421 << static_cast<int>(a2.a0[1].a1) << ")], "
10422 << static_cast<int>(a2.a1) << "), ([(" << a3.a0[0].a0 << ", "
10423 << static_cast<int>(a3.a0[0].a1) << "), (" << a3.a0[1].a0 << ", "
10424 << static_cast<int>(a3.a0[1].a1) << ")], "
10425 << static_cast<int>(a3.a1) << "))" << ")\n";
10426
10427 int32_t result = f(a0, a1, a2, a3);
10428
10429 std::cout << "result = " << result << "\n";
10430
10431 CHECK_EQ(50, result);
10432
10433 // Pass argument that will make the Dart callback throw.
10434 a0.a0[0].a0 = 42;
10435
10436 result = f(a0, a1, a2, a3);
10437
10438 CHECK_EQ(0, result);
10439
10440 // Pass argument that will make the Dart callback return null.
10441 a0.a0[0].a0 = 84;
10442
10443 result = f(a0, a1, a2, a3);
10444
10445 CHECK_EQ(0, result);
10446
10447 return 0;
10448}

◆ TestPassStructNestedAlignmentStruct5BytesPackedMixed()

DART_EXPORT intptr_t dart::TestPassStructNestedAlignmentStruct5BytesPackedMixed ( double(*)(StructNestedAlignmentStruct5BytesPackedMixed a0)  f)

Definition at line 11468 of file ffi_test_functions_generated.cc.

11470 {
11472
11473 a0.a0 = 1;
11474 a0.a1.a0 = 2.0;
11475 a0.a1.a1 = 3;
11476
11477 std::cout << "Calling TestPassStructNestedAlignmentStruct5BytesPackedMixed("
11478 << "((" << static_cast<int>(a0.a0) << ", (" << a0.a1.a0 << ", "
11479 << static_cast<int>(a0.a1.a1) << ")))" << ")\n";
11480
11481 double result = f(a0);
11482
11483 std::cout << "result = " << result << "\n";
11484
11485 CHECK_APPROX(6.0, result);
11486
11487 // Pass argument that will make the Dart callback throw.
11488 a0.a0 = 42;
11489
11490 result = f(a0);
11491
11492 CHECK_APPROX(0.0, result);
11493
11494 // Pass argument that will make the Dart callback return null.
11495 a0.a0 = 84;
11496
11497 result = f(a0);
11498
11499 CHECK_APPROX(0.0, result);
11500
11501 return 0;
11502}

◆ TestPassStructNestedIntStructAlignmentInt16()

DART_EXPORT intptr_t dart::TestPassStructNestedIntStructAlignmentInt16 ( int64_t(*)(StructNestedIntStructAlignmentInt16 a0)  f)

Definition at line 9929 of file ffi_test_functions_generated.cc.

9931 {
9933
9934 a0.a0.a0 = -1;
9935 a0.a0.a1 = 2;
9936 a0.a0.a2 = -3;
9937 a0.a1.a0 = 4;
9938 a0.a1.a1 = -5;
9939 a0.a1.a2 = 6;
9940
9941 std::cout << "Calling TestPassStructNestedIntStructAlignmentInt16(" << "((("
9942 << static_cast<int>(a0.a0.a0) << ", " << a0.a0.a1 << ", "
9943 << static_cast<int>(a0.a0.a2) << "), ("
9944 << static_cast<int>(a0.a1.a0) << ", " << a0.a1.a1 << ", "
9945 << static_cast<int>(a0.a1.a2) << ")))" << ")\n";
9946
9947 int64_t result = f(a0);
9948
9949 std::cout << "result = " << result << "\n";
9950
9951 CHECK_EQ(3, result);
9952
9953 // Pass argument that will make the Dart callback throw.
9954 a0.a0.a0 = 42;
9955
9956 result = f(a0);
9957
9958 CHECK_EQ(0, result);
9959
9960 // Pass argument that will make the Dart callback return null.
9961 a0.a0.a0 = 84;
9962
9963 result = f(a0);
9964
9965 CHECK_EQ(0, result);
9966
9967 return 0;
9968}

◆ TestPassStructNestedIntStructAlignmentInt32()

DART_EXPORT intptr_t dart::TestPassStructNestedIntStructAlignmentInt32 ( int64_t(*)(StructNestedIntStructAlignmentInt32 a0)  f)

Definition at line 9972 of file ffi_test_functions_generated.cc.

9974 {
9976
9977 a0.a0.a0 = -1;
9978 a0.a0.a1 = 2;
9979 a0.a0.a2 = -3;
9980 a0.a1.a0 = 4;
9981 a0.a1.a1 = -5;
9982 a0.a1.a2 = 6;
9983
9984 std::cout << "Calling TestPassStructNestedIntStructAlignmentInt32(" << "((("
9985 << static_cast<int>(a0.a0.a0) << ", " << a0.a0.a1 << ", "
9986 << static_cast<int>(a0.a0.a2) << "), ("
9987 << static_cast<int>(a0.a1.a0) << ", " << a0.a1.a1 << ", "
9988 << static_cast<int>(a0.a1.a2) << ")))" << ")\n";
9989
9990 int64_t result = f(a0);
9991
9992 std::cout << "result = " << result << "\n";
9993
9994 CHECK_EQ(3, result);
9995
9996 // Pass argument that will make the Dart callback throw.
9997 a0.a0.a0 = 42;
9998
9999 result = f(a0);
10000
10001 CHECK_EQ(0, result);
10002
10003 // Pass argument that will make the Dart callback return null.
10004 a0.a0.a0 = 84;
10005
10006 result = f(a0);
10007
10008 CHECK_EQ(0, result);
10009
10010 return 0;
10011}

◆ TestPassStructNestedIntStructAlignmentInt64()

DART_EXPORT intptr_t dart::TestPassStructNestedIntStructAlignmentInt64 ( int64_t(*)(StructNestedIntStructAlignmentInt64 a0)  f)

Definition at line 10015 of file ffi_test_functions_generated.cc.

10017 {
10019
10020 a0.a0.a0 = -1;
10021 a0.a0.a1 = 2;
10022 a0.a0.a2 = -3;
10023 a0.a1.a0 = 4;
10024 a0.a1.a1 = -5;
10025 a0.a1.a2 = 6;
10026
10027 std::cout << "Calling TestPassStructNestedIntStructAlignmentInt64(" << "((("
10028 << static_cast<int>(a0.a0.a0) << ", " << a0.a0.a1 << ", "
10029 << static_cast<int>(a0.a0.a2) << "), ("
10030 << static_cast<int>(a0.a1.a0) << ", " << a0.a1.a1 << ", "
10031 << static_cast<int>(a0.a1.a2) << ")))" << ")\n";
10032
10033 int64_t result = f(a0);
10034
10035 std::cout << "result = " << result << "\n";
10036
10037 CHECK_EQ(3, result);
10038
10039 // Pass argument that will make the Dart callback throw.
10040 a0.a0.a0 = 42;
10041
10042 result = f(a0);
10043
10044 CHECK_EQ(0, result);
10045
10046 // Pass argument that will make the Dart callback return null.
10047 a0.a0.a0 = 84;
10048
10049 result = f(a0);
10050
10051 CHECK_EQ(0, result);
10052
10053 return 0;
10054}

◆ TestPassStructNestedIrregularEvenBiggerx4()

DART_EXPORT intptr_t dart::TestPassStructNestedIrregularEvenBiggerx4 ( double(*)(StructNestedIrregularEvenBigger a0, StructNestedIrregularEvenBigger a1, StructNestedIrregularEvenBigger a2, StructNestedIrregularEvenBigger a3)  f)

Definition at line 10058 of file ffi_test_functions_generated.cc.

10063 {
10065 StructNestedIrregularEvenBigger a1 = {};
10066 StructNestedIrregularEvenBigger a2 = {};
10067 StructNestedIrregularEvenBigger a3 = {};
10068
10069 a0.a0 = 1;
10070 a0.a1.a0.a0 = 2;
10071 a0.a1.a0.a1.a0.a0 = -3;
10072 a0.a1.a0.a1.a0.a1 = 4;
10073 a0.a1.a0.a1.a1.a0 = -5.0;
10074 a0.a1.a0.a2 = 6;
10075 a0.a1.a0.a3.a0.a0 = -7.0;
10076 a0.a1.a0.a3.a1 = 8.0;
10077 a0.a1.a0.a4 = 9;
10078 a0.a1.a0.a5.a0.a0 = 10.0;
10079 a0.a1.a0.a5.a1.a0 = -11.0;
10080 a0.a1.a0.a6 = 12;
10081 a0.a1.a1.a0.a0 = -13;
10082 a0.a1.a1.a0.a1 = 14;
10083 a0.a1.a1.a1.a0 = -15.0;
10084 a0.a1.a2 = 16.0;
10085 a0.a1.a3 = -17.0;
10086 a0.a2.a0.a0 = 18;
10087 a0.a2.a0.a1.a0.a0 = -19;
10088 a0.a2.a0.a1.a0.a1 = 20;
10089 a0.a2.a0.a1.a1.a0 = -21.0;
10090 a0.a2.a0.a2 = 22;
10091 a0.a2.a0.a3.a0.a0 = -23.0;
10092 a0.a2.a0.a3.a1 = 24.0;
10093 a0.a2.a0.a4 = 25;
10094 a0.a2.a0.a5.a0.a0 = 26.0;
10095 a0.a2.a0.a5.a1.a0 = -27.0;
10096 a0.a2.a0.a6 = 28;
10097 a0.a2.a1.a0.a0 = -29;
10098 a0.a2.a1.a0.a1 = 30;
10099 a0.a2.a1.a1.a0 = -31.0;
10100 a0.a2.a2 = 32.0;
10101 a0.a2.a3 = -33.0;
10102 a0.a3 = 34.0;
10103 a1.a0 = 35;
10104 a1.a1.a0.a0 = 36;
10105 a1.a1.a0.a1.a0.a0 = -37;
10106 a1.a1.a0.a1.a0.a1 = 38;
10107 a1.a1.a0.a1.a1.a0 = -39.0;
10108 a1.a1.a0.a2 = 40;
10109 a1.a1.a0.a3.a0.a0 = -41.0;
10110 a1.a1.a0.a3.a1 = 42.0;
10111 a1.a1.a0.a4 = 43;
10112 a1.a1.a0.a5.a0.a0 = 44.0;
10113 a1.a1.a0.a5.a1.a0 = -45.0;
10114 a1.a1.a0.a6 = 46;
10115 a1.a1.a1.a0.a0 = -47;
10116 a1.a1.a1.a0.a1 = 48;
10117 a1.a1.a1.a1.a0 = -49.0;
10118 a1.a1.a2 = 50.0;
10119 a1.a1.a3 = -51.0;
10120 a1.a2.a0.a0 = 52;
10121 a1.a2.a0.a1.a0.a0 = -53;
10122 a1.a2.a0.a1.a0.a1 = 54;
10123 a1.a2.a0.a1.a1.a0 = -55.0;
10124 a1.a2.a0.a2 = 56;
10125 a1.a2.a0.a3.a0.a0 = -57.0;
10126 a1.a2.a0.a3.a1 = 58.0;
10127 a1.a2.a0.a4 = 59;
10128 a1.a2.a0.a5.a0.a0 = 60.0;
10129 a1.a2.a0.a5.a1.a0 = -61.0;
10130 a1.a2.a0.a6 = 62;
10131 a1.a2.a1.a0.a0 = -63;
10132 a1.a2.a1.a0.a1 = 64;
10133 a1.a2.a1.a1.a0 = -65.0;
10134 a1.a2.a2 = 66.0;
10135 a1.a2.a3 = -67.0;
10136 a1.a3 = 68.0;
10137 a2.a0 = 69;
10138 a2.a1.a0.a0 = 70;
10139 a2.a1.a0.a1.a0.a0 = -71;
10140 a2.a1.a0.a1.a0.a1 = 72;
10141 a2.a1.a0.a1.a1.a0 = -73.0;
10142 a2.a1.a0.a2 = 74;
10143 a2.a1.a0.a3.a0.a0 = -75.0;
10144 a2.a1.a0.a3.a1 = 76.0;
10145 a2.a1.a0.a4 = 77;
10146 a2.a1.a0.a5.a0.a0 = 78.0;
10147 a2.a1.a0.a5.a1.a0 = -79.0;
10148 a2.a1.a0.a6 = 80;
10149 a2.a1.a1.a0.a0 = -81;
10150 a2.a1.a1.a0.a1 = 82;
10151 a2.a1.a1.a1.a0 = -83.0;
10152 a2.a1.a2 = 84.0;
10153 a2.a1.a3 = -85.0;
10154 a2.a2.a0.a0 = 86;
10155 a2.a2.a0.a1.a0.a0 = -87;
10156 a2.a2.a0.a1.a0.a1 = 88;
10157 a2.a2.a0.a1.a1.a0 = -89.0;
10158 a2.a2.a0.a2 = 90;
10159 a2.a2.a0.a3.a0.a0 = -91.0;
10160 a2.a2.a0.a3.a1 = 92.0;
10161 a2.a2.a0.a4 = 93;
10162 a2.a2.a0.a5.a0.a0 = 94.0;
10163 a2.a2.a0.a5.a1.a0 = -95.0;
10164 a2.a2.a0.a6 = 96;
10165 a2.a2.a1.a0.a0 = -97;
10166 a2.a2.a1.a0.a1 = 98;
10167 a2.a2.a1.a1.a0 = -99.0;
10168 a2.a2.a2 = 100.0;
10169 a2.a2.a3 = -101.0;
10170 a2.a3 = 102.0;
10171 a3.a0 = 103;
10172 a3.a1.a0.a0 = 104;
10173 a3.a1.a0.a1.a0.a0 = -105;
10174 a3.a1.a0.a1.a0.a1 = 106;
10175 a3.a1.a0.a1.a1.a0 = -107.0;
10176 a3.a1.a0.a2 = 108;
10177 a3.a1.a0.a3.a0.a0 = -109.0;
10178 a3.a1.a0.a3.a1 = 110.0;
10179 a3.a1.a0.a4 = 111;
10180 a3.a1.a0.a5.a0.a0 = 112.0;
10181 a3.a1.a0.a5.a1.a0 = -113.0;
10182 a3.a1.a0.a6 = 114;
10183 a3.a1.a1.a0.a0 = -115;
10184 a3.a1.a1.a0.a1 = 116;
10185 a3.a1.a1.a1.a0 = -117.0;
10186 a3.a1.a2 = 118.0;
10187 a3.a1.a3 = -119.0;
10188 a3.a2.a0.a0 = 120;
10189 a3.a2.a0.a1.a0.a0 = -121;
10190 a3.a2.a0.a1.a0.a1 = 122;
10191 a3.a2.a0.a1.a1.a0 = -123.0;
10192 a3.a2.a0.a2 = 124;
10193 a3.a2.a0.a3.a0.a0 = -125.0;
10194 a3.a2.a0.a3.a1 = 126.0;
10195 a3.a2.a0.a4 = 127;
10196 a3.a2.a0.a5.a0.a0 = 128.0;
10197 a3.a2.a0.a5.a1.a0 = -129.0;
10198 a3.a2.a0.a6 = 130;
10199 a3.a2.a1.a0.a0 = -131;
10200 a3.a2.a1.a0.a1 = 132;
10201 a3.a2.a1.a1.a0 = -133.0;
10202 a3.a2.a2 = 134.0;
10203 a3.a2.a3 = -135.0;
10204 a3.a3 = 136.0;
10205
10206 std::cout
10207 << "Calling TestPassStructNestedIrregularEvenBiggerx4(" << "((" << a0.a0
10208 << ", ((" << a0.a1.a0.a0 << ", ((" << a0.a1.a0.a1.a0.a0 << ", "
10209 << a0.a1.a0.a1.a0.a1 << "), (" << a0.a1.a0.a1.a1.a0 << ")), "
10210 << a0.a1.a0.a2 << ", ((" << a0.a1.a0.a3.a0.a0 << "), " << a0.a1.a0.a3.a1
10211 << "), " << a0.a1.a0.a4 << ", ((" << a0.a1.a0.a5.a0.a0 << "), ("
10212 << a0.a1.a0.a5.a1.a0 << ")), " << a0.a1.a0.a6 << "), ((" << a0.a1.a1.a0.a0
10213 << ", " << a0.a1.a1.a0.a1 << "), (" << a0.a1.a1.a1.a0 << ")), "
10214 << a0.a1.a2 << ", " << a0.a1.a3 << "), ((" << a0.a2.a0.a0 << ", (("
10215 << a0.a2.a0.a1.a0.a0 << ", " << a0.a2.a0.a1.a0.a1 << "), ("
10216 << a0.a2.a0.a1.a1.a0 << ")), " << a0.a2.a0.a2 << ", (("
10217 << a0.a2.a0.a3.a0.a0 << "), " << a0.a2.a0.a3.a1 << "), " << a0.a2.a0.a4
10218 << ", ((" << a0.a2.a0.a5.a0.a0 << "), (" << a0.a2.a0.a5.a1.a0 << ")), "
10219 << a0.a2.a0.a6 << "), ((" << a0.a2.a1.a0.a0 << ", " << a0.a2.a1.a0.a1
10220 << "), (" << a0.a2.a1.a1.a0 << ")), " << a0.a2.a2 << ", " << a0.a2.a3
10221 << "), " << a0.a3 << "), (" << a1.a0 << ", ((" << a1.a1.a0.a0 << ", (("
10222 << a1.a1.a0.a1.a0.a0 << ", " << a1.a1.a0.a1.a0.a1 << "), ("
10223 << a1.a1.a0.a1.a1.a0 << ")), " << a1.a1.a0.a2 << ", (("
10224 << a1.a1.a0.a3.a0.a0 << "), " << a1.a1.a0.a3.a1 << "), " << a1.a1.a0.a4
10225 << ", ((" << a1.a1.a0.a5.a0.a0 << "), (" << a1.a1.a0.a5.a1.a0 << ")), "
10226 << a1.a1.a0.a6 << "), ((" << a1.a1.a1.a0.a0 << ", " << a1.a1.a1.a0.a1
10227 << "), (" << a1.a1.a1.a1.a0 << ")), " << a1.a1.a2 << ", " << a1.a1.a3
10228 << "), ((" << a1.a2.a0.a0 << ", ((" << a1.a2.a0.a1.a0.a0 << ", "
10229 << a1.a2.a0.a1.a0.a1 << "), (" << a1.a2.a0.a1.a1.a0 << ")), "
10230 << a1.a2.a0.a2 << ", ((" << a1.a2.a0.a3.a0.a0 << "), " << a1.a2.a0.a3.a1
10231 << "), " << a1.a2.a0.a4 << ", ((" << a1.a2.a0.a5.a0.a0 << "), ("
10232 << a1.a2.a0.a5.a1.a0 << ")), " << a1.a2.a0.a6 << "), ((" << a1.a2.a1.a0.a0
10233 << ", " << a1.a2.a1.a0.a1 << "), (" << a1.a2.a1.a1.a0 << ")), "
10234 << a1.a2.a2 << ", " << a1.a2.a3 << "), " << a1.a3 << "), (" << a2.a0
10235 << ", ((" << a2.a1.a0.a0 << ", ((" << a2.a1.a0.a1.a0.a0 << ", "
10236 << a2.a1.a0.a1.a0.a1 << "), (" << a2.a1.a0.a1.a1.a0 << ")), "
10237 << a2.a1.a0.a2 << ", ((" << a2.a1.a0.a3.a0.a0 << "), " << a2.a1.a0.a3.a1
10238 << "), " << a2.a1.a0.a4 << ", ((" << a2.a1.a0.a5.a0.a0 << "), ("
10239 << a2.a1.a0.a5.a1.a0 << ")), " << a2.a1.a0.a6 << "), ((" << a2.a1.a1.a0.a0
10240 << ", " << a2.a1.a1.a0.a1 << "), (" << a2.a1.a1.a1.a0 << ")), "
10241 << a2.a1.a2 << ", " << a2.a1.a3 << "), ((" << a2.a2.a0.a0 << ", (("
10242 << a2.a2.a0.a1.a0.a0 << ", " << a2.a2.a0.a1.a0.a1 << "), ("
10243 << a2.a2.a0.a1.a1.a0 << ")), " << a2.a2.a0.a2 << ", (("
10244 << a2.a2.a0.a3.a0.a0 << "), " << a2.a2.a0.a3.a1 << "), " << a2.a2.a0.a4
10245 << ", ((" << a2.a2.a0.a5.a0.a0 << "), (" << a2.a2.a0.a5.a1.a0 << ")), "
10246 << a2.a2.a0.a6 << "), ((" << a2.a2.a1.a0.a0 << ", " << a2.a2.a1.a0.a1
10247 << "), (" << a2.a2.a1.a1.a0 << ")), " << a2.a2.a2 << ", " << a2.a2.a3
10248 << "), " << a2.a3 << "), (" << a3.a0 << ", ((" << a3.a1.a0.a0 << ", (("
10249 << a3.a1.a0.a1.a0.a0 << ", " << a3.a1.a0.a1.a0.a1 << "), ("
10250 << a3.a1.a0.a1.a1.a0 << ")), " << a3.a1.a0.a2 << ", (("
10251 << a3.a1.a0.a3.a0.a0 << "), " << a3.a1.a0.a3.a1 << "), " << a3.a1.a0.a4
10252 << ", ((" << a3.a1.a0.a5.a0.a0 << "), (" << a3.a1.a0.a5.a1.a0 << ")), "
10253 << a3.a1.a0.a6 << "), ((" << a3.a1.a1.a0.a0 << ", " << a3.a1.a1.a0.a1
10254 << "), (" << a3.a1.a1.a1.a0 << ")), " << a3.a1.a2 << ", " << a3.a1.a3
10255 << "), ((" << a3.a2.a0.a0 << ", ((" << a3.a2.a0.a1.a0.a0 << ", "
10256 << a3.a2.a0.a1.a0.a1 << "), (" << a3.a2.a0.a1.a1.a0 << ")), "
10257 << a3.a2.a0.a2 << ", ((" << a3.a2.a0.a3.a0.a0 << "), " << a3.a2.a0.a3.a1
10258 << "), " << a3.a2.a0.a4 << ", ((" << a3.a2.a0.a5.a0.a0 << "), ("
10259 << a3.a2.a0.a5.a1.a0 << ")), " << a3.a2.a0.a6 << "), ((" << a3.a2.a1.a0.a0
10260 << ", " << a3.a2.a1.a0.a1 << "), (" << a3.a2.a1.a1.a0 << ")), "
10261 << a3.a2.a2 << ", " << a3.a2.a3 << "), " << a3.a3 << "))" << ")\n";
10262
10263 double result = f(a0, a1, a2, a3);
10264
10265 std::cout << "result = " << result << "\n";
10266
10267 CHECK_APPROX(1572.0, result);
10268
10269 // Pass argument that will make the Dart callback throw.
10270 a0.a0 = 42;
10271
10272 result = f(a0, a1, a2, a3);
10273
10274 CHECK_APPROX(0.0, result);
10275
10276 // Pass argument that will make the Dart callback return null.
10277 a0.a0 = 84;
10278
10279 result = f(a0, a1, a2, a3);
10280
10281 CHECK_APPROX(0.0, result);
10282
10283 return 0;
10284}

◆ TestPassStructStruct16BytesHomogeneousFloat2x5()

Definition at line 10654 of file ffi_test_functions_generated.cc.

10660 {
10662 StructStruct16BytesHomogeneousFloat2 a1 = {};
10663 StructStruct16BytesHomogeneousFloat2 a2 = {};
10664 StructStruct16BytesHomogeneousFloat2 a3 = {};
10665 StructStruct16BytesHomogeneousFloat2 a4 = {};
10666
10667 a0.a0.a0 = -1.0;
10668 a0.a1[0].a0 = 2.0;
10669 a0.a1[1].a0 = -3.0;
10670 a0.a2 = 4.0;
10671 a1.a0.a0 = -5.0;
10672 a1.a1[0].a0 = 6.0;
10673 a1.a1[1].a0 = -7.0;
10674 a1.a2 = 8.0;
10675 a2.a0.a0 = -9.0;
10676 a2.a1[0].a0 = 10.0;
10677 a2.a1[1].a0 = -11.0;
10678 a2.a2 = 12.0;
10679 a3.a0.a0 = -13.0;
10680 a3.a1[0].a0 = 14.0;
10681 a3.a1[1].a0 = -15.0;
10682 a3.a2 = 16.0;
10683 a4.a0.a0 = -17.0;
10684 a4.a1[0].a0 = 18.0;
10685 a4.a1[1].a0 = -19.0;
10686 a4.a2 = 20.0;
10687
10688 std::cout << "Calling TestPassStructStruct16BytesHomogeneousFloat2x5("
10689 << "(((" << a0.a0.a0 << "), [(" << a0.a1[0].a0 << "), ("
10690 << a0.a1[1].a0 << ")], " << a0.a2 << "), ((" << a1.a0.a0 << "), [("
10691 << a1.a1[0].a0 << "), (" << a1.a1[1].a0 << ")], " << a1.a2
10692 << "), ((" << a2.a0.a0 << "), [(" << a2.a1[0].a0 << "), ("
10693 << a2.a1[1].a0 << ")], " << a2.a2 << "), ((" << a3.a0.a0 << "), [("
10694 << a3.a1[0].a0 << "), (" << a3.a1[1].a0 << ")], " << a3.a2
10695 << "), ((" << a4.a0.a0 << "), [(" << a4.a1[0].a0 << "), ("
10696 << a4.a1[1].a0 << ")], " << a4.a2 << "))" << ")\n";
10697
10698 float result = f(a0, a1, a2, a3, a4);
10699
10700 std::cout << "result = " << result << "\n";
10701
10702 CHECK_APPROX(10.0, result);
10703
10704 // Pass argument that will make the Dart callback throw.
10705 a0.a0.a0 = 42;
10706
10707 result = f(a0, a1, a2, a3, a4);
10708
10709 CHECK_APPROX(0.0, result);
10710
10711 // Pass argument that will make the Dart callback return null.
10712 a0.a0.a0 = 84;
10713
10714 result = f(a0, a1, a2, a3, a4);
10715
10716 CHECK_APPROX(0.0, result);
10717
10718 return 0;
10719}

◆ TestPassStructStruct16BytesMixed3x10()

Definition at line 10796 of file ffi_test_functions_generated.cc.

10807 {
10809 StructStruct16BytesMixed3 a1 = {};
10810 StructStruct16BytesMixed3 a2 = {};
10811 StructStruct16BytesMixed3 a3 = {};
10812 StructStruct16BytesMixed3 a4 = {};
10813 StructStruct16BytesMixed3 a5 = {};
10814 StructStruct16BytesMixed3 a6 = {};
10815 StructStruct16BytesMixed3 a7 = {};
10816 StructStruct16BytesMixed3 a8 = {};
10817 StructStruct16BytesMixed3 a9 = {};
10818
10819 a0.a0.a0 = -1.0;
10820 a0.a1[0].a0 = 2.0;
10821 a0.a1[0].a1 = -3;
10822 a0.a1[0].a2 = 4;
10823 a0.a2[0] = -5;
10824 a0.a2[1] = 6;
10825 a1.a0.a0 = -7.0;
10826 a1.a1[0].a0 = 8.0;
10827 a1.a1[0].a1 = -9;
10828 a1.a1[0].a2 = 10;
10829 a1.a2[0] = -11;
10830 a1.a2[1] = 12;
10831 a2.a0.a0 = -13.0;
10832 a2.a1[0].a0 = 14.0;
10833 a2.a1[0].a1 = -15;
10834 a2.a1[0].a2 = 16;
10835 a2.a2[0] = -17;
10836 a2.a2[1] = 18;
10837 a3.a0.a0 = -19.0;
10838 a3.a1[0].a0 = 20.0;
10839 a3.a1[0].a1 = -21;
10840 a3.a1[0].a2 = 22;
10841 a3.a2[0] = -23;
10842 a3.a2[1] = 24;
10843 a4.a0.a0 = -25.0;
10844 a4.a1[0].a0 = 26.0;
10845 a4.a1[0].a1 = -27;
10846 a4.a1[0].a2 = 28;
10847 a4.a2[0] = -29;
10848 a4.a2[1] = 30;
10849 a5.a0.a0 = -31.0;
10850 a5.a1[0].a0 = 32.0;
10851 a5.a1[0].a1 = -33;
10852 a5.a1[0].a2 = 34;
10853 a5.a2[0] = -35;
10854 a5.a2[1] = 36;
10855 a6.a0.a0 = -37.0;
10856 a6.a1[0].a0 = 38.0;
10857 a6.a1[0].a1 = -39;
10858 a6.a1[0].a2 = 40;
10859 a6.a2[0] = -41;
10860 a6.a2[1] = 42;
10861 a7.a0.a0 = -43.0;
10862 a7.a1[0].a0 = 44.0;
10863 a7.a1[0].a1 = -45;
10864 a7.a1[0].a2 = 46;
10865 a7.a2[0] = -47;
10866 a7.a2[1] = 48;
10867 a8.a0.a0 = -49.0;
10868 a8.a1[0].a0 = 50.0;
10869 a8.a1[0].a1 = -51;
10870 a8.a1[0].a2 = 52;
10871 a8.a2[0] = -53;
10872 a8.a2[1] = 54;
10873 a9.a0.a0 = -55.0;
10874 a9.a1[0].a0 = 56.0;
10875 a9.a1[0].a1 = -57;
10876 a9.a1[0].a2 = 58;
10877 a9.a2[0] = -59;
10878 a9.a2[1] = 60;
10879
10880 std::cout << "Calling TestPassStructStruct16BytesMixed3x10(" << "((("
10881 << a0.a0.a0 << "), [(" << a0.a1[0].a0 << ", " << a0.a1[0].a1 << ", "
10882 << a0.a1[0].a2 << ")], [" << a0.a2[0] << ", " << a0.a2[1]
10883 << "]), ((" << a1.a0.a0 << "), [(" << a1.a1[0].a0 << ", "
10884 << a1.a1[0].a1 << ", " << a1.a1[0].a2 << ")], [" << a1.a2[0] << ", "
10885 << a1.a2[1] << "]), ((" << a2.a0.a0 << "), [(" << a2.a1[0].a0
10886 << ", " << a2.a1[0].a1 << ", " << a2.a1[0].a2 << ")], [" << a2.a2[0]
10887 << ", " << a2.a2[1] << "]), ((" << a3.a0.a0 << "), [("
10888 << a3.a1[0].a0 << ", " << a3.a1[0].a1 << ", " << a3.a1[0].a2
10889 << ")], [" << a3.a2[0] << ", " << a3.a2[1] << "]), ((" << a4.a0.a0
10890 << "), [(" << a4.a1[0].a0 << ", " << a4.a1[0].a1 << ", "
10891 << a4.a1[0].a2 << ")], [" << a4.a2[0] << ", " << a4.a2[1]
10892 << "]), ((" << a5.a0.a0 << "), [(" << a5.a1[0].a0 << ", "
10893 << a5.a1[0].a1 << ", " << a5.a1[0].a2 << ")], [" << a5.a2[0] << ", "
10894 << a5.a2[1] << "]), ((" << a6.a0.a0 << "), [(" << a6.a1[0].a0
10895 << ", " << a6.a1[0].a1 << ", " << a6.a1[0].a2 << ")], [" << a6.a2[0]
10896 << ", " << a6.a2[1] << "]), ((" << a7.a0.a0 << "), [("
10897 << a7.a1[0].a0 << ", " << a7.a1[0].a1 << ", " << a7.a1[0].a2
10898 << ")], [" << a7.a2[0] << ", " << a7.a2[1] << "]), ((" << a8.a0.a0
10899 << "), [(" << a8.a1[0].a0 << ", " << a8.a1[0].a1 << ", "
10900 << a8.a1[0].a2 << ")], [" << a8.a2[0] << ", " << a8.a2[1]
10901 << "]), ((" << a9.a0.a0 << "), [(" << a9.a1[0].a0 << ", "
10902 << a9.a1[0].a1 << ", " << a9.a1[0].a2 << ")], [" << a9.a2[0] << ", "
10903 << a9.a2[1] << "]))" << ")\n";
10904
10905 float result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
10906
10907 std::cout << "result = " << result << "\n";
10908
10909 CHECK_APPROX(30.0, result);
10910
10911 // Pass argument that will make the Dart callback throw.
10912 a0.a0.a0 = 42;
10913
10914 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
10915
10916 CHECK_APPROX(0.0, result);
10917
10918 // Pass argument that will make the Dart callback return null.
10919 a0.a0.a0 = 84;
10920
10921 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
10922
10923 CHECK_APPROX(0.0, result);
10924
10925 return 0;
10926}

◆ TestPassStructStruct32BytesHomogeneousDouble2x5()

Definition at line 10724 of file ffi_test_functions_generated.cc.

10730 {
10732 StructStruct32BytesHomogeneousDouble2 a1 = {};
10733 StructStruct32BytesHomogeneousDouble2 a2 = {};
10734 StructStruct32BytesHomogeneousDouble2 a3 = {};
10735 StructStruct32BytesHomogeneousDouble2 a4 = {};
10736
10737 a0.a0.a0 = -1.0;
10738 a0.a1[0].a0 = 2.0;
10739 a0.a1[1].a0 = -3.0;
10740 a0.a2 = 4.0;
10741 a1.a0.a0 = -5.0;
10742 a1.a1[0].a0 = 6.0;
10743 a1.a1[1].a0 = -7.0;
10744 a1.a2 = 8.0;
10745 a2.a0.a0 = -9.0;
10746 a2.a1[0].a0 = 10.0;
10747 a2.a1[1].a0 = -11.0;
10748 a2.a2 = 12.0;
10749 a3.a0.a0 = -13.0;
10750 a3.a1[0].a0 = 14.0;
10751 a3.a1[1].a0 = -15.0;
10752 a3.a2 = 16.0;
10753 a4.a0.a0 = -17.0;
10754 a4.a1[0].a0 = 18.0;
10755 a4.a1[1].a0 = -19.0;
10756 a4.a2 = 20.0;
10757
10758 std::cout << "Calling TestPassStructStruct32BytesHomogeneousDouble2x5("
10759 << "(((" << a0.a0.a0 << "), [(" << a0.a1[0].a0 << "), ("
10760 << a0.a1[1].a0 << ")], " << a0.a2 << "), ((" << a1.a0.a0 << "), [("
10761 << a1.a1[0].a0 << "), (" << a1.a1[1].a0 << ")], " << a1.a2
10762 << "), ((" << a2.a0.a0 << "), [(" << a2.a1[0].a0 << "), ("
10763 << a2.a1[1].a0 << ")], " << a2.a2 << "), ((" << a3.a0.a0 << "), [("
10764 << a3.a1[0].a0 << "), (" << a3.a1[1].a0 << ")], " << a3.a2
10765 << "), ((" << a4.a0.a0 << "), [(" << a4.a1[0].a0 << "), ("
10766 << a4.a1[1].a0 << ")], " << a4.a2 << "))" << ")\n";
10767
10768 double result = f(a0, a1, a2, a3, a4);
10769
10770 std::cout << "result = " << result << "\n";
10771
10772 CHECK_APPROX(10.0, result);
10773
10774 // Pass argument that will make the Dart callback throw.
10775 a0.a0.a0 = 42;
10776
10777 result = f(a0, a1, a2, a3, a4);
10778
10779 CHECK_APPROX(0.0, result);
10780
10781 // Pass argument that will make the Dart callback return null.
10782 a0.a0.a0 = 84;
10783
10784 result = f(a0, a1, a2, a3, a4);
10785
10786 CHECK_APPROX(0.0, result);
10787
10788 return 0;
10789}

◆ TestPassUint8Boolx9Struct10BytesHomogeneousBoolBool()

DART_EXPORT intptr_t dart::TestPassUint8Boolx9Struct10BytesHomogeneousBoolBool ( int32_t(*)(uint8_t a0, bool a1, bool a2, bool a3, bool a4, bool a5, bool a6, bool a7, bool a8, bool a9, Struct10BytesHomogeneousBool a10, bool a11)  f)

Definition at line 11993 of file ffi_test_functions_generated.cc.

12006 {
12007 uint8_t a0;
12008 bool a1;
12009 bool a2;
12010 bool a3;
12011 bool a4;
12012 bool a5;
12013 bool a6;
12014 bool a7;
12015 bool a8;
12016 bool a9;
12018 bool a11;
12019
12020 a0 = 1;
12021 a1 = false;
12022 a2 = true;
12023 a3 = false;
12024 a4 = true;
12025 a5 = false;
12026 a6 = true;
12027 a7 = false;
12028 a8 = true;
12029 a9 = false;
12030 a10.a0 = true;
12031 a10.a1 = false;
12032 a10.a2 = true;
12033 a10.a3 = false;
12034 a10.a4 = true;
12035 a10.a5 = false;
12036 a10.a6 = true;
12037 a10.a7 = false;
12038 a10.a8 = true;
12039 a10.a9 = false;
12040 a11 = true;
12041
12042 std::cout << "Calling TestPassUint8Boolx9Struct10BytesHomogeneousBoolBool("
12043 << "(" << static_cast<int>(a0) << ", " << a1 << ", " << a2 << ", "
12044 << a3 << ", " << a4 << ", " << a5 << ", " << a6 << ", " << a7
12045 << ", " << a8 << ", " << a9 << ", (" << a10.a0 << ", " << a10.a1
12046 << ", " << a10.a2 << ", " << a10.a3 << ", " << a10.a4 << ", "
12047 << a10.a5 << ", " << a10.a6 << ", " << a10.a7 << ", " << a10.a8
12048 << ", " << a10.a9 << "), " << a11 << ")" << ")\n";
12049
12050 int32_t result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11);
12051
12052 std::cout << "result = " << result << "\n";
12053
12054 CHECK_EQ(11, result);
12055
12056 // Pass argument that will make the Dart callback throw.
12057 a0 = 42;
12058
12059 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11);
12060
12061 CHECK_EQ(0, result);
12062
12063 // Pass argument that will make the Dart callback return null.
12064 a0 = 84;
12065
12066 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11);
12067
12068 CHECK_EQ(0, result);
12069
12070 return 0;
12071}

◆ TestPassUint8Boolx9Struct10BytesInlineArrayBoolBool()

DART_EXPORT intptr_t dart::TestPassUint8Boolx9Struct10BytesInlineArrayBoolBool ( int32_t(*)(uint8_t a0, bool a1, bool a2, bool a3, bool a4, bool a5, bool a6, bool a7, bool a8, bool a9, Struct10BytesInlineArrayBool a10, bool a11)  f)

Definition at line 12077 of file ffi_test_functions_generated.cc.

12090 {
12091 uint8_t a0;
12092 bool a1;
12093 bool a2;
12094 bool a3;
12095 bool a4;
12096 bool a5;
12097 bool a6;
12098 bool a7;
12099 bool a8;
12100 bool a9;
12102 bool a11;
12103
12104 a0 = 1;
12105 a1 = false;
12106 a2 = true;
12107 a3 = false;
12108 a4 = true;
12109 a5 = false;
12110 a6 = true;
12111 a7 = false;
12112 a8 = true;
12113 a9 = false;
12114 a10.a0[0] = true;
12115 a10.a0[1] = false;
12116 a10.a0[2] = true;
12117 a10.a0[3] = false;
12118 a10.a0[4] = true;
12119 a10.a0[5] = false;
12120 a10.a0[6] = true;
12121 a10.a0[7] = false;
12122 a10.a0[8] = true;
12123 a10.a0[9] = false;
12124 a11 = true;
12125
12126 std::cout << "Calling TestPassUint8Boolx9Struct10BytesInlineArrayBoolBool("
12127 << "(" << static_cast<int>(a0) << ", " << a1 << ", " << a2 << ", "
12128 << a3 << ", " << a4 << ", " << a5 << ", " << a6 << ", " << a7
12129 << ", " << a8 << ", " << a9 << ", ([" << a10.a0[0] << ", "
12130 << a10.a0[1] << ", " << a10.a0[2] << ", " << a10.a0[3] << ", "
12131 << a10.a0[4] << ", " << a10.a0[5] << ", " << a10.a0[6] << ", "
12132 << a10.a0[7] << ", " << a10.a0[8] << ", " << a10.a0[9] << "]), "
12133 << a11 << ")" << ")\n";
12134
12135 int32_t result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11);
12136
12137 std::cout << "result = " << result << "\n";
12138
12139 CHECK_EQ(11, result);
12140
12141 // Pass argument that will make the Dart callback throw.
12142 a0 = 42;
12143
12144 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11);
12145
12146 CHECK_EQ(0, result);
12147
12148 // Pass argument that will make the Dart callback return null.
12149 a0 = 84;
12150
12151 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11);
12152
12153 CHECK_EQ(0, result);
12154
12155 return 0;
12156}

◆ TestPassUint8Struct1ByteBool()

DART_EXPORT intptr_t dart::TestPassUint8Struct1ByteBool ( bool(*)(uint8_t a0, Struct1ByteBool a1)  f)

Definition at line 12160 of file ffi_test_functions_generated.cc.

12162 {
12163 uint8_t a0;
12164 Struct1ByteBool a1 = {};
12165
12166 a0 = 1;
12167 a1.a0 = false;
12168
12169 std::cout << "Calling TestPassUint8Struct1ByteBool(" << "("
12170 << static_cast<int>(a0) << ", (" << a1.a0 << "))" << ")\n";
12171
12172 bool result = f(a0, a1);
12173
12174 std::cout << "result = " << result << "\n";
12175
12176 CHECK_EQ(1, result);
12177
12178 // Pass argument that will make the Dart callback throw.
12179 a0 = 42;
12180
12181 result = f(a0, a1);
12182
12183 CHECK_EQ(0, result);
12184
12185 // Pass argument that will make the Dart callback return null.
12186 a0 = 84;
12187
12188 result = f(a0, a1);
12189
12190 CHECK_EQ(0, result);
12191
12192 return 0;
12193}

◆ TestPassUint8Struct32BytesInlineArrayMultiDimensionalI()

DART_EXPORT intptr_t dart::TestPassUint8Struct32BytesInlineArrayMultiDimensionalI ( uint32_t(*)(uint8_t a0, Struct32BytesInlineArrayMultiDimensionalInt a1, uint8_t a2, Struct8BytesInlineArrayMultiDimensionalInt a3, uint8_t a4, Struct8BytesInlineArrayMultiDimensionalInt a5, uint8_t a6)  f)

Definition at line 10930 of file ffi_test_functions_generated.cc.

10938 {
10939 uint8_t a0;
10941 uint8_t a2;
10942 Struct8BytesInlineArrayMultiDimensionalInt a3 = {};
10943 uint8_t a4;
10944 Struct8BytesInlineArrayMultiDimensionalInt a5 = {};
10945 uint8_t a6;
10946
10947 a0 = 1;
10948 a1.a0[0][0][0][0][0] = 2;
10949 a1.a0[0][0][0][0][1] = 3;
10950 a1.a0[0][0][0][1][0] = 4;
10951 a1.a0[0][0][0][1][1] = 5;
10952 a1.a0[0][0][1][0][0] = 6;
10953 a1.a0[0][0][1][0][1] = 7;
10954 a1.a0[0][0][1][1][0] = 8;
10955 a1.a0[0][0][1][1][1] = 9;
10956 a1.a0[0][1][0][0][0] = 10;
10957 a1.a0[0][1][0][0][1] = 11;
10958 a1.a0[0][1][0][1][0] = 12;
10959 a1.a0[0][1][0][1][1] = 13;
10960 a1.a0[0][1][1][0][0] = 14;
10961 a1.a0[0][1][1][0][1] = 15;
10962 a1.a0[0][1][1][1][0] = 16;
10963 a1.a0[0][1][1][1][1] = 17;
10964 a1.a0[1][0][0][0][0] = 18;
10965 a1.a0[1][0][0][0][1] = 19;
10966 a1.a0[1][0][0][1][0] = 20;
10967 a1.a0[1][0][0][1][1] = 21;
10968 a1.a0[1][0][1][0][0] = 22;
10969 a1.a0[1][0][1][0][1] = 23;
10970 a1.a0[1][0][1][1][0] = 24;
10971 a1.a0[1][0][1][1][1] = 25;
10972 a1.a0[1][1][0][0][0] = 26;
10973 a1.a0[1][1][0][0][1] = 27;
10974 a1.a0[1][1][0][1][0] = 28;
10975 a1.a0[1][1][0][1][1] = 29;
10976 a1.a0[1][1][1][0][0] = 30;
10977 a1.a0[1][1][1][0][1] = 31;
10978 a1.a0[1][1][1][1][0] = 32;
10979 a1.a0[1][1][1][1][1] = 33;
10980 a2 = 34;
10981 a3.a0[0][0][0] = 35;
10982 a3.a0[0][0][1] = 36;
10983 a3.a0[0][1][0] = 37;
10984 a3.a0[0][1][1] = 38;
10985 a3.a0[1][0][0] = 39;
10986 a3.a0[1][0][1] = 40;
10987 a3.a0[1][1][0] = 41;
10988 a3.a0[1][1][1] = 42;
10989 a4 = 43;
10990 a5.a0[0][0][0] = 44;
10991 a5.a0[0][0][1] = 45;
10992 a5.a0[0][1][0] = 46;
10993 a5.a0[0][1][1] = 47;
10994 a5.a0[1][0][0] = 48;
10995 a5.a0[1][0][1] = 49;
10996 a5.a0[1][1][0] = 50;
10997 a5.a0[1][1][1] = 51;
10998 a6 = 52;
10999
11000 std::cout << "Calling TestPassUint8Struct32BytesInlineArrayMultiDimensionalI("
11001 << "(" << static_cast<int>(a0) << ", ([[[[["
11002 << static_cast<int>(a1.a0[0][0][0][0][0]) << ", "
11003 << static_cast<int>(a1.a0[0][0][0][0][1]) << "], ["
11004 << static_cast<int>(a1.a0[0][0][0][1][0]) << ", "
11005 << static_cast<int>(a1.a0[0][0][0][1][1]) << "]], [["
11006 << static_cast<int>(a1.a0[0][0][1][0][0]) << ", "
11007 << static_cast<int>(a1.a0[0][0][1][0][1]) << "], ["
11008 << static_cast<int>(a1.a0[0][0][1][1][0]) << ", "
11009 << static_cast<int>(a1.a0[0][0][1][1][1]) << "]]], [[["
11010 << static_cast<int>(a1.a0[0][1][0][0][0]) << ", "
11011 << static_cast<int>(a1.a0[0][1][0][0][1]) << "], ["
11012 << static_cast<int>(a1.a0[0][1][0][1][0]) << ", "
11013 << static_cast<int>(a1.a0[0][1][0][1][1]) << "]], [["
11014 << static_cast<int>(a1.a0[0][1][1][0][0]) << ", "
11015 << static_cast<int>(a1.a0[0][1][1][0][1]) << "], ["
11016 << static_cast<int>(a1.a0[0][1][1][1][0]) << ", "
11017 << static_cast<int>(a1.a0[0][1][1][1][1]) << "]]]], [[[["
11018 << static_cast<int>(a1.a0[1][0][0][0][0]) << ", "
11019 << static_cast<int>(a1.a0[1][0][0][0][1]) << "], ["
11020 << static_cast<int>(a1.a0[1][0][0][1][0]) << ", "
11021 << static_cast<int>(a1.a0[1][0][0][1][1]) << "]], [["
11022 << static_cast<int>(a1.a0[1][0][1][0][0]) << ", "
11023 << static_cast<int>(a1.a0[1][0][1][0][1]) << "], ["
11024 << static_cast<int>(a1.a0[1][0][1][1][0]) << ", "
11025 << static_cast<int>(a1.a0[1][0][1][1][1]) << "]]], [[["
11026 << static_cast<int>(a1.a0[1][1][0][0][0]) << ", "
11027 << static_cast<int>(a1.a0[1][1][0][0][1]) << "], ["
11028 << static_cast<int>(a1.a0[1][1][0][1][0]) << ", "
11029 << static_cast<int>(a1.a0[1][1][0][1][1]) << "]], [["
11030 << static_cast<int>(a1.a0[1][1][1][0][0]) << ", "
11031 << static_cast<int>(a1.a0[1][1][1][0][1]) << "], ["
11032 << static_cast<int>(a1.a0[1][1][1][1][0]) << ", "
11033 << static_cast<int>(a1.a0[1][1][1][1][1]) << "]]]]]), "
11034 << static_cast<int>(a2) << ", ([[["
11035 << static_cast<int>(a3.a0[0][0][0]) << ", "
11036 << static_cast<int>(a3.a0[0][0][1]) << "], ["
11037 << static_cast<int>(a3.a0[0][1][0]) << ", "
11038 << static_cast<int>(a3.a0[0][1][1]) << "]], [["
11039 << static_cast<int>(a3.a0[1][0][0]) << ", "
11040 << static_cast<int>(a3.a0[1][0][1]) << "], ["
11041 << static_cast<int>(a3.a0[1][1][0]) << ", "
11042 << static_cast<int>(a3.a0[1][1][1]) << "]]]), "
11043 << static_cast<int>(a4) << ", ([[["
11044 << static_cast<int>(a5.a0[0][0][0]) << ", "
11045 << static_cast<int>(a5.a0[0][0][1]) << "], ["
11046 << static_cast<int>(a5.a0[0][1][0]) << ", "
11047 << static_cast<int>(a5.a0[0][1][1]) << "]], [["
11048 << static_cast<int>(a5.a0[1][0][0]) << ", "
11049 << static_cast<int>(a5.a0[1][0][1]) << "], ["
11050 << static_cast<int>(a5.a0[1][1][0]) << ", "
11051 << static_cast<int>(a5.a0[1][1][1]) << "]]]), "
11052 << static_cast<int>(a6) << ")" << ")\n";
11053
11054 uint32_t result = f(a0, a1, a2, a3, a4, a5, a6);
11055
11056 std::cout << "result = " << result << "\n";
11057
11058 CHECK_EQ(1378, result);
11059
11060 // Pass argument that will make the Dart callback throw.
11061 a0 = 42;
11062
11063 result = f(a0, a1, a2, a3, a4, a5, a6);
11064
11065 CHECK_EQ(0, result);
11066
11067 // Pass argument that will make the Dart callback return null.
11068 a0 = 84;
11069
11070 result = f(a0, a1, a2, a3, a4, a5, a6);
11071
11072 CHECK_EQ(0, result);
11073
11074 return 0;
11075}

◆ TestPassUint8Struct4BytesInlineArrayMultiDimensionalIn()

DART_EXPORT intptr_t dart::TestPassUint8Struct4BytesInlineArrayMultiDimensionalIn ( uint32_t(*)(uint8_t a0, Struct4BytesInlineArrayMultiDimensionalInt a1, uint8_t a2)  f)

Definition at line 11079 of file ffi_test_functions_generated.cc.

11083 {
11084 uint8_t a0;
11086 uint8_t a2;
11087
11088 a0 = 1;
11089 a1.a0[0][0].a0 = 2;
11090 a1.a0[0][1].a0 = -3;
11091 a1.a0[1][0].a0 = 4;
11092 a1.a0[1][1].a0 = -5;
11093 a2 = 6;
11094
11095 std::cout << "Calling TestPassUint8Struct4BytesInlineArrayMultiDimensionalIn("
11096 << "(" << static_cast<int>(a0) << ", ([[("
11097 << static_cast<int>(a1.a0[0][0].a0) << "), ("
11098 << static_cast<int>(a1.a0[0][1].a0) << ")], [("
11099 << static_cast<int>(a1.a0[1][0].a0) << "), ("
11100 << static_cast<int>(a1.a0[1][1].a0) << ")]]), "
11101 << static_cast<int>(a2) << ")" << ")\n";
11102
11103 uint32_t result = f(a0, a1, a2);
11104
11105 std::cout << "result = " << result << "\n";
11106
11107 CHECK_EQ(5, result);
11108
11109 // Pass argument that will make the Dart callback throw.
11110 a0 = 42;
11111
11112 result = f(a0, a1, a2);
11113
11114 CHECK_EQ(0, result);
11115
11116 // Pass argument that will make the Dart callback return null.
11117 a0 = 84;
11118
11119 result = f(a0, a1, a2);
11120
11121 CHECK_EQ(0, result);
11122
11123 return 0;
11124}

◆ TestPassUnion16BytesNestedFloatx10()

Definition at line 11913 of file ffi_test_functions_generated.cc.

11924 {
11926 Union16BytesNestedFloat a1 = {};
11927 Union16BytesNestedFloat a2 = {};
11928 Union16BytesNestedFloat a3 = {};
11929 Union16BytesNestedFloat a4 = {};
11930 Union16BytesNestedFloat a5 = {};
11931 Union16BytesNestedFloat a6 = {};
11932 Union16BytesNestedFloat a7 = {};
11933 Union16BytesNestedFloat a8 = {};
11934 Union16BytesNestedFloat a9 = {};
11935
11936 a0.a0.a0 = -1.0;
11937 a0.a0.a1 = 2.0;
11938 a1.a0.a0 = -3.0;
11939 a1.a0.a1 = 4.0;
11940 a2.a0.a0 = -5.0;
11941 a2.a0.a1 = 6.0;
11942 a3.a0.a0 = -7.0;
11943 a3.a0.a1 = 8.0;
11944 a4.a0.a0 = -9.0;
11945 a4.a0.a1 = 10.0;
11946 a5.a0.a0 = -11.0;
11947 a5.a0.a1 = 12.0;
11948 a6.a0.a0 = -13.0;
11949 a6.a0.a1 = 14.0;
11950 a7.a0.a0 = -15.0;
11951 a7.a0.a1 = 16.0;
11952 a8.a0.a0 = -17.0;
11953 a8.a0.a1 = 18.0;
11954 a9.a0.a0 = -19.0;
11955 a9.a0.a1 = 20.0;
11956
11957 std::cout << "Calling TestPassUnion16BytesNestedFloatx10(" << "((("
11958 << a0.a0.a0 << ", " << a0.a0.a1 << ")), ((" << a1.a0.a0 << ", "
11959 << a1.a0.a1 << ")), ((" << a2.a0.a0 << ", " << a2.a0.a1 << ")), (("
11960 << a3.a0.a0 << ", " << a3.a0.a1 << ")), ((" << a4.a0.a0 << ", "
11961 << a4.a0.a1 << ")), ((" << a5.a0.a0 << ", " << a5.a0.a1 << ")), (("
11962 << a6.a0.a0 << ", " << a6.a0.a1 << ")), ((" << a7.a0.a0 << ", "
11963 << a7.a0.a1 << ")), ((" << a8.a0.a0 << ", " << a8.a0.a1 << ")), (("
11964 << a9.a0.a0 << ", " << a9.a0.a1 << ")))" << ")\n";
11965
11966 double result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
11967
11968 std::cout << "result = " << result << "\n";
11969
11970 CHECK_APPROX(10.0, result);
11971
11972 // Pass argument that will make the Dart callback throw.
11973 a0.a0.a0 = 42;
11974
11975 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
11976
11977 CHECK_APPROX(0.0, result);
11978
11979 // Pass argument that will make the Dart callback return null.
11980 a0.a0.a0 = 84;
11981
11982 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
11983
11984 CHECK_APPROX(0.0, result);
11985
11986 return 0;
11987}

◆ TestPassUnion16BytesNestedInlineArrayFloatx10()

Definition at line 11808 of file ffi_test_functions_generated.cc.

11819 {
11821 Union16BytesNestedInlineArrayFloat a1 = {};
11822 Union16BytesNestedInlineArrayFloat a2 = {};
11823 Union16BytesNestedInlineArrayFloat a3 = {};
11824 Union16BytesNestedInlineArrayFloat a4 = {};
11825 Union16BytesNestedInlineArrayFloat a5 = {};
11826 Union16BytesNestedInlineArrayFloat a6 = {};
11827 Union16BytesNestedInlineArrayFloat a7 = {};
11828 Union16BytesNestedInlineArrayFloat a8 = {};
11829 Union16BytesNestedInlineArrayFloat a9 = {};
11830
11831 a0.a0[0] = -1.0;
11832 a0.a0[1] = 2.0;
11833 a0.a0[2] = -3.0;
11834 a0.a0[3] = 4.0;
11835 a1.a0[0] = -5.0;
11836 a1.a0[1] = 6.0;
11837 a1.a0[2] = -7.0;
11838 a1.a0[3] = 8.0;
11839 a2.a0[0] = -9.0;
11840 a2.a0[1] = 10.0;
11841 a2.a0[2] = -11.0;
11842 a2.a0[3] = 12.0;
11843 a3.a0[0] = -13.0;
11844 a3.a0[1] = 14.0;
11845 a3.a0[2] = -15.0;
11846 a3.a0[3] = 16.0;
11847 a4.a0[0] = -17.0;
11848 a4.a0[1] = 18.0;
11849 a4.a0[2] = -19.0;
11850 a4.a0[3] = 20.0;
11851 a5.a0[0] = -21.0;
11852 a5.a0[1] = 22.0;
11853 a5.a0[2] = -23.0;
11854 a5.a0[3] = 24.0;
11855 a6.a0[0] = -25.0;
11856 a6.a0[1] = 26.0;
11857 a6.a0[2] = -27.0;
11858 a6.a0[3] = 28.0;
11859 a7.a0[0] = -29.0;
11860 a7.a0[1] = 30.0;
11861 a7.a0[2] = -31.0;
11862 a7.a0[3] = 32.0;
11863 a8.a0[0] = -33.0;
11864 a8.a0[1] = 34.0;
11865 a8.a0[2] = -35.0;
11866 a8.a0[3] = 36.0;
11867 a9.a0[0] = -37.0;
11868 a9.a0[1] = 38.0;
11869 a9.a0[2] = -39.0;
11870 a9.a0[3] = 40.0;
11871
11872 std::cout << "Calling TestPassUnion16BytesNestedInlineArrayFloatx10(" << "((["
11873 << a0.a0[0] << ", " << a0.a0[1] << ", " << a0.a0[2] << ", "
11874 << a0.a0[3] << "]), ([" << a1.a0[0] << ", " << a1.a0[1] << ", "
11875 << a1.a0[2] << ", " << a1.a0[3] << "]), ([" << a2.a0[0] << ", "
11876 << a2.a0[1] << ", " << a2.a0[2] << ", " << a2.a0[3] << "]), (["
11877 << a3.a0[0] << ", " << a3.a0[1] << ", " << a3.a0[2] << ", "
11878 << a3.a0[3] << "]), ([" << a4.a0[0] << ", " << a4.a0[1] << ", "
11879 << a4.a0[2] << ", " << a4.a0[3] << "]), ([" << a5.a0[0] << ", "
11880 << a5.a0[1] << ", " << a5.a0[2] << ", " << a5.a0[3] << "]), (["
11881 << a6.a0[0] << ", " << a6.a0[1] << ", " << a6.a0[2] << ", "
11882 << a6.a0[3] << "]), ([" << a7.a0[0] << ", " << a7.a0[1] << ", "
11883 << a7.a0[2] << ", " << a7.a0[3] << "]), ([" << a8.a0[0] << ", "
11884 << a8.a0[1] << ", " << a8.a0[2] << ", " << a8.a0[3] << "]), (["
11885 << a9.a0[0] << ", " << a9.a0[1] << ", " << a9.a0[2] << ", "
11886 << a9.a0[3] << "]))" << ")\n";
11887
11888 double result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
11889
11890 std::cout << "result = " << result << "\n";
11891
11892 CHECK_APPROX(20.0, result);
11893
11894 // Pass argument that will make the Dart callback throw.
11895 a0.a0[0] = 42;
11896
11897 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
11898
11899 CHECK_APPROX(0.0, result);
11900
11901 // Pass argument that will make the Dart callback return null.
11902 a0.a0[0] = 84;
11903
11904 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
11905
11906 CHECK_APPROX(0.0, result);
11907
11908 return 0;
11909}

◆ TestPassUnion4BytesMixedx10()

Definition at line 11589 of file ffi_test_functions_generated.cc.

11600 {
11601 Union4BytesMixed a0 = {};
11602 Union4BytesMixed a1 = {};
11603 Union4BytesMixed a2 = {};
11604 Union4BytesMixed a3 = {};
11605 Union4BytesMixed a4 = {};
11606 Union4BytesMixed a5 = {};
11607 Union4BytesMixed a6 = {};
11608 Union4BytesMixed a7 = {};
11609 Union4BytesMixed a8 = {};
11610 Union4BytesMixed a9 = {};
11611
11612 a0.a0 = 1;
11613 a1.a0 = 2;
11614 a2.a0 = 3;
11615 a3.a0 = 4;
11616 a4.a0 = 5;
11617 a5.a0 = 6;
11618 a6.a0 = 7;
11619 a7.a0 = 8;
11620 a8.a0 = 9;
11621 a9.a0 = 10;
11622
11623 std::cout << "Calling TestPassUnion4BytesMixedx10(" << "((" << a0.a0 << "), ("
11624 << a1.a0 << "), (" << a2.a0 << "), (" << a3.a0 << "), (" << a4.a0
11625 << "), (" << a5.a0 << "), (" << a6.a0 << "), (" << a7.a0 << "), ("
11626 << a8.a0 << "), (" << a9.a0 << "))" << ")\n";
11627
11628 double result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
11629
11630 std::cout << "result = " << result << "\n";
11631
11632 CHECK_APPROX(55.0, result);
11633
11634 // Pass argument that will make the Dart callback throw.
11635 a0.a0 = 42;
11636
11637 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
11638
11639 CHECK_APPROX(0.0, result);
11640
11641 // Pass argument that will make the Dart callback return null.
11642 a0.a0 = 84;
11643
11644 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
11645
11646 CHECK_APPROX(0.0, result);
11647
11648 return 0;
11649}

◆ TestPassUnion8BytesNestedFloatx10()

Definition at line 11653 of file ffi_test_functions_generated.cc.

11664 {
11665 Union8BytesNestedFloat a0 = {};
11666 Union8BytesNestedFloat a1 = {};
11667 Union8BytesNestedFloat a2 = {};
11668 Union8BytesNestedFloat a3 = {};
11669 Union8BytesNestedFloat a4 = {};
11670 Union8BytesNestedFloat a5 = {};
11671 Union8BytesNestedFloat a6 = {};
11672 Union8BytesNestedFloat a7 = {};
11673 Union8BytesNestedFloat a8 = {};
11674 Union8BytesNestedFloat a9 = {};
11675
11676 a0.a0 = -1.0;
11677 a1.a0 = 2.0;
11678 a2.a0 = -3.0;
11679 a3.a0 = 4.0;
11680 a4.a0 = -5.0;
11681 a5.a0 = 6.0;
11682 a6.a0 = -7.0;
11683 a7.a0 = 8.0;
11684 a8.a0 = -9.0;
11685 a9.a0 = 10.0;
11686
11687 std::cout << "Calling TestPassUnion8BytesNestedFloatx10(" << "((" << a0.a0
11688 << "), (" << a1.a0 << "), (" << a2.a0 << "), (" << a3.a0 << "), ("
11689 << a4.a0 << "), (" << a5.a0 << "), (" << a6.a0 << "), (" << a7.a0
11690 << "), (" << a8.a0 << "), (" << a9.a0 << "))" << ")\n";
11691
11692 double result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
11693
11694 std::cout << "result = " << result << "\n";
11695
11696 CHECK_APPROX(5.0, result);
11697
11698 // Pass argument that will make the Dart callback throw.
11699 a0.a0 = 42;
11700
11701 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
11702
11703 CHECK_APPROX(0.0, result);
11704
11705 // Pass argument that will make the Dart callback return null.
11706 a0.a0 = 84;
11707
11708 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
11709
11710 CHECK_APPROX(0.0, result);
11711
11712 return 0;
11713}

◆ TestPassUnion9BytesNestedIntx10()

Definition at line 11717 of file ffi_test_functions_generated.cc.

11728 {
11729 Union9BytesNestedInt a0 = {};
11730 Union9BytesNestedInt a1 = {};
11731 Union9BytesNestedInt a2 = {};
11732 Union9BytesNestedInt a3 = {};
11733 Union9BytesNestedInt a4 = {};
11734 Union9BytesNestedInt a5 = {};
11735 Union9BytesNestedInt a6 = {};
11736 Union9BytesNestedInt a7 = {};
11737 Union9BytesNestedInt a8 = {};
11738 Union9BytesNestedInt a9 = {};
11739
11740 a0.a0.a0 = -1;
11741 a0.a0.a1 = 2;
11742 a0.a0.a2 = -3;
11743 a1.a0.a0 = 4;
11744 a1.a0.a1 = -5;
11745 a1.a0.a2 = 6;
11746 a2.a0.a0 = -7;
11747 a2.a0.a1 = 8;
11748 a2.a0.a2 = -9;
11749 a3.a0.a0 = 10;
11750 a3.a0.a1 = -11;
11751 a3.a0.a2 = 12;
11752 a4.a0.a0 = -13;
11753 a4.a0.a1 = 14;
11754 a4.a0.a2 = -15;
11755 a5.a0.a0 = 16;
11756 a5.a0.a1 = -17;
11757 a5.a0.a2 = 18;
11758 a6.a0.a0 = -19;
11759 a6.a0.a1 = 20;
11760 a6.a0.a2 = -21;
11761 a7.a0.a0 = 22;
11762 a7.a0.a1 = -23;
11763 a7.a0.a2 = 24;
11764 a8.a0.a0 = -25;
11765 a8.a0.a1 = 26;
11766 a8.a0.a2 = -27;
11767 a9.a0.a0 = 28;
11768 a9.a0.a1 = -29;
11769 a9.a0.a2 = 30;
11770
11771 std::cout << "Calling TestPassUnion9BytesNestedIntx10(" << "(((" << a0.a0.a0
11772 << ", " << a0.a0.a1 << ", " << a0.a0.a2 << ")), ((" << a1.a0.a0
11773 << ", " << a1.a0.a1 << ", " << a1.a0.a2 << ")), ((" << a2.a0.a0
11774 << ", " << a2.a0.a1 << ", " << a2.a0.a2 << ")), ((" << a3.a0.a0
11775 << ", " << a3.a0.a1 << ", " << a3.a0.a2 << ")), ((" << a4.a0.a0
11776 << ", " << a4.a0.a1 << ", " << a4.a0.a2 << ")), ((" << a5.a0.a0
11777 << ", " << a5.a0.a1 << ", " << a5.a0.a2 << ")), ((" << a6.a0.a0
11778 << ", " << a6.a0.a1 << ", " << a6.a0.a2 << ")), ((" << a7.a0.a0
11779 << ", " << a7.a0.a1 << ", " << a7.a0.a2 << ")), ((" << a8.a0.a0
11780 << ", " << a8.a0.a1 << ", " << a8.a0.a2 << ")), ((" << a9.a0.a0
11781 << ", " << a9.a0.a1 << ", " << a9.a0.a2 << ")))" << ")\n";
11782
11783 double result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
11784
11785 std::cout << "result = " << result << "\n";
11786
11787 CHECK_APPROX(15.0, result);
11788
11789 // Pass argument that will make the Dart callback throw.
11790 a0.a0.a0 = 42;
11791
11792 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
11793
11794 CHECK_APPROX(0.0, result);
11795
11796 // Pass argument that will make the Dart callback return null.
11797 a0.a0.a0 = 84;
11798
11799 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
11800
11801 CHECK_APPROX(0.0, result);
11802
11803 return 0;
11804}

◆ TestPassWCharStructInlineArrayIntUintPtrx2LongUnsigned()

DART_EXPORT intptr_t dart::TestPassWCharStructInlineArrayIntUintPtrx2LongUnsigned ( wchar_t(*)(wchar_t a0, StructInlineArrayInt a1, uintptr_t a2, uintptr_t a3, long a4, unsigned long a5)  f)

Definition at line 12197 of file ffi_test_functions_generated.cc.

12204 {
12205 wchar_t a0;
12206 StructInlineArrayInt a1 = {};
12207 uintptr_t a2;
12208 uintptr_t a3;
12209 /* NOLINT(runtime/int) */ long a4;
12210 /* NOLINT(runtime/int) */ unsigned long a5;
12211
12212 a0 = 1;
12213 a1.a0[0] = 2;
12214 a1.a0[1] = 3;
12215 a1.a0[2] = 4;
12216 a1.a0[3] = 5;
12217 a1.a0[4] = 6;
12218 a1.a0[5] = 7;
12219 a1.a0[6] = 8;
12220 a1.a0[7] = 9;
12221 a1.a0[8] = 10;
12222 a1.a0[9] = 11;
12223 a2 = 12;
12224 a3 = 13;
12225 a4 = 14;
12226 a5 = 15;
12227
12228 std::cout << "Calling TestPassWCharStructInlineArrayIntUintPtrx2LongUnsigned("
12229 << "(" << a0 << ", ([" << a1.a0[0] << ", " << a1.a0[1] << ", "
12230 << a1.a0[2] << ", " << a1.a0[3] << ", " << a1.a0[4] << ", "
12231 << a1.a0[5] << ", " << a1.a0[6] << ", " << a1.a0[7] << ", "
12232 << a1.a0[8] << ", " << a1.a0[9] << "]), " << a2 << ", " << a3
12233 << ", " << a4 << ", " << a5 << ")" << ")\n";
12234
12235 wchar_t result = f(a0, a1, a2, a3, a4, a5);
12236
12237 std::cout << "result = " << result << "\n";
12238
12239 CHECK_EQ(120, result);
12240
12241 // Pass argument that will make the Dart callback throw.
12242 a0 = 42;
12243
12244 result = f(a0, a1, a2, a3, a4, a5);
12245
12246 CHECK_EQ(0, result);
12247
12248 // Pass argument that will make the Dart callback return null.
12249 a0 = 84;
12250
12251 result = f(a0, a1, a2, a3, a4, a5);
12252
12253 CHECK_EQ(0, result);
12254
12255 return 0;
12256}

◆ TestPhiUnboxingHeuristicSimd()

static void dart::TestPhiUnboxingHeuristicSimd ( const char *  script)
static

Definition at line 359 of file flow_graph_test.cc.

359 {
360 if (!FlowGraphCompiler::SupportsUnboxedSimd128()) {
361 return;
362 }
363
364 const auto& root_library = Library::Handle(LoadTestScript(script));
365 const auto& function = Function::Handle(GetFunction(root_library, "foo"));
366
367 Invoke(root_library, "main");
368
369 TestPipeline pipeline(function, CompilerPass::kJIT);
370 FlowGraph* flow_graph = pipeline.RunPasses({});
371
372 auto entry = flow_graph->graph_entry()->normal_entry();
373 ILMatcher cursor(flow_graph, entry, /*trace=*/true,
374 ParallelMovesHandling::kSkip);
375
376 RELEASE_ASSERT(cursor.TryMatch({
377 kMatchAndMoveFunctionEntry,
378 }));
379 RELEASE_ASSERT(cursor.TryMatch({
380 kMatchAndMoveUnbox, // outside of loop
381 kMatchAndMoveCheckSmi,
382 kMoveGlob,
383
384 // Loop header
385 kMatchAndMoveJoinEntry,
386 kMatchAndMoveCheckStackOverflow,
387 kMatchAndMoveBranchTrue,
388
389 // Loop body
390 kMatchAndMoveTargetEntry,
391 kMatchAndMoveSimdOp,
392 kMatchAndMoveBinarySmiOp,
393 kMatchAndMoveGoto,
394
395 // Loop header, again
396 kMatchAndMoveJoinEntry,
397 kMatchAndMoveCheckStackOverflow,
398 kMatchAndMoveBranchFalse,
399
400 // After loop
401 kMatchAndMoveTargetEntry,
402 kMatchAndMoveBox,
403 kMatchDartReturn,
404 }));
405}

◆ TestPrint()

static void dart::TestPrint ( Dart_NativeArguments  args)
static

Definition at line 454 of file inliner_test.cc.

454 {
457 const char* str = nullptr;
458 Dart_StringToCString(handle, &str);
459 OS::Print("%s\n", str);
461}

◆ TestPrinter()

static void dart::TestPrinter ( const char *  buffer)
static

Definition at line 22 of file log_test.cc.

22 {
23 if (test_output_ != nullptr) {
24 free(const_cast<char*>(test_output_));
25 test_output_ = nullptr;
26 }
27 test_output_ = Utils::StrDup(buffer);
28
29 // Also print to stdout to see the overall result.
30 OS::PrintErr("%s", test_output_);
31}

◆ TestRaw()

template<typename T >
void dart::TestRaw ( )

Definition at line 88 of file datastream_test.cc.

88 {
89 MallocWriteStream writer(1 * KB);
90 for (T i = kSignedStart; i < kSignedEnd; i++) {
91 writer.Write(i);
92 }
94 writer.Write(all_ones);
95 writer.Write(min);
96 writer.Write(max);
97 writer.Write(half_min);
98 writer.Write(half_max);
99 ReadStream reader(writer.buffer(), writer.bytes_written());
100 using Raw = ReadStream::Raw<sizeof(T), T>;
101 for (T i = kSignedStart; i < kSignedEnd; i++) {
102 const T r = Raw::Read(&reader);
103 EXPECT_EQ(i, r);
104 }
105 const T read_all_ones = Raw::Read(&reader);
106 EXPECT_EQ(all_ones, read_all_ones);
107 const T read_min = Raw::Read(&reader);
108 EXPECT_EQ(min, read_min);
109 const T read_max = Raw::Read(&reader);
110 EXPECT_EQ(max, read_max);
111 const T read_half_min = Raw::Read(&reader);
112 EXPECT_EQ(half_min, read_half_min);
113 const T read_half_max = Raw::Read(&reader);
114 EXPECT_EQ(half_max, read_half_max);
115}

◆ TestRegress38528()

static void dart::TestRegress38528 ( intptr_t  header_overlap)
static

Definition at line 188 of file freelist_test.cc.

188 {
189 // Test the following scenario.
190 //
191 // | <------------ free list element -----------------> |
192 // | <allocated code> | <header> | <remainder - header> | <other code> |
193 // ^
194 // page boundary around here, depending on header_overlap
195 //
196 // It is important that after the allocation has been re-protected, the
197 // "<other code>" region is also still executable (and not writable).
198 std::unique_ptr<FreeList> free_list(new FreeList());
199 const uword page = VirtualMemory::PageSize();
200 std::unique_ptr<VirtualMemory> blob(VirtualMemory::Allocate(
201 2 * page,
202 /*is_executable=*/true, /*is_compressed=*/false, "test"));
203 const intptr_t remainder_size = page / 2;
204 const intptr_t alloc_size = page - header_overlap * kObjectAlignment;
205 void* const other_code =
206 reinterpret_cast<void*>(blob->start() + alloc_size + remainder_size);
207
208 // Load a simple function into the "other code" section which just returns.
209 // This is used to ensure that it's still executable.
210#if defined(HOST_ARCH_X64) || defined(HOST_ARCH_IA32)
211 const uint8_t ret[1] = {0xC3}; // ret
212#elif defined(HOST_ARCH_ARM)
213 const uint8_t ret[4] = {0x1e, 0xff, 0x2f, 0xe1}; // bx lr
214#elif defined(HOST_ARCH_ARM64)
215 const uint8_t ret[4] = {0xc0, 0x03, 0x5f, 0xd6}; // ret
216#elif defined(HOST_ARCH_RISCV32) || defined(HOST_ARCH_RISCV64)
217 const uint8_t ret[2] = {0x82, 0x80}; // c.ret
218#else
219#error "Unknown architecture."
220#endif
221 memcpy(other_code, ret, sizeof(ret)); // NOLINT
222
223 free_list->Free(blob->start(), alloc_size + remainder_size);
224 blob->Protect(VirtualMemory::kReadExecute); // not writable
225 Allocate(free_list.get(), alloc_size, /*protected=*/true);
226 VirtualMemory::Protect(blob->address(), alloc_size,
227 VirtualMemory::kReadExecute);
228 reinterpret_cast<void (*)()>(other_code)();
229}

◆ TestReloadWithFieldChange()

static void dart::TestReloadWithFieldChange ( const char *  prefix,
const char *  suffix,
const char *  verify,
const char *  from_type,
const char *  from_init,
const char *  to_type,
const char *  to_init 
)
static

Definition at line 5465 of file isolate_reload_test.cc.

5471 {
5473 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, nullptr);
5475 {
5476 TransitionNativeToVM transition(thread);
5477 cid = Api::ClassId(result);
5478 }
5480 }
5481
5482 const char* kReloadScript =
5483 "class C {\n"
5484 "}\n"
5485 "class Foo {\n"
5486 "}\n"
5487 "main() {\n"
5488 " return '${Foo()}';\n"
5489 "}\n";
5490
5491 lib = TestCase::ReloadTestScript(kReloadScript);
5492 EXPECT_VALID(lib);
5493 Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, nullptr);
5495 {
5496 TransitionNativeToVM transition(thread);
5497 GCTestHelper::CollectAllGarbage();
5498
5499 {
5500 HeapIterationScope iteration(thread);
5501 CidCountingVisitor counting_visitor(cid);
5502 iteration.IterateObjects(&counting_visitor);
5503
5504 // We still expect to find references to static field values
5505 // because they are not deleted after hot reload.
5506 EXPECT_NE(counting_visitor.count(), 0);
5507 }
5508 }
5509}
5510
5511static void TestReloadWithFieldChange(const char* prefix,
5512 const char* suffix,
5513 const char* verify,
5514 const char* from_type,
5515 const char* from_init,
5516 const char* to_type,
5517 const char* to_init) {
5518 const char* late_tag = TestCase::LateTag();
5519 // clang-format off
5520 auto kScript = Utils::CStringUniquePtr(OS::SCreate(nullptr,
5521 R"(
5522 import 'dart:typed_data';
5523
5524 void doubleEq(double got, double expected) {
5525 if (got != expected) throw 'expected $expected got $got';
5526 }

◆ TestRepresentationChangeDuringCanonicalization()

static void dart::TestRepresentationChangeDuringCanonicalization ( Thread thread,
bool  allow_representation_change 
)
static

Definition at line 1172 of file il_test.cc.

1174 {
1176
1177 const auto& lib = Library::Handle(Library::CoreLibrary());
1178 const Class& list_class =
1179 Class::Handle(lib.LookupClassAllowPrivate(Symbols::_List()));
1180 EXPECT(!list_class.IsNull());
1181 const Error& err = Error::Handle(list_class.EnsureIsFinalized(thread));
1182 EXPECT(err.IsNull());
1183 const Function& list_filled = Function::ZoneHandle(
1184 list_class.LookupFactoryAllowPrivate(Symbols::_ListFilledFactory()));
1185 EXPECT(!list_filled.IsNull());
1186
1187 CompilerState S(thread, /*is_aot=*/true, /*is_optimizing=*/true);
1188
1189 FlowGraphBuilderHelper H(/*num_parameters=*/1);
1190 H.AddVariable("param", AbstractType::ZoneHandle(Type::IntType()));
1191
1192 auto normal_entry = H.flow_graph()->graph_entry()->normal_entry();
1193
1194 Definition* param = nullptr;
1195 LoadFieldInstr* load = nullptr;
1196 UnboxInstr* unbox = nullptr;
1197 Definition* add = nullptr;
1198 {
1199 BlockBuilder builder(H.flow_graph(), normal_entry);
1200 param = builder.AddParameter(0, kUnboxedInt64);
1201
1203 args.Add(new Value(H.flow_graph()->constant_null()));
1204 args.Add(new Value(param));
1205 args.Add(new Value(H.IntConstant(0)));
1206 StaticCallInstr* array = builder.AddDefinition(new StaticCallInstr(
1207 InstructionSource(), list_filled, 1, Array::empty_array(),
1208 std::move(args), DeoptId::kNone, 0, ICData::kNoRebind));
1209 array->UpdateType(CompileType::FromCid(kArrayCid));
1210 array->SetResultType(thread->zone(), CompileType::FromCid(kArrayCid));
1211 array->set_is_known_list_constructor(true);
1212
1213 load = builder.AddDefinition(new LoadFieldInstr(
1214 new Value(array), Slot::Array_length(), InstructionSource()));
1215
1216 unbox = builder.AddDefinition(new UnboxInt64Instr(
1217 new Value(load), DeoptId::kNone, Instruction::kNotSpeculative));
1218
1219 add = builder.AddDefinition(new BinaryInt64OpInstr(
1220 Token::kADD, new Value(unbox), new Value(H.IntConstant(1)),
1221 S.GetNextDeoptId(), Instruction::kNotSpeculative));
1222
1223 Definition* box = builder.AddDefinition(new BoxInt64Instr(new Value(add)));
1224
1225 builder.AddReturn(new Value(box));
1226 }
1227
1228 H.FinishGraph();
1229
1230 if (!allow_representation_change) {
1231 H.flow_graph()->disallow_unmatched_representations();
1232 }
1233
1234 H.flow_graph()->Canonicalize();
1235
1236 if (allow_representation_change) {
1237 EXPECT(add->InputAt(0)->definition() == param);
1238 } else {
1239 EXPECT(add->InputAt(0)->definition() == unbox);
1240 EXPECT(unbox->value()->definition() == load);
1241 }
1242}
FunctionPtr LookupFactoryAllowPrivate(const String &name) const
Definition object.cc:6218
Value * value() const
Definition il.h:8630

◆ TestResolve()

static const char * dart::TestResolve ( const char *  base_uri,
const char *  uri 
)
static

Definition at line 505 of file uri_test.cc.

505 {
506 const char* target_uri;
507 EXPECT(ResolveUri(uri, base_uri, &target_uri));
508 return target_uri;
509}

◆ TestReturnMaxUint8()

DART_EXPORT intptr_t dart::TestReturnMaxUint8 ( uint8_t(*)()  fn)

Definition at line 1153 of file ffi_test_functions.cc.

1153 {
1154 std::cout << "TestReturnMaxUint8(fn): " << static_cast<int>(fn()) << "\n";
1155 CHECK_EQ(0xFF, fn());
1156 return 0;
1157}

◆ TestReturnNull()

DART_EXPORT intptr_t dart::TestReturnNull ( int32_t(*)()  fn)

Definition at line 1104 of file ffi_test_functions.cc.

1104 {
1105 CHECK_EQ(fn(), 42);
1106 return 0;
1107}

◆ TestReturnStruct1024BytesHomogeneousUint64()

DART_EXPORT intptr_t dart::TestReturnStruct1024BytesHomogeneousUint64 ( Struct1024BytesHomogeneousUint64(*)(uint64_t a0, uint64_t a1, uint64_t a2, uint64_t a3, uint64_t a4, uint64_t a5, uint64_t a6, uint64_t a7, uint64_t a8, uint64_t a9, uint64_t a10, uint64_t a11, uint64_t a12, uint64_t a13, uint64_t a14, uint64_t a15, uint64_t a16, uint64_t a17, uint64_t a18, uint64_t a19, uint64_t a20, uint64_t a21, uint64_t a22, uint64_t a23, uint64_t a24, uint64_t a25, uint64_t a26, uint64_t a27, uint64_t a28, uint64_t a29, uint64_t a30, uint64_t a31, uint64_t a32, uint64_t a33, uint64_t a34, uint64_t a35, uint64_t a36, uint64_t a37, uint64_t a38, uint64_t a39, uint64_t a40, uint64_t a41, uint64_t a42, uint64_t a43, uint64_t a44, uint64_t a45, uint64_t a46, uint64_t a47, uint64_t a48, uint64_t a49, uint64_t a50, uint64_t a51, uint64_t a52, uint64_t a53, uint64_t a54, uint64_t a55, uint64_t a56, uint64_t a57, uint64_t a58, uint64_t a59, uint64_t a60, uint64_t a61, uint64_t a62, uint64_t a63, uint64_t a64, uint64_t a65, uint64_t a66, uint64_t a67, uint64_t a68, uint64_t a69, uint64_t a70, uint64_t a71, uint64_t a72, uint64_t a73, uint64_t a74, uint64_t a75, uint64_t a76, uint64_t a77, uint64_t a78, uint64_t a79, uint64_t a80, uint64_t a81, uint64_t a82, uint64_t a83, uint64_t a84, uint64_t a85, uint64_t a86, uint64_t a87, uint64_t a88, uint64_t a89, uint64_t a90, uint64_t a91, uint64_t a92, uint64_t a93, uint64_t a94, uint64_t a95, uint64_t a96, uint64_t a97, uint64_t a98, uint64_t a99, uint64_t a100, uint64_t a101, uint64_t a102, uint64_t a103, uint64_t a104, uint64_t a105, uint64_t a106, uint64_t a107, uint64_t a108, uint64_t a109, uint64_t a110, uint64_t a111, uint64_t a112, uint64_t a113, uint64_t a114, uint64_t a115, uint64_t a116, uint64_t a117, uint64_t a118, uint64_t a119, uint64_t a120, uint64_t a121, uint64_t a122, uint64_t a123, uint64_t a124, uint64_t a125, uint64_t a126, uint64_t a127)  f)

Definition at line 13530 of file ffi_test_functions_generated.cc.

13659 {
13660 uint64_t a0;
13661 uint64_t a1;
13662 uint64_t a2;
13663 uint64_t a3;
13664 uint64_t a4;
13665 uint64_t a5;
13666 uint64_t a6;
13667 uint64_t a7;
13668 uint64_t a8;
13669 uint64_t a9;
13670 uint64_t a10;
13671 uint64_t a11;
13672 uint64_t a12;
13673 uint64_t a13;
13674 uint64_t a14;
13675 uint64_t a15;
13676 uint64_t a16;
13677 uint64_t a17;
13678 uint64_t a18;
13679 uint64_t a19;
13680 uint64_t a20;
13681 uint64_t a21;
13682 uint64_t a22;
13683 uint64_t a23;
13684 uint64_t a24;
13685 uint64_t a25;
13686 uint64_t a26;
13687 uint64_t a27;
13688 uint64_t a28;
13689 uint64_t a29;
13690 uint64_t a30;
13691 uint64_t a31;
13692 uint64_t a32;
13693 uint64_t a33;
13694 uint64_t a34;
13695 uint64_t a35;
13696 uint64_t a36;
13697 uint64_t a37;
13698 uint64_t a38;
13699 uint64_t a39;
13700 uint64_t a40;
13701 uint64_t a41;
13702 uint64_t a42;
13703 uint64_t a43;
13704 uint64_t a44;
13705 uint64_t a45;
13706 uint64_t a46;
13707 uint64_t a47;
13708 uint64_t a48;
13709 uint64_t a49;
13710 uint64_t a50;
13711 uint64_t a51;
13712 uint64_t a52;
13713 uint64_t a53;
13714 uint64_t a54;
13715 uint64_t a55;
13716 uint64_t a56;
13717 uint64_t a57;
13718 uint64_t a58;
13719 uint64_t a59;
13720 uint64_t a60;
13721 uint64_t a61;
13722 uint64_t a62;
13723 uint64_t a63;
13724 uint64_t a64;
13725 uint64_t a65;
13726 uint64_t a66;
13727 uint64_t a67;
13728 uint64_t a68;
13729 uint64_t a69;
13730 uint64_t a70;
13731 uint64_t a71;
13732 uint64_t a72;
13733 uint64_t a73;
13734 uint64_t a74;
13735 uint64_t a75;
13736 uint64_t a76;
13737 uint64_t a77;
13738 uint64_t a78;
13739 uint64_t a79;
13740 uint64_t a80;
13741 uint64_t a81;
13742 uint64_t a82;
13743 uint64_t a83;
13744 uint64_t a84;
13745 uint64_t a85;
13746 uint64_t a86;
13747 uint64_t a87;
13748 uint64_t a88;
13749 uint64_t a89;
13750 uint64_t a90;
13751 uint64_t a91;
13752 uint64_t a92;
13753 uint64_t a93;
13754 uint64_t a94;
13755 uint64_t a95;
13756 uint64_t a96;
13757 uint64_t a97;
13758 uint64_t a98;
13759 uint64_t a99;
13760 uint64_t a100;
13761 uint64_t a101;
13762 uint64_t a102;
13763 uint64_t a103;
13764 uint64_t a104;
13765 uint64_t a105;
13766 uint64_t a106;
13767 uint64_t a107;
13768 uint64_t a108;
13769 uint64_t a109;
13770 uint64_t a110;
13771 uint64_t a111;
13772 uint64_t a112;
13773 uint64_t a113;
13774 uint64_t a114;
13775 uint64_t a115;
13776 uint64_t a116;
13777 uint64_t a117;
13778 uint64_t a118;
13779 uint64_t a119;
13780 uint64_t a120;
13781 uint64_t a121;
13782 uint64_t a122;
13783 uint64_t a123;
13784 uint64_t a124;
13785 uint64_t a125;
13786 uint64_t a126;
13787 uint64_t a127;
13788
13789 a0 = 1;
13790 a1 = 2;
13791 a2 = 3;
13792 a3 = 4;
13793 a4 = 5;
13794 a5 = 6;
13795 a6 = 7;
13796 a7 = 8;
13797 a8 = 9;
13798 a9 = 10;
13799 a10 = 11;
13800 a11 = 12;
13801 a12 = 13;
13802 a13 = 14;
13803 a14 = 15;
13804 a15 = 16;
13805 a16 = 17;
13806 a17 = 18;
13807 a18 = 19;
13808 a19 = 20;
13809 a20 = 21;
13810 a21 = 22;
13811 a22 = 23;
13812 a23 = 24;
13813 a24 = 25;
13814 a25 = 26;
13815 a26 = 27;
13816 a27 = 28;
13817 a28 = 29;
13818 a29 = 30;
13819 a30 = 31;
13820 a31 = 32;
13821 a32 = 33;
13822 a33 = 34;
13823 a34 = 35;
13824 a35 = 36;
13825 a36 = 37;
13826 a37 = 38;
13827 a38 = 39;
13828 a39 = 40;
13829 a40 = 41;
13830 a41 = 42;
13831 a42 = 43;
13832 a43 = 44;
13833 a44 = 45;
13834 a45 = 46;
13835 a46 = 47;
13836 a47 = 48;
13837 a48 = 49;
13838 a49 = 50;
13839 a50 = 51;
13840 a51 = 52;
13841 a52 = 53;
13842 a53 = 54;
13843 a54 = 55;
13844 a55 = 56;
13845 a56 = 57;
13846 a57 = 58;
13847 a58 = 59;
13848 a59 = 60;
13849 a60 = 61;
13850 a61 = 62;
13851 a62 = 63;
13852 a63 = 64;
13853 a64 = 65;
13854 a65 = 66;
13855 a66 = 67;
13856 a67 = 68;
13857 a68 = 69;
13858 a69 = 70;
13859 a70 = 71;
13860 a71 = 72;
13861 a72 = 73;
13862 a73 = 74;
13863 a74 = 75;
13864 a75 = 76;
13865 a76 = 77;
13866 a77 = 78;
13867 a78 = 79;
13868 a79 = 80;
13869 a80 = 81;
13870 a81 = 82;
13871 a82 = 83;
13872 a83 = 84;
13873 a84 = 85;
13874 a85 = 86;
13875 a86 = 87;
13876 a87 = 88;
13877 a88 = 89;
13878 a89 = 90;
13879 a90 = 91;
13880 a91 = 92;
13881 a92 = 93;
13882 a93 = 94;
13883 a94 = 95;
13884 a95 = 96;
13885 a96 = 97;
13886 a97 = 98;
13887 a98 = 99;
13888 a99 = 100;
13889 a100 = 101;
13890 a101 = 102;
13891 a102 = 103;
13892 a103 = 104;
13893 a104 = 105;
13894 a105 = 106;
13895 a106 = 107;
13896 a107 = 108;
13897 a108 = 109;
13898 a109 = 110;
13899 a110 = 111;
13900 a111 = 112;
13901 a112 = 113;
13902 a113 = 114;
13903 a114 = 115;
13904 a115 = 116;
13905 a116 = 117;
13906 a117 = 118;
13907 a118 = 119;
13908 a119 = 120;
13909 a120 = 121;
13910 a121 = 122;
13911 a122 = 123;
13912 a123 = 124;
13913 a124 = 125;
13914 a125 = 126;
13915 a126 = 127;
13916 a127 = 128;
13917
13918 std::cout << "Calling TestReturnStruct1024BytesHomogeneousUint64(" << "("
13919 << a0 << ", " << a1 << ", " << a2 << ", " << a3 << ", " << a4
13920 << ", " << a5 << ", " << a6 << ", " << a7 << ", " << a8 << ", "
13921 << a9 << ", " << a10 << ", " << a11 << ", " << a12 << ", " << a13
13922 << ", " << a14 << ", " << a15 << ", " << a16 << ", " << a17 << ", "
13923 << a18 << ", " << a19 << ", " << a20 << ", " << a21 << ", " << a22
13924 << ", " << a23 << ", " << a24 << ", " << a25 << ", " << a26 << ", "
13925 << a27 << ", " << a28 << ", " << a29 << ", " << a30 << ", " << a31
13926 << ", " << a32 << ", " << a33 << ", " << a34 << ", " << a35 << ", "
13927 << a36 << ", " << a37 << ", " << a38 << ", " << a39 << ", " << a40
13928 << ", " << a41 << ", " << a42 << ", " << a43 << ", " << a44 << ", "
13929 << a45 << ", " << a46 << ", " << a47 << ", " << a48 << ", " << a49
13930 << ", " << a50 << ", " << a51 << ", " << a52 << ", " << a53 << ", "
13931 << a54 << ", " << a55 << ", " << a56 << ", " << a57 << ", " << a58
13932 << ", " << a59 << ", " << a60 << ", " << a61 << ", " << a62 << ", "
13933 << a63 << ", " << a64 << ", " << a65 << ", " << a66 << ", " << a67
13934 << ", " << a68 << ", " << a69 << ", " << a70 << ", " << a71 << ", "
13935 << a72 << ", " << a73 << ", " << a74 << ", " << a75 << ", " << a76
13936 << ", " << a77 << ", " << a78 << ", " << a79 << ", " << a80 << ", "
13937 << a81 << ", " << a82 << ", " << a83 << ", " << a84 << ", " << a85
13938 << ", " << a86 << ", " << a87 << ", " << a88 << ", " << a89 << ", "
13939 << a90 << ", " << a91 << ", " << a92 << ", " << a93 << ", " << a94
13940 << ", " << a95 << ", " << a96 << ", " << a97 << ", " << a98 << ", "
13941 << a99 << ", " << a100 << ", " << a101 << ", " << a102 << ", "
13942 << a103 << ", " << a104 << ", " << a105 << ", " << a106 << ", "
13943 << a107 << ", " << a108 << ", " << a109 << ", " << a110 << ", "
13944 << a111 << ", " << a112 << ", " << a113 << ", " << a114 << ", "
13945 << a115 << ", " << a116 << ", " << a117 << ", " << a118 << ", "
13946 << a119 << ", " << a120 << ", " << a121 << ", " << a122 << ", "
13947 << a123 << ", " << a124 << ", " << a125 << ", " << a126 << ", "
13948 << a127 << ")" << ")\n";
13949
13951 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16,
13952 a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27, a28, a29, a30, a31,
13953 a32, a33, a34, a35, a36, a37, a38, a39, a40, a41, a42, a43, a44, a45, a46,
13954 a47, a48, a49, a50, a51, a52, a53, a54, a55, a56, a57, a58, a59, a60, a61,
13955 a62, a63, a64, a65, a66, a67, a68, a69, a70, a71, a72, a73, a74, a75, a76,
13956 a77, a78, a79, a80, a81, a82, a83, a84, a85, a86, a87, a88, a89, a90, a91,
13957 a92, a93, a94, a95, a96, a97, a98, a99, a100, a101, a102, a103, a104,
13958 a105, a106, a107, a108, a109, a110, a111, a112, a113, a114, a115, a116,
13959 a117, a118, a119, a120, a121, a122, a123, a124, a125, a126, a127);
13960
13961 std::cout << "result = " << "(" << result.a0 << ", " << result.a1 << ", "
13962 << result.a2 << ", " << result.a3 << ", " << result.a4 << ", "
13963 << result.a5 << ", " << result.a6 << ", " << result.a7 << ", "
13964 << result.a8 << ", " << result.a9 << ", " << result.a10 << ", "
13965 << result.a11 << ", " << result.a12 << ", " << result.a13 << ", "
13966 << result.a14 << ", " << result.a15 << ", " << result.a16 << ", "
13967 << result.a17 << ", " << result.a18 << ", " << result.a19 << ", "
13968 << result.a20 << ", " << result.a21 << ", " << result.a22 << ", "
13969 << result.a23 << ", " << result.a24 << ", " << result.a25 << ", "
13970 << result.a26 << ", " << result.a27 << ", " << result.a28 << ", "
13971 << result.a29 << ", " << result.a30 << ", " << result.a31 << ", "
13972 << result.a32 << ", " << result.a33 << ", " << result.a34 << ", "
13973 << result.a35 << ", " << result.a36 << ", " << result.a37 << ", "
13974 << result.a38 << ", " << result.a39 << ", " << result.a40 << ", "
13975 << result.a41 << ", " << result.a42 << ", " << result.a43 << ", "
13976 << result.a44 << ", " << result.a45 << ", " << result.a46 << ", "
13977 << result.a47 << ", " << result.a48 << ", " << result.a49 << ", "
13978 << result.a50 << ", " << result.a51 << ", " << result.a52 << ", "
13979 << result.a53 << ", " << result.a54 << ", " << result.a55 << ", "
13980 << result.a56 << ", " << result.a57 << ", " << result.a58 << ", "
13981 << result.a59 << ", " << result.a60 << ", " << result.a61 << ", "
13982 << result.a62 << ", " << result.a63 << ", " << result.a64 << ", "
13983 << result.a65 << ", " << result.a66 << ", " << result.a67 << ", "
13984 << result.a68 << ", " << result.a69 << ", " << result.a70 << ", "
13985 << result.a71 << ", " << result.a72 << ", " << result.a73 << ", "
13986 << result.a74 << ", " << result.a75 << ", " << result.a76 << ", "
13987 << result.a77 << ", " << result.a78 << ", " << result.a79 << ", "
13988 << result.a80 << ", " << result.a81 << ", " << result.a82 << ", "
13989 << result.a83 << ", " << result.a84 << ", " << result.a85 << ", "
13990 << result.a86 << ", " << result.a87 << ", " << result.a88 << ", "
13991 << result.a89 << ", " << result.a90 << ", " << result.a91 << ", "
13992 << result.a92 << ", " << result.a93 << ", " << result.a94 << ", "
13993 << result.a95 << ", " << result.a96 << ", " << result.a97 << ", "
13994 << result.a98 << ", " << result.a99 << ", " << result.a100 << ", "
13995 << result.a101 << ", " << result.a102 << ", " << result.a103 << ", "
13996 << result.a104 << ", " << result.a105 << ", " << result.a106 << ", "
13997 << result.a107 << ", " << result.a108 << ", " << result.a109 << ", "
13998 << result.a110 << ", " << result.a111 << ", " << result.a112 << ", "
13999 << result.a113 << ", " << result.a114 << ", " << result.a115 << ", "
14000 << result.a116 << ", " << result.a117 << ", " << result.a118 << ", "
14001 << result.a119 << ", " << result.a120 << ", " << result.a121 << ", "
14002 << result.a122 << ", " << result.a123 << ", " << result.a124 << ", "
14003 << result.a125 << ", " << result.a126 << ", " << result.a127 << ")"
14004 << "\n";
14005
14006 CHECK_EQ(a0, result.a0);
14007 CHECK_EQ(a1, result.a1);
14008 CHECK_EQ(a2, result.a2);
14009 CHECK_EQ(a3, result.a3);
14010 CHECK_EQ(a4, result.a4);
14011 CHECK_EQ(a5, result.a5);
14012 CHECK_EQ(a6, result.a6);
14013 CHECK_EQ(a7, result.a7);
14014 CHECK_EQ(a8, result.a8);
14015 CHECK_EQ(a9, result.a9);
14016 CHECK_EQ(a10, result.a10);
14017 CHECK_EQ(a11, result.a11);
14018 CHECK_EQ(a12, result.a12);
14019 CHECK_EQ(a13, result.a13);
14020 CHECK_EQ(a14, result.a14);
14021 CHECK_EQ(a15, result.a15);
14022 CHECK_EQ(a16, result.a16);
14023 CHECK_EQ(a17, result.a17);
14024 CHECK_EQ(a18, result.a18);
14025 CHECK_EQ(a19, result.a19);
14026 CHECK_EQ(a20, result.a20);
14027 CHECK_EQ(a21, result.a21);
14028 CHECK_EQ(a22, result.a22);
14029 CHECK_EQ(a23, result.a23);
14030 CHECK_EQ(a24, result.a24);
14031 CHECK_EQ(a25, result.a25);
14032 CHECK_EQ(a26, result.a26);
14033 CHECK_EQ(a27, result.a27);
14034 CHECK_EQ(a28, result.a28);
14035 CHECK_EQ(a29, result.a29);
14036 CHECK_EQ(a30, result.a30);
14037 CHECK_EQ(a31, result.a31);
14038 CHECK_EQ(a32, result.a32);
14039 CHECK_EQ(a33, result.a33);
14040 CHECK_EQ(a34, result.a34);
14041 CHECK_EQ(a35, result.a35);
14042 CHECK_EQ(a36, result.a36);
14043 CHECK_EQ(a37, result.a37);
14044 CHECK_EQ(a38, result.a38);
14045 CHECK_EQ(a39, result.a39);
14046 CHECK_EQ(a40, result.a40);
14047 CHECK_EQ(a41, result.a41);
14048 CHECK_EQ(a42, result.a42);
14049 CHECK_EQ(a43, result.a43);
14050 CHECK_EQ(a44, result.a44);
14051 CHECK_EQ(a45, result.a45);
14052 CHECK_EQ(a46, result.a46);
14053 CHECK_EQ(a47, result.a47);
14054 CHECK_EQ(a48, result.a48);
14055 CHECK_EQ(a49, result.a49);
14056 CHECK_EQ(a50, result.a50);
14057 CHECK_EQ(a51, result.a51);
14058 CHECK_EQ(a52, result.a52);
14059 CHECK_EQ(a53, result.a53);
14060 CHECK_EQ(a54, result.a54);
14061 CHECK_EQ(a55, result.a55);
14062 CHECK_EQ(a56, result.a56);
14063 CHECK_EQ(a57, result.a57);
14064 CHECK_EQ(a58, result.a58);
14065 CHECK_EQ(a59, result.a59);
14066 CHECK_EQ(a60, result.a60);
14067 CHECK_EQ(a61, result.a61);
14068 CHECK_EQ(a62, result.a62);
14069 CHECK_EQ(a63, result.a63);
14070 CHECK_EQ(a64, result.a64);
14071 CHECK_EQ(a65, result.a65);
14072 CHECK_EQ(a66, result.a66);
14073 CHECK_EQ(a67, result.a67);
14074 CHECK_EQ(a68, result.a68);
14075 CHECK_EQ(a69, result.a69);
14076 CHECK_EQ(a70, result.a70);
14077 CHECK_EQ(a71, result.a71);
14078 CHECK_EQ(a72, result.a72);
14079 CHECK_EQ(a73, result.a73);
14080 CHECK_EQ(a74, result.a74);
14081 CHECK_EQ(a75, result.a75);
14082 CHECK_EQ(a76, result.a76);
14083 CHECK_EQ(a77, result.a77);
14084 CHECK_EQ(a78, result.a78);
14085 CHECK_EQ(a79, result.a79);
14086 CHECK_EQ(a80, result.a80);
14087 CHECK_EQ(a81, result.a81);
14088 CHECK_EQ(a82, result.a82);
14089 CHECK_EQ(a83, result.a83);
14090 CHECK_EQ(a84, result.a84);
14091 CHECK_EQ(a85, result.a85);
14092 CHECK_EQ(a86, result.a86);
14093 CHECK_EQ(a87, result.a87);
14094 CHECK_EQ(a88, result.a88);
14095 CHECK_EQ(a89, result.a89);
14096 CHECK_EQ(a90, result.a90);
14097 CHECK_EQ(a91, result.a91);
14098 CHECK_EQ(a92, result.a92);
14099 CHECK_EQ(a93, result.a93);
14100 CHECK_EQ(a94, result.a94);
14101 CHECK_EQ(a95, result.a95);
14102 CHECK_EQ(a96, result.a96);
14103 CHECK_EQ(a97, result.a97);
14104 CHECK_EQ(a98, result.a98);
14105 CHECK_EQ(a99, result.a99);
14106 CHECK_EQ(a100, result.a100);
14107 CHECK_EQ(a101, result.a101);
14108 CHECK_EQ(a102, result.a102);
14109 CHECK_EQ(a103, result.a103);
14110 CHECK_EQ(a104, result.a104);
14111 CHECK_EQ(a105, result.a105);
14112 CHECK_EQ(a106, result.a106);
14113 CHECK_EQ(a107, result.a107);
14114 CHECK_EQ(a108, result.a108);
14115 CHECK_EQ(a109, result.a109);
14116 CHECK_EQ(a110, result.a110);
14117 CHECK_EQ(a111, result.a111);
14118 CHECK_EQ(a112, result.a112);
14119 CHECK_EQ(a113, result.a113);
14120 CHECK_EQ(a114, result.a114);
14121 CHECK_EQ(a115, result.a115);
14122 CHECK_EQ(a116, result.a116);
14123 CHECK_EQ(a117, result.a117);
14124 CHECK_EQ(a118, result.a118);
14125 CHECK_EQ(a119, result.a119);
14126 CHECK_EQ(a120, result.a120);
14127 CHECK_EQ(a121, result.a121);
14128 CHECK_EQ(a122, result.a122);
14129 CHECK_EQ(a123, result.a123);
14130 CHECK_EQ(a124, result.a124);
14131 CHECK_EQ(a125, result.a125);
14132 CHECK_EQ(a126, result.a126);
14133 CHECK_EQ(a127, result.a127);
14134
14135 // Pass argument that will make the Dart callback throw.
14136 a0 = 42;
14137
14138 result = f(
14139 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16,
14140 a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27, a28, a29, a30, a31,
14141 a32, a33, a34, a35, a36, a37, a38, a39, a40, a41, a42, a43, a44, a45, a46,
14142 a47, a48, a49, a50, a51, a52, a53, a54, a55, a56, a57, a58, a59, a60, a61,
14143 a62, a63, a64, a65, a66, a67, a68, a69, a70, a71, a72, a73, a74, a75, a76,
14144 a77, a78, a79, a80, a81, a82, a83, a84, a85, a86, a87, a88, a89, a90, a91,
14145 a92, a93, a94, a95, a96, a97, a98, a99, a100, a101, a102, a103, a104,
14146 a105, a106, a107, a108, a109, a110, a111, a112, a113, a114, a115, a116,
14147 a117, a118, a119, a120, a121, a122, a123, a124, a125, a126, a127);
14148
14149 CHECK_EQ(0, result.a0);
14150 CHECK_EQ(0, result.a1);
14151 CHECK_EQ(0, result.a2);
14152 CHECK_EQ(0, result.a3);
14153 CHECK_EQ(0, result.a4);
14154 CHECK_EQ(0, result.a5);
14155 CHECK_EQ(0, result.a6);
14156 CHECK_EQ(0, result.a7);
14157 CHECK_EQ(0, result.a8);
14158 CHECK_EQ(0, result.a9);
14159 CHECK_EQ(0, result.a10);
14160 CHECK_EQ(0, result.a11);
14161 CHECK_EQ(0, result.a12);
14162 CHECK_EQ(0, result.a13);
14163 CHECK_EQ(0, result.a14);
14164 CHECK_EQ(0, result.a15);
14165 CHECK_EQ(0, result.a16);
14166 CHECK_EQ(0, result.a17);
14167 CHECK_EQ(0, result.a18);
14168 CHECK_EQ(0, result.a19);
14169 CHECK_EQ(0, result.a20);
14170 CHECK_EQ(0, result.a21);
14171 CHECK_EQ(0, result.a22);
14172 CHECK_EQ(0, result.a23);
14173 CHECK_EQ(0, result.a24);
14174 CHECK_EQ(0, result.a25);
14175 CHECK_EQ(0, result.a26);
14176 CHECK_EQ(0, result.a27);
14177 CHECK_EQ(0, result.a28);
14178 CHECK_EQ(0, result.a29);
14179 CHECK_EQ(0, result.a30);
14180 CHECK_EQ(0, result.a31);
14181 CHECK_EQ(0, result.a32);
14182 CHECK_EQ(0, result.a33);
14183 CHECK_EQ(0, result.a34);
14184 CHECK_EQ(0, result.a35);
14185 CHECK_EQ(0, result.a36);
14186 CHECK_EQ(0, result.a37);
14187 CHECK_EQ(0, result.a38);
14188 CHECK_EQ(0, result.a39);
14189 CHECK_EQ(0, result.a40);
14190 CHECK_EQ(0, result.a41);
14191 CHECK_EQ(0, result.a42);
14192 CHECK_EQ(0, result.a43);
14193 CHECK_EQ(0, result.a44);
14194 CHECK_EQ(0, result.a45);
14195 CHECK_EQ(0, result.a46);
14196 CHECK_EQ(0, result.a47);
14197 CHECK_EQ(0, result.a48);
14198 CHECK_EQ(0, result.a49);
14199 CHECK_EQ(0, result.a50);
14200 CHECK_EQ(0, result.a51);
14201 CHECK_EQ(0, result.a52);
14202 CHECK_EQ(0, result.a53);
14203 CHECK_EQ(0, result.a54);
14204 CHECK_EQ(0, result.a55);
14205 CHECK_EQ(0, result.a56);
14206 CHECK_EQ(0, result.a57);
14207 CHECK_EQ(0, result.a58);
14208 CHECK_EQ(0, result.a59);
14209 CHECK_EQ(0, result.a60);
14210 CHECK_EQ(0, result.a61);
14211 CHECK_EQ(0, result.a62);
14212 CHECK_EQ(0, result.a63);
14213 CHECK_EQ(0, result.a64);
14214 CHECK_EQ(0, result.a65);
14215 CHECK_EQ(0, result.a66);
14216 CHECK_EQ(0, result.a67);
14217 CHECK_EQ(0, result.a68);
14218 CHECK_EQ(0, result.a69);
14219 CHECK_EQ(0, result.a70);
14220 CHECK_EQ(0, result.a71);
14221 CHECK_EQ(0, result.a72);
14222 CHECK_EQ(0, result.a73);
14223 CHECK_EQ(0, result.a74);
14224 CHECK_EQ(0, result.a75);
14225 CHECK_EQ(0, result.a76);
14226 CHECK_EQ(0, result.a77);
14227 CHECK_EQ(0, result.a78);
14228 CHECK_EQ(0, result.a79);
14229 CHECK_EQ(0, result.a80);
14230 CHECK_EQ(0, result.a81);
14231 CHECK_EQ(0, result.a82);
14232 CHECK_EQ(0, result.a83);
14233 CHECK_EQ(0, result.a84);
14234 CHECK_EQ(0, result.a85);
14235 CHECK_EQ(0, result.a86);
14236 CHECK_EQ(0, result.a87);
14237 CHECK_EQ(0, result.a88);
14238 CHECK_EQ(0, result.a89);
14239 CHECK_EQ(0, result.a90);
14240 CHECK_EQ(0, result.a91);
14241 CHECK_EQ(0, result.a92);
14242 CHECK_EQ(0, result.a93);
14243 CHECK_EQ(0, result.a94);
14244 CHECK_EQ(0, result.a95);
14245 CHECK_EQ(0, result.a96);
14246 CHECK_EQ(0, result.a97);
14247 CHECK_EQ(0, result.a98);
14248 CHECK_EQ(0, result.a99);
14249 CHECK_EQ(0, result.a100);
14250 CHECK_EQ(0, result.a101);
14251 CHECK_EQ(0, result.a102);
14252 CHECK_EQ(0, result.a103);
14253 CHECK_EQ(0, result.a104);
14254 CHECK_EQ(0, result.a105);
14255 CHECK_EQ(0, result.a106);
14256 CHECK_EQ(0, result.a107);
14257 CHECK_EQ(0, result.a108);
14258 CHECK_EQ(0, result.a109);
14259 CHECK_EQ(0, result.a110);
14260 CHECK_EQ(0, result.a111);
14261 CHECK_EQ(0, result.a112);
14262 CHECK_EQ(0, result.a113);
14263 CHECK_EQ(0, result.a114);
14264 CHECK_EQ(0, result.a115);
14265 CHECK_EQ(0, result.a116);
14266 CHECK_EQ(0, result.a117);
14267 CHECK_EQ(0, result.a118);
14268 CHECK_EQ(0, result.a119);
14269 CHECK_EQ(0, result.a120);
14270 CHECK_EQ(0, result.a121);
14271 CHECK_EQ(0, result.a122);
14272 CHECK_EQ(0, result.a123);
14273 CHECK_EQ(0, result.a124);
14274 CHECK_EQ(0, result.a125);
14275 CHECK_EQ(0, result.a126);
14276 CHECK_EQ(0, result.a127);
14277
14278 // Pass argument that will make the Dart callback return null.
14279 a0 = 84;
14280
14281 result = f(
14282 a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16,
14283 a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27, a28, a29, a30, a31,
14284 a32, a33, a34, a35, a36, a37, a38, a39, a40, a41, a42, a43, a44, a45, a46,
14285 a47, a48, a49, a50, a51, a52, a53, a54, a55, a56, a57, a58, a59, a60, a61,
14286 a62, a63, a64, a65, a66, a67, a68, a69, a70, a71, a72, a73, a74, a75, a76,
14287 a77, a78, a79, a80, a81, a82, a83, a84, a85, a86, a87, a88, a89, a90, a91,
14288 a92, a93, a94, a95, a96, a97, a98, a99, a100, a101, a102, a103, a104,
14289 a105, a106, a107, a108, a109, a110, a111, a112, a113, a114, a115, a116,
14290 a117, a118, a119, a120, a121, a122, a123, a124, a125, a126, a127);
14291
14292 CHECK_EQ(0, result.a0);
14293 CHECK_EQ(0, result.a1);
14294 CHECK_EQ(0, result.a2);
14295 CHECK_EQ(0, result.a3);
14296 CHECK_EQ(0, result.a4);
14297 CHECK_EQ(0, result.a5);
14298 CHECK_EQ(0, result.a6);
14299 CHECK_EQ(0, result.a7);
14300 CHECK_EQ(0, result.a8);
14301 CHECK_EQ(0, result.a9);
14302 CHECK_EQ(0, result.a10);
14303 CHECK_EQ(0, result.a11);
14304 CHECK_EQ(0, result.a12);
14305 CHECK_EQ(0, result.a13);
14306 CHECK_EQ(0, result.a14);
14307 CHECK_EQ(0, result.a15);
14308 CHECK_EQ(0, result.a16);
14309 CHECK_EQ(0, result.a17);
14310 CHECK_EQ(0, result.a18);
14311 CHECK_EQ(0, result.a19);
14312 CHECK_EQ(0, result.a20);
14313 CHECK_EQ(0, result.a21);
14314 CHECK_EQ(0, result.a22);
14315 CHECK_EQ(0, result.a23);
14316 CHECK_EQ(0, result.a24);
14317 CHECK_EQ(0, result.a25);
14318 CHECK_EQ(0, result.a26);
14319 CHECK_EQ(0, result.a27);
14320 CHECK_EQ(0, result.a28);
14321 CHECK_EQ(0, result.a29);
14322 CHECK_EQ(0, result.a30);
14323 CHECK_EQ(0, result.a31);
14324 CHECK_EQ(0, result.a32);
14325 CHECK_EQ(0, result.a33);
14326 CHECK_EQ(0, result.a34);
14327 CHECK_EQ(0, result.a35);
14328 CHECK_EQ(0, result.a36);
14329 CHECK_EQ(0, result.a37);
14330 CHECK_EQ(0, result.a38);
14331 CHECK_EQ(0, result.a39);
14332 CHECK_EQ(0, result.a40);
14333 CHECK_EQ(0, result.a41);
14334 CHECK_EQ(0, result.a42);
14335 CHECK_EQ(0, result.a43);
14336 CHECK_EQ(0, result.a44);
14337 CHECK_EQ(0, result.a45);
14338 CHECK_EQ(0, result.a46);
14339 CHECK_EQ(0, result.a47);
14340 CHECK_EQ(0, result.a48);
14341 CHECK_EQ(0, result.a49);
14342 CHECK_EQ(0, result.a50);
14343 CHECK_EQ(0, result.a51);
14344 CHECK_EQ(0, result.a52);
14345 CHECK_EQ(0, result.a53);
14346 CHECK_EQ(0, result.a54);
14347 CHECK_EQ(0, result.a55);
14348 CHECK_EQ(0, result.a56);
14349 CHECK_EQ(0, result.a57);
14350 CHECK_EQ(0, result.a58);
14351 CHECK_EQ(0, result.a59);
14352 CHECK_EQ(0, result.a60);
14353 CHECK_EQ(0, result.a61);
14354 CHECK_EQ(0, result.a62);
14355 CHECK_EQ(0, result.a63);
14356 CHECK_EQ(0, result.a64);
14357 CHECK_EQ(0, result.a65);
14358 CHECK_EQ(0, result.a66);
14359 CHECK_EQ(0, result.a67);
14360 CHECK_EQ(0, result.a68);
14361 CHECK_EQ(0, result.a69);
14362 CHECK_EQ(0, result.a70);
14363 CHECK_EQ(0, result.a71);
14364 CHECK_EQ(0, result.a72);
14365 CHECK_EQ(0, result.a73);
14366 CHECK_EQ(0, result.a74);
14367 CHECK_EQ(0, result.a75);
14368 CHECK_EQ(0, result.a76);
14369 CHECK_EQ(0, result.a77);
14370 CHECK_EQ(0, result.a78);
14371 CHECK_EQ(0, result.a79);
14372 CHECK_EQ(0, result.a80);
14373 CHECK_EQ(0, result.a81);
14374 CHECK_EQ(0, result.a82);
14375 CHECK_EQ(0, result.a83);
14376 CHECK_EQ(0, result.a84);
14377 CHECK_EQ(0, result.a85);
14378 CHECK_EQ(0, result.a86);
14379 CHECK_EQ(0, result.a87);
14380 CHECK_EQ(0, result.a88);
14381 CHECK_EQ(0, result.a89);
14382 CHECK_EQ(0, result.a90);
14383 CHECK_EQ(0, result.a91);
14384 CHECK_EQ(0, result.a92);
14385 CHECK_EQ(0, result.a93);
14386 CHECK_EQ(0, result.a94);
14387 CHECK_EQ(0, result.a95);
14388 CHECK_EQ(0, result.a96);
14389 CHECK_EQ(0, result.a97);
14390 CHECK_EQ(0, result.a98);
14391 CHECK_EQ(0, result.a99);
14392 CHECK_EQ(0, result.a100);
14393 CHECK_EQ(0, result.a101);
14394 CHECK_EQ(0, result.a102);
14395 CHECK_EQ(0, result.a103);
14396 CHECK_EQ(0, result.a104);
14397 CHECK_EQ(0, result.a105);
14398 CHECK_EQ(0, result.a106);
14399 CHECK_EQ(0, result.a107);
14400 CHECK_EQ(0, result.a108);
14401 CHECK_EQ(0, result.a109);
14402 CHECK_EQ(0, result.a110);
14403 CHECK_EQ(0, result.a111);
14404 CHECK_EQ(0, result.a112);
14405 CHECK_EQ(0, result.a113);
14406 CHECK_EQ(0, result.a114);
14407 CHECK_EQ(0, result.a115);
14408 CHECK_EQ(0, result.a116);
14409 CHECK_EQ(0, result.a117);
14410 CHECK_EQ(0, result.a118);
14411 CHECK_EQ(0, result.a119);
14412 CHECK_EQ(0, result.a120);
14413 CHECK_EQ(0, result.a121);
14414 CHECK_EQ(0, result.a122);
14415 CHECK_EQ(0, result.a123);
14416 CHECK_EQ(0, result.a124);
14417 CHECK_EQ(0, result.a125);
14418 CHECK_EQ(0, result.a126);
14419 CHECK_EQ(0, result.a127);
14420
14421 return 0;
14422}

◆ TestReturnStruct12BytesHomogeneousFloat()

DART_EXPORT intptr_t dart::TestReturnStruct12BytesHomogeneousFloat ( Struct12BytesHomogeneousFloat(*)(float a0, float a1, float a2)  f)

Definition at line 12886 of file ffi_test_functions_generated.cc.

12888 {
12889 float a0;
12890 float a1;
12891 float a2;
12892
12893 a0 = -1.0;
12894 a1 = 2.0;
12895 a2 = -3.0;
12896
12897 std::cout << "Calling TestReturnStruct12BytesHomogeneousFloat(" << "(" << a0
12898 << ", " << a1 << ", " << a2 << ")" << ")\n";
12899
12900 Struct12BytesHomogeneousFloat result = f(a0, a1, a2);
12901
12902 std::cout << "result = " << "(" << result.a0 << ", " << result.a1 << ", "
12903 << result.a2 << ")" << "\n";
12904
12905 CHECK_APPROX(a0, result.a0);
12906 CHECK_APPROX(a1, result.a1);
12907 CHECK_APPROX(a2, result.a2);
12908
12909 // Pass argument that will make the Dart callback throw.
12910 a0 = 42;
12911
12912 result = f(a0, a1, a2);
12913
12914 CHECK_APPROX(0.0, result.a0);
12915 CHECK_APPROX(0.0, result.a1);
12916 CHECK_APPROX(0.0, result.a2);
12917
12918 // Pass argument that will make the Dart callback return null.
12919 a0 = 84;
12920
12921 result = f(a0, a1, a2);
12922
12923 CHECK_APPROX(0.0, result.a0);
12924 CHECK_APPROX(0.0, result.a1);
12925 CHECK_APPROX(0.0, result.a2);
12926
12927 return 0;
12928}

◆ TestReturnStruct16BytesHomogeneousFloat()

DART_EXPORT intptr_t dart::TestReturnStruct16BytesHomogeneousFloat ( Struct16BytesHomogeneousFloat( *f)(float a0, float a1, float a2, float a3)  )

Definition at line 12932 of file ffi_test_functions_generated.cc.

12935 {
12936 float a0;
12937 float a1;
12938 float a2;
12939 float a3;
12940
12941 a0 = -1.0;
12942 a1 = 2.0;
12943 a2 = -3.0;
12944 a3 = 4.0;
12945
12946 std::cout << "Calling TestReturnStruct16BytesHomogeneousFloat(" << "(" << a0
12947 << ", " << a1 << ", " << a2 << ", " << a3 << ")" << ")\n";
12948
12949 Struct16BytesHomogeneousFloat result = f(a0, a1, a2, a3);
12950
12951 std::cout << "result = " << "(" << result.a0 << ", " << result.a1 << ", "
12952 << result.a2 << ", " << result.a3 << ")" << "\n";
12953
12954 CHECK_APPROX(a0, result.a0);
12955 CHECK_APPROX(a1, result.a1);
12956 CHECK_APPROX(a2, result.a2);
12957 CHECK_APPROX(a3, result.a3);
12958
12959 // Pass argument that will make the Dart callback throw.
12960 a0 = 42;
12961
12962 result = f(a0, a1, a2, a3);
12963
12964 CHECK_APPROX(0.0, result.a0);
12965 CHECK_APPROX(0.0, result.a1);
12966 CHECK_APPROX(0.0, result.a2);
12967 CHECK_APPROX(0.0, result.a3);
12968
12969 // Pass argument that will make the Dart callback return null.
12970 a0 = 84;
12971
12972 result = f(a0, a1, a2, a3);
12973
12974 CHECK_APPROX(0.0, result.a0);
12975 CHECK_APPROX(0.0, result.a1);
12976 CHECK_APPROX(0.0, result.a2);
12977 CHECK_APPROX(0.0, result.a3);
12978
12979 return 0;
12980}

◆ TestReturnStruct16BytesMixed()

DART_EXPORT intptr_t dart::TestReturnStruct16BytesMixed ( Struct16BytesMixed(*)(double a0, int64_t a1)  f)

Definition at line 12984 of file ffi_test_functions_generated.cc.

12986 {
12987 double a0;
12988 int64_t a1;
12989
12990 a0 = -1.0;
12991 a1 = 2;
12992
12993 std::cout << "Calling TestReturnStruct16BytesMixed(" << "(" << a0 << ", "
12994 << a1 << ")" << ")\n";
12995
12996 Struct16BytesMixed result = f(a0, a1);
12997
12998 std::cout << "result = " << "(" << result.a0 << ", " << result.a1 << ")"
12999 << "\n";
13000
13001 CHECK_APPROX(a0, result.a0);
13002 CHECK_EQ(a1, result.a1);
13003
13004 // Pass argument that will make the Dart callback throw.
13005 a0 = 42;
13006
13007 result = f(a0, a1);
13008
13009 CHECK_APPROX(0.0, result.a0);
13010 CHECK_EQ(0, result.a1);
13011
13012 // Pass argument that will make the Dart callback return null.
13013 a0 = 84;
13014
13015 result = f(a0, a1);
13016
13017 CHECK_APPROX(0.0, result.a0);
13018 CHECK_EQ(0, result.a1);
13019
13020 return 0;
13021}

◆ TestReturnStruct16BytesMixed2()

DART_EXPORT intptr_t dart::TestReturnStruct16BytesMixed2 ( Struct16BytesMixed2(*)(float a0, float a1, float a2, int32_t a3)  f)

Definition at line 13026 of file ffi_test_functions_generated.cc.

13028 {
13029 float a0;
13030 float a1;
13031 float a2;
13032 int32_t a3;
13033
13034 a0 = -1.0;
13035 a1 = 2.0;
13036 a2 = -3.0;
13037 a3 = 4;
13038
13039 std::cout << "Calling TestReturnStruct16BytesMixed2(" << "(" << a0 << ", "
13040 << a1 << ", " << a2 << ", " << a3 << ")" << ")\n";
13041
13042 Struct16BytesMixed2 result = f(a0, a1, a2, a3);
13043
13044 std::cout << "result = " << "(" << result.a0 << ", " << result.a1 << ", "
13045 << result.a2 << ", " << result.a3 << ")" << "\n";
13046
13047 CHECK_APPROX(a0, result.a0);
13048 CHECK_APPROX(a1, result.a1);
13049 CHECK_APPROX(a2, result.a2);
13050 CHECK_EQ(a3, result.a3);
13051
13052 // Pass argument that will make the Dart callback throw.
13053 a0 = 42;
13054
13055 result = f(a0, a1, a2, a3);
13056
13057 CHECK_APPROX(0.0, result.a0);
13058 CHECK_APPROX(0.0, result.a1);
13059 CHECK_APPROX(0.0, result.a2);
13060 CHECK_EQ(0, result.a3);
13061
13062 // Pass argument that will make the Dart callback return null.
13063 a0 = 84;
13064
13065 result = f(a0, a1, a2, a3);
13066
13067 CHECK_APPROX(0.0, result.a0);
13068 CHECK_APPROX(0.0, result.a1);
13069 CHECK_APPROX(0.0, result.a2);
13070 CHECK_EQ(0, result.a3);
13071
13072 return 0;
13073}

◆ TestReturnStruct16BytesNestedInt()

DART_EXPORT intptr_t dart::TestReturnStruct16BytesNestedInt ( Struct16BytesNestedInt(*)(Struct8BytesNestedInt a0, Struct8BytesNestedInt a1)  f)

Definition at line 15556 of file ffi_test_functions_generated.cc.

15559 {
15560 Struct8BytesNestedInt a0 = {};
15561 Struct8BytesNestedInt a1 = {};
15562
15563 a0.a0.a0 = -1;
15564 a0.a0.a1 = 2;
15565 a0.a1.a0 = -3;
15566 a0.a1.a1 = 4;
15567 a1.a0.a0 = -5;
15568 a1.a0.a1 = 6;
15569 a1.a1.a0 = -7;
15570 a1.a1.a1 = 8;
15571
15572 std::cout << "Calling TestReturnStruct16BytesNestedInt(" << "(((" << a0.a0.a0
15573 << ", " << a0.a0.a1 << "), (" << a0.a1.a0 << ", " << a0.a1.a1
15574 << ")), ((" << a1.a0.a0 << ", " << a1.a0.a1 << "), (" << a1.a1.a0
15575 << ", " << a1.a1.a1 << ")))" << ")\n";
15576
15577 Struct16BytesNestedInt result = f(a0, a1);
15578
15579 std::cout << "result = " << "(((" << result.a0.a0.a0 << ", "
15580 << result.a0.a0.a1 << "), (" << result.a0.a1.a0 << ", "
15581 << result.a0.a1.a1 << ")), ((" << result.a1.a0.a0 << ", "
15582 << result.a1.a0.a1 << "), (" << result.a1.a1.a0 << ", "
15583 << result.a1.a1.a1 << ")))" << "\n";
15584
15585 CHECK_EQ(a0.a0.a0, result.a0.a0.a0);
15586 CHECK_EQ(a0.a0.a1, result.a0.a0.a1);
15587 CHECK_EQ(a0.a1.a0, result.a0.a1.a0);
15588 CHECK_EQ(a0.a1.a1, result.a0.a1.a1);
15589 CHECK_EQ(a1.a0.a0, result.a1.a0.a0);
15590 CHECK_EQ(a1.a0.a1, result.a1.a0.a1);
15591 CHECK_EQ(a1.a1.a0, result.a1.a1.a0);
15592 CHECK_EQ(a1.a1.a1, result.a1.a1.a1);
15593
15594 // Pass argument that will make the Dart callback throw.
15595 a0.a0.a0 = 42;
15596
15597 result = f(a0, a1);
15598
15599 CHECK_EQ(0, result.a0.a0.a0);
15600 CHECK_EQ(0, result.a0.a0.a1);
15601 CHECK_EQ(0, result.a0.a1.a0);
15602 CHECK_EQ(0, result.a0.a1.a1);
15603 CHECK_EQ(0, result.a1.a0.a0);
15604 CHECK_EQ(0, result.a1.a0.a1);
15605 CHECK_EQ(0, result.a1.a1.a0);
15606 CHECK_EQ(0, result.a1.a1.a1);
15607
15608 // Pass argument that will make the Dart callback return null.
15609 a0.a0.a0 = 84;
15610
15611 result = f(a0, a1);
15612
15613 CHECK_EQ(0, result.a0.a0.a0);
15614 CHECK_EQ(0, result.a0.a0.a1);
15615 CHECK_EQ(0, result.a0.a1.a0);
15616 CHECK_EQ(0, result.a0.a1.a1);
15617 CHECK_EQ(0, result.a1.a0.a0);
15618 CHECK_EQ(0, result.a1.a0.a1);
15619 CHECK_EQ(0, result.a1.a1.a0);
15620 CHECK_EQ(0, result.a1.a1.a1);
15621
15622 return 0;
15623}

◆ TestReturnStruct17BytesInt()

DART_EXPORT intptr_t dart::TestReturnStruct17BytesInt ( Struct17BytesInt(*)(int64_t a0, int64_t a1, int8_t a2)  f)

Definition at line 13079 of file ffi_test_functions_generated.cc.

13081 {
13082 int64_t a0;
13083 int64_t a1;
13084 int8_t a2;
13085
13086 a0 = -1;
13087 a1 = 2;
13088 a2 = -3;
13089
13090 std::cout << "Calling TestReturnStruct17BytesInt(" << "(" << a0 << ", " << a1
13091 << ", " << static_cast<int>(a2) << ")" << ")\n";
13092
13093 Struct17BytesInt result = f(a0, a1, a2);
13094
13095 std::cout << "result = " << "(" << result.a0 << ", " << result.a1 << ", "
13096 << static_cast<int>(result.a2) << ")" << "\n";
13097
13098 CHECK_EQ(a0, result.a0);
13099 CHECK_EQ(a1, result.a1);
13100 CHECK_EQ(a2, result.a2);
13101
13102 // Pass argument that will make the Dart callback throw.
13103 a0 = 42;
13104
13105 result = f(a0, a1, a2);
13106
13107 CHECK_EQ(0, result.a0);
13108 CHECK_EQ(0, result.a1);
13109 CHECK_EQ(0, result.a2);
13110
13111 // Pass argument that will make the Dart callback return null.
13112 a0 = 84;
13113
13114 result = f(a0, a1, a2);
13115
13116 CHECK_EQ(0, result.a0);
13117 CHECK_EQ(0, result.a1);
13118 CHECK_EQ(0, result.a2);
13119
13120 return 0;
13121}

◆ TestReturnStruct19BytesHomogeneousUint8()

DART_EXPORT intptr_t dart::TestReturnStruct19BytesHomogeneousUint8 ( Struct19BytesHomogeneousUint8(*)(uint8_t a0, uint8_t a1, uint8_t a2, uint8_t a3, uint8_t a4, uint8_t a5, uint8_t a6, uint8_t a7, uint8_t a8, uint8_t a9, uint8_t a10, uint8_t a11, uint8_t a12, uint8_t a13, uint8_t a14, uint8_t a15, uint8_t a16, uint8_t a17, uint8_t a18)  f)

Definition at line 13127 of file ffi_test_functions_generated.cc.

13147 {
13148 uint8_t a0;
13149 uint8_t a1;
13150 uint8_t a2;
13151 uint8_t a3;
13152 uint8_t a4;
13153 uint8_t a5;
13154 uint8_t a6;
13155 uint8_t a7;
13156 uint8_t a8;
13157 uint8_t a9;
13158 uint8_t a10;
13159 uint8_t a11;
13160 uint8_t a12;
13161 uint8_t a13;
13162 uint8_t a14;
13163 uint8_t a15;
13164 uint8_t a16;
13165 uint8_t a17;
13166 uint8_t a18;
13167
13168 a0 = 1;
13169 a1 = 2;
13170 a2 = 3;
13171 a3 = 4;
13172 a4 = 5;
13173 a5 = 6;
13174 a6 = 7;
13175 a7 = 8;
13176 a8 = 9;
13177 a9 = 10;
13178 a10 = 11;
13179 a11 = 12;
13180 a12 = 13;
13181 a13 = 14;
13182 a14 = 15;
13183 a15 = 16;
13184 a16 = 17;
13185 a17 = 18;
13186 a18 = 19;
13187
13188 std::cout << "Calling TestReturnStruct19BytesHomogeneousUint8(" << "("
13189 << static_cast<int>(a0) << ", " << static_cast<int>(a1) << ", "
13190 << static_cast<int>(a2) << ", " << static_cast<int>(a3) << ", "
13191 << static_cast<int>(a4) << ", " << static_cast<int>(a5) << ", "
13192 << static_cast<int>(a6) << ", " << static_cast<int>(a7) << ", "
13193 << static_cast<int>(a8) << ", " << static_cast<int>(a9) << ", "
13194 << static_cast<int>(a10) << ", " << static_cast<int>(a11) << ", "
13195 << static_cast<int>(a12) << ", " << static_cast<int>(a13) << ", "
13196 << static_cast<int>(a14) << ", " << static_cast<int>(a15) << ", "
13197 << static_cast<int>(a16) << ", " << static_cast<int>(a17) << ", "
13198 << static_cast<int>(a18) << ")" << ")\n";
13199
13201 f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15,
13202 a16, a17, a18);
13203
13204 std::cout << "result = " << "(" << static_cast<int>(result.a0) << ", "
13205 << static_cast<int>(result.a1) << ", "
13206 << static_cast<int>(result.a2) << ", "
13207 << static_cast<int>(result.a3) << ", "
13208 << static_cast<int>(result.a4) << ", "
13209 << static_cast<int>(result.a5) << ", "
13210 << static_cast<int>(result.a6) << ", "
13211 << static_cast<int>(result.a7) << ", "
13212 << static_cast<int>(result.a8) << ", "
13213 << static_cast<int>(result.a9) << ", "
13214 << static_cast<int>(result.a10) << ", "
13215 << static_cast<int>(result.a11) << ", "
13216 << static_cast<int>(result.a12) << ", "
13217 << static_cast<int>(result.a13) << ", "
13218 << static_cast<int>(result.a14) << ", "
13219 << static_cast<int>(result.a15) << ", "
13220 << static_cast<int>(result.a16) << ", "
13221 << static_cast<int>(result.a17) << ", "
13222 << static_cast<int>(result.a18) << ")" << "\n";
13223
13224 CHECK_EQ(a0, result.a0);
13225 CHECK_EQ(a1, result.a1);
13226 CHECK_EQ(a2, result.a2);
13227 CHECK_EQ(a3, result.a3);
13228 CHECK_EQ(a4, result.a4);
13229 CHECK_EQ(a5, result.a5);
13230 CHECK_EQ(a6, result.a6);
13231 CHECK_EQ(a7, result.a7);
13232 CHECK_EQ(a8, result.a8);
13233 CHECK_EQ(a9, result.a9);
13234 CHECK_EQ(a10, result.a10);
13235 CHECK_EQ(a11, result.a11);
13236 CHECK_EQ(a12, result.a12);
13237 CHECK_EQ(a13, result.a13);
13238 CHECK_EQ(a14, result.a14);
13239 CHECK_EQ(a15, result.a15);
13240 CHECK_EQ(a16, result.a16);
13241 CHECK_EQ(a17, result.a17);
13242 CHECK_EQ(a18, result.a18);
13243
13244 // Pass argument that will make the Dart callback throw.
13245 a0 = 42;
13246
13247 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14,
13248 a15, a16, a17, a18);
13249
13250 CHECK_EQ(0, result.a0);
13251 CHECK_EQ(0, result.a1);
13252 CHECK_EQ(0, result.a2);
13253 CHECK_EQ(0, result.a3);
13254 CHECK_EQ(0, result.a4);
13255 CHECK_EQ(0, result.a5);
13256 CHECK_EQ(0, result.a6);
13257 CHECK_EQ(0, result.a7);
13258 CHECK_EQ(0, result.a8);
13259 CHECK_EQ(0, result.a9);
13260 CHECK_EQ(0, result.a10);
13261 CHECK_EQ(0, result.a11);
13262 CHECK_EQ(0, result.a12);
13263 CHECK_EQ(0, result.a13);
13264 CHECK_EQ(0, result.a14);
13265 CHECK_EQ(0, result.a15);
13266 CHECK_EQ(0, result.a16);
13267 CHECK_EQ(0, result.a17);
13268 CHECK_EQ(0, result.a18);
13269
13270 // Pass argument that will make the Dart callback return null.
13271 a0 = 84;
13272
13273 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14,
13274 a15, a16, a17, a18);
13275
13276 CHECK_EQ(0, result.a0);
13277 CHECK_EQ(0, result.a1);
13278 CHECK_EQ(0, result.a2);
13279 CHECK_EQ(0, result.a3);
13280 CHECK_EQ(0, result.a4);
13281 CHECK_EQ(0, result.a5);
13282 CHECK_EQ(0, result.a6);
13283 CHECK_EQ(0, result.a7);
13284 CHECK_EQ(0, result.a8);
13285 CHECK_EQ(0, result.a9);
13286 CHECK_EQ(0, result.a10);
13287 CHECK_EQ(0, result.a11);
13288 CHECK_EQ(0, result.a12);
13289 CHECK_EQ(0, result.a13);
13290 CHECK_EQ(0, result.a14);
13291 CHECK_EQ(0, result.a15);
13292 CHECK_EQ(0, result.a16);
13293 CHECK_EQ(0, result.a17);
13294 CHECK_EQ(0, result.a18);
13295
13296 return 0;
13297}

◆ TestReturnStruct1ByteInt()

DART_EXPORT intptr_t dart::TestReturnStruct1ByteInt ( Struct1ByteInt(*)(int8_t a0)  f)

Definition at line 12320 of file ffi_test_functions_generated.cc.

12322 {
12323 int8_t a0;
12324
12325 a0 = -1;
12326
12327 std::cout << "Calling TestReturnStruct1ByteInt(" << "("
12328 << static_cast<int>(a0) << ")" << ")\n";
12329
12330 Struct1ByteInt result = f(a0);
12331
12332 std::cout << "result = " << "(" << static_cast<int>(result.a0) << ")" << "\n";
12333
12334 CHECK_EQ(a0, result.a0);
12335
12336 // Pass argument that will make the Dart callback throw.
12337 a0 = 42;
12338
12339 result = f(a0);
12340
12341 CHECK_EQ(0, result.a0);
12342
12343 // Pass argument that will make the Dart callback return null.
12344 a0 = 84;
12345
12346 result = f(a0);
12347
12348 CHECK_EQ(0, result.a0);
12349
12350 return 0;
12351}

◆ TestReturnStruct20BytesHomogeneousFloat()

DART_EXPORT intptr_t dart::TestReturnStruct20BytesHomogeneousFloat ( Struct20BytesHomogeneousFloat( *f)(float a0, float a1, float a2, float a3, float a4)  )

Definition at line 13360 of file ffi_test_functions_generated.cc.

13363 {
13364 float a0;
13365 float a1;
13366 float a2;
13367 float a3;
13368 float a4;
13369
13370 a0 = -1.0;
13371 a1 = 2.0;
13372 a2 = -3.0;
13373 a3 = 4.0;
13374 a4 = -5.0;
13375
13376 std::cout << "Calling TestReturnStruct20BytesHomogeneousFloat(" << "(" << a0
13377 << ", " << a1 << ", " << a2 << ", " << a3 << ", " << a4 << ")"
13378 << ")\n";
13379
13380 Struct20BytesHomogeneousFloat result = f(a0, a1, a2, a3, a4);
13381
13382 std::cout << "result = " << "(" << result.a0 << ", " << result.a1 << ", "
13383 << result.a2 << ", " << result.a3 << ", " << result.a4 << ")"
13384 << "\n";
13385
13386 CHECK_APPROX(a0, result.a0);
13387 CHECK_APPROX(a1, result.a1);
13388 CHECK_APPROX(a2, result.a2);
13389 CHECK_APPROX(a3, result.a3);
13390 CHECK_APPROX(a4, result.a4);
13391
13392 // Pass argument that will make the Dart callback throw.
13393 a0 = 42;
13394
13395 result = f(a0, a1, a2, a3, a4);
13396
13397 CHECK_APPROX(0.0, result.a0);
13398 CHECK_APPROX(0.0, result.a1);
13399 CHECK_APPROX(0.0, result.a2);
13400 CHECK_APPROX(0.0, result.a3);
13401 CHECK_APPROX(0.0, result.a4);
13402
13403 // Pass argument that will make the Dart callback return null.
13404 a0 = 84;
13405
13406 result = f(a0, a1, a2, a3, a4);
13407
13408 CHECK_APPROX(0.0, result.a0);
13409 CHECK_APPROX(0.0, result.a1);
13410 CHECK_APPROX(0.0, result.a2);
13411 CHECK_APPROX(0.0, result.a3);
13412 CHECK_APPROX(0.0, result.a4);
13413
13414 return 0;
13415}

◆ TestReturnStruct20BytesHomogeneousInt32()

DART_EXPORT intptr_t dart::TestReturnStruct20BytesHomogeneousInt32 ( Struct20BytesHomogeneousInt32( *f)(int32_t a0, int32_t a1, int32_t a2, int32_t a3, int32_t a4)  )

Definition at line 13301 of file ffi_test_functions_generated.cc.

13304 {
13305 int32_t a0;
13306 int32_t a1;
13307 int32_t a2;
13308 int32_t a3;
13309 int32_t a4;
13310
13311 a0 = -1;
13312 a1 = 2;
13313 a2 = -3;
13314 a3 = 4;
13315 a4 = -5;
13316
13317 std::cout << "Calling TestReturnStruct20BytesHomogeneousInt32(" << "(" << a0
13318 << ", " << a1 << ", " << a2 << ", " << a3 << ", " << a4 << ")"
13319 << ")\n";
13320
13321 Struct20BytesHomogeneousInt32 result = f(a0, a1, a2, a3, a4);
13322
13323 std::cout << "result = " << "(" << result.a0 << ", " << result.a1 << ", "
13324 << result.a2 << ", " << result.a3 << ", " << result.a4 << ")"
13325 << "\n";
13326
13327 CHECK_EQ(a0, result.a0);
13328 CHECK_EQ(a1, result.a1);
13329 CHECK_EQ(a2, result.a2);
13330 CHECK_EQ(a3, result.a3);
13331 CHECK_EQ(a4, result.a4);
13332
13333 // Pass argument that will make the Dart callback throw.
13334 a0 = 42;
13335
13336 result = f(a0, a1, a2, a3, a4);
13337
13338 CHECK_EQ(0, result.a0);
13339 CHECK_EQ(0, result.a1);
13340 CHECK_EQ(0, result.a2);
13341 CHECK_EQ(0, result.a3);
13342 CHECK_EQ(0, result.a4);
13343
13344 // Pass argument that will make the Dart callback return null.
13345 a0 = 84;
13346
13347 result = f(a0, a1, a2, a3, a4);
13348
13349 CHECK_EQ(0, result.a0);
13350 CHECK_EQ(0, result.a1);
13351 CHECK_EQ(0, result.a2);
13352 CHECK_EQ(0, result.a3);
13353 CHECK_EQ(0, result.a4);
13354
13355 return 0;
13356}

◆ TestReturnStruct32BytesHomogeneousDouble()

DART_EXPORT intptr_t dart::TestReturnStruct32BytesHomogeneousDouble ( Struct32BytesHomogeneousDouble( *f)(double a0, double a1, double a2, double a3)  )

Definition at line 13419 of file ffi_test_functions_generated.cc.

13422 {
13423 double a0;
13424 double a1;
13425 double a2;
13426 double a3;
13427
13428 a0 = -1.0;
13429 a1 = 2.0;
13430 a2 = -3.0;
13431 a3 = 4.0;
13432
13433 std::cout << "Calling TestReturnStruct32BytesHomogeneousDouble(" << "(" << a0
13434 << ", " << a1 << ", " << a2 << ", " << a3 << ")" << ")\n";
13435
13436 Struct32BytesHomogeneousDouble result = f(a0, a1, a2, a3);
13437
13438 std::cout << "result = " << "(" << result.a0 << ", " << result.a1 << ", "
13439 << result.a2 << ", " << result.a3 << ")" << "\n";
13440
13441 CHECK_APPROX(a0, result.a0);
13442 CHECK_APPROX(a1, result.a1);
13443 CHECK_APPROX(a2, result.a2);
13444 CHECK_APPROX(a3, result.a3);
13445
13446 // Pass argument that will make the Dart callback throw.
13447 a0 = 42;
13448
13449 result = f(a0, a1, a2, a3);
13450
13451 CHECK_APPROX(0.0, result.a0);
13452 CHECK_APPROX(0.0, result.a1);
13453 CHECK_APPROX(0.0, result.a2);
13454 CHECK_APPROX(0.0, result.a3);
13455
13456 // Pass argument that will make the Dart callback return null.
13457 a0 = 84;
13458
13459 result = f(a0, a1, a2, a3);
13460
13461 CHECK_APPROX(0.0, result.a0);
13462 CHECK_APPROX(0.0, result.a1);
13463 CHECK_APPROX(0.0, result.a2);
13464 CHECK_APPROX(0.0, result.a3);
13465
13466 return 0;
13467}

◆ TestReturnStruct32BytesNestedInt()

DART_EXPORT intptr_t dart::TestReturnStruct32BytesNestedInt ( Struct32BytesNestedInt(*)(Struct16BytesNestedInt a0, Struct16BytesNestedInt a1)  f)

Definition at line 15627 of file ffi_test_functions_generated.cc.

15630 {
15631 Struct16BytesNestedInt a0 = {};
15632 Struct16BytesNestedInt a1 = {};
15633
15634 a0.a0.a0.a0 = -1;
15635 a0.a0.a0.a1 = 2;
15636 a0.a0.a1.a0 = -3;
15637 a0.a0.a1.a1 = 4;
15638 a0.a1.a0.a0 = -5;
15639 a0.a1.a0.a1 = 6;
15640 a0.a1.a1.a0 = -7;
15641 a0.a1.a1.a1 = 8;
15642 a1.a0.a0.a0 = -9;
15643 a1.a0.a0.a1 = 10;
15644 a1.a0.a1.a0 = -11;
15645 a1.a0.a1.a1 = 12;
15646 a1.a1.a0.a0 = -13;
15647 a1.a1.a0.a1 = 14;
15648 a1.a1.a1.a0 = -15;
15649 a1.a1.a1.a1 = 16;
15650
15651 std::cout << "Calling TestReturnStruct32BytesNestedInt(" << "(((("
15652 << a0.a0.a0.a0 << ", " << a0.a0.a0.a1 << "), (" << a0.a0.a1.a0
15653 << ", " << a0.a0.a1.a1 << ")), ((" << a0.a1.a0.a0 << ", "
15654 << a0.a1.a0.a1 << "), (" << a0.a1.a1.a0 << ", " << a0.a1.a1.a1
15655 << "))), (((" << a1.a0.a0.a0 << ", " << a1.a0.a0.a1 << "), ("
15656 << a1.a0.a1.a0 << ", " << a1.a0.a1.a1 << ")), ((" << a1.a1.a0.a0
15657 << ", " << a1.a1.a0.a1 << "), (" << a1.a1.a1.a0 << ", "
15658 << a1.a1.a1.a1 << "))))" << ")\n";
15659
15660 Struct32BytesNestedInt result = f(a0, a1);
15661
15662 std::cout << "result = " << "((((" << result.a0.a0.a0.a0 << ", "
15663 << result.a0.a0.a0.a1 << "), (" << result.a0.a0.a1.a0 << ", "
15664 << result.a0.a0.a1.a1 << ")), ((" << result.a0.a1.a0.a0 << ", "
15665 << result.a0.a1.a0.a1 << "), (" << result.a0.a1.a1.a0 << ", "
15666 << result.a0.a1.a1.a1 << "))), (((" << result.a1.a0.a0.a0 << ", "
15667 << result.a1.a0.a0.a1 << "), (" << result.a1.a0.a1.a0 << ", "
15668 << result.a1.a0.a1.a1 << ")), ((" << result.a1.a1.a0.a0 << ", "
15669 << result.a1.a1.a0.a1 << "), (" << result.a1.a1.a1.a0 << ", "
15670 << result.a1.a1.a1.a1 << "))))" << "\n";
15671
15672 CHECK_EQ(a0.a0.a0.a0, result.a0.a0.a0.a0);
15673 CHECK_EQ(a0.a0.a0.a1, result.a0.a0.a0.a1);
15674 CHECK_EQ(a0.a0.a1.a0, result.a0.a0.a1.a0);
15675 CHECK_EQ(a0.a0.a1.a1, result.a0.a0.a1.a1);
15676 CHECK_EQ(a0.a1.a0.a0, result.a0.a1.a0.a0);
15677 CHECK_EQ(a0.a1.a0.a1, result.a0.a1.a0.a1);
15678 CHECK_EQ(a0.a1.a1.a0, result.a0.a1.a1.a0);
15679 CHECK_EQ(a0.a1.a1.a1, result.a0.a1.a1.a1);
15680 CHECK_EQ(a1.a0.a0.a0, result.a1.a0.a0.a0);
15681 CHECK_EQ(a1.a0.a0.a1, result.a1.a0.a0.a1);
15682 CHECK_EQ(a1.a0.a1.a0, result.a1.a0.a1.a0);
15683 CHECK_EQ(a1.a0.a1.a1, result.a1.a0.a1.a1);
15684 CHECK_EQ(a1.a1.a0.a0, result.a1.a1.a0.a0);
15685 CHECK_EQ(a1.a1.a0.a1, result.a1.a1.a0.a1);
15686 CHECK_EQ(a1.a1.a1.a0, result.a1.a1.a1.a0);
15687 CHECK_EQ(a1.a1.a1.a1, result.a1.a1.a1.a1);
15688
15689 // Pass argument that will make the Dart callback throw.
15690 a0.a0.a0.a0 = 42;
15691
15692 result = f(a0, a1);
15693
15694 CHECK_EQ(0, result.a0.a0.a0.a0);
15695 CHECK_EQ(0, result.a0.a0.a0.a1);
15696 CHECK_EQ(0, result.a0.a0.a1.a0);
15697 CHECK_EQ(0, result.a0.a0.a1.a1);
15698 CHECK_EQ(0, result.a0.a1.a0.a0);
15699 CHECK_EQ(0, result.a0.a1.a0.a1);
15700 CHECK_EQ(0, result.a0.a1.a1.a0);
15701 CHECK_EQ(0, result.a0.a1.a1.a1);
15702 CHECK_EQ(0, result.a1.a0.a0.a0);
15703 CHECK_EQ(0, result.a1.a0.a0.a1);
15704 CHECK_EQ(0, result.a1.a0.a1.a0);
15705 CHECK_EQ(0, result.a1.a0.a1.a1);
15706 CHECK_EQ(0, result.a1.a1.a0.a0);
15707 CHECK_EQ(0, result.a1.a1.a0.a1);
15708 CHECK_EQ(0, result.a1.a1.a1.a0);
15709 CHECK_EQ(0, result.a1.a1.a1.a1);
15710
15711 // Pass argument that will make the Dart callback return null.
15712 a0.a0.a0.a0 = 84;
15713
15714 result = f(a0, a1);
15715
15716 CHECK_EQ(0, result.a0.a0.a0.a0);
15717 CHECK_EQ(0, result.a0.a0.a0.a1);
15718 CHECK_EQ(0, result.a0.a0.a1.a0);
15719 CHECK_EQ(0, result.a0.a0.a1.a1);
15720 CHECK_EQ(0, result.a0.a1.a0.a0);
15721 CHECK_EQ(0, result.a0.a1.a0.a1);
15722 CHECK_EQ(0, result.a0.a1.a1.a0);
15723 CHECK_EQ(0, result.a0.a1.a1.a1);
15724 CHECK_EQ(0, result.a1.a0.a0.a0);
15725 CHECK_EQ(0, result.a1.a0.a0.a1);
15726 CHECK_EQ(0, result.a1.a0.a1.a0);
15727 CHECK_EQ(0, result.a1.a0.a1.a1);
15728 CHECK_EQ(0, result.a1.a1.a0.a0);
15729 CHECK_EQ(0, result.a1.a1.a0.a1);
15730 CHECK_EQ(0, result.a1.a1.a1.a0);
15731 CHECK_EQ(0, result.a1.a1.a1.a1);
15732
15733 return 0;
15734}

◆ TestReturnStruct3BytesHomogeneousUint8()

DART_EXPORT intptr_t dart::TestReturnStruct3BytesHomogeneousUint8 ( Struct3BytesHomogeneousUint8(*)(uint8_t a0, uint8_t a1, uint8_t a2)  f)

Definition at line 12355 of file ffi_test_functions_generated.cc.

12357 {
12358 uint8_t a0;
12359 uint8_t a1;
12360 uint8_t a2;
12361
12362 a0 = 1;
12363 a1 = 2;
12364 a2 = 3;
12365
12366 std::cout << "Calling TestReturnStruct3BytesHomogeneousUint8(" << "("
12367 << static_cast<int>(a0) << ", " << static_cast<int>(a1) << ", "
12368 << static_cast<int>(a2) << ")" << ")\n";
12369
12370 Struct3BytesHomogeneousUint8 result = f(a0, a1, a2);
12371
12372 std::cout << "result = " << "(" << static_cast<int>(result.a0) << ", "
12373 << static_cast<int>(result.a1) << ", "
12374 << static_cast<int>(result.a2) << ")" << "\n";
12375
12376 CHECK_EQ(a0, result.a0);
12377 CHECK_EQ(a1, result.a1);
12378 CHECK_EQ(a2, result.a2);
12379
12380 // Pass argument that will make the Dart callback throw.
12381 a0 = 42;
12382
12383 result = f(a0, a1, a2);
12384
12385 CHECK_EQ(0, result.a0);
12386 CHECK_EQ(0, result.a1);
12387 CHECK_EQ(0, result.a2);
12388
12389 // Pass argument that will make the Dart callback return null.
12390 a0 = 84;
12391
12392 result = f(a0, a1, a2);
12393
12394 CHECK_EQ(0, result.a0);
12395 CHECK_EQ(0, result.a1);
12396 CHECK_EQ(0, result.a2);
12397
12398 return 0;
12399}

◆ TestReturnStruct3BytesInt2ByteAligned()

DART_EXPORT intptr_t dart::TestReturnStruct3BytesInt2ByteAligned ( Struct3BytesInt2ByteAligned(*)(int16_t a0, int8_t a1)  f)

Definition at line 12404 of file ffi_test_functions_generated.cc.

12406 {
12407 int16_t a0;
12408 int8_t a1;
12409
12410 a0 = -1;
12411 a1 = 2;
12412
12413 std::cout << "Calling TestReturnStruct3BytesInt2ByteAligned(" << "(" << a0
12414 << ", " << static_cast<int>(a1) << ")" << ")\n";
12415
12417
12418 std::cout << "result = " << "(" << result.a0 << ", "
12419 << static_cast<int>(result.a1) << ")" << "\n";
12420
12421 CHECK_EQ(a0, result.a0);
12422 CHECK_EQ(a1, result.a1);
12423
12424 // Pass argument that will make the Dart callback throw.
12425 a0 = 42;
12426
12427 result = f(a0, a1);
12428
12429 CHECK_EQ(0, result.a0);
12430 CHECK_EQ(0, result.a1);
12431
12432 // Pass argument that will make the Dart callback return null.
12433 a0 = 84;
12434
12435 result = f(a0, a1);
12436
12437 CHECK_EQ(0, result.a0);
12438 CHECK_EQ(0, result.a1);
12439
12440 return 0;
12441}

◆ TestReturnStruct3BytesPackedInt()

DART_EXPORT intptr_t dart::TestReturnStruct3BytesPackedInt ( Struct3BytesPackedInt(*)(int8_t a0, int16_t a1)  f)

Definition at line 14426 of file ffi_test_functions_generated.cc.

14428 {
14429 int8_t a0;
14430 int16_t a1;
14431
14432 a0 = -1;
14433 a1 = 2;
14434
14435 std::cout << "Calling TestReturnStruct3BytesPackedInt(" << "("
14436 << static_cast<int>(a0) << ", " << a1 << ")" << ")\n";
14437
14438 Struct3BytesPackedInt result = f(a0, a1);
14439
14440 std::cout << "result = " << "(" << static_cast<int>(result.a0) << ", "
14441 << result.a1 << ")" << "\n";
14442
14443 CHECK_EQ(a0, result.a0);
14444 CHECK_EQ(a1, result.a1);
14445
14446 // Pass argument that will make the Dart callback throw.
14447 a0 = 42;
14448
14449 result = f(a0, a1);
14450
14451 CHECK_EQ(0, result.a0);
14452 CHECK_EQ(0, result.a1);
14453
14454 // Pass argument that will make the Dart callback return null.
14455 a0 = 84;
14456
14457 result = f(a0, a1);
14458
14459 CHECK_EQ(0, result.a0);
14460 CHECK_EQ(0, result.a1);
14461
14462 return 0;
14463}

◆ TestReturnStruct40BytesHomogeneousDouble()

DART_EXPORT intptr_t dart::TestReturnStruct40BytesHomogeneousDouble ( Struct40BytesHomogeneousDouble( *f)(double a0, double a1, double a2, double a3, double a4)  )

Definition at line 13471 of file ffi_test_functions_generated.cc.

13474 {
13475 double a0;
13476 double a1;
13477 double a2;
13478 double a3;
13479 double a4;
13480
13481 a0 = -1.0;
13482 a1 = 2.0;
13483 a2 = -3.0;
13484 a3 = 4.0;
13485 a4 = -5.0;
13486
13487 std::cout << "Calling TestReturnStruct40BytesHomogeneousDouble(" << "(" << a0
13488 << ", " << a1 << ", " << a2 << ", " << a3 << ", " << a4 << ")"
13489 << ")\n";
13490
13491 Struct40BytesHomogeneousDouble result = f(a0, a1, a2, a3, a4);
13492
13493 std::cout << "result = " << "(" << result.a0 << ", " << result.a1 << ", "
13494 << result.a2 << ", " << result.a3 << ", " << result.a4 << ")"
13495 << "\n";
13496
13497 CHECK_APPROX(a0, result.a0);
13498 CHECK_APPROX(a1, result.a1);
13499 CHECK_APPROX(a2, result.a2);
13500 CHECK_APPROX(a3, result.a3);
13501 CHECK_APPROX(a4, result.a4);
13502
13503 // Pass argument that will make the Dart callback throw.
13504 a0 = 42;
13505
13506 result = f(a0, a1, a2, a3, a4);
13507
13508 CHECK_APPROX(0.0, result.a0);
13509 CHECK_APPROX(0.0, result.a1);
13510 CHECK_APPROX(0.0, result.a2);
13511 CHECK_APPROX(0.0, result.a3);
13512 CHECK_APPROX(0.0, result.a4);
13513
13514 // Pass argument that will make the Dart callback return null.
13515 a0 = 84;
13516
13517 result = f(a0, a1, a2, a3, a4);
13518
13519 CHECK_APPROX(0.0, result.a0);
13520 CHECK_APPROX(0.0, result.a1);
13521 CHECK_APPROX(0.0, result.a2);
13522 CHECK_APPROX(0.0, result.a3);
13523 CHECK_APPROX(0.0, result.a4);
13524
13525 return 0;
13526}

◆ TestReturnStruct4BytesHomogeneousInt16()

DART_EXPORT intptr_t dart::TestReturnStruct4BytesHomogeneousInt16 ( Struct4BytesHomogeneousInt16(*)(int16_t a0, int16_t a1)  f)

Definition at line 12445 of file ffi_test_functions_generated.cc.

12447 {
12448 int16_t a0;
12449 int16_t a1;
12450
12451 a0 = -1;
12452 a1 = 2;
12453
12454 std::cout << "Calling TestReturnStruct4BytesHomogeneousInt16(" << "(" << a0
12455 << ", " << a1 << ")" << ")\n";
12456
12458
12459 std::cout << "result = " << "(" << result.a0 << ", " << result.a1 << ")"
12460 << "\n";
12461
12462 CHECK_EQ(a0, result.a0);
12463 CHECK_EQ(a1, result.a1);
12464
12465 // Pass argument that will make the Dart callback throw.
12466 a0 = 42;
12467
12468 result = f(a0, a1);
12469
12470 CHECK_EQ(0, result.a0);
12471 CHECK_EQ(0, result.a1);
12472
12473 // Pass argument that will make the Dart callback return null.
12474 a0 = 84;
12475
12476 result = f(a0, a1);
12477
12478 CHECK_EQ(0, result.a0);
12479 CHECK_EQ(0, result.a1);
12480
12481 return 0;
12482}

◆ TestReturnStruct7BytesHomogeneousUint8()

DART_EXPORT intptr_t dart::TestReturnStruct7BytesHomogeneousUint8 ( Struct7BytesHomogeneousUint8(*)(uint8_t a0, uint8_t a1, uint8_t a2, uint8_t a3, uint8_t a4, uint8_t a5, uint8_t a6)  f)

Definition at line 12486 of file ffi_test_functions_generated.cc.

12494 {
12495 uint8_t a0;
12496 uint8_t a1;
12497 uint8_t a2;
12498 uint8_t a3;
12499 uint8_t a4;
12500 uint8_t a5;
12501 uint8_t a6;
12502
12503 a0 = 1;
12504 a1 = 2;
12505 a2 = 3;
12506 a3 = 4;
12507 a4 = 5;
12508 a5 = 6;
12509 a6 = 7;
12510
12511 std::cout << "Calling TestReturnStruct7BytesHomogeneousUint8(" << "("
12512 << static_cast<int>(a0) << ", " << static_cast<int>(a1) << ", "
12513 << static_cast<int>(a2) << ", " << static_cast<int>(a3) << ", "
12514 << static_cast<int>(a4) << ", " << static_cast<int>(a5) << ", "
12515 << static_cast<int>(a6) << ")" << ")\n";
12516
12517 Struct7BytesHomogeneousUint8 result = f(a0, a1, a2, a3, a4, a5, a6);
12518
12519 std::cout << "result = " << "(" << static_cast<int>(result.a0) << ", "
12520 << static_cast<int>(result.a1) << ", "
12521 << static_cast<int>(result.a2) << ", "
12522 << static_cast<int>(result.a3) << ", "
12523 << static_cast<int>(result.a4) << ", "
12524 << static_cast<int>(result.a5) << ", "
12525 << static_cast<int>(result.a6) << ")" << "\n";
12526
12527 CHECK_EQ(a0, result.a0);
12528 CHECK_EQ(a1, result.a1);
12529 CHECK_EQ(a2, result.a2);
12530 CHECK_EQ(a3, result.a3);
12531 CHECK_EQ(a4, result.a4);
12532 CHECK_EQ(a5, result.a5);
12533 CHECK_EQ(a6, result.a6);
12534
12535 // Pass argument that will make the Dart callback throw.
12536 a0 = 42;
12537
12538 result = f(a0, a1, a2, a3, a4, a5, a6);
12539
12540 CHECK_EQ(0, result.a0);
12541 CHECK_EQ(0, result.a1);
12542 CHECK_EQ(0, result.a2);
12543 CHECK_EQ(0, result.a3);
12544 CHECK_EQ(0, result.a4);
12545 CHECK_EQ(0, result.a5);
12546 CHECK_EQ(0, result.a6);
12547
12548 // Pass argument that will make the Dart callback return null.
12549 a0 = 84;
12550
12551 result = f(a0, a1, a2, a3, a4, a5, a6);
12552
12553 CHECK_EQ(0, result.a0);
12554 CHECK_EQ(0, result.a1);
12555 CHECK_EQ(0, result.a2);
12556 CHECK_EQ(0, result.a3);
12557 CHECK_EQ(0, result.a4);
12558 CHECK_EQ(0, result.a5);
12559 CHECK_EQ(0, result.a6);
12560
12561 return 0;
12562}

◆ TestReturnStruct7BytesInt4ByteAligned()

DART_EXPORT intptr_t dart::TestReturnStruct7BytesInt4ByteAligned ( Struct7BytesInt4ByteAligned(*)(int32_t a0, int16_t a1, int8_t a2)  f)

Definition at line 12567 of file ffi_test_functions_generated.cc.

12569 {
12570 int32_t a0;
12571 int16_t a1;
12572 int8_t a2;
12573
12574 a0 = -1;
12575 a1 = 2;
12576 a2 = -3;
12577
12578 std::cout << "Calling TestReturnStruct7BytesInt4ByteAligned(" << "(" << a0
12579 << ", " << a1 << ", " << static_cast<int>(a2) << ")" << ")\n";
12580
12581 Struct7BytesInt4ByteAligned result = f(a0, a1, a2);
12582
12583 std::cout << "result = " << "(" << result.a0 << ", " << result.a1 << ", "
12584 << static_cast<int>(result.a2) << ")" << "\n";
12585
12586 CHECK_EQ(a0, result.a0);
12587 CHECK_EQ(a1, result.a1);
12588 CHECK_EQ(a2, result.a2);
12589
12590 // Pass argument that will make the Dart callback throw.
12591 a0 = 42;
12592
12593 result = f(a0, a1, a2);
12594
12595 CHECK_EQ(0, result.a0);
12596 CHECK_EQ(0, result.a1);
12597 CHECK_EQ(0, result.a2);
12598
12599 // Pass argument that will make the Dart callback return null.
12600 a0 = 84;
12601
12602 result = f(a0, a1, a2);
12603
12604 CHECK_EQ(0, result.a0);
12605 CHECK_EQ(0, result.a1);
12606 CHECK_EQ(0, result.a2);
12607
12608 return 0;
12609}

◆ TestReturnStruct8BytesHomogeneousFloat()

DART_EXPORT intptr_t dart::TestReturnStruct8BytesHomogeneousFloat ( Struct8BytesHomogeneousFloat(*)(float a0, float a1)  f)

Definition at line 12659 of file ffi_test_functions_generated.cc.

12661 {
12662 float a0;
12663 float a1;
12664
12665 a0 = -1.0;
12666 a1 = 2.0;
12667
12668 std::cout << "Calling TestReturnStruct8BytesHomogeneousFloat(" << "(" << a0
12669 << ", " << a1 << ")" << ")\n";
12670
12672
12673 std::cout << "result = " << "(" << result.a0 << ", " << result.a1 << ")"
12674 << "\n";
12675
12676 CHECK_APPROX(a0, result.a0);
12677 CHECK_APPROX(a1, result.a1);
12678
12679 // Pass argument that will make the Dart callback throw.
12680 a0 = 42;
12681
12682 result = f(a0, a1);
12683
12684 CHECK_APPROX(0.0, result.a0);
12685 CHECK_APPROX(0.0, result.a1);
12686
12687 // Pass argument that will make the Dart callback return null.
12688 a0 = 84;
12689
12690 result = f(a0, a1);
12691
12692 CHECK_APPROX(0.0, result.a0);
12693 CHECK_APPROX(0.0, result.a1);
12694
12695 return 0;
12696}

◆ TestReturnStruct8BytesInt()

DART_EXPORT intptr_t dart::TestReturnStruct8BytesInt ( Struct8BytesInt(*)(int16_t a0, int16_t a1, int32_t a2)  f)

Definition at line 12613 of file ffi_test_functions_generated.cc.

12615 {
12616 int16_t a0;
12617 int16_t a1;
12618 int32_t a2;
12619
12620 a0 = -1;
12621 a1 = 2;
12622 a2 = -3;
12623
12624 std::cout << "Calling TestReturnStruct8BytesInt(" << "(" << a0 << ", " << a1
12625 << ", " << a2 << ")" << ")\n";
12626
12627 Struct8BytesInt result = f(a0, a1, a2);
12628
12629 std::cout << "result = " << "(" << result.a0 << ", " << result.a1 << ", "
12630 << result.a2 << ")" << "\n";
12631
12632 CHECK_EQ(a0, result.a0);
12633 CHECK_EQ(a1, result.a1);
12634 CHECK_EQ(a2, result.a2);
12635
12636 // Pass argument that will make the Dart callback throw.
12637 a0 = 42;
12638
12639 result = f(a0, a1, a2);
12640
12641 CHECK_EQ(0, result.a0);
12642 CHECK_EQ(0, result.a1);
12643 CHECK_EQ(0, result.a2);
12644
12645 // Pass argument that will make the Dart callback return null.
12646 a0 = 84;
12647
12648 result = f(a0, a1, a2);
12649
12650 CHECK_EQ(0, result.a0);
12651 CHECK_EQ(0, result.a1);
12652 CHECK_EQ(0, result.a2);
12653
12654 return 0;
12655}

◆ TestReturnStruct8BytesMixed()

DART_EXPORT intptr_t dart::TestReturnStruct8BytesMixed ( Struct8BytesMixed(*)(float a0, int16_t a1, int16_t a2)  f)

Definition at line 12700 of file ffi_test_functions_generated.cc.

12702 {
12703 float a0;
12704 int16_t a1;
12705 int16_t a2;
12706
12707 a0 = -1.0;
12708 a1 = 2;
12709 a2 = -3;
12710
12711 std::cout << "Calling TestReturnStruct8BytesMixed(" << "(" << a0 << ", " << a1
12712 << ", " << a2 << ")" << ")\n";
12713
12714 Struct8BytesMixed result = f(a0, a1, a2);
12715
12716 std::cout << "result = " << "(" << result.a0 << ", " << result.a1 << ", "
12717 << result.a2 << ")" << "\n";
12718
12719 CHECK_APPROX(a0, result.a0);
12720 CHECK_EQ(a1, result.a1);
12721 CHECK_EQ(a2, result.a2);
12722
12723 // Pass argument that will make the Dart callback throw.
12724 a0 = 42;
12725
12726 result = f(a0, a1, a2);
12727
12728 CHECK_APPROX(0.0, result.a0);
12729 CHECK_EQ(0, result.a1);
12730 CHECK_EQ(0, result.a2);
12731
12732 // Pass argument that will make the Dart callback return null.
12733 a0 = 84;
12734
12735 result = f(a0, a1, a2);
12736
12737 CHECK_APPROX(0.0, result.a0);
12738 CHECK_EQ(0, result.a1);
12739 CHECK_EQ(0, result.a2);
12740
12741 return 0;
12742}

◆ TestReturnStruct8BytesNestedFloat()

DART_EXPORT intptr_t dart::TestReturnStruct8BytesNestedFloat ( Struct8BytesNestedFloat(*)(Struct4BytesFloat a0, Struct4BytesFloat a1)  f)

Definition at line 15427 of file ffi_test_functions_generated.cc.

15429 {
15430 Struct4BytesFloat a0 = {};
15431 Struct4BytesFloat a1 = {};
15432
15433 a0.a0 = -1.0;
15434 a1.a0 = 2.0;
15435
15436 std::cout << "Calling TestReturnStruct8BytesNestedFloat(" << "((" << a0.a0
15437 << "), (" << a1.a0 << "))" << ")\n";
15438
15439 Struct8BytesNestedFloat result = f(a0, a1);
15440
15441 std::cout << "result = " << "((" << result.a0.a0 << "), (" << result.a1.a0
15442 << "))" << "\n";
15443
15444 CHECK_APPROX(a0.a0, result.a0.a0);
15445 CHECK_APPROX(a1.a0, result.a1.a0);
15446
15447 // Pass argument that will make the Dart callback throw.
15448 a0.a0 = 42;
15449
15450 result = f(a0, a1);
15451
15452 CHECK_APPROX(0.0, result.a0.a0);
15453 CHECK_APPROX(0.0, result.a1.a0);
15454
15455 // Pass argument that will make the Dart callback return null.
15456 a0.a0 = 84;
15457
15458 result = f(a0, a1);
15459
15460 CHECK_APPROX(0.0, result.a0.a0);
15461 CHECK_APPROX(0.0, result.a1.a0);
15462
15463 return 0;
15464}

◆ TestReturnStruct8BytesNestedFloat2()

DART_EXPORT intptr_t dart::TestReturnStruct8BytesNestedFloat2 ( Struct8BytesNestedFloat2(*)(Struct4BytesFloat a0, float a1)  f)

Definition at line 15469 of file ffi_test_functions_generated.cc.

15471 {
15472 Struct4BytesFloat a0 = {};
15473 float a1;
15474
15475 a0.a0 = -1.0;
15476 a1 = 2.0;
15477
15478 std::cout << "Calling TestReturnStruct8BytesNestedFloat2(" << "((" << a0.a0
15479 << "), " << a1 << ")" << ")\n";
15480
15481 Struct8BytesNestedFloat2 result = f(a0, a1);
15482
15483 std::cout << "result = " << "((" << result.a0.a0 << "), " << result.a1 << ")"
15484 << "\n";
15485
15486 CHECK_APPROX(a0.a0, result.a0.a0);
15487 CHECK_APPROX(a1, result.a1);
15488
15489 // Pass argument that will make the Dart callback throw.
15490 a0.a0 = 42;
15491
15492 result = f(a0, a1);
15493
15494 CHECK_APPROX(0.0, result.a0.a0);
15495 CHECK_APPROX(0.0, result.a1);
15496
15497 // Pass argument that will make the Dart callback return null.
15498 a0.a0 = 84;
15499
15500 result = f(a0, a1);
15501
15502 CHECK_APPROX(0.0, result.a0.a0);
15503 CHECK_APPROX(0.0, result.a1);
15504
15505 return 0;
15506}

◆ TestReturnStruct8BytesNestedInt()

DART_EXPORT intptr_t dart::TestReturnStruct8BytesNestedInt ( Struct8BytesNestedInt(*)(Struct4BytesHomogeneousInt16 a0, Struct4BytesHomogeneousInt16 a1)  f)

Definition at line 15376 of file ffi_test_functions_generated.cc.

15379 {
15381 Struct4BytesHomogeneousInt16 a1 = {};
15382
15383 a0.a0 = -1;
15384 a0.a1 = 2;
15385 a1.a0 = -3;
15386 a1.a1 = 4;
15387
15388 std::cout << "Calling TestReturnStruct8BytesNestedInt(" << "((" << a0.a0
15389 << ", " << a0.a1 << "), (" << a1.a0 << ", " << a1.a1 << "))"
15390 << ")\n";
15391
15392 Struct8BytesNestedInt result = f(a0, a1);
15393
15394 std::cout << "result = " << "((" << result.a0.a0 << ", " << result.a0.a1
15395 << "), (" << result.a1.a0 << ", " << result.a1.a1 << "))" << "\n";
15396
15397 CHECK_EQ(a0.a0, result.a0.a0);
15398 CHECK_EQ(a0.a1, result.a0.a1);
15399 CHECK_EQ(a1.a0, result.a1.a0);
15400 CHECK_EQ(a1.a1, result.a1.a1);
15401
15402 // Pass argument that will make the Dart callback throw.
15403 a0.a0 = 42;
15404
15405 result = f(a0, a1);
15406
15407 CHECK_EQ(0, result.a0.a0);
15408 CHECK_EQ(0, result.a0.a1);
15409 CHECK_EQ(0, result.a1.a0);
15410 CHECK_EQ(0, result.a1.a1);
15411
15412 // Pass argument that will make the Dart callback return null.
15413 a0.a0 = 84;
15414
15415 result = f(a0, a1);
15416
15417 CHECK_EQ(0, result.a0.a0);
15418 CHECK_EQ(0, result.a0.a1);
15419 CHECK_EQ(0, result.a1.a0);
15420 CHECK_EQ(0, result.a1.a1);
15421
15422 return 0;
15423}

◆ TestReturnStruct8BytesNestedMixed()

DART_EXPORT intptr_t dart::TestReturnStruct8BytesNestedMixed ( Struct8BytesNestedMixed(*)(Struct4BytesHomogeneousInt16 a0, Struct4BytesFloat a1)  f)

Definition at line 15510 of file ffi_test_functions_generated.cc.

15513 {
15515 Struct4BytesFloat a1 = {};
15516
15517 a0.a0 = -1;
15518 a0.a1 = 2;
15519 a1.a0 = -3.0;
15520
15521 std::cout << "Calling TestReturnStruct8BytesNestedMixed(" << "((" << a0.a0
15522 << ", " << a0.a1 << "), (" << a1.a0 << "))" << ")\n";
15523
15524 Struct8BytesNestedMixed result = f(a0, a1);
15525
15526 std::cout << "result = " << "((" << result.a0.a0 << ", " << result.a0.a1
15527 << "), (" << result.a1.a0 << "))" << "\n";
15528
15529 CHECK_EQ(a0.a0, result.a0.a0);
15530 CHECK_EQ(a0.a1, result.a0.a1);
15531 CHECK_APPROX(a1.a0, result.a1.a0);
15532
15533 // Pass argument that will make the Dart callback throw.
15534 a0.a0 = 42;
15535
15536 result = f(a0, a1);
15537
15538 CHECK_EQ(0, result.a0.a0);
15539 CHECK_EQ(0, result.a0.a1);
15540 CHECK_APPROX(0.0, result.a1.a0);
15541
15542 // Pass argument that will make the Dart callback return null.
15543 a0.a0 = 84;
15544
15545 result = f(a0, a1);
15546
15547 CHECK_EQ(0, result.a0.a0);
15548 CHECK_EQ(0, result.a0.a1);
15549 CHECK_APPROX(0.0, result.a1.a0);
15550
15551 return 0;
15552}

◆ TestReturnStruct8BytesPackedInt()

DART_EXPORT intptr_t dart::TestReturnStruct8BytesPackedInt ( Struct8BytesPackedInt( *f)(uint8_t a0, uint32_t a1, uint8_t a2, uint8_t a3, uint8_t a4)  )

Definition at line 14467 of file ffi_test_functions_generated.cc.

14470 {
14471 uint8_t a0;
14472 uint32_t a1;
14473 uint8_t a2;
14474 uint8_t a3;
14475 uint8_t a4;
14476
14477 a0 = 1;
14478 a1 = 2;
14479 a2 = 3;
14480 a3 = 4;
14481 a4 = 5;
14482
14483 std::cout << "Calling TestReturnStruct8BytesPackedInt(" << "("
14484 << static_cast<int>(a0) << ", " << a1 << ", "
14485 << static_cast<int>(a2) << ", " << static_cast<int>(a3) << ", "
14486 << static_cast<int>(a4) << ")" << ")\n";
14487
14488 Struct8BytesPackedInt result = f(a0, a1, a2, a3, a4);
14489
14490 std::cout << "result = " << "(" << static_cast<int>(result.a0) << ", "
14491 << result.a1 << ", " << static_cast<int>(result.a2) << ", "
14492 << static_cast<int>(result.a3) << ", "
14493 << static_cast<int>(result.a4) << ")" << "\n";
14494
14495 CHECK_EQ(a0, result.a0);
14496 CHECK_EQ(a1, result.a1);
14497 CHECK_EQ(a2, result.a2);
14498 CHECK_EQ(a3, result.a3);
14499 CHECK_EQ(a4, result.a4);
14500
14501 // Pass argument that will make the Dart callback throw.
14502 a0 = 42;
14503
14504 result = f(a0, a1, a2, a3, a4);
14505
14506 CHECK_EQ(0, result.a0);
14507 CHECK_EQ(0, result.a1);
14508 CHECK_EQ(0, result.a2);
14509 CHECK_EQ(0, result.a3);
14510 CHECK_EQ(0, result.a4);
14511
14512 // Pass argument that will make the Dart callback return null.
14513 a0 = 84;
14514
14515 result = f(a0, a1, a2, a3, a4);
14516
14517 CHECK_EQ(0, result.a0);
14518 CHECK_EQ(0, result.a1);
14519 CHECK_EQ(0, result.a2);
14520 CHECK_EQ(0, result.a3);
14521 CHECK_EQ(0, result.a4);
14522
14523 return 0;
14524}

◆ TestReturnStruct9BytesHomogeneousUint8()

DART_EXPORT intptr_t dart::TestReturnStruct9BytesHomogeneousUint8 ( Struct9BytesHomogeneousUint8(*)(uint8_t a0, uint8_t a1, uint8_t a2, uint8_t a3, uint8_t a4, uint8_t a5, uint8_t a6, uint8_t a7, uint8_t a8)  f)

Definition at line 12748 of file ffi_test_functions_generated.cc.

12758 {
12759 uint8_t a0;
12760 uint8_t a1;
12761 uint8_t a2;
12762 uint8_t a3;
12763 uint8_t a4;
12764 uint8_t a5;
12765 uint8_t a6;
12766 uint8_t a7;
12767 uint8_t a8;
12768
12769 a0 = 1;
12770 a1 = 2;
12771 a2 = 3;
12772 a3 = 4;
12773 a4 = 5;
12774 a5 = 6;
12775 a6 = 7;
12776 a7 = 8;
12777 a8 = 9;
12778
12779 std::cout << "Calling TestReturnStruct9BytesHomogeneousUint8(" << "("
12780 << static_cast<int>(a0) << ", " << static_cast<int>(a1) << ", "
12781 << static_cast<int>(a2) << ", " << static_cast<int>(a3) << ", "
12782 << static_cast<int>(a4) << ", " << static_cast<int>(a5) << ", "
12783 << static_cast<int>(a6) << ", " << static_cast<int>(a7) << ", "
12784 << static_cast<int>(a8) << ")" << ")\n";
12785
12786 Struct9BytesHomogeneousUint8 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8);
12787
12788 std::cout << "result = " << "(" << static_cast<int>(result.a0) << ", "
12789 << static_cast<int>(result.a1) << ", "
12790 << static_cast<int>(result.a2) << ", "
12791 << static_cast<int>(result.a3) << ", "
12792 << static_cast<int>(result.a4) << ", "
12793 << static_cast<int>(result.a5) << ", "
12794 << static_cast<int>(result.a6) << ", "
12795 << static_cast<int>(result.a7) << ", "
12796 << static_cast<int>(result.a8) << ")" << "\n";
12797
12798 CHECK_EQ(a0, result.a0);
12799 CHECK_EQ(a1, result.a1);
12800 CHECK_EQ(a2, result.a2);
12801 CHECK_EQ(a3, result.a3);
12802 CHECK_EQ(a4, result.a4);
12803 CHECK_EQ(a5, result.a5);
12804 CHECK_EQ(a6, result.a6);
12805 CHECK_EQ(a7, result.a7);
12806 CHECK_EQ(a8, result.a8);
12807
12808 // Pass argument that will make the Dart callback throw.
12809 a0 = 42;
12810
12811 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8);
12812
12813 CHECK_EQ(0, result.a0);
12814 CHECK_EQ(0, result.a1);
12815 CHECK_EQ(0, result.a2);
12816 CHECK_EQ(0, result.a3);
12817 CHECK_EQ(0, result.a4);
12818 CHECK_EQ(0, result.a5);
12819 CHECK_EQ(0, result.a6);
12820 CHECK_EQ(0, result.a7);
12821 CHECK_EQ(0, result.a8);
12822
12823 // Pass argument that will make the Dart callback return null.
12824 a0 = 84;
12825
12826 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8);
12827
12828 CHECK_EQ(0, result.a0);
12829 CHECK_EQ(0, result.a1);
12830 CHECK_EQ(0, result.a2);
12831 CHECK_EQ(0, result.a3);
12832 CHECK_EQ(0, result.a4);
12833 CHECK_EQ(0, result.a5);
12834 CHECK_EQ(0, result.a6);
12835 CHECK_EQ(0, result.a7);
12836 CHECK_EQ(0, result.a8);
12837
12838 return 0;
12839}

◆ TestReturnStruct9BytesInt4Or8ByteAligned()

DART_EXPORT intptr_t dart::TestReturnStruct9BytesInt4Or8ByteAligned ( Struct9BytesInt4Or8ByteAligned(*)(int64_t a0, int8_t a1)  f)

Definition at line 12844 of file ffi_test_functions_generated.cc.

12846 {
12847 int64_t a0;
12848 int8_t a1;
12849
12850 a0 = -1;
12851 a1 = 2;
12852
12853 std::cout << "Calling TestReturnStruct9BytesInt4Or8ByteAligned(" << "(" << a0
12854 << ", " << static_cast<int>(a1) << ")" << ")\n";
12855
12857
12858 std::cout << "result = " << "(" << result.a0 << ", "
12859 << static_cast<int>(result.a1) << ")" << "\n";
12860
12861 CHECK_EQ(a0, result.a0);
12862 CHECK_EQ(a1, result.a1);
12863
12864 // Pass argument that will make the Dart callback throw.
12865 a0 = 42;
12866
12867 result = f(a0, a1);
12868
12869 CHECK_EQ(0, result.a0);
12870 CHECK_EQ(0, result.a1);
12871
12872 // Pass argument that will make the Dart callback return null.
12873 a0 = 84;
12874
12875 result = f(a0, a1);
12876
12877 CHECK_EQ(0, result.a0);
12878 CHECK_EQ(0, result.a1);
12879
12880 return 0;
12881}

◆ TestReturnStruct9BytesPackedMixed()

DART_EXPORT intptr_t dart::TestReturnStruct9BytesPackedMixed ( Struct9BytesPackedMixed(*)(uint8_t a0, double a1)  f)

Definition at line 14529 of file ffi_test_functions_generated.cc.

14531 {
14532 uint8_t a0;
14533 double a1;
14534
14535 a0 = 1;
14536 a1 = 2.0;
14537
14538 std::cout << "Calling TestReturnStruct9BytesPackedMixed(" << "("
14539 << static_cast<int>(a0) << ", " << a1 << ")" << ")\n";
14540
14541 Struct9BytesPackedMixed result = f(a0, a1);
14542
14543 std::cout << "result = " << "(" << static_cast<int>(result.a0) << ", "
14544 << result.a1 << ")" << "\n";
14545
14546 CHECK_EQ(a0, result.a0);
14547 CHECK_APPROX(a1, result.a1);
14548
14549 // Pass argument that will make the Dart callback throw.
14550 a0 = 42;
14551
14552 result = f(a0, a1);
14553
14554 CHECK_EQ(0, result.a0);
14555 CHECK_APPROX(0.0, result.a1);
14556
14557 // Pass argument that will make the Dart callback return null.
14558 a0 = 84;
14559
14560 result = f(a0, a1);
14561
14562 CHECK_EQ(0, result.a0);
14563 CHECK_APPROX(0.0, result.a1);
14564
14565 return 0;
14566}

◆ TestReturnStructAlignmentInt16()

DART_EXPORT intptr_t dart::TestReturnStructAlignmentInt16 ( StructAlignmentInt16(*)(int8_t a0, int16_t a1, int8_t a2)  f)

Definition at line 15235 of file ffi_test_functions_generated.cc.

15237 {
15238 int8_t a0;
15239 int16_t a1;
15240 int8_t a2;
15241
15242 a0 = -1;
15243 a1 = 2;
15244 a2 = -3;
15245
15246 std::cout << "Calling TestReturnStructAlignmentInt16(" << "("
15247 << static_cast<int>(a0) << ", " << a1 << ", "
15248 << static_cast<int>(a2) << ")" << ")\n";
15249
15250 StructAlignmentInt16 result = f(a0, a1, a2);
15251
15252 std::cout << "result = " << "(" << static_cast<int>(result.a0) << ", "
15253 << result.a1 << ", " << static_cast<int>(result.a2) << ")" << "\n";
15254
15255 CHECK_EQ(a0, result.a0);
15256 CHECK_EQ(a1, result.a1);
15257 CHECK_EQ(a2, result.a2);
15258
15259 // Pass argument that will make the Dart callback throw.
15260 a0 = 42;
15261
15262 result = f(a0, a1, a2);
15263
15264 CHECK_EQ(0, result.a0);
15265 CHECK_EQ(0, result.a1);
15266 CHECK_EQ(0, result.a2);
15267
15268 // Pass argument that will make the Dart callback return null.
15269 a0 = 84;
15270
15271 result = f(a0, a1, a2);
15272
15273 CHECK_EQ(0, result.a0);
15274 CHECK_EQ(0, result.a1);
15275 CHECK_EQ(0, result.a2);
15276
15277 return 0;
15278}

◆ TestReturnStructAlignmentInt32()

DART_EXPORT intptr_t dart::TestReturnStructAlignmentInt32 ( StructAlignmentInt32(*)(int8_t a0, int32_t a1, int8_t a2)  f)

Definition at line 15282 of file ffi_test_functions_generated.cc.

15284 {
15285 int8_t a0;
15286 int32_t a1;
15287 int8_t a2;
15288
15289 a0 = -1;
15290 a1 = 2;
15291 a2 = -3;
15292
15293 std::cout << "Calling TestReturnStructAlignmentInt32(" << "("
15294 << static_cast<int>(a0) << ", " << a1 << ", "
15295 << static_cast<int>(a2) << ")" << ")\n";
15296
15297 StructAlignmentInt32 result = f(a0, a1, a2);
15298
15299 std::cout << "result = " << "(" << static_cast<int>(result.a0) << ", "
15300 << result.a1 << ", " << static_cast<int>(result.a2) << ")" << "\n";
15301
15302 CHECK_EQ(a0, result.a0);
15303 CHECK_EQ(a1, result.a1);
15304 CHECK_EQ(a2, result.a2);
15305
15306 // Pass argument that will make the Dart callback throw.
15307 a0 = 42;
15308
15309 result = f(a0, a1, a2);
15310
15311 CHECK_EQ(0, result.a0);
15312 CHECK_EQ(0, result.a1);
15313 CHECK_EQ(0, result.a2);
15314
15315 // Pass argument that will make the Dart callback return null.
15316 a0 = 84;
15317
15318 result = f(a0, a1, a2);
15319
15320 CHECK_EQ(0, result.a0);
15321 CHECK_EQ(0, result.a1);
15322 CHECK_EQ(0, result.a2);
15323
15324 return 0;
15325}

◆ TestReturnStructAlignmentInt64()

DART_EXPORT intptr_t dart::TestReturnStructAlignmentInt64 ( StructAlignmentInt64(*)(int8_t a0, int64_t a1, int8_t a2)  f)

Definition at line 15329 of file ffi_test_functions_generated.cc.

15331 {
15332 int8_t a0;
15333 int64_t a1;
15334 int8_t a2;
15335
15336 a0 = -1;
15337 a1 = 2;
15338 a2 = -3;
15339
15340 std::cout << "Calling TestReturnStructAlignmentInt64(" << "("
15341 << static_cast<int>(a0) << ", " << a1 << ", "
15342 << static_cast<int>(a2) << ")" << ")\n";
15343
15344 StructAlignmentInt64 result = f(a0, a1, a2);
15345
15346 std::cout << "result = " << "(" << static_cast<int>(result.a0) << ", "
15347 << result.a1 << ", " << static_cast<int>(result.a2) << ")" << "\n";
15348
15349 CHECK_EQ(a0, result.a0);
15350 CHECK_EQ(a1, result.a1);
15351 CHECK_EQ(a2, result.a2);
15352
15353 // Pass argument that will make the Dart callback throw.
15354 a0 = 42;
15355
15356 result = f(a0, a1, a2);
15357
15358 CHECK_EQ(0, result.a0);
15359 CHECK_EQ(0, result.a1);
15360 CHECK_EQ(0, result.a2);
15361
15362 // Pass argument that will make the Dart callback return null.
15363 a0 = 84;
15364
15365 result = f(a0, a1, a2);
15366
15367 CHECK_EQ(0, result.a0);
15368 CHECK_EQ(0, result.a1);
15369 CHECK_EQ(0, result.a2);
15370
15371 return 0;
15372}

◆ TestReturnStructArgumentInt32x8Struct1ByteInt()

DART_EXPORT intptr_t dart::TestReturnStructArgumentInt32x8Struct1ByteInt ( Struct1ByteInt(*)(int32_t a0, int32_t a1, int32_t a2, int32_t a3, int32_t a4, int32_t a5, int32_t a6, int32_t a7, Struct1ByteInt a8)  f)

Definition at line 14763 of file ffi_test_functions_generated.cc.

14773 {
14774 int32_t a0;
14775 int32_t a1;
14776 int32_t a2;
14777 int32_t a3;
14778 int32_t a4;
14779 int32_t a5;
14780 int32_t a6;
14781 int32_t a7;
14782 Struct1ByteInt a8 = {};
14783
14784 a0 = -1;
14785 a1 = 2;
14786 a2 = -3;
14787 a3 = 4;
14788 a4 = -5;
14789 a5 = 6;
14790 a6 = -7;
14791 a7 = 8;
14792 a8.a0 = -9;
14793
14794 std::cout << "Calling TestReturnStructArgumentInt32x8Struct1ByteInt(" << "("
14795 << a0 << ", " << a1 << ", " << a2 << ", " << a3 << ", " << a4
14796 << ", " << a5 << ", " << a6 << ", " << a7 << ", ("
14797 << static_cast<int>(a8.a0) << "))" << ")\n";
14798
14799 Struct1ByteInt result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8);
14800
14801 std::cout << "result = " << "(" << static_cast<int>(result.a0) << ")" << "\n";
14802
14803 CHECK_EQ(a8.a0, result.a0);
14804
14805 // Pass argument that will make the Dart callback throw.
14806 a0 = 42;
14807
14808 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8);
14809
14810 CHECK_EQ(0, result.a0);
14811
14812 // Pass argument that will make the Dart callback return null.
14813 a0 = 84;
14814
14815 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8);
14816
14817 CHECK_EQ(0, result.a0);
14818
14819 return 0;
14820}

◆ TestReturnStructArgumentInt32x8Struct20BytesHomogeneou()

DART_EXPORT intptr_t dart::TestReturnStructArgumentInt32x8Struct20BytesHomogeneou ( Struct20BytesHomogeneousInt32(*)(int32_t a0, int32_t a1, int32_t a2, int32_t a3, int32_t a4, int32_t a5, int32_t a6, int32_t a7, Struct20BytesHomogeneousInt32 a8)  f)

Definition at line 14921 of file ffi_test_functions_generated.cc.

14931 {
14932 int32_t a0;
14933 int32_t a1;
14934 int32_t a2;
14935 int32_t a3;
14936 int32_t a4;
14937 int32_t a5;
14938 int32_t a6;
14939 int32_t a7;
14941
14942 a0 = -1;
14943 a1 = 2;
14944 a2 = -3;
14945 a3 = 4;
14946 a4 = -5;
14947 a5 = 6;
14948 a6 = -7;
14949 a7 = 8;
14950 a8.a0 = -9;
14951 a8.a1 = 10;
14952 a8.a2 = -11;
14953 a8.a3 = 12;
14954 a8.a4 = -13;
14955
14956 std::cout << "Calling TestReturnStructArgumentInt32x8Struct20BytesHomogeneou("
14957 << "(" << a0 << ", " << a1 << ", " << a2 << ", " << a3 << ", " << a4
14958 << ", " << a5 << ", " << a6 << ", " << a7 << ", (" << a8.a0 << ", "
14959 << a8.a1 << ", " << a8.a2 << ", " << a8.a3 << ", " << a8.a4 << "))"
14960 << ")\n";
14961
14962 Struct20BytesHomogeneousInt32 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8);
14963
14964 std::cout << "result = " << "(" << result.a0 << ", " << result.a1 << ", "
14965 << result.a2 << ", " << result.a3 << ", " << result.a4 << ")"
14966 << "\n";
14967
14968 CHECK_EQ(a8.a0, result.a0);
14969 CHECK_EQ(a8.a1, result.a1);
14970 CHECK_EQ(a8.a2, result.a2);
14971 CHECK_EQ(a8.a3, result.a3);
14972 CHECK_EQ(a8.a4, result.a4);
14973
14974 // Pass argument that will make the Dart callback throw.
14975 a0 = 42;
14976
14977 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8);
14978
14979 CHECK_EQ(0, result.a0);
14980 CHECK_EQ(0, result.a1);
14981 CHECK_EQ(0, result.a2);
14982 CHECK_EQ(0, result.a3);
14983 CHECK_EQ(0, result.a4);
14984
14985 // Pass argument that will make the Dart callback return null.
14986 a0 = 84;
14987
14988 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8);
14989
14990 CHECK_EQ(0, result.a0);
14991 CHECK_EQ(0, result.a1);
14992 CHECK_EQ(0, result.a2);
14993 CHECK_EQ(0, result.a3);
14994 CHECK_EQ(0, result.a4);
14995
14996 return 0;
14997}

◆ TestReturnStructArgumentStruct1ByteInt()

DART_EXPORT intptr_t dart::TestReturnStructArgumentStruct1ByteInt ( Struct1ByteInt(*)(Struct1ByteInt a0)  f)

Definition at line 14726 of file ffi_test_functions_generated.cc.

14728 {
14729 Struct1ByteInt a0 = {};
14730
14731 a0.a0 = -1;
14732
14733 std::cout << "Calling TestReturnStructArgumentStruct1ByteInt(" << "(("
14734 << static_cast<int>(a0.a0) << "))" << ")\n";
14735
14736 Struct1ByteInt result = f(a0);
14737
14738 std::cout << "result = " << "(" << static_cast<int>(result.a0) << ")" << "\n";
14739
14740 CHECK_EQ(a0.a0, result.a0);
14741
14742 // Pass argument that will make the Dart callback throw.
14743 a0.a0 = 42;
14744
14745 result = f(a0);
14746
14747 CHECK_EQ(0, result.a0);
14748
14749 // Pass argument that will make the Dart callback return null.
14750 a0.a0 = 84;
14751
14752 result = f(a0);
14753
14754 CHECK_EQ(0, result.a0);
14755
14756 return 0;
14757}

◆ TestReturnStructArgumentStruct20BytesHomogeneousInt32()

DART_EXPORT intptr_t dart::TestReturnStructArgumentStruct20BytesHomogeneousInt32 ( Struct20BytesHomogeneousInt32(*)(Struct20BytesHomogeneousInt32 a0)  f)

Definition at line 14866 of file ffi_test_functions_generated.cc.

14868 {
14870
14871 a0.a0 = -1;
14872 a0.a1 = 2;
14873 a0.a2 = -3;
14874 a0.a3 = 4;
14875 a0.a4 = -5;
14876
14877 std::cout << "Calling TestReturnStructArgumentStruct20BytesHomogeneousInt32("
14878 << "((" << a0.a0 << ", " << a0.a1 << ", " << a0.a2 << ", " << a0.a3
14879 << ", " << a0.a4 << "))" << ")\n";
14880
14881 Struct20BytesHomogeneousInt32 result = f(a0);
14882
14883 std::cout << "result = " << "(" << result.a0 << ", " << result.a1 << ", "
14884 << result.a2 << ", " << result.a3 << ", " << result.a4 << ")"
14885 << "\n";
14886
14887 CHECK_EQ(a0.a0, result.a0);
14888 CHECK_EQ(a0.a1, result.a1);
14889 CHECK_EQ(a0.a2, result.a2);
14890 CHECK_EQ(a0.a3, result.a3);
14891 CHECK_EQ(a0.a4, result.a4);
14892
14893 // Pass argument that will make the Dart callback throw.
14894 a0.a0 = 42;
14895
14896 result = f(a0);
14897
14898 CHECK_EQ(0, result.a0);
14899 CHECK_EQ(0, result.a1);
14900 CHECK_EQ(0, result.a2);
14901 CHECK_EQ(0, result.a3);
14902 CHECK_EQ(0, result.a4);
14903
14904 // Pass argument that will make the Dart callback return null.
14905 a0.a0 = 84;
14906
14907 result = f(a0);
14908
14909 CHECK_EQ(0, result.a0);
14910 CHECK_EQ(0, result.a1);
14911 CHECK_EQ(0, result.a2);
14912 CHECK_EQ(0, result.a3);
14913 CHECK_EQ(0, result.a4);
14914
14915 return 0;
14916}

◆ TestReturnStructArgumentStruct8BytesHomogeneousFloat()

DART_EXPORT intptr_t dart::TestReturnStructArgumentStruct8BytesHomogeneousFloat ( Struct8BytesHomogeneousFloat(*)(Struct8BytesHomogeneousFloat a0)  f)

Definition at line 14826 of file ffi_test_functions_generated.cc.

14828 {
14830
14831 a0.a0 = -1.0;
14832 a0.a1 = 2.0;
14833
14834 std::cout << "Calling TestReturnStructArgumentStruct8BytesHomogeneousFloat("
14835 << "((" << a0.a0 << ", " << a0.a1 << "))" << ")\n";
14836
14837 Struct8BytesHomogeneousFloat result = f(a0);
14838
14839 std::cout << "result = " << "(" << result.a0 << ", " << result.a1 << ")"
14840 << "\n";
14841
14842 CHECK_APPROX(a0.a0, result.a0);
14843 CHECK_APPROX(a0.a1, result.a1);
14844
14845 // Pass argument that will make the Dart callback throw.
14846 a0.a0 = 42;
14847
14848 result = f(a0);
14849
14850 CHECK_APPROX(0.0, result.a0);
14851 CHECK_APPROX(0.0, result.a1);
14852
14853 // Pass argument that will make the Dart callback return null.
14854 a0.a0 = 84;
14855
14856 result = f(a0);
14857
14858 CHECK_APPROX(0.0, result.a0);
14859 CHECK_APPROX(0.0, result.a1);
14860
14861 return 0;
14862}

◆ TestReturnStructArgumentStruct8BytesInlineArrayInt()

DART_EXPORT intptr_t dart::TestReturnStructArgumentStruct8BytesInlineArrayInt ( Struct8BytesInlineArrayInt(*)(Struct8BytesInlineArrayInt a0)  f)

Definition at line 15001 of file ffi_test_functions_generated.cc.

15003 {
15005
15006 a0.a0[0] = 1;
15007 a0.a0[1] = 2;
15008 a0.a0[2] = 3;
15009 a0.a0[3] = 4;
15010 a0.a0[4] = 5;
15011 a0.a0[5] = 6;
15012 a0.a0[6] = 7;
15013 a0.a0[7] = 8;
15014
15015 std::cout << "Calling TestReturnStructArgumentStruct8BytesInlineArrayInt("
15016 << "(([" << static_cast<int>(a0.a0[0]) << ", "
15017 << static_cast<int>(a0.a0[1]) << ", " << static_cast<int>(a0.a0[2])
15018 << ", " << static_cast<int>(a0.a0[3]) << ", "
15019 << static_cast<int>(a0.a0[4]) << ", " << static_cast<int>(a0.a0[5])
15020 << ", " << static_cast<int>(a0.a0[6]) << ", "
15021 << static_cast<int>(a0.a0[7]) << "]))" << ")\n";
15022
15023 Struct8BytesInlineArrayInt result = f(a0);
15024
15025 std::cout << "result = " << "([" << static_cast<int>(result.a0[0]) << ", "
15026 << static_cast<int>(result.a0[1]) << ", "
15027 << static_cast<int>(result.a0[2]) << ", "
15028 << static_cast<int>(result.a0[3]) << ", "
15029 << static_cast<int>(result.a0[4]) << ", "
15030 << static_cast<int>(result.a0[5]) << ", "
15031 << static_cast<int>(result.a0[6]) << ", "
15032 << static_cast<int>(result.a0[7]) << "])" << "\n";
15033
15034 for (intptr_t i = 0; i < 8; i++) {
15035 CHECK_EQ(a0.a0[i], result.a0[i]);
15036 }
15037
15038 // Pass argument that will make the Dart callback throw.
15039 a0.a0[0] = 42;
15040
15041 result = f(a0);
15042
15043 for (intptr_t i = 0; i < 8; i++) {
15044 CHECK_EQ(0, result.a0[i]);
15045 }
15046
15047 // Pass argument that will make the Dart callback return null.
15048 a0.a0[0] = 84;
15049
15050 result = f(a0);
15051
15052 for (intptr_t i = 0; i < 8; i++) {
15053 CHECK_EQ(0, result.a0[i]);
15054 }
15055
15056 return 0;
15057}

◆ TestReturnStructArgumentStructStruct16BytesHomogeneous()

DART_EXPORT intptr_t dart::TestReturnStructArgumentStructStruct16BytesHomogeneous ( StructStruct16BytesHomogeneousFloat2(*)(StructStruct16BytesHomogeneousFloat2 a0)  f)

Definition at line 15061 of file ffi_test_functions_generated.cc.

15064 {
15066
15067 a0.a0.a0 = -1.0;
15068 a0.a1[0].a0 = 2.0;
15069 a0.a1[1].a0 = -3.0;
15070 a0.a2 = 4.0;
15071
15072 std::cout << "Calling TestReturnStructArgumentStructStruct16BytesHomogeneous("
15073 << "(((" << a0.a0.a0 << "), [(" << a0.a1[0].a0 << "), ("
15074 << a0.a1[1].a0 << ")], " << a0.a2 << "))" << ")\n";
15075
15076 StructStruct16BytesHomogeneousFloat2 result = f(a0);
15077
15078 std::cout << "result = " << "((" << result.a0.a0 << "), [(" << result.a1[0].a0
15079 << "), (" << result.a1[1].a0 << ")], " << result.a2 << ")" << "\n";
15080
15081 CHECK_APPROX(a0.a0.a0, result.a0.a0);
15082 for (intptr_t i = 0; i < 2; i++) {
15083 CHECK_APPROX(a0.a1[i].a0, result.a1[i].a0);
15084 }
15085 CHECK_APPROX(a0.a2, result.a2);
15086
15087 // Pass argument that will make the Dart callback throw.
15088 a0.a0.a0 = 42;
15089
15090 result = f(a0);
15091
15092 CHECK_APPROX(0.0, result.a0.a0);
15093 for (intptr_t i = 0; i < 2; i++) {
15094 CHECK_APPROX(0.0, result.a1[i].a0);
15095 }
15096 CHECK_APPROX(0.0, result.a2);
15097
15098 // Pass argument that will make the Dart callback return null.
15099 a0.a0.a0 = 84;
15100
15101 result = f(a0);
15102
15103 CHECK_APPROX(0.0, result.a0.a0);
15104 for (intptr_t i = 0; i < 2; i++) {
15105 CHECK_APPROX(0.0, result.a1[i].a0);
15106 }
15107 CHECK_APPROX(0.0, result.a2);
15108
15109 return 0;
15110}

◆ TestReturnStructArgumentStructStruct16BytesMixed3()

DART_EXPORT intptr_t dart::TestReturnStructArgumentStructStruct16BytesMixed3 ( StructStruct16BytesMixed3(*)(StructStruct16BytesMixed3 a0)  f)

Definition at line 15167 of file ffi_test_functions_generated.cc.

15169 {
15171
15172 a0.a0.a0 = -1.0;
15173 a0.a1[0].a0 = 2.0;
15174 a0.a1[0].a1 = -3;
15175 a0.a1[0].a2 = 4;
15176 a0.a2[0] = -5;
15177 a0.a2[1] = 6;
15178
15179 std::cout << "Calling TestReturnStructArgumentStructStruct16BytesMixed3("
15180 << "(((" << a0.a0.a0 << "), [(" << a0.a1[0].a0 << ", "
15181 << a0.a1[0].a1 << ", " << a0.a1[0].a2 << ")], [" << a0.a2[0] << ", "
15182 << a0.a2[1] << "]))" << ")\n";
15183
15184 StructStruct16BytesMixed3 result = f(a0);
15185
15186 std::cout << "result = " << "((" << result.a0.a0 << "), [(" << result.a1[0].a0
15187 << ", " << result.a1[0].a1 << ", " << result.a1[0].a2 << ")], ["
15188 << result.a2[0] << ", " << result.a2[1] << "])" << "\n";
15189
15190 CHECK_APPROX(a0.a0.a0, result.a0.a0);
15191 for (intptr_t i = 0; i < 1; i++) {
15192 CHECK_APPROX(a0.a1[i].a0, result.a1[i].a0);
15193 CHECK_EQ(a0.a1[i].a1, result.a1[i].a1);
15194 CHECK_EQ(a0.a1[i].a2, result.a1[i].a2);
15195 }
15196 for (intptr_t i = 0; i < 2; i++) {
15197 CHECK_EQ(a0.a2[i], result.a2[i]);
15198 }
15199
15200 // Pass argument that will make the Dart callback throw.
15201 a0.a0.a0 = 42;
15202
15203 result = f(a0);
15204
15205 CHECK_APPROX(0.0, result.a0.a0);
15206 for (intptr_t i = 0; i < 1; i++) {
15207 CHECK_APPROX(0.0, result.a1[i].a0);
15208 CHECK_EQ(0, result.a1[i].a1);
15209 CHECK_EQ(0, result.a1[i].a2);
15210 }
15211 for (intptr_t i = 0; i < 2; i++) {
15212 CHECK_EQ(0, result.a2[i]);
15213 }
15214
15215 // Pass argument that will make the Dart callback return null.
15216 a0.a0.a0 = 84;
15217
15218 result = f(a0);
15219
15220 CHECK_APPROX(0.0, result.a0.a0);
15221 for (intptr_t i = 0; i < 1; i++) {
15222 CHECK_APPROX(0.0, result.a1[i].a0);
15223 CHECK_EQ(0, result.a1[i].a1);
15224 CHECK_EQ(0, result.a1[i].a2);
15225 }
15226 for (intptr_t i = 0; i < 2; i++) {
15227 CHECK_EQ(0, result.a2[i]);
15228 }
15229
15230 return 0;
15231}

◆ TestReturnStructArgumentStructStruct32BytesHomogeneous()

DART_EXPORT intptr_t dart::TestReturnStructArgumentStructStruct32BytesHomogeneous ( StructStruct32BytesHomogeneousDouble2(*)(StructStruct32BytesHomogeneousDouble2 a0)  f)

Definition at line 15114 of file ffi_test_functions_generated.cc.

15117 {
15119
15120 a0.a0.a0 = -1.0;
15121 a0.a1[0].a0 = 2.0;
15122 a0.a1[1].a0 = -3.0;
15123 a0.a2 = 4.0;
15124
15125 std::cout << "Calling TestReturnStructArgumentStructStruct32BytesHomogeneous("
15126 << "(((" << a0.a0.a0 << "), [(" << a0.a1[0].a0 << "), ("
15127 << a0.a1[1].a0 << ")], " << a0.a2 << "))" << ")\n";
15128
15129 StructStruct32BytesHomogeneousDouble2 result = f(a0);
15130
15131 std::cout << "result = " << "((" << result.a0.a0 << "), [(" << result.a1[0].a0
15132 << "), (" << result.a1[1].a0 << ")], " << result.a2 << ")" << "\n";
15133
15134 CHECK_APPROX(a0.a0.a0, result.a0.a0);
15135 for (intptr_t i = 0; i < 2; i++) {
15136 CHECK_APPROX(a0.a1[i].a0, result.a1[i].a0);
15137 }
15138 CHECK_APPROX(a0.a2, result.a2);
15139
15140 // Pass argument that will make the Dart callback throw.
15141 a0.a0.a0 = 42;
15142
15143 result = f(a0);
15144
15145 CHECK_APPROX(0.0, result.a0.a0);
15146 for (intptr_t i = 0; i < 2; i++) {
15147 CHECK_APPROX(0.0, result.a1[i].a0);
15148 }
15149 CHECK_APPROX(0.0, result.a2);
15150
15151 // Pass argument that will make the Dart callback return null.
15152 a0.a0.a0 = 84;
15153
15154 result = f(a0);
15155
15156 CHECK_APPROX(0.0, result.a0.a0);
15157 for (intptr_t i = 0; i < 2; i++) {
15158 CHECK_APPROX(0.0, result.a1[i].a0);
15159 }
15160 CHECK_APPROX(0.0, result.a2);
15161
15162 return 0;
15163}

◆ TestReturnStructNestedIntStructAlignmentInt16()

DART_EXPORT intptr_t dart::TestReturnStructNestedIntStructAlignmentInt16 ( StructNestedIntStructAlignmentInt16(*)(StructAlignmentInt16 a0, StructAlignmentInt16 a1)  f)

Definition at line 15738 of file ffi_test_functions_generated.cc.

15741 {
15742 StructAlignmentInt16 a0 = {};
15743 StructAlignmentInt16 a1 = {};
15744
15745 a0.a0 = -1;
15746 a0.a1 = 2;
15747 a0.a2 = -3;
15748 a1.a0 = 4;
15749 a1.a1 = -5;
15750 a1.a2 = 6;
15751
15752 std::cout << "Calling TestReturnStructNestedIntStructAlignmentInt16(" << "(("
15753 << static_cast<int>(a0.a0) << ", " << a0.a1 << ", "
15754 << static_cast<int>(a0.a2) << "), (" << static_cast<int>(a1.a0)
15755 << ", " << a1.a1 << ", " << static_cast<int>(a1.a2) << "))"
15756 << ")\n";
15757
15758 StructNestedIntStructAlignmentInt16 result = f(a0, a1);
15759
15760 std::cout << "result = " << "((" << static_cast<int>(result.a0.a0) << ", "
15761 << result.a0.a1 << ", " << static_cast<int>(result.a0.a2) << "), ("
15762 << static_cast<int>(result.a1.a0) << ", " << result.a1.a1 << ", "
15763 << static_cast<int>(result.a1.a2) << "))" << "\n";
15764
15765 CHECK_EQ(a0.a0, result.a0.a0);
15766 CHECK_EQ(a0.a1, result.a0.a1);
15767 CHECK_EQ(a0.a2, result.a0.a2);
15768 CHECK_EQ(a1.a0, result.a1.a0);
15769 CHECK_EQ(a1.a1, result.a1.a1);
15770 CHECK_EQ(a1.a2, result.a1.a2);
15771
15772 // Pass argument that will make the Dart callback throw.
15773 a0.a0 = 42;
15774
15775 result = f(a0, a1);
15776
15777 CHECK_EQ(0, result.a0.a0);
15778 CHECK_EQ(0, result.a0.a1);
15779 CHECK_EQ(0, result.a0.a2);
15780 CHECK_EQ(0, result.a1.a0);
15781 CHECK_EQ(0, result.a1.a1);
15782 CHECK_EQ(0, result.a1.a2);
15783
15784 // Pass argument that will make the Dart callback return null.
15785 a0.a0 = 84;
15786
15787 result = f(a0, a1);
15788
15789 CHECK_EQ(0, result.a0.a0);
15790 CHECK_EQ(0, result.a0.a1);
15791 CHECK_EQ(0, result.a0.a2);
15792 CHECK_EQ(0, result.a1.a0);
15793 CHECK_EQ(0, result.a1.a1);
15794 CHECK_EQ(0, result.a1.a2);
15795
15796 return 0;
15797}

◆ TestReturnStructNestedIntStructAlignmentInt32()

DART_EXPORT intptr_t dart::TestReturnStructNestedIntStructAlignmentInt32 ( StructNestedIntStructAlignmentInt32(*)(StructAlignmentInt32 a0, StructAlignmentInt32 a1)  f)

Definition at line 15801 of file ffi_test_functions_generated.cc.

15804 {
15805 StructAlignmentInt32 a0 = {};
15806 StructAlignmentInt32 a1 = {};
15807
15808 a0.a0 = -1;
15809 a0.a1 = 2;
15810 a0.a2 = -3;
15811 a1.a0 = 4;
15812 a1.a1 = -5;
15813 a1.a2 = 6;
15814
15815 std::cout << "Calling TestReturnStructNestedIntStructAlignmentInt32(" << "(("
15816 << static_cast<int>(a0.a0) << ", " << a0.a1 << ", "
15817 << static_cast<int>(a0.a2) << "), (" << static_cast<int>(a1.a0)
15818 << ", " << a1.a1 << ", " << static_cast<int>(a1.a2) << "))"
15819 << ")\n";
15820
15821 StructNestedIntStructAlignmentInt32 result = f(a0, a1);
15822
15823 std::cout << "result = " << "((" << static_cast<int>(result.a0.a0) << ", "
15824 << result.a0.a1 << ", " << static_cast<int>(result.a0.a2) << "), ("
15825 << static_cast<int>(result.a1.a0) << ", " << result.a1.a1 << ", "
15826 << static_cast<int>(result.a1.a2) << "))" << "\n";
15827
15828 CHECK_EQ(a0.a0, result.a0.a0);
15829 CHECK_EQ(a0.a1, result.a0.a1);
15830 CHECK_EQ(a0.a2, result.a0.a2);
15831 CHECK_EQ(a1.a0, result.a1.a0);
15832 CHECK_EQ(a1.a1, result.a1.a1);
15833 CHECK_EQ(a1.a2, result.a1.a2);
15834
15835 // Pass argument that will make the Dart callback throw.
15836 a0.a0 = 42;
15837
15838 result = f(a0, a1);
15839
15840 CHECK_EQ(0, result.a0.a0);
15841 CHECK_EQ(0, result.a0.a1);
15842 CHECK_EQ(0, result.a0.a2);
15843 CHECK_EQ(0, result.a1.a0);
15844 CHECK_EQ(0, result.a1.a1);
15845 CHECK_EQ(0, result.a1.a2);
15846
15847 // Pass argument that will make the Dart callback return null.
15848 a0.a0 = 84;
15849
15850 result = f(a0, a1);
15851
15852 CHECK_EQ(0, result.a0.a0);
15853 CHECK_EQ(0, result.a0.a1);
15854 CHECK_EQ(0, result.a0.a2);
15855 CHECK_EQ(0, result.a1.a0);
15856 CHECK_EQ(0, result.a1.a1);
15857 CHECK_EQ(0, result.a1.a2);
15858
15859 return 0;
15860}

◆ TestReturnStructNestedIntStructAlignmentInt64()

DART_EXPORT intptr_t dart::TestReturnStructNestedIntStructAlignmentInt64 ( StructNestedIntStructAlignmentInt64(*)(StructAlignmentInt64 a0, StructAlignmentInt64 a1)  f)

Definition at line 15864 of file ffi_test_functions_generated.cc.

15867 {
15868 StructAlignmentInt64 a0 = {};
15869 StructAlignmentInt64 a1 = {};
15870
15871 a0.a0 = -1;
15872 a0.a1 = 2;
15873 a0.a2 = -3;
15874 a1.a0 = 4;
15875 a1.a1 = -5;
15876 a1.a2 = 6;
15877
15878 std::cout << "Calling TestReturnStructNestedIntStructAlignmentInt64(" << "(("
15879 << static_cast<int>(a0.a0) << ", " << a0.a1 << ", "
15880 << static_cast<int>(a0.a2) << "), (" << static_cast<int>(a1.a0)
15881 << ", " << a1.a1 << ", " << static_cast<int>(a1.a2) << "))"
15882 << ")\n";
15883
15884 StructNestedIntStructAlignmentInt64 result = f(a0, a1);
15885
15886 std::cout << "result = " << "((" << static_cast<int>(result.a0.a0) << ", "
15887 << result.a0.a1 << ", " << static_cast<int>(result.a0.a2) << "), ("
15888 << static_cast<int>(result.a1.a0) << ", " << result.a1.a1 << ", "
15889 << static_cast<int>(result.a1.a2) << "))" << "\n";
15890
15891 CHECK_EQ(a0.a0, result.a0.a0);
15892 CHECK_EQ(a0.a1, result.a0.a1);
15893 CHECK_EQ(a0.a2, result.a0.a2);
15894 CHECK_EQ(a1.a0, result.a1.a0);
15895 CHECK_EQ(a1.a1, result.a1.a1);
15896 CHECK_EQ(a1.a2, result.a1.a2);
15897
15898 // Pass argument that will make the Dart callback throw.
15899 a0.a0 = 42;
15900
15901 result = f(a0, a1);
15902
15903 CHECK_EQ(0, result.a0.a0);
15904 CHECK_EQ(0, result.a0.a1);
15905 CHECK_EQ(0, result.a0.a2);
15906 CHECK_EQ(0, result.a1.a0);
15907 CHECK_EQ(0, result.a1.a1);
15908 CHECK_EQ(0, result.a1.a2);
15909
15910 // Pass argument that will make the Dart callback return null.
15911 a0.a0 = 84;
15912
15913 result = f(a0, a1);
15914
15915 CHECK_EQ(0, result.a0.a0);
15916 CHECK_EQ(0, result.a0.a1);
15917 CHECK_EQ(0, result.a0.a2);
15918 CHECK_EQ(0, result.a1.a0);
15919 CHECK_EQ(0, result.a1.a1);
15920 CHECK_EQ(0, result.a1.a2);
15921
15922 return 0;
15923}

◆ TestReturnStructNestedIrregularEvenBigger()

DART_EXPORT intptr_t dart::TestReturnStructNestedIrregularEvenBigger ( StructNestedIrregularEvenBigger(*)(uint64_t a0, StructNestedIrregularBigger a1, StructNestedIrregularBigger a2, double a3)  f)

Definition at line 15927 of file ffi_test_functions_generated.cc.

15932 {
15933 uint64_t a0;
15935 StructNestedIrregularBigger a2 = {};
15936 double a3;
15937
15938 a0 = 1;
15939 a1.a0.a0 = 2;
15940 a1.a0.a1.a0.a0 = -3;
15941 a1.a0.a1.a0.a1 = 4;
15942 a1.a0.a1.a1.a0 = -5.0;
15943 a1.a0.a2 = 6;
15944 a1.a0.a3.a0.a0 = -7.0;
15945 a1.a0.a3.a1 = 8.0;
15946 a1.a0.a4 = 9;
15947 a1.a0.a5.a0.a0 = 10.0;
15948 a1.a0.a5.a1.a0 = -11.0;
15949 a1.a0.a6 = 12;
15950 a1.a1.a0.a0 = -13;
15951 a1.a1.a0.a1 = 14;
15952 a1.a1.a1.a0 = -15.0;
15953 a1.a2 = 16.0;
15954 a1.a3 = -17.0;
15955 a2.a0.a0 = 18;
15956 a2.a0.a1.a0.a0 = -19;
15957 a2.a0.a1.a0.a1 = 20;
15958 a2.a0.a1.a1.a0 = -21.0;
15959 a2.a0.a2 = 22;
15960 a2.a0.a3.a0.a0 = -23.0;
15961 a2.a0.a3.a1 = 24.0;
15962 a2.a0.a4 = 25;
15963 a2.a0.a5.a0.a0 = 26.0;
15964 a2.a0.a5.a1.a0 = -27.0;
15965 a2.a0.a6 = 28;
15966 a2.a1.a0.a0 = -29;
15967 a2.a1.a0.a1 = 30;
15968 a2.a1.a1.a0 = -31.0;
15969 a2.a2 = 32.0;
15970 a2.a3 = -33.0;
15971 a3 = 34.0;
15972
15973 std::cout << "Calling TestReturnStructNestedIrregularEvenBigger(" << "(" << a0
15974 << ", ((" << a1.a0.a0 << ", ((" << a1.a0.a1.a0.a0 << ", "
15975 << a1.a0.a1.a0.a1 << "), (" << a1.a0.a1.a1.a0 << ")), " << a1.a0.a2
15976 << ", ((" << a1.a0.a3.a0.a0 << "), " << a1.a0.a3.a1 << "), "
15977 << a1.a0.a4 << ", ((" << a1.a0.a5.a0.a0 << "), (" << a1.a0.a5.a1.a0
15978 << ")), " << a1.a0.a6 << "), ((" << a1.a1.a0.a0 << ", "
15979 << a1.a1.a0.a1 << "), (" << a1.a1.a1.a0 << ")), " << a1.a2 << ", "
15980 << a1.a3 << "), ((" << a2.a0.a0 << ", ((" << a2.a0.a1.a0.a0 << ", "
15981 << a2.a0.a1.a0.a1 << "), (" << a2.a0.a1.a1.a0 << ")), " << a2.a0.a2
15982 << ", ((" << a2.a0.a3.a0.a0 << "), " << a2.a0.a3.a1 << "), "
15983 << a2.a0.a4 << ", ((" << a2.a0.a5.a0.a0 << "), (" << a2.a0.a5.a1.a0
15984 << ")), " << a2.a0.a6 << "), ((" << a2.a1.a0.a0 << ", "
15985 << a2.a1.a0.a1 << "), (" << a2.a1.a1.a0 << ")), " << a2.a2 << ", "
15986 << a2.a3 << "), " << a3 << ")" << ")\n";
15987
15988 StructNestedIrregularEvenBigger result = f(a0, a1, a2, a3);
15989
15990 std::cout << "result = " << "(" << result.a0 << ", ((" << result.a1.a0.a0
15991 << ", ((" << result.a1.a0.a1.a0.a0 << ", " << result.a1.a0.a1.a0.a1
15992 << "), (" << result.a1.a0.a1.a1.a0 << ")), " << result.a1.a0.a2
15993 << ", ((" << result.a1.a0.a3.a0.a0 << "), " << result.a1.a0.a3.a1
15994 << "), " << result.a1.a0.a4 << ", ((" << result.a1.a0.a5.a0.a0
15995 << "), (" << result.a1.a0.a5.a1.a0 << ")), " << result.a1.a0.a6
15996 << "), ((" << result.a1.a1.a0.a0 << ", " << result.a1.a1.a0.a1
15997 << "), (" << result.a1.a1.a1.a0 << ")), " << result.a1.a2 << ", "
15998 << result.a1.a3 << "), ((" << result.a2.a0.a0 << ", (("
15999 << result.a2.a0.a1.a0.a0 << ", " << result.a2.a0.a1.a0.a1 << "), ("
16000 << result.a2.a0.a1.a1.a0 << ")), " << result.a2.a0.a2 << ", (("
16001 << result.a2.a0.a3.a0.a0 << "), " << result.a2.a0.a3.a1 << "), "
16002 << result.a2.a0.a4 << ", ((" << result.a2.a0.a5.a0.a0 << "), ("
16003 << result.a2.a0.a5.a1.a0 << ")), " << result.a2.a0.a6 << "), (("
16004 << result.a2.a1.a0.a0 << ", " << result.a2.a1.a0.a1 << "), ("
16005 << result.a2.a1.a1.a0 << ")), " << result.a2.a2 << ", "
16006 << result.a2.a3 << "), " << result.a3 << ")" << "\n";
16007
16008 CHECK_EQ(a0, result.a0);
16009 CHECK_EQ(a1.a0.a0, result.a1.a0.a0);
16010 CHECK_EQ(a1.a0.a1.a0.a0, result.a1.a0.a1.a0.a0);
16011 CHECK_EQ(a1.a0.a1.a0.a1, result.a1.a0.a1.a0.a1);
16012 CHECK_APPROX(a1.a0.a1.a1.a0, result.a1.a0.a1.a1.a0);
16013 CHECK_EQ(a1.a0.a2, result.a1.a0.a2);
16014 CHECK_APPROX(a1.a0.a3.a0.a0, result.a1.a0.a3.a0.a0);
16015 CHECK_APPROX(a1.a0.a3.a1, result.a1.a0.a3.a1);
16016 CHECK_EQ(a1.a0.a4, result.a1.a0.a4);
16017 CHECK_APPROX(a1.a0.a5.a0.a0, result.a1.a0.a5.a0.a0);
16018 CHECK_APPROX(a1.a0.a5.a1.a0, result.a1.a0.a5.a1.a0);
16019 CHECK_EQ(a1.a0.a6, result.a1.a0.a6);
16020 CHECK_EQ(a1.a1.a0.a0, result.a1.a1.a0.a0);
16021 CHECK_EQ(a1.a1.a0.a1, result.a1.a1.a0.a1);
16022 CHECK_APPROX(a1.a1.a1.a0, result.a1.a1.a1.a0);
16023 CHECK_APPROX(a1.a2, result.a1.a2);
16024 CHECK_APPROX(a1.a3, result.a1.a3);
16025 CHECK_EQ(a2.a0.a0, result.a2.a0.a0);
16026 CHECK_EQ(a2.a0.a1.a0.a0, result.a2.a0.a1.a0.a0);
16027 CHECK_EQ(a2.a0.a1.a0.a1, result.a2.a0.a1.a0.a1);
16028 CHECK_APPROX(a2.a0.a1.a1.a0, result.a2.a0.a1.a1.a0);
16029 CHECK_EQ(a2.a0.a2, result.a2.a0.a2);
16030 CHECK_APPROX(a2.a0.a3.a0.a0, result.a2.a0.a3.a0.a0);
16031 CHECK_APPROX(a2.a0.a3.a1, result.a2.a0.a3.a1);
16032 CHECK_EQ(a2.a0.a4, result.a2.a0.a4);
16033 CHECK_APPROX(a2.a0.a5.a0.a0, result.a2.a0.a5.a0.a0);
16034 CHECK_APPROX(a2.a0.a5.a1.a0, result.a2.a0.a5.a1.a0);
16035 CHECK_EQ(a2.a0.a6, result.a2.a0.a6);
16036 CHECK_EQ(a2.a1.a0.a0, result.a2.a1.a0.a0);
16037 CHECK_EQ(a2.a1.a0.a1, result.a2.a1.a0.a1);
16038 CHECK_APPROX(a2.a1.a1.a0, result.a2.a1.a1.a0);
16039 CHECK_APPROX(a2.a2, result.a2.a2);
16040 CHECK_APPROX(a2.a3, result.a2.a3);
16041 CHECK_APPROX(a3, result.a3);
16042
16043 // Pass argument that will make the Dart callback throw.
16044 a0 = 42;
16045
16046 result = f(a0, a1, a2, a3);
16047
16048 CHECK_EQ(0, result.a0);
16049 CHECK_EQ(0, result.a1.a0.a0);
16050 CHECK_EQ(0, result.a1.a0.a1.a0.a0);
16051 CHECK_EQ(0, result.a1.a0.a1.a0.a1);
16052 CHECK_APPROX(0.0, result.a1.a0.a1.a1.a0);
16053 CHECK_EQ(0, result.a1.a0.a2);
16054 CHECK_APPROX(0.0, result.a1.a0.a3.a0.a0);
16055 CHECK_APPROX(0.0, result.a1.a0.a3.a1);
16056 CHECK_EQ(0, result.a1.a0.a4);
16057 CHECK_APPROX(0.0, result.a1.a0.a5.a0.a0);
16058 CHECK_APPROX(0.0, result.a1.a0.a5.a1.a0);
16059 CHECK_EQ(0, result.a1.a0.a6);
16060 CHECK_EQ(0, result.a1.a1.a0.a0);
16061 CHECK_EQ(0, result.a1.a1.a0.a1);
16062 CHECK_APPROX(0.0, result.a1.a1.a1.a0);
16063 CHECK_APPROX(0.0, result.a1.a2);
16064 CHECK_APPROX(0.0, result.a1.a3);
16065 CHECK_EQ(0, result.a2.a0.a0);
16066 CHECK_EQ(0, result.a2.a0.a1.a0.a0);
16067 CHECK_EQ(0, result.a2.a0.a1.a0.a1);
16068 CHECK_APPROX(0.0, result.a2.a0.a1.a1.a0);
16069 CHECK_EQ(0, result.a2.a0.a2);
16070 CHECK_APPROX(0.0, result.a2.a0.a3.a0.a0);
16071 CHECK_APPROX(0.0, result.a2.a0.a3.a1);
16072 CHECK_EQ(0, result.a2.a0.a4);
16073 CHECK_APPROX(0.0, result.a2.a0.a5.a0.a0);
16074 CHECK_APPROX(0.0, result.a2.a0.a5.a1.a0);
16075 CHECK_EQ(0, result.a2.a0.a6);
16076 CHECK_EQ(0, result.a2.a1.a0.a0);
16077 CHECK_EQ(0, result.a2.a1.a0.a1);
16078 CHECK_APPROX(0.0, result.a2.a1.a1.a0);
16079 CHECK_APPROX(0.0, result.a2.a2);
16080 CHECK_APPROX(0.0, result.a2.a3);
16081 CHECK_APPROX(0.0, result.a3);
16082
16083 // Pass argument that will make the Dart callback return null.
16084 a0 = 84;
16085
16086 result = f(a0, a1, a2, a3);
16087
16088 CHECK_EQ(0, result.a0);
16089 CHECK_EQ(0, result.a1.a0.a0);
16090 CHECK_EQ(0, result.a1.a0.a1.a0.a0);
16091 CHECK_EQ(0, result.a1.a0.a1.a0.a1);
16092 CHECK_APPROX(0.0, result.a1.a0.a1.a1.a0);
16093 CHECK_EQ(0, result.a1.a0.a2);
16094 CHECK_APPROX(0.0, result.a1.a0.a3.a0.a0);
16095 CHECK_APPROX(0.0, result.a1.a0.a3.a1);
16096 CHECK_EQ(0, result.a1.a0.a4);
16097 CHECK_APPROX(0.0, result.a1.a0.a5.a0.a0);
16098 CHECK_APPROX(0.0, result.a1.a0.a5.a1.a0);
16099 CHECK_EQ(0, result.a1.a0.a6);
16100 CHECK_EQ(0, result.a1.a1.a0.a0);
16101 CHECK_EQ(0, result.a1.a1.a0.a1);
16102 CHECK_APPROX(0.0, result.a1.a1.a1.a0);
16103 CHECK_APPROX(0.0, result.a1.a2);
16104 CHECK_APPROX(0.0, result.a1.a3);
16105 CHECK_EQ(0, result.a2.a0.a0);
16106 CHECK_EQ(0, result.a2.a0.a1.a0.a0);
16107 CHECK_EQ(0, result.a2.a0.a1.a0.a1);
16108 CHECK_APPROX(0.0, result.a2.a0.a1.a1.a0);
16109 CHECK_EQ(0, result.a2.a0.a2);
16110 CHECK_APPROX(0.0, result.a2.a0.a3.a0.a0);
16111 CHECK_APPROX(0.0, result.a2.a0.a3.a1);
16112 CHECK_EQ(0, result.a2.a0.a4);
16113 CHECK_APPROX(0.0, result.a2.a0.a5.a0.a0);
16114 CHECK_APPROX(0.0, result.a2.a0.a5.a1.a0);
16115 CHECK_EQ(0, result.a2.a0.a6);
16116 CHECK_EQ(0, result.a2.a1.a0.a0);
16117 CHECK_EQ(0, result.a2.a1.a0.a1);
16118 CHECK_APPROX(0.0, result.a2.a1.a1.a0);
16119 CHECK_APPROX(0.0, result.a2.a2);
16120 CHECK_APPROX(0.0, result.a2.a3);
16121 CHECK_APPROX(0.0, result.a3);
16122
16123 return 0;
16124}

◆ TestReturnUnion16BytesNestedFloat()

DART_EXPORT intptr_t dart::TestReturnUnion16BytesNestedFloat ( Union16BytesNestedFloat(*)(Struct8BytesHomogeneousFloat a0)  f)

Definition at line 14684 of file ffi_test_functions_generated.cc.

14686 {
14688
14689 a0.a0 = -1.0;
14690 a0.a1 = 2.0;
14691
14692 std::cout << "Calling TestReturnUnion16BytesNestedFloat(" << "((" << a0.a0
14693 << ", " << a0.a1 << "))" << ")\n";
14694
14695 Union16BytesNestedFloat result = f(a0);
14696
14697 std::cout << "result = " << "((" << result.a0.a0 << ", " << result.a0.a1
14698 << "))" << "\n";
14699
14700 CHECK_APPROX(a0.a0, result.a0.a0);
14701 CHECK_APPROX(a0.a1, result.a0.a1);
14702
14703 // Pass argument that will make the Dart callback throw.
14704 a0.a0 = 42;
14705
14706 result = f(a0);
14707
14708 CHECK_APPROX(0.0, result.a0.a0);
14709 CHECK_APPROX(0.0, result.a0.a1);
14710
14711 // Pass argument that will make the Dart callback return null.
14712 a0.a0 = 84;
14713
14714 result = f(a0);
14715
14716 CHECK_APPROX(0.0, result.a0.a0);
14717 CHECK_APPROX(0.0, result.a0.a1);
14718
14719 return 0;
14720}

◆ TestReturnUnion4BytesMixed()

DART_EXPORT intptr_t dart::TestReturnUnion4BytesMixed ( Union4BytesMixed(*)(uint32_t a0)  f)

Definition at line 14570 of file ffi_test_functions_generated.cc.

14572 {
14573 uint32_t a0;
14574
14575 a0 = 1;
14576
14577 std::cout << "Calling TestReturnUnion4BytesMixed(" << "(" << a0 << ")"
14578 << ")\n";
14579
14580 Union4BytesMixed result = f(a0);
14581
14582 std::cout << "result = " << "(" << result.a0 << ")" << "\n";
14583
14584 CHECK_EQ(a0, result.a0);
14585
14586 // Pass argument that will make the Dart callback throw.
14587 a0 = 42;
14588
14589 result = f(a0);
14590
14591 CHECK_EQ(0, result.a0);
14592
14593 // Pass argument that will make the Dart callback return null.
14594 a0 = 84;
14595
14596 result = f(a0);
14597
14598 CHECK_EQ(0, result.a0);
14599
14600 return 0;
14601}

◆ TestReturnUnion8BytesNestedFloat()

DART_EXPORT intptr_t dart::TestReturnUnion8BytesNestedFloat ( Union8BytesNestedFloat(*)(double a0)  f)

Definition at line 14605 of file ffi_test_functions_generated.cc.

14607 {
14608 double a0;
14609
14610 a0 = -1.0;
14611
14612 std::cout << "Calling TestReturnUnion8BytesNestedFloat(" << "(" << a0 << ")"
14613 << ")\n";
14614
14616
14617 std::cout << "result = " << "(" << result.a0 << ")" << "\n";
14618
14619 CHECK_APPROX(a0, result.a0);
14620
14621 // Pass argument that will make the Dart callback throw.
14622 a0 = 42;
14623
14624 result = f(a0);
14625
14626 CHECK_APPROX(0.0, result.a0);
14627
14628 // Pass argument that will make the Dart callback return null.
14629 a0 = 84;
14630
14631 result = f(a0);
14632
14633 CHECK_APPROX(0.0, result.a0);
14634
14635 return 0;
14636}

◆ TestReturnUnion9BytesNestedInt()

DART_EXPORT intptr_t dart::TestReturnUnion9BytesNestedInt ( Union9BytesNestedInt(*)(Struct8BytesInt a0)  f)

Definition at line 14640 of file ffi_test_functions_generated.cc.

14642 {
14643 Struct8BytesInt a0 = {};
14644
14645 a0.a0 = -1;
14646 a0.a1 = 2;
14647 a0.a2 = -3;
14648
14649 std::cout << "Calling TestReturnUnion9BytesNestedInt(" << "((" << a0.a0
14650 << ", " << a0.a1 << ", " << a0.a2 << "))" << ")\n";
14651
14652 Union9BytesNestedInt result = f(a0);
14653
14654 std::cout << "result = " << "((" << result.a0.a0 << ", " << result.a0.a1
14655 << ", " << result.a0.a2 << "))" << "\n";
14656
14657 CHECK_EQ(a0.a0, result.a0.a0);
14658 CHECK_EQ(a0.a1, result.a0.a1);
14659 CHECK_EQ(a0.a2, result.a0.a2);
14660
14661 // Pass argument that will make the Dart callback throw.
14662 a0.a0 = 42;
14663
14664 result = f(a0);
14665
14666 CHECK_EQ(0, result.a0.a0);
14667 CHECK_EQ(0, result.a0.a1);
14668 CHECK_EQ(0, result.a0.a2);
14669
14670 // Pass argument that will make the Dart callback return null.
14671 a0.a0 = 84;
14672
14673 result = f(a0);
14674
14675 CHECK_EQ(0, result.a0.a0);
14676 CHECK_EQ(0, result.a0.a1);
14677 CHECK_EQ(0, result.a0.a2);
14678
14679 return 0;
14680}

◆ TestReturnVoid()

DART_EXPORT intptr_t dart::TestReturnVoid ( intptr_t(*)()  return_void)

Definition at line 1116 of file ffi_test_functions.cc.

1116 {
1117 CHECK_EQ(return_void(), 0);
1118 return 0;
1119}

◆ TestScriptJIT()

static void dart::TestScriptJIT ( const char *  script_chars,
intptr_t  expected_before,
intptr_t  expected_after 
)
static

Definition at line 66 of file bce_test.cc.

68 {
69 auto jit_result = ApplyBCE(script_chars, CompilerPass::kJIT);
70 EXPECT_EQ(expected_before, jit_result.first);
71 EXPECT_EQ(expected_after, jit_result.second);
72}
static std::pair< intptr_t, intptr_t > ApplyBCE(const char *script_chars, CompilerPass::PipelineMode mode)
Definition bce_test.cc:36

◆ TestSet() [1/2]

void dart::TestSet ( IntKeyHash  hash,
int  size 
)

Definition at line 81 of file hashmap_test.cc.

81 {
82 IntSet set(hash);
83 EXPECT_EQ(0u, set.occupancy());
84
85 set.Insert(1);
86 set.Insert(2);
87 set.Insert(3);
88 set.Insert(4);
89 EXPECT_EQ(4u, set.occupancy());
90
91 set.Insert(2);
92 set.Insert(3);
93 EXPECT_EQ(4u, set.occupancy());
94
95 EXPECT(set.Present(1));
96 EXPECT(set.Present(2));
97 EXPECT(set.Present(3));
98 EXPECT(set.Present(4));
99 EXPECT(!set.Present(5));
100 EXPECT_EQ(4u, set.occupancy());
101
102 set.Remove(1);
103 EXPECT(!set.Present(1));
104 EXPECT(set.Present(2));
105 EXPECT(set.Present(3));
106 EXPECT(set.Present(4));
107 EXPECT_EQ(3u, set.occupancy());
108
109 set.Remove(3);
110 EXPECT(!set.Present(1));
111 EXPECT(set.Present(2));
112 EXPECT(!set.Present(3));
113 EXPECT(set.Present(4));
114 EXPECT_EQ(2u, set.occupancy());
115
116 set.Remove(4);
117 EXPECT(!set.Present(1));
118 EXPECT(set.Present(2));
119 EXPECT(!set.Present(3));
120 EXPECT(!set.Present(4));
121 EXPECT_EQ(1u, set.occupancy());
122
123 set.Clear();
124 EXPECT_EQ(0u, set.occupancy());
125
126 // Insert a long series of values.
127 const uint32_t start = 453;
128 const uint32_t factor = 13;
129 const uint32_t offset = 7;
130 const uint32_t n = size;
131
132 uint32_t x = start;
133 for (uint32_t i = 0; i < n; i++) {
134 EXPECT_EQ(i, set.occupancy());
135 set.Insert(x);
136 x = x * factor + offset;
137 }
138 EXPECT_EQ(n, set.occupancy());
139
140 // Verify the same sequence of values.
141 x = start;
142 for (uint32_t i = 0; i < n; i++) {
143 EXPECT(set.Present(x));
144 x = x * factor + offset;
145 }
146 EXPECT_EQ(n, set.occupancy());
147
148 // Remove all these values.
149 x = start;
150 for (uint32_t i = 0; i < n; i++) {
151 EXPECT_EQ(n - i, set.occupancy());
152 EXPECT(set.Present(x));
153 set.Remove(x);
154 EXPECT(!set.Present(x));
155 x = x * factor + offset;
156
157 // Verify the expected values are still there.
158 int y = start;
159 for (uint32_t j = 0; j < n; j++) {
160 if (j <= i) {
161 EXPECT(!set.Present(y));
162 } else {
163 EXPECT(set.Present(y));
164 }
165 y = y * factor + offset;
166 }
167 }
168 EXPECT_EQ(0u, set.occupancy());
169}

◆ TestSet() [2/2]

template<typename Set >
void dart::TestSet ( intptr_t  initial_capacity,
bool  ordered 
)

Definition at line 192 of file hash_table_test.cc.

192 {
193 std::set<std::string> expected;
194 Set actual(HashTables::New<Set>(initial_capacity));
195 // Insert the following strings twice:
196 // aaa...aaa (length 26)
197 // bbb..bbb
198 // ...
199 // yy
200 // z
201 for (int i = 0; i < 2; ++i) {
202 for (char ch = 'a'; ch <= 'z'; ++ch) {
203 std::string key('z' - ch + 1, ch);
204 expected.insert(key);
205 bool present = actual.Insert(String::Handle(String::New(key.c_str())));
206 EXPECT_EQ((i != 0), present);
207 Validate(actual);
208 VerifyStringSetsEqual(expected, actual, ordered);
209 }
210 }
211 actual.Clear();
212 EXPECT_EQ(0, actual.NumOccupied());
213 actual.Release();
214}
void VerifyStringSetsEqual(const std::set< std::string > &expected, const Set &actual, bool ordered)

◆ TestSignExtendedBitField()

template<typename T >
static void dart::TestSignExtendedBitField ( )
static

Definition at line 27 of file bitfield_test.cc.

27 {
28 class F1 : public BitField<T, intptr_t, 0, 8, /*sign_extend=*/true> {};
29 class F2
30 : public BitField<T, uintptr_t, F1::kNextBit, 8, /*sign_extend=*/false> {
31 };
32 class F3
33 : public BitField<T, intptr_t, F2::kNextBit, 8, /*sign_extend=*/true> {};
34 class F4
35 : public BitField<T, uintptr_t, F3::kNextBit, 8, /*sign_extend=*/false> {
36 };
37
38 const uint32_t value =
39 F1::encode(-1) | F2::encode(1) | F3::encode(-2) | F4::encode(2);
40 EXPECT_EQ(0x02fe01ffU, value);
41 EXPECT_EQ(-1, F1::decode(value));
42 EXPECT_EQ(1U, F2::decode(value));
43 EXPECT_EQ(-2, F3::decode(value));
44 EXPECT_EQ(2U, F4::decode(value));
45}

◆ TestSimpleAddition()

DART_EXPORT intptr_t dart::TestSimpleAddition ( intptr_t(*)(int, int add)

Definition at line 899 of file ffi_test_functions.cc.

899 {
900 const intptr_t result = add(10, 20);
901 std::cout << "result " << result << "\n";
902 CHECK_EQ(result, 30);
903 return 0;
904}

◆ TestSimpleMultiply()

DART_EXPORT intptr_t dart::TestSimpleMultiply ( double(*)(double)  fn)

Definition at line 927 of file ffi_test_functions.cc.

927 {
928 CHECK_EQ(fn(2.0), 2.0 * 1.337);
929 return 0;
930}

◆ TestSimpleMultiplyFloat()

DART_EXPORT intptr_t dart::TestSimpleMultiplyFloat ( float(*)(float)  fn)

Definition at line 932 of file ffi_test_functions.cc.

932 {
933 CHECK(::std::abs(fn(2.0) - 2.0 * 1.337) < 0.001);
934 return 0;
935}

◆ TestSmiSub()

void dart::TestSmiSub ( Dart_NativeArguments  args)

Definition at line 22 of file native_entry_test.cc.

22 {
25 int64_t left_value = -1;
26 int64_t right_value = -1;
29
30 // Ignoring overflow in the calculation below.
31 int64_t result = left_value - right_value;
33}

◆ TestSmiSum()

void dart::TestSmiSum ( Dart_NativeArguments  args)

Definition at line 38 of file native_entry_test.cc.

38 {
39 int64_t result = 0;
40 int arg_count = Dart_GetNativeArgumentCount(args);
41 for (int i = 0; i < arg_count; i++) {
43 int64_t arg_value = -1;
44 EXPECT_VALID(Dart_IntegerToInt64(arg, &arg_value));
45
46 // Ignoring overflow in the addition below.
47 result += arg_value;
48 }
50}

◆ TestStartFunction()

MessageHandler::MessageStatus dart::TestStartFunction ( uword  data)

Definition at line 123 of file message_handler_test.cc.

123 {
124 return (reinterpret_cast<TestMessageHandler*>(data))->Start();
125}

◆ TestStaticFieldForwarding()

void dart::TestStaticFieldForwarding ( Thread thread,
const Class test_cls,
const Field field,
intptr_t  num_stores,
bool  expected_to_forward 
)

Definition at line 1424 of file il_test.cc.

1428 {
1429 EXPECT(num_stores <= 2);
1430
1432 CompilerState S(thread, /*is_aot=*/false, /*is_optimizing=*/true);
1434
1435 auto b1 = H.flow_graph()->graph_entry()->normal_entry();
1436
1437 const auto constant_42 = H.IntConstant(42);
1438 const auto constant_24 = H.IntConstant(24);
1440 DartReturnInstr* ret;
1441
1442 {
1443 BlockBuilder builder(H.flow_graph(), b1);
1444 // obj <- AllocateObject(TestClass)
1445 const auto obj = builder.AddDefinition(
1446 new AllocateObjectInstr(InstructionSource(), test_cls, DeoptId::kNone));
1447
1448 if (num_stores >= 1) {
1449 // StoreField(o.field = 42)
1450 builder.AddInstruction(new StoreFieldInstr(
1451 field, new Value(obj), new Value(constant_42),
1452 StoreBarrierType::kNoStoreBarrier, InstructionSource(),
1453 &H.flow_graph()->parsed_function(),
1454 StoreFieldInstr::Kind::kInitializing));
1455 }
1456
1457 if (num_stores >= 2) {
1458 // StoreField(o.field = 24)
1459 builder.AddInstruction(new StoreFieldInstr(
1460 field, new Value(obj), new Value(constant_24),
1461 StoreBarrierType::kNoStoreBarrier, InstructionSource(),
1462 &H.flow_graph()->parsed_function()));
1463 }
1464
1465 // load <- LoadField(view.field)
1466 load = builder.AddDefinition(new LoadFieldInstr(
1467 new Value(obj), Slot::Get(field, &H.flow_graph()->parsed_function()),
1468 InstructionSource()));
1469
1470 // Return(load)
1471 ret = builder.AddReturn(new Value(load));
1472 }
1473 H.FinishGraph();
1474 H.flow_graph()->Canonicalize();
1475
1476 if (expected_to_forward) {
1477 EXPECT_PROPERTY(ret->value()->definition(), &it == constant_42);
1478 } else {
1479 EXPECT_PROPERTY(ret->value()->definition(), &it == load);
1480 }
1481}

◆ TestStore()

DART_EXPORT intptr_t dart::TestStore ( int64_t *(*)(int64_t *a fn)

Definition at line 1095 of file ffi_test_functions.cc.

1095 {
1096 int64_t p[2] = {42, 1000};
1097 int64_t* result = fn(p);
1098 CHECK_EQ(*result, 1337);
1099 CHECK_EQ(p[1], 1337);
1100 CHECK_EQ(result, p + 1);
1101 return 0;
1102}

◆ TestString() [1/2]

void dart::TestString ( BaseTextBuffer f,
LoopInfo loop,
const GrowableArray< BlockEntryInstr * > &  preorder 
)

Definition at line 27 of file loops_test.cc.

29 {
30 for (; loop != nullptr; loop = loop->next()) {
31 intptr_t depth = loop->NestingDepth();
32 f->Printf("%*c[%" Pd "\n", static_cast<int>(2 * depth), ' ', loop->id());
33 for (BitVector::Iterator block_it(loop->blocks()); !block_it.Done();
34 block_it.Advance()) {
35 BlockEntryInstr* block = preorder[block_it.Current()];
36 if (block->IsJoinEntry()) {
37 for (PhiIterator it(block->AsJoinEntry()); !it.Done(); it.Advance()) {
38 InductionVar* induc = loop->LookupInduction(it.Current());
39 if (induc != nullptr) {
40 // Obtain the debug string for induction and bounds.
41 f->Printf("%*c%s", static_cast<int>(2 * depth), ' ',
42 induc->ToCString());
43 for (auto bound : induc->bounds()) {
44 f->Printf(" %s", bound.limit_->ToCString());
45 }
46 f->AddString("\n");
47 }
48 }
49 }
50 for (ForwardInstructionIterator it(block); !it.Done(); it.Advance()) {
51 InductionVar* induc =
52 loop->LookupInduction(it.Current()->AsDefinition());
53 if (InductionVar::IsInduction(induc)) {
54 f->Printf("%*c%s\n", static_cast<int>(2 * depth), ' ',
55 induc->ToCString());
56 }
57 }
58 }
59 TestString(f, loop->inner(), preorder);
60 f->Printf("%*c]\n", static_cast<int>(2 * depth), ' ');
61 }
62}
const char * ToCString() const
Definition loops.cc:973
InductionVar * LookupInduction(Definition *def) const
Definition loops.cc:1081
BitVector * blocks() const
Definition loops.h:253
LoopInfo * next() const
Definition loops.h:259
intptr_t id() const
Definition loops.h:251
intptr_t NestingDepth() const
Definition loops.cc:1062
LoopInfo * inner() const
Definition loops.h:258
bool Done() const
Definition il.h:2106

◆ TestString() [2/2]

static void dart::TestString ( const char *  cstr)
static

Definition at line 374 of file snapshot_test.cc.

374 {
375 Thread* thread = Thread::Current();
376 EXPECT(Utf8::IsValid(reinterpret_cast<const uint8_t*>(cstr), strlen(cstr)));
377 // Write snapshot with object content.
378 String& str = String::Handle(String::New(cstr));
379 std::unique_ptr<Message> message = WriteMessage(
380 /* same_group */ false, str, ILLEGAL_PORT, Message::kNormalPriority);
381
382 // Read object back from the snapshot.
383 String& serialized_str = String::Handle();
384 serialized_str ^= ReadMessage(thread, message.get());
385 EXPECT(str.Equals(serialized_str));
386
387 // Read object back from the snapshot into a C structure.
388 ApiNativeScope scope;
389 Dart_CObject* root = ReadApiMessage(scope.zone(), message.get());
390 EXPECT_EQ(Dart_CObject_kString, root->type);
391 EXPECT_STREQ(cstr, root->value.as_string);
392 CheckEncodeDecodeMessage(scope.zone(), root);
393}

◆ TestSumFloatsAndDoubles()

DART_EXPORT intptr_t dart::TestSumFloatsAndDoubles ( double(*)(float, double, float)  fn)

Definition at line 991 of file ffi_test_functions.cc.

993 {
994 CHECK_EQ(6.0, fn(1.0, 2.0, 3.0));
995 return 0;
996}

◆ TestSumVeryManyFloatsDoubles()

DART_EXPORT intptr_t dart::TestSumVeryManyFloatsDoubles ( double(*)(float, double, float, double, float, double, float, double, float, double, float, double, float, double, float, double, float, double, float, double, float, double, float, double, float, double, float, double, float, double, float, double, float, double, float, double, float, double, float, double)  fn)

Definition at line 1047 of file ffi_test_functions.cc.

1086 {
1087 CHECK_EQ(40 * 41 / 2,
1088 fn(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0,
1089 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0,
1090 24.0, 25.0, 26.0, 27.0, 28.0, 29.0, 30.0, 31.0, 32.0, 33.0, 34.0,
1091 35.0, 36.0, 37.0, 38.0, 39.0, 40.0));
1092 return 0;
1093}

◆ TestSumVeryManySmallInts()

DART_EXPORT intptr_t dart::TestSumVeryManySmallInts ( int16_t(*)(int8_t, int16_t, int8_t, int16_t, int8_t, int16_t, int8_t, int16_t, int8_t, int16_t, int8_t, int16_t, int8_t, int16_t, int8_t, int16_t, int8_t, int16_t, int8_t, int16_t, int8_t, int16_t, int8_t, int16_t, int8_t, int16_t, int8_t, int16_t, int8_t, int16_t, int8_t, int16_t, int8_t, int16_t, int8_t, int16_t, int8_t, int16_t, int8_t, int16_t)  fn)

Definition at line 999 of file ffi_test_functions.cc.

1038 {
1039 CHECK_EQ(40 * 41 / 2, fn(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
1040 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
1041 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40));
1042 return 0;
1043}

◆ TestTakeMaxUint8x10()

DART_EXPORT intptr_t dart::TestTakeMaxUint8x10 ( intptr_t(*)(uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t)  fn)

Definition at line 1136 of file ffi_test_functions.cc.

1145 {
1146 CHECK_EQ(1, fn(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF));
1147 // Check the argument values are properly truncated.
1148 uint64_t v = 0xabcFF;
1149 CHECK_EQ(1, fn(v, v, v, v, v, v, v, v, v, v));
1150 return 0;
1151}

◆ TestTestRangeCanonicalize()

static void dart::TestTestRangeCanonicalize ( const AbstractType type,
uword  lower,
uword  upper,
bool  result 
)
static

Definition at line 1381 of file il_test.cc.

1384 {
1386 CompilerState S(Thread::Current(), /*is_aot=*/true, /*is_optimizing=*/true);
1387 FlowGraphBuilderHelper H(/*num_parameters=*/1);
1388 H.AddVariable("v0", type);
1389
1390 auto normal_entry = H.flow_graph()->graph_entry()->normal_entry();
1391
1392 DartReturnInstr* ret;
1393 {
1394 BlockBuilder builder(H.flow_graph(), normal_entry);
1395 Definition* param = builder.AddParameter(0, kTagged);
1396 Definition* load_cid =
1397 builder.AddDefinition(new LoadClassIdInstr(new Value(param)));
1398 Definition* test_range = builder.AddDefinition(new TestRangeInstr(
1399 InstructionSource(), new Value(load_cid), lower, upper, kTagged));
1400 ret = builder.AddReturn(new Value(test_range));
1401 }
1402 H.FinishGraph();
1403 H.flow_graph()->Canonicalize();
1404
1405 EXPECT_PROPERTY(ret, it.value()->BindsToConstant());
1406 EXPECT_PROPERTY(ret,
1407 it.value()->BoundConstant().ptr() == Bool::Get(result).ptr());
1408}
static void test_range(skiatest::Reporter *reporter)

◆ TestThrowException()

DART_EXPORT intptr_t dart::TestThrowException ( intptr_t(*)()  fn)

Definition at line 1131 of file ffi_test_functions.cc.

1131 {
1132 CHECK_EQ(fn(), 42);
1133 return 0;
1134}

◆ TestThrowExceptionDouble()

DART_EXPORT intptr_t dart::TestThrowExceptionDouble ( double(*)()  fn)

Definition at line 1121 of file ffi_test_functions.cc.

1121 {
1122 CHECK_EQ(fn(), 42.0);
1123 return 0;
1124}

◆ TestThrowExceptionPointer()

DART_EXPORT intptr_t dart::TestThrowExceptionPointer ( void *(*)()  fn)

Definition at line 1126 of file ffi_test_functions.cc.

1126 {
1127 CHECK_EQ(fn(), nullptr);
1128 return 0;
1129}

◆ TestTypedDataDirectAccess()

static void dart::TestTypedDataDirectAccess ( )
static

Definition at line 2465 of file dart_api_impl_test.cc.

2465 {
2468 EXPECT_VALID(byte_array);
2470 result = Dart_TypedDataAcquireData(byte_array, nullptr, nullptr, nullptr);
2472 "Dart_TypedDataAcquireData expects argument 'type'"
2473 " to be non-null.");
2475 result = Dart_TypedDataAcquireData(byte_array, &type, nullptr, nullptr);
2477 "Dart_TypedDataAcquireData expects argument 'data'"
2478 " to be non-null.");
2479 void* data;
2480 result = Dart_TypedDataAcquireData(byte_array, &type, &data, nullptr);
2482 "Dart_TypedDataAcquireData expects argument 'len'"
2483 " to be non-null.");
2484 intptr_t len;
2485 result = Dart_TypedDataAcquireData(Dart_Null(), &type, &data, &len);
2487 "Dart_TypedDataAcquireData expects argument 'object'"
2488 " to be non-null.");
2489 result = Dart_TypedDataAcquireData(str, &type, &data, &len);
2491 "Dart_TypedDataAcquireData expects argument 'object'"
2492 " to be of type 'TypedData'.");
2493
2496 "Dart_TypedDataReleaseData expects argument 'object'"
2497 " to be non-null.");
2500 "Dart_TypedDataReleaseData expects argument 'object'"
2501 " to be of type 'TypedData'.");
2502}

◆ TestTypedDataDirectAccess1()

static void dart::TestTypedDataDirectAccess1 ( )
static

Definition at line 2587 of file dart_api_impl_test.cc.

2587 {
2588 const char* kScriptChars =
2589 "import 'dart:typed_data';\n"
2590 "class Expect {\n"
2591 " static equals(a, b) {\n"
2592 " if (a != b) {\n"
2593 " throw new Exception('not equal. expected: $a, got: $b');\n"
2594 " }\n"
2595 " }\n"
2596 "}\n"
2597 "void setMain(var a) {"
2598 " for (var i = 0; i < 10; i++) {"
2599 " a[i] = i;"
2600 " }"
2601 "}\n"
2602 "bool testMain(var list) {"
2603 " for (var i = 0; i < 10; i++) {"
2604 " Expect.equals((10 + i), list[i]);"
2605 " }\n"
2606 " return true;"
2607 "}\n"
2608 "List main() {"
2609 " var a = new Int8List(10);"
2610 " return a;"
2611 "}\n";
2612 // Create a test library and Load up a test script in it.
2613 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
2614
2615 Monitor monitor;
2616 bool done = false;
2617 Dart::thread_pool()->Run<BackgroundGCTask>(IsolateGroup::Current(), &monitor,
2618 &done);
2619
2620 for (intptr_t i = 0; i < 10; i++) {
2621 // Test with an regular typed data object.
2622 Dart_Handle list_access_test_obj;
2623 list_access_test_obj = Dart_Invoke(lib, NewString("main"), 0, nullptr);
2624 EXPECT_VALID(list_access_test_obj);
2625 TestDirectAccess(lib, list_access_test_obj, Dart_TypedData_kInt8, false);
2626
2627 // Test with an external typed data object.
2628 uint8_t data[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
2629 intptr_t data_length = ARRAY_SIZE(data);
2630 Dart_Handle ext_list_access_test_obj;
2631 ext_list_access_test_obj =
2633 EXPECT_VALID(ext_list_access_test_obj);
2634 TestDirectAccess(lib, ext_list_access_test_obj, Dart_TypedData_kUint8,
2635 true);
2636 }
2637
2638 {
2639 MonitorLocker ml(&monitor);
2640 while (!done) {
2641 ml.Wait();
2642 }
2643 }
2644}

◆ TestTypedDataViewDirectAccess()

static void dart::TestTypedDataViewDirectAccess ( )
static

Definition at line 2656 of file dart_api_impl_test.cc.

2656 {
2657 const char* kScriptChars =
2658 "import 'dart:typed_data';\n"
2659 "class Expect {\n"
2660 " static equals(a, b) {\n"
2661 " if (a != b) {\n"
2662 " throw 'not equal. expected: $a, got: $b';\n"
2663 " }\n"
2664 " }\n"
2665 "}\n"
2666 "void setMain(var list) {"
2667 " Expect.equals(10, list.length);"
2668 " for (var i = 0; i < 10; i++) {"
2669 " list[i] = i;"
2670 " }"
2671 "}\n"
2672 "bool testMain(var list) {"
2673 " Expect.equals(10, list.length);"
2674 " for (var i = 0; i < 10; i++) {"
2675 " Expect.equals((10 + i), list[i]);"
2676 " }"
2677 " return true;"
2678 "}\n"
2679 "List main() {"
2680 " var a = new Int8List(100);"
2681 " var view = new Int8List.view(a.buffer, 50, 10);"
2682 " return view;"
2683 "}\n";
2684 // Create a test library and Load up a test script in it.
2685 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
2686
2687 // Test with a typed data view object.
2688 Dart_Handle list_access_test_obj;
2689 list_access_test_obj = Dart_Invoke(lib, NewString("main"), 0, nullptr);
2690 EXPECT_VALID(list_access_test_obj);
2691 TestDirectAccess(lib, list_access_test_obj, Dart_TypedData_kInt8, false);
2692}

◆ TestUintComputation()

DART_EXPORT intptr_t dart::TestUintComputation ( uint64_t(*)(uint8_t, uint16_t, uint32_t, uint64_t)  fn)

Definition at line 920 of file ffi_test_functions.cc.

920 {
921 CHECK_EQ(0x7FFFFFFFFFFFFFFFLL, fn(0, 0, 0, 0x7FFFFFFFFFFFFFFFLL));
922 CHECK_EQ(0x8000000000000000LL, fn(0, 0, 0, 0x8000000000000000LL));
923 CHECK_EQ(-1, (int64_t)fn(0, 0, 0, -1));
924 return 0;
925}

◆ TestUnmodifiableTypedDataViewDirectAccess()

static void dart::TestUnmodifiableTypedDataViewDirectAccess ( )
static

Definition at line 2704 of file dart_api_impl_test.cc.

2704 {
2705 const char* kScriptChars =
2706 "import 'dart:typed_data';\n"
2707 "List main() {"
2708 " var list = new Int8List(100);"
2709 " for (var i = 0; i < 100; i++) {"
2710 " list[i] = i;"
2711 " }"
2712 " return new UnmodifiableInt8ListView(list);"
2713 "}\n";
2714 // Create a test library and Load up a test script in it.
2715 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
2716
2717 // Test with a typed data view object.
2718 Dart_Handle view_obj;
2719 view_obj = Dart_Invoke(lib, NewString("main"), 0, nullptr);
2720 EXPECT_VALID(view_obj);
2721
2722 const int kLength = 100;
2724 void* data;
2725 intptr_t len;
2726 Dart_Handle result = Dart_TypedDataAcquireData(view_obj, &type, &data, &len);
2727 EXPECT(!Thread::Current()->IsAtSafepoint());
2729 EXPECT_EQ(Dart_TypedData_kInt8, type);
2730 EXPECT_EQ(kLength, len);
2731 int8_t* dataP = reinterpret_cast<int8_t*>(data);
2732 for (int i = 0; i < kLength; i++) {
2733 EXPECT_EQ(i, dataP[i]);
2734 }
2735
2736 // Now try allocating a string with outstanding Acquires and it should
2737 // return an error.
2738 result = NewString("We expect an error here");
2739 EXPECT_ERROR(result, "Callbacks into the Dart VM are currently prohibited");
2740
2741 // Release direct access to the typed data object.
2742 EXPECT(!Thread::Current()->IsAtSafepoint());
2745}

◆ TestUnprotectCode()

DART_EXPORT void * dart::TestUnprotectCode ( void(*)(void *)  fn)

Definition at line 154 of file ffi_test_functions_vmspecific.cc.

154 {
156
157 {
158 std::unique_lock<std::mutex> lock(state->mutex); // locks the mutex
159 state->helper.reset(new std::thread(UnprotectCodeOtherThread,
160 Dart_CurrentIsolate(), &state->cvar,
161 &state->mutex));
162
163 state->cvar.wait(lock);
164 }
165
166 if (fn != nullptr) {
167 fn(state);
168 return nullptr;
169 } else {
170 return state;
171 }
172}

◆ TestVariadicAt11Doublex8FloatStruct12BytesHomogeneousF()

DART_EXPORT intptr_t dart::TestVariadicAt11Doublex8FloatStruct12BytesHomogeneousF ( double(*)(double a0, double a1, double a2, double a3, double a4, double a5, double a6, double a7, float a8, Struct12BytesHomogeneousFloat a9, int64_t a10,...)  f)

Definition at line 23700 of file ffi_test_functions_generated.cc.

23713 {
23714 double a0;
23715 double a1;
23716 double a2;
23717 double a3;
23718 double a4;
23719 double a5;
23720 double a6;
23721 double a7;
23722 float a8;
23724 int64_t a10;
23725 int32_t a11;
23726 Struct12BytesHomogeneousFloat a12 = {};
23727
23728 a0 = -1.0;
23729 a1 = 2.0;
23730 a2 = -3.0;
23731 a3 = 4.0;
23732 a4 = -5.0;
23733 a5 = 6.0;
23734 a6 = -7.0;
23735 a7 = 8.0;
23736 a8 = -9.0;
23737 a9.a0 = 10.0;
23738 a9.a1 = -11.0;
23739 a9.a2 = 12.0;
23740 a10 = -13;
23741 a11 = 14;
23742 a12.a0 = -15.0;
23743 a12.a1 = 16.0;
23744 a12.a2 = -17.0;
23745
23746 std::cout << "Calling TestVariadicAt11Doublex8FloatStruct12BytesHomogeneousF("
23747 << "(" << a0 << ", " << a1 << ", " << a2 << ", " << a3 << ", " << a4
23748 << ", " << a5 << ", " << a6 << ", " << a7 << ", " << a8 << ", ("
23749 << a9.a0 << ", " << a9.a1 << ", " << a9.a2 << "), " << a10 << ", "
23750 << a11 << ", (" << a12.a0 << ", " << a12.a1 << ", " << a12.a2
23751 << "))" << ")\n";
23752
23753 double result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12);
23754
23755 std::cout << "result = " << result << "\n";
23756
23757 CHECK_APPROX(-9.0, result);
23758
23759 // Pass argument that will make the Dart callback throw.
23760 a0 = 42;
23761
23762 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12);
23763
23764 CHECK_APPROX(0.0, result);
23765
23766 // Pass argument that will make the Dart callback return null.
23767 a0 = 84;
23768
23769 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12);
23770
23771 CHECK_APPROX(0.0, result);
23772
23773 return 0;
23774}

◆ TestVariadicAt1DoubleInt64Int32DoubleInt64Int32()

DART_EXPORT intptr_t dart::TestVariadicAt1DoubleInt64Int32DoubleInt64Int32 ( double(*)(double a0,...)  f)

Definition at line 23612 of file ffi_test_functions_generated.cc.

23614 {
23615 double a0;
23616 int64_t a1;
23617 int32_t a2;
23618 double a3;
23619 int64_t a4;
23620 int32_t a5;
23621
23622 a0 = -1.0;
23623 a1 = 2;
23624 a2 = -3;
23625 a3 = 4.0;
23626 a4 = -5;
23627 a5 = 6;
23628
23629 std::cout << "Calling TestVariadicAt1DoubleInt64Int32DoubleInt64Int32(" << "("
23630 << a0 << ", " << a1 << ", " << a2 << ", " << a3 << ", " << a4
23631 << ", " << a5 << ")" << ")\n";
23632
23633 double result = f(a0, a1, a2, a3, a4, a5);
23634
23635 std::cout << "result = " << result << "\n";
23636
23637 CHECK_APPROX(3.0, result);
23638
23639 // Pass argument that will make the Dart callback throw.
23640 a0 = 42;
23641
23642 result = f(a0, a1, a2, a3, a4, a5);
23643
23644 CHECK_APPROX(0.0, result);
23645
23646 // Pass argument that will make the Dart callback return null.
23647 a0 = 84;
23648
23649 result = f(a0, a1, a2, a3, a4, a5);
23650
23651 CHECK_APPROX(0.0, result);
23652
23653 return 0;
23654}

◆ TestVariadicAt1DoubleInt64Int32Struct20BytesHomogeneou()

DART_EXPORT intptr_t dart::TestVariadicAt1DoubleInt64Int32Struct20BytesHomogeneou ( double(*)(double a0,...)  f)

Definition at line 23778 of file ffi_test_functions_generated.cc.

23780 {
23781 double a0;
23782 int64_t a1;
23783 int32_t a2;
23785 double a4;
23786 int64_t a5;
23787 int32_t a6;
23788 Struct12BytesHomogeneousFloat a7 = {};
23789 int64_t a8;
23790
23791 a0 = -1.0;
23792 a1 = 2;
23793 a2 = -3;
23794 a3.a0 = 4;
23795 a3.a1 = -5;
23796 a3.a2 = 6;
23797 a3.a3 = -7;
23798 a3.a4 = 8;
23799 a4 = -9.0;
23800 a5 = 10;
23801 a6 = -11;
23802 a7.a0 = 12.0;
23803 a7.a1 = -13.0;
23804 a7.a2 = 14.0;
23805 a8 = -15;
23806
23807 std::cout << "Calling TestVariadicAt1DoubleInt64Int32Struct20BytesHomogeneou("
23808 << "(" << a0 << ", " << a1 << ", " << a2 << ", (" << a3.a0 << ", "
23809 << a3.a1 << ", " << a3.a2 << ", " << a3.a3 << ", " << a3.a4 << "), "
23810 << a4 << ", " << a5 << ", " << a6 << ", (" << a7.a0 << ", " << a7.a1
23811 << ", " << a7.a2 << "), " << a8 << ")" << ")\n";
23812
23813 double result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8);
23814
23815 std::cout << "result = " << result << "\n";
23816
23817 CHECK_APPROX(-8.0, result);
23818
23819 // Pass argument that will make the Dart callback throw.
23820 a0 = 42;
23821
23822 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8);
23823
23824 CHECK_APPROX(0.0, result);
23825
23826 // Pass argument that will make the Dart callback return null.
23827 a0 = 84;
23828
23829 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8);
23830
23831 CHECK_APPROX(0.0, result);
23832
23833 return 0;
23834}

◆ TestVariadicAt1DoubleStruct12BytesHomogeneousFloatDoub()

DART_EXPORT intptr_t dart::TestVariadicAt1DoubleStruct12BytesHomogeneousFloatDoub ( double(*)(double a0,...)  f)

Definition at line 23442 of file ffi_test_functions_generated.cc.

23444 {
23445 double a0;
23447 double a2;
23448
23449 a0 = -1.0;
23450 a1.a0 = 2.0;
23451 a1.a1 = -3.0;
23452 a1.a2 = 4.0;
23453 a2 = -5.0;
23454
23455 std::cout << "Calling TestVariadicAt1DoubleStruct12BytesHomogeneousFloatDoub("
23456 << "(" << a0 << ", (" << a1.a0 << ", " << a1.a1 << ", " << a1.a2
23457 << "), " << a2 << ")" << ")\n";
23458
23459 double result = f(a0, a1, a2);
23460
23461 std::cout << "result = " << result << "\n";
23462
23463 CHECK_APPROX(-3.0, result);
23464
23465 // Pass argument that will make the Dart callback throw.
23466 a0 = 42;
23467
23468 result = f(a0, a1, a2);
23469
23470 CHECK_APPROX(0.0, result);
23471
23472 // Pass argument that will make the Dart callback return null.
23473 a0 = 84;
23474
23475 result = f(a0, a1, a2);
23476
23477 CHECK_APPROX(0.0, result);
23478
23479 return 0;
23480}

◆ TestVariadicAt1DoubleStruct20BytesHomogeneousFloatDoub()

DART_EXPORT intptr_t dart::TestVariadicAt1DoubleStruct20BytesHomogeneousFloatDoub ( double(*)(double a0,...)  f)

Definition at line 23528 of file ffi_test_functions_generated.cc.

23530 {
23531 double a0;
23533 double a2;
23534
23535 a0 = -1.0;
23536 a1.a0 = 2.0;
23537 a1.a1 = -3.0;
23538 a1.a2 = 4.0;
23539 a1.a3 = -5.0;
23540 a1.a4 = 6.0;
23541 a2 = -7.0;
23542
23543 std::cout << "Calling TestVariadicAt1DoubleStruct20BytesHomogeneousFloatDoub("
23544 << "(" << a0 << ", (" << a1.a0 << ", " << a1.a1 << ", " << a1.a2
23545 << ", " << a1.a3 << ", " << a1.a4 << "), " << a2 << ")" << ")\n";
23546
23547 double result = f(a0, a1, a2);
23548
23549 std::cout << "result = " << result << "\n";
23550
23551 CHECK_APPROX(-4.0, result);
23552
23553 // Pass argument that will make the Dart callback throw.
23554 a0 = 42;
23555
23556 result = f(a0, a1, a2);
23557
23558 CHECK_APPROX(0.0, result);
23559
23560 // Pass argument that will make the Dart callback return null.
23561 a0 = 84;
23562
23563 result = f(a0, a1, a2);
23564
23565 CHECK_APPROX(0.0, result);
23566
23567 return 0;
23568}

◆ TestVariadicAt1Doublex2()

DART_EXPORT intptr_t dart::TestVariadicAt1Doublex2 ( double(*)(double a0,...)  f)

Definition at line 23070 of file ffi_test_functions_generated.cc.

23072 {
23073 double a0;
23074 double a1;
23075
23076 a0 = -1.0;
23077 a1 = 2.0;
23078
23079 std::cout << "Calling TestVariadicAt1Doublex2(" << "(" << a0 << ", " << a1
23080 << ")" << ")\n";
23081
23082 double result = f(a0, a1);
23083
23084 std::cout << "result = " << result << "\n";
23085
23086 CHECK_APPROX(1.0, result);
23087
23088 // Pass argument that will make the Dart callback throw.
23089 a0 = 42;
23090
23091 result = f(a0, a1);
23092
23093 CHECK_APPROX(0.0, result);
23094
23095 // Pass argument that will make the Dart callback return null.
23096 a0 = 84;
23097
23098 result = f(a0, a1);
23099
23100 CHECK_APPROX(0.0, result);
23101
23102 return 0;
23103}

◆ TestVariadicAt1Doublex20()

DART_EXPORT intptr_t dart::TestVariadicAt1Doublex20 ( double(*)(double a0,...)  f)

Definition at line 23273 of file ffi_test_functions_generated.cc.

23275 {
23276 double a0;
23277 double a1;
23278 double a2;
23279 double a3;
23280 double a4;
23281 double a5;
23282 double a6;
23283 double a7;
23284 double a8;
23285 double a9;
23286 double a10;
23287 double a11;
23288 double a12;
23289 double a13;
23290 double a14;
23291 double a15;
23292 double a16;
23293 double a17;
23294 double a18;
23295 double a19;
23296
23297 a0 = -1.0;
23298 a1 = 2.0;
23299 a2 = -3.0;
23300 a3 = 4.0;
23301 a4 = -5.0;
23302 a5 = 6.0;
23303 a6 = -7.0;
23304 a7 = 8.0;
23305 a8 = -9.0;
23306 a9 = 10.0;
23307 a10 = -11.0;
23308 a11 = 12.0;
23309 a12 = -13.0;
23310 a13 = 14.0;
23311 a14 = -15.0;
23312 a15 = 16.0;
23313 a16 = -17.0;
23314 a17 = 18.0;
23315 a18 = -19.0;
23316 a19 = 20.0;
23317
23318 std::cout << "Calling TestVariadicAt1Doublex20(" << "(" << a0 << ", " << a1
23319 << ", " << a2 << ", " << a3 << ", " << a4 << ", " << a5 << ", "
23320 << a6 << ", " << a7 << ", " << a8 << ", " << a9 << ", " << a10
23321 << ", " << a11 << ", " << a12 << ", " << a13 << ", " << a14 << ", "
23322 << a15 << ", " << a16 << ", " << a17 << ", " << a18 << ", " << a19
23323 << ")" << ")\n";
23324
23325 double result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13,
23326 a14, a15, a16, a17, a18, a19);
23327
23328 std::cout << "result = " << result << "\n";
23329
23330 CHECK_APPROX(10.0, result);
23331
23332 // Pass argument that will make the Dart callback throw.
23333 a0 = 42;
23334
23335 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14,
23336 a15, a16, a17, a18, a19);
23337
23338 CHECK_APPROX(0.0, result);
23339
23340 // Pass argument that will make the Dart callback return null.
23341 a0 = 84;
23342
23343 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14,
23344 a15, a16, a17, a18, a19);
23345
23346 CHECK_APPROX(0.0, result);
23347
23348 return 0;
23349}

◆ TestVariadicAt1Doublex2Struct32BytesHomogeneousDoubleD()

DART_EXPORT intptr_t dart::TestVariadicAt1Doublex2Struct32BytesHomogeneousDoubleD ( double(*)(double a0,...)  f)

Definition at line 23397 of file ffi_test_functions_generated.cc.

23399 {
23400 double a0;
23401 double a1;
23403 double a3;
23404
23405 a0 = -1.0;
23406 a1 = 2.0;
23407 a2.a0 = -3.0;
23408 a2.a1 = 4.0;
23409 a2.a2 = -5.0;
23410 a2.a3 = 6.0;
23411 a3 = -7.0;
23412
23413 std::cout << "Calling TestVariadicAt1Doublex2Struct32BytesHomogeneousDoubleD("
23414 << "(" << a0 << ", " << a1 << ", (" << a2.a0 << ", " << a2.a1
23415 << ", " << a2.a2 << ", " << a2.a3 << "), " << a3 << ")" << ")\n";
23416
23417 double result = f(a0, a1, a2, a3);
23418
23419 std::cout << "result = " << result << "\n";
23420
23421 CHECK_APPROX(-4.0, result);
23422
23423 // Pass argument that will make the Dart callback throw.
23424 a0 = 42;
23425
23426 result = f(a0, a1, a2, a3);
23427
23428 CHECK_APPROX(0.0, result);
23429
23430 // Pass argument that will make the Dart callback return null.
23431 a0 = 84;
23432
23433 result = f(a0, a1, a2, a3);
23434
23435 CHECK_APPROX(0.0, result);
23436
23437 return 0;
23438}

◆ TestVariadicAt1Doublex5()

DART_EXPORT intptr_t dart::TestVariadicAt1Doublex5 ( double(*)(double a0,...)  f)

Definition at line 23150 of file ffi_test_functions_generated.cc.

23152 {
23153 double a0;
23154 double a1;
23155 double a2;
23156 double a3;
23157 double a4;
23158
23159 a0 = -1.0;
23160 a1 = 2.0;
23161 a2 = -3.0;
23162 a3 = 4.0;
23163 a4 = -5.0;
23164
23165 std::cout << "Calling TestVariadicAt1Doublex5(" << "(" << a0 << ", " << a1
23166 << ", " << a2 << ", " << a3 << ", " << a4 << ")" << ")\n";
23167
23168 double result = f(a0, a1, a2, a3, a4);
23169
23170 std::cout << "result = " << result << "\n";
23171
23172 CHECK_APPROX(-3.0, result);
23173
23174 // Pass argument that will make the Dart callback throw.
23175 a0 = 42;
23176
23177 result = f(a0, a1, a2, a3, a4);
23178
23179 CHECK_APPROX(0.0, result);
23180
23181 // Pass argument that will make the Dart callback return null.
23182 a0 = 84;
23183
23184 result = f(a0, a1, a2, a3, a4);
23185
23186 CHECK_APPROX(0.0, result);
23187
23188 return 0;
23189}

◆ TestVariadicAt1Int32Struct20BytesHomogeneousInt32Int32()

DART_EXPORT intptr_t dart::TestVariadicAt1Int32Struct20BytesHomogeneousInt32Int32 ( int32_t(*)(int32_t a0,...)  f)

Definition at line 23484 of file ffi_test_functions_generated.cc.

23486 {
23487 int32_t a0;
23489 int32_t a2;
23490
23491 a0 = -1;
23492 a1.a0 = 2;
23493 a1.a1 = -3;
23494 a1.a2 = 4;
23495 a1.a3 = -5;
23496 a1.a4 = 6;
23497 a2 = -7;
23498
23499 std::cout << "Calling TestVariadicAt1Int32Struct20BytesHomogeneousInt32Int32("
23500 << "(" << a0 << ", (" << a1.a0 << ", " << a1.a1 << ", " << a1.a2
23501 << ", " << a1.a3 << ", " << a1.a4 << "), " << a2 << ")" << ")\n";
23502
23503 int32_t result = f(a0, a1, a2);
23504
23505 std::cout << "result = " << result << "\n";
23506
23507 CHECK_EQ(-4, result);
23508
23509 // Pass argument that will make the Dart callback throw.
23510 a0 = 42;
23511
23512 result = f(a0, a1, a2);
23513
23514 CHECK_EQ(0, result);
23515
23516 // Pass argument that will make the Dart callback return null.
23517 a0 = 84;
23518
23519 result = f(a0, a1, a2);
23520
23521 CHECK_EQ(0, result);
23522
23523 return 0;
23524}

◆ TestVariadicAt1Int64Int32Struct12BytesHomogeneousFloat()

DART_EXPORT intptr_t dart::TestVariadicAt1Int64Int32Struct12BytesHomogeneousFloat ( double(*)(int64_t a0,...)  f)

Definition at line 23658 of file ffi_test_functions_generated.cc.

23660 {
23661 int64_t a0;
23662 int32_t a1;
23664
23665 a0 = -1;
23666 a1 = 2;
23667 a2.a0 = -3.0;
23668 a2.a1 = 4.0;
23669 a2.a2 = -5.0;
23670
23671 std::cout << "Calling TestVariadicAt1Int64Int32Struct12BytesHomogeneousFloat("
23672 << "(" << a0 << ", " << a1 << ", (" << a2.a0 << ", " << a2.a1
23673 << ", " << a2.a2 << "))" << ")\n";
23674
23675 double result = f(a0, a1, a2);
23676
23677 std::cout << "result = " << result << "\n";
23678
23679 CHECK_APPROX(-3.0, result);
23680
23681 // Pass argument that will make the Dart callback throw.
23682 a0 = 42;
23683
23684 result = f(a0, a1, a2);
23685
23686 CHECK_APPROX(0.0, result);
23687
23688 // Pass argument that will make the Dart callback return null.
23689 a0 = 84;
23690
23691 result = f(a0, a1, a2);
23692
23693 CHECK_APPROX(0.0, result);
23694
23695 return 0;
23696}

◆ TestVariadicAt1Int64x2()

DART_EXPORT intptr_t dart::TestVariadicAt1Int64x2 ( int64_t(*)(int64_t a0,...)  f)

Definition at line 23033 of file ffi_test_functions_generated.cc.

23035 {
23036 int64_t a0;
23037 int64_t a1;
23038
23039 a0 = -1;
23040 a1 = 2;
23041
23042 std::cout << "Calling TestVariadicAt1Int64x2(" << "(" << a0 << ", " << a1
23043 << ")" << ")\n";
23044
23045 int64_t result = f(a0, a1);
23046
23047 std::cout << "result = " << result << "\n";
23048
23049 CHECK_EQ(1, result);
23050
23051 // Pass argument that will make the Dart callback throw.
23052 a0 = 42;
23053
23054 result = f(a0, a1);
23055
23056 CHECK_EQ(0, result);
23057
23058 // Pass argument that will make the Dart callback return null.
23059 a0 = 84;
23060
23061 result = f(a0, a1);
23062
23063 CHECK_EQ(0, result);
23064
23065 return 0;
23066}

◆ TestVariadicAt1Int64x20()

DART_EXPORT intptr_t dart::TestVariadicAt1Int64x20 ( int64_t(*)(int64_t a0,...)  f)

Definition at line 23193 of file ffi_test_functions_generated.cc.

23195 {
23196 int64_t a0;
23197 int64_t a1;
23198 int64_t a2;
23199 int64_t a3;
23200 int64_t a4;
23201 int64_t a5;
23202 int64_t a6;
23203 int64_t a7;
23204 int64_t a8;
23205 int64_t a9;
23206 int64_t a10;
23207 int64_t a11;
23208 int64_t a12;
23209 int64_t a13;
23210 int64_t a14;
23211 int64_t a15;
23212 int64_t a16;
23213 int64_t a17;
23214 int64_t a18;
23215 int64_t a19;
23216
23217 a0 = -1;
23218 a1 = 2;
23219 a2 = -3;
23220 a3 = 4;
23221 a4 = -5;
23222 a5 = 6;
23223 a6 = -7;
23224 a7 = 8;
23225 a8 = -9;
23226 a9 = 10;
23227 a10 = -11;
23228 a11 = 12;
23229 a12 = -13;
23230 a13 = 14;
23231 a14 = -15;
23232 a15 = 16;
23233 a16 = -17;
23234 a17 = 18;
23235 a18 = -19;
23236 a19 = 20;
23237
23238 std::cout << "Calling TestVariadicAt1Int64x20(" << "(" << a0 << ", " << a1
23239 << ", " << a2 << ", " << a3 << ", " << a4 << ", " << a5 << ", "
23240 << a6 << ", " << a7 << ", " << a8 << ", " << a9 << ", " << a10
23241 << ", " << a11 << ", " << a12 << ", " << a13 << ", " << a14 << ", "
23242 << a15 << ", " << a16 << ", " << a17 << ", " << a18 << ", " << a19
23243 << ")" << ")\n";
23244
23245 int64_t result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13,
23246 a14, a15, a16, a17, a18, a19);
23247
23248 std::cout << "result = " << result << "\n";
23249
23250 CHECK_EQ(10, result);
23251
23252 // Pass argument that will make the Dart callback throw.
23253 a0 = 42;
23254
23255 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14,
23256 a15, a16, a17, a18, a19);
23257
23258 CHECK_EQ(0, result);
23259
23260 // Pass argument that will make the Dart callback return null.
23261 a0 = 84;
23262
23263 result = f(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14,
23264 a15, a16, a17, a18, a19);
23265
23266 CHECK_EQ(0, result);
23267
23268 return 0;
23269}

◆ TestVariadicAt1Int64x2Struct8BytesIntInt64()

DART_EXPORT intptr_t dart::TestVariadicAt1Int64x2Struct8BytesIntInt64 ( int64_t(*)(int64_t a0,...)  f)

Definition at line 23353 of file ffi_test_functions_generated.cc.

23355 {
23356 int64_t a0;
23357 int64_t a1;
23358 Struct8BytesInt a2 = {};
23359 int64_t a3;
23360
23361 a0 = -1;
23362 a1 = 2;
23363 a2.a0 = -3;
23364 a2.a1 = 4;
23365 a2.a2 = -5;
23366 a3 = 6;
23367
23368 std::cout << "Calling TestVariadicAt1Int64x2Struct8BytesIntInt64(" << "("
23369 << a0 << ", " << a1 << ", (" << a2.a0 << ", " << a2.a1 << ", "
23370 << a2.a2 << "), " << a3 << ")" << ")\n";
23371
23372 int64_t result = f(a0, a1, a2, a3);
23373
23374 std::cout << "result = " << result << "\n";
23375
23376 CHECK_EQ(3, result);
23377
23378 // Pass argument that will make the Dart callback throw.
23379 a0 = 42;
23380
23381 result = f(a0, a1, a2, a3);
23382
23383 CHECK_EQ(0, result);
23384
23385 // Pass argument that will make the Dart callback return null.
23386 a0 = 84;
23387
23388 result = f(a0, a1, a2, a3);
23389
23390 CHECK_EQ(0, result);
23391
23392 return 0;
23393}

◆ TestVariadicAt1Int64x5()

DART_EXPORT intptr_t dart::TestVariadicAt1Int64x5 ( int64_t(*)(int64_t a0,...)  f)

Definition at line 23107 of file ffi_test_functions_generated.cc.

23109 {
23110 int64_t a0;
23111 int64_t a1;
23112 int64_t a2;
23113 int64_t a3;
23114 int64_t a4;
23115
23116 a0 = -1;
23117 a1 = 2;
23118 a2 = -3;
23119 a3 = 4;
23120 a4 = -5;
23121
23122 std::cout << "Calling TestVariadicAt1Int64x5(" << "(" << a0 << ", " << a1
23123 << ", " << a2 << ", " << a3 << ", " << a4 << ")" << ")\n";
23124
23125 int64_t result = f(a0, a1, a2, a3, a4);
23126
23127 std::cout << "result = " << result << "\n";
23128
23129 CHECK_EQ(-3, result);
23130
23131 // Pass argument that will make the Dart callback throw.
23132 a0 = 42;
23133
23134 result = f(a0, a1, a2, a3, a4);
23135
23136 CHECK_EQ(0, result);
23137
23138 // Pass argument that will make the Dart callback return null.
23139 a0 = 84;
23140
23141 result = f(a0, a1, a2, a3, a4);
23142
23143 CHECK_EQ(0, result);
23144
23145 return 0;
23146}

◆ TestVariadicAt1Int64x7Struct12BytesHomogeneousInt32()

DART_EXPORT intptr_t dart::TestVariadicAt1Int64x7Struct12BytesHomogeneousInt32 ( int64_t(*)(int64_t a0,...)  f)

Definition at line 23881 of file ffi_test_functions_generated.cc.

23883 {
23884 int64_t a0;
23885 int64_t a1;
23886 int64_t a2;
23887 int64_t a3;
23888 int64_t a4;
23889 int64_t a5;
23890 int64_t a6;
23892
23893 a0 = -1;
23894 a1 = 2;
23895 a2 = -3;
23896 a3 = 4;
23897 a4 = -5;
23898 a5 = 6;
23899 a6 = -7;
23900 a7.a0 = 8;
23901 a7.a1 = -9;
23902 a7.a2 = 10;
23903
23904 std::cout << "Calling TestVariadicAt1Int64x7Struct12BytesHomogeneousInt32("
23905 << "(" << a0 << ", " << a1 << ", " << a2 << ", " << a3 << ", " << a4
23906 << ", " << a5 << ", " << a6 << ", (" << a7.a0 << ", " << a7.a1
23907 << ", " << a7.a2 << "))" << ")\n";
23908
23909 int64_t result = f(a0, a1, a2, a3, a4, a5, a6, a7);
23910
23911 std::cout << "result = " << result << "\n";
23912
23913 CHECK_EQ(5, result);
23914
23915 // Pass argument that will make the Dart callback throw.
23916 a0 = 42;
23917
23918 result = f(a0, a1, a2, a3, a4, a5, a6, a7);
23919
23920 CHECK_EQ(0, result);
23921
23922 // Pass argument that will make the Dart callback return null.
23923 a0 = 84;
23924
23925 result = f(a0, a1, a2, a3, a4, a5, a6, a7);
23926
23927 CHECK_EQ(0, result);
23928
23929 return 0;
23930}

◆ TestVariadicAt1Struct12BytesHomogeneousInt32Int32x4()

DART_EXPORT intptr_t dart::TestVariadicAt1Struct12BytesHomogeneousInt32Int32x4 ( int32_t(*)(Struct12BytesHomogeneousInt32 a0,...)  f)

Definition at line 23934 of file ffi_test_functions_generated.cc.

23936 {
23938 int32_t a1;
23939 int32_t a2;
23940 int32_t a3;
23941 int32_t a4;
23942
23943 a0.a0 = -1;
23944 a0.a1 = 2;
23945 a0.a2 = -3;
23946 a1 = 4;
23947 a2 = -5;
23948 a3 = 6;
23949 a4 = -7;
23950
23951 std::cout << "Calling TestVariadicAt1Struct12BytesHomogeneousInt32Int32x4("
23952 << "((" << a0.a0 << ", " << a0.a1 << ", " << a0.a2 << "), " << a1
23953 << ", " << a2 << ", " << a3 << ", " << a4 << ")" << ")\n";
23954
23955 int32_t result = f(a0, a1, a2, a3, a4);
23956
23957 std::cout << "result = " << result << "\n";
23958
23959 CHECK_EQ(-4, result);
23960
23961 // Pass argument that will make the Dart callback throw.
23962 a0.a0 = 42;
23963
23964 result = f(a0, a1, a2, a3, a4);
23965
23966 CHECK_EQ(0, result);
23967
23968 // Pass argument that will make the Dart callback return null.
23969 a0.a0 = 84;
23970
23971 result = f(a0, a1, a2, a3, a4);
23972
23973 CHECK_EQ(0, result);
23974
23975 return 0;
23976}

◆ TestVariadicAt2Int32Int64IntPtr()

DART_EXPORT intptr_t dart::TestVariadicAt2Int32Int64IntPtr ( int32_t(*)(int32_t a0, int64_t a1,...)  f)

Definition at line 23573 of file ffi_test_functions_generated.cc.

23575 {
23576 int32_t a0;
23577 int64_t a1;
23578 intptr_t a2;
23579
23580 a0 = -1;
23581 a1 = 2;
23582 a2 = -3;
23583
23584 std::cout << "Calling TestVariadicAt2Int32Int64IntPtr(" << "(" << a0 << ", "
23585 << a1 << ", " << a2 << ")" << ")\n";
23586
23587 int32_t result = f(a0, a1, a2);
23588
23589 std::cout << "result = " << result << "\n";
23590
23591 CHECK_EQ(-2, result);
23592
23593 // Pass argument that will make the Dart callback throw.
23594 a0 = 42;
23595
23596 result = f(a0, a1, a2);
23597
23598 CHECK_EQ(0, result);
23599
23600 // Pass argument that will make the Dart callback return null.
23601 a0 = 84;
23602
23603 result = f(a0, a1, a2);
23604
23605 CHECK_EQ(0, result);
23606
23607 return 0;
23608}

◆ TestVariadicAt5Doublex5()

DART_EXPORT intptr_t dart::TestVariadicAt5Doublex5 ( double(*)(double a0, double a1, double a2, double a3, double a4,...)  f)

Definition at line 23838 of file ffi_test_functions_generated.cc.

23840 {
23841 double a0;
23842 double a1;
23843 double a2;
23844 double a3;
23845 double a4;
23846
23847 a0 = -1.0;
23848 a1 = 2.0;
23849 a2 = -3.0;
23850 a3 = 4.0;
23851 a4 = -5.0;
23852
23853 std::cout << "Calling TestVariadicAt5Doublex5(" << "(" << a0 << ", " << a1
23854 << ", " << a2 << ", " << a3 << ", " << a4 << ")" << ")\n";
23855
23856 double result = f(a0, a1, a2, a3, a4);
23857
23858 std::cout << "result = " << result << "\n";
23859
23860 CHECK_APPROX(-3.0, result);
23861
23862 // Pass argument that will make the Dart callback throw.
23863 a0 = 42;
23864
23865 result = f(a0, a1, a2, a3, a4);
23866
23867 CHECK_APPROX(0.0, result);
23868
23869 // Pass argument that will make the Dart callback return null.
23870 a0 = 84;
23871
23872 result = f(a0, a1, a2, a3, a4);
23873
23874 CHECK_APPROX(0.0, result);
23875
23876 return 0;
23877}

◆ TestWBEForArrays()

static void dart::TestWBEForArrays ( int  length)
static

Definition at line 122 of file write_barrier_elimination_test.cc.

129 {
130 kMoveGlob,
132 kMoveGlob,
133 kMatchAndMoveGoto,
134 kMoveGlob,
135 {kMatchAndMoveStoreField, &store},
136 }));
137
138 EXPECT(store->ShouldEmitStoreBarrier() == true);
139}
140
141static void TestWBEForArrays(int length) {
143 SetFlagScope<bool> sfs(&FLAG_trace_write_barrier_elimination, true));
144 const char* nullable_tag = TestCase::NullableTag();
145
146 // Test that array allocations are considered usable after a
147 // may-trigger-GC instruction (in this case CheckStackOverflow) iff they
148 // are small.
149 // clang-format off
150 auto kScript =
151 Utils::CStringUniquePtr(OS::SCreate(nullptr, R"(
152 class C {
153 %s C next;
154 }
155
156 @pragma("vm:never-inline")
157 fn() {}
158
159 foo(int x) {
160 C c = C();
161 C n = C();
162 List<C%s> array = List<C%s>.filled(%d, null);
163 array[0] = c;
164 while (x --> 0) {
165 c.next = n;
166 n = c;
167 c = C();
168 }
169 array[0] = c;
170 return array;
171 }
172
173 main() { foo(10); }
174 )", TestCase::LateTag(), nullable_tag, nullable_tag, length), std::free);
175 // clang-format on
176
177 // Generate a length dependent test library uri.
178 char lib_uri[256];
179 snprintf(lib_uri, sizeof(lib_uri), "%s%d", RESOLVED_USER_TEST_URI, length);
180
181 const auto& root_library = Library::Handle(
182 LoadTestScript(kScript.get(), /*resolver=*/nullptr, lib_uri));
183
184 Invoke(root_library, "main");
185
186 const auto& function = Function::Handle(GetFunction(root_library, "foo"));
187 TestPipeline pipeline(function, CompilerPass::kJIT);
188 FlowGraph* flow_graph = pipeline.RunPasses({});
189
190 auto entry = flow_graph->graph_entry()->normal_entry();
191 EXPECT(entry != nullptr);
192
193 StoreFieldInstr* store_into_c = nullptr;
194 StoreIndexedInstr* store_into_array_before_loop = nullptr;
195 StoreIndexedInstr* store_into_array_after_loop = nullptr;
196
197 ILMatcher cursor(flow_graph, entry);
198 RELEASE_ASSERT(cursor.TryMatch({
199 kMoveGlob,
200 {kMatchAndMoveStoreIndexed, &store_into_array_before_loop},

◆ THREAD_POOL_UNIT_TEST_CASE() [1/6]

dart::THREAD_POOL_UNIT_TEST_CASE ( ThreadPool_Create  )

Definition at line 31 of file thread_pool_test.cc.

31 {
32 ThreadPool thread_pool;
33}

◆ THREAD_POOL_UNIT_TEST_CASE() [2/6]

dart::THREAD_POOL_UNIT_TEST_CASE ( ThreadPool_RecursiveSpawn  )

Definition at line 243 of file thread_pool_test.cc.

243 {
244 ThreadPool thread_pool;
245 Monitor sync;
246 const int kTotalTasks = 500;
247 int done = 0;
248 thread_pool.Run<SpawnTask>(&thread_pool, &sync, kTotalTasks, kTotalTasks,
249 &done);
250 {
251 MonitorLocker ml(&sync);
252 while (done < kTotalTasks) {
253 ml.Wait();
254 }
255 }
256 EXPECT_EQ(kTotalTasks, done);
257}
bool Run(Args &&... args)
Definition thread_pool.h:45

◆ THREAD_POOL_UNIT_TEST_CASE() [3/6]

dart::THREAD_POOL_UNIT_TEST_CASE ( ThreadPool_RunMany  )

Definition at line 80 of file thread_pool_test.cc.

80 {
81 const int kTaskCount = 100;
82 ThreadPool thread_pool;
83 Monitor sync[kTaskCount];
84 bool done[kTaskCount];
85
86 for (int i = 0; i < kTaskCount; i++) {
87 done[i] = true;
88 thread_pool.Run<TestTask>(&sync[i], &done[i]);
89 }
90 for (int i = 0; i < kTaskCount; i++) {
91 MonitorLocker ml(&sync[i]);
92 done[i] = false;
93 ml.Notify();
94 while (!done[i]) {
95 ml.Wait();
96 }
97 EXPECT(done[i]);
98 }
99}

◆ THREAD_POOL_UNIT_TEST_CASE() [4/6]

dart::THREAD_POOL_UNIT_TEST_CASE ( ThreadPool_RunOne  )

Definition at line 60 of file thread_pool_test.cc.

60 {
61 ThreadPool thread_pool;
62 Monitor sync;
63 bool done = true;
64 thread_pool.Run<TestTask>(&sync, &done);
65 {
66 MonitorLocker ml(&sync);
67 done = false;
68 ml.Notify();
69 while (!done) {
70 ml.Wait();
71 }
72 }
73 EXPECT(done);
74
75 // Do a sanity test on the worker stats.
76 EXPECT_EQ(1U, thread_pool.workers_started());
77 EXPECT_EQ(0U, thread_pool.workers_stopped());
78}
uint64_t workers_started() const
Definition thread_pool.h:65
uint64_t workers_stopped() const
Definition thread_pool.h:67

◆ THREAD_POOL_UNIT_TEST_CASE() [5/6]

dart::THREAD_POOL_UNIT_TEST_CASE ( ThreadPool_WorkerShutdown  )

Definition at line 133 of file thread_pool_test.cc.

133 {
134 const int kTaskCount = 10;
135 Monitor sync;
136 int slept_count = 0;
137 int started_count = 0;
138
139 // Set up the ThreadPool so that workers notify before they exit.
140 ThreadPool* thread_pool = new ThreadPool();
141
142 // Run a single task.
143 for (int i = 0; i < kTaskCount; i++) {
144 thread_pool->Run<SleepTask>(&sync, &started_count, &slept_count, 2);
145 }
146
147 {
148 // Wait for everybody to start.
149 MonitorLocker ml(&sync);
150 while (started_count < kTaskCount) {
151 ml.Wait();
152 }
153 }
154
155 // Kill the thread pool while the workers are sleeping.
156 delete thread_pool;
157 thread_pool = nullptr;
158
159 int final_count = 0;
160 {
161 MonitorLocker ml(&sync);
162 final_count = slept_count;
163 }
164
165 // We should have waited for all the workers to finish, so they all should
166 // have had a chance to increment slept_count.
167 EXPECT_EQ(kTaskCount, final_count);
168}

◆ THREAD_POOL_UNIT_TEST_CASE() [6/6]

dart::THREAD_POOL_UNIT_TEST_CASE ( ThreadPool_WorkerTimeout  )

Definition at line 170 of file thread_pool_test.cc.

170 {
171 // Adjust the worker timeout so that we timeout quickly.
172 int saved_timeout = FLAG_worker_timeout_millis;
173 FLAG_worker_timeout_millis = 1;
174
175 {
176 ThreadPool thread_pool;
177 EXPECT_EQ(0U, thread_pool.workers_started());
178 EXPECT_EQ(0U, thread_pool.workers_stopped());
179
180 // Run a worker.
181 Monitor sync;
182 bool done = true;
183 thread_pool.Run<TestTask>(&sync, &done);
184 EXPECT_EQ(1U, thread_pool.workers_started());
185 EXPECT_EQ(0U, thread_pool.workers_stopped());
186 {
187 MonitorLocker ml(&sync);
188 done = false;
189 ml.Notify();
190 while (!done) {
191 ml.Wait();
192 }
193 }
194 EXPECT(done);
195
196 // Wait up to 5 seconds to see if a worker times out.
197 const int kMaxWait = 5000;
198 int waited = 0;
199 while (thread_pool.workers_stopped() == 0 && waited < kMaxWait) {
200 OS::Sleep(1);
201 waited += 1;
202 }
203 EXPECT_EQ(1U, thread_pool.workers_stopped());
204 }
205
206 FLAG_worker_timeout_millis = saved_timeout;
207}

◆ ThreadIteratorTestMain()

void dart::ThreadIteratorTestMain ( uword  parameter)

Definition at line 739 of file thread_test.cc.

739 {
741 reinterpret_cast<ThreadIteratorTestParams*>(parameter);
742 OSThread* thread = OSThread::Current();
743 EXPECT(thread != nullptr);
744
745 MonitorLocker ml(params->monitor);
746 params->spawned_thread_id = thread->id();
747 params->spawned_thread_join_id = OSThread::GetCurrentThreadJoinId(thread);
748 EXPECT(params->spawned_thread_id != OSThread::kInvalidThreadId);
749 EXPECT(OSThread::IsThreadInList(thread->id()));
750 ml.Notify();
751}

◆ ThreadPoolTest_BarrierSync()

DART_EXPORT void dart::ThreadPoolTest_BarrierSync ( Dart_Isolate(*)()  dart_current_isolate,
void(*)(Dart_Isolate dart_enter_isolate,
void(*)()  dart_exit_isolate,
intptr_t  num_threads 
)

Definition at line 890 of file ffi_test_functions_vmspecific.cc.

894 {
895 // Guaranteed to be initialized exactly once (no race between multiple
896 // threads).
897 static std::mutex mutex;
898 static std::condition_variable cvar;
899 static intptr_t thread_count = 0;
900
901 const Dart_Isolate isolate = dart_current_isolate();
902 dart_exit_isolate();
903 {
904 std::unique_lock<std::mutex> lock(mutex);
905 ++thread_count;
906 while (thread_count < num_threads) {
907 cvar.wait(lock);
908 }
909 cvar.notify_all();
910 }
911 dart_enter_isolate(isolate);
912}

◆ ThrowArgumentError()

static ObjectPtr dart::ThrowArgumentError ( const char *  exception_message)
static

Definition at line 3332 of file dart_api_impl.cc.

3332 {
3333 Thread* thread = Thread::Current();
3334 Zone* zone = thread->zone();
3335 // Lookup the class ArgumentError in dart:core.
3336 const String& lib_url = String::Handle(String::New("dart:core"));
3337 const String& class_name = String::Handle(String::New("ArgumentError"));
3338 const Library& lib =
3339 Library::Handle(zone, Library::LookupLibrary(thread, lib_url));
3340 if (lib.IsNull()) {
3341 const String& message = String::Handle(String::NewFormatted(
3342 "%s: library '%s' not found.", CURRENT_FUNC, lib_url.ToCString()));
3343 return ApiError::New(message);
3344 }
3345 const Class& cls =
3346 Class::Handle(zone, lib.LookupClassAllowPrivate(class_name));
3347 ASSERT(!cls.IsNull());
3348 Object& result = Object::Handle(zone);
3349 String& dot_name = String::Handle(String::New("."));
3350 String& constr_name = String::Handle(String::Concat(class_name, dot_name));
3351 result = ResolveConstructor(CURRENT_FUNC, cls, class_name, constr_name, 1);
3352 if (result.IsError()) return result.ptr();
3353 ASSERT(result.IsFunction());
3354 Function& constructor = Function::Handle(zone);
3355 constructor ^= result.ptr();
3356 if (!constructor.IsGenerativeConstructor()) {
3357 const String& message = String::Handle(
3358 String::NewFormatted("%s: class '%s' is not a constructor.",
3359 CURRENT_FUNC, class_name.ToCString()));
3360 return ApiError::New(message);
3361 }
3362 Instance& exception = Instance::Handle(zone);
3363 exception = Instance::New(cls);
3364 const Array& args = Array::Handle(zone, Array::New(2));
3365 args.SetAt(0, exception);
3366 args.SetAt(1, String::Handle(String::New(exception_message)));
3367 result = DartEntry::InvokeFunction(constructor, args);
3368 if (result.IsError()) return result.ptr();
3369 ASSERT(result.IsNull());
3370
3371 if (thread->top_exit_frame_info() == 0) {
3372 // There are no dart frames on the stack so it would be illegal to
3373 // throw an exception here.
3374 const String& message = String::Handle(
3375 String::New("No Dart frames on stack, cannot throw exception"));
3376 return ApiError::New(message);
3377 }
3378 // Unwind all the API scopes till the exit frame before throwing an
3379 // exception.
3380 const Instance* saved_exception;
3381 {
3382 NoSafepointScope no_safepoint;
3383 InstancePtr raw_exception = exception.ptr();
3384 thread->UnwindScopes(thread->top_exit_frame_info());
3385 saved_exception = &Instance::Handle(raw_exception);
3386 }
3387 Exceptions::Throw(thread, *saved_exception);
3388 const String& message =
3389 String::Handle(String::New("Exception was not thrown, internal error"));
3390 return ApiError::New(message);
3391}

◆ ThrowExceptionHelper()

static DART_NORETURN void dart::ThrowExceptionHelper ( Thread thread,
const Instance incoming_exception,
const Instance existing_stacktrace,
const bool  is_rethrow,
const bool  bypass_debugger 
)
static

Definition at line 731 of file exceptions.cc.

735 {
736 // SuspendLongJumpScope during Dart entry ensures that if a longjmp base is
737 // available, it is the innermost error handler. If one is available, so
738 // should jump there instead.
739 RELEASE_ASSERT(thread->long_jump_base() == nullptr);
740 Zone* zone = thread->zone();
741 auto object_store = thread->isolate_group()->object_store();
742 Isolate* isolate = thread->isolate();
743#if !defined(PRODUCT)
744 if (!bypass_debugger) {
745 // Do not notify debugger on stack overflow and out of memory exceptions.
746 // The VM would crash when the debugger calls back into the VM to
747 // get values of variables.
748 if (incoming_exception.ptr() != object_store->out_of_memory() &&
749 incoming_exception.ptr() != object_store->stack_overflow()) {
750 isolate->debugger()->PauseException(incoming_exception);
751 }
752 }
753#endif
754 bool use_preallocated_stacktrace = false;
755 Instance& exception = Instance::Handle(zone, incoming_exception.ptr());
756 if (exception.IsNull()) {
757 const Array& args = Array::Handle(zone, Array::New(4));
758 const Smi& line_col = Smi::Handle(zone, Smi::New(-1));
759 args.SetAt(0, Symbols::OptimizedOut());
760 args.SetAt(1, line_col);
761 args.SetAt(2, line_col);
762 args.SetAt(3, String::Handle(String::New("Throw of null.")));
763 exception ^= Exceptions::Create(Exceptions::kType, args);
764 } else if (existing_stacktrace.IsNull() &&
765 (exception.ptr() == object_store->out_of_memory() ||
766 exception.ptr() == object_store->stack_overflow())) {
767 use_preallocated_stacktrace = true;
768 }
769 // Find the exception handler and determine if the handler needs a
770 // stacktrace.
771 ExceptionHandlerFinder finder(thread);
772 bool handler_exists = finder.Find();
773 uword handler_pc = finder.handler_pc;
774 uword handler_sp = finder.handler_sp;
775 uword handler_fp = finder.handler_fp;
776 bool handler_needs_stacktrace = finder.needs_stacktrace;
777 Instance& stacktrace = Instance::Handle(zone);
778 if (use_preallocated_stacktrace) {
779 if (handler_pc == 0) {
780 // No Dart frame.
781 ASSERT(incoming_exception.ptr() == object_store->out_of_memory());
782 const UnhandledException& error = UnhandledException::Handle(
783 zone,
784 isolate->isolate_object_store()->preallocated_unhandled_exception());
785 thread->long_jump_base()->Jump(1, error);
786 UNREACHABLE();
787 }
788 stacktrace = isolate->isolate_object_store()->preallocated_stack_trace();
789 PreallocatedStackTraceBuilder frame_builder(stacktrace);
790 ASSERT(existing_stacktrace.IsNull() ||
791 (existing_stacktrace.ptr() == stacktrace.ptr()));
792 ASSERT(existing_stacktrace.IsNull() || is_rethrow);
793 if (handler_needs_stacktrace && existing_stacktrace.IsNull()) {
794 BuildStackTrace(&frame_builder);
795 }
796 } else {
797 if (!existing_stacktrace.IsNull()) {
798 stacktrace = existing_stacktrace.ptr();
799 // If this is not a rethrow, it's a "throw with stacktrace".
800 // Set an Error object's stackTrace field if needed.
801 if (!is_rethrow) {
802 const Field& stacktrace_field =
803 Field::Handle(zone, LookupStackTraceField(exception));
804 if (!stacktrace_field.IsNull() &&
805 (exception.GetField(stacktrace_field) == Object::null())) {
806 exception.SetField(stacktrace_field, stacktrace);
807 }
808 }
809 } else {
810 // Get stacktrace field of class Error to determine whether we have a
811 // subclass of Error which carries around its stack trace.
812 const Field& stacktrace_field =
813 Field::Handle(zone, LookupStackTraceField(exception));
814 if (!stacktrace_field.IsNull() || handler_needs_stacktrace) {
815 // Collect the stacktrace if needed.
816 ASSERT(existing_stacktrace.IsNull());
817 stacktrace = Exceptions::CurrentStackTrace();
818 // If we have an Error object, then set its stackTrace field only if it
819 // not yet initialized.
820 if (!stacktrace_field.IsNull() &&
821 (exception.GetField(stacktrace_field) == Object::null())) {
822 exception.SetField(stacktrace_field, stacktrace);
823 }
824 }
825 }
826 }
827 // We expect to find a handler_pc, if the exception is unhandled
828 // then we expect to at least have the dart entry frame on the
829 // stack as Exceptions::Throw should happen only after a dart
830 // invocation has been done.
831 ASSERT(handler_pc != 0);
832
833 if (FLAG_print_stacktrace_at_throw) {
834 THR_Print("Exception '%s' thrown:\n", exception.ToCString());
835 THR_Print("%s\n", stacktrace.ToCString());
836 }
837 if (handler_exists) {
838 finder.PrepareFrameForCatchEntry();
839 // Found a dart handler for the exception, jump to it.
840 JumpToExceptionHandler(thread, handler_pc, handler_sp, handler_fp,
841 exception, stacktrace);
842 } else {
843 // No dart exception handler found in this invocation sequence,
844 // so we create an unhandled exception object and return to the
845 // invocation stub so that it returns this unhandled exception
846 // object. The C++ code which invoked this dart sequence can check
847 // and do the appropriate thing (rethrow the exception to the
848 // dart invocation sequence above it, print diagnostics and terminate
849 // the isolate etc.). This can happen in the compiler, which is not
850 // allowed to allocate in new space, so we pass the kOld argument.
851 const UnhandledException& unhandled_exception = UnhandledException::Handle(
852 zone, exception.ptr() == object_store->out_of_memory()
853 ? isolate->isolate_object_store()
854 ->preallocated_unhandled_exception()
855 : UnhandledException::New(exception, stacktrace, Heap::kOld));
856 stacktrace = StackTrace::null();
857 JumpToExceptionHandler(thread, handler_pc, handler_sp, handler_fp,
858 unhandled_exception, stacktrace);
859 }
860 UNREACHABLE();
861}
void PauseException(const Instance &exc)
Definition debugger.cc:1914
LongJumpScope * long_jump_base() const
static void BuildStackTrace(StackTraceBuilder *builder)
static FieldPtr LookupStackTraceField(const Instance &instance)
static void JumpToExceptionHandler(Thread *thread, uword program_counter, uword stack_pointer, uword frame_pointer, const Object &exception_object, const Object &stacktrace_object)

◆ ThrowFfiResolveError()

static void dart::ThrowFfiResolveError ( const String symbol,
const String asset,
char *  error 
)
static

Definition at line 461 of file ffi_dynamic_library.cc.

463 {
464 const String& error_message = String::Handle(String::NewFormatted(
465 "Couldn't resolve native function '%s' in '%s' : %s.\n",
466 symbol.ToCString(), asset.ToCString(), error));
467 free(error);
468 Exceptions::ThrowArgumentError(error_message);
469}

◆ ThrowIfError()

static void dart::ThrowIfError ( const Object result)
static

Definition at line 524 of file runtime_entry.cc.

524 {
525 if (!result.IsNull() && result.IsError()) {
526 Exceptions::PropagateError(Error::Cast(result));
527 }
528}

◆ ThrowIsolateSpawnException()

static void dart::ThrowIsolateSpawnException ( const String message)
static

Definition at line 553 of file isolate.cc.

553 {
554 const Array& args = Array::Handle(Array::New(1));
555 args.SetAt(0, message);
556 Exceptions::ThrowByType(Exceptions::kIsolateSpawn, args);
557}

◆ ThrowLanguageError()

static void dart::ThrowLanguageError ( const char *  message)
static

Definition at line 670 of file mirrors.cc.

670 {
671 const Error& error =
672 Error::Handle(LanguageError::New(String::Handle(String::New(message))));
673 Exceptions::PropagateError(error);
674}

◆ ThrowMaskRangeException()

static void dart::ThrowMaskRangeException ( int64_t  m)
static

Definition at line 14 of file simd128.cc.

14 {
15 if ((m < 0) || (m > 255)) {
16 Exceptions::ThrowRangeError("mask", Integer::Handle(Integer::New(m)), 0,
17 255);
18 }
19}

◆ ThrowNoSuchMethod() [1/2]

static void dart::ThrowNoSuchMethod ( const Instance receiver,
const String function_name,
const Array arguments,
const Array argument_names,
const InvocationMirror::Level  level,
const InvocationMirror::Kind  kind 
)
static

Definition at line 49 of file mirrors.cc.

54 {
55 const Smi& invocation_type =
56 Smi::Handle(Smi::New(InvocationMirror::EncodeType(level, kind)));
57
58 const Array& args = Array::Handle(Array::New(7));
59 args.SetAt(0, receiver);
60 args.SetAt(1, function_name);
61 args.SetAt(2, invocation_type);
62 args.SetAt(3, Object::smi_zero()); // Type arguments length.
63 args.SetAt(4, Object::null_type_arguments());
64 args.SetAt(5, arguments);
65 args.SetAt(6, argument_names);
66
67 const Library& libcore = Library::Handle(Library::CoreLibrary());
68 const Class& cls =
69 Class::Handle(libcore.LookupClass(Symbols::NoSuchMethodError()));
70 const auto& error = cls.EnsureIsFinalized(Thread::Current());
71 ASSERT(error == Error::null());
72 const Function& throwNew =
73 Function::Handle(cls.LookupFunctionAllowPrivate(Symbols::ThrowNew()));
74 const Object& result =
75 Object::Handle(DartEntry::InvokeFunction(throwNew, args));
76 ASSERT(result.IsError());
77 Exceptions::PropagateError(Error::Cast(result));
79}

◆ ThrowNoSuchMethod() [2/2]

static ObjectPtr dart::ThrowNoSuchMethod ( const Instance receiver,
const String function_name,
const Array arguments,
const Array argument_names,
const InvocationMirror::Level  level,
const InvocationMirror::Kind  kind 
)
static

Definition at line 4520 of file object.cc.

4525 {
4526 const Smi& invocation_type =
4527 Smi::Handle(Smi::New(InvocationMirror::EncodeType(level, kind)));
4528
4529 ASSERT(!receiver.IsNull() || level == InvocationMirror::Level::kTopLevel);
4530 ASSERT(level != InvocationMirror::Level::kTopLevel || receiver.IsString());
4531 const Array& args = Array::Handle(Array::New(7));
4532 args.SetAt(0, receiver);
4533 args.SetAt(1, function_name);
4534 args.SetAt(2, invocation_type);
4535 args.SetAt(3, Object::smi_zero()); // Type arguments length.
4536 args.SetAt(4, Object::null_type_arguments());
4537 args.SetAt(5, arguments);
4538 args.SetAt(6, argument_names);
4539
4540 const Library& libcore = Library::Handle(Library::CoreLibrary());
4541 const Class& cls =
4542 Class::Handle(libcore.LookupClass(Symbols::NoSuchMethodError()));
4543 ASSERT(!cls.IsNull());
4544 const auto& error = cls.EnsureIsFinalized(Thread::Current());
4545 ASSERT(error == Error::null());
4546 const Function& throwNew =
4547 Function::Handle(cls.LookupFunctionAllowPrivate(Symbols::ThrowNew()));
4548 return DartEntry::InvokeFunction(throwNew, args);
4549}

◆ ThrowOnReturnOfError()

DART_EXPORT Dart_Handle dart::ThrowOnReturnOfError ( Dart_Handle(*)()  callback)

Definition at line 1071 of file ffi_test_functions_vmspecific.cc.

1071 {
1073 const bool is_error = Dart_IsError(result);
1074 printf("ThrowOnReturnOfError is_error %s\n", is_error ? "true" : "false");
1075 return result;
1076}

◆ ThrowTypeError()

static ObjectPtr dart::ThrowTypeError ( const TokenPosition  token_pos,
const Instance src_value,
const AbstractType dst_type,
const String dst_name 
)
static

Definition at line 4551 of file object.cc.

4554 {
4555 const Array& args = Array::Handle(Array::New(4));
4556 const Smi& pos = Smi::Handle(Smi::New(token_pos.Serialize()));
4557 args.SetAt(0, pos);
4558 args.SetAt(1, src_value);
4559 args.SetAt(2, dst_type);
4560 args.SetAt(3, dst_name);
4561
4562 const Library& libcore = Library::Handle(Library::CoreLibrary());
4563 const Class& cls =
4564 Class::Handle(libcore.LookupClassAllowPrivate(Symbols::TypeError()));
4565 const auto& error = cls.EnsureIsFinalized(Thread::Current());
4566 ASSERT(error == Error::null());
4567 const Function& throwNew =
4568 Function::Handle(cls.LookupFunctionAllowPrivate(Symbols::ThrowNew()));
4569 return DartEntry::InvokeFunction(throwNew, args);
4570}

◆ Times1_337Double()

DART_EXPORT double dart::Times1_337Double ( double  a)

Definition at line 255 of file ffi_test_functions.cc.

255 {
256 std::cout << "Times1_337Double(" << a << ")\n";
257 const double retval = a * 1.337;
258 std::cout << "returning " << retval << "\n";
259 return retval;
260}

◆ Times1_337Float()

DART_EXPORT float dart::Times1_337Float ( float  a)

Definition at line 264 of file ffi_test_functions.cc.

264 {
265 std::cout << "Times1_337Float(" << a << ")\n";
266 const float retval = a * 1.337f;
267 std::cout << "returning " << retval << "\n";
268 return retval;
269}

◆ Times3()

DART_EXPORT intptr_t dart::Times3 ( intptr_t  a)

Definition at line 244 of file ffi_test_functions.cc.

244 {
245 std::cout << "Times3(" << a << ")\n";
246 const intptr_t retval = a * 3;
247 std::cout << "returning " << retval << "\n";
248 return retval;
249}

◆ ToContextIndex()

static intptr_t dart::ToContextIndex ( intptr_t  offset_in_bytes)
static

Definition at line 285 of file deferred_objects.cc.

285 {
286 intptr_t result = (offset_in_bytes - Context::variable_offset(0)) /
287 Context::kBytesPerElement;
288 ASSERT(result >= 0);
289 return result;
290}

◆ ToDouble()

static double dart::ToDouble ( const Object value)
static

Definition at line 1288 of file constant_propagator.cc.

1288 {
1289 return value.IsInteger() ? Integer::Cast(value).AsDoubleValue()
1290 : Double::Cast(value).value();
1291}

◆ ToInstructionEnd()

static intptr_t dart::ToInstructionEnd ( intptr_t  pos)
static

Definition at line 54 of file linearscan.cc.

54 {
55 return (pos | 1);
56}

◆ ToInstructionStart()

static intptr_t dart::ToInstructionStart ( intptr_t  pos)
static

Definition at line 50 of file linearscan.cc.

50 {
51 return (pos & ~1);
52}

◆ TopDartFrame()

static ActivationFrame * dart::TopDartFrame ( )
static

Definition at line 1779 of file debugger.cc.

1779 {
1780 StackFrameIterator iterator(ValidationPolicy::kDontValidateFrames,
1781 Thread::Current(),
1782 StackFrameIterator::kNoCrossThreadIteration);
1784 while (true) {
1785 frame = iterator.NextFrame();
1786 RELEASE_ASSERT(frame != nullptr);
1787 if (!frame->IsDartFrame()) {
1788 continue;
1789 }
1790 Code& code = Code::Handle(frame->LookupDartCode());
1791 ActivationFrame* activation = new ActivationFrame(
1792 frame->pc(), frame->fp(), frame->sp(), code, Object::null_array(), 0);
1793 return activation;
1794 }
1795}

◆ ToScaleFactor()

static ScaleFactor dart::ToScaleFactor ( intptr_t  index_scale,
bool  index_unboxed 
)
inlinestatic

Definition at line 95 of file constants.h.

96 {
97 RELEASE_ASSERT(index_scale >= 0);
98 const intptr_t shift = Utils::ShiftForPowerOfTwo(index_scale) -
99 (index_unboxed ? 0 : kSmiTagShift);
100 // index_scale < kSmiTagShift for boxed indexes must be handled by the caller,
101 // and ScaleFactor is currently only defined up to TIMES_16 == 4.
102 RELEASE_ASSERT(shift >= 0 && shift <= 4);
103 return static_cast<ScaleFactor>(shift);
104}

◆ ToStdString()

std::string dart::ToStdString ( const String str)

Definition at line 116 of file hash_table_test.cc.

116 {
117 EXPECT(str.IsOneByteString());
118 std::string result;
119 for (intptr_t i = 0; i < str.Length(); ++i) {
120 result += static_cast<char>(str.CharAt(i));
121 }
122 return result;
123}

◆ TracePolyInlining()

static void dart::TracePolyInlining ( const CallTargets targets,
intptr_t  idx,
intptr_t  total,
const char *  message 
)
static

Definition at line 2302 of file inliner.cc.

2305 {
2306 String& name =
2307 String::Handle(targets.TargetAt(idx)->target->QualifiedUserVisibleName());
2308 int percent = total == 0 ? 0 : (100 * targets.TargetAt(idx)->count) / total;
2309 THR_Print("%s cid %" Pd "-%" Pd ": %" Pd "/%" Pd " %d%% %s\n",
2310 name.ToCString(), targets[idx].cid_start, targets[idx].cid_end,
2311 targets.TargetAt(idx)->count, total, percent, message);
2312}
TargetInfo * TargetAt(int i) const
Definition il.h:790
StringPtr QualifiedUserVisibleName() const
Definition object.cc:11081
const Function * target
Definition il.h:721

◆ TraceStrongModeType() [1/2]

static void dart::TraceStrongModeType ( const Instruction instr,
CompileType compileType 
)
static

Definition at line 31 of file type_propagator.cc.

32 {
33 if (FLAG_trace_strong_mode_types) {
34 const AbstractType* type = compileType->ToAbstractType();
35 if ((type != nullptr) && !type->IsDynamicType()) {
37 }
38 }
39}
static void TraceStrongModeType(const Instruction *instr, const AbstractType &type)

◆ TraceStrongModeType() [2/2]

static void dart::TraceStrongModeType ( const Instruction instr,
const AbstractType type 
)
static

Definition at line 23 of file type_propagator.cc.

24 {
25 if (FLAG_trace_strong_mode_types) {
26 THR_Print("[Strong mode] Type of %s - %s\n", instr->ToCString(),
27 type.ToCString());
28 }
29}
const char * ToCString() const

◆ TransferableTypedDataFinalizer()

static void dart::TransferableTypedDataFinalizer ( void *  isolate_callback_data,
void *  peer 
)
static

Definition at line 25909 of file object.cc.

25910 {
25911 delete (reinterpret_cast<TransferableTypedDataPeer*>(peer));
25912}

◆ TransposeCoordinate()

DART_EXPORT Coord * dart::TransposeCoordinate ( Coord coord)

Definition at line 552 of file ffi_test_functions.cc.

552 {
553 std::cout << "TransposeCoordinate(" << coord << " {" << coord->x << ", "
554 << coord->y << ", " << coord->next << "})\n";
555 coord->x = coord->x + 10.0;
556 coord->y = coord->y + 10.0;
557 std::cout << "returning " << coord->next << "\n";
558 return coord->next;
559}
struct Coord * next
double y

◆ TriggerEchoEvent()

static void dart::TriggerEchoEvent ( Thread thread,
JSONStream js 
)
static

Definition at line 1777 of file service.cc.

1777 {
1778 if (Service::echo_stream.enabled()) {
1779 Service::SendEchoEvent(thread->isolate(), js->LookupParam("text"));
1780 }
1781 JSONObject jsobj(js);
1782 HandleCommonEcho(&jsobj, js);
1783}

◆ TriggerGC()

DART_EXPORT void dart::TriggerGC ( uint64_t  count)

Definition at line 90 of file ffi_test_functions_vmspecific.cc.

90 {
91 Dart_ExecuteInternalCommand("gc-now", nullptr);
92}

◆ TrivialTypeExactnessFor()

static StaticTypeExactnessState dart::TrivialTypeExactnessFor ( const Class cls)
static

Definition at line 12831 of file object.cc.

12831 {
12832 const intptr_t type_arguments_offset = cls.host_type_arguments_field_offset();
12833 ASSERT(type_arguments_offset != Class::kNoTypeArguments);
12834 if (StaticTypeExactnessState::CanRepresentAsTriviallyExact(
12835 type_arguments_offset / kCompressedWordSize)) {
12836 return StaticTypeExactnessState::TriviallyExact(type_arguments_offset /
12837 kCompressedWordSize);
12838 } else {
12839 return StaticTypeExactnessState::NotExact();
12840 }
12841}
intptr_t host_type_arguments_field_offset() const
Definition object.h:1377

◆ TrueHandle()

DART_EXPORT Dart_Handle dart::TrueHandle ( )

Definition at line 1078 of file ffi_test_functions_vmspecific.cc.

1078 {
1079 return Dart_True();
1080}

◆ TryAddTest()

static void dart::TryAddTest ( ZoneGrowableArray< intptr_t > *  results,
intptr_t  test_cid,
bool  result 
)
static

Definition at line 1370 of file call_specializer.cc.

1372 {
1373 if (!CidTestResultsContains(*results, test_cid)) {
1374 results->Add(test_cid);
1375 results->Add(static_cast<intptr_t>(result));
1376 }
1377}
static bool CidTestResultsContains(const ZoneGrowableArray< intptr_t > &results, intptr_t test_cid)

◆ TryCatchOptimizerTest()

static void dart::TryCatchOptimizerTest ( Thread thread,
const char *  script_chars,
std::initializer_list< const char * >  synchronized 
)
static

Definition at line 66 of file redundancy_elimination_test.cc.

69 {
70 // Load the script and exercise the code once.
71 const auto& root_library =
72 Library::Handle(LoadTestScript(script_chars, &NoopNativeLookup));
73 Invoke(root_library, "main");
74
75 // Build the flow graph.
76 std::initializer_list<CompilerPass::Id> passes = {
77 CompilerPass::kComputeSSA, CompilerPass::kTypePropagation,
78 CompilerPass::kApplyICData, CompilerPass::kSelectRepresentations,
79 CompilerPass::kTypePropagation, CompilerPass::kCanonicalize,
80 };
81 const auto& function = Function::Handle(GetFunction(root_library, "foo"));
82 TestPipeline pipeline(function, CompilerPass::kJIT);
83 FlowGraph* graph = pipeline.RunPasses(passes);
84
85 // Finally run TryCatchAnalyzer on the graph (in AOT mode).
86 OptimizeCatchEntryStates(graph, /*is_aot=*/true);
87
88 EXPECT_EQ(1, graph->graph_entry()->catch_entries().length());
89 auto scope = graph->parsed_function().scope();
90
91 GrowableArray<LocalVariable*> env;
92 FlattenScopeIntoEnvironment(graph, scope, &env);
93
94 for (intptr_t i = 0; i < env.length(); i++) {
95 bool found = false;
96 for (auto name : synchronized) {
97 if (env[i]->name().Equals(name)) {
98 found = true;
99 break;
100 }
101 }
102 if (!found) {
103 env[i] = nullptr;
104 }
105 }
106
107 CatchBlockEntryInstr* catch_entry = graph->graph_entry()->catch_entries()[0];
108
109 // We should only synchronize state for variables from the synchronized list.
110 for (auto defn : *catch_entry->initial_definitions()) {
111 if (ParameterInstr* param = defn->AsParameter()) {
112 if (param->location().IsRegister()) {
113 EXPECT(param->location().Equals(LocationExceptionLocation()) ||
114 param->location().Equals(LocationStackTraceLocation()));
115 continue;
116 }
117
118 EXPECT(0 <= param->env_index() && param->env_index() < env.length());
119 EXPECT(env[param->env_index()] != nullptr);
120 if (env[param->env_index()] == nullptr) {
121 OS::PrintErr("something is wrong with %s\n", param->ToCString());
122 }
123 }
124 }
125}
Location LocationExceptionLocation()
Definition locations.cc:484
Location LocationStackTraceLocation()
Definition locations.cc:488

◆ TrySwitchInstanceCall()

static void dart::TrySwitchInstanceCall ( Thread thread,
StackFrame caller_frame,
const Code caller_code,
const Function caller_function,
const ICData ic_data,
const Function target_function 
)
static

Definition at line 1634 of file runtime_entry.cc.

1639 {
1640 auto zone = thread->zone();
1641
1642 // Monomorphic/megamorphic calls only check the receiver CID.
1643 if (ic_data.NumArgsTested() != 1) return;
1644
1645 ASSERT(ic_data.rebind_rule() == ICData::kInstance);
1646
1647 // Monomorphic/megamorphic calls don't record exactness.
1648 if (ic_data.is_tracking_exactness()) return;
1649
1650#if !defined(PRODUCT)
1651 // Monomorphic/megamorphic do not check the isolate's stepping flag.
1652 if (thread->isolate()->has_attempted_stepping()) return;
1653#endif
1654
1655 // Monomorphic/megamorphic calls are only for unoptimized code.
1656 ASSERT(!caller_code.is_optimized());
1657
1658 // Code is detached from its function. This will prevent us from resetting
1659 // the switchable call later because resets are function based and because
1660 // the ic_data_array belongs to the function instead of the code. This should
1661 // only happen because of reload, but it sometimes happens with KBC mixed mode
1662 // probably through a race between foreground and background compilation.
1663 if (caller_function.unoptimized_code() != caller_code.ptr()) {
1664 return;
1665 }
1666#if !defined(PRODUCT)
1667 // Skip functions that contain breakpoints or when debugger is in single
1668 // stepping mode.
1669 if (thread->isolate_group()->debugger()->IsDebugging(thread,
1670 caller_function)) {
1671 return;
1672 }
1673#endif
1674
1675 const intptr_t num_checks = ic_data.NumberOfChecks();
1676
1677 // Monomorphic call.
1678 if (FLAG_unopt_monomorphic_calls && (num_checks == 1)) {
1679 // A call site in the monomorphic state does not load the arguments
1680 // descriptor, so do not allow transition to this state if the callee
1681 // needs it.
1682 if (target_function.PrologueNeedsArgumentsDescriptor()) {
1683 return;
1684 }
1685
1686 const Array& data = Array::Handle(zone, ic_data.entries());
1687 const Code& target = Code::Handle(zone, target_function.EnsureHasCode());
1688 CodePatcher::PatchInstanceCallAt(caller_frame->pc(), caller_code, data,
1689 target);
1690 if (FLAG_trace_ic) {
1691 OS::PrintErr("Instance call at %" Px
1692 " switching to monomorphic dispatch, %s\n",
1693 caller_frame->pc(), ic_data.ToCString());
1694 }
1695 return; // Success.
1696 }
1697
1698 // Megamorphic call.
1699 if (FLAG_unopt_megamorphic_calls &&
1700 (num_checks > FLAG_max_polymorphic_checks)) {
1701 const String& name = String::Handle(zone, ic_data.target_name());
1702 const Array& descriptor =
1703 Array::Handle(zone, ic_data.arguments_descriptor());
1704 const MegamorphicCache& cache = MegamorphicCache::Handle(
1705 zone, MegamorphicCacheTable::Lookup(thread, name, descriptor));
1706 ic_data.set_is_megamorphic(true);
1707 CodePatcher::PatchInstanceCallAt(caller_frame->pc(), caller_code, cache,
1708 StubCode::MegamorphicCall());
1709 if (FLAG_trace_ic) {
1710 OS::PrintErr("Instance call at %" Px
1711 " switching to megamorphic dispatch, %s\n",
1712 caller_frame->pc(), ic_data.ToCString());
1713 }
1714 return; // Success.
1715 }
1716}
bool PrologueNeedsArgumentsDescriptor() const
Definition object.cc:11488
bool IsDebugging(Thread *thread, const Function &function)
Definition debugger.cc:3465
ArrayPtr entries() const
Definition object.h:2763
RebindRule rebind_rule() const
Definition object.cc:16594
void set_is_megamorphic(bool value) const
Definition object.h:2535
GroupDebugger * debugger() const
Definition isolate.h:314
bool has_attempted_stepping() const
Definition isolate.h:1374

◆ TwoArgsSmiOpInlineCacheEntry()

static CodePtr dart::TwoArgsSmiOpInlineCacheEntry ( Token::Kind  kind)
static

Definition at line 5158 of file il.cc.

5158 {
5159 if (!FLAG_two_args_smi_icd) {
5160 return Code::null();
5161 }
5162 switch (kind) {
5163 case Token::kADD:
5164 return StubCode::SmiAddInlineCache().ptr();
5165 case Token::kLT:
5166 return StubCode::SmiLessInlineCache().ptr();
5167 case Token::kEQ:
5168 return StubCode::SmiEqualInlineCache().ptr();
5169 default:
5170 return Code::null();
5171 }
5172}

◆ TypeArgumentsForElementType()

static TypeArgumentsPtr dart::TypeArgumentsForElementType ( ObjectStore store,
Dart_CoreType_Id  element_type_id 
)
static

Definition at line 3054 of file dart_api_impl.cc.

3056 {
3057 switch (element_type_id) {
3059 return TypeArguments::null();
3060 case Dart_CoreType_Int:
3061 return store->type_argument_legacy_int();
3063 return store->type_argument_legacy_string();
3064 }
3065 UNREACHABLE();
3066 return TypeArguments::null();
3067}

◆ TypeArgumentsHashCacheTest()

static void dart::TypeArgumentsHashCacheTest ( Thread thread,
intptr_t  num_classes 
)
static

Definition at line 8016 of file object_test.cc.

8027 {
8028 TextBuffer buffer(MB);
8029 buffer.AddString("class D<T> {}\n");
8030 for (intptr_t i = 0; i < num_classes; i++) {
8031 buffer.Printf("class C%" Pd " { String toString() => 'C%" Pd "'; }\n", i,
8032 i);
8033 }
8034 buffer.AddString("main() {\n");
8035 for (intptr_t i = 0; i < num_classes; i++) {
8036 buffer.Printf(" C%" Pd "().toString();\n", i);
8037 }
8038 buffer.AddString("}\n");
8039
8040 Dart_Handle api_lib = TestCase::LoadTestScript(buffer.buffer(), nullptr);
8041 EXPECT_VALID(api_lib);
8042 Dart_Handle result = Dart_Invoke(api_lib, NewString("main"), 0, nullptr);
8044
8045 // D + C0...CN, where N = kNumClasses - 1
8046 EXPECT(IsolateGroup::Current()->class_table()->NumCids() > num_classes);
8047
8048 TransitionNativeToVM transition(thread);
8049 Zone* const zone = thread->zone();
8050
8051 const auto& root_lib =
8052 Library::CheckedHandle(zone, Api::UnwrapHandle(api_lib));
8053 EXPECT(!root_lib.IsNull());
8054
8055 const auto& class_d = Class::Handle(zone, GetClass(root_lib, "D"));
8056 ASSERT(!class_d.IsNull());
8057 const auto& decl_type_d = Type::Handle(zone, class_d.DeclarationType());
8058 const auto& decl_type_d_type_args =
8059 TypeArguments::Handle(zone, decl_type_d.arguments());
8060
8061 EXPECT(!decl_type_d_type_args.HasInstantiations());
8062
8063 auto& class_c = Class::Handle(zone);
8064 auto& decl_type_c = Type::Handle(zone);
8065 auto& instantiator_type_args = TypeArguments::Handle(zone);
8066 const auto& function_type_args = Object::null_type_arguments();
8067 auto& result_type_args = TypeArguments::Handle(zone);
8068 auto& result_type = AbstractType::Handle(zone);
8069 // Cache the first computed set of instantiator type arguments to check that
8070 // no entries from the cache have been lost when the cache grows.
8071 auto& first_instantiator_type_args = TypeArguments::Handle(zone);
8072 // Used for the cache hit in stub check.
8073 const auto& invoke_instantiate_tav =
8074 Code::Handle(zone, CreateInvokeInstantiateTypeArgumentsStub(thread));
8075 const auto& invoke_instantiate_tav_arguments =
8076 Array::Handle(zone, Array::New(3));
8077 const auto& invoke_instantiate_tav_args_descriptor =
8078 Array::Handle(zone, ArgumentsDescriptor::NewBoxed(0, 3));
8079 for (intptr_t i = 0; i < num_classes; ++i) {
8080 const bool updated_cache_is_linear =
8081 i < TypeArguments::Cache::kMaxLinearCacheEntries;
8082 auto const name = OS::SCreate(zone, "C%" Pd "", i);
8083 class_c = GetClass(root_lib, name);
8084 ASSERT(!class_c.IsNull());
8085 decl_type_c = class_c.DeclarationType();
8086 instantiator_type_args = TypeArguments::New(1);
8087 instantiator_type_args.SetTypeAt(0, decl_type_c);
8088 instantiator_type_args = instantiator_type_args.Canonicalize(thread);
8089
8090#if !defined(PRODUCT)
8091 // The first call to InstantiateAndCanonicalizeFrom shouldn't have a cache
8092 // hit since the instantiator type arguments should be unique for each
8093 // iteration, and after that we do a check that the InstantiateTypeArguments
8094 // stub finds the entry (unless the cache is hash-based on IA32).
8096#endif
8097
8098 // Check that the key does not currently exist in the cache.
8099 intptr_t old_capacity;
8100 {
8101 SafepointMutexLocker ml(
8103 TypeArguments::Cache cache(zone, decl_type_d_type_args);
8104 EXPECT_EQ(i, cache.NumOccupied());
8105 auto loc =
8106 cache.FindKeyOrUnused(instantiator_type_args, function_type_args);
8107 EXPECT(!loc.present);
8108 old_capacity = cache.NumEntries();
8109 }
8110
8111 decl_type_d_type_args.InstantiateAndCanonicalizeFrom(instantiator_type_args,
8112 function_type_args);
8113
8114 // Check that the key now does exist in the cache.
8115 TypeArguments::Cache::KeyLocation loc;
8116 bool storage_changed;
8117 {
8118 SafepointMutexLocker ml(
8120 TypeArguments::Cache cache(zone, decl_type_d_type_args);
8121 EXPECT_EQ(i + 1, cache.NumOccupied());
8122 // Double-check that we got the expected type of cache.
8123 EXPECT(updated_cache_is_linear ? cache.IsLinear() : cache.IsHash());
8124 loc = cache.FindKeyOrUnused(instantiator_type_args, function_type_args);
8125 EXPECT(loc.present);
8126 storage_changed = cache.NumEntries() != old_capacity;
8127 }
8128
8129#if defined(TARGET_ARCH_IA32)
8130 const bool stub_checks_hash_caches = false;
8131#else
8132 const bool stub_checks_hash_caches = true;
8133#endif
8134 // Now check that we get the expected result from calling the stub if it
8135 // checks the cache (e.g., in all cases but hash-based caches on IA32).
8136 if (updated_cache_is_linear || stub_checks_hash_caches) {
8137 invoke_instantiate_tav_arguments.SetAt(0, decl_type_d_type_args);
8138 invoke_instantiate_tav_arguments.SetAt(1, instantiator_type_args);
8139 invoke_instantiate_tav_arguments.SetAt(2, function_type_args);
8140 result_type_args ^= DartEntry::InvokeCode(
8141 invoke_instantiate_tav, invoke_instantiate_tav_args_descriptor,
8142 invoke_instantiate_tav_arguments, thread);
8143 EXPECT_EQ(1, result_type_args.Length());
8144 result_type = result_type_args.TypeAt(0);
8145 EXPECT_TYPES_SYNTACTICALLY_EQUIVALENT(decl_type_c, result_type);
8146 }
8147
8148#if !defined(PRODUCT)
8149 // Setting to false prior to re-calling InstantiateAndCanonicalizeFrom with
8150 // the same keys, as now we want a runtime check of an existing cache entry.
8152#endif
8153
8154 result_type_args = decl_type_d_type_args.InstantiateAndCanonicalizeFrom(
8155 instantiator_type_args, function_type_args);
8156 result_type = result_type_args.TypeAt(0);
8157 EXPECT_TYPES_SYNTACTICALLY_EQUIVALENT(decl_type_c, result_type);
8158
8159 // Check that no new entries were added to the cache.
8160 {
8161 SafepointMutexLocker ml(
8163 TypeArguments::Cache cache(zone, decl_type_d_type_args);
8164 EXPECT_EQ(i + 1, cache.NumOccupied());
8165 auto const loc2 =
8166 cache.FindKeyOrUnused(instantiator_type_args, function_type_args);
8167 EXPECT(loc2.present);
8168 EXPECT_EQ(loc.entry, loc2.entry);
8169 }
8170
8171 if (i == 0) {
8172 first_instantiator_type_args = instantiator_type_args.ptr();
8173 } else if (storage_changed) {
8174 // Check that the first instantiator TAV still exists in the new cache.
8175 SafepointMutexLocker ml(
Mutex * type_arguments_canonicalization_mutex()
Definition isolate.h:508
static CodePtr CreateInvokeInstantiateTypeArgumentsStub(Thread *thread)
bool TESTING_runtime_fail_on_existing_cache_entry
Definition object.cc:7675

◆ TypedDataCidForElementSize()

static classid_t dart::TypedDataCidForElementSize ( intptr_t  elem_size)
static

Definition at line 26 of file memory_copy_test.cc.

26 {
27 switch (elem_size) {
28 case 1:
29 return kTypedDataUint8ArrayCid;
30 case 2:
31 return kTypedDataUint16ArrayCid;
32 case 4:
33 return kTypedDataUint32ArrayCid;
34 case 8:
35 return kTypedDataUint64ArrayCid;
36 case 16:
37 return kTypedDataInt32x4ArrayCid;
38 default:
39 break;
40 }
42}

◆ TypeToHelper()

static Dart_Handle dart::TypeToHelper ( Dart_Handle  type,
Nullability  nullability 
)
static

Definition at line 5626 of file dart_api_impl.cc.

5626 {
5627 DARTSCOPE(Thread::Current());
5628 const Type& ty = Api::UnwrapTypeHandle(Z, type);
5629 if (ty.IsNull()) {
5631 }
5632 if (ty.nullability() == nullability) {
5633 return type;
5634 }
5635 return Api::NewHandle(T, ty.ToNullability(nullability, Heap::kOld));
5636}
TypePtr ToNullability(Nullability value, Heap::Space space) const
Definition object.cc:21971

◆ UintComputation()

DART_EXPORT int64_t dart::UintComputation ( uint8_t  a,
uint16_t  b,
uint32_t  c,
uint64_t  d 
)

Definition at line 231 of file ffi_test_functions.cc.

234 {
235 std::cout << "UintComputation(" << static_cast<int>(a) << ", " << b << ", "
236 << c << ", " << d << ")\n";
237 const uint64_t retval = d - c + b - a;
238 std::cout << "returning " << retval << "\n";
239 return retval;
240}

◆ UnanchoredAdvance()

RegExpNode * dart::UnanchoredAdvance ( RegExpCompiler compiler,
RegExpNode on_success 
)

Definition at line 4121 of file regexp.cc.

4122 {
4123 // This implements ES2015 21.2.5.2.3, AdvanceStringIndex.
4124 ASSERT(!compiler->read_backward());
4125 // Advance any character. If the character happens to be a lead surrogate and
4126 // we advanced into the middle of a surrogate pair, it will work out, as
4127 // nothing will match from there. We will have to advance again, consuming
4128 // the associated trail surrogate.
4129 auto range = CharacterRange::List(
4130 on_success->zone(), CharacterRange::Range(0, Utf16::kMaxCodeUnit));
4131 return TextNode::CreateForCharacterRanges(range, false, on_success,
4132 RegExpFlags());
4133}

◆ UnaryIntegerEvaluateRaw()

static IntegerPtr dart::UnaryIntegerEvaluateRaw ( const Integer value,
Token::Kind  token_kind,
Zone zone 
)
static

Definition at line 51 of file evaluator.cc.

53 {
54 switch (token_kind) {
55 case Token::kNEGATE:
56 return value.ArithmeticOp(Token::kMUL, Smi::Handle(zone, Smi::New(-1)),
57 Heap::kOld);
58 case Token::kBIT_NOT:
59 if (value.IsSmi()) {
60 return Integer::New(~Smi::Cast(value).Value(), Heap::kOld);
61 } else if (value.IsMint()) {
62 return Integer::New(~Mint::Cast(value).value(), Heap::kOld);
63 }
64 break;
65 default:
67 }
68 return Integer::null();
69}

◆ Unhandled_equals()

void FUNCTION_NAME() dart::Unhandled_equals ( Dart_NativeArguments  args)

Definition at line 15 of file exceptions_test.cc.

15 {
16 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args);
17 TransitionNativeToVM transition(arguments->thread());
18 Zone* zone = arguments->thread()->zone();
19 const Instance& expected =
20 Instance::CheckedHandle(zone, arguments->NativeArgAt(0));
21 const Instance& actual =
22 Instance::CheckedHandle(zone, arguments->NativeArgAt(1));
23 if (!expected.CanonicalizeEquals(actual)) {
24 OS::PrintErr("expected: '%s' actual: '%s'\n", expected.ToCString(),
25 actual.ToCString());
26 FATAL("Unhandled_equals fails.\n");
27 }
28}
virtual bool CanonicalizeEquals(const Instance &other) const
Definition object.cc:20300

◆ Unhandled_invoke()

void FUNCTION_NAME() dart::Unhandled_invoke ( Dart_NativeArguments  args)

Definition at line 30 of file exceptions_test.cc.

30 {
31 // Invoke the specified entry point.
32 Dart_Handle cls = Dart_GetClass(TestCase::lib(), NewString("Second"));
33 Dart_Handle result = Dart_Invoke(cls, NewString("method2"), 0, nullptr);
36 return;
37}

◆ Unhandled_invoke2()

void FUNCTION_NAME() dart::Unhandled_invoke2 ( Dart_NativeArguments  args)

Definition at line 39 of file exceptions_test.cc.

39 {
40 // Invoke the specified entry point.
41 Dart_Handle cls = Dart_GetClass(TestCase::lib(), NewString("Second"));
42 Dart_Handle result = Dart_Invoke(cls, NewString("method2"), 0, nullptr);
46 ASSERT(!Dart_IsError(exception));
47 Dart_ThrowException(exception);
49 return;
50}

◆ Union()

static void dart::Union ( GrowableArray< Chain * > *  chains,
Chain source_chain,
Chain target_chain 
)
static

Definition at line 136 of file block_scheduler.cc.

138 {
139 if (source_chain->length < target_chain->length) {
140 for (Link* link = source_chain->first; link != nullptr; link = link->next) {
141 (*chains)[link->block->postorder_number()] = target_chain;
142 }
143 // Link the chains.
144 source_chain->last->next = target_chain->first;
145 // Update the state of the longer chain.
146 target_chain->first = source_chain->first;
147 target_chain->length += source_chain->length;
148 } else {
149 for (Link* link = target_chain->first; link != nullptr; link = link->next) {
150 (*chains)[link->block->postorder_number()] = source_chain;
151 }
152 source_chain->last->next = target_chain->first;
153 source_chain->last = target_chain->last;
154 source_chain->length += target_chain->length;
155 }
156}
link(from_root, to_root)
Definition dart_pkg.py:44

◆ UNIT_TEST_CASE() [1/19]

dart::UNIT_TEST_CASE ( DartAPI_DartInitializeAfterCleanup  )

Definition at line 31 of file dart_api_impl_test.cc.

31 {
32 EXPECT(Dart_SetVMFlags(TesterState::argc, TesterState::argv) == nullptr);
34 memset(&params, 0, sizeof(Dart_InitializeParams));
36 params.vm_snapshot_data = TesterState::vm_snapshot_data;
37 params.create_group = TesterState::create_callback;
38 params.shutdown_isolate = TesterState::shutdown_callback;
39 params.cleanup_group = TesterState::group_cleanup_callback;
40 params.start_kernel_isolate = true;
41
42 // Reinitialize and ensure we can execute Dart code.
43 EXPECT(Dart_Initialize(&params) == nullptr);
44 {
45 TestIsolateScope scope;
46 const char* kScriptChars =
47 "int testMain() {\n"
48 " return 42;\n"
49 "}\n";
50 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
51 EXPECT_VALID(lib);
52 Dart_Handle result = Dart_Invoke(lib, NewString("testMain"), 0, nullptr);
54 int64_t value = 0;
56 EXPECT_EQ(42, value);
57 }
58 EXPECT(Dart_Cleanup() == nullptr);
59}
DART_EXPORT DART_WARN_UNUSED_RESULT char * Dart_Initialize(Dart_InitializeParams *params)
DART_EXPORT DART_WARN_UNUSED_RESULT char * Dart_Cleanup(void)
DART_EXPORT DART_WARN_UNUSED_RESULT char * Dart_SetVMFlags(int argc, const char **argv)

◆ UNIT_TEST_CASE() [2/19]

dart::UNIT_TEST_CASE ( DartAPI_DartInitializeCallsCodeObserver  )

Definition at line 61 of file dart_api_impl_test.cc.

61 {
62 EXPECT(Dart_SetVMFlags(TesterState::argc, TesterState::argv) == nullptr);
64 memset(&params, 0, sizeof(Dart_InitializeParams));
66 params.vm_snapshot_data = TesterState::vm_snapshot_data;
67 params.create_group = TesterState::create_callback;
68 params.shutdown_isolate = TesterState::shutdown_callback;
69 params.cleanup_group = TesterState::group_cleanup_callback;
70 params.start_kernel_isolate = true;
71
72 bool was_called = false;
73 Dart_CodeObserver code_observer;
74 code_observer.data = &was_called;
75 code_observer.on_new_code = [](Dart_CodeObserver* observer, const char* name,
76 uintptr_t base, uintptr_t size) {
77 *static_cast<bool*>(observer->data) = true;
78 };
79 params.code_observer = &code_observer;
80
81 // Reinitialize and ensure we can execute Dart code.
82 EXPECT(Dart_Initialize(&params) == nullptr);
83
84 // Wait for 5 seconds to let the kernel service load the snapshot,
85 // which should trigger calls to the code observer.
86 OS::Sleep(5);
87
88 EXPECT(was_called);
89 EXPECT(Dart_Cleanup() == nullptr);
90}
Dart_OnNewCodeCallback on_new_code
Definition dart_api.h:862

◆ UNIT_TEST_CASE() [3/19]

dart::UNIT_TEST_CASE ( DartAPI_DartInitializeHeapSizes  )

Definition at line 92 of file dart_api_impl_test.cc.

92 {
94 memset(&params, 0, sizeof(Dart_InitializeParams));
96 params.vm_snapshot_data = TesterState::vm_snapshot_data;
97 params.create_group = TesterState::create_callback;
98 params.shutdown_isolate = TesterState::shutdown_callback;
99 params.cleanup_group = TesterState::group_cleanup_callback;
100 params.start_kernel_isolate = true;
101
102 // Initialize with a normal heap size specification.
103 const char* options_1[] = {"--old-gen-heap-size=3192",
104 "--new-gen-semi-max-size=32"};
105 EXPECT(Dart_SetVMFlags(2, options_1) == nullptr);
106 EXPECT(Dart_Initialize(&params) == nullptr);
107 EXPECT(FLAG_old_gen_heap_size == 3192);
108 EXPECT(FLAG_new_gen_semi_max_size == 32);
109 EXPECT(Dart_Cleanup() == nullptr);
110
111 const char* options_2[] = {"--old-gen-heap-size=16384",
112 "--new-gen-semi-max-size=16384"};
113 EXPECT(Dart_SetVMFlags(2, options_2) == nullptr);
114 EXPECT(Dart_Initialize(&params) == nullptr);
115 if (kMaxAddrSpaceMB == 4096) {
116 EXPECT(FLAG_old_gen_heap_size == 0);
117 EXPECT(FLAG_new_gen_semi_max_size == kDefaultNewGenSemiMaxSize);
118 } else {
119 EXPECT(FLAG_old_gen_heap_size == 16384);
120 EXPECT(FLAG_new_gen_semi_max_size == 16384);
121 }
122 EXPECT(Dart_Cleanup() == nullptr);
123
124 const char* options_3[] = {"--old-gen-heap-size=30720",
125 "--new-gen-semi-max-size=30720"};
126 EXPECT(Dart_SetVMFlags(2, options_3) == nullptr);
127 EXPECT(Dart_Initialize(&params) == nullptr);
128 if (kMaxAddrSpaceMB == 4096) {
129 EXPECT(FLAG_old_gen_heap_size == 0);
130 EXPECT(FLAG_new_gen_semi_max_size == kDefaultNewGenSemiMaxSize);
131 } else {
132 EXPECT(FLAG_old_gen_heap_size == 30720);
133 EXPECT(FLAG_new_gen_semi_max_size == 30720);
134 }
135 EXPECT(Dart_Cleanup() == nullptr);
136}

◆ UNIT_TEST_CASE() [4/19]

dart::UNIT_TEST_CASE ( DartAPI_TimelineEvents_Loop  )

Definition at line 10072 of file dart_api_impl_test.cc.

10072 {
10073 error = nullptr;
10074 response_json = nullptr;
10075 response_json_length = 0;
10076 const bool success = Dart_InvokeVMServiceMethod(
10077 reinterpret_cast<uint8_t*>(buffer), strlen(buffer), &response_json,
10078 &response_json_length, &error);
10079 if (success) {
10080 MonitorLocker ml(loop_test_lock);
10081 EXPECT(error == nullptr);
10082 free(response_json);
10083 if (count == 10) {
10084 loop_test_exit = true;
10085 ml.Notify();
10086 }
10087 count++;
10088 } else {
10089 free(error);
10090 }
10091 } while (count < 100);
10092}
10093
10094TEST_CASE(DartAPI_InvokeVMServiceMethod_Loop) {
10095 MonitorLocker ml(loop_test_lock);
10096 loop_test_exit = false;
10097 loop_reset_count = false;
10098 OSThread::Start("InvokeServiceMessages", InvokeServiceMessages, 0);
10099 while (!loop_test_exit) {
10100 ml.Wait();
10101 }
10102}
10103#endif // !defined(PRODUCT)
10104
10105static void HandleResponse(Dart_Port dest_port_id, Dart_CObject* message) {
10106 printf("Response received\n");
10107}
void HandleResponse(bool handled, void *user_data)
static bool loop_reset_count

◆ UNIT_TEST_CASE() [5/19]

dart::UNIT_TEST_CASE ( DartAPI_TimelineEvents_NullFlowIdsHandledGracefully  )

Definition at line 10109 of file dart_api_impl_test.cc.

10109 {
10110 uint32_t count = 0;
10111 do {
10112 const Dart_Port port_id = Dart_NewNativePort("tst", &HandleResponse, false);
10113 if (port_id != ILLEGAL_PORT) {

◆ UNIT_TEST_CASE() [6/19]

dart::UNIT_TEST_CASE ( FixedCacheEmpty  )

Definition at line 12 of file fixed_cache_test.cc.

12 {
14 EXPECT(cache.Lookup(0) == nullptr);
15 EXPECT(cache.Lookup(1) == nullptr);
16 cache.Insert(1, 2);
17 EXPECT(*cache.Lookup(1) == 2);
18 EXPECT(cache.Lookup(0) == nullptr);
19}

◆ UNIT_TEST_CASE() [7/19]

dart::UNIT_TEST_CASE ( FixedCacheFullResource  )

Definition at line 66 of file fixed_cache_test.cc.

66 {
67 {
69 cache.Insert(10, Resource(2));
70 cache.Insert(20, Resource(4));
71 cache.Insert(40, Resource(16));
72 cache.Insert(30, Resource(8));
73 EXPECT(cache.Lookup(40)->id == 16);
74 EXPECT(cache.Lookup(5) == nullptr);
75 EXPECT(cache.Lookup(0) == nullptr);
76 // Insert in the front, middle.
77 cache.Insert(5, Resource(1));
78 cache.Insert(15, Resource(3));
79 cache.Insert(25, Resource(6));
80 // 40 got removed by shifting.
81 EXPECT(cache.Lookup(40) == nullptr);
82 EXPECT(cache.Lookup(5)->id == 1);
83 EXPECT(cache.Lookup(15)->id == 3);
84 EXPECT(cache.Lookup(25)->id == 6);
85
86 // Insert at end top - 30 gets replaced by 40.
87 cache.Insert(40, Resource(16));
88 EXPECT(cache.Lookup(40)->id == 16);
89 EXPECT(cache.Lookup(30) == nullptr);
90 }
91 EXPECT(Resource::copies == 0);
92}

◆ UNIT_TEST_CASE() [8/19]

dart::UNIT_TEST_CASE ( FixedCacheHalfFull  )

Definition at line 21 of file fixed_cache_test.cc.

21 {
23 // Insert at end.
24 cache.Insert(10, "a");
25 cache.Insert(20, "b");
26 cache.Insert(40, "c");
27 // Insert in the middle.
28 cache.Insert(15, "ab");
29 cache.Insert(25, "bc");
30 // Insert in front.
31 cache.Insert(5, "_");
32 // Check all items.
33 EXPECT(strcmp(*cache.Lookup(5), "_") == 0);
34 EXPECT(strcmp(*cache.Lookup(10), "a") == 0);
35 EXPECT(strcmp(*cache.Lookup(20), "b") == 0);
36 EXPECT(strcmp(*cache.Lookup(40), "c") == 0);
37 EXPECT(strcmp(*cache.Lookup(25), "bc") == 0);
38 // Nonexistent - front, middle, end.
39 EXPECT(cache.Lookup(1) == nullptr);
40 EXPECT(cache.Lookup(35) == nullptr);
41 EXPECT(cache.Lookup(50) == nullptr);
42}

◆ UNIT_TEST_CASE() [9/19]

dart::UNIT_TEST_CASE ( IntrusiveDListAppendListTest  )

Definition at line 155 of file intrusive_dlist_test.cc.

155 {
156 // Append to empty list.
157 {
160
161 Item a1(1, 11), a2(2, 12);
162 all.Append(&a1);
163 all.Append(&a2);
164
165 other.AppendList(&all);
166
167 EXPECT(all.IsEmpty());
168 EXPECT(!other.IsEmpty());
169 EXPECT_EQ(&a1, other.First());
170 EXPECT_EQ(&a2, other.Last());
171
172 auto it = other.Begin();
173 EXPECT_EQ(&a1, *it);
174 it = other.Erase(it);
175 EXPECT_EQ(&a2, *it);
176 it = other.Erase(it);
177 EXPECT(it == other.end());
178 }
179 // Append to non-empty list.
180 {
181 IntrusiveDList<Item> all;
182 IntrusiveDList<Item> other;
183
184 Item a1(1, 11), a2(2, 12);
185 all.Append(&a1);
186 all.Append(&a2);
187
188 Item o1(1, 11);
189 other.Append(&o1);
190
191 other.AppendList(&all);
192
193 EXPECT(all.IsEmpty());
194 EXPECT(!other.IsEmpty());
195 EXPECT_EQ(&o1, other.First());
196 EXPECT_EQ(&a2, other.Last());
197
198 auto it = other.Begin();
199 EXPECT_EQ(&o1, *it);
200 it = other.Erase(it);
201 EXPECT_EQ(&a1, *it);
202 it = other.Erase(it);
203 EXPECT_EQ(&a2, *it);
204 it = other.Erase(it);
205 EXPECT(it == other.end());
206 }
207}
void AppendList(IntrusiveDList< T, N > *other)
Iterator< T, N > Begin()
Iterator< T, N > Erase(const Iterator< T, N > &iterator)
Iterator< T, N > end()

◆ UNIT_TEST_CASE() [10/19]

dart::UNIT_TEST_CASE ( IntrusiveDListEraseIterator  )

Definition at line 131 of file intrusive_dlist_test.cc.

131 {
132 Item a1(1, 11), a2(2, 12), a3(3, 13);
133
135
136 all.Append(&a2);
137 all.Append(&a3);
138 all.Prepend(&a1);
139
140 auto it = all.Begin();
141 it = all.Erase(++it);
142 EXPECT_EQ(*it, &a3);
143 EXPECT_EQ(*it, all.Last());
144
145 it = all.Erase(all.Begin());
146 EXPECT_EQ(*it, &a3);
147 EXPECT_EQ(*it, all.First());
148 EXPECT_EQ(*it, all.Last());
149
150 it = all.Erase(all.Begin());
151 EXPECT(it == all.End());
152 EXPECT(all.IsEmpty());
153}

◆ UNIT_TEST_CASE() [11/19]

dart::UNIT_TEST_CASE ( IntrusiveDListIsInList  )

Definition at line 108 of file intrusive_dlist_test.cc.

108 {
109 Item a1(1, 11), a2(2, 12), a3(3, 13);
110
112
113 all.Append(&a2);
114 all.Append(&a3);
115 all.Prepend(&a1);
116
117 ASSERT(all.IsInList(&a1));
118 ASSERT(all.IsInList(&a2));
119 ASSERT(all.IsInList(&a3));
120
121 EXPECT_EQ(&a1, all.RemoveFirst());
122 EXPECT(!all.IsInList(&a1));
123 EXPECT_EQ(&a3, all.RemoveLast());
124 EXPECT(!all.IsInList(&a3));
125 EXPECT_EQ(&a2, all.RemoveFirst());
126 EXPECT(!all.IsInList(&a2));
127
128 EXPECT(all.IsEmpty());
129}

◆ UNIT_TEST_CASE() [12/19]

dart::UNIT_TEST_CASE ( IntrusiveDListMultiEntryTest  )

Definition at line 26 of file intrusive_dlist_test.cc.

26 {
27 Item a1(1, 11), a2(2, 12), a3(3, 13);
28
31
32 EXPECT(all.IsEmpty());
33 EXPECT(ready.IsEmpty());
34
35 all.Append(&a2);
36 all.Append(&a3);
37 all.Prepend(&a1);
38 EXPECT_EQ(all.First()->item, 11);
39 EXPECT_EQ(all.Last()->item, 13);
40
41 ready.Append(&a1);
42 ready.Append(&a2);
43 EXPECT_EQ(ready.First()->item, 11);
44 EXPECT_EQ(ready.Last()->item, 12);
45
46 int i = 0;
47 for (auto it = all.Begin(); it != all.End(); ++it) {
48 i++;
49 EXPECT_EQ(it->base, i);
50 EXPECT_EQ((*it)->base, i);
51 EXPECT_EQ(it->item, 10 + i);
52 EXPECT_EQ((*it)->item, 10 + i);
53 }
54 EXPECT_EQ(i, 3);
55
56 i = 0;
57 for (auto it = ready.Begin(); it != ready.End(); ++it) {
58 i++;
59 EXPECT_EQ(it->base, i);
60 EXPECT_EQ((*it)->base, i);
61 EXPECT_EQ(it->item, 10 + i);
62 EXPECT_EQ((*it)->item, 10 + i);
63 }
64 EXPECT_EQ(i, 2);
65
66 ready.Remove(&a1);
67 ready.Remove(&a2);
68
69 all.Remove(&a1);
70 all.Remove(&a2);
71 all.Remove(&a3);
72
73 EXPECT(all.IsEmpty());
74 EXPECT(ready.IsEmpty());
75}
Iterator< T, N > End()

◆ UNIT_TEST_CASE() [13/19]

dart::UNIT_TEST_CASE ( IntrusiveDListRemoveFirstTest  )

Definition at line 77 of file intrusive_dlist_test.cc.

77 {
78 Item a1(1, 11), a2(2, 12), a3(3, 13);
79
81
82 all.Append(&a2);
83 all.Append(&a3);
84 all.Prepend(&a1);
85
86 EXPECT_EQ(&a1, all.RemoveFirst());
87 EXPECT_EQ(&a2, all.RemoveFirst());
88 EXPECT_EQ(&a3, all.RemoveFirst());
89
90 EXPECT(all.IsEmpty());
91}

◆ UNIT_TEST_CASE() [14/19]

dart::UNIT_TEST_CASE ( IntrusiveDListRemoveLastTest  )

Definition at line 93 of file intrusive_dlist_test.cc.

93 {
94 Item a1(1, 11), a2(2, 12), a3(3, 13);
95
97
98 all.Append(&a2);
99 all.Append(&a3);
100 all.Prepend(&a1);
101
102 EXPECT_EQ(&a3, all.RemoveLast());
103 EXPECT_EQ(&a2, all.RemoveLast());
104 EXPECT_EQ(&a1, all.RemoveLast());
105 EXPECT(all.IsEmpty());
106}

◆ UNIT_TEST_CASE() [15/19]

dart::UNIT_TEST_CASE ( PRIORITY_HEAP_WITH_INDEX__CHANGE_PRIORITY  )

Definition at line 122 of file priority_heap_test.cc.

122 {
124
126 for (word i = 0; i < kSize; i++) {
127 if (i % 2 == 0) {
128 heap.Insert(i, 10 + i);
129 }
130 }
131 ASSERT(heap.min_heap_size() == kSize);
132 for (word i = 0; i < kSize; i++) {
133 bool was_inserted = i % 2 == 0;
134 bool increase = i % 3 == 0;
135 word new_priority = i + (increase ? 100 : -100);
136
137 EXPECT(was_inserted != heap.InsertOrChangePriority(new_priority, 10 + i));
138 }
139
140 for (word i = 0; i < kSize; i++) {
141 bool increase = i % 3 == 0;
142 if (!increase) {
143 word expected_priority = i + (increase ? 100 : -100);
144 EXPECT(!heap.IsEmpty());
145 EXPECT_EQ(expected_priority, heap.Minimum().priority);
146 EXPECT_EQ(10 + i, heap.Minimum().value);
147 EXPECT(heap.ContainsValue(10 + i));
148 heap.RemoveMinimum();
149 EXPECT(!heap.ContainsValue(10 + i));
150 }
151 }
152 for (word i = 0; i < kSize; i++) {
153 bool increase = i % 3 == 0;
154 if (increase) {
155 word expected_priority = i + (increase ? 100 : -100);
156 EXPECT(!heap.IsEmpty());
157 EXPECT_EQ(expected_priority, heap.Minimum().priority);
158 EXPECT_EQ(10 + i, heap.Minimum().value);
159 EXPECT(heap.ContainsValue(10 + i));
160 heap.RemoveMinimum();
161 EXPECT(!heap.ContainsValue(10 + i));
162 }
163 }
164 EXPECT(heap.IsEmpty());
165}
const Entry & Minimum() const
bool ContainsValue(const V &value)
void Insert(const P &priority, const V &value)
bool InsertOrChangePriority(const P &priority, const V &value)

◆ UNIT_TEST_CASE() [16/19]

dart::UNIT_TEST_CASE ( PRIORITY_HEAP_WITH_INDEX__DECREASING  )

Definition at line 30 of file priority_heap_test.cc.

30 {
32
34 for (word i = kSize - 1; i >= 0; i--) {
35 heap.Insert(i, 10 + i);
36 }
37 ASSERT(heap.min_heap_size() == kSize);
38 for (word i = 0; i < kSize; i++) {
39 EXPECT(!heap.IsEmpty());
40 EXPECT_EQ(i, heap.Minimum().priority);
41 EXPECT_EQ(10 + i, heap.Minimum().value);
42 EXPECT(heap.ContainsValue(10 + i));
43 heap.RemoveMinimum();
44 EXPECT(!heap.ContainsValue(10 + i));
45 }
46 EXPECT(heap.IsEmpty());
47}

◆ UNIT_TEST_CASE() [17/19]

dart::UNIT_TEST_CASE ( PRIORITY_HEAP_WITH_INDEX__DELETE_BY_VALUES  )

Definition at line 49 of file priority_heap_test.cc.

49 {
51
53 for (word i = kSize - 1; i >= 0; i--) {
54 heap.Insert(i, 10 + i);
55 }
56
57 ASSERT(heap.min_heap_size() == kSize);
58
59 EXPECT(heap.RemoveByValue(10 + 0));
60 EXPECT(!heap.RemoveByValue(10 + 0));
61
62 EXPECT(heap.RemoveByValue(10 + 5));
63 EXPECT(!heap.RemoveByValue(10 + 5));
64
65 EXPECT(heap.RemoveByValue(10 + kSize - 1));
66 EXPECT(!heap.RemoveByValue(10 + kSize - 1));
67
68 for (word i = 0; i < kSize; i++) {
69 // Jump over the removed [i]s in the loop.
70 if (i != 0 && i != 5 && i != (kSize - 1)) {
71 EXPECT(!heap.IsEmpty());
72 EXPECT_EQ(i, heap.Minimum().priority);
73 EXPECT_EQ(10 + i, heap.Minimum().value);
74 EXPECT(heap.ContainsValue(10 + i));
75 heap.RemoveMinimum();
76 EXPECT(!heap.ContainsValue(10 + i));
77 }
78 }
79 EXPECT(heap.IsEmpty());
80}
bool RemoveByValue(const V &value)

◆ UNIT_TEST_CASE() [18/19]

dart::UNIT_TEST_CASE ( PRIORITY_HEAP_WITH_INDEX__GROW_SHRINK  )

Definition at line 82 of file priority_heap_test.cc.

82 {
83 const word kSize = 1024;
85
87 for (word i = 0; i < kSize; i++) {
88 heap.Insert(i, 10 + i);
89 }
90
91 ASSERT(heap.min_heap_size() == kSize);
92
93 for (word i = 0; i < kSize; i++) {
94 EXPECT(!heap.IsEmpty());
95 EXPECT_EQ(i, heap.Minimum().priority);
96 EXPECT_EQ(10 + i, heap.Minimum().value);
97 EXPECT(heap.ContainsValue(10 + i));
98 heap.RemoveMinimum();
99 EXPECT(!heap.ContainsValue(10 + i));
100 }
101
102 EXPECT(heap.IsEmpty());
103 ASSERT(heap.min_heap_size() == kMinimumSize);
104
105 for (word i = 0; i < kSize; i++) {
106 heap.Insert(i, 10 + i);
107 }
108
109 for (word i = 0; i < kSize; i++) {
110 EXPECT(!heap.IsEmpty());
111 EXPECT_EQ(i, heap.Minimum().priority);
112 EXPECT_EQ(10 + i, heap.Minimum().value);
113 EXPECT(heap.ContainsValue(10 + i));
114 heap.RemoveMinimum();
115 EXPECT(!heap.ContainsValue(10 + i));
116 }
117
118 EXPECT(heap.IsEmpty());
119 ASSERT(heap.min_heap_size() == kMinimumSize);
120}

◆ UNIT_TEST_CASE() [19/19]

dart::UNIT_TEST_CASE ( PRIORITY_HEAP_WITH_INDEX__INCREASING  )

Definition at line 11 of file priority_heap_test.cc.

11 {
13
15 for (word i = 0; i < kSize; i++) {
16 heap.Insert(i, 10 + i);
17 }
18 ASSERT(heap.min_heap_size() == kSize);
19 for (word i = 0; i < kSize; i++) {
20 EXPECT(!heap.IsEmpty());
21 EXPECT_EQ(i, heap.Minimum().priority);
22 EXPECT_EQ(10 + i, heap.Minimum().value);
23 EXPECT(heap.ContainsValue(10 + i));
24 heap.RemoveMinimum();
25 EXPECT(!heap.ContainsValue(10 + i));
26 }
27 EXPECT(heap.IsEmpty());
28}

◆ UnitString()

static const char * dart::UnitString ( intptr_t  unit)
static

Definition at line 61 of file metrics.cc.

61 {
62 switch (unit) {
63 case Metric::kCounter:
64 return "counter";
65 case Metric::kByte:
66 return "byte";
67 case Metric::kMicrosecond:
68 return "us";
69 default:
71 }
73 return nullptr;
74}

◆ UnmarkClasses()

static void dart::UnmarkClasses ( )
static

Definition at line 3493 of file service.cc.

3493 {
3494 ClassTable* table = IsolateGroup::Current()->class_table();
3495 for (intptr_t i = 1; i < table->NumCids(); i++) {
3496 table->SetCollectInstancesFor(i, false);
3497 }
3498}

◆ UnprotectCodeOtherThread()

DART_EXPORT void * dart::UnprotectCodeOtherThread ( void *  isolate,
std::condition_variable *  var,
std::mutex *  mut 
)

Definition at line 123 of file ffi_test_functions_vmspecific.cc.

125 {
126 std::function<void()> callback = [&]() {
127 mut->lock();
128 var->notify_all();
129 mut->unlock();
130
131 // Wait for mutator thread to continue (and block) before leaving the
132 // safepoint.
133 while (Dart_ExecuteInternalCommand("is-mutator-in-native", isolate) !=
134 nullptr) {
135 usleep(10 * 1000 /*10 ms*/);
136 }
137 };
138
139 struct {
140 void* isolate;
141 std::function<void()>* callback;
142 } args = {.isolate = isolate, .callback = &callback};
143
144 Dart_ExecuteInternalCommand("run-in-safepoint-and-rw-code", &args);
145 return nullptr;
146}

◆ UnreachableFinalizer()

static void dart::UnreachableFinalizer ( void *  isolate_callback_data,
void *  peer 
)
static

Definition at line 8002 of file dart_api_impl_test.cc.

8004 {

◆ UnreachableMessageHandler()

static void dart::UnreachableMessageHandler ( Dart_Port  dest_port_id,
Dart_CObject message 
)
static

Definition at line 8283 of file dart_api_impl_test.cc.

◆ UnreachedCallback()

static void dart::UnreachedCallback ( void *  isolate_callback_data,
void *  peer 
)
static

Definition at line 3146 of file dart_api_impl_test.cc.

3146 {
3147 UNREACHABLE();
3148}

◆ untag()

raw_obj dart::untag ( ) -> num_entries()) VARIABLE_COMPRESSED_VISITOR(Array, Smi::Value(raw_obj->untag()->length())) VARIABLE_COMPRESSED_VISITOR( TypedData, TypedData::ElementSizeInBytes(raw_obj->GetClassId()) * Smi::Value(raw_obj->untag()->length())) VARIABLE_COMPRESSED_VISITOR(Record, RecordShape(raw_obj->untag()->shape()).num_fields()) VARIABLE_NULL_VISITOR(CompressedStackMaps, CompressedStackMaps::PayloadSizeOf(raw_obj)) VARIABLE_NULL_VISITOR(OneByteString, Smi::Value(raw_obj->untag()->length())) VARIABLE_NULL_VISITOR(TwoByteString, Smi::Value(raw_obj->untag()->length())) intptr_t UntaggedField::VisitFieldPointers(FieldPtr raw_obj, ObjectPointerVisitor* visitor)

Definition at line 562 of file raw_object.cc.

607 {
608 ASSERT(raw_obj->IsHeapObject());
610 visitor->VisitCompressedPointers(
611 raw_obj->heap_base(), raw_obj->untag()->from(), raw_obj->untag()->to());
612
613 if (visitor->trace_values_through_fields()) {
614 if (Field::StaticBit::decode(raw_obj->untag()->kind_bits_)) {
615 visitor->isolate_group()->ForEachIsolate(
616 [&](Isolate* isolate) {
617 intptr_t index =
618 Smi::Value(raw_obj->untag()->host_offset_or_field_id());
619 visitor->VisitPointer(&isolate->field_table()->table()[index]);
620 },
621 /*at_safepoint=*/true);
622 }
623 }
624 return Field::InstanceSize();
625}
ObjectPtr * table()
Definition field_table.h:42
FieldTable * field_table() const
Definition isolate.h:953
#define ASSERT_COMPRESSED(Type)
Definition raw_object.h:117

◆ UnwrapConstraint()

static Definition * dart::UnwrapConstraint ( Definition defn)
static

Definition at line 73 of file range_analysis.cc.

73 {
74 while (defn->IsConstraint()) {
75 defn = defn->AsConstraint()->value()->definition();
76 }
77 return defn;
78}

◆ UpdateBestFit()

static void dart::UpdateBestFit ( Function best_fit,
const Function func 
)
static

Definition at line 2354 of file debugger.cc.

2354 {
2355 if (best_fit->IsNull()) {
2356 *best_fit = func.ptr();
2357 } else if ((best_fit->token_pos().IsSynthetic() ||
2358 func.token_pos().IsSynthetic() ||
2359 (best_fit->token_pos() < func.token_pos())) &&
2360 (func.end_token_pos() <= best_fit->end_token_pos())) {
2361 *best_fit = func.ptr();
2362 }
2363}
bool IsSynthetic() const

◆ UpdateBoundsCheck()

static void dart::UpdateBoundsCheck ( intptr_t  index,
intptr_t *  checked_up_to 
)
static

Definition at line 2357 of file regexp.cc.

2357 {
2358 if (index > *checked_up_to) {
2359 *checked_up_to = index;
2360 }
2361}

◆ UpdateLengthField()

DART_FORCE_INLINE void dart::UpdateLengthField ( intptr_t  cid,
ObjectPtr  from,
ObjectPtr  to 
)

Definition at line 280 of file object_graph_copy.cc.

280 {
281 // We share these objects - never copy them.
282 ASSERT(!IsStringClassId(cid));
283
284 // We update any in-heap variable sized object with the length to keep the
285 // length and the size in the object header in-sync for the GC.
286 if (cid == kArrayCid || cid == kImmutableArrayCid) {
287 static_cast<UntaggedArray*>(to.untag())->length_ =
288 static_cast<UntaggedArray*>(from.untag())->length_;
289 } else if (cid == kContextCid) {
290 static_cast<UntaggedContext*>(to.untag())->num_variables_ =
291 static_cast<UntaggedContext*>(from.untag())->num_variables_;
292 } else if (IsTypedDataClassId(cid)) {
293 static_cast<UntaggedTypedDataBase*>(to.untag())->length_ =
294 static_cast<UntaggedTypedDataBase*>(from.untag())->length_;
295 } else if (cid == kRecordCid) {
296 static_cast<UntaggedRecord*>(to.untag())->shape_ =
297 static_cast<UntaggedRecord*>(from.untag())->shape_;
298 }
299}

◆ UpdateTypeTestCache()

static void dart::UpdateTypeTestCache ( Zone zone,
Thread thread,
const Instance instance,
const AbstractType destination_type,
const TypeArguments instantiator_type_arguments,
const TypeArguments function_type_arguments,
const Bool result,
const SubtypeTestCache new_cache 
)
static

Definition at line 973 of file runtime_entry.cc.

981 {
982 ASSERT(!new_cache.IsNull());
983 ASSERT(destination_type.IsCanonical());
984 ASSERT(instantiator_type_arguments.IsCanonical());
985 ASSERT(function_type_arguments.IsCanonical());
986 if (instance.IsRecord()) {
987 // Do not add record instances to cache as they don't have a valid
988 // key (type of a record depends on types of all its fields).
989 if (FLAG_trace_type_checks) {
990 THR_Print("Not updating subtype test cache for the record instance.\n");
991 }
992 return;
993 }
994 Class& instance_class = Class::Handle(zone);
995 if (instance.IsSmi()) {
996 instance_class = Smi::Class();
997 } else {
998 instance_class = instance.clazz();
999 }
1000 // If the type is uninstantiated and refers to parent function type
1001 // parameters, the function_type_arguments have been canonicalized
1002 // when concatenated.
1003 auto& instance_class_id_or_signature = Object::Handle(zone);
1004 auto& instance_type_arguments = TypeArguments::Handle(zone);
1005 auto& instance_parent_function_type_arguments = TypeArguments::Handle(zone);
1006 auto& instance_delayed_type_arguments = TypeArguments::Handle(zone);
1007 if (instance_class.IsClosureClass()) {
1008 const auto& closure = Closure::Cast(instance);
1009 const auto& function = Function::Handle(zone, closure.function());
1010 instance_class_id_or_signature = function.signature();
1011 ASSERT(instance_class_id_or_signature.IsFunctionType());
1012 instance_type_arguments = closure.instantiator_type_arguments();
1013 instance_parent_function_type_arguments = closure.function_type_arguments();
1014 instance_delayed_type_arguments = closure.delayed_type_arguments();
1015 ASSERT(instance_class_id_or_signature.IsCanonical());
1016 ASSERT(instance_type_arguments.IsCanonical());
1017 ASSERT(instance_parent_function_type_arguments.IsCanonical());
1018 ASSERT(instance_delayed_type_arguments.IsCanonical());
1019 } else {
1020 instance_class_id_or_signature = Smi::New(instance_class.id());
1021 if (instance_class.NumTypeArguments() > 0) {
1022 instance_type_arguments = instance.GetTypeArguments();
1023 ASSERT(instance_type_arguments.IsCanonical());
1024 }
1025 }
1026 if (FLAG_trace_type_checks) {
1027 const auto& instance_class_name =
1028 String::Handle(zone, instance_class.Name());
1029 TextBuffer buffer(256);
1030 buffer.Printf(" Updating test cache %#" Px " with result %s for:\n",
1031 static_cast<uword>(new_cache.ptr()), result.ToCString());
1032 if (instance.IsString()) {
1033 buffer.Printf(" instance: '%s'\n", instance.ToCString());
1034 } else {
1035 buffer.Printf(" instance: %s\n", instance.ToCString());
1036 }
1037 buffer.Printf(" class: %s (%" Pd ")\n", instance_class_name.ToCString(),
1038 instance_class.id());
1039 buffer.Printf(
1040 " raw entry: [ %#" Px ", %#" Px ", %#" Px ", %#" Px ", %#" Px
1041 ", %#" Px ", %#" Px ", %#" Px " ]\n",
1042 static_cast<uword>(instance_class_id_or_signature.ptr()),
1043 static_cast<uword>(instance_type_arguments.ptr()),
1044 static_cast<uword>(instantiator_type_arguments.ptr()),
1045 static_cast<uword>(function_type_arguments.ptr()),
1046 static_cast<uword>(instance_parent_function_type_arguments.ptr()),
1047 static_cast<uword>(instance_delayed_type_arguments.ptr()),
1048 static_cast<uword>(destination_type.ptr()),
1049 static_cast<uword>(result.ptr()));
1050 THR_Print("%s", buffer.buffer());
1051 }
1052 {
1053 SafepointMutexLocker ml(
1055 const intptr_t len = new_cache.NumberOfChecks();
1056 if (len >= FLAG_max_subtype_cache_entries) {
1057 if (FLAG_trace_type_checks) {
1058 THR_Print("Not updating subtype test cache as its length reached %d\n",
1059 FLAG_max_subtype_cache_entries);
1060 }
1061 return;
1062 }
1063 intptr_t colliding_index = -1;
1064 auto& old_result = Bool::Handle(zone);
1065 if (new_cache.HasCheck(
1066 instance_class_id_or_signature, destination_type,
1067 instance_type_arguments, instantiator_type_arguments,
1068 function_type_arguments, instance_parent_function_type_arguments,
1069 instance_delayed_type_arguments, &colliding_index, &old_result)) {
1070 if (FLAG_trace_type_checks) {
1071 TextBuffer buffer(256);
1072 buffer.Printf(" Collision for test cache %#" Px " at index %" Pd ":\n",
1073 static_cast<uword>(new_cache.ptr()), colliding_index);
1074 buffer.Printf(" entry: ");
1075 new_cache.WriteEntryToBuffer(zone, &buffer, colliding_index, " ");
1076 THR_Print("%s\n", buffer.buffer());
1077 }
1078 if (old_result.ptr() != result.ptr()) {
1079 FATAL("Existing subtype test cache entry has result %s, not %s",
1080 old_result.ToCString(), result.ToCString());
1081 }
1082 // Some other isolate might have updated the cache between entry was
1083 // found missing and now.
1084 return;
1085 }
1086 const intptr_t new_index = new_cache.AddCheck(
1087 instance_class_id_or_signature, destination_type,
1088 instance_type_arguments, instantiator_type_arguments,
1089 function_type_arguments, instance_parent_function_type_arguments,
1090 instance_delayed_type_arguments, result);
1091 if (FLAG_trace_type_checks) {
1092 TextBuffer buffer(256);
1093 buffer.Printf(" Added new entry to test cache %#" Px " at index %" Pd
1094 ":\n",
1095 static_cast<uword>(new_cache.ptr()), new_index);
1096 buffer.Printf(" new entry: ");
1097 new_cache.WriteEntryToBuffer(zone, &buffer, new_index, " ");
1098 THR_Print("%s\n", buffer.buffer());
1099 }
1100 }
1101}
Mutex * subtype_test_cache_mutex()
Definition isolate.h:511
bool IsCanonical() const
Definition object.h:335
void WriteEntryToBuffer(Zone *zone, BaseTextBuffer *buffer, intptr_t index, const char *line_prefix=nullptr) const
Definition object.cc:19546
intptr_t NumberOfChecks() const
Definition object.cc:19004
intptr_t AddCheck(const Object &instance_class_id_or_signature, const AbstractType &destination_type, const TypeArguments &instance_type_arguments, const TypeArguments &instantiator_type_arguments, const TypeArguments &function_type_arguments, const TypeArguments &instance_parent_function_type_arguments, const TypeArguments &instance_delayed_type_arguments, const Bool &test_result) const
Definition object.cc:19028
bool HasCheck(const Object &instance_class_id_or_signature, const AbstractType &destination_type, const TypeArguments &instance_type_arguments, const TypeArguments &instantiator_type_arguments, const TypeArguments &function_type_arguments, const TypeArguments &instance_parent_function_type_arguments, const TypeArguments &instance_delayed_type_arguments, intptr_t *index, Bool *result) const
Definition object.cc:19514

◆ Usage()

static intptr_t dart::Usage ( Thread thread,
const Function function 
)
static

Definition at line 727 of file il.cc.

727 {
728 intptr_t count = function.usage_counter();
729 if (count < 0) {
730 if (function.HasCode()) {
731 // 'function' is queued for optimized compilation
733 } else {
734 count = 0;
735 }
736 } else if (Code::IsOptimized(function.CurrentCode())) {
737 // 'function' was optimized and stopped counting
739 }
740 return count;
741}

◆ USE()

template<typename T >
static void dart::USE ( T &&  )
inlinestatic

Definition at line 618 of file globals.h.

618{}

◆ UseDartApi()

static void dart::UseDartApi ( Dart_NativeArguments  args)
static

Definition at line 124 of file benchmark_test.cc.

124 {
126 EXPECT_EQ(3, count);
127
128 // Get native field from receiver.
129 intptr_t receiver_value;
130 Dart_Handle result = Dart_GetNativeReceiver(args, &receiver_value);
132 EXPECT_EQ(7, receiver_value);
133
134 // Get param1.
136 EXPECT_VALID(param1);
137 EXPECT(Dart_IsInteger(param1));
138 bool fits = false;
139 result = Dart_IntegerFitsIntoInt64(param1, &fits);
141 EXPECT(fits);
142 int64_t value1;
143 result = Dart_IntegerToInt64(param1, &value1);
145 EXPECT_LE(0, value1);
146 EXPECT_LE(value1, 1000000);
147
148 // Return param + receiver.field.
149 Dart_SetReturnValue(args, Dart_NewInteger(value1 * receiver_value));
150}
DART_EXPORT Dart_Handle Dart_GetNativeReceiver(Dart_NativeArguments args, intptr_t *value)

◆ Validate()

template<typename Table >
void dart::Validate ( const Table &  table)

Definition at line 39 of file hash_table_test.cc.

39 {
40 // Verify consistency of entry state tracking.
41 intptr_t num_entries = table.NumEntries();
42 intptr_t num_unused = table.NumUnused();
43 intptr_t num_occupied = table.NumOccupied();
44 intptr_t num_deleted = table.NumDeleted();
45 for (intptr_t i = 0; i < num_entries; ++i) {
46 EXPECT_EQ(1, table.IsUnused(i) + table.IsOccupied(i) + table.IsDeleted(i));
47 num_unused -= table.IsUnused(i);
48 num_occupied -= table.IsOccupied(i);
49 num_deleted -= table.IsDeleted(i);
50 }
51 EXPECT_EQ(0, num_unused);
52 EXPECT_EQ(0, num_occupied);
53 EXPECT_EQ(0, num_deleted);
54}

◆ ValidateMessageObject()

static ObjectPtr dart::ValidateMessageObject ( Zone zone,
Isolate isolate,
const Object obj 
)
static

Definition at line 142 of file isolate.cc.

144 {
145 TIMELINE_DURATION(Thread::Current(), Isolate, "ValidateMessageObject");
146
147 class SendMessageValidator : public ObjectPointerVisitor {
148 public:
149 SendMessageValidator(IsolateGroup* isolate_group,
150 WeakTable* visited,
151 MallocGrowableArray<ObjectPtr>* const working_set)
152 : ObjectPointerVisitor(isolate_group),
153 visited_(visited),
154 working_set_(working_set) {}
155
156 void VisitObject(ObjectPtr obj) {
157 if (!obj->IsHeapObject() || obj->untag()->IsCanonical()) {
158 return;
159 }
160 if (visited_->GetValueExclusive(obj) == 1) {
161 return;
162 }
163 visited_->SetValueExclusive(obj, 1);
164 working_set_->Add(obj);
165 }
166
167 private:
168 void VisitPointers(ObjectPtr* from, ObjectPtr* to) override {
169 for (ObjectPtr* ptr = from; ptr <= to; ptr++) {
170 VisitObject(*ptr);
171 }
172 }
173
174#if defined(DART_COMPRESSED_POINTERS)
175 void VisitCompressedPointers(uword heap_base,
176 CompressedObjectPtr* from,
177 CompressedObjectPtr* to) override {
178 for (CompressedObjectPtr* ptr = from; ptr <= to; ptr++) {
179 VisitObject(ptr->Decompress(heap_base));
180 }
181 }
182#endif
183
184 WeakTable* visited_;
185 MallocGrowableArray<ObjectPtr>* const working_set_;
186 };
187 if (!obj.ptr()->IsHeapObject() || obj.ptr()->untag()->IsCanonical()) {
188 return obj.ptr();
189 }
190 ClassTable* class_table = isolate->group()->class_table();
191
192 Class& klass = Class::Handle(zone);
193 Closure& closure = Closure::Handle(zone);
194 Array& array = Array::Handle(zone);
195 Object& illegal_object = Object::Handle(zone);
196 const char* exception_message = nullptr;
197 Thread* thread = Thread::Current();
198
199 // working_set contains only elements that have not been visited yet that
200 // need to be processed.
201 // So before adding elements to working_set ensure to check visited flag,
202 // set visited flag at the same time as the element is added.
203
204 // This working set of raw pointers is visited by GC, only one for a given
205 // isolate should be in use.
206 MallocGrowableArray<ObjectPtr>* const working_set =
208 ASSERT(working_set->length() == 0);
209 std::unique_ptr<WeakTable> visited(new WeakTable());
210
211 SendMessageValidator visitor(isolate->group(), visited.get(), working_set);
212
213 visited->SetValueExclusive(obj.ptr(), 1);
214 working_set->Add(obj.ptr());
215
216 while (!working_set->is_empty() && (exception_message == nullptr)) {
217 thread->CheckForSafepoint();
218
219 ObjectPtr raw = working_set->RemoveLast();
221 continue;
222 }
223 const intptr_t cid = raw->GetClassId();
224 switch (cid) {
225 case kArrayCid: {
226 array ^= Array::RawCast(raw);
227 visitor.VisitObject(array.GetTypeArguments());
228 const intptr_t batch_size = (2 << 14) - 1;
229 for (intptr_t i = 0; i < array.Length(); ++i) {
230 ObjectPtr ptr = array.At(i);
231 visitor.VisitObject(ptr);
232 if ((i & batch_size) == batch_size) {
233 thread->CheckForSafepoint();
234 }
235 }
236 continue;
237 }
238 case kClosureCid:
239 closure ^= raw;
240 // Only context has to be checked.
241 working_set->Add(closure.RawContext());
242 continue;
243
244#define MESSAGE_SNAPSHOT_ILLEGAL(type) \
245 case k##type##Cid: \
246 illegal_object = raw; \
247 exception_message = "is a " #type; \
248 break;
249
250 MESSAGE_SNAPSHOT_ILLEGAL(DynamicLibrary);
251 // TODO(http://dartbug.com/47777): Send and exit support: remove this.
252 MESSAGE_SNAPSHOT_ILLEGAL(Finalizer);
253 MESSAGE_SNAPSHOT_ILLEGAL(NativeFinalizer);
254 MESSAGE_SNAPSHOT_ILLEGAL(MirrorReference);
256 MESSAGE_SNAPSHOT_ILLEGAL(ReceivePort);
258 MESSAGE_SNAPSHOT_ILLEGAL(SuspendState);
259
260 default:
261 klass = class_table->At(cid);
262 if (klass.is_isolate_unsendable()) {
263 illegal_object = raw;
264 exception_message =
265 "is unsendable object (see restrictions listed at"
266 "`SendPort.send()` documentation for more information)";
267 break;
268 }
269 }
270 raw->untag()->VisitPointers(&visitor);
271 }
272
273 ASSERT((exception_message == nullptr) == illegal_object.IsNull());
274 if (exception_message != nullptr) {
275 working_set->Clear();
276
277 const Array& args = Array::Handle(zone, Array::New(3));
278 args.SetAt(0, illegal_object);
279 args.SetAt(2, String::Handle(
280 zone, String::NewFormatted(
281 "%s%s",
283 zone, isolate, obj, illegal_object,
284 TraversalRules::kInternalToIsolateGroup),
285 exception_message)));
286 const Object& exception = Object::Handle(
287 zone, Exceptions::Create(Exceptions::kArgumentValue, args));
288 return UnhandledException::New(Instance::Cast(exception),
289 StackTrace::Handle(zone));
290 }
291
292 ASSERT(working_set->length() == 0);
293 isolate->set_forward_table_new(nullptr);
294 return obj.ptr();
295}
MallocGrowableArray< ObjectPtr > * pointers_to_verify_at_exit()
Definition isolate.h:1432
virtual void VisitPointers(ObjectPtr *first, ObjectPtr *last)=0
void VisitCompressedPointers(uword heap_base, CompressedObjectPtr *first, CompressedObjectPtr *last)
Definition visitor.h:43
#define MESSAGE_SNAPSHOT_ILLEGAL(type)
bool CanShareObjectAcrossIsolates(ObjectPtr obj)
const char * FindRetainingPath(Zone *zone_, Isolate *isolate, const Object &from, const Object &to, TraversalRules traversal_rules)

◆ ValidateParameters()

static bool dart::ValidateParameters ( const MethodParameter *const *  parameters,
JSONStream js 
)
static

Definition at line 895 of file service.cc.

896 {
897 if (parameters == nullptr) {
898 return true;
899 }
900 if (js->NumObjectParameters() > 0) {
901 Object& value = Object::Handle();
902 for (intptr_t i = 0; parameters[i] != nullptr; i++) {
903 const MethodParameter* parameter = parameters[i];
904 const char* name = parameter->name();
905 const bool required = parameter->required();
906 value = js->LookupObjectParam(name);
907 const bool has_parameter = !value.IsNull();
908 if (required && !has_parameter) {
909 PrintMissingParamError(js, name);
910 return false;
911 }
912 if (has_parameter && !parameter->ValidateObject(value)) {
913 parameter->PrintErrorObject(name, value, js);
914 return false;
915 }
916 }
917 } else {
918 for (intptr_t i = 0; parameters[i] != nullptr; i++) {
919 const MethodParameter* parameter = parameters[i];
920 const char* name = parameter->name();
921 const bool required = parameter->required();
922 const char* value = js->LookupParam(name);
923 const bool has_parameter = (value != nullptr);
924 if (required && !has_parameter) {
926 return false;
927 }
928 if (has_parameter && !parameter->Validate(value)) {
929 parameter->PrintError(name, value, js);
930 return false;
931 }
932 }
933 }
934 return true;
935}
const char * name() const
Definition service.cc:147

◆ ValidateSummary()

static void dart::ValidateSummary ( LocationSummary locs,
Location  expected_output,
const LocationArray expected_inputs,
const LocationArray expected_temps 
)
static

Definition at line 40 of file locations_helpers_test.cc.

43 {
44 EXPECT(locs->out(0).Equals(expected_output));
45 EXPECT_EQ(expected_inputs->length(), locs->input_count());
46 for (intptr_t i = 0; i < expected_inputs->length(); i++) {
47 EXPECT(locs->in(i).Equals(expected_inputs->At(i)));
48 }
49 EXPECT_EQ(expected_temps->length(), locs->temp_count());
50 for (intptr_t i = 0; i < expected_temps->length(); i++) {
51 EXPECT(locs->temp(i).Equals(expected_temps->At(i)));
52 }
53}
Location temp(intptr_t index) const
Definition locations.h:882
intptr_t input_count() const
Definition locations.h:864
intptr_t temp_count() const
Definition locations.h:880
Location in(intptr_t index) const
Definition locations.h:866

◆ ValidateThreadStackBounds()

static bool dart::ValidateThreadStackBounds ( uintptr_t  fp,
uintptr_t  sp,
uword  stack_lower,
uword  stack_upper 
)
static

Definition at line 344 of file profiler.cc.

347 {
348 if (stack_lower >= stack_upper) {
349 // Stack boundary is invalid.
350 return false;
351 }
352
353 if ((sp < stack_lower) || (sp >= stack_upper)) {
354 // Stack pointer is outside thread's stack boundary.
355 return false;
356 }
357
358 if ((fp < stack_lower) || (fp >= stack_upper)) {
359 // Frame pointer is outside threads's stack boundary.
360 return false;
361 }
362
363 return true;
364}

◆ ValidOutputForAlwaysCalls()

static bool dart::ValidOutputForAlwaysCalls ( const Location loc)
static

Definition at line 201 of file locations.cc.

201 {
202 return loc.IsMachineRegister() || loc.IsInvalid() || loc.IsPairLocation();
203}
bool IsMachineRegister() const
Definition locations.h:434

◆ VARIABLE_COMPRESSED_VISITOR()

dart::VARIABLE_COMPRESSED_VISITOR ( WeakArray  ,
Smi::Value(raw_obj->untag() ->length())   
)

◆ VariadicAt11Doublex8FloatStruct12BytesHomogeneousF()

DART_EXPORT double dart::VariadicAt11Doublex8FloatStruct12BytesHomogeneousF ( double  a0,
double  a1,
double  a2,
double  a3,
double  a4,
double  a5,
double  a6,
double  a7,
float  a8,
Struct12BytesHomogeneousFloat  a9,
int64_t  a10,
  ... 
)

Definition at line 22832 of file ffi_test_functions_generated.cc.

22844 {
22845 va_list var_args;
22846 va_start(var_args, a10);
22847 int32_t a11 = va_arg(var_args, int32_t);
22849 va_arg(var_args, Struct12BytesHomogeneousFloat);
22850 va_end(var_args);
22851
22852 std::cout << "VariadicAt11Doublex8FloatStruct12BytesHomogeneousF" << "(" << a0
22853 << ", " << a1 << ", " << a2 << ", " << a3 << ", " << a4 << ", "
22854 << a5 << ", " << a6 << ", " << a7 << ", " << a8 << ", (" << a9.a0
22855 << ", " << a9.a1 << ", " << a9.a2 << "), " << a10 << ", " << a11
22856 << ", (" << a12.a0 << ", " << a12.a1 << ", " << a12.a2 << "))"
22857 << "\n";
22858
22859 double result = 0;
22860
22861 result += a0;
22862 result += a1;
22863 result += a2;
22864 result += a3;
22865 result += a4;
22866 result += a5;
22867 result += a6;
22868 result += a7;
22869 result += a8;
22870 result += a9.a0;
22871 result += a9.a1;
22872 result += a9.a2;
22873 result += a10;
22874 result += a11;
22875 result += a12.a0;
22876 result += a12.a1;
22877 result += a12.a2;
22878
22879 std::cout << "result = " << result << "\n";
22880
22881 return result;
22882}

◆ VariadicAt1DoubleInt64Int32DoubleInt64Int32()

DART_EXPORT double dart::VariadicAt1DoubleInt64Int32DoubleInt64Int32 ( double  a0,
  ... 
)

Definition at line 22773 of file ffi_test_functions_generated.cc.

22773 {
22774 va_list var_args;
22775 va_start(var_args, a0);
22776 int64_t a1 = va_arg(var_args, int64_t);
22777 int32_t a2 = va_arg(var_args, int32_t);
22778 double a3 = va_arg(var_args, double);
22779 int64_t a4 = va_arg(var_args, int64_t);
22780 int32_t a5 = va_arg(var_args, int32_t);
22781 va_end(var_args);
22782
22783 std::cout << "VariadicAt1DoubleInt64Int32DoubleInt64Int32" << "(" << a0
22784 << ", " << a1 << ", " << a2 << ", " << a3 << ", " << a4 << ", "
22785 << a5 << ")" << "\n";
22786
22787 double result = 0;
22788
22789 result += a0;
22790 result += a1;
22791 result += a2;
22792 result += a3;
22793 result += a4;
22794 result += a5;
22795
22796 std::cout << "result = " << result << "\n";
22797
22798 return result;
22799}

◆ VariadicAt1DoubleInt64Int32Struct20BytesHomogeneou()

DART_EXPORT double dart::VariadicAt1DoubleInt64Int32Struct20BytesHomogeneou ( double  a0,
  ... 
)

Definition at line 22886 of file ffi_test_functions_generated.cc.

22887 {
22888 va_list var_args;
22889 va_start(var_args, a0);
22890 int64_t a1 = va_arg(var_args, int64_t);
22891 int32_t a2 = va_arg(var_args, int32_t);
22893 va_arg(var_args, Struct20BytesHomogeneousInt32);
22894 double a4 = va_arg(var_args, double);
22895 int64_t a5 = va_arg(var_args, int64_t);
22896 int32_t a6 = va_arg(var_args, int32_t);
22898 va_arg(var_args, Struct12BytesHomogeneousFloat);
22899 int64_t a8 = va_arg(var_args, int64_t);
22900 va_end(var_args);
22901
22902 std::cout << "VariadicAt1DoubleInt64Int32Struct20BytesHomogeneou" << "(" << a0
22903 << ", " << a1 << ", " << a2 << ", (" << a3.a0 << ", " << a3.a1
22904 << ", " << a3.a2 << ", " << a3.a3 << ", " << a3.a4 << "), " << a4
22905 << ", " << a5 << ", " << a6 << ", (" << a7.a0 << ", " << a7.a1
22906 << ", " << a7.a2 << "), " << a8 << ")" << "\n";
22907
22908 double result = 0;
22909
22910 result += a0;
22911 result += a1;
22912 result += a2;
22913 result += a3.a0;
22914 result += a3.a1;
22915 result += a3.a2;
22916 result += a3.a3;
22917 result += a3.a4;
22918 result += a4;
22919 result += a5;
22920 result += a6;
22921 result += a7.a0;
22922 result += a7.a1;
22923 result += a7.a2;
22924 result += a8;
22925
22926 std::cout << "result = " << result << "\n";
22927
22928 return result;
22929}

◆ VariadicAt1DoubleStruct12BytesHomogeneousFloatDoub()

DART_EXPORT double dart::VariadicAt1DoubleStruct12BytesHomogeneousFloatDoub ( double  a0,
  ... 
)

Definition at line 22662 of file ffi_test_functions_generated.cc.

22663 {
22664 va_list var_args;
22665 va_start(var_args, a0);
22667 va_arg(var_args, Struct12BytesHomogeneousFloat);
22668 double a2 = va_arg(var_args, double);
22669 va_end(var_args);
22670
22671 std::cout << "VariadicAt1DoubleStruct12BytesHomogeneousFloatDoub" << "(" << a0
22672 << ", (" << a1.a0 << ", " << a1.a1 << ", " << a1.a2 << "), " << a2
22673 << ")" << "\n";
22674
22675 double result = 0;
22676
22677 result += a0;
22678 result += a1.a0;
22679 result += a1.a1;
22680 result += a1.a2;
22681 result += a2;
22682
22683 std::cout << "result = " << result << "\n";
22684
22685 return result;
22686}

◆ VariadicAt1DoubleStruct20BytesHomogeneousFloatDoub()

DART_EXPORT double dart::VariadicAt1DoubleStruct20BytesHomogeneousFloatDoub ( double  a0,
  ... 
)

Definition at line 22720 of file ffi_test_functions_generated.cc.

22721 {
22722 va_list var_args;
22723 va_start(var_args, a0);
22725 va_arg(var_args, Struct20BytesHomogeneousFloat);
22726 double a2 = va_arg(var_args, double);
22727 va_end(var_args);
22728
22729 std::cout << "VariadicAt1DoubleStruct20BytesHomogeneousFloatDoub" << "(" << a0
22730 << ", (" << a1.a0 << ", " << a1.a1 << ", " << a1.a2 << ", " << a1.a3
22731 << ", " << a1.a4 << "), " << a2 << ")" << "\n";
22732
22733 double result = 0;
22734
22735 result += a0;
22736 result += a1.a0;
22737 result += a1.a1;
22738 result += a1.a2;
22739 result += a1.a3;
22740 result += a1.a4;
22741 result += a2;
22742
22743 std::cout << "result = " << result << "\n";
22744
22745 return result;
22746}

◆ VariadicAt1Doublex2()

DART_EXPORT double dart::VariadicAt1Doublex2 ( double  a0,
  ... 
)

Definition at line 22409 of file ffi_test_functions_generated.cc.

22409 {
22410 va_list var_args;
22411 va_start(var_args, a0);
22412 double a1 = va_arg(var_args, double);
22413 va_end(var_args);
22414
22415 std::cout << "VariadicAt1Doublex2" << "(" << a0 << ", " << a1 << ")" << "\n";
22416
22417 double result = 0;
22418
22419 result += a0;
22420 result += a1;
22421
22422 std::cout << "result = " << result << "\n";
22423
22424 return result;
22425}

◆ VariadicAt1Doublex20()

DART_EXPORT double dart::VariadicAt1Doublex20 ( double  a0,
  ... 
)

Definition at line 22543 of file ffi_test_functions_generated.cc.

22543 {
22544 va_list var_args;
22545 va_start(var_args, a0);
22546 double a1 = va_arg(var_args, double);
22547 double a2 = va_arg(var_args, double);
22548 double a3 = va_arg(var_args, double);
22549 double a4 = va_arg(var_args, double);
22550 double a5 = va_arg(var_args, double);
22551 double a6 = va_arg(var_args, double);
22552 double a7 = va_arg(var_args, double);
22553 double a8 = va_arg(var_args, double);
22554 double a9 = va_arg(var_args, double);
22555 double a10 = va_arg(var_args, double);
22556 double a11 = va_arg(var_args, double);
22557 double a12 = va_arg(var_args, double);
22558 double a13 = va_arg(var_args, double);
22559 double a14 = va_arg(var_args, double);
22560 double a15 = va_arg(var_args, double);
22561 double a16 = va_arg(var_args, double);
22562 double a17 = va_arg(var_args, double);
22563 double a18 = va_arg(var_args, double);
22564 double a19 = va_arg(var_args, double);
22565 va_end(var_args);
22566
22567 std::cout << "VariadicAt1Doublex20" << "(" << a0 << ", " << a1 << ", " << a2
22568 << ", " << a3 << ", " << a4 << ", " << a5 << ", " << a6 << ", "
22569 << a7 << ", " << a8 << ", " << a9 << ", " << a10 << ", " << a11
22570 << ", " << a12 << ", " << a13 << ", " << a14 << ", " << a15 << ", "
22571 << a16 << ", " << a17 << ", " << a18 << ", " << a19 << ")" << "\n";
22572
22573 double result = 0;
22574
22575 result += a0;
22576 result += a1;
22577 result += a2;
22578 result += a3;
22579 result += a4;
22580 result += a5;
22581 result += a6;
22582 result += a7;
22583 result += a8;
22584 result += a9;
22585 result += a10;
22586 result += a11;
22587 result += a12;
22588 result += a13;
22589 result += a14;
22590 result += a15;
22591 result += a16;
22592 result += a17;
22593 result += a18;
22594 result += a19;
22595
22596 std::cout << "result = " << result << "\n";
22597
22598 return result;
22599}

◆ VariadicAt1Doublex2Struct32BytesHomogeneousDoubleD()

DART_EXPORT double dart::VariadicAt1Doublex2Struct32BytesHomogeneousDoubleD ( double  a0,
  ... 
)

Definition at line 22631 of file ffi_test_functions_generated.cc.

22632 {
22633 va_list var_args;
22634 va_start(var_args, a0);
22635 double a1 = va_arg(var_args, double);
22637 va_arg(var_args, Struct32BytesHomogeneousDouble);
22638 double a3 = va_arg(var_args, double);
22639 va_end(var_args);
22640
22641 std::cout << "VariadicAt1Doublex2Struct32BytesHomogeneousDoubleD" << "(" << a0
22642 << ", " << a1 << ", (" << a2.a0 << ", " << a2.a1 << ", " << a2.a2
22643 << ", " << a2.a3 << "), " << a3 << ")" << "\n";
22644
22645 double result = 0;
22646
22647 result += a0;
22648 result += a1;
22649 result += a2.a0;
22650 result += a2.a1;
22651 result += a2.a2;
22652 result += a2.a3;
22653 result += a3;
22654
22655 std::cout << "result = " << result << "\n";
22656
22657 return result;
22658}

◆ VariadicAt1Doublex5()

DART_EXPORT double dart::VariadicAt1Doublex5 ( double  a0,
  ... 
)

Definition at line 22456 of file ffi_test_functions_generated.cc.

22456 {
22457 va_list var_args;
22458 va_start(var_args, a0);
22459 double a1 = va_arg(var_args, double);
22460 double a2 = va_arg(var_args, double);
22461 double a3 = va_arg(var_args, double);
22462 double a4 = va_arg(var_args, double);
22463 va_end(var_args);
22464
22465 std::cout << "VariadicAt1Doublex5" << "(" << a0 << ", " << a1 << ", " << a2
22466 << ", " << a3 << ", " << a4 << ")" << "\n";
22467
22468 double result = 0;
22469
22470 result += a0;
22471 result += a1;
22472 result += a2;
22473 result += a3;
22474 result += a4;
22475
22476 std::cout << "result = " << result << "\n";
22477
22478 return result;
22479}

◆ VariadicAt1Int32Struct20BytesHomogeneousInt32Int32()

DART_EXPORT int32_t dart::VariadicAt1Int32Struct20BytesHomogeneousInt32Int32 ( int32_t  a0,
  ... 
)

Definition at line 22691 of file ffi_test_functions_generated.cc.

22691 {
22692 va_list var_args;
22693 va_start(var_args, a0);
22695 va_arg(var_args, Struct20BytesHomogeneousInt32);
22696 int32_t a2 = va_arg(var_args, int32_t);
22697 va_end(var_args);
22698
22699 std::cout << "VariadicAt1Int32Struct20BytesHomogeneousInt32Int32" << "(" << a0
22700 << ", (" << a1.a0 << ", " << a1.a1 << ", " << a1.a2 << ", " << a1.a3
22701 << ", " << a1.a4 << "), " << a2 << ")" << "\n";
22702
22703 int32_t result = 0;
22704
22705 result += a0;
22706 result += a1.a0;
22707 result += a1.a1;
22708 result += a1.a2;
22709 result += a1.a3;
22710 result += a1.a4;
22711 result += a2;
22712
22713 std::cout << "result = " << result << "\n";
22714
22715 return result;
22716}

◆ VariadicAt1Int64Int32Struct12BytesHomogeneousFloat()

DART_EXPORT double dart::VariadicAt1Int64Int32Struct12BytesHomogeneousFloat ( int64_t  a0,
  ... 
)

Definition at line 22803 of file ffi_test_functions_generated.cc.

22805 {
22806 va_list var_args;
22807 va_start(var_args, a0);
22808 int32_t a1 = va_arg(var_args, int32_t);
22810 va_arg(var_args, Struct12BytesHomogeneousFloat);
22811 va_end(var_args);
22812
22813 std::cout << "VariadicAt1Int64Int32Struct12BytesHomogeneousFloat" << "(" << a0
22814 << ", " << a1 << ", (" << a2.a0 << ", " << a2.a1 << ", " << a2.a2
22815 << "))" << "\n";
22816
22817 double result = 0;
22818
22819 result += a0;
22820 result += a1;
22821 result += a2.a0;
22822 result += a2.a1;
22823 result += a2.a2;
22824
22825 std::cout << "result = " << result << "\n";
22826
22827 return result;
22828}

◆ VariadicAt1Int64x2()

DART_EXPORT int64_t dart::VariadicAt1Int64x2 ( int64_t  a0,
  ... 
)

Definition at line 22389 of file ffi_test_functions_generated.cc.

22389 {
22390 va_list var_args;
22391 va_start(var_args, a0);
22392 int64_t a1 = va_arg(var_args, int64_t);
22393 va_end(var_args);
22394
22395 std::cout << "VariadicAt1Int64x2" << "(" << a0 << ", " << a1 << ")" << "\n";
22396
22397 int64_t result = 0;
22398
22399 result += a0;
22400 result += a1;
22401
22402 std::cout << "result = " << result << "\n";
22403
22404 return result;
22405}

◆ VariadicAt1Int64x20()

DART_EXPORT int64_t dart::VariadicAt1Int64x20 ( int64_t  a0,
  ... 
)

Definition at line 22483 of file ffi_test_functions_generated.cc.

22483 {
22484 va_list var_args;
22485 va_start(var_args, a0);
22486 int64_t a1 = va_arg(var_args, int64_t);
22487 int64_t a2 = va_arg(var_args, int64_t);
22488 int64_t a3 = va_arg(var_args, int64_t);
22489 int64_t a4 = va_arg(var_args, int64_t);
22490 int64_t a5 = va_arg(var_args, int64_t);
22491 int64_t a6 = va_arg(var_args, int64_t);
22492 int64_t a7 = va_arg(var_args, int64_t);
22493 int64_t a8 = va_arg(var_args, int64_t);
22494 int64_t a9 = va_arg(var_args, int64_t);
22495 int64_t a10 = va_arg(var_args, int64_t);
22496 int64_t a11 = va_arg(var_args, int64_t);
22497 int64_t a12 = va_arg(var_args, int64_t);
22498 int64_t a13 = va_arg(var_args, int64_t);
22499 int64_t a14 = va_arg(var_args, int64_t);
22500 int64_t a15 = va_arg(var_args, int64_t);
22501 int64_t a16 = va_arg(var_args, int64_t);
22502 int64_t a17 = va_arg(var_args, int64_t);
22503 int64_t a18 = va_arg(var_args, int64_t);
22504 int64_t a19 = va_arg(var_args, int64_t);
22505 va_end(var_args);
22506
22507 std::cout << "VariadicAt1Int64x20" << "(" << a0 << ", " << a1 << ", " << a2
22508 << ", " << a3 << ", " << a4 << ", " << a5 << ", " << a6 << ", "
22509 << a7 << ", " << a8 << ", " << a9 << ", " << a10 << ", " << a11
22510 << ", " << a12 << ", " << a13 << ", " << a14 << ", " << a15 << ", "
22511 << a16 << ", " << a17 << ", " << a18 << ", " << a19 << ")" << "\n";
22512
22513 int64_t result = 0;
22514
22515 result += a0;
22516 result += a1;
22517 result += a2;
22518 result += a3;
22519 result += a4;
22520 result += a5;
22521 result += a6;
22522 result += a7;
22523 result += a8;
22524 result += a9;
22525 result += a10;
22526 result += a11;
22527 result += a12;
22528 result += a13;
22529 result += a14;
22530 result += a15;
22531 result += a16;
22532 result += a17;
22533 result += a18;
22534 result += a19;
22535
22536 std::cout << "result = " << result << "\n";
22537
22538 return result;
22539}

◆ VariadicAt1Int64x2Struct8BytesIntInt64()

DART_EXPORT int64_t dart::VariadicAt1Int64x2Struct8BytesIntInt64 ( int64_t  a0,
  ... 
)

Definition at line 22603 of file ffi_test_functions_generated.cc.

22603 {
22604 va_list var_args;
22605 va_start(var_args, a0);
22606 int64_t a1 = va_arg(var_args, int64_t);
22607 Struct8BytesInt a2 = va_arg(var_args, Struct8BytesInt);
22608 int64_t a3 = va_arg(var_args, int64_t);
22609 va_end(var_args);
22610
22611 std::cout << "VariadicAt1Int64x2Struct8BytesIntInt64" << "(" << a0 << ", "
22612 << a1 << ", (" << a2.a0 << ", " << a2.a1 << ", " << a2.a2 << "), "
22613 << a3 << ")" << "\n";
22614
22615 int64_t result = 0;
22616
22617 result += a0;
22618 result += a1;
22619 result += a2.a0;
22620 result += a2.a1;
22621 result += a2.a2;
22622 result += a3;
22623
22624 std::cout << "result = " << result << "\n";
22625
22626 return result;
22627}

◆ VariadicAt1Int64x5()

DART_EXPORT int64_t dart::VariadicAt1Int64x5 ( int64_t  a0,
  ... 
)

Definition at line 22429 of file ffi_test_functions_generated.cc.

22429 {
22430 va_list var_args;
22431 va_start(var_args, a0);
22432 int64_t a1 = va_arg(var_args, int64_t);
22433 int64_t a2 = va_arg(var_args, int64_t);
22434 int64_t a3 = va_arg(var_args, int64_t);
22435 int64_t a4 = va_arg(var_args, int64_t);
22436 va_end(var_args);
22437
22438 std::cout << "VariadicAt1Int64x5" << "(" << a0 << ", " << a1 << ", " << a2
22439 << ", " << a3 << ", " << a4 << ")" << "\n";
22440
22441 int64_t result = 0;
22442
22443 result += a0;
22444 result += a1;
22445 result += a2;
22446 result += a3;
22447 result += a4;
22448
22449 std::cout << "result = " << result << "\n";
22450
22451 return result;
22452}

◆ VariadicAt1Int64x7Struct12BytesHomogeneousInt32()

DART_EXPORT int64_t dart::VariadicAt1Int64x7Struct12BytesHomogeneousInt32 ( int64_t  a0,
  ... 
)

Definition at line 22962 of file ffi_test_functions_generated.cc.

22963 {
22964 va_list var_args;
22965 va_start(var_args, a0);
22966 int64_t a1 = va_arg(var_args, int64_t);
22967 int64_t a2 = va_arg(var_args, int64_t);
22968 int64_t a3 = va_arg(var_args, int64_t);
22969 int64_t a4 = va_arg(var_args, int64_t);
22970 int64_t a5 = va_arg(var_args, int64_t);
22971 int64_t a6 = va_arg(var_args, int64_t);
22973 va_arg(var_args, Struct12BytesHomogeneousInt32);
22974 va_end(var_args);
22975
22976 std::cout << "VariadicAt1Int64x7Struct12BytesHomogeneousInt32" << "(" << a0
22977 << ", " << a1 << ", " << a2 << ", " << a3 << ", " << a4 << ", "
22978 << a5 << ", " << a6 << ", (" << a7.a0 << ", " << a7.a1 << ", "
22979 << a7.a2 << "))" << "\n";
22980
22981 int64_t result = 0;
22982
22983 result += a0;
22984 result += a1;
22985 result += a2;
22986 result += a3;
22987 result += a4;
22988 result += a5;
22989 result += a6;
22990 result += a7.a0;
22991 result += a7.a1;
22992 result += a7.a2;
22993
22994 std::cout << "result = " << result << "\n";
22995
22996 return result;
22997}

◆ VariadicAt1Struct12BytesHomogeneousInt32Int32x4()

DART_EXPORT int32_t dart::VariadicAt1Struct12BytesHomogeneousInt32Int32x4 ( Struct12BytesHomogeneousInt32  a0,
  ... 
)

Definition at line 23001 of file ffi_test_functions_generated.cc.

23003 {
23004 va_list var_args;
23005 va_start(var_args, a0);
23006 int32_t a1 = va_arg(var_args, int32_t);
23007 int32_t a2 = va_arg(var_args, int32_t);
23008 int32_t a3 = va_arg(var_args, int32_t);
23009 int32_t a4 = va_arg(var_args, int32_t);
23010 va_end(var_args);
23011
23012 std::cout << "VariadicAt1Struct12BytesHomogeneousInt32Int32x4" << "(("
23013 << a0.a0 << ", " << a0.a1 << ", " << a0.a2 << "), " << a1 << ", "
23014 << a2 << ", " << a3 << ", " << a4 << ")" << "\n";
23015
23016 int32_t result = 0;
23017
23018 result += a0.a0;
23019 result += a0.a1;
23020 result += a0.a2;
23021 result += a1;
23022 result += a2;
23023 result += a3;
23024 result += a4;
23025
23026 std::cout << "result = " << result << "\n";
23027
23028 return result;
23029}

◆ VariadicAt2Int32Int64IntPtr()

DART_EXPORT int32_t dart::VariadicAt2Int32Int64IntPtr ( int32_t  a0,
int64_t  a1,
  ... 
)

Definition at line 22751 of file ffi_test_functions_generated.cc.

22751 {
22752 va_list var_args;
22753 va_start(var_args, a1);
22754 intptr_t a2 = va_arg(var_args, intptr_t);
22755 va_end(var_args);
22756
22757 std::cout << "VariadicAt2Int32Int64IntPtr" << "(" << a0 << ", " << a1 << ", "
22758 << a2 << ")" << "\n";
22759
22760 int32_t result = 0;
22761
22762 result += a0;
22763 result += a1;
22764 result += a2;
22765
22766 std::cout << "result = " << result << "\n";
22767
22768 return result;
22769}

◆ VariadicAt5Doublex5()

DART_EXPORT double dart::VariadicAt5Doublex5 ( double  a0,
double  a1,
double  a2,
double  a3,
double  a4,
  ... 
)

Definition at line 22933 of file ffi_test_functions_generated.cc.

22938 {
22939 va_list var_args;
22940 va_start(var_args, a4);
22941
22942 va_end(var_args);
22943
22944 std::cout << "VariadicAt5Doublex5" << "(" << a0 << ", " << a1 << ", " << a2
22945 << ", " << a3 << ", " << a4 << ")" << "\n";
22946
22947 double result = 0;
22948
22949 result += a0;
22950 result += a1;
22951 result += a2;
22952 result += a3;
22953 result += a4;
22954
22955 std::cout << "result = " << result << "\n";
22956
22957 return result;
22958}

◆ VariadicStructVarArgs()

DART_EXPORT int64_t dart::VariadicStructVarArgs ( VarArgs  a0,
  ... 
)

Definition at line 1267 of file ffi_test_functions.cc.

1267 {
1268 va_list var_args;
1269 va_start(var_args, a0);
1270 VarArgs a1 = va_arg(var_args, VarArgs);
1271 va_end(var_args);
1272
1273 std::cout << "VariadicStructVarArgs" << "(" << a0.a << ", " << a1.a << ")"
1274 << "\n";
1275
1276 int64_t result = 0;
1277
1278 result += a0.a;
1279 result += a1.a;
1280
1281 std::cout << "result = " << result << "\n";
1282
1283 return result;
1284}

◆ VerifyEntryPoint()

DART_WARN_UNUSED_RESULT ErrorPtr dart::VerifyEntryPoint ( const Library lib,
const Object member,
const Object annotated,
std::initializer_list< EntryPointPragma allowed_kinds 
)

Definition at line 27227 of file object.cc.

27231 {
27232#if defined(DART_PRECOMPILED_RUNTIME)
27233 // Annotations are discarded in the AOT snapshot, so we can't determine
27234 // precisely if this member was marked as an entry-point. Instead, we use
27235 // "has_pragma()" as a proxy, since that bit is usually retained.
27236 bool is_marked_entrypoint = true;
27237 if (annotated.IsClass() && !Class::Cast(annotated).has_pragma()) {
27238 is_marked_entrypoint = false;
27239 } else if (annotated.IsField() && !Field::Cast(annotated).has_pragma()) {
27240 is_marked_entrypoint = false;
27241 } else if (annotated.IsFunction() &&
27242 !Function::Cast(annotated).has_pragma()) {
27243 is_marked_entrypoint = false;
27244 }
27245#else
27246 Object& metadata = Object::Handle(Object::empty_array().ptr());
27247 if (!annotated.IsNull()) {
27248 metadata = lib.GetMetadata(annotated);
27249 }
27250 if (metadata.IsError()) return Error::RawCast(metadata.ptr());
27251 ASSERT(!metadata.IsNull() && metadata.IsArray());
27252 EntryPointPragma pragma =
27253 FindEntryPointPragma(IsolateGroup::Current(), Array::Cast(metadata),
27254 &Field::Handle(), &Object::Handle());
27255 bool is_marked_entrypoint = pragma == EntryPointPragma::kAlways;
27256 if (!is_marked_entrypoint) {
27257 for (const auto allowed_kind : allowed_kinds) {
27258 if (pragma == allowed_kind) {
27259 is_marked_entrypoint = true;
27260 break;
27261 }
27262 }
27263 }
27264#endif
27265 if (!is_marked_entrypoint) {
27266 return EntryPointMemberInvocationError(member);
27267 }
27268 return Error::null();
27269}
DART_WARN_UNUSED_RESULT ErrorPtr EntryPointMemberInvocationError(const Object &member)
Definition object.cc:27288
EntryPointPragma FindEntryPointPragma(IsolateGroup *IG, const Array &metadata, Field *reusable_field_handle, Object *pragma)
Definition object.cc:27193
EntryPointPragma
Definition object.h:4344

◆ VerifyMethodKindShifts()

static void dart::VerifyMethodKindShifts ( )
static

Definition at line 584 of file mirrors.cc.

584 {
585#ifdef DEBUG
586 Thread* thread = Thread::Current();
587 Zone* zone = thread->zone();
588 const Library& lib = Library::Handle(zone, Library::MirrorsLibrary());
589 const Class& cls = Class::Handle(
590 zone, lib.LookupClassAllowPrivate(Symbols::_MethodMirror()));
591 Error& error = Error::Handle(zone);
592 error ^= cls.EnsureIsFinalized(thread);
593 ASSERT(error.IsNull());
594
595 Field& field = Field::Handle(zone);
596 Smi& value = Smi::Handle(zone);
597 String& fname = String::Handle(zone);
598
599#define CHECK_KIND_SHIFT(name) \
600 fname ^= String::New(#name); \
601 field = cls.LookupField(fname); \
602 ASSERT(!field.IsNull()); \
603 if (field.IsUninitialized()) { \
604 error ^= field.InitializeStatic(); \
605 ASSERT(error.IsNull()); \
606 } \
607 value ^= field.StaticValue(); \
608 ASSERT(value.Value() == Mirrors::name);
609 MIRRORS_KIND_SHIFT_LIST(CHECK_KIND_SHIFT)
610#undef CHECK_KIND_SHIFT
611#endif
612}
#define MIRRORS_KIND_SHIFT_LIST(V)
Definition mirrors.h:14

◆ VerifyStackOverflowStackTraceInfo()

void dart::VerifyStackOverflowStackTraceInfo ( const char *  script,
const char *  top_frame_func_name,
const char *  entry_func_name,
int  expected_line_number,
int  expected_column_number 
)

Definition at line 396 of file dart_api_impl_test.cc.

400 {
401 Dart_Handle lib = TestCase::LoadTestScript(script, nullptr);
402 Dart_Handle error = Dart_Invoke(lib, NewString(entry_func_name), 0, nullptr);
403
405
406 Dart_StackTrace stacktrace;
409
410 intptr_t frame_count = 0;
411 result = Dart_StackTraceLength(stacktrace, &frame_count);
413 EXPECT_EQ(StackTrace::kPreallocatedStackdepth - 1, frame_count);
414
416 Dart_Handle script_url;
417 intptr_t line_number = 0;
418 intptr_t column_number = 0;
419 const char* cstr = "";
420
421 // Top frame at recursive call.
423 result = Dart_GetActivationFrame(stacktrace, 0, &frame);
425 result = Dart_ActivationFrameInfo(frame, &function_name, &script_url,
426 &line_number, &column_number);
428 Dart_StringToCString(function_name, &cstr);
429 EXPECT_STREQ(top_frame_func_name, cstr);
430 Dart_StringToCString(script_url, &cstr);
431 EXPECT_STREQ(TestCase::url(), cstr);
432 EXPECT_EQ(expected_line_number, line_number);
433 EXPECT_EQ(expected_column_number, column_number);
434
435 // Out-of-bounds frames.
436 result = Dart_GetActivationFrame(stacktrace, frame_count, &frame);
438 result = Dart_GetActivationFrame(stacktrace, -1, &frame);
440}

◆ VerifyStringMapsEqual()

template<typename Map >
void dart::VerifyStringMapsEqual ( const std::map< std::string, int > &  expected,
const Map actual,
bool  ordered 
)

Definition at line 159 of file hash_table_test.cc.

161 {
162 intptr_t expected_size = expected.size();
163 // Get actual concatenated (key, value) pairs in iteration order.
164 Array& entries = Array::Handle(HashTables::ToArray(actual, true));
165 // Cardinality must match.
166 EXPECT_EQ(expected_size * 2, entries.Length());
167 std::vector<std::pair<std::string, int> > expected_vec(expected.begin(),
168 expected.end());
169 // Check containment.
170 Smi& value = Smi::Handle();
171 for (uintptr_t i = 0; i < expected_vec.size(); ++i) {
172 std::string key = expected_vec[i].first;
173 EXPECT(actual.ContainsKey(key.c_str()));
174 value ^= actual.GetOrNull(key.c_str());
175 EXPECT_EQ(expected_vec[i].second, value.Value());
176 }
177 if (!ordered) {
178 return;
179 }
180 // Equality including order.
181 std::vector<std::string> actual_vec;
182 String& key = String::Handle();
183 for (int i = 0; i < expected_size; ++i) {
184 key ^= entries.At(2 * i);
185 value ^= entries.At(2 * i + 1);
186 EXPECT(expected_vec[i].first == ToStdString(key));
187 EXPECT_EQ(expected_vec[i].second, value.Value());
188 }
189}
std::string ToStdString(const String &str)

◆ VerifyStringSetsEqual()

template<typename Set >
void dart::VerifyStringSetsEqual ( const std::set< std::string > &  expected,
const Set actual,
bool  ordered 
)

Definition at line 129 of file hash_table_test.cc.

131 {
132 // Get actual keys in iteration order.
133 Array& keys = Array::Handle(HashTables::ToArray(actual, true));
134 // Cardinality must match.
135 EXPECT_EQ(static_cast<intptr_t>(expected.size()), keys.Length());
136 std::vector<std::string> expected_vec(expected.begin(), expected.end());
137 // Check containment.
138 for (uintptr_t i = 0; i < expected_vec.size(); ++i) {
139 EXPECT(actual.ContainsKey(expected_vec[i].c_str()));
140 }
141 // Equality, including order, if requested.
142 std::vector<std::string> actual_vec;
143 String& key = String::Handle();
144 for (int i = 0; i < keys.Length(); ++i) {
145 key ^= keys.At(i);
146 actual_vec.push_back(ToStdString(key));
147 }
148 if (!ordered) {
149 std::sort(actual_vec.begin(), actual_vec.end());
150 }
151 EXPECT(
152 std::equal(actual_vec.begin(), actual_vec.end(), expected_vec.begin()));
153}

◆ VisitSamples()

static void dart::VisitSamples ( SampleBlockBuffer buffer,
SampleVisitor visitor 
)
static

Definition at line 83 of file profiler_test.cc.

83 {
84 visitor->Reset();
85 buffer->VisitSamples(visitor);
86}
virtual void Reset()
Definition profiler.h:130

◆ VM_UNIT_TEST_CASE() [1/107]

dart::VM_UNIT_TEST_CASE ( AllocateAlignedVirtualMemory  )

Definition at line 54 of file virtual_memory_test.cc.

54 {
55 intptr_t kHeapPageSize = kPageSize;
56 intptr_t kVirtualPageSize = 4096;
57
58 intptr_t kIterations = kHeapPageSize / kVirtualPageSize;
59 for (intptr_t i = 0; i < kIterations; i++) {
60 VirtualMemory* vm = VirtualMemory::AllocateAligned(
61 kHeapPageSize, kHeapPageSize, false, false, "test");
62 EXPECT(Utils::IsAligned(vm->start(), kHeapPageSize));
63 EXPECT_EQ(kHeapPageSize, vm->size());
64 delete vm;
65 }
66}

◆ VM_UNIT_TEST_CASE() [2/107]

dart::VM_UNIT_TEST_CASE ( AllocateVirtualMemory  )

Definition at line 22 of file virtual_memory_test.cc.

22 {
23 const intptr_t kVirtualMemoryBlockSize = 64 * KB;
24 VirtualMemory* vm =
25 VirtualMemory::Allocate(kVirtualMemoryBlockSize, false, false, "test");
26 EXPECT(vm != nullptr);
27 EXPECT(vm->address() != nullptr);
28 EXPECT_EQ(vm->start(), reinterpret_cast<uword>(vm->address()));
29 EXPECT_EQ(kVirtualMemoryBlockSize, vm->size());
30 EXPECT_EQ(vm->start() + kVirtualMemoryBlockSize, vm->end());
31 EXPECT(vm->Contains(vm->start()));
32 EXPECT(vm->Contains(vm->start() + 1));
33 EXPECT(vm->Contains(vm->start() + kVirtualMemoryBlockSize - 1));
34 EXPECT(vm->Contains(vm->start() + (kVirtualMemoryBlockSize / 2)));
35 EXPECT(!vm->Contains(vm->start() - 1));
36 EXPECT(!vm->Contains(vm->end()));
37 EXPECT(!vm->Contains(vm->end() + 1));
38 EXPECT(!vm->Contains(0));
39 EXPECT(!vm->Contains(static_cast<uword>(-1)));
40
41 char* buf = reinterpret_cast<char*>(vm->address());
42 EXPECT(IsZero(buf, buf + vm->size()));
43 buf[0] = 'a';
44 buf[1] = 'c';
45 buf[2] = '/';
46 buf[3] = 'd';
47 buf[4] = 'c';
48 buf[5] = 0;
49 EXPECT_STREQ("ac/dc", buf);
50
51 delete vm;
52}
bool Contains(uword addr) const
void * address() const
bool IsZero(char *begin, char *end)

◆ VM_UNIT_TEST_CASE() [3/107]

dart::VM_UNIT_TEST_CASE ( AllocateZone  )

Definition at line 15 of file zone_test.cc.

15 {
16#if defined(DEBUG)
17 FLAG_trace_zones = true;
18#endif
19 TestCase::CreateTestIsolate();
20 Thread* thread = Thread::Current();
21 EXPECT(thread->zone() == nullptr);
22 {
23 TransitionNativeToVM transition(thread);
24 StackZone stack_zone(thread);
25 EXPECT(thread->zone() != nullptr);
26 Zone* zone = stack_zone.GetZone();
27 uintptr_t allocated_size = 0;
28
29 // The loop is to make sure we overflow one segment and go on
30 // to the next segment.
31 for (int i = 0; i < 1000; i++) {
32 uword first = zone->AllocUnsafe(2 * kWordSize);
33 uword second = zone->AllocUnsafe(3 * kWordSize);
34 EXPECT(first != second);
35 allocated_size = ((2 + 3) * kWordSize);
36 }
37 EXPECT_LE(allocated_size, zone->SizeInBytes());
38
39 // Test for allocation of large segments.
40 const uword kLargeSize = 1 * MB;
41 const uword kSegmentSize = 64 * KB;
42 ASSERT(kLargeSize > kSegmentSize);
43 for (int i = 0; i < 10; i++) {
44 EXPECT(zone->AllocUnsafe(kLargeSize) != 0);
45 allocated_size += kLargeSize;
46 }
47 EXPECT_LE(allocated_size, zone->SizeInBytes());
48
49 // Test corner cases of kSegmentSize.
50 uint8_t* buffer = nullptr;
51 buffer =
52 reinterpret_cast<uint8_t*>(zone->AllocUnsafe(kSegmentSize - kWordSize));
53 EXPECT(buffer != nullptr);
54 buffer[(kSegmentSize - kWordSize) - 1] = 0;
55 allocated_size += (kSegmentSize - kWordSize);
56 EXPECT_LE(allocated_size, zone->SizeInBytes());
57
58 buffer = reinterpret_cast<uint8_t*>(
59 zone->AllocUnsafe(kSegmentSize - (2 * kWordSize)));
60 EXPECT(buffer != nullptr);
61 buffer[(kSegmentSize - (2 * kWordSize)) - 1] = 0;
62 allocated_size += (kSegmentSize - (2 * kWordSize));
63 EXPECT_LE(allocated_size, zone->SizeInBytes());
64
65 buffer =
66 reinterpret_cast<uint8_t*>(zone->AllocUnsafe(kSegmentSize + kWordSize));
67 EXPECT(buffer != nullptr);
68 buffer[(kSegmentSize + kWordSize) - 1] = 0;
69 allocated_size += (kSegmentSize + kWordSize);
70 EXPECT_LE(allocated_size, zone->SizeInBytes());
71 }
72 EXPECT(thread->zone() == nullptr);
74}
uintptr_t SizeInBytes() const
Definition zone.cc:182

◆ VM_UNIT_TEST_CASE() [4/107]

dart::VM_UNIT_TEST_CASE ( AllocGeneric_Success  )

Definition at line 76 of file zone_test.cc.

76 {
77#if defined(DEBUG)
78 FLAG_trace_zones = true;
79#endif
80 TestCase::CreateTestIsolate();
81 Thread* thread = Thread::Current();
82 EXPECT(thread->zone() == nullptr);
83 {
84 TransitionNativeToVM transition(thread);
85 StackZone zone(thread);
86 EXPECT(thread->zone() != nullptr);
87 uintptr_t allocated_size = 0;
88
89 const intptr_t kNumElements = 1000;
90 zone.GetZone()->Alloc<uint32_t>(kNumElements);
91 allocated_size += sizeof(uint32_t) * kNumElements;
92 EXPECT_LE(allocated_size, zone.SizeInBytes());
93 }
94 EXPECT(thread->zone() == nullptr);
96}

◆ VM_UNIT_TEST_CASE() [5/107]

dart::VM_UNIT_TEST_CASE ( BasicFlags  )

Definition at line 16 of file flags_test.cc.

16 {
17 EXPECT_EQ(true, FLAG_basic_flag);
18 EXPECT_EQ(false, FLAG_verbose_gc);
19 EXPECT_EQ(false, FLAG_print_flags);
20}

◆ VM_UNIT_TEST_CASE() [6/107]

dart::VM_UNIT_TEST_CASE ( BitFields  )

Definition at line 13 of file bitfield_test.cc.

13 {
14 class TestBitFields : public BitField<uword, int32_t, 1, 8> {};
15 EXPECT(TestBitFields::is_valid(16));
16 EXPECT(!TestBitFields::is_valid(256));
17 EXPECT_EQ(0x00ffU, TestBitFields::mask());
18 EXPECT_EQ(0x001feU, TestBitFields::mask_in_place());
19 EXPECT_EQ(1, TestBitFields::shift());
20 EXPECT_EQ(8, TestBitFields::bitsize());
21 EXPECT_EQ(32U, TestBitFields::encode(16));
22 EXPECT_EQ(16, TestBitFields::decode(32));
23 EXPECT_EQ(2U, TestBitFields::update(1, 16));
24}

◆ VM_UNIT_TEST_CASE() [7/107]

dart::VM_UNIT_TEST_CASE ( BitFields_SignedField  )

Definition at line 68 of file bitfield_test.cc.

68 {
69 TestSignExtendedBitField<uint32_t>();
70 TestSignExtendedBitField<int32_t>();
71}

◆ VM_UNIT_TEST_CASE() [8/107]

dart::VM_UNIT_TEST_CASE ( BoolField  )

Definition at line 12 of file boolfield_test.cc.

12 {
13 class TestBoolField : public BoolField<1> {};
14 EXPECT(TestBoolField::decode(2));
15 EXPECT(!TestBoolField::decode(1));
16 EXPECT_EQ(2U, TestBoolField::encode(true));
17 EXPECT_EQ(0U, TestBoolField::encode(false));
18 EXPECT_EQ(3U, TestBoolField::update(true, 1));
19 EXPECT_EQ(1U, TestBoolField::update(false, 1));
20}

◆ VM_UNIT_TEST_CASE() [9/107]

dart::VM_UNIT_TEST_CASE ( CleanupBequestNeverReceived  )

Definition at line 537 of file heap_test.cc.

537 {
538 const char* TEST_MESSAGE = "hello, world";
539 Dart_Isolate parent = TestCase::CreateTestIsolate("parent");
540 EXPECT_EQ(parent, Dart_CurrentIsolate());
541 {
542 SendAndExitMessagesHandler handler(Isolate::Current());
543 Dart_Port port_id = PortMap::CreatePort(&handler);
544 EXPECT_EQ(PortMap::GetIsolate(port_id), Isolate::Current());
546
547 Dart_Isolate worker = TestCase::CreateTestIsolateInGroup("worker", parent);
548 EXPECT_EQ(worker, Dart_CurrentIsolate());
549 {
550 Thread* thread = Thread::Current();
551 TransitionNativeToVM transition(thread);
552 StackZone zone(thread);
553
554 String& string = String::Handle(String::New(TEST_MESSAGE));
555 PersistentHandle* handle =
556 Isolate::Current()->group()->api_state()->AllocatePersistentHandle();
557 handle->set_ptr(string.ptr());
558
559 reinterpret_cast<Isolate*>(worker)->bequeath(
560 std::unique_ptr<Bequest>(new Bequest(handle, port_id)));
561 }
562 }
564 Dart_EnterIsolate(parent);
566}

◆ VM_UNIT_TEST_CASE() [10/107]

dart::VM_UNIT_TEST_CASE ( CountLeadingZeros32  )

Definition at line 220 of file utils_test.cc.

220 {
221 EXPECT_EQ(32, Utils::CountLeadingZeros32(0x0));
222 EXPECT_EQ(31, Utils::CountLeadingZeros32(0x1));
223 EXPECT_EQ(4, Utils::CountLeadingZeros32(0x0F0F0000));
224 EXPECT_EQ(1, Utils::CountLeadingZeros32(0x7FFFFFFF));
225 EXPECT_EQ(0, Utils::CountLeadingZeros32(0xFFFFFFFF));
226}

◆ VM_UNIT_TEST_CASE() [11/107]

dart::VM_UNIT_TEST_CASE ( CountLeadingZeros64  )

Definition at line 228 of file utils_test.cc.

228 {
229 EXPECT_EQ(64, Utils::CountLeadingZeros64(0x0));
230 EXPECT_EQ(63, Utils::CountLeadingZeros64(0x1));
231 EXPECT_EQ(4, Utils::CountLeadingZeros64(0x0F0F000000000000LLU));
232 EXPECT_EQ(1, Utils::CountLeadingZeros64(0x7FFFFFFFFFFFFFFFLLU));
233 EXPECT_EQ(0, Utils::CountLeadingZeros64(0xFFFFFFFFFFFFFFFFLLU));
234}

◆ VM_UNIT_TEST_CASE() [12/107]

dart::VM_UNIT_TEST_CASE ( CountOneBits32  )

Definition at line 160 of file utils_test.cc.

160 {
161 EXPECT_EQ(0, Utils::CountOneBits32(0));
162 EXPECT_EQ(1, Utils::CountOneBits32(0x00000010));
163 EXPECT_EQ(1, Utils::CountOneBits32(0x00010000));
164 EXPECT_EQ(1, Utils::CountOneBits32(0x10000000));
165 EXPECT_EQ(4, Utils::CountOneBits32(0x10101010));
166 EXPECT_EQ(8, Utils::CountOneBits32(0x03030303));
167 EXPECT_EQ(32, Utils::CountOneBits32(0xFFFFFFFF));
168}

◆ VM_UNIT_TEST_CASE() [13/107]

dart::VM_UNIT_TEST_CASE ( CountOneBits64  )

Definition at line 170 of file utils_test.cc.

170 {
171 EXPECT_EQ(0, Utils::CountOneBits64(DART_UINT64_C(0)));
172 EXPECT_EQ(1, Utils::CountOneBits64(DART_UINT64_C(0x00000010)));
173 EXPECT_EQ(1, Utils::CountOneBits64(DART_UINT64_C(0x00010000)));
174 EXPECT_EQ(1, Utils::CountOneBits64(DART_UINT64_C(0x10000000)));
175 EXPECT_EQ(4, Utils::CountOneBits64(DART_UINT64_C(0x10101010)));
176 EXPECT_EQ(8, Utils::CountOneBits64(DART_UINT64_C(0x03030303)));
177 EXPECT_EQ(32, Utils::CountOneBits64(DART_UINT64_C(0xFFFFFFFF)));
178 EXPECT_EQ(2, Utils::CountOneBits64(DART_UINT64_C(0x0000001000000010)));
179 EXPECT_EQ(2, Utils::CountOneBits64(DART_UINT64_C(0x0001000000010000)));
180 EXPECT_EQ(2, Utils::CountOneBits64(DART_UINT64_C(0x1000000010000000)));
181 EXPECT_EQ(8, Utils::CountOneBits64(DART_UINT64_C(0x1010101010101010)));
182 EXPECT_EQ(16, Utils::CountOneBits64(DART_UINT64_C(0x0303030303030303)));
183 EXPECT_EQ(64, Utils::CountOneBits64(DART_UINT64_C(0xFFFFFFFFFFFFFFFF)));
184}
#define DART_UINT64_C(x)
Definition globals.h:434

◆ VM_UNIT_TEST_CASE() [14/107]

dart::VM_UNIT_TEST_CASE ( CountOneBitsWord  )

Definition at line 186 of file utils_test.cc.

186 {
187 EXPECT_EQ(0, Utils::CountOneBitsWord(0));
188 EXPECT_EQ(1, Utils::CountOneBitsWord(0x00000010));
189 EXPECT_EQ(1, Utils::CountOneBitsWord(0x00010000));
190 EXPECT_EQ(1, Utils::CountOneBitsWord(0x10000000));
191 EXPECT_EQ(4, Utils::CountOneBitsWord(0x10101010));
192 EXPECT_EQ(8, Utils::CountOneBitsWord(0x03030303));
193 EXPECT_EQ(32, Utils::CountOneBitsWord(0xFFFFFFFF));
194#if defined(ARCH_IS_64_BIT)
195 EXPECT_EQ(2, Utils::CountOneBitsWord(0x0000001000000010));
196 EXPECT_EQ(2, Utils::CountOneBitsWord(0x0001000000010000));
197 EXPECT_EQ(2, Utils::CountOneBitsWord(0x1000000010000000));
198 EXPECT_EQ(8, Utils::CountOneBitsWord(0x1010101010101010));
199 EXPECT_EQ(16, Utils::CountOneBitsWord(0x0303030303030303));
200 EXPECT_EQ(64, Utils::CountOneBitsWord(0xFFFFFFFFFFFFFFFF));
201#endif
202}

◆ VM_UNIT_TEST_CASE() [15/107]

dart::VM_UNIT_TEST_CASE ( CountTrailingZeros32  )

Definition at line 204 of file utils_test.cc.

204 {
205 EXPECT_EQ(0, Utils::CountTrailingZeros32(0x1));
206 EXPECT_EQ(1, Utils::CountTrailingZeros32(0x2));
207 EXPECT_EQ(4, Utils::CountTrailingZeros32(0x0f0f0));
208 EXPECT_EQ(31, Utils::CountTrailingZeros32(0x80000000));
209 EXPECT_EQ(32, Utils::CountTrailingZeros32(0x0));
210}

◆ VM_UNIT_TEST_CASE() [16/107]

dart::VM_UNIT_TEST_CASE ( CountTrailingZeros64  )

Definition at line 212 of file utils_test.cc.

212 {
213 EXPECT_EQ(0, Utils::CountTrailingZeros64(0x1));
214 EXPECT_EQ(1, Utils::CountTrailingZeros64(0x2));
215 EXPECT_EQ(4, Utils::CountTrailingZeros64(0x0f0f0));
216 EXPECT_EQ(63, Utils::CountTrailingZeros64(0x8000000000000000LLU));
217 EXPECT_EQ(64, Utils::CountTrailingZeros64(0x0));
218}

◆ VM_UNIT_TEST_CASE() [17/107]

dart::VM_UNIT_TEST_CASE ( CountZerosWord  )

Definition at line 236 of file utils_test.cc.

236 {
237 EXPECT_EQ(kBitsPerWord, Utils::CountTrailingZerosWord(0x0));
238 EXPECT_EQ(kBitsPerWord, Utils::CountLeadingZerosWord(0x0));
239 EXPECT_EQ(0, Utils::CountTrailingZerosWord(0x1));
240 EXPECT_EQ(kBitsPerWord - 1, Utils::CountLeadingZerosWord(0x1));
241 EXPECT_EQ(1, Utils::CountTrailingZerosWord(0x2));
242 EXPECT_EQ(kBitsPerWord - 2, Utils::CountLeadingZerosWord(0x2));
243 EXPECT_EQ(0, Utils::CountTrailingZerosWord(0x3));
244 EXPECT_EQ(kBitsPerWord - 2, Utils::CountLeadingZerosWord(0x3));
245 EXPECT_EQ(2, Utils::CountTrailingZerosWord(0x4));
246 EXPECT_EQ(kBitsPerWord - 3, Utils::CountLeadingZerosWord(0x4));
247 EXPECT_EQ(0, Utils::CountTrailingZerosWord(kUwordMax));
248 EXPECT_EQ(0, Utils::CountLeadingZerosWord(kUwordMax));
249 const uword kTopBit = static_cast<uword>(1) << (kBitsPerWord - 1);
250 EXPECT_EQ(kBitsPerWord - 1, Utils::CountTrailingZerosWord(kTopBit));
251 EXPECT_EQ(0, Utils::CountLeadingZerosWord(kTopBit));
252}

◆ VM_UNIT_TEST_CASE() [18/107]

dart::VM_UNIT_TEST_CASE ( CustomIsolates  )

Definition at line 309 of file custom_isolate_test.cc.

309 {
310 bool saved_flag = FLAG_trace_shutdown;
311 FLAG_trace_shutdown = true;
312 event_queue = new EventQueue();
313
314 Dart_Isolate dart_isolate = TestCase::CreateTestIsolate();
315 EXPECT(dart_isolate != nullptr);
316 Dart_SetMessageNotifyCallback(&NotifyMessage);
319
320 // Create a test library.
321 Dart_Handle lib =
322 TestCase::LoadTestScript(kCustomIsolateScriptChars, NativeLookup);
323 EXPECT_VALID(lib);
324
325 // Run main.
326 result = Dart_Invoke(lib, NewString("main"), 0, nullptr);
329 const char* result_str = nullptr;
331 EXPECT_STREQ("success", result_str);
332
335
336 OS::PrintErr("-- Starting event loop --\n");
337 Event* event = event_queue->Get();
338 while (event != nullptr) {
339 event->Process();
340 delete event;
341 event = event_queue->Get();
342 }
343 OS::PrintErr("-- Finished event loop --\n");
344 EXPECT_STREQ("Received: 43", saved_echo);
345 free(saved_echo);
346
347 delete event_queue;
348 event_queue = nullptr;
349 FLAG_trace_shutdown = saved_flag;
350}
virtual void Process()=0

◆ VM_UNIT_TEST_CASE() [19/107]

dart::VM_UNIT_TEST_CASE ( DartAPI_AssignToPersistentHandle  )

Definition at line 3408 of file dart_api_impl_test.cc.

3408 {
3409 const char* kTestString1 = "Test String1";
3410 const char* kTestString2 = "Test String2";
3411 TestIsolateScope __test_isolate__;
3412
3413 Thread* T = Thread::Current();
3415 Isolate* isolate = T->isolate();
3416 EXPECT(isolate != nullptr);
3417 ApiState* state = isolate->group()->api_state();
3418 EXPECT(state != nullptr);
3419
3420 // Start with a known persistent handle.
3421 Dart_Handle ref1 = Dart_NewStringFromCString(kTestString1);
3423 EXPECT(state->IsValidPersistentHandle(obj));
3424 {
3425 TransitionNativeToVM transition(T);
3426 HANDLESCOPE(T);
3427 String& str = String::Handle();
3428 str ^= PersistentHandle::Cast(obj)->ptr();
3429 EXPECT(str.Equals(kTestString1));
3430 }
3431
3432 // Now create another local handle and assign it to the persistent handle.
3433 Dart_Handle ref2 = Dart_NewStringFromCString(kTestString2);
3434 Dart_SetPersistentHandle(obj, ref2);
3435 {
3436 TransitionNativeToVM transition(T);
3437 HANDLESCOPE(T);
3438 String& str = String::Handle();
3439 str ^= PersistentHandle::Cast(obj)->ptr();
3440 EXPECT(str.Equals(kTestString2));
3441 }
3442
3443 // Now assign Null to the persistent handle and check.
3445 EXPECT(Dart_IsNull(obj));
3446}
DART_EXPORT void Dart_SetPersistentHandle(Dart_PersistentHandle obj1, Dart_Handle obj2)

◆ VM_UNIT_TEST_CASE() [20/107]

dart::VM_UNIT_TEST_CASE ( DartAPI_CurrentIsolateData  )

Definition at line 4809 of file dart_api_impl_test.cc.

4809 {
4810 Dart_IsolateShutdownCallback saved_shutdown = Isolate::ShutdownCallback();
4811 Dart_IsolateGroupCleanupCallback saved_cleanup =
4812 Isolate::GroupCleanupCallback();
4813 Isolate::SetShutdownCallback(nullptr);
4814 Isolate::SetGroupCleanupCallback(nullptr);
4815
4816 intptr_t mydata = 12345;
4817 Dart_Isolate isolate =
4818 TestCase::CreateTestIsolate(nullptr, reinterpret_cast<void*>(mydata));
4819 EXPECT(isolate != nullptr);
4820 EXPECT_EQ(mydata, reinterpret_cast<intptr_t>(Dart_CurrentIsolateGroupData()));
4821 EXPECT_EQ(mydata, reinterpret_cast<intptr_t>(Dart_IsolateGroupData(isolate)));
4823
4824 Isolate::SetShutdownCallback(saved_shutdown);
4825 Isolate::SetGroupCleanupCallback(saved_cleanup);
4826}
void(* Dart_IsolateGroupCleanupCallback)(void *isolate_group_data)
Definition dart_api.h:744
void(* Dart_IsolateShutdownCallback)(void *isolate_group_data, void *isolate_data)
Definition dart_api.h:710
DART_EXPORT void * Dart_IsolateGroupData(Dart_Isolate isolate)
DART_EXPORT void * Dart_CurrentIsolateGroupData(void)

◆ VM_UNIT_TEST_CASE() [21/107]

dart::VM_UNIT_TEST_CASE ( DartAPI_EnterExitScope  )

Definition at line 3287 of file dart_api_impl_test.cc.

3287 {
3288 TestIsolateScope __test_isolate__;
3289
3290 Thread* thread = Thread::Current();
3291 EXPECT(thread != nullptr);
3292 ApiLocalScope* scope = thread->api_top_scope();
3294 {
3295 EXPECT(thread->api_top_scope() != nullptr);
3296 TransitionNativeToVM transition(thread);
3297 HANDLESCOPE(thread);
3298 String& str1 = String::Handle();
3299 str1 = String::New("Test String");
3300 Dart_Handle ref = Api::NewHandle(thread, str1.ptr());
3301 String& str2 = String::Handle();
3302 str2 ^= Api::UnwrapHandle(ref);
3303 EXPECT(str1.Equals(str2));
3304 }
3306 EXPECT(scope == thread->api_top_scope());
3307}

◆ VM_UNIT_TEST_CASE() [22/107]

dart::VM_UNIT_TEST_CASE ( DartAPI_FinalizableHandlesCallbackShutdown  )

Definition at line 4077 of file dart_api_impl_test.cc.

4077 {
4078 TestCase::CreateTestIsolate();
4080 Dart_Handle ref = Dart_True();
4081 int peer = 1234;
4082 Dart_NewFinalizableHandle(ref, &peer, 0, FinalizableHandlePeerFinalizer);
4085 EXPECT(peer == 42);
4086}

◆ VM_UNIT_TEST_CASE() [23/107]

dart::VM_UNIT_TEST_CASE ( DartAPI_HeapSampling_CorrectSamplingIntervalForOldSpaceAllocations  )

Definition at line 10467 of file dart_api_impl_test.cc.

◆ VM_UNIT_TEST_CASE() [24/107]

dart::VM_UNIT_TEST_CASE ( DartAPI_IsolateGroups  )

Definition at line 4790 of file dart_api_impl_test.cc.

4790 {
4791 Dart_Isolate iso_1 = TestCase::CreateTestIsolate();
4792 EXPECT_NOTNULL(Dart_CurrentIsolateGroup());
4794 EXPECT_NULLPTR(Dart_CurrentIsolateGroup());
4795 Dart_Isolate iso_2 = TestCase::CreateTestIsolate();
4796 EXPECT_NOTNULL(Dart_CurrentIsolateGroup());
4798 EXPECT_NULLPTR(Dart_CurrentIsolateGroup());
4799 Dart_EnterIsolate(iso_2);
4800 EXPECT_NOTNULL(Dart_CurrentIsolateGroup());
4802 EXPECT_NULLPTR(Dart_CurrentIsolateGroup());
4803 Dart_EnterIsolate(iso_1);
4804 EXPECT_NOTNULL(Dart_CurrentIsolateGroup());
4806 EXPECT_NULLPTR(Dart_CurrentIsolateGroup());
4807}

◆ VM_UNIT_TEST_CASE() [25/107]

dart::VM_UNIT_TEST_CASE ( DartAPI_Isolates  )

Definition at line 4767 of file dart_api_impl_test.cc.

4767 {
4768 // This test currently assumes that the Dart_Isolate type is an opaque
4769 // representation of Isolate*.
4770 Dart_Isolate iso_1 = TestCase::CreateTestIsolate();
4771 EXPECT_EQ(iso_1, Api::CastIsolate(Isolate::Current()));
4773 EXPECT_EQ(iso_1, isolate);
4775 EXPECT_NULLPTR(Dart_CurrentIsolate());
4776 Dart_Isolate iso_2 = TestCase::CreateTestIsolate();
4777 EXPECT_EQ(iso_2, Dart_CurrentIsolate());
4779 EXPECT_NULLPTR(Dart_CurrentIsolate());
4780 Dart_EnterIsolate(iso_2);
4781 EXPECT_EQ(iso_2, Dart_CurrentIsolate());
4783 EXPECT_NULLPTR(Dart_CurrentIsolate());
4784 Dart_EnterIsolate(iso_1);
4785 EXPECT_EQ(iso_1, Dart_CurrentIsolate());
4787 EXPECT_NULLPTR(Dart_CurrentIsolate());
4788}

◆ VM_UNIT_TEST_CASE() [26/107]

dart::VM_UNIT_TEST_CASE ( DartAPI_IsolateShutdownAndCleanup  )

Definition at line 8547 of file dart_api_impl_test.cc.

8557 {
8558 cleanup_group_callback_data = callback_data;
8559}
8560
8561VM_UNIT_TEST_CASE(DartAPI_IsolateShutdownAndCleanup) {
8562 Dart_IsolateShutdownCallback saved_shutdown = Isolate::ShutdownCallback();
8563 Dart_IsolateGroupCleanupCallback saved_cleanup =
8564 Isolate::GroupCleanupCallback();
8565 Isolate::SetShutdownCallback(IsolateShutdownTestCallback);
8566 Isolate::SetCleanupCallback(IsolateCleanupTestCallback);
8567 Isolate::SetGroupCleanupCallback(IsolateGroupCleanupTestCallback);
8568
8569 shutdown_isolate_group_data = nullptr;
8570 shutdown_isolate_data = nullptr;
8571 cleanup_group_callback_data = nullptr;
8572 void* my_group_data = reinterpret_cast<void*>(123);
8573 void* my_data = reinterpret_cast<void*>(456);
8574
8575 // Create an isolate.
8576 Dart_Isolate isolate =
8577 TestCase::CreateTestIsolate(nullptr, my_group_data, my_data);
8578 EXPECT(isolate != nullptr);
8579
8580 // The shutdown callback has not been called.
8581 EXPECT(nullptr == shutdown_isolate_data);
8582 EXPECT(nullptr == shutdown_isolate_group_data);
8583 EXPECT(nullptr == cleanup_group_callback_data);
8584
8585 // The isolate is the active isolate which allows us to access the isolate
8586 // specific and isolate-group specific data.
8587 EXPECT(Dart_CurrentIsolateData() == my_data);
8588 EXPECT(Dart_CurrentIsolateGroupData() == my_group_data);
DART_EXPORT void * Dart_CurrentIsolateData(void)
static void * cleanup_group_callback_data

◆ VM_UNIT_TEST_CASE() [27/107]

dart::VM_UNIT_TEST_CASE ( DartAPI_IsolateShutdownRunDartCode  )

Definition at line 8614 of file dart_api_impl_test.cc.

8620 {arg1, arg2};
8621 Dart_Handle result = Dart_Invoke(lib, NewString("add"), 2, dart_args);
8623 result = Dart_IntegerToInt64(result, &add_result);
8626}
8627
8628VM_UNIT_TEST_CASE(DartAPI_IsolateShutdownRunDartCode) {
8629 const char* kScriptChars =
8630 "int add(int a, int b) {\n"
8631 " return a + b;\n"
8632 "}\n"
8633 "\n"
8634 "void main() {\n"
8635 " add(4, 5);\n"
8636 "}\n";
8637
8638 // Create an isolate.
8639 auto isolate = reinterpret_cast<Isolate*>(TestCase::CreateTestIsolate());
8640 EXPECT(isolate != nullptr);
8641
8642 isolate->set_on_shutdown_callback(IsolateShutdownRunDartCodeTestCallback);
8643
8644 {
8646 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
8647 EXPECT_VALID(lib);
8648 Dart_Handle result = Dart_SetLibraryTagHandler(TestCase::library_handler);

◆ VM_UNIT_TEST_CASE() [28/107]

dart::VM_UNIT_TEST_CASE ( DartAPI_LocalHandles  )

Definition at line 4652 of file dart_api_impl_test.cc.

4652 {
4653 TestCase::CreateTestIsolate();
4654 Thread* thread = Thread::Current();
4655 Isolate* isolate = thread->isolate();
4656 EXPECT(isolate != nullptr);
4657 ApiLocalScope* scope = thread->api_top_scope();
4658 Dart_Handle handles[300];
4659 {
4660 TransitionNativeToVM transition1(thread);
4661 StackZone zone(thread);
4662 Smi& val = Smi::Handle();
4663 TransitionVMToNative transition2(thread);
4664
4665 // Start a new scope and allocate some local handles.
4667 {
4668 TransitionNativeToVM transition3(thread);
4669 for (int i = 0; i < 100; i++) {
4670 handles[i] = Api::NewHandle(thread, Smi::New(i));
4671 }
4672 EXPECT_EQ(100, thread->CountLocalHandles());
4673 for (int i = 0; i < 100; i++) {
4674 val ^= Api::UnwrapHandle(handles[i]);
4675 EXPECT_EQ(i, val.Value());
4676 }
4677 }
4678 // Start another scope and allocate some more local handles.
4679 {
4681 {
4682 TransitionNativeToVM transition3(thread);
4683 for (int i = 100; i < 200; i++) {
4684 handles[i] = Api::NewHandle(thread, Smi::New(i));
4685 }
4686 EXPECT_EQ(200, thread->CountLocalHandles());
4687 for (int i = 100; i < 200; i++) {
4688 val ^= Api::UnwrapHandle(handles[i]);
4689 EXPECT_EQ(i, val.Value());
4690 }
4691 }
4692
4693 // Start another scope and allocate some more local handles.
4694 {
4696 {
4697 TransitionNativeToVM transition3(thread);
4698 for (int i = 200; i < 300; i++) {
4699 handles[i] = Api::NewHandle(thread, Smi::New(i));
4700 }
4701 EXPECT_EQ(300, thread->CountLocalHandles());
4702 for (int i = 200; i < 300; i++) {
4703 val ^= Api::UnwrapHandle(handles[i]);
4704 EXPECT_EQ(i, val.Value());
4705 }
4706 EXPECT_EQ(300, thread->CountLocalHandles());
4707 }
4709 }
4710 EXPECT_EQ(200, thread->CountLocalHandles());
4712 }
4713 EXPECT_EQ(100, thread->CountLocalHandles());
4715 }
4716 EXPECT_EQ(0, thread->CountLocalHandles());
4717 EXPECT(scope == thread->api_top_scope());
4719}
intptr_t CountLocalHandles() const
Definition thread.cc:1215

◆ VM_UNIT_TEST_CASE() [29/107]

dart::VM_UNIT_TEST_CASE ( DartAPI_LocalZoneMemory  )

Definition at line 4724 of file dart_api_impl_test.cc.

4724 {
4725 TestCase::CreateTestIsolate();
4726 Thread* thread = Thread::Current();
4727 EXPECT(thread != nullptr);
4728 ApiLocalScope* scope = thread->api_top_scope();
4729 EXPECT_EQ(0, thread->ZoneSizeInBytes());
4730 {
4731 // Start a new scope and allocate some memory.
4733 EXPECT_EQ(0, thread->ZoneSizeInBytes());
4734 for (int i = 0; i < 100; i++) {
4736 }
4737 EXPECT_EQ(1600, thread->ZoneSizeInBytes());
4738 // Start another scope and allocate some more memory.
4739 {
4741 for (int i = 0; i < 100; i++) {
4743 }
4744 EXPECT_EQ(3200, thread->ZoneSizeInBytes());
4745 {
4746 // Start another scope and allocate some more memory.
4747 {
4749 for (int i = 0; i < 200; i++) {
4751 }
4752 EXPECT_EQ(6400, thread->ZoneSizeInBytes());
4754 }
4755 }
4756 EXPECT_EQ(3200, thread->ZoneSizeInBytes());
4758 }
4759 EXPECT_EQ(1600, thread->ZoneSizeInBytes());
4761 }
4762 EXPECT_EQ(0, thread->ZoneSizeInBytes());
4763 EXPECT(scope == thread->api_top_scope());
4765}
int ZoneSizeInBytes() const
Definition thread.cc:1225

◆ VM_UNIT_TEST_CASE() [30/107]

dart::VM_UNIT_TEST_CASE ( DartAPI_NewNativePort  )

Definition at line 8025 of file dart_api_impl_test.cc.

8039 {
8040 // Create a port with a bogus handler.
8041 Dart_Port error_port = Dart_NewNativePort("Foo", nullptr, true);
8042 EXPECT_EQ(ILLEGAL_PORT, error_port);
8043
8044 // Create the port w/o a current isolate, just to make sure that works.
8045 Dart_Port port_id1 =
8046 Dart_NewNativePort("Port123", NewNativePort_send123, true);
8047
8048 TestIsolateScope __test_isolate__;
8049 const char* kScriptChars =
8050 "import 'dart:isolate';\n"
8051 "void callPort(SendPort port) {\n"
8052 " var receivePort = new RawReceivePort();\n"
8053 " var replyPort = receivePort.sendPort;\n"
8054 " port.send(<dynamic>[replyPort]);\n"
8055 " receivePort.handler = (message) {\n"
8056 " receivePort.close();\n"
8057 " throw new Exception(message);\n"
8058 " };\n"
8059 "}\n";
8060 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
8062
8063 // Create a port w/ a current isolate, to make sure that works too.
8064 Dart_Port port_id2 =
8065 Dart_NewNativePort("Port321", NewNativePort_send321, true);
8066
8067 Dart_Handle send_port1 = Dart_NewSendPort(port_id1);
8068 EXPECT_VALID(send_port1);
8069 Dart_Handle send_port2 = Dart_NewSendPort(port_id2);
8070 EXPECT_VALID(send_port2);
8071
8072 // Test first port.
8073 Dart_Handle dart_args[1];
8074 dart_args[0] = send_port1;
8075 Dart_Handle result = Dart_Invoke(lib, NewString("callPort"), 1, dart_args);
8077 result = Dart_RunLoop();
8080 EXPECT_SUBSTRING("Exception: 123\n", Dart_GetError(result));
8081
8082 // result second port.

◆ VM_UNIT_TEST_CASE() [31/107]

dart::VM_UNIT_TEST_CASE ( DartAPI_NewPersistentHandle_FromPersistentHandle  )

Definition at line 3379 of file dart_api_impl_test.cc.

3379 {
3380 TestIsolateScope __test_isolate__;
3381
3382 Isolate* isolate = Isolate::Current();
3383 EXPECT(isolate != nullptr);
3384 ApiState* state = isolate->group()->api_state();
3385 EXPECT(state != nullptr);
3386 Thread* thread = Thread::Current();
3387 CHECK_API_SCOPE(thread);
3388
3389 // Start with a known persistent handle.
3391 EXPECT(state->IsValidPersistentHandle(obj1));
3392
3393 // And use it to allocate a second persistent handle.
3396 EXPECT(state->IsValidPersistentHandle(obj3));
3397
3398 // Make sure that the value transferred.
3400 EXPECT(Dart_IsBoolean(obj4));
3401 bool value = false;
3402 Dart_Handle result = Dart_BooleanValue(obj4, &value);
3404 EXPECT(value);
3405}

◆ VM_UNIT_TEST_CASE() [32/107]

dart::VM_UNIT_TEST_CASE ( DartAPI_PersistentHandles  )

Definition at line 3310 of file dart_api_impl_test.cc.

3310 {
3311 const char* kTestString1 = "Test String1";
3312 const char* kTestString2 = "Test String2";
3313 TestCase::CreateTestIsolate();
3314 Thread* thread = Thread::Current();
3315 Isolate* isolate = thread->isolate();
3316 EXPECT(isolate != nullptr);
3317 ApiState* state = isolate->group()->api_state();
3318 EXPECT(state != nullptr);
3319 ApiLocalScope* scope = thread->api_top_scope();
3320
3321 const intptr_t handle_count_start = state->CountPersistentHandles();
3322
3323 Dart_PersistentHandle handles[2000];
3325 {
3326 CHECK_API_SCOPE(thread);
3327 Dart_Handle ref1 = Dart_NewStringFromCString(kTestString1);
3328 for (int i = 0; i < 1000; i++) {
3329 handles[i] = Dart_NewPersistentHandle(ref1);
3330 }
3332 Dart_Handle ref2 = Dart_NewStringFromCString(kTestString2);
3333 for (int i = 1000; i < 2000; i++) {
3334 handles[i] = Dart_NewPersistentHandle(ref2);
3335 }
3336 for (int i = 500; i < 1500; i++) {
3337 Dart_DeletePersistentHandle(handles[i]);
3338 }
3339 for (int i = 500; i < 1000; i++) {
3340 handles[i] = Dart_NewPersistentHandle(ref2);
3341 }
3342 for (int i = 1000; i < 1500; i++) {
3343 handles[i] = Dart_NewPersistentHandle(ref1);
3344 }
3346 }
3348 {
3349 TransitionNativeToVM transition(thread);
3350 StackZone zone(thread);
3351 for (int i = 0; i < 500; i++) {
3352 String& str = String::Handle();
3353 str ^= PersistentHandle::Cast(handles[i])->ptr();
3354 EXPECT(str.Equals(kTestString1));
3355 }
3356 for (int i = 500; i < 1000; i++) {
3357 String& str = String::Handle();
3358 str ^= PersistentHandle::Cast(handles[i])->ptr();
3359 EXPECT(str.Equals(kTestString2));
3360 }
3361 for (int i = 1000; i < 1500; i++) {
3362 String& str = String::Handle();
3363 str ^= PersistentHandle::Cast(handles[i])->ptr();
3364 EXPECT(str.Equals(kTestString1));
3365 }
3366 for (int i = 1500; i < 2000; i++) {
3367 String& str = String::Handle();
3368 str ^= PersistentHandle::Cast(handles[i])->ptr();
3369 EXPECT(str.Equals(kTestString2));
3370 }
3371 }
3372 EXPECT(scope == thread->api_top_scope());
3373 EXPECT_EQ(handle_count_start + 2000, state->CountPersistentHandles());
3375}

◆ VM_UNIT_TEST_CASE() [33/107]

dart::VM_UNIT_TEST_CASE ( DartAPI_RunLoop_Exception  )

Definition at line 8502 of file dart_api_impl_test.cc.

8502 {
8504 }

◆ VM_UNIT_TEST_CASE() [34/107]

dart::VM_UNIT_TEST_CASE ( DartAPI_RunLoop_Success  )

Definition at line 8498 of file dart_api_impl_test.cc.

8500 {

◆ VM_UNIT_TEST_CASE() [35/107]

dart::VM_UNIT_TEST_CASE ( DartAPI_SetMessageCallbacks  )

Definition at line 4857 of file dart_api_impl_test.cc.

4857 {
4858 Dart_Isolate dart_isolate = TestCase::CreateTestIsolate();
4859 Dart_SetMessageNotifyCallback(&MyMessageNotifyCallback);
4860 Isolate* isolate = reinterpret_cast<Isolate*>(dart_isolate);
4861 EXPECT_EQ(&MyMessageNotifyCallback, isolate->message_notify_callback());
4863}

◆ VM_UNIT_TEST_CASE() [36/107]

dart::VM_UNIT_TEST_CASE ( DartAPI_WeakPersistentHandlesCallbackShutdown  )

Definition at line 4065 of file dart_api_impl_test.cc.

4065 {
4066 TestCase::CreateTestIsolate();
4068 Dart_Handle ref = Dart_True();
4069 int peer = 1234;
4071 ref, &peer, 0, DontDeleteWeakHandleOnFinalization);
4074 EXPECT(peer == 42);
4075}

◆ VM_UNIT_TEST_CASE() [37/107]

dart::VM_UNIT_TEST_CASE ( DartGeneratedArrayLiteralMessages  )

Definition at line 1074 of file snapshot_test.cc.

1074 {
1075 const int kArrayLength = 10;
1076 const char* kScriptChars =
1077 "final int kArrayLength = 10;\n"
1078 "getList() {\n"
1079 " return [null, null, null, null, null, null, null, null, null, null];\n"
1080 "}\n"
1081 "getIntList() {\n"
1082 " return [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];\n"
1083 "}\n"
1084 "getStringList() {\n"
1085 " return ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];\n"
1086 "}\n"
1087 "getListList() {\n"
1088 " return <dynamic>[[],"
1089 " [0],"
1090 " [0, 1],"
1091 " [0, 1, 2],"
1092 " [0, 1, 2, 3],"
1093 " [0, 1, 2, 3, 4],"
1094 " [0, 1, 2, 3, 4, 5],"
1095 " [0, 1, 2, 3, 4, 5, 6],"
1096 " [0, 1, 2, 3, 4, 5, 6, 7],"
1097 " [0, 1, 2, 3, 4, 5, 6, 7, 8]];\n"
1098 "}\n"
1099 "getMixedList() {\n"
1100 " var list = [];\n"
1101 " list.add(0);\n"
1102 " list.add('1');\n"
1103 " list.add(2.2);\n"
1104 " list.add(true);\n"
1105 " list.add([]);\n"
1106 " list.add(<dynamic>[[]]);\n"
1107 " list.add(<dynamic>[<dynamic>[[]]]);\n"
1108 " list.add(<dynamic>[1, <dynamic>[2, [3]]]);\n"
1109 " list.add(<dynamic>[1, <dynamic>[1, 2, [1, 2, 3]]]);\n"
1110 " list.add([1, 2, 3]);\n"
1111 " return list;\n"
1112 "}\n";
1113
1114 TestCase::CreateTestIsolate();
1115 Thread* thread = Thread::Current();
1116 EXPECT(thread->isolate() != nullptr);
1118
1119 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
1120 EXPECT_VALID(lib);
1121
1122 {
1123 CHECK_API_SCOPE(thread);
1124 TransitionNativeToVM transition(thread);
1125 HANDLESCOPE(thread);
1126 StackZone zone(thread);
1127 {
1128 // Generate a list of nulls from Dart code.
1129 std::unique_ptr<Message> message = GetSerialized(lib, "getList");
1130 ApiNativeScope scope;
1131 Dart_CObject* root = ReadApiMessage(scope.zone(), message.get());
1132 EXPECT_NOTNULL(root);
1133 EXPECT_EQ(Dart_CObject_kArray, root->type);
1134 EXPECT_EQ(kArrayLength, root->value.as_array.length);
1135 for (int i = 0; i < kArrayLength; i++) {
1136 EXPECT_EQ(Dart_CObject_kNull, root->value.as_array.values[i]->type);
1137 }
1138 CheckEncodeDecodeMessage(scope.zone(), root);
1139 }
1140 {
1141 // Generate a list of ints from Dart code.
1142 std::unique_ptr<Message> message = GetSerialized(lib, "getIntList");
1143 ApiNativeScope scope;
1144 Dart_CObject* root = ReadApiMessage(scope.zone(), message.get());
1145 EXPECT_NOTNULL(root);
1146 EXPECT_EQ(Dart_CObject_kArray, root->type);
1147 EXPECT_EQ(kArrayLength, root->value.as_array.length);
1148 for (int i = 0; i < kArrayLength; i++) {
1149 EXPECT_EQ(Dart_CObject_kInt32, root->value.as_array.values[i]->type);
1150 EXPECT_EQ(i, root->value.as_array.values[i]->value.as_int32);
1151 }
1152 CheckEncodeDecodeMessage(scope.zone(), root);
1153 }
1154 {
1155 // Generate a list of strings from Dart code.
1156 std::unique_ptr<Message> message = GetSerialized(lib, "getStringList");
1157 ApiNativeScope scope;
1158 Dart_CObject* root = ReadApiMessage(scope.zone(), message.get());
1159 EXPECT_NOTNULL(root);
1160 EXPECT_EQ(Dart_CObject_kArray, root->type);
1161 EXPECT_EQ(kArrayLength, root->value.as_array.length);
1162 for (int i = 0; i < kArrayLength; i++) {
1163 EXPECT_EQ(Dart_CObject_kString, root->value.as_array.values[i]->type);
1164 char buffer[3];
1165 snprintf(buffer, sizeof(buffer), "%d", i);
1166 EXPECT_STREQ(buffer, root->value.as_array.values[i]->value.as_string);
1167 }
1168 }
1169 {
1170 // Generate a list of lists from Dart code.
1171 std::unique_ptr<Message> message = GetSerialized(lib, "getListList");
1172 ApiNativeScope scope;
1173 Dart_CObject* root = ReadApiMessage(scope.zone(), message.get());
1174 EXPECT_NOTNULL(root);
1175 EXPECT_EQ(Dart_CObject_kArray, root->type);
1176 EXPECT_EQ(kArrayLength, root->value.as_array.length);
1177 for (int i = 0; i < kArrayLength; i++) {
1178 Dart_CObject* element = root->value.as_array.values[i];
1179 EXPECT_EQ(Dart_CObject_kArray, element->type);
1180 EXPECT_EQ(i, element->value.as_array.length);
1181 for (int j = 0; j < i; j++) {
1182 EXPECT_EQ(Dart_CObject_kInt32,
1183 element->value.as_array.values[j]->type);
1184 EXPECT_EQ(j, element->value.as_array.values[j]->value.as_int32);
1185 }
1186 }
1187 }
1188 {
1189 // Generate a list of objects of different types from Dart code.
1190 std::unique_ptr<Message> message = GetSerialized(lib, "getMixedList");
1191 ApiNativeScope scope;
1192 Dart_CObject* root = ReadApiMessage(scope.zone(), message.get());
1193 EXPECT_NOTNULL(root);
1194 EXPECT_EQ(Dart_CObject_kArray, root->type);
1195 EXPECT_EQ(kArrayLength, root->value.as_array.length);
1196
1197 EXPECT_EQ(Dart_CObject_kInt32, root->value.as_array.values[0]->type);
1198 EXPECT_EQ(0, root->value.as_array.values[0]->value.as_int32);
1199 EXPECT_EQ(Dart_CObject_kString, root->value.as_array.values[1]->type);
1200 EXPECT_STREQ("1", root->value.as_array.values[1]->value.as_string);
1201 EXPECT_EQ(Dart_CObject_kDouble, root->value.as_array.values[2]->type);
1202 EXPECT_EQ(2.2, root->value.as_array.values[2]->value.as_double);
1203 EXPECT_EQ(Dart_CObject_kBool, root->value.as_array.values[3]->type);
1204 EXPECT_EQ(true, root->value.as_array.values[3]->value.as_bool);
1205
1206 for (int i = 0; i < kArrayLength; i++) {
1207 if (i > 3) {
1208 EXPECT_EQ(Dart_CObject_kArray, root->value.as_array.values[i]->type);
1209 }
1210 }
1211
1212 Dart_CObject* element;
1213 Dart_CObject* e;
1214
1215 // []
1216 element = root->value.as_array.values[4];
1217 EXPECT_EQ(0, element->value.as_array.length);
1218
1219 // [[]]
1220 element = root->value.as_array.values[5];
1221 EXPECT_EQ(1, element->value.as_array.length);
1222 element = element->value.as_array.values[0];
1223 EXPECT_EQ(Dart_CObject_kArray, element->type);
1224 EXPECT_EQ(0, element->value.as_array.length);
1225
1226 // [[[]]]"
1227 element = root->value.as_array.values[6];
1228 EXPECT_EQ(1, element->value.as_array.length);
1229 element = element->value.as_array.values[0];
1230 EXPECT_EQ(Dart_CObject_kArray, element->type);
1231 EXPECT_EQ(1, element->value.as_array.length);
1232 element = element->value.as_array.values[0];
1233 EXPECT_EQ(Dart_CObject_kArray, element->type);
1234 EXPECT_EQ(0, element->value.as_array.length);
1235
1236 // [1, [2, [3]]]
1237 element = root->value.as_array.values[7];
1238 EXPECT_EQ(2, element->value.as_array.length);
1239 e = element->value.as_array.values[0];
1240 EXPECT_EQ(Dart_CObject_kInt32, e->type);
1241 EXPECT_EQ(1, e->value.as_int32);
1242 element = element->value.as_array.values[1];
1243 EXPECT_EQ(Dart_CObject_kArray, element->type);
1244 EXPECT_EQ(2, element->value.as_array.length);
1245 e = element->value.as_array.values[0];
1246 EXPECT_EQ(Dart_CObject_kInt32, e->type);
1247 EXPECT_EQ(2, e->value.as_int32);
1248 element = element->value.as_array.values[1];
1249 EXPECT_EQ(Dart_CObject_kArray, element->type);
1250 EXPECT_EQ(1, element->value.as_array.length);
1251 e = element->value.as_array.values[0];
1252 EXPECT_EQ(Dart_CObject_kInt32, e->type);
1253 EXPECT_EQ(3, e->value.as_int32);
1254
1255 // [1, [1, 2, [1, 2, 3]]]
1256 element = root->value.as_array.values[8];
1257 EXPECT_EQ(2, element->value.as_array.length);
1258 e = element->value.as_array.values[0];
1259 EXPECT_EQ(Dart_CObject_kInt32, e->type);
1260 e = element->value.as_array.values[0];
1261 EXPECT_EQ(Dart_CObject_kInt32, e->type);
1262 EXPECT_EQ(1, e->value.as_int32);
1263 element = element->value.as_array.values[1];
1264 EXPECT_EQ(Dart_CObject_kArray, element->type);
1265 EXPECT_EQ(3, element->value.as_array.length);
1266 for (int i = 0; i < 2; i++) {
1267 e = element->value.as_array.values[i];
1268 EXPECT_EQ(Dart_CObject_kInt32, e->type);
1269 EXPECT_EQ(i + 1, e->value.as_int32);
1270 }
1271 element = element->value.as_array.values[2];
1272 EXPECT_EQ(Dart_CObject_kArray, element->type);
1273 EXPECT_EQ(3, element->value.as_array.length);
1274 for (int i = 0; i < 3; i++) {
1275 e = element->value.as_array.values[i];
1276 EXPECT_EQ(Dart_CObject_kInt32, e->type);
1277 EXPECT_EQ(i + 1, e->value.as_int32);
1278 }
1279
1280 // [1, 2, 3]
1281 element = root->value.as_array.values[9];
1282 EXPECT_EQ(3, element->value.as_array.length);
1283 for (int i = 0; i < 3; i++) {
1284 e = element->value.as_array.values[i];
1285 EXPECT_EQ(Dart_CObject_kInt32, e->type);
1286 EXPECT_EQ(i + 1, e->value.as_int32);
1287 }
1288 }
1289 }
1292}
static std::unique_ptr< Message > GetSerialized(Dart_Handle lib, const char *dart_function)

◆ VM_UNIT_TEST_CASE() [38/107]

dart::VM_UNIT_TEST_CASE ( DartGeneratedArrayLiteralMessagesWithBackref  )

Definition at line 1487 of file snapshot_test.cc.

1487 {
1488 const int kArrayLength = 10;
1489 const char* kScriptChars =
1490 "import 'dart:typed_data';\n"
1491 "final int kArrayLength = 10;\n"
1492 "getStringList() {\n"
1493 " var s = 'Hello, world!';\n"
1494 " var list = [s, s, s, s, s, s, s, s, s, s];\n"
1495 " return list;\n"
1496 "}\n"
1497 "getMintList() {\n"
1498 " var mint = 0x7FFFFFFFFFFFFFFF;\n"
1499 " var list = [mint, mint, mint, mint, mint,\n"
1500 " mint, mint, mint, mint, mint];\n"
1501 " return list;\n"
1502 "}\n"
1503 "getDoubleList() {\n"
1504 " var d = 3.14;\n"
1505 " var list = [3.14, 3.14, 3.14, 3.14, 3.14, 3.14];\n"
1506 " list.add(3.14);\n"
1507 " list.add(3.14);\n"
1508 " list.add(3.14);\n"
1509 " list.add(3.14);\n"
1510 " return list;\n"
1511 "}\n"
1512 "getTypedDataList() {\n"
1513 " var byte_array = new Uint8List(256);\n"
1514 " var list = [];\n"
1515 " for (var i = 0; i < kArrayLength; i++) {\n"
1516 " list.add(byte_array);\n"
1517 " }\n"
1518 " return list;\n"
1519 "}\n"
1520 "getTypedDataViewList() {\n"
1521 " var uint8_list = new Uint8List(256);\n"
1522 " uint8_list[64] = 1;\n"
1523 " var uint8_list_view =\n"
1524 " new Uint8List.view(uint8_list.buffer, 64, 128);\n"
1525 " var list = [];\n"
1526 " for (var i = 0; i < kArrayLength; i++) {\n"
1527 " list.add(uint8_list_view);\n"
1528 " }\n"
1529 " return list;\n"
1530 "}\n"
1531 "getMixedList() {\n"
1532 " var list = [];\n"
1533 " for (var i = 0; i < kArrayLength; i++) {\n"
1534 " list.add(((i % 2) == 0) ? '.' : 2.72);\n"
1535 " }\n"
1536 " return list;\n"
1537 "}\n"
1538 "getSelfRefList() {\n"
1539 " var list = [];\n"
1540 " for (var i = 0; i < kArrayLength; i++) {\n"
1541 " list.add(list);\n"
1542 " }\n"
1543 " return list;\n"
1544 "}\n";
1545
1546 TestCase::CreateTestIsolate();
1547 Thread* thread = Thread::Current();
1548 EXPECT(thread->isolate() != nullptr);
1550
1551 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
1552 EXPECT_VALID(lib);
1553
1554 {
1555 CHECK_API_SCOPE(thread);
1556 TransitionNativeToVM transition(thread);
1557 HANDLESCOPE(thread);
1558 StackZone zone(thread);
1559 {
1560 // Generate a list of strings from Dart code.
1561 std::unique_ptr<Message> message = GetSerialized(lib, "getStringList");
1562 ApiNativeScope scope;
1563 Dart_CObject* root = ReadApiMessage(scope.zone(), message.get());
1564 EXPECT_NOTNULL(root);
1565 EXPECT_EQ(Dart_CObject_kArray, root->type);
1566 EXPECT_EQ(kArrayLength, root->value.as_array.length);
1567 for (int i = 0; i < kArrayLength; i++) {
1568 Dart_CObject* element = root->value.as_array.values[i];
1569 EXPECT_EQ(root->value.as_array.values[0], element);
1570 EXPECT_EQ(Dart_CObject_kString, element->type);
1571 EXPECT_STREQ("Hello, world!", element->value.as_string);
1572 }
1573 }
1574 {
1575 // Generate a list of medium ints from Dart code.
1576 std::unique_ptr<Message> message = GetSerialized(lib, "getMintList");
1577 ApiNativeScope scope;
1578 Dart_CObject* root = ReadApiMessage(scope.zone(), message.get());
1579 EXPECT_NOTNULL(root);
1580 EXPECT_EQ(Dart_CObject_kArray, root->type);
1581 EXPECT_EQ(kArrayLength, root->value.as_array.length);
1582 for (int i = 0; i < kArrayLength; i++) {
1583 Dart_CObject* element = root->value.as_array.values[i];
1584 EXPECT_EQ(root->value.as_array.values[0], element);
1585 EXPECT_EQ(Dart_CObject_kInt64, element->type);
1586 EXPECT_EQ(DART_INT64_C(0x7FFFFFFFFFFFFFFF), element->value.as_int64);
1587 }
1588 }
1589 {
1590 // Generate a list of doubles from Dart code.
1591 std::unique_ptr<Message> message = GetSerialized(lib, "getDoubleList");
1592 ApiNativeScope scope;
1593 Dart_CObject* root = ReadApiMessage(scope.zone(), message.get());
1594 EXPECT_NOTNULL(root);
1595 EXPECT_EQ(Dart_CObject_kArray, root->type);
1596 EXPECT_EQ(kArrayLength, root->value.as_array.length);
1597 Dart_CObject* element = root->value.as_array.values[0];
1598 EXPECT_EQ(Dart_CObject_kDouble, element->type);
1599 EXPECT_EQ(3.14, element->value.as_double);
1600 for (int i = 1; i < kArrayLength; i++) {
1601 element = root->value.as_array.values[i];
1602 EXPECT_EQ(Dart_CObject_kDouble, element->type);
1603 EXPECT_EQ(3.14, element->value.as_double);
1604 }
1605 }
1606 {
1607 // Generate a list of Uint8Lists from Dart code.
1608 std::unique_ptr<Message> message = GetSerialized(lib, "getTypedDataList");
1609 ApiNativeScope scope;
1610 Dart_CObject* root = ReadApiMessage(scope.zone(), message.get());
1611 EXPECT_NOTNULL(root);
1612 EXPECT_EQ(Dart_CObject_kArray, root->type);
1613 EXPECT_EQ(kArrayLength, root->value.as_array.length);
1614 for (int i = 0; i < kArrayLength; i++) {
1615 Dart_CObject* element = root->value.as_array.values[i];
1616 EXPECT_EQ(root->value.as_array.values[0], element);
1617 EXPECT_EQ(Dart_CObject_kTypedData, element->type);
1618 EXPECT_EQ(Dart_TypedData_kUint8, element->value.as_typed_data.type);
1619 EXPECT_EQ(256, element->value.as_typed_data.length);
1620 }
1621 }
1622 {
1623 // Generate a list of Uint8List views from Dart code.
1624 std::unique_ptr<Message> message =
1625 GetSerialized(lib, "getTypedDataViewList");
1626 ApiNativeScope scope;
1627 Dart_CObject* root = ReadApiMessage(scope.zone(), message.get());
1628 EXPECT_NOTNULL(root);
1629 EXPECT_EQ(Dart_CObject_kArray, root->type);
1630 EXPECT_EQ(kArrayLength, root->value.as_array.length);
1631 for (int i = 0; i < kArrayLength; i++) {
1632 Dart_CObject* element = root->value.as_array.values[i];
1633 EXPECT_EQ(root->value.as_array.values[0], element);
1634 EXPECT_EQ(Dart_CObject_kTypedData, element->type);
1635 EXPECT_EQ(Dart_TypedData_kUint8, element->value.as_typed_data.type);
1636 EXPECT_EQ(128, element->value.as_typed_data.length);
1637 EXPECT_EQ(1, element->value.as_typed_data.values[0]);
1638 EXPECT_EQ(0, element->value.as_typed_data.values[1]);
1639 }
1640 }
1641 {
1642 // Generate a list of objects of different types from Dart code.
1643 std::unique_ptr<Message> message = GetSerialized(lib, "getMixedList");
1644 ApiNativeScope scope;
1645 Dart_CObject* root = ReadApiMessage(scope.zone(), message.get());
1646 EXPECT_NOTNULL(root);
1647 EXPECT_EQ(Dart_CObject_kArray, root->type);
1648 EXPECT_EQ(kArrayLength, root->value.as_array.length);
1649 Dart_CObject* element = root->value.as_array.values[0];
1650 EXPECT_EQ(Dart_CObject_kString, element->type);
1651 EXPECT_STREQ(".", element->value.as_string);
1652 element = root->value.as_array.values[1];
1653 EXPECT_EQ(Dart_CObject_kDouble, element->type);
1654 EXPECT_EQ(2.72, element->value.as_double);
1655 for (int i = 2; i < kArrayLength; i++) {
1656 Dart_CObject* element = root->value.as_array.values[i];
1657 if ((i % 2) == 0) {
1658 EXPECT_EQ(root->value.as_array.values[0], element);
1659 EXPECT_EQ(Dart_CObject_kString, element->type);
1660 EXPECT_STREQ(".", element->value.as_string);
1661 } else {
1662 EXPECT_EQ(Dart_CObject_kDouble, element->type);
1663 EXPECT_EQ(2.72, element->value.as_double);
1664 }
1665 }
1666 }
1667 {
1668 // Generate a list of objects of different types from Dart code.
1669 std::unique_ptr<Message> message = GetSerialized(lib, "getSelfRefList");
1670 ApiNativeScope scope;
1671 Dart_CObject* root = ReadApiMessage(scope.zone(), message.get());
1672 EXPECT_NOTNULL(root);
1673 EXPECT_EQ(Dart_CObject_kArray, root->type);
1674 EXPECT_EQ(kArrayLength, root->value.as_array.length);
1675 for (int i = 0; i < kArrayLength; i++) {
1676 Dart_CObject* element = root->value.as_array.values[i];
1677 EXPECT_EQ(Dart_CObject_kArray, element->type);
1678 EXPECT_EQ(root, element);
1679 }
1680 }
1681 }
1684}

◆ VM_UNIT_TEST_CASE() [39/107]

dart::VM_UNIT_TEST_CASE ( DartGeneratedListMessages  )

Definition at line 964 of file snapshot_test.cc.

964 {
965 const int kArrayLength = 10;
966 const char* kScriptChars =
967 "final int kArrayLength = 10;\n"
968 "getList() {\n"
969 " return List.filled(kArrayLength, null);\n"
970 "}\n"
971 "getIntList() {\n"
972 " var list = List<int>.filled(kArrayLength, 0);\n"
973 " for (var i = 0; i < kArrayLength; i++) list[i] = i;\n"
974 " return list;\n"
975 "}\n"
976 "getStringList() {\n"
977 " var list = List<String>.filled(kArrayLength, '');\n"
978 " for (var i = 0; i < kArrayLength; i++) list[i] = i.toString();\n"
979 " return list;\n"
980 "}\n"
981 "getMixedList() {\n"
982 " var list = List<dynamic>.filled(kArrayLength, null);\n"
983 " list[0] = 0;\n"
984 " list[1] = '1';\n"
985 " list[2] = 2.2;\n"
986 " list[3] = true;\n"
987 " return list;\n"
988 "}\n";
989
990 TestCase::CreateTestIsolate();
991 Thread* thread = Thread::Current();
992 EXPECT(thread->isolate() != nullptr);
994
995 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
996 EXPECT_VALID(lib);
997
998 {
999 CHECK_API_SCOPE(thread);
1000 TransitionNativeToVM transition(thread);
1001 HANDLESCOPE(thread);
1002 StackZone zone(thread);
1003 {
1004 // Generate a list of nulls from Dart code.
1005 std::unique_ptr<Message> message = GetSerialized(lib, "getList");
1006 ApiNativeScope scope;
1007 Dart_CObject* root = ReadApiMessage(scope.zone(), message.get());
1008 EXPECT_NOTNULL(root);
1009 EXPECT_EQ(Dart_CObject_kArray, root->type);
1010 EXPECT_EQ(kArrayLength, root->value.as_array.length);
1011 for (int i = 0; i < kArrayLength; i++) {
1012 EXPECT_EQ(Dart_CObject_kNull, root->value.as_array.values[i]->type);
1013 }
1014 CheckEncodeDecodeMessage(scope.zone(), root);
1015 }
1016 {
1017 // Generate a list of ints from Dart code.
1018 std::unique_ptr<Message> message = GetSerialized(lib, "getIntList");
1019 ApiNativeScope scope;
1020 Dart_CObject* root = ReadApiMessage(scope.zone(), message.get());
1021 EXPECT_NOTNULL(root);
1022 EXPECT_EQ(Dart_CObject_kArray, root->type);
1023 EXPECT_EQ(kArrayLength, root->value.as_array.length);
1024 for (int i = 0; i < kArrayLength; i++) {
1025 EXPECT_EQ(Dart_CObject_kInt32, root->value.as_array.values[i]->type);
1026 EXPECT_EQ(i, root->value.as_array.values[i]->value.as_int32);
1027 }
1028 CheckEncodeDecodeMessage(scope.zone(), root);
1029 }
1030 {
1031 // Generate a list of strings from Dart code.
1032 std::unique_ptr<Message> message = GetSerialized(lib, "getStringList");
1033 ApiNativeScope scope;
1034 Dart_CObject* root = ReadApiMessage(scope.zone(), message.get());
1035 EXPECT_NOTNULL(root);
1036 EXPECT_EQ(Dart_CObject_kArray, root->type);
1037 EXPECT_EQ(kArrayLength, root->value.as_array.length);
1038 for (int i = 0; i < kArrayLength; i++) {
1039 EXPECT_EQ(Dart_CObject_kString, root->value.as_array.values[i]->type);
1040 char buffer[3];
1041 snprintf(buffer, sizeof(buffer), "%d", i);
1042 EXPECT_STREQ(buffer, root->value.as_array.values[i]->value.as_string);
1043 }
1044 }
1045 {
1046 // Generate a list of objects of different types from Dart code.
1047 std::unique_ptr<Message> message = GetSerialized(lib, "getMixedList");
1048 ApiNativeScope scope;
1049 Dart_CObject* root = ReadApiMessage(scope.zone(), message.get());
1050 EXPECT_NOTNULL(root);
1051 EXPECT_EQ(Dart_CObject_kArray, root->type);
1052 EXPECT_EQ(kArrayLength, root->value.as_array.length);
1053
1054 EXPECT_EQ(Dart_CObject_kInt32, root->value.as_array.values[0]->type);
1055 EXPECT_EQ(0, root->value.as_array.values[0]->value.as_int32);
1056 EXPECT_EQ(Dart_CObject_kString, root->value.as_array.values[1]->type);
1057 EXPECT_STREQ("1", root->value.as_array.values[1]->value.as_string);
1058 EXPECT_EQ(Dart_CObject_kDouble, root->value.as_array.values[2]->type);
1059 EXPECT_EQ(2.2, root->value.as_array.values[2]->value.as_double);
1060 EXPECT_EQ(Dart_CObject_kBool, root->value.as_array.values[3]->type);
1061 EXPECT_EQ(true, root->value.as_array.values[3]->value.as_bool);
1062
1063 for (int i = 0; i < kArrayLength; i++) {
1064 if (i > 3) {
1065 EXPECT_EQ(Dart_CObject_kNull, root->value.as_array.values[i]->type);
1066 }
1067 }
1068 }
1069 }
1072}

◆ VM_UNIT_TEST_CASE() [40/107]

dart::VM_UNIT_TEST_CASE ( DartGeneratedListMessagesWithBackref  )

Definition at line 1294 of file snapshot_test.cc.

1294 {
1295 const int kArrayLength = 10;
1296 const char* kScriptChars =
1297 "import 'dart:typed_data';\n"
1298 "final int kArrayLength = 10;\n"
1299 "getStringList() {\n"
1300 " var s = 'Hello, world!';\n"
1301 " var list = List<String>.filled(kArrayLength, '');\n"
1302 " for (var i = 0; i < kArrayLength; i++) list[i] = s;\n"
1303 " return list;\n"
1304 "}\n"
1305 "getMintList() {\n"
1306 " var mint = 0x7FFFFFFFFFFFFFFF;\n"
1307 " var list = List.filled(kArrayLength, 0);\n"
1308 " for (var i = 0; i < kArrayLength; i++) list[i] = mint;\n"
1309 " return list;\n"
1310 "}\n"
1311 "getDoubleList() {\n"
1312 " var d = 3.14;\n"
1313 " var list = List<double>.filled(kArrayLength, 0.0);\n"
1314 " for (var i = 0; i < kArrayLength; i++) list[i] = d;\n"
1315 " return list;\n"
1316 "}\n"
1317 "getTypedDataList() {\n"
1318 " var byte_array = Uint8List(256);\n"
1319 " var list = List<dynamic>.filled(kArrayLength, null);\n"
1320 " for (var i = 0; i < kArrayLength; i++) list[i] = byte_array;\n"
1321 " return list;\n"
1322 "}\n"
1323 "getTypedDataViewList() {\n"
1324 " var uint8_list = Uint8List(256);\n"
1325 " uint8_list[64] = 1;\n"
1326 " var uint8_list_view =\n"
1327 " Uint8List.view(uint8_list.buffer, 64, 128);\n"
1328 " var list = List<dynamic>.filled(kArrayLength, null);\n"
1329 " for (var i = 0; i < kArrayLength; i++) list[i] = uint8_list_view;\n"
1330 " return list;\n"
1331 "}\n"
1332 "getMixedList() {\n"
1333 " var list = List<dynamic>.filled(kArrayLength, null);\n"
1334 " for (var i = 0; i < kArrayLength; i++) {\n"
1335 " list[i] = ((i % 2) == 0) ? 'A' : 2.72;\n"
1336 " }\n"
1337 " return list;\n"
1338 "}\n"
1339 "getSelfRefList() {\n"
1340 " var list = List<dynamic>.filled(kArrayLength, null, growable: true);\n"
1341 " for (var i = 0; i < kArrayLength; i++) {\n"
1342 " list[i] = list;\n"
1343 " }\n"
1344 " return list;\n"
1345 "}\n";
1346
1347 TestCase::CreateTestIsolate();
1348 Thread* thread = Thread::Current();
1349 EXPECT(thread->isolate() != nullptr);
1351
1352 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
1353 EXPECT_VALID(lib);
1354
1355 {
1356 CHECK_API_SCOPE(thread);
1357 TransitionNativeToVM transition(thread);
1358 HANDLESCOPE(thread);
1359 StackZone zone(thread);
1360 {
1361 // Generate a list of strings from Dart code.
1362 std::unique_ptr<Message> message = GetSerialized(lib, "getStringList");
1363 ApiNativeScope scope;
1364 Dart_CObject* root = ReadApiMessage(scope.zone(), message.get());
1365 EXPECT_NOTNULL(root);
1366 EXPECT_EQ(Dart_CObject_kArray, root->type);
1367 EXPECT_EQ(kArrayLength, root->value.as_array.length);
1368 for (int i = 0; i < kArrayLength; i++) {
1369 Dart_CObject* element = root->value.as_array.values[i];
1370 EXPECT_EQ(root->value.as_array.values[0], element);
1371 EXPECT_EQ(Dart_CObject_kString, element->type);
1372 EXPECT_STREQ("Hello, world!", element->value.as_string);
1373 }
1374 }
1375 {
1376 // Generate a list of medium ints from Dart code.
1377 std::unique_ptr<Message> message = GetSerialized(lib, "getMintList");
1378 ApiNativeScope scope;
1379 Dart_CObject* root = ReadApiMessage(scope.zone(), message.get());
1380 EXPECT_NOTNULL(root);
1381 EXPECT_EQ(Dart_CObject_kArray, root->type);
1382 EXPECT_EQ(kArrayLength, root->value.as_array.length);
1383 for (int i = 0; i < kArrayLength; i++) {
1384 Dart_CObject* element = root->value.as_array.values[i];
1385 EXPECT_EQ(root->value.as_array.values[0], element);
1386 EXPECT_EQ(Dart_CObject_kInt64, element->type);
1387 EXPECT_EQ(DART_INT64_C(0x7FFFFFFFFFFFFFFF), element->value.as_int64);
1388 }
1389 }
1390 {
1391 // Generate a list of doubles from Dart code.
1392 std::unique_ptr<Message> message = GetSerialized(lib, "getDoubleList");
1393 ApiNativeScope scope;
1394 Dart_CObject* root = ReadApiMessage(scope.zone(), message.get());
1395 EXPECT_NOTNULL(root);
1396 EXPECT_EQ(Dart_CObject_kArray, root->type);
1397 EXPECT_EQ(kArrayLength, root->value.as_array.length);
1398 Dart_CObject* element = root->value.as_array.values[0];
1399 EXPECT_EQ(Dart_CObject_kDouble, element->type);
1400 EXPECT_EQ(3.14, element->value.as_double);
1401 for (int i = 1; i < kArrayLength; i++) {
1402 element = root->value.as_array.values[i];
1403 EXPECT_EQ(Dart_CObject_kDouble, element->type);
1404 EXPECT_EQ(3.14, element->value.as_double);
1405 }
1406 }
1407 {
1408 // Generate a list of Uint8Lists from Dart code.
1409 std::unique_ptr<Message> message = GetSerialized(lib, "getTypedDataList");
1410 ApiNativeScope scope;
1411 Dart_CObject* root = ReadApiMessage(scope.zone(), message.get());
1412 EXPECT_NOTNULL(root);
1413 EXPECT_EQ(Dart_CObject_kArray, root->type);
1414 EXPECT_EQ(kArrayLength, root->value.as_array.length);
1415 for (int i = 0; i < kArrayLength; i++) {
1416 Dart_CObject* element = root->value.as_array.values[i];
1417 EXPECT_EQ(root->value.as_array.values[0], element);
1418 EXPECT_EQ(Dart_CObject_kTypedData, element->type);
1419 EXPECT_EQ(Dart_TypedData_kUint8, element->value.as_typed_data.type);
1420 EXPECT_EQ(256, element->value.as_typed_data.length);
1421 }
1422 }
1423 {
1424 // Generate a list of Uint8List views from Dart code.
1425 std::unique_ptr<Message> message =
1426 GetSerialized(lib, "getTypedDataViewList");
1427 ApiNativeScope scope;
1428 Dart_CObject* root = ReadApiMessage(scope.zone(), message.get());
1429 EXPECT_NOTNULL(root);
1430 EXPECT_EQ(Dart_CObject_kArray, root->type);
1431 EXPECT_EQ(kArrayLength, root->value.as_array.length);
1432 for (int i = 0; i < kArrayLength; i++) {
1433 Dart_CObject* element = root->value.as_array.values[i];
1434 EXPECT_EQ(root->value.as_array.values[0], element);
1435 EXPECT_EQ(Dart_CObject_kTypedData, element->type);
1436 EXPECT_EQ(Dart_TypedData_kUint8, element->value.as_typed_data.type);
1437 EXPECT_EQ(128, element->value.as_typed_data.length);
1438 EXPECT_EQ(1, element->value.as_typed_data.values[0]);
1439 EXPECT_EQ(0, element->value.as_typed_data.values[1]);
1440 }
1441 }
1442 {
1443 // Generate a list of objects of different types from Dart code.
1444 std::unique_ptr<Message> message = GetSerialized(lib, "getMixedList");
1445 ApiNativeScope scope;
1446 Dart_CObject* root = ReadApiMessage(scope.zone(), message.get());
1447 EXPECT_NOTNULL(root);
1448 EXPECT_EQ(Dart_CObject_kArray, root->type);
1449 EXPECT_EQ(kArrayLength, root->value.as_array.length);
1450 Dart_CObject* element = root->value.as_array.values[0];
1451 EXPECT_EQ(Dart_CObject_kString, element->type);
1452 EXPECT_STREQ("A", element->value.as_string);
1453 element = root->value.as_array.values[1];
1454 EXPECT_EQ(Dart_CObject_kDouble, element->type);
1455 EXPECT_EQ(2.72, element->value.as_double);
1456 for (int i = 2; i < kArrayLength; i++) {
1457 element = root->value.as_array.values[i];
1458 if ((i % 2) == 0) {
1459 EXPECT_EQ(root->value.as_array.values[0], element);
1460 EXPECT_EQ(Dart_CObject_kString, element->type);
1461 EXPECT_STREQ("A", element->value.as_string);
1462 } else {
1463 EXPECT_EQ(Dart_CObject_kDouble, element->type);
1464 EXPECT_EQ(2.72, element->value.as_double);
1465 }
1466 }
1467 }
1468 {
1469 // Generate a list of objects of different types from Dart code.
1470 std::unique_ptr<Message> message = GetSerialized(lib, "getSelfRefList");
1471 ApiNativeScope scope;
1472 Dart_CObject* root = ReadApiMessage(scope.zone(), message.get());
1473 EXPECT_NOTNULL(root);
1474 EXPECT_EQ(Dart_CObject_kArray, root->type);
1475 EXPECT_EQ(kArrayLength, root->value.as_array.length);
1476 for (int i = 0; i < kArrayLength; i++) {
1477 Dart_CObject* element = root->value.as_array.values[i];
1478 EXPECT_EQ(Dart_CObject_kArray, element->type);
1479 EXPECT_EQ(root, element);
1480 }
1481 }
1482 }
1485}

◆ VM_UNIT_TEST_CASE() [41/107]

dart::VM_UNIT_TEST_CASE ( DartGeneratedListMessagesWithTypedData  )

Definition at line 1694 of file snapshot_test.cc.

1694 {
1695 static const char* kScriptChars =
1696 "import 'dart:typed_data';\n"
1697 "getTypedDataList() {\n"
1698 " var list = List<dynamic>.filled(13, null);\n"
1699 " var index = 0;\n"
1700 " list[index++] = Int8List(256);\n"
1701 " list[index++] = Uint8List(256);\n"
1702 " list[index++] = Int16List(256);\n"
1703 " list[index++] = Uint16List(256);\n"
1704 " list[index++] = Int32List(256);\n"
1705 " list[index++] = Uint32List(256);\n"
1706 " list[index++] = Int64List(256);\n"
1707 " list[index++] = Uint64List(256);\n"
1708 " list[index++] = Float32List(256);\n"
1709 " list[index++] = Float64List(256);\n"
1710 " list[index++] = Int32x4List(256);\n"
1711 " list[index++] = Float32x4List(256);\n"
1712 " list[index++] = Float64x2List(256);\n"
1713 " return list;\n"
1714 "}\n"
1715 "getTypedDataViewList() {\n"
1716 " var list = List<dynamic>.filled(45, null);\n"
1717 " var index = 0;\n"
1718 " list[index++] = Int8List.view(Int8List(256).buffer);\n"
1719 " list[index++] = Uint8List.view(Uint8List(256).buffer);\n"
1720 " list[index++] = Int16List.view(new Int16List(256).buffer);\n"
1721 " list[index++] = Uint16List.view(new Uint16List(256).buffer);\n"
1722 " list[index++] = Int32List.view(new Int32List(256).buffer);\n"
1723 " list[index++] = Uint32List.view(new Uint32List(256).buffer);\n"
1724 " list[index++] = Int64List.view(new Int64List(256).buffer);\n"
1725 " list[index++] = Uint64List.view(new Uint64List(256).buffer);\n"
1726 " list[index++] = Float32List.view(new Float32List(256).buffer);\n"
1727 " list[index++] = Float64List.view(new Float64List(256).buffer);\n"
1728 " list[index++] = Int32x4List.view(new Int32x4List(256).buffer);\n"
1729 " list[index++] = Float32x4List.view(new Float32x4List(256).buffer);\n"
1730 " list[index++] = Float64x2List.view(new Float64x2List(256).buffer);\n"
1731
1732 " list[index++] = Int8List.view(new Int16List(256).buffer);\n"
1733 " list[index++] = Uint8List.view(new Uint16List(256).buffer);\n"
1734 " list[index++] = Int8List.view(new Int32List(256).buffer);\n"
1735 " list[index++] = Uint8List.view(new Uint32List(256).buffer);\n"
1736 " list[index++] = Int8List.view(new Int64List(256).buffer);\n"
1737 " list[index++] = Uint8List.view(new Uint64List(256).buffer);\n"
1738 " list[index++] = Int8List.view(new Float32List(256).buffer);\n"
1739 " list[index++] = Uint8List.view(new Float32List(256).buffer);\n"
1740 " list[index++] = Int8List.view(new Float64List(256).buffer);\n"
1741 " list[index++] = Uint8List.view(new Float64List(256).buffer);\n"
1742 " list[index++] = Int8List.view(new Int32x4List(256).buffer);\n"
1743 " list[index++] = Uint8List.view(new Int32x4List(256).buffer);\n"
1744 " list[index++] = Int8List.view(new Float32x4List(256).buffer);\n"
1745 " list[index++] = Uint8List.view(new Float32x4List(256).buffer);\n"
1746 " list[index++] = Int8List.view(new Float64x2List(256).buffer);\n"
1747 " list[index++] = Uint8List.view(new Float64x2List(256).buffer);\n"
1748
1749 " list[index++] = Int16List.view(new Int8List(256).buffer);\n"
1750 " list[index++] = Uint16List.view(new Uint8List(256).buffer);\n"
1751 " list[index++] = Int16List.view(new Int32List(256).buffer);\n"
1752 " list[index++] = Uint16List.view(new Uint32List(256).buffer);\n"
1753 " list[index++] = Int16List.view(new Int64List(256).buffer);\n"
1754 " list[index++] = Uint16List.view(new Uint64List(256).buffer);\n"
1755 " list[index++] = Int16List.view(new Float32List(256).buffer);\n"
1756 " list[index++] = Uint16List.view(new Float32List(256).buffer);\n"
1757 " list[index++] = Int16List.view(new Float64List(256).buffer);\n"
1758 " list[index++] = Uint16List.view(new Float64List(256).buffer);\n"
1759 " list[index++] = Int16List.view(new Int32x4List(256).buffer);\n"
1760 " list[index++] = Uint16List.view(new Int32x4List(256).buffer);\n"
1761 " list[index++] = Int16List.view(new Float32x4List(256).buffer);\n"
1762 " list[index++] = Uint16List.view(new Float32x4List(256).buffer);\n"
1763 " list[index++] = Int16List.view(new Float64x2List(256).buffer);\n"
1764 " list[index++] = Uint16List.view(new Float64x2List(256).buffer);\n"
1765 " return list;\n"
1766 "}\n"
1767 "getMultipleTypedDataViewList() {\n"
1768 " var list = List<dynamic>.filled(13, null);\n"
1769 " var index = 0;\n"
1770 " var data = Uint8List(256).buffer;\n"
1771 " list[index++] = Int8List.view(data);\n"
1772 " list[index++] = Uint8List.view(data);\n"
1773 " list[index++] = Int16List.view(data);\n"
1774 " list[index++] = Uint16List.view(data);\n"
1775 " list[index++] = Int32List.view(data);\n"
1776 " list[index++] = Uint32List.view(data);\n"
1777 " list[index++] = Int64List.view(data);\n"
1778 " list[index++] = Uint64List.view(data);\n"
1779 " list[index++] = Float32List.view(data);\n"
1780 " list[index++] = Float64List.view(data);\n"
1781 " list[index++] = Int32x4List.view(data);\n"
1782 " list[index++] = Float32x4List.view(data);\n"
1783 " list[index++] = Float64x2List.view(data);\n"
1784 " return list;\n"
1785 "}\n";
1786
1787 TestCase::CreateTestIsolate();
1788 Thread* thread = Thread::Current();
1789 EXPECT(thread->isolate() != nullptr);
1791
1792 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
1793 EXPECT_VALID(lib);
1794
1795 {
1796 CHECK_API_SCOPE(thread);
1797 TransitionNativeToVM transition(thread);
1798 HANDLESCOPE(thread);
1799 StackZone zone(thread);
1800 {
1801 // Generate a list of Uint8Lists from Dart code.
1802 std::unique_ptr<Message> message = GetSerialized(lib, "getTypedDataList");
1803 ApiNativeScope scope;
1804 Dart_CObject* root = ReadApiMessage(scope.zone(), message.get());
1805 EXPECT_NOTNULL(root);
1806 EXPECT_EQ(Dart_CObject_kArray, root->type);
1807 struct {
1809 int size;
1810 } expected[] = {
1818
1819 int i = 0;
1820 while (expected[i].type != Dart_TypedData_kInvalid) {
1821 CheckTypedData(root->value.as_array.values[i], expected[i].type,
1822 expected[i].size);
1823 i++;
1824 }
1825 EXPECT_EQ(i, root->value.as_array.length);
1826 }
1827 {
1828 // Generate a list of Uint8List views from Dart code.
1829 std::unique_ptr<Message> message =
1830 GetSerialized(lib, "getTypedDataViewList");
1831 ApiNativeScope scope;
1832 Dart_CObject* root = ReadApiMessage(scope.zone(), message.get());
1833 EXPECT_NOTNULL(root);
1834 EXPECT_EQ(Dart_CObject_kArray, root->type);
1835 struct {
1837 int size;
1838 } expected[] = {
1846
1855
1864
1866
1867 int i = 0;
1868 while (expected[i].type != Dart_TypedData_kInvalid) {
1869 CheckTypedData(root->value.as_array.values[i], expected[i].type,
1870 expected[i].size);
1871 i++;
1872 }
1873 EXPECT_EQ(i, root->value.as_array.length);
1874 }
1875 {
1876 // Generate a list of Uint8Lists from Dart code.
1877 std::unique_ptr<Message> message =
1878 GetSerialized(lib, "getMultipleTypedDataViewList");
1879 ApiNativeScope scope;
1880 Dart_CObject* root = ReadApiMessage(scope.zone(), message.get());
1881 EXPECT_NOTNULL(root);
1882 EXPECT_EQ(Dart_CObject_kArray, root->type);
1883 struct {
1885 int size;
1886 } expected[] = {
1894
1895 int i = 0;
1896 while (expected[i].type != Dart_TypedData_kInvalid) {
1897 CheckTypedData(root->value.as_array.values[i], expected[i].type,
1898 expected[i].size);
1899
1900 // All views point to the same data.
1901 EXPECT_EQ(root->value.as_array.values[0]->value.as_typed_data.values,
1902 root->value.as_array.values[i]->value.as_typed_data.values);
1903 i++;
1904 }
1905 EXPECT_EQ(i, root->value.as_array.length);
1906 }
1907 }
1910}
static void CheckTypedData(Dart_CObject *object, Dart_TypedData_Type typed_data_type, int len)

◆ VM_UNIT_TEST_CASE() [42/107]

dart::VM_UNIT_TEST_CASE ( DartGeneratedMessages  )

Definition at line 842 of file snapshot_test.cc.

842 {
843 static const char* kCustomIsolateScriptChars =
844 "final int kArrayLength = 10;\n"
845 "getSmi() {\n"
846 " return 42;\n"
847 "}\n"
848 "getAsciiString() {\n"
849 " return \"Hello, world!\";\n"
850 "}\n"
851 "getNonAsciiString() {\n"
852 " return \"Blåbærgrød\";\n"
853 "}\n"
854 "getNonBMPString() {\n"
855 " return \"\\u{10000}\\u{1F601}\\u{1F637}\\u{20000}\";\n"
856 "}\n"
857 "getLeadSurrogateString() {\n"
858 " return String.fromCharCodes([0xd800]);\n"
859 "}\n"
860 "getTrailSurrogateString() {\n"
861 " return \"\\u{10000}\".substring(1);\n"
862 "}\n"
863 "getSurrogatesString() {\n"
864 " return String.fromCharCodes([0xdc00, 0xdc00, 0xd800, 0xd800]);\n"
865 "}\n"
866 "getCrappyString() {\n"
867 " return String.fromCharCodes([0xd800, 32, 0xdc00, 32]);\n"
868 "}\n"
869 "getList() {\n"
870 " return List.filled(kArrayLength, null);\n"
871 "}\n";
872
873 TestCase::CreateTestIsolate();
874 Isolate* isolate = Isolate::Current();
875 EXPECT(isolate != nullptr);
877
878 Dart_Handle lib =
879 TestCase::LoadTestScript(kCustomIsolateScriptChars, nullptr);
880 EXPECT_VALID(lib);
881 Dart_Handle smi_result;
882 smi_result = Dart_Invoke(lib, NewString("getSmi"), 0, nullptr);
883 EXPECT_VALID(smi_result);
884
885 Dart_Handle ascii_string_result;
886 ascii_string_result =
887 Dart_Invoke(lib, NewString("getAsciiString"), 0, nullptr);
888 EXPECT_VALID(ascii_string_result);
889 EXPECT(Dart_IsString(ascii_string_result));
890
891 Dart_Handle non_ascii_string_result;
892 non_ascii_string_result =
893 Dart_Invoke(lib, NewString("getNonAsciiString"), 0, nullptr);
894 EXPECT_VALID(non_ascii_string_result);
895 EXPECT(Dart_IsString(non_ascii_string_result));
896
897 Dart_Handle non_bmp_string_result;
898 non_bmp_string_result =
899 Dart_Invoke(lib, NewString("getNonBMPString"), 0, nullptr);
900 EXPECT_VALID(non_bmp_string_result);
901 EXPECT(Dart_IsString(non_bmp_string_result));
902
903 Dart_Handle lead_surrogate_string_result;
904 lead_surrogate_string_result =
905 Dart_Invoke(lib, NewString("getLeadSurrogateString"), 0, nullptr);
906 EXPECT_VALID(lead_surrogate_string_result);
907 EXPECT(Dart_IsString(lead_surrogate_string_result));
908
909 Dart_Handle trail_surrogate_string_result;
910 trail_surrogate_string_result =
911 Dart_Invoke(lib, NewString("getTrailSurrogateString"), 0, nullptr);
912 EXPECT_VALID(trail_surrogate_string_result);
913 EXPECT(Dart_IsString(trail_surrogate_string_result));
914
915 Dart_Handle surrogates_string_result;
916 surrogates_string_result =
917 Dart_Invoke(lib, NewString("getSurrogatesString"), 0, nullptr);
918 EXPECT_VALID(surrogates_string_result);
919 EXPECT(Dart_IsString(surrogates_string_result));
920
921 Dart_Handle crappy_string_result;
922 crappy_string_result =
923 Dart_Invoke(lib, NewString("getCrappyString"), 0, nullptr);
924 EXPECT_VALID(crappy_string_result);
925 EXPECT(Dart_IsString(crappy_string_result));
926
927 {
928 Thread* thread = Thread::Current();
929 CHECK_API_SCOPE(thread);
930 TransitionNativeToVM transition(thread);
931 HANDLESCOPE(thread);
932
933 {
934 StackZone zone(thread);
935 Smi& smi = Smi::Handle();
936 smi ^= Api::UnwrapHandle(smi_result);
937 std::unique_ptr<Message> message = WriteMessage(
938 /* same_group */ false, smi, ILLEGAL_PORT, Message::kNormalPriority);
939
940 // Read object back from the snapshot into a C structure.
941 ApiNativeScope scope;
942 Dart_CObject* root = ReadApiMessage(scope.zone(), message.get());
943 EXPECT_NOTNULL(root);
944 EXPECT_EQ(Dart_CObject_kInt32, root->type);
945 EXPECT_EQ(42, root->value.as_int32);
946 CheckEncodeDecodeMessage(scope.zone(), root);
947 }
948 CheckString(ascii_string_result, "Hello, world!");
949 CheckString(non_ascii_string_result, "Blåbærgrød");
950 CheckString(non_bmp_string_result,
951 "\xf0\x90\x80\x80"
952 "\xf0\x9f\x98\x81"
953 "\xf0\x9f\x98\xb7"
954 "\xf0\xa0\x80\x80");
955 CheckStringInvalid(lead_surrogate_string_result);
956 CheckStringInvalid(trail_surrogate_string_result);
957 CheckStringInvalid(crappy_string_result);
958 CheckStringInvalid(surrogates_string_result);
959 }
962}

◆ VM_UNIT_TEST_CASE() [43/107]

dart::VM_UNIT_TEST_CASE ( DecrementBy  )

Definition at line 43 of file atomic_test.cc.

43 {
45 v.fetch_sub(41);
46 EXPECT_EQ(static_cast<intptr_t>(1), v);
47}
T fetch_sub(T arg, std::memory_order order=std::memory_order_relaxed)
Definition atomic.h:38

◆ VM_UNIT_TEST_CASE() [44/107]

dart::VM_UNIT_TEST_CASE ( DirectoryCurrentNoScope  )

Definition at line 12 of file directory_test.cc.

12 {
13 char* current_dir = dart::bin::Directory::CurrentNoScope();
14 EXPECT_NOTNULL(current_dir);
15 free(current_dir);
16}
static char * CurrentNoScope()

◆ VM_UNIT_TEST_CASE() [45/107]

dart::VM_UNIT_TEST_CASE ( DoublesBitEqual  )

Definition at line 424 of file utils_test.cc.

424 {
425 EXPECT(Utils::DoublesBitEqual(1.0, 1.0));
426 EXPECT(!Utils::DoublesBitEqual(1.0, -1.0));
427 EXPECT(Utils::DoublesBitEqual(0.0, 0.0));
428 EXPECT(!Utils::DoublesBitEqual(0.0, -0.0));
429 EXPECT(Utils::DoublesBitEqual(NAN, NAN));
430}

◆ VM_UNIT_TEST_CASE() [46/107]

dart::VM_UNIT_TEST_CASE ( DuplicateRXVirtualMemory  )

Definition at line 100 of file virtual_memory_test.cc.

100 {
101 const uword page_size = VirtualMemory::PageSize();
102 const uword pointer = reinterpret_cast<uword>(&testFunction);
103 const uword page_start = Utils::RoundDown(pointer, page_size);
104 const uword offset = pointer - page_start;
105
106 // Grab 2 * page_size, in case testFunction happens to land near the end of
107 // the page.
108 VirtualMemory* vm = VirtualMemory::ForImagePage(
109 reinterpret_cast<void*>(page_start), 2 * page_size);
110 EXPECT_NE(nullptr, vm);
111
112#if defined(DART_HOST_OS_MACOS) && !defined(DART_PRECOMPILED_RUNTIME)
113 // If we are not going to use vm_remap then we need to pass
114 // is_executable=true so that pages get allocated with MAP_JIT flag if
115 // necessary. Otherwise OS will kill us with a codesigning violation if
116 // hardened runtime is enabled.
117 const bool is_executable = true;
118#else
119 const bool is_executable = false;
120#endif
121
122 VirtualMemory* vm2 = VirtualMemory::AllocateAligned(
123 vm->size(), kPageSize, is_executable,
124 /*is_compressed=*/false, "FfiCallbackMetadata::TrampolinePage");
125 bool ok = vm->DuplicateRX(vm2);
126 EXPECT_EQ(true, ok);
127
128 auto testFunction2 = reinterpret_cast<int (*)(int)>(vm2->start() + offset);
129 EXPECT_NE(&testFunction, testFunction2);
130
131 EXPECT_EQ(246, testFunction2(123));
132
133 delete vm;
134 delete vm2;
135}
bool DuplicateRX(VirtualMemory *target)
static int testFunction(int x)

◆ VM_UNIT_TEST_CASE() [47/107]

dart::VM_UNIT_TEST_CASE ( Endianity  )

Definition at line 380 of file utils_test.cc.

380 {
381 uint16_t value16be = Utils::HostToBigEndian16(0xf1);
382 EXPECT_EQ(0x0, reinterpret_cast<uint8_t*>(&value16be)[0]);
383 EXPECT_EQ(0xf1, reinterpret_cast<uint8_t*>(&value16be)[1]);
384
385 uint16_t value16le = Utils::HostToLittleEndian16(0xf1);
386 EXPECT_EQ(0xf1, reinterpret_cast<uint8_t*>(&value16le)[0]);
387 EXPECT_EQ(0x0, reinterpret_cast<uint8_t*>(&value16le)[1]);
388
389 uint32_t value32be = Utils::HostToBigEndian32(0xf1f2);
390 EXPECT_EQ(0x0, reinterpret_cast<uint8_t*>(&value32be)[0]);
391 EXPECT_EQ(0x0, reinterpret_cast<uint8_t*>(&value32be)[1]);
392 EXPECT_EQ(0xf1, reinterpret_cast<uint8_t*>(&value32be)[2]);
393 EXPECT_EQ(0xf2, reinterpret_cast<uint8_t*>(&value32be)[3]);
394 EXPECT_EQ(0xf1f2u, Utils::BigEndianToHost32(value32be));
395
396 uint32_t value32le = Utils::HostToLittleEndian32(0xf1f2);
397 EXPECT_EQ(0xf2, reinterpret_cast<uint8_t*>(&value32le)[0]);
398 EXPECT_EQ(0xf1, reinterpret_cast<uint8_t*>(&value32le)[1]);
399 EXPECT_EQ(0x0, reinterpret_cast<uint8_t*>(&value32le)[2]);
400 EXPECT_EQ(0x0, reinterpret_cast<uint8_t*>(&value32le)[3]);
401
402 uint64_t value64be = Utils::HostToBigEndian64(0xf1f2f3f4);
403 EXPECT_EQ(0x0, reinterpret_cast<uint8_t*>(&value64be)[0]);
404 EXPECT_EQ(0x0, reinterpret_cast<uint8_t*>(&value64be)[1]);
405 EXPECT_EQ(0x0, reinterpret_cast<uint8_t*>(&value64be)[2]);
406 EXPECT_EQ(0x0, reinterpret_cast<uint8_t*>(&value64be)[3]);
407 EXPECT_EQ(0xf1, reinterpret_cast<uint8_t*>(&value64be)[4]);
408 EXPECT_EQ(0xf2, reinterpret_cast<uint8_t*>(&value64be)[5]);
409 EXPECT_EQ(0xf3, reinterpret_cast<uint8_t*>(&value64be)[6]);
410 EXPECT_EQ(0xf4, reinterpret_cast<uint8_t*>(&value64be)[7]);
411
412 uint64_t value64le = Utils::HostToLittleEndian64(0xf1f2f3f4);
413 EXPECT_EQ(0xf4, reinterpret_cast<uint8_t*>(&value64le)[0]);
414 EXPECT_EQ(0xf3, reinterpret_cast<uint8_t*>(&value64le)[1]);
415 EXPECT_EQ(0xf2, reinterpret_cast<uint8_t*>(&value64le)[2]);
416 EXPECT_EQ(0xf1, reinterpret_cast<uint8_t*>(&value64le)[3]);
417 EXPECT_EQ(0x0, reinterpret_cast<uint8_t*>(&value64le)[4]);
418 EXPECT_EQ(0x0, reinterpret_cast<uint8_t*>(&value64le)[5]);
419 EXPECT_EQ(0x0, reinterpret_cast<uint8_t*>(&value64le)[6]);
420 EXPECT_EQ(0x0, reinterpret_cast<uint8_t*>(&value64le)[7]);
421 EXPECT_EQ(0xf1f2f3f4ul, Utils::LittleEndianToHost64(value64le));
422}

◆ VM_UNIT_TEST_CASE() [48/107]

dart::VM_UNIT_TEST_CASE ( ExtendedRegion  )

Definition at line 58 of file memory_region_test.cc.

58 {
59 const uword kSize = 1024;
60 const uword kSubSize = 512;
61 const uword kExtendSize = 512;
63 MemoryRegion sub_region;
64 sub_region.Subregion(region, 0, kSubSize);
65 MemoryRegion extended_region;
66 extended_region.Extend(sub_region, kExtendSize);
67 EXPECT_EQ(kSize, extended_region.size());
68 EXPECT(extended_region.pointer() == region.pointer());
69 EXPECT(extended_region.pointer() == sub_region.pointer());
70
71 extended_region.Store<int32_t>(0, 42);
72 EXPECT_EQ(42, extended_region.Load<int32_t>(0));
73
74 DeleteRegion(region);
75}
void Subregion(const MemoryRegion &from, uword offset, uword size)
void * pointer() const
void Store(uword offset, T value) const
uword size() const
T Load(uword offset) const
void Extend(const MemoryRegion &region, uword extra)
static void * NewRegion(uword size)
static void DeleteRegion(const MemoryRegion &region)

◆ VM_UNIT_TEST_CASE() [49/107]

dart::VM_UNIT_TEST_CASE ( FetchAndDecrement  )

Definition at line 19 of file atomic_test.cc.

19 {
21 EXPECT_EQ(static_cast<uintptr_t>(42), v.fetch_sub(1));
22 EXPECT_EQ(static_cast<uintptr_t>(41), v);
23}

◆ VM_UNIT_TEST_CASE() [50/107]

dart::VM_UNIT_TEST_CASE ( FetchAndDecrementSigned  )

Definition at line 31 of file atomic_test.cc.

31 {
33 EXPECT_EQ(static_cast<intptr_t>(-42), v.fetch_sub(1));
34 EXPECT_EQ(static_cast<intptr_t>(-43), v);
35}

◆ VM_UNIT_TEST_CASE() [51/107]

dart::VM_UNIT_TEST_CASE ( FetchAndIncrement  )

Definition at line 13 of file atomic_test.cc.

13 {
15 EXPECT_EQ(static_cast<uintptr_t>(42), v.fetch_add(1));
16 EXPECT_EQ(static_cast<uintptr_t>(43), v);
17}
T fetch_add(T arg, std::memory_order order=std::memory_order_relaxed)
Definition atomic.h:35

◆ VM_UNIT_TEST_CASE() [52/107]

dart::VM_UNIT_TEST_CASE ( FetchAndIncrementSigned  )

Definition at line 25 of file atomic_test.cc.

25 {
27 EXPECT_EQ(static_cast<intptr_t>(-42), v.fetch_add(1));
28 EXPECT_EQ(static_cast<intptr_t>(-41), v);
29}

◆ VM_UNIT_TEST_CASE() [53/107]

dart::VM_UNIT_TEST_CASE ( FetchAndRelaxed  )

Definition at line 56 of file atomic_test.cc.

56 {
58 uint32_t previous = v.fetch_and(3);
59 EXPECT_EQ(static_cast<uint32_t>(42), previous);
60 EXPECT_EQ(static_cast<uint32_t>(2), v);
61}
T fetch_and(T arg, std::memory_order order=std::memory_order_relaxed)
Definition atomic.h:44

◆ VM_UNIT_TEST_CASE() [54/107]

dart::VM_UNIT_TEST_CASE ( FetchOrRelaxed  )

Definition at line 49 of file atomic_test.cc.

49 {
51 uint32_t previous = v.fetch_or(3);
52 EXPECT_EQ(static_cast<uint32_t>(42), previous);
53 EXPECT_EQ(static_cast<uint32_t>(43), v);
54}
T fetch_or(T arg, std::memory_order order=std::memory_order_relaxed)
Definition atomic.h:41

◆ VM_UNIT_TEST_CASE() [55/107]

dart::VM_UNIT_TEST_CASE ( FfiCallbackMetadata_CreateAsyncFfiCallback  )

Definition at line 168 of file ffi_callback_metadata_test.cc.

171 {
172 auto* fcm = FfiCallbackMetadata::Instance();
175
176 {
177 TestIsolateScope isolate_scope;
178 Thread* thread = Thread::Current();
179 Isolate* isolate = thread->isolate();
180 ASSERT(thread->isolate() == isolate_scope.isolate());
181 TransitionNativeToVM transition(thread);
182 StackZone stack_zone(thread);
183 HandleScope handle_scope(thread);
184
185 auto* zone = thread->zone();
186
187 const Function& func =
188 Function::Handle(CreateTestFunction(FfiCallbackKind::kAsyncCallback));
189 const Code& code = Code::Handle(func.EnsureHasCode());
190 EXPECT(!code.IsNull());
191
192 EXPECT_EQ(isolate->ffi_callback_list_head(), nullptr);
193
194 auto port1 = PortMap::CreatePort(new FakeMessageHandler());
195 tramp1 = isolate->CreateAsyncFfiCallback(zone, func, port1);
196 EXPECT_NE(tramp1, 0u);
197
198 {
200 fcm->LookupMetadataForTrampoline(tramp1);
201 EXPECT(m1.IsLive());
202 EXPECT_EQ(m1.target_isolate(), isolate);
203 EXPECT_EQ(m1.target_entry_point(), code.EntryPoint());
204 EXPECT_EQ(m1.send_port(), port1);
205 EXPECT_EQ(static_cast<int>(m1.trampoline_type()),
206 static_cast<int>(FfiCallbackMetadata::TrampolineType::kAsync));
207
208 // head -> tramp1
209 auto* e1 = fcm->MetadataOfTrampoline(tramp1);
210 EXPECT_EQ(isolate->ffi_callback_list_head(), e1);
211 EXPECT_EQ(e1->list_prev(), nullptr);
212 EXPECT_EQ(e1->list_next(), nullptr);
213 }
214
215 auto port2 = PortMap::CreatePort(new FakeMessageHandler());
216 tramp2 = isolate->CreateAsyncFfiCallback(zone, func, port2);
217 EXPECT_NE(tramp2, 0u);
218 EXPECT_NE(tramp2, tramp1);
219
220 {
221 FfiCallbackMetadata::Metadata m2 =
222 fcm->LookupMetadataForTrampoline(tramp2);
223 EXPECT(m2.IsLive());
224 EXPECT_EQ(m2.target_isolate(), isolate);
225 EXPECT_EQ(m2.target_entry_point(), code.EntryPoint());
226 EXPECT_EQ(m2.send_port(), port2);
227 EXPECT_EQ(static_cast<int>(m2.trampoline_type()),
228 static_cast<int>(FfiCallbackMetadata::TrampolineType::kAsync));
229 }
230
231 {
232 // head -> tramp2 -> tramp1
233 auto* e1 = fcm->MetadataOfTrampoline(tramp1);
234 auto* e2 = fcm->MetadataOfTrampoline(tramp2);
235 EXPECT_EQ(isolate->ffi_callback_list_head(), e2);
236 EXPECT_EQ(e2->list_prev(), nullptr);
237 EXPECT_EQ(e2->list_next(), e1);
238 EXPECT_EQ(e1->list_prev(), e2);
239 EXPECT_EQ(e1->list_next(), nullptr);
240 }
241
242 {
243 isolate->DeleteFfiCallback(tramp2);
244 FfiCallbackMetadata::Metadata m2 =
245 fcm->LookupMetadataForTrampoline(tramp2);
246 EXPECT(!m2.IsLive());
247
248 // head -> tramp1
249 auto* e1 = fcm->MetadataOfTrampoline(tramp1);
250 EXPECT_EQ(isolate->ffi_callback_list_head(), e1);
251 EXPECT_EQ(e1->list_prev(), nullptr);
252 EXPECT_EQ(e1->list_next(), nullptr);
253 }
254 }
255
256 {
257 // Isolate has shut down, so all callbacks should be deleted.
258 FfiCallbackMetadata::Metadata m1 = fcm->LookupMetadataForTrampoline(tramp1);
259 EXPECT(!m1.IsLive());
260
261 FfiCallbackMetadata::Metadata m2 = fcm->LookupMetadataForTrampoline(tramp2);
FfiCallbackMetadata::Trampoline CreateAsyncFfiCallback(Zone *zone, const Function &send_function, Dart_Port send_port)
Definition isolate.cc:3686
FfiCallbackMetadata::Metadata * ffi_callback_list_head()
Definition isolate.h:1234
void DeleteFfiCallback(FfiCallbackMetadata::Trampoline callback)
Definition isolate.cc:3755

◆ VM_UNIT_TEST_CASE() [56/107]

dart::VM_UNIT_TEST_CASE ( FfiCallbackMetadata_CreateIsolateLocalFfiCallback  )

Definition at line 263 of file ffi_callback_metadata_test.cc.

266 {
267 auto* fcm = FfiCallbackMetadata::Instance();
270
271 {
272 TestIsolateScope isolate_scope;
273 Thread* thread = Thread::Current();
274 Isolate* isolate = thread->isolate();
275 ASSERT(thread->isolate() == isolate_scope.isolate());
276 TransitionNativeToVM transition(thread);
277 StackZone stack_zone(thread);
278 HandleScope handle_scope(thread);
279
280 auto* zone = thread->zone();
281
282 const Function& func = Function::Handle(
283 CreateTestFunction(FfiCallbackKind::kIsolateLocalClosureCallback));
284 const Code& code = Code::Handle(func.EnsureHasCode());
285 EXPECT(!code.IsNull());
286
287 // Using a FfiCallbackKind::kSync function as a dummy closure.
288 const Function& closure_func = Function::Handle(
289 CreateTestFunction(FfiCallbackKind::kIsolateLocalStaticCallback));
290 const Context& context = Context::Handle(Context::null());
291 const Closure& closure1 = Closure::Handle(
292 Closure::New(Object::null_type_arguments(),
293 Object::null_type_arguments(), closure_func, context));
294
295 EXPECT_EQ(isolate->ffi_callback_list_head(), nullptr);
296
297 tramp1 = isolate->CreateIsolateLocalFfiCallback(zone, func, closure1, true);
298 EXPECT_NE(tramp1, 0u);
299
300 {
302 fcm->LookupMetadataForTrampoline(tramp1);
303 EXPECT(m1.IsLive());
304 EXPECT_EQ(m1.target_isolate(), isolate);
305 EXPECT_EQ(m1.target_entry_point(), code.EntryPoint());
306 EXPECT_EQ(m1.closure_handle()->ptr(), closure1.ptr());
307 EXPECT_EQ(static_cast<int>(m1.trampoline_type()),
308 static_cast<int>(FfiCallbackMetadata::TrampolineType::kSync));
309
310 // head -> tramp1
311 auto* e1 = fcm->MetadataOfTrampoline(tramp1);
312 EXPECT_EQ(isolate->ffi_callback_list_head(), e1);
313 EXPECT_EQ(e1->list_prev(), nullptr);
314 EXPECT_EQ(e1->list_next(), nullptr);
315 }
316
317 const Closure& closure2 = Closure::Handle(
318 Closure::New(Object::null_type_arguments(),
319 Object::null_type_arguments(), closure_func, context));
320 tramp2 = isolate->CreateIsolateLocalFfiCallback(zone, func, closure2, true);
321 EXPECT_NE(tramp2, 0u);
322 EXPECT_NE(tramp2, tramp1);
323
324 {
325 FfiCallbackMetadata::Metadata m2 =
326 fcm->LookupMetadataForTrampoline(tramp2);
327 EXPECT(m2.IsLive());
328 EXPECT_EQ(m2.target_isolate(), isolate);
329 EXPECT_EQ(m2.target_entry_point(), code.EntryPoint());
330 EXPECT_EQ(m2.closure_handle()->ptr(), closure2.ptr());
331 EXPECT_EQ(static_cast<int>(m2.trampoline_type()),
332 static_cast<int>(FfiCallbackMetadata::TrampolineType::kSync));
333 }
334
335 {
336 // head -> tramp2 -> tramp1
337 auto* e1 = fcm->MetadataOfTrampoline(tramp1);
338 auto* e2 = fcm->MetadataOfTrampoline(tramp2);
339 EXPECT_EQ(isolate->ffi_callback_list_head(), e2);
340 EXPECT_EQ(e2->list_prev(), nullptr);
341 EXPECT_EQ(e2->list_next(), e1);
342 EXPECT_EQ(e1->list_prev(), e2);
343 EXPECT_EQ(e1->list_next(), nullptr);
344 }
345
346 {
347 isolate->DeleteFfiCallback(tramp2);
348 FfiCallbackMetadata::Metadata m2 =
349 fcm->LookupMetadataForTrampoline(tramp2);
350 EXPECT(!m2.IsLive());
351
352 // head -> tramp1
353 auto* e1 = fcm->MetadataOfTrampoline(tramp1);
354 EXPECT_EQ(isolate->ffi_callback_list_head(), e1);
355 EXPECT_EQ(e1->list_prev(), nullptr);
356 EXPECT_EQ(e1->list_next(), nullptr);
357 }
358 }
359
360 {
361 // Isolate has shut down, so all callbacks should be deleted.
362 FfiCallbackMetadata::Metadata m1 = fcm->LookupMetadataForTrampoline(tramp1);
363 EXPECT(!m1.IsLive());
364
365 FfiCallbackMetadata::Metadata m2 = fcm->LookupMetadataForTrampoline(tramp2);
PersistentHandle * closure_handle() const
FfiCallbackMetadata::Trampoline CreateIsolateLocalFfiCallback(Zone *zone, const Function &trampoline, const Closure &target, bool keep_isolate_alive)
Definition isolate.cc:3694

◆ VM_UNIT_TEST_CASE() [57/107]

dart::VM_UNIT_TEST_CASE ( FfiCallbackMetadata_CreateSyncFfiCallback  )

Definition at line 75 of file ffi_callback_metadata_test.cc.

78 {
79 auto* fcm = FfiCallbackMetadata::Instance();
82
83 {
84 TestIsolateScope isolate_scope;
85 Thread* thread = Thread::Current();
86 Isolate* isolate = thread->isolate();
87 ASSERT(isolate == isolate_scope.isolate());
88 TransitionNativeToVM transition(thread);
89 StackZone stack_zone(thread);
90 HandleScope handle_scope(thread);
91
92 auto* zone = thread->zone();
93
94 const auto& func = Function::Handle(
95 CreateTestFunction(FfiCallbackKind::kIsolateLocalStaticCallback));
96 const auto& code = Code::Handle(func.EnsureHasCode());
97 EXPECT(!code.IsNull());
98
99 tramp1 = isolate->CreateIsolateLocalFfiCallback(
100 zone, func, Closure::Handle(Closure::null()), false);
101 EXPECT_NE(tramp1, 0u);
102
103 {
105 fcm->LookupMetadataForTrampoline(tramp1);
106 EXPECT(m1.IsLive());
107 EXPECT_EQ(m1.target_isolate(), isolate);
108 EXPECT_EQ(m1.target_entry_point(), code.EntryPoint());
109 EXPECT_EQ(m1.closure_handle(), nullptr);
110 EXPECT_EQ(static_cast<int>(m1.trampoline_type()),
111 static_cast<int>(FfiCallbackMetadata::TrampolineType::kSync));
112
113 // head -> tramp1
114 auto* e1 = fcm->MetadataOfTrampoline(tramp1);
115 EXPECT_EQ(isolate->ffi_callback_list_head(), e1);
116 EXPECT_EQ(e1->list_prev(), nullptr);
117 EXPECT_EQ(e1->list_next(), nullptr);
118 }
119
120 tramp2 = isolate->CreateIsolateLocalFfiCallback(
121 zone, func, Closure::Handle(Closure::null()), false);
122 EXPECT_NE(tramp2, 0u);
123 EXPECT_NE(tramp2, tramp1);
124
125 {
126 FfiCallbackMetadata::Metadata m2 =
127 fcm->LookupMetadataForTrampoline(tramp2);
128 EXPECT(m2.IsLive());
129 EXPECT_EQ(m2.target_isolate(), isolate);
130 EXPECT_EQ(m2.target_entry_point(), code.EntryPoint());
131 EXPECT_EQ(m2.closure_handle(), nullptr);
132 EXPECT_EQ(static_cast<int>(m2.trampoline_type()),
133 static_cast<int>(FfiCallbackMetadata::TrampolineType::kSync));
134 }
135
136 {
137 // head -> tramp2 -> tramp1
138 auto* e1 = fcm->MetadataOfTrampoline(tramp1);
139 auto* e2 = fcm->MetadataOfTrampoline(tramp2);
140 EXPECT_EQ(isolate->ffi_callback_list_head(), e2);
141 EXPECT_EQ(e2->list_prev(), nullptr);
142 EXPECT_EQ(e2->list_next(), e1);
143 EXPECT_EQ(e1->list_prev(), e2);
144 EXPECT_EQ(e1->list_next(), nullptr);
145 }
146
147 {
148 isolate->DeleteFfiCallback(tramp1);
149 FfiCallbackMetadata::Metadata m1 =
150 fcm->LookupMetadataForTrampoline(tramp1);
151 EXPECT(!m1.IsLive());
152
153 // head -> tramp2
154 auto* e2 = fcm->MetadataOfTrampoline(tramp2);
155 EXPECT_EQ(isolate->ffi_callback_list_head(), e2);
156 EXPECT_EQ(e2->list_prev(), nullptr);
157 EXPECT_EQ(e2->list_next(), nullptr);
158 }
159 }
160
161 {
162 // Isolate has shut down, so all callbacks should be deleted.
163 FfiCallbackMetadata::Metadata m1 = fcm->LookupMetadataForTrampoline(tramp1);
164 EXPECT(!m1.IsLive());
165
166 FfiCallbackMetadata::Metadata m2 = fcm->LookupMetadataForTrampoline(tramp2);

◆ VM_UNIT_TEST_CASE() [58/107]

dart::VM_UNIT_TEST_CASE ( FfiCallbackMetadata_DeleteTrampolines  )

Definition at line 423 of file ffi_callback_metadata_test.cc.

426 {
427 static constexpr int kCreations = 1000;
428 static constexpr int kDeletions = 100;
429
430 TestIsolateScope isolate_scope;
431 Thread* thread = Thread::Current();
432 Isolate* isolate = thread->isolate();
433 ASSERT(isolate == isolate_scope.isolate());
434 TransitionNativeToVM transition(thread);
435 StackZone stack_zone(thread);
436 HandleScope handle_scope(thread);
437
438 auto* fcm = FfiCallbackMetadata::Instance();
439 std::unordered_set<FfiCallbackMetadata::Trampoline> tramps;
440 FfiCallbackMetadata::Metadata* list_head = nullptr;
441
442 const auto& sync_func = Function::Handle(
443 CreateTestFunction(FfiCallbackKind::kIsolateLocalStaticCallback));
444 const auto& sync_code = Code::Handle(sync_func.EnsureHasCode());
445 EXPECT(!sync_code.IsNull());
446
447 // Create some callbacks.
448 for (int itr = 0; itr < kCreations; ++itr) {
449 tramps.insert(fcm->CreateIsolateLocalFfiCallback(
450 isolate, thread->zone(), sync_func, Closure::Handle(Closure::null()),
451 &list_head));
452 }
453
454 // Delete some of the callbacks.
455 for (int itr = 0; itr < kDeletions; ++itr) {
456 auto tramp = *tramps.begin();
457 fcm->DeleteCallback(tramp, &list_head);
458 tramps.erase(tramp);
459 }
460
461 // Verify all the callbacks.
462 for (FfiCallbackMetadata::Trampoline tramp : tramps) {
463 auto metadata = fcm->LookupMetadataForTrampoline(tramp);
464 EXPECT(metadata.IsLive());
465 EXPECT_EQ(metadata.target_isolate(), isolate);
466 EXPECT_EQ(static_cast<int>(metadata.trampoline_type()),
467 static_cast<int>(FfiCallbackMetadata::TrampolineType::kSync));
468 EXPECT_EQ(metadata.target_entry_point(), sync_code.EntryPoint());
469 }
470
471 // Verify the list of callbacks.
472 uword list_length = 0;
473 for (FfiCallbackMetadata::Metadata* m = list_head; m != nullptr;) {
474 ++list_length;
475 auto tramp = fcm->TrampolineOfMetadata(m);
476 EXPECT(m->IsLive());
477 EXPECT_EQ(m->target_isolate(), isolate);
478 EXPECT_EQ(tramps.count(tramp), 1u);
479 auto* next = m->list_next();
480 auto* prev = m->list_prev();
481 if (prev != nullptr) {
482 EXPECT_EQ(prev->list_next(), m);
483 } else {
484 EXPECT_EQ(list_head, m);
485 }
486 if (next != nullptr) {
487 EXPECT_EQ(next->list_prev(), m);
488 }
489 m = m->list_next();
490 }
491 EXPECT_EQ(list_length, tramps.size());
492
493 // Delete all callbacks and verify they're destroyed.
494 fcm->DeleteAllCallbacks(&list_head);
495 EXPECT_EQ(list_head, nullptr);
496 for (FfiCallbackMetadata::Trampoline tramp : tramps) {

◆ VM_UNIT_TEST_CASE() [59/107]

dart::VM_UNIT_TEST_CASE ( FreeVirtualMemory  )

Definition at line 68 of file virtual_memory_test.cc.

68 {
69 // Reservations should always be handed back to OS upon destruction.
70 const intptr_t kVirtualMemoryBlockSize = 10 * MB;
71 const intptr_t kIterations = 900; // Enough to exhaust 32-bit address space.
72 for (intptr_t i = 0; i < kIterations; ++i) {
73 VirtualMemory* vm =
74 VirtualMemory::Allocate(kVirtualMemoryBlockSize, false, false, "test");
75 delete vm;
76 }
77 // Check that truncation does not introduce leaks.
78 for (intptr_t i = 0; i < kIterations; ++i) {
79 VirtualMemory* vm =
80 VirtualMemory::Allocate(kVirtualMemoryBlockSize, false, false, "test");
81 vm->Truncate(kVirtualMemoryBlockSize / 2);
82 delete vm;
83 }
84 for (intptr_t i = 0; i < kIterations; ++i) {
85 VirtualMemory* vm =
86 VirtualMemory::Allocate(kVirtualMemoryBlockSize, true, false, "test");
87 vm->Truncate(0);
88 delete vm;
89 }
90}

◆ VM_UNIT_TEST_CASE() [60/107]

dart::VM_UNIT_TEST_CASE ( FullSnapshot  )

Definition at line 709 of file snapshot_test.cc.

709 {
710 // clang-format off
711 auto kScriptChars = Utils::CStringUniquePtr(
712 OS::SCreate(
713 nullptr,
714 "class Fields {\n"
715 " Fields(int i, int j) : fld1 = i, fld2 = j {}\n"
716 " int fld1;\n"
717 " final int fld2;\n"
718 " final int bigint_fld = 0xfffffffffff;\n"
719 " static int%s fld3;\n"
720 " static const int smi_sfld = 10;\n"
721 " static const int bigint_sfld = 0xfffffffffff;\n"
722 "}\n"
723 "class Expect {\n"
724 " static void equals(x, y) {\n"
725 " if (x != y) throw new ArgumentError('not equal');\n"
726 " }\n"
727 "}\n"
728 "class FieldsTest {\n"
729 " static Fields testMain() {\n"
730 " Expect.equals(true, Fields.bigint_sfld == 0xfffffffffff);\n"
731 " Fields obj = new Fields(10, 20);\n"
732 " Expect.equals(true, obj.bigint_fld == 0xfffffffffff);\n"
733 " return obj;\n"
734 " }\n"
735 "}\n",
736 TestCase::NullableTag()),
737 std::free);
738 // clang-format on
740
741 uint8_t* isolate_snapshot_data_buffer;
742
743 // Start an Isolate, load a script and create a full snapshot.
744 Timer timer1;
745 timer1.Start();
746 {
747 TestIsolateScope __test_isolate__;
748
749 // Create a test library and Load up a test script in it.
750 TestCase::LoadTestScript(kScriptChars.get(), nullptr);
751
752 Thread* thread = Thread::Current();
753 TransitionNativeToVM transition(thread);
754 StackZone zone(thread);
755 HandleScope scope(thread);
756
757 Dart_Handle result = Api::CheckAndFinalizePendingClasses(thread);
758 {
759 TransitionVMToNative to_native(thread);
761 }
762 timer1.Stop();
763 OS::PrintErr("Without Snapshot: %" Pd64 "us\n", timer1.TotalElapsedTime());
764
765 // Write snapshot with object content.
766 MallocWriteStream isolate_snapshot_data(FullSnapshotWriter::kInitialSize);
767 FullSnapshotWriter writer(
768 Snapshot::kFull, /*vm_snapshot_data=*/nullptr, &isolate_snapshot_data,
769 /*vm_image_writer=*/nullptr, /*iso_image_writer=*/nullptr);
770 writer.WriteFullSnapshot();
771 // Take ownership so it doesn't get freed by the stream destructor.
772 intptr_t unused;
773 isolate_snapshot_data_buffer = isolate_snapshot_data.Steal(&unused);
774 }
775
776 // Now Create another isolate using the snapshot and execute a method
777 // from the script.
778 Timer timer2;
779 timer2.Start();
780 TestCase::CreateTestIsolateFromSnapshot(isolate_snapshot_data_buffer);
781 {
782 Dart_EnterScope(); // Start a Dart API scope for invoking API functions.
783 timer2.Stop();
784 OS::PrintErr("From Snapshot: %" Pd64 "us\n", timer2.TotalElapsedTime());
785
786 // Invoke a function which returns an object.
787 Dart_Handle cls = Dart_GetClass(TestCase::lib(), NewString("FieldsTest"));
788 result = Dart_Invoke(cls, NewString("testMain"), 0, nullptr);
791 }
793 free(isolate_snapshot_data_buffer);
794}

◆ VM_UNIT_TEST_CASE() [61/107]

dart::VM_UNIT_TEST_CASE ( GetCpuModelTest  )

Definition at line 12 of file cpuinfo_test.cc.

12 {
13 const char* cpumodel = CpuInfo::GetCpuModel();
14 EXPECT_NE(strlen(cpumodel), 0UL);
15 // caller is responsible for deleting the returned cpumodel string.
16 free(const_cast<char*>(cpumodel));
17}

◆ VM_UNIT_TEST_CASE() [62/107]

dart::VM_UNIT_TEST_CASE ( Id  )

Definition at line 12 of file cpu_test.cc.

12 {
13#if defined(TARGET_ARCH_IA32)
14 EXPECT_STREQ("ia32", CPU::Id());
15#elif defined(TARGET_ARCH_X64)
16 EXPECT_STREQ("x64", CPU::Id());
17#elif defined(TARGET_ARCH_ARM)
18#if defined(HOST_ARCH_ARM)
19 EXPECT_STREQ("arm", CPU::Id());
20#else // defined(HOST_ARCH_ARM)
21 EXPECT_STREQ("simarm", CPU::Id());
22#endif // defined(HOST_ARCH_ARM)
23#elif defined(TARGET_ARCH_ARM64)
24#if defined(HOST_ARCH_ARM64)
25 EXPECT_STREQ("arm64", CPU::Id());
26#else // defined(HOST_ARCH_ARM64)
27 EXPECT_STREQ("simarm64", CPU::Id());
28#endif // defined(HOST_ARCH_ARM64)
29#elif defined(TARGET_ARCH_RISCV32)
30#if defined(HOST_ARCH_RISCV32)
31 EXPECT_STREQ("riscv32", CPU::Id());
32#else // defined(HOST_ARCH_RISCV32)
33 EXPECT_STREQ("simriscv32", CPU::Id());
34#endif // defined(HOST_ARCH_RISCV32)
35#elif defined(TARGET_ARCH_RISCV64)
36#if defined(HOST_ARCH_RISCV64)
37 EXPECT_STREQ("riscv64", CPU::Id());
38#else // defined(HOST_ARCH_RISCV64)
39 EXPECT_STREQ("simriscv64", CPU::Id());
40#endif // defined(HOST_ARCH_RISCV64)
41#else
42#error Architecture was not detected as supported by Dart.
43#endif
44}

◆ VM_UNIT_TEST_CASE() [63/107]

dart::VM_UNIT_TEST_CASE ( IncrementBy  )

Definition at line 37 of file atomic_test.cc.

37 {
39 v.fetch_add(100);
40 EXPECT_EQ(static_cast<intptr_t>(142), v);
41}

◆ VM_UNIT_TEST_CASE() [64/107]

dart::VM_UNIT_TEST_CASE ( IsAligned  )

Definition at line 102 of file utils_test.cc.

102 {
103 EXPECT(Utils::IsAligned(0, 1));
104 EXPECT(Utils::IsAligned(1, 1));
105
106 EXPECT(Utils::IsAligned(0, 2));
107 EXPECT(!Utils::IsAligned(1, 2));
108 EXPECT(Utils::IsAligned(2, 2));
109
110 EXPECT(Utils::IsAligned(32, 8));
111 EXPECT(!Utils::IsAligned(33, 8));
112 EXPECT(Utils::IsAligned(40, 8));
113
114 EXPECT(!Utils::IsAligned(0, 8, 4));
115 EXPECT(!Utils::IsAligned(1, 8, 4));
116 EXPECT(Utils::IsAligned(4, 8, 4));
117 EXPECT(!Utils::IsAligned(8, 8, 4));
118 EXPECT(!Utils::IsAligned(9, 8, 4));
119 EXPECT(Utils::IsAligned(12, 8, 4));
120}

◆ VM_UNIT_TEST_CASE() [65/107]

dart::VM_UNIT_TEST_CASE ( IsInt  )

Definition at line 277 of file utils_test.cc.

277 {
278 EXPECT(Utils::IsInt(8, 16));
279 EXPECT(Utils::IsInt(8, 16U));
280 EXPECT(Utils::IsInt(8, 127));
281 EXPECT(Utils::IsInt(8, 127U));
282 EXPECT(Utils::IsInt(8, -128));
283 EXPECT(!Utils::IsInt(8, static_cast<unsigned int>(-128)));
284 EXPECT(!Utils::IsInt(8, 255));
285 EXPECT(!Utils::IsInt(8, 255U));
286 EXPECT(Utils::IsInt(16, 16));
287 EXPECT(Utils::IsInt(16, 16U));
288 EXPECT(!Utils::IsInt(16, 65535));
289 EXPECT(!Utils::IsInt(16, 65535U));
290 EXPECT(Utils::IsInt(16, 32767));
291 EXPECT(Utils::IsInt(16, 32767U));
292 EXPECT(Utils::IsInt(16, -32768));
293 EXPECT(!Utils::IsInt(16, static_cast<unsigned int>(-32768)));
294 EXPECT(Utils::IsInt(32, 16LL));
295 EXPECT(Utils::IsInt(32, 16ULL));
296 EXPECT(Utils::IsInt(32, 2147483647LL));
297 EXPECT(Utils::IsInt(32, 2147483647ULL));
298 EXPECT(Utils::IsInt(32, -2147483648LL));
299 EXPECT(!Utils::IsInt(32, static_cast<uint64_t>(-2147483648LL)));
300 EXPECT(!Utils::IsInt(32, 4294967295LL));
301 EXPECT(!Utils::IsInt(32, 4294967295ULL));
302}

◆ VM_UNIT_TEST_CASE() [66/107]

dart::VM_UNIT_TEST_CASE ( IsolateCurrent  )

Definition at line 19 of file isolate_test.cc.

19 {
20 Dart_Isolate isolate = TestCase::CreateTestIsolate();
21 EXPECT_EQ(isolate, Dart_CurrentIsolate());
23 EXPECT_EQ(static_cast<Dart_Isolate>(nullptr), Dart_CurrentIsolate());
24}

◆ VM_UNIT_TEST_CASE() [67/107]

dart::VM_UNIT_TEST_CASE ( IsPowerOfTwo  )

Definition at line 84 of file utils_test.cc.

84 {
85 EXPECT(!Utils::IsPowerOfTwo(0));
86 EXPECT(Utils::IsPowerOfTwo(1));
87 EXPECT(Utils::IsPowerOfTwo(2));
88 EXPECT(!Utils::IsPowerOfTwo(3));
89 EXPECT(Utils::IsPowerOfTwo(4));
90 EXPECT(Utils::IsPowerOfTwo(256));
91
92 EXPECT(!Utils::IsPowerOfTwo(-1));
93 EXPECT(!Utils::IsPowerOfTwo(-2));
94}

◆ VM_UNIT_TEST_CASE() [68/107]

dart::VM_UNIT_TEST_CASE ( IsUint  )

Definition at line 304 of file utils_test.cc.

304 {
305 EXPECT(Utils::IsUint(8, 16));
306 EXPECT(Utils::IsUint(8, 16U));
307 EXPECT(Utils::IsUint(8, 0));
308 EXPECT(Utils::IsUint(8, 0U));
309 EXPECT(Utils::IsUint(8, 255));
310 EXPECT(Utils::IsUint(8, 255U));
311 EXPECT(!Utils::IsUint(8, 256));
312 EXPECT(!Utils::IsUint(8, 256U));
313 EXPECT(Utils::IsUint(16, 16));
314 EXPECT(Utils::IsUint(16, 16U));
315 EXPECT(Utils::IsUint(16, 0));
316 EXPECT(Utils::IsUint(16, 0U));
317 EXPECT(Utils::IsUint(16, 65535));
318 EXPECT(Utils::IsUint(16, 65535U));
319 EXPECT(!Utils::IsUint(16, 65536));
320 EXPECT(!Utils::IsUint(16, 65536U));
321 EXPECT(Utils::IsUint(32, 16LL));
322 EXPECT(Utils::IsUint(32, 16ULL));
323 EXPECT(Utils::IsUint(32, 0LL));
324 EXPECT(Utils::IsUint(32, 0ULL));
325 EXPECT(Utils::IsUint(32, 4294967295LL));
326 EXPECT(Utils::IsUint(32, 4294967295ULL));
327 EXPECT(!Utils::IsUint(32, 4294967296LL));
328 EXPECT(!Utils::IsUint(32, 4294967296ULL));
329}

◆ VM_UNIT_TEST_CASE() [69/107]

dart::VM_UNIT_TEST_CASE ( LoadRelaxed  )

Definition at line 63 of file atomic_test.cc.

63 {
65 EXPECT_EQ(static_cast<uword>(42), v.load());
66}
T load(std::memory_order order=std::memory_order_relaxed) const
Definition atomic.h:21

◆ VM_UNIT_TEST_CASE() [70/107]

dart::VM_UNIT_TEST_CASE ( LowBits  )

Definition at line 372 of file utils_test.cc.

372 {
373 EXPECT_EQ(0xff00, Utils::Low16Bits(0xffff00));
374 EXPECT_EQ(0xff, Utils::High16Bits(0xffff00));
375 EXPECT_EQ(0xff00, Utils::Low32Bits(0xff0000ff00LL));
376 EXPECT_EQ(0xff, Utils::High32Bits(0xff0000ff00LL));
377 EXPECT_EQ(0x00ff0000ff00LL, Utils::LowHighTo64Bits(0xff00, 0x00ff));
378}

◆ VM_UNIT_TEST_CASE() [71/107]

dart::VM_UNIT_TEST_CASE ( MagnitudeIsUint  )

Definition at line 331 of file utils_test.cc.

331 {
332 EXPECT(Utils::MagnitudeIsUint(8, 16));
333 EXPECT(Utils::MagnitudeIsUint(8, 16U));
334 EXPECT(Utils::MagnitudeIsUint(8, 0));
335 EXPECT(Utils::MagnitudeIsUint(8, 0U));
336 EXPECT(Utils::MagnitudeIsUint(8, -128));
337 EXPECT(!Utils::MagnitudeIsUint(8, static_cast<unsigned int>(-128)));
338 EXPECT(Utils::MagnitudeIsUint(8, 255));
339 EXPECT(Utils::MagnitudeIsUint(8, 255U));
340 EXPECT(!Utils::MagnitudeIsUint(8, 256));
341 EXPECT(!Utils::MagnitudeIsUint(8, 256U));
342 EXPECT(Utils::MagnitudeIsUint(12, 4095));
343 EXPECT(Utils::MagnitudeIsUint(12, 4095U));
344 EXPECT(Utils::MagnitudeIsUint(12, -4095));
345 EXPECT(!Utils::MagnitudeIsUint(12, static_cast<unsigned int>(-4095)));
346 EXPECT(!Utils::MagnitudeIsUint(12, 4096));
347 EXPECT(!Utils::MagnitudeIsUint(12, 4096U));
348 EXPECT(!Utils::MagnitudeIsUint(12, -4096));
349 EXPECT(!Utils::MagnitudeIsUint(12, static_cast<unsigned int>(-4096)));
350 EXPECT(Utils::MagnitudeIsUint(16, 16));
351 EXPECT(Utils::MagnitudeIsUint(16, 16U));
352 EXPECT(Utils::MagnitudeIsUint(16, 0));
353 EXPECT(Utils::MagnitudeIsUint(16, 0U));
354 EXPECT(Utils::MagnitudeIsUint(16, 65535));
355 EXPECT(Utils::MagnitudeIsUint(16, 65535U));
356 EXPECT(Utils::MagnitudeIsUint(16, -32768));
357 EXPECT(!Utils::MagnitudeIsUint(16, static_cast<unsigned int>(-32768)));
358 EXPECT(!Utils::MagnitudeIsUint(16, 65536));
359 EXPECT(!Utils::MagnitudeIsUint(16, 65536U));
360 EXPECT(Utils::MagnitudeIsUint(32, 16LL));
361 EXPECT(Utils::MagnitudeIsUint(32, 16ULL));
362 EXPECT(Utils::MagnitudeIsUint(32, 0LL));
363 EXPECT(Utils::MagnitudeIsUint(32, 0ULL));
364 EXPECT(Utils::MagnitudeIsUint(32, -2147483648LL));
365 EXPECT(!Utils::MagnitudeIsUint(32, static_cast<uint64_t>(-2147483648LL)));
366 EXPECT(Utils::MagnitudeIsUint(32, 4294967295LL));
367 EXPECT(Utils::MagnitudeIsUint(32, 4294967295ULL));
368 EXPECT(!Utils::MagnitudeIsUint(32, 4294967296LL));
369 EXPECT(!Utils::MagnitudeIsUint(32, 4294967296ULL));
370}

◆ VM_UNIT_TEST_CASE() [72/107]

dart::VM_UNIT_TEST_CASE ( Maximum  )

Definition at line 70 of file utils_test.cc.

70 {
71 EXPECT_EQ(1, Utils::Maximum(0, 1));
72 EXPECT_EQ(1, Utils::Maximum(1, 0));
73
74 EXPECT_EQ(2, Utils::Maximum(1, 2));
75 EXPECT_EQ(2, Utils::Maximum(2, 1));
76
77 EXPECT_EQ(1, Utils::Maximum(-1, 1));
78 EXPECT_EQ(1, Utils::Maximum(1, -1));
79
80 EXPECT_EQ(-1, Utils::Maximum(-1, -2));
81 EXPECT_EQ(-1, Utils::Maximum(-2, -1));
82}

◆ VM_UNIT_TEST_CASE() [73/107]

dart::VM_UNIT_TEST_CASE ( MessageHandler_CloseAllPorts  )

Definition at line 217 of file message_handler_test.cc.

217 {
218 TestMessageHandler handler;
219 MessageHandlerTestPeer handler_peer(&handler);
220 handler_peer.PostMessage(BlankMessage(1, Message::kNormalPriority));
221 handler_peer.PostMessage(BlankMessage(2, Message::kNormalPriority));
222
223 handler_peer.CloseAllPorts();
224
225 // All messages are dropped from the queue.
226 EXPECT(nullptr == handler_peer.queue()->Dequeue());
227}

◆ VM_UNIT_TEST_CASE() [74/107]

dart::VM_UNIT_TEST_CASE ( MessageHandler_ClosePort  )

Definition at line 199 of file message_handler_test.cc.

199 {
200 TestMessageHandler handler;
201 MessageHandlerTestPeer handler_peer(&handler);
202 std::unique_ptr<Message> message;
203 message = BlankMessage(1, Message::kNormalPriority);
204 Message* raw_message1 = message.get();
205 handler_peer.PostMessage(std::move(message));
206 message = BlankMessage(2, Message::kNormalPriority);
207 Message* raw_message2 = message.get();
208 handler_peer.PostMessage(std::move(message));
209
210 handler_peer.ClosePort(1);
211
212 // Closing the port does not drop the messages from the queue.
213 EXPECT(raw_message1 == handler_peer.queue()->Dequeue().get());
214 EXPECT(raw_message2 == handler_peer.queue()->Dequeue().get());
215}

◆ VM_UNIT_TEST_CASE() [75/107]

dart::VM_UNIT_TEST_CASE ( MessageHandler_HandleNextMessage  )

Definition at line 229 of file message_handler_test.cc.

229 {
230 TestMessageHandler handler;
231 MessageHandlerTestPeer handler_peer(&handler);
232 Dart_Port port1 = PortMap::CreatePort(&handler);
233 Dart_Port port2 = PortMap::CreatePort(&handler);
234 Dart_Port port3 = PortMap::CreatePort(&handler);
235 handler_peer.PostMessage(BlankMessage(port1, Message::kNormalPriority));
236 handler_peer.PostMessage(BlankMessage(port2, Message::kOOBPriority));
237 handler_peer.PostMessage(BlankMessage(port2, Message::kNormalPriority));
238 handler_peer.PostMessage(BlankMessage(port3, Message::kOOBPriority));
239
240 // We handle both oob messages and a single normal message.
241 EXPECT_EQ(MessageHandler::kOK, handler.HandleNextMessage());
242 EXPECT_EQ(3, handler.message_count());
243 Dart_Port* ports = handler.port_buffer();
244 EXPECT_EQ(port2, ports[0]);
245 EXPECT_EQ(port3, ports[1]);
246 EXPECT_EQ(port1, ports[2]);
247}
MessageStatus HandleNextMessage()
Dart_Port * port_buffer() const

◆ VM_UNIT_TEST_CASE() [76/107]

dart::VM_UNIT_TEST_CASE ( MessageHandler_HandleNextMessage_ProcessOOBAfterError  )

Definition at line 249 of file message_handler_test.cc.

249 {
250 TestMessageHandler handler;
252 MessageHandler::kError, // oob_message1
253 MessageHandler::kOK, // oob_message2
254 MessageHandler::kOK, // unused
255 };
256 handler.set_results(results);
257 MessageHandlerTestPeer handler_peer(&handler);
258 Dart_Port port1 = PortMap::CreatePort(&handler);
259 Dart_Port port2 = PortMap::CreatePort(&handler);
260 Dart_Port port3 = PortMap::CreatePort(&handler);
261 handler_peer.PostMessage(BlankMessage(port1, Message::kNormalPriority));
262 handler_peer.PostMessage(BlankMessage(port2, Message::kOOBPriority));
263 handler_peer.PostMessage(BlankMessage(port3, Message::kOOBPriority));
264
265 // When we get an error, we continue processing oob messages but
266 // stop handling normal messages.
267 EXPECT_EQ(MessageHandler::kError, handler.HandleNextMessage());
268 EXPECT_EQ(2, handler.message_count());
269 Dart_Port* ports = handler.port_buffer();
270 EXPECT_EQ(port2, ports[0]); // oob_message1, error
271 EXPECT_EQ(port3, ports[1]); // oob_message2, ok
272 handler_peer.CloseAllPorts();
273}
void set_results(MessageStatus *results)

◆ VM_UNIT_TEST_CASE() [77/107]

dart::VM_UNIT_TEST_CASE ( MessageHandler_HandleNextMessage_Shutdown  )

Definition at line 275 of file message_handler_test.cc.

275 {
276 TestMessageHandler handler;
278 MessageHandler::kOK, // oob_message1
279 MessageHandler::kShutdown, // oob_message2
280 MessageHandler::kOK, // unused
281 MessageHandler::kOK, // unused
282 };
283 handler.set_results(results);
284 MessageHandlerTestPeer handler_peer(&handler);
285 Dart_Port port1 = PortMap::CreatePort(&handler);
286 Dart_Port port2 = PortMap::CreatePort(&handler);
287 Dart_Port port3 = PortMap::CreatePort(&handler);
288 Dart_Port port4 = PortMap::CreatePort(&handler);
289 handler_peer.PostMessage(BlankMessage(port1, Message::kNormalPriority));
290 handler_peer.PostMessage(BlankMessage(port2, Message::kOOBPriority));
291 handler_peer.PostMessage(BlankMessage(port3, Message::kOOBPriority));
292 handler_peer.PostMessage(BlankMessage(port4, Message::kOOBPriority));
293
294 // When we get a shutdown message, we stop processing all messages.
295 EXPECT_EQ(MessageHandler::kShutdown, handler.HandleNextMessage());
296 EXPECT_EQ(2, handler.message_count());
297 Dart_Port* ports = handler.port_buffer();
298 EXPECT_EQ(port2, ports[0]); // oob_message1, ok
299 EXPECT_EQ(port3, ports[1]); // oob_message2, shutdown
300 {
301 // The oob queue has been cleared. oob_message3 is gone.
302 MessageHandler::AcquiredQueues aq(&handler);
303 EXPECT(aq.oob_queue()->Length() == 0);
304 }
305 handler_peer.CloseAllPorts();
306}

◆ VM_UNIT_TEST_CASE() [78/107]

dart::VM_UNIT_TEST_CASE ( MessageHandler_HandleOOBMessages  )

Definition at line 308 of file message_handler_test.cc.

308 {
309 TestMessageHandler handler;
310 MessageHandlerTestPeer handler_peer(&handler);
311 Dart_Port port1 = PortMap::CreatePort(&handler);
312 Dart_Port port2 = PortMap::CreatePort(&handler);
313 Dart_Port port3 = PortMap::CreatePort(&handler);
314 Dart_Port port4 = PortMap::CreatePort(&handler);
315 handler_peer.PostMessage(BlankMessage(port1, Message::kNormalPriority));
316 handler_peer.PostMessage(BlankMessage(port2, Message::kNormalPriority));
317 handler_peer.PostMessage(BlankMessage(port3, Message::kOOBPriority));
318 handler_peer.PostMessage(BlankMessage(port4, Message::kOOBPriority));
319
320 // We handle both oob messages but no normal messages.
321 EXPECT_EQ(MessageHandler::kOK, handler.HandleOOBMessages());
322 EXPECT_EQ(2, handler.message_count());
323 Dart_Port* ports = handler.port_buffer();
324 EXPECT_EQ(port3, ports[0]);
325 EXPECT_EQ(port4, ports[1]);
326 handler_peer.CloseAllPorts();
327}
MessageStatus HandleOOBMessages()

◆ VM_UNIT_TEST_CASE() [79/107]

dart::VM_UNIT_TEST_CASE ( MessageHandler_HasOOBMessages  )

Definition at line 167 of file message_handler_test.cc.

167 {
168 TestMessageHandler handler;
169 MessageHandlerTestPeer handler_peer(&handler);
170
171 EXPECT(!handler.HasOOBMessages());
172
173 // Post a normal message.
174 std::unique_ptr<Message> message = BlankMessage(1, Message::kNormalPriority);
175 handler_peer.PostMessage(std::move(message));
176 EXPECT(!handler.HasOOBMessages());
177 {
178 // Acquire ownership of message handler queues, verify one regular message.
180 EXPECT(aq.queue()->Length() == 1);
181 }
182
183 // Post an oob message.
184 message = BlankMessage(1, Message::kOOBPriority);
185 handler_peer.PostMessage(std::move(message));
186 EXPECT(handler.HasOOBMessages());
187 {
188 // Acquire ownership of message handler queues, verify one regular and one
189 // OOB message.
190 MessageHandler::AcquiredQueues aq(&handler);
191 EXPECT(aq.queue()->Length() == 1);
192 EXPECT(aq.oob_queue()->Length() == 1);
193 }
194
195 // Delete all pending messages.
196 handler_peer.CloseAllPorts();
197}

◆ VM_UNIT_TEST_CASE() [80/107]

dart::VM_UNIT_TEST_CASE ( MessageHandler_PostMessage  )

Definition at line 137 of file message_handler_test.cc.

137 {
138 TestMessageHandler handler;
139 MessageHandlerTestPeer handler_peer(&handler);
140 EXPECT_EQ(0, handler.notify_count());
141
142 // Post a message.
143 std::unique_ptr<Message> message = BlankMessage(1, Message::kNormalPriority);
144 Message* raw_message = message.get();
145 handler_peer.PostMessage(std::move(message));
146
147 // The notify callback is called.
148 EXPECT_EQ(1, handler.notify_count());
149
150 // The message has been added to the correct queue.
151 EXPECT(raw_message == handler_peer.queue()->Dequeue().get());
152 EXPECT(nullptr == handler_peer.oob_queue()->Dequeue());
153
154 // Post an oob message.
155 message = BlankMessage(1, Message::kOOBPriority);
156 raw_message = message.get();
157 handler_peer.PostMessage(std::move(message));
158
159 // The notify callback is called.
160 EXPECT_EQ(2, handler.notify_count());
161
162 // The message has been added to the correct queue.
163 EXPECT(raw_message == handler_peer.oob_queue()->Dequeue().get());
164 EXPECT(nullptr == handler_peer.queue()->Dequeue());
165}

◆ VM_UNIT_TEST_CASE() [81/107]

dart::VM_UNIT_TEST_CASE ( MessageHandler_Run  )

Definition at line 347 of file message_handler_test.cc.

347 {
348 TestMessageHandler handler;
350 MessageHandlerTestPeer handler_peer(&handler);
351
352 handler.Run(&pool, TestStartFunction, TestEndFunction,
353 reinterpret_cast<uword>(&handler));
354
355 EXPECT(!PortMap::HasPorts(&handler));
356 Dart_Port port = PortMap::CreatePort(&handler);
357 EXPECT(PortMap::HasPorts(&handler));
358
359 handler_peer.PostMessage(BlankMessage(port, Message::kNormalPriority));
360
361 // Wait for the first message to be handled.
362 {
363 MonitorLocker ml(handler.monitor());
364 while (handler.message_count() < 1) {
365 ml.Wait();
366 }
367 EXPECT_EQ(1, handler.message_count());
368 EXPECT(handler.start_called());
369 EXPECT(!handler.end_called());
370 Dart_Port* handler_ports = handler.port_buffer();
371 EXPECT_EQ(port, handler_ports[0]);
372 }
373
374 // Start a thread which sends more messages.
375 Dart_Port ports[10];
376 for (int i = 0; i < 10; i++) {
377 ports[i] = PortMap::CreatePort(&handler);
378 }
379 ThreadStartInfo info;
380 info.handler = &handler;
381 info.ports = ports;
382 info.count = 10;
383 info.join_id = OSThread::kInvalidThreadJoinId;
384 OSThread::Start("SendMessages", SendMessages, reinterpret_cast<uword>(&info));
385
386 // Wait for the messages to be handled.
387 {
388 MonitorLocker ml(handler.monitor());
389 while (handler.message_count() < 11) {
390 ml.Wait();
391 }
392 Dart_Port* handler_ports = handler.port_buffer();
393 EXPECT_EQ(11, handler.message_count());
394 EXPECT(handler.start_called());
395 EXPECT(!handler.end_called());
396 EXPECT_EQ(port, handler_ports[0]);
397 for (int i = 1; i < 11; i++) {
398 EXPECT_EQ(ports[i - 1], handler_ports[i]);
399 }
400 }
401
402 for (int i = 0; i < 10; i++) {
403 PortMap::ClosePort(ports[i]);
404 }
405 PortMap::ClosePort(port);
406 EXPECT(!PortMap::HasPorts(&handler));
407
408 // Must join the thread or the VM shutdown is racing with any VM state the
409 // thread touched.
410 ASSERT(info.join_id != OSThread::kInvalidThreadJoinId);
411 OSThread::Join(info.join_id);
412}
bool Run(ThreadPool *pool, StartCallback start_callback, EndCallback end_callback, CallbackData data)

◆ VM_UNIT_TEST_CASE() [82/107]

dart::VM_UNIT_TEST_CASE ( Metric_OnDemand  )

Definition at line 50 of file metrics_test.cc.

50 {
51 TestCase::CreateTestIsolate();
52 {
53 Thread* thread = Thread::Current();
54 TransitionNativeToVM transition(thread);
55 StackZone zone(thread);
56 MyMetric metric;
57
58 metric.InitInstance(Isolate::Current(), "a.b.c", "foobar", Metric::kByte);
59 // value is still the default value.
60 EXPECT_EQ(0, metric.value());
61 // Call LeakyValue to confirm that Value returns constant 99.
62 EXPECT_EQ(99, metric.LeakyValue());
63
64 // Serialize to JSON.
65 JSONStream js;
66 metric.PrintJSON(&js);
67 const char* json = js.ToCString();
68 EXPECT_STREQ(
69 "{\"type\":\"Counter\",\"name\":\"a.b.c\",\"description\":"
70 "\"foobar\",\"unit\":\"byte\","
71 "\"fixedId\":true,\"id\":\"metrics\\/native\\/a.b.c\""
72 ",\"value\":99.0}",
73 json);
74 }
76}
void PrintJSON(JSONStream *stream)
Definition metrics.cc:76
void InitInstance(Isolate *isolate, const char *name, const char *description, Unit unit)
Definition metrics.cc:39
int64_t value() const
Definition metrics.h:95
int64_t LeakyValue() const

◆ VM_UNIT_TEST_CASE() [83/107]

dart::VM_UNIT_TEST_CASE ( Metric_Simple  )

Definition at line 21 of file metrics_test.cc.

21 {
22 TestCase::CreateTestIsolate();
23 {
24 Metric metric;
25
26 // Initialize metric.
27 metric.InitInstance(Isolate::Current(), "a.b.c", "foobar",
28 Metric::kCounter);
29 EXPECT_EQ(0, metric.value());
30 metric.increment();
31 EXPECT_EQ(1, metric.value());
32 metric.set_value(44);
33 EXPECT_EQ(44, metric.value());
34 }
36}
void set_value(int64_t value)
Definition metrics.h:96
void increment()
Definition metrics.h:98

◆ VM_UNIT_TEST_CASE() [84/107]

dart::VM_UNIT_TEST_CASE ( Minimum  )

Definition at line 56 of file utils_test.cc.

56 {
57 EXPECT_EQ(0, Utils::Minimum(0, 1));
58 EXPECT_EQ(0, Utils::Minimum(1, 0));
59
60 EXPECT_EQ(1, Utils::Minimum(1, 2));
61 EXPECT_EQ(1, Utils::Minimum(2, 1));
62
63 EXPECT_EQ(-1, Utils::Minimum(-1, 1));
64 EXPECT_EQ(-1, Utils::Minimum(1, -1));
65
66 EXPECT_EQ(-2, Utils::Minimum(-1, -2));
67 EXPECT_EQ(-2, Utils::Minimum(-2, -1));
68}

◆ VM_UNIT_TEST_CASE() [85/107]

dart::VM_UNIT_TEST_CASE ( Monitor  )

Definition at line 37 of file thread_test.cc.

37 {
38 // This unit test case needs a running isolate.
39 TestCase::CreateTestIsolate();
40 OSThread* thread = OSThread::Current();
41 // Thread interrupter interferes with this test, disable interrupts.
43 Monitor* monitor = new Monitor();
44 monitor->Enter();
45 monitor->Exit();
46 EXPECT_EQ(true, monitor->TryEnter());
47 monitor->Exit();
48
49 const int kNumAttempts = 5;
50 int attempts = 0;
51 while (attempts < kNumAttempts) {
52 MonitorLocker ml(monitor);
53 int64_t start = OS::GetCurrentMonotonicMicros();
54 int64_t wait_time = 2017;
55 Monitor::WaitResult wait_result = ml.Wait(wait_time);
56 int64_t stop = OS::GetCurrentMonotonicMicros();
57
58 // We expect to be timing out here.
59 EXPECT_EQ(Monitor::kTimedOut, wait_result);
60
61 // Check whether this attempt falls within the expected time limits.
62 int64_t wakeup_time = (stop - start) / kMicrosecondsPerMillisecond;
63 OS::PrintErr("wakeup_time: %" Pd64 "\n", wakeup_time);
64 const int kAcceptableTimeJitter = 20; // Measured in milliseconds.
65 const int kAcceptableWakeupDelay = 150; // Measured in milliseconds.
66 if (((wait_time - kAcceptableTimeJitter) <= wakeup_time) &&
67 (wakeup_time <= (wait_time + kAcceptableWakeupDelay))) {
68 break;
69 }
70
71 // Record the attempt.
72 attempts++;
73 }
74 EXPECT_LT(attempts, kNumAttempts);
75
76 // The isolate shutdown and the destruction of the mutex are out-of-order on
77 // purpose.
79 delete monitor;
80}

◆ VM_UNIT_TEST_CASE() [86/107]

dart::VM_UNIT_TEST_CASE ( Mutex  )

Definition at line 17 of file thread_test.cc.

17 {
18 // This unit test case needs a running isolate.
19 TestCase::CreateTestIsolate();
20 Mutex* mutex = new Mutex();
21 mutex->Lock();
22 EXPECT_EQ(false, mutex->TryLock());
23 mutex->Unlock();
24 EXPECT_EQ(true, mutex->TryLock());
25 mutex->Unlock();
26 {
27 MutexLocker ml(mutex);
28 EXPECT_EQ(false, mutex->TryLock());
29 }
30 // The isolate shutdown and the destruction of the mutex are out-of-order on
31 // purpose.
33 delete mutex;
34}

◆ VM_UNIT_TEST_CASE() [87/107]

dart::VM_UNIT_TEST_CASE ( NBitMask  )

Definition at line 432 of file utils_test.cc.

432 {
433#if defined(ARCH_IS_64_BIT)
434 EXPECT_EQ(0ull, Utils::NBitMask(0));
435 EXPECT_EQ(0x1ull, Utils::NBitMask(1));
436 EXPECT_EQ(0x3ull, Utils::NBitMask(2));
437 EXPECT_EQ(0xfull, Utils::NBitMask(4));
438 EXPECT_EQ(0xffull, Utils::NBitMask(8));
439 EXPECT_EQ(0xffffull, Utils::NBitMask(16));
440 EXPECT_EQ(0x1ffffull, Utils::NBitMask(17));
441 EXPECT_EQ(0x7fffffffull, Utils::NBitMask(31));
442 EXPECT_EQ(0xffffffffull, Utils::NBitMask(32));
443 EXPECT_EQ(0x1ffffffffull, Utils::NBitMask(33));
444 EXPECT_EQ(0x7fffffffffffffffull, Utils::NBitMask(kBitsPerWord - 1));
445 EXPECT_EQ(0xffffffffffffffffull, Utils::NBitMask(kBitsPerWord));
446#else
447 EXPECT_EQ(0u, Utils::NBitMask(0));
448 EXPECT_EQ(0x1u, Utils::NBitMask(1));
449 EXPECT_EQ(0x3u, Utils::NBitMask(2));
450 EXPECT_EQ(0xfu, Utils::NBitMask(4));
451 EXPECT_EQ(0xffu, Utils::NBitMask(8));
452 EXPECT_EQ(0xffffu, Utils::NBitMask(16));
453 EXPECT_EQ(0x1ffffu, Utils::NBitMask(17));
454 EXPECT_EQ(0x7fffffffu, Utils::NBitMask(kBitsPerWord - 1));
455 EXPECT_EQ(0xffffffffu, Utils::NBitMask(kBitsPerWord));
456#endif
457}

◆ VM_UNIT_TEST_CASE() [88/107]

dart::VM_UNIT_TEST_CASE ( NewRegion  )

Definition at line 27 of file memory_region_test.cc.

27 {
28 const uword kSize = 1024;
30 EXPECT_EQ(kSize, region.size());
31 EXPECT(region.pointer() != nullptr);
32
33 region.Store<int32_t>(0, 42);
34 EXPECT_EQ(42, region.Load<int32_t>(0));
35
36 DeleteRegion(region);
37}

◆ VM_UNIT_TEST_CASE() [89/107]

dart::VM_UNIT_TEST_CASE ( NullRegion  )

Definition at line 20 of file memory_region_test.cc.

20 {
21 const uword kSize = 512;
22 MemoryRegion region(nullptr, kSize);
23 EXPECT(region.pointer() == nullptr);
24 EXPECT_EQ(kSize, region.size());
25}

◆ VM_UNIT_TEST_CASE() [90/107]

dart::VM_UNIT_TEST_CASE ( OsFuncs  )

Definition at line 29 of file os_test.cc.

29 {
30 EXPECT(Utils::IsPowerOfTwo(OS::ActivationFrameAlignment()));
31 int procs = OS::NumberOfAvailableProcessors();
32 EXPECT_LE(1, procs);
33}

◆ VM_UNIT_TEST_CASE() [91/107]

dart::VM_UNIT_TEST_CASE ( ParseFlags  )

Definition at line 27 of file flags_test.cc.

27 {
28 EXPECT_EQ(true, FLAG_parse_flag_bool_test);
29 Flags::Parse("no_parse_flag_bool_test");
30 EXPECT_EQ(false, FLAG_parse_flag_bool_test);
31 Flags::Parse("parse_flag_bool_test");
32 EXPECT_EQ(true, FLAG_parse_flag_bool_test);
33 Flags::Parse("parse_flag_bool_test=false");
34 EXPECT_EQ(false, FLAG_parse_flag_bool_test);
35 Flags::Parse("parse_flag_bool_test=true");
36 EXPECT_EQ(true, FLAG_parse_flag_bool_test);
37
38 EXPECT_EQ(true, FLAG_string_opt_test == nullptr);
39 Flags::Parse("string_opt_test=doobidoo");
40 EXPECT_EQ(true, FLAG_string_opt_test != nullptr);
41 EXPECT_EQ(0, strcmp(FLAG_string_opt_test, "doobidoo"));
42 FLAG_string_opt_test = reinterpret_cast<charp>(0xDEADBEEF);
43 Flags::Parse("string_opt_test=foofoo");
44 EXPECT_EQ(true, FLAG_string_opt_test != nullptr);
45 EXPECT_EQ(0, strcmp(FLAG_string_opt_test, "foofoo"));
46
47 EXPECT_EQ(true, FLAG_entrypoint_test != nullptr);
48 EXPECT_EQ(0, strcmp(FLAG_entrypoint_test, "main"));
49
50 EXPECT_EQ(100, FLAG_counter);
51 Flags::Parse("counter=-300");
52 EXPECT_EQ(-300, FLAG_counter);
53 Flags::Parse("counter=$300");
54 EXPECT_EQ(-300, FLAG_counter);
55}
const char * charp
Definition flags.h:12

◆ VM_UNIT_TEST_CASE() [92/107]

dart::VM_UNIT_TEST_CASE ( PostCObject  )

Definition at line 1917 of file snapshot_test.cc.

1917 {
1918 // Create a native port for posting from C to Dart
1919 TestIsolateScope __test_isolate__;
1920 const char* kScriptChars =
1921 "import 'dart:isolate';\n"
1922 "main() {\n"
1923 " var messageCount = 0;\n"
1924 " var exception = '';\n"
1925 " var port = new RawReceivePort();\n"
1926 " var sendPort = port.sendPort;\n"
1927 " port.handler = (message) {\n"
1928 " if (messageCount < 9) {\n"
1929 " exception = '$exception${message}';\n"
1930 " } else {\n"
1931 " exception = '$exception${message.length}';\n"
1932 " for (int i = 0; i < message.length; i++) {\n"
1933 " exception = '$exception${message[i]}';\n"
1934 " }\n"
1935 " }\n"
1936 " messageCount++;\n"
1937 " if (messageCount == 13) throw new Exception(exception);\n"
1938 " };\n"
1939 " return sendPort;\n"
1940 "}\n";
1941 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, nullptr);
1943
1944 Dart_Handle send_port = Dart_Invoke(lib, NewString("main"), 0, nullptr);
1945 EXPECT_VALID(send_port);
1946 Dart_Port port_id;
1947 Dart_Handle result = Dart_SendPortGetId(send_port, &port_id);
1949
1950 // Setup single object message.
1951 Dart_CObject object;
1952
1953 object.type = Dart_CObject_kNull;
1954 EXPECT(Dart_PostCObject(port_id, &object));
1955
1956 object.type = Dart_CObject_kBool;
1957 object.value.as_bool = true;
1958 EXPECT(Dart_PostCObject(port_id, &object));
1959
1960 object.type = Dart_CObject_kBool;
1961 object.value.as_bool = false;
1962 EXPECT(Dart_PostCObject(port_id, &object));
1963
1964 object.type = Dart_CObject_kInt32;
1965 object.value.as_int32 = 123;
1966 EXPECT(Dart_PostCObject(port_id, &object));
1967
1968 object.type = Dart_CObject_kString;
1969 object.value.as_string = const_cast<char*>("456");
1970 EXPECT(Dart_PostCObject(port_id, &object));
1971
1972 object.type = Dart_CObject_kString;
1973 object.value.as_string = const_cast<char*>("æøå");
1974 EXPECT(Dart_PostCObject(port_id, &object));
1975
1976 object.type = Dart_CObject_kString;
1977 object.value.as_string = const_cast<char*>("");
1978 EXPECT(Dart_PostCObject(port_id, &object));
1979
1980 object.type = Dart_CObject_kDouble;
1981 object.value.as_double = 3.14;
1982 EXPECT(Dart_PostCObject(port_id, &object));
1983
1984 object.type = Dart_CObject_kArray;
1985 object.value.as_array.length = 0;
1986 EXPECT(Dart_PostCObject(port_id, &object));
1987
1988 const int kArrayLength = 10;
1989 Dart_CObject* array = reinterpret_cast<Dart_CObject*>(Dart_ScopeAllocate(
1990 sizeof(Dart_CObject) + sizeof(Dart_CObject*) * kArrayLength)); // NOLINT
1991 array->type = Dart_CObject_kArray;
1992 array->value.as_array.length = kArrayLength;
1993 array->value.as_array.values = reinterpret_cast<Dart_CObject**>(array + 1);
1994 for (int i = 0; i < kArrayLength; i++) {
1995 Dart_CObject* element = reinterpret_cast<Dart_CObject*>(
1997 element->type = Dart_CObject_kInt32;
1998 element->value.as_int32 = i;
1999 array->value.as_array.values[i] = element;
2000 }
2001 EXPECT(Dart_PostCObject(port_id, array));
2002
2003 object.type = Dart_CObject_kTypedData;
2004 object.value.as_typed_data.type = Dart_TypedData_kUint8;
2005 uint8_t data[] = {0, 1, 2, 3, 4, 5, 6, 7, 8};
2006 object.value.as_typed_data.length = ARRAY_SIZE(data);
2007 object.value.as_typed_data.values = data;
2008 EXPECT(Dart_PostCObject(port_id, &object));
2009
2010 object.type = Dart_CObject_kExternalTypedData;
2011 object.value.as_typed_data.type = Dart_TypedData_kUint8;
2012 uint8_t* external_data = reinterpret_cast<uint8_t*>(malloc(sizeof(data)));
2013 memmove(external_data, data, sizeof(data));
2014 object.value.as_external_typed_data.length = ARRAY_SIZE(data);
2015 object.value.as_external_typed_data.data = external_data;
2016 object.value.as_external_typed_data.peer = external_data;
2017 object.value.as_external_typed_data.callback = MallocFinalizer;
2018 EXPECT(Dart_PostCObject(port_id, &object));
2019
2021 object.value.as_typed_data.type = Dart_TypedData_kUint8;
2022 static const uint8_t unmodifiable_data[] = {0, 1, 2, 3, 4, 5, 6, 7, 8};
2023 object.value.as_external_typed_data.length = ARRAY_SIZE(unmodifiable_data);
2024 object.value.as_external_typed_data.data =
2025 const_cast<uint8_t*>(unmodifiable_data);
2026 object.value.as_external_typed_data.peer = nullptr;
2027 object.value.as_external_typed_data.callback = NoopFinalizer;
2028 EXPECT(Dart_PostCObject(port_id, &object));
2029
2030 result = Dart_RunLoop();
2033 EXPECT_SUBSTRING(
2034 "Exception: "
2035 "nulltruefalse123456æøå3.14[]"
2036 "100123456789901234567890123456789012345678\n",
2038
2040}
DART_EXPORT bool Dart_PostCObject(Dart_Port port_id, Dart_CObject *message)
static void NoopFinalizer(void *isolate_callback_data, void *peer)
static void MallocFinalizer(void *isolate_callback_data, void *peer)

◆ VM_UNIT_TEST_CASE() [93/107]

dart::VM_UNIT_TEST_CASE ( ReceivesSendAndExitMessage  )

Definition at line 568 of file heap_test.cc.

568 {
569 const char* TEST_MESSAGE = "hello, world";
570 Dart_Isolate parent = TestCase::CreateTestIsolate("parent");
571 EXPECT_EQ(parent, Dart_CurrentIsolate());
572 SendAndExitMessagesHandler handler(Isolate::Current());
573 Dart_Port port_id = PortMap::CreatePort(&handler);
574 EXPECT_EQ(PortMap::GetIsolate(port_id), Isolate::Current());
576
577 Dart_Isolate worker = TestCase::CreateTestIsolateInGroup("worker", parent);
578 EXPECT_EQ(worker, Dart_CurrentIsolate());
579 {
580 Thread* thread = Thread::Current();
581 TransitionNativeToVM transition(thread);
582 StackZone zone(thread);
583
584 String& string = String::Handle(String::New(TEST_MESSAGE));
585
586 PersistentHandle* handle =
587 Isolate::Current()->group()->api_state()->AllocatePersistentHandle();
588 handle->set_ptr(string.ptr());
589
590 reinterpret_cast<Isolate*>(worker)->bequeath(
591 std::unique_ptr<Bequest>(new Bequest(handle, port_id)));
592 }
593
595 Dart_EnterIsolate(parent);
596 {
597 Thread* thread = Thread::Current();
598 TransitionNativeToVM transition(thread);
599 StackZone zone(thread);
600
601 EXPECT_EQ(MessageHandler::kOK, handler.HandleNextMessage());
602 }
603 EXPECT_STREQ(handler.msg(), TEST_MESSAGE);
605}

◆ VM_UNIT_TEST_CASE() [94/107]

dart::VM_UNIT_TEST_CASE ( ReverseBits32  )

Definition at line 254 of file utils_test.cc.

254 {
255 EXPECT_EQ(0xffffffffU, Utils::ReverseBits32(0xffffffffU));
256 EXPECT_EQ(0xf0000000U, Utils::ReverseBits32(0x0000000fU));
257 EXPECT_EQ(0x00000001U, Utils::ReverseBits32(0x80000000U));
258 EXPECT_EQ(0x22222222U, Utils::ReverseBits32(0x44444444U));
259 EXPECT_EQ(0x1E6A2C48U, Utils::ReverseBits32(0x12345678U));
260}

◆ VM_UNIT_TEST_CASE() [95/107]

dart::VM_UNIT_TEST_CASE ( ReverseBits64  )

Definition at line 262 of file utils_test.cc.

262 {
263 EXPECT_EQ(0xffffffffffffffffLLU, Utils::ReverseBits64(0xffffffffffffffffLLU));
264 EXPECT_EQ(0xf000000000000000LLU, Utils::ReverseBits64(0x000000000000000fLLU));
265 EXPECT_EQ(0x0000000000000001LLU, Utils::ReverseBits64(0x8000000000000000LLU));
266 EXPECT_EQ(0x2222222222222222LLU, Utils::ReverseBits64(0x4444444444444444LLU));
267 EXPECT_EQ(0x8f7b3d591e6a2c48LLU, Utils::ReverseBits64(0x123456789abcdef1LLU));
268}

◆ VM_UNIT_TEST_CASE() [96/107]

dart::VM_UNIT_TEST_CASE ( ReverseBitsWord  )

Definition at line 270 of file utils_test.cc.

270 {
271 const uword kOne = static_cast<uword>(1);
272 const uword kTopBit = kOne << (kBitsPerWord - 1);
273 EXPECT_EQ(kTopBit, Utils::ReverseBitsWord(kOne));
274 EXPECT_EQ(kOne, Utils::ReverseBitsWord(kTopBit));
275}
constexpr intptr_t kBitsPerWord
Definition globals.h:514

◆ VM_UNIT_TEST_CASE() [97/107]

dart::VM_UNIT_TEST_CASE ( RoundDown  )

Definition at line 122 of file utils_test.cc.

122 {
123 EXPECT_EQ(0, Utils::RoundDown(22, 32));
124 EXPECT_EQ(32, Utils::RoundDown(33, 32));
125 EXPECT_EQ(32, Utils::RoundDown(63, 32));
126 uword* address = reinterpret_cast<uword*>(63);
127 uword* rounddown_address = reinterpret_cast<uword*>(32);
128 EXPECT_EQ(rounddown_address, Utils::RoundDown(address, 32));
129}

◆ VM_UNIT_TEST_CASE() [98/107]

dart::VM_UNIT_TEST_CASE ( RoundUp  )

Definition at line 131 of file utils_test.cc.

131 {
132 EXPECT_EQ(32, Utils::RoundUp(22, 32));
133 EXPECT_EQ(64, Utils::RoundUp(33, 32));
134 EXPECT_EQ(64, Utils::RoundUp(63, 32));
135 uword* address = reinterpret_cast<uword*>(63);
136 uword* roundup_address = reinterpret_cast<uword*>(64);
137 EXPECT_EQ(roundup_address, Utils::RoundUp(address, 32));
138
139 EXPECT_EQ(4, Utils::RoundUp(0, 8, 4));
140 EXPECT_EQ(4, Utils::RoundUp(1, 8, 4));
141 EXPECT_EQ(4, Utils::RoundUp(4, 8, 4));
142 EXPECT_EQ(12, Utils::RoundUp(8, 8, 4));
143 EXPECT_EQ(12, Utils::RoundUp(9, 8, 4));
144 EXPECT_EQ(12, Utils::RoundUp(12, 8, 4));
145}

◆ VM_UNIT_TEST_CASE() [99/107]

dart::VM_UNIT_TEST_CASE ( RoundUpToPowerOfTwo  )

Definition at line 147 of file utils_test.cc.

147 {
148 EXPECT_EQ(0U, Utils::RoundUpToPowerOfTwo(0));
149 EXPECT_EQ(1U, Utils::RoundUpToPowerOfTwo(1));
150 EXPECT_EQ(2U, Utils::RoundUpToPowerOfTwo(2));
151 EXPECT_EQ(4U, Utils::RoundUpToPowerOfTwo(3));
152 EXPECT_EQ(4U, Utils::RoundUpToPowerOfTwo(4));
153 EXPECT_EQ(8U, Utils::RoundUpToPowerOfTwo(5));
154 EXPECT_EQ(8U, Utils::RoundUpToPowerOfTwo(7));
155 EXPECT_EQ(16U, Utils::RoundUpToPowerOfTwo(9));
156 EXPECT_EQ(16U, Utils::RoundUpToPowerOfTwo(16));
157 EXPECT_EQ(0x10000000U, Utils::RoundUpToPowerOfTwo(0x08765432));
158}

◆ VM_UNIT_TEST_CASE() [100/107]

dart::VM_UNIT_TEST_CASE ( ShiftForPowerOfTwo  )

Definition at line 96 of file utils_test.cc.

96 {
97 EXPECT_EQ(1, Utils::ShiftForPowerOfTwo(2));
98 EXPECT_EQ(2, Utils::ShiftForPowerOfTwo(4));
99 EXPECT_EQ(8, Utils::ShiftForPowerOfTwo(256));
100}

◆ VM_UNIT_TEST_CASE() [101/107]

dart::VM_UNIT_TEST_CASE ( SimpleHashMap_Basic  )

Definition at line 171 of file hashmap_test.cc.

171 {
172 TestSet(WordHash, 100);
173 TestSet(Hash, 100);
174 TestSet(CollisionHash1, 50);
175 TestSet(CollisionHash2, 50);
176 TestSet(CollisionHash3, 50);
177 TestSet(CollisionHash4, 50);
178}

◆ VM_UNIT_TEST_CASE() [102/107]

dart::VM_UNIT_TEST_CASE ( SNPrint  )

Definition at line 13 of file os_test.cc.

13 {
14 char buffer[256];
15 int length;
16 length = Utils::SNPrint(buffer, 10, "%s", "foo");
17 EXPECT_EQ(3, length);
18 EXPECT_STREQ("foo", buffer);
19 length = Utils::SNPrint(buffer, 3, "%s", "foo");
20 EXPECT_EQ(3, length);
21 EXPECT_STREQ("fo", buffer);
22 length = Utils::SNPrint(buffer, 256, "%s%c%d", "foo", 'Z', 42);
23 EXPECT_EQ(6, length);
24 EXPECT_STREQ("fooZ42", buffer);
25 length = Utils::SNPrint(nullptr, 0, "foo");
26 EXPECT_EQ(3, length);
27}

◆ VM_UNIT_TEST_CASE() [103/107]

dart::VM_UNIT_TEST_CASE ( StringHash  )

Definition at line 12 of file utils_test.cc.

12 {
13 auto hash_created_string = [](intptr_t length,
14 intptr_t misalignment) -> uint32_t {
15 const intptr_t capacity = length + misalignment + kInt32Size;
16 char* str = new char[capacity];
17 const intptr_t alloc_misalignment =
18 reinterpret_cast<intptr_t>(str) % kInt32Size;
19 const intptr_t first_aligned_position =
20 alloc_misalignment > 0 ? kInt32Size - alloc_misalignment : 0;
21 const intptr_t start = first_aligned_position + misalignment;
22 for (intptr_t n = 0; n < start; n++) {
23 str[n] = 0xFF;
24 }
25 for (intptr_t n = 0; n < length; n++) {
26 // Fill the important string positions with uppercase letters.
27 str[start + n] = 0x40 + (n % 26);
28 }
29 for (intptr_t n = start + length; n < capacity; n++) {
30 str[n] = 0xFF;
31 }
32 const uint32_t hash = Utils::StringHash(str + start, length);
33 delete[] str;
34 return hash;
35 };
36
37 const intptr_t kMaxLength = 100;
38 ASSERT(kMaxLength >= kInt64Size);
39 uint32_t last_hash = hash_created_string(0, 0);
40 bool identical_hashes = true;
41 // Check the same string at different (mis)alignments has the same hash.
42 for (intptr_t len = 0; len < kMaxLength; len++) {
43 const uint32_t hash = hash_created_string(len, 0);
44 for (intptr_t misalignment = 1; misalignment < kInt64Size; misalignment++) {
45 EXPECT_EQ(hash, hash_created_string(len, misalignment));
46 }
47 if (hash != last_hash) {
48 identical_hashes = false;
49 }
50 last_hash = hash;
51 }
52 // Make sure at least some of the hashes were different from each other.
53 EXPECT(!identical_hashes);
54}
constexpr intptr_t kInt64Size
Definition globals.h:453
constexpr intptr_t kInt32Size
Definition globals.h:450

◆ VM_UNIT_TEST_CASE() [104/107]

dart::VM_UNIT_TEST_CASE ( Subregion  )

Definition at line 39 of file memory_region_test.cc.

39 {
40 const uword kSize = 1024;
41 const uword kSubOffset = 128;
42 const uword kSubSize = 512;
44 MemoryRegion sub_region;
45 sub_region.Subregion(region, kSubOffset, kSubSize);
46 EXPECT_EQ(kSubSize, sub_region.size());
47 EXPECT(sub_region.pointer() != nullptr);
48 EXPECT(sub_region.start() == region.start() + kSubOffset);
49
50 region.Store<int32_t>(0, 42);
51 sub_region.Store<int32_t>(0, 100);
52 EXPECT_EQ(42, region.Load<int32_t>(0));
53 EXPECT_EQ(100, region.Load<int32_t>(kSubOffset));
54
55 DeleteRegion(region);
56}
uword start() const

◆ VM_UNIT_TEST_CASE() [105/107]

dart::VM_UNIT_TEST_CASE ( ThreadBarrier  )

Definition at line 39 of file thread_barrier_test.cc.

39 {
40 const intptr_t kNumTasks = 5;
41 const intptr_t kNumRounds = 500;
42
43 ThreadBarrier* barrier = new ThreadBarrier(kNumTasks + 1, kNumTasks + 1);
44 for (intptr_t i = 0; i < kNumTasks; ++i) {
45 Dart::thread_pool()->Run<FuzzTask>(kNumRounds, barrier, i + 1);
46 }
47 for (intptr_t i = 0; i < kNumRounds; ++i) {
48 barrier->Sync();
49 }
50 barrier->Release();
51}

◆ VM_UNIT_TEST_CASE() [106/107]

dart::VM_UNIT_TEST_CASE ( ZoneAllocated  )

Definition at line 138 of file zone_test.cc.

138 {
139#if defined(DEBUG)
140 FLAG_trace_zones = true;
141#endif
142 TestCase::CreateTestIsolate();
143 Thread* thread = Thread::Current();
144 EXPECT(thread->zone() == nullptr);
145 static int marker;
146
147 class SimpleZoneObject : public ZoneAllocated {
148 public:
149 SimpleZoneObject() : slot(marker++) {}
150 virtual ~SimpleZoneObject() {}
151 virtual int GetSlot() { return slot; }
152 int slot;
153 };
154
155 // Reset the marker.
156 marker = 0;
157
158 // Create a few zone allocated objects.
159 {
160 TransitionNativeToVM transition(thread);
161 StackZone zone(thread);
162 EXPECT_EQ(0UL, zone.SizeInBytes());
163 SimpleZoneObject* first = new SimpleZoneObject();
164 EXPECT(first != nullptr);
165 SimpleZoneObject* second = new SimpleZoneObject();
166 EXPECT(second != nullptr);
167 EXPECT(first != second);
168 uintptr_t expected_size = (2 * sizeof(SimpleZoneObject));
169 EXPECT_LE(expected_size, zone.SizeInBytes());
170
171 // Make sure the constructors were invoked.
172 EXPECT_EQ(0, first->slot);
173 EXPECT_EQ(1, second->slot);
174
175 // Make sure we can write to the members of the zone objects.
176 first->slot = 42;
177 second->slot = 87;
178 EXPECT_EQ(42, first->slot);
179 EXPECT_EQ(87, second->slot);
180 }
181 EXPECT(thread->zone() == nullptr);
183}
static const char marker[]

◆ VM_UNIT_TEST_CASE() [107/107]

dart::VM_UNIT_TEST_CASE ( ZoneRealloc  )

Definition at line 116 of file zone_test.cc.

116 {
117 TestCase::CreateTestIsolate();
118 Thread* thread = Thread::Current();
119 {
120 TransitionNativeToVM transition(thread);
121 StackZone stack_zone(thread);
122 auto zone = thread->zone();
123
124 const intptr_t kOldLen = 32;
125 const intptr_t kNewLen = 16;
126 const intptr_t kNewLen2 = 16;
127
128 auto data_old = zone->Alloc<uint8_t>(kOldLen);
129 auto data_new = zone->Realloc<uint8_t>(data_old, kOldLen, kNewLen);
130 RELEASE_ASSERT(data_old == data_new);
131
132 auto data_new2 = zone->Realloc<uint8_t>(data_old, kNewLen, kNewLen2);
133 RELEASE_ASSERT(data_old == data_new2);
134 }
136}

◆ VM_UNIT_TEST_CASE_WITH_EXPECTATION() [1/2]

dart::VM_UNIT_TEST_CASE_WITH_EXPECTATION ( AllocGeneric_Overflow  ,
"Crash"   
)

Definition at line 99 of file zone_test.cc.

99 {
100#if defined(DEBUG)
101 FLAG_trace_zones = true;
102#endif
103 TestCase::CreateTestIsolate();
104 Thread* thread = Thread::Current();
105 EXPECT(thread->zone() == nullptr);
106 {
107 StackZone zone(thread);
108 EXPECT(thread->zone() != nullptr);
109
110 const intptr_t kNumElements = (kIntptrMax / sizeof(uint32_t)) + 1;
111 zone.GetZone()->Alloc<uint32_t>(kNumElements);
112 }
114}
constexpr intptr_t kIntptrMax
Definition globals.h:557

◆ VM_UNIT_TEST_CASE_WITH_EXPECTATION() [2/2]

dart::VM_UNIT_TEST_CASE_WITH_EXPECTATION ( BitFields_Assert  ,
DEBUG_CRASH   
)

Definition at line 79 of file bitfield_test.cc.

79 {
80 class F : public BitField<uint32_t, uint32_t, 0, 8, /*sign_extend=*/false> {};
81 const uint32_t value = F::encode(kMaxUint32);
82 EXPECT_EQ(kMaxUint8, value);
83}

◆ vmservice_resolver()

static void dart::vmservice_resolver ( Dart_NativeArguments  args)
static

Definition at line 208 of file benchmark_test.cc.

208{}

◆ WaitForHelper()

DART_EXPORT void dart::WaitForHelper ( HelperThreadState helper)

Definition at line 174 of file ffi_test_functions_vmspecific.cc.

174 {
175 helper->helper->join();
176 delete helper;
177}
std::unique_ptr< std::thread > helper

◆ WaitUntilNThreadsEnterBarrier()

DART_EXPORT void dart::WaitUntilNThreadsEnterBarrier ( intptr_t  num_threads)

Definition at line 1288 of file ffi_test_functions_vmspecific.cc.

1288 {
1289 ThreadPoolTest_BarrierSync(Dart_CurrentIsolate_DL, Dart_EnterIsolate_DL,
1290 Dart_ExitIsolate_DL, num_threads);
1291}
DART_EXPORT void ThreadPoolTest_BarrierSync(Dart_Isolate(*dart_current_isolate)(), void(*dart_enter_isolate)(Dart_Isolate), void(*dart_exit_isolate)(), intptr_t num_threads)

◆ WCharMaxValue()

DART_EXPORT int64_t dart::WCharMaxValue ( )

Definition at line 1259 of file ffi_test_functions.cc.

1259 {
1260 return WCHAR_MAX;
1261}

◆ WCharMinValue()

DART_EXPORT int64_t dart::WCharMinValue ( )

Definition at line 1256 of file ffi_test_functions.cc.

1256 {
1257 return WCHAR_MIN;
1258}

◆ WeakArray_Generations()

static void dart::WeakArray_Generations ( intptr_t  length,
Generation  array_space,
Generation  element_space,
bool  cleared_after_minor,
bool  cleared_after_major,
bool  cleared_after_all 
)
static

Definition at line 1071 of file heap_test.cc.

1076 {
1077 WeakArray& array = WeakArray::Handle();
1078 GCTestHelper::CollectAllGarbage();
1079 {
1080 HANDLESCOPE(Thread::Current());
1081 switch (array_space) {
1082 case kNew:
1083 array = WeakArray::New(length, Heap::kNew);
1084 break;
1085 case kOld:
1086 array = WeakArray::New(length, Heap::kOld);
1087 break;
1088 case kImm:
1089 UNREACHABLE();
1090 }
1091
1092 Object& element = Object::Handle();
1093 switch (element_space) {
1094 case kNew:
1095 element = OneByteString::New("element", Heap::kNew);
1096 break;
1097 case kOld:
1098 element = OneByteString::New("element", Heap::kOld);
1099 break;
1100 case kImm:
1101 element = Smi::New(42);
1102 break;
1103 }
1104
1105 array.SetAt(length - 1, element);
1106 }
1107
1108 OS::PrintErr("%d %d\n", array_space, element_space);
1109
1110 GCTestHelper::CollectNewSpace();
1111 if (cleared_after_minor) {
1112 EXPECT(array.At(length - 1) == Object::null());
1113 } else {
1114 EXPECT(array.At(length - 1) != Object::null());
1115 }
1116
1117 GCTestHelper::CollectOldSpace();
1118 if (cleared_after_major) {
1119 EXPECT(array.At(length - 1) == Object::null());
1120 } else {
1121 EXPECT(array.At(length - 1) != Object::null());
1122 }
1123
1124 GCTestHelper::CollectAllGarbage();
1125 if (cleared_after_all) {
1126 EXPECT(array.At(length - 1) == Object::null());
1127 } else {
1128 EXPECT(array.At(length - 1) != Object::null());
1129 }
1130}

◆ WeakHandleFinalizer() [1/2]

static void dart::WeakHandleFinalizer ( void *  isolate_callback_data,
void *  peer 
)
static

Definition at line 144 of file object_graph_test.cc.

144{}

◆ WeakHandleFinalizer() [2/2]

static void dart::WeakHandleFinalizer ( void *  isolate_callback_data,
void *  peer 
)
static

Definition at line 488 of file service_test.cc.

488{}

◆ WeakPersistentHandlePeerCleanupEnsuresIGFinalizer()

static void dart::WeakPersistentHandlePeerCleanupEnsuresIGFinalizer ( void *  isolate_callback_data,
void *  peer 
)
static

Definition at line 3832 of file dart_api_impl_test.cc.

3834 {
3835 ASSERT(IsolateGroup::Current() != nullptr);
3836}

◆ WeakPersistentHandlePeerCleanupFinalizer()

static void dart::WeakPersistentHandlePeerCleanupFinalizer ( void *  isolate_callback_data,
void *  peer 
)
static

Definition at line 3849 of file dart_api_impl_test.cc.

3851 {
3852 Dart_DeletePersistentHandle(persistent_handle1);
3853 Dart_DeleteWeakPersistentHandle(weak_persistent_handle2);
3854 *static_cast<int*>(peer) = 42;
3855}

◆ WeakPersistentHandlePeerFinalizer()

static void dart::WeakPersistentHandlePeerFinalizer ( void *  isolate_callback_data,
void *  peer 
)
static

Definition at line 3926 of file dart_api_impl_test.cc.

3927 {
3928 *static_cast<int*>(peer) = 42;
3929}

◆ WeakProperty_Generations()

static void dart::WeakProperty_Generations ( Generation  property_space,
Generation  key_space,
Generation  value_space,
bool  cleared_after_minor,
bool  cleared_after_major,
bool  cleared_after_all 
)
static

Definition at line 896 of file heap_test.cc.

901 {
902 WeakProperty& property = WeakProperty::Handle();
903 GCTestHelper::CollectAllGarbage();
904 {
905 HANDLESCOPE(Thread::Current());
906 switch (property_space) {
907 case kNew:
908 property = WeakProperty::New(Heap::kNew);
909 break;
910 case kOld:
911 property = WeakProperty::New(Heap::kOld);
912 break;
913 case kImm:
914 UNREACHABLE();
915 }
916
917 Object& key = Object::Handle();
918 switch (key_space) {
919 case kNew:
920 key = OneByteString::New("key", Heap::kNew);
921 break;
922 case kOld:
923 key = OneByteString::New("key", Heap::kOld);
924 break;
925 case kImm:
926 key = Smi::New(42);
927 break;
928 }
929
930 Object& value = Object::Handle();
931 switch (value_space) {
932 case kNew:
933 value = OneByteString::New("value", Heap::kNew);
934 break;
935 case kOld:
936 value = OneByteString::New("value", Heap::kOld);
937 break;
938 case kImm:
939 value = Smi::New(84);
940 break;
941 }
942
943 property.set_key(key);
944 property.set_value(value);
945 }
946
947 OS::PrintErr("%d %d %d\n", property_space, key_space, value_space);
948
949 GCTestHelper::CollectNewSpace();
950 if (cleared_after_minor) {
951 EXPECT(property.key() == Object::null());
952 EXPECT(property.value() == Object::null());
953 } else {
954 EXPECT(property.key() != Object::null());
955 EXPECT(property.value() != Object::null());
956 }
957
958 GCTestHelper::CollectOldSpace();
959 if (cleared_after_major) {
960 EXPECT(property.key() == Object::null());
961 EXPECT(property.value() == Object::null());
962 } else {
963 EXPECT(property.key() != Object::null());
964 EXPECT(property.value() != Object::null());
965 }
966
967 GCTestHelper::CollectAllGarbage();
968 if (cleared_after_all) {
969 EXPECT(property.key() == Object::null());
970 EXPECT(property.value() == Object::null());
971 } else {
972 EXPECT(property.key() != Object::null());
973 EXPECT(property.value() != Object::null());
974 }
975}

◆ WeakReference_Clear_ReachableThroughWeakProperty()

static void dart::WeakReference_Clear_ReachableThroughWeakProperty ( Thread thread,
Heap::Space  space 
)
static

Definition at line 3713 of file object_test.cc.

3715 {
3716 auto& weak_property = WeakProperty::Handle();
3717 const auto& key = String::Handle(OneByteString::New("key", space));
3718 {
3719 HANDLESCOPE(thread);
3720 ObjectStore* object_store = thread->isolate_group()->object_store();
3721 const auto& type_arguments =
3722 TypeArguments::Handle(object_store->type_argument_double());
3723 const auto& weak_reference =
3724 WeakReference::Handle(WeakReference::New(space));
3725 const auto& target = String::Handle(OneByteString::New("target", space));
3726 weak_reference.set_target(target);
3727 weak_reference.SetTypeArguments(type_arguments);
3728
3729 weak_property ^= WeakProperty::New(space);
3730 weak_property.set_key(key);
3731 weak_property.set_value(weak_reference);
3732 }
3733
3734 if (space == Heap::kNew) {
3735 GCTestHelper::CollectNewSpace();
3736 } else {
3737 GCTestHelper::CollectAllGarbage();
3738 }
3739
3740 const auto& weak_reference =
3741 WeakReference::CheckedHandle(Z, weak_property.value());
3742 EXPECT(weak_reference.target() == Object::null());
3743 EXPECT(weak_reference.GetTypeArguments() != Object::null());
3744}

◆ WeakReference_ClearOne()

static void dart::WeakReference_ClearOne ( Thread thread,
Heap::Space  space 
)
static

Definition at line 3682 of file object_test.cc.

3682 {
3683 auto& weak = WeakReference::Handle();
3684 {
3685 HANDLESCOPE(thread);
3686 const auto& target = String::Handle(OneByteString::New("target", space));
3687 ObjectStore* object_store = thread->isolate_group()->object_store();
3688 const auto& type_arguments =
3689 TypeArguments::Handle(object_store->type_argument_double());
3690 weak ^= WeakReference::New(space);
3691 weak.set_target(target);
3692 weak.SetTypeArguments(type_arguments);
3693 }
3694
3695 if (space == Heap::kNew) {
3696 GCTestHelper::CollectNewSpace();
3697 } else {
3698 GCTestHelper::CollectAllGarbage();
3699 }
3700
3701 EXPECT(weak.target() == Object::null());
3702 EXPECT(weak.GetTypeArguments() != Object::null());
3703}

◆ WeakReference_Generations()

static void dart::WeakReference_Generations ( Generation  reference_space,
Generation  target_space,
bool  cleared_after_minor,
bool  cleared_after_major,
bool  cleared_after_all 
)
static

Definition at line 1000 of file heap_test.cc.

1004 {
1005 WeakReference& reference = WeakReference::Handle();
1006 GCTestHelper::CollectAllGarbage();
1007 {
1008 HANDLESCOPE(Thread::Current());
1009 switch (reference_space) {
1010 case kNew:
1011 reference = WeakReference::New(Heap::kNew);
1012 break;
1013 case kOld:
1014 reference = WeakReference::New(Heap::kOld);
1015 break;
1016 case kImm:
1017 UNREACHABLE();
1018 }
1019
1020 Object& target = Object::Handle();
1021 switch (target_space) {
1022 case kNew:
1023 target = OneByteString::New("target", Heap::kNew);
1024 break;
1025 case kOld:
1026 target = OneByteString::New("target", Heap::kOld);
1027 break;
1028 case kImm:
1029 target = Smi::New(42);
1030 break;
1031 }
1032
1033 reference.set_target(target);
1034 }
1035
1036 OS::PrintErr("%d %d\n", reference_space, target_space);
1037
1038 GCTestHelper::CollectNewSpace();
1039 if (cleared_after_minor) {
1040 EXPECT(reference.target() == Object::null());
1041 } else {
1042 EXPECT(reference.target() != Object::null());
1043 }
1044
1045 GCTestHelper::CollectOldSpace();
1046 if (cleared_after_major) {
1047 EXPECT(reference.target() == Object::null());
1048 } else {
1049 EXPECT(reference.target() != Object::null());
1050 }
1051
1052 GCTestHelper::CollectAllGarbage();
1053 if (cleared_after_all) {
1054 EXPECT(reference.target() == Object::null());
1055 } else {
1056 EXPECT(reference.target() != Object::null());
1057 }
1058}

◆ WeakReference_Preserve_ReachableThroughWeakProperty()

static void dart::WeakReference_Preserve_ReachableThroughWeakProperty ( Thread thread,
Heap::Space  space 
)
static

Definition at line 3756 of file object_test.cc.

3758 {
3759 auto& weak_property = WeakProperty::Handle();
3760 const auto& key = String::Handle(OneByteString::New("key", space));
3761 const auto& target = String::Handle(OneByteString::New("target", space));
3762 {
3763 HANDLESCOPE(thread);
3764 ObjectStore* object_store = thread->isolate_group()->object_store();
3765 const auto& type_arguments =
3766 TypeArguments::Handle(object_store->type_argument_double());
3767 const auto& weak_reference =
3768 WeakReference::Handle(WeakReference::New(space));
3769 weak_reference.set_target(target);
3770 weak_reference.SetTypeArguments(type_arguments);
3771
3772 weak_property ^= WeakProperty::New(space);
3773 weak_property.set_key(key);
3774 weak_property.set_value(weak_reference);
3775 }
3776
3777 if (space == Heap::kNew) {
3778 GCTestHelper::CollectNewSpace();
3779 } else {
3780 GCTestHelper::CollectAllGarbage();
3781 }
3782
3783 const auto& weak_reference =
3784 WeakReference::CheckedHandle(Z, weak_property.value());
3785 EXPECT(weak_reference.target() != Object::null());
3786 EXPECT(weak_reference.GetTypeArguments() != Object::null());
3787}

◆ WeakReference_PreserveOne()

static void dart::WeakReference_PreserveOne ( Thread thread,
Heap::Space  space 
)
static

Definition at line 3651 of file object_test.cc.

3651 {
3652 auto& weak = WeakReference::Handle();
3653 const auto& target = String::Handle(OneByteString::New("target", space));
3654 {
3655 HANDLESCOPE(thread);
3656 ObjectStore* object_store = thread->isolate_group()->object_store();
3657 const auto& type_arguments =
3658 TypeArguments::Handle(object_store->type_argument_double());
3659 weak ^= WeakReference::New(space);
3660 weak.set_target(target);
3661 weak.SetTypeArguments(type_arguments);
3662 }
3663
3664 if (space == Heap::kNew) {
3665 GCTestHelper::CollectNewSpace();
3666 } else {
3667 GCTestHelper::CollectAllGarbage();
3668 }
3669
3670 EXPECT(weak.target() != Object::null());
3671 EXPECT(weak.GetTypeArguments() != Object::null());
3672}

◆ WidenMax()

static RangeBoundary dart::WidenMax ( const Range range,
const Range new_range,
RangeBoundary::RangeSize  size 
)
static

Definition at line 363 of file range_analysis.cc.

365 {
366 RangeBoundary max = range->max();
367 RangeBoundary new_max = new_range->max();
368
369 if (max.IsSymbol()) {
370 if (max.UpperBound().Overflowed(size)) {
371 return RangeBoundary::MaxConstant(size);
372 } else if (DependOnSameSymbol(max, new_max)) {
373 return max.offset() >= new_max.offset()
374 ? max
375 : RangeBoundary::MaxConstant(size);
376 } else if (max.LowerBound(size) >= new_max.UpperBound(size)) {
377 return max;
378 }
379 }
380
381 max = Range::ConstantMax(range, size);
382 new_max = Range::ConstantMax(new_range, size);
383
384 return (max.ConstantValue() >= new_max.ConstantValue())
385 ? max
386 : RangeBoundary::MaxConstant(size);
387}

◆ WidenMin()

static RangeBoundary dart::WidenMin ( const Range range,
const Range new_range,
RangeBoundary::RangeSize  size 
)
static

Definition at line 334 of file range_analysis.cc.

336 {
337 RangeBoundary min = range->min();
338 RangeBoundary new_min = new_range->min();
339
340 if (min.IsSymbol()) {
341 if (min.LowerBound().Overflowed(size)) {
342 return RangeBoundary::MinConstant(size);
343 } else if (DependOnSameSymbol(min, new_min)) {
344 return min.offset() <= new_min.offset()
345 ? min
346 : RangeBoundary::MinConstant(size);
347 } else if (min.UpperBound(size) <= new_min.LowerBound(size)) {
348 return min;
349 }
350 }
351
352 min = Range::ConstantMin(range, size);
353 new_min = Range::ConstantMin(new_range, size);
354
355 return (min.ConstantValue() <= new_min.ConstantValue())
356 ? min
357 : RangeBoundary::MinConstant(size);
358}

◆ WordHash()

static uint32_t dart::WordHash ( uint32_t  key)
static

Definition at line 62 of file hashmap_test.cc.

62 {
64}
static uint32_t WordHash(intptr_t key)
Definition utils.cc:217

◆ WordsToMB()

constexpr double dart::WordsToMB ( intptr_t  size_in_words)
constexpr

Definition at line 551 of file globals.h.

551 {
552 return static_cast<double>(size_in_words) / MBInWords;
553}

◆ Work1()

void dart::Work1 ( )

Definition at line 513 of file ffi_test_functions_vmspecific.cc.

513 {
514 printf("C T1: Work1 Start.\n");
515 SleepOnAnyOS(1);
516 const intptr_t val1 = 3;
517 printf("C T1: MyCallbackBlocking(%" Pd ").\n", val1);
518 const intptr_t val2 = MyCallbackBlocking(val1); // val2 = 6.
519 printf("C T1: MyCallbackBlocking returned %" Pd ".\n", val2);
520 SleepOnAnyOS(1);
521 const intptr_t val3 = val2 - 1; // val3 = 5.
522 printf("C T1: MyCallbackNonBlocking(%" Pd ").\n", val3);
523 MyCallbackNonBlocking(val3); // Post 5 to Dart.
524 printf("C T1: Work1 Done.\n");
525}
DART_EXPORT void SleepOnAnyOS(intptr_t seconds)
intptr_t MyCallbackBlocking(intptr_t a)
void MyCallbackNonBlocking(intptr_t a)

◆ Work1_2()

void dart::Work1_2 ( )

Definition at line 803 of file ffi_test_functions_vmspecific.cc.

803 {
804 printf("C T1: Work1 Start.\n");
805 SleepOnAnyOS(1);
806 const intptr_t val1 = 3;
807 printf("C T1: MyCallback1(%" Pd ").\n", val1);
808 const intptr_t val2 = MyCallback1(val1); // val2 = 6.
809 printf("C T1: MyCallback1 returned %" Pd ".\n", val2);
810 SleepOnAnyOS(1);
811 const intptr_t val3 = val2 - 1; // val3 = 5.
812 printf("C T1: MyCallback2(%" Pd ").\n", val3);
813 MyCallback2(val3); // Post 5 to Dart.
814 printf("C T1: Work1 Done.\n");
815}
void MyCallback2(uint8_t a)
uint8_t MyCallback1(uint8_t a)

◆ Work2()

void dart::Work2 ( )

Definition at line 530 of file ffi_test_functions_vmspecific.cc.

530 {
531 printf("C T2: Work2 Start.\n");
532 const intptr_t val1 = 5;
533 printf("C T2: MyCallbackNonBlocking(%" Pd ").\n", val1);
534 MyCallbackNonBlocking(val1); // Post 5 to Dart.
535 const intptr_t val2 = 1;
536 printf("C T2: MyCallbackBlocking(%" Pd ").\n", val2);
537 const intptr_t val3 = MyCallbackBlocking(val2); // val3 = 4.
538 printf("C T2: MyCallbackBlocking returned %" Pd ".\n", val3);
539 printf("C T2: MyCallbackNonBlocking(%" Pd ").\n", val3);
540 MyCallbackNonBlocking(val3); // Post 4 to Dart.
541 printf("C T2: Work2 Done.\n");
542}

◆ Work2_2()

void dart::Work2_2 ( )

Definition at line 820 of file ffi_test_functions_vmspecific.cc.

820 {
821 printf("C T2: Work2 Start.\n");
822 const intptr_t val1 = 5;
823 printf("C T2: MyCallback2(%" Pd ").\n", val1);
824 MyCallback2(val1); // Post 5 to Dart.
825 const intptr_t val2 = 1;
826 printf("C T2: MyCallback1(%" Pd ").\n", val2);
827 const intptr_t val3 = MyCallback1(val2); // val3 = 4.
828 printf("C T2: MyCallback1 returned %" Pd ".\n", val3);
829 printf("C T2: MyCallback2(%" Pd ").\n", val3);
830 MyCallback2(val3); // Post 4 to Dart.
831 printf("C T2: Work2 Done.\n");
832}

◆ WriteApiMessage()

std::unique_ptr< Message > dart::WriteApiMessage ( Zone zone,
Dart_CObject obj,
Dart_Port  dest_port,
Message::Priority  priority 
)

Definition at line 3436 of file message_snapshot.cc.

3439 {
3440 ApiMessageSerializer serializer(zone);
3441 if (!serializer.Serialize(obj)) {
3442 return nullptr;
3443 }
3444 return serializer.Finish(dest_port, priority);
3445}

◆ WriteCidRangeVectorTo()

static void dart::WriteCidRangeVectorTo ( const CidRangeVector ranges,
BaseTextBuffer buffer 
)
static

Definition at line 439 of file il_test.cc.

440 {
441 if (ranges.is_empty()) {
442 buffer->AddString("empty CidRangeVector");
443 return;
444 }
445 buffer->AddString("non-empty CidRangeVector:\n");
446 for (const auto& range : ranges) {
447 for (intptr_t cid = range.cid_start; cid <= range.cid_end; cid++) {
448 buffer->AddString(" * ");
449 WriteCidTo(cid, buffer);
450 buffer->AddString("\n");
451 }
452 }
453}

◆ WriteCidTo()

static void dart::WriteCidTo ( intptr_t  cid,
BaseTextBuffer buffer 
)
static

Definition at line 383 of file il_test.cc.

383 {
384 ClassTable* const class_table = IsolateGroup::Current()->class_table();
385 buffer->Printf("%" Pd "", cid);
386 if (class_table->HasValidClassAt(cid)) {
387 const auto& cls = Class::Handle(class_table->At(cid));
388 buffer->Printf(" (%s", cls.ScrubbedNameCString());
389 if (cls.is_abstract()) {
390 buffer->AddString(", abstract");
391 }
392 buffer->AddString(")");
393 }
394}

◆ WriteHeaderRelaxed()

static DART_FORCE_INLINE void dart::WriteHeaderRelaxed ( ObjectPtr  obj,
uword  header 
)
static

Definition at line 124 of file scavenger.cc.

124 {
125 reinterpret_cast<std::atomic<uword>*>(UntaggedObject::ToAddr(obj))
126 ->store(header, std::memory_order_relaxed);
127}

◆ WriteMessage()

std::unique_ptr< Message > dart::WriteMessage ( bool  same_group,
const Object obj,
Dart_Port  dest_port,
Message::Priority  priority 
)

Definition at line 3416 of file message_snapshot.cc.

3419 {
3420 if (ApiObjectConverter::CanConvert(obj.ptr())) {
3421 return Message::New(dest_port, obj.ptr(), priority);
3422 } else if (same_group) {
3423 const Object& copy = Object::Handle(CopyMutableObjectGraph(obj));
3424 auto handle =
3425 IsolateGroup::Current()->api_state()->AllocatePersistentHandle();
3426 handle->set_ptr(copy.ptr());
3427 return std::make_unique<Message>(dest_port, handle, priority);
3428 }
3429
3430 Thread* thread = Thread::Current();
3431 MessageSerializer serializer(thread);
3432 serializer.Serialize(obj);
3433 return serializer.Finish(dest_port, priority);
3434}
Definition copy.py:1

Variable Documentation

◆ ab

const CatchEntryMove dart::ab[] = {kA, kB}

Definition at line 31 of file catch_entry_moves_test.cc.

◆ abcde

const CatchEntryMove dart::abcde[] = {kA, kB, kC, kD, kE}

Definition at line 27 of file catch_entry_moves_test.cc.

27{kA, kB, kC, kD, kE};
@ kC
const auto kD

◆ abcdx

const CatchEntryMove dart::abcdx[] = {kA, kB, kC, kD, kX}

Definition at line 28 of file catch_entry_moves_test.cc.

28{kA, kB, kC, kD, kX};

◆ abxde

const CatchEntryMove dart::abxde[] = {kA, kB, kX, kD, kE}

Definition at line 30 of file catch_entry_moves_test.cc.

30{kA, kB, kX, kD, kE};

◆ add_breakpoint_at_activation_params

const MethodParameter* const dart::add_breakpoint_at_activation_params[]
static
Initial value:
= {
new IdParameter("objectId", true),
nullptr,
}
#define RUNNABLE_ISOLATE_PARAMETER
Definition service.cc:182

Definition at line 4007 of file service.cc.

4007 {
4009 new IdParameter("objectId", true),
4010 nullptr,
4011};

◆ add_breakpoint_at_entry_params

const MethodParameter* const dart::add_breakpoint_at_entry_params[]
static
Initial value:
= {
new IdParameter("functionId", true),
nullptr,
}

Definition at line 3978 of file service.cc.

3978 {
3980 new IdParameter("functionId", true),
3981 nullptr,
3982};

◆ add_breakpoint_params

const MethodParameter* const dart::add_breakpoint_params[]
static
Initial value:
= {
new IdParameter("scriptId", true),
new UIntParameter("line", true),
new UIntParameter("column", false),
nullptr,
}

Definition at line 3934 of file service.cc.

3934 {
3936 new IdParameter("scriptId", true),
3937 new UIntParameter("line", true),
3938 new UIntParameter("column", false),
3939 nullptr,
3940};

◆ add_breakpoint_with_script_uri_params

const MethodParameter* const dart::add_breakpoint_with_script_uri_params[]
static
Initial value:
= {
new IdParameter("scriptUri", true),
new UIntParameter("line", true),
new UIntParameter("column", false),
nullptr,
}

Definition at line 3960 of file service.cc.

3960 {
3962 new IdParameter("scriptUri", true),
3963 new UIntParameter("line", true),
3964 new UIntParameter("column", false),
3965 nullptr,
3966};

◆ add_result

int64_t dart::add_result = 0
static

Definition at line 8590 of file dart_api_impl_test.cc.

◆ APSR

const Register dart::APSR = R15

Definition at line 325 of file constants_arm.h.

◆ ARGS_DESC_REG

const Register dart::ARGS_DESC_REG = R4
constexpr

Definition at line 317 of file constants_arm.h.

◆ bare_instructions_frame_layout

const FrameLayout dart::bare_instructions_frame_layout
Initial value:
= {
kFirstObjectSlotFromFp,
kLastFixedObjectSlotFromFp +
2,
kParamEndSlotFromFp,
kLastParamSlotFromEntrySp,
kFirstLocalSlotFromFp +
2,
kDartFrameFixedSize -
2,
0,
kSavedCallerFpSlotFromFp,
kSavedCallerPcSlotFromFp,
0,
kExitLinkSlotFromEntryFp,
}

Definition at line 56 of file stack_frame.cc.

56 {
57 /*.first_object_from_pc =*/kFirstObjectSlotFromFp, // No saved PP slot.
58 /*.last_fixed_object_from_fp = */ kLastFixedObjectSlotFromFp +
59 2, // No saved CODE, PP slots
60 /*.param_end_from_fp = */ kParamEndSlotFromFp,
61 /*.last_param_from_entry_sp = */ kLastParamSlotFromEntrySp,
62 /*.first_local_from_fp =*/kFirstLocalSlotFromFp +
63 2, // No saved CODE, PP slots.
64 /*.dart_fixed_frame_size =*/kDartFrameFixedSize -
65 2, // No saved CODE, PP slots.
66 /*.saved_caller_pp_from_fp = */ 0, // No saved PP slot.
67 /*.saved_caller_fp_from_fp = */ kSavedCallerFpSlotFromFp,
68 /*.saved_caller_pc_from_fp = */ kSavedCallerPcSlotFromFp,
69 /*.code_from_fp = */ 0, // No saved CODE
70 /*.exit_link_slot_from_entry_fp = */ kExitLinkSlotFromEntryFp,
71};

◆ base64_digits

const char dart::base64_digits[65]
static
Initial value:
=
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"

Definition at line 42 of file json_writer.cc.

◆ base64_pad

const char dart::base64_pad = '='
static

Definition at line 44 of file json_writer.cc.

◆ bootstrap_libraries

const BootstrapLibProps dart::bootstrap_libraries[]
static
Initial value:
= {
#define MAKE_PROPERTIES(CamelName, name)
Definition bootstrap.cc:34
#define FOR_EACH_BOOTSTRAP_LIBRARY(M)

Definition at line 37 of file bootstrap.cc.

◆ BootStrapEntries

const struct dart::NativeEntries dart::BootStrapEntries[]
static
Initial value:
}
#define REGISTER_NATIVE_ENTRY(name, count)
#define BOOTSTRAP_NATIVE_LIST(V)

◆ BootStrapFfiEntries

const struct dart::FfiNativeEntries dart::BootStrapFfiEntries[]
static
Initial value:
= {
#define REGISTER_FFI_NATIVE_ENTRY(name, return_type, argument_types)
#define BOOTSTRAP_FFI_NATIVE_LIST(V)

◆ build_expression_evaluation_scope_params

const MethodParameter* const dart::build_expression_evaluation_scope_params[]
static
Initial value:
=
{
new IdParameter("frameIndex", false),
new IdParameter("targetId", false),
nullptr,
}

Definition at line 2881 of file service.cc.

2882 {
2884 new IdParameter("frameIndex", false),
2885 new IdParameter("targetId", false),
2886 nullptr,
2887};

◆ BuiltinEntries [1/2]

struct dart::NativeEntries dart::BuiltinEntries[] = {UNHANDLED_NATIVE_LIST(REGISTER_FUNCTION)}
static

◆ BuiltinEntries [2/2]

struct dart::NativeEntries dart::BuiltinEntries[] = {STACKFRAME_NATIVE_LIST(REGISTER_FUNCTION)}
static

◆ byte_data_finalizer_run

bool dart::byte_data_finalizer_run = false
static

Definition at line 2329 of file dart_api_impl_test.cc.

◆ BYTECODE_MASK

const int dart::BYTECODE_MASK = 0xff

Definition at line 10 of file regexp_bytecodes.h.

◆ BYTECODE_SHIFT

const int dart::BYTECODE_SHIFT = 8

Definition at line 15 of file regexp_bytecodes.h.

◆ callback_

void(* dart::callback_) (Dart_Handle) ( Dart_Handle  )

Definition at line 1103 of file ffi_test_functions_vmspecific.cc.

◆ CALLEE_SAVED_TEMP

const Register dart::CALLEE_SAVED_TEMP = R8
constexpr

Definition at line 322 of file constants_arm.h.

◆ CALLEE_SAVED_TEMP2

constexpr Register dart::CALLEE_SAVED_TEMP2 = R20
constexpr

Definition at line 155 of file constants_arm64.h.

◆ cid

const intptr_t dart::cid

Definition at line 322 of file method_recognizer.cc.

◆ class_name

const char* const dart::class_name

Definition at line 133 of file method_recognizer.cc.

◆ cleanup_group_callback_data

void* dart::cleanup_group_callback_data
static

Definition at line 8542 of file dart_api_impl_test.cc.

◆ cleanup_isolate_data

void* dart::cleanup_isolate_data
static

Definition at line 8509 of file dart_api_impl_test.cc.

◆ cleanup_isolate_group_data

void* dart::cleanup_isolate_group_data
static

Definition at line 8508 of file dart_api_impl_test.cc.

◆ clear_cpu_samples_params

const MethodParameter* const dart::clear_cpu_samples_params[]
static
Initial value:

Definition at line 4499 of file service.cc.

4499 {
4501 nullptr,
4502};

◆ clear_vm_timeline_params

const MethodParameter* const dart::clear_vm_timeline_params[]
static
Initial value:
= {
nullptr,
}
#define NO_ISOLATE_PARAMETER
Definition service.cc:181

Definition at line 4285 of file service.cc.

4285 {
4287 nullptr,
4288};

◆ closure_to_callback_

Dart_PersistentHandle dart::closure_to_callback_

Definition at line 1104 of file ffi_test_functions_vmspecific.cc.

◆ cobj_dynamic_type

Dart_CObject dart::cobj_dynamic_type = {Dart_CObject_kUnsupported, {false}}
static

Definition at line 32 of file message_snapshot.cc.

◆ cobj_empty_type_arguments

Dart_CObject dart::cobj_empty_type_arguments
static
Initial value:

Definition at line 34 of file message_snapshot.cc.

35 {false}};

◆ cobj_false

Dart_CObject dart::cobj_false = {Dart_CObject_kBool, {false}}
static

Definition at line 37 of file message_snapshot.cc.

37{Dart_CObject_kBool, {false}};

◆ cobj_sentinel

Dart_CObject dart::cobj_sentinel = {Dart_CObject_kUnsupported, {false}}
static

Definition at line 29 of file message_snapshot.cc.

◆ cobj_transition_sentinel

Dart_CObject dart::cobj_transition_sentinel
static
Initial value:

Definition at line 30 of file message_snapshot.cc.

31 {false}};

◆ cobj_true

Dart_CObject dart::cobj_true = {Dart_CObject_kBool, {true}}
static

Definition at line 36 of file message_snapshot.cc.

36{Dart_CObject_kBool, {true}};

◆ cobj_void_type

Dart_CObject dart::cobj_void_type = {Dart_CObject_kUnsupported, {false}}
static

Definition at line 33 of file message_snapshot.cc.

◆ CODE_REG

const Register dart::CODE_REG = R6
constexpr

Definition at line 318 of file constants_arm.h.

◆ collect_all_garbage_params

const MethodParameter* const dart::collect_all_garbage_params[]
static
Initial value:

Definition at line 4554 of file service.cc.

4554 {
4556 nullptr,
4557};

◆ compile_expression_params

const MethodParameter* const dart::compile_expression_params[]
static
Initial value:
= {
new StringParameter("expression", true),
new StringParameter("definitions", false),
new StringParameter("definitionTypes", false),
new StringParameter("typeDefinitions", false),
new StringParameter("typeBounds", false),
new StringParameter("typeDefaults", false),
new StringParameter("libraryUri", true),
new StringParameter("klass", false),
new BoolParameter("isStatic", false),
new StringParameter("method", false),
new Int64Parameter("tokenPos", false),
nullptr,
}

Definition at line 3197 of file service.cc.

3197 {
3199 new StringParameter("expression", true),
3200 new StringParameter("definitions", false),
3201 new StringParameter("definitionTypes", false),
3202 new StringParameter("typeDefinitions", false),
3203 new StringParameter("typeBounds", false),
3204 new StringParameter("typeDefaults", false),
3205 new StringParameter("libraryUri", true),
3206 new StringParameter("klass", false),
3207 new BoolParameter("isStatic", false),
3208 new StringParameter("method", false),
3209 new Int64Parameter("tokenPos", false),
3210 // TODO(jensj): Uncomment this line when DDS has rolled into flutter
3211 // (https://dart-review.googlesource.com/c/sdk/+/329322).
3212 // new StringParameter("scriptUri", false),
3213 nullptr,
3214};

◆ cpu_reg_abi_names

const char *const dart::cpu_reg_abi_names
extern

Definition at line 138 of file constants_arm64.h.

◆ cpu_reg_byte_names

const char *const dart::cpu_reg_byte_names
extern

Definition at line 107 of file constants_x64.h.

◆ cpu_reg_names

const char *const dart::cpu_reg_names
extern

Definition at line 137 of file constants_arm64.h.

◆ dart_api_data

const DartApi dart::dart_api_data
static
Initial value:
= {
static const DartApiEntry dart_api_entries[]
Definition ffi.cc:86

Definition at line 93 of file ffi.cc.

◆ dart_api_entries

const DartApiEntry dart::dart_api_entries[]
static
Initial value:
= {
#define ENTRY(name, R, A)
DartApiEntry{nullptr, nullptr}}

Definition at line 86 of file ffi.cc.

86 {
87#define ENTRY(name, R, A) \
88 DartApiEntry{#name, reinterpret_cast<void (*)()>(name)},
90#undef ENTRY
91 DartApiEntry{nullptr, nullptr}};
#define DART_API_ALL_DL_SYMBOLS(F)
#define ENTRY(name, R, A)

◆ DART_USED

const SRegister STMP dart::DART_USED = EvenSRegisterOf(DTMP)

Definition at line 292 of file constants_arm.h.

◆ data

int8_t dart::data[kExtLength]
static
Initial value:
= {
0x41, 0x42, 0x41, 0x42, 0x41, 0x42, 0x41, 0x42,
0x41, 0x42, 0x41, 0x42, 0x41, 0x42, 0x41, 0x42,
}

Definition at line 2256 of file dart_api_impl_test.cc.

2256 {
2257 0x41, 0x42, 0x41, 0x42, 0x41, 0x42, 0x41, 0x42,
2258 0x41, 0x42, 0x41, 0x42, 0x41, 0x42, 0x41, 0x42,
2259};

◆ de

const CatchEntryMove dart::de[] = {kD, kE}

Definition at line 32 of file catch_entry_moves_test.cc.

32{kD, kE};

◆ decode_table

const int8_t dart::decode_table[]
static
Initial value:
= {
-2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -1, -2, -2, -1, -2, -2,
-2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
-2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, 62, -2, 62, -2, 63,
52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -2, -2, -2, 00, -2, -2,
-2, 00, 01, 02, 03, 04, 05, 06, 07, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -2, -2, -2, -2, 63,
-2, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -2, -2, -2, -2, -2,
-2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
-2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
-2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
-2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
-2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
-2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
-2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
-2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2}

Definition at line 19 of file base64.cc.

19 {
20 -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -1, -2, -2, -1, -2, -2, //
21 -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, //
22 -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, 62, -2, 62, -2, 63, //
23 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -2, -2, -2, 00, -2, -2, //
24 -2, 00, 01, 02, 03, 04, 05, 06, 07, 8, 9, 10, 11, 12, 13, 14, //
25 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -2, -2, -2, -2, 63, //
26 -2, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, //
27 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -2, -2, -2, -2, -2, //
28 -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, //
29 -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, //
30 -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, //
31 -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, //
32 -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, //
33 -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, //
34 -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, //
35 -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2};

◆ default_frame_layout

const FrameLayout dart::default_frame_layout
Initial value:
= {
kFirstObjectSlotFromFp,
kLastFixedObjectSlotFromFp,
kParamEndSlotFromFp,
kLastParamSlotFromEntrySp,
kFirstLocalSlotFromFp,
kDartFrameFixedSize,
kSavedCallerPpSlotFromFp,
kSavedCallerFpSlotFromFp,
kSavedCallerPcSlotFromFp,
kPcMarkerSlotFromFp,
kExitLinkSlotFromEntryFp,
}

Definition at line 43 of file stack_frame.cc.

43 {
44 /*.first_object_from_fp = */ kFirstObjectSlotFromFp,
45 /*.last_fixed_object_from_fp = */ kLastFixedObjectSlotFromFp,
46 /*.param_end_from_fp = */ kParamEndSlotFromFp,
47 /*.last_param_from_entry_sp = */ kLastParamSlotFromEntrySp,
48 /*.first_local_from_fp = */ kFirstLocalSlotFromFp,
49 /*.dart_fixed_frame_size = */ kDartFrameFixedSize,
50 /*.saved_caller_pp_from_fp = */ kSavedCallerPpSlotFromFp,
51 /*.saved_caller_fp_from_fp = */ kSavedCallerFpSlotFromFp,
52 /*.saved_caller_pc_from_fp = */ kSavedCallerPcSlotFromFp,
53 /*.code_from_fp = */ kPcMarkerSlotFromFp,
54 /*.exit_link_slot_from_entry_fp = */ kExitLinkSlotFromEntryFp,
55};

◆ delete_on_finalization

Dart_WeakPersistentHandle dart::delete_on_finalization

Definition at line 4025 of file dart_api_impl_test.cc.

◆ DISPATCH_TABLE_REG

constexpr Register dart::DISPATCH_TABLE_REG = NOTFP
constexpr

Definition at line 313 of file constants_arm.h.

◆ double_abs_constant

const struct dart::ALIGN16 dart::double_abs_constant = {0x7FFFFFFFFFFFFFFFULL, 0x7FFFFFFFFFFFFFFFULL}
static

◆ double_nan_constant

const double dart::double_nan_constant = NAN
static

Definition at line 141 of file thread.cc.

◆ double_negate_constant

const struct dart::ALIGN16 dart::double_negate_constant = {0x8000000000000000ULL, 0x8000000000000000ULL}
static

◆ DTMP

const DRegister dart::DTMP = EvenDRegisterOf(QTMP)

Definition at line 291 of file constants_arm.h.

◆ enable_profiler_params

const MethodParameter* const dart::enable_profiler_params[]
static
Initial value:
= {
nullptr,
}

Definition at line 4425 of file service.cc.

4425 {
4426 nullptr,
4427};

◆ enum_name

const char* const dart::enum_name

Definition at line 135 of file method_recognizer.cc.

◆ evaluate_compiled_expression_params

const MethodParameter* const dart::evaluate_compiled_expression_params[]
static
Initial value:
= {
new UIntParameter("frameIndex", false),
new IdParameter("targetId", false),
new StringParameter("kernelBytes", true),
nullptr,
}

Definition at line 3299 of file service.cc.

3299 {
3301 new UIntParameter("frameIndex", false),
3302 new IdParameter("targetId", false),
3303 new StringParameter("kernelBytes", true),
3304 nullptr,
3305};

◆ evaluate_in_frame_params

const MethodParameter* const dart::evaluate_in_frame_params[]
static
Initial value:
= {
new UIntParameter("frameIndex", true),
new MethodParameter("expression", true),
nullptr,
}

Definition at line 3433 of file service.cc.

3433 {
3435 new UIntParameter("frameIndex", true),
3436 new MethodParameter("expression", true),
3437 nullptr,
3438};

◆ evaluate_params

const MethodParameter* const dart::evaluate_params[]
static
Initial value:

Definition at line 2757 of file service.cc.

2757 {
2759 nullptr,
2760};

◆ event_queue

EventQueue* dart::event_queue

Definition at line 154 of file custom_isolate_test.cc.

◆ exception_pause_mode_names

const char* const dart::exception_pause_mode_names[]
static
Initial value:
= {
"All",
"None",
"Unhandled",
nullptr,
}

Definition at line 5485 of file service.cc.

5485 {
5486 "All",
5487 "None",
5488 "Unhandled",
5489 nullptr,
5490};

◆ exception_pause_mode_values

Dart_ExceptionPauseInfo dart::exception_pause_mode_values[]
static

◆ expected_allocation_cls

const char* dart::expected_allocation_cls = nullptr
static

Definition at line 10239 of file dart_api_impl_test.cc.

◆ [struct]

const struct { ... } dart::factory_recognizer_list[]
Initial value:
Symbols::kIllegal, -1, 0, nullptr}}
#define RECOGNIZE_FACTORY(symbol, class_name, constructor_name, cid, fp)
#define RECOGNIZED_LIST_FACTORY_LIST(V)

◆ false

dart::false

Definition at line 58 of file isolate_reload.cc.

◆ FAR_TMP

constexpr Register dart::FAR_TMP = S8
constexpr

Definition at line 152 of file constants_riscv.h.

◆ file_schema

const char* dart::file_schema = "file://"

Definition at line 293 of file ffi_dynamic_library.cc.

◆ file_schema_length

const int dart::file_schema_length = 7

Definition at line 294 of file ffi_dynamic_library.cc.

◆ finalizable_handle3

Dart_FinalizableHandle dart::finalizable_handle3
static

Definition at line 3888 of file dart_api_impl_test.cc.

◆ finalizable_new_ref

Dart_FinalizableHandle dart::finalizable_new_ref = nullptr
static

Definition at line 3589 of file dart_api_impl_test.cc.

◆ finalizable_new_ref_peer

void* dart::finalizable_new_ref_peer = 0
static

Definition at line 3590 of file dart_api_impl_test.cc.

◆ finalizable_old_ref

Dart_FinalizableHandle dart::finalizable_old_ref = nullptr
static

Definition at line 3591 of file dart_api_impl_test.cc.

◆ finalizable_old_ref_peer

void* dart::finalizable_old_ref_peer = 0
static

Definition at line 3592 of file dart_api_impl_test.cc.

◆ finger_print

const uint32_t dart::finger_print

Definition at line 323 of file method_recognizer.cc.

◆ FLAG_regexp_possessive_quantifier

constexpr bool dart::FLAG_regexp_possessive_quantifier = false
staticconstexpr

Definition at line 21 of file regexp_parser.cc.

◆ float_absolute_constant

const struct dart::ALIGN16 dart::float_absolute_constant = {0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF}
static

◆ float_negate_constant

const struct dart::ALIGN16 dart::float_negate_constant = {0x80000000, 0x80000000, 0x80000000, 0x80000000}
static

◆ float_not_constant

const struct dart::ALIGN16 dart::float_not_constant = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF}
static

◆ float_zerow_constant

const struct dart::ALIGN16 dart::float_zerow_constant = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000}
static

◆ found_allocation

bool dart::found_allocation = false
static

Definition at line 10240 of file dart_api_impl_test.cc.

◆ fp

const uint32_t dart::fp

Definition at line 136 of file method_recognizer.cc.

◆ FPREG

const Register dart::FPREG = FP
constexpr

Definition at line 315 of file constants_arm.h.

◆ fpu_d_reg_names

const char* const dart::fpu_d_reg_names[kNumberOfDRegisters]
extern

◆ fpu_reg_names

const char *const dart::fpu_reg_names
extern

Definition at line 139 of file constants_arm64.h.

◆ fpu_s_reg_names

const char* const dart::fpu_s_reg_names[kNumberOfSRegisters]
extern

◆ FpuTMP

const FpuRegister dart::FpuTMP = QTMP

Definition at line 297 of file constants_arm.h.

◆ FTMP

const FRegister dart::FTMP = FT11

Definition at line 137 of file constants_riscv.h.

◆ function_name

const char* const dart::function_name

Definition at line 134 of file method_recognizer.cc.

◆ FUNCTION_REG

const Register dart::FUNCTION_REG = R0
constexpr

Definition at line 320 of file constants_arm.h.

◆ GB

constexpr intptr_t dart::GB = 1 << GBLog2
constexpr

Definition at line 532 of file globals.h.

◆ GBInWords

constexpr intptr_t dart::GBInWords = 1 << GBInWordsLog2
constexpr

Definition at line 539 of file globals.h.

◆ GBInWordsLog2

constexpr intptr_t dart::GBInWordsLog2 = MBLog2 + KBInWordsLog2
constexpr

Definition at line 538 of file globals.h.

◆ GBLog2

constexpr intptr_t dart::GBLog2 = MBLog2 + KBLog2
constexpr

Definition at line 531 of file globals.h.

◆ gc_during_reload

dart::gc_during_reload

Definition at line 58 of file isolate_reload.cc.

◆ get_allocation_profile_params

const MethodParameter* const dart::get_allocation_profile_params[]
static
Initial value:

Definition at line 4541 of file service.cc.

4541 {
4543 nullptr,
4544};

◆ get_allocation_traces_params

const MethodParameter* const dart::get_allocation_traces_params[]
static
Initial value:
= {
new IdParameter("classId", false),
new Int64Parameter("timeOriginMicros", false),
new Int64Parameter("timeExtentMicros", false),
nullptr,
}

Definition at line 4459 of file service.cc.

4459 {
4461 new IdParameter("classId", false),
4462 new Int64Parameter("timeOriginMicros", false),
4463 new Int64Parameter("timeExtentMicros", false),
4464 nullptr,
4465};

◆ get_class_list_params

const MethodParameter* const dart::get_class_list_params[]
static
Initial value:

Definition at line 5154 of file service.cc.

5154 {
5156 nullptr,
5157};

◆ get_cpu_samples_params

const MethodParameter* const dart::get_cpu_samples_params[]
static
Initial value:
= {
new Int64Parameter("timeOriginMicros", false),
new Int64Parameter("timeExtentMicros", false),
nullptr,
}

Definition at line 4448 of file service.cc.

4448 {
4450 new Int64Parameter("timeOriginMicros", /*required=*/false),
4451 new Int64Parameter("timeExtentMicros", /*required=*/false),
4452 nullptr,
4453};

◆ get_default_classes_aliases_params

const MethodParameter* const dart::get_default_classes_aliases_params[]
static
Initial value:
= {
nullptr,
}

Definition at line 5762 of file service.cc.

5762 {
5764 nullptr,
5765};

◆ get_flag_list_params

const MethodParameter* const dart::get_flag_list_params[]
static
Initial value:
= {
nullptr,
}

Definition at line 5593 of file service.cc.

5593 {
5595 nullptr,
5596};

◆ get_heap_map_params

const MethodParameter* const dart::get_heap_map_params[]
static
Initial value:

Definition at line 4565 of file service.cc.

4565 {
4567 nullptr,
4568};

◆ get_implementation_fields_params

const MethodParameter* const dart::get_implementation_fields_params[]
static
Initial value:
= {
nullptr,
}
#define OBJECT_PARAMETER
Definition service.cc:183

Definition at line 5096 of file service.cc.

5096 {
5099 nullptr,
5100};

◆ get_inbound_references_params

const MethodParameter* const dart::get_inbound_references_params[]
static
Initial value:

Definition at line 2363 of file service.cc.

2363 {
2365 nullptr,
2366};

◆ get_instances_as_list_params

const MethodParameter* const dart::get_instances_as_list_params[]
static
Initial value:
= {
new IdParameter("objectId", true),
new BoolParameter("includeSubclasses", false),
new BoolParameter("includeImplementers", false),
nullptr,
}

Definition at line 3581 of file service.cc.

3581 {
3583 new IdParameter("objectId", /*required=*/true),
3584 new BoolParameter("includeSubclasses", /*required=*/false),
3585 new BoolParameter("includeImplementers", /*required=*/false),
3586 nullptr,
3587};

◆ get_instances_params

const MethodParameter* const dart::get_instances_params[]
static
Initial value:
= {
new IdParameter("objectId", true),
new UIntParameter("limit", true),
new BoolParameter("includeSubclasses", false),
new BoolParameter("includeImplementers", false),
nullptr,
}

Definition at line 3532 of file service.cc.

3532 {
3534 new IdParameter("objectId", /*required=*/true),
3535 new UIntParameter("limit", /*required=*/true),
3536 new BoolParameter("includeSubclasses", /*required=*/false),
3537 new BoolParameter("includeImplementers", /*required=*/false),
3538 nullptr,
3539};

◆ get_isolate_group_memory_usage_params

const MethodParameter* const dart::get_isolate_group_memory_usage_params[]
static
Initial value:
= {
nullptr,
}
#define ISOLATE_GROUP_PARAMETER
Definition service.cc:180

Definition at line 1616 of file service.cc.

1616 {
1618 nullptr,
1619};

◆ get_isolate_group_params

const MethodParameter* const dart::get_isolate_group_params[]
static
Initial value:
= {
nullptr,
}

Definition at line 1524 of file service.cc.

1524 {
1526 nullptr,
1527};

◆ get_isolate_metric_list_params

const MethodParameter* const dart::get_isolate_metric_list_params[]
static
Initial value:

Definition at line 4105 of file service.cc.

4105 {
4107 nullptr,
4108};

◆ get_isolate_metric_params

const MethodParameter* const dart::get_isolate_metric_params[]
static
Initial value:

Definition at line 4123 of file service.cc.

4123 {
4125 nullptr,
4126};

◆ get_isolate_object_store_params

const MethodParameter* const dart::get_isolate_object_store_params[]
static
Initial value:

Definition at line 5144 of file service.cc.

5144 {
5146 nullptr,
5147};

◆ get_isolate_params

const MethodParameter* const dart::get_isolate_params[]
static
Initial value:
= {
nullptr,
}
#define ISOLATE_PARAMETER
Definition service.cc:179

Definition at line 1515 of file service.cc.

1515 {
1517 nullptr,
1518};

◆ get_isolate_pause_event_params

const MethodParameter* const dart::get_isolate_pause_event_params[]
static
Initial value:
= {
nullptr,
}

Definition at line 1627 of file service.cc.

1627 {
1629 nullptr,
1630};

◆ get_memory_usage_params

const MethodParameter* const dart::get_memory_usage_params[]
static
Initial value:
= {
nullptr,
}

Definition at line 1607 of file service.cc.

1607 {
1609 nullptr,
1610};

◆ get_object_params

const MethodParameter* const dart::get_object_params[]
static
Initial value:
= {
new UIntParameter("offset", false),
new UIntParameter("count", false),
nullptr,
}

Definition at line 5039 of file service.cc.

5039 {
5041 new UIntParameter("offset", false),
5042 new UIntParameter("count", false),
5043 nullptr,
5044};

◆ get_object_store_params

const MethodParameter* const dart::get_object_store_params[]
static
Initial value:

Definition at line 5134 of file service.cc.

5134 {
5136 nullptr,
5137};

◆ get_persistent_handles_params

const MethodParameter* const dart::get_persistent_handles_params[]
static
Initial value:
= {
nullptr,
}

Definition at line 4890 of file service.cc.

4890 {
4892 nullptr,
4893};

◆ get_ports_params

const MethodParameter* const dart::get_ports_params[]
static
Initial value:

Definition at line 3685 of file service.cc.

3685 {
3687 nullptr,
3688};

◆ get_ports_private_params

const MethodParameter* const dart::get_ports_private_params[]
static
Initial value:

Definition at line 4978 of file service.cc.

4978 {
4980 nullptr,
4981};

◆ get_process_memory_usage_params

const MethodParameter* const dart::get_process_memory_usage_params[]
static
Initial value:
= {
nullptr,
}

Definition at line 4821 of file service.cc.

4821 {
4822 nullptr,
4823};

◆ get_reachable_size_params

const MethodParameter* const dart::get_reachable_size_params[]
static
Initial value:
= {
new IdParameter("targetId", true),
nullptr,
}

Definition at line 2585 of file service.cc.

2585 {
2587 new IdParameter("targetId", true),
2588 nullptr,
2589};

◆ get_retained_size_params

const MethodParameter* const dart::get_retained_size_params[]
static
Initial value:
= {
new IdParameter("targetId", true),
nullptr,
}

Definition at line 2546 of file service.cc.

2546 {
2548 new IdParameter("targetId", true),
2549 nullptr,
2550};

◆ get_retaining_path_params

const MethodParameter* const dart::get_retaining_path_params[]
static
Initial value:

Definition at line 2505 of file service.cc.

2505 {
2507 nullptr,
2508};

◆ get_scripts_params

const MethodParameter* const dart::get_scripts_params[]
static
Initial value:

Definition at line 1636 of file service.cc.

1636 {
1638 nullptr,
1639};

◆ get_source_report_params

const MethodParameter* const dart::get_source_report_params[]
static
Initial value:
= {
new EnumListParameter("reports", true, report_enum_names),
new IdParameter("scriptId", false),
new UIntParameter("tokenPos", false),
new UIntParameter("endTokenPos", false),
new BoolParameter("forceCompile", false),
nullptr,
}

Definition at line 3718 of file service.cc.

3718 {
3719#if !defined(DART_PRECOMPILED_RUNTIME)
3721 new EnumListParameter("reports", true, report_enum_names),
3722 new IdParameter("scriptId", false),
3723 new UIntParameter("tokenPos", false),
3724 new UIntParameter("endTokenPos", false),
3725 new BoolParameter("forceCompile", false),
3726#endif
3727 nullptr,
3728};

◆ get_stack_params

const MethodParameter* const dart::get_stack_params[]
static
Initial value:
= {
new UIntParameter("limit", false),
nullptr,
}

Definition at line 1670 of file service.cc.

1670 {
1672 new UIntParameter("limit", false),
1673 nullptr,
1674};

◆ get_tag_profile_params

const MethodParameter* const dart::get_tag_profile_params[]
static
Initial value:

Definition at line 4437 of file service.cc.

4437 {
4439 nullptr,
4440};

◆ get_type_arguments_list_params

const MethodParameter* const dart::get_type_arguments_list_params[]
static
Initial value:

Definition at line 5165 of file service.cc.

5165 {
5167 nullptr,
5168};

◆ get_version_params

const MethodParameter* const dart::get_version_params[]
static
Initial value:
= {
nullptr,
}

Definition at line 5201 of file service.cc.

5201 {
5203 nullptr,
5204};

◆ get_vm_params

const MethodParameter* const dart::get_vm_params[]
static
Initial value:
= {
nullptr,
}

Definition at line 5247 of file service.cc.

5247 {
5249 nullptr,
5250};

◆ get_vm_timeline_flags_params

const MethodParameter* const dart::get_vm_timeline_flags_params[]
static
Initial value:
= {
nullptr,
}

Definition at line 4257 of file service.cc.

4257 {
4259 nullptr,
4260};

◆ get_vm_timeline_micros_params

const MethodParameter* const dart::get_vm_timeline_micros_params[]
static
Initial value:
= {
nullptr,
}

Definition at line 4274 of file service.cc.

4274 {
4276 nullptr,
4277};

◆ get_vm_timeline_params

const MethodParameter* const dart::get_vm_timeline_params[]
static
Initial value:
= {
new Int64Parameter("timeOriginMicros", false),
new Int64Parameter("timeExtentMicros", false),
nullptr,
}

Definition at line 4300 of file service.cc.

4300 {
4302 new Int64Parameter("timeOriginMicros", /*required=*/false),
4303 new Int64Parameter("timeExtentMicros", /*required=*/false),
4304 nullptr,
4305};

◆ global_random

Random* dart::global_random = nullptr
static

Definition at line 78 of file random.cc.

◆ global_random_mutex

Mutex* dart::global_random_mutex = nullptr
static

Definition at line 79 of file random.cc.

◆ HEAP_BITS

const Register dart::HEAP_BITS = R28

Definition at line 156 of file constants_arm64.h.

◆ heap_samples

intptr_t dart::heap_samples = 0
static

Definition at line 10238 of file dart_api_impl_test.cc.

◆ IC_DATA_REG

const Register dart::IC_DATA_REG = R9
constexpr

Definition at line 316 of file constants_arm.h.

◆ invalid_frame_layout

const FrameLayout dart::invalid_frame_layout
Initial value:
= {
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
}

Definition at line 29 of file stack_frame.cc.

29 {
30 /*.first_object_from_fp = */ -1,
31 /*.last_fixed_object_from_fp = */ -1,
32 /*.param_end_from_fp = */ -1,
33 /*.last_param_from_entry_sp = */ -1,
34 /*.first_local_from_fp = */ -1,
35 /*.dart_fixed_frame_size = */ -1,
36 /*.saved_caller_pp_from_fp = */ -1,
37 /*.saved_caller_fp_from_fp = */ -1,
38 /*.saved_caller_pc_from_fp = */ -1,
39 /*.code_from_fp = */ -1,
40 /*.exit_link_slot_from_entry_fp = */ -1,
41};

◆ invoke_params

const MethodParameter* const dart::invoke_params[]
static
Initial value:

Definition at line 2624 of file service.cc.

2624 {
2626 nullptr,
2627};

◆ kA

const auto dart::kA = NewMove(1, 10)

Definition at line 20 of file catch_entry_moves_test.cc.

◆ kAbiArgumentCpuRegs

constexpr RegList dart::kAbiArgumentCpuRegs
constexpr
Initial value:
=
(1 << R0) | (1 << R1) | (1 << R2) | (1 << R3)

Definition at line 647 of file constants_arm.h.

◆ kAbiArgumentFpuRegs

constexpr RegList dart::kAbiArgumentFpuRegs
constexpr
Initial value:
=
R(FA0) | R(FA1) | R(FA2) | R(FA3) | R(FA4) | R(FA5) | R(FA6) | R(FA7)
#define R(reg)

Definition at line 520 of file constants_riscv.h.

◆ kAbiFirstPreservedCpuReg

const Register dart::kAbiFirstPreservedCpuReg = R19

Definition at line 514 of file constants_arm64.h.

◆ kAbiFirstPreservedFpuReg

const VRegister dart::kAbiFirstPreservedFpuReg = Q4

Definition at line 660 of file constants_arm.h.

◆ kAbiLastPreservedCpuReg

const Register dart::kAbiLastPreservedCpuReg = R28

Definition at line 515 of file constants_arm64.h.

◆ kAbiLastPreservedFpuReg

const VRegister dart::kAbiLastPreservedFpuReg = Q7

Definition at line 661 of file constants_arm.h.

◆ kAbiPreservedCpuRegCount

constexpr int dart::kAbiPreservedCpuRegCount = 7
constexpr

Definition at line 658 of file constants_arm.h.

◆ kAbiPreservedCpuRegs

const RegList dart::kAbiPreservedCpuRegs
constexpr
Initial value:
= (1 << R4) | (1 << R5) | (1 << R6) |
(1 << R7) | (1 << R8) | (1 << R9) |
(1 << R10)

Definition at line 655 of file constants_arm.h.

◆ kAbiPreservedFpuRegCount

constexpr int dart::kAbiPreservedFpuRegCount = 4
constexpr

Definition at line 662 of file constants_arm.h.

◆ kAbiPreservedFpuRegs

constexpr RegList dart::kAbiPreservedFpuRegs
constexpr
Initial value:
= R(FS0) | R(FS1) | R(FS2) | R(FS3) |
R(FS4) | R(FS5) | R(FS6) | R(FS7) |
R(FS8) | R(FS9) | R(FS10) | R(FS11)

Definition at line 525 of file constants_riscv.h.

◆ kAbiVolatileCpuRegs

constexpr RegList dart::kAbiVolatileCpuRegs = kAbiArgumentCpuRegs | (1 << IP) | (1 << LR)
constexpr

Definition at line 649 of file constants_arm.h.

◆ kAbiVolatileFpuRegs

const RegList dart::kAbiVolatileFpuRegs = R(Q0) | R(Q1) | R(Q2) | R(Q3)
constexpr

Definition at line 686 of file constants_arm.h.

◆ kAcquireShift

const intptr_t dart::kAcquireShift = 26

Definition at line 948 of file constants_riscv.h.

◆ kAllBenchmarks

constexpr const char* dart::kAllBenchmarks = "All Benchmarks"
staticconstexpr

Definition at line 45 of file run_vm_tests.cc.

◆ kAllCpuRegistersList

const RegList dart::kAllCpuRegistersList = 0xFFFF

Definition at line 643 of file constants_arm.h.

◆ kAllFpuRegistersList

const RegList dart::kAllFpuRegistersList = (1 << kNumberOfFpuRegisters) - 1

Definition at line 644 of file constants_arm.h.

◆ kAllocatablePageSize

constexpr intptr_t dart::kAllocatablePageSize = 64 * KB
staticconstexpr

Definition at line 55 of file spaces.h.

◆ kAllocationCanary

constexpr intptr_t dart::kAllocationCanary = 123
staticconstexpr

Definition at line 181 of file globals.h.

◆ kAllocationRedZoneSize

constexpr intptr_t dart::kAllocationRedZoneSize = kObjectAlignment
staticconstexpr

Definition at line 41 of file page.h.

◆ kArg1Reg

Definition at line 146 of file assembler_test.cc.

◆ kArg2Reg

Definition at line 147 of file assembler_test.cc.

◆ kAsciiWordMask

constexpr uintptr_t dart::kAsciiWordMask = 0x80808080u
staticconstexpr

Definition at line 18 of file unicode.cc.

◆ KB

constexpr intptr_t dart::KB = 1 << KBLog2
constexpr

Definition at line 528 of file globals.h.

◆ kB

const auto dart::kB = NewMove(2, 20)

Definition at line 21 of file catch_entry_moves_test.cc.

◆ KBInWords

constexpr intptr_t dart::KBInWords = 1 << KBInWordsLog2
constexpr

Definition at line 535 of file globals.h.

◆ KBInWordsLog2

constexpr intptr_t dart::KBInWordsLog2 = KBLog2 - kWordSizeLog2
constexpr

Definition at line 534 of file globals.h.

◆ kBitsPerByte

constexpr intptr_t dart::kBitsPerByte = 1 << kBitsPerByteLog2
constexpr

Definition at line 463 of file globals.h.

◆ kBitsPerByteLog2

constexpr intptr_t dart::kBitsPerByteLog2 = 3
constexpr

Definition at line 462 of file globals.h.

◆ kBitsPerInt16

constexpr intptr_t dart::kBitsPerInt16 = kInt16Size * kBitsPerByte
constexpr

Definition at line 465 of file globals.h.

◆ kBitsPerInt32

constexpr intptr_t dart::kBitsPerInt32 = kInt32Size * kBitsPerByte
constexpr

Definition at line 466 of file globals.h.

◆ kBitsPerInt64

constexpr intptr_t dart::kBitsPerInt64 = kInt64Size * kBitsPerByte
constexpr

Definition at line 467 of file globals.h.

◆ kBitsPerInt8

constexpr intptr_t dart::kBitsPerInt8 = kInt8Size * kBitsPerByte
constexpr

Definition at line 464 of file globals.h.

◆ kBitsPerWord

constexpr intptr_t dart::kBitsPerWord = 1 << kBitsPerWordLog2
constexpr

Definition at line 514 of file globals.h.

◆ kBitsPerWordLog2

constexpr intptr_t dart::kBitsPerWordLog2 = kWordSizeLog2 + kBitsPerByteLog2
constexpr

Definition at line 513 of file globals.h.

◆ kBitVectorWordsPerBlock

constexpr intptr_t dart::kBitVectorWordsPerBlock = 1
staticconstexpr

Definition at line 32 of file page.h.

◆ kBlockMask

constexpr intptr_t dart::kBlockMask = ~(kBlockSize - 1)
staticconstexpr

Definition at line 35 of file page.h.

◆ kBlockSize

constexpr intptr_t dart::kBlockSize
staticconstexpr
Initial value:
=
static constexpr intptr_t kBitVectorWordsPerBlock
Definition page.h:32

Definition at line 33 of file page.h.

◆ kBlocksPerPage

constexpr intptr_t dart::kBlocksPerPage = kPageSize / kBlockSize
staticconstexpr

Definition at line 36 of file page.h.

◆ KBLog2

constexpr intptr_t dart::KBLog2 = 10
constexpr

Definition at line 527 of file globals.h.

◆ kBoolValueBitPosition

constexpr intptr_t dart::kBoolValueBitPosition
staticconstexpr
Initial value:
=
HostObjectAlignment::kBoolValueBitPosition

Definition at line 62 of file pointer_tagging.h.

◆ kBoolValueMask

constexpr intptr_t dart::kBoolValueMask = HostObjectAlignment::kBoolValueMask
staticconstexpr

Definition at line 64 of file pointer_tagging.h.

◆ kBoolVsNullBitPosition

constexpr intptr_t dart::kBoolVsNullBitPosition
staticconstexpr
Initial value:
=
HostObjectAlignment::kBoolVsNullBitPosition

Definition at line 65 of file pointer_tagging.h.

◆ kBoolVsNullMask

constexpr intptr_t dart::kBoolVsNullMask
staticconstexpr
Initial value:
=
HostObjectAlignment::kBoolVsNullMask

Definition at line 67 of file pointer_tagging.h.

◆ kBootstrapLibraryCount

constexpr intptr_t dart::kBootstrapLibraryCount
staticconstexpr
Initial value:
=
ARRAY_SIZE(bootstrap_libraries)

Definition at line 42 of file bootstrap.cc.

◆ kBreakInstructionFiller

const uint64_t dart::kBreakInstructionFiller = 0xE1200070
constexpr

Definition at line 1317 of file constants_arm.h.

◆ kByteMask

constexpr int8_t dart::kByteMask = (1 << kDataBitsPerByte) - 1
staticconstexpr

Definition at line 19 of file datastream.h.

◆ kBytesPerBigIntDigit

const intptr_t dart::kBytesPerBigIntDigit = 4

Definition at line 54 of file globals.h.

◆ kC

const auto dart::kC = NewMove(3, 30)

Definition at line 22 of file catch_entry_moves_test.cc.

◆ kCalculateCanonicalizeHash

const uint32_t dart::kCalculateCanonicalizeHash = 0

Definition at line 6444 of file object_test.cc.

◆ kCallbackSlotsBeforeSavedArguments

constexpr intptr_t dart::kCallbackSlotsBeforeSavedArguments = 2
constexpr

Definition at line 70 of file stack_frame_arm.h.

◆ kCallerSpSlotFromFp [1/5]

constexpr int dart::kCallerSpSlotFromFp = 2
staticconstexpr

Definition at line 49 of file stack_frame_arm.h.

◆ kCallerSpSlotFromFp [2/5]

constexpr int dart::kCallerSpSlotFromFp = 2
staticconstexpr

Definition at line 49 of file stack_frame_arm64.h.

◆ kCallerSpSlotFromFp [3/5]

constexpr int dart::kCallerSpSlotFromFp = 2
staticconstexpr

Definition at line 45 of file stack_frame_ia32.h.

◆ kCallerSpSlotFromFp [4/5]

constexpr int dart::kCallerSpSlotFromFp = 0
staticconstexpr

Definition at line 49 of file stack_frame_riscv.h.

◆ kCallerSpSlotFromFp [5/5]

constexpr int dart::kCallerSpSlotFromFp = 2
staticconstexpr

Definition at line 52 of file stack_frame_x64.h.

◆ kClassIdTagMax

constexpr intptr_t dart::kClassIdTagMax = (1 << 20) - 1
staticconstexpr

Definition at line 22 of file class_id.h.

◆ kCommonDoubleConstants

const double dart::kCommonDoubleConstants[]
Initial value:
= {
-1.0, -0.5, -0.1, 0.0, 0.1, 0.5, 1.0, 2.0, 4.0, 5.0, 10.0, 20.0, 30.0, 64.0,
255.0, NAN,
2.718281828459045, 2.302585092994046, 0.6931471805599453,
1.4426950408889634, 0.4342944819032518, 3.1415926535897932,
0.7071067811865476, 1.4142135623730951}

Definition at line 22 of file flow_graph_builder.cc.

22 {
23 -1.0, -0.5, -0.1, 0.0, 0.1, 0.5, 1.0, 2.0, 4.0, 5.0, 10.0, 20.0, 30.0, 64.0,
24 255.0, NAN,
25 // From dart:math
26 2.718281828459045, 2.302585092994046, 0.6931471805599453,
27 1.4426950408889634, 0.4342944819032518, 3.1415926535897932,
28 0.7071067811865476, 1.4142135623730951};

◆ kCompilerPassesUsage

const char* dart::kCompilerPassesUsage
static
Initial value:
=
"=== How to use --compiler-passes flag\n"
"\n"
"Pass the list of comma separated compiler pass filter flags.\n"
"\n"
"For the given pass Name the following flags are supported:\n"
"\n"
" -Name disable the pass\n"
" ]Name or Name print IL after the pass\n"
" [Name print IL before the pass\n"
" *Name print IL before and after the pass\n"
" * print IL after each pass.\n"
"\n"
" The flag can be followed by '+' which makes it sticky, e.g. Inlining+\n"
" would cause IL to be printed after all passes that follow inlining and\n"
" are not disabled.\n"
"\n"
"List of compiler passes:\n"

Definition at line 97 of file compiler_pass.cc.

◆ kCompressedWordSize

constexpr intptr_t dart::kCompressedWordSize = kWordSize
staticconstexpr

Definition at line 42 of file globals.h.

◆ kCompressedWordSizeLog2

constexpr intptr_t dart::kCompressedWordSizeLog2 = kWordSizeLog2
staticconstexpr

Definition at line 43 of file globals.h.

◆ kConservativeInitialMarkSpeed

constexpr intptr_t dart::kConservativeInitialMarkSpeed = 20
staticconstexpr

Definition at line 52 of file pages.cc.

◆ kConservativeInitialScavengeSpeed

constexpr intptr_t dart::kConservativeInitialScavengeSpeed = 40
staticconstexpr

Definition at line 771 of file scavenger.cc.

◆ kCustomIsolateScriptChars

const char* dart::kCustomIsolateScriptChars
static

Definition at line 27 of file custom_isolate_test.cc.

◆ kD

const auto dart::kD = NewMove(4, 40)

Definition at line 23 of file catch_entry_moves_test.cc.

◆ kDartAvailableCpuRegs

const RegList dart::kDartAvailableCpuRegs
constexpr
Initial value:
=
kAllCpuRegistersList & ~kReservedCpuRegisters
const RegList kAllCpuRegistersList

Definition at line 670 of file constants_arm.h.

◆ kDartFirstVolatileCpuReg

const Register dart::kDartFirstVolatileCpuReg = R0

Definition at line 542 of file constants_arm64.h.

◆ kDartFrameFixedSize [1/5]

constexpr int dart::kDartFrameFixedSize = 4
staticconstexpr

Definition at line 36 of file stack_frame_arm.h.

◆ kDartFrameFixedSize [2/5]

constexpr int dart::kDartFrameFixedSize = 4
staticconstexpr

Definition at line 35 of file stack_frame_arm64.h.

◆ kDartFrameFixedSize [3/5]

constexpr int dart::kDartFrameFixedSize = 3
staticconstexpr

Definition at line 33 of file stack_frame_ia32.h.

◆ kDartFrameFixedSize [4/5]

constexpr int dart::kDartFrameFixedSize = 4
staticconstexpr

Definition at line 35 of file stack_frame_riscv.h.

◆ kDartFrameFixedSize [5/5]

constexpr int dart::kDartFrameFixedSize = 4
staticconstexpr

Definition at line 38 of file stack_frame_x64.h.

◆ kDartLastVolatileCpuReg

const Register dart::kDartLastVolatileCpuReg = R14

Definition at line 543 of file constants_arm64.h.

◆ kDartVolatileCpuRegCount

const int dart::kDartVolatileCpuRegCount = 5

Definition at line 683 of file constants_arm.h.

◆ kDartVolatileCpuRegs

const RegList dart::kDartVolatileCpuRegs
constexpr
Initial value:
=
kDartAvailableCpuRegs & ~kAbiPreservedCpuRegs
constexpr RegList kDartAvailableCpuRegs

Definition at line 678 of file constants_arm.h.

◆ kDartVolatileFpuRegCount

const int dart::kDartVolatileFpuRegCount = 24

Definition at line 545 of file constants_arm64.h.

◆ kDataBitsPerByte

constexpr int8_t dart::kDataBitsPerByte = 7
staticconstexpr

Definition at line 18 of file datastream.h.

◆ kDataMemoryBarrier

constexpr uword dart::kDataMemoryBarrier = 0xf57ff050 | 0xb
constexpr

Definition at line 1318 of file constants_arm.h.

◆ kDefaultMaxOldGenHeapSize

const intptr_t dart::kDefaultMaxOldGenHeapSize = (kWordSize <= 4) ? 1536 : 30720

Definition at line 62 of file globals.h.

◆ kDefaultMaxSubtypeCacheEntries

constexpr intptr_t dart::kDefaultMaxSubtypeCacheEntries
staticconstexpr
Initial value:
=
SubtypeTestCache::MaxEntriesForCacheAllocatedFor(1000)

Definition at line 45 of file runtime_entry.cc.

◆ kDefaultNewGenSemiMaxSize

const intptr_t dart::kDefaultNewGenSemiMaxSize = (kWordSize <= 4) ? 8 : 16

Definition at line 63 of file globals.h.

◆ kDefaultStackAllocation

constexpr intptr_t dart::kDefaultStackAllocation = 8
staticconstexpr

Definition at line 19 of file stacktrace.cc.

◆ kDigitRangeCount

constexpr intptr_t dart::kDigitRangeCount = ARRAY_SIZE(kDigitRanges)
staticconstexpr

Definition at line 2780 of file regexp.cc.

◆ kDigitRanges

constexpr int32_t dart::kDigitRanges[] = {'0', '9' + 1, kRangeEndMarker}
staticconstexpr

Definition at line 2779 of file regexp.cc.

2779{'0', '9' + 1, kRangeEndMarker};
static constexpr int32_t kRangeEndMarker
Definition regexp.cc:2764

◆ kDontAssertNoSafepointScope

const bool dart::kDontAssertNoSafepointScope = false

Definition at line 18 of file lockers.h.

◆ kDoubleSize

constexpr intptr_t dart::kDoubleSize = sizeof(double)
constexpr

Definition at line 456 of file globals.h.

◆ kE

const auto dart::kE = NewMove(5, 50)

Definition at line 24 of file catch_entry_moves_test.cc.

◆ kElfPageSize

constexpr intptr_t dart::kElfPageSize = 16 * KB
staticconstexpr

Definition at line 31 of file elf.h.

◆ kEndByteMarker

constexpr uint8_t dart::kEndByteMarker = (255 - kMaxDataPerByte)
staticconstexpr

Definition at line 24 of file datastream.h.

◆ kEndUnsignedByteMarker

constexpr uint8_t dart::kEndUnsignedByteMarker
staticconstexpr
Initial value:
=
static constexpr int8_t kMaxUnsignedDataPerByte
Definition datastream.h:20

Definition at line 25 of file datastream.h.

◆ kernel_snapshot

const char* dart::kernel_snapshot = nullptr
static

Definition at line 47 of file run_vm_tests.cc.

◆ kExceptionObjectReg

const Register dart::kExceptionObjectReg = R0
constexpr

Definition at line 328 of file constants_arm.h.

◆ kExitLinkSlotFromEntryFp [1/4]

constexpr int dart::kExitLinkSlotFromEntryFp = -28
staticconstexpr

Definition at line 58 of file stack_frame_arm.h.

◆ kExitLinkSlotFromEntryFp [2/4]

constexpr int dart::kExitLinkSlotFromEntryFp = -23
staticconstexpr

Definition at line 57 of file stack_frame_arm64.h.

◆ kExitLinkSlotFromEntryFp [3/4]

constexpr int dart::kExitLinkSlotFromEntryFp = -8
staticconstexpr

Definition at line 52 of file stack_frame_ia32.h.

◆ kExitLinkSlotFromEntryFp [4/4]

constexpr int dart::kExitLinkSlotFromEntryFp = -11
staticconstexpr

Definition at line 59 of file stack_frame_x64.h.

◆ kExponentChar

constexpr char dart::kExponentChar = 'e'
staticconstexpr

Definition at line 15 of file double_conversion.cc.

◆ kExtLength

constexpr intptr_t dart::kExtLength = 16
staticconstexpr

Definition at line 2255 of file dart_api_impl_test.cc.

◆ kFalseIdentityHash

constexpr intptr_t dart::kFalseIdentityHash = 1237
staticconstexpr

Definition at line 10765 of file object.h.

◆ kFalseOffsetFromNull

constexpr intptr_t dart::kFalseOffsetFromNull
staticconstexpr
Initial value:
=
HostObjectAlignment::kFalseOffsetFromNull

Definition at line 71 of file pointer_tagging.h.

◆ kFastAllocationFailed

const char* dart::kFastAllocationFailed = "fast allocation failed"

Definition at line 105 of file object_graph_copy.cc.

◆ kFfiCallerTypedDataSlotFromFp [1/5]

constexpr int dart::kFfiCallerTypedDataSlotFromFp = kCallerSpSlotFromFp + 1
staticconstexpr

Definition at line 79 of file stack_frame_arm.h.

◆ kFfiCallerTypedDataSlotFromFp [2/5]

constexpr int dart::kFfiCallerTypedDataSlotFromFp = kCallerSpSlotFromFp
staticconstexpr

Definition at line 73 of file stack_frame_arm64.h.

◆ kFfiCallerTypedDataSlotFromFp [3/5]

constexpr int dart::kFfiCallerTypedDataSlotFromFp = kCallerSpSlotFromFp
staticconstexpr

Definition at line 63 of file stack_frame_ia32.h.

◆ kFfiCallerTypedDataSlotFromFp [4/5]

constexpr int dart::kFfiCallerTypedDataSlotFromFp = kCallerSpSlotFromFp
staticconstexpr

Definition at line 72 of file stack_frame_riscv.h.

◆ kFfiCallerTypedDataSlotFromFp [5/5]

constexpr int dart::kFfiCallerTypedDataSlotFromFp = kCallerSpSlotFromFp
staticconstexpr

Definition at line 74 of file stack_frame_x64.h.

◆ kFinalizablePersistentHandleSizeInWords

constexpr int dart::kFinalizablePersistentHandleSizeInWords
staticconstexpr
Initial value:
=
sizeof(FinalizablePersistentHandle) / kWordSize

Definition at line 513 of file dart_api_state.h.

◆ kFinalizablePersistentHandlesPerChunk

constexpr int dart::kFinalizablePersistentHandlesPerChunk = 64
staticconstexpr

Definition at line 515 of file dart_api_state.h.

◆ kFinalizerTwoEntriesNumObjects

const intptr_t dart::kFinalizerTwoEntriesNumObjects = 9

Definition at line 4267 of file object_test.cc.

◆ kFirstErrorCid

const ClassId dart::kFirstErrorCid = kErrorCid
static

Definition at line 310 of file class_id.h.

◆ kFirstInternalOnlyCid

constexpr intptr_t dart::kFirstInternalOnlyCid = kClassCid
constexpr

Definition at line 288 of file class_id.h.

◆ kFirstLocalSlotFromFp [1/5]

constexpr int dart::kFirstLocalSlotFromFp = -3
staticconstexpr

Definition at line 43 of file stack_frame_arm.h.

◆ kFirstLocalSlotFromFp [2/5]

constexpr int dart::kFirstLocalSlotFromFp = -3
staticconstexpr

Definition at line 42 of file stack_frame_arm64.h.

◆ kFirstLocalSlotFromFp [3/5]

constexpr int dart::kFirstLocalSlotFromFp = -2
staticconstexpr

Definition at line 40 of file stack_frame_ia32.h.

◆ kFirstLocalSlotFromFp [4/5]

constexpr int dart::kFirstLocalSlotFromFp = -5
staticconstexpr

Definition at line 42 of file stack_frame_riscv.h.

◆ kFirstLocalSlotFromFp [5/5]

constexpr int dart::kFirstLocalSlotFromFp = -3
staticconstexpr

Definition at line 45 of file stack_frame_x64.h.

◆ kFirstObjectSlotFromFp [1/5]

constexpr int dart::kFirstObjectSlotFromFp
staticconstexpr
Initial value:
=
-1

Definition at line 39 of file stack_frame_arm.h.

◆ kFirstObjectSlotFromFp [2/5]

constexpr int dart::kFirstObjectSlotFromFp
staticconstexpr
Initial value:
=
-1

Definition at line 38 of file stack_frame_arm64.h.

◆ kFirstObjectSlotFromFp [3/5]

constexpr int dart::kFirstObjectSlotFromFp
staticconstexpr
Initial value:
=
-1

Definition at line 36 of file stack_frame_ia32.h.

◆ kFirstObjectSlotFromFp [4/5]

constexpr int dart::kFirstObjectSlotFromFp
staticconstexpr
Initial value:
=
-3

Definition at line 38 of file stack_frame_riscv.h.

◆ kFirstObjectSlotFromFp [5/5]

constexpr int dart::kFirstObjectSlotFromFp
staticconstexpr
Initial value:
=
-1

Definition at line 41 of file stack_frame_x64.h.

◆ kFirstReference [1/2]

constexpr intptr_t dart::kFirstReference = 1
staticconstexpr

Definition at line 286 of file app_snapshot.cc.

◆ kFirstReference [2/2]

constexpr intptr_t dart::kFirstReference = 1
staticconstexpr

Definition at line 2688 of file message_snapshot.cc.

◆ kFirstTypedDataCid

const ClassId dart::kFirstTypedDataCid = kTypedDataInt8ArrayCid
static

Definition at line 377 of file class_id.h.

◆ kFloatSize

constexpr intptr_t dart::kFloatSize = sizeof(float)
constexpr

Definition at line 457 of file globals.h.

◆ kFpuRegisterSize

const int dart::kFpuRegisterSize = 16

Definition at line 298 of file constants_arm.h.

◆ kFpuRegistersWithoutSOverlap

const RegList dart::kFpuRegistersWithoutSOverlap
Initial value:
=
~((1 << QRegister::kNumberOfOverlappingQRegisters) - 1)
const RegList kAllFpuRegistersList

Definition at line 688 of file constants_arm.h.

◆ kGetterPrefix

const char* const dart::kGetterPrefix = "get:"
static

Definition at line 115 of file object.cc.

◆ kGetterPrefixLength

const intptr_t dart::kGetterPrefixLength = strlen(kGetterPrefix)
static

Definition at line 116 of file object.cc.

◆ kHeapBaseMask

constexpr uintptr_t dart::kHeapBaseMask = 0
staticconstexpr

Definition at line 97 of file pointer_tagging.h.

◆ kill_params

const MethodParameter* const dart::kill_params[]
static
Initial value:

Definition at line 4395 of file service.cc.

4395 {
4397 nullptr,
4398};

◆ kIllegalPosition

constexpr intptr_t dart::kIllegalPosition = -1
staticconstexpr

Definition at line 35 of file linearscan.cc.

◆ kInfinitySymbol

constexpr const char* dart::kInfinitySymbol = "Infinity"
staticconstexpr

Definition at line 16 of file double_conversion.cc.

◆ kInitialSize

intptr_t dart::kInitialSize = 8
static

Definition at line 13 of file hashmap_test.cc.

◆ kInitPrefix

const char* const dart::kInitPrefix = "init:"
static

Definition at line 119 of file object.cc.

◆ kInitPrefixLength

const intptr_t dart::kInitPrefixLength = strlen(kInitPrefix)
static

Definition at line 120 of file object.cc.

◆ kInt16Size

constexpr intptr_t dart::kInt16Size = 1 << kInt16SizeLog2
constexpr

Definition at line 447 of file globals.h.

◆ kInt16SizeLog2

constexpr intptr_t dart::kInt16SizeLog2 = 1
constexpr

Definition at line 446 of file globals.h.

◆ kInt32Size

constexpr intptr_t dart::kInt32Size = 1 << kInt32SizeLog2
constexpr

Definition at line 450 of file globals.h.

◆ kInt32SizeLog2

constexpr intptr_t dart::kInt32SizeLog2 = 2
constexpr

Definition at line 449 of file globals.h.

◆ kInt64Size

constexpr intptr_t dart::kInt64Size = 1 << kInt64SizeLog2
constexpr

Definition at line 453 of file globals.h.

◆ kInt64SizeLog2

constexpr intptr_t dart::kInt64SizeLog2 = 3
constexpr

Definition at line 452 of file globals.h.

◆ kInt8Size

constexpr intptr_t dart::kInt8Size = 1 << kInt8SizeLog2
constexpr

Definition at line 444 of file globals.h.

◆ kInt8SizeLog2

constexpr intptr_t dart::kInt8SizeLog2 = 0
constexpr

Definition at line 443 of file globals.h.

◆ kInterruptStackLimit

constexpr uword dart::kInterruptStackLimit = ~static_cast<uword>(0)
staticconstexpr

Definition at line 427 of file stack_frame.h.

◆ kIntptrMax

constexpr intptr_t dart::kIntptrMax = ~kIntptrMin
constexpr

Definition at line 557 of file globals.h.

◆ kIntptrMin

constexpr intptr_t dart::kIntptrMin = (kIntptrOne << (kBitsPerWord - 1))
constexpr

Definition at line 556 of file globals.h.

◆ kIntptrOne

constexpr intptr_t dart::kIntptrOne = 1
constexpr

Definition at line 555 of file globals.h.

◆ kInvalidTryIndex

constexpr intptr_t dart::kInvalidTryIndex = -1
staticconstexpr

Definition at line 17 of file code_descriptors.h.

◆ kIsolateReloadTestLibSource

const char* dart::kIsolateReloadTestLibSource
static
Initial value:
= R"(
@pragma("vm:external-name", "Test_Reload")
external void reloadTest();
@pragma("vm:external-name", "Test_CollectNewSpace")
external void collectNewSpace();
@pragma("vm:external-name", "Test_CollectOldSpace")
external void collectOldSpace();
)"

Definition at line 222 of file unit_test.cc.

◆ kLastErrorCid

const ClassId dart::kLastErrorCid = kUnwindErrorCid
static

Definition at line 311 of file class_id.h.

◆ kLastFixedObjectSlotFromFp [1/5]

constexpr int dart::kLastFixedObjectSlotFromFp = -2
staticconstexpr

Definition at line 41 of file stack_frame_arm.h.

◆ kLastFixedObjectSlotFromFp [2/5]

constexpr int dart::kLastFixedObjectSlotFromFp = -2
staticconstexpr

Definition at line 40 of file stack_frame_arm64.h.

◆ kLastFixedObjectSlotFromFp [3/5]

constexpr int dart::kLastFixedObjectSlotFromFp = -1
staticconstexpr

Definition at line 38 of file stack_frame_ia32.h.

◆ kLastFixedObjectSlotFromFp [4/5]

constexpr int dart::kLastFixedObjectSlotFromFp = -4
staticconstexpr

Definition at line 40 of file stack_frame_riscv.h.

◆ kLastFixedObjectSlotFromFp [5/5]

constexpr int dart::kLastFixedObjectSlotFromFp = -2
staticconstexpr

Definition at line 43 of file stack_frame_x64.h.

◆ kLastInternalOnlyCid

constexpr intptr_t dart::kLastInternalOnlyCid = kUnwindErrorCid
constexpr

Definition at line 289 of file class_id.h.

◆ kLastParamSlotFromEntrySp [1/5]

constexpr int dart::kLastParamSlotFromEntrySp = 0
staticconstexpr

Definition at line 50 of file stack_frame_arm.h.

◆ kLastParamSlotFromEntrySp [2/5]

constexpr int dart::kLastParamSlotFromEntrySp = 0
staticconstexpr

Definition at line 50 of file stack_frame_arm64.h.

◆ kLastParamSlotFromEntrySp [3/5]

constexpr int dart::kLastParamSlotFromEntrySp = 1
staticconstexpr

Definition at line 46 of file stack_frame_ia32.h.

◆ kLastParamSlotFromEntrySp [4/5]

constexpr int dart::kLastParamSlotFromEntrySp = 0
staticconstexpr

Definition at line 50 of file stack_frame_riscv.h.

◆ kLastParamSlotFromEntrySp [5/5]

constexpr int dart::kLastParamSlotFromEntrySp = 1
staticconstexpr

Definition at line 53 of file stack_frame_x64.h.

◆ kLastTypedDataCid

const ClassId dart::kLastTypedDataCid
static
Initial value:
=
kUnmodifiableTypedDataFloat64x2ArrayViewCid

Definition at line 378 of file class_id.h.

◆ kLength

int dart::kLength = 16
static

Definition at line 2199 of file dart_api_impl_test.cc.

◆ kLengthMask

constexpr intptr_t dart::kLengthMask = (1 << kLengthSize) - 1
staticconstexpr

Definition at line 119 of file string.cc.

◆ kLengthSize

constexpr intptr_t dart::kLengthSize = 11
staticconstexpr

Definition at line 118 of file string.cc.

◆ kLineTerminatorRangeCount

constexpr intptr_t dart::kLineTerminatorRangeCount
staticconstexpr
Initial value:
=
ARRAY_SIZE(kLineTerminatorRanges)

Definition at line 2785 of file regexp.cc.

◆ kLineTerminatorRanges

constexpr int32_t dart::kLineTerminatorRanges[]
staticconstexpr
Initial value:
= {
0x000A, 0x000B, 0x000D, 0x000E, 0x2028, 0x202A, kRangeEndMarker}

Definition at line 2783 of file regexp.cc.

2783 {
2784 0x000A, 0x000B, 0x000D, 0x000E, 0x2028, 0x202A, kRangeEndMarker};

◆ kList

constexpr const char* dart::kList = "List all Tests and Benchmarks"
staticconstexpr

Definition at line 44 of file run_vm_tests.cc.

◆ kLocalHandleSizeInWords

constexpr int dart::kLocalHandleSizeInWords = sizeof(LocalHandle) / kWordSize
staticconstexpr

Definition at line 364 of file dart_api_state.h.

◆ kLocalHandlesPerChunk

constexpr int dart::kLocalHandlesPerChunk = 64
staticconstexpr

Definition at line 365 of file dart_api_state.h.

◆ kMarkingStackBlockSize

constexpr int dart::kMarkingStackBlockSize = 64
staticconstexpr

Definition at line 284 of file pointer_block.h.

◆ kMaxAddrSpaceInWords

const intptr_t dart::kMaxAddrSpaceInWords
Initial value:
<< MBLog2
constexpr intptr_t kWordSizeLog2
Definition globals.h:507
const intptr_t kMaxAddrSpaceMB
Definition globals.h:49

Definition at line 50 of file globals.h.

◆ kMaxAddrSpaceMB

const intptr_t dart::kMaxAddrSpaceMB = (kWordSize <= 4) ? 4096 : 268435456

Definition at line 49 of file globals.h.

◆ kMaxAllowedSeconds

int64_t dart::kMaxAllowedSeconds = kMaxInt32
static

Definition at line 15 of file date.cc.

◆ kMaxDataPerByte

constexpr int8_t dart::kMaxDataPerByte
staticconstexpr
Initial value:
=
(~kMinDataPerByte & kByteMask)
static constexpr int8_t kByteMask
Definition datastream.h:19

Definition at line 22 of file datastream.h.

◆ kMaxElementSizeForEfficientCopy

const intptr_t dart::kMaxElementSizeForEfficientCopy
static
Initial value:
=
compiler::target::kWordSize

Definition at line 6957 of file il.cc.

◆ kMaxInt

constexpr int dart::kMaxInt = INT_MAX
constexpr

Definition at line 490 of file globals.h.

◆ kMaxInt16

constexpr int16_t dart::kMaxInt16 = 0x7FFF
constexpr

Definition at line 480 of file globals.h.

◆ kMaxInt32

constexpr int32_t dart::kMaxInt32 = 0x7FFFFFFF
constexpr

Definition at line 483 of file globals.h.

◆ kMaxInt64

constexpr int64_t dart::kMaxInt64 = DART_INT64_C(0x7FFFFFFFFFFFFFFF)
constexpr

Definition at line 486 of file globals.h.

◆ kMaxInt64RepresentableAsDouble

constexpr int64_t dart::kMaxInt64RepresentableAsDouble
constexpr
Initial value:
=
DART_INT64_C(0x7FFFFFFFFFFFFC00)

Definition at line 494 of file globals.h.

◆ kMaxInt8

constexpr int8_t dart::kMaxInt8 = 0x7F
constexpr

Definition at line 477 of file globals.h.

◆ kMaxLocationCount

constexpr intptr_t dart::kMaxLocationCount = 2
staticconstexpr

Definition at line 73 of file locations.h.

◆ kMaxLookaheadForBoyerMoore

constexpr intptr_t dart::kMaxLookaheadForBoyerMoore = 8
staticconstexpr

Definition at line 34 of file regexp.cc.

◆ kMaxPosition

constexpr intptr_t dart::kMaxPosition = 0x7FFFFFFF
staticconstexpr

Definition at line 36 of file linearscan.cc.

◆ kMaxSamplesPerTick

constexpr intptr_t dart::kMaxSamplesPerTick = 4
staticconstexpr

Definition at line 35 of file profiler.cc.

◆ kMaxUint

constexpr int dart::kMaxUint = UINT_MAX
constexpr

Definition at line 491 of file globals.h.

◆ kMaxUint16

constexpr uint16_t dart::kMaxUint16 = 0xFFFF
constexpr

Definition at line 481 of file globals.h.

◆ kMaxUint32

constexpr uint32_t dart::kMaxUint32 = 0xFFFFFFFF
constexpr

Definition at line 484 of file globals.h.

◆ kMaxUint64

constexpr uint64_t dart::kMaxUint64 = DART_2PART_UINT64_C(0xFFFFFFFF, FFFFFFFF)
constexpr

Definition at line 487 of file globals.h.

◆ kMaxUint8

constexpr uint8_t dart::kMaxUint8 = 0xFF
constexpr

Definition at line 478 of file globals.h.

◆ kMaxUnsignedDataPerByte

constexpr int8_t dart::kMaxUnsignedDataPerByte = kByteMask
staticconstexpr

Definition at line 20 of file datastream.h.

◆ kMemoryTestLength

constexpr intptr_t dart::kMemoryTestLength = 1024
staticconstexpr

Definition at line 23 of file memory_copy_test.cc.

◆ kMicrosecondsPerMillisecond

constexpr intptr_t dart::kMicrosecondsPerMillisecond = 1000
constexpr

Definition at line 561 of file globals.h.

◆ kMicrosecondsPerSecond

constexpr intptr_t dart::kMicrosecondsPerSecond
constexpr
Initial value:
=
constexpr intptr_t kMillisecondsPerSecond
Definition globals.h:560

Definition at line 562 of file globals.h.

◆ kMillisecondsPerSecond

constexpr intptr_t dart::kMillisecondsPerSecond = 1000
constexpr

Definition at line 560 of file globals.h.

◆ kMinDataPerByte

constexpr int8_t dart::kMinDataPerByte = -(1 << (kDataBitsPerByte - 1))
staticconstexpr

Definition at line 21 of file datastream.h.

◆ kMinInt

constexpr int dart::kMinInt = INT_MIN
constexpr

Definition at line 489 of file globals.h.

◆ kMinInt16

constexpr int16_t dart::kMinInt16 = 0x8000
constexpr

Definition at line 479 of file globals.h.

◆ kMinInt32

constexpr int32_t dart::kMinInt32 = 0x80000000
constexpr

Definition at line 482 of file globals.h.

◆ kMinInt64

constexpr int64_t dart::kMinInt64 = DART_INT64_C(0x8000000000000000)
constexpr

Definition at line 485 of file globals.h.

◆ kMinInt64RepresentableAsDouble

constexpr int64_t dart::kMinInt64RepresentableAsDouble = kMinInt64
constexpr

Definition at line 493 of file globals.h.

◆ kMinInt8

constexpr int8_t dart::kMinInt8 = 0x80
constexpr

Definition at line 476 of file globals.h.

◆ kNanosecondsPerMicrosecond

constexpr intptr_t dart::kNanosecondsPerMicrosecond = 1000
constexpr

Definition at line 564 of file globals.h.

◆ kNanosecondsPerMillisecond

constexpr intptr_t dart::kNanosecondsPerMillisecond
constexpr
Initial value:

Definition at line 565 of file globals.h.

◆ kNanosecondsPerSecond

constexpr intptr_t dart::kNanosecondsPerSecond
constexpr
Initial value:

Definition at line 567 of file globals.h.

◆ kNaNSymbol

constexpr const char* dart::kNaNSymbol = "NaN"
staticconstexpr

Definition at line 17 of file double_conversion.cc.

◆ kNativeArgumentNativeField1Value

intptr_t dart::kNativeArgumentNativeField1Value = 30
static

Definition at line 7067 of file dart_api_impl_test.cc.

◆ kNativeArgumentNativeField2Value

intptr_t dart::kNativeArgumentNativeField2Value = 40
static

Definition at line 7068 of file dart_api_impl_test.cc.

◆ kNativeField1Value

constexpr intptr_t dart::kNativeField1Value = 30
staticconstexpr

Definition at line 5571 of file dart_api_impl_test.cc.

◆ kNativeField2Value

constexpr intptr_t dart::kNativeField2Value = 40
staticconstexpr

Definition at line 5572 of file dart_api_impl_test.cc.

◆ kNewAllocatableSize

constexpr intptr_t dart::kNewAllocatableSize = 256 * KB
staticconstexpr

Definition at line 54 of file spaces.h.

◆ kNewObjectAlignmentOffset

constexpr intptr_t dart::kNewObjectAlignmentOffset
staticconstexpr
Initial value:
=
HostObjectAlignment::kNewObjectAlignmentOffset

Definition at line 50 of file pointer_tagging.h.

◆ kNewObjectBitPosition

constexpr intptr_t dart::kNewObjectBitPosition
staticconstexpr
Initial value:
=
HostObjectAlignment::kNewObjectBitPosition

Definition at line 54 of file pointer_tagging.h.

◆ kNoFpuRegister

const FpuRegister dart::kNoFpuRegister = kNoQRegister

Definition at line 301 of file constants_arm.h.

◆ kNone

constexpr const char* dart::kNone = "No Test or Benchmarks"
staticconstexpr

Definition at line 43 of file run_vm_tests.cc.

◆ kNoSafepointScope

const bool dart::kNoSafepointScope = true

Definition at line 17 of file lockers.h.

◆ kNoVirtualRegister

constexpr intptr_t dart::kNoVirtualRegister = -1
staticconstexpr

Definition at line 33 of file linearscan.cc.

◆ kNullIdentityHash

constexpr intptr_t dart::kNullIdentityHash = 2011
staticconstexpr

Definition at line 10763 of file object.h.

◆ kNumberOfDartAvailableCpuRegs

constexpr int dart::kNumberOfDartAvailableCpuRegs
constexpr
Initial value:

Definition at line 672 of file constants_arm.h.

◆ kNumberOfFpuRegisters

const int dart::kNumberOfFpuRegisters = kNumberOfQRegisters

Definition at line 300 of file constants_arm.h.

◆ kNumberOfReservedCpuRegisters

constexpr intptr_t dart::kNumberOfReservedCpuRegisters
constexpr
Initial value:
=
Utils::CountOneBits32(kReservedCpuRegisters)

Definition at line 667 of file constants_arm.h.

◆ kNumberOfReservedFpuRegisters

constexpr intptr_t dart::kNumberOfReservedFpuRegisters = 0
constexpr

Definition at line 530 of file constants_riscv.h.

◆ kNumberOfSavedCpuRegisters

constexpr intptr_t dart::kNumberOfSavedCpuRegisters = kNumberOfCpuRegisters
staticconstexpr

Definition at line 3512 of file runtime_entry.cc.

◆ kNumberOfSavedFpuRegisters

constexpr intptr_t dart::kNumberOfSavedFpuRegisters = kNumberOfFpuRegisters
staticconstexpr

Definition at line 3513 of file runtime_entry.cc.

◆ kNumTypedDataCidRemainders

const int dart::kNumTypedDataCidRemainders = kTypedDataCidRemainderUnmodifiable + 1

Definition at line 265 of file class_id.h.

◆ kObjectAlignment

constexpr intptr_t dart::kObjectAlignment
staticconstexpr
Initial value:
=
HostObjectAlignment::kObjectAlignment

Definition at line 56 of file pointer_tagging.h.

◆ kObjectAlignmentLog2

constexpr intptr_t dart::kObjectAlignmentLog2
staticconstexpr
Initial value:
=
HostObjectAlignment::kObjectAlignmentLog2

Definition at line 58 of file pointer_tagging.h.

◆ kObjectAlignmentMask

constexpr intptr_t dart::kObjectAlignmentMask
staticconstexpr
Initial value:
=
HostObjectAlignment::kObjectAlignmentMask

Definition at line 60 of file pointer_tagging.h.

◆ kObjectStartAlignment

constexpr intptr_t dart::kObjectStartAlignment = 64
staticconstexpr

Definition at line 74 of file pointer_tagging.h.

◆ kObjectStoreFieldNames

const char* const dart::kObjectStoreFieldNames[]
static
Initial value:
= {
#define DECLARE_OBJECT_STORE_FIELD(Type, Name)
}
#define DECLARE_OBJECT_STORE_FIELD(Type, Name)
#define OBJECT_STORE_FIELD_LIST(R_, RW, ARW_RELAXED, ARW_AR, LAZY_CORE, LAZY_ASYNC, LAZY_ISOLATE, LAZY_INTERNAL, LAZY_FFI)

Definition at line 7023 of file app_snapshot.cc.

7023 {
7024#define DECLARE_OBJECT_STORE_FIELD(Type, Name) #Name,
7034#undef DECLARE_OBJECT_STORE_FIELD
7035};

◆ kOffsetOfPtr

const intptr_t dart::kOffsetOfPtr = 32

Definition at line 136 of file globals.h.

◆ kOffsetOfRawPtr

constexpr int dart::kOffsetOfRawPtr = kWordSize
staticconstexpr

Definition at line 241 of file handles.h.

◆ kOffsetOfRawPtrInFinalizablePersistentHandle

constexpr int dart::kOffsetOfRawPtrInFinalizablePersistentHandle = 0
staticconstexpr

Definition at line 516 of file dart_api_state.h.

◆ kOffsetOfRawPtrInLocalHandle

constexpr int dart::kOffsetOfRawPtrInLocalHandle = 0
staticconstexpr

Definition at line 366 of file dart_api_state.h.

◆ kOffsetOfRawPtrInPersistentHandle

constexpr int dart::kOffsetOfRawPtrInPersistentHandle = 0
staticconstexpr

Definition at line 426 of file dart_api_state.h.

◆ kOldObjectAlignmentOffset

constexpr intptr_t dart::kOldObjectAlignmentOffset
staticconstexpr
Initial value:
=
HostObjectAlignment::kOldObjectAlignmentOffset

Definition at line 52 of file pointer_tagging.h.

◆ kOptExtLength

constexpr intptr_t dart::kOptExtLength = 16
staticconstexpr

Definition at line 2394 of file dart_api_impl_test.cc.

◆ kPageCacheCapacity

constexpr intptr_t dart::kPageCacheCapacity = 8 * kWordSize
staticconstexpr

Definition at line 26 of file page.cc.

◆ kPageMask

constexpr intptr_t dart::kPageMask = ~(kPageSize - 1)
staticconstexpr

Definition at line 29 of file page.h.

◆ kPageSize

constexpr intptr_t dart::kPageSize = 512 * KB
staticconstexpr

Definition at line 27 of file page.h.

◆ kPageSizeInWords

constexpr intptr_t dart::kPageSizeInWords = kPageSize / kWordSize
staticconstexpr

Definition at line 28 of file page.h.

◆ kParamEndSlotFromFp [1/5]

constexpr int dart::kParamEndSlotFromFp = 1
staticconstexpr

Definition at line 48 of file stack_frame_arm.h.

◆ kParamEndSlotFromFp [2/5]

constexpr int dart::kParamEndSlotFromFp = 1
staticconstexpr

Definition at line 48 of file stack_frame_arm64.h.

◆ kParamEndSlotFromFp [3/5]

constexpr int dart::kParamEndSlotFromFp = 1
staticconstexpr

Definition at line 44 of file stack_frame_ia32.h.

◆ kParamEndSlotFromFp [4/5]

constexpr int dart::kParamEndSlotFromFp = -1
staticconstexpr

Definition at line 48 of file stack_frame_riscv.h.

◆ kParamEndSlotFromFp [5/5]

constexpr int dart::kParamEndSlotFromFp = 1
staticconstexpr

Definition at line 51 of file stack_frame_x64.h.

◆ kPcMarkerSlotFromFp [1/5]

constexpr int dart::kPcMarkerSlotFromFp = -1
staticconstexpr

Definition at line 45 of file stack_frame_arm.h.

◆ kPcMarkerSlotFromFp [2/5]

constexpr int dart::kPcMarkerSlotFromFp = -1
staticconstexpr

Definition at line 44 of file stack_frame_arm64.h.

◆ kPcMarkerSlotFromFp [3/5]

constexpr int dart::kPcMarkerSlotFromFp = -1
staticconstexpr

Definition at line 41 of file stack_frame_ia32.h.

◆ kPcMarkerSlotFromFp [4/5]

constexpr int dart::kPcMarkerSlotFromFp = -3
staticconstexpr

Definition at line 44 of file stack_frame_riscv.h.

◆ kPcMarkerSlotFromFp [5/5]

constexpr int dart::kPcMarkerSlotFromFp = -1
staticconstexpr

Definition at line 47 of file stack_frame_x64.h.

◆ kPersistentHandleSizeInWords

constexpr int dart::kPersistentHandleSizeInWords
staticconstexpr
Initial value:
=
sizeof(PersistentHandle) / kWordSize

Definition at line 423 of file dart_api_state.h.

◆ kPersistentHandlesPerChunk

constexpr int dart::kPersistentHandlesPerChunk = 64
staticconstexpr

Definition at line 425 of file dart_api_state.h.

◆ kPreferredLoopAlignment

const intptr_t dart::kPreferredLoopAlignment = 1

Definition at line 1341 of file constants_arm.h.

◆ kPromotionStackBlockSize

constexpr int dart::kPromotionStackBlockSize = 64
staticconstexpr

Definition at line 296 of file pointer_block.h.

◆ kQuadSize

constexpr intptr_t dart::kQuadSize = 4 * kFloatSize
constexpr

Definition at line 458 of file globals.h.

◆ kRangeEndMarker

constexpr int32_t dart::kRangeEndMarker = Utf::kMaxCodePoint + 1
staticconstexpr

Definition at line 2764 of file regexp.cc.

◆ kReadOnlyGCBits

constexpr uword dart::kReadOnlyGCBits
staticconstexpr
Initial value:
=
UntaggedObject::AlwaysSetBit::encode(true) |
UntaggedObject::NotMarkedBit::encode(false) |
UntaggedObject::OldAndNotRememberedBit::encode(true) |
UntaggedObject::NewBit::encode(false)

Definition at line 600 of file image_snapshot.cc.

◆ kRecordSubtypeRangeCheckScript

const char* dart::kRecordSubtypeRangeCheckScript
Initial value:
=
R"(
class A {}
class B extends A {}
class C implements A {}
class D<T> {}
getType<T>() => T;
getRecordType1() => getType<(int, A)>();
getRecordType2() => getType<(A, int, String)>();
getRecordType3() => getType<(int, D)>();
createObj1() => (1, B());
createObj2() => (1, 'bye');
createObj3() => (1, foo: B());
createObj4() => (1, B(), 2);
createObj5() => (C(), 2, 'hi');
createObj6() => (D(), 2, 'hi');
createObj7() => (3, D<int>());
createObj8() => (D<int>(), 3);
)"

Definition at line 1229 of file type_testing_stubs_test.cc.

◆ kRegexpOptimization

constexpr bool dart::kRegexpOptimization = true
staticconstexpr

Definition at line 31 of file regexp.cc.

◆ kRegisterAllocationBias

constexpr int dart::kRegisterAllocationBias = 0
constexpr

Definition at line 675 of file constants_arm.h.

◆ kReleaseShift

const intptr_t dart::kReleaseShift = 25

Definition at line 947 of file constants_riscv.h.

◆ kReservedCpuRegisters

const RegList dart::kReservedCpuRegisters
constexpr
Initial value:
= (1 << SPREG) | (1 << FPREG) | (1 << TMP) |
(1 << PP) | (1 << THR) | (1 << LR) |
(1 << PC) | (1 << NOTFP)
const Register THR
const Register TMP
const Register SPREG

Definition at line 664 of file constants_arm.h.

◆ kReservedFpuRegisters

constexpr intptr_t dart::kReservedFpuRegisters = 0
constexpr

Definition at line 529 of file constants_riscv.h.

◆ kRssSlack

constexpr int64_t dart::kRssSlack = 20 * MB
staticconstexpr

Definition at line 197 of file zone_test.cc.

◆ kSafepointKind

const uint8_t dart::kSafepointKind
Initial value:
= UntaggedPcDescriptors::kIcCall |
UntaggedPcDescriptors::kUnoptStaticCall |
UntaggedPcDescriptors::kRuntimeCall

Definition at line 1313 of file debugger.cc.

◆ kSavedCallerFpSlotFromFp [1/5]

constexpr int dart::kSavedCallerFpSlotFromFp = 0
staticconstexpr

Definition at line 46 of file stack_frame_arm.h.

◆ kSavedCallerFpSlotFromFp [2/5]

constexpr int dart::kSavedCallerFpSlotFromFp = 0
staticconstexpr

Definition at line 45 of file stack_frame_arm64.h.

◆ kSavedCallerFpSlotFromFp [3/5]

constexpr int dart::kSavedCallerFpSlotFromFp = 0
staticconstexpr

Definition at line 42 of file stack_frame_ia32.h.

◆ kSavedCallerFpSlotFromFp [4/5]

constexpr int dart::kSavedCallerFpSlotFromFp = -2
staticconstexpr

Definition at line 45 of file stack_frame_riscv.h.

◆ kSavedCallerFpSlotFromFp [5/5]

constexpr int dart::kSavedCallerFpSlotFromFp = 0
staticconstexpr

Definition at line 48 of file stack_frame_x64.h.

◆ kSavedCallerPcSlotFromFp [1/5]

constexpr int dart::kSavedCallerPcSlotFromFp = 1
staticconstexpr

Definition at line 47 of file stack_frame_arm.h.

◆ kSavedCallerPcSlotFromFp [2/5]

constexpr int dart::kSavedCallerPcSlotFromFp = 1
staticconstexpr

Definition at line 46 of file stack_frame_arm64.h.

◆ kSavedCallerPcSlotFromFp [3/5]

constexpr int dart::kSavedCallerPcSlotFromFp = 1
staticconstexpr

Definition at line 43 of file stack_frame_ia32.h.

◆ kSavedCallerPcSlotFromFp [4/5]

constexpr int dart::kSavedCallerPcSlotFromFp = -1
staticconstexpr

Definition at line 46 of file stack_frame_riscv.h.

◆ kSavedCallerPcSlotFromFp [5/5]

constexpr int dart::kSavedCallerPcSlotFromFp = 1
staticconstexpr

Definition at line 49 of file stack_frame_x64.h.

◆ kSavedCallerPpSlotFromFp [1/5]

constexpr int dart::kSavedCallerPpSlotFromFp = -2
staticconstexpr

Definition at line 44 of file stack_frame_arm.h.

◆ kSavedCallerPpSlotFromFp [2/5]

constexpr int dart::kSavedCallerPpSlotFromFp = -2
staticconstexpr

Definition at line 43 of file stack_frame_arm64.h.

◆ kSavedCallerPpSlotFromFp [3/5]

constexpr int dart::kSavedCallerPpSlotFromFp = kSavedCallerFpSlotFromFp
staticconstexpr

Definition at line 49 of file stack_frame_ia32.h.

◆ kSavedCallerPpSlotFromFp [4/5]

constexpr int dart::kSavedCallerPpSlotFromFp = -4
staticconstexpr

Definition at line 43 of file stack_frame_riscv.h.

◆ kSavedCallerPpSlotFromFp [5/5]

constexpr int dart::kSavedCallerPpSlotFromFp = -2
staticconstexpr

Definition at line 46 of file stack_frame_x64.h.

◆ kSavedPcSlotFromSp [1/5]

constexpr int dart::kSavedPcSlotFromSp = -1
staticconstexpr

Definition at line 37 of file stack_frame_arm.h.

◆ kSavedPcSlotFromSp [2/5]

constexpr int dart::kSavedPcSlotFromSp = -1
staticconstexpr

Definition at line 36 of file stack_frame_arm64.h.

◆ kSavedPcSlotFromSp [3/5]

constexpr int dart::kSavedPcSlotFromSp = -1
staticconstexpr

Definition at line 34 of file stack_frame_ia32.h.

◆ kSavedPcSlotFromSp [4/5]

constexpr int dart::kSavedPcSlotFromSp = -1
staticconstexpr

Definition at line 36 of file stack_frame_riscv.h.

◆ kSavedPcSlotFromSp [5/5]

constexpr int dart::kSavedPcSlotFromSp = -1
staticconstexpr

Definition at line 39 of file stack_frame_x64.h.

◆ kSegmentCacheCapacity

constexpr intptr_t dart::kSegmentCacheCapacity = 16
staticconstexpr

Definition at line 53 of file zone.cc.

◆ kSendLength

constexpr intptr_t dart::kSendLength = 16
staticconstexpr

Definition at line 8225 of file dart_api_impl_test.cc.

◆ kSetterPrefix

const char* const dart::kSetterPrefix = "set:"
static

Definition at line 117 of file object.cc.

◆ kSetterPrefixLength

const intptr_t dart::kSetterPrefixLength = strlen(kSetterPrefix)
static

Definition at line 118 of file object.cc.

◆ kShouldWriteProtectCodeByDefault

constexpr bool dart::kShouldWriteProtectCodeByDefault = false
staticconstexpr

Definition at line 20 of file code_patcher.cc.

◆ kSignBitDouble

constexpr int64_t dart::kSignBitDouble = DART_INT64_C(0x8000000000000000)
constexpr

Definition at line 496 of file globals.h.

◆ kSignedEnd

constexpr intptr_t dart::kSignedEnd = kMaxInt16
staticconstexpr

Definition at line 17 of file datastream_test.cc.

◆ kSignedStart

constexpr intptr_t dart::kSignedStart = kMinInt16
staticconstexpr

Definition at line 16 of file datastream_test.cc.

◆ kSimd128Size

constexpr intptr_t dart::kSimd128Size = sizeof(simd128_value_t)
constexpr

Definition at line 459 of file globals.h.

◆ kSizes

const size_t dart::kSizes[]
static
Initial value:
= {
64 * KB,
64 * KB + 2 * kWordSize,
64 * KB - 2 * kWordSize,
128 * KB,
128 * KB + 2 * kWordSize,
128 * KB - 2 * kWordSize,
256 * KB,
256 * KB + 2 * kWordSize,
256 * KB - 2 * kWordSize,
512 * KB,
512 * KB + 2 * kWordSize,
512 * KB - 2 * kWordSize,
}

Definition at line 202 of file zone_test.cc.

202 {
203 64 * KB,
204 64 * KB + 2 * kWordSize,
205 64 * KB - 2 * kWordSize,
206 128 * KB,
207 128 * KB + 2 * kWordSize,
208 128 * KB - 2 * kWordSize,
209 256 * KB,
210 256 * KB + 2 * kWordSize,
211 256 * KB - 2 * kWordSize,
212 512 * KB,
213 512 * KB + 2 * kWordSize,
214 512 * KB - 2 * kWordSize,
215};

◆ kSmiBits

const intptr_t dart::kSmiBits = kBitsPerWord - 2

Definition at line 24 of file globals.h.

◆ kSmiBits32

const intptr_t dart::kSmiBits32 = kBitsPerInt32 - 2

Definition at line 32 of file globals.h.

◆ kSmiMax

const intptr_t dart::kSmiMax = (static_cast<intptr_t>(1) << kSmiBits) - 1

Definition at line 28 of file globals.h.

◆ kSmiMax32

const intptr_t dart::kSmiMax32 = (static_cast<intptr_t>(1) << kSmiBits32) - 1

Definition at line 33 of file globals.h.

◆ kSmiMin

const intptr_t dart::kSmiMin = -(static_cast<intptr_t>(1) << kSmiBits)

Definition at line 29 of file globals.h.

◆ kSmiMin32

const intptr_t dart::kSmiMin32 = -(static_cast<intptr_t>(1) << kSmiBits32)

Definition at line 34 of file globals.h.

◆ kSpaceRangeCount

constexpr intptr_t dart::kSpaceRangeCount = ARRAY_SIZE(kSpaceRanges)
staticconstexpr

Definition at line 2775 of file regexp.cc.

◆ kSpaceRanges

constexpr int32_t dart::kSpaceRanges[]
staticconstexpr
Initial value:
= {
'\t', '\r' + 1, ' ', ' ' + 1, 0x00A0, 0x00A1, 0x1680,
0x1681, 0x2000, 0x200B, 0x2028, 0x202A, 0x202F, 0x2030,
0x205F, 0x2060, 0x3000, 0x3001, 0xFEFF, 0xFF00, kRangeEndMarker}

Definition at line 2771 of file regexp.cc.

2771 {
2772 '\t', '\r' + 1, ' ', ' ' + 1, 0x00A0, 0x00A1, 0x1680,
2773 0x1681, 0x2000, 0x200B, 0x2028, 0x202A, 0x202F, 0x2030,
2774 0x205F, 0x2060, 0x3000, 0x3001, 0xFEFF, 0xFF00, kRangeEndMarker};

◆ kStackTraceObjectReg

const Register dart::kStackTraceObjectReg = R1
constexpr

Definition at line 329 of file constants_arm.h.

◆ kStoreBufferBlockSize

constexpr int dart::kStoreBufferBlockSize = 1024
staticconstexpr

Definition at line 263 of file pointer_block.h.

◆ kStoreBufferWrapperSize

constexpr int dart::kStoreBufferWrapperSize = 24
constexpr

Definition at line 676 of file constants_arm.h.

◆ kStringHashM

constexpr uint32_t dart::kStringHashM = 0x5bd1e995
staticconstexpr

Definition at line 101 of file utils.cc.

◆ kStringHashR

constexpr int dart::kStringHashR = 24
staticconstexpr

Definition at line 102 of file utils.cc.

◆ kSubtypeRangeCheckScript

const char* dart::kSubtypeRangeCheckScript

Definition at line 851 of file type_testing_stubs_test.cc.

◆ kSurrogateRangeCount

constexpr intptr_t dart::kSurrogateRangeCount = ARRAY_SIZE(kSurrogateRanges)
staticconstexpr

Definition at line 2782 of file regexp.cc.

◆ kSurrogateRanges

constexpr int32_t dart::kSurrogateRanges[] = {0xd800, 0xe000, kRangeEndMarker}
staticconstexpr

Definition at line 2781 of file regexp.cc.

2781{0xd800, 0xe000, kRangeEndMarker};

◆ kTempVirtualRegister

constexpr intptr_t dart::kTempVirtualRegister = -2
staticconstexpr

Definition at line 34 of file linearscan.cc.

◆ kTestNumNativeFields

constexpr int dart::kTestNumNativeFields = 2
staticconstexpr

Definition at line 5570 of file dart_api_impl_test.cc.

◆ kTestPcOffset

constexpr uint32_t dart::kTestPcOffset = 0x4
staticconstexpr

Definition at line 16 of file bitmap_test.cc.

◆ kTestResultStrings

const char* dart::kTestResultStrings[]
static
Initial value:
= {
"fails in runtime",
"passes in TTS",
"passes in STC stub",
"passes in runtime, adding new STC entry",
"passes in runtime, no changes to max size STC",
"passes in runtime, initial TTS stub specialization",
"passes in runtime, TTS stub respecialized",
}

Definition at line 242 of file type_testing_stubs_test.cc.

242 {
243 "fails in runtime",
244 "passes in TTS",
245 "passes in STC stub",
246 "passes in runtime, adding new STC entry",
247 "passes in runtime, no changes to max size STC",
248 "passes in runtime, initial TTS stub specialization",
249 "passes in runtime, TTS stub respecialized",
250};

◆ kTestSpillSlotBitCount

constexpr intptr_t dart::kTestSpillSlotBitCount = 0
staticconstexpr

Definition at line 17 of file bitmap_test.cc.

◆ kTrueIdentityHash

constexpr intptr_t dart::kTrueIdentityHash = 1231
staticconstexpr

Definition at line 10764 of file object.h.

◆ kTrueOffsetFromNull

constexpr intptr_t dart::kTrueOffsetFromNull
staticconstexpr
Initial value:
=
HostObjectAlignment::kTrueOffsetFromNull

Definition at line 69 of file pointer_tagging.h.

◆ kTypedDataCidRemainderExternal

const int dart::kTypedDataCidRemainderExternal = 2

Definition at line 263 of file class_id.h.

◆ kTypedDataCidRemainderInternal

const int dart::kTypedDataCidRemainderInternal = 0

Definition at line 261 of file class_id.h.

◆ kTypedDataCidRemainderUnmodifiable

const int dart::kTypedDataCidRemainderUnmodifiable = 3

Definition at line 264 of file class_id.h.

◆ kTypedDataCidRemainderView

const int dart::kTypedDataCidRemainderView = 1

Definition at line 262 of file class_id.h.

◆ kUnallocatedReference [1/2]

constexpr intptr_t dart::kUnallocatedReference = -1
staticconstexpr

Definition at line 290 of file app_snapshot.cc.

◆ kUnallocatedReference [2/2]

constexpr intptr_t dart::kUnallocatedReference = -1
staticconstexpr

Definition at line 2689 of file message_snapshot.cc.

◆ kUnboxedAddress

constexpr Representation dart::kUnboxedAddress = kUnboxedUword
staticconstexpr

Definition at line 182 of file locations.h.

◆ kUnboxedBool

const Representation dart::kUnboxedBool = kTagged
static

Definition at line 8267 of file il.cc.

◆ kUnboxedIntPtr

constexpr Representation dart::kUnboxedIntPtr = kUnboxedWord
staticconstexpr

Definition at line 176 of file locations.h.

◆ kUnboxedUword

constexpr Representation dart::kUnboxedUword
staticconstexpr
Initial value:
=
compiler::target::kWordSize == 4 ? kUnboxedUint32 : kUnboxedInt64

Definition at line 171 of file locations.h.

◆ kUnboxedWord

constexpr Representation dart::kUnboxedWord
staticconstexpr
Initial value:
=
compiler::target::kWordSize == 4 ? kUnboxedInt32 : kUnboxedInt64

Definition at line 164 of file locations.h.

◆ kUnicodeIdentity

const char* dart::kUnicodeIdentity
static
Initial value:
=
"Invalid identity escape in Unicode pattern"

Definition at line 466 of file regexp_parser.cc.

◆ kUnInitialized

constexpr uint8_t dart::kUnInitialized = 0xFE
staticconstexpr

Definition at line 24 of file memory_copy_test.cc.

◆ kUnreachableReference

constexpr intptr_t dart::kUnreachableReference = 0
staticconstexpr

Definition at line 284 of file app_snapshot.cc.

◆ kUnsetThreadLocalKey [1/6]

const ThreadLocalKey dart::kUnsetThreadLocalKey
static
Initial value:
=
static_cast<pthread_key_t>(-1)

Definition at line 24 of file os_thread_absl.h.

◆ kUnsetThreadLocalKey [2/6]

const ThreadLocalKey dart::kUnsetThreadLocalKey
static
Initial value:
=
static_cast<pthread_key_t>(-1)

Definition at line 23 of file os_thread_android.h.

◆ kUnsetThreadLocalKey [3/6]

const ThreadLocalKey dart::kUnsetThreadLocalKey
static
Initial value:
=
static_cast<pthread_key_t>(-1)

Definition at line 24 of file os_thread_fuchsia.h.

◆ kUnsetThreadLocalKey [4/6]

const ThreadLocalKey dart::kUnsetThreadLocalKey
static
Initial value:
=
static_cast<pthread_key_t>(-1)

Definition at line 23 of file os_thread_linux.h.

◆ kUnsetThreadLocalKey [5/6]

const ThreadLocalKey dart::kUnsetThreadLocalKey
static
Initial value:
=
static_cast<pthread_key_t>(-1)

Definition at line 23 of file os_thread_macos.h.

◆ kUnsetThreadLocalKey [6/6]

const ThreadLocalKey dart::kUnsetThreadLocalKey = TLS_OUT_OF_INDEXES
static

Definition at line 23 of file os_thread_win.h.

◆ kUnsignedEnd

constexpr intptr_t dart::kUnsignedEnd = kMaxUint16
staticconstexpr

Definition at line 15 of file datastream_test.cc.

◆ kUwordMax

constexpr uword dart::kUwordMax = static_cast<uword>(-1)
constexpr

Definition at line 519 of file globals.h.

◆ kUwordOne

constexpr uword dart::kUwordOne = 1U
staticconstexpr

Definition at line 126 of file bitfield.h.

◆ kValidPc

const uword dart::kValidPc = 0xFF

Definition at line 29 of file profiler_test.cc.

◆ kValidTimeStamp

const int64_t dart::kValidTimeStamp = 1

Definition at line 26 of file profiler_test.cc.

◆ kVMHandleSizeInWords

constexpr int dart::kVMHandleSizeInWords = 2
staticconstexpr

Definition at line 238 of file handles.h.

◆ kVMHandlesPerChunk

constexpr int dart::kVMHandlesPerChunk = 63
staticconstexpr

Definition at line 240 of file handles.h.

◆ kWordMax

constexpr word dart::kWordMax = (static_cast<uword>(1) << (kBitsPerWord - 1)) - 1
constexpr

Definition at line 518 of file globals.h.

◆ kWordMin

constexpr word dart::kWordMin = static_cast<uword>(1) << (kBitsPerWord - 1)
constexpr

Definition at line 517 of file globals.h.

◆ kWordRangeCount

constexpr intptr_t dart::kWordRangeCount = ARRAY_SIZE(kWordRanges)
staticconstexpr

Definition at line 2778 of file regexp.cc.

◆ kWordRanges

constexpr int32_t dart::kWordRanges[]
staticconstexpr
Initial value:
= {
'0', '9' + 1, 'A', 'Z' + 1, '_', '_' + 1, 'a', 'z' + 1, kRangeEndMarker}

Definition at line 2776 of file regexp.cc.

2776 {
2777 '0', '9' + 1, 'A', 'Z' + 1, '_', '_' + 1, 'a', 'z' + 1, kRangeEndMarker};

◆ kWordSize

constexpr intptr_t dart::kWordSize = 1 << kWordSizeLog2
constexpr

Definition at line 509 of file globals.h.

◆ kWordSizeLog2

constexpr intptr_t dart::kWordSizeLog2 = kInt64SizeLog2
constexpr

Definition at line 507 of file globals.h.

◆ kWRegMask

const int64_t dart::kWRegMask = 0x00000000ffffffffL

Definition at line 483 of file constants_arm64.h.

◆ kWRegSizeInBits

const int dart::kWRegSizeInBits = 32

Definition at line 481 of file constants_arm64.h.

◆ kWriteBarrierObjectReg

const Register dart::kWriteBarrierObjectReg = R1
constexpr

Definition at line 332 of file constants_arm.h.

◆ kWriteBarrierSlotReg

const Register dart::kWriteBarrierSlotReg = R9
constexpr

Definition at line 334 of file constants_arm.h.

◆ kWriteBarrierValueReg

const Register dart::kWriteBarrierValueReg = R0
constexpr

Definition at line 333 of file constants_arm.h.

◆ kX

const auto dart::kX = NewMove(-1, -10)

Definition at line 25 of file catch_entry_moves_test.cc.

◆ kXRegMask

const int64_t dart::kXRegMask = 0xffffffffffffffffL

Definition at line 482 of file constants_arm64.h.

◆ kXRegSizeInBits

const int dart::kXRegSizeInBits = 64

Definition at line 480 of file constants_arm64.h.

◆ kZapCodeReg

constexpr uword dart::kZapCodeReg = 0xf1f1f1f1
staticconstexpr

Definition at line 258 of file stub_code_compiler.h.

◆ kZapReturnAddress

constexpr uword dart::kZapReturnAddress = 0xe1e1e1e1
staticconstexpr

Definition at line 261 of file stub_code_compiler.h.

◆ kZapUninitializedWord

constexpr uword dart::kZapUninitializedWord = 0xabababababababab
staticconstexpr

Definition at line 179 of file globals.h.

◆ last_allocation_cls

const char* dart::last_allocation_cls = nullptr
static

Definition at line 10237 of file dart_api_impl_test.cc.

◆ last_allocation_context

void* dart::last_allocation_context = nullptr
static

Definition at line 10236 of file dart_api_impl_test.cc.

◆ lookup_package_uris_params

const MethodParameter* const dart::lookup_package_uris_params[]
static
Initial value:
= {
nullptr,
}

Definition at line 5476 of file service.cc.

5476 {
5478 nullptr,
5479};

◆ lookup_resolved_package_uris_params

const MethodParameter* const dart::lookup_resolved_package_uris_params[]
static
Initial value:
= {
nullptr,
}

Definition at line 5467 of file service.cc.

5467 {
5469 nullptr,
5470};

◆ loop_reset_count

bool dart::loop_reset_count = false
static

Definition at line 9900 of file dart_api_impl_test.cc.

◆ loop_test_exit

bool dart::loop_test_exit = false
static

Definition at line 9899 of file dart_api_impl_test.cc.

◆ loop_test_lock

Monitor* dart::loop_test_lock = new Monitor()
static

Definition at line 9898 of file dart_api_impl_test.cc.

◆ MAX_FIRST_ARG

const unsigned int dart::MAX_FIRST_ARG = 0x7fffffu

Definition at line 14 of file regexp_bytecodes.h.

◆ MAX_NOP_SIZE

const int dart::MAX_NOP_SIZE = 8

Definition at line 455 of file constants_ia32.h.

◆ MB

constexpr intptr_t dart::MB = 1 << MBLog2
constexpr

Definition at line 530 of file globals.h.

◆ MBInWords

constexpr intptr_t dart::MBInWords = 1 << MBInWordsLog2
constexpr

Definition at line 537 of file globals.h.

◆ MBInWordsLog2

constexpr intptr_t dart::MBInWordsLog2 = KBLog2 + KBInWordsLog2
constexpr

Definition at line 536 of file globals.h.

◆ MBLog2

constexpr intptr_t dart::MBLog2 = KBLog2 + KBLog2
constexpr

Definition at line 529 of file globals.h.

◆ my_callback_blocking_fp_

intptr_t(* dart::my_callback_blocking_fp_) (intptr_t) ( intptr_t  )

Definition at line 445 of file ffi_test_functions_vmspecific.cc.

◆ my_callback_blocking_send_port_

Dart_Port dart::my_callback_blocking_send_port_

Definition at line 446 of file ffi_test_functions_vmspecific.cc.

◆ my_callback_non_blocking_fp_

void(* dart::my_callback_non_blocking_fp_) (intptr_t) ( intptr_t  )

Definition at line 448 of file ffi_test_functions_vmspecific.cc.

◆ my_callback_non_blocking_send_port_

Dart_Port dart::my_callback_non_blocking_send_port_

Definition at line 449 of file ffi_test_functions_vmspecific.cc.

◆ name

const char* const dart::name

Definition at line 324 of file method_recognizer.cc.

◆ names

const char* const dart::names[]
static
Initial value:
= {
nullptr,
#define DEFINE_SYMBOL_LITERAL(symbol, literal)
"",
#define DEFINE_TOKEN_SYMBOL_INDEX(t, s, p, a)
}

Definition at line 24 of file symbols.cc.

24 {
25 // clang-format off
26 nullptr,
27#define DEFINE_SYMBOL_LITERAL(symbol, literal) literal,
29#undef DEFINE_SYMBOL_LITERAL
30 "", // matches kTokenTableStart.
31#define DEFINE_TOKEN_SYMBOL_INDEX(t, s, p, a) s,
34#undef DEFINE_TOKEN_SYMBOL_INDEX
35 // clang-format on
36};
#define DEFINE_SYMBOL_LITERAL(symbol, literal)
#define DEFINE_TOKEN_SYMBOL_INDEX(t, s, p, a)
#define PREDEFINED_SYMBOLS_LIST(V)
Definition symbols.h:18
#define DART_KEYWORD_LIST(KW)
Definition token.h:159
#define DART_TOKEN_LIST(TOK)
Definition token.h:34

◆ NULL_REG

constexpr Register dart::NULL_REG = R22
constexpr

Definition at line 157 of file constants_arm64.h.

◆ opt_data

int8_t dart::opt_data[kOptExtLength]
static
Initial value:
= {
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
}

Definition at line 2395 of file dart_api_impl_test.cc.

2395 {
2396 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
2397 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
2398};

◆ PAD

const char dart::PAD = '='
static

Definition at line 37 of file base64.cc.

◆ page_cache

VirtualMemory* dart::page_cache[kPageCacheCapacity] = {nullptr}
static

Definition at line 28 of file page.cc.

28{nullptr};

◆ page_cache_mutex

Mutex* dart::page_cache_mutex = nullptr
static

Definition at line 27 of file page.cc.

◆ page_cache_size

intptr_t dart::page_cache_size = 0
static

Definition at line 29 of file page.cc.

◆ pause_params

const MethodParameter* const dart::pause_params[]
static
Initial value:

Definition at line 4409 of file service.cc.

4409 {
4411 nullptr,
4412};

◆ persistent_handle1

Dart_PersistentHandle dart::persistent_handle1
static

Definition at line 3828 of file dart_api_impl_test.cc.

◆ platform_strong_dill

const uint8_t * dart::platform_strong_dill = kPlatformStrongDill

Definition at line 39 of file unit_test.cc.

◆ platform_strong_dill_size

const intptr_t dart::platform_strong_dill_size = kPlatformStrongDillSize

Definition at line 40 of file unit_test.cc.

◆ pointer_prefix

const char* dart::pointer_prefix = ""

Definition at line 20 of file memory_copy_test.cc.

◆ PP

const Register dart::PP = R5
constexpr

Definition at line 312 of file constants_arm.h.

◆ QTMP

const QRegister dart::QTMP = Q7

Definition at line 290 of file constants_arm.h.

◆ [struct]

const struct { ... } dart::recognized_methods[MethodRecognizer::kNumRecognizedMethods]
Initial value:
= {
{"", "", "Unknown", 0},
#define RECOGNIZE_METHOD(class_name, function_name, enum_name, fp)
}

◆ ref_counted_resource_mutex

std::mutex dart::ref_counted_resource_mutex

Definition at line 1333 of file ffi_test_functions_vmspecific.cc.

◆ reload

Cause GC during dart::reload
explicit

Definition at line 58 of file isolate_reload.cc.

◆ reload_sources_params

const MethodParameter* const dart::reload_sources_params[]
static
Initial value:
= {
new BoolParameter("force", false),
new BoolParameter("pause", false),
new StringParameter("rootLibUri", false),
new StringParameter("packagesUri", false),
nullptr,
}

Definition at line 3831 of file service.cc.

3831 {
3833 new BoolParameter("force", false),
3834 new BoolParameter("pause", false),
3835 new StringParameter("rootLibUri", false),
3836 new StringParameter("packagesUri", false),
3837 nullptr,
3838};

◆ ReloadEntries

struct dart::NativeEntries dart::ReloadEntries[] = {RELOAD_NATIVE_LIST(REGISTER_FUNCTION)}
static

◆ remove_breakpoint_params

const MethodParameter* const dart::remove_breakpoint_params[]
static
Initial value:

Definition at line 4035 of file service.cc.

4035 {
4037 nullptr,
4038};

◆ report_enum_names

const char* const dart::report_enum_names[]
static
Initial value:
= {
SourceReport::kCallSitesStr, SourceReport::kCoverageStr,
SourceReport::kPossibleBreakpointsStr, SourceReport::kProfileStr,
SourceReport::kBranchCoverageStr, nullptr,
}

Definition at line 3711 of file service.cc.

3711 {
3712 SourceReport::kCallSitesStr, SourceReport::kCoverageStr,
3713 SourceReport::kPossibleBreakpointsStr, SourceReport::kProfileStr,
3714 SourceReport::kBranchCoverageStr, nullptr,
3715};

◆ request_heap_snapshot_params

const MethodParameter* const dart::request_heap_snapshot_params[]
static
Initial value:

Definition at line 4590 of file service.cc.

4590 {
4592 nullptr,
4593};

◆ resume_params

const MethodParameter* const dart::resume_params[]
static
Initial value:
= {
new EnumParameter("step", false, step_enum_names),
new UIntParameter("frameIndex", false),
nullptr,
}

Definition at line 4322 of file service.cc.

4322 {
4324 new EnumParameter("step", false, step_enum_names),
4325 new UIntParameter("frameIndex", false),
4326 nullptr,
4327};

◆ run_filter

const char* dart::run_filter = kNone
static

Definition at line 46 of file run_vm_tests.cc.

◆ run_matches

int dart::run_matches = 0
static

Definition at line 49 of file run_vm_tests.cc.

◆ runtime_frame_layout

FrameLayout dart::runtime_frame_layout = invalid_frame_layout

Definition at line 81 of file stack_frame.cc.

◆ RV_B

constexpr ExtensionSet dart::RV_B = RV_Zba | RV_Zbb | RV_Zbc | RV_Zbs
staticconstexpr

Definition at line 1599 of file constants_riscv.h.

◆ RV_G

constexpr ExtensionSet dart::RV_G = RV_I | RV_M | RV_A | RV_F | RV_D
staticconstexpr

Definition at line 1593 of file constants_riscv.h.

◆ RV_GC

constexpr ExtensionSet dart::RV_GC = RV_G | RV_C
staticconstexpr

Definition at line 1594 of file constants_riscv.h.

◆ RV_GCB

constexpr ExtensionSet dart::RV_GCB = RV_GC | RV_B
staticconstexpr

Definition at line 1600 of file constants_riscv.h.

◆ saved_echo

char* dart::saved_echo = nullptr

Definition at line 240 of file custom_isolate_test.cc.

◆ segment_cache

VirtualMemory* dart::segment_cache[kSegmentCacheCapacity] = {nullptr}
static

Definition at line 55 of file zone.cc.

55{nullptr};

◆ segment_cache_mutex

Mutex* dart::segment_cache_mutex = nullptr
static

Definition at line 54 of file zone.cc.

◆ segment_cache_size

intptr_t dart::segment_cache_size = 0
static

Definition at line 56 of file zone.cc.

◆ send_port_

Dart_Port dart::send_port_

Definition at line 618 of file ffi_test_functions_vmspecific.cc.

◆ service_methods_

const ServiceMethodDescriptor dart::service_methods_[]
static

Definition at line 5847 of file service.cc.

5847 {
5848 { "_echo", Echo,
5849 nullptr },
5850 { "_respondWithMalformedJson", RespondWithMalformedJson,
5851 nullptr },
5852 { "_respondWithMalformedObject", RespondWithMalformedObject,
5853 nullptr },
5854 { "_triggerEchoEvent", TriggerEchoEvent,
5855 nullptr },
5856 { "addBreakpoint", AddBreakpoint,
5858 { "addBreakpointWithScriptUri", AddBreakpointWithScriptUri,
5860 { "addBreakpointAtEntry", AddBreakpointAtEntry,
5862 { "_addBreakpointAtActivation", AddBreakpointAtActivation,
5864 { "_buildExpressionEvaluationScope", BuildExpressionEvaluationScope,
5866 { "clearCpuSamples", ClearCpuSamples,
5868 { "clearVMTimeline", ClearVMTimeline,
5870 { "_compileExpression", CompileExpression, compile_expression_params },
5871 { "_enableProfiler", EnableProfiler,
5873 { "evaluate", Evaluate,
5875 { "evaluateInFrame", EvaluateInFrame,
5877 { "_getAllocationProfile", GetAllocationProfile,
5879 { "getAllocationProfile", GetAllocationProfilePublic,
5881 { "getAllocationTraces", GetAllocationTraces,
5883 { "getClassList", GetClassList,
5885 { "getCpuSamples", GetCpuSamples,
5887 { "getFlagList", GetFlagList,
5889 { "_getHeapMap", GetHeapMap,
5891 { "_getImplementationFields", GetImplementationFields,
5893 { "getInboundReferences", GetInboundReferences,
5895 { "getInstances", GetInstances,
5897 { "getInstancesAsList", GetInstancesAsList,
5899#if defined(SUPPORT_PERFETTO)
5900 { "getPerfettoCpuSamples", GetPerfettoCpuSamples,
5902 { "getPerfettoVMTimeline", GetPerfettoVMTimeline,
5904#endif // defined(SUPPORT_PERFETTO)
5905 { "getPorts", GetPorts,
5907 { "getIsolate", GetIsolate,
5909 { "_getIsolateObjectStore", GetIsolateObjectStore,
5911 { "getIsolateGroup", GetIsolateGroup,
5913 { "getMemoryUsage", GetMemoryUsage,
5915 { "getIsolateGroupMemoryUsage", GetIsolateGroupMemoryUsage,
5917 { "_getIsolateMetric", GetIsolateMetric,
5919 { "_getIsolateMetricList", GetIsolateMetricList,
5921 { "getIsolatePauseEvent", GetIsolatePauseEvent,
5923 { "getObject", GetObject,
5925 { "_getObjectStore", GetObjectStore,
5927 { "_getPersistentHandles", GetPersistentHandles,
5929 { "_getPorts", GetPortsPrivate,
5931 { "getProcessMemoryUsage", GetProcessMemoryUsage,
5933 { "_getReachableSize", GetReachableSize,
5935 { "_getRetainedSize", GetRetainedSize,
5937 { "lookupResolvedPackageUris", LookupResolvedPackageUris,
5939 { "lookupPackageUris", LookupPackageUris,
5941 { "getRetainingPath", GetRetainingPath,
5943 { "getScripts", GetScripts,
5945 { "getSourceReport", GetSourceReport,
5947 { "getStack", GetStack,
5949 { "_getTagProfile", GetTagProfile,
5951 { "_getTypeArgumentsList", GetTypeArgumentsList,
5953 { "getVersion", GetVersion,
5955 { "getVM", GetVM,
5956 get_vm_params },
5957 { "getVMTimeline", GetVMTimeline,
5959 { "getVMTimelineFlags", GetVMTimelineFlags,
5961 { "getVMTimelineMicros", GetVMTimelineMicros,
5963 { "invoke", Invoke, invoke_params },
5964 { "kill", Kill, kill_params },
5965 { "pause", Pause,
5966 pause_params },
5967 { "removeBreakpoint", RemoveBreakpoint,
5969 { "reloadSources", ReloadSources,
5971 { "_reloadSources", ReloadSources,
5973 { "resume", Resume,
5974 resume_params },
5975 { "requestHeapSnapshot", RequestHeapSnapshot,
5977 { "_evaluateCompiledExpression", EvaluateCompiledExpression,
5979 { "setBreakpointState", SetBreakpointState,
5981 { "setExceptionPauseMode", SetExceptionPauseMode,
5983 { "setIsolatePauseMode", SetIsolatePauseMode,
5985 { "setFlag", SetFlag,
5987 { "setLibraryDebuggable", SetLibraryDebuggable,
5989 { "setName", SetName,
5991 { "_setStreamIncludePrivateMembers", SetStreamIncludePrivateMembers,
5993 { "setTraceClassAllocation", SetTraceClassAllocation,
5995 { "setVMName", SetVMName,
5997 { "setVMTimelineFlags", SetVMTimelineFlags,
5998 set_vm_timeline_flags_params },
5999 { "_collectAllGarbage", CollectAllGarbage,
6001 { "_getDefaultClassesAliases", GetDefaultClassesAliases,
6003};
static void EnableProfiler(Thread *thread, JSONStream *js)
Definition service.cc:4429
static const MethodParameter *const get_allocation_profile_params[]
Definition service.cc:4541
static const MethodParameter *const get_ports_private_params[]
Definition service.cc:4978
static const MethodParameter *const set_trace_class_allocation_params[]
Definition service.cc:5739
static void TriggerEchoEvent(Thread *thread, JSONStream *js)
Definition service.cc:1777
static void GetIsolateMetricList(Thread *thread, JSONStream *js)
Definition service.cc:4110
static void LookupResolvedPackageUris(Thread *thread, JSONStream *js)
Definition service.cc:5472
static void AddBreakpointWithScriptUri(Thread *thread, JSONStream *js)
Definition service.cc:3968
static void GetSourceReport(Thread *thread, JSONStream *js)
Definition service.cc:3730
static void GetIsolateObjectStore(Thread *thread, JSONStream *js)
Definition service.cc:5149
static const MethodParameter *const get_object_store_params[]
Definition service.cc:5134
static void Evaluate(Thread *thread, JSONStream *js)
Definition service.cc:2872
static const MethodParameter *const clear_vm_timeline_params[]
Definition service.cc:4285
static const MethodParameter *const get_type_arguments_list_params[]
Definition service.cc:5165
static void SetBreakpointState(Thread *thread, JSONStream *js)
Definition service.cc:5571
static const MethodParameter *const get_isolate_metric_params[]
Definition service.cc:4123
static void GetTypeArgumentsList(Thread *thread, JSONStream *js)
Definition service.cc:5170
static void RespondWithMalformedObject(Thread *thread, JSONStream *js)
Definition service.cc:4999
static const MethodParameter *const pause_params[]
Definition service.cc:4409
static void SetLibraryDebuggable(Thread *thread, JSONStream *js)
Definition service.cc:5688
static void ReloadSources(Thread *thread, JSONStream *js)
Definition service.cc:3840
static const MethodParameter *const set_library_debuggable_params[]
Definition service.cc:5681
static void LookupPackageUris(Thread *thread, JSONStream *js)
Definition service.cc:5481
static void GetImplementationFields(Thread *thread, JSONStream *js)
Definition service.cc:5102
static const MethodParameter *const get_implementation_fields_params[]
Definition service.cc:5096
static const MethodParameter *const get_vm_timeline_params[]
Definition service.cc:4300
static void GetObjectStore(Thread *thread, JSONStream *js)
Definition service.cc:5139
static void GetClassList(Thread *thread, JSONStream *js)
Definition service.cc:5159
static const MethodParameter *const add_breakpoint_at_entry_params[]
Definition service.cc:3978
static void GetIsolateGroupMemoryUsage(Thread *thread, JSONStream *js)
Definition service.cc:1621
static const MethodParameter *const get_scripts_params[]
Definition service.cc:1636
static const MethodParameter *const lookup_resolved_package_uris_params[]
Definition service.cc:5467
static void SetStreamIncludePrivateMembers(Thread *thread, JSONStream *js)
Definition service.cc:1564
static const MethodParameter *const add_breakpoint_at_activation_params[]
Definition service.cc:4007
static const MethodParameter *const build_expression_evaluation_scope_params[]
Definition service.cc:2881
static const MethodParameter *const compile_expression_params[]
Definition service.cc:3197
static const MethodParameter *const get_isolate_object_store_params[]
Definition service.cc:5144
static const MethodParameter *const collect_all_garbage_params[]
Definition service.cc:4554
static const MethodParameter *const get_stack_params[]
Definition service.cc:1670
static void GetIsolate(Thread *thread, JSONStream *js)
Definition service.cc:1520
static const MethodParameter *const get_retaining_path_params[]
Definition service.cc:2505
static const MethodParameter *const get_instances_as_list_params[]
Definition service.cc:3581
static void GetMemoryUsage(Thread *thread, JSONStream *js)
Definition service.cc:1612
static void RemoveBreakpoint(Thread *thread, JSONStream *js)
Definition service.cc:4040
static void ClearCpuSamples(Thread *thread, JSONStream *js)
Definition service.cc:4504
static const MethodParameter *const get_flag_list_params[]
Definition service.cc:5593
static const MethodParameter *const invoke_params[]
Definition service.cc:2624
static const MethodParameter *const get_tag_profile_params[]
Definition service.cc:4437
static void GetHeapMap(Thread *thread, JSONStream *js)
Definition service.cc:4570
static void AddBreakpoint(Thread *thread, JSONStream *js)
Definition service.cc:3942
static const MethodParameter *const enable_profiler_params[]
Definition service.cc:4425
static void GetStack(Thread *thread, JSONStream *js)
Definition service.cc:1676
static void SetTraceClassAllocation(Thread *thread, JSONStream *js)
Definition service.cc:5746
static const MethodParameter *const get_isolate_pause_event_params[]
Definition service.cc:1627
static void GetInboundReferences(Thread *thread, JSONStream *js)
Definition service.cc:2368
static void GetIsolatePauseEvent(Thread *thread, JSONStream *js)
Definition service.cc:1632
static void SetVMName(Thread *thread, JSONStream *js)
Definition service.cc:5727
static const MethodParameter *const get_inbound_references_params[]
Definition service.cc:2363
static const MethodParameter *const clear_cpu_samples_params[]
Definition service.cc:4499
static const MethodParameter *const evaluate_in_frame_params[]
Definition service.cc:3433
static const MethodParameter *const get_process_memory_usage_params[]
Definition service.cc:4821
static void GetVersion(Thread *thread, JSONStream *js)
Definition service.cc:5206
static const MethodParameter *const get_class_list_params[]
Definition service.cc:5154
static const MethodParameter *const get_vm_params[]
Definition service.cc:5247
static const MethodParameter *const set_flags_params[]
Definition service.cc:5602
static void CompileExpression(Thread *thread, JSONStream *js)
Definition service.cc:3216
static const MethodParameter *const reload_sources_params[]
Definition service.cc:3831
static const MethodParameter *const request_heap_snapshot_params[]
Definition service.cc:4590
static void BuildExpressionEvaluationScope(Thread *thread, JSONStream *js)
Definition service.cc:2955
static const MethodParameter *const evaluate_params[]
Definition service.cc:2757
static const MethodParameter *const get_persistent_handles_params[]
Definition service.cc:4890
static void GetTagProfile(Thread *thread, JSONStream *js)
Definition service.cc:4442
static void Pause(Thread *thread, JSONStream *js)
Definition service.cc:4414
static const MethodParameter *const get_isolate_group_memory_usage_params[]
Definition service.cc:1616
static const MethodParameter *const get_ports_params[]
Definition service.cc:3685
static const MethodParameter *const set_exception_pause_mode_params[]
Definition service.cc:5499
static void EvaluateInFrame(Thread *thread, JSONStream *js)
Definition service.cc:3440
static const MethodParameter *const evaluate_compiled_expression_params[]
Definition service.cc:3299
static void GetVMTimelineMicros(Thread *thread, JSONStream *js)
Definition service.cc:4279
static void EvaluateCompiledExpression(Thread *thread, JSONStream *js)
Definition service.cc:3313
static const MethodParameter *const get_memory_usage_params[]
Definition service.cc:1607
static const MethodParameter *const get_version_params[]
Definition service.cc:5201
static const MethodParameter *const set_breakpoint_state_params[]
Definition service.cc:5564
static const MethodParameter *const get_heap_map_params[]
Definition service.cc:4565
static void GetPortsPrivate(Thread *thread, JSONStream *js)
Definition service.cc:4983
static void GetAllocationProfilePublic(Thread *thread, JSONStream *js)
Definition service.cc:4546
static void GetDefaultClassesAliases(Thread *thread, JSONStream *js)
Definition service.cc:5767
static const MethodParameter *const kill_params[]
Definition service.cc:4395
static void Kill(Thread *thread, JSONStream *js)
Definition service.cc:4400
static const MethodParameter *const add_breakpoint_params[]
Definition service.cc:3934
static void Echo(Thread *thread, JSONStream *js)
Definition service.cc:1785
static void GetReachableSize(Thread *thread, JSONStream *js)
Definition service.cc:2591
static const MethodParameter *const get_allocation_traces_params[]
Definition service.cc:4459
static void GetIsolateMetric(Thread *thread, JSONStream *js)
Definition service.cc:4128
static void AddBreakpointAtEntry(Thread *thread, JSONStream *js)
Definition service.cc:3984
static const MethodParameter *const set_stream_include_private_members_params[]
Definition service.cc:1558
static const MethodParameter *const get_vm_timeline_micros_params[]
Definition service.cc:4274
static void SetIsolatePauseMode(Thread *thread, JSONStream *js)
Definition service.cc:5533
static void GetCpuSamples(Thread *thread, JSONStream *js)
Definition service.cc:4455
static const MethodParameter *const get_reachable_size_params[]
Definition service.cc:2585
static void GetRetainingPath(Thread *thread, JSONStream *js)
Definition service.cc:2510
static void Resume(Thread *thread, JSONStream *js)
Definition service.cc:4329
static void SetFlag(Thread *thread, JSONStream *js)
Definition service.cc:5607
static const MethodParameter *const resume_params[]
Definition service.cc:4322
static void GetInstancesAsList(Thread *thread, JSONStream *js)
Definition service.cc:3589
static void GetProcessMemoryUsage(Thread *thread, JSONStream *js)
Definition service.cc:4825
static void GetVM(Thread *thread, JSONStream *js)
Definition service.cc:5337
static void CollectAllGarbage(Thread *thread, JSONStream *js)
Definition service.cc:4559
static const MethodParameter *const get_instances_params[]
Definition service.cc:3532
static void GetRetainedSize(Thread *thread, JSONStream *js)
Definition service.cc:2552
static const MethodParameter *const get_default_classes_aliases_params[]
Definition service.cc:5762
static void GetVMTimeline(Thread *thread, JSONStream *js)
Definition service.cc:4307
static void GetPorts(Thread *thread, JSONStream *js)
Definition service.cc:3690
static void SetExceptionPauseMode(Thread *thread, JSONStream *js)
Definition service.cc:5505
static const MethodParameter *const set_name_params[]
Definition service.cc:5704
static void GetObject(Thread *thread, JSONStream *js)
Definition service.cc:5046
static const MethodParameter *const get_isolate_params[]
Definition service.cc:1515
static void GetPersistentHandles(Thread *thread, JSONStream *js)
Definition service.cc:4945
static const MethodParameter *const lookup_package_uris_params[]
Definition service.cc:5476
static const MethodParameter *const get_cpu_samples_params[]
Definition service.cc:4448
static const MethodParameter *const get_vm_timeline_flags_params[]
Definition service.cc:4257
static const MethodParameter *const remove_breakpoint_params[]
Definition service.cc:4035
static void GetScripts(Thread *thread, JSONStream *js)
Definition service.cc:1641
static const MethodParameter *const get_retained_size_params[]
Definition service.cc:2546
static void GetFlagList(Thread *thread, JSONStream *js)
Definition service.cc:5598
static const MethodParameter *const set_isolate_pause_mode_params[]
Definition service.cc:5526
static void RequestHeapSnapshot(Thread *thread, JSONStream *js)
Definition service.cc:4595
static const MethodParameter *const get_isolate_metric_list_params[]
Definition service.cc:4105
static void SetVMTimelineFlags(Thread *thread, JSONStream *js)
Definition service.cc:4241
static void GetVMTimelineFlags(Thread *thread, JSONStream *js)
Definition service.cc:4262
static const MethodParameter *const get_object_params[]
Definition service.cc:5039
static const MethodParameter *const get_isolate_group_params[]
Definition service.cc:1524
static void GetAllocationProfile(Thread *thread, JSONStream *js)
Definition service.cc:4550
static const MethodParameter *const add_breakpoint_with_script_uri_params[]
Definition service.cc:3960
static void AddBreakpointAtActivation(Thread *thread, JSONStream *js)
Definition service.cc:4013
static void GetIsolateGroup(Thread *thread, JSONStream *js)
Definition service.cc:1601
static void GetAllocationTraces(Thread *thread, JSONStream *js)
Definition service.cc:4467
static void ClearVMTimeline(Thread *thread, JSONStream *js)
Definition service.cc:4290
static const MethodParameter *const set_vm_name_params[]
Definition service.cc:5721
static void SetName(Thread *thread, JSONStream *js)
Definition service.cc:5710
static void GetInstances(Thread *thread, JSONStream *js)
Definition service.cc:3541

◆ set_breakpoint_state_params

const MethodParameter* const dart::set_breakpoint_state_params[]
static
Initial value:
= {
new IdParameter("breakpointId", true),
new BoolParameter("enable", true),
nullptr,
}

Definition at line 5564 of file service.cc.

5564 {
5566 new IdParameter("breakpointId", true),
5567 new BoolParameter("enable", true),
5568 nullptr,
5569};

◆ set_exception_pause_mode_params

const MethodParameter* const dart::set_exception_pause_mode_params[]
static
Initial value:
= {
new EnumParameter("mode", true, exception_pause_mode_names),
nullptr,
}

Definition at line 5499 of file service.cc.

5499 {
5501 new EnumParameter("mode", true, exception_pause_mode_names),
5502 nullptr,
5503};

◆ set_flags_params

const MethodParameter* const dart::set_flags_params[]
static
Initial value:
= {
nullptr,
}

Definition at line 5602 of file service.cc.

5602 {
5604 nullptr,
5605};

◆ set_isolate_pause_mode_params

const MethodParameter* const dart::set_isolate_pause_mode_params[]
static
Initial value:
= {
new EnumParameter("exceptionPauseMode", false, exception_pause_mode_names),
new BoolParameter("shouldPauseOnExit", false),
nullptr,
}

Definition at line 5526 of file service.cc.

5526 {
5528 new EnumParameter("exceptionPauseMode", false, exception_pause_mode_names),
5529 new BoolParameter("shouldPauseOnExit", false),
5530 nullptr,
5531};

◆ set_library_debuggable_params

const MethodParameter* const dart::set_library_debuggable_params[]
static
Initial value:
= {
new IdParameter("libraryId", true),
new BoolParameter("isDebuggable", true),
nullptr,
}

Definition at line 5681 of file service.cc.

5681 {
5683 new IdParameter("libraryId", true),
5684 new BoolParameter("isDebuggable", true),
5685 nullptr,
5686};

◆ set_name_params

const MethodParameter* const dart::set_name_params[]
static
Initial value:
= {
new MethodParameter("name", true),
nullptr,
}

Definition at line 5704 of file service.cc.

5704 {
5706 new MethodParameter("name", true),
5707 nullptr,
5708};

◆ set_stream_include_private_members_params

const MethodParameter* const dart::set_stream_include_private_members_params[]
static
Initial value:
= {
new BoolParameter("includePrivateMembers", true),
nullptr,
}

Definition at line 1558 of file service.cc.

1558 {
1560 new BoolParameter("includePrivateMembers", true),
1561 nullptr,
1562};

◆ set_trace_class_allocation_params

const MethodParameter* const dart::set_trace_class_allocation_params[]
static
Initial value:
= {
new IdParameter("classId", true),
new BoolParameter("enable", true),
nullptr,
}

Definition at line 5739 of file service.cc.

5739 {
5741 new IdParameter("classId", true),
5742 new BoolParameter("enable", true),
5743 nullptr,
5744};

◆ set_vm_name_params

const MethodParameter* const dart::set_vm_name_params[]
static
Initial value:
= {
new MethodParameter("name", true),
nullptr,
}

Definition at line 5721 of file service.cc.

5721 {
5723 new MethodParameter("name", true),
5724 nullptr,
5725};

◆ shutdown_isolate_data

void* dart::shutdown_isolate_data
static

Definition at line 8507 of file dart_api_impl_test.cc.

◆ shutdown_isolate_group_data

void* dart::shutdown_isolate_group_data
static

Definition at line 8506 of file dart_api_impl_test.cc.

◆ simd_op_information

const SimdOpInfo dart::simd_op_information[]
static
Initial value:
= {
#define CASE(Arity, Mask, Name, Args, Result)
}

Definition at line 8281 of file il.cc.

8281 {
8282#define CASE(Arity, Mask, Name, Args, Result) \
8283 {Arity, HAS_##Mask, REP(Result), {PP_APPLY(ENCODE_INPUTS_##Arity, Args)}},
8285#undef CASE
8286};
#define CASE(Arity, Mask, Name, Args, Result)
#define SIMD_OP_LIST(M, BINARY_OP)
Definition il.h:11195

◆ simd_op_result_cids

const intptr_t dart::simd_op_result_cids[]
static
Initial value:
= {
#define kInt8Cid
#define CASE(Arity, Mask, Name, Args, Result)
}

Definition at line 1783 of file type_propagator.cc.

1783 {
1784#define kInt8Cid kSmiCid
1785#define CASE(Arity, Mask, Name, Args, Result) k##Result##Cid,
1787#undef CASE
1788#undef kWordCid
1789};
#define CASE(Arity, Mask, Name, Args, Result)

◆ SPREG

const Register dart::SPREG = SP
constexpr

Definition at line 314 of file constants_arm.h.

◆ step_enum_names

const char* const dart::step_enum_names[]
static
Initial value:
= {
"None", "Into", "Over", "Out", "Rewind", "OverAsyncSuspension", nullptr,
}

Definition at line 4311 of file service.cc.

4311 {
4312 "None", "Into", "Over", "Out", "Rewind", "OverAsyncSuspension", nullptr,
4313};

◆ step_enum_values

const Debugger::ResumeAction dart::step_enum_values[]
static
Initial value:
= {
Debugger::kContinue, Debugger::kStepInto,
Debugger::kStepOver, Debugger::kStepOut,
Debugger::kStepRewind, Debugger::kStepOverAsyncSuspension,
Debugger::kContinue,
}

Definition at line 4315 of file service.cc.

4315 {
4316 Debugger::kContinue, Debugger::kStepInto,
4317 Debugger::kStepOver, Debugger::kStepOut,
4318 Debugger::kStepRewind, Debugger::kStepOverAsyncSuspension,
4319 Debugger::kContinue, // Default value
4320};

◆ streams_

StreamInfo* const dart::streams_[]
static
Initial value:
= {
&Service::vm_stream, &Service::isolate_stream,
&Service::debug_stream, &Service::gc_stream,
&Service::echo_stream, &Service::heapsnapshot_stream,
&Service::logging_stream, &Service::extension_stream,
&Service::timeline_stream, &Service::profiler_stream,
}

Definition at line 419 of file service.cc.

419 {
420 &Service::vm_stream, &Service::isolate_stream,
421 &Service::debug_stream, &Service::gc_stream,
422 &Service::echo_stream, &Service::heapsnapshot_stream,
423 &Service::logging_stream, &Service::extension_stream,
424 &Service::timeline_stream, &Service::profiler_stream,
425};

◆ symbol_id

const intptr_t dart::symbol_id

Definition at line 321 of file method_recognizer.cc.

◆ test_libs_

MallocGrowableArray<TestLibEntry>* dart::test_libs_ = nullptr
static

Definition at line 182 of file unit_test.cc.

◆ test_output_

const char* dart::test_output_ = nullptr
static

Definition at line 20 of file log_test.cc.

◆ TESTING_runtime_fail_on_existing_cache_entry

bool dart::TESTING_runtime_fail_on_existing_cache_entry = false

Definition at line 7675 of file object.cc.

◆ THR

const Register dart::THR = R10
constexpr

Definition at line 321 of file constants_arm.h.

◆ TMP

const Register dart::TMP = IP
constexpr

Definition at line 310 of file constants_arm.h.

◆ TMP2

const Register dart::TMP2 = kNoRegister
constexpr

Definition at line 311 of file constants_arm.h.

◆ use_set_return

bool dart::use_set_return = false
static

Definition at line 787 of file dart_api_impl_test.cc.

◆ use_throw_exception

bool dart::use_throw_exception = false
static

Definition at line 790 of file dart_api_impl_test.cc.

◆ vm_name

char* dart::vm_name = nullptr
static

Definition at line 356 of file service.cc.

◆ VTMP

const VRegister dart::VTMP = V31

Definition at line 127 of file constants_arm64.h.

◆ weak1

Dart_WeakPersistentHandle dart::weak1 = nullptr
static

Definition at line 4513 of file dart_api_impl_test.cc.

◆ weak2

Dart_WeakPersistentHandle dart::weak2 = nullptr
static

Definition at line 4514 of file dart_api_impl_test.cc.

◆ weak3

Dart_WeakPersistentHandle dart::weak3 = nullptr
static

Definition at line 4515 of file dart_api_impl_test.cc.

◆ weak_persistent_handle2

Dart_WeakPersistentHandle dart::weak_persistent_handle2
static

Definition at line 3829 of file dart_api_impl_test.cc.

◆ weak_persistent_handle3

Dart_WeakPersistentHandle dart::weak_persistent_handle3
static

Definition at line 3830 of file dart_api_impl_test.cc.

◆ WRITE_BARRIER_STATE

constexpr Register dart::WRITE_BARRIER_STATE = S11
constexpr

Definition at line 165 of file constants_riscv.h.

◆ xbcde

const CatchEntryMove dart::xbcde[] = {kX, kB, kC, kD, kE}

Definition at line 29 of file catch_entry_moves_test.cc.

29{kX, kB, kC, kD, kE};