Reviewers: jarin,

Description:
[turbofan] Truncation of Bit/Word8/16 to Word32 is a no-op.

TEST=mjsunit/compiler/regress-445859
BUG=chromium:445859
LOG=y
[email protected]

Please review this at https://codereview.chromium.org/828313002/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+5, -10 lines):
  M src/compiler/simplified-lowering.cc
  A + test/mjsunit/compiler/regress-445859.js


Index: src/compiler/simplified-lowering.cc
diff --git a/src/compiler/simplified-lowering.cc b/src/compiler/simplified-lowering.cc index 89c6bce4937e7b698aa26bcde836c783b7a4d9d9..bb5761469d144acc64748ec3224e650f44dac5a5 100644
--- a/src/compiler/simplified-lowering.cc
+++ b/src/compiler/simplified-lowering.cc
@@ -181,7 +181,7 @@ class RepresentationSelector {
     } else {
       // In the change phase, insert a change before the use if necessary.
       MachineTypeUnion output = GetInfo(input)->output;
-      if ((output & kRepWord32) == 0) {
+ if ((output & (kRepBit | kRepWord8 | kRepWord16 | kRepWord32)) == 0) {
         // Output representation doesn't match usage.
         TRACE(("  truncate-to-int32: #%d:%s(@%d #%d:%s) ", node->id(),
                node->op()->mnemonic(), index, input->id(),
Index: test/mjsunit/compiler/regress-445859.js
diff --git a/test/mjsunit/compiler/regress-445267.js b/test/mjsunit/compiler/regress-445859.js
similarity index 56%
copy from test/mjsunit/compiler/regress-445267.js
copy to test/mjsunit/compiler/regress-445859.js
index 465168b6e87ae6d49696d9e67c06a7bb982ace57..256af3eeeb44d535d2d35db7908efcd3dc6a1ed1 100644
--- a/test/mjsunit/compiler/regress-445267.js
+++ b/test/mjsunit/compiler/regress-445859.js
@@ -2,15 +2,10 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.

-var foo = (function Module(stdlib, foreign, heap) {
+var foo = (function Module(global, env, buffer) {
   "use asm";
-  var MEM16 = new stdlib.Int16Array(heap);
-  function foo(i) {
-    i = i|0;
-    i = MEM16[i + 2147483650 >> 1]|0;
-    return i;
-  }
+  var i8 = new global.Int8Array(buffer);
+  function foo() { i8[0] += 4294967295; }
   return { foo: foo };
 })(this, {}, new ArrayBuffer(64 * 1024)).foo;
-
-foo(0);
+foo();


--
--
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.

Reply via email to