1 | // Copyright (c) 2017, 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_JIT_JIT_CALL_SPECIALIZER_H_ |
6 | #define RUNTIME_VM_COMPILER_JIT_JIT_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 | |
12 | #include "vm/compiler/call_specializer.h" |
13 | |
14 | namespace dart { |
15 | |
16 | class JitCallSpecializer : public CallSpecializer { |
17 | public: |
18 | explicit JitCallSpecializer(FlowGraph* flow_graph, |
19 | SpeculativeInliningPolicy* speculative_policy); |
20 | |
21 | virtual ~JitCallSpecializer() {} |
22 | |
23 | virtual void VisitInstanceCall(InstanceCallInstr* instr); |
24 | |
25 | // TODO(dartbug.com/30633) these methods have nothing to do with |
26 | // specialization of calls. They are here for historical reasons. |
27 | // Find a better place for them. |
28 | virtual void VisitAllocateContext(AllocateContextInstr* instr); |
29 | virtual void VisitCloneContext(CloneContextInstr* instr); |
30 | virtual void VisitStoreInstanceField(StoreInstanceFieldInstr* instr); |
31 | |
32 | private: |
33 | virtual bool IsAllowedForInlining(intptr_t deopt_id) const; |
34 | |
35 | virtual bool TryOptimizeStaticCallUsingStaticTypes(StaticCallInstr* call); |
36 | |
37 | void LowerContextAllocation( |
38 | Definition* instr, |
39 | const ZoneGrowableArray<const Slot*>& context_variables, |
40 | Value* context_value); |
41 | |
42 | void ReplaceWithStaticCall(InstanceCallInstr* instr, |
43 | const Function& target, |
44 | intptr_t call_count); |
45 | |
46 | DISALLOW_COPY_AND_ASSIGN(JitCallSpecializer); |
47 | }; |
48 | |
49 | } // namespace dart |
50 | |
51 | #endif // RUNTIME_VM_COMPILER_JIT_JIT_CALL_SPECIALIZER_H_ |
52 | |