OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 info.MarkAsGlobal(); | 524 info.MarkAsGlobal(); |
525 info.SetExtension(extension); | 525 info.SetExtension(extension); |
526 info.SetPreParseData(pre_data); | 526 info.SetPreParseData(pre_data); |
527 if (FLAG_use_strict) { | 527 if (FLAG_use_strict) { |
528 info.SetLanguageMode(FLAG_harmony_scoping ? EXTENDED_MODE : STRICT_MODE); | 528 info.SetLanguageMode(FLAG_harmony_scoping ? EXTENDED_MODE : STRICT_MODE); |
529 } | 529 } |
530 result = MakeFunctionInfo(&info); | 530 result = MakeFunctionInfo(&info); |
531 if (extension == NULL && !result.is_null()) { | 531 if (extension == NULL && !result.is_null()) { |
532 compilation_cache->PutScript(source, result); | 532 compilation_cache->PutScript(source, result); |
533 } | 533 } |
| 534 } else { |
| 535 if (result->ic_age() != HEAP->global_ic_age()) { |
| 536 result->ResetForNewContext(HEAP->global_ic_age()); |
| 537 } |
534 } | 538 } |
535 | 539 |
536 if (result.is_null()) isolate->ReportPendingMessages(); | 540 if (result.is_null()) isolate->ReportPendingMessages(); |
537 return result; | 541 return result; |
538 } | 542 } |
539 | 543 |
540 | 544 |
541 Handle<SharedFunctionInfo> Compiler::CompileEval(Handle<String> source, | 545 Handle<SharedFunctionInfo> Compiler::CompileEval(Handle<String> source, |
542 Handle<Context> context, | 546 Handle<Context> context, |
543 bool is_global, | 547 bool is_global, |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
579 // extended mode as well, but not the other way around. Consider: | 583 // extended mode as well, but not the other way around. Consider: |
580 // eval("'use strict'; ..."); | 584 // eval("'use strict'; ..."); |
581 ASSERT(language_mode != STRICT_MODE || !result->is_classic_mode()); | 585 ASSERT(language_mode != STRICT_MODE || !result->is_classic_mode()); |
582 // If caller is in extended mode, the result must also be in | 586 // If caller is in extended mode, the result must also be in |
583 // extended mode. | 587 // extended mode. |
584 ASSERT(language_mode != EXTENDED_MODE || | 588 ASSERT(language_mode != EXTENDED_MODE || |
585 result->is_extended_mode()); | 589 result->is_extended_mode()); |
586 compilation_cache->PutEval( | 590 compilation_cache->PutEval( |
587 source, context, is_global, result, scope_position); | 591 source, context, is_global, result, scope_position); |
588 } | 592 } |
| 593 } else { |
| 594 if (result->ic_age() != HEAP->global_ic_age()) { |
| 595 result->ResetForNewContext(HEAP->global_ic_age()); |
| 596 } |
589 } | 597 } |
590 | 598 |
591 return result; | 599 return result; |
592 } | 600 } |
593 | 601 |
594 | 602 |
595 bool Compiler::CompileLazy(CompilationInfo* info) { | 603 bool Compiler::CompileLazy(CompilationInfo* info) { |
596 Isolate* isolate = info->isolate(); | 604 Isolate* isolate = info->isolate(); |
597 | 605 |
598 ZoneScope zone_scope(isolate, DELETE_ON_EXIT); | 606 ZoneScope zone_scope(isolate, DELETE_ON_EXIT); |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
809 } | 817 } |
810 } | 818 } |
811 | 819 |
812 GDBJIT(AddCode(Handle<String>(shared->DebugName()), | 820 GDBJIT(AddCode(Handle<String>(shared->DebugName()), |
813 Handle<Script>(info->script()), | 821 Handle<Script>(info->script()), |
814 Handle<Code>(info->code()), | 822 Handle<Code>(info->code()), |
815 info)); | 823 info)); |
816 } | 824 } |
817 | 825 |
818 } } // namespace v8::internal | 826 } } // namespace v8::internal |
OLD | NEW |