v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
wasm-features.cc
Go to the documentation of this file.
1// Copyright 2018 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
6
8#include "src/flags/flags.h"
10#include "src/objects/string.h"
11
12namespace v8 {
13namespace internal {
14namespace wasm {
15
16// static
19
20#if V8_ENABLE_DRUMBRAKE
21 // DrumBrake supports only a subset or older versions of some Wasm features.
22 if (v8_flags.wasm_jitless) {
23 features.Add(WasmEnabledFeature::legacy_eh);
24 }
25#endif // V8_ENABLE_DRUMBRAKE
26
27#define CHECK_FEATURE_FLAG(feat, ...) \
28 if (!v8_flags.wasm_jitless && v8_flags.experimental_wasm_##feat) \
29 features.Add(WasmEnabledFeature::feat);
31#undef CHECK_FEATURE_FLAG
32 return features;
33}
34
35// static
37 return FromContext(isolate, isolate->native_context());
38}
39
40// static
42 Isolate* isolate, DirectHandle<NativeContext> context) {
44 if (!v8_flags.wasm_jitless) {
45 if (isolate->IsWasmStringRefEnabled(context)) {
46 features.Add(WasmEnabledFeature::stringref);
47 }
48 if (isolate->IsWasmImportedStringsEnabled(context)) {
49 features.Add(WasmEnabledFeature::imported_strings);
50 }
51 if (isolate->IsWasmJSPIEnabled(context)) {
52 features.Add(WasmEnabledFeature::jspi);
53 }
54 }
55 // This space intentionally left blank for future Wasm origin trials.
56 return features;
57}
58
59} // namespace wasm
60} // namespace internal
61} // namespace v8
constexpr void Add(E element)
Definition enum-set.h:50
static V8_EXPORT_PRIVATE WasmEnabledFeatures FromContext(Isolate *, DirectHandle< NativeContext >)
static V8_EXPORT_PRIVATE WasmEnabledFeatures FromIsolate(Isolate *)
static V8_EXPORT_PRIVATE WasmEnabledFeatures FromFlags()
static constexpr WasmEnabledFeatures None()
V8_EXPORT_PRIVATE FlagValues v8_flags
Definition c-api.cc:87
#define FOREACH_WASM_FEATURE_FLAG(V)
#define CHECK_FEATURE_FLAG(feat,...)