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

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

Issue 9187005: Enable optimization of top-level code. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: fixed problem with eval code, 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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 Code* unoptimized = function->shared()->code(); 225 Code* unoptimized = function->shared()->code();
226 int nesting = unoptimized->allow_osr_at_loop_nesting_level(); 226 int nesting = unoptimized->allow_osr_at_loop_nesting_level();
227 if (nesting == 0) AttemptOnStackReplacement(function); 227 if (nesting == 0) AttemptOnStackReplacement(function);
228 int new_nesting = Min(nesting + 1, Code::kMaxLoopNestingMarker); 228 int new_nesting = Min(nesting + 1, Code::kMaxLoopNestingMarker);
229 unoptimized->set_allow_osr_at_loop_nesting_level(new_nesting); 229 unoptimized->set_allow_osr_at_loop_nesting_level(new_nesting);
230 } 230 }
231 231
232 // Do not record non-optimizable functions. 232 // Do not record non-optimizable functions.
233 if (!function->IsOptimizable()) continue; 233 if (!function->IsOptimizable()) continue;
234 234
235 // Only record top-level code on top of the execution stack and
236 // avoid optimizing excessively large scripts since top-level code
237 // will be executed only once.
238 const int kMaxToplevelSourceSize = 10 * 1024;
239 if (function->shared()->is_toplevel()
240 && (frame_count > 1
241 || function->shared()->SourceSize() > kMaxToplevelSourceSize)) {
242 continue;
243 }
244
235 if (FLAG_watch_ic_patching) { 245 if (FLAG_watch_ic_patching) {
236 int ticks = function->shared()->profiler_ticks(); 246 int ticks = function->shared()->profiler_ticks();
237 247
238 if (ticks >= kProfilerTicksBeforeOptimization) { 248 if (ticks >= kProfilerTicksBeforeOptimization) {
239 // If this particular function hasn't had any ICs patched for enough 249 // If this particular function hasn't had any ICs patched for enough
240 // ticks, optimize it now. 250 // ticks, optimize it now.
241 Optimize(function, "hot and stable"); 251 Optimize(function, "hot and stable");
242 } else if (!any_ic_changed_ && 252 } else if (!any_ic_changed_ &&
243 function->shared()->code()->instruction_size() < kMaxSizeEarlyOpt) { 253 function->shared()->code()->instruction_size() < kMaxSizeEarlyOpt) {
244 // If no IC was patched since the last tick and this function is very 254 // If no IC was patched since the last tick and this function is very
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 415
406 bool RuntimeProfilerRateLimiter::SuspendIfNecessary() { 416 bool RuntimeProfilerRateLimiter::SuspendIfNecessary() {
407 if (!RuntimeProfiler::IsSomeIsolateInJS()) { 417 if (!RuntimeProfiler::IsSomeIsolateInJS()) {
408 return RuntimeProfiler::WaitForSomeIsolateToEnterJS(); 418 return RuntimeProfiler::WaitForSomeIsolateToEnterJS();
409 } 419 }
410 return false; 420 return false;
411 } 421 }
412 422
413 423
414 } } // namespace v8::internal 424 } } // namespace v8::internal
OLDNEW
« src/compiler.cc ('K') | « src/parser.cc ('k') | src/x64/full-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698