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

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

Issue 2626313003: [wasm] Change the constant kV8MaxWasmMemoryPages to a command line flag. (Closed)
Patch Set: typo 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
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 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 WasmIndirectFunctionTable* table = &module->function_tables.back(); 313 WasmIndirectFunctionTable* table = &module->function_tables.back();
314 consume_resizable_limits("element count", "elements", 314 consume_resizable_limits("element count", "elements",
315 kV8MaxWasmTableSize, &table->min_size, 315 kV8MaxWasmTableSize, &table->min_size,
316 &table->has_max, kV8MaxWasmTableSize, 316 &table->has_max, kV8MaxWasmTableSize,
317 &table->max_size); 317 &table->max_size);
318 break; 318 break;
319 } 319 }
320 case kExternalMemory: { 320 case kExternalMemory: {
321 // ===== Imported memory ========================================= 321 // ===== Imported memory =========================================
322 bool has_max = false; 322 bool has_max = false;
323 consume_resizable_limits("memory", "pages", kV8MaxWasmMemoryPages, 323 consume_resizable_limits(
324 &module->min_mem_pages, &has_max, 324 "memory", "pages",
325 kSpecMaxWasmMemoryPages, 325 static_cast<uint32_t>(FLAG_wasm_max_mem_pages),
326 &module->max_mem_pages); 326 &module->min_mem_pages, &has_max, kSpecMaxWasmMemoryPages,
327 &module->max_mem_pages);
327 SetHasMemory(module); 328 SetHasMemory(module);
328 break; 329 break;
329 } 330 }
330 case kExternalGlobal: { 331 case kExternalGlobal: {
331 // ===== Imported global ========================================= 332 // ===== Imported global =========================================
332 import->index = static_cast<uint32_t>(module->globals.size()); 333 import->index = static_cast<uint32_t>(module->globals.size());
333 module->globals.push_back( 334 module->globals.push_back(
334 {kWasmStmt, false, WasmInitExpr(), 0, true, false}); 335 {kWasmStmt, false, WasmInitExpr(), 0, true, false});
335 WasmGlobal* global = &module->globals.back(); 336 WasmGlobal* global = &module->globals.back();
336 global->type = consume_value_type(); 337 global->type = consume_value_type();
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 section_iter.advance(); 390 section_iter.advance();
390 } 391 }
391 392
392 // ===== Memory section ================================================== 393 // ===== Memory section ==================================================
393 if (section_iter.section_code() == kMemorySectionCode) { 394 if (section_iter.section_code() == kMemorySectionCode) {
394 uint32_t memory_count = consume_count("memory count", kV8MaxWasmMemories); 395 uint32_t memory_count = consume_count("memory count", kV8MaxWasmMemories);
395 396
396 for (uint32_t i = 0; ok() && i < memory_count; i++) { 397 for (uint32_t i = 0; ok() && i < memory_count; i++) {
397 bool has_max = false; 398 bool has_max = false;
398 consume_resizable_limits( 399 consume_resizable_limits(
399 "memory", "pages", kV8MaxWasmMemoryPages, &module->min_mem_pages, 400 "memory", "pages", static_cast<uint32_t>(FLAG_wasm_max_mem_pages),
400 &has_max, kSpecMaxWasmMemoryPages, &module->max_mem_pages); 401 &module->min_mem_pages, &has_max, kSpecMaxWasmMemoryPages,
402 &module->max_mem_pages);
401 } 403 }
402 SetHasMemory(module); 404 SetHasMemory(module);
403 section_iter.advance(); 405 section_iter.advance();
404 } 406 }
405 407
406 // ===== Global section ================================================== 408 // ===== Global section ==================================================
407 if (section_iter.section_code() == kGlobalSectionCode) { 409 if (section_iter.section_code() == kGlobalSectionCode) {
408 uint32_t globals_count = 410 uint32_t globals_count =
409 consume_count("globals count", kV8MaxWasmGlobals); 411 consume_count("globals count", kV8MaxWasmGlobals);
410 uint32_t imported_globals = static_cast<uint32_t>(module->globals.size()); 412 uint32_t imported_globals = static_cast<uint32_t>(module->globals.size());
(...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after
1235 table.push_back(std::move(func_asm_offsets)); 1237 table.push_back(std::move(func_asm_offsets));
1236 } 1238 }
1237 if (decoder.more()) decoder.error("unexpected additional bytes"); 1239 if (decoder.more()) decoder.error("unexpected additional bytes");
1238 1240
1239 return decoder.toResult(std::move(table)); 1241 return decoder.toResult(std::move(table));
1240 } 1242 }
1241 1243
1242 } // namespace wasm 1244 } // namespace wasm
1243 } // namespace internal 1245 } // namespace internal
1244 } // namespace v8 1246 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698