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

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

Issue 2552913004: [wasm][asm.js] Require exported asm.js functions have be names. (Closed)
Patch Set: fix 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/wasm/asm-wasm.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 917 matching lines...) Expand 10 before | Expand all | Expand 10 after
928 } 928 }
929 929
930 if (auto* obj_export = exports->expression()->AsObjectLiteral()) { 930 if (auto* obj_export = exports->expression()->AsObjectLiteral()) {
931 // Exporting object literal. 931 // Exporting object literal.
932 for (auto* prop : *obj_export->properties()) { 932 for (auto* prop : *obj_export->properties()) {
933 if (!prop->key()->IsLiteral()) { 933 if (!prop->key()->IsLiteral()) {
934 FAIL(prop->key(), 934 FAIL(prop->key(),
935 "Only normal object properties may be used in the export object " 935 "Only normal object properties may be used in the export object "
936 "literal."); 936 "literal.");
937 } 937 }
938 if (!prop->key()->AsLiteral()->IsPropertyName()) {
939 FAIL(prop->key(),
940 "Exported functions must have valid identifier names.");
941 }
938 942
939 auto* export_obj = prop->value()->AsVariableProxy(); 943 auto* export_obj = prop->value()->AsVariableProxy();
940 if (export_obj == nullptr) { 944 if (export_obj == nullptr) {
941 FAIL(prop->value(), "Exported value must be an asm.js function name."); 945 FAIL(prop->value(), "Exported value must be an asm.js function name.");
942 } 946 }
943 947
944 RECURSE(ExportType(export_obj)); 948 RECURSE(ExportType(export_obj));
945 } 949 }
946 950
947 return AsmType::Int(); 951 return AsmType::Int();
(...skipping 1927 matching lines...) Expand 10 before | Expand all | Expand 10 after
2875 return true; 2879 return true;
2876 } 2880 }
2877 2881
2878 *error_message = typer.error_message(); 2882 *error_message = typer.error_message();
2879 return false; 2883 return false;
2880 } 2884 }
2881 2885
2882 } // namespace wasm 2886 } // namespace wasm
2883 } // namespace internal 2887 } // namespace internal
2884 } // namespace v8 2888 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/wasm/asm-wasm.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698