• Georg Neis's avatar
    [turbofan] Make fewer assumptions about children of a serialized object · fb481bc9
    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: 's avatarSantiago 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
Name
Last commit
Last update
build_overrides Loading commit data...
custom_deps Loading commit data...
docs Loading commit data...
gni Loading commit data...
include Loading commit data...
infra Loading commit data...
samples Loading commit data...
src Loading commit data...
test Loading commit data...
testing Loading commit data...
third_party Loading commit data...
tools Loading commit data...
.clang-format Loading commit data...
.clang-tidy Loading commit data...
.editorconfig Loading commit data...
.flake8 Loading commit data...
.git-blame-ignore-revs Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
.gn Loading commit data...
.vpython Loading commit data...
.ycm_extra_conf.py Loading commit data...
AUTHORS Loading commit data...
BUILD.gn Loading commit data...
CODE_OF_CONDUCT.md Loading commit data...
COMMON_OWNERS Loading commit data...
DEPS Loading commit data...
ENG_REVIEW_OWNERS Loading commit data...
INFRA_OWNERS Loading commit data...
INTL_OWNERS Loading commit data...
LICENSE Loading commit data...
LICENSE.fdlibm Loading commit data...
LICENSE.strongtalk Loading commit data...
LICENSE.v8 Loading commit data...
LICENSE.valgrind Loading commit data...
MIPS_OWNERS Loading commit data...
OWNERS Loading commit data...
PPC_OWNERS Loading commit data...
PRESUBMIT.py Loading commit data...
README.md Loading commit data...
S390_OWNERS Loading commit data...
WATCHLISTS Loading commit data...
codereview.settings Loading commit data...