| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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 SRC_ASMJS_ASM_TYPER_H_ | 5 #ifndef SRC_ASMJS_ASM_TYPER_H_ |
| 6 #define SRC_ASMJS_ASM_TYPER_H_ | 6 #define SRC_ASMJS_ASM_TYPER_H_ |
| 7 | 7 |
| 8 #include <cstdint> | 8 #include <cstdint> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 | 78 |
| 79 class VariableInfo : public ZoneObject { | 79 class VariableInfo : public ZoneObject { |
| 80 public: | 80 public: |
| 81 enum Mutability { | 81 enum Mutability { |
| 82 kInvalidMutability, | 82 kInvalidMutability, |
| 83 kLocal, | 83 kLocal, |
| 84 kMutableGlobal, | 84 kMutableGlobal, |
| 85 kImmutableGlobal, | 85 kImmutableGlobal, |
| 86 }; | 86 }; |
| 87 | 87 |
| 88 VariableInfo() = default; | |
| 89 explicit VariableInfo(AsmType* t) : type_(t) {} | 88 explicit VariableInfo(AsmType* t) : type_(t) {} |
| 90 | 89 |
| 91 VariableInfo* Clone(Zone* zone) const; | 90 VariableInfo* Clone(Zone* zone) const; |
| 92 | 91 |
| 93 bool IsMutable() const { | 92 bool IsMutable() const { |
| 94 return mutability_ == kLocal || mutability_ == kMutableGlobal; | 93 return mutability_ == kLocal || mutability_ == kMutableGlobal; |
| 95 } | 94 } |
| 96 | 95 |
| 97 bool IsGlobal() const { | 96 bool IsGlobal() const { |
| 98 return mutability_ == kImmutableGlobal || mutability_ == kMutableGlobal; | 97 return mutability_ == kImmutableGlobal || mutability_ == kMutableGlobal; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 113 AsmType* type() const { return type_; } | 112 AsmType* type() const { return type_; } |
| 114 void set_type(AsmType* type) { type_ = type; } | 113 void set_type(AsmType* type) { type_ = type; } |
| 115 | 114 |
| 116 Mutability mutability() const { return mutability_; } | 115 Mutability mutability() const { return mutability_; } |
| 117 void set_mutability(Mutability mutability) { mutability_ = mutability; } | 116 void set_mutability(Mutability mutability) { mutability_ = mutability; } |
| 118 | 117 |
| 119 bool missing_definition() const { return missing_definition_; } | 118 bool missing_definition() const { return missing_definition_; } |
| 120 | 119 |
| 121 VariableProxy* first_forward_use() const { return first_forward_use_; } | 120 VariableProxy* first_forward_use() const { return first_forward_use_; } |
| 122 | 121 |
| 122 static VariableInfo* ForSpecialSymbol(Zone* zone, |
| 123 StandardMember standard_member); |
| 124 |
| 123 private: | 125 private: |
| 124 AsmType* type_ = AsmType::None(); | 126 AsmType* type_; |
| 125 StandardMember standard_member_ = kNone; | 127 StandardMember standard_member_ = kNone; |
| 126 Mutability mutability_ = kInvalidMutability; | 128 Mutability mutability_ = kInvalidMutability; |
| 127 // missing_definition_ is set to true for forward definition - i.e., use | 129 // missing_definition_ is set to true for forward definition - i.e., use |
| 128 // before definition. | 130 // before definition. |
| 129 bool missing_definition_ = false; | 131 bool missing_definition_ = false; |
| 130 // first_forward_use_ holds the AST node that first referenced this | 132 // first_forward_use_ holds the AST node that first referenced this |
| 131 // VariableInfo. Used for error messages. | 133 // VariableInfo. Used for error messages. |
| 132 VariableProxy* first_forward_use_ = nullptr; | 134 VariableProxy* first_forward_use_ = nullptr; |
| 133 }; | 135 }; |
| 134 | 136 |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 bool in_function_ = false; | 298 bool in_function_ = false; |
| 297 | 299 |
| 298 AsmType* return_type_ = nullptr; | 300 AsmType* return_type_ = nullptr; |
| 299 | 301 |
| 300 ZoneVector<VariableInfo*> forward_definitions_; | 302 ZoneVector<VariableInfo*> forward_definitions_; |
| 301 ObjectTypeMap stdlib_types_; | 303 ObjectTypeMap stdlib_types_; |
| 302 ObjectTypeMap stdlib_math_types_; | 304 ObjectTypeMap stdlib_math_types_; |
| 303 | 305 |
| 304 // The ASM module name. This member is used to prevent globals from redefining | 306 // The ASM module name. This member is used to prevent globals from redefining |
| 305 // the module name. | 307 // the module name. |
| 306 VariableInfo module_info_; | 308 VariableInfo* module_info_; |
| 307 Handle<String> module_name_; | 309 Handle<String> module_name_; |
| 308 | 310 |
| 309 // 3 Environments | 311 // 3 Environments |
| 310 ZoneHashMap global_scope_; // 3.1 Global environment | 312 ZoneHashMap global_scope_; // 3.1 Global environment |
| 311 ZoneHashMap local_scope_; // 3.2 Variable environment | 313 ZoneHashMap local_scope_; // 3.2 Variable environment |
| 312 | 314 |
| 313 std::uintptr_t stack_limit_; | 315 std::uintptr_t stack_limit_; |
| 314 bool stack_overflow_ = false; | 316 bool stack_overflow_ = false; |
| 315 ZoneMap<AstNode*, AsmType*> node_types_; | 317 ZoneMap<AstNode*, AsmType*> node_types_; |
| 316 static const int kErrorMessageLimit = 100; | 318 static const int kErrorMessageLimit = 100; |
| 317 AsmType* fround_type_; | 319 AsmType* fround_type_; |
| 320 AsmType* ffi_type_; |
| 318 char error_message_[kErrorMessageLimit]; | 321 char error_message_[kErrorMessageLimit]; |
| 319 | 322 |
| 320 DISALLOW_IMPLICIT_CONSTRUCTORS(AsmTyper); | 323 DISALLOW_IMPLICIT_CONSTRUCTORS(AsmTyper); |
| 321 }; | 324 }; |
| 322 | 325 |
| 323 } // namespace wasm | 326 } // namespace wasm |
| 324 } // namespace internal | 327 } // namespace internal |
| 325 } // namespace v8 | 328 } // namespace v8 |
| 326 | 329 |
| 327 #endif // SRC_ASMJS_ASM_TYPER_H_ | 330 #endif // SRC_ASMJS_ASM_TYPER_H_ |
| OLD | NEW |