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 "src/globals.h"
11
12namespace v8 {
13namespace internal {
14
15class AccountingAllocator;
16class AsmWasmData;
17class FunctionLiteral;
18class JSArrayBuffer;
19class ParseInfo;
20class SharedFunctionInfo;
21class UnoptimizedCompilationJob;
22
23// Interface to compile and instantiate for asm.js modules.
24class AsmJs {
25 public:
26 static UnoptimizedCompilationJob* NewCompilationJob(
27 ParseInfo* parse_info, FunctionLiteral* literal,
28 AccountingAllocator* allocator);
29 static MaybeHandle<Object> InstantiateAsmWasm(Isolate* isolate,
30 Handle<SharedFunctionInfo>,
31 Handle<AsmWasmData> wasm_data,
32 Handle<JSReceiver> stdlib,
33 Handle<JSReceiver> foreign,
34 Handle<JSArrayBuffer> memory);
35
36 // Special export name used to indicate that the module exports a single
37 // function instead of a JavaScript object holding multiple functions.
38 static const char* const kSingleFunctionName;
39};
40
41} // namespace internal
42} // namespace v8
43
44#endif // V8_ASMJS_ASM_JS_H_
45