v8/test/common/wasm/flag-utils.h
Maya Lekova 95bb97bc02 [turbofan] Make OSR and stack slots compatible
Bug: chromium:1130844, v8:10973
Change-Id: I912f2cf6cedaf22dd50d456622880ea266b65dcd
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2445509
Commit-Queue: Maya Lekova <mslekova@chromium.org>
Reviewed-by: Georg Neis <neis@chromium.org>
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#70323}
2020-10-05 17:41:02 +00:00

54 lines
1.3 KiB
C++

// Copyright 2017 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.
#ifndef V8_TEST_COMMON_WASM_FLAG_UTILS_H
#define V8_TEST_COMMON_WASM_FLAG_UTILS_H
#include "src/wasm/wasm-features.h"
#include "test/common/flag-utils.h"
namespace v8 {
namespace internal {
#define EXPERIMENTAL_FLAG_SCOPE(flag) FLAG_SCOPE(experimental_wasm_##flag)
namespace wasm {
class WasmFeatureScope {
public:
explicit WasmFeatureScope(WasmFeatures* features, WasmFeature feature,
bool val = true)
: prev_(features->contains(feature)),
feature_(feature),
features_(features) {
set(val);
}
~WasmFeatureScope() { set(prev_); }
private:
void set(bool val) {
if (val) {
features_->Add(feature_);
} else {
features_->Remove(feature_);
}
}
bool const prev_;
WasmFeature const feature_;
WasmFeatures* const features_;
};
#define WASM_FEATURE_SCOPE(feat) \
WasmFeatureScope feat##_scope(&this->enabled_features_, kFeature_##feat)
#define WASM_FEATURE_SCOPE_VAL(feat, val) \
WasmFeatureScope feat##_scope(&this->enabled_features_, kFeature_##feat, val)
} // namespace wasm
} // namespace internal
} // namespace v8
#endif // V8_TEST_COMMON_WASM_FLAG_UTILS_H