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

Side by Side Diff: src/objects.cc

Issue 581013003: Revert "Don't use OwnPrototypeChainLength in GetOwnPropertyNames" (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « src/objects.h ('k') | src/runtime.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 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 "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/allocation-site-scopes.h" 8 #include "src/allocation-site-scopes.h"
9 #include "src/api.h" 9 #include "src/api.h"
10 #include "src/arguments.h" 10 #include "src/arguments.h"
(...skipping 13328 matching lines...) Expand 10 before | Expand all | Expand 10 after
13339 } else { 13339 } else {
13340 HeapSortPairs(this, numbers, len); 13340 HeapSortPairs(this, numbers, len);
13341 return; 13341 return;
13342 } 13342 }
13343 } 13343 }
13344 13344
13345 13345
13346 // Fill in the names of own properties into the supplied storage. The main 13346 // Fill in the names of own properties into the supplied storage. The main
13347 // purpose of this function is to provide reflection information for the object 13347 // purpose of this function is to provide reflection information for the object
13348 // mirrors. 13348 // mirrors.
13349 int JSObject::GetOwnPropertyNames(FixedArray* storage, int index, 13349 void JSObject::GetOwnPropertyNames(
13350 PropertyAttributes filter) { 13350 FixedArray* storage, int index, PropertyAttributes filter) {
13351 DCHECK(storage->length() >= (NumberOfOwnProperties(filter) - index)); 13351 DCHECK(storage->length() >= (NumberOfOwnProperties(filter) - index));
13352 if (HasFastProperties()) { 13352 if (HasFastProperties()) {
13353 int offset = 0;
13354 int real_size = map()->NumberOfOwnDescriptors(); 13353 int real_size = map()->NumberOfOwnDescriptors();
13355 DescriptorArray* descs = map()->instance_descriptors(); 13354 DescriptorArray* descs = map()->instance_descriptors();
13356 for (int i = 0; i < real_size; i++) { 13355 for (int i = 0; i < real_size; i++) {
13357 if ((descs->GetDetails(i).attributes() & filter) == 0 && 13356 if ((descs->GetDetails(i).attributes() & filter) == 0 &&
13358 !FilterKey(descs->GetKey(i), filter)) { 13357 !FilterKey(descs->GetKey(i), filter)) {
13359 storage->set(index + offset, descs->GetKey(i)); 13358 storage->set(index++, descs->GetKey(i));
13360 offset++;
13361 } 13359 }
13362 } 13360 }
13363 return offset;
13364 } else { 13361 } else {
13365 return property_dictionary()->CopyKeysTo(storage, index, filter, 13362 property_dictionary()->CopyKeysTo(storage,
13366 NameDictionary::UNSORTED); 13363 index,
13364 filter,
13365 NameDictionary::UNSORTED);
13367 } 13366 }
13368 } 13367 }
13369 13368
13370 13369
13371 int JSObject::NumberOfOwnElements(PropertyAttributes filter) { 13370 int JSObject::NumberOfOwnElements(PropertyAttributes filter) {
13372 return GetOwnElementKeys(NULL, filter); 13371 return GetOwnElementKeys(NULL, filter);
13373 } 13372 }
13374 13373
13375 13374
13376 int JSObject::NumberOfEnumElements() { 13375 int JSObject::NumberOfEnumElements() {
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after
14049 New(Isolate*, int, MinimumCapacity, PretenureFlag); 14048 New(Isolate*, int, MinimumCapacity, PretenureFlag);
14050 14049
14051 template Handle<NameDictionary> 14050 template Handle<NameDictionary>
14052 HashTable<NameDictionary, NameDictionaryShape, Handle<Name> >:: 14051 HashTable<NameDictionary, NameDictionaryShape, Handle<Name> >::
14053 Shrink(Handle<NameDictionary>, Handle<Name>); 14052 Shrink(Handle<NameDictionary>, Handle<Name>);
14054 14053
14055 template Handle<SeededNumberDictionary> 14054 template Handle<SeededNumberDictionary>
14056 HashTable<SeededNumberDictionary, SeededNumberDictionaryShape, uint32_t>:: 14055 HashTable<SeededNumberDictionary, SeededNumberDictionaryShape, uint32_t>::
14057 Shrink(Handle<SeededNumberDictionary>, uint32_t); 14056 Shrink(Handle<SeededNumberDictionary>, uint32_t);
14058 14057
14059 template int 14058 template void Dictionary<NameDictionary, NameDictionaryShape, Handle<Name> >::
14060 Dictionary<NameDictionary, NameDictionaryShape, Handle<Name> >::CopyKeysTo( 14059 CopyKeysTo(
14061 FixedArray*, int, PropertyAttributes, 14060 FixedArray*,
14062 Dictionary<NameDictionary, NameDictionaryShape, 14061 int,
14063 Handle<Name> >::SortMode); 14062 PropertyAttributes,
14063 Dictionary<
14064 NameDictionary, NameDictionaryShape, Handle<Name> >::SortMode);
14064 14065
14065 template int 14066 template int
14066 Dictionary<NameDictionary, NameDictionaryShape, Handle<Name> >:: 14067 Dictionary<NameDictionary, NameDictionaryShape, Handle<Name> >::
14067 NumberOfElementsFilterAttributes(PropertyAttributes); 14068 NumberOfElementsFilterAttributes(PropertyAttributes);
14068 14069
14069 template Handle<NameDictionary> 14070 template Handle<NameDictionary>
14070 Dictionary<NameDictionary, NameDictionaryShape, Handle<Name> >::Add( 14071 Dictionary<NameDictionary, NameDictionaryShape, Handle<Name> >::Add(
14071 Handle<NameDictionary>, Handle<Name>, Handle<Object>, PropertyDetails); 14072 Handle<NameDictionary>, Handle<Name>, Handle<Object>, PropertyDetails);
14072 14073
14073 template void 14074 template void
(...skipping 1126 matching lines...) Expand 10 before | Expand all | Expand 10 after
15200 EnumIndexComparator cmp(this); 15201 EnumIndexComparator cmp(this);
15201 Smi** start = reinterpret_cast<Smi**>(storage->GetFirstElementAddress()); 15202 Smi** start = reinterpret_cast<Smi**>(storage->GetFirstElementAddress());
15202 std::sort(start, start + length, cmp); 15203 std::sort(start, start + length, cmp);
15203 for (int i = 0; i < length; i++) { 15204 for (int i = 0; i < length; i++) {
15204 int index = Smi::cast(storage->get(i))->value(); 15205 int index = Smi::cast(storage->get(i))->value();
15205 storage->set(i, KeyAt(index)); 15206 storage->set(i, KeyAt(index));
15206 } 15207 }
15207 } 15208 }
15208 15209
15209 15210
15210 template <typename Derived, typename Shape, typename Key> 15211 template<typename Derived, typename Shape, typename Key>
15211 int Dictionary<Derived, Shape, Key>::CopyKeysTo( 15212 void Dictionary<Derived, Shape, Key>::CopyKeysTo(
15212 FixedArray* storage, int index, PropertyAttributes filter, 15213 FixedArray* storage,
15214 int index,
15215 PropertyAttributes filter,
15213 typename Dictionary<Derived, Shape, Key>::SortMode sort_mode) { 15216 typename Dictionary<Derived, Shape, Key>::SortMode sort_mode) {
15214 DCHECK(storage->length() >= NumberOfElementsFilterAttributes(filter)); 15217 DCHECK(storage->length() >= NumberOfElementsFilterAttributes(filter));
15215 int capacity = DerivedHashTable::Capacity(); 15218 int capacity = DerivedHashTable::Capacity();
15216 int offset = 0;
15217 for (int i = 0; i < capacity; i++) { 15219 for (int i = 0; i < capacity; i++) {
15218 Object* k = DerivedHashTable::KeyAt(i); 15220 Object* k = DerivedHashTable::KeyAt(i);
15219 if (DerivedHashTable::IsKey(k) && !FilterKey(k, filter)) { 15221 if (DerivedHashTable::IsKey(k) && !FilterKey(k, filter)) {
15220 PropertyDetails details = DetailsAt(i); 15222 PropertyDetails details = DetailsAt(i);
15221 if (details.IsDeleted()) continue; 15223 if (details.IsDeleted()) continue;
15222 PropertyAttributes attr = details.attributes(); 15224 PropertyAttributes attr = details.attributes();
15223 if ((attr & filter) == 0) storage->set(index + offset, k); 15225 if ((attr & filter) == 0) storage->set(index++, k);
15224 offset++;
15225 } 15226 }
15226 } 15227 }
15227 if (sort_mode == Dictionary::SORTED) { 15228 if (sort_mode == Dictionary::SORTED) {
15228 storage->SortPairs(storage, index + offset); 15229 storage->SortPairs(storage, index);
15229 } 15230 }
15230 DCHECK(storage->length() >= index + offset); 15231 DCHECK(storage->length() >= index);
15231 return offset;
15232 } 15232 }
15233 15233
15234 15234
15235 // Backwards lookup (slow). 15235 // Backwards lookup (slow).
15236 template<typename Derived, typename Shape, typename Key> 15236 template<typename Derived, typename Shape, typename Key>
15237 Object* Dictionary<Derived, Shape, Key>::SlowReverseLookup(Object* value) { 15237 Object* Dictionary<Derived, Shape, Key>::SlowReverseLookup(Object* value) {
15238 int capacity = DerivedHashTable::Capacity(); 15238 int capacity = DerivedHashTable::Capacity();
15239 for (int i = 0; i < capacity; i++) { 15239 for (int i = 0; i < capacity; i++) {
15240 Object* k = DerivedHashTable::KeyAt(i); 15240 Object* k = DerivedHashTable::KeyAt(i);
15241 if (Dictionary::IsKey(k)) { 15241 if (Dictionary::IsKey(k)) {
(...skipping 1117 matching lines...) Expand 10 before | Expand all | Expand 10 after
16359 #define ERROR_MESSAGES_TEXTS(C, T) T, 16359 #define ERROR_MESSAGES_TEXTS(C, T) T,
16360 static const char* error_messages_[] = { 16360 static const char* error_messages_[] = {
16361 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) 16361 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS)
16362 }; 16362 };
16363 #undef ERROR_MESSAGES_TEXTS 16363 #undef ERROR_MESSAGES_TEXTS
16364 return error_messages_[reason]; 16364 return error_messages_[reason];
16365 } 16365 }
16366 16366
16367 16367
16368 } } // namespace v8::internal 16368 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698