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 2802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2813 Object* megamorphic = *TypeFeedbackVector::MegamorphicSentinel(isolate()); | 2813 Object* megamorphic = *TypeFeedbackVector::MegamorphicSentinel(isolate()); |
2814 dummy_vector->Set(load_ic_slot, megamorphic, SKIP_WRITE_BARRIER); | 2814 dummy_vector->Set(load_ic_slot, megamorphic, SKIP_WRITE_BARRIER); |
2815 dummy_vector->Set(keyed_load_ic_slot, megamorphic, SKIP_WRITE_BARRIER); | 2815 dummy_vector->Set(keyed_load_ic_slot, megamorphic, SKIP_WRITE_BARRIER); |
2816 dummy_vector->Set(store_ic_slot, megamorphic, SKIP_WRITE_BARRIER); | 2816 dummy_vector->Set(store_ic_slot, megamorphic, SKIP_WRITE_BARRIER); |
2817 dummy_vector->Set(keyed_store_ic_slot, megamorphic, SKIP_WRITE_BARRIER); | 2817 dummy_vector->Set(keyed_store_ic_slot, megamorphic, SKIP_WRITE_BARRIER); |
2818 | 2818 |
2819 set_dummy_vector(*dummy_vector); | 2819 set_dummy_vector(*dummy_vector); |
2820 } | 2820 } |
2821 | 2821 |
2822 { | 2822 { |
| 2823 // Create a canonical empty TypeFeedbackVector, which is shared by all |
| 2824 // functions that don't need actual type feedback slots. Note however |
| 2825 // that all these functions will share the same invocation count, but |
| 2826 // that shouldn't matter since we only use the invocation count to |
| 2827 // relativize the absolute call counts, but we can only have call counts |
| 2828 // if we have actual feedback slots. |
| 2829 Handle<FixedArray> empty_type_feedback_vector = factory->NewFixedArray( |
| 2830 TypeFeedbackVector::kReservedIndexCount, TENURED); |
| 2831 empty_type_feedback_vector->set(TypeFeedbackVector::kMetadataIndex, |
| 2832 empty_fixed_array()); |
| 2833 empty_type_feedback_vector->set(TypeFeedbackVector::kInvocationCountIndex, |
| 2834 Smi::FromInt(0)); |
| 2835 set_empty_type_feedback_vector(*empty_type_feedback_vector); |
| 2836 |
| 2837 // We use a canonical empty LiteralsArray for all functions that neither |
| 2838 // have literals nor need a TypeFeedbackVector (besides the invocation |
| 2839 // count special slot). |
2823 Handle<FixedArray> empty_literals_array = | 2840 Handle<FixedArray> empty_literals_array = |
2824 factory->NewFixedArray(1, TENURED); | 2841 factory->NewFixedArray(1, TENURED); |
2825 empty_literals_array->set(0, *factory->empty_fixed_array()); | 2842 empty_literals_array->set(0, *empty_type_feedback_vector); |
2826 set_empty_literals_array(*empty_literals_array); | 2843 set_empty_literals_array(*empty_literals_array); |
2827 } | 2844 } |
2828 | 2845 |
2829 { | 2846 { |
2830 Handle<FixedArray> empty_sloppy_arguments_elements = | 2847 Handle<FixedArray> empty_sloppy_arguments_elements = |
2831 factory->NewFixedArray(2, TENURED); | 2848 factory->NewFixedArray(2, TENURED); |
2832 empty_sloppy_arguments_elements->set_map(sloppy_arguments_elements_map()); | 2849 empty_sloppy_arguments_elements->set_map(sloppy_arguments_elements_map()); |
2833 set_empty_sloppy_arguments_elements(*empty_sloppy_arguments_elements); | 2850 set_empty_sloppy_arguments_elements(*empty_sloppy_arguments_elements); |
2834 } | 2851 } |
2835 | 2852 |
(...skipping 3683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6519 } | 6536 } |
6520 | 6537 |
6521 | 6538 |
6522 // static | 6539 // static |
6523 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6540 int Heap::GetStaticVisitorIdForMap(Map* map) { |
6524 return StaticVisitorBase::GetVisitorId(map); | 6541 return StaticVisitorBase::GetVisitorId(map); |
6525 } | 6542 } |
6526 | 6543 |
6527 } // namespace internal | 6544 } // namespace internal |
6528 } // namespace v8 | 6545 } // namespace v8 |
OLD | NEW |