1. 10 Oct, 2019 1 commit
    • Joyee Cheung's avatar
      [class] fix undefined private name access in computed property keys · 7fa12e2a
      Joyee Cheung authored
      This patch implements https://github.com/tc39/proposal-class-fields/pull/269
      and makes sure we always throw TypeError when there is invalid private
      name access in computed property keys.
      
      Before this patch, private name variables of private fields and methods
      are initialized together with computed property keys in the order they
      are declared. Accessing undefined private names in the computed property
      keys thus fail silently.
      
      After this patch, we initialize the private name variables of private
      fields before we initialize the computed property keys, so that invalid
      access to private fields in the computed keys can be checked in the IC.
      We now also initialize the brand early, so that invalid access to private
      methods or accessors in the computed keys throw TypeError during brand
      checks - and since these accesses are guarded by brand checks, we can
      create the private methods and accessors after the class is
      defined, and merge the home object setting with the creation
      of the closures.
      
      Bug: v8:8330, v8:9611
      Change-Id: I01363f7befac6cf9dd28ec229b99a99102bcf012
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1846571
      Commit-Queue: Joyee Cheung <joyee@igalia.com>
      Reviewed-by: 's avatarMythri Alle <mythria@chromium.org>
      Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#64225}
      7fa12e2a
  2. 30 Aug, 2019 1 commit
  3. 20 Aug, 2019 1 commit
  4. 30 Jul, 2019 1 commit
    • Joyee Cheung's avatar
      [class] parse private accessors · a6dd7f1c
      Joyee Cheung authored
      This patch adds:
      
      - VariableMode::kPrivateMethod
      - VariableMode::kPrivateSetterOnly
      - VariableMode::kPrivateGetterOnly
      - VariableMode::kPrivateGetterAndSetter
      
      And replace the previous RequiresBrandCheckFlag by inferring
      whether the brand check is required from these VariableModes.
      It is then possible to check duplicate non-complementary
      accessors in the parsers and throw early errors, and allow
      complementary accessors to be associated with the same
      private name variable.
      
      This patch also adds the following AssignType:
      
      - PRIVATE_METHOD
      - PRIVATE_GETTER_ONLY
      - PRIVATE_SETTER_ONLY
      - PRIVATE_GETTER_AND_SETTER
      
      corresponding to the new VariableModes so that it's possible
      to generate specialized code for different type of
      private accessor declarations.
      
      Design doc: https://docs.google.com/document/d/10W4begYfs7lmldSqBoQBBt_BKamgT8igqxF9u50RGrI/edit
      
      Bug: v8:8330
      Change-Id: I0fb61b1be248630d1eadd74fb16d7d64a421f4c4
      Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1695204
      Commit-Queue: Joyee Cheung <joyee@igalia.com>
      Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
      Cr-Commit-Position: refs/heads/master@{#62988}
      a6dd7f1c