[api] Fix DCHECK on API failure

Utils::ReportApiFailure() contains logic to handle the case where no
isolate has been entered but it called Isolate::Current(), which DCHECks
when there is no active isolate. Switch to Isolate::TryGetCurrent().

See https://github.com/denoland/rusty_v8/issues/253 for background.

Change-Id: I73c28c31102c0c4ab216a925d22ad54174c7911d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2020943
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#65995}
This commit is contained in:
Ben Noordhuis 2020-01-26 01:06:48 +01:00 committed by Commit Bot
parent 4299cb69fb
commit 872bc2d17f

View File

@ -465,7 +465,7 @@ void i::V8::FatalProcessOutOfMemory(i::Isolate* isolate, const char* location,
}
void Utils::ReportApiFailure(const char* location, const char* message) {
i::Isolate* isolate = i::Isolate::Current();
i::Isolate* isolate = i::Isolate::TryGetCurrent();
FatalErrorCallback callback = nullptr;
if (isolate != nullptr) {
callback = isolate->exception_behavior();