mirror of
https://github.com/dart-lang/sdk
synced 2024-09-19 21:11:40 +00:00
7d6f78b88f
Move inlining OneByteString._setAt, List constructor, Object constructor and a few math function to the flow-graph inliner. Enable inlining of trigonometric math functions in AOT that were previously not inlined. BUG= R=rmacnak@google.com Review URL: https://codereview.chromium.org/2273943002 .
87 lines
2.9 KiB
C++
87 lines
2.9 KiB
C++
// 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 VM_FLOW_GRAPH_INLINER_H_
|
|
#define VM_FLOW_GRAPH_INLINER_H_
|
|
|
|
#include "vm/allocation.h"
|
|
#include "vm/growable_array.h"
|
|
|
|
namespace dart {
|
|
|
|
class Definition;
|
|
class Field;
|
|
class FlowGraph;
|
|
class ForwardInstructionIterator;
|
|
class Function;
|
|
class InstanceCallInstr;
|
|
class Instruction;
|
|
class StaticCallInstr;
|
|
class TargetEntryInstr;
|
|
|
|
class FlowGraphInliner : ValueObject {
|
|
public:
|
|
FlowGraphInliner(FlowGraph* flow_graph,
|
|
GrowableArray<const Function*>* inline_id_to_function,
|
|
GrowableArray<TokenPosition>* inline_id_to_token_pos,
|
|
GrowableArray<intptr_t>* caller_inline_id,
|
|
bool use_speculative_inlining,
|
|
GrowableArray<intptr_t>* inlining_black_list);
|
|
|
|
// The flow graph is destructively updated upon inlining.
|
|
void Inline();
|
|
|
|
// Compute graph info if it was not already computed or if 'force' is true.
|
|
static void CollectGraphInfo(FlowGraph* flow_graph, bool force = false);
|
|
static void SetInliningId(FlowGraph* flow_graph, intptr_t inlining_id);
|
|
|
|
bool AlwaysInline(const Function& function);
|
|
|
|
FlowGraph* flow_graph() const { return flow_graph_; }
|
|
intptr_t NextInlineId(const Function& function,
|
|
TokenPosition tp,
|
|
intptr_t caller_id);
|
|
|
|
bool trace_inlining() const { return trace_inlining_; }
|
|
|
|
static bool TryReplaceInstanceCallWithInline(
|
|
FlowGraph* flow_graph,
|
|
ForwardInstructionIterator* iterator,
|
|
InstanceCallInstr* call);
|
|
|
|
static bool TryReplaceStaticCallWithInline(
|
|
FlowGraph* flow_graph,
|
|
ForwardInstructionIterator* iterator,
|
|
StaticCallInstr* call);
|
|
|
|
static bool TryInlineRecognizedMethod(FlowGraph* flow_graph,
|
|
intptr_t receiver_cid,
|
|
const Function& target,
|
|
Definition* call,
|
|
Definition* receiver,
|
|
TokenPosition token_pos,
|
|
const ICData& ic_data,
|
|
TargetEntryInstr** entry,
|
|
Definition** last);
|
|
|
|
bool use_speculative_inlining() const { return use_speculative_inlining_; }
|
|
|
|
private:
|
|
friend class CallSiteInliner;
|
|
|
|
FlowGraph* flow_graph_;
|
|
GrowableArray<const Function*>* inline_id_to_function_;
|
|
GrowableArray<TokenPosition>* inline_id_to_token_pos_;
|
|
GrowableArray<intptr_t>* caller_inline_id_;
|
|
const bool trace_inlining_;
|
|
const bool use_speculative_inlining_;
|
|
GrowableArray<intptr_t>* inlining_black_list_;
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(FlowGraphInliner);
|
|
};
|
|
|
|
} // namespace dart
|
|
|
|
#endif // VM_FLOW_GRAPH_INLINER_H_
|