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

Side by Side Diff: src/execution.cc

Issue 7945009: Merge experimental/gc branch to the bleeding_edge. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 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
« no previous file with comments | « src/execution.h ('k') | src/extensions/gc-extension.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 370
371 371
372 void StackGuard::DisableInterrupts() { 372 void StackGuard::DisableInterrupts() {
373 ExecutionAccess access(isolate_); 373 ExecutionAccess access(isolate_);
374 reset_limits(access); 374 reset_limits(access);
375 } 375 }
376 376
377 377
378 bool StackGuard::IsInterrupted() { 378 bool StackGuard::IsInterrupted() {
379 ExecutionAccess access(isolate_); 379 ExecutionAccess access(isolate_);
380 return thread_local_.interrupt_flags_ & INTERRUPT; 380 return (thread_local_.interrupt_flags_ & INTERRUPT) != 0;
381 } 381 }
382 382
383 383
384 void StackGuard::Interrupt() { 384 void StackGuard::Interrupt() {
385 ExecutionAccess access(isolate_); 385 ExecutionAccess access(isolate_);
386 thread_local_.interrupt_flags_ |= INTERRUPT; 386 thread_local_.interrupt_flags_ |= INTERRUPT;
387 set_interrupt_limits(access); 387 set_interrupt_limits(access);
388 } 388 }
389 389
390 390
391 bool StackGuard::IsPreempted() { 391 bool StackGuard::IsPreempted() {
392 ExecutionAccess access(isolate_); 392 ExecutionAccess access(isolate_);
393 return thread_local_.interrupt_flags_ & PREEMPT; 393 return thread_local_.interrupt_flags_ & PREEMPT;
394 } 394 }
395 395
396 396
397 void StackGuard::Preempt() { 397 void StackGuard::Preempt() {
398 ExecutionAccess access(isolate_); 398 ExecutionAccess access(isolate_);
399 thread_local_.interrupt_flags_ |= PREEMPT; 399 thread_local_.interrupt_flags_ |= PREEMPT;
400 set_interrupt_limits(access); 400 set_interrupt_limits(access);
401 } 401 }
402 402
403 403
404 bool StackGuard::IsTerminateExecution() { 404 bool StackGuard::IsTerminateExecution() {
405 ExecutionAccess access(isolate_); 405 ExecutionAccess access(isolate_);
406 return thread_local_.interrupt_flags_ & TERMINATE; 406 return (thread_local_.interrupt_flags_ & TERMINATE) != 0;
407 } 407 }
408 408
409 409
410 void StackGuard::TerminateExecution() { 410 void StackGuard::TerminateExecution() {
411 ExecutionAccess access(isolate_); 411 ExecutionAccess access(isolate_);
412 thread_local_.interrupt_flags_ |= TERMINATE; 412 thread_local_.interrupt_flags_ |= TERMINATE;
413 set_interrupt_limits(access); 413 set_interrupt_limits(access);
414 } 414 }
415 415
416 416
417 bool StackGuard::IsRuntimeProfilerTick() { 417 bool StackGuard::IsRuntimeProfilerTick() {
418 ExecutionAccess access(isolate_); 418 ExecutionAccess access(isolate_);
419 return thread_local_.interrupt_flags_ & RUNTIME_PROFILER_TICK; 419 return (thread_local_.interrupt_flags_ & RUNTIME_PROFILER_TICK) != 0;
420 } 420 }
421 421
422 422
423 void StackGuard::RequestRuntimeProfilerTick() { 423 void StackGuard::RequestRuntimeProfilerTick() {
424 // Ignore calls if we're not optimizing or if we can't get the lock. 424 // Ignore calls if we're not optimizing or if we can't get the lock.
425 if (FLAG_opt && ExecutionAccess::TryLock(isolate_)) { 425 if (FLAG_opt && ExecutionAccess::TryLock(isolate_)) {
426 thread_local_.interrupt_flags_ |= RUNTIME_PROFILER_TICK; 426 thread_local_.interrupt_flags_ |= RUNTIME_PROFILER_TICK;
427 if (thread_local_.postpone_interrupts_nesting_ == 0) { 427 if (thread_local_.postpone_interrupts_nesting_ == 0) {
428 thread_local_.jslimit_ = thread_local_.climit_ = kInterruptLimit; 428 thread_local_.jslimit_ = thread_local_.climit_ = kInterruptLimit;
429 isolate_->heap()->SetStackLimits(); 429 isolate_->heap()->SetStackLimits();
430 } 430 }
431 ExecutionAccess::Unlock(isolate_); 431 ExecutionAccess::Unlock(isolate_);
432 } 432 }
433 } 433 }
434 434
435 435
436 bool StackGuard::IsGCRequest() {
437 ExecutionAccess access(isolate_);
438 return (thread_local_.interrupt_flags_ & GC_REQUEST) != 0;
439 }
440
441
442 void StackGuard::RequestGC() {
443 ExecutionAccess access(isolate_);
444 thread_local_.interrupt_flags_ |= GC_REQUEST;
445 if (thread_local_.postpone_interrupts_nesting_ == 0) {
446 thread_local_.jslimit_ = thread_local_.climit_ = kInterruptLimit;
447 isolate_->heap()->SetStackLimits();
448 }
449 }
450
451
436 #ifdef ENABLE_DEBUGGER_SUPPORT 452 #ifdef ENABLE_DEBUGGER_SUPPORT
437 bool StackGuard::IsDebugBreak() { 453 bool StackGuard::IsDebugBreak() {
438 ExecutionAccess access(isolate_); 454 ExecutionAccess access(isolate_);
439 return thread_local_.interrupt_flags_ & DEBUGBREAK; 455 return thread_local_.interrupt_flags_ & DEBUGBREAK;
440 } 456 }
441 457
442 458
443 void StackGuard::DebugBreak() { 459 void StackGuard::DebugBreak() {
444 ExecutionAccess access(isolate_); 460 ExecutionAccess access(isolate_);
445 thread_local_.interrupt_flags_ |= DEBUGBREAK; 461 thread_local_.interrupt_flags_ |= DEBUGBREAK;
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
845 isolate->debugger()->OnDebugBreak(isolate->factory()->undefined_value(), 861 isolate->debugger()->OnDebugBreak(isolate->factory()->undefined_value(),
846 debug_command_only); 862 debug_command_only);
847 } 863 }
848 864
849 865
850 #endif 866 #endif
851 867
852 MaybeObject* Execution::HandleStackGuardInterrupt() { 868 MaybeObject* Execution::HandleStackGuardInterrupt() {
853 Isolate* isolate = Isolate::Current(); 869 Isolate* isolate = Isolate::Current();
854 StackGuard* stack_guard = isolate->stack_guard(); 870 StackGuard* stack_guard = isolate->stack_guard();
871
872 if (stack_guard->IsGCRequest()) {
873 isolate->heap()->CollectAllGarbage(false);
874 stack_guard->Continue(GC_REQUEST);
875 }
876
855 isolate->counters()->stack_interrupts()->Increment(); 877 isolate->counters()->stack_interrupts()->Increment();
856 if (stack_guard->IsRuntimeProfilerTick()) { 878 if (stack_guard->IsRuntimeProfilerTick()) {
857 isolate->counters()->runtime_profiler_ticks()->Increment(); 879 isolate->counters()->runtime_profiler_ticks()->Increment();
858 stack_guard->Continue(RUNTIME_PROFILER_TICK); 880 stack_guard->Continue(RUNTIME_PROFILER_TICK);
859 isolate->runtime_profiler()->OptimizeNow(); 881 isolate->runtime_profiler()->OptimizeNow();
860 } 882 }
861 #ifdef ENABLE_DEBUGGER_SUPPORT 883 #ifdef ENABLE_DEBUGGER_SUPPORT
862 if (stack_guard->IsDebugBreak() || stack_guard->IsDebugCommand()) { 884 if (stack_guard->IsDebugBreak() || stack_guard->IsDebugCommand()) {
863 DebugBreakHelper(); 885 DebugBreakHelper();
864 } 886 }
865 #endif 887 #endif
866 if (stack_guard->IsPreempted()) RuntimePreempt(); 888 if (stack_guard->IsPreempted()) RuntimePreempt();
867 if (stack_guard->IsTerminateExecution()) { 889 if (stack_guard->IsTerminateExecution()) {
868 stack_guard->Continue(TERMINATE); 890 stack_guard->Continue(TERMINATE);
869 return isolate->TerminateExecution(); 891 return isolate->TerminateExecution();
870 } 892 }
871 if (stack_guard->IsInterrupted()) { 893 if (stack_guard->IsInterrupted()) {
872 stack_guard->Continue(INTERRUPT); 894 stack_guard->Continue(INTERRUPT);
873 return isolate->StackOverflow(); 895 return isolate->StackOverflow();
874 } 896 }
875 return isolate->heap()->undefined_value(); 897 return isolate->heap()->undefined_value();
876 } 898 }
877 899
878 } } // namespace v8::internal 900 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/execution.h ('k') | src/extensions/gc-extension.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698