Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(613)

Side by Side Diff: src/heap.h

Issue 143633007: A64: Synchronize with r18764. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/full-codegen.cc ('k') | src/heap.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 V(ExternalArray, empty_external_short_array, EmptyExternalShortArray) \ 149 V(ExternalArray, empty_external_short_array, EmptyExternalShortArray) \
150 V(ExternalArray, empty_external_unsigned_short_array, \ 150 V(ExternalArray, empty_external_unsigned_short_array, \
151 EmptyExternalUnsignedShortArray) \ 151 EmptyExternalUnsignedShortArray) \
152 V(ExternalArray, empty_external_int_array, EmptyExternalIntArray) \ 152 V(ExternalArray, empty_external_int_array, EmptyExternalIntArray) \
153 V(ExternalArray, empty_external_unsigned_int_array, \ 153 V(ExternalArray, empty_external_unsigned_int_array, \
154 EmptyExternalUnsignedIntArray) \ 154 EmptyExternalUnsignedIntArray) \
155 V(ExternalArray, empty_external_float_array, EmptyExternalFloatArray) \ 155 V(ExternalArray, empty_external_float_array, EmptyExternalFloatArray) \
156 V(ExternalArray, empty_external_double_array, EmptyExternalDoubleArray) \ 156 V(ExternalArray, empty_external_double_array, EmptyExternalDoubleArray) \
157 V(ExternalArray, empty_external_pixel_array, \ 157 V(ExternalArray, empty_external_pixel_array, \
158 EmptyExternalPixelArray) \ 158 EmptyExternalPixelArray) \
159 V(Map, fixed_uint8_array_map, FixedUint8ArrayMap) \
160 V(Map, fixed_int8_array_map, FixedInt8ArrayMap) \
161 V(Map, fixed_uint16_array_map, FixedUint16ArrayMap) \
162 V(Map, fixed_int16_array_map, FixedInt16ArrayMap) \
163 V(Map, fixed_uint32_array_map, FixedUint32ArrayMap) \
164 V(Map, fixed_int32_array_map, FixedInt32ArrayMap) \
165 V(Map, fixed_float32_array_map, FixedFloat32ArrayMap) \
166 V(Map, fixed_float64_array_map, FixedFloat64ArrayMap) \
167 V(Map, fixed_uint8_clamped_array_map, FixedUint8ClampedArrayMap) \
159 V(Map, non_strict_arguments_elements_map, NonStrictArgumentsElementsMap) \ 168 V(Map, non_strict_arguments_elements_map, NonStrictArgumentsElementsMap) \
160 V(Map, function_context_map, FunctionContextMap) \ 169 V(Map, function_context_map, FunctionContextMap) \
161 V(Map, catch_context_map, CatchContextMap) \ 170 V(Map, catch_context_map, CatchContextMap) \
162 V(Map, with_context_map, WithContextMap) \ 171 V(Map, with_context_map, WithContextMap) \
163 V(Map, block_context_map, BlockContextMap) \ 172 V(Map, block_context_map, BlockContextMap) \
164 V(Map, module_context_map, ModuleContextMap) \ 173 V(Map, module_context_map, ModuleContextMap) \
165 V(Map, global_context_map, GlobalContextMap) \ 174 V(Map, global_context_map, GlobalContextMap) \
166 V(Map, oddball_map, OddballMap) \ 175 V(Map, oddball_map, OddballMap) \
167 V(Map, message_object_map, JSMessageObjectMap) \ 176 V(Map, message_object_map, JSMessageObjectMap) \
168 V(Map, foreign_map, ForeignMap) \ 177 V(Map, foreign_map, ForeignMap) \
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 inline void Iterate(ObjectVisitor* v); 455 inline void Iterate(ObjectVisitor* v);
447 456
448 // Restores internal invariant and gets rid of collected strings. 457 // Restores internal invariant and gets rid of collected strings.
449 // Must be called after each Iterate() that modified the strings. 458 // Must be called after each Iterate() that modified the strings.
450 void CleanUp(); 459 void CleanUp();
451 460
452 // Destroys all allocated memory. 461 // Destroys all allocated memory.
453 void TearDown(); 462 void TearDown();
454 463
455 private: 464 private:
456 ExternalStringTable() { } 465 explicit ExternalStringTable(Heap* heap) : heap_(heap) { }
457 466
458 friend class Heap; 467 friend class Heap;
459 468
460 inline void Verify(); 469 inline void Verify();
461 470
462 inline void AddOldString(String* string); 471 inline void AddOldString(String* string);
463 472
464 // Notifies the table that only a prefix of the new list is valid. 473 // Notifies the table that only a prefix of the new list is valid.
465 inline void ShrinkNewStrings(int position); 474 inline void ShrinkNewStrings(int position);
466 475
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
868 // Allocates an external array of the specified length and type. 877 // Allocates an external array of the specified length and type.
869 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation 878 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
870 // failed. 879 // failed.
871 // Please note this does not perform a garbage collection. 880 // Please note this does not perform a garbage collection.
872 MUST_USE_RESULT MaybeObject* AllocateExternalArray( 881 MUST_USE_RESULT MaybeObject* AllocateExternalArray(
873 int length, 882 int length,
874 ExternalArrayType array_type, 883 ExternalArrayType array_type,
875 void* external_pointer, 884 void* external_pointer,
876 PretenureFlag pretenure); 885 PretenureFlag pretenure);
877 886
887 // Allocates a fixed typed array of the specified length and type.
888 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
889 // failed.
890 // Please note this does not perform a garbage collection.
891 MUST_USE_RESULT MaybeObject* AllocateFixedTypedArray(
892 int length,
893 ExternalArrayType array_type,
894 PretenureFlag pretenure);
895
878 // Allocate a symbol in old space. 896 // Allocate a symbol in old space.
879 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation 897 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
880 // failed. 898 // failed.
881 // Please note this does not perform a garbage collection. 899 // Please note this does not perform a garbage collection.
882 MUST_USE_RESULT MaybeObject* AllocateSymbol(); 900 MUST_USE_RESULT MaybeObject* AllocateSymbol();
883 MUST_USE_RESULT MaybeObject* AllocatePrivateSymbol(); 901 MUST_USE_RESULT MaybeObject* AllocatePrivateSymbol();
884 902
885 // Allocate a tenured AllocationSite. It's payload is null 903 // Allocate a tenured AllocationSite. It's payload is null
886 MUST_USE_RESULT MaybeObject* AllocateAllocationSite(); 904 MUST_USE_RESULT MaybeObject* AllocateAllocationSite();
887 905
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
1118 1136
1119 // Copy the code and scope info part of the code object, but insert 1137 // Copy the code and scope info part of the code object, but insert
1120 // the provided data as the relocation information. 1138 // the provided data as the relocation information.
1121 MUST_USE_RESULT MaybeObject* CopyCode(Code* code, Vector<byte> reloc_info); 1139 MUST_USE_RESULT MaybeObject* CopyCode(Code* code, Vector<byte> reloc_info);
1122 1140
1123 // Finds the internalized copy for string in the string table. 1141 // Finds the internalized copy for string in the string table.
1124 // If not found, a new string is added to the table and returned. 1142 // If not found, a new string is added to the table and returned.
1125 // Returns Failure::RetryAfterGC(requested_bytes, space) if allocation 1143 // Returns Failure::RetryAfterGC(requested_bytes, space) if allocation
1126 // failed. 1144 // failed.
1127 // Please note this function does not perform a garbage collection. 1145 // Please note this function does not perform a garbage collection.
1128 MUST_USE_RESULT MaybeObject* InternalizeUtf8String(Vector<const char> str);
1129 MUST_USE_RESULT MaybeObject* InternalizeUtf8String(const char* str) { 1146 MUST_USE_RESULT MaybeObject* InternalizeUtf8String(const char* str) {
1130 return InternalizeUtf8String(CStrVector(str)); 1147 return InternalizeUtf8String(CStrVector(str));
1131 } 1148 }
1132 MUST_USE_RESULT MaybeObject* InternalizeOneByteString( 1149 MUST_USE_RESULT MaybeObject* InternalizeUtf8String(Vector<const char> str);
1133 Vector<const uint8_t> str); 1150
1134 MUST_USE_RESULT MaybeObject* InternalizeTwoByteString(Vector<const uc16> str);
1135 MUST_USE_RESULT MaybeObject* InternalizeString(String* str); 1151 MUST_USE_RESULT MaybeObject* InternalizeString(String* str);
1136 MUST_USE_RESULT MaybeObject* InternalizeOneByteString( 1152 MUST_USE_RESULT MaybeObject* InternalizeStringWithKey(HashTableKey* key);
1137 Handle<SeqOneByteString> string, int from, int length);
1138 1153
1139 bool InternalizeStringIfExists(String* str, String** result); 1154 bool InternalizeStringIfExists(String* str, String** result);
1140 bool InternalizeTwoCharsStringIfExists(String* str, String** result); 1155 bool InternalizeTwoCharsStringIfExists(String* str, String** result);
1141 1156
1142 // Compute the matching internalized string map for a string if possible. 1157 // Compute the matching internalized string map for a string if possible.
1143 // NULL is returned if string is in new space or not flattened. 1158 // NULL is returned if string is in new space or not flattened.
1144 Map* InternalizedStringMapForString(String* str); 1159 Map* InternalizedStringMapForString(String* str);
1145 1160
1146 // Tries to flatten a string before compare operation. 1161 // Tries to flatten a string before compare operation.
1147 // 1162 //
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
1549 STATIC_CHECK(kFalseValueRootIndex == Internals::kFalseValueRootIndex); 1564 STATIC_CHECK(kFalseValueRootIndex == Internals::kFalseValueRootIndex);
1550 STATIC_CHECK(kempty_stringRootIndex == Internals::kEmptyStringRootIndex); 1565 STATIC_CHECK(kempty_stringRootIndex == Internals::kEmptyStringRootIndex);
1551 1566
1552 // Generated code can embed direct references to non-writable roots if 1567 // Generated code can embed direct references to non-writable roots if
1553 // they are in new space. 1568 // they are in new space.
1554 static bool RootCanBeWrittenAfterInitialization(RootListIndex root_index); 1569 static bool RootCanBeWrittenAfterInitialization(RootListIndex root_index);
1555 // Generated code can treat direct references to this root as constant. 1570 // Generated code can treat direct references to this root as constant.
1556 bool RootCanBeTreatedAsConstant(RootListIndex root_index); 1571 bool RootCanBeTreatedAsConstant(RootListIndex root_index);
1557 1572
1558 MUST_USE_RESULT MaybeObject* NumberToString( 1573 MUST_USE_RESULT MaybeObject* NumberToString(
1559 Object* number, bool check_number_string_cache = true, 1574 Object* number, bool check_number_string_cache = true);
1560 PretenureFlag pretenure = NOT_TENURED);
1561 MUST_USE_RESULT MaybeObject* Uint32ToString( 1575 MUST_USE_RESULT MaybeObject* Uint32ToString(
1562 uint32_t value, bool check_number_string_cache = true); 1576 uint32_t value, bool check_number_string_cache = true);
1563 1577
1578 Map* MapForFixedTypedArray(ExternalArrayType array_type);
1579 RootListIndex RootIndexForFixedTypedArray(
1580 ExternalArrayType array_type);
1581
1564 Map* MapForExternalArrayType(ExternalArrayType array_type); 1582 Map* MapForExternalArrayType(ExternalArrayType array_type);
1565 RootListIndex RootIndexForExternalArrayType( 1583 RootListIndex RootIndexForExternalArrayType(
1566 ExternalArrayType array_type); 1584 ExternalArrayType array_type);
1567 1585
1568 RootListIndex RootIndexForEmptyExternalArray(ElementsKind kind); 1586 RootListIndex RootIndexForEmptyExternalArray(ElementsKind kind);
1569 ExternalArray* EmptyExternalArrayForMap(Map* map); 1587 ExternalArray* EmptyExternalArrayForMap(Map* map);
1570 1588
1571 void RecordStats(HeapStats* stats, bool take_snapshot = false); 1589 void RecordStats(HeapStats* stats, bool take_snapshot = false);
1572 1590
1573 // Copy block of memory from src to dst. Size of block should be aligned 1591 // Copy block of memory from src to dst. Size of block should be aligned
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
1836 MaybeObject* AddWeakObjectToCodeDependency(Object* obj, DependentCode* dep); 1854 MaybeObject* AddWeakObjectToCodeDependency(Object* obj, DependentCode* dep);
1837 1855
1838 DependentCode* LookupWeakObjectToCodeDependency(Object* obj); 1856 DependentCode* LookupWeakObjectToCodeDependency(Object* obj);
1839 1857
1840 void InitializeWeakObjectToCodeTable() { 1858 void InitializeWeakObjectToCodeTable() {
1841 set_weak_object_to_code_table(undefined_value()); 1859 set_weak_object_to_code_table(undefined_value());
1842 } 1860 }
1843 1861
1844 void EnsureWeakObjectToCodeTable(); 1862 void EnsureWeakObjectToCodeTable();
1845 1863
1864 static void FatalProcessOutOfMemory(const char* location,
1865 bool take_snapshot = false);
1866
1846 private: 1867 private:
1847 Heap(); 1868 Heap();
1848 1869
1849 // This can be calculated directly from a pointer to the heap; however, it is 1870 // This can be calculated directly from a pointer to the heap; however, it is
1850 // more expedient to get at the isolate directly from within Heap methods. 1871 // more expedient to get at the isolate directly from within Heap methods.
1851 Isolate* isolate_; 1872 Isolate* isolate_;
1852 1873
1853 Object* roots_[kRootListLength]; 1874 Object* roots_[kRootListLength];
1854 1875
1855 intptr_t code_range_size_; 1876 intptr_t code_range_size_;
(...skipping 1162 matching lines...) Expand 10 before | Expand all | Expand 10 after
3018 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. 3039 DisallowHeapAllocation no_allocation; // i.e. no gc allowed.
3019 3040
3020 private: 3041 private:
3021 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); 3042 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer);
3022 }; 3043 };
3023 #endif // DEBUG 3044 #endif // DEBUG
3024 3045
3025 } } // namespace v8::internal 3046 } } // namespace v8::internal
3026 3047
3027 #endif // V8_HEAP_H_ 3048 #endif // V8_HEAP_H_
OLDNEW
« no previous file with comments | « src/full-codegen.cc ('k') | src/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698