OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <stdlib.h> | 5 #include <stdlib.h> |
6 #include <utility> | 6 #include <utility> |
7 | 7 |
8 #include "test/cctest/test-api.h" | 8 #include "test/cctest/test-api.h" |
9 | 9 |
10 #include "src/v8.h" | 10 #include "src/v8.h" |
(...skipping 2443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2454 Isolate* isolate = CcTest::i_isolate(); | 2454 Isolate* isolate = CcTest::i_isolate(); |
2455 | 2455 |
2456 Zone zone(isolate->allocator(), ZONE_NAME); | 2456 Zone zone(isolate->allocator(), ZONE_NAME); |
2457 | 2457 |
2458 CHECK_EQ(FieldType::Any()->Convert(&zone), AstType::NonInternal()); | 2458 CHECK_EQ(FieldType::Any()->Convert(&zone), AstType::NonInternal()); |
2459 CHECK_EQ(FieldType::None()->Convert(&zone), AstType::None()); | 2459 CHECK_EQ(FieldType::None()->Convert(&zone), AstType::None()); |
2460 } | 2460 } |
2461 | 2461 |
2462 // TODO(ishell): add this test once IS_ACCESSOR_FIELD_SUPPORTED is supported. | 2462 // TODO(ishell): add this test once IS_ACCESSOR_FIELD_SUPPORTED is supported. |
2463 // TEST(TransitionAccessorConstantToAnotherAccessorConstant) | 2463 // TEST(TransitionAccessorConstantToAnotherAccessorConstant) |
| 2464 |
| 2465 TEST(HoleyMutableHeapNumber) { |
| 2466 CcTest::InitializeVM(); |
| 2467 v8::HandleScope scope(CcTest::isolate()); |
| 2468 Isolate* isolate = CcTest::i_isolate(); |
| 2469 |
| 2470 Handle<HeapNumber> mhn = isolate->factory()->NewMutableHeapNumber(); |
| 2471 CHECK_EQ(kHoleNanInt64, mhn->value_as_bits()); |
| 2472 |
| 2473 mhn = isolate->factory()->NewHeapNumber(0.0, MUTABLE); |
| 2474 CHECK_EQ(V8_UINT64_C(0), mhn->value_as_bits()); |
| 2475 |
| 2476 mhn->set_value_as_bits(kHoleNanInt64); |
| 2477 CHECK_EQ(kHoleNanInt64, mhn->value_as_bits()); |
| 2478 |
| 2479 // Ensure that new storage for uninitialized value or mutable heap number |
| 2480 // with uninitialized sentinel (kHoleNanInt64) is a mutable heap number |
| 2481 // with uninitialized sentinel. |
| 2482 Handle<Object> obj = |
| 2483 Object::NewStorageFor(isolate, isolate->factory()->uninitialized_value(), |
| 2484 Representation::Double()); |
| 2485 CHECK(obj->IsMutableHeapNumber()); |
| 2486 CHECK_EQ(kHoleNanInt64, HeapNumber::cast(*obj)->value_as_bits()); |
| 2487 |
| 2488 obj = Object::NewStorageFor(isolate, mhn, Representation::Double()); |
| 2489 CHECK(obj->IsMutableHeapNumber()); |
| 2490 CHECK_EQ(kHoleNanInt64, HeapNumber::cast(*obj)->value_as_bits()); |
| 2491 } |
OLD | NEW |