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 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
602 info.SetLanguageMode(FLAG_harmony_scoping ? EXTENDED_MODE : STRICT_MODE); | 602 info.SetLanguageMode(FLAG_harmony_scoping ? EXTENDED_MODE : STRICT_MODE); |
603 } | 603 } |
604 result = MakeFunctionInfo(&info); | 604 result = MakeFunctionInfo(&info); |
605 if (extension == NULL && !result.is_null() && !result->dont_cache()) { | 605 if (extension == NULL && !result.is_null() && !result->dont_cache()) { |
606 compilation_cache->PutScript(source, context, result); | 606 compilation_cache->PutScript(source, context, result); |
607 } | 607 } |
608 } else { | 608 } else { |
609 if (result->ic_age() != HEAP->global_ic_age()) { | 609 if (result->ic_age() != HEAP->global_ic_age()) { |
610 result->ResetForNewContext(HEAP->global_ic_age()); | 610 result->ResetForNewContext(HEAP->global_ic_age()); |
611 } | 611 } |
| 612 result->code()->MakeYoung(); |
612 } | 613 } |
613 | 614 |
614 if (result.is_null()) isolate->ReportPendingMessages(); | 615 if (result.is_null()) isolate->ReportPendingMessages(); |
615 return result; | 616 return result; |
616 } | 617 } |
617 | 618 |
618 | 619 |
619 Handle<SharedFunctionInfo> Compiler::CompileEval(Handle<String> source, | 620 Handle<SharedFunctionInfo> Compiler::CompileEval(Handle<String> source, |
620 Handle<Context> context, | 621 Handle<Context> context, |
621 bool is_global, | 622 bool is_global, |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
663 result->is_extended_mode()); | 664 result->is_extended_mode()); |
664 if (!result->dont_cache()) { | 665 if (!result->dont_cache()) { |
665 compilation_cache->PutEval( | 666 compilation_cache->PutEval( |
666 source, context, is_global, result, scope_position); | 667 source, context, is_global, result, scope_position); |
667 } | 668 } |
668 } | 669 } |
669 } else { | 670 } else { |
670 if (result->ic_age() != HEAP->global_ic_age()) { | 671 if (result->ic_age() != HEAP->global_ic_age()) { |
671 result->ResetForNewContext(HEAP->global_ic_age()); | 672 result->ResetForNewContext(HEAP->global_ic_age()); |
672 } | 673 } |
| 674 result->code()->MakeYoung(); |
673 } | 675 } |
674 | 676 |
675 return result; | 677 return result; |
676 } | 678 } |
677 | 679 |
678 | 680 |
679 static bool InstallFullCode(CompilationInfo* info) { | 681 static bool InstallFullCode(CompilationInfo* info) { |
680 // Update the shared function info with the compiled code and the | 682 // Update the shared function info with the compiled code and the |
681 // scope info. Please note, that the order of the shared function | 683 // scope info. Please note, that the order of the shared function |
682 // info initialization is important since set_scope_info might | 684 // info initialization is important since set_scope_info might |
(...skipping 18 matching lines...) Expand all Loading... |
701 | 703 |
702 // Set the optimization hints after performing lazy compilation, as | 704 // Set the optimization hints after performing lazy compilation, as |
703 // these are not set when the function is set up as a lazily | 705 // these are not set when the function is set up as a lazily |
704 // compiled function. | 706 // compiled function. |
705 shared->SetThisPropertyAssignmentsInfo( | 707 shared->SetThisPropertyAssignmentsInfo( |
706 lit->has_only_simple_this_property_assignments(), | 708 lit->has_only_simple_this_property_assignments(), |
707 *lit->this_property_assignments()); | 709 *lit->this_property_assignments()); |
708 | 710 |
709 // Check the function has compiled code. | 711 // Check the function has compiled code. |
710 ASSERT(shared->is_compiled()); | 712 ASSERT(shared->is_compiled()); |
711 shared->set_code_age(0); | |
712 shared->set_dont_optimize(lit->flags()->Contains(kDontOptimize)); | 713 shared->set_dont_optimize(lit->flags()->Contains(kDontOptimize)); |
713 shared->set_dont_inline(lit->flags()->Contains(kDontInline)); | 714 shared->set_dont_inline(lit->flags()->Contains(kDontInline)); |
714 shared->set_ast_node_count(lit->ast_node_count()); | 715 shared->set_ast_node_count(lit->ast_node_count()); |
715 | 716 |
716 if (V8::UseCrankshaft() && | 717 if (V8::UseCrankshaft() && |
717 !function.is_null() && | 718 !function.is_null() && |
718 !shared->optimization_disabled()) { | 719 !shared->optimization_disabled()) { |
719 // If we're asked to always optimize, we compile the optimized | 720 // If we're asked to always optimize, we compile the optimized |
720 // version of the function right away - unless the debugger is | 721 // version of the function right away - unless the debugger is |
721 // active as it makes no sense to compile optimized code then. | 722 // active as it makes no sense to compile optimized code then. |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1047 } | 1048 } |
1048 } | 1049 } |
1049 | 1050 |
1050 GDBJIT(AddCode(Handle<String>(shared->DebugName()), | 1051 GDBJIT(AddCode(Handle<String>(shared->DebugName()), |
1051 Handle<Script>(info->script()), | 1052 Handle<Script>(info->script()), |
1052 Handle<Code>(info->code()), | 1053 Handle<Code>(info->code()), |
1053 info)); | 1054 info)); |
1054 } | 1055 } |
1055 | 1056 |
1056 } } // namespace v8::internal | 1057 } } // namespace v8::internal |
OLD | NEW |