summaryrefslogtreecommitdiff
path: root/deps/v8/src/compiler/pipeline.h
blob: 4c1c0bcea9a20a278948484b63a007eb9a56e80f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// 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_

#include "src/v8.h"

#include "src/compiler.h"

// Note: TODO(turbofan) implies a performance improvement opportunity,
//   and TODO(name) implies an incomplete implementation

namespace v8 {
namespace internal {
namespace compiler {

// Clients of this interface shouldn't depend on lots of compiler internals.
class CallDescriptor;
class Graph;
class Schedule;
class SourcePositionTable;
class Linkage;

class Pipeline {
 public:
  explicit Pipeline(CompilationInfo* info) : info_(info) {}

  // Run the entire pipeline and generate a handle to a code object.
  Handle<Code> GenerateCode();

  // Run the pipeline on a machine graph and generate code. If {schedule}
  // is {NULL}, then compute a new schedule for code generation.
  Handle<Code> GenerateCodeForMachineGraph(Linkage* linkage, Graph* graph,
                                           Schedule* schedule = NULL);

  CompilationInfo* info() const { return info_; }
  Zone* zone() { return info_->zone(); }
  Isolate* isolate() { return info_->isolate(); }

  static inline bool SupportedBackend() { return V8_TURBOFAN_BACKEND != 0; }
  static inline bool SupportedTarget() { return V8_TURBOFAN_TARGET != 0; }

  static inline bool VerifyGraphs() {
#ifdef DEBUG
    return true;
#else
    return FLAG_turbo_verify;
#endif
  }

  static void SetUp();
  static void TearDown();

 private:
  CompilationInfo* info_;

  Schedule* ComputeSchedule(Graph* graph);
  void VerifyAndPrintGraph(Graph* graph, const char* phase);
  Handle<Code> GenerateCode(Linkage* linkage, Graph* graph, Schedule* schedule,
                            SourcePositionTable* source_positions);
};
}
}
}  // namespace v8::internal::compiler

#endif  // V8_COMPILER_PIPELINE_H_