OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_COMPILATION_CACHE_H_ | 5 #ifndef V8_COMPILATION_CACHE_H_ |
6 #define V8_COMPILATION_CACHE_H_ | 6 #define V8_COMPILATION_CACHE_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/objects.h" | 9 #include "src/objects.h" |
10 | 10 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 // DebugEvaluateGlobal runtime functions. | 109 // DebugEvaluateGlobal runtime functions. |
110 // 4. The start position of the calling scope. | 110 // 4. The start position of the calling scope. |
111 class CompilationCacheEval: public CompilationSubCache { | 111 class CompilationCacheEval: public CompilationSubCache { |
112 public: | 112 public: |
113 explicit CompilationCacheEval(Isolate* isolate) | 113 explicit CompilationCacheEval(Isolate* isolate) |
114 : CompilationSubCache(isolate, 1) {} | 114 : CompilationSubCache(isolate, 1) {} |
115 | 115 |
116 InfoVectorPair Lookup(Handle<String> source, | 116 InfoVectorPair Lookup(Handle<String> source, |
117 Handle<SharedFunctionInfo> outer_info, | 117 Handle<SharedFunctionInfo> outer_info, |
118 Handle<Context> native_context, | 118 Handle<Context> native_context, |
119 LanguageMode language_mode, int scope_position); | 119 LanguageMode language_mode, int position); |
120 | 120 |
121 void Put(Handle<String> source, Handle<SharedFunctionInfo> outer_info, | 121 void Put(Handle<String> source, Handle<SharedFunctionInfo> outer_info, |
122 Handle<SharedFunctionInfo> function_info, | 122 Handle<SharedFunctionInfo> function_info, |
123 Handle<Context> native_context, Handle<Cell> literals, | 123 Handle<Context> native_context, Handle<Cell> literals, int position); |
124 int scope_position); | |
125 | 124 |
126 private: | 125 private: |
127 DISALLOW_IMPLICIT_CONSTRUCTORS(CompilationCacheEval); | 126 DISALLOW_IMPLICIT_CONSTRUCTORS(CompilationCacheEval); |
128 }; | 127 }; |
129 | 128 |
130 | 129 |
131 // Sub-cache for regular expressions. | 130 // Sub-cache for regular expressions. |
132 class CompilationCacheRegExp: public CompilationSubCache { | 131 class CompilationCacheRegExp: public CompilationSubCache { |
133 public: | 132 public: |
134 CompilationCacheRegExp(Isolate* isolate, int generations) | 133 CompilationCacheRegExp(Isolate* isolate, int generations) |
(...skipping 22 matching lines...) Expand all Loading... |
157 ScriptOriginOptions resource_options, | 156 ScriptOriginOptions resource_options, |
158 Handle<Context> context, | 157 Handle<Context> context, |
159 LanguageMode language_mode); | 158 LanguageMode language_mode); |
160 | 159 |
161 // Finds the shared function info for a source string for eval in a | 160 // Finds the shared function info for a source string for eval in a |
162 // given context. Returns an empty handle if the cache doesn't | 161 // given context. Returns an empty handle if the cache doesn't |
163 // contain a script for the given source string. | 162 // contain a script for the given source string. |
164 InfoVectorPair LookupEval(Handle<String> source, | 163 InfoVectorPair LookupEval(Handle<String> source, |
165 Handle<SharedFunctionInfo> outer_info, | 164 Handle<SharedFunctionInfo> outer_info, |
166 Handle<Context> context, LanguageMode language_mode, | 165 Handle<Context> context, LanguageMode language_mode, |
167 int scope_position); | 166 int position); |
168 | 167 |
169 // Returns the regexp data associated with the given regexp if it | 168 // Returns the regexp data associated with the given regexp if it |
170 // is in cache, otherwise an empty handle. | 169 // is in cache, otherwise an empty handle. |
171 MaybeHandle<FixedArray> LookupRegExp( | 170 MaybeHandle<FixedArray> LookupRegExp( |
172 Handle<String> source, JSRegExp::Flags flags); | 171 Handle<String> source, JSRegExp::Flags flags); |
173 | 172 |
174 // Associate the (source, kind) pair to the shared function | 173 // Associate the (source, kind) pair to the shared function |
175 // info. This may overwrite an existing mapping. | 174 // info. This may overwrite an existing mapping. |
176 void PutScript(Handle<String> source, Handle<Context> context, | 175 void PutScript(Handle<String> source, Handle<Context> context, |
177 LanguageMode language_mode, | 176 LanguageMode language_mode, |
178 Handle<SharedFunctionInfo> function_info, | 177 Handle<SharedFunctionInfo> function_info, |
179 Handle<Cell> literals); | 178 Handle<Cell> literals); |
180 | 179 |
181 // Associate the (source, context->closure()->shared(), kind) triple | 180 // Associate the (source, context->closure()->shared(), kind) triple |
182 // with the shared function info. This may overwrite an existing mapping. | 181 // with the shared function info. This may overwrite an existing mapping. |
183 void PutEval(Handle<String> source, Handle<SharedFunctionInfo> outer_info, | 182 void PutEval(Handle<String> source, Handle<SharedFunctionInfo> outer_info, |
184 Handle<Context> context, | 183 Handle<Context> context, |
185 Handle<SharedFunctionInfo> function_info, Handle<Cell> literals, | 184 Handle<SharedFunctionInfo> function_info, Handle<Cell> literals, |
186 int scope_position); | 185 int position); |
187 | 186 |
188 // Associate the (source, flags) pair to the given regexp data. | 187 // Associate the (source, flags) pair to the given regexp data. |
189 // This may overwrite an existing mapping. | 188 // This may overwrite an existing mapping. |
190 void PutRegExp(Handle<String> source, | 189 void PutRegExp(Handle<String> source, |
191 JSRegExp::Flags flags, | 190 JSRegExp::Flags flags, |
192 Handle<FixedArray> data); | 191 Handle<FixedArray> data); |
193 | 192 |
194 // Clear the cache - also used to initialize the cache at startup. | 193 // Clear the cache - also used to initialize the cache at startup. |
195 void Clear(); | 194 void Clear(); |
196 | 195 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 friend class Isolate; | 237 friend class Isolate; |
239 | 238 |
240 DISALLOW_COPY_AND_ASSIGN(CompilationCache); | 239 DISALLOW_COPY_AND_ASSIGN(CompilationCache); |
241 }; | 240 }; |
242 | 241 |
243 | 242 |
244 } // namespace internal | 243 } // namespace internal |
245 } // namespace v8 | 244 } // namespace v8 |
246 | 245 |
247 #endif // V8_COMPILATION_CACHE_H_ | 246 #endif // V8_COMPILATION_CACHE_H_ |
OLD | NEW |