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 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
622 return LookupSymbol(CStrVector(str)); | 622 return LookupSymbol(CStrVector(str)); |
623 } | 623 } |
624 static Object* LookupSymbol(String* str); | 624 static Object* LookupSymbol(String* str); |
625 static bool LookupSymbolIfExists(String* str, String** symbol); | 625 static bool LookupSymbolIfExists(String* str, String** symbol); |
626 static bool LookupTwoCharsSymbolIfExists(String* str, String** symbol); | 626 static bool LookupTwoCharsSymbolIfExists(String* str, String** symbol); |
627 | 627 |
628 // Compute the matching symbol map for a string if possible. | 628 // Compute the matching symbol map for a string if possible. |
629 // NULL is returned if string is in new space or not flattened. | 629 // NULL is returned if string is in new space or not flattened. |
630 static Map* SymbolMapForString(String* str); | 630 static Map* SymbolMapForString(String* str); |
631 | 631 |
| 632 // Tries to flatten a string before compare operation. |
| 633 // |
| 634 // Returns a failure in case it was decided that flattening was |
| 635 // necessary and failed. Note, if flattening is not necessary the |
| 636 // string might stay non-flat even when not a failure is returned. |
| 637 // |
| 638 // Please note this function does not perform a garbage collection. |
| 639 static inline Object* PrepareForCompare(String* str); |
| 640 |
632 // Converts the given boolean condition to JavaScript boolean value. | 641 // Converts the given boolean condition to JavaScript boolean value. |
633 static Object* ToBoolean(bool condition) { | 642 static Object* ToBoolean(bool condition) { |
634 return condition ? true_value() : false_value(); | 643 return condition ? true_value() : false_value(); |
635 } | 644 } |
636 | 645 |
637 // Code that should be run before and after each GC. Includes some | 646 // Code that should be run before and after each GC. Includes some |
638 // reporting/verification activities when compiled with DEBUG set. | 647 // reporting/verification activities when compiled with DEBUG set. |
639 static void GarbageCollectionPrologue(); | 648 static void GarbageCollectionPrologue(); |
640 static void GarbageCollectionEpilogue(); | 649 static void GarbageCollectionEpilogue(); |
641 | 650 |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
943 | 952 |
944 // Returns the size of object residing in non new spaces. | 953 // Returns the size of object residing in non new spaces. |
945 static int PromotedSpaceSize(); | 954 static int PromotedSpaceSize(); |
946 | 955 |
947 // Returns the amount of external memory registered since last global gc. | 956 // Returns the amount of external memory registered since last global gc. |
948 static int PromotedExternalMemorySize(); | 957 static int PromotedExternalMemorySize(); |
949 | 958 |
950 static int mc_count_; // how many mark-compact collections happened | 959 static int mc_count_; // how many mark-compact collections happened |
951 static int gc_count_; // how many gc happened | 960 static int gc_count_; // how many gc happened |
952 | 961 |
| 962 // Total length of the strings we failed to flatten since the last GC. |
| 963 static int unflattended_strings_length_; |
| 964 |
953 #define ROOT_ACCESSOR(type, name, camel_name) \ | 965 #define ROOT_ACCESSOR(type, name, camel_name) \ |
954 static inline void set_##name(type* value) { \ | 966 static inline void set_##name(type* value) { \ |
955 roots_[k##camel_name##RootIndex] = value; \ | 967 roots_[k##camel_name##RootIndex] = value; \ |
956 } | 968 } |
957 ROOT_LIST(ROOT_ACCESSOR) | 969 ROOT_LIST(ROOT_ACCESSOR) |
958 #undef ROOT_ACCESSOR | 970 #undef ROOT_ACCESSOR |
959 | 971 |
960 #ifdef DEBUG | 972 #ifdef DEBUG |
961 static bool allocation_allowed_; | 973 static bool allocation_allowed_; |
962 | 974 |
(...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1741 | 1753 |
1742 // To speed up scavenge collections new space string are kept | 1754 // To speed up scavenge collections new space string are kept |
1743 // separate from old space strings. | 1755 // separate from old space strings. |
1744 static List<Object*> new_space_strings_; | 1756 static List<Object*> new_space_strings_; |
1745 static List<Object*> old_space_strings_; | 1757 static List<Object*> old_space_strings_; |
1746 }; | 1758 }; |
1747 | 1759 |
1748 } } // namespace v8::internal | 1760 } } // namespace v8::internal |
1749 | 1761 |
1750 #endif // V8_HEAP_H_ | 1762 #endif // V8_HEAP_H_ |
OLD | NEW |