js-inlining.h 1.86 KB
Newer Older
1 2 3 4 5 6 7 8
// Copyright 2014 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef V8_COMPILER_JS_INLINING_H_
#define V8_COMPILER_JS_INLINING_H_

#include "src/compiler/js-graph.h"
9
#include "src/compiler/graph-reducer.h"
10 11 12

namespace v8 {
namespace internal {
13 14 15 16

// Forward declarations.
class CompilationInfo;

17 18
namespace compiler {

19 20 21
// The JSInliner provides the core graph inlining machinery. Note that this
// class only deals with the mechanics of how to inline one graph into another,
// heuristics that decide what and how much to inline are beyond its scope.
22
class JSInliner final : public AdvancedReducer {
23
 public:
24
  JSInliner(Editor* editor, Zone* local_zone, CompilationInfo* info,
25
            JSGraph* jsgraph)
26 27 28 29
      : AdvancedReducer(editor),
        local_zone_(local_zone),
        info_(info),
        jsgraph_(jsgraph) {}
30

31
  // Reducer interface, eagerly inlines everything.
32
  Reduction Reduce(Node* node) final;
33

34 35
  // Can be used by inlining heuristics or by testing code directly, without
  // using the above generic reducer interface of the inlining machinery.
36
  Reduction ReduceJSCall(Node* node, Handle<JSFunction> function);
37

38
 private:
39
  Zone* local_zone_;
40 41 42
  CompilationInfo* info_;
  JSGraph* jsgraph_;

43 44 45 46
  Node* CreateArtificialFrameState(Node* node, Node* outer_frame_state,
                                   int parameter_count,
                                   FrameStateType frame_state_type,
                                   Handle<SharedFunctionInfo> shared);
47

48 49
  Node* CreateTailCallerFrameState(Node* node, Node* outer_frame_state);

50 51
  Reduction InlineCall(Node* call, Node* new_target, Node* context,
                       Node* frame_state, Node* start, Node* end);
52
};
53 54 55 56

}  // namespace compiler
}  // namespace internal
}  // namespace v8
57 58

#endif  // V8_COMPILER_JS_INLINING_H_