v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
maglev-compilation-unit.h
Go to the documentation of this file.
1// Copyright 2022 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_MAGLEV_MAGLEV_COMPILATION_UNIT_H_
6#define V8_MAGLEV_MAGLEV_COMPILATION_UNIT_H_
7
11
12namespace v8 {
13namespace internal {
14namespace maglev {
15
16enum class ValueRepresentation : uint8_t;
17class MaglevCompilationInfo;
18class MaglevGraphLabeller;
19class Node;
20
21// Per-unit data, i.e. once per top-level function and once per inlined
22// function.
24 public:
26 Handle<JSFunction> function) {
27 return zone->New<MaglevCompilationUnit>(info, function);
28 }
44
47
52
55 uint16_t parameter_count, uint16_t max_arguments);
56
57 MaglevCompilationInfo* info() const { return info_; }
58 const MaglevCompilationUnit* caller() const { return caller_; }
61 Zone* zone() const;
62 int register_count() const { return register_count_; }
63 uint16_t parameter_count() const { return parameter_count_; }
64 uint16_t max_arguments() const { return max_arguments_; }
65 bool is_osr() const;
67 int inlining_depth() const { return inlining_depth_; }
68 bool is_inline() const { return inlining_depth_ != 0; }
69 bool has_graph_labeller() const;
74 compiler::BytecodeArrayRef bytecode() const { return bytecode_.value(); }
76 return feedback_cell_.value();
77 }
81
82 void RegisterNodeInGraphLabeller(const Node* node);
84
85 private:
88 const compiler::OptionalSharedFunctionInfoRef shared_function_info_;
89 const compiler::OptionalBytecodeArrayRef bytecode_;
90 const compiler::OptionalFeedbackCellRef feedback_cell_;
91 const int register_count_;
92 const uint16_t parameter_count_;
93 const uint16_t max_arguments_;
94 const int inlining_depth_;
95};
96
97} // namespace maglev
98} // namespace internal
99} // namespace v8
100
101#endif // V8_MAGLEV_MAGLEV_COMPILATION_UNIT_H_
T * New(Args &&... args)
Definition zone.h:114
OptionalFeedbackVectorRef feedback_vector(JSHeapBroker *broker) const
compiler::SharedFunctionInfoRef shared_function_info() const
const compiler::OptionalSharedFunctionInfoRef shared_function_info_
const MaglevCompilationUnit * GetTopLevelCompilationUnit() const
const MaglevCompilationUnit * caller() const
compiler::FeedbackCellRef feedback_cell() const
const compiler::OptionalFeedbackCellRef feedback_cell_
static MaglevCompilationUnit * NewDummy(Zone *zone, const MaglevCompilationUnit *caller, int register_count, uint16_t parameter_count, uint16_t max_arguments)
const compiler::OptionalBytecodeArrayRef bytecode_
static MaglevCompilationUnit * NewInner(Zone *zone, const MaglevCompilationUnit *caller, compiler::SharedFunctionInfoRef shared_function_info, compiler::FeedbackCellRef feedback_cell)
MaglevCompilationUnit(MaglevCompilationInfo *info, DirectHandle< JSFunction > function)
compiler::BytecodeArrayRef bytecode() const
static MaglevCompilationUnit * New(Zone *zone, MaglevCompilationInfo *info, Handle< JSFunction > function)
compiler::FeedbackVectorRef feedback() const