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

Side by Side Diff: src/wasm/module-decoder.cc

Issue 2484803002: [wasm] Mutable globals cannot be imported (Closed)
Patch Set: Created 4 years, 1 month 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/unittests/wasm/module-decoder-unittest.cc » ('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/wasm/module-decoder.h" 5 #include "src/wasm/module-decoder.h"
6 6
7 #include "src/base/functional.h" 7 #include "src/base/functional.h"
8 #include "src/base/platform/platform.h" 8 #include "src/base/platform/platform.h"
9 #include "src/flags.h" 9 #include "src/flags.h"
10 #include "src/macro-assembler.h" 10 #include "src/macro-assembler.h"
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 break; 330 break;
331 } 331 }
332 case kExternalGlobal: { 332 case kExternalGlobal: {
333 // ===== Imported global ========================================= 333 // ===== Imported global =========================================
334 import->index = static_cast<uint32_t>(module->globals.size()); 334 import->index = static_cast<uint32_t>(module->globals.size());
335 module->globals.push_back( 335 module->globals.push_back(
336 {kAstStmt, false, WasmInitExpr(), 0, true, false}); 336 {kAstStmt, false, WasmInitExpr(), 0, true, false});
337 WasmGlobal* global = &module->globals.back(); 337 WasmGlobal* global = &module->globals.back();
338 global->type = consume_value_type(); 338 global->type = consume_value_type();
339 global->mutability = consume_u8("mutability") != 0; 339 global->mutability = consume_u8("mutability") != 0;
340 if (global->mutability) {
341 error("mutable globals cannot be imported");
342 }
340 break; 343 break;
341 } 344 }
342 default: 345 default:
343 error(pos, pos, "unknown import kind 0x%02x", import->kind); 346 error(pos, pos, "unknown import kind 0x%02x", import->kind);
344 break; 347 break;
345 } 348 }
346 } 349 }
347 section_iter.advance(); 350 section_iter.advance();
348 } 351 }
349 352
(...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after
1200 table.push_back(std::move(func_asm_offsets)); 1203 table.push_back(std::move(func_asm_offsets));
1201 } 1204 }
1202 if (decoder.more()) decoder.error("unexpected additional bytes"); 1205 if (decoder.more()) decoder.error("unexpected additional bytes");
1203 1206
1204 return decoder.toResult(std::move(table)); 1207 return decoder.toResult(std::move(table));
1205 } 1208 }
1206 1209
1207 } // namespace wasm 1210 } // namespace wasm
1208 } // namespace internal 1211 } // namespace internal
1209 } // namespace v8 1212 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/unittests/wasm/module-decoder-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698