Reviewers: dcarney,
Description:
[turbofan] Make Factory::NewNumber() always return the minus_zero_value.
TEST=unittests
[email protected]
Please review this at https://codereview.chromium.org/838263006/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+23, -1 lines):
M src/factory.cc
A test/unittests/factory-unittest.cc
M test/unittests/unittests.gyp
Index: src/factory.cc
diff --git a/src/factory.cc b/src/factory.cc
index
96883052dad1a9105cd23dd0e641952821fbc730..320e14ff07bcb0d8ca96caaad01bc48165c31ab4
100644
--- a/src/factory.cc
+++ b/src/factory.cc
@@ -1018,7 +1018,7 @@ Handle<Object> Factory::NewNumber(double value,
// We need to distinguish the minus zero value and this cannot be
// done after conversion to int. Doing this by comparing bit
// patterns is faster than using fpclassify() et al.
- if (IsMinusZero(value)) return NewHeapNumber(-0.0, IMMUTABLE, pretenure);
+ if (IsMinusZero(value)) return minus_zero_value();
int int_value = FastD2IChecked(value);
if (value == int_value && Smi::IsValid(int_value)) {
Index: test/unittests/factory-unittest.cc
diff --git a/test/unittests/factory-unittest.cc
b/test/unittests/factory-unittest.cc
new file mode 100644
index
0000000000000000000000000000000000000000..472f364651757e7e39d985ad472ee74043bbf740
--- /dev/null
+++ b/test/unittests/factory-unittest.cc
@@ -0,0 +1,21 @@
+// 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.
+
+#include "src/factory.h"
+#include "src/handles-inl.h"
+#include "test/unittests/test-utils.h"
+
+namespace v8 {
+namespace internal {
+
+typedef TestWithIsolate FactoryTest;
+
+
+TEST_F(FactoryTest, NewNumberWithMinusZero) {
+ Handle<Object> minus_zero_value = factory()->minus_zero_value();
+
EXPECT_TRUE(minus_zero_value.is_identical_to(factory()->NewNumber(-0.0)));
+}
+
+} // namespace internal
+} // namespace v8
Index: test/unittests/unittests.gyp
diff --git a/test/unittests/unittests.gyp b/test/unittests/unittests.gyp
index
fe4a1279516b3fcb440122defead8ebfc4579d6e..357d64429fe3b081d95640f17e267002314a4158
100644
--- a/test/unittests/unittests.gyp
+++ b/test/unittests/unittests.gyp
@@ -67,6 +67,7 @@
'compiler/simplified-operator-unittest.cc',
'compiler/value-numbering-reducer-unittest.cc',
'compiler/zone-pool-unittest.cc',
+ 'factory-unittest.cc',
'libplatform/default-platform-unittest.cc',
'libplatform/task-queue-unittest.cc',
'libplatform/worker-thread-unittest.cc',
--
--
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.