Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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_
 
GrowableArray< intptr_t > coverage_array_positions_
 
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:8191
static Object & ZoneHandle()
Definition object.h:419
const Function & function() const
Definition parser.h:73
Zone * zone() const
static Thread * Current()
Definition thread.h:361
ZoneGrowableArray< intptr_t > * context_level_array_
Dart_NativeFunction function
Definition fuchsia.cc:51
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 926 of file base_flow_graph_builder.cc.

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

◆ AllocateContext()

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

Definition at line 918 of file base_flow_graph_builder.cc.

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

◆ AllocateObject()

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

Definition at line 1028 of file base_flow_graph_builder.cc.

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

◆ AllocateRecord()

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

Definition at line 951 of file base_flow_graph_builder.cc.

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

◆ AllocateSmallRecord()

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

Definition at line 959 of file base_flow_graph_builder.cc.

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

◆ 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 973 of file base_flow_graph_builder.cc.

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

◆ AssertAssignable()

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

Definition at line 1204 of file base_flow_graph_builder.cc.

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

◆ AssertBool()

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

Definition at line 904 of file base_flow_graph_builder.cc.

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

◆ BinaryIntegerOp()

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

Definition at line 844 of file base_flow_graph_builder.cc.

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

◆ BooleanNegate()

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

Definition at line 912 of file base_flow_graph_builder.cc.

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

◆ Box()

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

Definition at line 1039 of file base_flow_graph_builder.cc.

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

◆ 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}
static bool compare(const SkBitmap &ref, const SkIRect &iref, const SkBitmap &test, const SkIRect &itest)
Definition BlurTest.cpp:100

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

◆ BuildEntryPointsIntrospection()

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

Definition at line 1116 of file base_flow_graph_builder.cc.

1116 {
1117 if (!FLAG_enable_testing_pragmas) return Drop();
1118
1120
1121 if (function.IsImplicitClosureFunction()) {
1122 const auto& parent = Function::Handle(Z, function.parent_function());
1123 const auto& func_name = String::Handle(Z, parent.name());
1124 const auto& owner = Class::Handle(Z, parent.Owner());
1125 if (owner.EnsureIsFinalized(thread_) == Error::null()) {
1126 function = Resolver::ResolveFunction(Z, owner, func_name);
1127 }
1128 }
1129
1130 Object& options = Object::Handle(Z);
1131 if (!Library::FindPragma(thread_, /*only_core=*/false, function,
1132 Symbols::vm_trace_entrypoints(), /*multiple=*/false,
1133 &options) ||
1134 options.IsNull() || !options.IsClosure()) {
1135 return Drop();
1136 }
1137 auto& closure = Closure::ZoneHandle(Z, Closure::Cast(options).ptr());
1138 LocalVariable* entry_point_num = MakeTemporary("entry_point_num");
1139
1141 Z, String::New(function.ToLibNamePrefixedQualifiedCString(), Heap::kOld));
1145 Heap::kOld);
1146 }
1147 if (!function_name.IsCanonical()) {
1149 }
1150
1151 Fragment call_hook;
1152 call_hook += Constant(closure);
1153 call_hook += Constant(function_name);
1154 call_hook += LoadLocal(entry_point_num);
1155 if (FLAG_precompiled_mode) {
1156 call_hook += Constant(closure);
1157 } else {
1158 call_hook += Constant(Function::ZoneHandle(Z, closure.function()));
1159 }
1160 call_hook += ClosureCall(Function::null_function(), TokenPosition::kNoSource,
1161 /*type_args_len=*/0, /*argument_count=*/3,
1162 /*argument_names=*/Array::ZoneHandle(Z));
1163 call_hook += Drop(); // result of closure call
1164 call_hook += DropTemporary(&entry_point_num); // entrypoint number
1165 return call_hook;
1166}
const char * options
bool IsImplicitClosureFunction() const
Definition object.h:3883
@ 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:4201
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:180
static StringPtr New(const char *cstr, Heap::Space space=Heap::kNew)
Definition object.cc:23777
static StringPtr Concat(const String &str1, const String &str2, Heap::Space space=Heap::kNew)
Definition object.cc:24116
static StringPtr New(Thread *thread, const char *cstr)
Definition symbols.h:722
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 798 of file base_flow_graph_builder.cc.

