| 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 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 isolate, | 361 isolate, |
| 362 isolate->run_microtasks(), | 362 isolate->run_microtasks(), |
| 363 isolate->factory()->undefined_value(), | 363 isolate->factory()->undefined_value(), |
| 364 0, | 364 0, |
| 365 NULL, | 365 NULL, |
| 366 &threw); | 366 &threw); |
| 367 ASSERT(!threw); | 367 ASSERT(!threw); |
| 368 } | 368 } |
| 369 | 369 |
| 370 | 370 |
| 371 void Execution::EnqueueMicrotask(Isolate* isolate, Handle<Object> microtask) { | |
| 372 bool threw = false; | |
| 373 Handle<Object> args[] = { microtask }; | |
| 374 Execution::Call( | |
| 375 isolate, | |
| 376 isolate->enqueue_external_microtask(), | |
| 377 isolate->factory()->undefined_value(), | |
| 378 1, | |
| 379 args, | |
| 380 &threw); | |
| 381 ASSERT(!threw); | |
| 382 } | |
| 383 | |
| 384 | |
| 385 bool StackGuard::IsStackOverflow() { | 371 bool StackGuard::IsStackOverflow() { |
| 386 ExecutionAccess access(isolate_); | 372 ExecutionAccess access(isolate_); |
| 387 return (thread_local_.jslimit_ != kInterruptLimit && | 373 return (thread_local_.jslimit_ != kInterruptLimit && |
| 388 thread_local_.climit_ != kInterruptLimit); | 374 thread_local_.climit_ != kInterruptLimit); |
| 389 } | 375 } |
| 390 | 376 |
| 391 | 377 |
| 392 void StackGuard::EnableInterrupts() { | 378 void StackGuard::EnableInterrupts() { |
| 393 ExecutionAccess access(isolate_); | 379 ExecutionAccess access(isolate_); |
| 394 if (has_pending_interrupts(access)) { | 380 if (has_pending_interrupts(access)) { |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 } | 495 } |
| 510 | 496 |
| 511 | 497 |
| 512 void StackGuard::FullDeopt() { | 498 void StackGuard::FullDeopt() { |
| 513 ExecutionAccess access(isolate_); | 499 ExecutionAccess access(isolate_); |
| 514 thread_local_.interrupt_flags_ |= FULL_DEOPT; | 500 thread_local_.interrupt_flags_ |= FULL_DEOPT; |
| 515 set_interrupt_limits(access); | 501 set_interrupt_limits(access); |
| 516 } | 502 } |
| 517 | 503 |
| 518 | 504 |
| 519 bool StackGuard::IsDeoptMarkedAllocationSites() { | 505 bool StackGuard::IsDeoptMarkedCode() { |
| 520 ExecutionAccess access(isolate_); | 506 ExecutionAccess access(isolate_); |
| 521 return (thread_local_.interrupt_flags_ & DEOPT_MARKED_ALLOCATION_SITES) != 0; | 507 return (thread_local_.interrupt_flags_ & DEOPT_MARKED_CODE) != 0; |
| 522 } | 508 } |
| 523 | 509 |
| 524 | 510 |
| 525 void StackGuard::DeoptMarkedAllocationSites() { | 511 void StackGuard::DeoptMarkedCode() { |
| 526 ExecutionAccess access(isolate_); | 512 ExecutionAccess access(isolate_); |
| 527 thread_local_.interrupt_flags_ |= DEOPT_MARKED_ALLOCATION_SITES; | 513 thread_local_.interrupt_flags_ |= DEOPT_MARKED_CODE; |
| 528 set_interrupt_limits(access); | 514 set_interrupt_limits(access); |
| 529 } | 515 } |
| 530 | 516 |
| 531 | 517 |
| 532 #ifdef ENABLE_DEBUGGER_SUPPORT | 518 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 533 bool StackGuard::IsDebugBreak() { | 519 bool StackGuard::IsDebugBreak() { |
| 534 ExecutionAccess access(isolate_); | 520 ExecutionAccess access(isolate_); |
| 535 return thread_local_.interrupt_flags_ & DEBUGBREAK; | 521 return thread_local_.interrupt_flags_ & DEBUGBREAK; |
| 536 } | 522 } |
| 537 | 523 |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1033 return isolate->TerminateExecution(); | 1019 return isolate->TerminateExecution(); |
| 1034 } | 1020 } |
| 1035 if (stack_guard->IsInterrupted()) { | 1021 if (stack_guard->IsInterrupted()) { |
| 1036 stack_guard->Continue(INTERRUPT); | 1022 stack_guard->Continue(INTERRUPT); |
| 1037 return isolate->StackOverflow(); | 1023 return isolate->StackOverflow(); |
| 1038 } | 1024 } |
| 1039 if (stack_guard->IsFullDeopt()) { | 1025 if (stack_guard->IsFullDeopt()) { |
| 1040 stack_guard->Continue(FULL_DEOPT); | 1026 stack_guard->Continue(FULL_DEOPT); |
| 1041 Deoptimizer::DeoptimizeAll(isolate); | 1027 Deoptimizer::DeoptimizeAll(isolate); |
| 1042 } | 1028 } |
| 1043 if (stack_guard->IsDeoptMarkedAllocationSites()) { | 1029 if (stack_guard->IsDeoptMarkedCode()) { |
| 1044 stack_guard->Continue(DEOPT_MARKED_ALLOCATION_SITES); | 1030 stack_guard->Continue(DEOPT_MARKED_CODE); |
| 1045 isolate->heap()->DeoptMarkedAllocationSites(); | 1031 Deoptimizer::DeoptimizeMarkedCode(isolate); |
| 1046 } | 1032 } |
| 1047 if (stack_guard->IsInstallCodeRequest()) { | 1033 if (stack_guard->IsInstallCodeRequest()) { |
| 1048 ASSERT(isolate->concurrent_recompilation_enabled()); | 1034 ASSERT(isolate->concurrent_recompilation_enabled()); |
| 1049 stack_guard->Continue(INSTALL_CODE); | 1035 stack_guard->Continue(INSTALL_CODE); |
| 1050 isolate->optimizing_compiler_thread()->InstallOptimizedFunctions(); | 1036 isolate->optimizing_compiler_thread()->InstallOptimizedFunctions(); |
| 1051 } | 1037 } |
| 1052 isolate->runtime_profiler()->OptimizeNow(); | 1038 isolate->runtime_profiler()->OptimizeNow(); |
| 1053 return isolate->heap()->undefined_value(); | 1039 return isolate->heap()->undefined_value(); |
| 1054 } | 1040 } |
| 1055 | 1041 |
| 1056 | 1042 |
| 1057 } } // namespace v8::internal | 1043 } } // namespace v8::internal |
| OLD | NEW |