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" | |
9 #include "src/handles.h" | |
10 #include "src/wasm/wasm-opcodes.h" | 8 #include "src/wasm/wasm-opcodes.h" |
11 #include "src/wasm/wasm-result.h" | 9 #include "src/wasm/wasm-result.h" |
12 | 10 |
| 11 #include "src/api.h" |
| 12 #include "src/handles.h" |
| 13 |
13 namespace v8 { | 14 namespace v8 { |
14 namespace internal { | 15 namespace internal { |
15 | 16 |
16 namespace compiler { | 17 namespace compiler { |
17 class CallDescriptor; | 18 class CallDescriptor; |
18 class WasmCompilationUnit; | 19 class WasmCompilationUnit; |
19 } | 20 } |
20 | 21 |
21 namespace wasm { | 22 namespace wasm { |
22 const size_t kMaxModuleSize = 1024 * 1024 * 1024; | 23 const size_t kMaxModuleSize = 1024 * 1024 * 1024; |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 // For testing. Decode, verify, and run the last exported function in the | 312 // For testing. Decode, verify, and run the last exported function in the |
312 // given encoded module. | 313 // given encoded module. |
313 int32_t CompileAndRunWasmModule(Isolate* isolate, const byte* module_start, | 314 int32_t CompileAndRunWasmModule(Isolate* isolate, const byte* module_start, |
314 const byte* module_end, bool asm_js = false); | 315 const byte* module_end, bool asm_js = false); |
315 | 316 |
316 // For testing. Decode, verify, and run the last exported function in the | 317 // For testing. Decode, verify, and run the last exported function in the |
317 // given decoded module. | 318 // given decoded module. |
318 int32_t CompileAndRunWasmModule(Isolate* isolate, const WasmModule* module); | 319 int32_t CompileAndRunWasmModule(Isolate* isolate, const WasmModule* module); |
319 | 320 |
320 // Extract a function name from the given wasm object. | 321 // Extract a function name from the given wasm object. |
321 // Returns "<WASM UNNAMED>" if the function is unnamed or the name is not a | |
322 // valid UTF-8 string. | |
323 Handle<String> GetWasmFunctionName(Isolate* isolate, Handle<Object> wasm, | |
324 uint32_t func_index); | |
325 | |
326 // Extract a function name from the given wasm object. | |
327 // Returns a null handle if the function is unnamed or the name is not a valid | 322 // Returns a null handle if the function is unnamed or the name is not a valid |
328 // UTF-8 string. | 323 // UTF-8 string. |
329 Handle<Object> GetWasmFunctionNameOrNull(Isolate* isolate, Handle<Object> wasm, | 324 MaybeHandle<String> GetWasmFunctionName(Handle<JSObject> wasm, |
330 uint32_t func_index); | 325 uint32_t func_index); |
331 | 326 |
332 // Check whether the given object is a wasm object. | 327 // Check whether the given object is a wasm object. |
333 // This checks the number and type of internal fields, so it's not 100 percent | 328 // This checks the number and type of internal fields, so it's not 100 percent |
334 // secure. If it turns out that we need more complete checks, we could add a | 329 // secure. If it turns out that we need more complete checks, we could add a |
335 // special marker as internal field, which will definitely never occur anywhere | 330 // special marker as internal field, which will definitely never occur anywhere |
336 // else. | 331 // else. |
337 bool IsWasmObject(Handle<JSObject> object); | 332 bool IsWasmObject(Handle<JSObject> object); |
338 | 333 |
339 } // namespace wasm | 334 } // namespace wasm |
340 } // namespace internal | 335 } // namespace internal |
341 } // namespace v8 | 336 } // namespace v8 |
342 | 337 |
343 #endif // V8_WASM_MODULE_H_ | 338 #endif // V8_WASM_MODULE_H_ |
OLD | NEW |