Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Side by Side Diff: src/compiler.cc

Issue 9361026: Count-based profiling for primitive functions (hidden behind a flag) (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comments Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 bool is_optimizable_closure = 103 bool is_optimizable_closure =
104 FLAG_optimize_closures && 104 FLAG_optimize_closures &&
105 closure_.is_null() && 105 closure_.is_null() &&
106 !scope_->HasTrivialOuterContext() && 106 !scope_->HasTrivialOuterContext() &&
107 !scope_->outer_scope_calls_non_strict_eval() && 107 !scope_->outer_scope_calls_non_strict_eval() &&
108 !scope_->inside_with(); 108 !scope_->inside_with();
109 SetMode(is_optimizable_closure ? BASE : NONOPT); 109 SetMode(is_optimizable_closure ? BASE : NONOPT);
110 } 110 }
111 111
112 112
113 bool CompilationInfo::ShouldSelfOptimize() {
114 return FLAG_counting_profiler &&
115 FLAG_crankshaft &&
116 !Serializer::enabled() &&
117 !function()->flags()->Contains(kDontSelfOptimize) &&
118 (shared_info().is_null() || !shared_info()->optimization_disabled());
119 }
120
121
113 void CompilationInfo::AbortOptimization() { 122 void CompilationInfo::AbortOptimization() {
114 Handle<Code> code(shared_info()->code()); 123 Handle<Code> code(shared_info()->code());
115 SetCode(code); 124 SetCode(code);
116 } 125 }
117 126
118 127
119 // Determine whether to use the full compiler for all code. If the flag 128 // Determine whether to use the full compiler for all code. If the flag
120 // --always-full-compiler is specified this is the case. For the virtual frame 129 // --always-full-compiler is specified this is the case. For the virtual frame
121 // based compiler the full compiler is also used if a debugger is connected, as 130 // based compiler the full compiler is also used if a debugger is connected, as
122 // the code from the full compiler supports mode precise break points. For the 131 // the code from the full compiler supports mode precise break points. For the
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 // compiled function. 656 // compiled function.
648 shared->SetThisPropertyAssignmentsInfo( 657 shared->SetThisPropertyAssignmentsInfo(
649 lit->has_only_simple_this_property_assignments(), 658 lit->has_only_simple_this_property_assignments(),
650 *lit->this_property_assignments()); 659 *lit->this_property_assignments());
651 660
652 // Check the function has compiled code. 661 // Check the function has compiled code.
653 ASSERT(shared->is_compiled()); 662 ASSERT(shared->is_compiled());
654 shared->set_code_age(0); 663 shared->set_code_age(0);
655 shared->set_dont_crankshaft(lit->flags()->Contains(kDontOptimize)); 664 shared->set_dont_crankshaft(lit->flags()->Contains(kDontOptimize));
656 shared->set_dont_inline(lit->flags()->Contains(kDontInline)); 665 shared->set_dont_inline(lit->flags()->Contains(kDontInline));
666 shared->set_ast_node_count(lit->ast_node_count());
657 667
658 if (info->AllowOptimize() && !shared->optimization_disabled()) { 668 if (info->AllowOptimize() && !shared->optimization_disabled()) {
659 // If we're asked to always optimize, we compile the optimized 669 // If we're asked to always optimize, we compile the optimized
660 // version of the function right away - unless the debugger is 670 // version of the function right away - unless the debugger is
661 // active as it makes no sense to compile optimized code then. 671 // active as it makes no sense to compile optimized code then.
662 if (FLAG_always_opt && 672 if (FLAG_always_opt &&
663 !Isolate::Current()->DebuggerHasBreakPoints()) { 673 !Isolate::Current()->DebuggerHasBreakPoints()) {
664 CompilationInfo optimized(function); 674 CompilationInfo optimized(function);
665 optimized.SetOptimizing(AstNode::kNoNumber); 675 optimized.SetOptimizing(AstNode::kNoNumber);
666 return CompileLazy(&optimized); 676 return CompileLazy(&optimized);
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
791 } 801 }
792 } 802 }
793 803
794 GDBJIT(AddCode(Handle<String>(shared->DebugName()), 804 GDBJIT(AddCode(Handle<String>(shared->DebugName()),
795 Handle<Script>(info->script()), 805 Handle<Script>(info->script()),
796 Handle<Code>(info->code()), 806 Handle<Code>(info->code()),
797 info)); 807 info));
798 } 808 }
799 809
800 } } // namespace v8::internal 810 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698