Flutter Engine
The Flutter Engine
Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
dart::kernel::KernelReaderHelper Class Reference

#include <kernel_translation_helper.h>

Inheritance diagram for dart::kernel::KernelReaderHelper:
dart::kernel::KernelFingerprintHelper dart::kernel::KernelTokenPositionCollector dart::kernel::MetadataEvaluator dart::kernel::ParameterDescriptorBuilder dart::kernel::StreamingFlowGraphBuilder

Public Member Functions

 KernelReaderHelper (Zone *zone, TranslationHelper *translation_helper, const TypedDataBase &data, intptr_t data_program_offset)
 
virtual ~KernelReaderHelper ()=default
 
void SetOffset (intptr_t offset)
 
intptr_t ReadListLength ()
 
NameIndex ReadCanonicalNameReference ()
 
virtual void ReportUnexpectedTag (const char *variant, Tag tag)
 
void ReadUntilFunctionNode ()
 
Tag PeekTag (uint8_t *payload=nullptr)
 

Protected Member Functions

virtual void set_current_script_id (intptr_t id)
 
virtual void RecordTokenPosition (TokenPosition position)
 
intptr_t ReaderOffset () const
 
intptr_t ReaderSize () const
 
void SkipBytes (intptr_t skip)
 
bool ReadBool ()
 
uint8_t ReadByte ()
 
uint32_t ReadUInt ()
 
uint32_t ReadUInt32 ()
 
uint32_t PeekUInt ()
 
double ReadDouble ()
 
uint32_t PeekListLength ()
 
StringIndex ReadStringReference ()
 
NameIndex ReadInterfaceMemberNameReference ()
 
StringIndex ReadNameAsStringIndex ()
 
const StringReadNameAsMethodName ()
 
const StringReadNameAsGetterName ()
 
const StringReadNameAsSetterName ()
 
const StringReadNameAsFieldName ()
 
void SkipFlags ()
 
void SkipStringReference ()
 
void SkipConstantReference ()
 
void SkipCanonicalNameReference ()
 
void SkipInterfaceMemberNameReference ()
 
void SkipDartType ()
 
void SkipOptionalDartType ()
 
void SkipInterfaceType (bool simple)
 
void SkipFunctionType (bool simple)
 
void SkipStatementList ()
 
void SkipListOfExpressions ()
 
void SkipListOfNamedExpressions ()
 
void SkipListOfDartTypes ()
 
void SkipListOfStrings ()
 
void SkipListOfVariableDeclarations ()
 
void SkipListOfCanonicalNameReferences ()
 
void SkipTypeParametersList ()
 
void SkipInitializer ()
 
void SkipExpression ()
 
void SkipStatement ()
 
void SkipFunctionNode ()
 
void SkipName ()
 
void SkipArguments ()
 
void SkipVariableDeclaration ()
 
void SkipLibraryCombinator ()
 
void SkipLibraryDependency ()
 
TokenPosition ReadPosition ()
 
Tag ReadTag (uint8_t *payload=nullptr)
 
uint8_t ReadFlags ()
 
Nullability ReadNullability ()
 
Variance ReadVariance ()
 
intptr_t SourceTableSize ()
 
intptr_t GetOffsetForSourceInfo (intptr_t index)
 
StringSourceTableUriFor (intptr_t index)
 
const StringGetSourceFor (intptr_t index)
 
TypedDataPtr GetLineStartsFor (intptr_t index)
 
StringSourceTableImportUriFor (intptr_t index)
 
TypedDataViewPtr GetConstantCoverageFor (intptr_t index)
 

Protected Attributes

Zonezone_
 
TranslationHelpertranslation_helper_
 
Reader reader_
 
intptr_t data_program_offset_
 

Friends

class ClassHelper
 
class CallSiteAttributesMetadataHelper
 
class ConstantReader
 
class ConstantHelper
 
class ConstructorHelper
 
class DirectCallMetadataHelper
 
class FieldHelper
 
class FunctionNodeHelper
 
class InferredTypeMetadataHelper
 
class KernelLoader
 
class LibraryDependencyHelper
 
class LibraryHelper
 
class MetadataHelper
 
class ProcedureAttributesMetadataHelper
 
class ProcedureHelper
 
class SimpleExpressionConverter
 
class ScopeBuilder
 
class TableSelectorMetadataHelper
 
class TypeParameterHelper
 
class TypeTranslator
 
class UnboxingInfoMetadataHelper
 
class VariableDeclarationHelper
 
class ObfuscationProhibitionsMetadataHelper
 
class LoadingUnitsMetadataHelper
 
bool NeedsDynamicInvocationForwarder (const Function &function)
 
ArrayPtr CollectConstConstructorCoverageFrom (const Script &interesting_script)
 

Detailed Description

Definition at line 1264 of file kernel_translation_helper.h.

Constructor & Destructor Documentation

◆ KernelReaderHelper()

dart::kernel::KernelReaderHelper::KernelReaderHelper ( Zone zone,
TranslationHelper translation_helper,
const TypedDataBase data,
intptr_t  data_program_offset 
)
inline

Definition at line 1266 of file kernel_translation_helper.h.

1270 : zone_(zone),
1271 translation_helper_(*translation_helper),
1272 reader_(data),
1273 data_program_offset_(data_program_offset) {}
static int8_t data[kExtLength]

◆ ~KernelReaderHelper()

virtual dart::kernel::KernelReaderHelper::~KernelReaderHelper ( )
virtualdefault

Member Function Documentation

◆ GetConstantCoverageFor()

TypedDataViewPtr dart::kernel::KernelReaderHelper::GetConstantCoverageFor ( intptr_t  index)
protected

Definition at line 3179 of file kernel_translation_helper.cc.

3179 {
3180 AlternativeReadingScope alt(&reader_);
3182 SkipBytes(ReadUInt()); // skip uri.
3183 SkipBytes(ReadUInt()); // skip source.
3184 const intptr_t line_start_count = ReadUInt(); // read number of line start
3185 // entries.
3186 for (intptr_t i = 0; i < line_start_count; ++i) {
3187 ReadUInt();
3188 }
3189
3190 SkipBytes(ReadUInt()); // skip import uri.
3191
3192 intptr_t start_offset = ReaderOffset();
3193
3194 // Read past "constant coverage constructors".
3195 const intptr_t constant_coverage_constructors = ReadUInt();
3196 for (intptr_t i = 0; i < constant_coverage_constructors; ++i) {
3197 ReadUInt();
3198 }
3199
3200 intptr_t end_offset = ReaderOffset();
3201
3202 return reader_.ViewFromTo(start_offset, end_offset);
3203}
TypedDataViewPtr ViewFromTo(intptr_t start, intptr_t end)

◆ GetLineStartsFor()

TypedDataPtr dart::kernel::KernelReaderHelper::GetLineStartsFor ( intptr_t  index)
protected

Definition at line 3153 of file kernel_translation_helper.cc.

3153 {
3154 // Line starts are delta encoded. So get the max delta first so that we
3155 // can store them as tightly as possible.
3156 AlternativeReadingScope alt(&reader_);
3158 SkipBytes(ReadUInt()); // skip uri.
3159 SkipBytes(ReadUInt()); // skip source.
3160 const intptr_t line_start_count = ReadUInt();
3161 return reader_.ReadLineStartsData(line_start_count);
3162}
TypedDataPtr ReadLineStartsData(intptr_t line_start_count)

◆ GetOffsetForSourceInfo()

intptr_t dart::kernel::KernelReaderHelper::GetOffsetForSourceInfo ( intptr_t  index)
protected

Definition at line 3113 of file kernel_translation_helper.cc.

