OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 8090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8101 // All done. Return the compiled code. | 8101 // All done. Return the compiled code. |
8102 ASSERT(function->is_compiled()); | 8102 ASSERT(function->is_compiled()); |
8103 return function->code(); | 8103 return function->code(); |
8104 } | 8104 } |
8105 | 8105 |
8106 | 8106 |
8107 RUNTIME_FUNCTION(MaybeObject*, Runtime_LazyRecompile) { | 8107 RUNTIME_FUNCTION(MaybeObject*, Runtime_LazyRecompile) { |
8108 HandleScope scope(isolate); | 8108 HandleScope scope(isolate); |
8109 ASSERT(args.length() == 1); | 8109 ASSERT(args.length() == 1); |
8110 Handle<JSFunction> function = args.at<JSFunction>(0); | 8110 Handle<JSFunction> function = args.at<JSFunction>(0); |
| 8111 |
| 8112 // If the function is not compiled ignore the lazy |
| 8113 // recompilation. This can happen if the debugger is activated and |
| 8114 // the function is returned to the not compiled state. |
| 8115 if (!function->shared()->is_compiled()) { |
| 8116 function->ReplaceCode(function->shared()->code()); |
| 8117 return function->code(); |
| 8118 } |
| 8119 |
8111 // If the function is not optimizable or debugger is active continue using the | 8120 // If the function is not optimizable or debugger is active continue using the |
8112 // code from the full compiler. | 8121 // code from the full compiler. |
8113 if (!function->shared()->code()->optimizable() || | 8122 if (!function->shared()->code()->optimizable() || |
8114 isolate->DebuggerHasBreakPoints()) { | 8123 isolate->DebuggerHasBreakPoints()) { |
8115 if (FLAG_trace_opt) { | 8124 if (FLAG_trace_opt) { |
8116 PrintF("[failed to optimize "); | 8125 PrintF("[failed to optimize "); |
8117 function->PrintName(); | 8126 function->PrintName(); |
8118 PrintF(": is code optimizable: %s, is debugger enabled: %s]\n", | 8127 PrintF(": is code optimizable: %s, is debugger enabled: %s]\n", |
8119 function->shared()->code()->optimizable() ? "T" : "F", | 8128 function->shared()->code()->optimizable() ? "T" : "F", |
8120 isolate->DebuggerHasBreakPoints() ? "T" : "F"); | 8129 isolate->DebuggerHasBreakPoints() ? "T" : "F"); |
(...skipping 4978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13099 } else { | 13108 } else { |
13100 // Handle last resort GC and make sure to allow future allocations | 13109 // Handle last resort GC and make sure to allow future allocations |
13101 // to grow the heap without causing GCs (if possible). | 13110 // to grow the heap without causing GCs (if possible). |
13102 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13111 isolate->counters()->gc_last_resort_from_js()->Increment(); |
13103 isolate->heap()->CollectAllGarbage(false); | 13112 isolate->heap()->CollectAllGarbage(false); |
13104 } | 13113 } |
13105 } | 13114 } |
13106 | 13115 |
13107 | 13116 |
13108 } } // namespace v8::internal | 13117 } } // namespace v8::internal |
OLD | NEW |