Chromium Code Reviews| Index: test/cctest/wasm/wasm-run-utils.h |
| diff --git a/test/cctest/wasm/wasm-run-utils.h b/test/cctest/wasm/wasm-run-utils.h |
| index ff8d78bae63dc18500cadfebfb588b52a90a1a0f..124eaa4d9210509533c5700d8107d7d9039f654c 100644 |
| --- a/test/cctest/wasm/wasm-run-utils.h |
| +++ b/test/cctest/wasm/wasm-run-utils.h |
| @@ -220,25 +220,24 @@ class TestingModule : public ModuleEnv { |
| instance->function_code[index] = code; |
| } |
| - void AddIndirectFunctionTable(int* functions, int table_size) { |
| - Handle<FixedArray> fixed = |
| - isolate_->factory()->NewFixedArray(2 * table_size); |
| - instance->function_table = fixed; |
| - DCHECK_EQ(0u, module->function_table.size()); |
| + void AddIndirectFunctionTable(uint16_t* functions, uint32_t table_size) { |
| + module_.function_tables.push_back( |
| + {table_size, table_size, std::vector<uint16_t>()}); |
| for (int i = 0; i < table_size; i++) { |
|
Mircea Trofin
2016/07/26 03:37:27
++i
ddchen
2016/07/26 05:44:44
Done.
|
| - module_.function_table.push_back(functions[i]); |
| + module_.function_tables.back().values.push_back(functions[i]); |
| } |
| + |
| + Handle<FixedArray> values = BuildFunctionTable( |
| + isolate_, static_cast<int>(module_.function_tables.size() - 1), |
| + &module_); |
| + instance->function_tables.push_back(values); |
| } |
| void PopulateIndirectFunctionTable() { |
| - if (instance->function_table.is_null()) return; |
| - int table_size = static_cast<int>(module->function_table.size()); |
| - for (int i = 0; i < table_size; i++) { |
| - int function_index = module->function_table[i]; |
| - const WasmFunction* function = &module->functions[function_index]; |
| - instance->function_table->set(i, Smi::FromInt(function->sig_index)); |
| - instance->function_table->set(i + table_size, |
| - *instance->function_code[function_index]); |
| + for (int i = 0; i < instance->function_tables.size(); i++) { |
| + PopulateFunctionTable(instance->function_tables[i], |
| + module_.function_tables[i].size, |
| + &instance->function_code); |
| } |
| } |