Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(292)

Side by Side Diff: src/runtime.cc

Issue 23542029: Simplify installing concurrently recompiled code. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: add stack check when calling function that is in recompile queue. Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 8326 matching lines...) Expand 10 before | Expand all | Expand 10 after
8337 } 8337 }
8338 function->shared()->code()->set_profiler_ticks(0); 8338 function->shared()->code()->set_profiler_ticks(0);
8339 ASSERT(FLAG_concurrent_recompilation); 8339 ASSERT(FLAG_concurrent_recompilation);
8340 if (!Compiler::RecompileConcurrent(function)) { 8340 if (!Compiler::RecompileConcurrent(function)) {
8341 function->ReplaceCode(function->shared()->code()); 8341 function->ReplaceCode(function->shared()->code());
8342 } 8342 }
8343 return isolate->heap()->undefined_value(); 8343 return isolate->heap()->undefined_value();
8344 } 8344 }
8345 8345
8346 8346
8347 RUNTIME_FUNCTION(MaybeObject*, Runtime_InstallRecompiledCode) {
8348 HandleScope handle_scope(isolate);
8349 ASSERT(args.length() == 1);
8350 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
8351 ASSERT(isolate->use_crankshaft() && FLAG_concurrent_recompilation);
8352 isolate->optimizing_compiler_thread()->InstallOptimizedFunctions();
8353 return function->code();
8354 }
8355
8356
8357 class ActivationsFinder : public ThreadVisitor { 8347 class ActivationsFinder : public ThreadVisitor {
8358 public: 8348 public:
8359 Code* code_; 8349 Code* code_;
8360 bool has_code_activations_; 8350 bool has_code_activations_;
8361 8351
8362 explicit ActivationsFinder(Code* code) 8352 explicit ActivationsFinder(Code* code)
8363 : code_(code), 8353 : code_(code),
8364 has_code_activations_(false) { } 8354 has_code_activations_(false) { }
8365 8355
8366 void VisitThread(Isolate* isolate, ThreadLocalTop* top) { 8356 void VisitThread(Isolate* isolate, ThreadLocalTop* top) {
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
8544 } 8534 }
8545 bool sync_with_compiler_thread = true; 8535 bool sync_with_compiler_thread = true;
8546 if (args.length() == 2) { 8536 if (args.length() == 2) {
8547 CONVERT_ARG_HANDLE_CHECKED(String, sync, 1); 8537 CONVERT_ARG_HANDLE_CHECKED(String, sync, 1);
8548 if (sync->IsOneByteEqualTo(STATIC_ASCII_VECTOR("no sync"))) { 8538 if (sync->IsOneByteEqualTo(STATIC_ASCII_VECTOR("no sync"))) {
8549 sync_with_compiler_thread = false; 8539 sync_with_compiler_thread = false;
8550 } 8540 }
8551 } 8541 }
8552 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); 8542 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
8553 if (FLAG_concurrent_recompilation && sync_with_compiler_thread) { 8543 if (FLAG_concurrent_recompilation && sync_with_compiler_thread) {
8554 while (function->IsInRecompileQueue() || 8544 while (function->IsInRecompileQueue()) {
8555 function->IsMarkedForInstallingRecompiledCode()) {
8556 isolate->optimizing_compiler_thread()->InstallOptimizedFunctions(); 8545 isolate->optimizing_compiler_thread()->InstallOptimizedFunctions();
8557 OS::Sleep(50); 8546 OS::Sleep(50);
8558 } 8547 }
8559 } 8548 }
8560 if (FLAG_always_opt) { 8549 if (FLAG_always_opt) {
8561 // We may have always opt, but that is more best-effort than a real 8550 // We may have always opt, but that is more best-effort than a real
8562 // promise, so we still say "no" if it is not optimized. 8551 // promise, so we still say "no" if it is not optimized.
8563 return function->IsOptimized() ? Smi::FromInt(3) // 3 == "always". 8552 return function->IsOptimized() ? Smi::FromInt(3) // 3 == "always".
8564 : Smi::FromInt(2); // 2 == "no". 8553 : Smi::FromInt(2); // 2 == "no".
8565 } 8554 }
(...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after
9373 } 9362 }
9374 9363
9375 9364
9376 9365
9377 RUNTIME_FUNCTION(MaybeObject*, Runtime_StackGuard) { 9366 RUNTIME_FUNCTION(MaybeObject*, Runtime_StackGuard) {
9378 SealHandleScope shs(isolate); 9367 SealHandleScope shs(isolate);
9379 ASSERT(args.length() == 0); 9368 ASSERT(args.length() == 0);
9380 9369
9381 // First check if this is a real stack overflow. 9370 // First check if this is a real stack overflow.
9382 if (isolate->stack_guard()->IsStackOverflow()) { 9371 if (isolate->stack_guard()->IsStackOverflow()) {
9383 SealHandleScope shs(isolate);
9384 return isolate->StackOverflow(); 9372 return isolate->StackOverflow();
9385 } 9373 }
9386 9374
9387 return Execution::HandleStackGuardInterrupt(isolate); 9375 return Execution::HandleStackGuardInterrupt(isolate);
9388 } 9376 }
9389 9377
9390 9378
9379 RUNTIME_FUNCTION(MaybeObject*, Runtime_TryInstallRecompiledCode) {
9380 HandleScope scope(isolate);
9381 ASSERT(args.length() == 1);
9382 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
9383
9384 // First check if this is a real stack overflow.
9385 if (isolate->stack_guard()->IsStackOverflow()) {
9386 SealHandleScope shs(isolate);
9387 return isolate->StackOverflow();
9388 }
9389
9390 isolate->optimizing_compiler_thread()->InstallOptimizedFunctions();
9391 return (function->IsOptimized()) ? function->code()
9392 : function->shared()->code();
9393 }
9394
9395
9391 RUNTIME_FUNCTION(MaybeObject*, Runtime_Interrupt) { 9396 RUNTIME_FUNCTION(MaybeObject*, Runtime_Interrupt) {
9392 SealHandleScope shs(isolate); 9397 SealHandleScope shs(isolate);
9393 ASSERT(args.length() == 0); 9398 ASSERT(args.length() == 0);
9394 return Execution::HandleStackGuardInterrupt(isolate); 9399 return Execution::HandleStackGuardInterrupt(isolate);
9395 } 9400 }
9396 9401
9397 9402
9398 static int StackSize(Isolate* isolate) { 9403 static int StackSize(Isolate* isolate) {
9399 int n = 0; 9404 int n = 0;
9400 for (JavaScriptFrameIterator it(isolate); !it.done(); it.Advance()) n++; 9405 for (JavaScriptFrameIterator it(isolate); !it.done(); it.Advance()) n++;
(...skipping 5360 matching lines...) Expand 10 before | Expand all | Expand 10 after
14761 // Handle last resort GC and make sure to allow future allocations 14766 // Handle last resort GC and make sure to allow future allocations
14762 // to grow the heap without causing GCs (if possible). 14767 // to grow the heap without causing GCs (if possible).
14763 isolate->counters()->gc_last_resort_from_js()->Increment(); 14768 isolate->counters()->gc_last_resort_from_js()->Increment();
14764 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 14769 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
14765 "Runtime::PerformGC"); 14770 "Runtime::PerformGC");
14766 } 14771 }
14767 } 14772 }
14768 14773
14769 14774
14770 } } // namespace v8::internal 14775 } } // namespace v8::internal
OLDNEW
« src/objects.h ('K') | « src/runtime.h ('k') | src/runtime-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698