OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef WASM_RUN_UTILS_H | 5 #ifndef WASM_RUN_UTILS_H |
6 #define WASM_RUN_UTILS_H | 6 #define WASM_RUN_UTILS_H |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <stdlib.h> | 9 #include <stdlib.h> |
10 #include <string.h> | 10 #include <string.h> |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 static_cast<int>(this->module->functions[index].sig->parameter_count()), | 220 static_cast<int>(this->module->functions[index].sig->parameter_count()), |
221 exportedSig, module_object); | 221 exportedSig, module_object); |
222 return ret; | 222 return ret; |
223 } | 223 } |
224 | 224 |
225 void SetFunctionCode(uint32_t index, Handle<Code> code) { | 225 void SetFunctionCode(uint32_t index, Handle<Code> code) { |
226 instance->function_code[index] = code; | 226 instance->function_code[index] = code; |
227 } | 227 } |
228 | 228 |
229 void AddIndirectFunctionTable(uint16_t* functions, uint32_t table_size) { | 229 void AddIndirectFunctionTable(uint16_t* functions, uint32_t table_size) { |
230 module_.function_tables.push_back( | 230 module_.function_tables.push_back({table_size, table_size, |
231 {table_size, table_size, std::vector<int32_t>(), false, false}); | 231 std::vector<int32_t>(), false, false, |
| 232 SignatureMap()}); |
| 233 WasmIndirectFunctionTable& table = module_.function_tables.back(); |
232 for (uint32_t i = 0; i < table_size; ++i) { | 234 for (uint32_t i = 0; i < table_size; ++i) { |
233 module_.function_tables.back().values.push_back(functions[i]); | 235 table.values.push_back(functions[i]); |
| 236 table.map.FindOrInsert(module_.functions[functions[i]].sig); |
234 } | 237 } |
235 | 238 |
236 Handle<FixedArray> values = BuildFunctionTable( | 239 Handle<FixedArray> values = BuildFunctionTable( |
237 isolate_, static_cast<int>(module_.function_tables.size() - 1), | 240 isolate_, static_cast<int>(module_.function_tables.size() - 1), |
238 &module_); | 241 &module_); |
239 instance->function_tables.push_back(values); | 242 instance->function_tables.push_back(values); |
240 } | 243 } |
241 | 244 |
242 void PopulateIndirectFunctionTable() { | 245 void PopulateIndirectFunctionTable() { |
243 for (uint32_t i = 0; i < instance->function_tables.size(); i++) { | 246 for (uint32_t i = 0; i < instance->function_tables.size(); i++) { |
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
781 // interpreter. | 784 // interpreter. |
782 #define WASM_EXEC_TEST(name) \ | 785 #define WASM_EXEC_TEST(name) \ |
783 void RunWasm_##name(WasmExecutionMode execution_mode); \ | 786 void RunWasm_##name(WasmExecutionMode execution_mode); \ |
784 TEST(RunWasmCompiled_##name) { RunWasm_##name(kExecuteCompiled); } \ | 787 TEST(RunWasmCompiled_##name) { RunWasm_##name(kExecuteCompiled); } \ |
785 TEST(RunWasmInterpreted_##name) { RunWasm_##name(kExecuteInterpreted); } \ | 788 TEST(RunWasmInterpreted_##name) { RunWasm_##name(kExecuteInterpreted); } \ |
786 void RunWasm_##name(WasmExecutionMode execution_mode) | 789 void RunWasm_##name(WasmExecutionMode execution_mode) |
787 | 790 |
788 } // namespace | 791 } // namespace |
789 | 792 |
790 #endif | 793 #endif |
OLD | NEW |