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

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

Issue 196133017: Experimental parser: merge r19949 (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 6 years, 9 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/codegen.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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 DISALLOW_IMPLICIT_CONSTRUCTORS(CompilationCacheScript); 129 DISALLOW_IMPLICIT_CONSTRUCTORS(CompilationCacheScript);
130 }; 130 };
131 131
132 132
133 // 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
134 // 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
135 // considers the following pieces of information when checking for matching 135 // considers the following pieces of information when checking for matching
136 // entries: 136 // entries:
137 // 1. The source string. 137 // 1. The source string.
138 // 2. The shared function info of the calling function. 138 // 2. The shared function info of the calling function.
139 // 3. Whether the source should be compiled as strict code or as non-strict 139 // 3. Whether the source should be compiled as strict code or as sloppy code.
140 // code.
141 // Note: Currently there are clients of CompileEval that always compile 140 // Note: Currently there are clients of CompileEval that always compile
142 // non-strict code even if the calling function is a strict mode function. 141 // sloppy code even if the calling function is a strict mode function.
143 // More specifically these are the CompileString, DebugEvaluate and 142 // More specifically these are the CompileString, DebugEvaluate and
144 // DebugEvaluateGlobal runtime functions. 143 // DebugEvaluateGlobal runtime functions.
145 // 4. The start position of the calling scope. 144 // 4. The start position of the calling scope.
146 class CompilationCacheEval: public CompilationSubCache { 145 class CompilationCacheEval: public CompilationSubCache {
147 public: 146 public:
148 CompilationCacheEval(Isolate* isolate, int generations) 147 CompilationCacheEval(Isolate* isolate, int generations)
149 : CompilationSubCache(isolate, generations) { } 148 : CompilationSubCache(isolate, generations) { }
150 149
151 Handle<SharedFunctionInfo> Lookup(Handle<String> source, 150 Handle<SharedFunctionInfo> Lookup(Handle<String> source,
152 Handle<Context> context, 151 Handle<Context> context,
153 LanguageMode language_mode, 152 StrictMode strict_mode,
154 int scope_position); 153 int scope_position);
155 154
156 void Put(Handle<String> source, 155 void Put(Handle<String> source,
157 Handle<Context> context, 156 Handle<Context> context,
158 Handle<SharedFunctionInfo> function_info, 157 Handle<SharedFunctionInfo> function_info,
159 int scope_position); 158 int scope_position);
160 159
161 private: 160 private:
162 MUST_USE_RESULT MaybeObject* TryTablePut( 161 MUST_USE_RESULT MaybeObject* TryTablePut(
163 Handle<String> source, 162 Handle<String> source,
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 int line_offset, 214 int line_offset,
216 int column_offset, 215 int column_offset,
217 bool is_shared_cross_origin, 216 bool is_shared_cross_origin,
218 Handle<Context> context); 217 Handle<Context> context);
219 218
220 // Finds the shared function info for a source string for eval in a 219 // Finds the shared function info for a source string for eval in a
221 // given context. Returns an empty handle if the cache doesn't 220 // given context. Returns an empty handle if the cache doesn't
222 // contain a script for the given source string. 221 // contain a script for the given source string.
223 Handle<SharedFunctionInfo> LookupEval(Handle<String> source, 222 Handle<SharedFunctionInfo> LookupEval(Handle<String> source,
224 Handle<Context> context, 223 Handle<Context> context,
225 LanguageMode language_mode, 224 StrictMode strict_mode,
226 int scope_position); 225 int scope_position);
227 226
228 // Returns the regexp data associated with the given regexp if it 227 // Returns the regexp data associated with the given regexp if it
229 // is in cache, otherwise an empty handle. 228 // is in cache, otherwise an empty handle.
230 Handle<FixedArray> LookupRegExp(Handle<String> source, 229 Handle<FixedArray> LookupRegExp(Handle<String> source,
231 JSRegExp::Flags flags); 230 JSRegExp::Flags flags);
232 231
233 // Associate the (source, kind) pair to the shared function 232 // Associate the (source, kind) pair to the shared function
234 // info. This may overwrite an existing mapping. 233 // info. This may overwrite an existing mapping.
235 void PutScript(Handle<String> source, 234 void PutScript(Handle<String> source,
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 294
296 friend class Isolate; 295 friend class Isolate;
297 296
298 DISALLOW_COPY_AND_ASSIGN(CompilationCache); 297 DISALLOW_COPY_AND_ASSIGN(CompilationCache);
299 }; 298 };
300 299
301 300
302 } } // namespace v8::internal 301 } } // namespace v8::internal
303 302
304 #endif // V8_COMPILATION_CACHE_H_ 303 #endif // V8_COMPILATION_CACHE_H_
OLDNEW
« no previous file with comments | « src/codegen.cc ('k') | src/compilation-cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698