Revision: 21762
Author: [email protected]
Date: Wed Jun 11 09:09:15 2014 UTC
Log: Fix unsigned comparisons.
Instead of marking the comparison instruction itself as Uint32, we
look at its arguments. This is more consistent what HChange does.
BUG=v8:3380
TEST=mjsunit/regress/regress-3380
LOG=y
[email protected]
Review URL: https://codereview.chromium.org/325133004
http://code.google.com/p/v8/source/detail?r=21762
Added:
/branches/bleeding_edge/test/mjsunit/regress/regress-3380.js
Modified:
/branches/bleeding_edge/src/arm/lithium-codegen-arm.cc
/branches/bleeding_edge/src/arm64/lithium-codegen-arm64.cc
/branches/bleeding_edge/src/hydrogen-uint32-analysis.cc
/branches/bleeding_edge/src/ia32/lithium-codegen-ia32.cc
/branches/bleeding_edge/src/mips/lithium-codegen-mips.cc
/branches/bleeding_edge/src/x64/lithium-codegen-x64.cc
/branches/bleeding_edge/src/x87/lithium-codegen-x87.cc
=======================================
--- /dev/null
+++ /branches/bleeding_edge/test/mjsunit/regress/regress-3380.js Wed Jun 11
09:09:15 2014 UTC
@@ -0,0 +1,16 @@
+// 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.
+
+// Flags: --allow-natives-syntax
+
+function foo(a) {
+ return (a[0] >>> 0) > 0;
+}
+
+var a = new Uint32Array([4]);
+var b = new Uint32Array([0x80000000]);
+assertTrue(foo(a));
+assertTrue(foo(a));
+%OptimizeFunctionOnNextCall(foo);
+assertTrue(foo(b))
=======================================
--- /branches/bleeding_edge/src/arm/lithium-codegen-arm.cc Thu Jun 5
07:33:01 2014 UTC
+++ /branches/bleeding_edge/src/arm/lithium-codegen-arm.cc Wed Jun 11
09:09:15 2014 UTC
@@ -2371,7 +2371,9 @@
void LCodeGen::DoCompareNumericAndBranch(LCompareNumericAndBranch* instr) {
LOperand* left = instr->left();
LOperand* right = instr->right();
- bool is_unsigned = instr->hydrogen()->CheckFlag(HInstruction::kUint32);
+ bool is_unsigned =
+ instr->hydrogen()->left()->CheckFlag(HInstruction::kUint32) ||
+ instr->hydrogen()->right()->CheckFlag(HInstruction::kUint32);
Condition cond = TokenToCondition(instr->op(), is_unsigned);
if (left->IsConstantOperand() && right->IsConstantOperand()) {
=======================================
--- /branches/bleeding_edge/src/arm64/lithium-codegen-arm64.cc Mon Jun 9
14:23:46 2014 UTC
+++ /branches/bleeding_edge/src/arm64/lithium-codegen-arm64.cc Wed Jun 11
09:09:15 2014 UTC
@@ -2470,7 +2470,9 @@
void LCodeGen::DoCompareNumericAndBranch(LCompareNumericAndBranch* instr) {
LOperand* left = instr->left();
LOperand* right = instr->right();
- bool is_unsigned = instr->hydrogen()->CheckFlag(HInstruction::kUint32);
+ bool is_unsigned =
+ instr->hydrogen()->left()->CheckFlag(HInstruction::kUint32) ||
+ instr->hydrogen()->right()->CheckFlag(HInstruction::kUint32);
Condition cond = TokenToCondition(instr->op(), is_unsigned);
if (left->IsConstantOperand() && right->IsConstantOperand()) {
=======================================
--- /branches/bleeding_edge/src/hydrogen-uint32-analysis.cc Tue Jun 10
18:54:28 2014 UTC
+++ /branches/bleeding_edge/src/hydrogen-uint32-analysis.cc Wed Jun 11
09:09:15 2014 UTC
@@ -62,7 +62,6 @@
}
}
} else if (use->IsCompareNumericAndBranch()) {
- return false; // TODO(svenpanne/3380): Fix and re-enable!
HCompareNumericAndBranch* c = HCompareNumericAndBranch::cast(use);
return IsUint32Operation(c->left()) && IsUint32Operation(c->right());
}
=======================================
--- /branches/bleeding_edge/src/ia32/lithium-codegen-ia32.cc Thu Jun 5
07:33:01 2014 UTC
+++ /branches/bleeding_edge/src/ia32/lithium-codegen-ia32.cc Wed Jun 11
09:09:15 2014 UTC
@@ -2247,7 +2247,9 @@
LOperand* left = instr->left();
LOperand* right = instr->right();
bool is_unsigned =
- instr->is_double() ||
instr->hydrogen()->CheckFlag(HInstruction::kUint32);
+ instr->is_double() ||
+ instr->hydrogen()->left()->CheckFlag(HInstruction::kUint32) ||
+ instr->hydrogen()->right()->CheckFlag(HInstruction::kUint32);
Condition cc = TokenToCondition(instr->op(), is_unsigned);
if (left->IsConstantOperand() && right->IsConstantOperand()) {
=======================================
--- /branches/bleeding_edge/src/mips/lithium-codegen-mips.cc Thu Jun 5
16:47:02 2014 UTC
+++ /branches/bleeding_edge/src/mips/lithium-codegen-mips.cc Wed Jun 11
09:09:15 2014 UTC
@@ -2279,7 +2279,9 @@
void LCodeGen::DoCompareNumericAndBranch(LCompareNumericAndBranch* instr) {
LOperand* left = instr->left();
LOperand* right = instr->right();
- bool is_unsigned = instr->hydrogen()->CheckFlag(HInstruction::kUint32);
+ bool is_unsigned =
+ instr->hydrogen()->left()->CheckFlag(HInstruction::kUint32) ||
+ instr->hydrogen()->right()->CheckFlag(HInstruction::kUint32);
Condition cond = TokenToCondition(instr->op(), is_unsigned);
if (left->IsConstantOperand() && right->IsConstantOperand()) {
=======================================
--- /branches/bleeding_edge/src/x64/lithium-codegen-x64.cc Tue Jun 10
04:08:48 2014 UTC
+++ /branches/bleeding_edge/src/x64/lithium-codegen-x64.cc Wed Jun 11
09:09:15 2014 UTC
@@ -2238,7 +2238,9 @@
LOperand* left = instr->left();
LOperand* right = instr->right();
bool is_unsigned =
- instr->is_double() ||
instr->hydrogen()->CheckFlag(HInstruction::kUint32);
+ instr->is_double() ||
+ instr->hydrogen()->left()->CheckFlag(HInstruction::kUint32) ||
+ instr->hydrogen()->right()->CheckFlag(HInstruction::kUint32);
Condition cc = TokenToCondition(instr->op(), is_unsigned);
if (left->IsConstantOperand() && right->IsConstantOperand()) {
=======================================
--- /branches/bleeding_edge/src/x87/lithium-codegen-x87.cc Tue Jun 10
08:09:56 2014 UTC
+++ /branches/bleeding_edge/src/x87/lithium-codegen-x87.cc Wed Jun 11
09:09:15 2014 UTC
@@ -2380,7 +2380,9 @@
LOperand* left = instr->left();
LOperand* right = instr->right();
bool is_unsigned =
- instr->is_double() ||
instr->hydrogen()->CheckFlag(HInstruction::kUint32);
+ instr->is_double() ||
+ instr->hydrogen()->left()->CheckFlag(HInstruction::kUint32) ||
+ instr->hydrogen()->right()->CheckFlag(HInstruction::kUint32);
Condition cc = TokenToCondition(instr->op(), is_unsigned);
if (left->IsConstantOperand() && right->IsConstantOperand()) {
--
--
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.