Chromium Code Reviews| Index: src/heap.h |
| =================================================================== |
| --- src/heap.h (revision 147) |
| +++ src/heap.h (working copy) |
| @@ -122,7 +122,9 @@ |
| V(Code, c_entry_debug_break_code) \ |
| V(FixedArray, number_string_cache) \ |
| V(FixedArray, single_character_string_cache) \ |
| - V(FixedArray, natives_source_cache) |
| + V(FixedArray, natives_source_cache) \ |
| + V(Object, eval_cache_global) \ |
| + V(Object, eval_cache_non_global) |
| #define ROOT_LIST(V) \ |
| STRONG_ROOT_LIST(V) \ |
| @@ -533,6 +535,28 @@ |
| } |
| static Object* LookupSymbol(String* str); |
| + // EvalCache caches function boilerplates for compiled scripts |
|
Kasper Lund
2008/09/05 09:16:29
I would move this code out into a separate class w
Feng Qian
2008/09/09 03:42:50
Let's do that in our next step. Also I'd like to s
|
| + // from 'eval' function. |
| + // Source string is used as the key, and compiled function |
| + // boilerplate as value. Because the same source has different |
| + // compiled code in global or local context, we use separate |
| + // caches for global and local contexts. |
| + // Caches are cleared before mark-compact GC's. |
|
Kasper Lund
2008/09/05 09:16:29
Isn't this really for all mark-sweep GCs - not jus
Feng Qian
2008/09/09 03:42:50
Both, but since we use the same name Heap::MarkCom
|
| + |
| + // Finds the function boilerplate of a source string. |
| + // It returns a JSFunction object if found in the cache. |
| + // The first parameter specifies whether the code is |
| + // compiled in a global context. |
| + static Object* LookupEvalCache(bool is_global_context, String* src); |
| + |
| + // Put a source string and its compiled function boilerplate |
| + // in the eval cache. The cache may expand, and returns failure |
| + // if it cannot expand the cache, otherwise the value is returned. |
| + // The first parameter specifies whether the boilerplate is |
| + // compiled in a global context. |
| + static Object* PutInEvalCache(bool is_global_context, |
|
Kasper Lund
2008/09/05 09:16:29
Indentation of the arguments should align them bel
Feng Qian
2008/09/09 03:42:50
Done.
|
| + String* src, JSFunction* value); |
| + |
| // Compute the matching symbol map for a string if possible. |
| // NULL is returned if string is in new space or not flattened. |
| static Map* SymbolMapForString(String* str); |
| @@ -865,6 +889,7 @@ |
| static void RebuildRSets(LargeObjectSpace* space); |
| static const int kInitialSymbolTableSize = 2048; |
| + static const int kInitialEvalCacheSize = 64; |
| friend class Factory; |
| friend class DisallowAllocationFailure; |
| @@ -1132,7 +1157,6 @@ |
| int previous_marked_count_; |
| }; |
| - |
| } } // namespace v8::internal |
| #endif // V8_HEAP_H_ |