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