Commit c8e8f482 authored by Maya Lekova's avatar Maya Lekova Committed by Commit Bot

[test] Fix a crash in fast API interface types test

This CL hardens the test facility in d8 for interface types for
the fast C API.

Bug: chromium:1201011
Change-Id: Ibfe1bb242f86b4a5edd0d195e049852430f8a2fe
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2843344
Commit-Queue: Maya Lekova <mslekova@chromium.org>
Reviewed-by: 's avatarCamillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#74079}
parent 2cd77745
......@@ -122,6 +122,9 @@ class FastCApiObject {
return false;
}
if (!arg->IsObject()) {
return false;
}
Object* object = Object::Cast(arg);
if (!IsValidApiObject(object)) return false;
......@@ -150,13 +153,15 @@ class FastCApiObject {
"is_valid_api_object should be called with 2 arguments");
return;
}
Object* object = Object::Cast(*args[1]);
if (!IsValidApiObject(object)) {
result = false;
} else {
result = PerIsolateData::Get(args.GetIsolate())
->GetTestApiObjectCtor()
->IsLeafTemplateForApiObject(object);
if (args[1]->IsObject()) {
Object* object = Object::Cast(*args[1]);
if (!IsValidApiObject(object)) {
result = false;
} else {
result = PerIsolateData::Get(args.GetIsolate())
->GetTestApiObjectCtor()
->IsLeafTemplateForApiObject(object);
}
}
args.GetReturnValue().Set(Boolean::New(isolate, result));
......
// 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.
// Flags: --turbo-fast-api-calls
const fast_c_api = new d8.test.FastCAPI();
function foo(obj) {
return fast_c_api.is_fast_c_api_object(false, obj);
}
foo();
// 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.
// Flags: --turbo-fast-api-calls
const fast_c_api = new d8.test.FastCAPI();
function foo(obj) {
return fast_c_api.is_fast_c_api_object(false, obj);
}
foo(1);
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