799 {
800 return new (Z) FunctionEntryInstr(graph_entry, AllocateBlockId(),
802}

◆ BuildIndirectEntry()

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

Definition at line 814 of file base_flow_graph_builder.cc.

816 {
817 return new (Z) IndirectEntryInstr(AllocateBlockId(), indirect_id, try_index,
819}

◆ BuildJoinEntry() [1/2]

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

Definition at line 809 of file base_flow_graph_builder.cc.

809 {
810 return new (Z) JoinEntryInstr(AllocateBlockId(), CurrentTryIndex(),
812}

◆ BuildJoinEntry() [2/2]

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

Definition at line 804 of file base_flow_graph_builder.cc.

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

◆ BuildTargetEntry()

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

Definition at line 793 of file base_flow_graph_builder.cc.

793 {
794 return new (Z) TargetEntryInstr(AllocateBlockId(), CurrentTryIndex(),
796}

◆ BuildThrowNoSuchMethod()

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

Definition at line 879 of file base_flow_graph_builder.cc.

879 {
880 JoinEntryInstr* nsm = BuildJoinEntry();
881
882 Fragment failing(nsm);
883 const Code& nsm_handler = Code::ZoneHandle(
884 Z, IG->object_store()->call_closure_no_such_method_stub());
885 failing += LoadArgDescriptor();
886 failing += TailCall(nsm_handler);
887
888 return nsm;
889}
#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}
Point offset

◆ CheckNotDeeplyImmutable()

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

Definition at line 1089 of file base_flow_graph_builder.cc.

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

◆ CheckNull()

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

Definition at line 1061 of file base_flow_graph_builder.cc.

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

◆ 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 1077 of file base_flow_graph_builder.cc.

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

◆ 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 1168 of file base_flow_graph_builder.cc.

1174 {
1175 Fragment instructions = RecordCoverage(position);
1176 const intptr_t total_count =
1177 (type_args_len > 0 ? 1 : 0) + argument_count +
1178 /*closure (bare instructions) or function (otherwise)*/ 1;
1179 InputsArray arguments = GetArguments(total_count);
1180 ClosureCallInstr* call = new (Z) ClosureCallInstr(
1181 target_function, std::move(arguments), type_args_len, argument_names,
1182 InstructionSource(position), GetNextDeoptId());
1183 Push(call);
1184 instructions <<= call;
1185 if (result_type != nullptr && result_type->IsConstant()) {
1186 instructions += Drop();
1187 instructions += Constant(result_type->constant_value);
1188 }
1189 return instructions;
1190}
Fragment RecordCoverage(TokenPosition position)
GrowableArray< Value * > InputsArray
Definition il.h:895
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 941 of file base_flow_graph_builder.cc.

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

◆ 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 1051 of file base_flow_graph_builder.cc.

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

◆ 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(
454 Push(instr);
455 return Fragment(instr);
456}
@ kNotSpeculative
Definition il.h:969

◆ DoubleToInteger()

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

Definition at line 1247 of file base_flow_graph_builder.cc.

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

◆ Drop()

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

Definition at line 757 of file base_flow_graph_builder.cc.

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

◆ DropTemporary()

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

Definition at line 715 of file base_flow_graph_builder.cc.

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

◆ DropTempsPreserveTop()

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

Definition at line 773 of file base_flow_graph_builder.cc.

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

◆ FinalizeCoverageArray()

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

Definition at line 1311 of file base_flow_graph_builder.cc.

1311 {
1312 if (!coverage_array_.IsNull()) {
1313 return;
1314 }
1315
1317 coverage_array_ = Array::empty_array().ptr();
1318 return;
1319 }
1320
1323
1324 Smi& value = Smi::Handle();
1325 for (intptr_t i = 0; i < coverage_array_positions_.length(); i++) {
1327 coverage_array_.SetAt(2 * i, value);
1328 value = Smi::New(0); // no coverage recorded.
1329 coverage_array_.SetAt(2 * i + 1, value);
1330 }
1331}
static ArrayPtr New(intptr_t len, Heap::Space space=Heap::kNew)
Definition object.h:10933
void SetAt(intptr_t index, const Object &value) const
Definition object.h:10858
intptr_t length() const
bool IsNull() const
Definition object.h:363
static SmiPtr New(intptr_t value)
Definition object.h:9985
GrowableArray< intptr_t > coverage_array_positions_

◆ 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 821 of file base_flow_graph_builder.cc.

821 {
822 InputsArray arguments(Z, count);
823 arguments.SetLength(count);
824 for (intptr_t i = count - 1; i >= 0; --i) {
825 arguments[i] = Pop();
826 }
827 return arguments;
828}
int count

◆ GetCoverageIndexFor()

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

Definition at line 1286 of file base_flow_graph_builder.cc.

1286 {
1287 if (coverage_array_.IsNull()) {
1288 // We have not yet created coverage_array, this is the first time we are
1289 // building the graph for this function. Collect coverage positions.
1290 for (intptr_t i = 0; i < coverage_array_positions_.length(); i++) {
1291 if (coverage_array_positions_.At(i) == encoded_position) {
1292 return 2 * i + 1;
1293 }
1294 }
1295 const auto index = 2 * coverage_array_positions_.length() + 1;
1296 coverage_array_positions_.Add(encoded_position);
1297 return index;
1298 }
1299
1300 for (intptr_t i = 0; i < coverage_array_.Length(); i += 2) {
1301 if (Smi::Value(static_cast<SmiPtr>(coverage_array_.At(i))) ==
1302 encoded_position) {
1303 return i + 1;
1304 }
1305 }
1306 // Reaching here indicates that the graph is constructed in an unstable way.
1307 UNREACHABLE();
1308 return 1;
1309}
#define UNREACHABLE()
Definition assert.h:248
ObjectPtr At(intptr_t index) const
Definition object.h:10854
intptr_t Length() const
Definition object.h:10808
void Add(const T &value)
const T & At(intptr_t index) const
intptr_t Value() const
Definition object.h:9969

◆ 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 }
intptr_t GetNextDeoptId()
CompilerState & compiler_state()
Definition thread.h:583

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

◆ InitConstantParameters()

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

Definition at line 1221 of file base_flow_graph_builder.cc.

1221 {
1222 Fragment instructions;
1223 const intptr_t parameter_count = parsed_function_->function().NumParameters();
1224 for (intptr_t i = 0; i < parameter_count; ++i) {
1225 LocalVariable* raw_parameter = parsed_function_->RawParameterVariable(i);
1226 const Object* param_value = raw_parameter->inferred_arg_value();
1227 if (param_value != nullptr) {
1228 instructions += Constant(*param_value);
1229 instructions += StoreLocalRaw(TokenPosition::kNoSource, raw_parameter);
1230 instructions += Drop();
1231 }
1232 }
1233 return instructions;
1234}
intptr_t NumParameters() const
Definition object.cc:8935
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 1009 of file base_flow_graph_builder.cc.

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

◆ InstantiateType()

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

Definition at line 982 of file base_flow_graph_builder.cc.

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

◆ InstantiateTypeArguments()

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

Definition at line 992 of file base_flow_graph_builder.cc.

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

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

◆ InvokeMathCFunction()

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

Definition at line 1236 of file base_flow_graph_builder.cc.

1238 {
1239 InputsArray args = GetArguments(num_inputs);
1240 auto* instr = new (Z) InvokeMathCFunctionInstr(
1241 std::move(args), GetNextDeoptId(), recognized_kind,
1242 InstructionSource(TokenPosition::kNoSource));
1243 Push(instr);
1244 return Fragment(instr);
1245}
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)
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 1022 of file base_flow_graph_builder.cc.

1022 {
1023 LoadClassIdInstr* load = new (Z) LoadClassIdInstr(Pop());
1024 Push(load);
1025 return Fragment(load);
1026}
SI T load(const P *ptr)

◆ 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 861 of file base_flow_graph_builder.cc.

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

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

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

◆ LoadStaticField()

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

Definition at line 585 of file base_flow_graph_builder.cc.

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

◆ 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 787 of file base_flow_graph_builder.cc.

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

◆ MakeTemporary()

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

Definition at line 685 of file base_flow_graph_builder.cc.

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

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

◆ Pop()

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

Definition at line 745 of file base_flow_graph_builder.cc.

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

◆ Push()

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

Definition at line 730 of file base_flow_graph_builder.cc.

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

◆ ReachabilityFence()

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

Definition at line 603 of file base_flow_graph_builder.cc.

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

◆ RecordBranchCoverage()

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

is_branch_coverage

Definition at line 1268 of file base_flow_graph_builder.cc.

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

◆ RecordCoverage()

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

is_branch_coverage

Definition at line 1264 of file base_flow_graph_builder.cc.

1264 {
1265 return RecordCoverageImpl(position, false /** is_branch_coverage **/);
1266}

◆ RecordCoverageImpl()

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

Definition at line 1272 of file base_flow_graph_builder.cc.

1273 {
1274 Fragment instructions;
1275 if (!SupportsCoverage()) return instructions;
1276 if (!position.IsReal()) return instructions;
1277 if (is_branch_coverage && !IG->branch_coverage()) return instructions;
1278
1279 const intptr_t coverage_index =
1280 GetCoverageIndexFor(position.EncodeCoveragePosition(is_branch_coverage));
1281 instructions <<= new (Z) RecordCoverageInstr(coverage_array(), coverage_index,
1282 InstructionSource(position));
1283 return instructions;
1284}
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 1097 of file base_flow_graph_builder.cc.

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

◆ RedefinitionWithType()

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

Definition at line 594 of file base_flow_graph_builder.cc.

594 {
595 auto redefinition = new (Z) RedefinitionInstr(Pop());
596 redefinition->set_constrained_type(
597 new (Z) CompileType(CompileType::FromAbstractType(
599 Push(redefinition);
600 return Fragment(redefinition);
601}
static constexpr bool kCannotBeSentinel
static constexpr bool kCanBeNull
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 1192 of file base_flow_graph_builder.cc.

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

◆ 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)
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 725 of file base_flow_graph_builder.cc.

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

◆ SmiBinaryOp()

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

Definition at line 839 of file base_flow_graph_builder.cc.

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

◆ SmiRelationalOp()

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

Definition at line 830 of file base_flow_graph_builder.cc.

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

◆ StoreField()

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

Definition at line 534 of file base_flow_graph_builder.cc.

537 {
538 return StoreNativeField(TokenPosition::kNoSource,
540 kind, emit_store_barrier);
541}
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 543 of file base_flow_graph_builder.cc.

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

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

◆ StoreIndexed()

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

Definition at line 630 of file base_flow_graph_builder.cc.

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

◆ StoreIndexedTypedData()

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

Definition at line 645 of file base_flow_graph_builder.cc.

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

◆ 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 660 of file base_flow_graph_builder.cc.

661 {
662 if (variable->is_captured()) {
663 Fragment instructions;
664 LocalVariable* value = MakeTemporary();
665 instructions += LoadContextAt(variable->owner()->context_level());
666 instructions += LoadLocal(value);
667 instructions += StoreNativeField(
668 position, Slot::GetContextVariableSlotFor(thread_, *variable));
669 return instructions;
670 }
671 return StoreLocalRaw(position, variable);
672}
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 674 of file base_flow_graph_builder.cc.

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

◆ 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 if (value->BindsToConstant()) {
526 emit_store_barrier = kNoStoreBarrier;
527 }
528 StoreFieldInstr* store = new (Z)
529 StoreFieldInstr(slot, Pop(), value, emit_store_barrier,
530 stores_inner_pointer, InstructionSource(position), kind);
531 return Fragment(store);
532}

◆ 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 624 of file base_flow_graph_builder.cc.

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

◆ 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
347 test += LoadLocal(closure);
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}
SINT Vec< 2 *N, T > join(const Vec< N, T > &lo, const Vec< N, T > &hi)
Definition SkVx.h:242

◆ 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 891 of file base_flow_graph_builder.cc.

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

◆ UnaryDoubleOp()

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

Definition at line 1256 of file base_flow_graph_builder.cc.

1256 {
1257 Value* value = Pop();
1258 auto* instr = new (Z) UnaryDoubleOpInstr(op, value, GetNextDeoptId(),
1260 Push(instr);
1261 return Fragment(instr);
1262}

◆ UnboxedIntConstant()

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

Definition at line 261 of file base_flow_graph_builder.cc.

263 {
264 const auto& obj = Integer::ZoneHandle(Z, Integer::NewCanonical(value));
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:23078

◆ Utf8Scan()

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

Definition at line 609 of file base_flow_graph_builder.cc.

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

Friends And Related Symbol Documentation

◆ StreamingFlowGraphBuilder

friend class StreamingFlowGraphBuilder
friend

Definition at line 541 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 539 of file base_flow_graph_builder.h.

◆ coverage_array_positions_

GrowableArray<intptr_t> dart::kernel::BaseFlowGraphBuilder::coverage_array_positions_
protected

Definition at line 538 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: