• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
13 namespace v8 {
14 namespace internal {
15 
16 class CompilationInfo;
17 class CompilationJob;
18 class RegisterConfiguration;
19 
20 namespace compiler {
21 
22 class CallDescriptor;
23 class Graph;
24 class InstructionSequence;
25 class Schedule;
26 class SourcePositionTable;
27 
28 class Pipeline : public AllStatic {
29  public:
30   // Returns a new compilation job for the given function.
31   static CompilationJob* NewCompilationJob(Handle<JSFunction> function);
32 
33   // Returns a new compilation job for the WebAssembly compilation info.
34   static CompilationJob* NewWasmCompilationJob(
35       CompilationInfo* info, Graph* graph, CallDescriptor* descriptor,
36       SourcePositionTable* source_positions);
37 
38   // Run the pipeline on a machine graph and generate code. The {schedule} must
39   // be valid, hence the given {graph} does not need to be schedulable.
40   static Handle<Code> GenerateCodeForCodeStub(Isolate* isolate,
41                                               CallDescriptor* call_descriptor,
42                                               Graph* graph, Schedule* schedule,
43                                               Code::Flags flags,
44                                               const char* debug_name);
45 
46   // Run the entire pipeline and generate a handle to a code object suitable for
47   // testing.
48   static Handle<Code> GenerateCodeForTesting(CompilationInfo* info);
49 
50   // Run the pipeline on a machine graph and generate code. If {schedule} is
51   // {nullptr}, then compute a new schedule for code generation.
52   static Handle<Code> GenerateCodeForTesting(CompilationInfo* info,
53                                              Graph* graph,
54                                              Schedule* schedule = nullptr);
55 
56   // Run just the register allocator phases.
57   V8_EXPORT_PRIVATE static bool AllocateRegistersForTesting(
58       const RegisterConfiguration* config, InstructionSequence* sequence,
59       bool run_verifier);
60 
61   // Run the pipeline on a machine graph and generate code. If {schedule} is
62   // {nullptr}, then compute a new schedule for code generation.
63   static Handle<Code> GenerateCodeForTesting(CompilationInfo* info,
64                                              CallDescriptor* call_descriptor,
65                                              Graph* graph,
66                                              Schedule* schedule = nullptr);
67 
68  private:
69   DISALLOW_IMPLICIT_CONSTRUCTORS(Pipeline);
70 };
71 
72 }  // namespace compiler
73 }  // namespace internal
74 }  // namespace v8
75 
76 #endif  // V8_COMPILER_PIPELINE_H_
77