Flutter Engine
The Flutter Engine
Classes | Public Member Functions | Friends | List of all members
dart::kernel::StreamingFlowGraphBuilder Class Reference

#include <kernel_binary_flowgraph.h>

Inheritance diagram for dart::kernel::StreamingFlowGraphBuilder:
dart::kernel::KernelReaderHelper

Public Member Functions

 StreamingFlowGraphBuilder (FlowGraphBuilder *flow_graph_builder, const TypedDataView &data, intptr_t data_program_offset)
 
virtual ~StreamingFlowGraphBuilder ()
 
FlowGraphBuildGraph ()
 
void ReportUnexpectedTag (const char *variant, Tag tag) override
 
Fragment BuildStatementAt (intptr_t kernel_offset)
 
intptr_t num_ast_nodes () const
 
- Public Member Functions inherited from dart::kernel::KernelReaderHelper
 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)
 

Friends

class KernelLoader
 

Additional Inherited Members

- Protected Member Functions inherited from dart::kernel::KernelReaderHelper
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 inherited from dart::kernel::KernelReaderHelper
Zonezone_
 
TranslationHelpertranslation_helper_
 
Reader reader_
 
intptr_t data_program_offset_
 

Detailed Description

Definition at line 23 of file kernel_binary_flowgraph.h.

Constructor & Destructor Documentation

◆ StreamingFlowGraphBuilder()

dart::kernel::StreamingFlowGraphBuilder::StreamingFlowGraphBuilder ( FlowGraphBuilder flow_graph_builder,
const TypedDataView data,
intptr_t  data_program_offset 
)
inline

Definition at line 25 of file kernel_binary_flowgraph.h.

28 : KernelReaderHelper(flow_graph_builder->zone_,
29 &flow_graph_builder->translation_helper_,
30 data,
31 data_program_offset),
32 flow_graph_builder_(flow_graph_builder),
33 active_class_(&flow_graph_builder->active_class_),
34 constant_reader_(this, active_class_),
35 type_translator_(this,
36 &constant_reader_,
37 active_class_,
38 /* finalize= */ true),
39 direct_call_metadata_helper_(this),
40 inferred_type_metadata_helper_(this, &constant_reader_),
41 procedure_attributes_metadata_helper_(this),
42 call_site_attributes_metadata_helper_(this, &type_translator_),
43 closure_owner_(Object::Handle(flow_graph_builder->zone_)) {}
static Object & Handle()
Definition: object.h:407
KernelReaderHelper(Zone *zone, TranslationHelper *translation_helper, const TypedDataBase &data, intptr_t data_program_offset)
static int8_t data[kExtLength]

◆ ~StreamingFlowGraphBuilder()

virtual dart::kernel::StreamingFlowGraphBuilder::~StreamingFlowGraphBuilder ( )
inlinevirtual

Definition at line 45 of file kernel_binary_flowgraph.h.

45{}

Member Function Documentation

◆ BuildGraph()

FlowGraph * dart::kernel::StreamingFlowGraphBuilder::BuildGraph ( )

Definition at line 903 of file kernel_binary_flowgraph.cc.

