module-instantiate.h 1.39 KB
Newer Older
1 2 3 4
// Copyright 2019 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

5 6 7 8
#if !V8_ENABLE_WEBASSEMBLY
#error This header should only be included if WebAssembly is enabled.
#endif  // !V8_ENABLE_WEBASSEMBLY

9 10 11
#ifndef V8_WASM_MODULE_INSTANTIATE_H_
#define V8_WASM_MODULE_INSTANTIATE_H_

12
#include <stdint.h>
13 14

#include "include/v8-metrics.h"
15 16
#include "include/v8config.h"

17 18 19 20 21 22
namespace v8 {
namespace internal {

class Isolate;
class JSArrayBuffer;
class JSReceiver;
23
class WasmInitExpr;
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
class WasmModuleObject;
class WasmInstanceObject;

template <typename T>
class Handle;
template <typename T>
class MaybeHandle;

namespace wasm {

class ErrorThrower;

MaybeHandle<WasmInstanceObject> InstantiateToInstanceObject(
    Isolate* isolate, ErrorThrower* thrower,
    Handle<WasmModuleObject> module_object, MaybeHandle<JSReceiver> imports,
    MaybeHandle<JSArrayBuffer> memory);

41 42 43 44
bool LoadElemSegment(Isolate* isolate, Handle<WasmInstanceObject> instance,
                     uint32_t table_index, uint32_t segment_index, uint32_t dst,
                     uint32_t src, uint32_t count) V8_WARN_UNUSED_RESULT;

45 46 47
uint32_t EvalUint32InitExpr(Handle<WasmInstanceObject> instance,
                            const WasmInitExpr& expr);

48 49 50 51 52
}  // namespace wasm
}  // namespace internal
}  // namespace v8

#endif  // V8_WASM_MODULE_INSTANTIATE_H_