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

#include <base_flow_graph_builder.h>

Inheritance diagram for dart::kernel::BaseFlowGraphBuilder:
dart::kernel::FlowGraphBuilder dart::kernel::PrologueBuilder

Public Member Functions

 BaseFlowGraphBuilder (const ParsedFunction *parsed_function, intptr_t last_used_block_id, intptr_t osr_id=DeoptId::kNone, ZoneGrowableArray< intptr_t > *context_level_array=nullptr, InlineExitCollector *exit_collector=nullptr, bool inlining_unchecked_entry=false)
 
const Arraycoverage_array () const
 
void FinalizeCoverageArray ()
 
Fragment LoadField (const Field &field, bool calls_initializer)
 
Fragment LoadNativeField (const Slot &native_field, InnerPointerAccess loads_inner_pointer, bool calls_initializer=false)
 
Fragment LoadNativeField (const Slot &native_field, bool calls_initializer=false)
 
Fragment LoadIndexed (classid_t class_id, intptr_t index_scale=compiler::target::kWordSize, bool index_unboxed=false, AlignmentType alignment=kAlignedAccess)
 
Fragment GenericCheckBound ()
 
Fragment LoadUntagged (intptr_t offset)
 
Fragment CalculateElementAddress (intptr_t index_scale)
 
Fragment ConvertUntaggedToUnboxed ()
 
Fragment ConvertUnboxedToUntagged ()
 
Fragment FloatToDouble ()
 
Fragment DoubleToFloat ()
 
void SetTempIndex (Definition *definition)
 
Fragment LoadLocal (LocalVariable *variable)
 
Fragment StoreLocal (LocalVariable *variable)
 
Fragment StoreLocal (TokenPosition position, LocalVariable *variable)
 
Fragment StoreLocalRaw (TokenPosition position, LocalVariable *variable)
 
Fragment LoadContextAt (int depth)
 
Fragment GuardFieldLength (const Field &field, intptr_t deopt_id)
 
Fragment GuardFieldClass (const Field &field, intptr_t deopt_id)
 
Fragment StoreNativeField (TokenPosition position, const Slot &slot, InnerPointerAccess stores_inner_pointer, StoreFieldInstr::Kind kind=StoreFieldInstr::Kind::kOther, StoreBarrierType emit_store_barrier=kEmitStoreBarrier, compiler::Assembler::MemoryOrder memory_order=compiler::Assembler::kRelaxedNonAtomic)
 
Fragment StoreNativeField (TokenPosition position, const Slot &slot, StoreFieldInstr::Kind kind=StoreFieldInstr::Kind::kOther, StoreBarrierType emit_store_barrier=kEmitStoreBarrier, compiler::Assembler::MemoryOrder memory_order=compiler::Assembler::kRelaxedNonAtomic)
 
Fragment StoreNativeField (const Slot &slot, InnerPointerAccess stores_inner_pointer, StoreFieldInstr::Kind kind=StoreFieldInstr::Kind::kOther, StoreBarrierType emit_store_barrier=kEmitStoreBarrier, compiler::Assembler::MemoryOrder memory_order=compiler::Assembler::kRelaxedNonAtomic)
 
Fragment StoreNativeField (const Slot &slot, StoreFieldInstr::Kind kind=StoreFieldInstr::Kind::kOther, StoreBarrierType emit_store_barrier=kEmitStoreBarrier, compiler::Assembler::MemoryOrder memory_order=compiler::Assembler::kRelaxedNonAtomic)
 
Fragment StoreField (const Field &field, StoreFieldInstr::Kind kind=StoreFieldInstr::Kind::kOther, StoreBarrierType emit_store_barrier=kEmitStoreBarrier)
 
Fragment StoreFieldGuarded (const Field &field, StoreFieldInstr::Kind kind=StoreFieldInstr::Kind::kOther)
 
Fragment LoadStaticField (const Field &field, bool calls_initializer)
 
Fragment RedefinitionWithType (const AbstractType &type)
 
Fragment ReachabilityFence ()
 
Fragment StoreStaticField (TokenPosition position, const Field &field)
 
Fragment StoreIndexed (classid_t class_id)
 
Fragment StoreIndexedTypedData (classid_t class_id, intptr_t index_scale, bool index_unboxed, AlignmentType alignment=kAlignedAccess)
 
Fragment Box (Representation from)
 
void Push (Definition *definition)
 
DefinitionPeek (intptr_t depth=0)
 
ValuePop ()
 
Fragment Drop ()
 
Fragment DropTempsPreserveTop (intptr_t num_temps_to_drop)
 
Fragment MakeTemp ()
 
LocalVariableMakeTemporary (const char *suffix=nullptr)
 
Fragment DropTemporary (LocalVariable **temp)
 
InputsArray GetArguments (int count)
 
TargetEntryInstrBuildTargetEntry ()
 
FunctionEntryInstrBuildFunctionEntry (GraphEntryInstr *graph_entry)
 
JoinEntryInstrBuildJoinEntry ()
 
JoinEntryInstrBuildJoinEntry (intptr_t try_index)
 
IndirectEntryInstrBuildIndirectEntry (intptr_t indirect_id, intptr_t try_index)
 
Fragment StrictCompare (TokenPosition position, Token::Kind kind, bool number_check=false)
 
Fragment StrictCompare (Token::Kind kind, bool number_check=false)
 
Fragment Goto (JoinEntryInstr *destination)
 
Fragment UnboxedIntConstant (int64_t value, Representation representation)
 
Fragment IntConstant (int64_t value)
 
Fragment Constant (const Object &value)
 
Fragment NullConstant ()
 
Fragment SmiRelationalOp (Token::Kind kind)
 
Fragment SmiBinaryOp (Token::Kind op, bool is_truncating=false)
 
Fragment BinaryIntegerOp (Token::Kind op, Representation representation, bool is_truncating=false)
 
Fragment LoadFpRelativeSlot (intptr_t offset, CompileType result_type, Representation representation=kTagged)
 
Fragment StoreFpRelativeSlot (intptr_t offset)
 
Fragment BranchIfTrue (TargetEntryInstr **then_entry, TargetEntryInstr **otherwise_entry, bool negate=false)
 
Fragment BranchIfNull (TargetEntryInstr **then_entry, TargetEntryInstr **otherwise_entry, bool negate=false)
 
Fragment BranchIfEqual (TargetEntryInstr **then_entry, TargetEntryInstr **otherwise_entry, bool negate=false)
 
Fragment BranchIfStrictEqual (TargetEntryInstr **then_entry, TargetEntryInstr **otherwise_entry)
 
Fragment Return (TokenPosition position)
 
Fragment CheckStackOverflow (TokenPosition position, intptr_t stack_depth, intptr_t loop_depth)
 
Fragment CheckStackOverflowInPrologue (TokenPosition position)
 
Fragment MemoryCopy (classid_t src_cid, classid_t dest_cid, bool unboxed_inputs, bool can_overlap=true)
 
Fragment TailCall (const Code &code)
 
Fragment Utf8Scan ()
 
intptr_t GetNextDeoptId ()
 
intptr_t AllocateTryIndex ()
 
intptr_t CurrentTryIndex () const
 
void SetCurrentTryIndex (intptr_t try_index)
 
bool IsCompiledForOsr ()
 
bool IsInlining () const
 
void InlineBailout (const char *reason)
 
Fragment LoadArgDescriptor ()
 
Fragment TestTypeArgsLen (Fragment eq_branch, Fragment neq_branch, intptr_t num_type_args)
 
Fragment TestDelayedTypeArgs (LocalVariable *closure, Fragment present, Fragment absent)
 
Fragment TestAnyTypeArgs (Fragment present, Fragment absent)
 
JoinEntryInstrBuildThrowNoSuchMethod ()
 
Fragment ThrowException (TokenPosition position)
 
Fragment AssertBool (TokenPosition position)
 
Fragment BooleanNegate ()
 
Fragment AllocateContext (const ZoneGrowableArray< const Slot * > &scope)
 
Fragment AllocateClosure (TokenPosition position, bool has_instantiator_type_args, bool is_generic, bool is_tear_off)
 
Fragment CreateArray ()
 
Fragment AllocateRecord (TokenPosition position, RecordShape shape)
 
Fragment AllocateSmallRecord (TokenPosition position, RecordShape shape)
 
Fragment AllocateTypedData (TokenPosition position, classid_t class_id)
 
Fragment InstantiateType (const AbstractType &type)
 
Fragment InstantiateTypeArguments (const TypeArguments &type_arguments)
 
Fragment InstantiateDynamicTypeArguments ()
 
Fragment LoadClassId ()
 
bool InliningUncheckedEntry () const
 
intptr_t GetStackDepth () const
 
Fragment AllocateObject (TokenPosition position, const Class &klass, intptr_t argument_count)
 
Fragment DebugStepCheck (TokenPosition position)
 
Fragment CheckNull (TokenPosition position, LocalVariable *receiver, const String &function_name)
 
Fragment CheckNullOptimized (const String &name, CheckNullInstr::ExceptionType exception_type, TokenPosition position=TokenPosition::kNoSource)
 
Fragment CheckNullOptimized (const String &function_name, TokenPosition position=TokenPosition::kNoSource)
 
Fragment CheckNotDeeplyImmutable (CheckWritableInstr::Kind kind)
 
void RecordUncheckedEntryPoint (GraphEntryInstr *graph_entry, FunctionEntryInstr *unchecked_entry)
 
Fragment BuildEntryPointsIntrospection ()
 
Fragment ClosureCall (const Function &target_function, TokenPosition position, intptr_t type_args_len, intptr_t argument_count, const Array &argument_names, const InferredTypeMetadata *result_type=nullptr)
 
Fragment AssertAssignable (TokenPosition position, const String &dst_name, AssertAssignableInstr::Kind kind=AssertAssignableInstr::kUnknown)
 
bool is_recording_context_levels () const
 
void set_context_depth (intptr_t context_level)
 
void reset_context_depth_for_deopt_id (intptr_t deopt_id)
 
Fragment InitConstantParameters ()
 
Fragment InvokeMathCFunction (MethodRecognizer::Kind recognized_kind, intptr_t num_inputs)
 
Fragment DoubleToInteger (MethodRecognizer::Kind recognized_kind)
 
Fragment UnaryDoubleOp (Token::Kind op)
 
Fragment RecordCoverage (TokenPosition position)
 
Fragment RecordBranchCoverage (TokenPosition position)
 
bool has_saved_args_desc_array ()
 
const Arraysaved_args_desc_array ()
 

Static Public Member Functions

static const FieldMayCloneField (Zone *zone, const Field &field)
 

Protected Member Functions

intptr_t AllocateBlockId ()
 
Fragment RecordCoverageImpl (TokenPosition position, bool is_branch_coverage)
 
intptr_t GetCoverageIndexFor (intptr_t encoded_position)
 

Protected Attributes

const ParsedFunctionparsed_function_
 
const Functionfunction_
 
Threadthread_
 
Zonezone_
 
intptr_t osr_id_
 
ZoneGrowableArray< intptr_t > * context_level_array_
 
intptr_t context_depth_
 
intptr_t last_used_block_id_
 
intptr_t current_try_index_
 
intptr_t next_used_try_index_
 
Valuestack_
 
InlineExitCollectorexit_collector_
 
const bool inlining_unchecked_entry_
 
const Arraysaved_args_desc_array_
 
IntMap< intptr_t > coverage_state_index_for_position_
 
