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

Side by Side Diff: src/api.cc

Issue 264233005: Clean up stack guard interrupts. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comments Created 6 years, 7 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 | « no previous file | src/arm/regexp-macro-assembler-arm.cc » ('j') | src/execution.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 "api.h" 5 #include "api.h"
6 6
7 #include <string.h> // For memcpy, strlen. 7 #include <string.h> // For memcpy, strlen.
8 #include <cmath> // For isnan. 8 #include <cmath> // For isnan.
9 #include "../include/v8-debug.h" 9 #include "../include/v8-debug.h"
10 #include "../include/v8-profiler.h" 10 #include "../include/v8-profiler.h"
(...skipping 6446 matching lines...) Expand 10 before | Expand all | Expand 10 after
6457 isolate->EnqueueMicrotask(microtask); 6457 isolate->EnqueueMicrotask(microtask);
6458 } 6458 }
6459 6459
6460 6460
6461 void V8::SetAutorunMicrotasks(Isolate* isolate, bool autorun) { 6461 void V8::SetAutorunMicrotasks(Isolate* isolate, bool autorun) {
6462 isolate->SetAutorunMicrotasks(autorun); 6462 isolate->SetAutorunMicrotasks(autorun);
6463 } 6463 }
6464 6464
6465 6465
6466 void V8::TerminateExecution(Isolate* isolate) { 6466 void V8::TerminateExecution(Isolate* isolate) {
6467 reinterpret_cast<i::Isolate*>(isolate)->stack_guard()->TerminateExecution(); 6467 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
6468 i_isolate->stack_guard()->RequestTerminateExecution();
6468 } 6469 }
6469 6470
6470 6471
6471 bool V8::IsExecutionTerminating(Isolate* isolate) { 6472 bool V8::IsExecutionTerminating(Isolate* isolate) {
6472 i::Isolate* i_isolate = isolate != NULL ? 6473 i::Isolate* i_isolate = isolate != NULL ?
6473 reinterpret_cast<i::Isolate*>(isolate) : i::Isolate::Current(); 6474 reinterpret_cast<i::Isolate*>(isolate) : i::Isolate::Current();
6474 return IsExecutionTerminatingCheck(i_isolate); 6475 return IsExecutionTerminatingCheck(i_isolate);
6475 } 6476 }
6476 6477
6477 6478
6478 void V8::CancelTerminateExecution(Isolate* isolate) { 6479 void V8::CancelTerminateExecution(Isolate* isolate) {
6479 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); 6480 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
6480 i_isolate->stack_guard()->CancelTerminateExecution(); 6481 i_isolate->stack_guard()->ClearTerminateExecution();
6482 i_isolate->CancelTerminateExecution();
6481 } 6483 }
6482 6484
6483 6485
6484 void Isolate::RequestInterrupt(InterruptCallback callback, void* data) { 6486 void Isolate::RequestInterrupt(InterruptCallback callback, void* data) {
6485 reinterpret_cast<i::Isolate*>(this)->stack_guard()->RequestInterrupt( 6487 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(this);
6486 callback, data); 6488 i_isolate->set_api_interrupt_callback(callback);
6489 i_isolate->set_api_interrupt_callback_data(data);
6490 i_isolate->stack_guard()->RequestApiInterrupt();
6487 } 6491 }
6488 6492
6489 6493
6490 void Isolate::ClearInterrupt() { 6494 void Isolate::ClearInterrupt() {
6491 reinterpret_cast<i::Isolate*>(this)->stack_guard()->ClearInterrupt(); 6495 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(this);
6496 i_isolate->stack_guard()->ClearApiInterrupt();
6497 i_isolate->set_api_interrupt_callback(NULL);
6498 i_isolate->set_api_interrupt_callback_data(NULL);
6492 } 6499 }
6493 6500
6494 6501
6495 void Isolate::RequestGarbageCollectionForTesting(GarbageCollectionType type) { 6502 void Isolate::RequestGarbageCollectionForTesting(GarbageCollectionType type) {
6496 CHECK(i::FLAG_expose_gc); 6503 CHECK(i::FLAG_expose_gc);
6497 if (type == kMinorGarbageCollection) { 6504 if (type == kMinorGarbageCollection) {
6498 reinterpret_cast<i::Isolate*>(this)->heap()->CollectGarbage( 6505 reinterpret_cast<i::Isolate*>(this)->heap()->CollectGarbage(
6499 i::NEW_SPACE, "Isolate::RequestGarbageCollection", 6506 i::NEW_SPACE, "Isolate::RequestGarbageCollection",
6500 kGCCallbackFlagForced); 6507 kGCCallbackFlagForced);
6501 } else { 6508 } else {
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
6803 i::Isolate* isolate = i::Isolate::Current(); 6810 i::Isolate* isolate = i::Isolate::Current();
6804 ON_BAILOUT(isolate, "v8::Debug::SetDebugEventListener()", return false); 6811 ON_BAILOUT(isolate, "v8::Debug::SetDebugEventListener()", return false);
6805 ENTER_V8(isolate); 6812 ENTER_V8(isolate);
6806 isolate->debugger()->SetEventListener(Utils::OpenHandle(*that), 6813 isolate->debugger()->SetEventListener(Utils::OpenHandle(*that),
6807 Utils::OpenHandle(*data, true)); 6814 Utils::OpenHandle(*data, true));
6808 return true; 6815 return true;
6809 } 6816 }
6810 6817
6811 6818
6812 void Debug::DebugBreak(Isolate* isolate) { 6819 void Debug::DebugBreak(Isolate* isolate) {
6813 reinterpret_cast<i::Isolate*>(isolate)->stack_guard()->DebugBreak(); 6820 reinterpret_cast<i::Isolate*>(isolate)->stack_guard()->RequestDebugBreak();
6814 } 6821 }
6815 6822
6816 6823
6817 void Debug::CancelDebugBreak(Isolate* isolate) { 6824 void Debug::CancelDebugBreak(Isolate* isolate) {
6818 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); 6825 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
6819 internal_isolate->stack_guard()->Continue(i::DEBUGBREAK); 6826 internal_isolate->stack_guard()->ClearDebugBreak();
6820 } 6827 }
6821 6828
6822 6829
6823 void Debug::DebugBreakForCommand(Isolate* isolate, ClientData* data) { 6830 void Debug::DebugBreakForCommand(Isolate* isolate, ClientData* data) {
6824 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); 6831 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
6825 internal_isolate->debugger()->EnqueueDebugCommand(data); 6832 internal_isolate->debugger()->EnqueueDebugCommand(data);
6826 } 6833 }
6827 6834
6828 6835
6829 void Debug::SetMessageHandler2(v8::Debug::MessageHandler2 handler) { 6836 void Debug::SetMessageHandler2(v8::Debug::MessageHandler2 handler) {
(...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after
7588 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 7595 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
7589 Address callback_address = 7596 Address callback_address =
7590 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 7597 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
7591 VMState<EXTERNAL> state(isolate); 7598 VMState<EXTERNAL> state(isolate);
7592 ExternalCallbackScope call_scope(isolate, callback_address); 7599 ExternalCallbackScope call_scope(isolate, callback_address);
7593 callback(info); 7600 callback(info);
7594 } 7601 }
7595 7602
7596 7603
7597 } } // namespace v8::internal 7604 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/arm/regexp-macro-assembler-arm.cc » ('j') | src/execution.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698