| OLD | NEW | 
|---|
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 215                                     ObjectSlotCallback copy_object_func); | 215                                     ObjectSlotCallback copy_object_func); | 
| 216 | 216 | 
| 217 | 217 | 
| 218 // The all static Heap captures the interface to the global object heap. | 218 // The all static Heap captures the interface to the global object heap. | 
| 219 // All JavaScript contexts by this process share the same object heap. | 219 // All JavaScript contexts by this process share the same object heap. | 
| 220 | 220 | 
| 221 class Heap : public AllStatic { | 221 class Heap : public AllStatic { | 
| 222  public: | 222  public: | 
| 223   // Configure heap size before setup. Return false if the heap has been | 223   // Configure heap size before setup. Return false if the heap has been | 
| 224   // setup already. | 224   // setup already. | 
| 225   static bool ConfigureHeap(int max_semispace_size, int max_old_gen_size); | 225   static bool ConfigureHeap(int max_semispace_size, | 
|  | 226                             int max_old_gen_size, | 
|  | 227                             int max_executable_size); | 
| 226   static bool ConfigureHeapDefault(); | 228   static bool ConfigureHeapDefault(); | 
| 227 | 229 | 
| 228   // Initializes the global object heap. If create_heap_objects is true, | 230   // Initializes the global object heap. If create_heap_objects is true, | 
| 229   // also creates the basic non-mutable objects. | 231   // also creates the basic non-mutable objects. | 
| 230   // Returns whether it succeeded. | 232   // Returns whether it succeeded. | 
| 231   static bool Setup(bool create_heap_objects); | 233   static bool Setup(bool create_heap_objects); | 
| 232 | 234 | 
| 233   // Destroys all memory allocated by the heap. | 235   // Destroys all memory allocated by the heap. | 
| 234   static void TearDown(); | 236   static void TearDown(); | 
| 235 | 237 | 
| (...skipping 10 matching lines...) Expand all  Loading... | 
| 246   // semi space.  The young generation consists of two semi spaces and | 248   // semi space.  The young generation consists of two semi spaces and | 
| 247   // we reserve twice the amount needed for those in order to ensure | 249   // we reserve twice the amount needed for those in order to ensure | 
| 248   // that new space can be aligned to its size. | 250   // that new space can be aligned to its size. | 
| 249   static intptr_t MaxReserved() { | 251   static intptr_t MaxReserved() { | 
| 250     return 4 * reserved_semispace_size_ + max_old_generation_size_; | 252     return 4 * reserved_semispace_size_ + max_old_generation_size_; | 
| 251   } | 253   } | 
| 252   static int MaxSemiSpaceSize() { return max_semispace_size_; } | 254   static int MaxSemiSpaceSize() { return max_semispace_size_; } | 
| 253   static int ReservedSemiSpaceSize() { return reserved_semispace_size_; } | 255   static int ReservedSemiSpaceSize() { return reserved_semispace_size_; } | 
| 254   static int InitialSemiSpaceSize() { return initial_semispace_size_; } | 256   static int InitialSemiSpaceSize() { return initial_semispace_size_; } | 
| 255   static intptr_t MaxOldGenerationSize() { return max_old_generation_size_; } | 257   static intptr_t MaxOldGenerationSize() { return max_old_generation_size_; } | 
|  | 258   static intptr_t MaxExecutableSize() { return max_executable_size_; } | 
| 256 | 259 | 
| 257   // Returns the capacity of the heap in bytes w/o growing. Heap grows when | 260   // Returns the capacity of the heap in bytes w/o growing. Heap grows when | 
| 258   // more spaces are needed until it reaches the limit. | 261   // more spaces are needed until it reaches the limit. | 
| 259   static intptr_t Capacity(); | 262   static intptr_t Capacity(); | 
| 260 | 263 | 
| 261   // Returns the amount of memory currently committed for the heap. | 264   // Returns the amount of memory currently committed for the heap. | 
| 262   static intptr_t CommittedMemory(); | 265   static intptr_t CommittedMemory(); | 
| 263 | 266 | 
|  | 267   // Returns the amount of executable memory currently committed for the heap. | 
|  | 268   static intptr_t CommittedMemoryExecutable(); | 
|  | 269 | 
| 264   // Returns the available bytes in space w/o growing. | 270   // Returns the available bytes in space w/o growing. | 
| 265   // Heap doesn't guarantee that it can allocate an object that requires | 271   // Heap doesn't guarantee that it can allocate an object that requires | 
| 266   // all available bytes. Check MaxHeapObjectSize() instead. | 272   // all available bytes. Check MaxHeapObjectSize() instead. | 
| 267   static intptr_t Available(); | 273   static intptr_t Available(); | 
| 268 | 274 | 
| 269   // Returns the maximum object size in paged space. | 275   // Returns the maximum object size in paged space. | 
| 270   static inline int MaxObjectSizeInPagedSpace(); | 276   static inline int MaxObjectSizeInPagedSpace(); | 
| 271 | 277 | 
| 272   // Returns of size of all objects residing in the heap. | 278   // Returns of size of all objects residing in the heap. | 
| 273   static intptr_t SizeOfObjects(); | 279   static intptr_t SizeOfObjects(); | 
| (...skipping 815 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1089 | 1095 | 
| 1090   static void ClearNormalizedMapCaches(); | 1096   static void ClearNormalizedMapCaches(); | 
| 1091 | 1097 | 
| 1092   static GCTracer* tracer() { return tracer_; } | 1098   static GCTracer* tracer() { return tracer_; } | 
| 1093 | 1099 | 
| 1094  private: | 1100  private: | 
| 1095   static int reserved_semispace_size_; | 1101   static int reserved_semispace_size_; | 
| 1096   static int max_semispace_size_; | 1102   static int max_semispace_size_; | 
| 1097   static int initial_semispace_size_; | 1103   static int initial_semispace_size_; | 
| 1098   static intptr_t max_old_generation_size_; | 1104   static intptr_t max_old_generation_size_; | 
|  | 1105   static intptr_t max_executable_size_; | 
| 1099   static intptr_t code_range_size_; | 1106   static intptr_t code_range_size_; | 
| 1100 | 1107 | 
| 1101   // For keeping track of how much data has survived | 1108   // For keeping track of how much data has survived | 
| 1102   // scavenge since last new space expansion. | 1109   // scavenge since last new space expansion. | 
| 1103   static int survived_since_last_expansion_; | 1110   static int survived_since_last_expansion_; | 
| 1104 | 1111 | 
| 1105   static int always_allocate_scope_depth_; | 1112   static int always_allocate_scope_depth_; | 
| 1106   static int linear_allocation_scope_depth_; | 1113   static int linear_allocation_scope_depth_; | 
| 1107 | 1114 | 
| 1108   // For keeping track of context disposals. | 1115   // For keeping track of context disposals. | 
| (...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2078   // Return whether this object should be retained. If NULL is returned the | 2085   // Return whether this object should be retained. If NULL is returned the | 
| 2079   // object has no references. Otherwise the address of the retained object | 2086   // object has no references. Otherwise the address of the retained object | 
| 2080   // should be returned as in some GC situations the object has been moved. | 2087   // should be returned as in some GC situations the object has been moved. | 
| 2081   virtual Object* RetainAs(Object* object) = 0; | 2088   virtual Object* RetainAs(Object* object) = 0; | 
| 2082 }; | 2089 }; | 
| 2083 | 2090 | 
| 2084 | 2091 | 
| 2085 } }  // namespace v8::internal | 2092 } }  // namespace v8::internal | 
| 2086 | 2093 | 
| 2087 #endif  // V8_HEAP_H_ | 2094 #endif  // V8_HEAP_H_ | 
| OLD | NEW | 
|---|