v8/test/unittests/code-stub-assembler-unittest.cc
Tobias Tebbi 205860b147 [csa] re-schedule CSA graph
This CL is an experiment to get more performance data from the perf-bots
and will likely lead to regressions. The try-bots (see patcheset 9)
indicate some regressions, but it doesn't seem too bad.

Change-Id: Ia173ab20ee2a4904663db0f4ca2ffb196b203c77
Reviewed-on: https://chromium-review.googlesource.com/c/1319763
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Reviewed-by: Jaroslav Sevcik <jarin@chromium.org>
Reviewed-by: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57483}
2018-11-13 17:12:01 +00:00

65 lines
2.0 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.
#include "test/unittests/code-stub-assembler-unittest.h"
#include "src/code-factory.h"
#include "src/compiler/node.h"
#include "src/interface-descriptors.h"
#include "src/isolate.h"
#include "src/objects-inl.h"
#include "test/unittests/compiler/compiler-test-utils.h"
#include "test/unittests/compiler/node-test-utils.h"
using ::testing::_;
using v8::internal::compiler::Node;
namespace c = v8::internal::compiler;
namespace v8 {
namespace internal {
CodeStubAssemblerTestState::CodeStubAssemblerTestState(
CodeStubAssemblerTest* test)
: compiler::CodeAssemblerState(
test->isolate(), test->zone(), VoidDescriptor{}, Code::STUB, "test",
PoisoningMitigationLevel::kPoisonCriticalOnly) {}
TARGET_TEST_F(CodeStubAssemblerTest, SmiTag) {
CodeStubAssemblerTestState state(this);
CodeStubAssemblerForTest m(&state);
Node* value = m.Int32Constant(44);
EXPECT_THAT(m.SmiTag(value),
IsBitcastWordToTaggedSigned(c::IsIntPtrConstant(
static_cast<intptr_t>(44) << (kSmiShiftSize + kSmiTagSize))));
EXPECT_THAT(m.SmiUntag(value),
c::IsIntPtrConstant(static_cast<intptr_t>(44) >>
(kSmiShiftSize + kSmiTagSize)));
}
TARGET_TEST_F(CodeStubAssemblerTest, IntPtrMax) {
CodeStubAssemblerTestState state(this);
CodeStubAssemblerForTest m(&state);
{
Node* a = m.IntPtrConstant(100);
Node* b = m.IntPtrConstant(1);
Node* z = m.IntPtrMax(a, b);
EXPECT_THAT(z, c::IsIntPtrConstant(100));
}
}
TARGET_TEST_F(CodeStubAssemblerTest, IntPtrMin) {
CodeStubAssemblerTestState state(this);
CodeStubAssemblerForTest m(&state);
{
Node* a = m.IntPtrConstant(100);
Node* b = m.IntPtrConstant(1);
Node* z = m.IntPtrMin(a, b);
EXPECT_THAT(z, c::IsIntPtrConstant(1));
}
}
} // namespace internal
} // namespace v8