Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(237)

Unified Diff: test/cctest/test-field-type-tracking.cc

Issue 2652553003: Access double fields in C++ as uint64_t fields to preserve signaling bit of a NaN. (Closed)
Patch Set: More fixes Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/cctest/heap/test-alloc.cc ('k') | test/cctest/test-unboxed-doubles.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-field-type-tracking.cc
diff --git a/test/cctest/test-field-type-tracking.cc b/test/cctest/test-field-type-tracking.cc
index 05a7742d69244e21c93ed726f2c58a941fff3ec0..b9478c76e250b2a007828482773ba52306a91114 100644
--- a/test/cctest/test-field-type-tracking.cc
+++ b/test/cctest/test-field-type-tracking.cc
@@ -2461,3 +2461,31 @@ TEST(FieldTypeConvertSimple) {
// TODO(ishell): add this test once IS_ACCESSOR_FIELD_SUPPORTED is supported.
// TEST(TransitionAccessorConstantToAnotherAccessorConstant)
+
+TEST(HoleyMutableHeapNumber) {
+ CcTest::InitializeVM();
+ v8::HandleScope scope(CcTest::isolate());
+ Isolate* isolate = CcTest::i_isolate();
+
+ Handle<HeapNumber> mhn = isolate->factory()->NewMutableHeapNumber();
+ CHECK_EQ(kHoleNanInt64, mhn->value_as_bits());
+
+ mhn = isolate->factory()->NewHeapNumber(0.0, MUTABLE);
+ CHECK_EQ(V8_UINT64_C(0), mhn->value_as_bits());
+
+ mhn->set_value_as_bits(kHoleNanInt64);
+ CHECK_EQ(kHoleNanInt64, mhn->value_as_bits());
+
+ // Ensure that new storage for uninitialized value or mutable heap number
+ // with uninitialized sentinel (kHoleNanInt64) is a mutable heap number
+ // with uninitialized sentinel.
+ Handle<Object> obj =
+ Object::NewStorageFor(isolate, isolate->factory()->uninitialized_value(),
+ Representation::Double());
+ CHECK(obj->IsMutableHeapNumber());
+ CHECK_EQ(kHoleNanInt64, HeapNumber::cast(*obj)->value_as_bits());
+
+ obj = Object::NewStorageFor(isolate, mhn, Representation::Double());
+ CHECK(obj->IsMutableHeapNumber());
+ CHECK_EQ(kHoleNanInt64, HeapNumber::cast(*obj)->value_as_bits());
+}
« no previous file with comments | « test/cctest/heap/test-alloc.cc ('k') | test/cctest/test-unboxed-doubles.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698