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 "src/api.h" | 8 #include "src/api.h" |
9 #include "src/handles.h" | 9 #include "src/handles.h" |
10 #include "src/wasm/wasm-opcodes.h" | 10 #include "src/wasm/wasm-opcodes.h" |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 // Returns a null handle if the function is unnamed or the name is not a valid | 345 // Returns a null handle if the function is unnamed or the name is not a valid |
346 // UTF-8 string. | 346 // UTF-8 string. |
347 Handle<Object> GetWasmFunctionNameOrNull(Isolate* isolate, Handle<Object> wasm, | 347 Handle<Object> GetWasmFunctionNameOrNull(Isolate* isolate, Handle<Object> wasm, |
348 uint32_t func_index); | 348 uint32_t func_index); |
349 | 349 |
350 // Return the binary source bytes of a wasm module. | 350 // Return the binary source bytes of a wasm module. |
351 SeqOneByteString* GetWasmBytes(JSObject* wasm); | 351 SeqOneByteString* GetWasmBytes(JSObject* wasm); |
352 | 352 |
353 // Get the debug info associated with the given wasm object. | 353 // Get the debug info associated with the given wasm object. |
354 // If no debug info exists yet, it is created automatically. | 354 // If no debug info exists yet, it is created automatically. |
355 WasmDebugInfo* GetDebugInfo(JSObject* wasm); | 355 WasmDebugInfo* GetDebugInfo(Handle<JSObject> wasm); |
356 | 356 |
357 // Return the number of functions in the given wasm object. | 357 // Return the number of functions in the given wasm object. |
358 int GetNumberOfFunctions(JSObject* wasm); | 358 int GetNumberOfFunctions(JSObject* wasm); |
359 | 359 |
360 // Check whether the given object is a wasm object. | 360 // Check whether the given object is a wasm object. |
361 // This checks the number and type of internal fields, so it's not 100 percent | 361 // This checks the number and type of internal fields, so it's not 100 percent |
362 // secure. If it turns out that we need more complete checks, we could add a | 362 // secure. If it turns out that we need more complete checks, we could add a |
363 // special marker as internal field, which will definitely never occur anywhere | 363 // special marker as internal field, which will definitely never occur anywhere |
364 // else. | 364 // else. |
365 bool IsWasmObject(Object* object); | 365 bool IsWasmObject(Object* object); |
366 | 366 |
| 367 // Get the array buffer used as memory for the given wasm object. |
| 368 JSArrayBuffer* GetWasmMemoryBuffer(JSObject* wasm); |
| 369 |
| 370 // Get the code object for a specific wasm function. |
| 371 Code* GetWasmFunctionCode(JSObject* wasm, uint32_t func_index); |
| 372 |
367 namespace testing { | 373 namespace testing { |
368 | 374 |
369 // Decode, verify, and run the function labeled "main" in the | 375 // Decode, verify, and run the function labeled "main" in the |
370 // given encoded module. The module should have no imports. | 376 // given encoded module. The module should have no imports. |
371 int32_t CompileAndRunWasmModule(Isolate* isolate, const byte* module_start, | 377 int32_t CompileAndRunWasmModule(Isolate* isolate, const byte* module_start, |
372 const byte* module_end, bool asm_js = false); | 378 const byte* module_end, bool asm_js = false); |
373 | 379 |
374 } // namespace testing | 380 } // namespace testing |
375 | 381 |
376 } // namespace wasm | 382 } // namespace wasm |
377 } // namespace internal | 383 } // namespace internal |
378 } // namespace v8 | 384 } // namespace v8 |
379 | 385 |
380 #endif // V8_WASM_MODULE_H_ | 386 #endif // V8_WASM_MODULE_H_ |
OLD | NEW |