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 2738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2749 set_experimental_extra_natives_source_cache( | 2749 set_experimental_extra_natives_source_cache( |
2750 *factory->NewFixedArray(ExperimentalExtraNatives::GetBuiltinsCount())); | 2750 *factory->NewFixedArray(ExperimentalExtraNatives::GetBuiltinsCount())); |
2751 | 2751 |
2752 set_undefined_cell(*factory->NewCell(factory->undefined_value())); | 2752 set_undefined_cell(*factory->NewCell(factory->undefined_value())); |
2753 | 2753 |
2754 // Microtask queue uses the empty fixed array as a sentinel for "empty". | 2754 // Microtask queue uses the empty fixed array as a sentinel for "empty". |
2755 // Number of queued microtasks stored in Isolate::pending_microtask_count(). | 2755 // Number of queued microtasks stored in Isolate::pending_microtask_count(). |
2756 set_microtask_queue(empty_fixed_array()); | 2756 set_microtask_queue(empty_fixed_array()); |
2757 | 2757 |
2758 { | 2758 { |
2759 // Create a canonical empty FeedbackVector, which is shared by all | |
2760 // functions that don't need actual type feedback slots. Note however | |
2761 // that all these functions will share the same invocation count, but | |
2762 // that shouldn't matter since we only use the invocation count to | |
2763 // relativize the absolute call counts, but we can only have call counts | |
2764 // if we have actual feedback slots. | |
2765 Handle<FixedArray> empty_feedback_vector = | |
2766 factory->NewFixedArray(FeedbackVector::kReservedIndexCount, TENURED); | |
2767 empty_feedback_vector->set(FeedbackVector::kMetadataIndex, | |
2768 empty_fixed_array()); | |
2769 empty_feedback_vector->set(FeedbackVector::kInvocationCountIndex, | |
2770 Smi::kZero); | |
2771 empty_feedback_vector->set_map(feedback_vector_map()); | |
2772 set_empty_feedback_vector(*empty_feedback_vector); | |
2773 } | |
2774 | |
2775 { | |
2776 Handle<FixedArray> empty_sloppy_arguments_elements = | 2759 Handle<FixedArray> empty_sloppy_arguments_elements = |
2777 factory->NewFixedArray(2, TENURED); | 2760 factory->NewFixedArray(2, TENURED); |
2778 empty_sloppy_arguments_elements->set_map(sloppy_arguments_elements_map()); | 2761 empty_sloppy_arguments_elements->set_map(sloppy_arguments_elements_map()); |
2779 set_empty_sloppy_arguments_elements(*empty_sloppy_arguments_elements); | 2762 set_empty_sloppy_arguments_elements(*empty_sloppy_arguments_elements); |
2780 } | 2763 } |
2781 | 2764 |
2782 { | 2765 { |
2783 Handle<WeakCell> cell = factory->NewWeakCell(factory->undefined_value()); | 2766 Handle<WeakCell> cell = factory->NewWeakCell(factory->undefined_value()); |
2784 set_empty_weak_cell(*cell); | 2767 set_empty_weak_cell(*cell); |
2785 cell->clear(); | 2768 cell->clear(); |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2931 #undef SMI_ENTRY | 2914 #undef SMI_ENTRY |
2932 // String table | 2915 // String table |
2933 case kStringTableRootIndex: | 2916 case kStringTableRootIndex: |
2934 return true; | 2917 return true; |
2935 | 2918 |
2936 default: | 2919 default: |
2937 return false; | 2920 return false; |
2938 } | 2921 } |
2939 } | 2922 } |
2940 | 2923 |
2941 | |
2942 bool Heap::RootCanBeTreatedAsConstant(RootListIndex root_index) { | 2924 bool Heap::RootCanBeTreatedAsConstant(RootListIndex root_index) { |
2943 return !RootCanBeWrittenAfterInitialization(root_index) && | 2925 return !RootCanBeWrittenAfterInitialization(root_index) && |
2944 !InNewSpace(root(root_index)); | 2926 !InNewSpace(root(root_index)); |
2945 } | 2927 } |
2946 | 2928 |
2947 bool Heap::IsUnmodifiedHeapObject(Object** p) { | 2929 bool Heap::IsUnmodifiedHeapObject(Object** p) { |
2948 Object* object = *p; | 2930 Object* object = *p; |
2949 if (object->IsSmi()) return false; | 2931 if (object->IsSmi()) return false; |
2950 HeapObject* heap_object = HeapObject::cast(object); | 2932 HeapObject* heap_object = HeapObject::cast(object); |
2951 if (!object->IsJSObject()) return false; | 2933 if (!object->IsJSObject()) return false; |
(...skipping 3619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6571 } | 6553 } |
6572 | 6554 |
6573 | 6555 |
6574 // static | 6556 // static |
6575 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6557 int Heap::GetStaticVisitorIdForMap(Map* map) { |
6576 return StaticVisitorBase::GetVisitorId(map); | 6558 return StaticVisitorBase::GetVisitorId(map); |
6577 } | 6559 } |
6578 | 6560 |
6579 } // namespace internal | 6561 } // namespace internal |
6580 } // namespace v8 | 6562 } // namespace v8 |
OLD | NEW |