OLD | NEW |
1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 void CompilationCacheScript::Put(Handle<String> source, | 243 void CompilationCacheScript::Put(Handle<String> source, |
244 Handle<SharedFunctionInfo> function_info) { | 244 Handle<SharedFunctionInfo> function_info) { |
245 HandleScope scope(isolate()); | 245 HandleScope scope(isolate()); |
246 SetFirstTable(TablePut(source, function_info)); | 246 SetFirstTable(TablePut(source, function_info)); |
247 } | 247 } |
248 | 248 |
249 | 249 |
250 Handle<SharedFunctionInfo> CompilationCacheEval::Lookup( | 250 Handle<SharedFunctionInfo> CompilationCacheEval::Lookup( |
251 Handle<String> source, | 251 Handle<String> source, |
252 Handle<Context> context, | 252 Handle<Context> context, |
253 StrictModeFlag strict_mode) { | 253 LanguageMode language_mode) { |
254 // Make sure not to leak the table into the surrounding handle | 254 // Make sure not to leak the table into the surrounding handle |
255 // scope. Otherwise, we risk keeping old tables around even after | 255 // scope. Otherwise, we risk keeping old tables around even after |
256 // having cleared the cache. | 256 // having cleared the cache. |
257 Object* result = NULL; | 257 Object* result = NULL; |
258 int generation; | 258 int generation; |
259 { HandleScope scope(isolate()); | 259 { HandleScope scope(isolate()); |
260 for (generation = 0; generation < generations(); generation++) { | 260 for (generation = 0; generation < generations(); generation++) { |
261 Handle<CompilationCacheTable> table = GetTable(generation); | 261 Handle<CompilationCacheTable> table = GetTable(generation); |
262 result = table->LookupEval(*source, *context, strict_mode); | 262 result = table->LookupEval(*source, *context, language_mode); |
263 if (result->IsSharedFunctionInfo()) { | 263 if (result->IsSharedFunctionInfo()) { |
264 break; | 264 break; |
265 } | 265 } |
266 } | 266 } |
267 } | 267 } |
268 if (result->IsSharedFunctionInfo()) { | 268 if (result->IsSharedFunctionInfo()) { |
269 Handle<SharedFunctionInfo> | 269 Handle<SharedFunctionInfo> |
270 function_info(SharedFunctionInfo::cast(result), isolate()); | 270 function_info(SharedFunctionInfo::cast(result), isolate()); |
271 if (generation != 0) { | 271 if (generation != 0) { |
272 Put(source, context, function_info); | 272 Put(source, context, function_info); |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 } | 382 } |
383 | 383 |
384 return script_.Lookup(source, name, line_offset, column_offset); | 384 return script_.Lookup(source, name, line_offset, column_offset); |
385 } | 385 } |
386 | 386 |
387 | 387 |
388 Handle<SharedFunctionInfo> CompilationCache::LookupEval( | 388 Handle<SharedFunctionInfo> CompilationCache::LookupEval( |
389 Handle<String> source, | 389 Handle<String> source, |
390 Handle<Context> context, | 390 Handle<Context> context, |
391 bool is_global, | 391 bool is_global, |
392 StrictModeFlag strict_mode) { | 392 LanguageMode language_mode) { |
393 if (!IsEnabled()) { | 393 if (!IsEnabled()) { |
394 return Handle<SharedFunctionInfo>::null(); | 394 return Handle<SharedFunctionInfo>::null(); |
395 } | 395 } |
396 | 396 |
397 Handle<SharedFunctionInfo> result; | 397 Handle<SharedFunctionInfo> result; |
398 if (is_global) { | 398 if (is_global) { |
399 result = eval_global_.Lookup(source, context, strict_mode); | 399 result = eval_global_.Lookup(source, context, language_mode); |
400 } else { | 400 } else { |
401 result = eval_contextual_.Lookup(source, context, strict_mode); | 401 result = eval_contextual_.Lookup(source, context, language_mode); |
402 } | 402 } |
403 return result; | 403 return result; |
404 } | 404 } |
405 | 405 |
406 | 406 |
407 Handle<FixedArray> CompilationCache::LookupRegExp(Handle<String> source, | 407 Handle<FixedArray> CompilationCache::LookupRegExp(Handle<String> source, |
408 JSRegExp::Flags flags) { | 408 JSRegExp::Flags flags) { |
409 if (!IsEnabled()) { | 409 if (!IsEnabled()) { |
410 return Handle<FixedArray>::null(); | 410 return Handle<FixedArray>::null(); |
411 } | 411 } |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 } | 486 } |
487 | 487 |
488 | 488 |
489 void CompilationCache::Disable() { | 489 void CompilationCache::Disable() { |
490 enabled_ = false; | 490 enabled_ = false; |
491 Clear(); | 491 Clear(); |
492 } | 492 } |
493 | 493 |
494 | 494 |
495 } } // namespace v8::internal | 495 } } // namespace v8::internal |
OLD | NEW |