summaryrefslogtreecommitdiff
path: root/deps/v8/src/torque-assembler.h
blob: 3d7cf361c477acfa8a86ec17b293a1cb9d4d3546 (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
// Copyright 2018 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_TORQUE_ASSEMBLER_H_
#define V8_TORQUE_ASSEMBLER_H_

#include <deque>
#include <vector>

#include "src/code-stub-assembler.h"

#include "src/base/optional.h"

namespace v8 {
namespace internal {

class TorqueAssembler : public CodeStubAssembler {
 public:
  using CodeStubAssembler::CodeStubAssembler;

 protected:
  template <class... Ts>
  using PLabel = compiler::CodeAssemblerParameterizedLabel<Ts...>;

  template <class T>
  TNode<T> Uninitialized() {
    return {};
  }

  template <class... T, class... Args>
  void Goto(PLabel<T...>* label, Args... args) {
    label->AddInputs(args...);
    CodeStubAssembler::Goto(label->plain_label());
  }
  using CodeStubAssembler::Goto;
  template <class... T>
  void Bind(PLabel<T...>* label, TNode<T>*... phis) {
    Bind(label->plain_label());
    label->CreatePhis(phis...);
  }
  void Bind(Label* label) { CodeAssembler::Bind(label); }
  using CodeStubAssembler::Bind;
  template <class... T, class... Args>
  void Branch(TNode<BoolT> condition, PLabel<T...>* if_true,
              PLabel<T...>* if_false, Args... args) {
    if_true->AddInputs(args...);
    if_false->AddInputs(args...);
    CodeStubAssembler::Branch(condition, if_true->plain_label(),
                              if_false->plain_label());
  }
  using CodeStubAssembler::Branch;
};

}  // namespace internal
}  // namespace v8

#endif  // V8_TORQUE_ASSEMBLER_H_