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 1197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1208 | 1208 |
1209 Object* root(RootListIndex index) { return roots_[index]; } | 1209 Object* root(RootListIndex index) { return roots_[index]; } |
1210 Handle<Object> root_handle(RootListIndex index) { | 1210 Handle<Object> root_handle(RootListIndex index) { |
1211 return Handle<Object>(&roots_[index]); | 1211 return Handle<Object>(&roots_[index]); |
1212 } | 1212 } |
1213 | 1213 |
1214 // Generated code can embed this address to get access to the roots. | 1214 // Generated code can embed this address to get access to the roots. |
1215 Object** roots_array_start() { return roots_; } | 1215 Object** roots_array_start() { return roots_; } |
1216 | 1216 |
1217 // Sets the stub_cache_ (only used when expanding the dictionary). | 1217 // Sets the stub_cache_ (only used when expanding the dictionary). |
1218 void public_set_code_stubs(UnseededNumberDictionary* value) { | 1218 void SetRootCodeStubs(UnseededNumberDictionary* value) { |
1219 roots_[kCodeStubsRootIndex] = value; | 1219 roots_[kCodeStubsRootIndex] = value; |
1220 } | 1220 } |
1221 | 1221 |
1222 // Sets the non_monomorphic_cache_ (only used when expanding the dictionary). | 1222 // Sets the non_monomorphic_cache_ (only used when expanding the dictionary). |
1223 void public_set_non_monomorphic_cache(UnseededNumberDictionary* value) { | 1223 void SetRootNonMonomorphicCache(UnseededNumberDictionary* value) { |
1224 roots_[kNonMonomorphicCacheRootIndex] = value; | 1224 roots_[kNonMonomorphicCacheRootIndex] = value; |
1225 } | 1225 } |
1226 | 1226 |
1227 void public_set_empty_script(Script* script) { | 1227 void SetRootMaterializedObjects(FixedArray* objects) { |
1228 roots_[kEmptyScriptRootIndex] = script; | |
1229 } | |
1230 | |
1231 void public_set_materialized_objects(FixedArray* objects) { | |
1232 roots_[kMaterializedObjectsRootIndex] = objects; | 1228 roots_[kMaterializedObjectsRootIndex] = objects; |
1233 } | 1229 } |
1234 | 1230 |
| 1231 void SetRootCodeStubContext(Object* value) { |
| 1232 roots_[kCodeStubContextRootIndex] = value; |
| 1233 } |
| 1234 |
| 1235 void SetRootCodeStubExportsObject(JSObject* value) { |
| 1236 roots_[kCodeStubExportsObjectRootIndex] = value; |
| 1237 } |
| 1238 |
| 1239 void SetRootScriptList(Object* value) { |
| 1240 roots_[kScriptListRootIndex] = value; |
| 1241 } |
| 1242 |
| 1243 void SetRootStringTable(StringTable* value) { |
| 1244 roots_[kStringTableRootIndex] = value; |
| 1245 } |
| 1246 |
1235 // Set the stack limit in the roots_ array. Some architectures generate | 1247 // Set the stack limit in the roots_ array. Some architectures generate |
1236 // code that looks here, because it is faster than loading from the static | 1248 // code that looks here, because it is faster than loading from the static |
1237 // jslimit_/real_jslimit_ variable in the StackGuard. | 1249 // jslimit_/real_jslimit_ variable in the StackGuard. |
1238 void SetStackLimits(); | 1250 void SetStackLimits(); |
1239 | 1251 |
1240 // Generated code can treat direct references to this root as constant. | 1252 // Generated code can treat direct references to this root as constant. |
1241 bool RootCanBeTreatedAsConstant(RootListIndex root_index); | 1253 bool RootCanBeTreatedAsConstant(RootListIndex root_index); |
1242 | 1254 |
1243 Map* MapForFixedTypedArray(ExternalArrayType array_type); | 1255 Map* MapForFixedTypedArray(ExternalArrayType array_type); |
1244 RootListIndex RootIndexForFixedTypedArray(ExternalArrayType array_type); | 1256 RootListIndex RootIndexForFixedTypedArray(ExternalArrayType array_type); |
(...skipping 1155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2400 // have a separate list of allocated memory held by ArrayBuffers in new space. | 2412 // have a separate list of allocated memory held by ArrayBuffers in new space. |
2401 // | 2413 // |
2402 // Since mark/compact also evacuates the new space, all pointers in the | 2414 // Since mark/compact also evacuates the new space, all pointers in the |
2403 // |live_array_buffers_for_scavenge_| list are also in the | 2415 // |live_array_buffers_for_scavenge_| list are also in the |
2404 // |live_array_buffers_| list. | 2416 // |live_array_buffers_| list. |
2405 std::map<void*, size_t> live_array_buffers_for_scavenge_; | 2417 std::map<void*, size_t> live_array_buffers_for_scavenge_; |
2406 std::map<void*, size_t> not_yet_discovered_array_buffers_for_scavenge_; | 2418 std::map<void*, size_t> not_yet_discovered_array_buffers_for_scavenge_; |
2407 | 2419 |
2408 StrongRootsList* strong_roots_list_; | 2420 StrongRootsList* strong_roots_list_; |
2409 | 2421 |
| 2422 // Classes in "heap" can be friends. |
2410 friend class AlwaysAllocateScope; | 2423 friend class AlwaysAllocateScope; |
2411 friend class Bootstrapper; | |
2412 friend class Deserializer; | |
2413 friend class Factory; | |
2414 friend class GCCallbacksScope; | 2424 friend class GCCallbacksScope; |
2415 friend class GCTracer; | 2425 friend class GCTracer; |
2416 friend class HeapIterator; | 2426 friend class HeapIterator; |
2417 friend class IncrementalMarking; | 2427 friend class IncrementalMarking; |
2418 friend class Isolate; | |
2419 friend class MarkCompactCollector; | 2428 friend class MarkCompactCollector; |
2420 friend class MarkCompactMarkingVisitor; | 2429 friend class MarkCompactMarkingVisitor; |
2421 friend class MapCompact; | |
2422 friend class Page; | 2430 friend class Page; |
2423 friend class StoreBuffer; | 2431 friend class StoreBuffer; |
2424 | 2432 |
| 2433 // The allocator interface. |
| 2434 friend class Factory; |
| 2435 |
| 2436 // The Isolate constructs us. |
| 2437 friend class Isolate; |
| 2438 |
2425 // Used in cctest. | 2439 // Used in cctest. |
2426 friend class HeapTester; | 2440 friend class HeapTester; |
2427 | 2441 |
2428 DISALLOW_COPY_AND_ASSIGN(Heap); | 2442 DISALLOW_COPY_AND_ASSIGN(Heap); |
2429 }; | 2443 }; |
2430 | 2444 |
2431 | 2445 |
2432 class HeapStats { | 2446 class HeapStats { |
2433 public: | 2447 public: |
2434 static const int kStartMarker = 0xDECADE00; | 2448 static const int kStartMarker = 0xDECADE00; |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2786 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 2800 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
2787 | 2801 |
2788 private: | 2802 private: |
2789 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2803 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
2790 }; | 2804 }; |
2791 #endif // DEBUG | 2805 #endif // DEBUG |
2792 } | 2806 } |
2793 } // namespace v8::internal | 2807 } // namespace v8::internal |
2794 | 2808 |
2795 #endif // V8_HEAP_HEAP_H_ | 2809 #endif // V8_HEAP_HEAP_H_ |
OLD | NEW |