| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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_ASM_H_ | 5 #ifndef V8_TYPING_ASM_H_ |
| 6 #define V8_TYPING_ASM_H_ | 6 #define V8_TYPING_ASM_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/type-info.h" | 11 #include "src/type-info.h" |
| 12 #include "src/types.h" | 12 #include "src/types.h" |
| 13 #include "src/zone.h" | 13 #include "src/zone.h" |
| 14 | 14 |
| 15 namespace v8 { | 15 namespace v8 { |
| 16 namespace internal { | 16 namespace internal { |
| 17 | 17 |
| 18 class ZoneTypeCache; | 18 class ZoneTypeCache; |
| 19 | 19 |
| 20 class AsmTyper : public AstVisitor { | 20 class AsmTyper : public AstVisitor { |
| 21 public: | 21 public: |
| 22 explicit AsmTyper(Isolate* isolate, Zone* zone, Script* script, | 22 explicit AsmTyper(Isolate* isolate, Zone* zone, Script* script, |
| 23 FunctionLiteral* root); | 23 FunctionLiteral* root); |
| 24 bool Validate(); | 24 bool Validate(); |
| 25 const char* error_message() { return error_message_; } | 25 const char* error_message() { return error_message_; } |
| 26 | 26 |
| 27 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); | 27 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); |
| 28 | 28 |
| 29 private: | 29 private: |
| 30 Zone* zone_; |
| 30 Script* script_; | 31 Script* script_; |
| 31 FunctionLiteral* root_; | 32 FunctionLiteral* root_; |
| 32 bool valid_; | 33 bool valid_; |
| 33 | 34 |
| 34 // Information for bi-directional typing with a cap on nesting depth. | 35 // Information for bi-directional typing with a cap on nesting depth. |
| 35 Type* expected_type_; | 36 Type* expected_type_; |
| 36 Type* computed_type_; | 37 Type* computed_type_; |
| 37 int intish_; // How many ops we've gone without a x|0. | 38 int intish_; // How many ops we've gone without a x|0. |
| 38 | 39 |
| 39 Type* return_type_; // Return type of last function. | 40 Type* return_type_; // Return type of last function. |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 Type* GetType(Variable* variable); | 77 Type* GetType(Variable* variable); |
| 77 | 78 |
| 78 Type* LibType(ObjectTypeMap map, Handle<String> name); | 79 Type* LibType(ObjectTypeMap map, Handle<String> name); |
| 79 | 80 |
| 80 void SetResult(Expression* expr, Type* type); | 81 void SetResult(Expression* expr, Type* type); |
| 81 void IntersectResult(Expression* expr, Type* type); | 82 void IntersectResult(Expression* expr, Type* type); |
| 82 | 83 |
| 83 void VisitWithExpectation(Expression* expr, Type* expected_type, | 84 void VisitWithExpectation(Expression* expr, Type* expected_type, |
| 84 const char* msg); | 85 const char* msg); |
| 85 | 86 |
| 87 Zone* zone() const { return zone_; } |
| 88 |
| 86 #define DECLARE_VISIT(type) virtual void Visit##type(type* node) override; | 89 #define DECLARE_VISIT(type) virtual void Visit##type(type* node) override; |
| 87 AST_NODE_LIST(DECLARE_VISIT) | 90 AST_NODE_LIST(DECLARE_VISIT) |
| 88 #undef DECLARE_VISIT | 91 #undef DECLARE_VISIT |
| 89 | 92 |
| 90 DISALLOW_COPY_AND_ASSIGN(AsmTyper); | 93 DISALLOW_COPY_AND_ASSIGN(AsmTyper); |
| 91 }; | 94 }; |
| 92 } // namespace internal | 95 } // namespace internal |
| 93 } // namespace v8 | 96 } // namespace v8 |
| 94 | 97 |
| 95 #endif // V8_TYPING_ASM_H_ | 98 #endif // V8_TYPING_ASM_H_ |
| OLD | NEW |