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

Side by Side Diff: src/api.cc

Issue 2621873003: [heap, debugger] Introduce out-of-memory listener for debugger. (Closed)
Patch Set: remove isolate parameter of the callback Created 3 years, 11 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
« no previous file with comments | « no previous file | src/debug/debug-interface.h » ('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 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 "src/api.h" 5 #include "src/api.h"
6 6
7 #include <string.h> // For memcpy, strlen. 7 #include <string.h> // For memcpy, strlen.
8 #ifdef V8_USE_ADDRESS_SANITIZER 8 #ifdef V8_USE_ADDRESS_SANITIZER
9 #include <sanitizer/asan_interface.h> 9 #include <sanitizer/asan_interface.h>
10 #endif // V8_USE_ADDRESS_SANITIZER 10 #endif // V8_USE_ADDRESS_SANITIZER
(...skipping 8801 matching lines...) Expand 10 before | Expand all | Expand 10 after
8812 ENTER_V8(i_isolate); 8812 ENTER_V8(i_isolate);
8813 i::HandleScope scope(i_isolate); 8813 i::HandleScope scope(i_isolate);
8814 i::Handle<i::Object> foreign = i_isolate->factory()->undefined_value(); 8814 i::Handle<i::Object> foreign = i_isolate->factory()->undefined_value();
8815 if (that != NULL) { 8815 if (that != NULL) {
8816 foreign = i_isolate->factory()->NewForeign(FUNCTION_ADDR(that)); 8816 foreign = i_isolate->factory()->NewForeign(FUNCTION_ADDR(that));
8817 } 8817 }
8818 i_isolate->debug()->SetEventListener(foreign, Utils::OpenHandle(*data, true)); 8818 i_isolate->debug()->SetEventListener(foreign, Utils::OpenHandle(*data, true));
8819 return true; 8819 return true;
8820 } 8820 }
8821 8821
8822
8823 void Debug::DebugBreak(Isolate* isolate) { 8822 void Debug::DebugBreak(Isolate* isolate) {
8824 reinterpret_cast<i::Isolate*>(isolate)->stack_guard()->RequestDebugBreak(); 8823 reinterpret_cast<i::Isolate*>(isolate)->stack_guard()->RequestDebugBreak();
8825 } 8824 }
8826 8825
8827 8826
8828 void Debug::CancelDebugBreak(Isolate* isolate) { 8827 void Debug::CancelDebugBreak(Isolate* isolate) {
8829 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); 8828 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
8830 internal_isolate->stack_guard()->ClearDebugBreak(); 8829 internal_isolate->stack_guard()->ClearDebugBreak();
8831 } 8830 }
8832 8831
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
8980 } 8979 }
8981 8980
8982 void debug::ChangeBreakOnException(Isolate* isolate, ExceptionBreakState type) { 8981 void debug::ChangeBreakOnException(Isolate* isolate, ExceptionBreakState type) {
8983 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate); 8982 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate);
8984 internal_isolate->debug()->ChangeBreakOnException( 8983 internal_isolate->debug()->ChangeBreakOnException(
8985 i::BreakException, type == BreakOnAnyException); 8984 i::BreakException, type == BreakOnAnyException);
8986 internal_isolate->debug()->ChangeBreakOnException(i::BreakUncaughtException, 8985 internal_isolate->debug()->ChangeBreakOnException(i::BreakUncaughtException,
8987 type != NoBreakOnException); 8986 type != NoBreakOnException);
8988 } 8987 }
8989 8988
8989 void debug::SetOutOfMemoryCallback(Isolate* isolate,
8990 OutOfMemoryCallback callback, void* data) {
8991 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
8992 ENTER_V8(i_isolate);
8993 i_isolate->heap()->SetOutOfMemoryCallback(callback, data);
8994 }
8995
8990 void debug::PrepareStep(Isolate* v8_isolate, StepAction action) { 8996 void debug::PrepareStep(Isolate* v8_isolate, StepAction action) {
8991 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); 8997 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
8992 ENTER_V8(isolate); 8998 ENTER_V8(isolate);
8993 CHECK(isolate->debug()->CheckExecutionState()); 8999 CHECK(isolate->debug()->CheckExecutionState());
8994 // Clear all current stepping setup. 9000 // Clear all current stepping setup.
8995 isolate->debug()->ClearStepping(); 9001 isolate->debug()->ClearStepping();
8996 // Prepare step. 9002 // Prepare step.
8997 isolate->debug()->PrepareStep(static_cast<i::StepAction>(action)); 9003 isolate->debug()->PrepareStep(static_cast<i::StepAction>(action));
8998 } 9004 }
8999 9005
(...skipping 976 matching lines...) Expand 10 before | Expand all | Expand 10 after
9976 Address callback_address = 9982 Address callback_address =
9977 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 9983 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
9978 VMState<EXTERNAL> state(isolate); 9984 VMState<EXTERNAL> state(isolate);
9979 ExternalCallbackScope call_scope(isolate, callback_address); 9985 ExternalCallbackScope call_scope(isolate, callback_address);
9980 callback(info); 9986 callback(info);
9981 } 9987 }
9982 9988
9983 9989
9984 } // namespace internal 9990 } // namespace internal
9985 } // namespace v8 9991 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/debug/debug-interface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698