Arraycoverage_array_
 

Friends

class StreamingFlowGraphBuilder
 

Detailed Description

Definition at line 143 of file base_flow_graph_builder.h.

Constructor & Destructor Documentation

◆ BaseFlowGraphBuilder()

dart::kernel::BaseFlowGraphBuilder::BaseFlowGraphBuilder ( const ParsedFunction parsed_function,
intptr_t  last_used_block_id,
intptr_t  osr_id = DeoptId::kNone,
ZoneGrowableArray< intptr_t > *  context_level_array = nullptr,
InlineExitCollector exit_collector = nullptr,
bool  inlining_unchecked_entry = false 
)
inline

Definition at line 145 of file base_flow_graph_builder.h.

152 : parsed_function_(parsed_function),
155 zone_(thread_->zone()),
156 osr_id_(osr_id),
157 context_level_array_(context_level_array),
159 last_used_block_id_(last_used_block_id),
162 stack_(nullptr),
163 exit_collector_(exit_collector),
164 inlining_unchecked_entry_(inlining_unchecked_entry),
168 : Object::null_array()),
170 Array::ZoneHandle(parsed_function->function().GetCoverageArray())) {
171 }
ArrayPtr saved_args_desc() const
Definition: object.cc:8133
static Object & ZoneHandle()
Definition: object.h:419
const Function & function() const
Definition: parser.h:73
Zone * zone() const
Definition: thread_state.h:37
static Thread * Current()
Definition: thread.h:362
ZoneGrowableArray< intptr_t > * context_level_array_
static constexpr intptr_t kInvalidTryIndex

Member Function Documentation

◆ AllocateBlockId()

intptr_t dart::kernel::BaseFlowGraphBuilder::AllocateBlockId ( )
inlineprotected

Definition at line 515 of file base_flow_graph_builder.h.

515{ return ++last_used_block_id_; }

◆ AllocateClosure()

Fragment dart::kernel::BaseFlowGraphBuilder::AllocateClosure ( TokenPosition  position,
bool  has_instantiator_type_args,
bool  is_generic,
bool  is_tear_off 
)

Definition at line 924 of file base_flow_graph_builder.cc.

927 {
928 Value* instantiator_type_args =
929 (has_instantiator_type_args ? Pop() : nullptr);
930 auto const context = Pop();
931 auto const function = Pop();
932 auto* allocate = new (Z) AllocateClosureInstr(
933 InstructionSource(position), function, context, instantiator_type_args,
934 is_generic, is_tear_off, GetNextDeoptId());
935 Push(allocate);
936 return Fragment(allocate);
937}
#define Z
Dart_NativeFunction function
Definition: fuchsia.cc:51

◆ AllocateContext()

Fragment dart::kernel::BaseFlowGraphBuilder::AllocateContext ( const ZoneGrowableArray< const Slot * > &  scope)

Definition at line 916 of file base_flow_graph_builder.cc.

917 {
918 AllocateContextInstr* allocate = new (Z) AllocateContextInstr(
919 InstructionSource(), context_slots, GetNextDeoptId());
920 Push(allocate);
921 return Fragment(allocate);
922}

◆ AllocateObject()

Fragment dart::kernel::BaseFlowGraphBuilder::AllocateObject ( TokenPosition  position,
const Class klass,
intptr_t  argument_count 
)

Definition at line 1026 of file base_flow_graph_builder.cc.

1028 {
1029 ASSERT((argument_count == 0) || (argument_count == 1));
1030 Value* type_arguments = (argument_count > 0) ? Pop() : nullptr;
1031 AllocateObjectInstr* allocate = new (Z) AllocateObjectInstr(
1032 InstructionSource(position), klass, GetNextDeoptId(), type_arguments);
1033 Push(allocate);
1034 return Fragment(allocate);
1035}
#define ASSERT(E)
int argument_count
Definition: fuchsia.cc:52

◆ AllocateRecord()

Fragment dart::kernel::BaseFlowGraphBuilder::AllocateRecord ( TokenPosition  position,
RecordShape  shape 
)

Definition at line 949 of file base_flow_graph_builder.cc.

950 {
951 AllocateRecordInstr* allocate = new (Z)
952 AllocateRecordInstr(InstructionSource(position), shape, GetNextDeoptId());
953 Push(allocate);
954 return Fragment(allocate);
955}

◆ AllocateSmallRecord()

Fragment dart::kernel::BaseFlowGraphBuilder::AllocateSmallRecord ( TokenPosition  position,
RecordShape  shape 
)

Definition at line 957 of file base_flow_graph_builder.cc.

958 {
959 const intptr_t num_fields = shape.num_fields();
960 ASSERT(num_fields == 2 || num_fields == 3);
961 Value* value2 = (num_fields > 2) ? Pop() : nullptr;
962 Value* value1 = Pop();
963 Value* value0 = Pop();
964 AllocateSmallRecordInstr* allocate = new (Z)
965 AllocateSmallRecordInstr(InstructionSource(position), shape, value0,
966 value1, value2, GetNextDeoptId());
967 Push(allocate);
968 return Fragment(allocate);
969}

◆ AllocateTryIndex()

intptr_t dart::kernel::BaseFlowGraphBuilder::AllocateTryIndex ( )
inline

Definition at line 358 of file base_flow_graph_builder.h.

358{ return next_used_try_index_++; }

◆ AllocateTypedData()

Fragment dart::kernel::BaseFlowGraphBuilder::AllocateTypedData ( TokenPosition  position,
classid_t  class_id 
)

Definition at line 971 of file base_flow_graph_builder.cc.

972 {
973 Value* num_elements = Pop();
974 auto* instr = new (Z) AllocateTypedDataInstr(
975 InstructionSource(position), class_id, num_elements, GetNextDeoptId());
976 Push(instr);
977 return Fragment(instr);
978}

◆ AssertAssignable()

Fragment dart::kernel::BaseFlowGraphBuilder::AssertAssignable ( TokenPosition  position,
const String dst_name,
AssertAssignableInstr::Kind  kind = AssertAssignableInstr::kUnknown 
)

Definition at line 1202 of file base_flow_graph_builder.cc.

1205 {
1206 Value* function_type_args = Pop();
1207 Value* instantiator_type_args = Pop();
1208 Value* dst_type = Pop();
1209 Value* value = Pop();
1210
1211 AssertAssignableInstr* instr = new (Z) AssertAssignableInstr(
1212 InstructionSource(position), value, dst_type, instantiator_type_args,
1213 function_type_args, dst_name, GetNextDeoptId(), kind);
1214 Push(instr);
1215
1216 return Fragment(instr);
1217}
uint8_t value

◆ AssertBool()

Fragment dart::kernel::BaseFlowGraphBuilder::AssertBool ( TokenPosition  position)

Definition at line 902 of file base_flow_graph_builder.cc.

902 {
903 Value* value = Pop();
904 AssertBooleanInstr* instr = new (Z)
905 AssertBooleanInstr(InstructionSource(position), value, GetNextDeoptId());
906 Push(instr);
907 return Fragment(instr);
908}

◆ BinaryIntegerOp()

Fragment dart::kernel::BaseFlowGraphBuilder::BinaryIntegerOp ( Token::Kind  op,
Representation  representation,
bool  is_truncating = false 
)

Definition at line 842 of file base_flow_graph_builder.cc.

844 {
845 ASSERT(representation == kUnboxedInt32 || representation == kUnboxedUint32 ||
846 representation == kUnboxedInt64 || representation == kTagged);
847 Value* right = Pop();
848 Value* left = Pop();
849 BinaryIntegerOpInstr* instr = BinaryIntegerOpInstr::Make(
850 representation, kind, left, right, GetNextDeoptId());
851 ASSERT(instr != nullptr);
852 if (is_truncating) {
853 instr->mark_truncating();
854 }
855 Push(instr);
856 return Fragment(instr);
857}
static BinaryIntegerOpInstr * Make(Representation representation, Token::Kind op_kind, Value *left, Value *right, intptr_t deopt_id, SpeculativeMode speculative_mode=kGuardInputs)
Definition: il.cc:2293

◆ BooleanNegate()

Fragment dart::kernel::BaseFlowGraphBuilder::BooleanNegate ( )

Definition at line 910 of file base_flow_graph_builder.cc.

910 {
911 BooleanNegateInstr* negate = new (Z) BooleanNegateInstr(Pop());
912 Push(negate);
913 return Fragment(negate);
914}

◆ Box()

Fragment dart::kernel::BaseFlowGraphBuilder::Box ( Representation  from)

Definition at line 1037 of file base_flow_graph_builder.cc.

1037 {
1038 Fragment instructions;
1039 if (from == kUnboxedFloat) {
1040 instructions += FloatToDouble();
1041 from = kUnboxedDouble;
1042 }
1043 BoxInstr* box = BoxInstr::Create(from, Pop());
1044 instructions <<= box;
1045 Push(box);
1046 return instructions;
1047}
static BoxInstr * Create(Representation from, Value *value)
Definition: il.cc:4007

◆ BranchIfEqual()

Fragment dart::kernel::BaseFlowGraphBuilder::BranchIfEqual ( TargetEntryInstr **  then_entry,
TargetEntryInstr **  otherwise_entry,
bool  negate = false 
)

Definition at line 181 of file base_flow_graph_builder.cc.

183 {
184 Value* right_value = Pop();
185 Value* left_value = Pop();
186 StrictCompareInstr* compare = new (Z) StrictCompareInstr(
187 InstructionSource(), negate ? Token::kNE_STRICT : Token::kEQ_STRICT,
188 left_value, right_value, false, GetNextDeoptId());
189 BranchInstr* branch = new (Z) BranchInstr(compare, GetNextDeoptId());
190 *then_entry = *branch->true_successor_address() = BuildTargetEntry();
191 *otherwise_entry = *branch->false_successor_address() = BuildTargetEntry();
192 return Fragment(branch).closed();
193}
int compare(const void *untyped_lhs, const void *untyped_rhs)
Definition: skdiff.h:161

◆ BranchIfNull()

Fragment dart::kernel::BaseFlowGraphBuilder::BranchIfNull ( TargetEntryInstr **  then_entry,
TargetEntryInstr **  otherwise_entry,
bool  negate = false 
)

Definition at line 174 of file base_flow_graph_builder.cc.

176 {
177 Fragment instructions = NullConstant();
178 return instructions + BranchIfEqual(then_entry, otherwise_entry, negate);
179}
Fragment BranchIfEqual(TargetEntryInstr **then_entry, TargetEntryInstr **otherwise_entry, bool negate=false)

◆ BranchIfStrictEqual()

Fragment dart::kernel::BaseFlowGraphBuilder::BranchIfStrictEqual ( TargetEntryInstr **  then_entry,
TargetEntryInstr **  otherwise_entry 
)

Definition at line 195 of file base_flow_graph_builder.cc.

197 {
198 Value* rhs = Pop();
199 Value* lhs = Pop();
200 StrictCompareInstr* compare =
201 new (Z) StrictCompareInstr(InstructionSource(), Token::kEQ_STRICT, lhs,
202 rhs, false, GetNextDeoptId());
203 BranchInstr* branch = new (Z) BranchInstr(compare, GetNextDeoptId());
204 *then_entry = *branch->true_successor_address() = BuildTargetEntry();
205 *otherwise_entry = *branch->false_successor_address() = BuildTargetEntry();
206 return Fragment(branch).closed();
207}

