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

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

Issue 678843004: Use shared function info for eval cache key. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 1 month 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/arm64/full-codegen-arm64.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 // 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 // sloppy code even if the calling function is a strict mode function. 107 // sloppy code even if the calling function is a strict mode function.
108 // More specifically these are the CompileString, DebugEvaluate and 108 // More specifically these are the CompileString, DebugEvaluate and
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 CompilationCacheEval(Isolate* isolate, int generations) 113 CompilationCacheEval(Isolate* isolate, int generations)
114 : CompilationSubCache(isolate, generations) { } 114 : CompilationSubCache(isolate, generations) { }
115 115
116 MaybeHandle<SharedFunctionInfo> Lookup(Handle<String> source, 116 MaybeHandle<SharedFunctionInfo> Lookup(Handle<String> source,
117 Handle<Context> context, 117 Handle<SharedFunctionInfo> outer_info,
118 StrictMode strict_mode, 118 StrictMode strict_mode,
119 int scope_position); 119 int scope_position);
120 120
121 void Put(Handle<String> source, 121 void Put(Handle<String> source, Handle<SharedFunctionInfo> outer_info,
122 Handle<Context> context, 122 Handle<SharedFunctionInfo> function_info, int scope_position);
123 Handle<SharedFunctionInfo> function_info,
124 int scope_position);
125 123
126 private: 124 private:
127 DISALLOW_IMPLICIT_CONSTRUCTORS(CompilationCacheEval); 125 DISALLOW_IMPLICIT_CONSTRUCTORS(CompilationCacheEval);
128 }; 126 };
129 127
130 128
131 // Sub-cache for regular expressions. 129 // Sub-cache for regular expressions.
132 class CompilationCacheRegExp: public CompilationSubCache { 130 class CompilationCacheRegExp: public CompilationSubCache {
133 public: 131 public:
134 CompilationCacheRegExp(Isolate* isolate, int generations) 132 CompilationCacheRegExp(Isolate* isolate, int generations)
(...skipping 19 matching lines...) Expand all
154 // string. Returns an empty handle if the cache doesn't contain a 152 // string. Returns an empty handle if the cache doesn't contain a
155 // script for the given source string with the right origin. 153 // script for the given source string with the right origin.
156 MaybeHandle<SharedFunctionInfo> LookupScript( 154 MaybeHandle<SharedFunctionInfo> LookupScript(
157 Handle<String> source, Handle<Object> name, int line_offset, 155 Handle<String> source, Handle<Object> name, int line_offset,
158 int column_offset, bool is_shared_cross_origin, Handle<Context> context); 156 int column_offset, bool is_shared_cross_origin, Handle<Context> context);
159 157
160 // Finds the shared function info for a source string for eval in a 158 // Finds the shared function info for a source string for eval in a
161 // given context. Returns an empty handle if the cache doesn't 159 // given context. Returns an empty handle if the cache doesn't
162 // contain a script for the given source string. 160 // contain a script for the given source string.
163 MaybeHandle<SharedFunctionInfo> LookupEval( 161 MaybeHandle<SharedFunctionInfo> LookupEval(
164 Handle<String> source, Handle<Context> context, StrictMode strict_mode, 162 Handle<String> source, Handle<SharedFunctionInfo> outer_info,
165 int scope_position); 163 Handle<Context> context, StrictMode strict_mode, int scope_position);
166 164
167 // Returns the regexp data associated with the given regexp if it 165 // Returns the regexp data associated with the given regexp if it
168 // is in cache, otherwise an empty handle. 166 // is in cache, otherwise an empty handle.
169 MaybeHandle<FixedArray> LookupRegExp( 167 MaybeHandle<FixedArray> LookupRegExp(
170 Handle<String> source, JSRegExp::Flags flags); 168 Handle<String> source, JSRegExp::Flags flags);
171 169
172 // Associate the (source, kind) pair to the shared function 170 // Associate the (source, kind) pair to the shared function
173 // info. This may overwrite an existing mapping. 171 // info. This may overwrite an existing mapping.
174 void PutScript(Handle<String> source, 172 void PutScript(Handle<String> source,
175 Handle<Context> context, 173 Handle<Context> context,
176 Handle<SharedFunctionInfo> function_info); 174 Handle<SharedFunctionInfo> function_info);
177 175
178 // Associate the (source, context->closure()->shared(), kind) triple 176 // Associate the (source, context->closure()->shared(), kind) triple
179 // with the shared function info. This may overwrite an existing mapping. 177 // with the shared function info. This may overwrite an existing mapping.
180 void PutEval(Handle<String> source, 178 void PutEval(Handle<String> source, Handle<SharedFunctionInfo> outer_info,
181 Handle<Context> context, 179 Handle<Context> context,
182 Handle<SharedFunctionInfo> function_info, 180 Handle<SharedFunctionInfo> function_info, int scope_position);
183 int scope_position);
184 181
185 // Associate the (source, flags) pair to the given regexp data. 182 // Associate the (source, flags) pair to the given regexp data.
186 // This may overwrite an existing mapping. 183 // This may overwrite an existing mapping.
187 void PutRegExp(Handle<String> source, 184 void PutRegExp(Handle<String> source,
188 JSRegExp::Flags flags, 185 JSRegExp::Flags flags,
189 Handle<FixedArray> data); 186 Handle<FixedArray> data);
190 187
191 // Clear the cache - also used to initialize the cache at startup. 188 // Clear the cache - also used to initialize the cache at startup.
192 void Clear(); 189 void Clear();
193 190
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 231
235 friend class Isolate; 232 friend class Isolate;
236 233
237 DISALLOW_COPY_AND_ASSIGN(CompilationCache); 234 DISALLOW_COPY_AND_ASSIGN(CompilationCache);
238 }; 235 };
239 236
240 237
241 } } // namespace v8::internal 238 } } // namespace v8::internal
242 239
243 #endif // V8_COMPILATION_CACHE_H_ 240 #endif // V8_COMPILATION_CACHE_H_
OLDNEW
« no previous file with comments | « src/arm64/full-codegen-arm64.cc ('k') | src/compilation-cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698