From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Tobias Tebbi <tebbi@chromium.org>
Date: Tue, 13 Jun 2023 11:50:11 +0200
Subject: Merged: [compiler] check for read-only property on
 AccessMode::kDefine

(cherry picked from commit 95eda07ddbc1839e39b3d1ff5db329c0ceb6dfaa)

Change-Id: Ic5799a32e7c312e41cd0a7e1e6073a235414d56f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4665588
Auto-Submit: Tobias Tebbi <tebbi@chromium.org>
Reviewed-by: Darius Mercadier <dmercadier@chromium.org>
Commit-Queue: Darius Mercadier <dmercadier@chromium.org>
Cr-Commit-Position: refs/branch-heads/11.4@{#53}
Cr-Branched-From: 8a8a1e7086dacc426965d3875914efa66663c431-refs/heads/11.4.183@{#1}
Cr-Branched-From: 5483d8e816e0bbce865cbbc3fa0ab357e6330bab-refs/heads/main@{#87241}

diff --git a/src/compiler/access-info.cc b/src/compiler/access-info.cc
index 3120077a7710264926b9f9cce348cc3f7c0ac858..fc1bfcf2cd6c24ca9ddf8a95ef6a48b087ed3fde 100644
--- a/src/compiler/access-info.cc
+++ b/src/compiler/access-info.cc
@@ -749,8 +749,7 @@ PropertyAccessInfo AccessInfoFactory::ComputePropertyAccessInfo(
     }
 
     if (index.is_found()) {
-      if (access_mode == AccessMode::kStore ||
-          access_mode == AccessMode::kStoreInLiteral) {
+      if (IsAnyStore(access_mode)) {
         DCHECK(!map.is_dictionary_map());
 
         // Don't bother optimizing stores to read-only properties.
