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

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

Issue 2345593003: [wasm] Master CL for Binary 0xC changes. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Last comments update Created 4 years, 3 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 | « no previous file | src/asmjs/asm-typer.cc » ('j') | src/asmjs/asm-typer.cc » ('J')
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;
76 StandardMember VariableAsStandardMember(Variable* var); 77 StandardMember VariableAsStandardMember(Variable* var);
77 78
78 typedef std::unordered_set<StandardMember, std::hash<int> > StdlibSet; 79 typedef std::unordered_set<StandardMember, std::hash<int> > StdlibSet;
79 80
80 StdlibSet StdlibUses() const { return stdlib_uses_; } 81 StdlibSet StdlibUses() const { return stdlib_uses_; }
81 82
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() {
Mircea Trofin 2016/09/19 16:16:24 could this be const ZoneVector<FFIUseSignature>&,
93 return &ffi_use_signatures_;
94 }
95
82 private: 96 private:
83 friend class v8::internal::wasm::AsmTyperHarnessBuilder; 97 friend class v8::internal::wasm::AsmTyperHarnessBuilder;
84 98
85 class VariableInfo : public ZoneObject { 99 class VariableInfo : public ZoneObject {
86 public: 100 public:
87 enum Mutability { 101 enum Mutability {
88 kInvalidMutability, 102 kInvalidMutability,
89 kLocal, 103 kLocal,
90 kMutableGlobal, 104 kMutableGlobal,
91 kImmutableGlobal, 105 kImmutableGlobal,
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 bool AddGlobal(Variable* global, VariableInfo* info); 199 bool AddGlobal(Variable* global, VariableInfo* info);
186 bool AddLocal(Variable* global, VariableInfo* info); 200 bool AddLocal(Variable* global, VariableInfo* info);
187 // Used for 5.5 GlobalVariableTypeAnnotations 201 // Used for 5.5 GlobalVariableTypeAnnotations
188 VariableInfo* ImportLookup(Property* expr); 202 VariableInfo* ImportLookup(Property* expr);
189 // 3.3 Environment Lookup 203 // 3.3 Environment Lookup
190 // NOTE: In the spec, the lookup function's prototype is 204 // NOTE: In the spec, the lookup function's prototype is
191 // 205 //
192 // Lookup(Delta, Gamma, x) 206 // Lookup(Delta, Gamma, x)
193 // 207 //
194 // Delta is the global_scope_ member, and Gamma, local_scope_. 208 // Delta is the global_scope_ member, and Gamma, local_scope_.
195 VariableInfo* Lookup(Variable* variable); 209 VariableInfo* Lookup(Variable* variable) const;
196 210
197 // All of the ValidateXXX methods below return AsmType::None() in case of 211 // All of the ValidateXXX methods below return AsmType::None() in case of
198 // validation failure. 212 // validation failure.
199 213
200 // 6.1 ValidateModule 214 // 6.1 ValidateModule
201 AsmType* ValidateModule(FunctionLiteral* fun); 215 AsmType* ValidateModule(FunctionLiteral* fun);
202 AsmType* ValidateGlobalDeclaration(Assignment* assign); 216 AsmType* ValidateGlobalDeclaration(Assignment* assign);
203 // 6.2 ValidateExport 217 // 6.2 ValidateExport
204 AsmType* ExportType(VariableProxy* fun_export); 218 AsmType* ExportType(VariableProxy* fun_export);
205 AsmType* ValidateExport(ReturnStatement* exports); 219 AsmType* ValidateExport(ReturnStatement* exports);
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 313
300 Isolate* isolate_; 314 Isolate* isolate_;
301 Zone* zone_; 315 Zone* zone_;
302 Script* script_; 316 Script* script_;
303 FunctionLiteral* root_; 317 FunctionLiteral* root_;
304 bool in_function_ = false; 318 bool in_function_ = false;
305 319
306 AsmType* return_type_ = nullptr; 320 AsmType* return_type_ = nullptr;
307 321
308 ZoneVector<VariableInfo*> forward_definitions_; 322 ZoneVector<VariableInfo*> forward_definitions_;
323 ZoneVector<FFIUseSignature> ffi_use_signatures_;
309 ObjectTypeMap stdlib_types_; 324 ObjectTypeMap stdlib_types_;
310 ObjectTypeMap stdlib_math_types_; 325 ObjectTypeMap stdlib_math_types_;
311 326
312 // The ASM module name. This member is used to prevent globals from redefining 327 // The ASM module name. This member is used to prevent globals from redefining
313 // the module name. 328 // the module name.
314 VariableInfo* module_info_; 329 VariableInfo* module_info_;
315 Handle<String> module_name_; 330 Handle<String> module_name_;
316 331
317 // 3 Environments 332 // 3 Environments
318 ZoneHashMap global_scope_; // 3.1 Global environment 333 ZoneHashMap global_scope_; // 3.1 Global environment
319 ZoneHashMap local_scope_; // 3.2 Variable environment 334 ZoneHashMap local_scope_; // 3.2 Variable environment
320 335
321 std::uintptr_t stack_limit_; 336 std::uintptr_t stack_limit_;
322 bool stack_overflow_ = false; 337 bool stack_overflow_ = false;
323 ZoneMap<AstNode*, AsmType*> node_types_; 338 ZoneMap<AstNode*, AsmType*> node_types_;
324 static const int kErrorMessageLimit = 100; 339 static const int kErrorMessageLimit = 100;
325 AsmType* fround_type_; 340 AsmType* fround_type_;
326 AsmType* ffi_type_; 341 AsmType* ffi_type_;
327 char error_message_[kErrorMessageLimit]; 342 char error_message_[kErrorMessageLimit];
328 StdlibSet stdlib_uses_; 343 StdlibSet stdlib_uses_;
329 344
330 DISALLOW_IMPLICIT_CONSTRUCTORS(AsmTyper); 345 DISALLOW_IMPLICIT_CONSTRUCTORS(AsmTyper);
331 }; 346 };
332 347
333 } // namespace wasm 348 } // namespace wasm
334 } // namespace internal 349 } // namespace internal
335 } // namespace v8 350 } // namespace v8
336 351
337 #endif // SRC_ASMJS_ASM_TYPER_H_ 352 #endif // SRC_ASMJS_ASM_TYPER_H_
OLDNEW
« no previous file with comments | « no previous file | src/asmjs/asm-typer.cc » ('j') | src/asmjs/asm-typer.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698