| 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 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 813 | 813 |
| 814 static bool CreateApiObjects(); | 814 static bool CreateApiObjects(); |
| 815 | 815 |
| 816 // Attempt to find the number in a small cache. If we finds it, return | 816 // Attempt to find the number in a small cache. If we finds it, return |
| 817 // the string representation of the number. Otherwise return undefined. | 817 // the string representation of the number. Otherwise return undefined. |
| 818 static Object* GetNumberStringCache(Object* number); | 818 static Object* GetNumberStringCache(Object* number); |
| 819 | 819 |
| 820 // Update the cache with a new number-string pair. | 820 // Update the cache with a new number-string pair. |
| 821 static void SetNumberStringCache(Object* number, String* str); | 821 static void SetNumberStringCache(Object* number, String* str); |
| 822 | 822 |
| 823 // Entries in the cache. Must be a power of 2. | |
| 824 static const int kNumberStringCacheSize = 64; | |
| 825 | |
| 826 // Adjusts the amount of registered external memory. | 823 // Adjusts the amount of registered external memory. |
| 827 // Returns the adjusted value. | 824 // Returns the adjusted value. |
| 828 static inline int AdjustAmountOfExternalAllocatedMemory(int change_in_bytes); | 825 static inline int AdjustAmountOfExternalAllocatedMemory(int change_in_bytes); |
| 829 | 826 |
| 830 // Allocate unitialized fixed array (pretenure == NON_TENURE). | 827 // Allocate unitialized fixed array (pretenure == NON_TENURE). |
| 831 static Object* AllocateRawFixedArray(int length); | 828 static Object* AllocateRawFixedArray(int length); |
| 832 | 829 |
| 833 // True if we have reached the allocation limit in the old generation that | 830 // True if we have reached the allocation limit in the old generation that |
| 834 // should force the next GC (caused normally) to be a full one. | 831 // should force the next GC (caused normally) to be a full one. |
| 835 static bool OldGenerationPromotionLimitReached() { | 832 static bool OldGenerationPromotionLimitReached() { |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1091 // Initializes a function with a shared part and prototype. | 1088 // Initializes a function with a shared part and prototype. |
| 1092 // Returns the function. | 1089 // Returns the function. |
| 1093 // Note: this code was factored out of AllocateFunction such that | 1090 // Note: this code was factored out of AllocateFunction such that |
| 1094 // other parts of the VM could use it. Specifically, a function that creates | 1091 // other parts of the VM could use it. Specifically, a function that creates |
| 1095 // instances of type JS_FUNCTION_TYPE benefit from the use of this function. | 1092 // instances of type JS_FUNCTION_TYPE benefit from the use of this function. |
| 1096 // Please note this does not perform a garbage collection. | 1093 // Please note this does not perform a garbage collection. |
| 1097 static inline Object* InitializeFunction(JSFunction* function, | 1094 static inline Object* InitializeFunction(JSFunction* function, |
| 1098 SharedFunctionInfo* shared, | 1095 SharedFunctionInfo* shared, |
| 1099 Object* prototype); | 1096 Object* prototype); |
| 1100 | 1097 |
| 1098 |
| 1099 // Initializes the number to string cache based on the max semispace size. |
| 1100 static Object* InitializeNumberStringCache(); |
| 1101 // Flush the number to string cache. |
| 1102 static void FlushNumberStringCache(); |
| 1103 |
| 1101 static const int kInitialSymbolTableSize = 2048; | 1104 static const int kInitialSymbolTableSize = 2048; |
| 1102 static const int kInitialEvalCacheSize = 64; | 1105 static const int kInitialEvalCacheSize = 64; |
| 1103 | 1106 |
| 1104 friend class Factory; | 1107 friend class Factory; |
| 1105 friend class DisallowAllocationFailure; | 1108 friend class DisallowAllocationFailure; |
| 1106 friend class AlwaysAllocateScope; | 1109 friend class AlwaysAllocateScope; |
| 1107 friend class LinearAllocationScope; | 1110 friend class LinearAllocationScope; |
| 1108 }; | 1111 }; |
| 1109 | 1112 |
| 1110 | 1113 |
| (...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1673 | 1676 |
| 1674 // To speed up scavenge collections new space string are kept | 1677 // To speed up scavenge collections new space string are kept |
| 1675 // separate from old space strings. | 1678 // separate from old space strings. |
| 1676 static List<Object*> new_space_strings_; | 1679 static List<Object*> new_space_strings_; |
| 1677 static List<Object*> old_space_strings_; | 1680 static List<Object*> old_space_strings_; |
| 1678 }; | 1681 }; |
| 1679 | 1682 |
| 1680 } } // namespace v8::internal | 1683 } } // namespace v8::internal |
| 1681 | 1684 |
| 1682 #endif // V8_HEAP_H_ | 1685 #endif // V8_HEAP_H_ |
| OLD | NEW |