V8 API Reference, 7.2.502.16 (for Deno 0.2.4)
pipeline.h
1 // Copyright 2014 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_PIPELINE_H_
6 #define V8_COMPILER_PIPELINE_H_
7 
8 // Clients of this interface shouldn't depend on lots of compiler internals.
9 // Do not include anything from src/compiler here!
10 #include "src/globals.h"
11 #include "src/objects.h"
12 #include "src/objects/code.h"
13 
14 namespace v8 {
15 namespace internal {
16 
17 struct AssemblerOptions;
18 class OptimizedCompilationInfo;
19 class OptimizedCompilationJob;
20 class RegisterConfiguration;
21 class JumpOptimizationInfo;
22 
23 namespace wasm {
24 struct FunctionBody;
25 class NativeModule;
26 class WasmCode;
27 class WasmEngine;
28 } // namespace wasm
29 
30 namespace compiler {
31 
32 class CallDescriptor;
33 class Graph;
34 class InstructionSequence;
35 class MachineGraph;
36 class NodeOriginTable;
37 class Schedule;
38 class SourcePositionTable;
39 
40 class Pipeline : public AllStatic {
41  public:
42  // Returns a new compilation job for the given JavaScript function.
43  static OptimizedCompilationJob* NewCompilationJob(Isolate* isolate,
44  Handle<JSFunction> function,
45  bool has_script);
46 
47  // Run the pipeline for the WebAssembly compilation info.
48  static wasm::WasmCode* GenerateCodeForWasmFunction(
49  OptimizedCompilationInfo* info, wasm::WasmEngine* wasm_engine,
50  MachineGraph* mcgraph, CallDescriptor* call_descriptor,
51  SourcePositionTable* source_positions, NodeOriginTable* node_origins,
52  wasm::FunctionBody function_body, wasm::NativeModule* native_module,
53  int function_index);
54 
55  // Run the pipeline on a machine graph and generate code.
56  static wasm::WasmCode* GenerateCodeForWasmNativeStub(
57  wasm::WasmEngine* wasm_engine, CallDescriptor* call_descriptor,
58  MachineGraph* mcgraph, Code::Kind kind, int wasm_kind,
59  const char* debug_name, const AssemblerOptions& assembler_options,
60  wasm::NativeModule* native_module,
61  SourcePositionTable* source_positions = nullptr);
62 
63  // Run the pipeline on a machine graph and generate code.
64  static MaybeHandle<Code> GenerateCodeForWasmHeapStub(
65  Isolate* isolate, CallDescriptor* call_descriptor, Graph* graph,
66  Code::Kind kind, const char* debug_name,
67  const AssemblerOptions& assembler_options,
68  SourcePositionTable* source_positions = nullptr);
69 
70  // Run the pipeline on a machine graph and generate code. The {schedule} must
71  // be valid, hence the given {graph} does not need to be schedulable.
72  static MaybeHandle<Code> GenerateCodeForCodeStub(
73  Isolate* isolate, CallDescriptor* call_descriptor, Graph* graph,
74  Schedule* schedule, Code::Kind kind, const char* debug_name,
75  uint32_t stub_key, int32_t builtin_index, JumpOptimizationInfo* jump_opt,
76  PoisoningMitigationLevel poisoning_level,
77  const AssemblerOptions& options);
78 
79  // ---------------------------------------------------------------------------
80  // The following methods are for testing purposes only. Avoid production use.
81  // ---------------------------------------------------------------------------
82 
83  // Run the pipeline on JavaScript bytecode and generate code.
84  static MaybeHandle<Code> GenerateCodeForTesting(
85  OptimizedCompilationInfo* info, Isolate* isolate);
86 
87  // Run the pipeline on a machine graph and generate code. If {schedule} is
88  // {nullptr}, then compute a new schedule for code generation.
89  V8_EXPORT_PRIVATE static MaybeHandle<Code> GenerateCodeForTesting(
90  OptimizedCompilationInfo* info, Isolate* isolate,
91  CallDescriptor* call_descriptor, Graph* graph,
92  const AssemblerOptions& options, Schedule* schedule = nullptr);
93 
94  // Run just the register allocator phases.
95  V8_EXPORT_PRIVATE static bool AllocateRegistersForTesting(
96  const RegisterConfiguration* config, InstructionSequence* sequence,
97  bool run_verifier);
98 
99  private:
100  DISALLOW_IMPLICIT_CONSTRUCTORS(Pipeline);
101 };
102 
103 } // namespace compiler
104 } // namespace internal
105 } // namespace v8
106 
107 #endif // V8_COMPILER_PIPELINE_H_
Definition: libplatform.h:13