| 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, | 226 module_.function_tables.push_back({table_size, table_size, true, |
| 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; |
| 230 for (uint32_t i = 0; i < table_size; ++i) { | 232 for (uint32_t i = 0; i < table_size; ++i) { |
| 231 table.values.push_back(function_indexes[i]); | 233 table.values.push_back(function_indexes[i]); |
| 232 table.map.FindOrInsert(module_.functions[function_indexes[i]].sig); | 234 table.map.FindOrInsert(module_.functions[function_indexes[i]].sig); |
| 233 } | 235 } |
| 234 | 236 |
| 235 instance->function_tables.push_back( | 237 instance->function_tables.push_back( |
| 236 isolate_->factory()->NewFixedArray(table_size * 2)); | 238 isolate_->factory()->NewFixedArray(table_size * 2)); |
| 237 } | 239 } |
| 238 | 240 |
| 239 void PopulateIndirectFunctionTable() { | 241 void PopulateIndirectFunctionTable() { |
| (...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 786 // interpreter. | 788 // interpreter. |
| 787 #define WASM_EXEC_TEST(name) \ | 789 #define WASM_EXEC_TEST(name) \ |
| 788 void RunWasm_##name(WasmExecutionMode execution_mode); \ | 790 void RunWasm_##name(WasmExecutionMode execution_mode); \ |
| 789 TEST(RunWasmCompiled_##name) { RunWasm_##name(kExecuteCompiled); } \ | 791 TEST(RunWasmCompiled_##name) { RunWasm_##name(kExecuteCompiled); } \ |
| 790 TEST(RunWasmInterpreted_##name) { RunWasm_##name(kExecuteInterpreted); } \ | 792 TEST(RunWasmInterpreted_##name) { RunWasm_##name(kExecuteInterpreted); } \ |
| 791 void RunWasm_##name(WasmExecutionMode execution_mode) | 793 void RunWasm_##name(WasmExecutionMode execution_mode) |
| 792 | 794 |
| 793 } // namespace | 795 } // namespace |
| 794 | 796 |
| 795 #endif | 797 #endif |
| OLD | NEW |