Flutter Engine
The Flutter Engine
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 void ReplaceWithConditionalDispatchTableCall(
62 LoadClassIdInstr* load_cid,
63 const Function& interface_target,
64 const compiler::TableSelector* selector);
65
66 // Try to replace a call with a more specialized instruction working on
67 // integers (e.g. BinaryInt64OpInstr, EqualityCompareInstr,
68 // RelationalOpInstr)
69 bool TryOptimizeIntegerOperation(TemplateDartCall<0>* call, Token::Kind kind);
70
71 // Try to replace a call with a more specialized instruction working on
72 // doubles (e.g. BinaryDoubleOpInstr, EqualityCompareInstr,
73 // RelationalOpInstr)
74 bool TryOptimizeDoubleOperation(TemplateDartCall<0>* call, Token::Kind kind);
75
76 // Check if o.m(...) [call] is actually an invocation through a getter
77 // o.get:m().call(...) given that the receiver of the call is a subclass
78 // of the [receiver_class]. If it is - then expand it into
79 // o.get:m.call(...) to avoid hitting dispatch through noSuchMethod.
80 bool TryExpandCallThroughGetter(const Class& receiver_class,
82
83 Definition* TryOptimizeDivisionOperation(TemplateDartCall<0>* instr,
84 Token::Kind op_kind,
85 Value* left_value,
86 Value* right_value);
87
89
90 Precompiler* precompiler_;
91
92 bool has_unique_no_such_method_;
93
94 DISALLOW_COPY_AND_ASSIGN(AotCallSpecializer);
95};
96
97} // namespace dart
98
99#endif // RUNTIME_VM_COMPILER_AOT_AOT_CALL_SPECIALIZER_H_
GLenum type
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
Definition: il.h:75
Definition: dart_vm.cc:33
const intptr_t cid
def call(args)
Definition: dom.py:159