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

Side by Side Diff: src/runtime-profiler.cc

Issue 9403009: Count ICs that have type information. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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
« src/ic.cc ('K') | « src/objects-inl.h ('k') | no next file » | no next file with comments »
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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 } 102 }
103 103
104 104
105 void RuntimeProfiler::Optimize(JSFunction* function, const char* reason) { 105 void RuntimeProfiler::Optimize(JSFunction* function, const char* reason) {
106 ASSERT(function->IsOptimizable()); 106 ASSERT(function->IsOptimizable());
107 if (FLAG_trace_opt) { 107 if (FLAG_trace_opt) {
108 PrintF("[marking "); 108 PrintF("[marking ");
109 function->PrintName(); 109 function->PrintName();
110 PrintF(" 0x%" V8PRIxPTR, reinterpret_cast<intptr_t>(function->address())); 110 PrintF(" 0x%" V8PRIxPTR, reinterpret_cast<intptr_t>(function->address()));
111 PrintF(" for recompilation, reason: %s", reason); 111 PrintF(" for recompilation, reason: %s", reason);
112 int typeinfo = function->shared()->ic_typeinfo_count();
113 int total = function->shared()->ic_total_count();
114 PrintF(", ICs with typeinfo: %d/%d (%d%%)",
Vyacheslav Egorov (Chromium) 2012/02/15 12:07:39 I sense SIGFPE here for code objects without ICs.
Jakob Kummerow 2012/02/17 16:07:52 Done.
115 typeinfo, total, (100*typeinfo/total));
112 PrintF("]\n"); 116 PrintF("]\n");
113 } 117 }
114 118
115 // The next call to the function will trigger optimization. 119 // The next call to the function will trigger optimization.
116 function->MarkForLazyRecompilation(); 120 function->MarkForLazyRecompilation();
117 } 121 }
118 122
119 123
120 void RuntimeProfiler::AttemptOnStackReplacement(JSFunction* function) { 124 void RuntimeProfiler::AttemptOnStackReplacement(JSFunction* function) {
121 // See AlwaysFullCompiler (in compiler.cc) comment on why we need 125 // See AlwaysFullCompiler (in compiler.cc) comment on why we need
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 if (function->shared()->is_toplevel() 255 if (function->shared()->is_toplevel()
252 && (frame_count > 1 256 && (frame_count > 1
253 || function->shared()->SourceSize() > kMaxToplevelSourceSize)) { 257 || function->shared()->SourceSize() > kMaxToplevelSourceSize)) {
254 continue; 258 continue;
255 } 259 }
256 260
257 if (FLAG_watch_ic_patching) { 261 if (FLAG_watch_ic_patching) {
258 int ticks = function->shared()->profiler_ticks(); 262 int ticks = function->shared()->profiler_ticks();
259 263
260 if (ticks >= kProfilerTicksBeforeOptimization) { 264 if (ticks >= kProfilerTicksBeforeOptimization) {
261 // If this particular function hasn't had any ICs patched for enough 265 int ic_typeinfo = function->shared()->ic_typeinfo_count();
Vyacheslav Egorov (Chromium) 2012/02/15 12:07:39 I would rename ic_typeinfo_count into ic_with_type
Jakob Kummerow 2012/02/17 16:07:52 Done.
262 // ticks, optimize it now. 266 int ic_total = function->shared()->ic_total_count();
263 Optimize(function, "hot and stable"); 267 int percentage = 100 * ic_typeinfo / ic_total;
Vyacheslav Egorov (Chromium) 2012/02/15 12:07:39 I sense SIGFPE here for code objects without ICs.
Jakob Kummerow 2012/02/17 16:07:52 Done.
268 if (percentage >= FLAG_type_info_threshold) {
269 // If this particular function hasn't had any ICs patched for enough
270 // ticks, optimize it now.
271 Optimize(function, "hot and stable");
272 } else {
273 if (FLAG_trace_opt_verbose) {
274 PrintF("[not yet optimizing ");
275 function->PrintName();
276 PrintF(", not enough type info: %d/%d (%d%%)]\n",
277 ic_typeinfo, ic_total, percentage);
278 }
279 }
264 } else if (!any_ic_changed_ && 280 } else if (!any_ic_changed_ &&
265 function->shared()->code()->instruction_size() < kMaxSizeEarlyOpt) { 281 function->shared()->code()->instruction_size() < kMaxSizeEarlyOpt) {
266 // If no IC was patched since the last tick and this function is very 282 // If no IC was patched since the last tick and this function is very
267 // small, optimistically optimize it now. 283 // small, optimistically optimize it now.
268 Optimize(function, "small function"); 284 Optimize(function, "small function");
269 } else if (!code_generated_ && 285 } else if (!code_generated_ &&
270 !any_ic_changed_ && 286 !any_ic_changed_ &&
271 total_code_generated_ > 0 && 287 total_code_generated_ > 0 &&
272 total_code_generated_ < 2000) { 288 total_code_generated_ < 2000) {
273 // If no code was generated and no IC was patched since the last tick, 289 // If no code was generated and no IC was patched since the last tick,
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 446
431 bool RuntimeProfilerRateLimiter::SuspendIfNecessary() { 447 bool RuntimeProfilerRateLimiter::SuspendIfNecessary() {
432 if (!RuntimeProfiler::IsSomeIsolateInJS()) { 448 if (!RuntimeProfiler::IsSomeIsolateInJS()) {
433 return RuntimeProfiler::WaitForSomeIsolateToEnterJS(); 449 return RuntimeProfiler::WaitForSomeIsolateToEnterJS();
434 } 450 }
435 return false; 451 return false;
436 } 452 }
437 453
438 454
439 } } // namespace v8::internal 455 } } // namespace v8::internal
OLDNEW
« src/ic.cc ('K') | « src/objects-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698