pipeline.h 2.82 KB
Newer Older
1 2 3 4 5 6 7
// Copyright 2014 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef V8_COMPILER_PIPELINE_H_
#define V8_COMPILER_PIPELINE_H_

8 9
// Clients of this interface shouldn't depend on lots of compiler internals.
// Do not include anything from src/compiler here!
10
#include "src/globals.h"
11
#include "src/objects.h"
12 13 14

namespace v8 {
namespace internal {
15

16
class CompilationInfo;
17
class CompilationJob;
18 19
class RegisterConfiguration;

20 21
namespace compiler {

22
class CallDescriptor;
23
class Graph;
24
class InstructionSequence;
25
class Schedule;
26
class SourcePositionTable;
27

28
class Pipeline : public AllStatic {
29
 public:
30 31
  // Returns a new compilation job for the given function.
  static CompilationJob* NewCompilationJob(Handle<JSFunction> function);
32

33 34 35 36
  // Returns a new compilation job for the WebAssembly compilation info.
  static CompilationJob* NewWasmCompilationJob(
      CompilationInfo* info, Graph* graph, CallDescriptor* descriptor,
      SourcePositionTable* source_positions);
37

38 39
  // Run the pipeline on a machine graph and generate code. The {schedule} must
  // be valid, hence the given {graph} does not need to be schedulable.
40 41 42
  static Handle<Code> GenerateCodeForCodeStub(Isolate* isolate,
                                              CallDescriptor* call_descriptor,
                                              Graph* graph, Schedule* schedule,
43
                                              Code::Flags flags,
44
                                              const char* debug_name);
45

46 47 48 49
  // Run the entire pipeline and generate a handle to a code object suitable for
  // testing.
  static Handle<Code> GenerateCodeForTesting(CompilationInfo* info);

50 51 52 53 54
  // Run the pipeline on a machine graph and generate code. If {schedule} is
  // {nullptr}, then compute a new schedule for code generation.
  static Handle<Code> GenerateCodeForTesting(CompilationInfo* info,
                                             Graph* graph,
                                             Schedule* schedule = nullptr);
55

56
  // Run just the register allocator phases.
57 58 59
  V8_EXPORT_PRIVATE static bool AllocateRegistersForTesting(
      const RegisterConfiguration* config, InstructionSequence* sequence,
      bool run_verifier);
60

61 62
  // Run the pipeline on a machine graph and generate code. If {schedule} is
  // {nullptr}, then compute a new schedule for code generation.
63 64
  static Handle<Code> GenerateCodeForTesting(CompilationInfo* info,
                                             CallDescriptor* call_descriptor,
65 66
                                             Graph* graph,
                                             Schedule* schedule = nullptr);
67

68
 private:
69
  DISALLOW_IMPLICIT_CONSTRUCTORS(Pipeline);
70
};
71 72 73 74

}  // namespace compiler
}  // namespace internal
}  // namespace v8
75 76

#endif  // V8_COMPILER_PIPELINE_H_