• Seth Brenith's avatar
    Require the first three fields of ScopeInfo to be present · 2bbf3333
    Seth Brenith authored
    ScopeInfo objects generally start with three fields: flags, parameter
    count, and local variable count. But a single read-only ScopeInfo
    instance has none of those fields. This is the empty ScopeInfo, which is
    used for contexts that don't correspond to any scope (the native context
    and contexts for builtin functions). Since there is only ever a single
    instance of the empty ScopeInfo, the memory savings of omitting these
    fields is trivial, and we can simplify logic somewhat by including them.
    Rather than checking for length to be zero, this change introduces a new
    flag indicating that a ScopeInfo instance is the empty one.
    
    On its own, this change doesn't provide a whole lot of value. However,
    it sets us up for two further improvements, which are consistent with
    the goals outlined in [1]:
    
    1. We should fully describe ScopeInfo fields in Torque. Getting rid of
    the requirement to check for emptiness would substantially simplify the
    indexed field expressions.
    
    2. ScopeInfo shouldn't inherit from FixedArray, and shouldn't begin with
    a `length` field when the length can be computed from the other fields.
    This would save a small amount of heap memory and avoid any possibility
    of a mismatch between the two ways of computing the length.
    
    [1] https://docs.google.com/document/d/1tiGK7_lubxPHnInI2vscUwMHfadn8gIEa1apmI8HxR4/edit#heading=h.n63k76b3zfwa
    
    Bug: v8:8952
    Change-Id: I018127698a5d91fb2a91684bc3aec2e27ee27c41
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2561598Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
    Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
    Commit-Queue: Seth Brenith <seth.brenith@microsoft.com>
    Cr-Commit-Position: refs/heads/master@{#71500}
    2bbf3333
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...
DIR_METADATA 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...
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...