| 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 8485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8496 return isolate->concurrent_recompilation_enabled() | 8496 return isolate->concurrent_recompilation_enabled() |
| 8497 ? isolate->heap()->true_value() : isolate->heap()->false_value(); | 8497 ? isolate->heap()->true_value() : isolate->heap()->false_value(); |
| 8498 } | 8498 } |
| 8499 | 8499 |
| 8500 | 8500 |
| 8501 RUNTIME_FUNCTION(MaybeObject*, Runtime_OptimizeFunctionOnNextCall) { | 8501 RUNTIME_FUNCTION(MaybeObject*, Runtime_OptimizeFunctionOnNextCall) { |
| 8502 HandleScope scope(isolate); | 8502 HandleScope scope(isolate); |
| 8503 RUNTIME_ASSERT(args.length() == 1 || args.length() == 2); | 8503 RUNTIME_ASSERT(args.length() == 1 || args.length() == 2); |
| 8504 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); | 8504 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); |
| 8505 | 8505 |
| 8506 if (!function->IsOptimizable()) return isolate->heap()->undefined_value(); | 8506 if (!function->IsOptimizable() && |
| 8507 !function->IsMarkedForConcurrentOptimization() && |
| 8508 !function->IsInOptimizationQueue()) { |
| 8509 return isolate->heap()->undefined_value(); |
| 8510 } |
| 8511 |
| 8507 function->MarkForOptimization(); | 8512 function->MarkForOptimization(); |
| 8508 | 8513 |
| 8509 Code* unoptimized = function->shared()->code(); | 8514 Code* unoptimized = function->shared()->code(); |
| 8510 if (args.length() == 2 && | 8515 if (args.length() == 2 && |
| 8511 unoptimized->kind() == Code::FUNCTION) { | 8516 unoptimized->kind() == Code::FUNCTION) { |
| 8512 CONVERT_ARG_HANDLE_CHECKED(String, type, 1); | 8517 CONVERT_ARG_HANDLE_CHECKED(String, type, 1); |
| 8513 if (type->IsOneByteEqualTo(STATIC_ASCII_VECTOR("osr"))) { | 8518 if (type->IsOneByteEqualTo(STATIC_ASCII_VECTOR("osr"))) { |
| 8514 // Start patching from the currently patched loop nesting level. | 8519 // Start patching from the currently patched loop nesting level. |
| 8515 int current_level = unoptimized->allow_osr_at_loop_nesting_level(); | 8520 int current_level = unoptimized->allow_osr_at_loop_nesting_level(); |
| 8516 ASSERT(BackEdgeTable::Verify(isolate, unoptimized, current_level)); | 8521 ASSERT(BackEdgeTable::Verify(isolate, unoptimized, current_level)); |
| (...skipping 6351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14868 // Handle last resort GC and make sure to allow future allocations | 14873 // Handle last resort GC and make sure to allow future allocations |
| 14869 // to grow the heap without causing GCs (if possible). | 14874 // to grow the heap without causing GCs (if possible). |
| 14870 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14875 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 14871 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14876 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
| 14872 "Runtime::PerformGC"); | 14877 "Runtime::PerformGC"); |
| 14873 } | 14878 } |
| 14874 } | 14879 } |
| 14875 | 14880 |
| 14876 | 14881 |
| 14877 } } // namespace v8::internal | 14882 } } // namespace v8::internal |
| OLD | NEW |