[class] handle existing readonly properties in StoreOwnIC [v8/v8 : main]

34 views
Skip to first unread message

Joyee Cheung (Gerrit)

unread,
Nov 26, 2021, 9:10:28 AM11/26/21
to Igor Sheludko, Shu-yu Guo, V8 LUCI CQ, v8-re...@googlegroups.com

Attention is currently required from: Shu-yu Guo, Igor Sheludko.

View Change

5 comments:

  • Patchset:

    • Patch Set #11:

      PTAL, this fix so far works with the existing tests and the tests I added, but I have a question regarding how to handle LookupIterator::TRANSITION when implementing [[DefineOwnProperty]] semantics in the slow path (the current patch might fail if more tests with e.g. interceptors or access checks are added), so I want to confirm the current approach is correct before diving deeper.

  • File src/ic/ic.cc:

    • Patch Set #11, Line 1762: return JSProxy::DefineOwnProperty(it->isolate(), it->GetHolder<JSProxy>(),

      I *think* it should be fine to leave this for future patches?

    • Patch Set #11, Line 1771: // TODO(joyee): check if Object::AddDataProperty() is enough, or if we

      This part is incomplete and should be addressed in this patch - but I want to confirm that implementing an equivalent of JSObject::DefineOwnPropertyIgnoreAttributes() that plays well with the transition is the right way to go before diving into it. A lot of code used by JSObject::DefineOwnPropertyIgnoreAttributes() assumes that it->state() isn't TRANSITION, but as far as I can tell we do need to implement something that works with it for [[DefineOwnProperty]] semantics to work in the slow path.

    • Patch Set #11, Line 1803: if (IsStoreOwnIC()) {

      This, the TODO below and the TODO in keyed-store-generic.cc all points to https://docs.google.com/document/d/1jvSEvXFHRkxg4JX-j6ho3nRqAF8vZI2Ai7RI8AY54gM/edit, I think the renaming should be done, but it can be done independently from this fix.

  • File test/mjsunit/regress/regress-v8-12421.js:

    • Patch Set #11, Line 5: {

      Is there a way to tell the test runner to run this test again with --no-lazy-feedback? (Other than copy-pasting this file and adding a // Flags: --no-lazy-feedback on top..)

To view, visit change 3300092. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: I6547320a1caba58c66ee1043cd3183a2de7cefef
Gerrit-Change-Number: 3300092
Gerrit-PatchSet: 11
Gerrit-Owner: Joyee Cheung <jo...@igalia.com>
Gerrit-Reviewer: Igor Sheludko <ish...@chromium.org>
Gerrit-Reviewer: Joyee Cheung <jo...@igalia.com>
Gerrit-Reviewer: Shu-yu Guo <s...@chromium.org>
Gerrit-Attention: Shu-yu Guo <s...@chromium.org>
Gerrit-Attention: Igor Sheludko <ish...@chromium.org>
Gerrit-Comment-Date: Fri, 26 Nov 2021 14:10:19 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment

Joyee Cheung (Gerrit)

unread,
Nov 26, 2021, 9:16:31 AM11/26/21
to Igor Sheludko, Shu-yu Guo, V8 LUCI CQ, v8-re...@googlegroups.com

Attention is currently required from: Shu-yu Guo, Igor Sheludko.

View Change

1 comment:

  • File test/mjsunit/regress/regress-v8-12421.js:

    • Patch Set #11, Line 206: assertEquals("written", proxy.normalField);

      I had some tests that verify the content of trapCalls, but it got lost when I was tweaking the patch. Note to self to add them back.

To view, visit change 3300092. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: I6547320a1caba58c66ee1043cd3183a2de7cefef
Gerrit-Change-Number: 3300092
Gerrit-PatchSet: 11
Gerrit-Owner: Joyee Cheung <jo...@igalia.com>
Gerrit-Reviewer: Igor Sheludko <ish...@chromium.org>
Gerrit-Reviewer: Joyee Cheung <jo...@igalia.com>
Gerrit-Reviewer: Shu-yu Guo <s...@chromium.org>
Gerrit-Attention: Shu-yu Guo <s...@chromium.org>
Gerrit-Attention: Igor Sheludko <ish...@chromium.org>
Gerrit-Comment-Date: Fri, 26 Nov 2021 14:16:24 +0000

Shu-yu Guo (Gerrit)

unread,
Nov 29, 2021, 4:51:57 PM11/29/21
to Joyee Cheung, Igor Sheludko, V8 LUCI CQ, v8-re...@googlegroups.com

Attention is currently required from: Joyee Cheung, Igor Sheludko.

View Change

3 comments:

  • File src/ic/ic.cc:

    • Patch Set #11, Line 1762: return JSProxy::DefineOwnProperty(it->isolate(), it->GetHolder<JSProxy>(),

      I *think* it should be fine to leave this for future patches?

    • Defer to ishell@ here. Does LookupIterator call user code or do effectful things? It seems okay by my reading.

    • This part is incomplete and should be addressed in this patch - but I want to confirm that implement […]

      Doesn't JSObject::DefineOwnPropertyIgnoreAttributes already handle NOT_FOUND and TRANSITION at the bottom via Object::AddDataProperty? Is this case necessary?

    • This, the TODO below and the TODO in keyed-store-generic.cc all points to https://docs.google. […]

      +1 to keeping the rename CL separate.

To view, visit change 3300092. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: I6547320a1caba58c66ee1043cd3183a2de7cefef
Gerrit-Change-Number: 3300092
Gerrit-PatchSet: 11
Gerrit-Owner: Joyee Cheung <jo...@igalia.com>
Gerrit-Reviewer: Igor Sheludko <ish...@chromium.org>
Gerrit-Reviewer: Joyee Cheung <jo...@igalia.com>
Gerrit-Reviewer: Shu-yu Guo <s...@chromium.org>
Gerrit-Attention: Joyee Cheung <jo...@igalia.com>
Gerrit-Attention: Igor Sheludko <ish...@chromium.org>
Gerrit-Comment-Date: Mon, 29 Nov 2021 21:51:51 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Joyee Cheung <jo...@igalia.com>
Gerrit-MessageType: comment

Joyee Cheung (Gerrit)

unread,
Nov 30, 2021, 3:08:55 AM11/30/21
to Igor Sheludko, Shu-yu Guo, V8 LUCI CQ, v8-re...@googlegroups.com

Attention is currently required from: Shu-yu Guo, Igor Sheludko.

View Change

1 comment:

  • File src/ic/ic.cc:

    • Patch Set #11, Line 1771: // TODO(joyee): check if Object::AddDataProperty() is enough, or if we

      Doesn't JSObject::DefineOwnPropertyIgnoreAttributes already handle NOT_FOUND and TRANSITION at the b […]

      Currently NOT_FOUND and TRANSITION are UNREACHABLE in the switches in JSObject::DefineOwnPropertyIgnoreAttributes (before it hits Object::AddDataProperty at the bottom), so for example with --no-lazy-feedback the globalThis tests added in this CL would crash in JSObject::DefineOwnPropertyIgnoreAttributes (because it would be updated from ACCESS_CHECK to TRANSITION). I do wonder if we could just add some code there to handle these two cases directly in JSObject::DefineOwnPropertyIgnoreAttributes instead of having a new implementation though, unless it's intentional that this shouldn't be done there.

To view, visit change 3300092. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: I6547320a1caba58c66ee1043cd3183a2de7cefef
Gerrit-Change-Number: 3300092
Gerrit-PatchSet: 11
Gerrit-Owner: Joyee Cheung <jo...@igalia.com>
Gerrit-Reviewer: Igor Sheludko <ish...@chromium.org>
Gerrit-Reviewer: Joyee Cheung <jo...@igalia.com>
Gerrit-Reviewer: Shu-yu Guo <s...@chromium.org>
Gerrit-Attention: Shu-yu Guo <s...@chromium.org>
Gerrit-Attention: Igor Sheludko <ish...@chromium.org>
Gerrit-Comment-Date: Tue, 30 Nov 2021 08:08:46 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Shu-yu Guo <s...@chromium.org>

Shu-yu Guo (Gerrit)

unread,
Nov 30, 2021, 10:29:57 AM11/30/21
to Joyee Cheung, Igor Sheludko, V8 LUCI CQ, v8-re...@googlegroups.com

Attention is currently required from: Joyee Cheung, Igor Sheludko.

View Change

1 comment:

  • File src/ic/ic.cc:

    • Currently NOT_FOUND and TRANSITION are UNREACHABLE in the switches in JSObject::DefineOwnPropertyIgn […]

      I see. NOT_FOUND is already handled, though, since the for loop in DefineOwnPropertyIgnoreAttribute exits on !it->IsFound().

To view, visit change 3300092. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: I6547320a1caba58c66ee1043cd3183a2de7cefef
Gerrit-Change-Number: 3300092
Gerrit-PatchSet: 11
Gerrit-Owner: Joyee Cheung <jo...@igalia.com>
Gerrit-Reviewer: Igor Sheludko <ish...@chromium.org>
Gerrit-Reviewer: Joyee Cheung <jo...@igalia.com>
Gerrit-Reviewer: Shu-yu Guo <s...@chromium.org>
Gerrit-Attention: Joyee Cheung <jo...@igalia.com>
Gerrit-Attention: Igor Sheludko <ish...@chromium.org>
Gerrit-Comment-Date: Tue, 30 Nov 2021 15:29:51 +0000

Joyee Cheung (Gerrit)

unread,
Dec 7, 2021, 12:56:45 PM12/7/21
to Igor Sheludko, Shu-yu Guo, V8 LUCI CQ, v8-re...@googlegroups.com

Attention is currently required from: Shu-yu Guo, Igor Sheludko.

View Change

4 comments:

  • Patchset:

    • Patch Set #12:

      I tried to come up with some test cases for other states being transitioned, but reading StoreIC::LookupForWrite I realized that it seems only possible to transition from NOT_FOUND and ACCESS_CHECK here, so I added some UNREACHABLE checks and DCHECKs for the impossible cases instead. I think this is ready now, also updated the proxy case a bit to make sure that the defineProperty traps are called before an error is thrown. Pinging Igor for a review.

  • File src/ic/ic.cc:

    • I see. […]

      Ah, good point, I updated to use JSObject::DefineOwnPropertyIgnoreAttributes for NOT_FOUND too.

  • File test/mjsunit/regress/regress-v8-12421.js:

    • Patch Set #11, Line 5: {

      Is there a way to tell the test runner to run this test again with --no-lazy-feedback? (Other than c […]

      I added a test that just reload this one with --no-lazy-feedback-allocation.

    • I had some tests that verify the content of trapCalls, but it got lost when I was tweaking the patch […]

      Done

To view, visit change 3300092. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: I6547320a1caba58c66ee1043cd3183a2de7cefef
Gerrit-Change-Number: 3300092
Gerrit-PatchSet: 12
Gerrit-Owner: Joyee Cheung <jo...@igalia.com>
Gerrit-Reviewer: Igor Sheludko <ish...@chromium.org>
Gerrit-Reviewer: Joyee Cheung <jo...@igalia.com>
Gerrit-Reviewer: Shu-yu Guo <s...@chromium.org>
Gerrit-Attention: Shu-yu Guo <s...@chromium.org>
Gerrit-Attention: Igor Sheludko <ish...@chromium.org>
Gerrit-Comment-Date: Tue, 07 Dec 2021 17:56:30 +0000

Shu-yu Guo (Gerrit)

unread,
Dec 10, 2021, 6:36:04 PM12/10/21
to Joyee Cheung, Igor Sheludko, V8 LUCI CQ, v8-re...@googlegroups.com

Attention is currently required from: Joyee Cheung, Igor Sheludko.

Patch set 13:Code-Review +1

View Change

1 comment:

  • Patchset:

    • Patch Set #13:

      lgtm but let's wait for ishell@'s review who knows the IC system much better than I do.

To view, visit change 3300092. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: I6547320a1caba58c66ee1043cd3183a2de7cefef
Gerrit-Change-Number: 3300092
Gerrit-PatchSet: 13
Gerrit-Owner: Joyee Cheung <jo...@igalia.com>
Gerrit-Reviewer: Igor Sheludko <ish...@chromium.org>
Gerrit-Reviewer: Joyee Cheung <jo...@igalia.com>
Gerrit-Reviewer: Shu-yu Guo <s...@chromium.org>
Gerrit-Attention: Joyee Cheung <jo...@igalia.com>
Gerrit-Attention: Igor Sheludko <ish...@chromium.org>
Gerrit-Comment-Date: Fri, 10 Dec 2021 23:35:40 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

Joyee Cheung (Gerrit)

unread,
Jan 6, 2022, 10:45:16 PM1/6/22
to Shu-yu Guo, Igor Sheludko, V8 LUCI CQ, v8-re...@googlegroups.com

Attention is currently required from: Igor Sheludko.

View Change

1 comment:

  • Patchset:

    • Patch Set #13:

      Pinging Igor for a review, this is breaking the v9.7 release

To view, visit change 3300092. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: I6547320a1caba58c66ee1043cd3183a2de7cefef
Gerrit-Change-Number: 3300092
Gerrit-PatchSet: 13
Gerrit-Owner: Joyee Cheung <jo...@igalia.com>
Gerrit-Reviewer: Igor Sheludko <ish...@chromium.org>
Gerrit-Reviewer: Joyee Cheung <jo...@igalia.com>
Gerrit-Reviewer: Shu-yu Guo <s...@chromium.org>
Gerrit-Attention: Igor Sheludko <ish...@chromium.org>
Gerrit-Comment-Date: Fri, 07 Jan 2022 03:45:07 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment

Shu-yu Guo (Gerrit)

unread,
Jan 7, 2022, 11:13:55 AM1/7/22
to Joyee Cheung, Igor Sheludko, V8 LUCI CQ, v8-re...@googlegroups.com

Attention is currently required from: Joyee Cheung, Igor Sheludko.

View Change

1 comment:

  • Patchset:

    • Patch Set #13:

      Pinging Igor for a review, this is breaking the v9. […]

      Hm, that's already released, right? So we'd need to prepare a backport when this lands.

To view, visit change 3300092. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: I6547320a1caba58c66ee1043cd3183a2de7cefef
Gerrit-Change-Number: 3300092
Gerrit-PatchSet: 13
Gerrit-Owner: Joyee Cheung <jo...@igalia.com>
Gerrit-Reviewer: Igor Sheludko <ish...@chromium.org>
Gerrit-Reviewer: Joyee Cheung <jo...@igalia.com>
Gerrit-Reviewer: Shu-yu Guo <s...@chromium.org>
Gerrit-Attention: Joyee Cheung <jo...@igalia.com>
Gerrit-Attention: Igor Sheludko <ish...@chromium.org>
Gerrit-Comment-Date: Fri, 07 Jan 2022 16:13:45 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No

Joyee Cheung (Gerrit)

unread,
Jan 10, 2022, 4:52:09 AM1/10/22
to Shu-yu Guo, Igor Sheludko, V8 LUCI CQ, v8-re...@googlegroups.com

Attention is currently required from: Igor Sheludko.

View Change

1 comment:

  • Patchset:

    • Patch Set #13:

      Hm, that's already released, right? So we'd need to prepare a backport when this lands.

      Yes, we should request for a backport.

To view, visit change 3300092. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: I6547320a1caba58c66ee1043cd3183a2de7cefef
Gerrit-Change-Number: 3300092
Gerrit-PatchSet: 13
Gerrit-Owner: Joyee Cheung <jo...@igalia.com>
Gerrit-Reviewer: Igor Sheludko <ish...@chromium.org>
Gerrit-Reviewer: Joyee Cheung <jo...@igalia.com>
Gerrit-Reviewer: Shu-yu Guo <s...@chromium.org>
Gerrit-Attention: Igor Sheludko <ish...@chromium.org>
Gerrit-Comment-Date: Mon, 10 Jan 2022 09:52:01 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Shu-yu Guo <s...@chromium.org>

Toon Verwaest (Gerrit)

unread,
Jan 10, 2022, 10:28:12 AM1/10/22
to Joyee Cheung, Shu-yu Guo, Igor Sheludko, V8 LUCI CQ, v8-re...@googlegroups.com

Attention is currently required from: Shu-yu Guo, Joyee Cheung, Igor Sheludko.

View Change

6 comments:

  • Patchset:

    • Patch Set #13:

      Ugh, reusing StoreIC for StoreOwn and then even defineOwnProperty seems like a complete error-prone mess. Are you sure this is how we want to do it?

  • File src/ic/ic.cc:

    • Patch Set #11, Line 1762: return JSProxy::DefineOwnProperty(it->isolate(), it->GetHolder<JSProxy>(),

      Defer to ishell@ here. […]

      This is fine.

  • File src/ic/ic.cc:

    • Patch Set #13, Line 1748: if (!Object::CheckContextualStoreToJSGlobalObject(it, should_throw)) {

      This should never be possible. A contextual store is e.g., "a = 10" that ends up targeting the native context (global object).

    • Patch Set #13, Line 1871: // traps need to be called first if they are present.

      The same is true for interceptors?

    • Patch Set #13, Line 1881: UpdateCaches(&it, value, store_origin);

      Won't the proxy IC end up calling the store trap instead of the define trap?

      I tested in on 9.9 and that's indeed what it seems to be doing due to SetProperty below as well; but the IC will now cause a hybrid between set and defineProperty...:

       d8> Proxy.prototype = Object.prototype
      d8> Z = class Z extends Proxy { constructor() { super({}, {set() {
      console.log("set"); return true }, defineProperty() {
      console.log("defineProperty"); return true; } }) } a = 1 }
      d8> new Z()
      set
      {}
  • File src/objects/js-objects.cc:

To view, visit change 3300092. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: I6547320a1caba58c66ee1043cd3183a2de7cefef
Gerrit-Change-Number: 3300092
Gerrit-PatchSet: 13
Gerrit-Owner: Joyee Cheung <jo...@igalia.com>
Gerrit-Reviewer: Igor Sheludko <ish...@chromium.org>
Gerrit-Reviewer: Joyee Cheung <jo...@igalia.com>
Gerrit-Reviewer: Shu-yu Guo <s...@chromium.org>
Gerrit-CC: Toon Verwaest <verw...@chromium.org>
Gerrit-Attention: Shu-yu Guo <s...@chromium.org>
Gerrit-Attention: Joyee Cheung <jo...@igalia.com>
Gerrit-Attention: Igor Sheludko <ish...@chromium.org>
Gerrit-Comment-Date: Mon, 10 Jan 2022 15:28:01 +0000

Joyee Cheung (Gerrit)

unread,
Jan 10, 2022, 11:35:28 AM1/10/22
to Toon Verwaest, Shu-yu Guo, Igor Sheludko, V8 LUCI CQ, v8-re...@googlegroups.com

Attention is currently required from: Shu-yu Guo, Toon Verwaest, Igor Sheludko.

View Change

2 comments:

  • Patchset:

    • Patch Set #13:

      Ugh, reusing StoreIC for StoreOwn and then even defineOwnProperty seems like a complete error-prone […]

      I agree this is error-prone, but this is what currently on the tree. So I left some TODOs in the relevant code paths saying we should either rename them (see Shu's doc https://docs.google.com/document/d/1jvSEvXFHRkxg4JX-j6ho3nRqAF8vZI2Ai7RI8AY54gM/edit), or separate them out (can probably be done following the renaming). As the doc described, what we actually need is support for Set and Define, and the name Store is a bit ambiguous. Where StoreOwn is currently used is actually hitting [[DeinfeOwnProperty]] semantics in the spec, so to get out of this weird reuse we should probably stop merging Set and Define into Store, and separate the Define part out of StoreIC. I think we can focus on fixing the behavior in this patch though, since the bug is already out there, and the renaming/separation can be a follow-up, WDYT?

  • File src/ic/ic.cc:

    • This is fine.

      Done

To view, visit change 3300092. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: I6547320a1caba58c66ee1043cd3183a2de7cefef
Gerrit-Change-Number: 3300092
Gerrit-PatchSet: 14
Gerrit-Owner: Joyee Cheung <jo...@igalia.com>
Gerrit-Reviewer: Igor Sheludko <ish...@chromium.org>
Gerrit-Reviewer: Joyee Cheung <jo...@igalia.com>
Gerrit-Reviewer: Shu-yu Guo <s...@chromium.org>
Gerrit-CC: Toon Verwaest <verw...@chromium.org>
Gerrit-Attention: Shu-yu Guo <s...@chromium.org>
Gerrit-Attention: Toon Verwaest <verw...@chromium.org>
Gerrit-Attention: Igor Sheludko <ish...@chromium.org>
Gerrit-Comment-Date: Mon, 10 Jan 2022 16:35:20 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Shu-yu Guo <s...@chromium.org>
Comment-In-Reply-To: Joyee Cheung <jo...@igalia.com>
Comment-In-Reply-To: Toon Verwaest <verw...@chromium.org>
Gerrit-MessageType: comment

Joyee Cheung (Gerrit)

unread,
Jan 11, 2022, 3:36:21 AM1/11/22
to Toon Verwaest, Shu-yu Guo, Igor Sheludko, V8 LUCI CQ, v8-re...@googlegroups.com

Attention is currently required from: Shu-yu Guo, Toon Verwaest, Igor Sheludko.

View Change

4 comments:

  • File src/ic/ic.cc:

    • This should never be possible. A contextual store is e.g. […]

      I've updated this to a DCHECK instead.

    • When fixing this I noticed that DefineOwnPropertyIgnoreAttributes actually calls the setter interceptor, not the definer. Is that intentional? Should we update DefineOwnPropertyIgnoreAttributes to call the definer interceptor to fix this (I wonder if that's a breaking change and should be left to another patch), or just add some special handling for the StoreOwnIC to call the definer in this patch?

    • Won't the proxy IC end up calling the store trap instead of the define trap? […]

      With this patch this test should go into DefineOwnDataProperty below, so only the defineProperty would be called (previously it went into Object::SetProperty which was part of the bug and triggered the set trap). I added a test for this case.

  • File src/objects/js-objects.cc:

    • Done

To view, visit change 3300092. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: I6547320a1caba58c66ee1043cd3183a2de7cefef
Gerrit-Change-Number: 3300092
Gerrit-PatchSet: 16
Gerrit-Owner: Joyee Cheung <jo...@igalia.com>
Gerrit-Reviewer: Igor Sheludko <ish...@chromium.org>
Gerrit-Reviewer: Joyee Cheung <jo...@igalia.com>
Gerrit-Reviewer: Shu-yu Guo <s...@chromium.org>
Gerrit-CC: Toon Verwaest <verw...@chromium.org>
Gerrit-Attention: Shu-yu Guo <s...@chromium.org>
Gerrit-Attention: Toon Verwaest <verw...@chromium.org>
Gerrit-Attention: Igor Sheludko <ish...@chromium.org>
Gerrit-Comment-Date: Tue, 11 Jan 2022 08:36:13 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No

Joyee Cheung (Gerrit)

unread,
Jan 11, 2022, 3:38:13 AM1/11/22
to Toon Verwaest, Shu-yu Guo, Igor Sheludko, V8 LUCI CQ, v8-re...@googlegroups.com

Attention is currently required from: Shu-yu Guo, Toon Verwaest, Igor Sheludko.

Patch set 16:-Commit-Queue

View Change

1 comment:

  • Patchset:

    • Patch Set #13:

      I agree this is error-prone, but this is what currently on the tree. […]

      Accidentally clicked the resolved mark, mark it as unresolved.

To view, visit change 3300092. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: I6547320a1caba58c66ee1043cd3183a2de7cefef
Gerrit-Change-Number: 3300092
Gerrit-PatchSet: 16
Gerrit-Owner: Joyee Cheung <jo...@igalia.com>
Gerrit-Reviewer: Igor Sheludko <ish...@chromium.org>
Gerrit-Reviewer: Joyee Cheung <jo...@igalia.com>
Gerrit-Reviewer: Shu-yu Guo <s...@chromium.org>
Gerrit-CC: Toon Verwaest <verw...@chromium.org>
Gerrit-Attention: Shu-yu Guo <s...@chromium.org>
Gerrit-Attention: Toon Verwaest <verw...@chromium.org>
Gerrit-Attention: Igor Sheludko <ish...@chromium.org>
Gerrit-Comment-Date: Tue, 11 Jan 2022 08:38:04 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: Joyee Cheung <jo...@igalia.com>

Toon Verwaest (Gerrit)

unread,
Jan 11, 2022, 8:25:57 AM1/11/22
to Joyee Cheung, Shu-yu Guo, Igor Sheludko, V8 LUCI CQ, v8-re...@googlegroups.com

Attention is currently required from: Shu-yu Guo, Joyee Cheung, Igor Sheludko.

View Change

3 comments:

  • Patchset:

    • Patch Set #13:

      Accidentally clicked the resolved mark, mark it as unresolved.

      Basically StoreIC was just there for JS set semantics. StoreOwn was a hack to reuse the StoreICs _only_ for the case where the target is an engine-controlled object literal, in which case we know that DefineOwn and StoreOwn have the exact same semantics (and no proxy traps can be triggered etc). Extending this to mean Define for user-controlled objects (field defines on any random JSReceiver) seems like a minor change but really isn't; as is clear from all the resulting security and semantical bugs. Beyond simply renaming, I think we should really pull those bits apart instead.

  • File src/ic/ic.cc:

    • Patch Set #13, Line 1871: // traps need to be called first if they are present.

      When fixing this I noticed that DefineOwnPropertyIgnoreAttributes actually calls the setter intercep […]

      When this was implemented the method was still called SetOwnPropertyIgnoreAttributes and there was no definer interceptor yet. Changing it over sounds ok to me, but might break some embedder?

    • With this patch this test should go into DefineOwnDataProperty below, so only the defineProperty wou […]

      I mean UpdateCaches will for the Proxy case install the Proxy StoreIC state, which will in turn (once warmed up) call the "set" trap.

To view, visit change 3300092. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: I6547320a1caba58c66ee1043cd3183a2de7cefef
Gerrit-Change-Number: 3300092
Gerrit-PatchSet: 16
Gerrit-Owner: Joyee Cheung <jo...@igalia.com>
Gerrit-Reviewer: Igor Sheludko <ish...@chromium.org>
Gerrit-Reviewer: Joyee Cheung <jo...@igalia.com>
Gerrit-Reviewer: Shu-yu Guo <s...@chromium.org>
Gerrit-CC: Toon Verwaest <verw...@chromium.org>
Gerrit-Attention: Shu-yu Guo <s...@chromium.org>
Gerrit-Attention: Joyee Cheung <jo...@igalia.com>
Gerrit-Attention: Igor Sheludko <ish...@chromium.org>
Gerrit-Comment-Date: Tue, 11 Jan 2022 13:25:49 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No

Toon Verwaest (Gerrit)

unread,
Jan 11, 2022, 8:26:24 AM1/11/22
to Joyee Cheung, Shu-yu Guo, Igor Sheludko, V8 LUCI CQ, v8-re...@googlegroups.com

Attention is currently required from: Shu-yu Guo, Joyee Cheung, Igor Sheludko.

View Change

1 comment:

To view, visit change 3300092. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: I6547320a1caba58c66ee1043cd3183a2de7cefef
Gerrit-Change-Number: 3300092
Gerrit-PatchSet: 16
Gerrit-Owner: Joyee Cheung <jo...@igalia.com>
Gerrit-Reviewer: Igor Sheludko <ish...@chromium.org>
Gerrit-Reviewer: Joyee Cheung <jo...@igalia.com>
Gerrit-Reviewer: Shu-yu Guo <s...@chromium.org>
Gerrit-CC: Toon Verwaest <verw...@chromium.org>
Gerrit-Attention: Shu-yu Guo <s...@chromium.org>
Gerrit-Attention: Joyee Cheung <jo...@igalia.com>
Gerrit-Attention: Igor Sheludko <ish...@chromium.org>
Gerrit-Comment-Date: Tue, 11 Jan 2022 13:26:17 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment

Toon Verwaest (Gerrit)

unread,
Jan 11, 2022, 8:26:54 AM1/11/22
to Joyee Cheung, Shu-yu Guo, Igor Sheludko, V8 LUCI CQ, v8-re...@googlegroups.com

Attention is currently required from: Shu-yu Guo, Joyee Cheung, Igor Sheludko.

View Change

1 comment:

  • File src/ic/ic.cc:

    • Patch Set #13, Line 1881: UpdateCaches(&it, value, store_origin);

      I mean UpdateCaches will for the Proxy case install the Proxy StoreIC state, which will in turn (onc […]

      unresolved

To view, visit change 3300092. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: I6547320a1caba58c66ee1043cd3183a2de7cefef
Gerrit-Change-Number: 3300092
Gerrit-PatchSet: 16
Gerrit-Owner: Joyee Cheung <jo...@igalia.com>
Gerrit-Reviewer: Igor Sheludko <ish...@chromium.org>
Gerrit-Reviewer: Joyee Cheung <jo...@igalia.com>
Gerrit-Reviewer: Shu-yu Guo <s...@chromium.org>
Gerrit-CC: Toon Verwaest <verw...@chromium.org>
Gerrit-Attention: Shu-yu Guo <s...@chromium.org>
Gerrit-Attention: Joyee Cheung <jo...@igalia.com>
Gerrit-Attention: Igor Sheludko <ish...@chromium.org>
Gerrit-Comment-Date: Tue, 11 Jan 2022 13:26:47 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No

Joyee Cheung (Gerrit)

unread,
Jan 11, 2022, 10:10:12 AM1/11/22
to Toon Verwaest, Shu-yu Guo, Igor Sheludko, V8 LUCI CQ, v8-re...@googlegroups.com

Attention is currently required from: Shu-yu Guo, Toon Verwaest, Igor Sheludko.

View Change

1 comment:

  • File src/ic/ic.cc:

    • unresolved

      I see, I tested it with --no-lazy-feedback-allocation and indeed it triggers the set trap. I tried to fix that by installing the slow handler instead of the kProxy SMI handler for StoreOwnIC (we already install the slow handler for the private DefineOwnIC, so it seems logical to me), and fixing the slow stub to use CreateDataProperty instead of DefineOwnPropertyIgnoreAttributes, and it fixes the test.

To view, visit change 3300092. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: I6547320a1caba58c66ee1043cd3183a2de7cefef
Gerrit-Change-Number: 3300092
Gerrit-PatchSet: 16
Gerrit-Owner: Joyee Cheung <jo...@igalia.com>
Gerrit-Reviewer: Igor Sheludko <ish...@chromium.org>
Gerrit-Reviewer: Joyee Cheung <jo...@igalia.com>
Gerrit-Reviewer: Shu-yu Guo <s...@chromium.org>
Gerrit-CC: Toon Verwaest <verw...@chromium.org>
Gerrit-Attention: Shu-yu Guo <s...@chromium.org>
Gerrit-Attention: Toon Verwaest <verw...@chromium.org>
Gerrit-Attention: Igor Sheludko <ish...@chromium.org>
Gerrit-Comment-Date: Tue, 11 Jan 2022 15:10:02 +0000

Joyee Cheung (Gerrit)

unread,
Jan 11, 2022, 10:18:59 AM1/11/22
to Toon Verwaest, Shu-yu Guo, Igor Sheludko, V8 LUCI CQ, v8-re...@googlegroups.com

Attention is currently required from: Shu-yu Guo, Toon Verwaest, Igor Sheludko.

View Change

1 comment:

    • Beyond simply renaming, I think we should really pull those bits apart instead.

To view, visit change 3300092. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: I6547320a1caba58c66ee1043cd3183a2de7cefef
Gerrit-Change-Number: 3300092
Gerrit-PatchSet: 16
Gerrit-Owner: Joyee Cheung <jo...@igalia.com>
Gerrit-Reviewer: Igor Sheludko <ish...@chromium.org>
Gerrit-Reviewer: Joyee Cheung <jo...@igalia.com>
Gerrit-Reviewer: Shu-yu Guo <s...@chromium.org>
Gerrit-CC: Toon Verwaest <verw...@chromium.org>
Gerrit-Attention: Shu-yu Guo <s...@chromium.org>
Gerrit-Attention: Toon Verwaest <verw...@chromium.org>
Gerrit-Attention: Igor Sheludko <ish...@chromium.org>
Gerrit-Comment-Date: Tue, 11 Jan 2022 15:18:50 +0000

Toon Verwaest (Gerrit)

unread,
Jan 11, 2022, 11:20:30 AM1/11/22
to Joyee Cheung, Shu-yu Guo, Igor Sheludko, V8 LUCI CQ, v8-re...@googlegroups.com

Attention is currently required from: Shu-yu Guo, Joyee Cheung, Igor Sheludko.

View Change

2 comments:

  • Patchset:

    • Patch Set #13:

      > Beyond simply renaming, I think we should really pull those bits apart instead. […]

      That sounds alright. Yeah I'm not suggesting to do it here; I'm just a bit unhappy that we got to this point / design.

  • File src/ic/ic.cc:

    • Patch Set #17, Line 1982: return MaybeObjectHandle(StoreHandler::StoreInterceptor(isolate()));

      Given that we have a definer, as you mentioned, we should also call the definer here in case of StoreOwn?

To view, visit change 3300092. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: I6547320a1caba58c66ee1043cd3183a2de7cefef
Gerrit-Change-Number: 3300092
Gerrit-PatchSet: 17
Gerrit-Owner: Joyee Cheung <jo...@igalia.com>
Gerrit-Reviewer: Igor Sheludko <ish...@chromium.org>
Gerrit-Reviewer: Joyee Cheung <jo...@igalia.com>
Gerrit-Reviewer: Shu-yu Guo <s...@chromium.org>
Gerrit-CC: Toon Verwaest <verw...@chromium.org>
Gerrit-Attention: Shu-yu Guo <s...@chromium.org>
Gerrit-Attention: Joyee Cheung <jo...@igalia.com>
Gerrit-Attention: Igor Sheludko <ish...@chromium.org>
Gerrit-Comment-Date: Tue, 11 Jan 2022 16:20:23 +0000

Joyee Cheung (Gerrit)

unread,
Jan 13, 2022, 9:21:05 AM1/13/22
to Toon Verwaest, Shu-yu Guo, Igor Sheludko, V8 LUCI CQ, v8-re...@googlegroups.com

Attention is currently required from: Shu-yu Guo, Toon Verwaest, Igor Sheludko.

View Change

6 comments:

  • Patchset:

    • Patch Set #13:

      That sounds alright. […]

      Yeah in hindsight we probably should've put this behind a flag first..I'll try to follow up with a refactoring to sort it out, thanks for the bearing with my questions!

  • Patchset:

    • Patch Set #19:

      I think I've fixed the interceptor case and the proxy case, PTAL, thanks!

  • File src/ic/ic.cc:

    • +1 to keeping the rename CL separate.

    • Done

  • File src/ic/ic.cc:

    • Patch Set #13, Line 1871: // traps need to be called first if they are present.

      When this was implemented the method was still called SetOwnPropertyIgnoreAttributes and there was n […]

      I checked it and it seems simply doing Object.defineProperty would result in an invocation of the setter interceptor, I suspect that changing this behavior entails a deprecation, so I left a TODO to fix DefineOwnPropertyIgnoreAttributes later instead. Also I realized that objects with interceptors cannot prevent extension, so I only added a test for non-configurable objects.

    • I see, I tested it with --no-lazy-feedback-allocation and indeed it triggers the set trap. […]

      Done

  • File src/ic/ic.cc:

    • Given that we have a definer, as you mentioned, we should also call the definer here in case of Stor […]

      I used the slow-case Smi handler here for StoreOwnIC, which would invoke the definer accordingly.

To view, visit change 3300092. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: I6547320a1caba58c66ee1043cd3183a2de7cefef
Gerrit-Change-Number: 3300092
Gerrit-PatchSet: 19
Gerrit-Owner: Joyee Cheung <jo...@igalia.com>
Gerrit-Reviewer: Igor Sheludko <ish...@chromium.org>
Gerrit-Reviewer: Joyee Cheung <jo...@igalia.com>
Gerrit-Reviewer: Shu-yu Guo <s...@chromium.org>
Gerrit-CC: Toon Verwaest <verw...@chromium.org>
Gerrit-Attention: Shu-yu Guo <s...@chromium.org>
Gerrit-Attention: Toon Verwaest <verw...@chromium.org>
Gerrit-Attention: Igor Sheludko <ish...@chromium.org>
Gerrit-Comment-Date: Thu, 13 Jan 2022 14:20:55 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Shu-yu Guo <s...@chromium.org>

Toon Verwaest (Gerrit)

unread,
Jan 14, 2022, 4:58:10 AM1/14/22
to Joyee Cheung, Shu-yu Guo, Igor Sheludko, V8 LUCI CQ, v8-re...@googlegroups.com

Attention is currently required from: Shu-yu Guo, Joyee Cheung, Igor Sheludko.

View Change

3 comments:

  • File src/ic/ic.cc:

    • Patch Set #19, Line 1806: switch (it->state()) {

      What's the reason to duplicate it here rather than to update DefineOwnPropertyIgnoreAttributes? Given that name I'd expect it should always have define semantics and hence call the definer. At least we could pass a flag into that method to indicate whether define or set semantics should be used instead of duplicating this here.

    • Patch Set #19, Line 1814: if (it->HolderIsReceiverOrHiddenPrototype()) {

      We're in StoreOwn; this should be a guarantee? The LookupIterator is configured to only look at LookupIterator::OWN.

    • Patch Set #19, Line 1926: .IsUndefined(it.isolate()))) {

      CheckIfCanDefine with also call the query interceptor if present. Can we just skip entirely if we have an interceptor?

To view, visit change 3300092. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: I6547320a1caba58c66ee1043cd3183a2de7cefef
Gerrit-Change-Number: 3300092
Gerrit-PatchSet: 19
Gerrit-Owner: Joyee Cheung <jo...@igalia.com>
Gerrit-Reviewer: Igor Sheludko <ish...@chromium.org>
Gerrit-Reviewer: Joyee Cheung <jo...@igalia.com>
Gerrit-Reviewer: Shu-yu Guo <s...@chromium.org>
Gerrit-CC: Toon Verwaest <verw...@chromium.org>
Gerrit-Attention: Shu-yu Guo <s...@chromium.org>
Gerrit-Attention: Joyee Cheung <jo...@igalia.com>
Gerrit-Attention: Igor Sheludko <ish...@chromium.org>
Gerrit-Comment-Date: Fri, 14 Jan 2022 09:58:01 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment

Joyee Cheung (Gerrit)

unread,
Jan 14, 2022, 11:31:49 AM1/14/22
to Toon Verwaest, Shu-yu Guo, Igor Sheludko, V8 LUCI CQ, v8-re...@googlegroups.com

Attention is currently required from: Shu-yu Guo, Toon Verwaest, Igor Sheludko.

Patch set 20:Commit-Queue +1

View Change

3 comments:

  • File src/ic/ic.cc:

    • What's the reason to duplicate it here rather than to update DefineOwnPropertyIgnoreAttributes? Give […]

      Was just trying to not break DefineOwnPropertyIgnoreAttributes 
      if possible, but adding a flag is probably a better idea - I've added a EnforceDefineSemantics flag for the special cases.
    • We're in StoreOwn; this should be a guarantee? The LookupIterator is configured to only look at Look […]

      Done

    • CheckIfCanDefine with also call the query interceptor if present. […]

      Done

To view, visit change 3300092. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: I6547320a1caba58c66ee1043cd3183a2de7cefef
Gerrit-Change-Number: 3300092
Gerrit-PatchSet: 20
Gerrit-Owner: Joyee Cheung <jo...@igalia.com>
Gerrit-Reviewer: Igor Sheludko <ish...@chromium.org>
Gerrit-Reviewer: Joyee Cheung <jo...@igalia.com>
Gerrit-Reviewer: Shu-yu Guo <s...@chromium.org>
Gerrit-CC: Toon Verwaest <verw...@chromium.org>
Gerrit-Attention: Shu-yu Guo <s...@chromium.org>
Gerrit-Attention: Toon Verwaest <verw...@chromium.org>
Gerrit-Attention: Igor Sheludko <ish...@chromium.org>
Gerrit-Comment-Date: Fri, 14 Jan 2022 16:31:41 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes

Toon Verwaest (Gerrit)

unread,
Jan 17, 2022, 10:05:38 AM1/17/22
to Joyee Cheung, Shu-yu Guo, Igor Sheludko, V8 LUCI CQ, v8-re...@googlegroups.com

Attention is currently required from: Shu-yu Guo, Joyee Cheung, Igor Sheludko.

Patch set 20:Code-Review +1

View Change

2 comments:

  • Patchset:

  • File src/objects/js-objects.h:

    • Patch Set #20, Line 416: enum class EnforceDefineSemantics { kLegacy, kDefine };

      I'd say just call this kSet for now; since it's not clear we'll actually move this over.

To view, visit change 3300092. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: I6547320a1caba58c66ee1043cd3183a2de7cefef
Gerrit-Change-Number: 3300092
Gerrit-PatchSet: 20
Gerrit-Owner: Joyee Cheung <jo...@igalia.com>
Gerrit-Reviewer: Igor Sheludko <ish...@chromium.org>
Gerrit-Reviewer: Joyee Cheung <jo...@igalia.com>
Gerrit-Reviewer: Shu-yu Guo <s...@chromium.org>
Gerrit-Reviewer: Toon Verwaest <verw...@chromium.org>
Gerrit-Attention: Shu-yu Guo <s...@chromium.org>
Gerrit-Attention: Joyee Cheung <jo...@igalia.com>
Gerrit-Attention: Igor Sheludko <ish...@chromium.org>
Gerrit-Comment-Date: Mon, 17 Jan 2022 15:05:30 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

Joyee Cheung (Gerrit)

unread,
Jan 17, 2022, 10:21:07 PM1/17/22
to Toon Verwaest, Shu-yu Guo, Igor Sheludko, V8 LUCI CQ, v8-re...@googlegroups.com

Attention is currently required from: Shu-yu Guo, Igor Sheludko.

Patch set 21:Commit-Queue +2

View Change

3 comments:

    • Patch Set #20, Line 416: enum class EnforceDefineSemantics { kLegacy, kDefine };

      I'd say just call this kSet for now; since it's not clear we'll actually move this over.

    • Done

To view, visit change 3300092. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: I6547320a1caba58c66ee1043cd3183a2de7cefef
Gerrit-Change-Number: 3300092
Gerrit-PatchSet: 21
Gerrit-Owner: Joyee Cheung <jo...@igalia.com>
Gerrit-Reviewer: Igor Sheludko <ish...@chromium.org>
Gerrit-Reviewer: Joyee Cheung <jo...@igalia.com>
Gerrit-Reviewer: Shu-yu Guo <s...@chromium.org>
Gerrit-Reviewer: Toon Verwaest <verw...@chromium.org>
Gerrit-Attention: Shu-yu Guo <s...@chromium.org>
Gerrit-Attention: Igor Sheludko <ish...@chromium.org>
Gerrit-Comment-Date: Tue, 18 Jan 2022 03:20:56 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: Joyee Cheung <jo...@igalia.com>

V8 LUCI CQ (Gerrit)

unread,
Jan 18, 2022, 4:22:57 AM1/18/22
to Joyee Cheung, Toon Verwaest, Shu-yu Guo, Igor Sheludko, v8-re...@googlegroups.com

V8 LUCI CQ submitted this change.

View Change



20 is the latest approved patch-set.
The change was submitted with unreviewed changes in the following files:

```
The name of the file: src/objects/js-objects.cc
Insertions: 1, Deletions: 1.

@@ -3436,7 +3436,7 @@
result = DefinePropertyWithInterceptorInternal(
it, it->GetInterceptor(), should_throw, &descriptor);
} else {
- DCHECK_EQ(semantics, EnforceDefineSemantics::kLegacy);
+ DCHECK_EQ(semantics, EnforceDefineSemantics::kSet);
if (handling == DONT_FORCE_FIELD) {
result =
JSObject::SetPropertyWithInterceptor(it, should_throw, value);
```
```
The name of the file: src/objects/js-objects.h
Insertions: 3, Deletions: 3.

@@ -413,19 +413,19 @@
// kDefine allows us to implement the define semantics correctly
// in selected locations.
// TODO(joyee): see if we can deprecate the old behavior.
- enum class EnforceDefineSemantics { kLegacy, kDefine };
+ enum class EnforceDefineSemantics { kSet, kDefine };

V8_WARN_UNUSED_RESULT static MaybeHandle<Object>
DefineOwnPropertyIgnoreAttributes(
LookupIterator* it, Handle<Object> value, PropertyAttributes attributes,
AccessorInfoHandling handling = DONT_FORCE_FIELD,
- EnforceDefineSemantics semantics = EnforceDefineSemantics::kLegacy);
+ EnforceDefineSemantics semantics = EnforceDefineSemantics::kSet);

V8_WARN_UNUSED_RESULT static Maybe<bool> DefineOwnPropertyIgnoreAttributes(
LookupIterator* it, Handle<Object> value, PropertyAttributes attributes,
Maybe<ShouldThrow> should_throw,
AccessorInfoHandling handling = DONT_FORCE_FIELD,
- EnforceDefineSemantics semantics = EnforceDefineSemantics::kLegacy);
+ EnforceDefineSemantics semantics = EnforceDefineSemantics::kSet);

V8_WARN_UNUSED_RESULT static MaybeHandle<Object> V8_EXPORT_PRIVATE
SetOwnPropertyIgnoreAttributes(Handle<JSObject> object, Handle<Name> name,
```

Approvals: Toon Verwaest: Looks good to me Shu-yu Guo: Looks good to me Joyee Cheung: Commit
[class] handle existing readonly properties in StoreOwnIC

Previously, StoreOwnIC incorrectly reuses the [[Set]] semantics
when initializing public literal class fields and object literals in
certain cases (e.g. when there's no feedback).
This was less of an issue for object literals, but with public class
fields it's possible to define property attributes while the
instance is still being initialized, or to encounter existing static
"name" or "length" properties that should be readonly. This patch
fixes it by

1) Emitting code that calls into the slow stub when
handling StoreOwnIC with existing read-only properties.
2) Adding extra steps in StoreIC::Store to handle such stores
properly with [[DefineOwnProperty]] semantics.

Bug: v8:12421, v8:9888
Change-Id: I6547320a1caba58c66ee1043cd3183a2de7cefef
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3300092
Reviewed-by: Shu-yu Guo <s...@chromium.org>
Reviewed-by: Toon Verwaest <verw...@chromium.org>
Commit-Queue: Joyee Cheung <jo...@igalia.com>
Cr-Commit-Position: refs/heads/main@{#78659}
---
M src/objects/js-objects.cc
M src/ic/ic.cc
M src/objects/js-objects.h
A test/mjsunit/regress/regress-v8-12421.js
M src/objects/objects.h
M src/objects/lookup.cc
A test/mjsunit/regress/regress-v8-12421-no-lazy-feedback.js
M src/ic/keyed-store-generic.cc
A test/mjsunit/proxy-super-return-define-property-trap.js
M src/objects/objects.cc
M test/cctest/test-api-interceptors.cc
11 files changed, 755 insertions(+), 56 deletions(-)


To view, visit change 3300092. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: v8/v8
Gerrit-Branch: main
Gerrit-Change-Id: I6547320a1caba58c66ee1043cd3183a2de7cefef
Gerrit-Change-Number: 3300092
Gerrit-PatchSet: 22
Gerrit-Owner: Joyee Cheung <jo...@igalia.com>
Gerrit-Reviewer: Igor Sheludko <ish...@chromium.org>
Gerrit-Reviewer: Joyee Cheung <jo...@igalia.com>
Gerrit-Reviewer: Shu-yu Guo <s...@chromium.org>
Gerrit-Reviewer: Toon Verwaest <verw...@chromium.org>
Gerrit-MessageType: merged
Reply all
Reply to author
Forward
0 new messages