OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 void CompilationCacheScript::Put(Handle<String> source, | 244 void CompilationCacheScript::Put(Handle<String> source, |
245 Handle<SharedFunctionInfo> function_info) { | 245 Handle<SharedFunctionInfo> function_info) { |
246 HandleScope scope(isolate()); | 246 HandleScope scope(isolate()); |
247 SetFirstTable(TablePut(source, function_info)); | 247 SetFirstTable(TablePut(source, function_info)); |
248 } | 248 } |
249 | 249 |
250 | 250 |
251 Handle<SharedFunctionInfo> CompilationCacheEval::Lookup( | 251 Handle<SharedFunctionInfo> CompilationCacheEval::Lookup( |
252 Handle<String> source, | 252 Handle<String> source, |
253 Handle<Context> context, | 253 Handle<Context> context, |
254 StrictModeFlag strict_mode, | 254 LanguageMode language_mode, |
255 int scope_position) { | 255 int scope_position) { |
256 // Make sure not to leak the table into the surrounding handle | 256 // Make sure not to leak the table into the surrounding handle |
257 // scope. Otherwise, we risk keeping old tables around even after | 257 // scope. Otherwise, we risk keeping old tables around even after |
258 // having cleared the cache. | 258 // having cleared the cache. |
259 Object* result = NULL; | 259 Object* result = NULL; |
260 int generation; | 260 int generation; |
261 { HandleScope scope(isolate()); | 261 { HandleScope scope(isolate()); |
262 for (generation = 0; generation < generations(); generation++) { | 262 for (generation = 0; generation < generations(); generation++) { |
263 Handle<CompilationCacheTable> table = GetTable(generation); | 263 Handle<CompilationCacheTable> table = GetTable(generation); |
264 result = table->LookupEval( | 264 result = table->LookupEval( |
265 *source, *context, strict_mode, scope_position); | 265 *source, *context, language_mode, scope_position); |
266 if (result->IsSharedFunctionInfo()) { | 266 if (result->IsSharedFunctionInfo()) { |
267 break; | 267 break; |
268 } | 268 } |
269 } | 269 } |
270 } | 270 } |
271 if (result->IsSharedFunctionInfo()) { | 271 if (result->IsSharedFunctionInfo()) { |
272 Handle<SharedFunctionInfo> | 272 Handle<SharedFunctionInfo> |
273 function_info(SharedFunctionInfo::cast(result), isolate()); | 273 function_info(SharedFunctionInfo::cast(result), isolate()); |
274 if (generation != 0) { | 274 if (generation != 0) { |
275 Put(source, context, function_info, scope_position); | 275 Put(source, context, function_info, scope_position); |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 } | 389 } |
390 | 390 |
391 return script_.Lookup(source, name, line_offset, column_offset); | 391 return script_.Lookup(source, name, line_offset, column_offset); |
392 } | 392 } |
393 | 393 |
394 | 394 |
395 Handle<SharedFunctionInfo> CompilationCache::LookupEval( | 395 Handle<SharedFunctionInfo> CompilationCache::LookupEval( |
396 Handle<String> source, | 396 Handle<String> source, |
397 Handle<Context> context, | 397 Handle<Context> context, |
398 bool is_global, | 398 bool is_global, |
399 StrictModeFlag strict_mode, | 399 LanguageMode language_mode, |
400 int scope_position) { | 400 int scope_position) { |
401 if (!IsEnabled()) { | 401 if (!IsEnabled()) { |
402 return Handle<SharedFunctionInfo>::null(); | 402 return Handle<SharedFunctionInfo>::null(); |
403 } | 403 } |
404 | 404 |
405 Handle<SharedFunctionInfo> result; | 405 Handle<SharedFunctionInfo> result; |
406 if (is_global) { | 406 if (is_global) { |
407 result = eval_global_.Lookup(source, context, strict_mode, scope_position); | 407 result = eval_global_.Lookup( |
| 408 source, context, language_mode, scope_position); |
408 } else { | 409 } else { |
409 ASSERT(scope_position != RelocInfo::kNoPosition); | 410 ASSERT(scope_position != RelocInfo::kNoPosition); |
410 result = eval_contextual_.Lookup( | 411 result = eval_contextual_.Lookup( |
411 source, context, strict_mode, scope_position); | 412 source, context, language_mode, scope_position); |
412 } | 413 } |
413 return result; | 414 return result; |
414 } | 415 } |
415 | 416 |
416 | 417 |
417 Handle<FixedArray> CompilationCache::LookupRegExp(Handle<String> source, | 418 Handle<FixedArray> CompilationCache::LookupRegExp(Handle<String> source, |
418 JSRegExp::Flags flags) { | 419 JSRegExp::Flags flags) { |
419 if (!IsEnabled()) { | 420 if (!IsEnabled()) { |
420 return Handle<FixedArray>::null(); | 421 return Handle<FixedArray>::null(); |
421 } | 422 } |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 } | 499 } |
499 | 500 |
500 | 501 |
501 void CompilationCache::Disable() { | 502 void CompilationCache::Disable() { |
502 enabled_ = false; | 503 enabled_ = false; |
503 Clear(); | 504 Clear(); |
504 } | 505 } |
505 | 506 |
506 | 507 |
507 } } // namespace v8::internal | 508 } } // namespace v8::internal |
OLD | NEW |