v8/test/cctest/wasm/test-liftoff-for-fuzzing.cc
Thibaud Michaud c134f0af98 [wasm][liftoff] Add step counter in Liftoff
Add a new testing tier based on Liftoff. In this tier, the Liftoff
compiler takes an address to a counter, and decrements that counter at
every instruction. When the counter reaches 0, execution aborts.

R=clemensb@chromium.org

Bug: v8:11856
Change-Id: I20970e323ff19f7cb6ab6855377c678ca391421e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2944440
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#75022}
2021-06-08 15:02:36 +00:00

29 lines
802 B
C++

// Copyright 2021 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.
// #include "src/api/api-inl.h"
// #include "test/cctest/wasm/wasm-atomics-utils.h"
#include "test/cctest/cctest.h"
#include "test/cctest/wasm/wasm-run-utils.h"
#include "test/common/wasm/test-signatures.h"
#include "test/common/wasm/wasm-macro-gen.h"
namespace v8 {
namespace internal {
namespace wasm {
namespace test_liftoff_for_fuzzing {
TEST(MaxSteps) {
WasmRunner<uint32_t> r(TestExecutionTier::kLiftoffForFuzzing);
BUILD(r, WASM_LOOP(WASM_BR(0)), WASM_I32V(23));
r.SetMaxSteps(10);
r.CheckCallViaJSTraps();
}
} // namespace test_liftoff_for_fuzzing
} // namespace wasm
} // namespace internal
} // namespace v8