1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef V8_ASMJS_ASM_JS_H_
6 #define V8_ASMJS_ASM_JS_H_
7 
8 // Clients of this interface shouldn't depend on lots of asmjs internals.
9 // Do not include anything from src/asmjs here!
10 #include <memory>
11 
12 #include "src/common/globals.h"
13 
14 namespace v8 {
15 namespace internal {
16 
17 class AccountingAllocator;
18 class AsmWasmData;
19 class FunctionLiteral;
20 class JSArrayBuffer;
21 class ParseInfo;
22 class SharedFunctionInfo;
23 class UnoptimizedCompilationJob;
24 
25 // Interface to compile and instantiate for asm.js modules.
26 class AsmJs {
27  public:
28   static std::unique_ptr<UnoptimizedCompilationJob> NewCompilationJob(
29       ParseInfo* parse_info, FunctionLiteral* literal,
30       AccountingAllocator* allocator);
31   static MaybeHandle<Object> InstantiateAsmWasm(Isolate* isolate,
32                                                 Handle<SharedFunctionInfo>,
33                                                 Handle<AsmWasmData> wasm_data,
34                                                 Handle<JSReceiver> stdlib,
35                                                 Handle<JSReceiver> foreign,
36                                                 Handle<JSArrayBuffer> memory);
37 
38   // Special export name used to indicate that the module exports a single
39   // function instead of a JavaScript object holding multiple functions.
40   static const char* const kSingleFunctionName;
41 };
42 
43 }  // namespace internal
44 }  // namespace v8
45 
46 #endif  // V8_ASMJS_ASM_JS_H_
47