3113 {
3114 AlternativeReadingScope alt(&reader_);
3115 intptr_t library_count = reader_.ReadFromIndexNoReset(
3117
3118 const intptr_t count_from_first_library_offset =
3120
3121 intptr_t source_table_offset = reader_.ReadFromIndexNoReset(
3122 reader_.size(),
3123 LibraryCountFieldCountFromEnd + 1 + library_count + 1 +
3124 count_from_first_library_offset,
3125 1, 0);
3126 intptr_t next_field_offset = reader_.ReadUInt32();
3127 SetOffset(source_table_offset);
3128 intptr_t size = reader_.ReadUInt32(); // read source table size.
3129
3130 return reader_.ReadFromIndexNoReset(next_field_offset, 0, size, index);
3131}
uint32_t ReadFromIndexNoReset(intptr_t end_offset, intptr_t fields_before, intptr_t list_size, intptr_t list_index)
intptr_t size() const
static constexpr int SourceTableFieldCountFromFirstLibraryOffset
static constexpr int LibraryCountFieldCountFromEnd
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

◆ GetSourceFor()

const String & dart::kernel::KernelReaderHelper::GetSourceFor ( intptr_t  index)
protected

Definition at line 3140 of file kernel_translation_helper.cc.

3140 {
3141 AlternativeReadingScope alt(&reader_);
3143 SkipBytes(ReadUInt()); // skip uri.
3144 intptr_t size = ReadUInt(); // read source List<byte> size.
3145 ASSERT(size >= 0);
3146 if (size == 0) {
3147 return Symbols::Empty();
3148 } else {
3149 return H.DartString(reader_.BufferAt(ReaderOffset()), size, Heap::kOld);
3150 }
3151}
@ kOld
Definition: heap.h:39
static const String & Empty()
Definition: symbols.h:688
const uint8_t * BufferAt(intptr_t offset)
#define ASSERT(E)
Definition: SkMD5.cpp:130

◆ PeekListLength()

uint32_t dart::kernel::KernelReaderHelper::PeekListLength ( )
protected

Definition at line 2206 of file kernel_translation_helper.cc.

2206 {
2207 AlternativeReadingScope alt(&reader_);
2208 return reader_.ReadListLength();
2209}
intptr_t ReadListLength()

◆ PeekTag()

Tag dart::kernel::KernelReaderHelper::PeekTag ( uint8_t *  payload = nullptr)

Definition at line 1296 of file kernel_binary_flowgraph.cc.

1296 {
1297 return reader_.PeekTag(payload);
1298}
Tag PeekTag(uint8_t *payload=nullptr)

◆ PeekUInt()

uint32_t dart::kernel::KernelReaderHelper::PeekUInt ( )
protected

Definition at line 2197 of file kernel_translation_helper.cc.

2197 {
2198 AlternativeReadingScope alt(&reader_);
2199 return reader_.ReadUInt();
2200}

◆ ReadBool()

bool dart::kernel::KernelReaderHelper::ReadBool ( )
protected

Definition at line 2181 of file kernel_translation_helper.cc.

2181 {
2182 return reader_.ReadBool();
2183}

◆ ReadByte()

uint8_t dart::kernel::KernelReaderHelper::ReadByte ( )
protected

Definition at line 2185 of file kernel_translation_helper.cc.

2185 {
2186 return reader_.ReadByte();
2187}

◆ ReadCanonicalNameReference()

NameIndex dart::kernel::KernelReaderHelper::ReadCanonicalNameReference ( )

Definition at line 2219 of file kernel_translation_helper.cc.

2219 {
2221}
NameIndex ReadCanonicalNameReference()

◆ ReadDouble()

double dart::kernel::KernelReaderHelper::ReadDouble ( )
protected

Definition at line 2202 of file kernel_translation_helper.cc.

2202 {
2203 return reader_.ReadDouble();
2204}

◆ ReaderOffset()

intptr_t dart::kernel::KernelReaderHelper::ReaderOffset ( ) const
protected

Definition at line 2165 of file kernel_translation_helper.cc.

2165 {
2166 return reader_.offset();
2167}
intptr_t offset() const

◆ ReaderSize()

intptr_t dart::kernel::KernelReaderHelper::ReaderSize ( ) const
protected

Definition at line 2169 of file kernel_translation_helper.cc.

2169 {
2170 return reader_.size();
2171}

◆ ReadFlags()

uint8_t dart::kernel::KernelReaderHelper::ReadFlags ( )
inlineprotected

Definition at line 1346 of file kernel_translation_helper.h.

1346{ return reader_.ReadFlags(); }

◆ ReadInterfaceMemberNameReference()

NameIndex dart::kernel::KernelReaderHelper::ReadInterfaceMemberNameReference ( )
protected

Definition at line 2223 of file kernel_translation_helper.cc.

2223 {
2224 NameIndex name_index = reader_.ReadCanonicalNameReference();
2225 NameIndex origin_name_index = reader_.ReadCanonicalNameReference();
2226 if (!FLAG_precompiled_mode && origin_name_index != NameIndex::kInvalidName) {
2227 // Reference to a skipped member signature target, return the origin target.
2228 return origin_name_index;
2229 }
2230 return name_index;
2231}
static constexpr int kInvalidName
Definition: kernel.h:21

◆ ReadListLength()

intptr_t dart::kernel::KernelReaderHelper::ReadListLength ( )

Definition at line 2211 of file kernel_translation_helper.cc.

2211 {
2212 return reader_.ReadListLength();
2213}

◆ ReadNameAsFieldName()

const String & dart::kernel::KernelReaderHelper::ReadNameAsFieldName ( )
protected

Definition at line 2274 of file kernel_translation_helper.cc.

2274 {
2275 StringIndex name_index = ReadStringReference(); // read name index.
2276 if ((H.StringSize(name_index) >= 1) && H.CharacterAt(name_index, 0) == '_') {
2277 NameIndex library_reference =
2278 ReadCanonicalNameReference(); // read library index.
2279 return H.DartFieldName(library_reference, name_index);
2280 } else {
2281 return H.DartFieldName(NameIndex(), name_index);
2282 }
2283}

◆ ReadNameAsGetterName()

const String & dart::kernel::KernelReaderHelper::ReadNameAsGetterName ( )
protected

Definition at line 2263 of file kernel_translation_helper.cc.

2263 {
2264 StringIndex name_index = ReadStringReference(); // read name index.
2265 if ((H.StringSize(name_index) >= 1) && H.CharacterAt(name_index, 0) == '_') {
2266 NameIndex library_reference =
2267 ReadCanonicalNameReference(); // read library index.
2268 return H.DartGetterName(library_reference, name_index);
2269 } else {
2270 return H.DartGetterName(NameIndex(), name_index);
2271 }
2272}

◆ ReadNameAsMethodName()

const String & dart::kernel::KernelReaderHelper::ReadNameAsMethodName ( )
protected

Definition at line 2241 of file kernel_translation_helper.cc.

2241 {
2242 StringIndex name_index = ReadStringReference(); // read name index.
2243 if ((H.StringSize(name_index) >= 1) && H.CharacterAt(name_index, 0) == '_') {
2244 NameIndex library_reference =
2245 ReadCanonicalNameReference(); // read library index.
2246 return H.DartMethodName(library_reference, name_index);
2247 } else {
2248 return H.DartMethodName(NameIndex(), name_index);
2249 }
2250}

◆ ReadNameAsSetterName()

const String & dart::kernel::KernelReaderHelper::ReadNameAsSetterName ( )
protected

Definition at line 2252 of file kernel_translation_helper.cc.

2252 {
2253 StringIndex name_index = ReadStringReference(); // read name index.
2254 if ((H.StringSize(name_index) >= 1) && H.CharacterAt(name_index, 0) == '_') {
2255 NameIndex library_reference =
2256 ReadCanonicalNameReference(); // read library index.
2257 return H.DartSetterName(library_reference, name_index);
2258 } else {
2259 return H.DartSetterName(NameIndex(), name_index);
2260 }
2261}

◆ ReadNameAsStringIndex()

StringIndex dart::kernel::KernelReaderHelper::ReadNameAsStringIndex ( )
protected

Definition at line 2233 of file kernel_translation_helper.cc.

2233 {
2234 StringIndex name_index = ReadStringReference(); // read name index.
2235 if ((H.StringSize(name_index) >= 1) && H.CharacterAt(name_index, 0) == '_') {
2236 ReadUInt(); // read library index.
2237 }
2238 return name_index;
2239}

◆ ReadNullability()

Nullability dart::kernel::KernelReaderHelper::ReadNullability ( )
protected

Definition at line 1300 of file kernel_binary_flowgraph.cc.

1300 {
1301 return reader_.ReadNullability();
1302}
Nullability ReadNullability()

◆ ReadPosition()

TokenPosition dart::kernel::KernelReaderHelper::ReadPosition ( )
protected

Definition at line 3090 of file kernel_translation_helper.cc.

3090 {
3091 TokenPosition position = reader_.ReadPosition();
3092 RecordTokenPosition(position);
3093 return position;
3094}
virtual void RecordTokenPosition(TokenPosition position)
TokenPosition ReadPosition()

◆ ReadStringReference()

StringIndex dart::kernel::KernelReaderHelper::ReadStringReference ( )
protected

Definition at line 2215 of file kernel_translation_helper.cc.

2215 {
2216 return StringIndex(ReadUInt());
2217}

◆ ReadTag()

Tag dart::kernel::KernelReaderHelper::ReadTag ( uint8_t *  payload = nullptr)
protected

Definition at line 1292 of file kernel_binary_flowgraph.cc.

1292 {
1293 return reader_.ReadTag(payload);
1294}
Tag ReadTag(uint8_t *payload=nullptr)

◆ ReadUInt()

uint32_t dart::kernel::KernelReaderHelper::ReadUInt ( )
protected

Definition at line 2189 of file kernel_translation_helper.cc.

2189 {
2190 return reader_.ReadUInt();
2191}

◆ ReadUInt32()

uint32_t dart::kernel::KernelReaderHelper::ReadUInt32 ( )
protected

Definition at line 2193 of file kernel_translation_helper.cc.

2193 {
2194 return reader_.ReadUInt32();
2195}

◆ ReadUntilFunctionNode()

void dart::kernel::KernelReaderHelper::ReadUntilFunctionNode ( )

Definition at line 2311 of file kernel_translation_helper.cc.

2311 {
2312 const Tag tag = PeekTag();
2313 switch (tag) {
2314 case kProcedure: {
2315 ProcedureHelper procedure_helper(this);
2316 procedure_helper.ReadUntilExcluding(ProcedureHelper::kFunction);
2317 // Now at start of FunctionNode.
2318 break;
2319 }
2320 case kConstructor: {
2321 ConstructorHelper constructor_helper(this);
2322 constructor_helper.ReadUntilExcluding(ConstructorHelper::kFunction);
2323 // Now at start of FunctionNode.
2324 // Notice that we also have a list of initializers after that!
2325 break;
2326 }
2328 ReadTag();
2329 ReadPosition();
2331 break;
2332 case kFunctionExpression:
2333 ReadTag();
2334 ReadPosition();
2335 break;
2336 case kFunctionNode:
2337 // Already at start of FunctionNode.
2338 break;
2339 default:
2341 "a procedure, a constructor, a local function or a function node",
2342 tag);
2343 UNREACHABLE();
2344 }
2345 ASSERT(PeekTag() == kFunctionNode);
2346}
#define UNREACHABLE()
Definition: assert.h:248
Tag ReadTag(uint8_t *payload=nullptr)
virtual void ReportUnexpectedTag(const char *variant, Tag tag)
Tag PeekTag(uint8_t *payload=nullptr)

