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

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

Issue 2566683002: [wasm][asm.js] Check that property keys are literals for imports. (Closed)
Patch Set: merge Created 4 years 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/asm-validation.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 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 math[ii].standard_member); 328 math[ii].standard_member);
329 stdlib_math_types_[math[ii].name]->set_mutability( 329 stdlib_math_types_[math[ii].name]->set_mutability(
330 VariableInfo::kImmutableGlobal); 330 VariableInfo::kImmutableGlobal);
331 } 331 }
332 } 332 }
333 333
334 // Used for 5.5 GlobalVariableTypeAnnotations 334 // Used for 5.5 GlobalVariableTypeAnnotations
335 AsmTyper::VariableInfo* AsmTyper::ImportLookup(Property* import) { 335 AsmTyper::VariableInfo* AsmTyper::ImportLookup(Property* import) {
336 auto* obj = import->obj(); 336 auto* obj = import->obj();
337 auto* key = import->key()->AsLiteral(); 337 auto* key = import->key()->AsLiteral();
338 if (key == nullptr) {
339 return nullptr;
340 }
338 341
339 ObjectTypeMap* stdlib = &stdlib_types_; 342 ObjectTypeMap* stdlib = &stdlib_types_;
340 if (auto* obj_as_property = obj->AsProperty()) { 343 if (auto* obj_as_property = obj->AsProperty()) {
341 // This can only be stdlib.Math 344 // This can only be stdlib.Math
342 auto* math_name = obj_as_property->key()->AsLiteral(); 345 auto* math_name = obj_as_property->key()->AsLiteral();
343 if (math_name == nullptr || !math_name->IsPropertyName()) { 346 if (math_name == nullptr || !math_name->IsPropertyName()) {
344 return nullptr; 347 return nullptr;
345 } 348 }
346 349
347 if (!math_name->AsPropertyName()->IsUtf8EqualTo(CStrVector("Math"))) { 350 if (!math_name->AsPropertyName()->IsUtf8EqualTo(CStrVector("Math"))) {
(...skipping 2559 matching lines...) Expand 10 before | Expand all | Expand 10 after
2907 return true; 2910 return true;
2908 } 2911 }
2909 2912
2910 *error_message = typer.error_message(); 2913 *error_message = typer.error_message();
2911 return false; 2914 return false;
2912 } 2915 }
2913 2916
2914 } // namespace wasm 2917 } // namespace wasm
2915 } // namespace internal 2918 } // namespace internal
2916 } // namespace v8 2919 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/asm/asm-validation.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698