pipeline.h 3.15 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
#include "src/zone/zone-containers.h"
13 14 15

namespace v8 {
namespace internal {
16

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

21 22 23 24
namespace trap_handler {
struct ProtectedInstructionData;
}  // namespace trap_handler

25 26 27 28
namespace wasm {
enum ModuleOrigin : uint8_t;
}  // namespace wasm

29 30
namespace compiler {

31
class CallDescriptor;
32
class JSGraph;
33
class Graph;
34
class InstructionSequence;
35
class Schedule;
36
class SourcePositionTable;
37

38
class Pipeline : public AllStatic {
39
 public:
40
  // Returns a new compilation job for the given function.
41 42
  static CompilationJob* NewCompilationJob(Handle<JSFunction> function,
                                           bool has_script);
43

44 45
  // Returns a new compilation job for the WebAssembly compilation info.
  static CompilationJob* NewWasmCompilationJob(
46
      CompilationInfo* info, JSGraph* jsgraph, CallDescriptor* descriptor,
47 48
      SourcePositionTable* source_positions,
      ZoneVector<trap_handler::ProtectedInstructionData>*
49
          protected_instructions,
50
      wasm::ModuleOrigin wasm_origin);
51

52 53
  // 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.
54 55 56
  static Handle<Code> GenerateCodeForCodeStub(Isolate* isolate,
                                              CallDescriptor* call_descriptor,
                                              Graph* graph, Schedule* schedule,
57
                                              Code::Flags flags,
58
                                              const char* debug_name);
59

60 61 62 63
  // Run the entire pipeline and generate a handle to a code object suitable for
  // testing.
  static Handle<Code> GenerateCodeForTesting(CompilationInfo* info);

64 65 66 67 68
  // 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);
69

70
  // Run just the register allocator phases.
71 72 73
  V8_EXPORT_PRIVATE static bool AllocateRegistersForTesting(
      const RegisterConfiguration* config, InstructionSequence* sequence,
      bool run_verifier);
74

75 76
  // Run the pipeline on a machine graph and generate code. If {schedule} is
  // {nullptr}, then compute a new schedule for code generation.
77 78 79 80
  static Handle<Code> GenerateCodeForTesting(
      CompilationInfo* info, CallDescriptor* call_descriptor, Graph* graph,
      Schedule* schedule = nullptr,
      SourcePositionTable* source_positions = nullptr);
81

82
 private:
83
  DISALLOW_IMPLICIT_CONSTRUCTORS(Pipeline);
84
};
85 86 87 88

}  // namespace compiler
}  // namespace internal
}  // namespace v8
89 90

#endif  // V8_COMPILER_PIPELINE_H_