| 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 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 // If no debug info exists yet, it is created automatically. | 366 // If no debug info exists yet, it is created automatically. |
| 367 Handle<WasmDebugInfo> GetDebugInfo(Handle<JSObject> wasm); | 367 Handle<WasmDebugInfo> GetDebugInfo(Handle<JSObject> wasm); |
| 368 | 368 |
| 369 // Return the number of functions in the given wasm object. | 369 // Return the number of functions in the given wasm object. |
| 370 int GetNumberOfFunctions(JSObject* wasm); | 370 int GetNumberOfFunctions(JSObject* wasm); |
| 371 | 371 |
| 372 // Create and export JSFunction | 372 // Create and export JSFunction |
| 373 Handle<JSFunction> WrapExportCodeAsJSFunction(Isolate* isolate, | 373 Handle<JSFunction> WrapExportCodeAsJSFunction(Isolate* isolate, |
| 374 Handle<Code> export_code, | 374 Handle<Code> export_code, |
| 375 Handle<String> name, int arity, | 375 Handle<String> name, int arity, |
| 376 Handle<ByteArray> signature, |
| 376 Handle<JSObject> module_instance); | 377 Handle<JSObject> module_instance); |
| 377 | 378 |
| 378 // Check whether the given object is a wasm object. | 379 // Check whether the given object is a wasm object. |
| 379 // This checks the number and type of internal fields, so it's not 100 percent | 380 // This checks the number and type of internal fields, so it's not 100 percent |
| 380 // secure. If it turns out that we need more complete checks, we could add a | 381 // secure. If it turns out that we need more complete checks, we could add a |
| 381 // special marker as internal field, which will definitely never occur anywhere | 382 // special marker as internal field, which will definitely never occur anywhere |
| 382 // else. | 383 // else. |
| 383 bool IsWasmObject(Object* object); | 384 bool IsWasmObject(Object* object); |
| 384 | 385 |
| 385 // Update memory references of code objects associated with the module | 386 // Update memory references of code objects associated with the module |
| 386 bool UpdateWasmModuleMemory(Handle<JSObject> object, Address old_start, | 387 bool UpdateWasmModuleMemory(Handle<JSObject> object, Address old_start, |
| 387 Address new_start, uint32_t old_size, | 388 Address new_start, uint32_t old_size, |
| 388 uint32_t new_size); | 389 uint32_t new_size); |
| 389 | 390 |
| 390 namespace testing { | 391 namespace testing { |
| 391 | 392 |
| 392 // Decode, verify, and run the function labeled "main" in the | 393 // Decode, verify, and run the function labeled "main" in the |
| 393 // given encoded module. The module should have no imports. | 394 // given encoded module. The module should have no imports. |
| 394 int32_t CompileAndRunWasmModule(Isolate* isolate, const byte* module_start, | 395 int32_t CompileAndRunWasmModule(Isolate* isolate, const byte* module_start, |
| 395 const byte* module_end, bool asm_js = false); | 396 const byte* module_end, bool asm_js = false); |
| 396 | 397 |
| 397 } // namespace testing | 398 } // namespace testing |
| 398 } // namespace wasm | 399 } // namespace wasm |
| 399 } // namespace internal | 400 } // namespace internal |
| 400 } // namespace v8 | 401 } // namespace v8 |
| 401 | 402 |
| 402 #endif // V8_WASM_MODULE_H_ | 403 #endif // V8_WASM_MODULE_H_ |
| OLD | NEW |