| Index: src/compilation-cache.h
|
| diff --git a/src/compilation-cache.h b/src/compilation-cache.h
|
| index 4339d22641d2e01b396936d8357a2e07d3b702df..8b7d10b52ce7bd405afa16ec158fcd6bed3845a2 100644
|
| --- a/src/compilation-cache.h
|
| +++ b/src/compilation-cache.h
|
| @@ -123,7 +123,19 @@ class CompilationCacheScript : public CompilationSubCache {
|
| };
|
|
|
|
|
| -// Sub-cache for eval scripts.
|
| +// Sub-cache for eval scripts. Two caches for eval are used. One for eval calls
|
| +// in global contexts and one for eval calls in other contexts. The cache
|
| +// considers the following pieces of information when checking for matching
|
| +// entries:
|
| +// 1. The source string.
|
| +// 2. The shared function info of the calling function.
|
| +// 3. Whether the source should be compiled as strict code or as non-strict
|
| +// code.
|
| +// Note: Currently there are clients of CompileEval that always compile
|
| +// non-strict code even if the calling function is a strict mode function.
|
| +// More specifically these are the CompileString, DebugEvaluate and
|
| +// DebugEvaluateGlobal runtime functions.
|
| +// 4. The start position of the calling scope.
|
| class CompilationCacheEval: public CompilationSubCache {
|
| public:
|
| CompilationCacheEval(Isolate* isolate, int generations)
|
| @@ -131,23 +143,27 @@ class CompilationCacheEval: public CompilationSubCache {
|
|
|
| Handle<SharedFunctionInfo> Lookup(Handle<String> source,
|
| Handle<Context> context,
|
| - StrictModeFlag strict_mode);
|
| + StrictModeFlag strict_mode,
|
| + int scope_position);
|
|
|
| void Put(Handle<String> source,
|
| Handle<Context> context,
|
| - Handle<SharedFunctionInfo> function_info);
|
| + Handle<SharedFunctionInfo> function_info,
|
| + int scope_position);
|
|
|
| private:
|
| MUST_USE_RESULT MaybeObject* TryTablePut(
|
| Handle<String> source,
|
| Handle<Context> context,
|
| - Handle<SharedFunctionInfo> function_info);
|
| + Handle<SharedFunctionInfo> function_info,
|
| + int scope_position);
|
|
|
| // Note: Returns a new hash table if operation results in expansion.
|
| Handle<CompilationCacheTable> TablePut(
|
| Handle<String> source,
|
| Handle<Context> context,
|
| - Handle<SharedFunctionInfo> function_info);
|
| + Handle<SharedFunctionInfo> function_info,
|
| + int scope_position);
|
|
|
| DISALLOW_IMPLICIT_CONSTRUCTORS(CompilationCacheEval);
|
| };
|
| @@ -198,7 +214,8 @@ class CompilationCache {
|
| Handle<SharedFunctionInfo> LookupEval(Handle<String> source,
|
| Handle<Context> context,
|
| bool is_global,
|
| - StrictModeFlag strict_mode);
|
| + StrictModeFlag strict_mode,
|
| + int scope_position);
|
|
|
| // Returns the regexp data associated with the given regexp if it
|
| // is in cache, otherwise an empty handle.
|
| @@ -215,7 +232,8 @@ class CompilationCache {
|
| void PutEval(Handle<String> source,
|
| Handle<Context> context,
|
| bool is_global,
|
| - Handle<SharedFunctionInfo> function_info);
|
| + Handle<SharedFunctionInfo> function_info,
|
| + int scope_position);
|
|
|
| // Associate the (source, flags) pair to the given regexp data.
|
| // This may overwrite an existing mapping.
|
|
|