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