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

Side by Side Diff: src/wasm/wasm-js.cc

Issue 2109533002: [wasm] Require wasm explicit asm instantiation to be of a function. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 5 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/regress/regress-wasm-crbug-620649.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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/api-natives.h" 5 #include "src/api-natives.h"
6 #include "src/api.h" 6 #include "src/api.h"
7 #include "src/assert-scope.h" 7 #include "src/assert-scope.h"
8 #include "src/ast/ast.h" 8 #include "src/ast/ast.h"
9 #include "src/ast/scopes.h" 9 #include "src/ast/scopes.h"
10 #include "src/execution.h" 10 #include "src/execution.h"
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 134
135 if (!i::Compiler::ParseAndAnalyze(info)) { 135 if (!i::Compiler::ParseAndAnalyze(info)) {
136 return nullptr; 136 return nullptr;
137 } 137 }
138 138
139 if (info->scope()->declarations()->length() == 0) { 139 if (info->scope()->declarations()->length() == 0) {
140 thrower->Error("Asm.js validation failed: no declarations in scope"); 140 thrower->Error("Asm.js validation failed: no declarations in scope");
141 return nullptr; 141 return nullptr;
142 } 142 }
143 143
144 if (!info->scope()->declarations()->at(0)->IsFunctionDeclaration()) {
145 thrower->Error("Asm.js validation failed: non-function declaration");
146 return nullptr;
147 }
148
144 info->set_literal( 149 info->set_literal(
145 info->scope()->declarations()->at(0)->AsFunctionDeclaration()->fun()); 150 info->scope()->declarations()->at(0)->AsFunctionDeclaration()->fun());
146 151
147 v8::internal::AsmTyper typer(info->isolate(), info->zone(), *(info->script()), 152 v8::internal::AsmTyper typer(info->isolate(), info->zone(), *(info->script()),
148 info->literal()); 153 info->literal());
149 if (i::FLAG_enable_simd_asmjs) { 154 if (i::FLAG_enable_simd_asmjs) {
150 typer.set_allow_simd(true); 155 typer.set_allow_simd(true);
151 } 156 }
152 if (!typer.Validate()) { 157 if (!typer.Validate()) {
153 thrower->Error("Asm.js validation failed: %s", typer.error_message()); 158 thrower->Error("Asm.js validation failed: %s", typer.error_message());
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 int unused_property_fields = in_object_properties - pre_allocated; 492 int unused_property_fields = in_object_properties - pre_allocated;
488 Handle<Map> map = Map::CopyInitialMap( 493 Handle<Map> map = Map::CopyInitialMap(
489 prev_map, instance_size, in_object_properties, unused_property_fields); 494 prev_map, instance_size, in_object_properties, unused_property_fields);
490 495
491 context->set_wasm_function_map(*map); 496 context->set_wasm_function_map(*map);
492 } 497 }
493 } 498 }
494 499
495 } // namespace internal 500 } // namespace internal
496 } // namespace v8 501 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-wasm-crbug-620649.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698