node/deps/v8/test/unittests/compiler/turboshaft/simplified-lowering-reducer-unittest.cc
Michaël Zasso 09a8440b45
deps: update V8 to 12.2.281.27
PR-URL: https://github.com/nodejs/node/pull/51362
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
2024-03-31 15:36:07 +02:00

39 lines
1.4 KiB
C++

// Copyright 2024 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/compiler/turboshaft/simplified-lowering-reducer.h"
#include "src/compiler/turboshaft/assembler.h"
#include "src/compiler/turboshaft/copying-phase.h"
#include "src/compiler/turboshaft/operations.h"
#include "src/compiler/turboshaft/opmasks.h"
#include "src/compiler/turboshaft/phase.h"
#include "test/unittests/compiler/turboshaft/reducer-test.h"
namespace v8::internal::compiler::turboshaft {
#include "src/compiler/turboshaft/define-assembler-macros.inc"
class SimplifiedLoweringReducerTest : public ReducerTest {};
TEST_F(SimplifiedLoweringReducerTest, SafeIntegerAdd) {
auto test = CreateFromGraph(1, [](auto& Asm) {
OpIndex frame_state = Asm.BuildFrameState();
V<Object> result = __ SpeculativeNumberBinop(
Asm.GetParameter(0), __ NumberConstant(2), frame_state,
SpeculativeNumberBinopOp::Kind::kSafeIntegerAdd);
Asm.Capture(result, "SpeculativeNumberBinop");
__ Return(result);
});
test.Run<SimplifiedLoweringReducer>();
const auto& output = test.GetCapture("SpeculativeNumberBinop");
ASSERT_TRUE(output.template Contains<Opmask::kOverflowCheckedWord32Add>());
}
#include "src/compiler/turboshaft/undef-assembler-macros.inc"
} // namespace v8::internal::compiler::turboshaft