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

Side by Side Diff: src/compiler.cc

Issue 5633009: Collect only optimizable function samples.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years 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
« no previous file with comments | « no previous file | src/runtime-profiler.cc » ('j') | src/runtime-profiler.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 return FLAG_always_full_compiler || Debug::has_break_points(); 106 return FLAG_always_full_compiler || Debug::has_break_points();
107 } else { 107 } else {
108 return FLAG_always_full_compiler || Debugger::IsDebuggerActive(); 108 return FLAG_always_full_compiler || Debugger::IsDebuggerActive();
109 } 109 }
110 #else 110 #else
111 return FLAG_always_full_compiler; 111 return FLAG_always_full_compiler;
112 #endif 112 #endif
113 } 113 }
114 114
115 115
116 static double compilation_time_;
Kasper Lund 2010/12/08 14:54:15 Convert these to statics inside the if (FLAG_trace
117 static int compiled_functions_;
118 static int code_size_;
119
116 static void FinishOptimization(Handle<JSFunction> function, int64_t start) { 120 static void FinishOptimization(Handle<JSFunction> function, int64_t start) {
117 int opt_count = function->shared()->opt_count(); 121 int opt_count = function->shared()->opt_count();
118 function->shared()->set_opt_count(opt_count + 1); 122 function->shared()->set_opt_count(opt_count + 1);
119 if (!FLAG_trace_opt) return; 123 if (!FLAG_trace_opt) return;
120 124
121 double ms = static_cast<double>(OS::Ticks() - start) / 1000; 125 double ms = static_cast<double>(OS::Ticks() - start) / 1000;
122 PrintF("[optimizing: "); 126 PrintF("[optimizing: ");
123 function->PrintName(); 127 function->PrintName();
124 PrintF(" / %" V8PRIxPTR, reinterpret_cast<intptr_t>(*function)); 128 PrintF(" / %" V8PRIxPTR, reinterpret_cast<intptr_t>(*function));
125 PrintF(" - took %0.3f ms]\n", ms); 129 PrintF(" - took %0.3f ms]\n", ms);
130
131 compilation_time_ += ms;
132 compiled_functions_++;
133 code_size_ += function->shared()->SourceSize();
134 if (FLAG_trace_opt) {
135 PrintF("Compiled: %d functions with %d byte source size in %fms.\n",
136 compiled_functions_,
137 code_size_,
138 compilation_time_);
139 }
126 } 140 }
127 141
128 142
129 static void AbortAndDisable(CompilationInfo* info) { 143 static void AbortAndDisable(CompilationInfo* info) {
130 // Disable optimization for the shared function info and mark the 144 // Disable optimization for the shared function info and mark the
131 // code as non-optimizable. The marker on the shared function info 145 // code as non-optimizable. The marker on the shared function info
132 // is there because we flush non-optimized code thereby loosing the 146 // is there because we flush non-optimized code thereby loosing the
133 // non-optimizable information for the code. When the code is 147 // non-optimizable information for the code. When the code is
134 // regenerated and set on the shared function info it is marked as 148 // regenerated and set on the shared function info it is marked as
135 // non-optimizable if optimization is disabled for the shared 149 // non-optimizable if optimization is disabled for the shared
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 *code, 769 *code,
756 *name)); 770 *name));
757 OPROFILE(CreateNativeCodeRegion(*name, 771 OPROFILE(CreateNativeCodeRegion(*name,
758 code->instruction_start(), 772 code->instruction_start(),
759 code->instruction_size())); 773 code->instruction_size()));
760 } 774 }
761 } 775 }
762 } 776 }
763 777
764 } } // namespace v8::internal 778 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/runtime-profiler.cc » ('j') | src/runtime-profiler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698