Chromium Code Reviews
Help | Chromium Project | Sign in
(422)

Side by Side Diff: src/compiler.cc

Issue 10837037: Age code to allow reclaiming old unexecuted functions (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Cleanup code Created 1 year, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/code-stubs.h ('k') | src/heap.h » ('j') | src/heap.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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();
Michael Starzinger 2012/09/21 09:43:19 I think we also might want to make the code young
danno 2012/10/25 10:07:23 Done.
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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 ASSERT(language_mode != EXTENDED_MODE || 663 ASSERT(language_mode != EXTENDED_MODE ||
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 }
Michael Starzinger 2012/09/21 09:43:19 You should also make the code young here.
danno 2012/10/25 10:07:23 Done.
673 } 674 }
674 675
675 return result; 676 return result;
676 } 677 }
677 678
678 679
679 static bool InstallFullCode(CompilationInfo* info) { 680 static bool InstallFullCode(CompilationInfo* info) {
680 // Update the shared function info with the compiled code and the 681 // Update the shared function info with the compiled code and the
681 // scope info. Please note, that the order of the shared function 682 // scope info. Please note, that the order of the shared function
682 // info initialization is important since set_scope_info might 683 // info initialization is important since set_scope_info might
(...skipping 18 matching lines...) Expand all
701 702
702 // Set the optimization hints after performing lazy compilation, as 703 // Set the optimization hints after performing lazy compilation, as
703 // these are not set when the function is set up as a lazily 704 // these are not set when the function is set up as a lazily
704 // compiled function. 705 // compiled function.
705 shared->SetThisPropertyAssignmentsInfo( 706 shared->SetThisPropertyAssignmentsInfo(
706 lit->has_only_simple_this_property_assignments(), 707 lit->has_only_simple_this_property_assignments(),
707 *lit->this_property_assignments()); 708 *lit->this_property_assignments());
708 709
709 // Check the function has compiled code. 710 // Check the function has compiled code.
710 ASSERT(shared->is_compiled()); 711 ASSERT(shared->is_compiled());
711 shared->set_code_age(0);
712 shared->set_dont_optimize(lit->flags()->Contains(kDontOptimize)); 712 shared->set_dont_optimize(lit->flags()->Contains(kDontOptimize));
713 shared->set_dont_inline(lit->flags()->Contains(kDontInline)); 713 shared->set_dont_inline(lit->flags()->Contains(kDontInline));
714 shared->set_ast_node_count(lit->ast_node_count()); 714 shared->set_ast_node_count(lit->ast_node_count());
715 715
716 if (V8::UseCrankshaft() && 716 if (V8::UseCrankshaft() &&
717 !function.is_null() && 717 !function.is_null() &&
718 !shared->optimization_disabled()) { 718 !shared->optimization_disabled()) {
719 // If we're asked to always optimize, we compile the optimized 719 // If we're asked to always optimize, we compile the optimized
720 // version of the function right away - unless the debugger is 720 // version of the function right away - unless the debugger is
721 // active as it makes no sense to compile optimized code then. 721 // active as it makes no sense to compile optimized code then.
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
1047 } 1047 }
1048 } 1048 }
1049 1049
1050 GDBJIT(AddCode(Handle<String>(shared->DebugName()), 1050 GDBJIT(AddCode(Handle<String>(shared->DebugName()),
1051 Handle<Script>(info->script()), 1051 Handle<Script>(info->script()),
1052 Handle<Code>(info->code()), 1052 Handle<Code>(info->code()),
1053 info)); 1053 info));
1054 } 1054 }
1055 1055
1056 } } // namespace v8::internal 1056 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/code-stubs.h ('k') | src/heap.h » ('j') | src/heap.h » ('J')

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld 1275:d14800f88434