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 7958 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7969 // All done. Return the compiled code. | 7969 // All done. Return the compiled code. |
7970 ASSERT(function->is_compiled()); | 7970 ASSERT(function->is_compiled()); |
7971 return function->code(); | 7971 return function->code(); |
7972 } | 7972 } |
7973 | 7973 |
7974 | 7974 |
7975 RUNTIME_FUNCTION(MaybeObject*, Runtime_LazyRecompile) { | 7975 RUNTIME_FUNCTION(MaybeObject*, Runtime_LazyRecompile) { |
7976 HandleScope scope(isolate); | 7976 HandleScope scope(isolate); |
7977 ASSERT(args.length() == 1); | 7977 ASSERT(args.length() == 1); |
7978 Handle<JSFunction> function = args.at<JSFunction>(0); | 7978 Handle<JSFunction> function = args.at<JSFunction>(0); |
| 7979 |
| 7980 // If the function is not compiled ignore the lazy |
| 7981 // recompilation. This can happen if the debugger is activated and |
| 7982 // the function is returned to the not compiled state. |
| 7983 if (!function->shared()->is_compiled()) { |
| 7984 function->ReplaceCode(function->shared()->code()); |
| 7985 return function->code(); |
| 7986 } |
| 7987 |
7979 // If the function is not optimizable or debugger is active continue using the | 7988 // If the function is not optimizable or debugger is active continue using the |
7980 // code from the full compiler. | 7989 // code from the full compiler. |
7981 if (!function->shared()->code()->optimizable() || | 7990 if (!function->shared()->code()->optimizable() || |
7982 isolate->DebuggerHasBreakPoints()) { | 7991 isolate->DebuggerHasBreakPoints()) { |
7983 if (FLAG_trace_opt) { | 7992 if (FLAG_trace_opt) { |
7984 PrintF("[failed to optimize "); | 7993 PrintF("[failed to optimize "); |
7985 function->PrintName(); | 7994 function->PrintName(); |
7986 PrintF(": is code optimizable: %s, is debugger enabled: %s]\n", | 7995 PrintF(": is code optimizable: %s, is debugger enabled: %s]\n", |
7987 function->shared()->code()->optimizable() ? "T" : "F", | 7996 function->shared()->code()->optimizable() ? "T" : "F", |
7988 isolate->DebuggerHasBreakPoints() ? "T" : "F"); | 7997 isolate->DebuggerHasBreakPoints() ? "T" : "F"); |
(...skipping 4998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12987 } else { | 12996 } else { |
12988 // Handle last resort GC and make sure to allow future allocations | 12997 // Handle last resort GC and make sure to allow future allocations |
12989 // to grow the heap without causing GCs (if possible). | 12998 // to grow the heap without causing GCs (if possible). |
12990 isolate->counters()->gc_last_resort_from_js()->Increment(); | 12999 isolate->counters()->gc_last_resort_from_js()->Increment(); |
12991 isolate->heap()->CollectAllGarbage(false); | 13000 isolate->heap()->CollectAllGarbage(false); |
12992 } | 13001 } |
12993 } | 13002 } |
12994 | 13003 |
12995 | 13004 |
12996 } } // namespace v8::internal | 13005 } } // namespace v8::internal |
OLD | NEW |