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 namespace v8 { | 8 namespace v8 { |
9 namespace internal { | 9 namespace internal { |
10 | 10 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 | 69 |
70 // Sub-cache for scripts. | 70 // Sub-cache for scripts. |
71 class CompilationCacheScript : public CompilationSubCache { | 71 class CompilationCacheScript : public CompilationSubCache { |
72 public: | 72 public: |
73 CompilationCacheScript(Isolate* isolate, int generations); | 73 CompilationCacheScript(Isolate* isolate, int generations); |
74 | 74 |
75 Handle<SharedFunctionInfo> Lookup(Handle<String> source, Handle<Object> name, | 75 Handle<SharedFunctionInfo> Lookup(Handle<String> source, Handle<Object> name, |
76 int line_offset, int column_offset, | 76 int line_offset, int column_offset, |
77 bool is_embedder_debug_script, | 77 bool is_embedder_debug_script, |
78 bool is_shared_cross_origin, | 78 bool is_shared_cross_origin, |
79 Handle<Context> context); | 79 Handle<Context> context, |
| 80 LanguageMode language_mode); |
80 void Put(Handle<String> source, | 81 void Put(Handle<String> source, |
81 Handle<Context> context, | 82 Handle<Context> context, |
| 83 LanguageMode language_mode, |
82 Handle<SharedFunctionInfo> function_info); | 84 Handle<SharedFunctionInfo> function_info); |
83 | 85 |
84 private: | 86 private: |
85 bool HasOrigin(Handle<SharedFunctionInfo> function_info, Handle<Object> name, | 87 bool HasOrigin(Handle<SharedFunctionInfo> function_info, Handle<Object> name, |
86 int line_offset, int column_offset, | 88 int line_offset, int column_offset, |
87 bool is_embedder_debug_script, bool is_shared_cross_origin); | 89 bool is_embedder_debug_script, bool is_shared_cross_origin); |
88 | 90 |
89 DISALLOW_IMPLICIT_CONSTRUCTORS(CompilationCacheScript); | 91 DISALLOW_IMPLICIT_CONSTRUCTORS(CompilationCacheScript); |
90 }; | 92 }; |
91 | 93 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 // the source string as the key. For regular expressions the | 143 // the source string as the key. For regular expressions the |
142 // compilation data is cached. | 144 // compilation data is cached. |
143 class CompilationCache { | 145 class CompilationCache { |
144 public: | 146 public: |
145 // Finds the script shared function info for a source | 147 // Finds the script shared function info for a source |
146 // string. Returns an empty handle if the cache doesn't contain a | 148 // string. Returns an empty handle if the cache doesn't contain a |
147 // script for the given source string with the right origin. | 149 // script for the given source string with the right origin. |
148 MaybeHandle<SharedFunctionInfo> LookupScript( | 150 MaybeHandle<SharedFunctionInfo> LookupScript( |
149 Handle<String> source, Handle<Object> name, int line_offset, | 151 Handle<String> source, Handle<Object> name, int line_offset, |
150 int column_offset, bool is_embedder_debug_script, | 152 int column_offset, bool is_embedder_debug_script, |
151 bool is_shared_cross_origin, Handle<Context> context); | 153 bool is_shared_cross_origin, Handle<Context> context, |
| 154 LanguageMode language_mode); |
152 | 155 |
153 // Finds the shared function info for a source string for eval in a | 156 // Finds the shared function info for a source string for eval in a |
154 // given context. Returns an empty handle if the cache doesn't | 157 // given context. Returns an empty handle if the cache doesn't |
155 // contain a script for the given source string. | 158 // contain a script for the given source string. |
156 MaybeHandle<SharedFunctionInfo> LookupEval( | 159 MaybeHandle<SharedFunctionInfo> LookupEval( |
157 Handle<String> source, Handle<SharedFunctionInfo> outer_info, | 160 Handle<String> source, Handle<SharedFunctionInfo> outer_info, |
158 Handle<Context> context, LanguageMode language_mode, int scope_position); | 161 Handle<Context> context, LanguageMode language_mode, int scope_position); |
159 | 162 |
160 // Returns the regexp data associated with the given regexp if it | 163 // Returns the regexp data associated with the given regexp if it |
161 // is in cache, otherwise an empty handle. | 164 // is in cache, otherwise an empty handle. |
162 MaybeHandle<FixedArray> LookupRegExp( | 165 MaybeHandle<FixedArray> LookupRegExp( |
163 Handle<String> source, JSRegExp::Flags flags); | 166 Handle<String> source, JSRegExp::Flags flags); |
164 | 167 |
165 // Associate the (source, kind) pair to the shared function | 168 // Associate the (source, kind) pair to the shared function |
166 // info. This may overwrite an existing mapping. | 169 // info. This may overwrite an existing mapping. |
167 void PutScript(Handle<String> source, | 170 void PutScript(Handle<String> source, |
168 Handle<Context> context, | 171 Handle<Context> context, |
| 172 LanguageMode language_mode, |
169 Handle<SharedFunctionInfo> function_info); | 173 Handle<SharedFunctionInfo> function_info); |
170 | 174 |
171 // Associate the (source, context->closure()->shared(), kind) triple | 175 // Associate the (source, context->closure()->shared(), kind) triple |
172 // with the shared function info. This may overwrite an existing mapping. | 176 // with the shared function info. This may overwrite an existing mapping. |
173 void PutEval(Handle<String> source, Handle<SharedFunctionInfo> outer_info, | 177 void PutEval(Handle<String> source, Handle<SharedFunctionInfo> outer_info, |
174 Handle<Context> context, | 178 Handle<Context> context, |
175 Handle<SharedFunctionInfo> function_info, int scope_position); | 179 Handle<SharedFunctionInfo> function_info, int scope_position); |
176 | 180 |
177 // Associate the (source, flags) pair to the given regexp data. | 181 // Associate the (source, flags) pair to the given regexp data. |
178 // This may overwrite an existing mapping. | 182 // This may overwrite an existing mapping. |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 | 230 |
227 friend class Isolate; | 231 friend class Isolate; |
228 | 232 |
229 DISALLOW_COPY_AND_ASSIGN(CompilationCache); | 233 DISALLOW_COPY_AND_ASSIGN(CompilationCache); |
230 }; | 234 }; |
231 | 235 |
232 | 236 |
233 } } // namespace v8::internal | 237 } } // namespace v8::internal |
234 | 238 |
235 #endif // V8_COMPILATION_CACHE_H_ | 239 #endif // V8_COMPILATION_CACHE_H_ |
OLD | NEW |