Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix inline caching of object set #1322

Merged
merged 3 commits into from
Mar 12, 2024
Merged

Fix inline caching of object set #1322

merged 3 commits into from
Mar 12, 2024

Conversation

clover2123
Copy link
Contributor

No description provided.

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
Comment on lines -318 to +313
if (nextSize > ESCARGOT_OBJECT_STRUCTURE_ACCESS_CACHE_BUILD_MIN_SIZE) {
newObjectStructure = new ObjectStructureWithMap(nameIsIndexString, hasSymbol, hasEnumerableProperty, m_properties, newItem);
} else if (nextSize > ESCARGOT_OBJECT_STRUCTURE_TRANSITION_MODE_MAX_SIZE || nameIsIndexString) {
// ObjectStructureWithTransition cannot directly convert to ObjectStructureWithMap by just adding one property
ASSERT(nextSize < ESCARGOT_OBJECT_STRUCTURE_ACCESS_CACHE_BUILD_MIN_SIZE);
if (nextSize > ESCARGOT_OBJECT_STRUCTURE_TRANSITION_MODE_MAX_SIZE || nameIsIndexString) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ObjectStructureWithTransition cannot directly convert to ObjectStructureWithMap by just adding one property,
So I removed it.

Comment on lines 2867 to 2873
// finally, insert a valid new cache item at the end
// because an exception could occur ahead which makes insertion of cache item invalid
if (inlineCache->m_cache.size() > SetObjectInlineCacheData::MaxCacheCount) {
for (size_t i = inlineCache->m_cache.size() - 1; i > 0; i--) {
inlineCache->m_cache[i] = inlineCache->m_cache[i - 1];
}
} else {
inlineCache->m_cache.insert(0, SetObjectInlineCacheData());
block->m_inlineCacheDataSize += sizeof(SetObjectInlineCacheData);
currentCodeSizeTotal += sizeof(SetObjectInlineCacheData);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding a new cache item at the end of setObjectPreComputedCaseOperationSlowCase operation because exceptions could arise in the middle of its execution, which may lead to insertion of an imperfact cache item.

* fix inline caching to insert a new cache item after validation
* refactor set inline caching method

Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
Signed-off-by: HyukWoo Park <hyukwoo.park@samsung.com>
@ksh8281 ksh8281 merged commit bccdc42 into Samsung:master Mar 12, 2024
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants