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 8392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8403 | 8403 |
8404 RUNTIME_FUNCTION(MaybeObject*, Runtime_ConcurrentRecompile) { | 8404 RUNTIME_FUNCTION(MaybeObject*, Runtime_ConcurrentRecompile) { |
8405 HandleScope handle_scope(isolate); | 8405 HandleScope handle_scope(isolate); |
8406 ASSERT(args.length() == 1); | 8406 ASSERT(args.length() == 1); |
8407 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); | 8407 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); |
8408 if (!AllowOptimization(isolate, function)) { | 8408 if (!AllowOptimization(isolate, function)) { |
8409 function->ReplaceCode(function->shared()->code()); | 8409 function->ReplaceCode(function->shared()->code()); |
8410 return isolate->heap()->undefined_value(); | 8410 return isolate->heap()->undefined_value(); |
8411 } | 8411 } |
8412 function->shared()->code()->set_profiler_ticks(0); | 8412 function->shared()->code()->set_profiler_ticks(0); |
8413 ASSERT(FLAG_concurrent_recompilation); | 8413 ASSERT(isolate->concurrent_recompilation_enabled()); |
8414 if (!Compiler::RecompileConcurrent(function)) { | 8414 if (!Compiler::RecompileConcurrent(function)) { |
8415 function->ReplaceCode(function->shared()->code()); | 8415 function->ReplaceCode(function->shared()->code()); |
8416 } | 8416 } |
8417 return isolate->heap()->undefined_value(); | 8417 return isolate->heap()->undefined_value(); |
8418 } | 8418 } |
8419 | 8419 |
8420 | 8420 |
8421 class ActivationsFinder : public ThreadVisitor { | 8421 class ActivationsFinder : public ThreadVisitor { |
8422 public: | 8422 public: |
8423 Code* code_; | 8423 Code* code_; |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8540 #if defined(USE_SIMULATOR) | 8540 #if defined(USE_SIMULATOR) |
8541 return isolate->heap()->true_value(); | 8541 return isolate->heap()->true_value(); |
8542 #else | 8542 #else |
8543 return isolate->heap()->false_value(); | 8543 return isolate->heap()->false_value(); |
8544 #endif | 8544 #endif |
8545 } | 8545 } |
8546 | 8546 |
8547 | 8547 |
8548 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsConcurrentRecompilationSupported) { | 8548 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsConcurrentRecompilationSupported) { |
8549 HandleScope scope(isolate); | 8549 HandleScope scope(isolate); |
8550 return FLAG_concurrent_recompilation | 8550 return isolate->concurrent_recompilation_enabled() |
8551 ? isolate->heap()->true_value() : isolate->heap()->false_value(); | 8551 ? isolate->heap()->true_value() : isolate->heap()->false_value(); |
8552 } | 8552 } |
8553 | 8553 |
8554 | 8554 |
8555 RUNTIME_FUNCTION(MaybeObject*, Runtime_OptimizeFunctionOnNextCall) { | 8555 RUNTIME_FUNCTION(MaybeObject*, Runtime_OptimizeFunctionOnNextCall) { |
8556 HandleScope scope(isolate); | 8556 HandleScope scope(isolate); |
8557 RUNTIME_ASSERT(args.length() == 1 || args.length() == 2); | 8557 RUNTIME_ASSERT(args.length() == 1 || args.length() == 2); |
8558 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); | 8558 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); |
8559 | 8559 |
8560 if (!function->IsOptimizable()) return isolate->heap()->undefined_value(); | 8560 if (!function->IsOptimizable()) return isolate->heap()->undefined_value(); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8598 return Smi::FromInt(4); // 4 == "never". | 8598 return Smi::FromInt(4); // 4 == "never". |
8599 } | 8599 } |
8600 bool sync_with_compiler_thread = true; | 8600 bool sync_with_compiler_thread = true; |
8601 if (args.length() == 2) { | 8601 if (args.length() == 2) { |
8602 CONVERT_ARG_HANDLE_CHECKED(String, sync, 1); | 8602 CONVERT_ARG_HANDLE_CHECKED(String, sync, 1); |
8603 if (sync->IsOneByteEqualTo(STATIC_ASCII_VECTOR("no sync"))) { | 8603 if (sync->IsOneByteEqualTo(STATIC_ASCII_VECTOR("no sync"))) { |
8604 sync_with_compiler_thread = false; | 8604 sync_with_compiler_thread = false; |
8605 } | 8605 } |
8606 } | 8606 } |
8607 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); | 8607 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); |
8608 if (FLAG_concurrent_recompilation && sync_with_compiler_thread) { | 8608 if (isolate->concurrent_recompilation_enabled() && |
| 8609 sync_with_compiler_thread) { |
8609 while (function->IsInRecompileQueue()) { | 8610 while (function->IsInRecompileQueue()) { |
8610 isolate->optimizing_compiler_thread()->InstallOptimizedFunctions(); | 8611 isolate->optimizing_compiler_thread()->InstallOptimizedFunctions(); |
8611 OS::Sleep(50); | 8612 OS::Sleep(50); |
8612 } | 8613 } |
8613 } | 8614 } |
8614 if (FLAG_always_opt) { | 8615 if (FLAG_always_opt) { |
8615 // We may have always opt, but that is more best-effort than a real | 8616 // We may have always opt, but that is more best-effort than a real |
8616 // promise, so we still say "no" if it is not optimized. | 8617 // promise, so we still say "no" if it is not optimized. |
8617 return function->IsOptimized() ? Smi::FromInt(3) // 3 == "always". | 8618 return function->IsOptimized() ? Smi::FromInt(3) // 3 == "always". |
8618 : Smi::FromInt(2); // 2 == "no". | 8619 : Smi::FromInt(2); // 2 == "no". |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8676 ASSERT(pc_offset == | 8677 ASSERT(pc_offset == |
8677 static_cast<uint32_t>(frame->pc() - unoptimized->instruction_start())); | 8678 static_cast<uint32_t>(frame->pc() - unoptimized->instruction_start())); |
8678 #endif // DEBUG | 8679 #endif // DEBUG |
8679 | 8680 |
8680 // We're not prepared to handle a function with arguments object. | 8681 // We're not prepared to handle a function with arguments object. |
8681 ASSERT(!function->shared()->uses_arguments()); | 8682 ASSERT(!function->shared()->uses_arguments()); |
8682 | 8683 |
8683 Handle<Code> result = Handle<Code>::null(); | 8684 Handle<Code> result = Handle<Code>::null(); |
8684 BailoutId ast_id = BailoutId::None(); | 8685 BailoutId ast_id = BailoutId::None(); |
8685 | 8686 |
8686 if (FLAG_concurrent_osr) { | 8687 if (isolate->concurrent_osr_enabled()) { |
8687 if (isolate->optimizing_compiler_thread()-> | 8688 if (isolate->optimizing_compiler_thread()-> |
8688 IsQueuedForOSR(function, pc_offset)) { | 8689 IsQueuedForOSR(function, pc_offset)) { |
8689 // Still waiting for the optimizing compiler thread to finish. Carry on. | 8690 // Still waiting for the optimizing compiler thread to finish. Carry on. |
8690 if (FLAG_trace_osr) { | 8691 if (FLAG_trace_osr) { |
8691 PrintF("[COSR - polling recompile tasks for "); | 8692 PrintF("[COSR - polling recompile tasks for "); |
8692 function->PrintName(); | 8693 function->PrintName(); |
8693 PrintF("]\n"); | 8694 PrintF("]\n"); |
8694 } | 8695 } |
8695 return NULL; | 8696 return NULL; |
8696 } | 8697 } |
(...skipping 6189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14886 // Handle last resort GC and make sure to allow future allocations | 14887 // Handle last resort GC and make sure to allow future allocations |
14887 // to grow the heap without causing GCs (if possible). | 14888 // to grow the heap without causing GCs (if possible). |
14888 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14889 isolate->counters()->gc_last_resort_from_js()->Increment(); |
14889 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14890 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
14890 "Runtime::PerformGC"); | 14891 "Runtime::PerformGC"); |
14891 } | 14892 } |
14892 } | 14893 } |
14893 | 14894 |
14894 | 14895 |
14895 } } // namespace v8::internal | 14896 } } // namespace v8::internal |
OLD | NEW |