| 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 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 | 560 |
| 561 // Makes a new native code object | 561 // Makes a new native code object |
| 562 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation | 562 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation |
| 563 // failed. On success, the pointer to the Code object is stored in the | 563 // failed. On success, the pointer to the Code object is stored in the |
| 564 // self_reference. This allows generated code to reference its own Code | 564 // self_reference. This allows generated code to reference its own Code |
| 565 // object by containing this pointer. | 565 // object by containing this pointer. |
| 566 // Please note this function does not perform a garbage collection. | 566 // Please note this function does not perform a garbage collection. |
| 567 static Object* CreateCode(const CodeDesc& desc, | 567 static Object* CreateCode(const CodeDesc& desc, |
| 568 ScopeInfo<>* sinfo, | 568 ScopeInfo<>* sinfo, |
| 569 Code::Flags flags, | 569 Code::Flags flags, |
| 570 Code** self_reference = NULL); | 570 Handle<Object> self_reference); |
| 571 | 571 |
| 572 static Object* CopyCode(Code* code); | 572 static Object* CopyCode(Code* code); |
| 573 // Finds the symbol for string in the symbol table. | 573 // Finds the symbol for string in the symbol table. |
| 574 // If not found, a new symbol is added to the table and returned. | 574 // If not found, a new symbol is added to the table and returned. |
| 575 // Returns Failure::RetryAfterGC(requested_bytes, space) if allocation | 575 // Returns Failure::RetryAfterGC(requested_bytes, space) if allocation |
| 576 // failed. | 576 // failed. |
| 577 // Please note this function does not perform a garbage collection. | 577 // Please note this function does not perform a garbage collection. |
| 578 static Object* LookupSymbol(Vector<const char> str); | 578 static Object* LookupSymbol(Vector<const char> str); |
| 579 static Object* LookupAsciiSymbol(const char* str) { | 579 static Object* LookupAsciiSymbol(const char* str) { |
| 580 return LookupSymbol(CStrVector(str)); | 580 return LookupSymbol(CStrVector(str)); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 599 // Code that should be executed after the garbage collection proper. | 599 // Code that should be executed after the garbage collection proper. |
| 600 static void PostGarbageCollectionProcessing(); | 600 static void PostGarbageCollectionProcessing(); |
| 601 | 601 |
| 602 // Performs garbage collection operation. | 602 // Performs garbage collection operation. |
| 603 // Returns whether required_space bytes are available after the collection. | 603 // Returns whether required_space bytes are available after the collection. |
| 604 static bool CollectGarbage(int required_space, AllocationSpace space); | 604 static bool CollectGarbage(int required_space, AllocationSpace space); |
| 605 | 605 |
| 606 // Performs a full garbage collection. | 606 // Performs a full garbage collection. |
| 607 static void CollectAllGarbage(); | 607 static void CollectAllGarbage(); |
| 608 | 608 |
| 609 // Performs a full garbage collection if a context has been disposed |
| 610 // since the last time the check was performed. |
| 611 static void CollectAllGarbageIfContextDisposed(); |
| 612 |
| 613 // Notify the heap that a context has been disposed. |
| 614 static void NotifyContextDisposed(); |
| 615 |
| 609 // Utility to invoke the scavenger. This is needed in test code to | 616 // Utility to invoke the scavenger. This is needed in test code to |
| 610 // ensure correct callback for weak global handles. | 617 // ensure correct callback for weak global handles. |
| 611 static void PerformScavenge(); | 618 static void PerformScavenge(); |
| 612 | 619 |
| 613 #ifdef DEBUG | 620 #ifdef DEBUG |
| 614 // Utility used with flag gc-greedy. | 621 // Utility used with flag gc-greedy. |
| 615 static bool GarbageCollectionGreedyCheck(); | 622 static bool GarbageCollectionGreedyCheck(); |
| 616 #endif | 623 #endif |
| 617 | 624 |
| 618 static void SetGlobalGCPrologueCallback(GCCallback callback) { | 625 static void SetGlobalGCPrologueCallback(GCCallback callback) { |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 801 private: | 808 private: |
| 802 static int semispace_size_; | 809 static int semispace_size_; |
| 803 static int initial_semispace_size_; | 810 static int initial_semispace_size_; |
| 804 static int young_generation_size_; | 811 static int young_generation_size_; |
| 805 static int old_generation_size_; | 812 static int old_generation_size_; |
| 806 | 813 |
| 807 static int new_space_growth_limit_; | 814 static int new_space_growth_limit_; |
| 808 static int scavenge_count_; | 815 static int scavenge_count_; |
| 809 | 816 |
| 810 static int always_allocate_scope_depth_; | 817 static int always_allocate_scope_depth_; |
| 818 static bool context_disposed_pending_; |
| 811 | 819 |
| 812 static const int kMaxMapSpaceSize = 8*MB; | 820 static const int kMaxMapSpaceSize = 8*MB; |
| 813 | 821 |
| 814 static NewSpace new_space_; | 822 static NewSpace new_space_; |
| 815 static OldSpace* old_pointer_space_; | 823 static OldSpace* old_pointer_space_; |
| 816 static OldSpace* old_data_space_; | 824 static OldSpace* old_data_space_; |
| 817 static OldSpace* code_space_; | 825 static OldSpace* code_space_; |
| 818 static MapSpace* map_space_; | 826 static MapSpace* map_space_; |
| 819 static LargeObjectSpace* lo_space_; | 827 static LargeObjectSpace* lo_space_; |
| 820 static HeapState gc_state_; | 828 static HeapState gc_state_; |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 916 // Allocate empty fixed array. | 924 // Allocate empty fixed array. |
| 917 static Object* AllocateEmptyFixedArray(); | 925 static Object* AllocateEmptyFixedArray(); |
| 918 | 926 |
| 919 // Performs a minor collection in new generation. | 927 // Performs a minor collection in new generation. |
| 920 static void Scavenge(); | 928 static void Scavenge(); |
| 921 | 929 |
| 922 // Performs a major collection in the whole heap. | 930 // Performs a major collection in the whole heap. |
| 923 static void MarkCompact(GCTracer* tracer); | 931 static void MarkCompact(GCTracer* tracer); |
| 924 | 932 |
| 925 // Code to be run before and after mark-compact. | 933 // Code to be run before and after mark-compact. |
| 926 static void MarkCompactPrologue(); | 934 static void MarkCompactPrologue(bool is_compacting); |
| 927 static void MarkCompactEpilogue(); | 935 static void MarkCompactEpilogue(bool is_compacting); |
| 928 | 936 |
| 929 // Helper function used by CopyObject to copy a source object to an | 937 // Helper function used by CopyObject to copy a source object to an |
| 930 // allocated target object and update the forwarding pointer in the source | 938 // allocated target object and update the forwarding pointer in the source |
| 931 // object. Returns the target object. | 939 // object. Returns the target object. |
| 932 static HeapObject* MigrateObject(HeapObject* source, | 940 static HeapObject* MigrateObject(HeapObject* source, |
| 933 HeapObject* target, | 941 HeapObject* target, |
| 934 int size); | 942 int size); |
| 935 | 943 |
| 936 // Helper function that governs the promotion policy from new space to | 944 // Helper function that governs the promotion policy from new space to |
| 937 // old. If the object's old address lies below the new space's age | 945 // old. If the object's old address lies below the new space's age |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1280 int marked_count_; | 1288 int marked_count_; |
| 1281 | 1289 |
| 1282 // The count from the end of the previous full GC. Will be zero if there | 1290 // The count from the end of the previous full GC. Will be zero if there |
| 1283 // was no previous full GC. | 1291 // was no previous full GC. |
| 1284 int previous_marked_count_; | 1292 int previous_marked_count_; |
| 1285 }; | 1293 }; |
| 1286 | 1294 |
| 1287 } } // namespace v8::internal | 1295 } } // namespace v8::internal |
| 1288 | 1296 |
| 1289 #endif // V8_HEAP_H_ | 1297 #endif // V8_HEAP_H_ |
| OLD | NEW |