OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_TYPING_H_ | 5 #ifndef V8_TYPING_H_ |
6 #define V8_TYPING_H_ | 6 #define V8_TYPING_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/ast.h" | 9 #include "src/ast.h" |
10 #include "src/effects.h" | 10 #include "src/effects.h" |
11 #include "src/scopes.h" | 11 #include "src/scopes.h" |
12 #include "src/type-info.h" | 12 #include "src/type-info.h" |
13 #include "src/types.h" | 13 #include "src/types.h" |
14 #include "src/zone.h" | 14 #include "src/zone.h" |
15 | 15 |
16 namespace v8 { | 16 namespace v8 { |
17 namespace internal { | 17 namespace internal { |
18 | 18 |
19 | 19 |
20 class AstTyper: public AstVisitor { | 20 class AstTyper: public AstVisitor { |
21 public: | 21 public: |
22 explicit AstTyper(CompilationInfo* info); | 22 AstTyper(Isolate* isolate, Zone* zone, Handle<JSFunction> closure, |
| 23 Scope* scope, BailoutId osr_ast_id, FunctionLiteral* root); |
23 void Run(); | 24 void Run(); |
24 | 25 |
25 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); | 26 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); |
26 | 27 |
27 private: | 28 private: |
28 Effect ObservedOnStack(Object* value); | 29 Effect ObservedOnStack(Object* value); |
29 void ObserveTypesAtOsrEntry(IterationStatement* stmt); | 30 void ObserveTypesAtOsrEntry(IterationStatement* stmt); |
30 | 31 |
31 static const int kNoVar = INT_MIN; | 32 static const int kNoVar = INT_MIN; |
32 typedef v8::internal::Effects<int, kNoVar> Effects; | 33 typedef v8::internal::Effects<int, kNoVar> Effects; |
33 typedef v8::internal::NestedEffects<int, kNoVar> Store; | 34 typedef v8::internal::NestedEffects<int, kNoVar> Store; |
34 | 35 |
35 CompilationInfo* info_; | 36 Handle<JSFunction> closure_; |
| 37 Scope* scope_; |
| 38 BailoutId osr_ast_id_; |
| 39 FunctionLiteral* root_; |
36 TypeFeedbackOracle oracle_; | 40 TypeFeedbackOracle oracle_; |
37 Store store_; | 41 Store store_; |
38 | 42 |
39 TypeFeedbackOracle* oracle() { return &oracle_; } | 43 TypeFeedbackOracle* oracle() { return &oracle_; } |
40 | 44 |
41 void NarrowType(Expression* e, Bounds b) { | 45 void NarrowType(Expression* e, Bounds b) { |
42 e->set_bounds(Bounds::Both(e->bounds(), b, zone())); | 46 e->set_bounds(Bounds::Both(e->bounds(), b, zone())); |
43 } | 47 } |
44 void NarrowLowerType(Expression* e, Type* t) { | 48 void NarrowLowerType(Expression* e, Type* t) { |
45 e->set_bounds(Bounds::NarrowLower(e->bounds(), t, zone())); | 49 e->set_bounds(Bounds::NarrowLower(e->bounds(), t, zone())); |
(...skipping 22 matching lines...) Expand all Loading... |
68 #define DECLARE_VISIT(type) virtual void Visit##type(type* node) override; | 72 #define DECLARE_VISIT(type) virtual void Visit##type(type* node) override; |
69 AST_NODE_LIST(DECLARE_VISIT) | 73 AST_NODE_LIST(DECLARE_VISIT) |
70 #undef DECLARE_VISIT | 74 #undef DECLARE_VISIT |
71 | 75 |
72 DISALLOW_COPY_AND_ASSIGN(AstTyper); | 76 DISALLOW_COPY_AND_ASSIGN(AstTyper); |
73 }; | 77 }; |
74 | 78 |
75 } } // namespace v8::internal | 79 } } // namespace v8::internal |
76 | 80 |
77 #endif // V8_TYPING_H_ | 81 #endif // V8_TYPING_H_ |
OLD | NEW |