| 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 8025 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8036 ASSERT(function->is_compiled()); | 8036 ASSERT(function->is_compiled()); |
| 8037 return function->code(); | 8037 return function->code(); |
| 8038 } | 8038 } |
| 8039 | 8039 |
| 8040 | 8040 |
| 8041 RUNTIME_FUNCTION(MaybeObject*, Runtime_LazyRecompile) { | 8041 RUNTIME_FUNCTION(MaybeObject*, Runtime_LazyRecompile) { |
| 8042 HandleScope scope(isolate); | 8042 HandleScope scope(isolate); |
| 8043 ASSERT(args.length() == 1); | 8043 ASSERT(args.length() == 1); |
| 8044 Handle<JSFunction> function = args.at<JSFunction>(0); | 8044 Handle<JSFunction> function = args.at<JSFunction>(0); |
| 8045 | 8045 |
| 8046 function->shared()->set_profiler_ticks(0); | |
| 8047 | |
| 8048 // If the function is not compiled ignore the lazy | 8046 // If the function is not compiled ignore the lazy |
| 8049 // recompilation. This can happen if the debugger is activated and | 8047 // recompilation. This can happen if the debugger is activated and |
| 8050 // the function is returned to the not compiled state. | 8048 // the function is returned to the not compiled state. |
| 8051 if (!function->shared()->is_compiled()) { | 8049 if (!function->shared()->is_compiled()) { |
| 8052 function->ReplaceCode(function->shared()->code()); | 8050 function->ReplaceCode(function->shared()->code()); |
| 8053 return function->code(); | 8051 return function->code(); |
| 8054 } | 8052 } |
| 8055 | 8053 |
| 8056 // If the function is not optimizable or debugger is active continue using the | 8054 // If the function is not optimizable or debugger is active continue using the |
| 8057 // code from the full compiler. | 8055 // code from the full compiler. |
| 8058 if (!function->shared()->code()->optimizable() || | 8056 if (!function->shared()->code()->optimizable() || |
| 8059 isolate->DebuggerHasBreakPoints()) { | 8057 isolate->DebuggerHasBreakPoints()) { |
| 8060 if (FLAG_trace_opt) { | 8058 if (FLAG_trace_opt) { |
| 8061 PrintF("[failed to optimize "); | 8059 PrintF("[failed to optimize "); |
| 8062 function->PrintName(); | 8060 function->PrintName(); |
| 8063 PrintF(": is code optimizable: %s, is debugger enabled: %s]\n", | 8061 PrintF(": is code optimizable: %s, is debugger enabled: %s]\n", |
| 8064 function->shared()->code()->optimizable() ? "T" : "F", | 8062 function->shared()->code()->optimizable() ? "T" : "F", |
| 8065 isolate->DebuggerHasBreakPoints() ? "T" : "F"); | 8063 isolate->DebuggerHasBreakPoints() ? "T" : "F"); |
| 8066 } | 8064 } |
| 8067 function->ReplaceCode(function->shared()->code()); | 8065 function->ReplaceCode(function->shared()->code()); |
| 8068 return function->code(); | 8066 return function->code(); |
| 8069 } | 8067 } |
| 8068 function->shared()->code()->set_profiler_ticks(0); |
| 8070 if (JSFunction::CompileOptimized(function, | 8069 if (JSFunction::CompileOptimized(function, |
| 8071 AstNode::kNoNumber, | 8070 AstNode::kNoNumber, |
| 8072 CLEAR_EXCEPTION)) { | 8071 CLEAR_EXCEPTION)) { |
| 8073 return function->code(); | 8072 return function->code(); |
| 8074 } | 8073 } |
| 8075 if (FLAG_trace_opt) { | 8074 if (FLAG_trace_opt) { |
| 8076 PrintF("[failed to optimize "); | 8075 PrintF("[failed to optimize "); |
| 8077 function->PrintName(); | 8076 function->PrintName(); |
| 8078 PrintF(": optimized compilation failed]\n"); | 8077 PrintF(": optimized compilation failed]\n"); |
| 8079 } | 8078 } |
| (...skipping 5267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13347 // Handle last resort GC and make sure to allow future allocations | 13346 // Handle last resort GC and make sure to allow future allocations |
| 13348 // to grow the heap without causing GCs (if possible). | 13347 // to grow the heap without causing GCs (if possible). |
| 13349 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13348 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 13350 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 13349 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
| 13351 "Runtime::PerformGC"); | 13350 "Runtime::PerformGC"); |
| 13352 } | 13351 } |
| 13353 } | 13352 } |
| 13354 | 13353 |
| 13355 | 13354 |
| 13356 } } // namespace v8::internal | 13355 } } // namespace v8::internal |
| OLD | NEW |