◆ BranchIfTrue()

Fragment dart::kernel::BaseFlowGraphBuilder::BranchIfTrue ( TargetEntryInstr **  then_entry,
TargetEntryInstr **  otherwise_entry,
bool  negate = false 
)

Definition at line 167 of file base_flow_graph_builder.cc.

169 {
170 Fragment instructions = Constant(Bool::True());
171 return instructions + BranchIfEqual(then_entry, otherwise_entry, negate);
172}
static const Bool & True()
Definition: object.h:10797
Fragment Constant(const Object &value)

◆ BuildEntryPointsIntrospection()

Fragment dart::kernel::BaseFlowGraphBuilder::BuildEntryPointsIntrospection ( )

Definition at line 1114 of file base_flow_graph_builder.cc.

1114 {
1115 if (!FLAG_enable_testing_pragmas) return Drop();
1116
1118
1119 if (function.IsImplicitClosureFunction()) {
1120 const auto& parent = Function::Handle(Z, function.parent_function());
1121 const auto& func_name = String::Handle(Z, parent.name());
1122 const auto& owner = Class::Handle(Z, parent.Owner());
1123 if (owner.EnsureIsFinalized(thread_) == Error::null()) {
1124 function = Resolver::ResolveFunction(Z, owner, func_name);
1125 }
1126 }
1127
1128 Object& options = Object::Handle(Z);
1129 if (!Library::FindPragma(thread_, /*only_core=*/false, function,
1130 Symbols::vm_trace_entrypoints(), /*multiple=*/false,
1131 &options) ||
1132 options.IsNull() || !options.IsClosure()) {
1133 return Drop();
1134 }
1135 auto& closure = Closure::ZoneHandle(Z, Closure::Cast(options).ptr());
1136 LocalVariable* entry_point_num = MakeTemporary("entry_point_num");
1137
1139 Z, String::New(function.ToLibNamePrefixedQualifiedCString(), Heap::kOld));
1143 Heap::kOld);
1144 }
1145 if (!function_name.IsCanonical()) {
1147 }
1148
1149 Fragment call_hook;
1150 call_hook += Constant(closure);
1151 call_hook += Constant(function_name);
1152 call_hook += LoadLocal(entry_point_num);
1153 if (FLAG_precompiled_mode) {
1154 call_hook += Constant(closure);
1155 } else {
1156 call_hook += Constant(Function::ZoneHandle(Z, closure.function()));
1157 }
1158 call_hook += ClosureCall(Function::null_function(), TokenPosition::kNoSource,
1159 /*type_args_len=*/0, /*argument_count=*/3,
1160 /*argument_names=*/Array::ZoneHandle(Z));
1161 call_hook += Drop(); // result of closure call
1162 call_hook += DropTemporary(&entry_point_num); // entrypoint number
1163 return call_hook;
1164}
const char * options
bool IsImplicitClosureFunction() const
Definition: object.h:3903
@ kNew
Definition: heap.h:38
@ kOld
Definition: heap.h:39
static bool FindPragma(Thread *T, bool only_core, const Object &object, const String &pragma_name, bool multiple=false, Object *options=nullptr)
Definition: object.cc:4151
static ObjectPtr null()
Definition: object.h:433
ObjectPtr ptr() const
Definition: object.h:332
static Object & Handle()
Definition: object.h:407
static FunctionPtr ResolveFunction(Zone *zone, const Class &receiver_class, const String &function_name)
Definition: resolver.cc:167
static StringPtr New(const char *cstr, Heap::Space space=Heap::kNew)
Definition: object.cc:23698
static StringPtr Concat(const String &str1, const String &str2, Heap::Space space=Heap::kNew)
Definition: object.cc:24037
static StringPtr New(Thread *thread, const char *cstr)
Definition: symbols.h:723
Fragment LoadLocal(LocalVariable *variable)
Fragment ClosureCall(const Function &target_function, TokenPosition position, intptr_t type_args_len, intptr_t argument_count, const Array &argument_names, const InferredTypeMetadata *result_type=nullptr)
LocalVariable * MakeTemporary(const char *suffix=nullptr)
Fragment DropTemporary(LocalVariable **temp)
const char *const function_name
std::function< void()> closure
Definition: closure.h:14

◆ BuildFunctionEntry()

FunctionEntryInstr * dart::kernel::BaseFlowGraphBuilder::BuildFunctionEntry ( GraphEntryInstr graph_entry)

Definition at line 796 of file base_flow_graph_builder.cc.

