Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
aot_call_specializer.h
Go to the documentation of this file.
1// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2// for details. All rights reserved. Use of this source code is governed by a
3// BSD-style license that can be found in the LICENSE file.
4
5#ifndef RUNTIME_VM_COMPILER_AOT_AOT_CALL_SPECIALIZER_H_
6#define RUNTIME_VM_COMPILER_AOT_AOT_CALL_SPECIALIZER_H_
7
8#if defined(DART_PRECOMPILED_RUNTIME)
9#error "AOT runtime should not use compiler sources (including header files)"
10#endif // defined(DART_PRECOMPILED_RUNTIME)
11
13
14namespace dart {
15
16class Precompiler;
17class SpeculativeInliningPolicy;
18
20 public:
23 SpeculativeInliningPolicy* speculative_policy);
24
26
28 virtual void VisitStaticCall(StaticCallInstr* instr);
31
33 const AbstractType& type);
34
35 private:
36 // Attempt to build ICData for call using propagated class-ids.
38
39 bool TryCreateICDataForUniqueTarget(InstanceCallInstr* call);
40
41 bool RecognizeRuntimeTypeGetter(InstanceCallInstr* call);
42 bool TryReplaceWithHaveSameRuntimeType(TemplateDartCall<0>* call);
43
44 bool TryInlineFieldAccess(InstanceCallInstr* call);
45 bool TryInlineFieldAccess(StaticCallInstr* call);
46
47 bool IsSupportedIntOperandForStaticDoubleOp(CompileType* operand_type);
48 Value* PrepareStaticOpInput(Value* input, intptr_t cid, Instruction* call);
49
50 CompileType BuildStrengthenedReceiverType(Value* input, intptr_t cid);
51
52 bool TryOptimizeInstanceCallUsingStaticTypes(InstanceCallInstr* instr);
53
55
56 // If a call can be dispatched through the global dispatch table, replace
57 // it by a dispatch table call.
58 void TryReplaceWithDispatchTableCall(InstanceCallBaseInstr* call);
59 const Function& InterfaceTargetForTableDispatch(InstanceCallBaseInstr* call);
60
61 // Try to replace a call with a more specialized instruction working on
62 // integers (e.g. BinaryInt64OpInstr, EqualityCompareInstr,
63 // RelationalOpInstr)
64 bool TryOptimizeIntegerOperation(TemplateDartCall<0>* call, Token::Kind kind);
65
66 // Try to replace a call with a more specialized instruction working on
67 // doubles (e.g. BinaryDoubleOpInstr, EqualityCompareInstr,
68 // RelationalOpInstr)
69 bool TryOptimizeDoubleOperation(TemplateDartCall<0>* call, Token::Kind kind);
70
71 // Check if o.m(...) [call] is actually an invocation through a getter
72 // o.get:m().call(...) given that the receiver of the call is a subclass
73 // of the [receiver_class]. If it is - then expand it into
74 // o.get:m.call(...) to avoid hitting dispatch through noSuchMethod.
75 bool TryExpandCallThroughGetter(const Class& receiver_class,
76 InstanceCallInstr* call);
77
78 Definition* TryOptimizeDivisionOperation(TemplateDartCall<0>* instr,
79 Token::Kind op_kind,
80 Value* left_value,
81 Value* right_value);
82
84
85 Precompiler* precompiler_;
86
87 bool has_unique_no_such_method_;
88
90};
91
92} // namespace dart
93
94#endif // RUNTIME_VM_COMPILER_AOT_AOT_CALL_SPECIALIZER_H_
virtual void ReplaceInstanceCallsWithDispatchTableCalls()
virtual void VisitInstanceCall(InstanceCallInstr *instr)
virtual bool TryReplaceInstanceOfWithRangeCheck(InstanceCallInstr *call, const AbstractType &type)
virtual bool TryOptimizeStaticCallUsingStaticTypes(StaticCallInstr *call)
virtual void VisitPolymorphicInstanceCall(PolymorphicInstanceCallInstr *instr)
virtual void VisitStaticCall(StaticCallInstr *instr)
AotCallSpecializer(Precompiler *precompiler, FlowGraph *flow_graph, SpeculativeInliningPolicy *speculative_policy)
virtual bool TryCreateICData(InstanceCallInstr *call)
FlowGraph * flow_graph() const
const intptr_t cid
#define DISALLOW_COPY_AND_ASSIGN(TypeName)
Definition globals.h:581