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