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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 static_cast<int>(index), module_object); | 216 static_cast<int>(index), module_object); |
217 return ret; | 217 return ret; |
218 } | 218 } |
219 | 219 |
220 void SetFunctionCode(uint32_t index, Handle<Code> code) { | 220 void SetFunctionCode(uint32_t index, Handle<Code> code) { |
221 instance->function_code[index] = code; | 221 instance->function_code[index] = code; |
222 } | 222 } |
223 | 223 |
224 void AddIndirectFunctionTable(uint16_t* function_indexes, | 224 void AddIndirectFunctionTable(uint16_t* function_indexes, |
225 uint32_t table_size) { | 225 uint32_t table_size) { |
226 module_.function_tables.push_back({table_size, table_size, true, | 226 module_.function_tables.push_back({table_size, table_size, |
227 std::vector<int32_t>(), false, false, | 227 std::vector<int32_t>(), false, false, |
228 SignatureMap()}); | 228 SignatureMap()}); |
229 WasmIndirectFunctionTable& table = module_.function_tables.back(); | 229 WasmIndirectFunctionTable& table = module_.function_tables.back(); |
230 table.min_size = table_size; | |
231 table.max_size = table_size; | |
232 for (uint32_t i = 0; i < table_size; ++i) { | 230 for (uint32_t i = 0; i < table_size; ++i) { |
233 table.values.push_back(function_indexes[i]); | 231 table.values.push_back(function_indexes[i]); |
234 table.map.FindOrInsert(module_.functions[function_indexes[i]].sig); | 232 table.map.FindOrInsert(module_.functions[function_indexes[i]].sig); |
235 } | 233 } |
236 | 234 |
237 instance->function_tables.push_back( | 235 instance->function_tables.push_back( |
238 isolate_->factory()->NewFixedArray(table_size * 2)); | 236 isolate_->factory()->NewFixedArray(table_size * 2)); |
239 } | 237 } |
240 | 238 |
241 void PopulateIndirectFunctionTable() { | 239 void PopulateIndirectFunctionTable() { |
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
788 // interpreter. | 786 // interpreter. |
789 #define WASM_EXEC_TEST(name) \ | 787 #define WASM_EXEC_TEST(name) \ |
790 void RunWasm_##name(WasmExecutionMode execution_mode); \ | 788 void RunWasm_##name(WasmExecutionMode execution_mode); \ |
791 TEST(RunWasmCompiled_##name) { RunWasm_##name(kExecuteCompiled); } \ | 789 TEST(RunWasmCompiled_##name) { RunWasm_##name(kExecuteCompiled); } \ |
792 TEST(RunWasmInterpreted_##name) { RunWasm_##name(kExecuteInterpreted); } \ | 790 TEST(RunWasmInterpreted_##name) { RunWasm_##name(kExecuteInterpreted); } \ |
793 void RunWasm_##name(WasmExecutionMode execution_mode) | 791 void RunWasm_##name(WasmExecutionMode execution_mode) |
794 | 792 |
795 } // namespace | 793 } // namespace |
796 | 794 |
797 #endif | 795 #endif |
OLD | NEW |