blob: e9de84c85bf17c07c7a6cd78c99e0cc50aac9d37 [file] [log] [blame]
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
#ifndef RUNTIME_VM_COMPILER_AOT_AOT_CALL_SPECIALIZER_H_
#define RUNTIME_VM_COMPILER_AOT_AOT_CALL_SPECIALIZER_H_
#include "vm/compiler/call_specializer.h"
namespace dart {
class Precompiler;
class SpeculativeInliningPolicy;
class AotCallSpecializer : public CallSpecializer {
public:
AotCallSpecializer(Precompiler* precompiler,
FlowGraph* flow_graph,
SpeculativeInliningPolicy* speculative_policy);
virtual ~AotCallSpecializer() {}
// TODO(dartbug.com/30633) these method has nothing to do with
// specialization of calls. They are here for historical reasons.
// Find a better place for them.
void ReplaceArrayBoundChecks();
virtual void VisitInstanceCall(InstanceCallInstr* instr);
virtual void VisitPolymorphicInstanceCall(
PolymorphicInstanceCallInstr* instr);
virtual bool TryReplaceInstanceOfWithRangeCheck(InstanceCallInstr* call,
const AbstractType& type);
virtual bool TryReplaceTypeCastWithRangeCheck(InstanceCallInstr* call,
const AbstractType& type);
private:
// Attempt to build ICData for call using propagated class-ids.
virtual bool TryCreateICData(InstanceCallInstr* call);
bool TryCreateICDataForUniqueTarget(InstanceCallInstr* call);
bool RecognizeRuntimeTypeGetter(InstanceCallInstr* call);
bool TryReplaceWithHaveSameRuntimeType(InstanceCallInstr* call);
bool TryInlineFieldAccess(InstanceCallInstr* call);
Value* PrepareStaticOpInput(Value* input, intptr_t cid, Instruction* call);
Value* PrepareReceiverOfDevirtualizedCall(Value* input, intptr_t cid);
bool TryOptimizeInstanceCallUsingStaticTypes(InstanceCallInstr* instr);
virtual bool TryOptimizeStaticCallUsingStaticTypes(StaticCallInstr* call);
Precompiler* precompiler_;
bool has_unique_no_such_method_;
DISALLOW_COPY_AND_ASSIGN(AotCallSpecializer);
};
} // namespace dart
#endif // RUNTIME_VM_COMPILER_AOT_AOT_CALL_SPECIALIZER_H_