Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1177)

Side by Side Diff: src/asmjs/asm-typer.h

Issue 2361053004: Revert of [wasm] Master CL for Binary 0xC changes. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/asmjs/asm-js.cc ('k') | src/asmjs/asm-typer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 }; 66 };
67 67
68 ~AsmTyper() = default; 68 ~AsmTyper() = default;
69 AsmTyper(Isolate* isolate, Zone* zone, Script* script, FunctionLiteral* root); 69 AsmTyper(Isolate* isolate, Zone* zone, Script* script, FunctionLiteral* root);
70 70
71 bool Validate(); 71 bool Validate();
72 72
73 const char* error_message() const { return error_message_; } 73 const char* error_message() const { return error_message_; }
74 74
75 AsmType* TypeOf(AstNode* node) const; 75 AsmType* TypeOf(AstNode* node) const;
76 AsmType* TypeOf(Variable* v) const;
77 StandardMember VariableAsStandardMember(Variable* var); 76 StandardMember VariableAsStandardMember(Variable* var);
78 77
79 typedef std::unordered_set<StandardMember, std::hash<int> > StdlibSet; 78 typedef std::unordered_set<StandardMember, std::hash<int> > StdlibSet;
80 79
81 StdlibSet StdlibUses() const { return stdlib_uses_; } 80 StdlibSet StdlibUses() const { return stdlib_uses_; }
82 81
83 // Each FFI import has a usage-site signature associated with it.
84 struct FFIUseSignature {
85 Variable* var;
86 ZoneVector<AsmType*> arg_types_;
87 AsmType* return_type_;
88 FFIUseSignature(Variable* v, Zone* zone)
89 : var(v), arg_types_(zone), return_type_(nullptr) {}
90 };
91
92 const ZoneVector<FFIUseSignature>& FFIUseSignatures() {
93 return ffi_use_signatures_;
94 }
95
96 private: 82 private:
97 friend class v8::internal::wasm::AsmTyperHarnessBuilder; 83 friend class v8::internal::wasm::AsmTyperHarnessBuilder;
98 84
99 class VariableInfo : public ZoneObject { 85 class VariableInfo : public ZoneObject {
100 public: 86 public:
101 enum Mutability { 87 enum Mutability {
102 kInvalidMutability, 88 kInvalidMutability,
103 kLocal, 89 kLocal,
104 kMutableGlobal, 90 kMutableGlobal,
105 kImmutableGlobal, 91 kImmutableGlobal,
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 bool AddGlobal(Variable* global, VariableInfo* info); 185 bool AddGlobal(Variable* global, VariableInfo* info);
200 bool AddLocal(Variable* global, VariableInfo* info); 186 bool AddLocal(Variable* global, VariableInfo* info);
201 // Used for 5.5 GlobalVariableTypeAnnotations 187 // Used for 5.5 GlobalVariableTypeAnnotations
202 VariableInfo* ImportLookup(Property* expr); 188 VariableInfo* ImportLookup(Property* expr);
203 // 3.3 Environment Lookup 189 // 3.3 Environment Lookup
204 // NOTE: In the spec, the lookup function's prototype is 190 // NOTE: In the spec, the lookup function's prototype is
205 // 191 //
206 // Lookup(Delta, Gamma, x) 192 // Lookup(Delta, Gamma, x)
207 // 193 //
208 // Delta is the global_scope_ member, and Gamma, local_scope_. 194 // Delta is the global_scope_ member, and Gamma, local_scope_.
209 VariableInfo* Lookup(Variable* variable) const; 195 VariableInfo* Lookup(Variable* variable);
210 196
211 // All of the ValidateXXX methods below return AsmType::None() in case of 197 // All of the ValidateXXX methods below return AsmType::None() in case of
212 // validation failure. 198 // validation failure.
213 199
214 // 6.1 ValidateModule 200 // 6.1 ValidateModule
215 AsmType* ValidateModule(FunctionLiteral* fun); 201 AsmType* ValidateModule(FunctionLiteral* fun);
216 AsmType* ValidateGlobalDeclaration(Assignment* assign); 202 AsmType* ValidateGlobalDeclaration(Assignment* assign);
217 // 6.2 ValidateExport 203 // 6.2 ValidateExport
218 AsmType* ExportType(VariableProxy* fun_export); 204 AsmType* ExportType(VariableProxy* fun_export);
219 AsmType* ValidateExport(ReturnStatement* exports); 205 AsmType* ValidateExport(ReturnStatement* exports);
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 299
314 Isolate* isolate_; 300 Isolate* isolate_;
315 Zone* zone_; 301 Zone* zone_;
316 Script* script_; 302 Script* script_;
317 FunctionLiteral* root_; 303 FunctionLiteral* root_;
318 bool in_function_ = false; 304 bool in_function_ = false;
319 305
320 AsmType* return_type_ = nullptr; 306 AsmType* return_type_ = nullptr;
321 307
322 ZoneVector<VariableInfo*> forward_definitions_; 308 ZoneVector<VariableInfo*> forward_definitions_;
323 ZoneVector<FFIUseSignature> ffi_use_signatures_;
324 ObjectTypeMap stdlib_types_; 309 ObjectTypeMap stdlib_types_;
325 ObjectTypeMap stdlib_math_types_; 310 ObjectTypeMap stdlib_math_types_;
326 311
327 // The ASM module name. This member is used to prevent globals from redefining 312 // The ASM module name. This member is used to prevent globals from redefining
328 // the module name. 313 // the module name.
329 VariableInfo* module_info_; 314 VariableInfo* module_info_;
330 Handle<String> module_name_; 315 Handle<String> module_name_;
331 316
332 // 3 Environments 317 // 3 Environments
333 ZoneHashMap global_scope_; // 3.1 Global environment 318 ZoneHashMap global_scope_; // 3.1 Global environment
334 ZoneHashMap local_scope_; // 3.2 Variable environment 319 ZoneHashMap local_scope_; // 3.2 Variable environment
335 320
336 std::uintptr_t stack_limit_; 321 std::uintptr_t stack_limit_;
337 bool stack_overflow_ = false; 322 bool stack_overflow_ = false;
338 ZoneMap<AstNode*, AsmType*> node_types_; 323 ZoneMap<AstNode*, AsmType*> node_types_;
339 static const int kErrorMessageLimit = 100; 324 static const int kErrorMessageLimit = 100;
340 AsmType* fround_type_; 325 AsmType* fround_type_;
341 AsmType* ffi_type_; 326 AsmType* ffi_type_;
342 char error_message_[kErrorMessageLimit]; 327 char error_message_[kErrorMessageLimit];
343 StdlibSet stdlib_uses_; 328 StdlibSet stdlib_uses_;
344 329
345 DISALLOW_IMPLICIT_CONSTRUCTORS(AsmTyper); 330 DISALLOW_IMPLICIT_CONSTRUCTORS(AsmTyper);
346 }; 331 };
347 332
348 } // namespace wasm 333 } // namespace wasm
349 } // namespace internal 334 } // namespace internal
350 } // namespace v8 335 } // namespace v8
351 336
352 #endif // SRC_ASMJS_ASM_TYPER_H_ 337 #endif // SRC_ASMJS_ASM_TYPER_H_
OLDNEW
« no previous file with comments | « src/asmjs/asm-js.cc ('k') | src/asmjs/asm-typer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698