◆ ReadVariance()

Variance dart::kernel::KernelReaderHelper::ReadVariance ( )
protected

Definition at line 1304 of file kernel_binary_flowgraph.cc.

1304 {
1305 return reader_.ReadVariance();
1306}

◆ RecordTokenPosition()

virtual void dart::kernel::KernelReaderHelper::RecordTokenPosition ( TokenPosition  position)
inlineprotectedvirtual

Reimplemented in dart::kernel::KernelTokenPositionCollector.

Definition at line 1295 of file kernel_translation_helper.h.

1295 {
1296 // Do nothing by default.
1297 // This is overridden in KernelTokenPositionCollector.
1298 USE(position);
1299 }
static void USE(T &&)
Definition: globals.h:618

◆ ReportUnexpectedTag()

void dart::kernel::KernelReaderHelper::ReportUnexpectedTag ( const char *  variant,
Tag  tag 
)
virtual

Reimplemented in dart::kernel::StreamingFlowGraphBuilder.

Definition at line 2306 of file kernel_translation_helper.cc.

2306 {
2307 FATAL("Unexpected tag %d (%s) in ?, expected %s", tag, Reader::TagName(tag),
2308 variant);
2309}
static const char * TagName(Tag tag)
#define FATAL(error)

◆ set_current_script_id()

virtual void dart::kernel::KernelReaderHelper::set_current_script_id ( intptr_t  id)
inlineprotectedvirtual

Reimplemented in dart::kernel::KernelTokenPositionCollector.

Definition at line 1289 of file kernel_translation_helper.h.

1289 {
1290 // Do nothing by default.
1291 // This is overridden in KernelTokenPositionCollector.
1292 USE(id);
1293 }

◆ SetOffset()

void dart::kernel::KernelReaderHelper::SetOffset ( intptr_t  offset)

Definition at line 2173 of file kernel_translation_helper.cc.

2173 {
2175}
void set_offset(intptr_t offset)
SeparatedVector2 offset

◆ SkipArguments()

void dart::kernel::KernelReaderHelper::SkipArguments ( )
protected

Definition at line 3057 of file kernel_translation_helper.cc.

3057 {
3058 ReadUInt(); // read argument count.
3059
3060 SkipListOfDartTypes(); // read list of types.
3061 SkipListOfExpressions(); // read positional.
3062 SkipListOfNamedExpressions(); // read named.
3063}

◆ SkipBytes()

void dart::kernel::KernelReaderHelper::SkipBytes ( intptr_t  skip)
protected

Definition at line 2177 of file kernel_translation_helper.cc.

2177 {
2178 reader_.set_offset(ReaderOffset() + bytes);
2179}

◆ SkipCanonicalNameReference()

void dart::kernel::KernelReaderHelper::SkipCanonicalNameReference ( )
protected

Definition at line 2297 of file kernel_translation_helper.cc.

2297 {
2298 ReadUInt();
2299}

◆ SkipConstantReference()

void dart::kernel::KernelReaderHelper::SkipConstantReference ( )
protected

Definition at line 2293 of file kernel_translation_helper.cc.

2293 {
2294 ReadUInt();
2295}

◆ SkipDartType()

void dart::kernel::KernelReaderHelper::SkipDartType ( )
protected

Definition at line 2348 of file kernel_translation_helper.cc.

