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

Side by Side Diff: src/objects.cc

Issue 656423004: Narrow cases where Sparse/Smart versions of Array methods are used (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Added more tests Created 6 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « src/objects.h ('k') | src/runtime/runtime.h » ('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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 <sstream> 5 #include <sstream>
6 6
7 #include "src/v8.h" 7 #include "src/v8.h"
8 8
9 #include "src/accessors.h" 9 #include "src/accessors.h"
10 #include "src/allocation-site-scopes.h" 10 #include "src/allocation-site-scopes.h"
(...skipping 14212 matching lines...) Expand 10 before | Expand all | Expand 10 after
14223 EnsureCapacity(Handle<NameDictionary>, int, Handle<Name>); 14223 EnsureCapacity(Handle<NameDictionary>, int, Handle<Name>);
14224 14224
14225 template 14225 template
14226 int Dictionary<SeededNumberDictionary, SeededNumberDictionaryShape, uint32_t>:: 14226 int Dictionary<SeededNumberDictionary, SeededNumberDictionaryShape, uint32_t>::
14227 NumberOfEnumElements(); 14227 NumberOfEnumElements();
14228 14228
14229 template 14229 template
14230 int Dictionary<NameDictionary, NameDictionaryShape, Handle<Name> >:: 14230 int Dictionary<NameDictionary, NameDictionaryShape, Handle<Name> >::
14231 NumberOfEnumElements(); 14231 NumberOfEnumElements();
14232 14232
14233 template 14233 template bool Dictionary<SeededNumberDictionary, SeededNumberDictionaryShape,
14234 int HashTable<SeededNumberDictionary, SeededNumberDictionaryShape, uint32_t>:: 14234 uint32_t>::HasComplexElements();
14235 FindEntry(uint32_t); 14235
14236 template int HashTable<SeededNumberDictionary, SeededNumberDictionaryShape,
14237 uint32_t>::FindEntry(uint32_t);
14236 14238
14237 14239
14238 Handle<Object> JSObject::PrepareSlowElementsForSort( 14240 Handle<Object> JSObject::PrepareSlowElementsForSort(
14239 Handle<JSObject> object, uint32_t limit) { 14241 Handle<JSObject> object, uint32_t limit) {
14240 DCHECK(object->HasDictionaryElements()); 14242 DCHECK(object->HasDictionaryElements());
14241 Isolate* isolate = object->GetIsolate(); 14243 Isolate* isolate = object->GetIsolate();
14242 // Must stay in dictionary mode, either because of requires_slow_elements, 14244 // Must stay in dictionary mode, either because of requires_slow_elements,
14243 // or because we are not going to sort (and therefore compact) all of the 14245 // or because we are not going to sort (and therefore compact) all of the
14244 // elements. 14246 // elements.
14245 Handle<SeededNumberDictionary> dict(object->element_dictionary(), isolate); 14247 Handle<SeededNumberDictionary> dict(object->element_dictionary(), isolate);
(...skipping 1017 matching lines...) Expand 10 before | Expand all | Expand 10 after
15263 } 15265 }
15264 15266
15265 15267
15266 template<typename Derived, typename Shape, typename Key> 15268 template<typename Derived, typename Shape, typename Key>
15267 int Dictionary<Derived, Shape, Key>::NumberOfEnumElements() { 15269 int Dictionary<Derived, Shape, Key>::NumberOfEnumElements() {
15268 return NumberOfElementsFilterAttributes( 15270 return NumberOfElementsFilterAttributes(
15269 static_cast<PropertyAttributes>(DONT_ENUM | SYMBOLIC)); 15271 static_cast<PropertyAttributes>(DONT_ENUM | SYMBOLIC));
15270 } 15272 }
15271 15273
15272 15274
15273 template<typename Derived, typename Shape, typename Key> 15275 template <typename Derived, typename Shape, typename Key>
15276 bool Dictionary<Derived, Shape, Key>::HasComplexElements() {
15277 int capacity = DerivedHashTable::Capacity();
15278 for (int i = 0; i < capacity; i++) {
15279 Object* k = DerivedHashTable::KeyAt(i);
15280 if (DerivedHashTable::IsKey(k) && !FilterKey(k, NONE)) {
15281 PropertyDetails details = DetailsAt(i);
15282 if (details.IsDeleted()) continue;
15283 if (details.type() == CALLBACKS) return true;
15284 PropertyAttributes attr = details.attributes();
15285 if (attr & (READ_ONLY | DONT_DELETE)) return true;
15286 }
15287 }
15288 return false;
15289 }
15290
15291
15292 template <typename Derived, typename Shape, typename Key>
15274 void Dictionary<Derived, Shape, Key>::CopyKeysTo( 15293 void Dictionary<Derived, Shape, Key>::CopyKeysTo(
15275 FixedArray* storage, 15294 FixedArray* storage, PropertyAttributes filter,
15276 PropertyAttributes filter,
15277 typename Dictionary<Derived, Shape, Key>::SortMode sort_mode) { 15295 typename Dictionary<Derived, Shape, Key>::SortMode sort_mode) {
15278 DCHECK(storage->length() >= NumberOfElementsFilterAttributes(filter)); 15296 DCHECK(storage->length() >= NumberOfElementsFilterAttributes(filter));
15279 int capacity = DerivedHashTable::Capacity(); 15297 int capacity = DerivedHashTable::Capacity();
15280 int index = 0; 15298 int index = 0;
15281 for (int i = 0; i < capacity; i++) { 15299 for (int i = 0; i < capacity; i++) {
15282 Object* k = DerivedHashTable::KeyAt(i); 15300 Object* k = DerivedHashTable::KeyAt(i);
15283 if (DerivedHashTable::IsKey(k) && !FilterKey(k, filter)) { 15301 if (DerivedHashTable::IsKey(k) && !FilterKey(k, filter)) {
15284 PropertyDetails details = DetailsAt(i); 15302 PropertyDetails details = DetailsAt(i);
15285 if (details.IsDeleted()) continue; 15303 if (details.IsDeleted()) continue;
15286 PropertyAttributes attr = details.attributes(); 15304 PropertyAttributes attr = details.attributes();
(...skipping 1182 matching lines...) Expand 10 before | Expand all | Expand 10 after
16469 Handle<DependentCode> codes = 16487 Handle<DependentCode> codes =
16470 DependentCode::Insert(handle(cell->dependent_code(), info->isolate()), 16488 DependentCode::Insert(handle(cell->dependent_code(), info->isolate()),
16471 DependentCode::kPropertyCellChangedGroup, 16489 DependentCode::kPropertyCellChangedGroup,
16472 info->object_wrapper()); 16490 info->object_wrapper());
16473 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); 16491 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes);
16474 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( 16492 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add(
16475 cell, info->zone()); 16493 cell, info->zone());
16476 } 16494 }
16477 16495
16478 } } // namespace v8::internal 16496 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/runtime/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698