797 {
798 return new (Z) FunctionEntryInstr(graph_entry, AllocateBlockId(),
800}

◆ BuildIndirectEntry()

IndirectEntryInstr * dart::kernel::BaseFlowGraphBuilder::BuildIndirectEntry ( intptr_t  indirect_id,
intptr_t  try_index 
)

Definition at line 812 of file base_flow_graph_builder.cc.

814 {
815 return new (Z) IndirectEntryInstr(AllocateBlockId(), indirect_id, try_index,
817}

◆ BuildJoinEntry() [1/2]

JoinEntryInstr * dart::kernel::BaseFlowGraphBuilder::BuildJoinEntry ( )

Definition at line 807 of file base_flow_graph_builder.cc.

807 {
808 return new (Z) JoinEntryInstr(AllocateBlockId(), CurrentTryIndex(),
810}

◆ BuildJoinEntry() [2/2]

JoinEntryInstr * dart::kernel::BaseFlowGraphBuilder::BuildJoinEntry ( intptr_t  try_index)

Definition at line 802 of file base_flow_graph_builder.cc.

802 {
803 return new (Z) JoinEntryInstr(AllocateBlockId(), try_index, GetNextDeoptId(),
804 GetStackDepth());
805}

◆ BuildTargetEntry()

TargetEntryInstr * dart::kernel::BaseFlowGraphBuilder::BuildTargetEntry ( )

Definition at line 791 of file base_flow_graph_builder.cc.

791 {
792 return new (Z) TargetEntryInstr(AllocateBlockId(), CurrentTryIndex(),
794}

◆ BuildThrowNoSuchMethod()

JoinEntryInstr * dart::kernel::BaseFlowGraphBuilder::BuildThrowNoSuchMethod ( )

Definition at line 877 of file base_flow_graph_builder.cc.

877 {
878 JoinEntryInstr* nsm = BuildJoinEntry();
879
880 Fragment failing(nsm);
881 const Code& nsm_handler = Code::ZoneHandle(
882 Z, IG->object_store()->call_closure_no_such_method_stub());
883 failing += LoadArgDescriptor();
884 failing += TailCall(nsm_handler);
885
886 return nsm;
887}
#define IG

◆ CalculateElementAddress()

Fragment dart::kernel::BaseFlowGraphBuilder::CalculateElementAddress ( intptr_t  index_scale)

Definition at line 433 of file base_flow_graph_builder.cc.

433 {
434 Value* offset = Pop();
435 Value* index = Pop();
436 Value* base = Pop();
437 auto adjust =
438 new (Z) CalculateElementAddressInstr(base, index, index_scale, offset);
439 Push(adjust);
440 return Fragment(adjust);
441}
SeparatedVector2 offset

◆ CheckNotDeeplyImmutable()

Fragment dart::kernel::BaseFlowGraphBuilder::CheckNotDeeplyImmutable ( CheckWritableInstr::Kind  kind)

Definition at line 1087 of file base_flow_graph_builder.cc.

1088 {
1089 Value* value = Pop();
1090 auto* check_writable = new (Z)
1091 CheckWritableInstr(value, GetNextDeoptId(), InstructionSource(), kind);
1092 return Fragment(check_writable);
1093}

◆ CheckNull()

Fragment dart::kernel::BaseFlowGraphBuilder::CheckNull ( TokenPosition  position,
LocalVariable receiver,
const String function_name 
)

Definition at line 1059 of file base_flow_graph_builder.cc.

1061 {
1062 Fragment instructions = LoadLocal(receiver);
1063
1064 CheckNullInstr* check_null = new (Z) CheckNullInstr(
1065 Pop(), function_name, GetNextDeoptId(), InstructionSource(position),
1068
1069 // Does not use the redefinition, no `Push(check_null)`.
1070 instructions <<= check_null;
1071
1072 return instructions;
1073}

◆ CheckNullOptimized() [1/2]

Fragment dart::kernel::BaseFlowGraphBuilder::CheckNullOptimized ( const String function_name,
TokenPosition  position = TokenPosition::kNoSource 
)
inline

Definition at line 433 of file base_flow_graph_builder.h.

435 {
437 position);
438 }
Fragment CheckNullOptimized(const String &name, CheckNullInstr::ExceptionType exception_type, TokenPosition position=TokenPosition::kNoSource)

◆ CheckNullOptimized() [2/2]

Fragment dart::kernel::BaseFlowGraphBuilder::CheckNullOptimized ( const String name,
CheckNullInstr::ExceptionType  exception_type,
TokenPosition  position = TokenPosition::kNoSource 
)

Definition at line 1075 of file base_flow_graph_builder.cc.

1078 {
1079 Value* value = Pop();
1080 CheckNullInstr* check_null =
1081 new (Z) CheckNullInstr(value, function_name, GetNextDeoptId(),
1082 InstructionSource(position), exception_type);
1083 Push(check_null); // Use the redefinition.
1084 return Fragment(check_null);
1085}

◆ CheckStackOverflow()

Fragment dart::kernel::BaseFlowGraphBuilder::CheckStackOverflow ( TokenPosition  position,
intptr_t  stack_depth,
intptr_t  loop_depth 
)

Definition at line 226 of file base_flow_graph_builder.cc.

228 {
229 return Fragment(new (Z) CheckStackOverflowInstr(
230 InstructionSource(position), stack_depth, loop_depth, GetNextDeoptId(),
232}

◆ CheckStackOverflowInPrologue()

Fragment dart::kernel::BaseFlowGraphBuilder::CheckStackOverflowInPrologue ( TokenPosition  position)

Definition at line 234 of file base_flow_graph_builder.cc.

235 {
236 if (IsInlining()) {
237 // If we are inlining don't actually attach the stack check. We must still
238 // create the stack check in order to allocate a deopt id.
239 CheckStackOverflow(position, 0, 0);
240 return Fragment();
241 }
242 return CheckStackOverflow(position, 0, 0);
243}
Fragment CheckStackOverflow(TokenPosition position, intptr_t stack_depth, intptr_t loop_depth)

◆ ClosureCall()

Fragment dart::kernel::BaseFlowGraphBuilder::ClosureCall ( const Function target_function,
TokenPosition  position,
intptr_t  type_args_len,
intptr_t  argument_count,
const Array argument_names,
const InferredTypeMetadata result_type = nullptr 
)

Definition at line 1166 of file base_flow_graph_builder.cc.

1172 {
1173 Fragment instructions = RecordCoverage(position);
1174 const intptr_t total_count =
1175 (type_args_len > 0 ? 1 : 0) + argument_count +
1176 /*closure (bare instructions) or function (otherwise)*/ 1;
1177 InputsArray arguments = GetArguments(total_count);
1178 ClosureCallInstr* call = new (Z) ClosureCallInstr(
1179 target_function, std::move(arguments), type_args_len, argument_names,
1180 InstructionSource(position), GetNextDeoptId());
1181 Push(call);
1182 instructions <<= call;
1183 if (result_type != nullptr && result_type->IsConstant()) {
1184 instructions += Drop();
1185 instructions += Constant(result_type->constant_value);
1186 }
1187 return instructions;
1188}
Fragment RecordCoverage(TokenPosition position)
GrowableArray< Value * > InputsArray
Definition: il.h:901
def call(args)
Definition: dom.py:159

◆ Constant()

Fragment dart::kernel::BaseFlowGraphBuilder::Constant ( const Object value)

Definition at line 245 of file base_flow_graph_builder.cc.

245 {
246 DEBUG_ASSERT(value.IsNotTemporaryScopedHandle());
247 ConstantInstr* constant = new (Z) ConstantInstr(value);
248 Push(constant);
249 return Fragment(constant);
250}
#define DEBUG_ASSERT(cond)
Definition: assert.h:321

◆ ConvertUnboxedToUntagged()

Fragment dart::kernel::BaseFlowGraphBuilder::ConvertUnboxedToUntagged ( )

Definition at line 424 of file base_flow_graph_builder.cc.

424 {
425 Value* value = Pop();
426 auto converted = new (Z)
427 IntConverterInstr(kUnboxedAddress, kUntagged, value, DeoptId::kNone);
428 converted->mark_truncating();
429 Push(converted);
430 return Fragment(converted);
431}
static constexpr intptr_t kNone
Definition: deopt_id.h:27
static constexpr Representation kUnboxedAddress
Definition: locations.h:182

◆ ConvertUntaggedToUnboxed()

Fragment dart::kernel::BaseFlowGraphBuilder::ConvertUntaggedToUnboxed ( )

Definition at line 415 of file base_flow_graph_builder.cc.

415 {
416 Value* value = Pop();
417 auto converted = new (Z)
418 IntConverterInstr(kUntagged, kUnboxedAddress, value, DeoptId::kNone);
419 converted->mark_truncating();
420 Push(converted);
421 return Fragment(converted);
422}

◆ coverage_array()

const Array & dart::kernel::BaseFlowGraphBuilder::coverage_array ( ) const
inline

Definition at line 173 of file base_flow_graph_builder.h.

173{ return coverage_array_; }

◆ CreateArray()

Fragment dart::kernel::BaseFlowGraphBuilder::CreateArray ( )

Definition at line 939 of file base_flow_graph_builder.cc.

939 {
940 Value* element_count = Pop();
941 CreateArrayInstr* array =
942 new (Z) CreateArrayInstr(InstructionSource(),
943 Pop(), // Element type.
944 element_count, GetNextDeoptId());
945 Push(array);
946 return Fragment(array);
947}

◆ CurrentTryIndex()

intptr_t dart::kernel::BaseFlowGraphBuilder::CurrentTryIndex ( ) const
inline

Definition at line 359 of file base_flow_graph_builder.h.

359{ return current_try_index_; }

◆ DebugStepCheck()

Fragment dart::kernel::BaseFlowGraphBuilder::DebugStepCheck ( TokenPosition  position)

Definition at line 1049 of file base_flow_graph_builder.cc.

1049 {
1050#ifdef PRODUCT
1051 return Fragment();
1052#else
1053 return Fragment(new (Z) DebugStepCheckInstr(
1054 InstructionSource(position), UntaggedPcDescriptors::kRuntimeCall,
1055 GetNextDeoptId()));
1056#endif
1057}

◆ DoubleToFloat()

Fragment dart::kernel::BaseFlowGraphBuilder::DoubleToFloat ( )

Definition at line 450 of file base_flow_graph_builder.cc.

450 {
451 Value* value = Pop();
452 DoubleToFloatInstr* instr = new DoubleToFloatInstr(
453 value, DeoptId::kNone, Instruction::SpeculativeMode::kNotSpeculative);
454 Push(instr);
455 return Fragment(instr);
456}

◆ DoubleToInteger()

Fragment dart::kernel::BaseFlowGraphBuilder::DoubleToInteger ( MethodRecognizer::Kind  recognized_kind)

Definition at line 1245 of file base_flow_graph_builder.cc.

1246 {
1247 Value* value = Pop();
1248 auto* instr =
1249 new (Z) DoubleToIntegerInstr(value, recognized_kind, GetNextDeoptId());
1250 Push(instr);
1251 return Fragment(instr);
1252}

◆ Drop()

Fragment dart::kernel::BaseFlowGraphBuilder::Drop ( )

Definition at line 755 of file base_flow_graph_builder.cc.

755 {
756 ASSERT(stack_ != nullptr);
757 Fragment instructions;
758 Definition* definition = stack_->definition();
759 // The SSA renaming implementation doesn't like [LoadLocal]s without a
760 // tempindex.
761 if (definition->HasSSATemp() || definition->IsLoadLocal()) {
762 instructions <<= new (Z) DropTempsInstr(1, nullptr);
763 } else {
764 definition->ClearTempIndex();
765 }
766
767 Pop();
768 return instructions;
769}
void ClearTempIndex()
Definition: il.h:2500
Definition * definition() const
Definition: il.h:103

◆ DropTemporary()

Fragment dart::kernel::BaseFlowGraphBuilder::DropTemporary ( LocalVariable **  temp)

Definition at line 713 of file base_flow_graph_builder.cc.

713 {
714 ASSERT(temp != nullptr && *temp != nullptr && (*temp)->HasIndex());
715 // Check that the temporary matches the current stack definition.
718 -(*temp)->index().value() - parsed_function_->num_stack_locals());
719 *temp = nullptr; // Clear to avoid inadvertent usage after dropping.
720 return Drop();
721}
#define ASSERT_EQUAL(expected, actual)
Definition: assert.h:309
intptr_t temp_index() const
Definition: il.h:2498
int num_stack_locals() const
Definition: parser.h:194

◆ DropTempsPreserveTop()

Fragment dart::kernel::BaseFlowGraphBuilder::DropTempsPreserveTop ( intptr_t  num_temps_to_drop)

Definition at line 771 of file base_flow_graph_builder.cc.

772 {
773 Value* top = Pop();
774
775 for (intptr_t i = 0; i < num_temps_to_drop; ++i) {
776 Pop();
777 }
778
779 DropTempsInstr* drop_temps = new (Z) DropTempsInstr(num_temps_to_drop, top);
780 Push(drop_temps);
781
782 return Fragment(drop_temps);
783}

◆ FinalizeCoverageArray()

void dart::kernel::BaseFlowGraphBuilder::FinalizeCoverageArray ( )

Definition at line 1326 of file base_flow_graph_builder.cc.

1326 {
1327 if (!coverage_array_.IsNull()) {
1328 return;
1329 }
1330
1332 coverage_array_ = Array::empty_array().ptr();
1333 return;
1334 }
1335
1338
1339 Smi& value = Smi::Handle();
1341 for (auto* p = it.Next(); p != nullptr; p = it.Next()) {
1342 value = Smi::New(p->key);
1343 // p->value is the index at which coverage state is stored, the
1344 // full coverage entry begins at the previous index.
1345 const intptr_t coverage_entry_index = p->value - 1;
1346 coverage_array_.SetAt(coverage_entry_index, value);
1347 value = Smi::New(0); // no coverage recorded.
1348 coverage_array_.SetAt(p->value, value);
1349 }
1350}
static ArrayPtr New(intptr_t len, Heap::Space space=Heap::kNew)
Definition: object.h:10959
void SetAt(intptr_t index, const Object &value) const
Definition: object.h:10880
intptr_t Length() const
Definition: hash_map.h:27
Iterator GetIterator() const
Definition: hash_map.h:87
bool IsNull() const
Definition: object.h:363
static SmiPtr New(intptr_t value)
Definition: object.h:10006

◆ FloatToDouble()

Fragment dart::kernel::BaseFlowGraphBuilder::FloatToDouble ( )

Definition at line 443 of file base_flow_graph_builder.cc.

443 {
444 Value* value = Pop();
445 FloatToDoubleInstr* instr = new FloatToDoubleInstr(value, DeoptId::kNone);
446 Push(instr);
447 return Fragment(instr);
448}

◆ GenericCheckBound()

Fragment dart::kernel::BaseFlowGraphBuilder::GenericCheckBound ( )

Definition at line 400 of file base_flow_graph_builder.cc.

400 {
401 Value* index = Pop();
402 Value* length = Pop();
403 auto* instr = new (Z) GenericCheckBoundInstr(length, index, GetNextDeoptId());
404 Push(instr);
405 return Fragment(instr);
406}
size_t length

◆ GetArguments()

InputsArray dart::kernel::BaseFlowGraphBuilder::GetArguments ( int  count)

Definition at line 819 of file base_flow_graph_builder.cc.

819 {
820 InputsArray arguments(Z, count);
821 arguments.SetLength(count);
822 for (intptr_t i = count - 1; i >= 0; --i) {
823 arguments[i] = Pop();
824 }
825 return arguments;
826}
int count
Definition: FontMgrTest.cpp:50

◆ GetCoverageIndexFor()

intptr_t dart::kernel::BaseFlowGraphBuilder::GetCoverageIndexFor ( intptr_t  encoded_position)
protected

Definition at line 1285 of file base_flow_graph_builder.cc.

1285 {
1286 if (coverage_array_.IsNull()) {
1287 // We have not yet created coverage_array, this is the first time we are
1288 // building the graph for this function. Collect coverage positions.
1289 intptr_t value =
1291 if (value > 0) {
1292 // Found.
1293 return value;
1294 }
1295 // Not found: Insert.
1296 const auto index = 2 * coverage_state_index_for_position_.Length() + 1;
1297 coverage_state_index_for_position_.Insert(encoded_position, index);
1298 return index;
1299 }
1300
1302 // coverage_array was already created, but we don't want to search
1303 // it linearly: Fill in the coverage_state_index_for_position_ to do
1304 // fast lookups.
1305 // TODO(jensj): If Length is small enough it's probably better to just do
1306 // the linear search.
1307 for (intptr_t i = 0; i < coverage_array_.Length(); i += 2) {
1308 intptr_t key = Smi::Value(static_cast<SmiPtr>(coverage_array_.At(i)));
1309 intptr_t value = i + 1;
1311 }
1312 }
1313
1314 intptr_t value = coverage_state_index_for_position_.Lookup(encoded_position);
1315
1316 if (value > 0) {
1317 // Found.
1318 return value;
1319 }
1320
1321 // Reaching here indicates that the graph is constructed in an unstable way.
1322 UNREACHABLE();
1323 return 1;
1324}
#define UNREACHABLE()
Definition: assert.h:248
ObjectPtr At(intptr_t index) const
Definition: object.h:10875
intptr_t Length() const
Definition: object.h:10829
V Lookup(const Key &key) const
Definition: hash_map.h:548
void Insert(const Key &key, const Value &value)
Definition: hash_map.h:543
intptr_t Value() const
Definition: object.h:9990

◆ GetNextDeoptId()

intptr_t dart::kernel::BaseFlowGraphBuilder::GetNextDeoptId ( )
inline

Definition at line 348 of file base_flow_graph_builder.h.

348 {
349 intptr_t deopt_id = thread_->compiler_state().GetNextDeoptId();
350 if (context_level_array_ != nullptr) {
351 intptr_t level = context_depth_;
352 context_level_array_->Add(deopt_id);
354 }
355 return deopt_id;
356 }
void Add(const T &value)
intptr_t GetNextDeoptId()
CompilerState & compiler_state()
Definition: thread.h:588

◆ GetStackDepth()

intptr_t dart::kernel::BaseFlowGraphBuilder::GetStackDepth ( ) const
inline

Definition at line 404 of file base_flow_graph_builder.h.

404 {
405 return stack_ == nullptr ? 0 : stack_->definition()->temp_index() + 1;
406 }

◆ Goto()

Fragment dart::kernel::BaseFlowGraphBuilder::Goto ( JoinEntryInstr destination)

Definition at line 252 of file base_flow_graph_builder.cc.

252 {
253 return Fragment(new (Z) GotoInstr(destination, GetNextDeoptId())).closed();
254}

◆ GuardFieldClass()

Fragment dart::kernel::BaseFlowGraphBuilder::GuardFieldClass ( const Field field,
intptr_t  deopt_id 
)

Definition at line 502 of file base_flow_graph_builder.cc.

503 {
504 return Fragment(new (Z) GuardFieldClassInstr(Pop(), field, deopt_id));
505}

◆ GuardFieldLength()

Fragment dart::kernel::BaseFlowGraphBuilder::GuardFieldLength ( const Field field,
intptr_t  deopt_id 
)

Definition at line 497 of file base_flow_graph_builder.cc.

498 {
499 return Fragment(new (Z) GuardFieldLengthInstr(Pop(), field, deopt_id));
500}

◆ has_saved_args_desc_array()

bool dart::kernel::BaseFlowGraphBuilder::has_saved_args_desc_array ( )
inline

Definition at line 504 of file base_flow_graph_builder.h.

504 {
506 }
bool HasSavedArgumentsDescriptor() const
Definition: object.h:3273

◆ InitConstantParameters()

Fragment dart::kernel::BaseFlowGraphBuilder::InitConstantParameters ( )

Definition at line 1219 of file base_flow_graph_builder.cc.

1219 {
1220 Fragment instructions;
1221 const intptr_t parameter_count = parsed_function_->function().NumParameters();
1222 for (intptr_t i = 0; i < parameter_count; ++i) {
1223 LocalVariable* raw_parameter = parsed_function_->RawParameterVariable(i);
1224 const Object* param_value = raw_parameter->inferred_arg_value();
1225 if (param_value != nullptr) {
1226 instructions += Constant(*param_value);
1227 instructions += StoreLocalRaw(TokenPosition::kNoSource, raw_parameter);
1228 instructions += Drop();
1229 }
1230 }
1231 return instructions;
1232}
intptr_t NumParameters() const
Definition: object.cc:8877
const Object * inferred_arg_value() const
Definition: scopes.h:138
LocalVariable * RawParameterVariable(intptr_t i) const
Definition: parser.h:235
Fragment StoreLocalRaw(TokenPosition position, LocalVariable *variable)

◆ InlineBailout()

void dart::kernel::BaseFlowGraphBuilder::InlineBailout ( const char *  reason)

Definition at line 290 of file base_flow_graph_builder.cc.

290 {
291 if (IsInlining()) {
292 parsed_function_->function().set_is_inlinable(false);
293 parsed_function_->Bailout("kernel::BaseFlowGraphBuilder", reason);
294 }
295}
void Bailout(const char *origin, const char *reason) const
Definition: parser.cc:118

◆ InliningUncheckedEntry()

bool dart::kernel::BaseFlowGraphBuilder::InliningUncheckedEntry ( ) const
inline

Definition at line 401 of file base_flow_graph_builder.h.

◆ InstantiateDynamicTypeArguments()

Fragment dart::kernel::BaseFlowGraphBuilder::InstantiateDynamicTypeArguments ( )

Definition at line 1007 of file base_flow_graph_builder.cc.

1007 {
1008 Value* type_arguments = Pop();
1009 Value* function_type_args = Pop();
1010 Value* instantiator_type_args = Pop();
1011 const Function& function = Object::null_function();
1012 const Class& instantiator_class = Class::ZoneHandle(Z);
1013 InstantiateTypeArgumentsInstr* instr = new (Z) InstantiateTypeArgumentsInstr(
1014 InstructionSource(), instantiator_type_args, function_type_args,
1015 type_arguments, instantiator_class, function, GetNextDeoptId());
1016 Push(instr);
1017 return Fragment(instr);
1018}

◆ InstantiateType()

Fragment dart::kernel::BaseFlowGraphBuilder::InstantiateType ( const AbstractType type)

Definition at line 980 of file base_flow_graph_builder.cc.

980 {
981 Value* function_type_args = Pop();
982 Value* instantiator_type_args = Pop();
983 InstantiateTypeInstr* instr = new (Z)
984 InstantiateTypeInstr(InstructionSource(), type, instantiator_type_args,
985 function_type_args, GetNextDeoptId());
986 Push(instr);
987 return Fragment(instr);
988}
GLenum type

◆ InstantiateTypeArguments()

Fragment dart::kernel::BaseFlowGraphBuilder::InstantiateTypeArguments ( const TypeArguments type_arguments)

Definition at line 990 of file base_flow_graph_builder.cc.

991 {
992 Fragment instructions;
993 instructions += Constant(type_arguments_value);
994
995 Value* type_arguments = Pop();
996 Value* function_type_args = Pop();
997 Value* instantiator_type_args = Pop();
998 const Class& instantiator_class = Class::ZoneHandle(Z, function_.Owner());
999 InstantiateTypeArgumentsInstr* instr = new (Z) InstantiateTypeArgumentsInstr(
1000 InstructionSource(), instantiator_type_args, function_type_args,
1001 type_arguments, instantiator_class, function_, GetNextDeoptId());
1002 Push(instr);
1003 instructions += Fragment(instr);
1004 return instructions;
1005}
ClassPtr Owner() const
Definition: object.cc:10841

◆ IntConstant()

Fragment dart::kernel::BaseFlowGraphBuilder::IntConstant ( int64_t  value)

Definition at line 256 of file base_flow_graph_builder.cc.

256 {
257 return Fragment(
259}
static IntegerPtr New(const String &str, Heap::Space space=Heap::kNew)
Definition: object.cc:22984

◆ InvokeMathCFunction()

Fragment dart::kernel::BaseFlowGraphBuilder::InvokeMathCFunction ( MethodRecognizer::Kind  recognized_kind,
intptr_t  num_inputs 
)

Definition at line 1234 of file base_flow_graph_builder.cc.

1236 {
1237 InputsArray args = GetArguments(num_inputs);
1238 auto* instr = new (Z) InvokeMathCFunctionInstr(
1239 std::move(args), GetNextDeoptId(), recognized_kind,
1240 InstructionSource(TokenPosition::kNoSource));
1241 Push(instr);
1242 return Fragment(instr);
1243}
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args

◆ is_recording_context_levels()

bool dart::kernel::BaseFlowGraphBuilder::is_recording_context_levels ( ) const
inline

Definition at line 472 of file base_flow_graph_builder.h.

472 {
473 return context_level_array_ != nullptr;
474 }

◆ IsCompiledForOsr()

bool dart::kernel::BaseFlowGraphBuilder::IsCompiledForOsr ( )
inline

Definition at line 364 of file base_flow_graph_builder.h.

364{ return osr_id_ != DeoptId::kNone; }

◆ IsInlining()

bool dart::kernel::BaseFlowGraphBuilder::IsInlining ( ) const
inline

Definition at line 366 of file base_flow_graph_builder.h.

366{ return exit_collector_ != nullptr; }

◆ LoadArgDescriptor()

Fragment dart::kernel::BaseFlowGraphBuilder::LoadArgDescriptor ( )

Definition at line 297 of file base_flow_graph_builder.cc.

297 {
299 const ArgumentsDescriptor descriptor(saved_args_desc_array());
300 // Double-check that compile-time Size() matches runtime size on target.
302 function_, descriptor.Count()));
304 }
307}
static intptr_t ComputeArgumentsSizeInWords(const Function &function, intptr_t arguments_count)
Definition: flow_graph.cc:96
LocalVariable * arg_desc_var() const
Definition: parser.h:131
bool has_arg_desc_var() const
Definition: parser.h:130

◆ LoadClassId()

Fragment dart::kernel::BaseFlowGraphBuilder::LoadClassId ( )

Definition at line 1020 of file base_flow_graph_builder.cc.

1020 {
1021 LoadClassIdInstr* load = new (Z) LoadClassIdInstr(Pop());
1022 Push(load);
1023 return Fragment(load);
1024}
SI T load(const P *ptr)
Definition: Transform_inl.h:98

◆ LoadContextAt()

Fragment dart::kernel::BaseFlowGraphBuilder::LoadContextAt ( int  depth)

Definition at line 135 of file base_flow_graph_builder.cc.

135 {
136 intptr_t delta = context_depth_ - depth;
137 ASSERT(delta >= 0);
138 Fragment instructions = LoadLocal(parsed_function_->current_context_var());
139 while (delta-- > 0) {
140 instructions += LoadNativeField(Slot::Context_parent());
141 }
142 return instructions;
143}
LocalVariable * current_context_var() const
Definition: parser.h:128
Fragment LoadNativeField(const Slot &native_field, InnerPointerAccess loads_inner_pointer, bool calls_initializer=false)

◆ LoadField()

Fragment dart::kernel::BaseFlowGraphBuilder::LoadField ( const Field field,
bool  calls_initializer 
)

Definition at line 458 of file base_flow_graph_builder.cc.

459 {
461 calls_initializer);
462}
static const Slot & Get(const Field &field, const ParsedFunction *parsed_function)
Definition: slot.cc:351
static const Field & MayCloneField(Zone *zone, const Field &field)

