32d23e7b26
This is a reland of commit abd0adf106
Original change's description:
> [compiler] Make ReduceWord32EqualForConstantRhs work for Word64Equal
>
> Adds reduction case in MachineOperatorReducer for when the left-hand side of a
> Word64Equals is based on a 64-bit shift-and-mask operation, as is the case
> when Torque accesses 64-bit bitfields.
>
> This improves Speedometer2 by 0.15% on a Neoverse-N1 machine, with
> React-Redux being improved by 0.4%.
>
> Change-Id: Icd0451c00c1b25f7d370e81bddcfd668a5b2523c
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3834027
> Commit-Queue: George Wort <george.wort@arm.com>
> Reviewed-by: Nico Hartmann <nicohartmann@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#82593}
Change-Id: I62393c062b2c785a5dfa3500b80fe44ec08f6f21
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3841569
Commit-Queue: George Wort <george.wort@arm.com>
Reviewed-by: Nico Hartmann <nicohartmann@chromium.org>
Cr-Commit-Position: refs/heads/main@{#82684}
100 lines
2.8 KiB
C++
100 lines
2.8 KiB
C++
// Copyright 2014 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_UNITTESTS_COMPILER_GRAPH_UNITTEST_H_
|
|
#define V8_UNITTESTS_COMPILER_GRAPH_UNITTEST_H_
|
|
|
|
#include "src/codegen/tick-counter.h"
|
|
#include "src/compiler/common-operator.h"
|
|
#include "src/compiler/compiler-source-position-table.h"
|
|
#include "src/compiler/graph.h"
|
|
#include "src/compiler/js-heap-broker.h"
|
|
#include "src/compiler/node-origin-table.h"
|
|
#include "src/compiler/typer.h"
|
|
#include "src/handles/handles.h"
|
|
#include "test/unittests/test-utils.h"
|
|
#include "testing/gmock/include/gmock/gmock.h"
|
|
|
|
namespace v8 {
|
|
namespace internal {
|
|
|
|
// Forward declarations.
|
|
class HeapObject;
|
|
|
|
namespace compiler {
|
|
|
|
using ::testing::Matcher;
|
|
|
|
class GraphTest : public TestWithNativeContextAndZone {
|
|
public:
|
|
explicit GraphTest(int num_parameters = 1);
|
|
~GraphTest() override;
|
|
|
|
Node* start() { return graph()->start(); }
|
|
Node* end() { return graph()->end(); }
|
|
|
|
Node* Parameter(int32_t index = 0);
|
|
Node* Parameter(Type type, int32_t index = 0);
|
|
Node* Float32Constant(float value);
|
|
Node* Float64Constant(double value);
|
|
Node* Int32Constant(int32_t value);
|
|
Node* Uint32Constant(uint32_t value) {
|
|
return Int32Constant(base::bit_cast<int32_t>(value));
|
|
}
|
|
Node* Int64Constant(int64_t value);
|
|
Node* Uint64Constant(uint64_t value) {
|
|
return Int64Constant(base::bit_cast<int64_t>(value));
|
|
}
|
|
Node* NumberConstant(double value);
|
|
Node* HeapConstant(const Handle<HeapObject>& value);
|
|
Node* FalseConstant();
|
|
Node* TrueConstant();
|
|
Node* UndefinedConstant();
|
|
|
|
Node* EmptyFrameState();
|
|
|
|
Matcher<Node*> IsBooleanConstant(bool value) {
|
|
return value ? IsTrueConstant() : IsFalseConstant();
|
|
}
|
|
Matcher<Node*> IsFalseConstant();
|
|
Matcher<Node*> IsTrueConstant();
|
|
Matcher<Node*> IsNullConstant();
|
|
Matcher<Node*> IsUndefinedConstant();
|
|
|
|
CommonOperatorBuilder* common() { return &common_; }
|
|
Graph* graph() { return &graph_; }
|
|
SourcePositionTable* source_positions() { return &source_positions_; }
|
|
NodeOriginTable* node_origins() { return &node_origins_; }
|
|
JSHeapBroker* broker() { return &broker_; }
|
|
TickCounter* tick_counter() { return &tick_counter_; }
|
|
|
|
private:
|
|
CanonicalHandleScope canonical_;
|
|
CommonOperatorBuilder common_;
|
|
Graph graph_;
|
|
JSHeapBroker broker_;
|
|
SourcePositionTable source_positions_;
|
|
NodeOriginTable node_origins_;
|
|
TickCounter tick_counter_;
|
|
};
|
|
|
|
|
|
class TypedGraphTest : public GraphTest {
|
|
public:
|
|
explicit TypedGraphTest(int num_parameters = 1);
|
|
~TypedGraphTest() override;
|
|
|
|
protected:
|
|
Typer* typer() { return &typer_; }
|
|
|
|
private:
|
|
Typer typer_;
|
|
};
|
|
|
|
} // namespace compiler
|
|
} // namespace internal
|
|
} // namespace v8
|
|
|
|
#endif // V8_UNITTESTS_COMPILER_GRAPH_UNITTEST_H_
|