| 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 | 92 |
| 93 // Sub-cache for scripts. | 93 // Sub-cache for scripts. |
| 94 class CompilationCacheScript : public CompilationSubCache { | 94 class CompilationCacheScript : public CompilationSubCache { |
| 95 public: | 95 public: |
| 96 CompilationCacheScript(Isolate* isolate, int generations); | 96 CompilationCacheScript(Isolate* isolate, int generations); |
| 97 | 97 |
| 98 Handle<SharedFunctionInfo> Lookup(Handle<String> source, | 98 Handle<SharedFunctionInfo> Lookup(Handle<String> source, |
| 99 Handle<Object> name, | 99 Handle<Object> name, |
| 100 int line_offset, | 100 int line_offset, |
| 101 int column_offset, | 101 int column_offset, |
| 102 bool is_shared_cross_origin, |
| 102 Handle<Context> context); | 103 Handle<Context> context); |
| 103 void Put(Handle<String> source, | 104 void Put(Handle<String> source, |
| 104 Handle<Context> context, | 105 Handle<Context> context, |
| 105 Handle<SharedFunctionInfo> function_info); | 106 Handle<SharedFunctionInfo> function_info); |
| 106 | 107 |
| 107 private: | 108 private: |
| 108 MUST_USE_RESULT MaybeObject* TryTablePut( | 109 MUST_USE_RESULT MaybeObject* TryTablePut( |
| 109 Handle<String> source, | 110 Handle<String> source, |
| 110 Handle<Context> context, | 111 Handle<Context> context, |
| 111 Handle<SharedFunctionInfo> function_info); | 112 Handle<SharedFunctionInfo> function_info); |
| 112 | 113 |
| 113 // Note: Returns a new hash table if operation results in expansion. | 114 // Note: Returns a new hash table if operation results in expansion. |
| 114 Handle<CompilationCacheTable> TablePut( | 115 Handle<CompilationCacheTable> TablePut( |
| 115 Handle<String> source, | 116 Handle<String> source, |
| 116 Handle<Context> context, | 117 Handle<Context> context, |
| 117 Handle<SharedFunctionInfo> function_info); | 118 Handle<SharedFunctionInfo> function_info); |
| 118 | 119 |
| 119 bool HasOrigin(Handle<SharedFunctionInfo> function_info, | 120 bool HasOrigin(Handle<SharedFunctionInfo> function_info, |
| 120 Handle<Object> name, | 121 Handle<Object> name, |
| 121 int line_offset, | 122 int line_offset, |
| 122 int column_offset); | 123 int column_offset, |
| 124 bool is_shared_cross_origin); |
| 123 | 125 |
| 124 void* script_histogram_; | 126 void* script_histogram_; |
| 125 bool script_histogram_initialized_; | 127 bool script_histogram_initialized_; |
| 126 | 128 |
| 127 DISALLOW_IMPLICIT_CONSTRUCTORS(CompilationCacheScript); | 129 DISALLOW_IMPLICIT_CONSTRUCTORS(CompilationCacheScript); |
| 128 }; | 130 }; |
| 129 | 131 |
| 130 | 132 |
| 131 // Sub-cache for eval scripts. Two caches for eval are used. One for eval calls | 133 // Sub-cache for eval scripts. Two caches for eval are used. One for eval calls |
| 132 // in native contexts and one for eval calls in other contexts. The cache | 134 // in native contexts and one for eval calls in other contexts. The cache |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 // compilation data is cached. | 207 // compilation data is cached. |
| 206 class CompilationCache { | 208 class CompilationCache { |
| 207 public: | 209 public: |
| 208 // Finds the script shared function info for a source | 210 // Finds the script shared function info for a source |
| 209 // string. Returns an empty handle if the cache doesn't contain a | 211 // string. Returns an empty handle if the cache doesn't contain a |
| 210 // script for the given source string with the right origin. | 212 // script for the given source string with the right origin. |
| 211 Handle<SharedFunctionInfo> LookupScript(Handle<String> source, | 213 Handle<SharedFunctionInfo> LookupScript(Handle<String> source, |
| 212 Handle<Object> name, | 214 Handle<Object> name, |
| 213 int line_offset, | 215 int line_offset, |
| 214 int column_offset, | 216 int column_offset, |
| 217 bool is_shared_cross_origin, |
| 215 Handle<Context> context); | 218 Handle<Context> context); |
| 216 | 219 |
| 217 // Finds the shared function info for a source string for eval in a | 220 // Finds the shared function info for a source string for eval in a |
| 218 // given context. Returns an empty handle if the cache doesn't | 221 // given context. Returns an empty handle if the cache doesn't |
| 219 // contain a script for the given source string. | 222 // contain a script for the given source string. |
| 220 Handle<SharedFunctionInfo> LookupEval(Handle<String> source, | 223 Handle<SharedFunctionInfo> LookupEval(Handle<String> source, |
| 221 Handle<Context> context, | 224 Handle<Context> context, |
| 222 bool is_global, | 225 bool is_global, |
| 223 LanguageMode language_mode, | 226 LanguageMode language_mode, |
| 224 int scope_position); | 227 int scope_position); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 | 297 |
| 295 friend class Isolate; | 298 friend class Isolate; |
| 296 | 299 |
| 297 DISALLOW_COPY_AND_ASSIGN(CompilationCache); | 300 DISALLOW_COPY_AND_ASSIGN(CompilationCache); |
| 298 }; | 301 }; |
| 299 | 302 |
| 300 | 303 |
| 301 } } // namespace v8::internal | 304 } } // namespace v8::internal |
| 302 | 305 |
| 303 #endif // V8_COMPILATION_CACHE_H_ | 306 #endif // V8_COMPILATION_CACHE_H_ |
| OLD | NEW |