2348 {
2349 Tag tag = ReadTag();
2350 switch (tag) {
2351 case kInvalidType:
2352 case kDynamicType:
2353 case kVoidType:
2354 case kNullType:
2355 // those contain nothing.
2356 return;
2357 case kNeverType:
2359 return;
2360 case kInterfaceType:
2361 SkipInterfaceType(false);
2362 return;
2363 case kSimpleInterfaceType:
2364 SkipInterfaceType(true);
2365 return;
2366 case kFunctionType:
2367 SkipFunctionType(false);
2368 return;
2369 case kSimpleFunctionType:
2370 SkipFunctionType(true);
2371 return;
2372 case kRecordType: {
2375 const intptr_t named_count = ReadListLength();
2376 for (intptr_t i = 0; i < named_count; ++i) {
2378 SkipDartType();
2379 ReadFlags();
2380 }
2381 return;
2382 }
2383 case kExtensionType: {
2385 SkipCanonicalNameReference(); // read index for canonical name.
2386 SkipListOfDartTypes(); // read type arguments
2387 SkipDartType(); // read type erasure.
2388 break;
2389 }
2390 case kTypedefType:
2391 ReadNullability(); // read nullability.
2392 ReadUInt(); // read index for canonical name.
2393 SkipListOfDartTypes(); // read list of types.
2394 return;
2395 case kTypeParameterType:
2396 ReadNullability(); // read nullability.
2397 ReadUInt(); // read index for parameter.
2398 return;
2399 case kIntersectionType:
2400 SkipDartType(); // read left.
2401 SkipDartType(); // read right.
2402 return;
2403 case kFutureOrType:
2405 SkipDartType(); // read type argument.
2406 break;
2407 default:
2408 ReportUnexpectedTag("type", tag);
2409 UNREACHABLE();
2410 }
2411}

◆ SkipExpression()

void dart::kernel::KernelReaderHelper::SkipExpression ( )
protected

Definition at line 2547 of file kernel_translation_helper.cc.

