Line data Source code
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/compiler/graph.h"
9 : #include "src/compiler/operation-typer.h"
10 : #include "src/globals.h"
11 :
12 : namespace v8 {
13 : namespace internal {
14 : namespace compiler {
15 :
16 : // Forward declarations.
17 : class LoopVariableOptimizer;
18 :
19 : class V8_EXPORT_PRIVATE Typer {
20 : public:
21 : enum Flag : uint8_t {
22 : kNoFlags = 0,
23 : kThisIsReceiver = 1u << 0, // Parameter this is an Object.
24 : kNewTargetIsReceiver = 1u << 1, // Parameter new.target is an Object.
25 : };
26 : using Flags = base::Flags<Flag>;
27 :
28 : Typer(JSHeapBroker* broker, Flags flags, Graph* graph);
29 : ~Typer();
30 :
31 : void Run();
32 : // TODO(bmeurer,jarin): Remove this once we have a notion of "roots" on Graph.
33 : void Run(const ZoneVector<Node*>& roots,
34 : LoopVariableOptimizer* induction_vars);
35 :
36 : private:
37 : class Visitor;
38 : class Decorator;
39 :
40 : Flags flags() const { return flags_; }
41 : Graph* graph() const { return graph_; }
42 : Zone* zone() const { return graph()->zone(); }
43 352098 : OperationTyper* operation_typer() { return &operation_typer_; }
44 : JSHeapBroker* broker() const { return broker_; }
45 :
46 : Flags const flags_;
47 : Graph* const graph_;
48 : Decorator* decorator_;
49 : TypeCache const* cache_;
50 : JSHeapBroker* broker_;
51 : OperationTyper operation_typer_;
52 :
53 : Type singleton_false_;
54 : Type singleton_true_;
55 :
56 : DISALLOW_COPY_AND_ASSIGN(Typer);
57 : };
58 :
59 : DEFINE_OPERATORS_FOR_FLAGS(Typer::Flags)
60 :
61 : } // namespace compiler
62 : } // namespace internal
63 : } // namespace v8
64 :
65 : #endif // V8_COMPILER_TYPER_H_
|