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" |
(...skipping 18 matching lines...) Expand all Loading... |
29 private: | 29 private: |
30 Zone* zone_; | 30 Zone* zone_; |
31 Script* script_; | 31 Script* script_; |
32 FunctionLiteral* root_; | 32 FunctionLiteral* root_; |
33 bool valid_; | 33 bool valid_; |
34 | 34 |
35 // Information for bi-directional typing with a cap on nesting depth. | 35 // Information for bi-directional typing with a cap on nesting depth. |
36 Type* expected_type_; | 36 Type* expected_type_; |
37 Type* computed_type_; | 37 Type* computed_type_; |
38 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. |
| 39 bool assigning_; // Are we about to assign. |
39 | 40 |
40 Type* return_type_; // Return type of last function. | 41 Type* return_type_; // Return type of last function. |
41 size_t array_size_; // Array size of last ArrayLiteral. | 42 size_t array_size_; // Array size of last ArrayLiteral. |
42 | 43 |
43 typedef ZoneMap<std::string, Type*> ObjectTypeMap; | 44 typedef ZoneMap<std::string, Type*> ObjectTypeMap; |
44 ObjectTypeMap stdlib_types_; | 45 ObjectTypeMap stdlib_types_; |
45 ObjectTypeMap stdlib_heap_types_; | 46 ObjectTypeMap stdlib_heap_types_; |
46 ObjectTypeMap stdlib_math_types_; | 47 ObjectTypeMap stdlib_math_types_; |
47 | 48 |
48 // Map from Variable* to global/local variable Type*. | 49 // Map from Variable* to global/local variable Type*. |
49 ZoneHashMap global_variable_type_; | 50 ZoneHashMap global_variable_type_; |
50 ZoneHashMap local_variable_type_; | 51 ZoneHashMap local_variable_type_; |
51 | 52 |
52 bool in_function_; // In module function? | 53 bool in_function_; // In module function? |
53 bool building_function_tables_; | 54 bool building_function_tables_; |
54 | 55 |
55 TypeCache const& cache_; | 56 TypeCache const& cache_; |
56 | 57 |
57 static const int kErrorMessageLimit = 100; | 58 static const int kErrorMessageLimit = 100; |
58 char error_message_[kErrorMessageLimit]; | 59 char error_message_[kErrorMessageLimit]; |
59 | 60 |
60 static const int kMaxUncombinedAdditiveSteps = 1 << 20; | 61 static const int kMaxUncombinedAdditiveSteps = 1 << 20; |
61 static const int kMaxUncombinedMultiplicativeSteps = 1; | 62 static const int kMaxUncombinedMultiplicativeSteps = 1; |
62 | 63 |
63 void InitializeStdlib(); | 64 void InitializeStdlib(); |
64 | 65 |
65 void VisitDeclarations(ZoneList<Declaration*>* d) override; | 66 void VisitDeclarations(ZoneList<Declaration*>* d) override; |
66 void VisitStatements(ZoneList<Statement*>* s) override; | 67 void VisitStatements(ZoneList<Statement*>* s) override; |
67 | 68 |
68 void VisitExpressionAnnotation(Expression* e, bool is_return); | 69 void VisitExpressionAnnotation(Expression* e, Variable* var, bool is_return); |
69 void VisitFunctionAnnotation(FunctionLiteral* f); | 70 void VisitFunctionAnnotation(FunctionLiteral* f); |
70 void VisitAsmModule(FunctionLiteral* f); | 71 void VisitAsmModule(FunctionLiteral* f); |
71 | 72 |
72 void VisitHeapAccess(Property* expr); | 73 void VisitHeapAccess(Property* expr); |
73 | 74 |
74 int ElementShiftSize(Type* type); | 75 int ElementShiftSize(Type* type); |
75 Type* StorageType(Type* type); | 76 Type* StorageType(Type* type); |
76 | 77 |
77 void SetType(Variable* variable, Type* type); | 78 void SetType(Variable* variable, Type* type); |
78 Type* GetType(Variable* variable); | 79 Type* GetType(Variable* variable); |
(...skipping 17 matching lines...) Expand all Loading... |
96 #define DECLARE_VISIT(type) void Visit##type(type* node) override; | 97 #define DECLARE_VISIT(type) void Visit##type(type* node) override; |
97 AST_NODE_LIST(DECLARE_VISIT) | 98 AST_NODE_LIST(DECLARE_VISIT) |
98 #undef DECLARE_VISIT | 99 #undef DECLARE_VISIT |
99 | 100 |
100 DISALLOW_COPY_AND_ASSIGN(AsmTyper); | 101 DISALLOW_COPY_AND_ASSIGN(AsmTyper); |
101 }; | 102 }; |
102 } // namespace internal | 103 } // namespace internal |
103 } // namespace v8 | 104 } // namespace v8 |
104 | 105 |
105 #endif // V8_TYPING_ASM_H_ | 106 #endif // V8_TYPING_ASM_H_ |
OLD | NEW |