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

Side by Side Diff: src/execution.cc

Issue 309533009: Release execution lock before dispatching interrupt handling. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: small fix to rebase mistake Created 6 years, 6 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
« no previous file with comments | « src/execution.h ('k') | test/cctest/test-debug.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "execution.h" 5 #include "execution.h"
6 6
7 #include "bootstrapper.h" 7 #include "bootstrapper.h"
8 #include "codegen.h" 8 #include "codegen.h"
9 #include "deoptimizer.h" 9 #include "deoptimizer.h"
10 #include "isolate-inl.h" 10 #include "isolate-inl.h"
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 359
360 void StackGuard::ClearInterrupt(int flagbit) { 360 void StackGuard::ClearInterrupt(int flagbit) {
361 ExecutionAccess access(isolate_); 361 ExecutionAccess access(isolate_);
362 thread_local_.interrupt_flags_ &= ~flagbit; 362 thread_local_.interrupt_flags_ &= ~flagbit;
363 if (!should_postpone_interrupts(access) && !has_pending_interrupts(access)) { 363 if (!should_postpone_interrupts(access) && !has_pending_interrupts(access)) {
364 reset_limits(access); 364 reset_limits(access);
365 } 365 }
366 } 366 }
367 367
368 368
369 bool StackGuard::CheckAndClearInterrupt(InterruptFlag flag, 369 bool StackGuard::CheckAndClearInterrupt(InterruptFlag flag) {
370 const ExecutionAccess& lock) { 370 ExecutionAccess access(isolate_);
371 int flagbit = 1 << flag; 371 int flagbit = 1 << flag;
372 bool result = (thread_local_.interrupt_flags_ & flagbit); 372 bool result = (thread_local_.interrupt_flags_ & flagbit);
373 thread_local_.interrupt_flags_ &= ~flagbit; 373 thread_local_.interrupt_flags_ &= ~flagbit;
374 if (!should_postpone_interrupts(lock) && !has_pending_interrupts(lock)) { 374 if (!should_postpone_interrupts(access) && !has_pending_interrupts(access)) {
375 reset_limits(lock); 375 reset_limits(access);
376 } 376 }
377 return result; 377 return result;
378 } 378 }
379 379
380 380
381 char* StackGuard::ArchiveStackGuard(char* to) { 381 char* StackGuard::ArchiveStackGuard(char* to) {
382 ExecutionAccess access(isolate_); 382 ExecutionAccess access(isolate_);
383 MemCopy(to, reinterpret_cast<char*>(&thread_local_), sizeof(ThreadLocal)); 383 MemCopy(to, reinterpret_cast<char*>(&thread_local_), sizeof(ThreadLocal));
384 ThreadLocal blank; 384 ThreadLocal blank;
385 385
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 Handle<Object> result; 648 Handle<Object> result;
649 if (!maybe_result.ToHandle(&result) || !result->IsString()) { 649 if (!maybe_result.ToHandle(&result) || !result->IsString()) {
650 return isolate->factory()->empty_string(); 650 return isolate->factory()->empty_string();
651 } 651 }
652 652
653 return Handle<String>::cast(result); 653 return Handle<String>::cast(result);
654 } 654 }
655 655
656 656
657 Object* StackGuard::HandleInterrupts() { 657 Object* StackGuard::HandleInterrupts() {
658 bool has_api_interrupt = false;
659 { 658 {
660 ExecutionAccess access(isolate_); 659 ExecutionAccess access(isolate_);
661 if (should_postpone_interrupts(access)) { 660 if (should_postpone_interrupts(access)) {
662 return isolate_->heap()->undefined_value(); 661 return isolate_->heap()->undefined_value();
663 } 662 }
664
665 if (CheckAndClearInterrupt(GC_REQUEST, access)) {
666 isolate_->heap()->CollectAllGarbage(Heap::kNoGCFlags, "GC interrupt");
667 }
668
669 if (CheckDebugBreak() || CheckDebugCommand()) {
670 isolate_->debug()->DebugBreakHelper();
671 }
672
673 if (CheckAndClearInterrupt(TERMINATE_EXECUTION, access)) {
674 return isolate_->TerminateExecution();
675 }
676
677 if (CheckAndClearInterrupt(DEOPT_MARKED_ALLOCATION_SITES, access)) {
678 isolate_->heap()->DeoptMarkedAllocationSites();
679 }
680
681 if (CheckAndClearInterrupt(INSTALL_CODE, access)) {
682 ASSERT(isolate_->concurrent_recompilation_enabled());
683 isolate_->optimizing_compiler_thread()->InstallOptimizedFunctions();
684 }
685
686 has_api_interrupt = CheckAndClearInterrupt(API_INTERRUPT, access);
687
688 isolate_->counters()->stack_interrupts()->Increment();
689 isolate_->counters()->runtime_profiler_ticks()->Increment();
690 isolate_->runtime_profiler()->OptimizeNow();
691 } 663 }
692 664
693 if (has_api_interrupt) { 665 if (CheckAndClearInterrupt(GC_REQUEST)) {
666 isolate_->heap()->CollectAllGarbage(Heap::kNoGCFlags, "GC interrupt");
667 }
668
669 if (CheckDebugBreak() || CheckDebugCommand()) {
670 isolate_->debug()->DebugBreakHelper();
671 }
672
673 if (CheckAndClearInterrupt(TERMINATE_EXECUTION)) {
674 return isolate_->TerminateExecution();
675 }
676
677 if (CheckAndClearInterrupt(DEOPT_MARKED_ALLOCATION_SITES)) {
678 isolate_->heap()->DeoptMarkedAllocationSites();
679 }
680
681 if (CheckAndClearInterrupt(INSTALL_CODE)) {
682 ASSERT(isolate_->concurrent_recompilation_enabled());
683 isolate_->optimizing_compiler_thread()->InstallOptimizedFunctions();
684 }
685
686 if (CheckAndClearInterrupt(API_INTERRUPT)) {
694 // Callback must be invoked outside of ExecusionAccess lock. 687 // Callback must be invoked outside of ExecusionAccess lock.
695 isolate_->InvokeApiInterruptCallback(); 688 isolate_->InvokeApiInterruptCallback();
696 } 689 }
697 690
691 isolate_->counters()->stack_interrupts()->Increment();
692 isolate_->counters()->runtime_profiler_ticks()->Increment();
693 isolate_->runtime_profiler()->OptimizeNow();
694
698 return isolate_->heap()->undefined_value(); 695 return isolate_->heap()->undefined_value();
699 } 696 }
700 697
701 } } // namespace v8::internal 698 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/execution.h ('k') | test/cctest/test-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698