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_TYPER_H_
6#define V8_COMPILER_TYPER_H_
7
8#include "src/v8.h"
9
10#include "src/compiler/graph.h"
11#include "src/compiler/opcodes.h"
12#include "src/types.h"
13
14namespace v8 {
15namespace internal {
16namespace compiler {
17
18class Typer {
19 public:
20  explicit Typer(Zone* zone);
21
22  void Init(Node* node);
23  void Run(Graph* graph, MaybeHandle<Context> context);
24  void Narrow(Graph* graph, Node* node, MaybeHandle<Context> context);
25  void Widen(Graph* graph, Node* node, MaybeHandle<Context> context);
26
27  void DecorateGraph(Graph* graph);
28
29  Zone* zone() { return zone_; }
30  Isolate* isolate() { return zone_->isolate(); }
31
32 private:
33  class Visitor;
34  class RunVisitor;
35  class NarrowVisitor;
36  class WidenVisitor;
37
38  Zone* zone_;
39  Type* number_fun0_;
40  Type* number_fun1_;
41  Type* number_fun2_;
42  Type* imul_fun_;
43  Type* array_buffer_fun_;
44  Type* int8_array_fun_;
45  Type* int16_array_fun_;
46  Type* int32_array_fun_;
47  Type* uint8_array_fun_;
48  Type* uint16_array_fun_;
49  Type* uint32_array_fun_;
50  Type* float32_array_fun_;
51  Type* float64_array_fun_;
52};
53}
54}
55}  // namespace v8::internal::compiler
56
57#endif  // V8_COMPILER_TYPER_H_
58