Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(149)

Side by Side Diff: src/compilation-cache.h

Issue 10878007: Index script compilation cache over context (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Respect language flags. Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/bootstrapper.cc ('k') | src/compilation-cache.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 91
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 void Put(Handle<String> source, Handle<SharedFunctionInfo> function_info); 102 Handle<Context> context);
103 void Put(Handle<String> source,
104 Handle<Context> context,
105 Handle<SharedFunctionInfo> function_info);
103 106
104 private: 107 private:
105 MUST_USE_RESULT MaybeObject* TryTablePut( 108 MUST_USE_RESULT MaybeObject* TryTablePut(
106 Handle<String> source, Handle<SharedFunctionInfo> function_info); 109 Handle<String> source,
110 Handle<Context> context,
111 Handle<SharedFunctionInfo> function_info);
107 112
108 // Note: Returns a new hash table if operation results in expansion. 113 // Note: Returns a new hash table if operation results in expansion.
109 Handle<CompilationCacheTable> TablePut( 114 Handle<CompilationCacheTable> TablePut(
110 Handle<String> source, Handle<SharedFunctionInfo> function_info); 115 Handle<String> source,
116 Handle<Context> context,
117 Handle<SharedFunctionInfo> function_info);
111 118
112 bool HasOrigin(Handle<SharedFunctionInfo> function_info, 119 bool HasOrigin(Handle<SharedFunctionInfo> function_info,
113 Handle<Object> name, 120 Handle<Object> name,
114 int line_offset, 121 int line_offset,
115 int column_offset); 122 int column_offset);
116 123
117 void* script_histogram_; 124 void* script_histogram_;
118 bool script_histogram_initialized_; 125 bool script_histogram_initialized_;
119 126
120 DISALLOW_IMPLICIT_CONSTRUCTORS(CompilationCacheScript); 127 DISALLOW_IMPLICIT_CONSTRUCTORS(CompilationCacheScript);
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 // the source string as the key. For regular expressions the 204 // the source string as the key. For regular expressions the
198 // compilation data is cached. 205 // compilation data is cached.
199 class CompilationCache { 206 class CompilationCache {
200 public: 207 public:
201 // Finds the script shared function info for a source 208 // Finds the script shared function info for a source
202 // string. Returns an empty handle if the cache doesn't contain a 209 // string. Returns an empty handle if the cache doesn't contain a
203 // script for the given source string with the right origin. 210 // script for the given source string with the right origin.
204 Handle<SharedFunctionInfo> LookupScript(Handle<String> source, 211 Handle<SharedFunctionInfo> LookupScript(Handle<String> source,
205 Handle<Object> name, 212 Handle<Object> name,
206 int line_offset, 213 int line_offset,
207 int column_offset); 214 int column_offset,
215 Handle<Context> context);
208 216
209 // Finds the shared function info for a source string for eval in a 217 // Finds the shared function info for a source string for eval in a
210 // given context. Returns an empty handle if the cache doesn't 218 // given context. Returns an empty handle if the cache doesn't
211 // contain a script for the given source string. 219 // contain a script for the given source string.
212 Handle<SharedFunctionInfo> LookupEval(Handle<String> source, 220 Handle<SharedFunctionInfo> LookupEval(Handle<String> source,
213 Handle<Context> context, 221 Handle<Context> context,
214 bool is_global, 222 bool is_global,
215 LanguageMode language_mode, 223 LanguageMode language_mode,
216 int scope_position); 224 int scope_position);
217 225
218 // Returns the regexp data associated with the given regexp if it 226 // Returns the regexp data associated with the given regexp if it
219 // is in cache, otherwise an empty handle. 227 // is in cache, otherwise an empty handle.
220 Handle<FixedArray> LookupRegExp(Handle<String> source, 228 Handle<FixedArray> LookupRegExp(Handle<String> source,
221 JSRegExp::Flags flags); 229 JSRegExp::Flags flags);
222 230
223 // Associate the (source, kind) pair to the shared function 231 // Associate the (source, kind) pair to the shared function
224 // info. This may overwrite an existing mapping. 232 // info. This may overwrite an existing mapping.
225 void PutScript(Handle<String> source, 233 void PutScript(Handle<String> source,
234 Handle<Context> context,
226 Handle<SharedFunctionInfo> function_info); 235 Handle<SharedFunctionInfo> function_info);
227 236
228 // Associate the (source, context->closure()->shared(), kind) triple 237 // Associate the (source, context->closure()->shared(), kind) triple
229 // with the shared function info. This may overwrite an existing mapping. 238 // with the shared function info. This may overwrite an existing mapping.
230 void PutEval(Handle<String> source, 239 void PutEval(Handle<String> source,
231 Handle<Context> context, 240 Handle<Context> context,
232 bool is_global, 241 bool is_global,
233 Handle<SharedFunctionInfo> function_info, 242 Handle<SharedFunctionInfo> function_info,
234 int scope_position); 243 int scope_position);
235 244
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 294
286 friend class Isolate; 295 friend class Isolate;
287 296
288 DISALLOW_COPY_AND_ASSIGN(CompilationCache); 297 DISALLOW_COPY_AND_ASSIGN(CompilationCache);
289 }; 298 };
290 299
291 300
292 } } // namespace v8::internal 301 } } // namespace v8::internal
293 302
294 #endif // V8_COMPILATION_CACHE_H_ 303 #endif // V8_COMPILATION_CACHE_H_
OLDNEW
« no previous file with comments | « src/bootstrapper.cc ('k') | src/compilation-cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698