5#ifndef RUNTIME_VM_COMPILER_CALL_SPECIALIZER_H_
6#define RUNTIME_VM_COMPILER_CALL_SPECIALIZER_H_
8#if defined(DART_PRECOMPILED_RUNTIME)
9#error "AOT runtime should not use compiler sources (including header files)"
17class SpeculativeInliningPolicy;
38 bool should_clone_fields)
114 AddCheckClass(call->Receiver()->definition(), call->Targets(),
115 call->deopt_id(), call->env(), call);
150 bool TypeCheckAsClassEquality(
const AbstractType&
type, intptr_t* type_cid);
163 int argument_number);
171 BoolPtr InstanceOfAsBool(
const ICData& ic_data,
185 static bool SpecializeTestCidsForNumericTypes(
189 static bool TryReplaceInstanceCallWithInline(
195 static bool TryReplaceStaticCallWithInline(
202 intptr_t receiver_cid,
218#define PUBLIC_TYPED_DATA_CLASS_LIST(V) \
219 V(Int8List, int8_list_type_, int_type_, kTypedDataInt8ArrayCid) \
220 V(Uint8List, uint8_list_type_, int_type_, kTypedDataUint8ArrayCid) \
221 V(Uint8ClampedList, uint8_clamped_type_, int_type_, \
222 kTypedDataUint8ClampedArrayCid) \
223 V(Int16List, int16_list_type_, int_type_, kTypedDataInt16ArrayCid) \
224 V(Uint16List, uint16_list_type_, int_type_, kTypedDataUint16ArrayCid) \
225 V(Int32List, int32_list_type_, int_type_, kTypedDataInt32ArrayCid) \
226 V(Uint32List, uint32_list_type_, int_type_, kTypedDataUint32ArrayCid) \
227 V(Int64List, int64_list_type_, int_type_, kTypedDataInt64ArrayCid) \
228 V(Uint64List, uint64_list_type_, int_type_, kTypedDataUint64ArrayCid) \
229 V(Float32List, float32_list_type_, double_type_, kTypedDataFloat32ArrayCid) \
230 V(Float64List, float64_list_type_, double_type_, kTypedDataFloat64ArrayCid)
269 zone_(thread_->zone()),
270 flow_graph_(flow_graph),
271#define ALLOCATE_HANDLE(iface, member_name, type, cid) \
272 member_name(AbstractType::Handle(zone_)),
281 void EnsureIsInitialized();
302 Zone* zone()
const {
return zone_; }
307 bool initialized_ =
false;
309#define DEF_HANDLE(iface, member_name, type, cid) AbstractType& member_name;
313 AbstractType& int_type_;
314 AbstractType& double_type_;
static float next(float f)
#define DEF_HANDLE(iface, member_name, type, cid)
#define PUBLIC_TYPED_DATA_CLASS_LIST(V)
#define ALLOCATE_HANDLE(iface, member_name, type, cid)
virtual void VisitStaticCall(StaticCallInstr *instr)
IsolateGroup * isolate_group() const
void AddReceiverCheck(InstanceCallInstr *call)
void set_flow_graph(FlowGraph *flow_graph)
bool TryReplaceWithEqualityOp(InstanceCallInstr *call, Token::Kind op_kind)
FlowGraph * flow_graph() const
void AddCheckNull(Value *to_check, const String &function_name, intptr_t deopt_id, Environment *deopt_environment, Instruction *insert_before)
void AddCheckClass(Definition *to_check, const Cids &cids, intptr_t deopt_id, Environment *deopt_environment, Instruction *insert_before)
void ReplaceCall(Definition *call, Definition *replacement)
virtual ~CallSpecializer()
bool TryInlineInstanceSetter(InstanceCallInstr *call)
CallSpecializer(FlowGraph *flow_graph, SpeculativeInliningPolicy *speculative_policy, bool should_clone_fields)
void InsertBefore(Instruction *next, Instruction *instr, Environment *env, FlowGraph::UseKind use_kind)
const bool should_clone_fields_
void ReplaceCallWithResult(Definition *call, Instruction *replacement, Definition *result)
virtual void VisitLoadCodeUnits(LoadCodeUnitsInstr *instr)
virtual bool TryCreateICData(InstanceCallInstr *call)
void InlineImplicitInstanceGetter(Definition *call, const Field &field)
bool TryInlineInstanceGetter(InstanceCallInstr *call)
bool TryReplaceWithRelationalOp(InstanceCallInstr *call, Token::Kind op_kind)
virtual bool TryOptimizeStaticCallUsingStaticTypes(StaticCallInstr *call)=0
bool TryReplaceWithUnaryOp(InstanceCallInstr *call, Token::Kind op_kind)
SpeculativeInliningPolicy * speculative_policy_
const Function & function() const
virtual void ReplaceInstanceCallsWithDispatchTableCalls()
void ReplaceWithInstanceOf(InstanceCallInstr *instr)
bool TryReplaceWithBinaryOp(InstanceCallInstr *call, Token::Kind op_kind)
bool TryInlineInstanceMethod(InstanceCallInstr *call)
virtual bool TryReplaceInstanceOfWithRangeCheck(InstanceCallInstr *call, const AbstractType &type)
void InsertSpeculativeBefore(Instruction *next, Instruction *instr, Environment *env, FlowGraph::UseKind use_kind)
void set_block_order(const GrowableArray< BlockEntryInstr * > &block_order)
const GrowableArray< BlockEntryInstr * > & reverse_postorder() const
IsolateGroup * isolate_group() const
const Function & function() const
void InsertBefore(Instruction *next, Instruction *instr, Environment *env, UseKind use_kind)
void InsertSpeculativeBefore(Instruction *next, Instruction *instr, Environment *env, UseKind use_kind)
static Thread * Current()
virtual void VisitStaticCall(StaticCallInstr *instr)
virtual void VisitInstanceCall(InstanceCallInstr *instr)
static void Optimize(FlowGraph *flow_graph)
const char *const function_name
bool emit_exactness_guard