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/scopeinfo.h" | 9 #include "src/ast/scopeinfo.h" |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 2385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2396 shared_function_info) | 2396 shared_function_info) |
2397 | 2397 |
2398 ALLOCATE_MAP(JS_MESSAGE_OBJECT_TYPE, JSMessageObject::kSize, message_object) | 2398 ALLOCATE_MAP(JS_MESSAGE_OBJECT_TYPE, JSMessageObject::kSize, message_object) |
2399 ALLOCATE_MAP(JS_OBJECT_TYPE, JSObject::kHeaderSize + kPointerSize, external) | 2399 ALLOCATE_MAP(JS_OBJECT_TYPE, JSObject::kHeaderSize + kPointerSize, external) |
2400 external_map()->set_is_extensible(false); | 2400 external_map()->set_is_extensible(false); |
2401 #undef ALLOCATE_PRIMITIVE_MAP | 2401 #undef ALLOCATE_PRIMITIVE_MAP |
2402 #undef ALLOCATE_VARSIZE_MAP | 2402 #undef ALLOCATE_VARSIZE_MAP |
2403 #undef ALLOCATE_MAP | 2403 #undef ALLOCATE_MAP |
2404 } | 2404 } |
2405 | 2405 |
| 2406 { |
| 2407 AllocationResult allocation = Allocate(boolean_map(), OLD_SPACE); |
| 2408 if (!allocation.To(&obj)) return false; |
| 2409 } |
| 2410 set_true_value(Oddball::cast(obj)); |
| 2411 Oddball::cast(obj)->set_kind(Oddball::kTrue); |
| 2412 |
| 2413 { |
| 2414 AllocationResult allocation = Allocate(boolean_map(), OLD_SPACE); |
| 2415 if (!allocation.To(&obj)) return false; |
| 2416 } |
| 2417 set_false_value(Oddball::cast(obj)); |
| 2418 Oddball::cast(obj)->set_kind(Oddball::kFalse); |
| 2419 |
2406 { // Empty arrays | 2420 { // Empty arrays |
2407 { | 2421 { |
2408 ByteArray* byte_array; | 2422 ByteArray* byte_array; |
2409 if (!AllocateByteArray(0, TENURED).To(&byte_array)) return false; | 2423 if (!AllocateByteArray(0, TENURED).To(&byte_array)) return false; |
2410 set_empty_byte_array(byte_array); | 2424 set_empty_byte_array(byte_array); |
2411 } | 2425 } |
2412 | 2426 |
2413 #define ALLOCATE_EMPTY_FIXED_TYPED_ARRAY(Type, type, TYPE, ctype, size) \ | 2427 #define ALLOCATE_EMPTY_FIXED_TYPED_ARRAY(Type, type, TYPE, ctype, size) \ |
2414 { \ | 2428 { \ |
2415 FixedTypedArrayBase* obj; \ | 2429 FixedTypedArrayBase* obj; \ |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2613 set_minus_infinity_value( | 2627 set_minus_infinity_value( |
2614 *factory->NewHeapNumber(-V8_INFINITY, IMMUTABLE, TENURED)); | 2628 *factory->NewHeapNumber(-V8_INFINITY, IMMUTABLE, TENURED)); |
2615 | 2629 |
2616 // The hole has not been created yet, but we want to put something | 2630 // The hole has not been created yet, but we want to put something |
2617 // predictable in the gaps in the string table, so lets make that Smi zero. | 2631 // predictable in the gaps in the string table, so lets make that Smi zero. |
2618 set_the_hole_value(reinterpret_cast<Oddball*>(Smi::FromInt(0))); | 2632 set_the_hole_value(reinterpret_cast<Oddball*>(Smi::FromInt(0))); |
2619 | 2633 |
2620 // Allocate initial string table. | 2634 // Allocate initial string table. |
2621 set_string_table(*StringTable::New(isolate(), kInitialStringTableSize)); | 2635 set_string_table(*StringTable::New(isolate(), kInitialStringTableSize)); |
2622 | 2636 |
| 2637 // Allocate |
| 2638 |
2623 // Finish initializing oddballs after creating the string table. | 2639 // Finish initializing oddballs after creating the string table. |
2624 Oddball::Initialize(isolate(), factory->undefined_value(), "undefined", | 2640 Oddball::Initialize(isolate(), factory->undefined_value(), "undefined", |
2625 factory->nan_value(), "undefined", Oddball::kUndefined); | 2641 factory->nan_value(), false, "undefined", |
| 2642 Oddball::kUndefined); |
2626 | 2643 |
2627 // Initialize the null_value. | 2644 // Initialize the null_value. |
2628 Oddball::Initialize(isolate(), factory->null_value(), "null", | 2645 Oddball::Initialize(isolate(), factory->null_value(), "null", |
2629 handle(Smi::FromInt(0), isolate()), "object", | 2646 handle(Smi::FromInt(0), isolate()), false, "object", |
2630 Oddball::kNull); | 2647 Oddball::kNull); |
2631 | 2648 |
2632 set_true_value(*factory->NewOddball(factory->boolean_map(), "true", | 2649 // Initialize the true_value. |
2633 handle(Smi::FromInt(1), isolate()), | 2650 Oddball::Initialize(isolate(), factory->true_value(), "true", |
2634 "boolean", Oddball::kTrue)); | 2651 handle(Smi::FromInt(1), isolate()), true, "boolean", |
| 2652 Oddball::kTrue); |
2635 | 2653 |
2636 set_false_value(*factory->NewOddball(factory->boolean_map(), "false", | 2654 // Initialize the false_value. |
2637 handle(Smi::FromInt(0), isolate()), | 2655 Oddball::Initialize(isolate(), factory->false_value(), "false", |
2638 "boolean", Oddball::kFalse)); | 2656 handle(Smi::FromInt(0), isolate()), false, "boolean", |
| 2657 Oddball::kFalse); |
2639 | 2658 |
2640 set_the_hole_value(*factory->NewOddball(factory->the_hole_map(), "hole", | 2659 set_the_hole_value(*factory->NewOddball( |
2641 handle(Smi::FromInt(-1), isolate()), | 2660 factory->the_hole_map(), "hole", handle(Smi::FromInt(-1), isolate()), |
2642 "undefined", Oddball::kTheHole)); | 2661 false, "undefined", Oddball::kTheHole)); |
2643 | 2662 |
2644 set_uninitialized_value( | 2663 set_uninitialized_value( |
2645 *factory->NewOddball(factory->uninitialized_map(), "uninitialized", | 2664 *factory->NewOddball(factory->uninitialized_map(), "uninitialized", |
2646 handle(Smi::FromInt(-1), isolate()), "undefined", | 2665 handle(Smi::FromInt(-1), isolate()), false, |
2647 Oddball::kUninitialized)); | 2666 "undefined", Oddball::kUninitialized)); |
2648 | 2667 |
2649 set_arguments_marker( | 2668 set_arguments_marker( |
2650 *factory->NewOddball(factory->arguments_marker_map(), "arguments_marker", | 2669 *factory->NewOddball(factory->arguments_marker_map(), "arguments_marker", |
2651 handle(Smi::FromInt(-4), isolate()), "undefined", | 2670 handle(Smi::FromInt(-4), isolate()), false, |
2652 Oddball::kArgumentsMarker)); | 2671 "undefined", Oddball::kArgumentsMarker)); |
2653 | 2672 |
2654 set_no_interceptor_result_sentinel(*factory->NewOddball( | 2673 set_no_interceptor_result_sentinel(*factory->NewOddball( |
2655 factory->no_interceptor_result_sentinel_map(), | 2674 factory->no_interceptor_result_sentinel_map(), |
2656 "no_interceptor_result_sentinel", handle(Smi::FromInt(-2), isolate()), | 2675 "no_interceptor_result_sentinel", handle(Smi::FromInt(-2), isolate()), |
2657 "undefined", Oddball::kOther)); | 2676 false, "undefined", Oddball::kOther)); |
2658 | 2677 |
2659 set_termination_exception(*factory->NewOddball( | 2678 set_termination_exception(*factory->NewOddball( |
2660 factory->termination_exception_map(), "termination_exception", | 2679 factory->termination_exception_map(), "termination_exception", |
2661 handle(Smi::FromInt(-3), isolate()), "undefined", Oddball::kOther)); | 2680 handle(Smi::FromInt(-3), isolate()), false, "undefined", |
| 2681 Oddball::kOther)); |
2662 | 2682 |
2663 set_exception(*factory->NewOddball(factory->exception_map(), "exception", | 2683 set_exception(*factory->NewOddball(factory->exception_map(), "exception", |
2664 handle(Smi::FromInt(-5), isolate()), | 2684 handle(Smi::FromInt(-5), isolate()), false, |
2665 "undefined", Oddball::kException)); | 2685 "undefined", Oddball::kException)); |
2666 | 2686 |
2667 for (unsigned i = 0; i < arraysize(constant_string_table); i++) { | 2687 for (unsigned i = 0; i < arraysize(constant_string_table); i++) { |
2668 Handle<String> str = | 2688 Handle<String> str = |
2669 factory->InternalizeUtf8String(constant_string_table[i].contents); | 2689 factory->InternalizeUtf8String(constant_string_table[i].contents); |
2670 roots_[constant_string_table[i].index] = *str; | 2690 roots_[constant_string_table[i].index] = *str; |
2671 } | 2691 } |
2672 | 2692 |
2673 // Create the code_stubs dictionary. The initial size is set to avoid | 2693 // Create the code_stubs dictionary. The initial size is set to avoid |
2674 // expanding the dictionary during bootstrapping. | 2694 // expanding the dictionary during bootstrapping. |
(...skipping 3647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6322 } | 6342 } |
6323 | 6343 |
6324 | 6344 |
6325 // static | 6345 // static |
6326 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6346 int Heap::GetStaticVisitorIdForMap(Map* map) { |
6327 return StaticVisitorBase::GetVisitorId(map); | 6347 return StaticVisitorBase::GetVisitorId(map); |
6328 } | 6348 } |
6329 | 6349 |
6330 } // namespace internal | 6350 } // namespace internal |
6331 } // namespace v8 | 6351 } // namespace v8 |
OLD | NEW |