| 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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 Handle<Context> context, | 262 Handle<Context> context, |
| 263 Handle<SharedFunctionInfo> function_info) { | 263 Handle<SharedFunctionInfo> function_info) { |
| 264 HandleScope scope(isolate()); | 264 HandleScope scope(isolate()); |
| 265 SetFirstTable(TablePut(source, context, function_info)); | 265 SetFirstTable(TablePut(source, context, function_info)); |
| 266 } | 266 } |
| 267 | 267 |
| 268 | 268 |
| 269 Handle<SharedFunctionInfo> CompilationCacheEval::Lookup( | 269 Handle<SharedFunctionInfo> CompilationCacheEval::Lookup( |
| 270 Handle<String> source, | 270 Handle<String> source, |
| 271 Handle<Context> context, | 271 Handle<Context> context, |
| 272 LanguageMode language_mode, | 272 StrictMode strict_mode, |
| 273 int scope_position) { | 273 int scope_position) { |
| 274 // Make sure not to leak the table into the surrounding handle | 274 // Make sure not to leak the table into the surrounding handle |
| 275 // scope. Otherwise, we risk keeping old tables around even after | 275 // scope. Otherwise, we risk keeping old tables around even after |
| 276 // having cleared the cache. | 276 // having cleared the cache. |
| 277 Object* result = NULL; | 277 Object* result = NULL; |
| 278 int generation; | 278 int generation; |
| 279 { HandleScope scope(isolate()); | 279 { HandleScope scope(isolate()); |
| 280 for (generation = 0; generation < generations(); generation++) { | 280 for (generation = 0; generation < generations(); generation++) { |
| 281 Handle<CompilationCacheTable> table = GetTable(generation); | 281 Handle<CompilationCacheTable> table = GetTable(generation); |
| 282 result = table->LookupEval( | 282 result = table->LookupEval( |
| 283 *source, *context, language_mode, scope_position); | 283 *source, *context, strict_mode, scope_position); |
| 284 if (result->IsSharedFunctionInfo()) { | 284 if (result->IsSharedFunctionInfo()) { |
| 285 break; | 285 break; |
| 286 } | 286 } |
| 287 } | 287 } |
| 288 } | 288 } |
| 289 if (result->IsSharedFunctionInfo()) { | 289 if (result->IsSharedFunctionInfo()) { |
| 290 Handle<SharedFunctionInfo> | 290 Handle<SharedFunctionInfo> |
| 291 function_info(SharedFunctionInfo::cast(result), isolate()); | 291 function_info(SharedFunctionInfo::cast(result), isolate()); |
| 292 if (generation != 0) { | 292 if (generation != 0) { |
| 293 Put(source, context, function_info, scope_position); | 293 Put(source, context, function_info, scope_position); |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 line_offset, | 414 line_offset, |
| 415 column_offset, | 415 column_offset, |
| 416 is_shared_cross_origin, | 416 is_shared_cross_origin, |
| 417 context); | 417 context); |
| 418 } | 418 } |
| 419 | 419 |
| 420 | 420 |
| 421 Handle<SharedFunctionInfo> CompilationCache::LookupEval( | 421 Handle<SharedFunctionInfo> CompilationCache::LookupEval( |
| 422 Handle<String> source, | 422 Handle<String> source, |
| 423 Handle<Context> context, | 423 Handle<Context> context, |
| 424 LanguageMode language_mode, | 424 StrictMode strict_mode, |
| 425 int scope_position) { | 425 int scope_position) { |
| 426 if (!IsEnabled()) { | 426 if (!IsEnabled()) { |
| 427 return Handle<SharedFunctionInfo>::null(); | 427 return Handle<SharedFunctionInfo>::null(); |
| 428 } | 428 } |
| 429 | 429 |
| 430 Handle<SharedFunctionInfo> result; | 430 Handle<SharedFunctionInfo> result; |
| 431 if (context->IsNativeContext()) { | 431 if (context->IsNativeContext()) { |
| 432 result = eval_global_.Lookup( | 432 result = eval_global_.Lookup( |
| 433 source, context, language_mode, scope_position); | 433 source, context, strict_mode, scope_position); |
| 434 } else { | 434 } else { |
| 435 ASSERT(scope_position != RelocInfo::kNoPosition); | 435 ASSERT(scope_position != RelocInfo::kNoPosition); |
| 436 result = eval_contextual_.Lookup( | 436 result = eval_contextual_.Lookup( |
| 437 source, context, language_mode, scope_position); | 437 source, context, strict_mode, scope_position); |
| 438 } | 438 } |
| 439 return result; | 439 return result; |
| 440 } | 440 } |
| 441 | 441 |
| 442 | 442 |
| 443 Handle<FixedArray> CompilationCache::LookupRegExp(Handle<String> source, | 443 Handle<FixedArray> CompilationCache::LookupRegExp(Handle<String> source, |
| 444 JSRegExp::Flags flags) { | 444 JSRegExp::Flags flags) { |
| 445 if (!IsEnabled()) { | 445 if (!IsEnabled()) { |
| 446 return Handle<FixedArray>::null(); | 446 return Handle<FixedArray>::null(); |
| 447 } | 447 } |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 } | 520 } |
| 521 | 521 |
| 522 | 522 |
| 523 void CompilationCache::Disable() { | 523 void CompilationCache::Disable() { |
| 524 enabled_ = false; | 524 enabled_ = false; |
| 525 Clear(); | 525 Clear(); |
| 526 } | 526 } |
| 527 | 527 |
| 528 | 528 |
| 529 } } // namespace v8::internal | 529 } } // namespace v8::internal |
| OLD | NEW |