Reviewers: jarin,
Description:
Version 4.1.0.14 (cherry-pick)
Merged d1c1a3c48f1a5aa3e14a4bea4930e769856c0e83
[turbofan] Fix bit representation of NumberConstant.
[email protected]
BUG=v8:3830
LOG=y
Please review this at https://codereview.chromium.org/882013003/
Base URL: https://chromium.googlesource.com/v8/[email protected]
Affected files (+25, -1 lines):
M src/compiler/representation-change.h
M src/version.cc
A test/mjsunit/compiler/regress-bit-number-constant.js
Index: src/compiler/representation-change.h
diff --git a/src/compiler/representation-change.h
b/src/compiler/representation-change.h
index
e4c257f2ea4bbef34adae3fec268785d5a892c27..8720afdde3ff8938e46ed2f1ab19a647e591e3da
100644
--- a/src/compiler/representation-change.h
+++ b/src/compiler/representation-change.h
@@ -296,6 +296,13 @@ class RepresentationChanger {
if (value == 0 || value == 1) return node;
return jsgraph()->Int32Constant(1); // value != 0
}
+ case IrOpcode::kNumberConstant: {
+ double value = OpParameter<double>(node);
+ if (std::isnan(value) || value == 0.0) {
+ return jsgraph()->Int32Constant(0);
+ }
+ return jsgraph()->Int32Constant(1);
+ }
case IrOpcode::kHeapConstant: {
Handle<Object> handle = OpParameter<Unique<Object>
(node).handle();
DCHECK(*handle == isolate()->heap()->true_value() ||
Index: src/version.cc
diff --git a/src/version.cc b/src/version.cc
index
514cf3fd6b32c09035fe0c988e8fe21ff35d9f18..3b1c220f57db2659792e6c49fdab5e532188fc6d
100644
--- a/src/version.cc
+++ b/src/version.cc
@@ -35,7 +35,7 @@
#define MAJOR_VERSION 4
#define MINOR_VERSION 1
#define BUILD_NUMBER 0
-#define PATCH_LEVEL 13
+#define PATCH_LEVEL 14
// Use 1 for candidates and 0 otherwise.
// (Boolean macro values are not supported by all preprocessors.)
#define IS_CANDIDATE_VERSION 0
Index: test/mjsunit/compiler/regress-bit-number-constant.js
diff --git a/test/mjsunit/compiler/regress-bit-number-constant.js
b/test/mjsunit/compiler/regress-bit-number-constant.js
new file mode 100644
index
0000000000000000000000000000000000000000..d36fe30ce06e610a0dad89a3c34448c4b46944a9
--- /dev/null
+++ b/test/mjsunit/compiler/regress-bit-number-constant.js
@@ -0,0 +1,17 @@
+// Copyright 2015 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 stdlib = this;
+var buffer = new ArrayBuffer(64 * 1024);
+var foreign = {}
+
+var foo = (function Module(stdlib, foreign, heap) {
+ "use asm";
+ function foo(i) {
+ return !(i ? 1 : false);
+ }
+ return {foo:foo};
+})(stdlib, foreign, buffer).foo;
+
+assertFalse(foo(1));
--
--
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.