Chromium Code Reviews| 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 7972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7983 } | 7983 } |
| 7984 function->ReplaceCode(function->shared()->code()); | 7984 function->ReplaceCode(function->shared()->code()); |
| 7985 return function->code(); | 7985 return function->code(); |
| 7986 } | 7986 } |
| 7987 | 7987 |
| 7988 | 7988 |
| 7989 RUNTIME_FUNCTION(MaybeObject*, Runtime_ParallelRecompile) { | 7989 RUNTIME_FUNCTION(MaybeObject*, Runtime_ParallelRecompile) { |
| 7990 HandleScope handle_scope(isolate); | 7990 HandleScope handle_scope(isolate); |
| 7991 ASSERT(FLAG_parallel_recompilation); | 7991 ASSERT(FLAG_parallel_recompilation); |
| 7992 Compiler::RecompileParallel(args.at<JSFunction>(0)); | 7992 Compiler::RecompileParallel(args.at<JSFunction>(0)); |
| 7993 return *isolate->factory()->undefined_value(); | 7993 return isolate->heap()->undefined_value(); |
| 7994 } | 7994 } |
| 7995 | 7995 |
| 7996 | 7996 |
| 7997 RUNTIME_FUNCTION(MaybeObject*, Runtime_ForceParallelRecompile) { | |
| 7998 HandleScope handle_scope(isolate); | |
| 7999 ASSERT(FLAG_parallel_recompilation && FLAG_manual_parallel_recompilation); | |
| 8000 if (!isolate->optimizing_compiler_thread()->IsQueueAvailable()) { | |
| 8001 return isolate->Throw(*isolate->factory()->LookupAsciiSymbol( | |
| 8002 "Recompile queue is full.")); | |
|
Jakob Kummerow
2012/11/16 10:34:01
nit: I'd prefer to break the line after "Throw("
| |
| 8003 } | |
| 8004 CONVERT_ARG_HANDLE_CHECKED(JSFunction, fun, 0); | |
| 8005 fun->ReplaceCode(isolate->builtins()->builtin(Builtins::kParallelRecompile)); | |
| 8006 Compiler::RecompileParallel(fun); | |
| 8007 return isolate->heap()->undefined_value(); | |
| 8008 } | |
| 8009 | |
| 8010 | |
| 8011 RUNTIME_FUNCTION(MaybeObject*, Runtime_InstallRecompiledCode) { | |
| 8012 HandleScope handle_scope(isolate); | |
| 8013 ASSERT(FLAG_parallel_recompilation && FLAG_manual_parallel_recompilation); | |
| 8014 CONVERT_ARG_HANDLE_CHECKED(HeapObject, arg, 0); | |
| 8015 OptimizingCompilerThread* opt_thread = isolate->optimizing_compiler_thread(); | |
| 8016 if (!arg->IsJSFunction()) { | |
| 8017 opt_thread->InstallOptimizedFunctions(); | |
| 8018 } else if (!JSFunction::cast(*arg)->IsOptimized()) { | |
| 8019 Handle<SharedFunctionInfo> shared(JSFunction::cast(*arg)->shared()); | |
| 8020 while (*opt_thread->InstallNextOptimizedFunction() != *shared) { } | |
| 8021 } | |
| 8022 return isolate->heap()->undefined_value(); | |
| 8023 } | |
| 8024 | |
| 8025 | |
| 7997 class ActivationsFinder : public ThreadVisitor { | 8026 class ActivationsFinder : public ThreadVisitor { |
| 7998 public: | 8027 public: |
| 7999 explicit ActivationsFinder(JSFunction* function) | 8028 explicit ActivationsFinder(JSFunction* function) |
| 8000 : function_(function), has_activations_(false) {} | 8029 : function_(function), has_activations_(false) {} |
| 8001 | 8030 |
| 8002 void VisitThread(Isolate* isolate, ThreadLocalTop* top) { | 8031 void VisitThread(Isolate* isolate, ThreadLocalTop* top) { |
| 8003 if (has_activations_) return; | 8032 if (has_activations_) return; |
| 8004 | 8033 |
| 8005 for (JavaScriptFrameIterator it(isolate, top); !it.done(); it.Advance()) { | 8034 for (JavaScriptFrameIterator it(isolate, top); !it.done(); it.Advance()) { |
| 8006 JavaScriptFrame* frame = it.frame(); | 8035 JavaScriptFrame* frame = it.frame(); |
| (...skipping 5414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 13421 // Handle last resort GC and make sure to allow future allocations | 13450 // Handle last resort GC and make sure to allow future allocations |
| 13422 // to grow the heap without causing GCs (if possible). | 13451 // to grow the heap without causing GCs (if possible). |
| 13423 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13452 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 13424 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 13453 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
| 13425 "Runtime::PerformGC"); | 13454 "Runtime::PerformGC"); |
| 13426 } | 13455 } |
| 13427 } | 13456 } |
| 13428 | 13457 |
| 13429 | 13458 |
| 13430 } } // namespace v8::internal | 13459 } } // namespace v8::internal |
| OLD | NEW |