◆ LoadFpRelativeSlot()

Fragment dart::kernel::BaseFlowGraphBuilder::LoadFpRelativeSlot ( intptr_t  offset,
CompileType  result_type,
Representation  representation = kTagged 
)

Definition at line 859 of file base_flow_graph_builder.cc.

862 {
863 LoadIndexedUnsafeInstr* instr = new (Z)
864 LoadIndexedUnsafeInstr(Pop(), offset, result_type, representation);
865 Push(instr);
866 return Fragment(instr);
867}

◆ LoadIndexed()

Fragment dart::kernel::BaseFlowGraphBuilder::LoadIndexed ( classid_t  class_id,
intptr_t  index_scale = compiler::target::kWordSize,
bool  index_unboxed = false,
AlignmentType  alignment = kAlignedAccess 
)

Definition at line 383 of file base_flow_graph_builder.cc.

386 {
387 Value* index = Pop();
388 // A C pointer if index_unboxed, otherwise a boxed Dart value.
389 Value* array = Pop();
390
391 // We use C behavior when dereferencing pointers, so we use aligned access in
392 // all cases.
393 LoadIndexedInstr* instr = new (Z)
394 LoadIndexedInstr(array, index, index_unboxed, index_scale, class_id,
395 alignment, DeoptId::kNone, InstructionSource());
396 Push(instr);
397 return Fragment(instr);
398}

◆ LoadLocal()

Fragment dart::kernel::BaseFlowGraphBuilder::LoadLocal ( LocalVariable variable)

Definition at line 486 of file base_flow_graph_builder.cc.

486 {
487 ASSERT(!variable->is_captured());
488 LoadLocalInstr* load = new (Z) LoadLocalInstr(*variable, InstructionSource());
489 Push(load);
490 return Fragment(load);
491}

◆ LoadNativeField() [1/2]

Fragment dart::kernel::BaseFlowGraphBuilder::LoadNativeField ( const Slot native_field,
bool  calls_initializer = false 
)

Definition at line 475 of file base_flow_graph_builder.cc.

