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 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 | 537 |
538 // Allocate a new external string object, which is backed by a string | 538 // Allocate a new external string object, which is backed by a string |
539 // resource that resides outside the V8 heap. | 539 // resource that resides outside the V8 heap. |
540 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation | 540 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation |
541 // failed. | 541 // failed. |
542 // Please note this does not perform a garbage collection. | 542 // Please note this does not perform a garbage collection. |
543 static Object* AllocateExternalStringFromAscii( | 543 static Object* AllocateExternalStringFromAscii( |
544 ExternalAsciiString::Resource* resource); | 544 ExternalAsciiString::Resource* resource); |
545 static Object* AllocateExternalStringFromTwoByte( | 545 static Object* AllocateExternalStringFromTwoByte( |
546 ExternalTwoByteString::Resource* resource); | 546 ExternalTwoByteString::Resource* resource); |
547 static Object* AllocateExternalSymbolFromTwoByte( | |
548 ExternalTwoByteString::Resource* resource); | |
549 | 547 |
550 // Allocates an uninitialized object. The memory is non-executable if the | 548 // Allocates an uninitialized object. The memory is non-executable if the |
551 // hardware and OS allow. | 549 // hardware and OS allow. |
552 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation | 550 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation |
553 // failed. | 551 // failed. |
554 // Please note this function does not perform a garbage collection. | 552 // Please note this function does not perform a garbage collection. |
555 static inline Object* AllocateRaw(int size_in_bytes, | 553 static inline Object* AllocateRaw(int size_in_bytes, |
556 AllocationSpace space, | 554 AllocationSpace space, |
557 AllocationSpace retry_space); | 555 AllocationSpace retry_space); |
558 | 556 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
617 static bool GarbageCollectionGreedyCheck(); | 615 static bool GarbageCollectionGreedyCheck(); |
618 #endif | 616 #endif |
619 | 617 |
620 static void SetGlobalGCPrologueCallback(GCCallback callback) { | 618 static void SetGlobalGCPrologueCallback(GCCallback callback) { |
621 global_gc_prologue_callback_ = callback; | 619 global_gc_prologue_callback_ = callback; |
622 } | 620 } |
623 static void SetGlobalGCEpilogueCallback(GCCallback callback) { | 621 static void SetGlobalGCEpilogueCallback(GCCallback callback) { |
624 global_gc_epilogue_callback_ = callback; | 622 global_gc_epilogue_callback_ = callback; |
625 } | 623 } |
626 | 624 |
627 static void SetExternalSymbolCallback(ExternalSymbolCallback callback) { | |
628 global_external_symbol_callback_ = callback; | |
629 } | |
630 | |
631 // Heap roots | 625 // Heap roots |
632 #define ROOT_ACCESSOR(type, name) static type* name() { return name##_; } | 626 #define ROOT_ACCESSOR(type, name) static type* name() { return name##_; } |
633 ROOT_LIST(ROOT_ACCESSOR) | 627 ROOT_LIST(ROOT_ACCESSOR) |
634 #undef ROOT_ACCESSOR | 628 #undef ROOT_ACCESSOR |
635 | 629 |
636 // Utility type maps | 630 // Utility type maps |
637 #define STRUCT_MAP_ACCESSOR(NAME, Name, name) \ | 631 #define STRUCT_MAP_ACCESSOR(NAME, Name, name) \ |
638 static Map* name##_map() { return name##_map_; } | 632 static Map* name##_map() { return name##_map_; } |
639 STRUCT_LIST(STRUCT_MAP_ACCESSOR) | 633 STRUCT_LIST(STRUCT_MAP_ACCESSOR) |
640 #undef STRUCT_MAP_ACCESSOR | 634 #undef STRUCT_MAP_ACCESSOR |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
880 | 874 |
881 #define SYMBOL_DECLARATION(name, str) static String* name##_; | 875 #define SYMBOL_DECLARATION(name, str) static String* name##_; |
882 SYMBOL_LIST(SYMBOL_DECLARATION) | 876 SYMBOL_LIST(SYMBOL_DECLARATION) |
883 #undef SYMBOL_DECLARATION | 877 #undef SYMBOL_DECLARATION |
884 | 878 |
885 // GC callback function, called before and after mark-compact GC. | 879 // GC callback function, called before and after mark-compact GC. |
886 // Allocations in the callback function are disallowed. | 880 // Allocations in the callback function are disallowed. |
887 static GCCallback global_gc_prologue_callback_; | 881 static GCCallback global_gc_prologue_callback_; |
888 static GCCallback global_gc_epilogue_callback_; | 882 static GCCallback global_gc_epilogue_callback_; |
889 | 883 |
890 // Callback function used for allocating external symbols. | |
891 static ExternalSymbolCallback global_external_symbol_callback_; | |
892 | |
893 // Checks whether a global GC is necessary | 884 // Checks whether a global GC is necessary |
894 static GarbageCollector SelectGarbageCollector(AllocationSpace space); | 885 static GarbageCollector SelectGarbageCollector(AllocationSpace space); |
895 | 886 |
896 // Performs garbage collection | 887 // Performs garbage collection |
897 static void PerformGarbageCollection(AllocationSpace space, | 888 static void PerformGarbageCollection(AllocationSpace space, |
898 GarbageCollector collector, | 889 GarbageCollector collector, |
899 GCTracer* tracer); | 890 GCTracer* tracer); |
900 | 891 |
901 // Returns either a Smi or a Number object from 'value'. If 'new_object' | 892 // Returns either a Smi or a Number object from 'value'. If 'new_object' |
902 // is false, it may return a preallocated immutable object. | 893 // is false, it may return a preallocated immutable object. |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1289 int marked_count_; | 1280 int marked_count_; |
1290 | 1281 |
1291 // The count from the end of the previous full GC. Will be zero if there | 1282 // The count from the end of the previous full GC. Will be zero if there |
1292 // was no previous full GC. | 1283 // was no previous full GC. |
1293 int previous_marked_count_; | 1284 int previous_marked_count_; |
1294 }; | 1285 }; |
1295 | 1286 |
1296 } } // namespace v8::internal | 1287 } } // namespace v8::internal |
1297 | 1288 |
1298 #endif // V8_HEAP_H_ | 1289 #endif // V8_HEAP_H_ |
OLD | NEW |