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

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

Issue 2267633002: [wasm] asm.js - Check stdlib functions are valid. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix Created 4 years, 4 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') | test/mjsunit/wasm/asm-wasm-stdlib.js » ('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 #include "src/asmjs/asm-typer.h" 5 #include "src/asmjs/asm-typer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 if (obj_info->IsFFI()) { 319 if (obj_info->IsFFI()) {
320 // For FFI we can't validate import->key, so assume this is OK. 320 // For FFI we can't validate import->key, so assume this is OK.
321 return obj_info; 321 return obj_info;
322 } 322 }
323 323
324 std::unique_ptr<char[]> aname = key->AsPropertyName()->ToCString(); 324 std::unique_ptr<char[]> aname = key->AsPropertyName()->ToCString();
325 ObjectTypeMap::iterator i = stdlib->find(std::string(aname.get())); 325 ObjectTypeMap::iterator i = stdlib->find(std::string(aname.get()));
326 if (i == stdlib->end()) { 326 if (i == stdlib->end()) {
327 return nullptr; 327 return nullptr;
328 } 328 }
329 stdlib_uses_.insert(i->second->standard_member());
329 return i->second; 330 return i->second;
330 } 331 }
331 332
332 AsmTyper::VariableInfo* AsmTyper::Lookup(Variable* variable) { 333 AsmTyper::VariableInfo* AsmTyper::Lookup(Variable* variable) {
333 ZoneHashMap* scope = in_function_ ? &local_scope_ : &global_scope_; 334 ZoneHashMap* scope = in_function_ ? &local_scope_ : &global_scope_;
334 ZoneHashMap::Entry* entry = 335 ZoneHashMap::Entry* entry =
335 scope->Lookup(variable, ComputePointerHash(variable)); 336 scope->Lookup(variable, ComputePointerHash(variable));
336 if (entry == nullptr && in_function_) { 337 if (entry == nullptr && in_function_) {
337 entry = global_scope_.Lookup(variable, ComputePointerHash(variable)); 338 entry = global_scope_.Lookup(variable, ComputePointerHash(variable));
338 } 339 }
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 423
423 return AsmType::None(); 424 return AsmType::None();
424 } 425 }
425 426
426 AsmTyper::StandardMember AsmTyper::VariableAsStandardMember(Variable* var) { 427 AsmTyper::StandardMember AsmTyper::VariableAsStandardMember(Variable* var) {
427 auto* var_info = Lookup(var); 428 auto* var_info = Lookup(var);
428 if (var_info == nullptr) { 429 if (var_info == nullptr) {
429 return kNone; 430 return kNone;
430 } 431 }
431 StandardMember member = var_info->standard_member(); 432 StandardMember member = var_info->standard_member();
432 stdlib_uses_.insert(member);
433 return member; 433 return member;
434 } 434 }
435 435
436 bool AsmTyper::Validate() { 436 bool AsmTyper::Validate() {
437 if (!AsmType::None()->IsExactly(ValidateModule(root_))) { 437 if (!AsmType::None()->IsExactly(ValidateModule(root_))) {
438 return true; 438 return true;
439 } 439 }
440 return false; 440 return false;
441 } 441 }
442 442
(...skipping 2303 matching lines...) Expand 10 before | Expand all | Expand 10 after
2746 return true; 2746 return true;
2747 } 2747 }
2748 2748
2749 *error_message = typer.error_message(); 2749 *error_message = typer.error_message();
2750 return false; 2750 return false;
2751 } 2751 }
2752 2752
2753 } // namespace wasm 2753 } // namespace wasm
2754 } // namespace internal 2754 } // namespace internal
2755 } // namespace v8 2755 } // namespace v8
OLDNEW
« no previous file with comments | « src/asmjs/asm-js.cc ('k') | test/mjsunit/wasm/asm-wasm-stdlib.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698