OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 V8_WASM_MODULE_H_ | 5 #ifndef V8_WASM_MODULE_H_ |
6 #define V8_WASM_MODULE_H_ | 6 #define V8_WASM_MODULE_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "src/api.h" | 10 #include "src/api.h" |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 const WasmModule* module); | 394 const WasmModule* module); |
395 | 395 |
396 // Populates a function table by replacing function indices with handles to | 396 // Populates a function table by replacing function indices with handles to |
397 // the compiled code. | 397 // the compiled code. |
398 void PopulateFunctionTable(Handle<FixedArray> table, uint32_t table_size, | 398 void PopulateFunctionTable(Handle<FixedArray> table, uint32_t table_size, |
399 const std::vector<Handle<Code>>* code_table); | 399 const std::vector<Handle<Code>>* code_table); |
400 | 400 |
401 Handle<JSObject> CreateCompiledModuleObject(Isolate* isolate, | 401 Handle<JSObject> CreateCompiledModuleObject(Isolate* isolate, |
402 Handle<FixedArray> compiled_module); | 402 Handle<FixedArray> compiled_module); |
403 | 403 |
| 404 // Assumed to be called with a code object associated to a wasm module instance. |
| 405 // Intended to be called from runtime functions. |
| 406 // Returns undefined if the runtime support was not setup, nullptr if the |
| 407 // instance |
| 408 // was collected, or the instance object owning the Code object |
| 409 Object* GetOwningWasmInstance(Object* undefined, Code* code); |
| 410 |
404 namespace testing { | 411 namespace testing { |
405 | 412 |
406 // Decode, verify, and run the function labeled "main" in the | 413 // Decode, verify, and run the function labeled "main" in the |
407 // given encoded module. The module should have no imports. | 414 // given encoded module. The module should have no imports. |
408 int32_t CompileAndRunWasmModule(Isolate* isolate, const byte* module_start, | 415 int32_t CompileAndRunWasmModule(Isolate* isolate, const byte* module_start, |
409 const byte* module_end, bool asm_js = false); | 416 const byte* module_end, bool asm_js = false); |
410 | 417 |
411 int32_t CallFunction(Isolate* isolate, Handle<JSObject> instance, | 418 int32_t CallFunction(Isolate* isolate, Handle<JSObject> instance, |
412 ErrorThrower* thrower, const char* name, int argc, | 419 ErrorThrower* thrower, const char* name, int argc, |
413 Handle<Object> argv[]); | 420 Handle<Object> argv[]); |
414 } // namespace testing | 421 } // namespace testing |
415 } // namespace wasm | 422 } // namespace wasm |
416 } // namespace internal | 423 } // namespace internal |
417 } // namespace v8 | 424 } // namespace v8 |
418 | 425 |
419 #endif // V8_WASM_MODULE_H_ | 426 #endif // V8_WASM_MODULE_H_ |
OLD | NEW |