2547 {
2548 uint8_t payload = 0;
2549 Tag tag = ReadTag(&payload);
2550 switch (tag) {
2551 case kInvalidExpression:
2552 ReadPosition();
2554 if (ReadTag() == kSomething) {
2555 SkipExpression(); // read expression.
2556 }
2557 return;
2558 case kVariableGet:
2559 ReadPosition(); // read position.
2560 ReadUInt(); // read kernel position.
2561 ReadUInt(); // read relative variable index.
2562 SkipOptionalDartType(); // read promoted type.
2563 return;
2564 case kSpecializedVariableGet:
2565 ReadPosition(); // read position.
2566 ReadUInt(); // read kernel position.
2567 return;
2568 case kVariableSet:
2569 ReadPosition(); // read position.
2570 ReadUInt(); // read kernel position.
2571 ReadUInt(); // read relative variable index.
2572 SkipExpression(); // read expression.
2573 return;
2574 case kSpecializedVariableSet:
2575 ReadPosition(); // read position.
2576 ReadUInt(); // read kernel position.
2577 SkipExpression(); // read expression.
2578 return;
2579 case kInstanceGet:
2580 ReadByte(); // read kind.
2581 ReadPosition(); // read position.
2582 SkipExpression(); // read receiver.
2583 SkipName(); // read name.
2584 SkipDartType(); // read result_type.
2585 SkipInterfaceMemberNameReference(); // read interface_target_reference.
2586 return;
2587 case kDynamicGet:
2588 ReadByte(); // read kind.
2589 ReadPosition(); // read position.
2590 SkipExpression(); // read receiver.
2591 SkipName(); // read name.
2592 return;
2593 case kInstanceTearOff:
2594 ReadByte(); // read kind.
2595 ReadPosition(); // read position.
2596 SkipExpression(); // read receiver.
2597 SkipName(); // read name.
2598 SkipDartType(); // read result_type.
2599 SkipInterfaceMemberNameReference(); // read interface_target_reference.
2600 return;
2601 case kFunctionTearOff:
2602 // Removed by lowering kernel transformation.
2603 UNREACHABLE();
2604 break;
2605 case kInstanceSet:
2606 ReadByte(); // read kind.
2607 ReadPosition(); // read position.
2608 SkipExpression(); // read receiver.
2609 SkipName(); // read name.
2610 SkipExpression(); // read value.
2611 SkipInterfaceMemberNameReference(); // read interface_target_reference.
2612 return;
2613 case kDynamicSet:
2614 ReadByte(); // read kind.
2615 ReadPosition(); // read position.
2616 SkipExpression(); // read receiver.
2617 SkipName(); // read name.
2618 SkipExpression(); // read value.
2619 return;
2620 case kAbstractSuperPropertyGet:
2621 // Abstract super property getters must be converted into super property
2622 // getters during mixin transformation.
2623 UNREACHABLE();
2624 break;
2625 case kAbstractSuperPropertySet:
2626 // Abstract super property setters must be converted into super property
2627 // setters during mixin transformation.
2628 UNREACHABLE();
2629 break;
2630 case kSuperPropertyGet:
2631 ReadPosition(); // read position.
2632 SkipName(); // read name.
2633 SkipInterfaceMemberNameReference(); // read interface_target_reference.
2634 return;
2635 case kSuperPropertySet:
2636 ReadPosition(); // read position.
2637 SkipName(); // read name.
2638 SkipExpression(); // read value.
2639 SkipInterfaceMemberNameReference(); // read interface_target_reference.
2640 return;
2641 case kStaticGet:
2642 ReadPosition(); // read position.
2643 SkipCanonicalNameReference(); // read target_reference.
2644 return;
2645 case kStaticSet:
2646 ReadPosition(); // read position.
2647 SkipCanonicalNameReference(); // read target_reference.
2648 SkipExpression(); // read expression.
2649 return;
2650 case kInstanceInvocation:
2651 ReadByte(); // read kind.
2652 ReadFlags(); // read flags.
2653 ReadPosition(); // read position.
2654 SkipExpression(); // read receiver.
2655 SkipName(); // read name.
2656 SkipArguments(); // read arguments.
2657 SkipDartType(); // read function_type.
2658 SkipInterfaceMemberNameReference(); // read interface_target_reference.
2659 return;
2660 case kDynamicInvocation:
2661 ReadByte(); // read kind.
2662 ReadByte(); // read flags.
2663 ReadPosition(); // read position.
2664 SkipExpression(); // read receiver.
2665 SkipName(); // read name.
2666 SkipArguments(); // read arguments.
2667 return;
2668 case kLocalFunctionInvocation:
2669 ReadPosition(); // read position.
2670 ReadUInt(); // read variable kernel position.
2671 ReadUInt(); // read relative variable index.
2672 SkipArguments(); // read arguments.
2673 SkipDartType(); // read function_type.
2674 return;
2675 case kFunctionInvocation:
2676 ReadByte(); // read kind.
2677 ReadPosition(); // read position.
2678 SkipExpression(); // read receiver.
2679 SkipArguments(); // read arguments.
2680 SkipDartType(); // read function_type.
2681 return;
2682 case kEqualsCall:
2683 ReadPosition(); // read position.
2684 SkipExpression(); // read left.
2685 SkipExpression(); // read right.
2686 SkipDartType(); // read function_type.
2687 SkipInterfaceMemberNameReference(); // read interface_target_reference.
2688 return;
2689 case kEqualsNull:
2690 ReadPosition(); // read position.
2691 SkipExpression(); // read expression.
2692 return;
2693 case kAbstractSuperMethodInvocation:
2694 // Abstract super method invocations must be converted into super
2695 // method invocations during mixin transformation.
2696 UNREACHABLE();
2697 break;
2698 case kSuperMethodInvocation:
2699 ReadPosition(); // read position.
2700 SkipName(); // read name.
2701 SkipArguments(); // read arguments.
2702 SkipInterfaceMemberNameReference(); // read interface_target_reference.
2703 return;
2704 case kStaticInvocation:
2705 ReadPosition(); // read position.
2706 SkipCanonicalNameReference(); // read procedure_reference.
2707 SkipArguments(); // read arguments.
2708 return;
2709 case kConstructorInvocation:
2710 ReadPosition(); // read position.
2711 SkipCanonicalNameReference(); // read target_reference.
2712 SkipArguments(); // read arguments.
2713 return;
2714 case kNot:
2715 ReadPosition(); // read position.
2716 SkipExpression(); // read expression.
2717 return;
2718 case kNullCheck:
2719 ReadPosition(); // read position.
2720 SkipExpression(); // read expression.
2721 return;
2722 case kLogicalExpression:
2723 ReadPosition(); // read position.
2724 SkipExpression(); // read left.
2725 SkipBytes(1); // read operator.
2726 SkipExpression(); // read right.
2727 return;
2728 case kConditionalExpression:
2729 ReadPosition(); // read position.
2730 SkipExpression(); // read condition.
2731 SkipExpression(); // read then.
2732 SkipExpression(); // read otherwise.
2733 SkipOptionalDartType(); // read unused static type.
2734 return;
2735 case kStringConcatenation:
2736 ReadPosition(); // read position.
2737 SkipListOfExpressions(); // read list of expressions.
2738 return;
2739 case kIsExpression:
2740 ReadPosition(); // read position.
2741 SkipExpression(); // read operand.
2742 SkipDartType(); // read type.
2743 return;
2744 case kAsExpression:
2745 ReadPosition(); // read position.
2746 SkipFlags(); // read flags.
2747 SkipExpression(); // read operand.
2748 SkipDartType(); // read type.
2749 return;
2750 case kTypeLiteral:
2751 ReadPosition(); // read position.
2752 SkipDartType(); // read type.
2753 return;
2754 case kThisExpression:
2755 ReadPosition(); // read position.
2756 return;
2757 case kRethrow:
2758 ReadPosition(); // read position.
2759 return;
2760 case kThrow:
2761 ReadPosition(); // read position.
2762 SkipFlags(); // read flags.
2763 SkipExpression(); // read expression.
2764 return;
2765 case kListLiteral:
2766 ReadPosition(); // read position.
2767 SkipDartType(); // read type.
2768 SkipListOfExpressions(); // read list of expressions.
2769 return;
2770 case kSetLiteral:
2771 // Set literals are currently desugared in the frontend and will not
2772 // reach the VM. See http://dartbug.com/35124 for discussion.
2773 UNREACHABLE();
2774 return;
2775 case kMapLiteral: {
2776 ReadPosition(); // read position.
2777 SkipDartType(); // read key type.
2778 SkipDartType(); // read value type.
2779 intptr_t list_length = ReadListLength(); // read list length.
2780 for (intptr_t i = 0; i < list_length; ++i) {
2781 SkipExpression(); // read ith key.
2782 SkipExpression(); // read ith value.
2783 }
2784 return;
2785 }
2786 case kRecordLiteral:
2787 ReadPosition(); // read position.
2788 SkipListOfExpressions(); // read positionals.
2789 SkipListOfNamedExpressions(); // read named.
2790 SkipDartType(); // read recordType.
2791 return;
2792 case kRecordIndexGet:
2793 ReadPosition(); // read position.
2794 SkipExpression(); // read receiver.
2795 SkipDartType(); // read recordType.
2796 ReadUInt(); // read index.
2797 return;
2798 case kRecordNameGet:
2799 ReadPosition(); // read position.
2800 SkipExpression(); // read receiver.
2801 SkipDartType(); // read recordType.
2802 SkipStringReference(); // read name.
2803 return;
2804 case kFunctionExpression:
2805 ReadPosition(); // read position.
2806 SkipFunctionNode(); // read function node.
2807 return;
2808 case kLet:
2809 ReadPosition(); // read position.
2810 SkipVariableDeclaration(); // read variable declaration.
2811 SkipExpression(); // read expression.
2812 return;
2813 case kBlockExpression:
2814 ReadPosition(); // read position.
2816 SkipExpression(); // read expression.
2817 return;
2818 case kInstantiation:
2819 ReadPosition(); // read position.
2820 SkipExpression(); // read expression.
2821 SkipListOfDartTypes(); // read type arguments.
2822 return;
2823 case kBigIntLiteral:
2824 ReadPosition(); // read position.
2825 SkipStringReference(); // read string reference.
2826 return;
2827 case kStringLiteral:
2828 ReadPosition(); // read position.
2829 SkipStringReference(); // read string reference.
2830 return;
2831 case kSpecializedIntLiteral:
2832 ReadPosition(); // read position.
2833 return;
2834 case kNegativeIntLiteral:
2835 ReadPosition(); // read position.
2836 ReadUInt(); // read value.
2837 return;
2838 case kPositiveIntLiteral:
2839 ReadPosition(); // read position.
2840 ReadUInt(); // read value.
2841 return;
2842 case kDoubleLiteral:
2843 ReadPosition(); // read position.
2844 ReadDouble(); // read value.
2845 return;
2846 case kTrueLiteral:
2847 ReadPosition(); // read position.
2848 return;
2849 case kFalseLiteral:
2850 ReadPosition(); // read position.
2851 return;
2852 case kNullLiteral:
2853 ReadPosition(); // read position.
2854 return;
2855 case kConstantExpression:
2856 ReadPosition(); // read position.
2857 SkipDartType(); // read type.
2859 return;
2860 case kFileUriConstantExpression:
2861 ReadPosition(); // read position.
2862 ReadUInt(); // skip uri
2863 SkipDartType(); // read type.
2865 return;
2866 case kLoadLibrary:
2867 case kCheckLibraryIsLoaded:
2868 ReadPosition(); // read file offset.
2869 ReadUInt(); // skip library index
2870 return;
2871 case kAwaitExpression:
2872 ReadPosition(); // read position.
2873 SkipExpression(); // read operand.
2874 if (ReadTag() == kSomething) {
2875 SkipDartType(); // read runtime check type.
2876 }
2877 return;
2878 case kFileUriExpression:
2879 ReadUInt(); // skip uri
2880 ReadPosition(); // read position
2881 SkipExpression(); // read expression
2882 return;
2883 case kConstStaticInvocation:
2884 case kConstConstructorInvocation:
2885 case kConstListLiteral:
2886 case kConstSetLiteral:
2887 case kConstMapLiteral:
2888 case kSymbolLiteral:
2889 case kListConcatenation:
2890 case kSetConcatenation:
2891 case kMapConcatenation:
2892 case kInstanceCreation:
2893 case kStaticTearOff:
2894 case kSwitchExpression:
2895 case kPatternAssignment:
2896 // These nodes are internal to the front end and
2897 // removed by the constant evaluator.
2898 default:
2899 ReportUnexpectedTag("expression", tag);
2900 UNREACHABLE();
2901 }
2902}

◆ SkipFlags()

void dart::kernel::KernelReaderHelper::SkipFlags ( )
protected

Definition at line 2285 of file kernel_translation_helper.cc.

2285 {
2286 ReadFlags();
2287}

◆ SkipFunctionNode()

void dart::kernel::KernelReaderHelper::SkipFunctionNode ( )
protected

Definition at line 3045 of file kernel_translation_helper.cc.

3045 {
3046 FunctionNodeHelper function_node_helper(this);
3047 function_node_helper.ReadUntilExcluding(FunctionNodeHelper::kEnd);
3048}

◆ SkipFunctionType()

void dart::kernel::KernelReaderHelper::SkipFunctionType ( bool  simple)
protected

Definition at line 2431 of file kernel_translation_helper.cc.

