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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 static_cast<int>(this->module->functions[index].sig->parameter_count()), | 222 static_cast<int>(this->module->functions[index].sig->parameter_count()), |
223 exportedSig, module_object); | 223 exportedSig, module_object); |
224 return ret; | 224 return ret; |
225 } | 225 } |
226 | 226 |
227 void SetFunctionCode(uint32_t index, Handle<Code> code) { | 227 void SetFunctionCode(uint32_t index, Handle<Code> code) { |
228 instance->function_code[index] = code; | 228 instance->function_code[index] = code; |
229 } | 229 } |
230 | 230 |
231 void AddIndirectFunctionTable(uint16_t* functions, uint32_t table_size) { | 231 void AddIndirectFunctionTable(uint16_t* functions, uint32_t table_size) { |
232 module_.function_tables.push_back( | 232 module_.function_tables.push_back({table_size, table_size, |
233 {table_size, table_size, std::vector<int32_t>(), false, false}); | 233 std::vector<int32_t>(), false, false, |
| 234 SignatureMap()}); |
| 235 WasmIndirectFunctionTable& table = module_.function_tables.back(); |
234 for (uint32_t i = 0; i < table_size; ++i) { | 236 for (uint32_t i = 0; i < table_size; ++i) { |
235 module_.function_tables.back().values.push_back(functions[i]); | 237 table.values.push_back(functions[i]); |
| 238 table.map_.Get(module_.functions[functions[i]].sig); |
236 } | 239 } |
237 | 240 |
238 Handle<FixedArray> values = BuildFunctionTable( | 241 Handle<FixedArray> values = BuildFunctionTable( |
239 isolate_, static_cast<int>(module_.function_tables.size() - 1), | 242 isolate_, static_cast<int>(module_.function_tables.size() - 1), |
240 &module_); | 243 &module_); |
241 instance->function_tables.push_back(values); | 244 instance->function_tables.push_back(values); |
242 } | 245 } |
243 | 246 |
244 void PopulateIndirectFunctionTable() { | 247 void PopulateIndirectFunctionTable() { |
245 for (uint32_t i = 0; i < instance->function_tables.size(); i++) { | 248 for (uint32_t i = 0; i < instance->function_tables.size(); i++) { |
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
783 // interpreter. | 786 // interpreter. |
784 #define WASM_EXEC_TEST(name) \ | 787 #define WASM_EXEC_TEST(name) \ |
785 void RunWasm_##name(WasmExecutionMode execution_mode); \ | 788 void RunWasm_##name(WasmExecutionMode execution_mode); \ |
786 TEST(RunWasmCompiled_##name) { RunWasm_##name(kExecuteCompiled); } \ | 789 TEST(RunWasmCompiled_##name) { RunWasm_##name(kExecuteCompiled); } \ |
787 TEST(RunWasmInterpreted_##name) { RunWasm_##name(kExecuteInterpreted); } \ | 790 TEST(RunWasmInterpreted_##name) { RunWasm_##name(kExecuteInterpreted); } \ |
788 void RunWasm_##name(WasmExecutionMode execution_mode) | 791 void RunWasm_##name(WasmExecutionMode execution_mode) |
789 | 792 |
790 } // namespace | 793 } // namespace |
791 | 794 |
792 #endif | 795 #endif |
OLD | NEW |