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 8068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8079 | 8079 |
8080 Handle<JSFunction> function = args.at<JSFunction>(0); | 8080 Handle<JSFunction> function = args.at<JSFunction>(0); |
8081 #ifdef DEBUG | 8081 #ifdef DEBUG |
8082 if (FLAG_trace_lazy && !function->shared()->is_compiled()) { | 8082 if (FLAG_trace_lazy && !function->shared()->is_compiled()) { |
8083 PrintF("[lazy: "); | 8083 PrintF("[lazy: "); |
8084 function->PrintName(); | 8084 function->PrintName(); |
8085 PrintF("]\n"); | 8085 PrintF("]\n"); |
8086 } | 8086 } |
8087 #endif | 8087 #endif |
8088 | 8088 |
8089 // Compile the target function. Here we compile using CompileLazyInLoop in | 8089 // Compile the target function. |
8090 // order to get the optimized version. This helps code like delta-blue | |
8091 // that calls performance-critical routines through constructors. A | |
8092 // constructor call doesn't use a CallIC, it uses a LoadIC followed by a | |
8093 // direct call. Since the in-loop tracking takes place through CallICs | |
8094 // this means that things called through constructors are never known to | |
8095 // be in loops. We compile them as if they are in loops here just in case. | |
8096 ASSERT(!function->is_compiled()); | 8090 ASSERT(!function->is_compiled()); |
8097 if (!CompileLazyInLoop(function, KEEP_EXCEPTION)) { | 8091 if (!CompileLazy(function, KEEP_EXCEPTION)) { |
8098 return Failure::Exception(); | 8092 return Failure::Exception(); |
8099 } | 8093 } |
8100 | 8094 |
8101 // All done. Return the compiled code. | 8095 // All done. Return the compiled code. |
8102 ASSERT(function->is_compiled()); | 8096 ASSERT(function->is_compiled()); |
8103 return function->code(); | 8097 return function->code(); |
8104 } | 8098 } |
8105 | 8099 |
8106 | 8100 |
8107 RUNTIME_FUNCTION(MaybeObject*, Runtime_LazyRecompile) { | 8101 RUNTIME_FUNCTION(MaybeObject*, Runtime_LazyRecompile) { |
(...skipping 4991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13099 } else { | 13093 } else { |
13100 // Handle last resort GC and make sure to allow future allocations | 13094 // Handle last resort GC and make sure to allow future allocations |
13101 // to grow the heap without causing GCs (if possible). | 13095 // to grow the heap without causing GCs (if possible). |
13102 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13096 isolate->counters()->gc_last_resort_from_js()->Increment(); |
13103 isolate->heap()->CollectAllGarbage(false); | 13097 isolate->heap()->CollectAllGarbage(false); |
13104 } | 13098 } |
13105 } | 13099 } |
13106 | 13100 |
13107 | 13101 |
13108 } } // namespace v8::internal | 13102 } } // namespace v8::internal |
OLD | NEW |