| OLD | NEW |
| 1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 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 13 matching lines...) Expand all Loading... |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #ifndef V8_COMPILATION_CACHE_H_ | 28 #ifndef V8_COMPILATION_CACHE_H_ |
| 29 #define V8_COMPILATION_CACHE_H_ | 29 #define V8_COMPILATION_CACHE_H_ |
| 30 | 30 |
| 31 namespace v8 { | 31 namespace v8 { |
| 32 namespace internal { | 32 namespace internal { |
| 33 | 33 |
| 34 class CompilationCachePrivateData; |
| 35 |
| 36 class CompilationCacheData { |
| 37 public: |
| 38 CompilationCachePrivateData& private_data_; |
| 39 private: |
| 40 CompilationCacheData(); |
| 41 ~CompilationCacheData(); |
| 42 |
| 43 friend class V8Context; |
| 44 friend class CompilationCache; |
| 45 DISALLOW_COPY_AND_ASSIGN(CompilationCacheData); |
| 46 }; |
| 34 | 47 |
| 35 // The compilation cache keeps function boilerplates for compiled | 48 // The compilation cache keeps function boilerplates for compiled |
| 36 // scripts and evals. The boilerplates are looked up using the source | 49 // scripts and evals. The boilerplates are looked up using the source |
| 37 // string as the key. For regular expressions the compilation data is cached. | 50 // string as the key. For regular expressions the compilation data is cached. |
| 38 class CompilationCache { | 51 class CompilationCache { |
| 39 public: | 52 public: |
| 40 // Finds the script function boilerplate for a source | 53 // Finds the script function boilerplate for a source |
| 41 // string. Returns an empty handle if the cache doesn't contain a | 54 // string. Returns an empty handle if the cache doesn't contain a |
| 42 // script for the given source string with the right origin. | 55 // script for the given source string with the right origin. |
| 43 static Handle<JSFunction> LookupScript(Handle<String> source, | 56 static Handle<JSFunction> LookupScript(Handle<String> source, |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 // Enable/disable compilation cache. Used by debugger to disable compilation | 102 // Enable/disable compilation cache. Used by debugger to disable compilation |
| 90 // cache during debugging to make sure new scripts are always compiled. | 103 // cache during debugging to make sure new scripts are always compiled. |
| 91 static void Enable(); | 104 static void Enable(); |
| 92 static void Disable(); | 105 static void Disable(); |
| 93 }; | 106 }; |
| 94 | 107 |
| 95 | 108 |
| 96 } } // namespace v8::internal | 109 } } // namespace v8::internal |
| 97 | 110 |
| 98 #endif // V8_COMPILATION_CACHE_H_ | 111 #endif // V8_COMPILATION_CACHE_H_ |
| OLD | NEW |