Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(421)

Unified Diff: src/ic/keyed-store-generic.cc

Issue 2610343002: Fix: KeyedStoreGeneric must check for writable array length (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/builtins/builtins-array.cc ('k') | test/mjsunit/regress/regress-5669.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ic/keyed-store-generic.cc
diff --git a/src/ic/keyed-store-generic.cc b/src/ic/keyed-store-generic.cc
index cf1c49f0c897304788c7134572b5413eb062fa05..4785398266018d4d821554254ec44050e1b5dfcd 100644
--- a/src/ic/keyed-store-generic.cc
+++ b/src/ic/keyed-store-generic.cc
@@ -225,6 +225,16 @@ void KeyedStoreGenericAssembler::StoreElementWithCapacity(
if (update_length != kDontChangeLength) {
CSA_ASSERT(this, Word32Equal(LoadMapInstanceType(receiver_map),
Int32Constant(JS_ARRAY_TYPE)));
+ // Check if the length property is writable. The fast check is only
+ // supported for fast properties.
+ GotoIf(IsDictionaryMap(receiver_map), slow);
+ // The length property is non-configurable, so it's guaranteed to always
+ // be the first property.
+ Node* descriptors = LoadMapDescriptors(receiver_map);
+ Node* details =
+ LoadFixedArrayElement(descriptors, DescriptorArray::ToDetailsIndex(0));
+ Node* mask_node = SmiConstant(PropertyDetails::kAttributesReadOnlyMask);
+ GotoIf(WordEqual(SmiAnd(details, mask_node), mask_node), slow);
danno 2017/01/10 01:27:12 What about: GotoIf(IsSetWord(BitcastTaggedToWord(
Jakob Kummerow 2017/01/10 11:53:46 As suggested, that compares a Smi against an untag
}
STATIC_ASSERT(FixedArray::kHeaderSize == FixedDoubleArray::kHeaderSize);
const int kHeaderSize = FixedArray::kHeaderSize - kHeapObjectTag;
« no previous file with comments | « src/builtins/builtins-array.cc ('k') | test/mjsunit/regress/regress-5669.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698