OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 "src/heap/heap.h" | 5 #include "src/heap/heap.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/api.h" | 8 #include "src/api.h" |
9 #include "src/ast/context-slot-cache.h" | 9 #include "src/ast/context-slot-cache.h" |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 2591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2602 void Heap::CreateInitialObjects() { | 2602 void Heap::CreateInitialObjects() { |
2603 HandleScope scope(isolate()); | 2603 HandleScope scope(isolate()); |
2604 Factory* factory = isolate()->factory(); | 2604 Factory* factory = isolate()->factory(); |
2605 | 2605 |
2606 // The -0 value must be set before NewNumber works. | 2606 // The -0 value must be set before NewNumber works. |
2607 set_minus_zero_value(*factory->NewHeapNumber(-0.0, IMMUTABLE, TENURED)); | 2607 set_minus_zero_value(*factory->NewHeapNumber(-0.0, IMMUTABLE, TENURED)); |
2608 DCHECK(std::signbit(minus_zero_value()->Number()) != 0); | 2608 DCHECK(std::signbit(minus_zero_value()->Number()) != 0); |
2609 | 2609 |
2610 set_nan_value(*factory->NewHeapNumber( | 2610 set_nan_value(*factory->NewHeapNumber( |
2611 std::numeric_limits<double>::quiet_NaN(), IMMUTABLE, TENURED)); | 2611 std::numeric_limits<double>::quiet_NaN(), IMMUTABLE, TENURED)); |
| 2612 set_hole_nan_value(*factory->NewHeapNumber(bit_cast<double>(kHoleNanInt64), |
| 2613 IMMUTABLE, TENURED)); |
2612 set_infinity_value(*factory->NewHeapNumber(V8_INFINITY, IMMUTABLE, TENURED)); | 2614 set_infinity_value(*factory->NewHeapNumber(V8_INFINITY, IMMUTABLE, TENURED)); |
2613 set_minus_infinity_value( | 2615 set_minus_infinity_value( |
2614 *factory->NewHeapNumber(-V8_INFINITY, IMMUTABLE, TENURED)); | 2616 *factory->NewHeapNumber(-V8_INFINITY, IMMUTABLE, TENURED)); |
2615 | 2617 |
2616 // Allocate initial string table. | 2618 // Allocate initial string table. |
2617 set_string_table(*StringTable::New(isolate(), kInitialStringTableSize)); | 2619 set_string_table(*StringTable::New(isolate(), kInitialStringTableSize)); |
2618 | 2620 |
2619 // Allocate | 2621 // Allocate |
2620 | 2622 |
2621 // Finish initializing oddballs after creating the string table. | 2623 // Finish initializing oddballs after creating the string table. |
2622 Oddball::Initialize(isolate(), factory->undefined_value(), "undefined", | 2624 Oddball::Initialize(isolate(), factory->undefined_value(), "undefined", |
2623 factory->nan_value(), "undefined", Oddball::kUndefined); | 2625 factory->nan_value(), "undefined", Oddball::kUndefined); |
2624 | 2626 |
2625 // Initialize the null_value. | 2627 // Initialize the null_value. |
2626 Oddball::Initialize(isolate(), factory->null_value(), "null", | 2628 Oddball::Initialize(isolate(), factory->null_value(), "null", |
2627 handle(Smi::FromInt(0), isolate()), "object", | 2629 handle(Smi::FromInt(0), isolate()), "object", |
2628 Oddball::kNull); | 2630 Oddball::kNull); |
2629 | 2631 |
2630 // Initialize the_hole_value. | 2632 // Initialize the_hole_value. |
2631 Oddball::Initialize(isolate(), factory->the_hole_value(), "hole", | 2633 Oddball::Initialize(isolate(), factory->the_hole_value(), "hole", |
2632 handle(Smi::FromInt(-1), isolate()), "undefined", | 2634 factory->hole_nan_value(), "undefined", |
2633 Oddball::kTheHole); | 2635 Oddball::kTheHole); |
2634 | 2636 |
2635 // Initialize the true_value. | 2637 // Initialize the true_value. |
2636 Oddball::Initialize(isolate(), factory->true_value(), "true", | 2638 Oddball::Initialize(isolate(), factory->true_value(), "true", |
2637 handle(Smi::FromInt(1), isolate()), "boolean", | 2639 handle(Smi::FromInt(1), isolate()), "boolean", |
2638 Oddball::kTrue); | 2640 Oddball::kTrue); |
2639 | 2641 |
2640 // Initialize the false_value. | 2642 // Initialize the false_value. |
2641 Oddball::Initialize(isolate(), factory->false_value(), "false", | 2643 Oddball::Initialize(isolate(), factory->false_value(), "false", |
2642 handle(Smi::FromInt(0), isolate()), "boolean", | 2644 handle(Smi::FromInt(0), isolate()), "boolean", |
(...skipping 3840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6483 } | 6485 } |
6484 | 6486 |
6485 | 6487 |
6486 // static | 6488 // static |
6487 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6489 int Heap::GetStaticVisitorIdForMap(Map* map) { |
6488 return StaticVisitorBase::GetVisitorId(map); | 6490 return StaticVisitorBase::GetVisitorId(map); |
6489 } | 6491 } |
6490 | 6492 |
6491 } // namespace internal | 6493 } // namespace internal |
6492 } // namespace v8 | 6494 } // namespace v8 |
OLD | NEW |