diff options
Diffstat (limited to 'deps/v8/src/compilation-cache.h')
-rw-r--r-- | deps/v8/src/compilation-cache.h | 64 |
1 files changed, 34 insertions, 30 deletions
diff --git a/deps/v8/src/compilation-cache.h b/deps/v8/src/compilation-cache.h index 973673c524..229fe07d0d 100644 --- a/deps/v8/src/compilation-cache.h +++ b/deps/v8/src/compilation-cache.h @@ -6,12 +6,14 @@ #define V8_COMPILATION_CACHE_H_ #include "src/allocation.h" -#include "src/handles.h" #include "src/objects.h" namespace v8 { namespace internal { +template <typename T> +class Handle; + // The compilation cache consists of several generational sub-caches which uses // this class as a base class. A sub-cache contains a compilation cache tables // for each generation of the sub-cache. Since the same source code string has @@ -74,17 +76,16 @@ class CompilationSubCache { // Sub-cache for scripts. class CompilationCacheScript : public CompilationSubCache { public: - CompilationCacheScript(Isolate* isolate, int generations); + explicit CompilationCacheScript(Isolate* isolate); - Handle<SharedFunctionInfo> Lookup(Handle<String> source, Handle<Object> name, - int line_offset, int column_offset, - ScriptOriginOptions resource_options, - Handle<Context> context, - LanguageMode language_mode); - void Put(Handle<String> source, - Handle<Context> context, - LanguageMode language_mode, - Handle<SharedFunctionInfo> function_info); + InfoVectorPair Lookup(Handle<String> source, Handle<Object> name, + int line_offset, int column_offset, + ScriptOriginOptions resource_options, + Handle<Context> context, LanguageMode language_mode); + + void Put(Handle<String> source, Handle<Context> context, + LanguageMode language_mode, Handle<SharedFunctionInfo> function_info, + Handle<Cell> literals); private: bool HasOrigin(Handle<SharedFunctionInfo> function_info, Handle<Object> name, @@ -109,16 +110,17 @@ class CompilationCacheScript : public CompilationSubCache { // 4. The start position of the calling scope. class CompilationCacheEval: public CompilationSubCache { public: - CompilationCacheEval(Isolate* isolate, int generations) - : CompilationSubCache(isolate, generations) { } + explicit CompilationCacheEval(Isolate* isolate) + : CompilationSubCache(isolate, 1) {} - MaybeHandle<SharedFunctionInfo> Lookup(Handle<String> source, - Handle<SharedFunctionInfo> outer_info, - LanguageMode language_mode, - int scope_position); + InfoVectorPair Lookup(Handle<String> source, + Handle<SharedFunctionInfo> outer_info, + Handle<Context> native_context, + LanguageMode language_mode, int position); void Put(Handle<String> source, Handle<SharedFunctionInfo> outer_info, - Handle<SharedFunctionInfo> function_info, int scope_position); + Handle<SharedFunctionInfo> function_info, + Handle<Context> native_context, Handle<Cell> literals, int position); private: DISALLOW_IMPLICIT_CONSTRUCTORS(CompilationCacheEval); @@ -140,7 +142,6 @@ class CompilationCacheRegExp: public CompilationSubCache { DISALLOW_IMPLICIT_CONSTRUCTORS(CompilationCacheRegExp); }; - // The compilation cache keeps shared function infos for compiled // scripts and evals. The shared function infos are looked up using // the source string as the key. For regular expressions the @@ -150,17 +151,19 @@ class CompilationCache { // Finds the script shared function info for a source // string. Returns an empty handle if the cache doesn't contain a // script for the given source string with the right origin. - MaybeHandle<SharedFunctionInfo> LookupScript( - Handle<String> source, Handle<Object> name, int line_offset, - int column_offset, ScriptOriginOptions resource_options, - Handle<Context> context, LanguageMode language_mode); + InfoVectorPair LookupScript(Handle<String> source, Handle<Object> name, + int line_offset, int column_offset, + ScriptOriginOptions resource_options, + Handle<Context> context, + LanguageMode language_mode); // Finds the shared function info for a source string for eval in a // given context. Returns an empty handle if the cache doesn't // contain a script for the given source string. - MaybeHandle<SharedFunctionInfo> LookupEval( - Handle<String> source, Handle<SharedFunctionInfo> outer_info, - Handle<Context> context, LanguageMode language_mode, int scope_position); + InfoVectorPair LookupEval(Handle<String> source, + Handle<SharedFunctionInfo> outer_info, + Handle<Context> context, LanguageMode language_mode, + int position); // Returns the regexp data associated with the given regexp if it // is in cache, otherwise an empty handle. @@ -169,16 +172,17 @@ class CompilationCache { // Associate the (source, kind) pair to the shared function // info. This may overwrite an existing mapping. - void PutScript(Handle<String> source, - Handle<Context> context, + void PutScript(Handle<String> source, Handle<Context> context, LanguageMode language_mode, - Handle<SharedFunctionInfo> function_info); + Handle<SharedFunctionInfo> function_info, + Handle<Cell> literals); // Associate the (source, context->closure()->shared(), kind) triple // with the shared function info. This may overwrite an existing mapping. void PutEval(Handle<String> source, Handle<SharedFunctionInfo> outer_info, Handle<Context> context, - Handle<SharedFunctionInfo> function_info, int scope_position); + Handle<SharedFunctionInfo> function_info, Handle<Cell> literals, + int position); // Associate the (source, flags) pair to the given regexp data. // This may overwrite an existing mapping. |