!6295 修复defineProperty的bug

Merge pull request !6295 from 韩靖/master
This commit is contained in:
openharmony_ci 2024-03-05 07:09:57 +00:00 committed by Gitee
commit 54e9d41b23
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 12 additions and 3 deletions

View File

@ -65,9 +65,6 @@ inline JSHClass *JSObject::GetJSHClass() const
inline uint32_t JSObject::GetNonInlinedFastPropsCapacity() const
{
uint32_t inlineProps = GetJSHClass()->GetInlinedProperties();
if (inlineProps < JSHClass::DEFAULT_CAPACITY_OF_IN_OBJECTS) {
return PropertyAttributes::MAX_FAST_PROPS_CAPACITY - JSHClass::DEFAULT_CAPACITY_OF_IN_OBJECTS;
}
return PropertyAttributes::MAX_FAST_PROPS_CAPACITY - inlineProps;
}

View File

@ -18,3 +18,4 @@ true
0
true
{"value":10,"writable":false,"enumerable":false,"configurable":true}
{"k":1}

View File

@ -58,3 +58,14 @@ Object.defineProperty(this, 'x', {
value: 10
});
print(JSON.stringify(Object.getOwnPropertyDescriptor(this, 'x')));
const o1 = {
k: 1
};
for (let i = 0; i < 1100; i++) {
Object.defineProperty(o1, "k" + i, {
value: 0,
enumerable: false
});
}
print(JSON.stringify(o1))