OLD | NEW |
---|---|
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 5893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5904 ASSERT(!curr->HasNamedInterceptor()); | 5904 ASSERT(!curr->HasNamedInterceptor()); |
5905 ASSERT(!curr->HasIndexedInterceptor()); | 5905 ASSERT(!curr->HasIndexedInterceptor()); |
5906 ASSERT(!curr->IsAccessCheckNeeded()); | 5906 ASSERT(!curr->IsAccessCheckNeeded()); |
5907 if (curr->NumberOfEnumElements() > 0) return false; | 5907 if (curr->NumberOfEnumElements() > 0) return false; |
5908 if (curr != this && enum_length != 0) return false; | 5908 if (curr != this && enum_length != 0) return false; |
5909 } | 5909 } |
5910 return true; | 5910 return true; |
5911 } | 5911 } |
5912 | 5912 |
5913 | 5913 |
5914 static bool FilterKey(Object* key, PropertyAttributes filter) { | |
5915 if ((filter & SYMBOLIC) && key->IsSymbol()) { | |
arv (Not doing code reviews)
2013/12/18 18:10:02
One option here would be:
if (filter & (SYMBOLIC
rossberg
2013/12/19 10:28:04
I leave that up to you, I'm fine either way.
| |
5916 return true; | |
5917 } | |
5918 | |
5919 if ((filter & PRIVATE_SYMBOL) && | |
5920 key->IsSymbol() && Symbol::cast(key)->is_private()) { | |
5921 return true; | |
5922 } | |
5923 | |
5924 if ((filter & STRING) && !key->IsSymbol()) { | |
5925 return true; | |
5926 } | |
5927 | |
5928 return false; | |
5929 } | |
5930 | |
5931 | |
5914 int Map::NumberOfDescribedProperties(DescriptorFlag which, | 5932 int Map::NumberOfDescribedProperties(DescriptorFlag which, |
5915 PropertyAttributes filter) { | 5933 PropertyAttributes filter) { |
5916 int result = 0; | 5934 int result = 0; |
5917 DescriptorArray* descs = instance_descriptors(); | 5935 DescriptorArray* descs = instance_descriptors(); |
5918 int limit = which == ALL_DESCRIPTORS | 5936 int limit = which == ALL_DESCRIPTORS |
5919 ? descs->number_of_descriptors() | 5937 ? descs->number_of_descriptors() |
5920 : NumberOfOwnDescriptors(); | 5938 : NumberOfOwnDescriptors(); |
5921 for (int i = 0; i < limit; i++) { | 5939 for (int i = 0; i < limit; i++) { |
5922 if ((descs->GetDetails(i).attributes() & filter) == 0 && | 5940 if ((descs->GetDetails(i).attributes() & filter) == 0 && |
5923 ((filter & SYMBOLIC) == 0 || !descs->GetKey(i)->IsSymbol())) { | 5941 !FilterKey(descs->GetKey(i), filter)) { |
5924 result++; | 5942 result++; |
5925 } | 5943 } |
5926 } | 5944 } |
5927 return result; | 5945 return result; |
5928 } | 5946 } |
5929 | 5947 |
5930 | 5948 |
5931 int Map::NextFreePropertyIndex() { | 5949 int Map::NextFreePropertyIndex() { |
5932 int max_index = -1; | 5950 int max_index = -1; |
5933 int number_of_own_descriptors = NumberOfOwnDescriptors(); | 5951 int number_of_own_descriptors = NumberOfOwnDescriptors(); |
(...skipping 7610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
13544 // purpose of this function is to provide reflection information for the object | 13562 // purpose of this function is to provide reflection information for the object |
13545 // mirrors. | 13563 // mirrors. |
13546 void JSObject::GetLocalPropertyNames( | 13564 void JSObject::GetLocalPropertyNames( |
13547 FixedArray* storage, int index, PropertyAttributes filter) { | 13565 FixedArray* storage, int index, PropertyAttributes filter) { |
13548 ASSERT(storage->length() >= (NumberOfLocalProperties(filter) - index)); | 13566 ASSERT(storage->length() >= (NumberOfLocalProperties(filter) - index)); |
13549 if (HasFastProperties()) { | 13567 if (HasFastProperties()) { |
13550 int real_size = map()->NumberOfOwnDescriptors(); | 13568 int real_size = map()->NumberOfOwnDescriptors(); |
13551 DescriptorArray* descs = map()->instance_descriptors(); | 13569 DescriptorArray* descs = map()->instance_descriptors(); |
13552 for (int i = 0; i < real_size; i++) { | 13570 for (int i = 0; i < real_size; i++) { |
13553 if ((descs->GetDetails(i).attributes() & filter) == 0 && | 13571 if ((descs->GetDetails(i).attributes() & filter) == 0 && |
13554 ((filter & SYMBOLIC) == 0 || !descs->GetKey(i)->IsSymbol())) { | 13572 !FilterKey(descs->GetKey(i), filter)) { |
13555 storage->set(index++, descs->GetKey(i)); | 13573 storage->set(index++, descs->GetKey(i)); |
13556 } | 13574 } |
13557 } | 13575 } |
13558 } else { | 13576 } else { |
13559 property_dictionary()->CopyKeysTo(storage, | 13577 property_dictionary()->CopyKeysTo(storage, |
13560 index, | 13578 index, |
13561 filter, | 13579 filter, |
13562 NameDictionary::UNSORTED); | 13580 NameDictionary::UNSORTED); |
13563 } | 13581 } |
13564 } | 13582 } |
(...skipping 2081 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
15646 | 15664 |
15647 | 15665 |
15648 template<typename Shape, typename Key> | 15666 template<typename Shape, typename Key> |
15649 int Dictionary<Shape, Key>::NumberOfElementsFilterAttributes( | 15667 int Dictionary<Shape, Key>::NumberOfElementsFilterAttributes( |
15650 PropertyAttributes filter) { | 15668 PropertyAttributes filter) { |
15651 int capacity = HashTable<Shape, Key>::Capacity(); | 15669 int capacity = HashTable<Shape, Key>::Capacity(); |
15652 int result = 0; | 15670 int result = 0; |
15653 for (int i = 0; i < capacity; i++) { | 15671 for (int i = 0; i < capacity; i++) { |
15654 Object* k = HashTable<Shape, Key>::KeyAt(i); | 15672 Object* k = HashTable<Shape, Key>::KeyAt(i); |
15655 if (HashTable<Shape, Key>::IsKey(k) && | 15673 if (HashTable<Shape, Key>::IsKey(k) && |
15656 ((filter & SYMBOLIC) == 0 || !k->IsSymbol())) { | 15674 !FilterKey(k, filter)) { |
15657 PropertyDetails details = DetailsAt(i); | 15675 PropertyDetails details = DetailsAt(i); |
15658 if (details.IsDeleted()) continue; | 15676 if (details.IsDeleted()) continue; |
15659 PropertyAttributes attr = details.attributes(); | 15677 PropertyAttributes attr = details.attributes(); |
15660 if ((attr & filter) == 0) result++; | 15678 if ((attr & filter) == 0) result++; |
15661 } | 15679 } |
15662 } | 15680 } |
15663 return result; | 15681 return result; |
15664 } | 15682 } |
15665 | 15683 |
15666 | 15684 |
(...skipping 984 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
16651 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16669 #define ERROR_MESSAGES_TEXTS(C, T) T, |
16652 static const char* error_messages_[] = { | 16670 static const char* error_messages_[] = { |
16653 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16671 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
16654 }; | 16672 }; |
16655 #undef ERROR_MESSAGES_TEXTS | 16673 #undef ERROR_MESSAGES_TEXTS |
16656 return error_messages_[reason]; | 16674 return error_messages_[reason]; |
16657 } | 16675 } |
16658 | 16676 |
16659 | 16677 |
16660 } } // namespace v8::internal | 16678 } } // namespace v8::internal |
OLD | NEW |