903 {
904 ASSERT(Error::Handle(Z, H.thread()->sticky_error()).IsNull());
905 ASSERT(flow_graph_builder_ != nullptr);
906
907 const Function& function = parsed_function()->function();
908
909 // Setup an [ActiveClassScope] and an [ActiveMemberScope] which will be used
910 // e.g. for type translation.
911 const Class& klass =
912 Class::Handle(zone_, parsed_function()->function().Owner());
913 Function& outermost_function =
914 Function::Handle(Z, function.GetOutermostFunction());
915
916 ActiveClassScope active_class_scope(active_class(), &klass);
917 ActiveMemberScope active_member(active_class(), &outermost_function);
918 FunctionType& signature = FunctionType::Handle(Z, function.signature());
919 ActiveTypeParametersScope active_type_params(active_class(), function,
920 &signature, Z);
921
922 ParseKernelASTFunction();
923
924 switch (function.kind()) {
925 case UntaggedFunction::kRegularFunction:
926 case UntaggedFunction::kGetterFunction:
927 case UntaggedFunction::kSetterFunction:
928 case UntaggedFunction::kClosureFunction:
929 case UntaggedFunction::kConstructor: {
931 return B->BuildGraphOfRecognizedMethod(function);
932 }
933 return BuildGraphOfFunction(function.IsGenerativeConstructor());
934 }
935 case UntaggedFunction::kImplicitGetter:
936 case UntaggedFunction::kImplicitStaticGetter:
937 case UntaggedFunction::kImplicitSetter: {
938 return B->BuildGraphOfFieldAccessor(function);
939 }
940 case UntaggedFunction::kFieldInitializer:
941 return BuildGraphOfFieldInitializer();
942 case UntaggedFunction::kDynamicInvocationForwarder:
943 return B->BuildGraphOfDynamicInvocationForwarder(function);
944 case UntaggedFunction::kMethodExtractor:
945 return flow_graph_builder_->BuildGraphOfMethodExtractor(function);
946 case UntaggedFunction::kNoSuchMethodDispatcher:
947 return flow_graph_builder_->BuildGraphOfNoSuchMethodDispatcher(function);
948 case UntaggedFunction::kInvokeFieldDispatcher:
949 return flow_graph_builder_->BuildGraphOfInvokeFieldDispatcher(function);
950 case UntaggedFunction::kImplicitClosureFunction:
951 return flow_graph_builder_->BuildGraphOfImplicitClosureFunction(function);
952 case UntaggedFunction::kFfiTrampoline:
953 return flow_graph_builder_->BuildGraphOfFfiTrampoline(function);
954 case UntaggedFunction::kRecordFieldGetter:
955 return flow_graph_builder_->BuildGraphOfRecordFieldGetter(function);
956 case UntaggedFunction::kIrregexpFunction:
957 break;
958 }
959 UNREACHABLE();
960 return nullptr;
961}
#define UNREACHABLE()
Definition: assert.h:248
bool IsNull() const
Definition: object.h:363
const Function & function() const
Definition: parser.h:73
static bool IsRecognizedMethodForFlowGraph(const Function &function)
#define ASSERT(E)
Dart_NativeFunction function
Definition: fuchsia.cc:51
#define Z
Definition: SkMD5.cpp:130

◆ BuildStatementAt()

Fragment dart::kernel::StreamingFlowGraphBuilder::BuildStatementAt ( intptr_t  kernel_offset)

Definition at line 1041 of file kernel_binary_flowgraph.cc.

1041 {
1042 SetOffset(kernel_offset);
1043 return BuildStatement(); // read statement.
1044}

◆ num_ast_nodes()

intptr_t dart::kernel::StreamingFlowGraphBuilder::num_ast_nodes ( ) const
inline

Definition at line 53 of file kernel_binary_flowgraph.h.

53{ return num_ast_nodes_; }

◆ ReportUnexpectedTag()

void dart::kernel::StreamingFlowGraphBuilder::ReportUnexpectedTag ( const char *  variant,
Tag  tag 
)
overridevirtual

Reimplemented from dart::kernel::KernelReaderHelper.

Definition at line 1279 of file kernel_binary_flowgraph.cc.

1280 {
1281 if ((flow_graph_builder_ == nullptr) || (parsed_function() == nullptr)) {
1283 } else {
1284 const auto& script = Script::Handle(Z, Script());
1285 H.ReportError(script, TokenPosition::kNoSource,
1286 "Unexpected tag %d (%s) in %s, expected %s", tag,
1287 Reader::TagName(tag),
1288 parsed_function()->function().ToQualifiedCString(), variant);
1289 }
1290}
virtual void ReportUnexpectedTag(const char *variant, Tag tag)
static const char * TagName(Tag tag)

Friends And Related Function Documentation

◆ KernelLoader

friend class KernelLoader
friend

Definition at line 460 of file kernel_binary_flowgraph.h.


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