476 {
477 const InnerPointerAccess loads_inner_pointer =
478 native_field.representation() == kUntagged
479 ? (native_field.may_contain_inner_pointer()
483 return LoadNativeField(native_field, loads_inner_pointer, calls_initializer);
484}
InnerPointerAccess
Definition: il.h:6295

◆ LoadNativeField() [2/2]

Fragment dart::kernel::BaseFlowGraphBuilder::LoadNativeField ( const Slot native_field,
InnerPointerAccess  loads_inner_pointer,
bool  calls_initializer = false 
)

Definition at line 464 of file base_flow_graph_builder.cc.

467 {
468 LoadFieldInstr* load = new (Z) LoadFieldInstr(
469 Pop(), native_field, loads_inner_pointer, InstructionSource(),
470 calls_initializer, calls_initializer ? GetNextDeoptId() : DeoptId::kNone);
471 Push(load);
472 return Fragment(load);
473}
@ kNone
Definition: layer.h:53

◆ LoadStaticField()

Fragment dart::kernel::BaseFlowGraphBuilder::LoadStaticField ( const Field field,
bool  calls_initializer 
)

Definition at line 583 of file base_flow_graph_builder.cc.

584 {
585 LoadStaticFieldInstr* load = new (Z) LoadStaticFieldInstr(
586 field, InstructionSource(), calls_initializer,
587 calls_initializer ? GetNextDeoptId() : DeoptId::kNone);
588 Push(load);
589 return Fragment(load);
590}

◆ LoadUntagged()

Fragment dart::kernel::BaseFlowGraphBuilder::LoadUntagged ( intptr_t  offset)

Definition at line 408 of file base_flow_graph_builder.cc.

408 {
409 Value* object = Pop();
410 auto load = new (Z) LoadUntaggedInstr(object, offset);
411 Push(load);
412 return Fragment(load);
413}

◆ MakeTemp()

Fragment dart::kernel::BaseFlowGraphBuilder::MakeTemp ( )

Definition at line 785 of file base_flow_graph_builder.cc.

785 {
786 MakeTempInstr* make_temp = new (Z) MakeTempInstr(Z);
787 Push(make_temp);
788 return Fragment(make_temp);
789}

◆ MakeTemporary()

LocalVariable * dart::kernel::BaseFlowGraphBuilder::MakeTemporary ( const char *  suffix = nullptr)

Definition at line 683 of file base_flow_graph_builder.cc.

683 {
684 static constexpr intptr_t kTemporaryNameLength = 64;
685 char name[kTemporaryNameLength];
686 intptr_t index = stack_->definition()->temp_index();
687 if (suffix != nullptr) {
688 Utils::SNPrint(name, kTemporaryNameLength, ":t_%s", suffix);
689 } else {
690 Utils::SNPrint(name, kTemporaryNameLength, ":t%" Pd, index);
691 }
692 const String& symbol_name =
694 LocalVariable* variable =
695 new (Z) LocalVariable(TokenPosition::kNoSource, TokenPosition::kNoSource,
696 symbol_name, Object::dynamic_type());
697 // Set the index relative to the base of the expression stack including
698 // outgoing arguments.
699 variable->set_index(
700 VariableIndex(-parsed_function_->num_stack_locals() - index));
701
702 // The value on top of the stack has uses as if it were a local variable.
703 // Mark all definitions on the stack as used so that their temp indices
704 // will not be cleared (causing them to never be materialized in the
705 // expression stack and skew stack depth).
706 for (Value* item = stack_; item != nullptr; item = item->next_use()) {
707 item->definition()->set_ssa_temp_index(0);
708 }
709
710 return variable;
711}
static int SNPrint(char *str, size_t size, const char *format,...) PRINTF_ATTRIBUTE(3
Value * next_use() const
Definition: il.h:114
const char *const name
#define Pd
Definition: globals.h:408

◆ MayCloneField()

const Field & dart::kernel::BaseFlowGraphBuilder::MayCloneField ( Zone zone,
const Field field 
)
static

Definition at line 507 of file base_flow_graph_builder.cc.

508 {
509 if (CompilerState::Current().should_clone_fields() && field.IsOriginal()) {
510 return Field::ZoneHandle(zone, field.CloneFromOriginal());
511 } else {
512 DEBUG_ASSERT(field.IsNotTemporaryScopedHandle());
513 return field;
514 }
515}
static CompilerState & Current()

◆ MemoryCopy()

Fragment dart::kernel::BaseFlowGraphBuilder::MemoryCopy ( classid_t  src_cid,
classid_t  dest_cid,
bool  unboxed_inputs,
bool  can_overlap = true 
)

Definition at line 270 of file base_flow_graph_builder.cc.

273 {
274 Value* length = Pop();
275 Value* dest_start = Pop();
276 Value* src_start = Pop();
277 Value* dest = Pop();
278 Value* src = Pop();
279 auto copy =
280 new (Z) MemoryCopyInstr(src, src_cid, dest, dest_cid, src_start,
281 dest_start, length, unboxed_inputs, can_overlap);
282 return Fragment(copy);
283}
Definition: copy.py:1
dest
Definition: zip.py:79

◆ NullConstant()

Fragment dart::kernel::BaseFlowGraphBuilder::NullConstant ( )

Definition at line 493 of file base_flow_graph_builder.cc.

493 {
495}

◆ Peek()

Definition * dart::kernel::BaseFlowGraphBuilder::Peek ( intptr_t  depth = 0)

Definition at line 733 of file base_flow_graph_builder.cc.

733 {
734 Value* head = stack_;
735 for (intptr_t i = 0; i < depth; ++i) {
736 ASSERT(head != nullptr);
737 head = head->next_use();
738 }
739 ASSERT(head != nullptr);
740 return head->definition();
741}

◆ Pop()

Value * dart::kernel::BaseFlowGraphBuilder::Pop ( )

Definition at line 743 of file base_flow_graph_builder.cc.

743 {
744 ASSERT(stack_ != nullptr);
745 Value* value = stack_;
746 stack_ = value->next_use();
747 if (stack_ != nullptr) stack_->set_previous_use(nullptr);
748
749 value->set_next_use(nullptr);
750 value->set_previous_use(nullptr);
751 value->definition()->ClearSSATempIndex();
752 return value;
753}
void set_previous_use(Value *previous)
Definition: il.h:112

◆ Push()

void dart::kernel::BaseFlowGraphBuilder::Push ( Definition definition)

Definition at line 728 of file base_flow_graph_builder.cc.

728 {
729 SetTempIndex(definition);
730 Value::AddToList(new (Z) Value(definition), &stack_);
731}
static void AddToList(Value *value, Value **list)
Definition: il.cc:1446
void SetTempIndex(Definition *definition)

◆ ReachabilityFence()

Fragment dart::kernel::BaseFlowGraphBuilder::ReachabilityFence ( )

Definition at line 601 of file base_flow_graph_builder.cc.

601 {
602 Fragment instructions;
603 instructions <<= new (Z) ReachabilityFenceInstr(Pop());
604 return instructions;
605}

◆ RecordBranchCoverage()

Fragment dart::kernel::BaseFlowGraphBuilder::RecordBranchCoverage ( TokenPosition  position)

is_branch_coverage

Definition at line 1266 of file base_flow_graph_builder.cc.

1266 {
1267 return RecordCoverageImpl(position, true /** is_branch_coverage **/);
1268}
Fragment RecordCoverageImpl(TokenPosition position, bool is_branch_coverage)

◆ RecordCoverage()

Fragment dart::kernel::BaseFlowGraphBuilder::RecordCoverage ( TokenPosition  position)

is_branch_coverage

Definition at line 1262 of file base_flow_graph_builder.cc.

1262 {
1263 return RecordCoverageImpl(position, false /** is_branch_coverage **/);
1264}

◆ RecordCoverageImpl()

Fragment dart::kernel::BaseFlowGraphBuilder::RecordCoverageImpl ( TokenPosition  position,
bool  is_branch_coverage 
)
protected

Definition at line 1270 of file base_flow_graph_builder.cc.

1271 {
1272 Fragment instructions;
1273 if (!SupportsCoverage()) return instructions;
1274 if (!IG->coverage()) return instructions;
1275 if (!position.IsReal()) return instructions;
1276 if (is_branch_coverage && !IG->branch_coverage()) return instructions;
1277
1278 const intptr_t coverage_index =
1279 GetCoverageIndexFor(position.EncodeCoveragePosition(is_branch_coverage));
1280 instructions <<= new (Z) RecordCoverageInstr(coverage_array(), coverage_index,
1281 InstructionSource(position));
1282 return instructions;
1283}
intptr_t GetCoverageIndexFor(intptr_t encoded_position)
static bool SupportsCoverage()

◆ RecordUncheckedEntryPoint()

void dart::kernel::BaseFlowGraphBuilder::RecordUncheckedEntryPoint ( GraphEntryInstr graph_entry,
FunctionEntryInstr unchecked_entry 
)

Definition at line 1095 of file base_flow_graph_builder.cc.

1097 {
1098 // Closures always check all arguments on their checked entry-point, most
1099 // call-sites are unchecked, and they're inlined less often, so it's very
1100 // beneficial to build multiple entry-points for them. Regular methods however
1101 // have fewer checks to begin with since they have dynamic invocation
1102 // forwarders, so in AOT we implement a more conservative time-space tradeoff
1103 // by only building the unchecked entry-point when inlining. We should
1104 // reconsider this heuristic if we identify non-inlined type-checks in
1105 // hotspots of new benchmarks.
1108 graph_entry->set_unchecked_entry(unchecked_entry);
1109 } else if (InliningUncheckedEntry()) {
1110 graph_entry->set_normal_entry(unchecked_entry);
1111 }
1112}
bool is_aot() const
bool IsClosureFunction() const
Definition: object.h:3891

◆ RedefinitionWithType()

Fragment dart::kernel::BaseFlowGraphBuilder::RedefinitionWithType ( const AbstractType type)

Definition at line 592 of file base_flow_graph_builder.cc.

592 {
593 auto redefinition = new (Z) RedefinitionInstr(Pop());
594 redefinition->set_constrained_type(
595 new (Z) CompileType(CompileType::FromAbstractType(
597 Push(redefinition);
598 return Fragment(redefinition);
599}
static constexpr bool kCannotBeSentinel
Definition: compile_type.h:49
static constexpr bool kCanBeNull
Definition: compile_type.h:45
static CompileType FromAbstractType(const AbstractType &type, bool can_be_null, bool can_be_sentinel)

◆ reset_context_depth_for_deopt_id()

void dart::kernel::BaseFlowGraphBuilder::reset_context_depth_for_deopt_id ( intptr_t  deopt_id)

Definition at line 1190 of file base_flow_graph_builder.cc.

1190 {
1192 for (intptr_t i = 0, n = context_level_array_->length(); i < n; i += 2) {
1193 if (context_level_array_->At(i) == deopt_id) {
1194 (*context_level_array_)[i + 1] = context_depth_;
1195 return;
1196 }
1197 ASSERT(context_level_array_->At(i) < deopt_id);
1198 }
1199 }
1200}
const T & At(intptr_t index) const
intptr_t length() const

◆ Return()

Fragment dart::kernel::BaseFlowGraphBuilder::Return ( TokenPosition  position)

Definition at line 209 of file base_flow_graph_builder.cc.

209 {
210 Fragment instructions;
211
212 Value* value = Pop();
213 ASSERT(stack_ == nullptr);
214 const Function& function = parsed_function_->function();
215 const Representation representation =
217 DartReturnInstr* return_instr = new (Z) DartReturnInstr(
218 InstructionSource(position), value, GetNextDeoptId(), representation);
219 if (exit_collector_ != nullptr) exit_collector_->AddExit(return_instr);
220
221 instructions <<= return_instr;
222
223 return instructions.closed();
224}
static Representation ReturnRepresentationOf(const Function &function)
Definition: flow_graph.cc:125
void AddExit(DartReturnInstr *exit)
Representation
Definition: locations.h:66

◆ saved_args_desc_array()

const Array & dart::kernel::BaseFlowGraphBuilder::saved_args_desc_array ( )
inline

Definition at line 509 of file base_flow_graph_builder.h.

509 {
512 }

◆ set_context_depth()

void dart::kernel::BaseFlowGraphBuilder::set_context_depth ( intptr_t  context_level)
inline

Definition at line 478 of file base_flow_graph_builder.h.

478 {
479 context_depth_ = context_level;
480 }

◆ SetCurrentTryIndex()

void dart::kernel::BaseFlowGraphBuilder::SetCurrentTryIndex ( intptr_t  try_index)
inline

Definition at line 360 of file base_flow_graph_builder.h.

360 {
361 current_try_index_ = try_index;
362 }

◆ SetTempIndex()

void dart::kernel::BaseFlowGraphBuilder::SetTempIndex ( Definition definition)

Definition at line 723 of file base_flow_graph_builder.cc.

723 {
724 definition->set_temp_index(
725 stack_ == nullptr ? 0 : stack_->definition()->temp_index() + 1);
726}

◆ SmiBinaryOp()

Fragment dart::kernel::BaseFlowGraphBuilder::SmiBinaryOp ( Token::Kind  op,
bool  is_truncating = false 
)

Definition at line 837 of file base_flow_graph_builder.cc.

838 {
839 return BinaryIntegerOp(kind, kTagged, is_truncating);
840}
Fragment BinaryIntegerOp(Token::Kind op, Representation representation, bool is_truncating=false)

◆ SmiRelationalOp()

Fragment dart::kernel::BaseFlowGraphBuilder::SmiRelationalOp ( Token::Kind  kind)

Definition at line 828 of file base_flow_graph_builder.cc.

828 {
829 Value* right = Pop();
830 Value* left = Pop();
831 RelationalOpInstr* instr = new (Z) RelationalOpInstr(
832 InstructionSource(), kind, left, right, kSmiCid, GetNextDeoptId());
833 Push(instr);
834 return Fragment(instr);
835}

◆ StoreField()

Fragment dart::kernel::BaseFlowGraphBuilder::StoreField ( const Field field,
StoreFieldInstr::Kind  kind = StoreFieldInstr::Kind::kOther,
StoreBarrierType  emit_store_barrier = kEmitStoreBarrier 
)

Definition at line 532 of file base_flow_graph_builder.cc.

535 {
536 return StoreNativeField(TokenPosition::kNoSource,
538 kind, emit_store_barrier);
539}
Fragment StoreNativeField(TokenPosition position, const Slot &slot, InnerPointerAccess stores_inner_pointer, StoreFieldInstr::Kind kind=StoreFieldInstr::Kind::kOther, StoreBarrierType emit_store_barrier=kEmitStoreBarrier, compiler::Assembler::MemoryOrder memory_order=compiler::Assembler::kRelaxedNonAtomic)

◆ StoreFieldGuarded()

Fragment dart::kernel::BaseFlowGraphBuilder::StoreFieldGuarded ( const Field field,
StoreFieldInstr::Kind  kind = StoreFieldInstr::Kind::kOther 
)

Definition at line 541 of file base_flow_graph_builder.cc.

543 {
544 Fragment instructions;
545 const Field& field_clone = MayCloneField(Z, field);
546 if (IG->use_field_guards()) {
547 LocalVariable* store_expression = MakeTemporary();
548
549 // Note: unboxing decision can only change due to hot reload at which
550 // point all code will be cleared, so there is no need to worry about
551 // stability of deopt id numbering.
552 if (!field_clone.is_unboxed()) {
553 instructions += LoadLocal(store_expression);
554 instructions += GuardFieldClass(field_clone, GetNextDeoptId());
555 }
556
557 // Field length guard can be omitted if it is not needed.
558 // However, it is possible that we were tracking list length previously,
559 // and generated length guards in the past. We need to generate same IL
560 // to keep deopt ids stable, but we can discard generated IL fragment
561 // if length guard is not needed.
562 Fragment length_guard;
563 length_guard += LoadLocal(store_expression);
564 length_guard += GuardFieldLength(field_clone, GetNextDeoptId());
565
566 if (field_clone.needs_length_check()) {
567 instructions += length_guard;
568 }
569
570 // If we are tracking exactness of the static type of the field then
571 // emit appropriate guard.
572 if (field_clone.static_type_exactness_state().IsTracking()) {
573 instructions += LoadLocal(store_expression);
574 instructions <<=
575 new (Z) GuardFieldTypeInstr(Pop(), field_clone, GetNextDeoptId());
576 }
577 }
578 instructions +=
579 StoreNativeField(Slot::Get(field_clone, parsed_function_), kind);
580 return instructions;
581}
Fragment GuardFieldLength(const Field &field, intptr_t deopt_id)
Fragment GuardFieldClass(const Field &field, intptr_t deopt_id)

◆ StoreFpRelativeSlot()

Fragment dart::kernel::BaseFlowGraphBuilder::StoreFpRelativeSlot ( intptr_t  offset)

Definition at line 869 of file base_flow_graph_builder.cc.

869 {
870 Value* value = Pop();
871 Value* index = Pop();
872 StoreIndexedUnsafeInstr* instr =
873 new (Z) StoreIndexedUnsafeInstr(index, value, offset);
874 return Fragment(instr);
875}

◆ StoreIndexed()

Fragment dart::kernel::BaseFlowGraphBuilder::StoreIndexed ( classid_t  class_id)

Definition at line 628 of file base_flow_graph_builder.cc.

628 {
629 // This fragment builder cannot be used for typed data accesses.
630 ASSERT(!IsTypedDataBaseClassId(class_id));
631 Value* value = Pop();
632 Value* index = Pop();
633 const StoreBarrierType emit_store_barrier =
634 value->BindsToConstant() ? kNoStoreBarrier : kEmitStoreBarrier;
635 StoreIndexedInstr* store = new (Z) StoreIndexedInstr(
636 Pop(), // Array.
637 index, value, emit_store_barrier, /*index_unboxed=*/false,
639 kAlignedAccess, DeoptId::kNone, InstructionSource());
640 return Fragment(store);
641}
SI void store(P *ptr, const T &val)
static word ElementSizeFor(intptr_t cid)
Definition: runtime_api.cc:581
bool IsTypedDataBaseClassId(intptr_t index)
Definition: class_id.h:429
StoreBarrierType
Definition: il.h:6301
@ kNoStoreBarrier
Definition: il.h:6301
@ kEmitStoreBarrier
Definition: il.h:6301
@ kAlignedAccess
Definition: il.h:6766

◆ StoreIndexedTypedData()

Fragment dart::kernel::BaseFlowGraphBuilder::StoreIndexedTypedData ( classid_t  class_id,
intptr_t  index_scale,
bool  index_unboxed,
AlignmentType  alignment = kAlignedAccess 
)

Definition at line 643 of file base_flow_graph_builder.cc.

646 {
648 Value* value = Pop();
649 Value* index = Pop();
650 Value* c_pointer = Pop();
651 StoreIndexedInstr* instr = new (Z) StoreIndexedInstr(
652 c_pointer, index, value, kNoStoreBarrier, index_unboxed, index_scale,
653 class_id, alignment, DeoptId::kNone, InstructionSource(),
654 Instruction::SpeculativeMode::kNotSpeculative);
655 return Fragment(instr);
656}

◆ StoreLocal() [1/2]

Fragment dart::kernel::BaseFlowGraphBuilder::StoreLocal ( LocalVariable variable)
inline

Definition at line 200 of file base_flow_graph_builder.h.

200 {
201 return StoreLocal(TokenPosition::kNoSource, variable);
202 }
Fragment StoreLocal(LocalVariable *variable)

◆ StoreLocal() [2/2]

Fragment dart::kernel::BaseFlowGraphBuilder::StoreLocal ( TokenPosition  position,
LocalVariable variable 
)

Definition at line 658 of file base_flow_graph_builder.cc.

659 {
660 if (variable->is_captured()) {
661 Fragment instructions;
662 LocalVariable* value = MakeTemporary();
663 instructions += LoadContextAt(variable->owner()->context_level());
664 instructions += LoadLocal(value);
665 instructions += StoreNativeField(
666 position, Slot::GetContextVariableSlotFor(thread_, *variable));
667 return instructions;
668 }
669 return StoreLocalRaw(position, variable);
670}
static const Slot & GetContextVariableSlotFor(Thread *thread, const LocalVariable &var)
Definition: slot.cc:292

◆ StoreLocalRaw()

Fragment dart::kernel::BaseFlowGraphBuilder::StoreLocalRaw ( TokenPosition  position,
LocalVariable variable 
)

Definition at line 672 of file base_flow_graph_builder.cc.

673 {
674 ASSERT(!variable->is_captured());
675 Value* value = Pop();
676 StoreLocalInstr* store =
677 new (Z) StoreLocalInstr(*variable, value, InstructionSource(position));
678 Fragment instructions(store);
679 Push(store);
680 return instructions;
681}

◆ StoreNativeField() [1/4]

Fragment dart::kernel::BaseFlowGraphBuilder::StoreNativeField ( const Slot slot,
InnerPointerAccess  stores_inner_pointer,
StoreFieldInstr::Kind  kind = StoreFieldInstr::Kind::kOther,
StoreBarrierType  emit_store_barrier = kEmitStoreBarrier,
compiler::Assembler::MemoryOrder  memory_order = compiler::Assembler::kRelaxedNonAtomic 
)
inline

Definition at line 227 of file base_flow_graph_builder.h.

233 {
234 return StoreNativeField(TokenPosition::kNoSource, slot,
235 stores_inner_pointer, kind, emit_store_barrier,
236 memory_order);
237 }

◆ StoreNativeField() [2/4]

Fragment dart::kernel::BaseFlowGraphBuilder::StoreNativeField ( const Slot slot,
StoreFieldInstr::Kind  kind = StoreFieldInstr::Kind::kOther,
StoreBarrierType  emit_store_barrier = kEmitStoreBarrier,
compiler::Assembler::MemoryOrder  memory_order = compiler::Assembler::kRelaxedNonAtomic 
)
inline

Definition at line 238 of file base_flow_graph_builder.h.

243 {
244 return StoreNativeField(TokenPosition::kNoSource, slot,
246 emit_store_barrier, memory_order);
247 }

◆ StoreNativeField() [3/4]

Fragment dart::kernel::BaseFlowGraphBuilder::StoreNativeField ( TokenPosition  position,
const Slot slot,
InnerPointerAccess  stores_inner_pointer,
StoreFieldInstr::Kind  kind = StoreFieldInstr::Kind::kOther,
StoreBarrierType  emit_store_barrier = kEmitStoreBarrier,
compiler::Assembler::MemoryOrder  memory_order = compiler::Assembler::kRelaxedNonAtomic 
)

Definition at line 517 of file base_flow_graph_builder.cc.

523 {
524 Value* value = Pop();
525 Value* instance = Pop();
526 StoreFieldInstr* store = new (Z)
527 StoreFieldInstr(slot, instance, value, emit_store_barrier,
528 stores_inner_pointer, InstructionSource(position), kind);
529 return Fragment(store);
530}
VkInstance instance
Definition: main.cc:48

◆ StoreNativeField() [4/4]

Fragment dart::kernel::BaseFlowGraphBuilder::StoreNativeField ( TokenPosition  position,
const Slot slot,
StoreFieldInstr::Kind  kind = StoreFieldInstr::Kind::kOther,
StoreBarrierType  emit_store_barrier = kEmitStoreBarrier,
compiler::Assembler::MemoryOrder  memory_order = compiler::Assembler::kRelaxedNonAtomic 
)
inline

Definition at line 217 of file base_flow_graph_builder.h.

223 {
225 kind, emit_store_barrier, memory_order);
226 }

◆ StoreStaticField()

Fragment dart::kernel::BaseFlowGraphBuilder::StoreStaticField ( TokenPosition  position,
const Field field 
)

Definition at line 622 of file base_flow_graph_builder.cc.

623 {
624 return Fragment(new (Z) StoreStaticFieldInstr(MayCloneField(Z, field), Pop(),
625 InstructionSource(position)));
626}

◆ StrictCompare() [1/2]

Fragment dart::kernel::BaseFlowGraphBuilder::StrictCompare ( Token::Kind  kind,
bool  number_check = false 
)

Definition at line 157 of file base_flow_graph_builder.cc.

158 {
159 Value* right = Pop();
160 Value* left = Pop();
161 StrictCompareInstr* compare = new (Z) StrictCompareInstr(
162 InstructionSource(), kind, left, right, number_check, GetNextDeoptId());
163 Push(compare);
164 return Fragment(compare);
165}

◆ StrictCompare() [2/2]

Fragment dart::kernel::BaseFlowGraphBuilder::StrictCompare ( TokenPosition  position,
Token::Kind  kind,
bool  number_check = false 
)

Definition at line 145 of file base_flow_graph_builder.cc.

147 {
148 Value* right = Pop();
149 Value* left = Pop();
150 StrictCompareInstr* compare =
151 new (Z) StrictCompareInstr(InstructionSource(position), kind, left, right,
152 number_check, GetNextDeoptId());
153 Push(compare);
154 return Fragment(compare);
155}

◆ TailCall()

Fragment dart::kernel::BaseFlowGraphBuilder::TailCall ( const Code code)

Definition at line 285 of file base_flow_graph_builder.cc.

285 {
286 Value* arg_desc = Pop();
287 return Fragment(new (Z) TailCallInstr(code, arg_desc)).closed();
288}

◆ TestAnyTypeArgs()

Fragment dart::kernel::BaseFlowGraphBuilder::TestAnyTypeArgs ( Fragment  present,
Fragment  absent 
)

Definition at line 362 of file base_flow_graph_builder.cc.

363 {
365 LocalVariable* closure = parsed_function_->ParameterVariable(0);
366
367 JoinEntryInstr* complete = BuildJoinEntry();
368 JoinEntryInstr* present_entry = BuildJoinEntry();
369
370 Fragment test = TestTypeArgsLen(
371 TestDelayedTypeArgs(closure, Goto(present_entry), absent),
372 Goto(present_entry), 0);
373 test += Goto(complete);
374
375 Fragment(present_entry) + present + Goto(complete);
376
377 return Fragment(test.entry, complete);
378 } else {
379 return TestTypeArgsLen(absent, present, 0);
380 }
381}
LocalVariable * ParameterVariable(intptr_t i) const
Definition: parser.h:239
Fragment TestDelayedTypeArgs(LocalVariable *closure, Fragment present, Fragment absent)
Fragment TestTypeArgsLen(Fragment eq_branch, Fragment neq_branch, intptr_t num_type_args)
Fragment Goto(JoinEntryInstr *destination)

◆ TestDelayedTypeArgs()

Fragment dart::kernel::BaseFlowGraphBuilder::TestDelayedTypeArgs ( LocalVariable closure,
Fragment  present,
Fragment  absent 
)

Definition at line 339 of file base_flow_graph_builder.cc.

341 {
342 Fragment test;
343
344 TargetEntryInstr* absent_entry;
345 TargetEntryInstr* present_entry;
346
348 test += LoadNativeField(Slot::Closure_delayed_type_arguments());
349 test += Constant(Object::empty_type_arguments());
350 test += BranchIfEqual(&absent_entry, &present_entry);
351
352 present.Prepend(present_entry);
353 absent.Prepend(absent_entry);
354
355 JoinEntryInstr* join = BuildJoinEntry();
356 absent += Goto(join);
357 present += Goto(join);
358
359 return Fragment(test.entry, join);
360}
#define test(name)
static SkString join(const CommandLineFlags::StringArray &)
Definition: skpbench.cpp:741

◆ TestTypeArgsLen()

Fragment dart::kernel::BaseFlowGraphBuilder::TestTypeArgsLen ( Fragment  eq_branch,
Fragment  neq_branch,
intptr_t  num_type_args 
)

Definition at line 309 of file base_flow_graph_builder.cc.

311 {
312 Fragment test;
313
314 // Compile-time arguments descriptor case.
316 const ArgumentsDescriptor descriptor(saved_args_desc_array_);
317 return descriptor.TypeArgsLen() == num_type_args ? eq_branch : neq_branch;
318 }
319
320 // Runtime arguments descriptor case.
321 TargetEntryInstr* eq_entry;
322 TargetEntryInstr* neq_entry;
323
325 test += LoadNativeField(Slot::ArgumentsDescriptor_type_args_len());
326 test += IntConstant(num_type_args);
327 test += BranchIfEqual(&eq_entry, &neq_entry);
328
329 eq_branch.Prepend(eq_entry);
330 neq_branch.Prepend(neq_entry);
331
332 JoinEntryInstr* join = BuildJoinEntry();
333 eq_branch += Goto(join);
334 neq_branch += Goto(join);
335
336 return Fragment(test.entry, join);
337}

