blob: b65a9a5aff09edb1c5a13f4cc1df494b70d4e574 [file] [log] [blame]
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001// 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
Emily Bernierd0a1eb72015-03-24 16:35:39 -040018// Forward declarations.
19class LazyTypeCache;
20
21
Ben Murdochb8a8cc12014-11-26 15:28:44 +000022class Typer {
23 public:
Emily Bernierd0a1eb72015-03-24 16:35:39 -040024 explicit Typer(Graph* graph, MaybeHandle<Context> context);
25 ~Typer();
Ben Murdochb8a8cc12014-11-26 15:28:44 +000026
Emily Bernierd0a1eb72015-03-24 16:35:39 -040027 void Run();
Ben Murdochb8a8cc12014-11-26 15:28:44 +000028
Emily Bernierd0a1eb72015-03-24 16:35:39 -040029 Graph* graph() { return graph_; }
30 MaybeHandle<Context> context() { return context_; }
31 Zone* zone() { return graph_->zone(); }
32 Isolate* isolate() { return zone()->isolate(); }
Ben Murdochb8a8cc12014-11-26 15:28:44 +000033
34 private:
35 class Visitor;
Emily Bernierd0a1eb72015-03-24 16:35:39 -040036 class Decorator;
37
38 Graph* graph_;
39 MaybeHandle<Context> context_;
40 Decorator* decorator_;
Ben Murdochb8a8cc12014-11-26 15:28:44 +000041
42 Zone* zone_;
Emily Bernierd0a1eb72015-03-24 16:35:39 -040043 Type* boolean_or_number;
44 Type* undefined_or_null;
45 Type* undefined_or_number;
46 Type* negative_signed32;
47 Type* non_negative_signed32;
48 Type* singleton_false;
49 Type* singleton_true;
50 Type* singleton_zero;
51 Type* singleton_one;
52 Type* zero_or_one;
53 Type* zeroish;
54 Type* signed32ish;
55 Type* unsigned32ish;
56 Type* falsish;
57 Type* truish;
58 Type* integer;
59 Type* weakint;
Ben Murdochb8a8cc12014-11-26 15:28:44 +000060 Type* number_fun0_;
61 Type* number_fun1_;
62 Type* number_fun2_;
Emily Bernierd0a1eb72015-03-24 16:35:39 -040063 Type* weakint_fun1_;
64 Type* random_fun_;
65 LazyTypeCache* cache_;
66
67 ZoneVector<Handle<Object> > weaken_min_limits_;
68 ZoneVector<Handle<Object> > weaken_max_limits_;
69 DISALLOW_COPY_AND_ASSIGN(Typer);
Ben Murdochb8a8cc12014-11-26 15:28:44 +000070};
Emily Bernierd0a1eb72015-03-24 16:35:39 -040071
72} // namespace compiler
73} // namespace internal
74} // namespace v8
Ben Murdochb8a8cc12014-11-26 15:28:44 +000075
76#endif // V8_COMPILER_TYPER_H_