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

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

Issue 894683003: Introduce LanguageMode, drop StrictMode. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebased (w/ conflicts) Created 5 years, 10 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
« no previous file with comments | « src/compilation-cache.h ('k') | src/compiler.h » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/assembler.h" 7 #include "src/assembler.h"
8 #include "src/compilation-cache.h" 8 #include "src/compilation-cache.h"
9 #include "src/serialize.h" 9 #include "src/serialize.h"
10 10
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 Handle<SharedFunctionInfo> function_info) { 196 Handle<SharedFunctionInfo> function_info) {
197 HandleScope scope(isolate()); 197 HandleScope scope(isolate());
198 Handle<CompilationCacheTable> table = GetFirstTable(); 198 Handle<CompilationCacheTable> table = GetFirstTable();
199 SetFirstTable( 199 SetFirstTable(
200 CompilationCacheTable::Put(table, source, context, function_info)); 200 CompilationCacheTable::Put(table, source, context, function_info));
201 } 201 }
202 202
203 203
204 MaybeHandle<SharedFunctionInfo> CompilationCacheEval::Lookup( 204 MaybeHandle<SharedFunctionInfo> CompilationCacheEval::Lookup(
205 Handle<String> source, Handle<SharedFunctionInfo> outer_info, 205 Handle<String> source, Handle<SharedFunctionInfo> outer_info,
206 StrictMode strict_mode, int scope_position) { 206 LanguageMode language_mode, int scope_position) {
207 HandleScope scope(isolate()); 207 HandleScope scope(isolate());
208 // Make sure not to leak the table into the surrounding handle 208 // Make sure not to leak the table into the surrounding handle
209 // scope. Otherwise, we risk keeping old tables around even after 209 // scope. Otherwise, we risk keeping old tables around even after
210 // having cleared the cache. 210 // having cleared the cache.
211 Handle<Object> result = isolate()->factory()->undefined_value(); 211 Handle<Object> result = isolate()->factory()->undefined_value();
212 int generation; 212 int generation;
213 for (generation = 0; generation < generations(); generation++) { 213 for (generation = 0; generation < generations(); generation++) {
214 Handle<CompilationCacheTable> table = GetTable(generation); 214 Handle<CompilationCacheTable> table = GetTable(generation);
215 result = table->LookupEval(source, outer_info, strict_mode, scope_position); 215 result =
216 table->LookupEval(source, outer_info, language_mode, scope_position);
216 if (result->IsSharedFunctionInfo()) break; 217 if (result->IsSharedFunctionInfo()) break;
217 } 218 }
218 if (result->IsSharedFunctionInfo()) { 219 if (result->IsSharedFunctionInfo()) {
219 Handle<SharedFunctionInfo> function_info = 220 Handle<SharedFunctionInfo> function_info =
220 Handle<SharedFunctionInfo>::cast(result); 221 Handle<SharedFunctionInfo>::cast(result);
221 if (generation != 0) { 222 if (generation != 0) {
222 Put(source, outer_info, function_info, scope_position); 223 Put(source, outer_info, function_info, scope_position);
223 } 224 }
224 isolate()->counters()->compilation_cache_hits()->Increment(); 225 isolate()->counters()->compilation_cache_hits()->Increment();
225 return scope.CloseAndEscape(function_info); 226 return scope.CloseAndEscape(function_info);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 if (!IsEnabled()) return MaybeHandle<SharedFunctionInfo>(); 296 if (!IsEnabled()) return MaybeHandle<SharedFunctionInfo>();
296 297
297 return script_.Lookup(source, name, line_offset, column_offset, 298 return script_.Lookup(source, name, line_offset, column_offset,
298 is_embedder_debug_script, is_shared_cross_origin, 299 is_embedder_debug_script, is_shared_cross_origin,
299 context); 300 context);
300 } 301 }
301 302
302 303
303 MaybeHandle<SharedFunctionInfo> CompilationCache::LookupEval( 304 MaybeHandle<SharedFunctionInfo> CompilationCache::LookupEval(
304 Handle<String> source, Handle<SharedFunctionInfo> outer_info, 305 Handle<String> source, Handle<SharedFunctionInfo> outer_info,
305 Handle<Context> context, StrictMode strict_mode, int scope_position) { 306 Handle<Context> context, LanguageMode language_mode, int scope_position) {
306 if (!IsEnabled()) return MaybeHandle<SharedFunctionInfo>(); 307 if (!IsEnabled()) return MaybeHandle<SharedFunctionInfo>();
307 308
308 MaybeHandle<SharedFunctionInfo> result; 309 MaybeHandle<SharedFunctionInfo> result;
309 if (context->IsNativeContext()) { 310 if (context->IsNativeContext()) {
310 result = 311 result =
311 eval_global_.Lookup(source, outer_info, strict_mode, scope_position); 312 eval_global_.Lookup(source, outer_info, language_mode, scope_position);
312 } else { 313 } else {
313 DCHECK(scope_position != RelocInfo::kNoPosition); 314 DCHECK(scope_position != RelocInfo::kNoPosition);
314 result = eval_contextual_.Lookup(source, outer_info, strict_mode, 315 result = eval_contextual_.Lookup(source, outer_info, language_mode,
315 scope_position); 316 scope_position);
316 } 317 }
317 return result; 318 return result;
318 } 319 }
319 320
320 321
321 MaybeHandle<FixedArray> CompilationCache::LookupRegExp(Handle<String> source, 322 MaybeHandle<FixedArray> CompilationCache::LookupRegExp(Handle<String> source,
322 JSRegExp::Flags flags) { 323 JSRegExp::Flags flags) {
323 if (!IsEnabled()) return MaybeHandle<FixedArray>(); 324 if (!IsEnabled()) return MaybeHandle<FixedArray>();
324 325
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 } 398 }
398 399
399 400
400 void CompilationCache::Disable() { 401 void CompilationCache::Disable() {
401 enabled_ = false; 402 enabled_ = false;
402 Clear(); 403 Clear();
403 } 404 }
404 405
405 406
406 } } // namespace v8::internal 407 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/compilation-cache.h ('k') | src/compiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698