1// Copyright 2015 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef V8_COMPILER_BYTECODE_GRAPH_BUILDER_H_
6#define V8_COMPILER_BYTECODE_GRAPH_BUILDER_H_
7
8#include "src/compiler/js-operator.h"
9#include "src/compiler/js-type-hint-lowering.h"
10#include "src/compiler/node-observer.h"
11#include "src/handles/handles.h"
12#include "src/objects/code-kind.h"
13#include "src/utils/utils.h"
14
15namespace v8 {
16
17class TickCounter;
18
19namespace internal {
20
21class BytecodeArray;
22class FeedbackVector;
23class SharedFunctionInfo;
24class Zone;
25
26namespace compiler {
27
28class JSGraph;
29class NodeObserver;
30class SourcePositionTable;
31
32enum class BytecodeGraphBuilderFlag : uint8_t {
33  kSkipFirstStackAndTierupCheck = 1 << 0,
34  // TODO(neis): Remove liveness flag here when concurrent inlining is always
35  // on, because then the serializer will be the only place where we perform
36  // bytecode analysis.
37  kAnalyzeEnvironmentLiveness = 1 << 1,
38  kBailoutOnUninitialized = 1 << 2,
39};
40using BytecodeGraphBuilderFlags = base::Flags<BytecodeGraphBuilderFlag>;
41
42// Note: {invocation_frequency} is taken by reference to work around a GCC bug
43// on AIX (v8:8193).
44void BuildGraphFromBytecode(JSHeapBroker* broker, Zone* local_zone,
45                            SharedFunctionInfoRef const& shared_info,
46                            FeedbackCellRef const& feedback_cell,
47                            BytecodeOffset osr_offset, JSGraph* jsgraph,
48                            CallFrequency const& invocation_frequency,
49                            SourcePositionTable* source_positions,
50                            int inlining_id, CodeKind code_kind,
51                            BytecodeGraphBuilderFlags flags,
52                            TickCounter* tick_counter,
53                            ObserveNodeInfo const& observe_node_info = {});
54
55}  // namespace compiler
56}  // namespace internal
57}  // namespace v8
58
59#endif  // V8_COMPILER_BYTECODE_GRAPH_BUILDER_H_
60