Fix PerformCastCheck on v8::Data (again)

See crrev.com/c/2383030

PerformCheckCast<Data>() itself should not invoke Data::Cast(), since
there is no such method and every publicly available value can be
casted to it anyway. This is an issue in e.g.
GetDataFromSnapshotOnce<Data>().

Change-Id: I4acbff86ffd4537b744dafc588733428e792b4bd
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2399052
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Commit-Queue: Gus Caplan <snek@chromium.org>
Cr-Commit-Position: refs/heads/master@{#69771}
This commit is contained in:
Gus Caplan 2020-09-08 22:25:22 -05:00 committed by Commit Bot
parent 92236da279
commit 74ede07103
2 changed files with 7 additions and 1 deletions

View File

@ -415,7 +415,7 @@ void CastCheck<false>::Perform(T* data) {}
template <class T>
V8_INLINE void PerformCastCheck(T* data) {
CastCheck<std::is_base_of<Data, T>::value &&
!std::is_same<Data, std::remove_cv<T>>::value>::Perform(data);
!std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
}
// A base class for backing stores, which is needed due to vagaries of

View File

@ -3389,6 +3389,12 @@ UNINITIALIZED_TEST(SnapshotCreatorAddData) {
DisableEmbeddedBlobRefcounting();
v8::StartupData blob;
// i::PerformCastCheck(Data*) should compile and be no-op
{
v8::Local<v8::Data> data;
i::PerformCastCheck(*data);
}
{
v8::SnapshotCreator creator;
v8::Isolate* isolate = creator.GetIsolate();