Commit e4046706 authored by Alexey Kozyatinskiy's avatar Alexey Kozyatinskiy Committed by Commit Bot

[debug] removed most debugger js

Removed most of mirrors.js and debug.js.
Further steps:
- migrate liveedit.js to native,
- remove debugger context.

R=yangguo@chromium.org
TBR=leszeks@chromium.org

Bug: v8:5530
Cq-Include-Trybots: luci.chromium.try:linux_chromium_headless_rel;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: I291ef20ef3c63a424d32e3e0c9d0962a6ca382d1
Reviewed-on: https://chromium-review.googlesource.com/1081176
Commit-Queue: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org>
Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
Reviewed-by: 's avatarDmitry Gozman <dgozman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53480}
parent 5cb11a17
......@@ -649,8 +649,6 @@ action("js2c") {
"src/js/prologue.js",
"src/js/array.js",
"src/js/typedarray.js",
"src/debug/mirrors.js",
"src/debug/debug.js",
"src/debug/liveedit.js",
]
......@@ -2259,7 +2257,6 @@ v8_source_set("v8_base") {
"src/runtime/runtime-dataview.cc",
"src/runtime/runtime-date.cc",
"src/runtime/runtime-debug.cc",
"src/runtime/runtime-error.cc",
"src/runtime/runtime-forin.cc",
"src/runtime/runtime-function.cc",
"src/runtime/runtime-futex.cc",
......
......@@ -55,10 +55,6 @@ Reduction JSIntrinsicLowering::Reduce(Node* node) {
return ReduceIsInstanceType(node, JS_TYPED_ARRAY_TYPE);
case Runtime::kInlineIsJSProxy:
return ReduceIsInstanceType(node, JS_PROXY_TYPE);
case Runtime::kInlineIsJSMap:
return ReduceIsInstanceType(node, JS_MAP_TYPE);
case Runtime::kInlineIsJSSet:
return ReduceIsInstanceType(node, JS_SET_TYPE);
case Runtime::kInlineIsJSWeakMap:
return ReduceIsInstanceType(node, JS_WEAK_MAP_TYPE);
case Runtime::kInlineIsJSWeakSet:
......
......@@ -158,7 +158,6 @@ bool Linkage::NeedsFrameStateInput(Runtime::FunctionId function) {
case Runtime::kAbort:
case Runtime::kAllocateInTargetSpace:
case Runtime::kCreateIterResultObject:
case Runtime::kGeneratorGetContinuation:
case Runtime::kIncBlockCounter:
case Runtime::kIsFunction:
case Runtime::kNewClosure:
......@@ -185,8 +184,6 @@ bool Linkage::NeedsFrameStateInput(Runtime::FunctionId function) {
case Runtime::kInlineGeneratorGetResumeMode:
case Runtime::kInlineCreateJSGeneratorObject:
case Runtime::kInlineIsArray:
case Runtime::kInlineIsJSMap:
case Runtime::kInlineIsJSSet:
case Runtime::kInlineIsJSWeakMap:
case Runtime::kInlineIsJSWeakSet:
case Runtime::kInlineIsJSReceiver:
......
......@@ -332,10 +332,8 @@ bool IntrinsicHasNoSideEffect(Runtime::FunctionId id) {
V(IsArray) \
V(IsDate) \
V(IsFunction) \
V(IsJSMap) \
V(IsJSProxy) \
V(IsJSReceiver) \
V(IsJSSet) \
V(IsJSWeakMap) \
V(IsJSWeakSet) \
V(IsRegExp) \
......
......@@ -181,32 +181,5 @@ bool FrameInspector::ParameterIsShadowedByContextLocal(
return ScopeInfo::ContextSlotIndex(info, parameter_name, &mode, &init_flag,
&maybe_assigned_flag) != -1;
}
SaveContext* DebugFrameHelper::FindSavedContextForFrame(Isolate* isolate,
StandardFrame* frame) {
SaveContext* save = isolate->save_context();
while (save != nullptr && !save->IsBelowFrame(frame)) {
save = save->prev();
}
DCHECK(save != nullptr);
return save;
}
int DebugFrameHelper::FindIndexedNonNativeFrame(StackTraceFrameIterator* it,
int index) {
int count = -1;
for (; !it->done(); it->Advance()) {
std::vector<FrameSummary> frames;
it->frame()->Summarize(&frames);
for (size_t i = frames.size(); i != 0; i--) {
// Omit functions from native and extension scripts.
if (!frames[i - 1].is_subject_to_debugging()) continue;
if (++count == index) return static_cast<int>(i) - 1;
}
}
return -1;
}
} // namespace internal
} // namespace v8
......@@ -71,27 +71,6 @@ class FrameInspector {
DISALLOW_COPY_AND_ASSIGN(FrameInspector);
};
class DebugFrameHelper : public AllStatic {
public:
static SaveContext* FindSavedContextForFrame(Isolate* isolate,
StandardFrame* frame);
// Advances the iterator to the frame that matches the index and returns the
// inlined frame index, or -1 if not found. Skips native JS functions.
static int FindIndexedNonNativeFrame(StackTraceFrameIterator* it, int index);
// Helper functions for wrapping and unwrapping stack frame ids.
static Smi* WrapFrameId(StackFrame::Id id) {
DCHECK(IsAligned(OffsetFrom(id), static_cast<intptr_t>(4)));
return Smi::FromInt(id >> 2);
}
static StackFrame::Id UnwrapFrameId(int wrapped) {
return static_cast<StackFrame::Id>(wrapped << 2);
}
};
} // namespace internal
} // namespace v8
......
......@@ -147,10 +147,9 @@ class DebugDelegate {
// |inspector_break_points_hit| contains id of breakpoints installed with
// debug::Script::SetBreakpoint API.
virtual void BreakProgramRequested(
v8::Local<v8::Context> paused_context, v8::Local<v8::Object> exec_state,
v8::Local<v8::Context> paused_context,
const std::vector<debug::BreakpointId>& inspector_break_points_hit) {}
virtual void ExceptionThrown(v8::Local<v8::Context> paused_context,
v8::Local<v8::Object> exec_state,
v8::Local<v8::Value> exception,
v8::Local<v8::Value> promise, bool is_uncaught) {
}
......
This diff is collapsed.
......@@ -31,7 +31,6 @@ namespace internal {
// Forward declarations.
class DebugScope;
// Step actions. NOTE: These values are in macros.py as well.
enum StepAction : int8_t {
StepNone = -1, // Stepping not prepared.
......@@ -228,8 +227,6 @@ class Debug {
void OnAsyncFunctionStateChanged(Handle<JSPromise> promise,
debug::DebugAsyncActionType);
V8_WARN_UNUSED_RESULT MaybeHandle<Object> Call(Handle<Object> fun,
Handle<Object> data);
Handle<Context> GetDebugContext();
void HandleDebugBreak(IgnoreBreakMode ignore_break_mode);
......@@ -267,7 +264,6 @@ class Debug {
void PrepareStepInSuspendedGenerator();
void PrepareStepOnThrow();
void ClearStepping();
void ClearStepOut();
void SetBreakOnNextFunctionCall();
void ClearBreakOnNextFunctionCall();
......@@ -334,10 +330,6 @@ class Debug {
void FreeThreadResources() { }
void Iterate(RootVisitor* v);
bool CheckExecutionState(int id) {
return CheckExecutionState() && break_id() == id;
}
bool CheckExecutionState() {
return is_active() && !debug_context().is_null() && break_id() != 0;
}
......@@ -455,17 +447,7 @@ class Debug {
void OnException(Handle<Object> exception, Handle<Object> promise);
// Constructors for debug event objects.
V8_WARN_UNUSED_RESULT MaybeHandle<Object> MakeExecutionState();
V8_WARN_UNUSED_RESULT MaybeHandle<Object> MakeExceptionEvent(
Handle<Object> exception, bool uncaught, Handle<Object> promise);
V8_WARN_UNUSED_RESULT MaybeHandle<Object> MakeCompileEvent(
Handle<Script> script, v8::DebugEvent type);
V8_WARN_UNUSED_RESULT MaybeHandle<Object> MakeAsyncTaskEvent(
v8::debug::DebugAsyncActionType type, int id);
void ProcessCompileEvent(v8::DebugEvent event, Handle<Script> script);
void ProcessDebugEvent(v8::DebugEvent event, Handle<JSObject> event_data);
void ProcessCompileEvent(bool has_compile_error, Handle<Script> script);
// Find the closest source position for a break point for a given position.
int FindBreakablePosition(Handle<DebugInfo> debug_info, int source_position);
......@@ -496,7 +478,6 @@ class Debug {
bool catch_exceptions = true);
inline void AssertDebugContext() {
DCHECK(isolate_->context() == *debug_context());
DCHECK(in_debug_scope());
}
......@@ -615,7 +596,6 @@ class Debug {
friend class LiveEdit;
friend class SuppressDebug;
friend class NoSideEffectScope;
friend class LegacyDebugDelegate;
friend Handle<FixedArray> GetDebuggedFunctions(); // In test-debug.cc
friend void CheckDebuggerUnloaded(); // In test-debug.cc
......@@ -623,70 +603,6 @@ class Debug {
DISALLOW_COPY_AND_ASSIGN(Debug);
};
class LegacyDebugDelegate : public v8::debug::DebugDelegate {
public:
explicit LegacyDebugDelegate(Isolate* isolate) : isolate_(isolate) {}
void AsyncEventOccurred(v8::debug::DebugAsyncActionType type, int id,
bool is_blackboxed) override;
void ScriptCompiled(v8::Local<v8::debug::Script> script, bool is_live_edited,
bool has_compile_error) override;
void BreakProgramRequested(v8::Local<v8::Context> paused_context,
v8::Local<v8::Object> exec_state,
const std::vector<debug::BreakpointId>&) override;
void ExceptionThrown(v8::Local<v8::Context> paused_context,
v8::Local<v8::Object> exec_state,
v8::Local<v8::Value> exception,
v8::Local<v8::Value> promise, bool is_uncaught) override;
bool IsFunctionBlackboxed(v8::Local<v8::debug::Script> script,
const v8::debug::Location& start,
const v8::debug::Location& end) override {
return false;
}
protected:
Isolate* isolate_;
private:
void ProcessDebugEvent(v8::DebugEvent event, Handle<JSObject> event_data);
virtual void ProcessDebugEvent(v8::DebugEvent event,
Handle<JSObject> event_data,
Handle<JSObject> exec_state) = 0;
};
class NativeDebugDelegate : public LegacyDebugDelegate {
public:
NativeDebugDelegate(Isolate* isolate, v8::Debug::EventCallback callback,
Handle<Object> data);
virtual ~NativeDebugDelegate();
private:
// Details of the debug event delivered to the debug event listener.
class EventDetails : public v8::Debug::EventDetails {
public:
EventDetails(DebugEvent event, Handle<JSObject> exec_state,
Handle<JSObject> event_data, Handle<Object> callback_data);
virtual DebugEvent GetEvent() const;
virtual v8::Local<v8::Object> GetExecutionState() const;
virtual v8::Local<v8::Object> GetEventData() const;
virtual v8::Local<v8::Context> GetEventContext() const;
virtual v8::Local<v8::Value> GetCallbackData() const;
virtual v8::Isolate* GetIsolate() const;
private:
DebugEvent event_; // Debug event causing the break.
Handle<JSObject> exec_state_; // Current execution state.
Handle<JSObject> event_data_; // Data associated with the event.
Handle<Object> callback_data_; // User data passed with the callback
// when it was registered.
};
void ProcessDebugEvent(v8::DebugEvent event, Handle<JSObject> event_data,
Handle<JSObject> exec_state) override;
v8::Debug::EventCallback callback_;
Handle<Object> data_;
};
// This scope is used to load and enter the debug context and create a new
// break state. Leaving the scope will restore the previous state.
// On failure to load, FailedToEnter returns true.
......@@ -698,9 +614,6 @@ class DebugScope BASE_EMBEDDED {
// Check whether loading was successful.
inline bool failed() { return failed_; }
// Get the active context from before entering the debugger.
inline Handle<Context> GetContext() { return save_.context(); }
private:
Isolate* isolate() { return debug_->isolate_; }
......@@ -709,7 +622,6 @@ class DebugScope BASE_EMBEDDED {
StackFrame::Id break_frame_id_; // Previous break frame id.
int break_id_; // Previous break id.
bool failed_; // Did the debug context fail to load?
SaveContext save_; // Saves previous context.
PostponeInterruptsScope no_termination_exceptons_;
};
......
This diff is collapsed.
......@@ -179,34 +179,4 @@ typedef int BreakpointId;
} // namespace debug
} // namespace v8
// TODO(yangguo): this is legacy left over from removing v8-debug.h, and still
// used in cctests. Let's get rid of these soon.
namespace v8 {
enum DebugEvent {
Break = 1,
Exception = 2,
AfterCompile = 3,
CompileError = 4,
AsyncTaskEvent = 5,
};
class Debug {
public:
class EventDetails {
public:
virtual DebugEvent GetEvent() const = 0;
virtual Local<Object> GetExecutionState() const = 0;
virtual Local<Object> GetEventData() const = 0;
virtual Local<Context> GetEventContext() const = 0;
virtual Local<Value> GetCallbackData() const = 0;
virtual Isolate* GetIsolate() const = 0;
virtual ~EventDetails() {}
};
typedef void (*EventCallback)(const EventDetails& event_details);
};
} // namespace v8
#endif // V8_DEBUG_INTERFACE_TYPES_H_
......@@ -26,7 +26,6 @@
// -------------------------------------------------------------------
// Imports
var FindScriptSourcePosition = global.Debug.findScriptSourcePosition;
var GlobalArray = global.Array;
var MathFloor = global.Math.floor;
var MathMax = global.Math.max;
......@@ -34,6 +33,11 @@
// -------------------------------------------------------------------
function FindScriptSourcePosition(script, opt_line, opt_column) {
var location = %ScriptLocationFromLine(script, opt_line, opt_column, 0);
return location ? location.position : null;
};
// Forward declaration for minifier.
var FunctionStatus;
......@@ -1052,7 +1056,8 @@
utils.InstallConstants(utils, [
"SetScriptSource", LiveEdit.SetScriptSource,
]);
utils.InstallConstants(global, [
"Debug", {},
]);
global.Debug.LiveEdit = LiveEdit;
})
This diff is collapsed.
......@@ -600,13 +600,12 @@ void V8Debugger::ScriptCompiled(v8::Local<v8::debug::Script> script,
}
void V8Debugger::BreakProgramRequested(
v8::Local<v8::Context> pausedContext, v8::Local<v8::Object>,
v8::Local<v8::Context> pausedContext,
const std::vector<v8::debug::BreakpointId>& break_points_hit) {
handleProgramBreak(pausedContext, v8::Local<v8::Value>(), break_points_hit);
}
void V8Debugger::ExceptionThrown(v8::Local<v8::Context> pausedContext,
v8::Local<v8::Object>,
v8::Local<v8::Value> exception,
v8::Local<v8::Value> promise,
bool isUncaught) {
......
......@@ -175,10 +175,10 @@ class V8Debugger : public v8::debug::DebugDelegate {
void ScriptCompiled(v8::Local<v8::debug::Script> script, bool is_live_edited,
bool has_compile_error) override;
void BreakProgramRequested(
v8::Local<v8::Context> paused_context, v8::Local<v8::Object>,
v8::Local<v8::Context> paused_context,
const std::vector<v8::debug::BreakpointId>& break_points_hit) override;
void ExceptionThrown(v8::Local<v8::Context> paused_context,
v8::Local<v8::Object>, v8::Local<v8::Value> exception,
v8::Local<v8::Value> exception,
v8::Local<v8::Value> promise, bool is_uncaught) override;
bool IsFunctionBlackboxed(v8::Local<v8::debug::Script> script,
const v8::debug::Location& start,
......
......@@ -170,18 +170,6 @@ Node* IntrinsicsGenerator::IsTypedArray(
return IsInstanceType(input, JS_TYPED_ARRAY_TYPE);
}
Node* IntrinsicsGenerator::IsJSMap(
const InterpreterAssembler::RegListNodePair& args, Node* context) {
Node* input = __ LoadRegisterFromRegisterList(args, 0);
return IsInstanceType(input, JS_MAP_TYPE);
}
Node* IntrinsicsGenerator::IsJSSet(
const InterpreterAssembler::RegListNodePair& args, Node* context) {
Node* input = __ LoadRegisterFromRegisterList(args, 0);
return IsInstanceType(input, JS_SET_TYPE);
}
Node* IntrinsicsGenerator::IsJSWeakMap(
const InterpreterAssembler::RegListNodePair& args, Node* context) {
Node* input = __ LoadRegisterFromRegisterList(args, 0);
......
......@@ -27,10 +27,8 @@ namespace interpreter {
V(CreateAsyncFromSyncIterator, create_async_from_sync_iterator, 1) \
V(HasProperty, has_property, 2) \
V(IsArray, is_array, 1) \
V(IsJSMap, is_js_map, 1) \
V(IsJSProxy, is_js_proxy, 1) \
V(IsJSReceiver, is_js_receiver, 1) \
V(IsJSSet, is_js_set, 1) \
V(IsJSWeakMap, is_js_weak_map, 1) \
V(IsJSWeakSet, is_js_weak_set, 1) \
V(IsSmi, is_smi, 1) \
......
......@@ -13,18 +13,6 @@
namespace v8 {
namespace internal {
RUNTIME_FUNCTION(Runtime_IsJSMapIterator) {
SealHandleScope shs(isolate);
DCHECK_EQ(1, args.length());
return isolate->heap()->ToBoolean(args[0]->IsJSMapIterator());
}
RUNTIME_FUNCTION(Runtime_IsJSSetIterator) {
SealHandleScope shs(isolate);
DCHECK_EQ(1, args.length());
return isolate->heap()->ToBoolean(args[0]->IsJSSetIterator());
}
RUNTIME_FUNCTION(Runtime_TheHole) {
SealHandleScope shs(isolate);
DCHECK_EQ(0, args.length());
......@@ -123,6 +111,14 @@ RUNTIME_FUNCTION(Runtime_WeakCollectionDelete) {
return isolate->heap()->ToBoolean(was_present);
}
RUNTIME_FUNCTION(Runtime_GetWeakSetValues) {
HandleScope scope(isolate);
DCHECK_EQ(2, args.length());
CONVERT_ARG_HANDLE_CHECKED(JSWeakCollection, holder, 0);
CONVERT_NUMBER_CHECKED(int, max_values, Int32, args[1]);
CHECK_GE(max_values, 0);
return *JSWeakCollection::GetEntries(holder, max_values);
}
RUNTIME_FUNCTION(Runtime_WeakCollectionSet) {
HandleScope scope(isolate);
......@@ -147,30 +143,6 @@ RUNTIME_FUNCTION(Runtime_WeakCollectionSet) {
return *weak_collection;
}
RUNTIME_FUNCTION(Runtime_GetWeakSetValues) {
HandleScope scope(isolate);
DCHECK_EQ(2, args.length());
CONVERT_ARG_HANDLE_CHECKED(JSWeakCollection, holder, 0);
CONVERT_NUMBER_CHECKED(int, max_values, Int32, args[1]);
CHECK_GE(max_values, 0);
return *JSWeakCollection::GetEntries(holder, max_values);
}
RUNTIME_FUNCTION(Runtime_IsJSMap) {
SealHandleScope shs(isolate);
DCHECK_EQ(1, args.length());
CONVERT_ARG_CHECKED(Object, obj, 0);
return isolate->heap()->ToBoolean(obj->IsJSMap());
}
RUNTIME_FUNCTION(Runtime_IsJSSet) {
SealHandleScope shs(isolate);
DCHECK_EQ(1, args.length());
CONVERT_ARG_CHECKED(Object, obj, 0);
return isolate->heap()->ToBoolean(obj->IsJSSet());
}
RUNTIME_FUNCTION(Runtime_IsJSWeakMap) {
SealHandleScope shs(isolate);
DCHECK_EQ(1, args.length());
......
This diff is collapsed.
// Copyright 2016 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "src/runtime/runtime-utils.h"
#include "src/arguments.h"
#include "src/base/platform/time.h"
#include "src/conversions-inl.h"
#include "src/futex-emulation.h"
#include "src/globals.h"
namespace v8 {
namespace internal {
RUNTIME_FUNCTION(Runtime_ErrorToString) {
HandleScope scope(isolate);
DCHECK_EQ(1, args.length());
CONVERT_ARG_HANDLE_CHECKED(Object, recv, 0);
RETURN_RESULT_OR_FAILURE(isolate, ErrorUtils::ToString(isolate, recv));
}
RUNTIME_FUNCTION(Runtime_IsJSError) {
SealHandleScope shs(isolate);
DCHECK_EQ(1, args.length());
return isolate->heap()->ToBoolean(args[0]->IsJSError());
}
} // namespace internal
} // namespace v8
......@@ -80,13 +80,6 @@ RUNTIME_FUNCTION(Runtime_FunctionGetScriptSourcePosition) {
return Smi::FromInt(pos);
}
RUNTIME_FUNCTION(Runtime_FunctionGetContextData) {
SealHandleScope shs(isolate);
DCHECK_EQ(1, args.length());
CONVERT_ARG_CHECKED(JSFunction, fun, 0);
return fun->native_context()->debug_context_id();
}
RUNTIME_FUNCTION(Runtime_FunctionIsAPIFunction) {
SealHandleScope shs(isolate);
......@@ -205,15 +198,5 @@ RUNTIME_FUNCTION(Runtime_IsFunction) {
}
RUNTIME_FUNCTION(Runtime_FunctionToString) {
HandleScope scope(isolate);
DCHECK_EQ(1, args.length());
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, function, 0);
return function->IsJSBoundFunction()
? *JSBoundFunction::ToString(
Handle<JSBoundFunction>::cast(function))
: *JSFunction::ToString(Handle<JSFunction>::cast(function));
}
} // namespace internal
} // namespace v8
......@@ -11,12 +11,6 @@
namespace v8 {
namespace internal {
RUNTIME_FUNCTION(Runtime_IsJSGeneratorObject) {
SealHandleScope shs(isolate);
DCHECK_EQ(1, args.length());
return isolate->heap()->ToBoolean(args[0]->IsJSGeneratorObject());
}
RUNTIME_FUNCTION(Runtime_CreateJSGeneratorObject) {
HandleScope scope(isolate);
DCHECK_EQ(2, args.length());
......@@ -58,14 +52,6 @@ RUNTIME_FUNCTION(Runtime_GeneratorGetFunction) {
return generator->function();
}
RUNTIME_FUNCTION(Runtime_GeneratorGetReceiver) {
HandleScope scope(isolate);
DCHECK_EQ(1, args.length());
CONVERT_ARG_HANDLE_CHECKED(JSGeneratorObject, generator, 0);
return generator->receiver();
}
RUNTIME_FUNCTION(Runtime_GeneratorGetInputOrDebugPos) {
// Runtime call is implemented in InterpreterIntrinsics and lowered in
// JSIntrinsicLowering
......@@ -96,23 +82,6 @@ RUNTIME_FUNCTION(Runtime_GeneratorGetResumeMode) {
UNREACHABLE();
}
RUNTIME_FUNCTION(Runtime_GeneratorGetContinuation) {
HandleScope scope(isolate);
DCHECK_EQ(1, args.length());
CONVERT_ARG_HANDLE_CHECKED(JSGeneratorObject, generator, 0);
return Smi::FromInt(generator->continuation());
}
RUNTIME_FUNCTION(Runtime_GeneratorGetSourcePosition) {
HandleScope scope(isolate);
DCHECK_EQ(1, args.length());
CONVERT_ARG_HANDLE_CHECKED(JSGeneratorObject, generator, 0);
if (!generator->is_suspended()) return isolate->heap()->undefined_value();
return Smi::FromInt(generator->source_position());
}
// Return true if {generator}'s PC has a catch handler. This allows
// catch prediction to happen from the AsyncGeneratorResumeNext stub.
RUNTIME_FUNCTION(Runtime_AsyncGeneratorHasCatchHandlerForPC) {
......
......@@ -30,12 +30,6 @@ RUNTIME_FUNCTION(Runtime_CheckIsBootstrapping) {
return isolate->heap()->undefined_value();
}
RUNTIME_FUNCTION(Runtime_IsScriptWrapper) {
SealHandleScope shs(isolate);
DCHECK_EQ(1, args.length());
return isolate->heap()->ToBoolean(args[0]->IsScriptWrapper());
}
RUNTIME_FUNCTION(Runtime_ExportFromRuntime) {
HandleScope scope(isolate);
DCHECK_EQ(1, args.length());
......
......@@ -266,41 +266,5 @@ RUNTIME_FUNCTION(Runtime_LiveEditCompareStrings) {
return *result;
}
// Restarts a call frame and completely drops all frames above.
// Returns true if successful. Otherwise returns undefined or an error message.
RUNTIME_FUNCTION(Runtime_LiveEditRestartFrame) {
HandleScope scope(isolate);
CHECK(isolate->debug()->live_edit_enabled());
DCHECK_EQ(2, args.length());
CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]);
CHECK(isolate->debug()->CheckExecutionState(break_id));
CONVERT_NUMBER_CHECKED(int, index, Int32, args[1]);
Heap* heap = isolate->heap();
// Find the relevant frame with the requested index.
StackFrame::Id id = isolate->debug()->break_frame_id();
if (id == StackFrame::NO_ID) {
// If there are no JavaScript stack frames return undefined.
return heap->undefined_value();
}
StackTraceFrameIterator it(isolate, id);
int inlined_jsframe_index =
DebugFrameHelper::FindIndexedNonNativeFrame(&it, index);
// Liveedit is not supported on Wasm.
if (inlined_jsframe_index == -1 || it.is_wasm()) {
return heap->undefined_value();
}
// We don't really care what the inlined frame index is, since we are
// throwing away the entire frame anyways.
const char* error_message = LiveEdit::RestartFrame(it.javascript_frame());
if (error_message) {
return *(isolate->factory()->InternalizeUtf8String(error_message));
}
return heap->true_value();
}
} // namespace internal
} // namespace v8
......@@ -687,24 +687,6 @@ RUNTIME_FUNCTION(Runtime_GetOwnPropertyKeys) {
}
// Return information on whether an object has a named or indexed interceptor.
// args[0]: object
RUNTIME_FUNCTION(Runtime_GetInterceptorInfo) {
HandleScope scope(isolate);
DCHECK_EQ(1, args.length());
if (!args[0]->IsJSObject()) {
return Smi::kZero;
}
CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0);
int result = 0;
if (obj->HasNamedInterceptor()) result |= 2;
if (obj->HasIndexedInterceptor()) result |= 1;
return Smi::FromInt(result);
}
RUNTIME_FUNCTION(Runtime_ToFastProperties) {
HandleScope scope(isolate);
DCHECK_EQ(1, args.length());
......
......@@ -31,14 +31,6 @@ RUNTIME_FUNCTION(Runtime_CreatePrivateFieldSymbol) {
return *symbol;
}
RUNTIME_FUNCTION(Runtime_SymbolDescription) {
SealHandleScope shs(isolate);
DCHECK_EQ(1, args.length());
CONVERT_ARG_CHECKED(Symbol, symbol, 0);
return symbol->name();
}
RUNTIME_FUNCTION(Runtime_SymbolDescriptiveString) {
HandleScope scope(isolate);
DCHECK_EQ(1, args.length());
......
......@@ -97,8 +97,6 @@ namespace internal {
#define FOR_EACH_INTRINSIC_COLLECTIONS(F) \
F(GetWeakMapEntries, 2, 1) \
F(GetWeakSetValues, 2, 1) \
F(IsJSMap, 1, 1) \
F(IsJSSet, 1, 1) \
F(IsJSWeakMap, 1, 1) \
F(IsJSWeakSet, 1, 1) \
F(MapGrow, 1, 1) \
......@@ -127,62 +125,37 @@ namespace internal {
F(IsDate, 1, 1)
#define FOR_EACH_INTRINSIC_DEBUG(F) \
F(ChangeBreakOnException, 2, 1) \
F(CheckExecutionState, 1, 1) \
F(ClearStepping, 0, 1) \
F(CollectGarbage, 1, 1) \
F(DebugApplyInstrumentation, 1, 1) \
F(DebugBreakAtEntry, 1, 1) \
F(DebugCollectCoverage, 0, 1) \
F(DebugConstructedBy, 2, 1) \
F(DebugEvaluate, 5, 1) \
F(DebugEvaluateGlobal, 2, 1) \
F(DebugGetInternalProperties, 1, 1) \
F(DebugGetLoadedScripts, 0, 1) \
F(DebugGetProperty, 2, 1) \
F(DebugGetPropertyDetails, 2, 1) \
F(DebugGetPrototype, 1, 1) \
F(DebugIsActive, 0, 1) \
F(DebugOnFunctionCall, 2, 1) \
F(DebugPopPromise, 0, 1) \
F(DebugPrepareStepInSuspendedGenerator, 0, 1) \
F(DebugPropertyAttributesFromDetails, 1, 1) \
F(DebugPropertyKindFromDetails, 1, 1) \
F(DebugPushPromise, 1, 1) \
F(DebugAsyncFunctionSuspended, 1, 1) \
F(DebugAsyncFunctionFinished, 2, 1) \
F(DebugReferencedBy, 3, 1) \
F(DebugSetScriptSource, 2, 1) \
F(DebugToggleBlockCoverage, 1, 1) \
F(DebugTogglePreciseCoverage, 1, 1) \
F(FunctionGetDebugName, 1, 1) \
F(FunctionGetInferredName, 1, 1) \
F(GetAllScopesDetails, 4, 1) \
F(GetBreakLocations, 1, 1) \
F(GetDebugContext, 0, 1) \
F(GetFrameCount, 1, 1) \
F(GetFrameDetails, 2, 1) \
F(GetFunctionScopeCount, 1, 1) \
F(GetFunctionScopeDetails, 2, 1) \
F(GetGeneratorScopeCount, 1, 1) \
F(GetGeneratorScopeDetails, 2, 1) \
F(GetHeapUsage, 0, 1) \
F(GetScopeCount, 2, 1) \
F(GetScopeDetails, 4, 1) \
F(GetScript, 1, 1) \
F(HandleDebuggerStatement, 0, 1) \
F(IncBlockCounter, 2, 1) \
F(IsBreakOnException, 1, 1) \
F(PrepareStep, 2, 1) \
F(ScheduleBreak, 0, 1) \
F(ScriptLineCount, 1, 1) \
F(ScriptLocationFromLine2, 4, 1) \
F(ScriptLocationFromLine, 4, 1) \
F(ScriptPositionInfo2, 3, 1) \
F(ScriptPositionInfo, 3, 1) \
F(SetScopeVariableValue, 6, 1)
#define FOR_EACH_INTRINSIC_ERROR(F) F(ErrorToString, 1, 1)
F(SetGeneratorScopeVariableValue, 4, 1)
#define FOR_EACH_INTRINSIC_FORIN(F) \
F(ForInEnumerate, 1, 1) \
......@@ -210,14 +183,12 @@ namespace internal {
#define FOR_EACH_INTRINSIC_FUNCTION(F) \
F(Call, -1 /* >= 2 */, 1) \
F(FunctionGetContextData, 1, 1) \
F(FunctionGetName, 1, 1) \
F(FunctionGetScript, 1, 1) \
F(FunctionGetScriptId, 1, 1) \
F(FunctionGetScriptSourcePosition, 1, 1) \
F(FunctionGetSourceCode, 1, 1) \
F(FunctionIsAPIFunction, 1, 1) \
F(FunctionToString, 1, 1) \
F(IsConstructor, 1, 1) \
F(IsFunction, 1, 1) \
F(SetCode, 2, 1) \
......@@ -230,12 +201,9 @@ namespace internal {
F(AsyncGeneratorYield, 3, 1) \
F(CreateJSGeneratorObject, 2, 1) \
F(GeneratorClose, 1, 1) \
F(GeneratorGetContinuation, 1, 1) \
F(GeneratorGetFunction, 1, 1) \
F(GeneratorGetInputOrDebugPos, 1, 1) \
F(GeneratorGetReceiver, 1, 1) \
F(GeneratorGetResumeMode, 1, 1) \
F(GeneratorGetSourcePosition, 1, 1)
F(GeneratorGetResumeMode, 1, 1)
#ifdef V8_INTL_SUPPORT
#define FOR_EACH_INTRINSIC_INTL(F) \
......@@ -330,8 +298,7 @@ namespace internal {
F(LiveEditPatchFunctionPositions, 2, 1) \
F(LiveEditReplaceFunctionCode, 2, 1) \
F(LiveEditReplaceRefToNestedFunction, 3, 1) \
F(LiveEditReplaceScript, 3, 1) \
F(LiveEditRestartFrame, 2, 1)
F(LiveEditReplaceScript, 3, 1)
#define FOR_EACH_INTRINSIC_MATHS(F) F(GenerateRandomNumbers, 0, 1)
......@@ -372,7 +339,6 @@ namespace internal {
F(DefineSetterPropertyUnchecked, 4, 1) \
F(DeleteProperty, 3, 1) \
F(GetFunctionName, 1, 1) \
F(GetInterceptorInfo, 1, 1) \
F(GetOwnPropertyDescriptor, 2, 1) \
F(GetOwnPropertyKeys, 2, 1) \
F(GetProperty, 2, 1) \
......@@ -511,7 +477,6 @@ namespace internal {
#define FOR_EACH_INTRINSIC_SYMBOL(F) \
F(CreatePrivateFieldSymbol, 0, 1) \
F(CreatePrivateSymbol, -1 /* <= 1 */, 1) \
F(SymbolDescription, 1, 1) \
F(SymbolDescriptiveString, 1, 1) \
F(SymbolIsPrivate, 1, 1)
......@@ -564,12 +529,7 @@ namespace internal {
F(InNewSpace, 1, 1) \
F(IsAsmWasmCode, 1, 1) \
F(IsConcurrentRecompilationSupported, 0, 1) \
F(IsJSError, 1, 1) \
F(IsJSGeneratorObject, 1, 1) \
F(IsJSMapIterator, 1, 1) \
F(IsJSSetIterator, 1, 1) \
F(IsLiftoffFunction, 1, 1) \
F(IsScriptWrapper, 1, 1) \
F(IsWasmCode, 1, 1) \
F(IsWasmTrapHandlerEnabled, 0, 1) \
F(NativeScriptsCount, 0, 1) \
......@@ -676,7 +636,6 @@ namespace internal {
FOR_EACH_INTRINSIC_COMPILER(F) \
FOR_EACH_INTRINSIC_DATE(F) \
FOR_EACH_INTRINSIC_DEBUG(F) \
FOR_EACH_INTRINSIC_ERROR(F) \
FOR_EACH_INTRINSIC_FORIN(F) \
FOR_EACH_INTRINSIC_FUNCTION(F) \
FOR_EACH_INTRINSIC_GENERATOR(F) \
......
......@@ -2967,7 +2967,6 @@ TEST(BytecodeGraphBuilderIllegalConstDeclaration) {
class CountBreakDebugDelegate : public v8::debug::DebugDelegate {
public:
void BreakProgramRequested(v8::Local<v8::Context> paused_context,
v8::Local<v8::Object> exec_state,
const std::vector<int>&) override {
debug_break_count++;
}
......
This diff is collapsed.
......@@ -87,7 +87,6 @@ class BreakHandler : public debug::DebugDelegate {
std::vector<BreakPoint> expected_breaks_;
void BreakProgramRequested(v8::Local<v8::Context> paused_context,
v8::Local<v8::Object> exec_state,
const std::vector<int>&) override {
printf("Break #%d\n", count_);
CHECK_GT(expected_breaks_.size(), count_);
......@@ -193,7 +192,6 @@ class CollectValuesBreakHandler : public debug::DebugDelegate {
std::vector<BreakpointValues> expected_values_;
void BreakProgramRequested(v8::Local<v8::Context> paused_context,
v8::Local<v8::Object> exec_state,
const std::vector<int>&) override {
printf("Break #%d\n", count_);
CHECK_GT(expected_values_.size(), count_);
......
// Copyright 2018 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
Debug = debug.Debug
function foo(){}
let breakpoint_count = 0;
let last_source_line = 0;
let last_source_column = 0;
function listener(event, exec_state, event_data, data) {
if (event == Debug.DebugEvent.Break) {
++breakpoint_count;
last_source_line = exec_state.frame(0).sourceLine();
last_source_column = exec_state.frame(0).sourceColumn();
}
};
Debug.setListener(listener);
// Run without breakpoints.
foo();
assertEquals(breakpoint_count, 0);
// Run with breakpoint.
const breakpoint = Debug.setBreakPoint(foo, 0);
foo();
assertEquals(breakpoint_count, 1);
assertEquals(last_source_line, 7);
assertEquals(last_source_column, 15);
foo();
assertEquals(breakpoint_count, 2);
assertEquals(last_source_line, 7);
assertEquals(last_source_column, 15);
// Run without breakpoints
Debug.clearBreakPoint(breakpoint);
foo();
assertEquals(breakpoint_count, 2);
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment