v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
unoptimized-compilation-info.h
Go to the documentation of this file.
1// Copyright 2018 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_CODEGEN_UNOPTIMIZED_COMPILATION_INFO_H_
6#define V8_CODEGEN_UNOPTIMIZED_COMPILATION_INFO_H_
7
8#include <memory>
9
11#include "src/common/globals.h"
12#include "src/handles/handles.h"
14#include "src/objects/objects.h"
16#include "src/utils/utils.h"
17
18namespace v8 {
19namespace internal {
20
21class AsmWasmData;
22class CoverageInfo;
23class DeclarationScope;
24class FunctionLiteral;
25class Isolate;
26class ParseInfo;
27class SourceRangeMap;
28class Zone;
29
30// UnoptimizedCompilationInfo encapsulates the information needed to compile
31// unoptimized code for a given function, and the results of the compilation.
33 public:
34 UnoptimizedCompilationInfo(Zone* zone, ParseInfo* parse_info,
36
37 const UnoptimizedCompileFlags& flags() const { return flags_; }
38 LazyCompileDispatcher* dispatcher() { return dispatcher_; }
40 return character_stream_;
41 }
42
43 // Accessors for the input data of the function being compiled.
44
45 FunctionLiteral* literal() const { return literal_; }
50 void ClearLiteral() { literal_ = nullptr; }
51
52 DeclarationScope* scope() const;
53
54 int num_parameters() const;
55 int num_parameters_including_this() const;
56
57 // Accessors for optional compilation features.
58
59 SourcePositionTableBuilder::RecordingMode SourcePositionRecordingMode() const;
60
61 bool has_source_range_map() const { return source_range_map_ != nullptr; }
62 SourceRangeMap* source_range_map() const { return source_range_map_; }
63 void set_source_range_map(SourceRangeMap* source_range_map) {
64 source_range_map_ = source_range_map;
65 }
66
67 bool has_coverage_info() const { return !coverage_info_.is_null(); }
68 Handle<CoverageInfo> coverage_info() const { return coverage_info_; }
70 coverage_info_ = coverage_info;
71 }
72
73 // Accessors for the output of compilation.
74
75 bool has_bytecode_array() const { return !bytecode_array_.is_null(); }
76 Handle<BytecodeArray> bytecode_array() const { return bytecode_array_; }
78 bytecode_array_ = bytecode_array;
79 }
80
81 bool has_asm_wasm_data() const { return !asm_wasm_data_.is_null(); }
82 DirectHandle<AsmWasmData> asm_wasm_data() const { return asm_wasm_data_; }
83 void SetAsmWasmData(Handle<AsmWasmData> asm_wasm_data) {
84 asm_wasm_data_ = asm_wasm_data;
85 }
86
87 FeedbackVectorSpec* feedback_vector_spec() { return &feedback_vector_spec_; }
88
89 private:
90 // Compilation flags.
92
93 // For dispatching eager compilation of lazily compiled functions.
96
97 // The root AST node of the function literal being compiled.
99
100 // Used when block coverage is enabled.
102
103 // Encapsulates coverage information gathered by the bytecode generator.
104 // Needs to be stored on the shared function info once compilation completes.
106
107 // Holds the bytecode array generated by the interpreter.
109
110 // Holds the asm_wasm data struct generated by the asmjs compiler.
112
113 // Holds the feedback vector spec generated during compilation
115};
116
117} // namespace internal
118} // namespace v8
119
120#endif // V8_CODEGEN_UNOPTIMIZED_COMPILATION_INFO_H_
friend Zone
Definition asm-types.cc:195
void SetBytecodeArray(Handle< BytecodeArray > bytecode_array)
const Utf16CharacterStream * character_stream() const
const UnoptimizedCompileFlags & flags() const
void SetAsmWasmData(Handle< AsmWasmData > asm_wasm_data)
void set_source_range_map(SourceRangeMap *source_range_map)
DirectHandle< AsmWasmData > asm_wasm_data() const
void set_coverage_info(Handle< CoverageInfo > coverage_info)
JSRegExp::Flags flags_
FunctionLiteral * literal
Definition liveedit.cc:294
#define DCHECK_NOT_NULL(val)
Definition logging.h:492
#define V8_EXPORT_PRIVATE
Definition macros.h:460