2431 {
2432 ReadNullability(); // read nullability.
2433
2434 if (!simple) {
2435 SkipTypeParametersList(); // read type_parameters.
2436 ReadUInt(); // read required parameter count.
2437 ReadUInt(); // read total parameter count.
2438 }
2439
2440 SkipListOfDartTypes(); // read positional_parameters types.
2441
2442 if (!simple) {
2443 const intptr_t named_count =
2444 ReadListLength(); // read named_parameters list length.
2445 for (intptr_t i = 0; i < named_count; ++i) {
2446 // read string reference (i.e. named_parameters[i].name).
2448 SkipDartType(); // read named_parameters[i].type.
2449 SkipBytes(1); // read flags
2450 }
2451 }
2452
2453 SkipDartType(); // read return type.
2454}

◆ SkipInitializer()

void dart::kernel::KernelReaderHelper::SkipInitializer ( )
protected

Definition at line 2514 of file kernel_translation_helper.cc.

2514 {
2515 Tag tag = ReadTag();
2516 ReadByte(); // read isSynthetic flag.
2517 switch (tag) {
2518 case kInvalidInitializer:
2519 return;
2520 case kFieldInitializer:
2521 ReadPosition(); // read position.
2522 SkipCanonicalNameReference(); // read field_reference.
2523 SkipExpression(); // read value.
2524 return;
2525 case kSuperInitializer:
2526 ReadPosition(); // read position.
2527 SkipCanonicalNameReference(); // read target_reference.
2528 SkipArguments(); // read arguments.
2529 return;
2530 case kRedirectingInitializer:
2531 ReadPosition(); // read position.
2532 SkipCanonicalNameReference(); // read target_reference.
2533 SkipArguments(); // read arguments.
2534 return;
2535 case kLocalInitializer:
2536 SkipVariableDeclaration(); // read variable.
2537 return;
2538 case kAssertInitializer:
2539 SkipStatement();
2540 return;
2541 default:
2542 ReportUnexpectedTag("initializer", tag);
2543 UNREACHABLE();
2544 }
2545}

◆ SkipInterfaceMemberNameReference()

void dart::kernel::KernelReaderHelper::SkipInterfaceMemberNameReference ( )
protected

Definition at line 2301 of file kernel_translation_helper.cc.

◆ SkipInterfaceType()

void dart::kernel::KernelReaderHelper::SkipInterfaceType ( bool  simple)
protected

Definition at line 2423 of file kernel_translation_helper.cc.

2423 {
2424 ReadNullability(); // read nullability.
2425 ReadUInt(); // read klass_name.
2426 if (!simple) {
2427 SkipListOfDartTypes(); // read list of types.
2428 }
2429}

◆ SkipLibraryCombinator()

void dart::kernel::KernelReaderHelper::SkipLibraryCombinator ( )
protected

Definition at line 3070 of file kernel_translation_helper.cc.

3070 {
3071 ReadBool(); // read is_show.
3072 intptr_t name_count = ReadUInt(); // read list length.
3073 for (intptr_t j = 0; j < name_count; ++j) {
3074 ReadUInt(); // read ith entry of name_indices.
3075 }
3076}

◆ SkipLibraryDependency()

void dart::kernel::KernelReaderHelper::SkipLibraryDependency ( )
protected

Definition at line 3078 of file kernel_translation_helper.cc.

3078 {
3079 ReadPosition(); // read file offset.
3080 ReadFlags();
3081 SkipListOfExpressions(); // Annotations.
3083 ReadStringReference(); // Name.
3084 intptr_t combinator_count = ReadListLength();
3085 for (intptr_t i = 0; i < combinator_count; ++i) {
3087 }
3088}

◆ SkipListOfCanonicalNameReferences()

void dart::kernel::KernelReaderHelper::SkipListOfCanonicalNameReferences ( )
protected

Definition at line 2499 of file kernel_translation_helper.cc.

2499 {
2500 intptr_t list_length = ReadListLength(); // read list length.
2501 for (intptr_t i = 0; i < list_length; ++i) {
2503 }
2504}

◆ SkipListOfDartTypes()

void dart::kernel::KernelReaderHelper::SkipListOfDartTypes ( )
protected

Definition at line 2478 of file kernel_translation_helper.cc.

2478 {
2479 intptr_t list_length = ReadListLength(); // read list length.
2480 for (intptr_t i = 0; i < list_length; ++i) {
2481 SkipDartType(); // read ith type.
2482 }
2483}

◆ SkipListOfExpressions()

void dart::kernel::KernelReaderHelper::SkipListOfExpressions ( )
protected

Definition at line 2463 of file kernel_translation_helper.cc.

2463 {
2464 intptr_t list_length = ReadListLength(); // read list length.
2465 for (intptr_t i = 0; i < list_length; ++i) {
2466 SkipExpression(); // read ith expression.
2467 }
2468}

◆ SkipListOfNamedExpressions()

void dart::kernel::KernelReaderHelper::SkipListOfNamedExpressions ( )
protected

Definition at line 2470 of file kernel_translation_helper.cc.

2470 {
2471 const intptr_t list_length = ReadListLength(); // read list length.
2472 for (intptr_t i = 0; i < list_length; ++i) {
2473 SkipStringReference(); // read ith name index.
2474 SkipExpression(); // read ith expression.
2475 }
2476}

◆ SkipListOfStrings()

void dart::kernel::KernelReaderHelper::SkipListOfStrings ( )
protected

Definition at line 2485 of file kernel_translation_helper.cc.

2485 {
2486 intptr_t list_length = ReadListLength(); // read list length.
2487 for (intptr_t i = 0; i < list_length; ++i) {
2488 SkipStringReference(); // read ith string index.
2489 }
2490}

◆ SkipListOfVariableDeclarations()

void dart::kernel::KernelReaderHelper::SkipListOfVariableDeclarations ( )
protected

Definition at line 2492 of file kernel_translation_helper.cc.

2492 {
2493 intptr_t list_length = ReadListLength(); // read list length.
2494 for (intptr_t i = 0; i < list_length; ++i) {
2495 SkipVariableDeclaration(); // read ith variable declaration.
2496 }
2497}

◆ SkipName()

void dart::kernel::KernelReaderHelper::SkipName ( )
protected

Definition at line 3050 of file kernel_translation_helper.cc.

3050 {
3051 StringIndex name_index = ReadStringReference(); // read name index.
3052 if ((H.StringSize(name_index) >= 1) && H.CharacterAt(name_index, 0) == '_') {
3053 SkipCanonicalNameReference(); // read library index.
3054 }
3055}

◆ SkipOptionalDartType()

void dart::kernel::KernelReaderHelper::SkipOptionalDartType ( )
protected

Definition at line 2413 of file kernel_translation_helper.cc.

2413 {
2414 Tag tag = ReadTag(); // read tag.
2415 if (tag == kNothing) {
2416 return;
2417 }
2418 ASSERT(tag == kSomething);
2419
2420 SkipDartType(); // read type.
2421}

◆ SkipStatement()

void dart::kernel::KernelReaderHelper::SkipStatement ( )
protected

Definition at line 2904 of file kernel_translation_helper.cc.

