Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 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 | |
| 14 | namespace v8 { |
| 15 | namespace internal { |
| 16 | namespace compiler { |
| 17 | |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame^] | 18 | // Forward declarations. |
| 19 | class LazyTypeCache; |
| 20 | |
| 21 | |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 22 | class Typer { |
| 23 | public: |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame^] | 24 | explicit Typer(Graph* graph, MaybeHandle<Context> context); |
| 25 | ~Typer(); |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 26 | |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame^] | 27 | void Run(); |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 28 | |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame^] | 29 | Graph* graph() { return graph_; } |
| 30 | MaybeHandle<Context> context() { return context_; } |
| 31 | Zone* zone() { return graph_->zone(); } |
| 32 | Isolate* isolate() { return zone()->isolate(); } |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 33 | |
| 34 | private: |
| 35 | class Visitor; |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame^] | 36 | class Decorator; |
| 37 | |
| 38 | Graph* graph_; |
| 39 | MaybeHandle<Context> context_; |
| 40 | Decorator* decorator_; |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 41 | |
| 42 | Zone* zone_; |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame^] | 43 | 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 Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 60 | Type* number_fun0_; |
| 61 | Type* number_fun1_; |
| 62 | Type* number_fun2_; |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame^] | 63 | 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 Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 70 | }; |
Emily Bernier | d0a1eb7 | 2015-03-24 16:35:39 -0400 | [diff] [blame^] | 71 | |
| 72 | } // namespace compiler |
| 73 | } // namespace internal |
| 74 | } // namespace v8 |
Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 75 | |
| 76 | #endif // V8_COMPILER_TYPER_H_ |