Line data Source code
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 :
5 : #include "src/wasm/wasm-features.h"
6 : #include "src/flags.h"
7 : #include "src/handles-inl.h"
8 : #include "src/isolate.h"
9 :
10 : namespace v8 {
11 : namespace internal {
12 : namespace wasm {
13 :
14 : #define COMMA ,
15 : #define SPACE
16 : #define DO_UNION(feat, desc, val) dst->feat |= src.feat;
17 : #define FLAG_REF(feat, desc, val) FLAG_experimental_wasm_##feat
18 :
19 469500 : void UnionFeaturesInto(WasmFeatures* dst, const WasmFeatures& src) {
20 469500 : FOREACH_WASM_FEATURE(DO_UNION, SPACE);
21 469500 : }
22 :
23 1630350 : WasmFeatures WasmFeaturesFromFlags() {
24 3260700 : return WasmFeatures{FOREACH_WASM_FEATURE(FLAG_REF, COMMA)};
25 : }
26 :
27 1540208 : WasmFeatures WasmFeaturesFromIsolate(Isolate* isolate) {
28 1540208 : WasmFeatures features = WasmFeaturesFromFlags();
29 : features.threads |=
30 1540210 : isolate->AreWasmThreadsEnabled(handle(isolate->context(), isolate));
31 1540208 : return features;
32 : }
33 :
34 : #undef DO_UNION
35 : #undef FLAG_REF
36 : #undef SPACE
37 : #undef COMMA
38 : } // namespace wasm
39 : } // namespace internal
40 122004 : } // namespace v8
|