Commit 335e169b authored by Sathya Gunasekaran's avatar Sathya Gunasekaran Committed by Commit Bot

Reland "[debug] Add test for promise finally"

This is a reland of a2ed0514
Original change's description:
> [debug] Add test for promise finally
> 
> As of v8:6536, we no longer have to mark builtins explicitly.
> 
> Also remove test whitelist for promise finally
> builtins.
> 
> Bug: v8:6088, v8:5967
> Change-Id: I7f98dfe7708678653e944ac76ba9938205490b16
> Reviewed-on: https://chromium-review.googlesource.com/654067
> Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
> Reviewed-by: Jakob Gruber <jgruber@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#47896}

TBR=jgruber@chromium.org

Bug: v8:6088, v8:5967
Change-Id: I25a1820e04596a44769fc8ded80678f3663bbcd5
Reviewed-on: https://chromium-review.googlesource.com/655740Reviewed-by: 's avatarSathya Gunasekaran <gsathya@chromium.org>
Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
Cr-Commit-Position: refs/heads/master@{#47906}
parent 566e9723
......@@ -6523,17 +6523,12 @@ TEST(BuiltinsExceptionPrediction) {
v8::HandleScope handle_scope(isolate);
v8::Context::New(isolate);
// TODO(gsathya): Fix catch prediction for the following.
std::set<int> whitelist(
{i::Builtins::kPromiseThenFinally, i::Builtins::kPromiseCatchFinally});
i::Builtins* builtins = CcTest::i_isolate()->builtins();
bool fail = false;
for (int i = 0; i < i::Builtins::builtin_count; i++) {
Code* builtin = builtins->builtin(i);
if (builtin->kind() != Code::BUILTIN) continue;
if (whitelist.find(i) != whitelist.end()) continue;
auto prediction = builtin->GetBuiltinCatchPrediction();
USE(prediction);
......
// Copyright 2017 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.
// Flags: --harmony-promise-finally
Debug = debug.Debug
var exception = null;
var step = 0;
function listener(event, exec_state, event_data, data) {
if (event != Debug.DebugEvent.Exception) return;
try {
var line = exec_state.frame(0).sourceLineText();
var match = /Exception/.exec(line);
assertNotNull(match);
step++;
} catch (e) {
exception = e;
}
}
// Caught throw, events on any exception.
Debug.setListener(listener);
Debug.setBreakOnException();
var thenable = {
get then() {
throw new Error('err'); // Exception
}
};
var caughtException = null;
Promise.resolve()
.finally(() => thenable)
.catch(e => caughtException = e);
%RunMicrotasks();
Debug.setListener(null);
Debug.clearBreakOnException();
assertNull(exception);
assertNotNull(caughtException);
assertEquals(1, step);
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