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

Unified Diff: test/cctest/wasm/wasm-run-utils.h

Issue 2174123002: [wasm] Add support for multiple indirect function tables (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix GC issue Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/cctest/wasm/test-run-wasm.cc ('k') | test/mjsunit/wasm/wasm-constants.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 3692dc6e52815ab318131014092f62b71993f683..d791d9355b5c390218fa0dc5eed3bef6d4351f85 100644
--- a/test/cctest/wasm/wasm-run-utils.h
+++ b/test/cctest/wasm/wasm-run-utils.h
@@ -222,25 +222,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());
- for (int i = 0; i < table_size; i++) {
- module_.function_table.push_back(functions[i]);
+ void AddIndirectFunctionTable(uint16_t* functions, uint32_t table_size) {
+ module_.function_tables.push_back(
+ {table_size, table_size, std::vector<uint16_t>()});
+ for (uint32_t i = 0; i < table_size; ++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 (uint32_t i = 0; i < instance->function_tables.size(); i++) {
+ PopulateFunctionTable(instance->function_tables[i],
+ module_.function_tables[i].size,
+ &instance->function_code);
}
}
« no previous file with comments | « test/cctest/wasm/test-run-wasm.cc ('k') | test/mjsunit/wasm/wasm-constants.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698