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
3// found in the LICENSE file.
4
5#ifndef V8_ASMJS_ASM_WASM_BUILDER_H_
6#define V8_ASMJS_ASM_WASM_BUILDER_H_
7
8#include "src/allocation.h"
9#include "src/asmjs/asm-typer.h"
10#include "src/objects.h"
11#include "src/wasm/wasm-module-builder.h"
12#include "src/zone/zone.h"
13
14namespace v8 {
15namespace internal {
16
17class FunctionLiteral;
18
19namespace wasm {
20
21class AsmWasmBuilder {
22 public:
23  struct Result {
24    ZoneBuffer* module_bytes;
25    ZoneBuffer* asm_offset_table;
26  };
27
28  explicit AsmWasmBuilder(Isolate* isolate, Zone* zone, FunctionLiteral* root,
29                          AsmTyper* typer);
30  Result Run(Handle<FixedArray>* foreign_args);
31
32  static const char* foreign_init_name;
33  static const char* single_function_name;
34
35 private:
36  Isolate* isolate_;
37  Zone* zone_;
38  FunctionLiteral* literal_;
39  AsmTyper* typer_;
40};
41}  // namespace wasm
42}  // namespace internal
43}  // namespace v8
44
45#endif  // V8_WASM_ASM_WASM_BUILDER_H_
46