Skip to content

Commit

Permalink
Revert "[debug][api] Move debugger support to debug-interface.cc."
Browse files Browse the repository at this point in the history
This reverts commit 1b4811f.

Reason for revert: makes "git cl upload" fail (the change related to files_to_skip)

Original change's description:
> [debug][api] Move debugger support to debug-interface.cc.
>
> Previously we had the debugger / inspector support declared in
> debug-interface.h, but the implementation was sprinkled all across
> api.cc, which was quite messy. This moves the relevant macros and
> other bits into api-macros.h (with api-macros-undef.h to support
> jumbo builds), and moves the debugger interface implementation to
> src/debug/debug-interface.cc.
>
> Bug: chromium:1162229
> Change-Id: I6965ebf2301459c89e3217bd87396ec353d814e9
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2653154
> Auto-Submit: Benedikt Meurer <[email protected]>
> Reviewed-by: Yang Guo <[email protected]>
> Commit-Queue: Benedikt Meurer <[email protected]>
> Cr-Commit-Position: refs/heads/master@{#72392}

[email protected],[email protected]

Change-Id: Ib9460709df799cd63b221f9f30dc33dff53075bd
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:1162229
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2655508
Reviewed-by: Marja Hölttä <[email protected]>
Commit-Queue: Marja Hölttä <[email protected]>
Cr-Commit-Position: refs/heads/master@{#72393}
  • Loading branch information
marjakh authored and Commit Bot committed Jan 28, 2021
1 parent 1b4811f commit ab7c7c7
Show file tree
Hide file tree
Showing 7 changed files with 1,403 additions and 1,426 deletions.
3 changes: 0 additions & 3 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -2463,8 +2463,6 @@ v8_source_set("v8_base_without_compiler") {
"src/api/api-arguments-inl.h",
"src/api/api-arguments.cc",
"src/api/api-arguments.h",
"src/api/api-inl.h",
"src/api/api-macros.h",
"src/api/api-natives.cc",
"src/api/api-natives.h",
"src/api/api.cc",
Expand Down Expand Up @@ -2629,7 +2627,6 @@ v8_source_set("v8_base_without_compiler") {
"src/debug/debug-evaluate.h",
"src/debug/debug-frames.cc",
"src/debug/debug-frames.h",
"src/debug/debug-interface.cc",
"src/debug/debug-interface.h",
"src/debug/debug-property-iterator.cc",
"src/debug/debug-property-iterator.h",
Expand Down
4 changes: 2 additions & 2 deletions PRESUBMIT.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,8 +480,8 @@ def _CheckNoexceptAnnotations(input_api, output_api):
def FilterFile(affected_file):
return input_api.FilterSourceFile(
affected_file,
files_to_check=(r'src/.*', r'test/.*'),
files_to_skip=(r'src[\\\/]api[\\\/]api\.cc'))
files_to_check=(r'src/.*', r'test/.*'))


# matches any class name.
class_name = r'\b([A-Z][A-Za-z0-9_:]*)(?:::\1)?'
Expand Down
106 changes: 0 additions & 106 deletions src/api/api-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#define V8_API_API_INL_H_

#include "src/api/api.h"
#include "src/execution/microtask-queue.h"
#include "src/handles/handles-inl.h"
#include "src/objects/foreign-inl.h"
#include "src/objects/js-weak-refs.h"
Expand Down Expand Up @@ -132,111 +131,6 @@ OPEN_HANDLE_LIST(MAKE_OPEN_HANDLE)
#undef MAKE_OPEN_HANDLE
#undef OPEN_HANDLE_LIST

template <bool do_callback>
class V8_NODISCARD CallDepthScope {
public:
CallDepthScope(i::Isolate* isolate, Local<Context> context)
: isolate_(isolate),
context_(context),
escaped_(false),
safe_for_termination_(isolate->next_v8_call_is_safe_for_termination()),
interrupts_scope_(isolate_, i::StackGuard::TERMINATE_EXECUTION,
isolate_->only_terminate_in_safe_scope()
? (safe_for_termination_
? i::InterruptsScope::kRunInterrupts
: i::InterruptsScope::kPostponeInterrupts)
: i::InterruptsScope::kNoop) {
isolate_->thread_local_top()->IncrementCallDepth(this);
isolate_->set_next_v8_call_is_safe_for_termination(false);
if (!context.IsEmpty()) {
i::Handle<i::Context> env = Utils::OpenHandle(*context);
i::HandleScopeImplementer* impl = isolate->handle_scope_implementer();
if (!isolate->context().is_null() &&
isolate->context().native_context() == env->native_context()) {
context_ = Local<Context>();
} else {
impl->SaveContext(isolate->context());
isolate->set_context(*env);
}
}
if (do_callback) isolate_->FireBeforeCallEnteredCallback();
}
~CallDepthScope() {
i::MicrotaskQueue* microtask_queue = isolate_->default_microtask_queue();
if (!context_.IsEmpty()) {
i::HandleScopeImplementer* impl = isolate_->handle_scope_implementer();
isolate_->set_context(impl->RestoreContext());

i::Handle<i::Context> env = Utils::OpenHandle(*context_);
microtask_queue = env->native_context().microtask_queue();
}
if (!escaped_) isolate_->thread_local_top()->DecrementCallDepth(this);
if (do_callback) isolate_->FireCallCompletedCallback(microtask_queue);
// TODO(jochen): This should be #ifdef DEBUG
#ifdef V8_CHECK_MICROTASKS_SCOPES_CONSISTENCY
if (do_callback) {
if (microtask_queue && microtask_queue->microtasks_policy() ==
v8::MicrotasksPolicy::kScoped) {
DCHECK(microtask_queue->GetMicrotasksScopeDepth() ||
!microtask_queue->DebugMicrotasksScopeDepthIsZero());
}
}
#endif
DCHECK(CheckKeptObjectsClearedAfterMicrotaskCheckpoint(microtask_queue));
isolate_->set_next_v8_call_is_safe_for_termination(safe_for_termination_);
}

CallDepthScope(const CallDepthScope&) = delete;
CallDepthScope& operator=(const CallDepthScope&) = delete;

void Escape() {
DCHECK(!escaped_);
escaped_ = true;
auto thread_local_top = isolate_->thread_local_top();
thread_local_top->DecrementCallDepth(this);
bool clear_exception = thread_local_top->CallDepthIsZero() &&
thread_local_top->try_catch_handler_ == nullptr;
isolate_->OptionalRescheduleException(clear_exception);
}

private:
bool CheckKeptObjectsClearedAfterMicrotaskCheckpoint(
i::MicrotaskQueue* microtask_queue) {
bool did_perform_microtask_checkpoint =
isolate_->thread_local_top()->CallDepthIsZero() && do_callback &&
microtask_queue &&
microtask_queue->microtasks_policy() == MicrotasksPolicy::kAuto;
return !did_perform_microtask_checkpoint ||
isolate_->heap()->weak_refs_keep_during_job().IsUndefined(isolate_);
}

i::Isolate* const isolate_;
Local<Context> context_;
bool escaped_;
bool do_callback_;
bool safe_for_termination_;
i::InterruptsScope interrupts_scope_;
i::Address previous_stack_height_;

friend class i::ThreadLocalTop;

DISALLOW_NEW_AND_DELETE()
};

class V8_NODISCARD InternalEscapableScope : public EscapableHandleScope {
public:
explicit inline InternalEscapableScope(i::Isolate* isolate)
: EscapableHandleScope(reinterpret_cast<v8::Isolate*>(isolate)) {}
};

inline bool IsExecutionTerminatingCheck(i::Isolate* isolate) {
if (isolate->has_scheduled_exception()) {
return isolate->scheduled_exception() ==
i::ReadOnlyRoots(isolate).termination_exception();
}
return false;
}

namespace internal {

Handle<Context> HandleScopeImplementer::LastEnteredContext() {
Expand Down
20 changes: 0 additions & 20 deletions src/api/api-macros-undef.h

This file was deleted.

132 changes: 0 additions & 132 deletions src/api/api-macros.h

This file was deleted.

Loading

0 comments on commit ab7c7c7

Please sign in to comment.