[d8] Properly handle exceptions in Shell::PerformanceMeasureMemory

Bug: chromium:1224142
Change-Id: I42ed4ad23057837972cdbebb10e861948da9ddb2
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3017813
Auto-Submit: Igor Sheludko <ishell@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#75682}
This commit is contained in:
Igor Sheludko 2021-07-12 14:34:34 +02:00 committed by V8 LUCI CQ
parent ca59636186
commit 5531a74be6
2 changed files with 25 additions and 2 deletions

View File

@ -1583,8 +1583,11 @@ void Shell::PerformanceMeasureMemory(
Local<Object> object = args[0].As<Object>();
Local<Value> value = TryGetValue(isolate, context, object, "detailed")
.FromMaybe(Local<Value>());
if (!value.IsEmpty() && value->IsBoolean() &&
value->BooleanValue(isolate)) {
if (value.IsEmpty()) {
// Exception was thrown and scheduled, so return from the callback.
return;
}
if (value->IsBoolean() && value->BooleanValue(isolate)) {
mode = v8::MeasureMemoryMode::kDetailed;
}
}

View File

@ -0,0 +1,20 @@
// Copyright 2021 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.
function main() {
function test(v9,v10) {
const v14 = async (v15,v16,v17) => {
function v19() {
JSON.stringify(this);
v17(test);
}
Object.defineProperty(v17,v16,v10);
new Promise(v19);
}
v9.__proto__.__proto__ = new Proxy(test, {get: v14})
}
test(isFinite,{});
undefined_function();
}
assertThrows(main);