2904 {
2905 Tag tag = ReadTag(); // read tag.
2906 switch (tag) {
2907 case kExpressionStatement:
2908 SkipExpression(); // read expression.
2909 return;
2910 case kBlock:
2911 ReadPosition(); // read file offset.
2912 ReadPosition(); // read file end offset.
2914 return;
2915 case kEmptyStatement:
2916 return;
2917 case kAssertBlock:
2919 return;
2920 case kAssertStatement:
2921 SkipExpression(); // Read condition.
2922 ReadPosition(); // read condition start offset.
2923 ReadPosition(); // read condition end offset.
2924 if (ReadTag() == kSomething) {
2925 SkipExpression(); // read (rest of) message.
2926 }
2927 return;
2928 case kLabeledStatement:
2929 ReadPosition(); // read position.
2930 SkipStatement(); // read body.
2931 return;
2932 case kBreakStatement:
2933 ReadPosition(); // read position.
2934 ReadUInt(); // read target_index.
2935 return;
2936 case kWhileStatement:
2937 ReadPosition(); // read position.
2938 SkipExpression(); // read condition.
2939 SkipStatement(); // read body.
2940 return;
2941 case kDoStatement:
2942 ReadPosition(); // read position.
2943 SkipStatement(); // read body.
2944 SkipExpression(); // read condition.
2945 return;
2946 case kForStatement: {
2947 ReadPosition(); // read position.
2948 SkipListOfVariableDeclarations(); // read variables.
2949 Tag tag = ReadTag(); // Read first part of condition.
2950 if (tag == kSomething) {
2951 SkipExpression(); // read rest of condition.
2952 }
2953 SkipListOfExpressions(); // read updates.
2954 SkipStatement(); // read body.
2955 return;
2956 }
2957 case kSwitchStatement: {
2958 ReadPosition(); // read position.
2959 ReadBool(); // read exhaustive flag.
2960 SkipExpression(); // read condition.
2961 SkipOptionalDartType(); // read expression type
2962 int case_count = ReadListLength(); // read number of cases.
2963 for (intptr_t i = 0; i < case_count; ++i) {
2964 ReadPosition(); // read file offset.
2965 int expression_count = ReadListLength(); // read number of expressions.
2966 for (intptr_t j = 0; j < expression_count; ++j) {
2967 ReadPosition(); // read jth position.
2968 SkipExpression(); // read jth expression.
2969 }
2970 ReadBool(); // read is_default.
2971 SkipStatement(); // read body.
2972 }
2973 return;
2974 }
2975 case kContinueSwitchStatement:
2976 ReadPosition(); // read position.
2977 ReadUInt(); // read target_index.
2978 return;
2979 case kIfStatement:
2980 ReadPosition(); // read position.
2981 SkipExpression(); // read condition.
2982 SkipStatement(); // read then.
2983 SkipStatement(); // read otherwise.
2984 return;
2985 case kReturnStatement: {
2986 ReadPosition(); // read position
2987 Tag tag = ReadTag(); // read (first part of) expression.
2988 if (tag == kSomething) {
2989 SkipExpression(); // read (rest of) expression.
2990 }
2991 return;
2992 }
2993 case kTryCatch: {
2994 ReadPosition(); // read position
2995 SkipStatement(); // read body.
2996 ReadByte(); // read flags
2997 intptr_t catch_count = ReadListLength(); // read number of catches.
2998 for (intptr_t i = 0; i < catch_count; ++i) {
2999 ReadPosition(); // read position.
3000 SkipDartType(); // read guard.
3001 tag = ReadTag(); // read first part of exception.
3002 if (tag == kSomething) {
3003 SkipVariableDeclaration(); // read exception.
3004 }
3005 tag = ReadTag(); // read first part of stack trace.
3006 if (tag == kSomething) {
3007 SkipVariableDeclaration(); // read stack trace.
3008 }
3009 SkipStatement(); // read body.
3010 }
3011 return;
3012 }
3013 case kTryFinally:
3014 ReadPosition(); // read position
3015 SkipStatement(); // read body.
3016 SkipStatement(); // read finalizer.
3017 return;
3018 case kYieldStatement: {
3019 ReadPosition(); // read position.
3020 ReadByte(); // read flags.
3021 SkipExpression(); // read expression.
3022 return;
3023 }
3024 case kVariableDeclaration:
3025 SkipVariableDeclaration(); // read variable declaration.
3026 return;
3028 ReadPosition(); // read position.
3029 SkipVariableDeclaration(); // read variable.
3030 SkipFunctionNode(); // read function node.
3031 return;
3032 case kForInStatement:
3033 case kAsyncForInStatement:
3034 case kIfCaseStatement:
3035 case kPatternSwitchStatement:
3036 case kPatternVariableDeclaration:
3037 // These nodes are internal to the front end and
3038 // removed by the constant evaluator.
3039 default:
3040 ReportUnexpectedTag("statement", tag);
3041 UNREACHABLE();
3042 }
3043}

◆ SkipStatementList()

void dart::kernel::KernelReaderHelper::SkipStatementList ( )
protected

Definition at line 2456 of file kernel_translation_helper.cc.

2456 {
2457 intptr_t list_length = ReadListLength(); // read list length.
2458 for (intptr_t i = 0; i < list_length; ++i) {
2459 SkipStatement(); // read ith expression.
2460 }
2461}

◆ SkipStringReference()

void dart::kernel::KernelReaderHelper::SkipStringReference ( )
protected

Definition at line 2289 of file kernel_translation_helper.cc.

2289 {
2290 ReadUInt();
2291}

◆ SkipTypeParametersList()

void dart::kernel::KernelReaderHelper::SkipTypeParametersList ( )
protected

Definition at line 2506 of file kernel_translation_helper.cc.

2506 {
2507 intptr_t list_length = ReadListLength(); // read list length.
2508 for (intptr_t i = 0; i < list_length; ++i) {
2509 TypeParameterHelper helper(this);
2510 helper.Finish();
2511 }
2512}

◆ SkipVariableDeclaration()

void dart::kernel::KernelReaderHelper::SkipVariableDeclaration ( )
protected

◆ SourceTableImportUriFor()

String & dart::kernel::KernelReaderHelper::SourceTableImportUriFor ( intptr_t  index)
protected

Definition at line 3164 of file kernel_translation_helper.cc.

3164 {
3165 AlternativeReadingScope alt(&reader_);
3167 SkipBytes(ReadUInt()); // skip uri.
3168 SkipBytes(ReadUInt()); // skip source.
3169 const intptr_t line_start_count = ReadUInt(); // read number of line start
3170 // entries.
3171 for (intptr_t i = 0; i < line_start_count; ++i) {
3172 ReadUInt();
3173 }
3174
3175 intptr_t size = ReadUInt(); // read import uri List<byte> size.
3176 return H.DartString(reader_.BufferAt(ReaderOffset()), size, Heap::kOld);
3177}

◆ SourceTableSize()

intptr_t dart::kernel::KernelReaderHelper::SourceTableSize ( )
protected

Definition at line 3096 of file kernel_translation_helper.cc.

