| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 int generations_; // Number of generations. | 79 int generations_; // Number of generations. |
| 80 Object** tables_; // Compilation cache tables - one for each generation. | 80 Object** tables_; // Compilation cache tables - one for each generation. |
| 81 | 81 |
| 82 DISALLOW_IMPLICIT_CONSTRUCTORS(CompilationSubCache); | 82 DISALLOW_IMPLICIT_CONSTRUCTORS(CompilationSubCache); |
| 83 }; | 83 }; |
| 84 | 84 |
| 85 | 85 |
| 86 // Sub-cache for scripts. | 86 // Sub-cache for scripts. |
| 87 class CompilationCacheScript : public CompilationSubCache { | 87 class CompilationCacheScript : public CompilationSubCache { |
| 88 public: | 88 public: |
| 89 explicit CompilationCacheScript(int generations) | 89 explicit CompilationCacheScript(int generations); |
| 90 : CompilationSubCache(generations) { } | |
| 91 | 90 |
| 92 Handle<SharedFunctionInfo> Lookup(Handle<String> source, | 91 Handle<SharedFunctionInfo> Lookup(Handle<String> source, |
| 93 Handle<Object> name, | 92 Handle<Object> name, |
| 94 int line_offset, | 93 int line_offset, |
| 95 int column_offset); | 94 int column_offset); |
| 96 void Put(Handle<String> source, Handle<SharedFunctionInfo> function_info); | 95 void Put(Handle<String> source, Handle<SharedFunctionInfo> function_info); |
| 97 | 96 |
| 98 private: | 97 private: |
| 99 // Note: Returns a new hash table if operation results in expansion. | 98 // Note: Returns a new hash table if operation results in expansion. |
| 100 Handle<CompilationCacheTable> TablePut( | 99 Handle<CompilationCacheTable> TablePut( |
| 101 Handle<String> source, Handle<SharedFunctionInfo> function_info); | 100 Handle<String> source, Handle<SharedFunctionInfo> function_info); |
| 102 | 101 |
| 103 bool HasOrigin(Handle<SharedFunctionInfo> function_info, | 102 bool HasOrigin(Handle<SharedFunctionInfo> function_info, |
| 104 Handle<Object> name, | 103 Handle<Object> name, |
| 105 int line_offset, | 104 int line_offset, |
| 106 int column_offset); | 105 int column_offset); |
| 107 | 106 |
| 107 void* script_histogram_; |
| 108 bool script_histogram_initialized_; |
| 109 |
| 108 DISALLOW_IMPLICIT_CONSTRUCTORS(CompilationCacheScript); | 110 DISALLOW_IMPLICIT_CONSTRUCTORS(CompilationCacheScript); |
| 109 }; | 111 }; |
| 110 | 112 |
| 111 | 113 |
| 112 // Sub-cache for eval scripts. | 114 // Sub-cache for eval scripts. |
| 113 class CompilationCacheEval: public CompilationSubCache { | 115 class CompilationCacheEval: public CompilationSubCache { |
| 114 public: | 116 public: |
| 115 explicit CompilationCacheEval(int generations) | 117 explicit CompilationCacheEval(int generations) |
| 116 : CompilationSubCache(generations) { } | 118 : CompilationSubCache(generations) { } |
| 117 | 119 |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 | 237 |
| 236 friend class Isolate; | 238 friend class Isolate; |
| 237 | 239 |
| 238 DISALLOW_COPY_AND_ASSIGN(CompilationCache); | 240 DISALLOW_COPY_AND_ASSIGN(CompilationCache); |
| 239 }; | 241 }; |
| 240 | 242 |
| 241 | 243 |
| 242 } } // namespace v8::internal | 244 } } // namespace v8::internal |
| 243 | 245 |
| 244 #endif // V8_COMPILATION_CACHE_H_ | 246 #endif // V8_COMPILATION_CACHE_H_ |
| OLD | NEW |