diff options
author | Timothy Gu <timothygu99@gmail.com> | 2017-11-26 23:33:17 -0800 |
---|---|---|
committer | Timothy Gu <timothygu99@gmail.com> | 2017-11-29 11:18:26 -0800 |
commit | b28af4dc26139778223fe61a886093a7d0e85c1f (patch) | |
tree | c2d8d695a57aa2fa1d4b5fdd302d485d31176903 /deps | |
parent | 4503da8a3a3b0b71d950a63de729ce495965f6ea (diff) | |
download | android-node-v8-b28af4dc26139778223fe61a886093a7d0e85c1f.tar.gz android-node-v8-b28af4dc26139778223fe61a886093a7d0e85c1f.tar.bz2 android-node-v8-b28af4dc26139778223fe61a886093a7d0e85c1f.zip |
deps: cherry-pick 1420e44db0 from upstream V8
Original commit message:
[coverage] Correctly free DebugInfo in the absence of breakpoints
It's quite possible for DebugInfos to exist without the presence of a
bytecode array, since DebugInfos are created for all functions for which
we have a CoverageInfo. Free such objects properly.
Also move the corresponding deletion of CoverageInfos on unload up
before the early exit.
Bug: v8:6000
Change-Id: Idde45b222290aa8b6828b61ff2251918b8ed2aed
Reviewed-on: https://chromium-review.googlesource.com/664811
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#48024}
Fixes crash when passing Profiler.startPreciseCoverage before
Debug.paused is received.
PR-URL: https://github.com/nodejs/node/pull/17344
Refs: https://github.com/v8/v8/commit/1420e44db0ac3631687deb9fc6816ac97b9f499c
Refs: https://github.com/bcoe/c8/pull/6#discussion_r153121287
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Michaƫl Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'deps')
-rw-r--r-- | deps/v8/src/debug/debug.cc | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/deps/v8/src/debug/debug.cc b/deps/v8/src/debug/debug.cc index e2beaed6ab..966be62e63 100644 --- a/deps/v8/src/debug/debug.cc +++ b/deps/v8/src/debug/debug.cc @@ -338,13 +338,12 @@ bool Debug::Load() { void Debug::Unload() { ClearAllBreakPoints(); ClearStepping(); + if (FLAG_block_coverage) RemoveAllCoverageInfos(); RemoveDebugDelegate(); // Return debugger is not loaded. if (!is_loaded()) return; - if (FLAG_block_coverage) RemoveAllCoverageInfos(); - // Clear debugger context global handle. GlobalHandles::Destroy(Handle<Object>::cast(debug_context_).location()); debug_context_ = Handle<Context>(); @@ -643,8 +642,11 @@ void Debug::ApplyBreakPoints(Handle<DebugInfo> debug_info) { } void Debug::ClearBreakPoints(Handle<DebugInfo> debug_info) { + // If we attempt to clear breakpoints but none exist, simply return. This can + // happen e.g. CoverageInfos exit but no breakpoints are set. + if (!debug_info->HasDebugBytecodeArray()) return; + DisallowHeapAllocation no_gc; - DCHECK(debug_info->HasDebugBytecodeArray()); for (BreakIterator it(debug_info); !it.Done(); it.Next()) { it.ClearDebugBreak(); } |