3096 {
3097 AlternativeReadingScope alt(&reader_);
3098 intptr_t library_count = reader_.ReadFromIndexNoReset(
3100
3101 const intptr_t count_from_first_library_offset =
3103
3104 intptr_t source_table_offset = reader_.ReadFromIndexNoReset(
3105 reader_.size(),
3106 LibraryCountFieldCountFromEnd + 1 + library_count + 1 +
3107 count_from_first_library_offset,
3108 1, 0);
3109 SetOffset(source_table_offset); // read source table offset.
3110 return reader_.ReadUInt32(); // read source table size.
3111}

◆ SourceTableUriFor()

String & dart::kernel::KernelReaderHelper::SourceTableUriFor ( intptr_t  index)
protected

Definition at line 3133 of file kernel_translation_helper.cc.

3133 {
3134 AlternativeReadingScope alt(&reader_);
3136 intptr_t size = ReadUInt(); // read uri List<byte> size.
3137 return H.DartString(reader_.BufferAt(ReaderOffset()), size, Heap::kOld);
3138}

Friends And Related Function Documentation

◆ CallSiteAttributesMetadataHelper

friend class CallSiteAttributesMetadataHelper
friend

Definition at line 1370 of file kernel_translation_helper.h.

◆ ClassHelper

friend class ClassHelper
friend

Definition at line 1369 of file kernel_translation_helper.h.

◆ CollectConstConstructorCoverageFrom

ArrayPtr CollectConstConstructorCoverageFrom ( const Script interesting_script)
friend

◆ ConstantHelper

friend class ConstantHelper
friend

Definition at line 1372 of file kernel_translation_helper.h.

◆ ConstantReader

friend class ConstantReader
friend

Definition at line 1371 of file kernel_translation_helper.h.

◆ ConstructorHelper

friend class ConstructorHelper
friend

Definition at line 1373 of file kernel_translation_helper.h.

◆ DirectCallMetadataHelper

friend class DirectCallMetadataHelper
friend

Definition at line 1374 of file kernel_translation_helper.h.

◆ FieldHelper

friend class FieldHelper
friend

Definition at line 1375 of file kernel_translation_helper.h.

◆ FunctionNodeHelper

friend class FunctionNodeHelper
friend

Definition at line 1376 of file kernel_translation_helper.h.

◆ InferredTypeMetadataHelper

friend class InferredTypeMetadataHelper
friend

Definition at line 1377 of file kernel_translation_helper.h.

◆ KernelLoader

friend class KernelLoader
friend

Definition at line 1378 of file kernel_translation_helper.h.

◆ LibraryDependencyHelper

friend class LibraryDependencyHelper
friend

Definition at line 1379 of file kernel_translation_helper.h.

◆ LibraryHelper

friend class LibraryHelper
friend

Definition at line 1380 of file kernel_translation_helper.h.

◆ LoadingUnitsMetadataHelper

friend class LoadingUnitsMetadataHelper
friend

Definition at line 1392 of file kernel_translation_helper.h.

◆ MetadataHelper

friend class MetadataHelper
friend

Definition at line 1381 of file kernel_translation_helper.h.

◆ NeedsDynamicInvocationForwarder

bool NeedsDynamicInvocationForwarder ( const Function function)
friend

Definition at line 657 of file kernel.cc.

657 {
658 Zone* zone = Thread::Current()->zone();
659
660 // Right now closures do not need a dyn:* forwarder.
661 // See https://github.com/dart-lang/sdk/issues/40813
662 if (function.IsClosureFunction()) return false;
663
664 // Method extractors have no parameters to check and return value is a closure
665 // and therefore not an unboxed primitive type.
666 if (function.IsMethodExtractor()) {
667 return false;
668 }
669
670 // Record field getters have no parameters to check and 'dynamic' return type.
671 if (function.IsRecordFieldGetter()) {
672 return false;
673 }
674
675 // Invoke field dispatchers are dynamically generated, will invoke a getter to
676 // obtain the field value and then invoke ".call()" on the result.
677 // Those dynamically generated dispathers don't have proper kernel metadata
678 // associated with them - we can therefore not query if there are dynamic
679 // calls to them or not and are therefore conservative.
680 if (function.IsInvokeFieldDispatcher()) {
681 return true;
682 }
683
684 // The dyn:* forwarders perform unboxing of parameters before calling the
685 // actual target (which accepts unboxed parameters) and boxes return values
686 // of the return value.
687 if (function.HasUnboxedParameters() || function.HasUnboxedReturnValue()) {
688 return true;
689 }
690
691 if (function.MaxNumberOfParametersInRegisters(zone) > 0) {
692 return true;
693 }
694
695 // There are no parameters to type check for getters and if the return value
696 // is boxed, then the dyn:* forwarder is not needed.
697 if (function.IsImplicitGetterFunction()) {
698 return false;
699 }
700
701 // Covariant parameters (both explicitly covariant and generic-covariant-impl)
702 // are checked in the body of a function and therefore don't need checks in a
703 // dynamic invocation forwarder. So dynamic invocation forwarder is only
704 // needed if there are non-covariant parameters of non-top type.
705 if (function.IsImplicitSetterFunction()) {
706 const auto& field = Field::Handle(zone, function.accessor_field());
707 return !(field.is_covariant() || field.is_generic_covariant_impl());
708 }
709
710 const auto& type_params =
711 TypeParameters::Handle(zone, function.type_parameters());
712 if (!type_params.IsNull()) {
713 auto& bound = AbstractType::Handle(zone);
714 for (intptr_t i = 0, n = type_params.Length(); i < n; ++i) {
715 bound = type_params.BoundAt(i);
716 if (!bound.IsTopTypeForSubtyping() &&
717 !type_params.IsGenericCovariantImplAt(i)) {
718 return true;
719 }
720 }
721 }
722
723 const intptr_t num_params = function.NumParameters();
724 BitVector is_covariant(zone, num_params);
725 BitVector is_generic_covariant_impl(zone, num_params);
726 ReadParameterCovariance(function, &is_covariant, &is_generic_covariant_impl);
727
728 auto& type = AbstractType::Handle(zone);
729 for (intptr_t i = function.NumImplicitParameters(); i < num_params; ++i) {
730 type = function.ParameterTypeAt(i);
731 if (!type.IsTopTypeForSubtyping() &&
732 !is_generic_covariant_impl.Contains(i) && !is_covariant.Contains(i)) {
733 return true;
734 }
735 }
736
737 return false;
738}
GLenum type
static Object & Handle()
Definition: object.h:407
Zone * zone() const
Definition: thread_state.h:37
static Thread * Current()
Definition: thread.h:362
Dart_NativeFunction function
Definition: fuchsia.cc:51
void ReadParameterCovariance(const Function &function, BitVector *is_covariant, BitVector *is_generic_covariant_impl)
Definition: kernel.cc:599

◆ ObfuscationProhibitionsMetadataHelper

Definition at line 1391 of file kernel_translation_helper.h.

◆ ProcedureAttributesMetadataHelper

friend class ProcedureAttributesMetadataHelper
friend

Definition at line 1382 of file kernel_translation_helper.h.

◆ ProcedureHelper

friend class ProcedureHelper
friend

Definition at line 1383 of file kernel_translation_helper.h.

◆ ScopeBuilder

friend class ScopeBuilder
friend

Definition at line 1385 of file kernel_translation_helper.h.

◆ SimpleExpressionConverter

friend class SimpleExpressionConverter
friend

Definition at line 1384 of file kernel_translation_helper.h.

◆ TableSelectorMetadataHelper

friend class TableSelectorMetadataHelper
friend

Definition at line 1386 of file kernel_translation_helper.h.

◆ TypeParameterHelper

friend class TypeParameterHelper
friend

Definition at line 1387 of file kernel_translation_helper.h.

◆ TypeTranslator

friend class TypeTranslator
friend

Definition at line 1388 of file kernel_translation_helper.h.

◆ UnboxingInfoMetadataHelper

friend class UnboxingInfoMetadataHelper
friend

Definition at line 1389 of file kernel_translation_helper.h.

◆ VariableDeclarationHelper

friend class VariableDeclarationHelper
friend

Definition at line 1390 of file kernel_translation_helper.h.

Member Data Documentation

◆ data_program_offset_

intptr_t dart::kernel::KernelReaderHelper::data_program_offset_
protected

Definition at line 1367 of file kernel_translation_helper.h.

◆ reader_

Reader dart::kernel::KernelReaderHelper::reader_
protected

Definition at line 1360 of file kernel_translation_helper.h.

◆ translation_helper_

TranslationHelper& dart::kernel::KernelReaderHelper::translation_helper_
protected

Definition at line 1359 of file kernel_translation_helper.h.

◆ zone_

Zone* dart::kernel::KernelReaderHelper::zone_
protected

Definition at line 1358 of file kernel_translation_helper.h.


The documentation for this class was generated from the following files: