[turbofan] Fix missing ChangeUint32ToUint64 in lowering of LoadBuffer.
authorBenedikt Meurer <bmeurer@chromium.org>
Tue, 23 Dec 2014 06:53:37 +0000 (07:53 +0100)
committerBenedikt Meurer <bmeurer@chromium.org>
Tue, 23 Dec 2014 06:54:00 +0000 (06:54 +0000)
TEST=mjsunit/compiler/regress-444695
BUG=chromium:444695
LOG=y
R=hpayer@chromium.org

Review URL: https://codereview.chromium.org/824843002

Cr-Commit-Position: refs/heads/master@{#25932}

src/compiler/simplified-lowering.cc
test/mjsunit/compiler/regress-444695.js [new file with mode: 0644]

index c4b1b57..74ddb53 100644 (file)
@@ -1147,14 +1147,18 @@ void SimplifiedLowering::DoLoadBuffer(Node* node, MachineType output_type,
     Node* const length = node->InputAt(2);
     Node* const effect = node->InputAt(3);
     Node* const control = node->InputAt(4);
+    Node* const index =
+        machine()->Is64()
+            ? graph()->NewNode(machine()->ChangeUint32ToUint64(), offset)
+            : offset;
 
     Node* check = graph()->NewNode(machine()->Uint32LessThan(), offset, length);
     Node* branch =
         graph()->NewNode(common()->Branch(BranchHint::kTrue), check, control);
 
     Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
-    Node* etrue = graph()->NewNode(machine()->Load(type), buffer, offset,
-                                   effect, if_true);
+    Node* etrue =
+        graph()->NewNode(machine()->Load(type), buffer, index, effect, if_true);
     Node* vtrue = changer->GetRepresentationFor(etrue, type, output_type);
 
     Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
diff --git a/test/mjsunit/compiler/regress-444695.js b/test/mjsunit/compiler/regress-444695.js
new file mode 100644 (file)
index 0000000..168ae25
--- /dev/null
@@ -0,0 +1,11 @@
+// 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.
+
+var foo = (function(stdlib, foreign, heap) {
+  "use asm";
+  var MEM = new stdlib.Uint8Array(heap);
+  function foo(x) { MEM[x | 0] *= 0; }
+  return {foo: foo};
+})(this, {}, new ArrayBuffer(1)).foo;
+foo(-926416896 * 8 * 1024);