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

Side by Side 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, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/objects.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/elements.h" 5 #include "src/elements.h"
6 6
7 #include "src/arguments.h" 7 #include "src/arguments.h"
8 #include "src/conversions.h" 8 #include "src/conversions.h"
9 #include "src/factory.h" 9 #include "src/factory.h"
10 #include "src/messages.h" 10 #include "src/messages.h"
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 DCHECK((copy_size + static_cast<int>(to_start)) <= to_base->length() && 137 DCHECK((copy_size + static_cast<int>(to_start)) <= to_base->length() &&
138 (copy_size + static_cast<int>(from_start)) <= from_base->length()); 138 (copy_size + static_cast<int>(from_start)) <= from_base->length());
139 if (copy_size == 0) return; 139 if (copy_size == 0) return;
140 FixedArray* from = FixedArray::cast(from_base); 140 FixedArray* from = FixedArray::cast(from_base);
141 FixedArray* to = FixedArray::cast(to_base); 141 FixedArray* to = FixedArray::cast(to_base);
142 DCHECK(IsFastSmiOrObjectElementsKind(from_kind) || 142 DCHECK(IsFastSmiOrObjectElementsKind(from_kind) ||
143 from_kind == FAST_STRING_WRAPPER_ELEMENTS); 143 from_kind == FAST_STRING_WRAPPER_ELEMENTS);
144 DCHECK(IsFastSmiOrObjectElementsKind(to_kind)); 144 DCHECK(IsFastSmiOrObjectElementsKind(to_kind));
145 145
146 WriteBarrierMode write_barrier_mode = 146 WriteBarrierMode write_barrier_mode =
147 (IsFastObjectElementsKind(from_kind) && IsFastObjectElementsKind(to_kind)) 147 ((IsFastObjectElementsKind(from_kind) &&
148 IsFastObjectElementsKind(to_kind)) ||
149 from_kind == FAST_STRING_WRAPPER_ELEMENTS)
148 ? UPDATE_WRITE_BARRIER 150 ? UPDATE_WRITE_BARRIER
149 : SKIP_WRITE_BARRIER; 151 : SKIP_WRITE_BARRIER;
150 for (int i = 0; i < copy_size; i++) { 152 for (int i = 0; i < copy_size; i++) {
151 Object* value = from->get(from_start + i); 153 Object* value = from->get(from_start + i);
152 to->set(to_start + i, value, write_barrier_mode); 154 to->set(to_start + i, value, write_barrier_mode);
153 } 155 }
154 } 156 }
155 157
156 158
157 static void CopyDictionaryToObjectElements( 159 static void CopyDictionaryToObjectElements(
(...skipping 2201 matching lines...) Expand 10 before | Expand all | Expand 10 after
2359 if (entry < length) { 2361 if (entry < length) {
2360 return; // String contents are read-only. 2362 return; // String contents are read-only.
2361 } 2363 }
2362 BackingStoreAccessor::SetImpl(holder->elements(), entry - length, value); 2364 BackingStoreAccessor::SetImpl(holder->elements(), entry - length, value);
2363 } 2365 }
2364 2366
2365 static void AddImpl(Handle<JSObject> object, uint32_t index, 2367 static void AddImpl(Handle<JSObject> object, uint32_t index,
2366 Handle<Object> value, PropertyAttributes attributes, 2368 Handle<Object> value, PropertyAttributes attributes,
2367 uint32_t new_capacity) { 2369 uint32_t new_capacity) {
2368 DCHECK(index >= static_cast<uint32_t>(GetString(*object)->length())); 2370 DCHECK(index >= static_cast<uint32_t>(GetString(*object)->length()));
2369 if ((KindTraits::Kind == FAST_STRING_WRAPPER_ELEMENTS && 2371 // Explicitly grow fast backing stores if needed. Dictionaries know how to
2370 object->GetElementsKind() == SLOW_STRING_WRAPPER_ELEMENTS) || 2372 // extend their capacity themselves.
2371 BackingStoreAccessor::GetCapacityImpl(*object, object->elements()) != 2373 if (KindTraits::Kind == FAST_STRING_WRAPPER_ELEMENTS &&
2372 new_capacity) { 2374 (object->GetElementsKind() == SLOW_STRING_WRAPPER_ELEMENTS ||
2375 BackingStoreAccessor::GetCapacityImpl(*object, object->elements()) !=
2376 new_capacity)) {
2373 StringWrapperElementsAccessorSubclass::GrowCapacityAndConvertImpl( 2377 StringWrapperElementsAccessorSubclass::GrowCapacityAndConvertImpl(
2374 object, new_capacity); 2378 object, new_capacity);
2375 } 2379 }
2376 BackingStoreAccessor::AddImpl(object, index, value, attributes, 2380 BackingStoreAccessor::AddImpl(object, index, value, attributes,
2377 new_capacity); 2381 new_capacity);
2378 } 2382 }
2379 2383
2380 static void ReconfigureImpl(Handle<JSObject> object, 2384 static void ReconfigureImpl(Handle<JSObject> object,
2381 Handle<FixedArrayBase> store, uint32_t entry, 2385 Handle<FixedArrayBase> store, uint32_t entry,
2382 Handle<Object> value, 2386 Handle<Object> value,
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
2673 } 2677 }
2674 } 2678 }
2675 2679
2676 DCHECK(j == result_len); 2680 DCHECK(j == result_len);
2677 return result_array; 2681 return result_array;
2678 } 2682 }
2679 2683
2680 ElementsAccessor** ElementsAccessor::elements_accessors_ = NULL; 2684 ElementsAccessor** ElementsAccessor::elements_accessors_ = NULL;
2681 } // namespace internal 2685 } // namespace internal
2682 } // namespace v8 2686 } // namespace v8
OLDNEW
« 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