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 #include <unordered_set> | 10 #include <unordered_set> |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 | 95 |
96 private: | 96 private: |
97 friend class v8::internal::wasm::AsmTyperHarnessBuilder; | 97 friend class v8::internal::wasm::AsmTyperHarnessBuilder; |
98 | 98 |
99 class VariableInfo : public ZoneObject { | 99 class VariableInfo : public ZoneObject { |
100 public: | 100 public: |
101 enum Mutability { | 101 enum Mutability { |
102 kInvalidMutability, | 102 kInvalidMutability, |
103 kLocal, | 103 kLocal, |
104 kMutableGlobal, | 104 kMutableGlobal, |
| 105 kConstGlobal, |
105 kImmutableGlobal, | 106 kImmutableGlobal, |
106 }; | 107 }; |
107 | 108 |
108 explicit VariableInfo(AsmType* t) : type_(t) {} | 109 explicit VariableInfo(AsmType* t) : type_(t) {} |
109 | 110 |
110 VariableInfo* Clone(Zone* zone) const; | 111 VariableInfo* Clone(Zone* zone) const; |
111 | 112 |
112 bool IsMutable() const { | 113 bool IsMutable() const { |
113 return mutability_ == kLocal || mutability_ == kMutableGlobal; | 114 return mutability_ == kLocal || mutability_ == kMutableGlobal; |
114 } | 115 } |
115 | 116 |
116 bool IsGlobal() const { | 117 bool IsGlobal() const { |
117 return mutability_ == kImmutableGlobal || mutability_ == kMutableGlobal; | 118 return mutability_ == kImmutableGlobal || mutability_ == kConstGlobal || |
| 119 mutability_ == kMutableGlobal; |
118 } | 120 } |
119 | 121 |
120 bool IsStdlib() const { return standard_member_ == kStdlib; } | 122 bool IsStdlib() const { return standard_member_ == kStdlib; } |
121 bool IsFFI() const { return standard_member_ == kFFI; } | 123 bool IsFFI() const { return standard_member_ == kFFI; } |
122 bool IsHeap() const { return standard_member_ == kHeap; } | 124 bool IsHeap() const { return standard_member_ == kHeap; } |
123 | 125 |
124 void MarkDefined() { missing_definition_ = false; } | 126 void MarkDefined() { missing_definition_ = false; } |
125 void FirstForwardUseIs(VariableProxy* var); | 127 void FirstForwardUseIs(VariableProxy* var); |
126 | 128 |
127 StandardMember standard_member() const { return standard_member_; } | 129 StandardMember standard_member() const { return standard_member_; } |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 bool IsCallToFround(Call* call); | 302 bool IsCallToFround(Call* call); |
301 AsmType* ValidateFloatCoercion(Call* call); | 303 AsmType* ValidateFloatCoercion(Call* call); |
302 | 304 |
303 // 5.1 ParameterTypeAnnotations | 305 // 5.1 ParameterTypeAnnotations |
304 AsmType* ParameterTypeAnnotations(Variable* parameter, | 306 AsmType* ParameterTypeAnnotations(Variable* parameter, |
305 Expression* annotation); | 307 Expression* annotation); |
306 // 5.2 ReturnTypeAnnotations | 308 // 5.2 ReturnTypeAnnotations |
307 AsmType* ReturnTypeAnnotations(ReturnStatement* statement); | 309 AsmType* ReturnTypeAnnotations(ReturnStatement* statement); |
308 // 5.4 VariableTypeAnnotations | 310 // 5.4 VariableTypeAnnotations |
309 // 5.5 GlobalVariableTypeAnnotations | 311 // 5.5 GlobalVariableTypeAnnotations |
310 AsmType* VariableTypeAnnotations(Expression* initializer, | 312 AsmType* VariableTypeAnnotations( |
311 bool global = false); | 313 Expression* initializer, |
| 314 VariableInfo::Mutability global = VariableInfo::kLocal); |
312 AsmType* ImportExpression(Property* import); | 315 AsmType* ImportExpression(Property* import); |
313 AsmType* NewHeapView(CallNew* new_heap_view); | 316 AsmType* NewHeapView(CallNew* new_heap_view); |
314 | 317 |
315 Isolate* isolate_; | 318 Isolate* isolate_; |
316 Zone* zone_; | 319 Zone* zone_; |
317 Script* script_; | 320 Script* script_; |
318 FunctionLiteral* root_; | 321 FunctionLiteral* root_; |
319 bool in_function_ = false; | 322 bool in_function_ = false; |
320 | 323 |
321 AsmType* return_type_ = nullptr; | 324 AsmType* return_type_ = nullptr; |
(...skipping 22 matching lines...) Expand all Loading... |
344 StdlibSet stdlib_uses_; | 347 StdlibSet stdlib_uses_; |
345 | 348 |
346 DISALLOW_IMPLICIT_CONSTRUCTORS(AsmTyper); | 349 DISALLOW_IMPLICIT_CONSTRUCTORS(AsmTyper); |
347 }; | 350 }; |
348 | 351 |
349 } // namespace wasm | 352 } // namespace wasm |
350 } // namespace internal | 353 } // namespace internal |
351 } // namespace v8 | 354 } // namespace v8 |
352 | 355 |
353 #endif // SRC_ASMJS_ASM_TYPER_H_ | 356 #endif // SRC_ASMJS_ASM_TYPER_H_ |
OLD | NEW |