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

Unified Diff: src/elements.cc

Issue 1651253003: More *_STRING_WRAPPER_ELEMENTS fixes (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: ...and one more fix Created 4 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 | « no previous file | src/objects.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/elements.cc
diff --git a/src/elements.cc b/src/elements.cc
index e88a03697e5b49caaaf31ed8d0b6b8f10358031a..e6d3f84f9ce8eec80bec76695220f6ff392c2787 100644
--- a/src/elements.cc
+++ b/src/elements.cc
@@ -144,7 +144,9 @@ void CopyObjectToObjectElements(FixedArrayBase* from_base,
DCHECK(IsFastSmiOrObjectElementsKind(to_kind));
WriteBarrierMode write_barrier_mode =
- (IsFastObjectElementsKind(from_kind) && IsFastObjectElementsKind(to_kind))
+ ((IsFastObjectElementsKind(from_kind) &&
+ IsFastObjectElementsKind(to_kind)) ||
+ from_kind == FAST_STRING_WRAPPER_ELEMENTS)
? UPDATE_WRITE_BARRIER
: SKIP_WRITE_BARRIER;
for (int i = 0; i < copy_size; i++) {
@@ -2366,10 +2368,12 @@ class StringWrapperElementsAccessor
Handle<Object> value, PropertyAttributes attributes,
uint32_t new_capacity) {
DCHECK(index >= static_cast<uint32_t>(GetString(*object)->length()));
- if ((KindTraits::Kind == FAST_STRING_WRAPPER_ELEMENTS &&
- object->GetElementsKind() == SLOW_STRING_WRAPPER_ELEMENTS) ||
- BackingStoreAccessor::GetCapacityImpl(*object, object->elements()) !=
- new_capacity) {
+ // Explicitly grow fast backing stores if needed. Dictionaries know how to
+ // extend their capacity themselves.
+ if (KindTraits::Kind == FAST_STRING_WRAPPER_ELEMENTS &&
+ (object->GetElementsKind() == SLOW_STRING_WRAPPER_ELEMENTS ||
+ BackingStoreAccessor::GetCapacityImpl(*object, object->elements()) !=
+ new_capacity)) {
StringWrapperElementsAccessorSubclass::GrowCapacityAndConvertImpl(
object, new_capacity);
}
« no previous file with comments | « no previous file | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698