v8/test/unittests/compiler/js-intrinsic-lowering-unittest.cc
Toon Verwaest 863a2d6c24 [interpreter] Remove unused interpreter intrinsics
This also removes intrinsics that were just used in tests. It keeps
InlineIncBlockCounter for now because it's a less straightforward.

Change-Id: I77e55d7a746294892d0fd7ab577ebf8eb42f1f08
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2953195
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/master@{#75217}
2021-06-17 13:43:41 +00:00

70 lines
2.2 KiB
C++

// Copyright 2015 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/access-builder.h"
#include "src/compiler/diamond.h"
#include "src/compiler/js-graph.h"
#include "src/compiler/js-intrinsic-lowering.h"
#include "src/compiler/js-operator.h"
#include "test/unittests/compiler/graph-unittest.h"
#include "test/unittests/compiler/node-test-utils.h"
#include "testing/gmock-support.h"
using testing::_;
using testing::AllOf;
using testing::BitEq;
using testing::Capture;
using testing::CaptureEq;
namespace v8 {
namespace internal {
namespace compiler {
class JSIntrinsicLoweringTest : public GraphTest {
public:
JSIntrinsicLoweringTest() : GraphTest(3), javascript_(zone()) {}
~JSIntrinsicLoweringTest() override = default;
protected:
Reduction Reduce(Node* node) {
MachineOperatorBuilder machine(zone(),
MachineType::PointerRepresentation());
SimplifiedOperatorBuilder simplified(zone());
JSGraph jsgraph(isolate(), graph(), common(), javascript(), &simplified,
&machine);
GraphReducer graph_reducer(zone(), graph(), tick_counter(), broker());
JSIntrinsicLowering reducer(&graph_reducer, &jsgraph, broker());
return reducer.Reduce(node);
}
JSOperatorBuilder* javascript() { return &javascript_; }
private:
JSOperatorBuilder javascript_;
};
// -----------------------------------------------------------------------------
// %_CreateJSGeneratorObject
TEST_F(JSIntrinsicLoweringTest, InlineCreateJSGeneratorObject) {
Node* const function = Parameter(0);
Node* const receiver = Parameter(1);
Node* const context = Parameter(2);
Node* const effect = graph()->start();
Node* const control = graph()->start();
Reduction const r = Reduce(graph()->NewNode(
javascript()->CallRuntime(Runtime::kInlineCreateJSGeneratorObject, 2),
function, receiver, context, effect, control));
ASSERT_TRUE(r.Changed());
EXPECT_EQ(IrOpcode::kJSCreateGeneratorObject,
r.replacement()->op()->opcode());
}
} // namespace compiler
} // namespace internal
} // namespace v8