OLD | NEW |
---|---|
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 Loading... | |
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 Loading... | |
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 } |
OLD | NEW |