| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 | 121 |
| 122 DISALLOW_IMPLICIT_CONSTRUCTORS(CompilationCacheScript); | 122 DISALLOW_IMPLICIT_CONSTRUCTORS(CompilationCacheScript); |
| 123 }; | 123 }; |
| 124 | 124 |
| 125 | 125 |
| 126 // Sub-cache for eval scripts. Two caches for eval are used. One for eval calls | 126 // Sub-cache for eval scripts. Two caches for eval are used. One for eval calls |
| 127 // in global contexts and one for eval calls in other contexts. The cache | 127 // in global contexts and one for eval calls in other contexts. The cache |
| 128 // considers the following pieces of information when checking for matching | 128 // considers the following pieces of information when checking for matching |
| 129 // entries: | 129 // entries: |
| 130 // 1. The source string. | 130 // 1. The source string. |
| 131 // 2. The shared function info of the calling function. | 131 // 2. The script of the calling function. |
| 132 // 3. Whether the source should be compiled as strict code or as non-strict | 132 // 3. Whether the source should be compiled as strict code or as non-strict |
| 133 // code. | 133 // code. |
| 134 // Note: Currently there are clients of CompileEval that always compile | 134 // Note: Currently there are clients of CompileEval that always compile |
| 135 // non-strict code even if the calling function is a strict mode function. | 135 // non-strict code even if the calling function is a strict mode function. |
| 136 // More specifically these are the CompileString, DebugEvaluate and | 136 // More specifically these are the CompileString, DebugEvaluate and |
| 137 // DebugEvaluateGlobal runtime functions. | 137 // DebugEvaluateGlobal runtime functions. |
| 138 // 4. The start position of the calling scope. | 138 // 4. The start position of the calling scope in the script source code. |
| 139 // Note: The script plus the start position of the calling scope uniquely |
| 140 // determine the shape of the outer scope of the eval call. |
| 141 // Note: For eval calls in global context RelocInfo::kNoPosition is always |
| 142 // used as the scope position to enable sharing between direct and indirect |
| 143 // global eval calls. |
| 139 class CompilationCacheEval: public CompilationSubCache { | 144 class CompilationCacheEval: public CompilationSubCache { |
| 140 public: | 145 public: |
| 141 CompilationCacheEval(Isolate* isolate, int generations) | 146 CompilationCacheEval(Isolate* isolate, int generations) |
| 142 : CompilationSubCache(isolate, generations) { } | 147 : CompilationSubCache(isolate, generations) { } |
| 143 | 148 |
| 144 Handle<SharedFunctionInfo> Lookup(Handle<String> source, | 149 Handle<SharedFunctionInfo> Lookup(Handle<String> source, |
| 145 Handle<Context> context, | 150 Handle<Context> context, |
| 146 LanguageMode language_mode, | 151 LanguageMode language_mode, |
| 147 int scope_position); | 152 int scope_position); |
| 148 | 153 |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 | 292 |
| 288 friend class Isolate; | 293 friend class Isolate; |
| 289 | 294 |
| 290 DISALLOW_COPY_AND_ASSIGN(CompilationCache); | 295 DISALLOW_COPY_AND_ASSIGN(CompilationCache); |
| 291 }; | 296 }; |
| 292 | 297 |
| 293 | 298 |
| 294 } } // namespace v8::internal | 299 } } // namespace v8::internal |
| 295 | 300 |
| 296 #endif // V8_COMPILATION_CACHE_H_ | 301 #endif // V8_COMPILATION_CACHE_H_ |
| OLD | NEW |