◆ ThrowException()

Fragment dart::kernel::BaseFlowGraphBuilder::ThrowException ( TokenPosition  position)

Definition at line 889 of file base_flow_graph_builder.cc.

889 {
890 Fragment instructions;
891 Value* exception = Pop();
892 instructions += Fragment(new (Z) ThrowInstr(InstructionSource(position),
893 GetNextDeoptId(), exception))
894 .closed();
895 // Use its side effect of leaving a constant on the stack (does not change
896 // the graph).
897 NullConstant();
898
899 return instructions;
900}

◆ UnaryDoubleOp()

Fragment dart::kernel::BaseFlowGraphBuilder::UnaryDoubleOp ( Token::Kind  op)

Definition at line 1254 of file base_flow_graph_builder.cc.

1254 {
1255 Value* value = Pop();
1256 auto* instr = new (Z) UnaryDoubleOpInstr(op, value, GetNextDeoptId(),
1258 Push(instr);
1259 return Fragment(instr);
1260}
@ kNotSpeculative
Definition: il.h:975

◆ UnboxedIntConstant()

Fragment dart::kernel::BaseFlowGraphBuilder::UnboxedIntConstant ( int64_t  value,
Representation  representation 
)

Definition at line 261 of file base_flow_graph_builder.cc.

263 {
265 auto const constant = new (Z) UnboxedConstantInstr(obj, representation);
266 Push(constant);
267 return Fragment(constant);
268}
static IntegerPtr NewCanonical(const String &str)
Definition: object.cc:22999

◆ Utf8Scan()

Fragment dart::kernel::BaseFlowGraphBuilder::Utf8Scan ( )

Definition at line 607 of file base_flow_graph_builder.cc.

607 {
608 Value* table = Pop();
609 Value* end = Pop();
610 Value* start = Pop();
611 Value* bytes = Pop();
612 Value* decoder = Pop();
613 const Field& scan_flags_field =
615 auto scan = new (Z) Utf8ScanInstr(
616 decoder, bytes, start, end, table,
617 Slot::Get(MayCloneField(Z, scan_flags_field), parsed_function_));
618 Push(scan);
619 return Fragment(scan);
620}
SI F table(const skcms_Curve *curve, F v)
glong glong end
const Field & LookupConvertUtf8DecoderScanFlagsField()
Definition: runtime_api.cc:271

Friends And Related Function Documentation

◆ StreamingFlowGraphBuilder

friend class StreamingFlowGraphBuilder
friend

Definition at line 543 of file base_flow_graph_builder.h.

Member Data Documentation

◆ context_depth_

intptr_t dart::kernel::BaseFlowGraphBuilder::context_depth_
protected

Definition at line 526 of file base_flow_graph_builder.h.

◆ context_level_array_

ZoneGrowableArray<intptr_t>* dart::kernel::BaseFlowGraphBuilder::context_level_array_
protected

Definition at line 525 of file base_flow_graph_builder.h.

◆ coverage_array_

Array& dart::kernel::BaseFlowGraphBuilder::coverage_array_
protected

Definition at line 541 of file base_flow_graph_builder.h.

◆ coverage_state_index_for_position_

IntMap<intptr_t> dart::kernel::BaseFlowGraphBuilder::coverage_state_index_for_position_
protected

Definition at line 540 of file base_flow_graph_builder.h.

◆ current_try_index_

intptr_t dart::kernel::BaseFlowGraphBuilder::current_try_index_
protected

Definition at line 529 of file base_flow_graph_builder.h.

◆ exit_collector_

InlineExitCollector* dart::kernel::BaseFlowGraphBuilder::exit_collector_
protected

Definition at line 533 of file base_flow_graph_builder.h.

◆ function_

const Function& dart::kernel::BaseFlowGraphBuilder::function_
protected

Definition at line 520 of file base_flow_graph_builder.h.

◆ inlining_unchecked_entry_

const bool dart::kernel::BaseFlowGraphBuilder::inlining_unchecked_entry_
protected

Definition at line 535 of file base_flow_graph_builder.h.

◆ last_used_block_id_

intptr_t dart::kernel::BaseFlowGraphBuilder::last_used_block_id_
protected

Definition at line 527 of file base_flow_graph_builder.h.

◆ next_used_try_index_

intptr_t dart::kernel::BaseFlowGraphBuilder::next_used_try_index_
protected

Definition at line 530 of file base_flow_graph_builder.h.

◆ osr_id_

intptr_t dart::kernel::BaseFlowGraphBuilder::osr_id_
protected

Definition at line 523 of file base_flow_graph_builder.h.

◆ parsed_function_

const ParsedFunction* dart::kernel::BaseFlowGraphBuilder::parsed_function_
protected

Definition at line 519 of file base_flow_graph_builder.h.

◆ saved_args_desc_array_

const Array& dart::kernel::BaseFlowGraphBuilder::saved_args_desc_array_
protected

Definition at line 536 of file base_flow_graph_builder.h.

◆ stack_

Value* dart::kernel::BaseFlowGraphBuilder::stack_
protected

Definition at line 532 of file base_flow_graph_builder.h.

◆ thread_

Thread* dart::kernel::BaseFlowGraphBuilder::thread_
protected

Definition at line 521 of file base_flow_graph_builder.h.

◆ zone_

Zone* dart::kernel::BaseFlowGraphBuilder::zone_
protected

Definition at line 522 of file base_flow_graph_builder.h.


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