Chromium Code Reviews| 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 124 *ic_total_count = info->ic_total_count(); | 124 *ic_total_count = info->ic_total_count(); |
| 125 } | 125 } |
| 126 *percentage = *ic_total_count > 0 | 126 *percentage = *ic_total_count > 0 |
| 127 ? 100 * *ic_with_type_info_count / *ic_total_count | 127 ? 100 * *ic_with_type_info_count / *ic_total_count |
| 128 : 100; | 128 : 100; |
| 129 } | 129 } |
| 130 | 130 |
| 131 | 131 |
| 132 void RuntimeProfiler::Optimize(JSFunction* function, const char* reason) { | 132 void RuntimeProfiler::Optimize(JSFunction* function, const char* reason) { |
| 133 ASSERT(function->IsOptimizable()); | 133 ASSERT(function->IsOptimizable()); |
| 134 | |
| 135 if (FLAG_concurrent_crankshaft && !(isolate_->context() == NULL || | |
|
danno
2012/05/22 10:32:19
I don't see why this is necessary, can you explain
sanjoy
2012/05/22 11:38:55
Sometimes this function is called with the context
| |
| 136 isolate_->context()->IsContext())) { | |
| 137 // This confuses the compiler thread | |
| 138 return; | |
| 139 } | |
| 140 | |
| 134 if (FLAG_trace_opt) { | 141 if (FLAG_trace_opt) { |
| 135 PrintF("[marking "); | 142 PrintF("[marking "); |
| 136 function->PrintName(); | 143 function->PrintName(); |
| 137 PrintF(" 0x%" V8PRIxPTR, reinterpret_cast<intptr_t>(function->address())); | 144 PrintF(" 0x%" V8PRIxPTR, reinterpret_cast<intptr_t>(function->address())); |
| 138 PrintF(" for recompilation, reason: %s", reason); | 145 PrintF(" for recompilation, reason: %s", reason); |
| 139 if (FLAG_type_info_threshold > 0) { | 146 if (FLAG_type_info_threshold > 0) { |
| 140 int typeinfo, total, percentage; | 147 int typeinfo, total, percentage; |
| 141 GetICCounts(function, &typeinfo, &total, &percentage); | 148 GetICCounts(function, &typeinfo, &total, &percentage); |
| 142 PrintF(", ICs with typeinfo: %d/%d (%d%%)", typeinfo, total, percentage); | 149 PrintF(", ICs with typeinfo: %d/%d (%d%%)", typeinfo, total, percentage); |
| 143 } | 150 } |
| 144 PrintF("]\n"); | 151 PrintF("]\n"); |
| 145 } | 152 } |
| 146 | 153 |
| 147 // The next call to the function will trigger optimization. | 154 if (FLAG_concurrent_crankshaft) |
| 148 function->MarkForLazyRecompilation(); | 155 function->CompileConcurrently(); |
| 156 else | |
| 157 function->MarkForLazyRecompilation(); | |
| 149 } | 158 } |
| 150 | 159 |
| 151 | 160 |
| 152 void RuntimeProfiler::AttemptOnStackReplacement(JSFunction* function) { | 161 void RuntimeProfiler::AttemptOnStackReplacement(JSFunction* function) { |
| 153 // See AlwaysFullCompiler (in compiler.cc) comment on why we need | 162 // See AlwaysFullCompiler (in compiler.cc) comment on why we need |
| 154 // Debug::has_break_points(). | 163 // Debug::has_break_points(). |
| 155 ASSERT(function->IsMarkedForLazyRecompilation()); | 164 ASSERT(function->IsMarkedForLazyRecompilation()); |
| 156 if (!FLAG_use_osr || | 165 if (!FLAG_use_osr || |
| 157 isolate_->DebuggerHasBreakPoints() || | 166 isolate_->DebuggerHasBreakPoints() || |
| 158 function->IsBuiltin()) { | 167 function->IsBuiltin()) { |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 464 | 473 |
| 465 bool RuntimeProfilerRateLimiter::SuspendIfNecessary() { | 474 bool RuntimeProfilerRateLimiter::SuspendIfNecessary() { |
| 466 if (!RuntimeProfiler::IsSomeIsolateInJS()) { | 475 if (!RuntimeProfiler::IsSomeIsolateInJS()) { |
| 467 return RuntimeProfiler::WaitForSomeIsolateToEnterJS(); | 476 return RuntimeProfiler::WaitForSomeIsolateToEnterJS(); |
| 468 } | 477 } |
| 469 return false; | 478 return false; |
| 470 } | 479 } |
| 471 | 480 |
| 472 | 481 |
| 473 } } // namespace v8::internal | 482 } } // namespace v8::internal |
| OLD | NEW |