| 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 8514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8525 function->ReplaceCode(function->shared()->code()); | 8525 function->ReplaceCode(function->shared()->code()); |
| 8526 } | 8526 } |
| 8527 } else { | 8527 } else { |
| 8528 // TODO(titzer): we should probably do DeoptimizeCodeList(code) | 8528 // TODO(titzer): we should probably do DeoptimizeCodeList(code) |
| 8529 // unconditionally if the code is not already marked for deoptimization. | 8529 // unconditionally if the code is not already marked for deoptimization. |
| 8530 // If there is an index by shared function info, all the better. | 8530 // If there is an index by shared function info, all the better. |
| 8531 Deoptimizer::DeoptimizeFunction(*function); | 8531 Deoptimizer::DeoptimizeFunction(*function); |
| 8532 } | 8532 } |
| 8533 // Evict optimized code for this function from the cache so that it doesn't | 8533 // Evict optimized code for this function from the cache so that it doesn't |
| 8534 // get used for new closures. | 8534 // get used for new closures. |
| 8535 function->shared()->EvictFromOptimizedCodeMap(*optimized_code, | 8535 function->shared()->EvictFromOptimizedCodeMap( |
| 8536 "notify deoptimized"); | 8536 function->context()->native_context(), "notify deoptimized"); |
| 8537 | 8537 |
| 8538 return isolate->heap()->undefined_value(); | 8538 return isolate->heap()->undefined_value(); |
| 8539 } | 8539 } |
| 8540 | 8540 |
| 8541 | 8541 |
| 8542 RUNTIME_FUNCTION(MaybeObject*, Runtime_DeoptimizeFunction) { | 8542 RUNTIME_FUNCTION(MaybeObject*, Runtime_DeoptimizeFunction) { |
| 8543 HandleScope scope(isolate); | 8543 HandleScope scope(isolate); |
| 8544 ASSERT(args.length() == 1); | 8544 ASSERT(args.length() == 1); |
| 8545 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); | 8545 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); |
| 8546 if (!function->IsOptimized()) return isolate->heap()->undefined_value(); | 8546 if (!function->IsOptimized()) return isolate->heap()->undefined_value(); |
| (...skipping 6418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14965 // Handle last resort GC and make sure to allow future allocations | 14965 // Handle last resort GC and make sure to allow future allocations |
| 14966 // to grow the heap without causing GCs (if possible). | 14966 // to grow the heap without causing GCs (if possible). |
| 14967 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14967 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 14968 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14968 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
| 14969 "Runtime::PerformGC"); | 14969 "Runtime::PerformGC"); |
| 14970 } | 14970 } |
| 14971 } | 14971 } |
| 14972 | 14972 |
| 14973 | 14973 |
| 14974 } } // namespace v8::internal | 14974 } } // namespace v8::internal |
| OLD | NEW |