OLD | NEW |
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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 | 158 |
159 static void AttemptOnStackReplacement(JSFunction* function) { | 159 static void AttemptOnStackReplacement(JSFunction* function) { |
160 // See AlwaysFullCompiler (in compiler.cc) comment on why we need | 160 // See AlwaysFullCompiler (in compiler.cc) comment on why we need |
161 // Debug::has_break_points(). | 161 // Debug::has_break_points(). |
162 ASSERT(function->IsMarkedForLazyRecompilation()); | 162 ASSERT(function->IsMarkedForLazyRecompilation()); |
163 if (!FLAG_use_osr || Debug::has_break_points() || function->IsBuiltin()) { | 163 if (!FLAG_use_osr || Debug::has_break_points() || function->IsBuiltin()) { |
164 return; | 164 return; |
165 } | 165 } |
166 | 166 |
167 SharedFunctionInfo* shared = function->shared(); | 167 SharedFunctionInfo* shared = function->shared(); |
168 // If the code is not optimizable, don't try OSR. | 168 // If the code is not optimizable or references context slots, don't try OSR. |
169 if (!shared->code()->optimizable()) return; | 169 if (!shared->code()->optimizable() || !shared->allows_lazy_compilation()) { |
| 170 return; |
| 171 } |
170 | 172 |
171 // We are not prepared to do OSR for a function that already has an | 173 // We are not prepared to do OSR for a function that already has an |
172 // allocated arguments object. The optimized code would bypass it for | 174 // allocated arguments object. The optimized code would bypass it for |
173 // arguments accesses, which is unsound. Don't try OSR. | 175 // arguments accesses, which is unsound. Don't try OSR. |
174 if (shared->scope_info()->HasArgumentsShadow()) return; | 176 if (shared->scope_info()->HasArgumentsShadow()) return; |
175 | 177 |
176 // We're using on-stack replacement: patch the unoptimized code so that | 178 // We're using on-stack replacement: patch the unoptimized code so that |
177 // any back edge in any unoptimized frame will trigger on-stack | 179 // any back edge in any unoptimized frame will trigger on-stack |
178 // replacement for that frame. | 180 // replacement for that frame. |
179 if (FLAG_trace_osr) { | 181 if (FLAG_trace_osr) { |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 if (Top::WaitForJSState()) return true; | 451 if (Top::WaitForJSState()) return true; |
450 } | 452 } |
451 } | 453 } |
452 } | 454 } |
453 #endif | 455 #endif |
454 return false; | 456 return false; |
455 } | 457 } |
456 | 458 |
457 | 459 |
458 } } // namespace v8::internal | 460 } } // namespace v8::internal |
OLD | NEW |