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 8572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8583 #if defined(USE_SIMULATOR) | 8583 #if defined(USE_SIMULATOR) |
8584 return isolate->heap()->true_value(); | 8584 return isolate->heap()->true_value(); |
8585 #else | 8585 #else |
8586 return isolate->heap()->false_value(); | 8586 return isolate->heap()->false_value(); |
8587 #endif | 8587 #endif |
8588 } | 8588 } |
8589 | 8589 |
8590 | 8590 |
8591 RUNTIME_FUNCTION(MaybeObject*, Runtime_OptimizeFunctionOnNextCall) { | 8591 RUNTIME_FUNCTION(MaybeObject*, Runtime_OptimizeFunctionOnNextCall) { |
8592 HandleScope scope(isolate); | 8592 HandleScope scope(isolate); |
8593 ASSERT(args.length() == 1); | 8593 ASSERT(args.length() == 1 || args.length() == 2); |
8594 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); | 8594 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); |
| 8595 |
8595 if (!function->IsOptimizable()) return isolate->heap()->undefined_value(); | 8596 if (!function->IsOptimizable()) return isolate->heap()->undefined_value(); |
8596 function->MarkForLazyRecompilation(); | 8597 function->MarkForLazyRecompilation(); |
| 8598 |
| 8599 Code* unoptimized = function->shared()->code(); |
| 8600 if (args.length() == 2 && |
| 8601 unoptimized->kind() == Code::FUNCTION) { |
| 8602 CONVERT_ARG_HANDLE_CHECKED(String, type, 1); |
| 8603 CHECK(type->IsEqualTo(CStrVector("osr"))); |
| 8604 isolate->runtime_profiler()->AttemptOnStackReplacement(*function); |
| 8605 unoptimized->set_allow_osr_at_loop_nesting_level( |
| 8606 Code::kMaxLoopNestingMarker); |
| 8607 } |
| 8608 |
8597 return isolate->heap()->undefined_value(); | 8609 return isolate->heap()->undefined_value(); |
8598 } | 8610 } |
8599 | 8611 |
8600 | 8612 |
8601 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetOptimizationStatus) { | 8613 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetOptimizationStatus) { |
8602 HandleScope scope(isolate); | 8614 HandleScope scope(isolate); |
8603 ASSERT(args.length() == 1); | 8615 ASSERT(args.length() == 1); |
8604 // The least significant bit (after untagging) indicates whether the | 8616 // The least significant bit (after untagging) indicates whether the |
8605 // function is currently optimized, regardless of reason. | 8617 // function is currently optimized, regardless of reason. |
8606 if (!V8::UseCrankshaft()) { | 8618 if (!V8::UseCrankshaft()) { |
(...skipping 5070 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13677 // Handle last resort GC and make sure to allow future allocations | 13689 // Handle last resort GC and make sure to allow future allocations |
13678 // to grow the heap without causing GCs (if possible). | 13690 // to grow the heap without causing GCs (if possible). |
13679 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13691 isolate->counters()->gc_last_resort_from_js()->Increment(); |
13680 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 13692 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
13681 "Runtime::PerformGC"); | 13693 "Runtime::PerformGC"); |
13682 } | 13694 } |
13683 } | 13695 } |
13684 | 13696 |
13685 | 13697 |
13686 } } // namespace v8::internal | 13698 } } // namespace v8::internal |
OLD | NEW |