| OLD | NEW | 
|    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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  144     PrintF(" 0x%" V8PRIxPTR, reinterpret_cast<intptr_t>(function->address())); |  144     PrintF(" 0x%" V8PRIxPTR, reinterpret_cast<intptr_t>(function->address())); | 
|  145     PrintF(" for recompilation, reason: %s", reason); |  145     PrintF(" for recompilation, reason: %s", reason); | 
|  146     if (FLAG_type_info_threshold > 0) { |  146     if (FLAG_type_info_threshold > 0) { | 
|  147       int typeinfo, total, percentage; |  147       int typeinfo, total, percentage; | 
|  148       GetICCounts(function, &typeinfo, &total, &percentage); |  148       GetICCounts(function, &typeinfo, &total, &percentage); | 
|  149       PrintF(", ICs with typeinfo: %d/%d (%d%%)", typeinfo, total, percentage); |  149       PrintF(", ICs with typeinfo: %d/%d (%d%%)", typeinfo, total, percentage); | 
|  150     } |  150     } | 
|  151     PrintF("]\n"); |  151     PrintF("]\n"); | 
|  152   } |  152   } | 
|  153  |  153  | 
|  154   // The next call to the function will trigger optimization. |  154   if (FLAG_parallel_recompilation) { | 
|  155   function->MarkForLazyRecompilation(); |  155     function->MarkForParallelRecompilation(); | 
 |  156   } else { | 
 |  157     // The next call to the function will trigger optimization. | 
 |  158     function->MarkForLazyRecompilation(); | 
 |  159   } | 
|  156 } |  160 } | 
|  157  |  161  | 
|  158  |  162  | 
|  159 void RuntimeProfiler::AttemptOnStackReplacement(JSFunction* function) { |  163 void RuntimeProfiler::AttemptOnStackReplacement(JSFunction* function) { | 
|  160   // See AlwaysFullCompiler (in compiler.cc) comment on why we need |  164   // See AlwaysFullCompiler (in compiler.cc) comment on why we need | 
|  161   // Debug::has_break_points(). |  165   // Debug::has_break_points(). | 
|  162   ASSERT(function->IsMarkedForLazyRecompilation()); |  166   ASSERT(function->IsMarkedForLazyRecompilation() || | 
 |  167          function->IsMarkedForParallelRecompilation()); | 
|  163   if (!FLAG_use_osr || |  168   if (!FLAG_use_osr || | 
|  164       isolate_->DebuggerHasBreakPoints() || |  169       isolate_->DebuggerHasBreakPoints() || | 
|  165       function->IsBuiltin()) { |  170       function->IsBuiltin()) { | 
|  166     return; |  171     return; | 
|  167   } |  172   } | 
|  168  |  173  | 
|  169   SharedFunctionInfo* shared = function->shared(); |  174   SharedFunctionInfo* shared = function->shared(); | 
|  170   // If the code is not optimizable, don't try OSR. |  175   // If the code is not optimizable, don't try OSR. | 
|  171   if (!shared->code()->optimizable()) return; |  176   if (!shared->code()->optimizable()) return; | 
|  172  |  177  | 
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  271           } |  276           } | 
|  272         } |  277         } | 
|  273       } |  278       } | 
|  274     } |  279     } | 
|  275  |  280  | 
|  276     SharedFunctionInfo* shared = function->shared(); |  281     SharedFunctionInfo* shared = function->shared(); | 
|  277     Code* shared_code = shared->code(); |  282     Code* shared_code = shared->code(); | 
|  278  |  283  | 
|  279     if (shared_code->kind() != Code::FUNCTION) continue; |  284     if (shared_code->kind() != Code::FUNCTION) continue; | 
|  280  |  285  | 
|  281     if (function->IsMarkedForLazyRecompilation()) { |  286     if (function->IsMarkedForLazyRecompilation() || | 
 |  287         function->IsMarkedForParallelRecompilation()) { | 
|  282       int nesting = shared_code->allow_osr_at_loop_nesting_level(); |  288       int nesting = shared_code->allow_osr_at_loop_nesting_level(); | 
|  283       if (nesting == 0) AttemptOnStackReplacement(function); |  289       if (nesting == 0) AttemptOnStackReplacement(function); | 
|  284       int new_nesting = Min(nesting + 1, Code::kMaxLoopNestingMarker); |  290       int new_nesting = Min(nesting + 1, Code::kMaxLoopNestingMarker); | 
|  285       shared_code->set_allow_osr_at_loop_nesting_level(new_nesting); |  291       shared_code->set_allow_osr_at_loop_nesting_level(new_nesting); | 
|  286     } |  292     } | 
|  287  |  293  | 
|  288     // Only record top-level code on top of the execution stack and |  294     // Only record top-level code on top of the execution stack and | 
|  289     // avoid optimizing excessively large scripts since top-level code |  295     // avoid optimizing excessively large scripts since top-level code | 
|  290     // will be executed only once. |  296     // will be executed only once. | 
|  291     const int kMaxToplevelSourceSize = 10 * 1024; |  297     const int kMaxToplevelSourceSize = 10 * 1024; | 
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  490  |  496  | 
|  491 bool RuntimeProfilerRateLimiter::SuspendIfNecessary() { |  497 bool RuntimeProfilerRateLimiter::SuspendIfNecessary() { | 
|  492   if (!RuntimeProfiler::IsSomeIsolateInJS()) { |  498   if (!RuntimeProfiler::IsSomeIsolateInJS()) { | 
|  493     return RuntimeProfiler::WaitForSomeIsolateToEnterJS(); |  499     return RuntimeProfiler::WaitForSomeIsolateToEnterJS(); | 
|  494   } |  500   } | 
|  495   return false; |  501   return false; | 
|  496 } |  502 } | 
|  497  |  503  | 
|  498  |  504  | 
|  499 } }  // namespace v8::internal |  505 } }  // namespace v8::internal | 
| OLD | NEW |