| 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 #ifndef V8_HEAP_HEAP_H_ | 5 #ifndef V8_HEAP_HEAP_H_ |
| 6 #define V8_HEAP_HEAP_H_ | 6 #define V8_HEAP_HEAP_H_ |
| 7 | 7 |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <map> | 9 #include <map> |
| 10 | 10 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 V(Map, meta_map, MetaMap) \ | 46 V(Map, meta_map, MetaMap) \ |
| 47 V(Map, heap_number_map, HeapNumberMap) \ | 47 V(Map, heap_number_map, HeapNumberMap) \ |
| 48 V(Map, mutable_heap_number_map, MutableHeapNumberMap) \ | 48 V(Map, mutable_heap_number_map, MutableHeapNumberMap) \ |
| 49 V(Map, float32x4_map, Float32x4Map) \ | 49 V(Map, float32x4_map, Float32x4Map) \ |
| 50 V(Map, native_context_map, NativeContextMap) \ | 50 V(Map, native_context_map, NativeContextMap) \ |
| 51 V(Map, fixed_array_map, FixedArrayMap) \ | 51 V(Map, fixed_array_map, FixedArrayMap) \ |
| 52 V(Map, code_map, CodeMap) \ | 52 V(Map, code_map, CodeMap) \ |
| 53 V(Map, scope_info_map, ScopeInfoMap) \ | 53 V(Map, scope_info_map, ScopeInfoMap) \ |
| 54 V(Map, fixed_cow_array_map, FixedCOWArrayMap) \ | 54 V(Map, fixed_cow_array_map, FixedCOWArrayMap) \ |
| 55 V(Map, fixed_double_array_map, FixedDoubleArrayMap) \ | 55 V(Map, fixed_double_array_map, FixedDoubleArrayMap) \ |
| 56 V(Map, feedback_vector_map, FeedbackVectorMap) \ |
| 56 V(Map, weak_cell_map, WeakCellMap) \ | 57 V(Map, weak_cell_map, WeakCellMap) \ |
| 57 V(Map, one_byte_string_map, OneByteStringMap) \ | 58 V(Map, one_byte_string_map, OneByteStringMap) \ |
| 58 V(Map, one_byte_internalized_string_map, OneByteInternalizedStringMap) \ | 59 V(Map, one_byte_internalized_string_map, OneByteInternalizedStringMap) \ |
| 59 V(Map, function_context_map, FunctionContextMap) \ | 60 V(Map, function_context_map, FunctionContextMap) \ |
| 60 V(FixedArray, empty_fixed_array, EmptyFixedArray) \ | 61 V(FixedArray, empty_fixed_array, EmptyFixedArray) \ |
| 62 V(Object, empty_feedback_vector, EmptyFeedbackVector) \ |
| 61 V(ByteArray, empty_byte_array, EmptyByteArray) \ | 63 V(ByteArray, empty_byte_array, EmptyByteArray) \ |
| 62 V(DescriptorArray, empty_descriptor_array, EmptyDescriptorArray) \ | 64 V(DescriptorArray, empty_descriptor_array, EmptyDescriptorArray) \ |
| 63 /* The roots above this line should be boring from a GC point of view. */ \ | 65 /* The roots above this line should be boring from a GC point of view. */ \ |
| 64 /* This means they are never in new space and never on a page that is */ \ | 66 /* This means they are never in new space and never on a page that is */ \ |
| 65 /* being compacted. */ \ | 67 /* being compacted. */ \ |
| 66 V(Oddball, no_interceptor_result_sentinel, NoInterceptorResultSentinel) \ | 68 V(Oddball, no_interceptor_result_sentinel, NoInterceptorResultSentinel) \ |
| 67 V(Oddball, arguments_marker, ArgumentsMarker) \ | 69 V(Oddball, arguments_marker, ArgumentsMarker) \ |
| 68 V(Oddball, exception, Exception) \ | 70 V(Oddball, exception, Exception) \ |
| 69 V(Oddball, termination_exception, TerminationException) \ | 71 V(Oddball, termination_exception, TerminationException) \ |
| 70 V(FixedArray, number_string_cache, NumberStringCache) \ | 72 V(FixedArray, number_string_cache, NumberStringCache) \ |
| (...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 DISALLOW_COPY_AND_ASSIGN(ExternalStringTable); | 559 DISALLOW_COPY_AND_ASSIGN(ExternalStringTable); |
| 558 }; | 560 }; |
| 559 | 561 |
| 560 | 562 |
| 561 enum ArrayStorageAllocationMode { | 563 enum ArrayStorageAllocationMode { |
| 562 DONT_INITIALIZE_ARRAY_ELEMENTS, | 564 DONT_INITIALIZE_ARRAY_ELEMENTS, |
| 563 INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE | 565 INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE |
| 564 }; | 566 }; |
| 565 | 567 |
| 566 | 568 |
| 569 class FeedbackVectorSpec; |
| 567 class Heap { | 570 class Heap { |
| 568 public: | 571 public: |
| 569 // Configure heap size in MB before setup. Return false if the heap has been | 572 // Configure heap size in MB before setup. Return false if the heap has been |
| 570 // set up already. | 573 // set up already. |
| 571 bool ConfigureHeap(int max_semi_space_size, int max_old_space_size, | 574 bool ConfigureHeap(int max_semi_space_size, int max_old_space_size, |
| 572 int max_executable_size, size_t code_range_size); | 575 int max_executable_size, size_t code_range_size); |
| 573 bool ConfigureHeapDefault(); | 576 bool ConfigureHeapDefault(); |
| 574 | 577 |
| 575 // Prepares the heap, setting up memory areas that are needed in the isolate | 578 // Prepares the heap, setting up memory areas that are needed in the isolate |
| 576 // without actually creating any objects. | 579 // without actually creating any objects. |
| (...skipping 1424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2001 // Make a copy of src, set the map, and return the copy. Returns | 2004 // Make a copy of src, set the map, and return the copy. Returns |
| 2002 // Failure::RetryAfterGC(requested_bytes, space) if the allocation failed. | 2005 // Failure::RetryAfterGC(requested_bytes, space) if the allocation failed. |
| 2003 MUST_USE_RESULT AllocationResult | 2006 MUST_USE_RESULT AllocationResult |
| 2004 CopyFixedArrayWithMap(FixedArray* src, Map* map); | 2007 CopyFixedArrayWithMap(FixedArray* src, Map* map); |
| 2005 | 2008 |
| 2006 // Make a copy of src and return it. Returns | 2009 // Make a copy of src and return it. Returns |
| 2007 // Failure::RetryAfterGC(requested_bytes, space) if the allocation failed. | 2010 // Failure::RetryAfterGC(requested_bytes, space) if the allocation failed. |
| 2008 MUST_USE_RESULT inline AllocationResult CopyFixedDoubleArray( | 2011 MUST_USE_RESULT inline AllocationResult CopyFixedDoubleArray( |
| 2009 FixedDoubleArray* src); | 2012 FixedDoubleArray* src); |
| 2010 | 2013 |
| 2014 MUST_USE_RESULT inline AllocationResult CopyTypeFeedbackVector( |
| 2015 TypeFeedbackVector* src); |
| 2016 MUST_USE_RESULT AllocationResult |
| 2017 CopyTypeFeedbackVectorWithMap(TypeFeedbackVector* src, Map* map); |
| 2018 |
| 2011 // Computes a single character string where the character has code. | 2019 // Computes a single character string where the character has code. |
| 2012 // A cache is used for one-byte (Latin1) codes. | 2020 // A cache is used for one-byte (Latin1) codes. |
| 2013 MUST_USE_RESULT AllocationResult | 2021 MUST_USE_RESULT AllocationResult |
| 2014 LookupSingleCharacterStringFromCode(uint16_t code); | 2022 LookupSingleCharacterStringFromCode(uint16_t code); |
| 2015 | 2023 |
| 2016 // Allocate a symbol in old space. | 2024 // Allocate a symbol in old space. |
| 2017 MUST_USE_RESULT AllocationResult AllocateSymbol(); | 2025 MUST_USE_RESULT AllocationResult AllocateSymbol(); |
| 2018 | 2026 |
| 2027 template <typename Spec> |
| 2028 MUST_USE_RESULT AllocationResult AllocateTypeFeedbackVector(const Spec* spec); |
| 2029 |
| 2019 // Allocates an external array of the specified length and type. | 2030 // Allocates an external array of the specified length and type. |
| 2020 MUST_USE_RESULT AllocationResult | 2031 MUST_USE_RESULT AllocationResult |
| 2021 AllocateExternalArray(int length, ExternalArrayType array_type, | 2032 AllocateExternalArray(int length, ExternalArrayType array_type, |
| 2022 void* external_pointer, PretenureFlag pretenure); | 2033 void* external_pointer, PretenureFlag pretenure); |
| 2023 | 2034 |
| 2024 // Allocates a fixed typed array of the specified length and type. | 2035 // Allocates a fixed typed array of the specified length and type. |
| 2025 MUST_USE_RESULT AllocationResult | 2036 MUST_USE_RESULT AllocationResult |
| 2026 AllocateFixedTypedArray(int length, ExternalArrayType array_type, | 2037 AllocateFixedTypedArray(int length, ExternalArrayType array_type, |
| 2027 bool initialize, PretenureFlag pretenure); | 2038 bool initialize, PretenureFlag pretenure); |
| 2028 | 2039 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 2040 // These five Create*EntryStub functions are here and forced to not be inlined | 2051 // These five Create*EntryStub functions are here and forced to not be inlined |
| 2041 // because of a gcc-4.4 bug that assigns wrong vtable entries. | 2052 // because of a gcc-4.4 bug that assigns wrong vtable entries. |
| 2042 NO_INLINE(void CreateJSEntryStub()); | 2053 NO_INLINE(void CreateJSEntryStub()); |
| 2043 NO_INLINE(void CreateJSConstructEntryStub()); | 2054 NO_INLINE(void CreateJSConstructEntryStub()); |
| 2044 | 2055 |
| 2045 void CreateFixedStubs(); | 2056 void CreateFixedStubs(); |
| 2046 | 2057 |
| 2047 // Allocate empty fixed array. | 2058 // Allocate empty fixed array. |
| 2048 MUST_USE_RESULT AllocationResult AllocateEmptyFixedArray(); | 2059 MUST_USE_RESULT AllocationResult AllocateEmptyFixedArray(); |
| 2049 | 2060 |
| 2061 // Allocate empty feedback vector. |
| 2062 MUST_USE_RESULT AllocationResult AllocateEmptyFeedbackVector(); |
| 2063 |
| 2050 // Allocate empty external array of given type. | 2064 // Allocate empty external array of given type. |
| 2051 MUST_USE_RESULT AllocationResult | 2065 MUST_USE_RESULT AllocationResult |
| 2052 AllocateEmptyExternalArray(ExternalArrayType array_type); | 2066 AllocateEmptyExternalArray(ExternalArrayType array_type); |
| 2053 | 2067 |
| 2054 // Allocate empty fixed typed array of given type. | 2068 // Allocate empty fixed typed array of given type. |
| 2055 MUST_USE_RESULT AllocationResult | 2069 MUST_USE_RESULT AllocationResult |
| 2056 AllocateEmptyFixedTypedArray(ExternalArrayType array_type); | 2070 AllocateEmptyFixedTypedArray(ExternalArrayType array_type); |
| 2057 | 2071 |
| 2058 // Allocate a tenured simple cell. | 2072 // Allocate a tenured simple cell. |
| 2059 MUST_USE_RESULT AllocationResult AllocateCell(Object* value); | 2073 MUST_USE_RESULT AllocationResult AllocateCell(Object* value); |
| (...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2852 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 2866 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
| 2853 | 2867 |
| 2854 private: | 2868 private: |
| 2855 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2869 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
| 2856 }; | 2870 }; |
| 2857 #endif // DEBUG | 2871 #endif // DEBUG |
| 2858 } | 2872 } |
| 2859 } // namespace v8::internal | 2873 } // namespace v8::internal |
| 2860 | 2874 |
| 2861 #endif // V8_HEAP_HEAP_H_ | 2875 #endif // V8_HEAP_HEAP_H_ |
| OLD | NEW |