| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 V(Proxy, prototype_accessors) \ | 119 V(Proxy, prototype_accessors) \ |
| 120 V(Dictionary, code_stubs) \ | 120 V(Dictionary, code_stubs) \ |
| 121 V(Dictionary, non_monomorphic_cache) \ | 121 V(Dictionary, non_monomorphic_cache) \ |
| 122 V(Code, js_entry_code) \ | 122 V(Code, js_entry_code) \ |
| 123 V(Code, js_construct_entry_code) \ | 123 V(Code, js_construct_entry_code) \ |
| 124 V(Code, c_entry_code) \ | 124 V(Code, c_entry_code) \ |
| 125 V(Code, c_entry_debug_break_code) \ | 125 V(Code, c_entry_debug_break_code) \ |
| 126 V(FixedArray, number_string_cache) \ | 126 V(FixedArray, number_string_cache) \ |
| 127 V(FixedArray, single_character_string_cache) \ | 127 V(FixedArray, single_character_string_cache) \ |
| 128 V(FixedArray, natives_source_cache) \ | 128 V(FixedArray, natives_source_cache) \ |
| 129 V(Object, keyed_lookup_cache) \ | |
| 130 V(Object, last_script_id) | 129 V(Object, last_script_id) |
| 131 | 130 |
| 132 | 131 |
| 133 #define ROOT_LIST(V) \ | 132 #define ROOT_LIST(V) \ |
| 134 STRONG_ROOT_LIST(V) \ | 133 STRONG_ROOT_LIST(V) \ |
| 135 V(Object, symbol_table) | 134 V(Object, symbol_table) |
| 136 | 135 |
| 137 #define SYMBOL_LIST(V) \ | 136 #define SYMBOL_LIST(V) \ |
| 138 V(Array_symbol, "Array") \ | 137 V(Array_symbol, "Array") \ |
| 139 V(Object_symbol, "Object") \ | 138 V(Object_symbol, "Object") \ |
| (...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 693 static inline AllocationSpace TargetSpaceId(InstanceType type); | 692 static inline AllocationSpace TargetSpaceId(InstanceType type); |
| 694 | 693 |
| 695 // Sets the stub_cache_ (only used when expanding the dictionary). | 694 // Sets the stub_cache_ (only used when expanding the dictionary). |
| 696 static void set_code_stubs(Dictionary* value) { code_stubs_ = value; } | 695 static void set_code_stubs(Dictionary* value) { code_stubs_ = value; } |
| 697 | 696 |
| 698 // Sets the non_monomorphic_cache_ (only used when expanding the dictionary). | 697 // Sets the non_monomorphic_cache_ (only used when expanding the dictionary). |
| 699 static void set_non_monomorphic_cache(Dictionary* value) { | 698 static void set_non_monomorphic_cache(Dictionary* value) { |
| 700 non_monomorphic_cache_ = value; | 699 non_monomorphic_cache_ = value; |
| 701 } | 700 } |
| 702 | 701 |
| 703 // Gets, sets and clears the lookup cache used for keyed access. | |
| 704 static inline Object* GetKeyedLookupCache(); | |
| 705 static inline void SetKeyedLookupCache(LookupCache* cache); | |
| 706 static inline void ClearKeyedLookupCache(); | |
| 707 | |
| 708 // Update the next script id. | 702 // Update the next script id. |
| 709 static inline void SetLastScriptId(Object* last_script_id); | 703 static inline void SetLastScriptId(Object* last_script_id); |
| 710 | 704 |
| 711 #ifdef DEBUG | 705 #ifdef DEBUG |
| 712 static void Print(); | 706 static void Print(); |
| 713 static void PrintHandles(); | 707 static void PrintHandles(); |
| 714 | 708 |
| 715 // Verify the heap is in its normal state before or after a GC. | 709 // Verify the heap is in its normal state before or after a GC. |
| 716 static void Verify(); | 710 static void Verify(); |
| 717 | 711 |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1133 // Perform all necessary shutdown (destruction) work. | 1127 // Perform all necessary shutdown (destruction) work. |
| 1134 void Shutdown(); | 1128 void Shutdown(); |
| 1135 | 1129 |
| 1136 // Space iterator for iterating all the spaces. | 1130 // Space iterator for iterating all the spaces. |
| 1137 SpaceIterator* space_iterator_; | 1131 SpaceIterator* space_iterator_; |
| 1138 // Object iterator for the space currently being iterated. | 1132 // Object iterator for the space currently being iterated. |
| 1139 ObjectIterator* object_iterator_; | 1133 ObjectIterator* object_iterator_; |
| 1140 }; | 1134 }; |
| 1141 | 1135 |
| 1142 | 1136 |
| 1137 // Cache for mapping (map, property name) into field offset. |
| 1138 // Cleared at startup and prior to mark sweep collection. |
| 1139 class KeyedLookupCache { |
| 1140 public: |
| 1141 // Lookup field offset for (map, name). If absent, -1 is returned. |
| 1142 static int Lookup(Map* map, String* name); |
| 1143 |
| 1144 // Update an element in the cache. |
| 1145 static void Update(Map* map, String* name, int field_offset); |
| 1146 |
| 1147 // Clear the cache. |
| 1148 static void Clear(); |
| 1149 private: |
| 1150 inline static int Hash(Map* map, String* name); |
| 1151 static const int kLength = 128; |
| 1152 struct Key { |
| 1153 Map* map; |
| 1154 String* name; |
| 1155 }; |
| 1156 static Key keys_[kLength]; |
| 1157 static int field_offsets_[kLength]; |
| 1158 }; |
| 1159 |
| 1160 |
| 1143 // ---------------------------------------------------------------------------- | 1161 // ---------------------------------------------------------------------------- |
| 1144 // Marking stack for tracing live objects. | 1162 // Marking stack for tracing live objects. |
| 1145 | 1163 |
| 1146 class MarkingStack { | 1164 class MarkingStack { |
| 1147 public: | 1165 public: |
| 1148 void Initialize(Address low, Address high) { | 1166 void Initialize(Address low, Address high) { |
| 1149 top_ = low_ = reinterpret_cast<HeapObject**>(low); | 1167 top_ = low_ = reinterpret_cast<HeapObject**>(low); |
| 1150 high_ = reinterpret_cast<HeapObject**>(high); | 1168 high_ = reinterpret_cast<HeapObject**>(high); |
| 1151 overflowed_ = false; | 1169 overflowed_ = false; |
| 1152 } | 1170 } |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1309 int marked_count_; | 1327 int marked_count_; |
| 1310 | 1328 |
| 1311 // The count from the end of the previous full GC. Will be zero if there | 1329 // The count from the end of the previous full GC. Will be zero if there |
| 1312 // was no previous full GC. | 1330 // was no previous full GC. |
| 1313 int previous_marked_count_; | 1331 int previous_marked_count_; |
| 1314 }; | 1332 }; |
| 1315 | 1333 |
| 1316 } } // namespace v8::internal | 1334 } } // namespace v8::internal |
| 1317 | 1335 |
| 1318 #endif // V8_HEAP_H_ | 1336 #endif // V8_HEAP_H_ |
| OLD | NEW |