| 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 403 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 bool is_global, | |
| 425 LanguageMode language_mode, | 424 LanguageMode language_mode, |
| 426 int scope_position) { | 425 int scope_position) { |
| 427 if (!IsEnabled()) { | 426 if (!IsEnabled()) { |
| 428 return Handle<SharedFunctionInfo>::null(); | 427 return Handle<SharedFunctionInfo>::null(); |
| 429 } | 428 } |
| 430 | 429 |
| 431 Handle<SharedFunctionInfo> result; | 430 Handle<SharedFunctionInfo> result; |
| 432 if (is_global) { | 431 if (context->IsNativeContext()) { |
| 433 result = eval_global_.Lookup( | 432 result = eval_global_.Lookup( |
| 434 source, context, language_mode, scope_position); | 433 source, context, language_mode, scope_position); |
| 435 } else { | 434 } else { |
| 436 ASSERT(scope_position != RelocInfo::kNoPosition); | 435 ASSERT(scope_position != RelocInfo::kNoPosition); |
| 437 result = eval_contextual_.Lookup( | 436 result = eval_contextual_.Lookup( |
| 438 source, context, language_mode, scope_position); | 437 source, context, language_mode, scope_position); |
| 439 } | 438 } |
| 440 return result; | 439 return result; |
| 441 } | 440 } |
| 442 | 441 |
| 443 | 442 |
| 444 Handle<FixedArray> CompilationCache::LookupRegExp(Handle<String> source, | 443 Handle<FixedArray> CompilationCache::LookupRegExp(Handle<String> source, |
| 445 JSRegExp::Flags flags) { | 444 JSRegExp::Flags flags) { |
| 446 if (!IsEnabled()) { | 445 if (!IsEnabled()) { |
| 447 return Handle<FixedArray>::null(); | 446 return Handle<FixedArray>::null(); |
| 448 } | 447 } |
| 449 | 448 |
| 450 return reg_exp_.Lookup(source, flags); | 449 return reg_exp_.Lookup(source, flags); |
| 451 } | 450 } |
| 452 | 451 |
| 453 | 452 |
| 454 void CompilationCache::PutScript(Handle<String> source, | 453 void CompilationCache::PutScript(Handle<String> source, |
| 455 Handle<Context> context, | 454 Handle<Context> context, |
| 456 Handle<SharedFunctionInfo> function_info) { | 455 Handle<SharedFunctionInfo> function_info) { |
| 457 if (!IsEnabled()) { | 456 if (!IsEnabled()) return; |
| 458 return; | |
| 459 } | |
| 460 | 457 |
| 461 script_.Put(source, context, function_info); | 458 script_.Put(source, context, function_info); |
| 462 } | 459 } |
| 463 | 460 |
| 464 | 461 |
| 465 void CompilationCache::PutEval(Handle<String> source, | 462 void CompilationCache::PutEval(Handle<String> source, |
| 466 Handle<Context> context, | 463 Handle<Context> context, |
| 467 bool is_global, | |
| 468 Handle<SharedFunctionInfo> function_info, | 464 Handle<SharedFunctionInfo> function_info, |
| 469 int scope_position) { | 465 int scope_position) { |
| 470 if (!IsEnabled()) { | 466 if (!IsEnabled()) return; |
| 471 return; | |
| 472 } | |
| 473 | 467 |
| 474 HandleScope scope(isolate()); | 468 HandleScope scope(isolate()); |
| 475 if (is_global) { | 469 if (context->IsNativeContext()) { |
| 476 eval_global_.Put(source, context, function_info, scope_position); | 470 eval_global_.Put(source, context, function_info, scope_position); |
| 477 } else { | 471 } else { |
| 478 ASSERT(scope_position != RelocInfo::kNoPosition); | 472 ASSERT(scope_position != RelocInfo::kNoPosition); |
| 479 eval_contextual_.Put(source, context, function_info, scope_position); | 473 eval_contextual_.Put(source, context, function_info, scope_position); |
| 480 } | 474 } |
| 481 } | 475 } |
| 482 | 476 |
| 483 | 477 |
| 484 | 478 |
| 485 void CompilationCache::PutRegExp(Handle<String> source, | 479 void CompilationCache::PutRegExp(Handle<String> source, |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 } | 520 } |
| 527 | 521 |
| 528 | 522 |
| 529 void CompilationCache::Disable() { | 523 void CompilationCache::Disable() { |
| 530 enabled_ = false; | 524 enabled_ = false; |
| 531 Clear(); | 525 Clear(); |
| 532 } | 526 } |
| 533 | 527 |
| 534 | 528 |
| 535 } } // namespace v8::internal | 529 } } // namespace v8::internal |
| OLD | NEW |