Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(327)

Side by Side Diff: src/heap.h

Issue 11404: Add experimental support for external two-byte symbols.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 12 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/api.cc ('k') | src/heap.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 Vector<const char> str, 349 Vector<const char> str,
350 PretenureFlag pretenure = NOT_TENURED); 350 PretenureFlag pretenure = NOT_TENURED);
351 static Object* AllocateStringFromTwoByte( 351 static Object* AllocateStringFromTwoByte(
352 Vector<const uc16> str, 352 Vector<const uc16> str,
353 PretenureFlag pretenure = NOT_TENURED); 353 PretenureFlag pretenure = NOT_TENURED);
354 354
355 // Allocates a symbol in old space based on the character stream. 355 // Allocates a symbol in old space based on the character stream.
356 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation 356 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
357 // failed. 357 // failed.
358 // Please note this function does not perform a garbage collection. 358 // Please note this function does not perform a garbage collection.
359 static Object* AllocateSymbol(unibrow::CharacterStream* buffer, 359 static inline Object* AllocateSymbol(Vector<const char> str,
360 int chars, 360 int chars,
361 uint32_t length_field); 361 uint32_t length_field);
362
363 static Object* AllocateInternalSymbol(unibrow::CharacterStream* buffer,
364 int chars,
365 uint32_t length_field);
366
367 static Object* AllocateExternalSymbol(Vector<const char> str,
368 int chars);
369
362 370
363 // Allocates and partially initializes a String. There are two String 371 // Allocates and partially initializes a String. There are two String
364 // encodings: ASCII and two byte. These functions allocate a string of the 372 // encodings: ASCII and two byte. These functions allocate a string of the
365 // given length and set its map and length fields. The characters of the 373 // given length and set its map and length fields. The characters of the
366 // string are uninitialized. 374 // string are uninitialized.
367 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation 375 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
368 // failed. 376 // failed.
369 // Please note this does not perform a garbage collection. 377 // Please note this does not perform a garbage collection.
370 static Object* AllocateRawAsciiString( 378 static Object* AllocateRawAsciiString(
371 int length, 379 int length,
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 528
521 // Allocate a new external string object, which is backed by a string 529 // Allocate a new external string object, which is backed by a string
522 // resource that resides outside the V8 heap. 530 // resource that resides outside the V8 heap.
523 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation 531 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
524 // failed. 532 // failed.
525 // Please note this does not perform a garbage collection. 533 // Please note this does not perform a garbage collection.
526 static Object* AllocateExternalStringFromAscii( 534 static Object* AllocateExternalStringFromAscii(
527 ExternalAsciiString::Resource* resource); 535 ExternalAsciiString::Resource* resource);
528 static Object* AllocateExternalStringFromTwoByte( 536 static Object* AllocateExternalStringFromTwoByte(
529 ExternalTwoByteString::Resource* resource); 537 ExternalTwoByteString::Resource* resource);
538 static Object* AllocateExternalSymbolFromTwoByte(
539 ExternalTwoByteString::Resource* resource);
530 540
531 // Allocates an uninitialized object. The memory is non-executable if the 541 // Allocates an uninitialized object. The memory is non-executable if the
532 // hardware and OS allow. 542 // hardware and OS allow.
533 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation 543 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
534 // failed. 544 // failed.
535 // Please note this function does not perform a garbage collection. 545 // Please note this function does not perform a garbage collection.
536 static inline Object* AllocateRaw(int size_in_bytes, 546 static inline Object* AllocateRaw(int size_in_bytes,
537 AllocationSpace space, 547 AllocationSpace space,
538 AllocationSpace retry_space); 548 AllocationSpace retry_space);
539 549
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 static bool GarbageCollectionGreedyCheck(); 598 static bool GarbageCollectionGreedyCheck();
589 #endif 599 #endif
590 600
591 static void SetGlobalGCPrologueCallback(GCCallback callback) { 601 static void SetGlobalGCPrologueCallback(GCCallback callback) {
592 global_gc_prologue_callback_ = callback; 602 global_gc_prologue_callback_ = callback;
593 } 603 }
594 static void SetGlobalGCEpilogueCallback(GCCallback callback) { 604 static void SetGlobalGCEpilogueCallback(GCCallback callback) {
595 global_gc_epilogue_callback_ = callback; 605 global_gc_epilogue_callback_ = callback;
596 } 606 }
597 607
608 static void SetExternalSymbolCallback(ExternalSymbolCallback callback) {
609 global_external_symbol_callback_ = callback;
610 }
611
598 // Heap roots 612 // Heap roots
599 #define ROOT_ACCESSOR(type, name) static type* name() { return name##_; } 613 #define ROOT_ACCESSOR(type, name) static type* name() { return name##_; }
600 ROOT_LIST(ROOT_ACCESSOR) 614 ROOT_LIST(ROOT_ACCESSOR)
601 #undef ROOT_ACCESSOR 615 #undef ROOT_ACCESSOR
602 616
603 // Utility type maps 617 // Utility type maps
604 #define STRUCT_MAP_ACCESSOR(NAME, Name, name) \ 618 #define STRUCT_MAP_ACCESSOR(NAME, Name, name) \
605 static Map* name##_map() { return name##_map_; } 619 static Map* name##_map() { return name##_map_; }
606 STRUCT_LIST(STRUCT_MAP_ACCESSOR) 620 STRUCT_LIST(STRUCT_MAP_ACCESSOR)
607 #undef STRUCT_MAP_ACCESSOR 621 #undef STRUCT_MAP_ACCESSOR
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
847 861
848 #define SYMBOL_DECLARATION(name, str) static String* name##_; 862 #define SYMBOL_DECLARATION(name, str) static String* name##_;
849 SYMBOL_LIST(SYMBOL_DECLARATION) 863 SYMBOL_LIST(SYMBOL_DECLARATION)
850 #undef SYMBOL_DECLARATION 864 #undef SYMBOL_DECLARATION
851 865
852 // GC callback function, called before and after mark-compact GC. 866 // GC callback function, called before and after mark-compact GC.
853 // Allocations in the callback function are disallowed. 867 // Allocations in the callback function are disallowed.
854 static GCCallback global_gc_prologue_callback_; 868 static GCCallback global_gc_prologue_callback_;
855 static GCCallback global_gc_epilogue_callback_; 869 static GCCallback global_gc_epilogue_callback_;
856 870
871 // Callback function used for allocating external symbols.
872 static ExternalSymbolCallback global_external_symbol_callback_;
873
857 // Checks whether a global GC is necessary 874 // Checks whether a global GC is necessary
858 static GarbageCollector SelectGarbageCollector(AllocationSpace space); 875 static GarbageCollector SelectGarbageCollector(AllocationSpace space);
859 876
860 // Performs garbage collection 877 // Performs garbage collection
861 static void PerformGarbageCollection(AllocationSpace space, 878 static void PerformGarbageCollection(AllocationSpace space,
862 GarbageCollector collector, 879 GarbageCollector collector,
863 GCTracer* tracer); 880 GCTracer* tracer);
864 881
865 // Returns either a Smi or a Number object from 'value'. If 'new_object' 882 // Returns either a Smi or a Number object from 'value'. If 'new_object'
866 // is false, it may return a preallocated immutable object. 883 // is false, it may return a preallocated immutable object.
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
1253 int marked_count_; 1270 int marked_count_;
1254 1271
1255 // The count from the end of the previous full GC. Will be zero if there 1272 // The count from the end of the previous full GC. Will be zero if there
1256 // was no previous full GC. 1273 // was no previous full GC.
1257 int previous_marked_count_; 1274 int previous_marked_count_;
1258 }; 1275 };
1259 1276
1260 } } // namespace v8::internal 1277 } } // namespace v8::internal
1261 1278
1262 #endif // V8_HEAP_H_ 1279 #endif // V8_HEAP_H_
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698