Commit 0d0e73e6 authored by Marja Hölttä's avatar Marja Hölttä Committed by V8 LUCI CQ

[rab/gsab] Fix error handling in GetDerivedRabGsabMap

It was delegating to GetDerivedMap but not handling the possible
error coming from it.

Bug: v8:11111,chromium:1347722
Change-Id: I348ed721281d8edd324f0e364d8ed45602cb9f54
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3791063Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Auto-Submit: Marja Hölttä <marja@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#82046}
parent 766b2a4d
......@@ -1067,11 +1067,14 @@ int TypedArrayElementsKindToRabGsabCtorIndex(ElementsKind elements_kind) {
} // namespace
Handle<Map> JSFunction::GetDerivedRabGsabMap(Isolate* isolate,
Handle<JSFunction> constructor,
Handle<JSReceiver> new_target) {
Handle<Map> map =
GetDerivedMap(isolate, constructor, new_target).ToHandleChecked();
MaybeHandle<Map> JSFunction::GetDerivedRabGsabMap(
Isolate* isolate, Handle<JSFunction> constructor,
Handle<JSReceiver> new_target) {
MaybeHandle<Map> maybe_map = GetDerivedMap(isolate, constructor, new_target);
Handle<Map> map;
if (!maybe_map.ToHandle(&map)) {
return MaybeHandle<Map>();
}
{
DisallowHeapAllocation no_alloc;
NativeContext context = isolate->context().native_context();
......
......@@ -279,7 +279,7 @@ class JSFunction : public TorqueGeneratedJSFunction<
Handle<JSReceiver> new_target);
// Like GetDerivedMap, but returns a map with a RAB / GSAB ElementsKind.
static V8_WARN_UNUSED_RESULT Handle<Map> GetDerivedRabGsabMap(
static V8_WARN_UNUSED_RESULT MaybeHandle<Map> GetDerivedRabGsabMap(
Isolate* isolate, Handle<JSFunction> constructor,
Handle<JSReceiver> new_target);
......
......@@ -1052,7 +1052,8 @@ RUNTIME_FUNCTION(Runtime_GetDerivedMap) {
Handle<JSReceiver> new_target = args.at<JSReceiver>(1);
Handle<Object> rab_gsab = args.at(2);
if (rab_gsab->IsTrue()) {
return *JSFunction::GetDerivedRabGsabMap(isolate, target, new_target);
RETURN_RESULT_OR_FAILURE(
isolate, JSFunction::GetDerivedRabGsabMap(isolate, target, new_target));
} else {
RETURN_RESULT_OR_FAILURE(
isolate, JSFunction::GetDerivedMap(isolate, target, new_target));
......
// Copyright 2022 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-rab-gsab
const proxy = new Proxy(Int16Array, {"get": () => { throw 'lol'; }});
const rab = new ArrayBuffer(1632, {"maxByteLength": 4096});
try {
new proxy(rab);
} catch {
}
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