summaryrefslogtreecommitdiff
path: root/deps/v8/src/runtime/runtime-debug.cc
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/runtime/runtime-debug.cc')
-rw-r--r--deps/v8/src/runtime/runtime-debug.cc50
1 files changed, 41 insertions, 9 deletions
diff --git a/deps/v8/src/runtime/runtime-debug.cc b/deps/v8/src/runtime/runtime-debug.cc
index daef53280e..a47ea2caaf 100644
--- a/deps/v8/src/runtime/runtime-debug.cc
+++ b/deps/v8/src/runtime/runtime-debug.cc
@@ -16,6 +16,7 @@
#include "src/debug/liveedit.h"
#include "src/frames-inl.h"
#include "src/globals.h"
+#include "src/interpreter/bytecode-array-accessor.h"
#include "src/interpreter/bytecodes.h"
#include "src/interpreter/interpreter.h"
#include "src/isolate-inl.h"
@@ -43,16 +44,25 @@ RUNTIME_FUNCTION_RETURN_PAIR(Runtime_DebugBreakOnBytecode) {
// Get the top-most JavaScript frame.
JavaScriptFrameIterator it(isolate);
- isolate->debug()->Break(it.frame(), handle(it.frame()->function()));
+ if (isolate->debug_execution_mode() == DebugInfo::kBreakpoints) {
+ isolate->debug()->Break(it.frame(), handle(it.frame()->function()));
+ }
// Return the handler from the original bytecode array.
DCHECK(it.frame()->is_interpreted());
InterpretedFrame* interpreted_frame =
reinterpret_cast<InterpretedFrame*>(it.frame());
SharedFunctionInfo* shared = interpreted_frame->function()->shared();
- BytecodeArray* bytecode_array = shared->bytecode_array();
+ BytecodeArray* bytecode_array = shared->GetBytecodeArray();
int bytecode_offset = interpreted_frame->GetBytecodeOffset();
Bytecode bytecode = Bytecodes::FromByte(bytecode_array->get(bytecode_offset));
+
+ bool side_effect_check_failed = false;
+ if (isolate->debug_execution_mode() == DebugInfo::kSideEffects) {
+ side_effect_check_failed =
+ !isolate->debug()->PerformSideEffectCheckAtBytecode(interpreted_frame);
+ }
+
if (Bytecodes::Returns(bytecode)) {
// If we are returning (or suspending), reset the bytecode array on the
// interpreted stack frame to the non-debug variant so that the interpreter
@@ -70,10 +80,35 @@ RUNTIME_FUNCTION_RETURN_PAIR(Runtime_DebugBreakOnBytecode) {
isolate->interpreter()->GetAndMaybeDeserializeBytecodeHandler(bytecode,
operand_scale);
- return MakePair(isolate->debug()->return_value(),
+ return MakePair(side_effect_check_failed ? isolate->heap()->exception()
+ : isolate->debug()->return_value(),
Smi::FromInt(static_cast<uint8_t>(bytecode)));
}
+RUNTIME_FUNCTION(Runtime_DebugBreakAtEntry) {
+ HandleScope scope(isolate);
+ DCHECK_EQ(1, args.length());
+ CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
+ USE(function);
+
+ DCHECK(function->shared()->HasDebugInfo());
+ DCHECK(function->shared()->GetDebugInfo()->BreakAtEntry());
+
+ // Get the top-most JavaScript frame.
+ JavaScriptFrameIterator it(isolate);
+ DCHECK_EQ(*function, it.frame()->function());
+ isolate->debug()->Break(it.frame(), function);
+
+ return isolate->heap()->undefined_value();
+}
+
+RUNTIME_FUNCTION(Runtime_DebugApplyInstrumentation) {
+ HandleScope scope(isolate);
+ DCHECK_EQ(1, args.length());
+ CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
+ isolate->debug()->ApplyInstrumentation(handle(function->shared()));
+ return isolate->heap()->undefined_value();
+}
RUNTIME_FUNCTION(Runtime_HandleDebuggerStatement) {
SealHandleScope shs(isolate);
@@ -1143,7 +1178,8 @@ RUNTIME_FUNCTION(Runtime_DebugEvaluateGlobal) {
CONVERT_ARG_HANDLE_CHECKED(String, source, 1);
- RETURN_RESULT_OR_FAILURE(isolate, DebugEvaluate::Global(isolate, source));
+ RETURN_RESULT_OR_FAILURE(isolate,
+ DebugEvaluate::Global(isolate, source, false));
}
@@ -1636,15 +1672,11 @@ RUNTIME_FUNCTION(Runtime_DebugOnFunctionCall) {
if (isolate->debug()->last_step_action() >= StepIn) {
isolate->debug()->PrepareStepIn(fun);
}
- if (isolate->needs_side_effect_check() &&
+ if (isolate->debug_execution_mode() == DebugInfo::kSideEffects &&
!isolate->debug()->PerformSideEffectCheck(fun)) {
return isolate->heap()->exception();
}
}
- if (fun->shared()->HasDebugInfo() &&
- fun->shared()->GetDebugInfo()->BreakAtEntry()) {
- isolate->debug()->Break(nullptr, fun);
- }
return isolate->heap()->undefined_value();
}