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

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

Issue 2433313002: [wasm] Only use the table maximum in allocation if it is non-zero. (Closed)
Patch Set: Created 4 years, 2 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 | « src/wasm/module-decoder.cc ('k') | no next file » | 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 <memory> 5 #include <memory>
6 6
7 #include "src/base/atomic-utils.h" 7 #include "src/base/atomic-utils.h"
8 #include "src/code-stubs.h" 8 #include "src/code-stubs.h"
9 9
10 #include "src/macro-assembler.h" 10 #include "src/macro-assembler.h"
(...skipping 1024 matching lines...) Expand 10 before | Expand all | Expand 10 after
1035 //-------------------------------------------------------------------------- 1035 //--------------------------------------------------------------------------
1036 int function_table_count = 1036 int function_table_count =
1037 static_cast<int>(module_->function_tables.size()); 1037 static_cast<int>(module_->function_tables.size());
1038 if (function_table_count > 0) { 1038 if (function_table_count > 0) {
1039 Handle<FixedArray> old_function_tables = 1039 Handle<FixedArray> old_function_tables =
1040 compiled_module_->function_tables(); 1040 compiled_module_->function_tables();
1041 Handle<FixedArray> new_function_tables = 1041 Handle<FixedArray> new_function_tables =
1042 factory->NewFixedArray(function_table_count); 1042 factory->NewFixedArray(function_table_count);
1043 for (int index = 0; index < function_table_count; ++index) { 1043 for (int index = 0; index < function_table_count; ++index) {
1044 WasmIndirectFunctionTable& table = module_->function_tables[index]; 1044 WasmIndirectFunctionTable& table = module_->function_tables[index];
1045 uint32_t size = table.max_size; 1045 uint32_t size = table.max_size > 0 ? table.max_size : table.size;
ahaas 2016/10/20 09:09:42 Could we just set the default value of table.max_s
1046 Handle<FixedArray> new_table = factory->NewFixedArray(size * 2); 1046 Handle<FixedArray> new_table = factory->NewFixedArray(size * 2);
1047 for (int i = 0; i < new_table->length(); ++i) { 1047 for (int i = 0; i < new_table->length(); ++i) {
1048 static const int kInvalidSigIndex = -1; 1048 static const int kInvalidSigIndex = -1;
1049 // Fill the table with invalid signature indexes so that uninitialized 1049 // Fill the table with invalid signature indexes so that uninitialized
1050 // entries will always fail the signature check. 1050 // entries will always fail the signature check.
1051 new_table->set(i, Smi::FromInt(kInvalidSigIndex)); 1051 new_table->set(i, Smi::FromInt(kInvalidSigIndex));
1052 } 1052 }
1053 for (auto table_init : module_->table_inits) { 1053 for (auto table_init : module_->table_inits) {
1054 uint32_t base = EvalUint32InitExpr(globals, table_init.offset); 1054 uint32_t base = EvalUint32InitExpr(globals, table_init.offset);
1055 uint32_t table_size = static_cast<uint32_t>(new_table->length()); 1055 uint32_t table_size = static_cast<uint32_t>(new_table->length());
(...skipping 925 matching lines...) Expand 10 before | Expand all | Expand 10 after
1981 CHECK_NOT_NULL(result.val); 1981 CHECK_NOT_NULL(result.val);
1982 module = const_cast<WasmModule*>(result.val); 1982 module = const_cast<WasmModule*>(result.val);
1983 } 1983 }
1984 1984
1985 Handle<WasmModuleWrapper> module_wrapper = 1985 Handle<WasmModuleWrapper> module_wrapper =
1986 WasmModuleWrapper::New(isolate, module); 1986 WasmModuleWrapper::New(isolate, module);
1987 1987
1988 compiled_module->set_module_wrapper(module_wrapper); 1988 compiled_module->set_module_wrapper(module_wrapper);
1989 DCHECK(WasmCompiledModule::IsWasmCompiledModule(*compiled_module)); 1989 DCHECK(WasmCompiledModule::IsWasmCompiledModule(*compiled_module));
1990 } 1990 }
OLDNEW
« no previous file with comments | « src/wasm/module-decoder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698