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

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

Issue 2641513003: [wasm][asm.js] Check if a property key is a PropertyName before assumming it. (Closed)
Patch Set: fix Created 3 years, 11 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 | test/mjsunit/asm/regress-681707.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 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 auto* obj_info = Lookup(obj_as_var_proxy->var()); 378 auto* obj_info = Lookup(obj_as_var_proxy->var());
379 if (obj_info == nullptr) { 379 if (obj_info == nullptr) {
380 return nullptr; 380 return nullptr;
381 } 381 }
382 382
383 if (obj_info->IsFFI()) { 383 if (obj_info->IsFFI()) {
384 // For FFI we can't validate import->key, so assume this is OK. 384 // For FFI we can't validate import->key, so assume this is OK.
385 return obj_info; 385 return obj_info;
386 } 386 }
387 387
388 if (!key->IsPropertyName()) {
389 return nullptr;
390 }
391
388 std::unique_ptr<char[]> aname = key->AsPropertyName()->ToCString(); 392 std::unique_ptr<char[]> aname = key->AsPropertyName()->ToCString();
389 ObjectTypeMap::iterator i = stdlib->find(std::string(aname.get())); 393 ObjectTypeMap::iterator i = stdlib->find(std::string(aname.get()));
390 if (i == stdlib->end()) { 394 if (i == stdlib->end()) {
391 return nullptr; 395 return nullptr;
392 } 396 }
393 stdlib_uses_.insert(i->second->standard_member()); 397 stdlib_uses_.insert(i->second->standard_member());
394 return i->second; 398 return i->second;
395 } 399 }
396 400
397 AsmTyper::VariableInfo* AsmTyper::Lookup(Variable* variable) const { 401 AsmTyper::VariableInfo* AsmTyper::Lookup(Variable* variable) const {
(...skipping 2536 matching lines...) Expand 10 before | Expand all | Expand 10 after
2934 "Heap view creation parameter should be the module's heap parameter."); 2938 "Heap view creation parameter should be the module's heap parameter.");
2935 } 2939 }
2936 2940
2937 DCHECK(heap_view_info->type()->IsA(AsmType::Heap())); 2941 DCHECK(heap_view_info->type()->IsA(AsmType::Heap()));
2938 return heap_view_info->type(); 2942 return heap_view_info->type();
2939 } 2943 }
2940 2944
2941 } // namespace wasm 2945 } // namespace wasm
2942 } // namespace internal 2946 } // namespace internal
2943 } // namespace v8 2947 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/asm/regress-681707.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698