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 8423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8434 RUNTIME_FUNCTION(MaybeObject*, Runtime_NeverOptimizeFunction) { | 8434 RUNTIME_FUNCTION(MaybeObject*, Runtime_NeverOptimizeFunction) { |
8435 HandleScope scope(isolate); | 8435 HandleScope scope(isolate); |
8436 ASSERT(args.length() == 1); | 8436 ASSERT(args.length() == 1); |
8437 CONVERT_ARG_CHECKED(JSFunction, function, 0); | 8437 CONVERT_ARG_CHECKED(JSFunction, function, 0); |
8438 ASSERT(!function->IsOptimized()); | 8438 ASSERT(!function->IsOptimized()); |
8439 function->shared()->set_optimization_disabled(true); | 8439 function->shared()->set_optimization_disabled(true); |
8440 return isolate->heap()->undefined_value(); | 8440 return isolate->heap()->undefined_value(); |
8441 } | 8441 } |
8442 | 8442 |
8443 | 8443 |
8444 RUNTIME_FUNCTION(MaybeObject*, Runtime_CompleteOptimization) { | 8444 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetOptimizationStatus) { |
8445 HandleScope scope(isolate); | 8445 HandleScope scope(isolate); |
8446 ASSERT(args.length() == 1); | 8446 RUNTIME_ASSERT(args.length() == 1 || args.length() == 2); |
| 8447 if (!V8::UseCrankshaft()) { |
| 8448 return Smi::FromInt(4); // 4 == "never". |
| 8449 } |
| 8450 bool sync_with_compiler_thread = true; |
| 8451 if (args.length() == 2) { |
| 8452 CONVERT_ARG_HANDLE_CHECKED(String, sync, 1); |
| 8453 if (sync->IsOneByteEqualTo(STATIC_ASCII_VECTOR("no sync"))) { |
| 8454 sync_with_compiler_thread = false; |
| 8455 } |
| 8456 } |
8447 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); | 8457 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); |
8448 if (FLAG_parallel_recompilation && V8::UseCrankshaft()) { | 8458 if (FLAG_parallel_recompilation && sync_with_compiler_thread) { |
8449 // While function is in optimization pipeline, it is marked accordingly. | |
8450 // Note that if the debugger is activated during parallel recompilation, | |
8451 // the function will be marked with the lazy-recompile builtin, which is | |
8452 // not related to parallel recompilation. | |
8453 while (function->IsMarkedForParallelRecompilation() || | 8459 while (function->IsMarkedForParallelRecompilation() || |
8454 function->IsInRecompileQueue() || | 8460 function->IsInRecompileQueue() || |
8455 function->IsMarkedForInstallingRecompiledCode()) { | 8461 function->IsMarkedForInstallingRecompiledCode()) { |
8456 isolate->optimizing_compiler_thread()->InstallOptimizedFunctions(); | 8462 isolate->optimizing_compiler_thread()->InstallOptimizedFunctions(); |
8457 OS::Sleep(50); | 8463 OS::Sleep(50); |
8458 } | 8464 } |
8459 } | 8465 } |
8460 return isolate->heap()->undefined_value(); | |
8461 } | |
8462 | |
8463 | |
8464 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetOptimizationStatus) { | |
8465 HandleScope scope(isolate); | |
8466 ASSERT(args.length() == 1); | |
8467 if (!V8::UseCrankshaft()) { | |
8468 return Smi::FromInt(4); // 4 == "never". | |
8469 } | |
8470 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); | |
8471 if (FLAG_parallel_recompilation) { | |
8472 if (function->IsMarkedForLazyRecompilation()) { | |
8473 return Smi::FromInt(5); // 5 == "parallel recompilation". | |
8474 } | |
8475 } | |
8476 if (FLAG_always_opt) { | 8466 if (FLAG_always_opt) { |
8477 // We may have always opt, but that is more best-effort than a real | 8467 // We may have always opt, but that is more best-effort than a real |
8478 // promise, so we still say "no" if it is not optimized. | 8468 // promise, so we still say "no" if it is not optimized. |
8479 return function->IsOptimized() ? Smi::FromInt(3) // 3 == "always". | 8469 return function->IsOptimized() ? Smi::FromInt(3) // 3 == "always". |
8480 : Smi::FromInt(2); // 2 == "no". | 8470 : Smi::FromInt(2); // 2 == "no". |
8481 } | 8471 } |
8482 if (FLAG_deopt_every_n_times) { | 8472 if (FLAG_deopt_every_n_times) { |
8483 return Smi::FromInt(6); // 6 == "maybe deopted". | 8473 return Smi::FromInt(6); // 6 == "maybe deopted". |
8484 } | 8474 } |
8485 return function->IsOptimized() ? Smi::FromInt(1) // 1 == "yes". | 8475 return function->IsOptimized() ? Smi::FromInt(1) // 1 == "yes". |
(...skipping 5494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13980 // Handle last resort GC and make sure to allow future allocations | 13970 // Handle last resort GC and make sure to allow future allocations |
13981 // to grow the heap without causing GCs (if possible). | 13971 // to grow the heap without causing GCs (if possible). |
13982 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13972 isolate->counters()->gc_last_resort_from_js()->Increment(); |
13983 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 13973 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
13984 "Runtime::PerformGC"); | 13974 "Runtime::PerformGC"); |
13985 } | 13975 } |
13986 } | 13976 } |
13987 | 13977 |
13988 | 13978 |
13989 } } // namespace v8::internal | 13979 } } // namespace v8::internal |
OLD | NEW |