Reviewers: titzer, Benedikt Meurer,
Message:
PTAL
Description:
[turbofan]: Fix x64 regression during ia32 lea port
Please review this at https://codereview.chromium.org/795353008/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+35, -2 lines):
M src/compiler/node-matchers.h
M test/unittests/compiler/node-matchers-unittest.cc
Index: src/compiler/node-matchers.h
diff --git a/src/compiler/node-matchers.h b/src/compiler/node-matchers.h
index
a59b8b3349f592a6a50a3fbf0e36a7fcd3b64a35..7cbd1c5e65bf445383c53572ce75e8b308663d26
100644
--- a/src/compiler/node-matchers.h
+++ b/src/compiler/node-matchers.h
@@ -39,10 +39,9 @@ struct NodeMatcher {
// A pattern matcher for abitrary value constants.
-template <typename T, IrOpcode::Value kMatchOpcode>
+template <typename T, IrOpcode::Value kOpcode>
struct ValueMatcher : public NodeMatcher {
typedef T ValueType;
- static const IrOpcode::Value kOpcode = kMatchOpcode;
explicit ValueMatcher(Node* node)
: NodeMatcher(node), value_(), has_value_(opcode() == kOpcode) {
@@ -71,6 +70,33 @@ struct ValueMatcher : public NodeMatcher {
};
+template <>
+inline ValueMatcher<int64_t, IrOpcode::kInt64Constant>::ValueMatcher(Node*
node)
+ : NodeMatcher(node), value_(), has_value_(false) {
+ if (opcode() == IrOpcode::kInt32Constant) {
+ value_ = OpParameter<int32_t>(node);
+ has_value_ = true;
+ } else if (opcode() == IrOpcode::kInt64Constant) {
+ value_ = OpParameter<int64_t>(node);
+ has_value_ = true;
+ }
+}
+
+
+template <>
+inline ValueMatcher<uint64_t, IrOpcode::kInt64Constant>::ValueMatcher(
+ Node* node)
+ : NodeMatcher(node), value_(), has_value_(false) {
+ if (opcode() == IrOpcode::kInt32Constant) {
+ value_ = OpParameter<uint32_t>(node);
+ has_value_ = true;
+ } else if (opcode() == IrOpcode::kInt64Constant) {
+ value_ = OpParameter<uint64_t>(node);
+ has_value_ = true;
+ }
+}
+
+
// A pattern matcher for integer constants.
template <typename T, IrOpcode::Value kOpcode>
struct IntMatcher FINAL : public ValueMatcher<T, kOpcode> {
Index: test/unittests/compiler/node-matchers-unittest.cc
diff --git a/test/unittests/compiler/node-matchers-unittest.cc
b/test/unittests/compiler/node-matchers-unittest.cc
index
5969cb424ad2ceca710c2a8e973d2b573ac15afa..ff13fce27184da2686612d3486656095fdb8f555
100644
--- a/test/unittests/compiler/node-matchers-unittest.cc
+++ b/test/unittests/compiler/node-matchers-unittest.cc
@@ -390,6 +390,9 @@ TEST_F(NodeMatcherTest, ScaledWithOffset64Matcher) {
const Operator* d15_op = common()->Int64Constant(15);
Node* d15 = graph()->NewNode(d15_op);
USE(d15);
+ const Operator* d15_32_op = common()->Int32Constant(15);
+ Node* d15_32 = graph()->NewNode(d15_32_op);
+ USE(d15_32);
const Operator* b0_op = common()->Parameter(0);
Node* b0 = graph()->NewNode(b0_op, graph()->start());
@@ -451,6 +454,10 @@ TEST_F(NodeMatcherTest, ScaledWithOffset64Matcher) {
BaseWithIndexAndDisplacement64Matcher match2(graph()->NewNode(a_op, b0,
d15));
CheckBaseWithIndexAndDisplacement(&match2, NULL, 0, b0, d15);
+ BaseWithIndexAndDisplacement64Matcher match2_32(
+ graph()->NewNode(a_op, b0, d15_32));
+ CheckBaseWithIndexAndDisplacement(&match2_32, NULL, 0, b0, d15_32);
+
// (D15 + B0) -> [NULL, 0, B0, D15]
BaseWithIndexAndDisplacement64Matcher match3(graph()->NewNode(a_op, d15,
b0));
CheckBaseWithIndexAndDisplacement(&match3, NULL, 0, b0, d15);
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.