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 8446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8457 OS::Sleep(50); | 8457 OS::Sleep(50); |
8458 } | 8458 } |
8459 } | 8459 } |
8460 return isolate->heap()->undefined_value(); | 8460 return isolate->heap()->undefined_value(); |
8461 } | 8461 } |
8462 | 8462 |
8463 | 8463 |
8464 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetOptimizationStatus) { | 8464 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetOptimizationStatus) { |
8465 HandleScope scope(isolate); | 8465 HandleScope scope(isolate); |
8466 ASSERT(args.length() == 1); | 8466 ASSERT(args.length() == 1); |
8467 // The least significant bit (after untagging) indicates whether the | |
8468 // function is currently optimized, regardless of reason. | |
8469 if (!V8::UseCrankshaft()) { | 8467 if (!V8::UseCrankshaft()) { |
8470 return Smi::FromInt(4); // 4 == "never". | 8468 return Smi::FromInt(4); // 4 == "never". |
8471 } | 8469 } |
8472 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); | 8470 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); |
8473 if (FLAG_parallel_recompilation) { | 8471 if (FLAG_parallel_recompilation) { |
8474 if (function->IsMarkedForLazyRecompilation()) { | 8472 if (function->IsMarkedForLazyRecompilation()) { |
8475 return Smi::FromInt(5); | 8473 return Smi::FromInt(5); // 5 == "parallel recompilation". |
8476 } | 8474 } |
8477 } | 8475 } |
8478 if (FLAG_always_opt) { | 8476 if (FLAG_always_opt) { |
8479 // We may have always opt, but that is more best-effort than a real | 8477 // We may have always opt, but that is more best-effort than a real |
8480 // promise, so we still say "no" if it is not optimized. | 8478 // promise, so we still say "no" if it is not optimized. |
8481 return function->IsOptimized() ? Smi::FromInt(3) // 3 == "always". | 8479 return function->IsOptimized() ? Smi::FromInt(3) // 3 == "always". |
8482 : Smi::FromInt(2); // 2 == "no". | 8480 : Smi::FromInt(2); // 2 == "no". |
8483 } | 8481 } |
| 8482 if (FLAG_deopt_every_n_times) { |
| 8483 return Smi::FromInt(6); // 6 == "maybe deopted". |
| 8484 } |
8484 return function->IsOptimized() ? Smi::FromInt(1) // 1 == "yes". | 8485 return function->IsOptimized() ? Smi::FromInt(1) // 1 == "yes". |
8485 : Smi::FromInt(2); // 2 == "no". | 8486 : Smi::FromInt(2); // 2 == "no". |
8486 } | 8487 } |
8487 | 8488 |
8488 | 8489 |
8489 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetOptimizationCount) { | 8490 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetOptimizationCount) { |
8490 HandleScope scope(isolate); | 8491 HandleScope scope(isolate); |
8491 ASSERT(args.length() == 1); | 8492 ASSERT(args.length() == 1); |
8492 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); | 8493 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); |
8493 return Smi::FromInt(function->shared()->opt_count()); | 8494 return Smi::FromInt(function->shared()->opt_count()); |
(...skipping 5583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14077 // Handle last resort GC and make sure to allow future allocations | 14078 // Handle last resort GC and make sure to allow future allocations |
14078 // to grow the heap without causing GCs (if possible). | 14079 // to grow the heap without causing GCs (if possible). |
14079 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14080 isolate->counters()->gc_last_resort_from_js()->Increment(); |
14080 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14081 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
14081 "Runtime::PerformGC"); | 14082 "Runtime::PerformGC"); |
14082 } | 14083 } |
14083 } | 14084 } |
14084 | 14085 |
14085 | 14086 |
14086 } } // namespace v8::internal | 14087 } } // namespace v8::internal |
OLD | NEW |