-
Georg Neis authored
1) Strengthen the ObjectData::As* cast methods to check that the kind is kSerializedHeapObject, because otherwise the data object is not a subclass instance and the cast is invalid. 2) Fix errors revealed by (1) and pave way for moving away from serialization. These changes are mechanical except for a needed refactoring of ContextRef::previous. Details regarding (2): Change (1) revealed a large number of places where we incorrectly casted object data. This went unnoticed so far because in the end we accessed the object through the corresponding ObjectRef interface which did the right thing depending on the data kind. These bugs were introduced when kUnserializedReadOnlyHeapObject was added, but they also affect the new kNeverSerializedHeapObject and would become show stoppers as we move more objects to the latter kind. The CL fixes all the issues that I found except one: There's still one place left where we assume a particular subclass instance for now (marked with a TODO). This is not a bug at the moment but will cause CHECK failures once we move the corresponding object type to never-serialized. A rewrite of map serialization might be needed to resolve that. Note: With the changes in (2) we lose some type safety in the implementation of the *Data classes. With some extra work that could be avoided. However, I think it's not worth it because (i) these classes are expected to be removed (and in the meantime to not change much), and (ii) their wrapper *Ref classes still ensure type safety. Bug: v8:7790 Change-Id: I9a5d03fa2f61e03c9c0ab4ac7f9869603d5be1d9 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2398537Reviewed-by: Santiago Aboy Solanes <solanes@chromium.org> Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org> Auto-Submit: Georg Neis <neis@chromium.org> Cr-Commit-Position: refs/heads/master@{#69775}
fb481bc9