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

Side by Side Diff: src/objects.cc

Issue 12455002: ES6 symbols: filter symbols form for-in loops and Object.keys (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 9 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/handles.cc ('k') | src/property-details.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 // 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 4552 matching lines...) Expand 10 before | Expand all | Expand 10 after
4563 4563
4564 4564
4565 int Map::NumberOfDescribedProperties(DescriptorFlag which, 4565 int Map::NumberOfDescribedProperties(DescriptorFlag which,
4566 PropertyAttributes filter) { 4566 PropertyAttributes filter) {
4567 int result = 0; 4567 int result = 0;
4568 DescriptorArray* descs = instance_descriptors(); 4568 DescriptorArray* descs = instance_descriptors();
4569 int limit = which == ALL_DESCRIPTORS 4569 int limit = which == ALL_DESCRIPTORS
4570 ? descs->number_of_descriptors() 4570 ? descs->number_of_descriptors()
4571 : NumberOfOwnDescriptors(); 4571 : NumberOfOwnDescriptors();
4572 for (int i = 0; i < limit; i++) { 4572 for (int i = 0; i < limit; i++) {
4573 if ((descs->GetDetails(i).attributes() & filter) == 0) result++; 4573 if ((descs->GetDetails(i).attributes() & filter) == 0 &&
4574 ((filter & SYMBOLIC) == 0 || !descs->GetKey(i)->IsSymbol())) {
4575 result++;
4576 }
4574 } 4577 }
4575 return result; 4578 return result;
4576 } 4579 }
4577 4580
4578 4581
4579 int Map::PropertyIndexFor(Name* name) { 4582 int Map::PropertyIndexFor(Name* name) {
4580 DescriptorArray* descs = instance_descriptors(); 4583 DescriptorArray* descs = instance_descriptors();
4581 int limit = NumberOfOwnDescriptors(); 4584 int limit = NumberOfOwnDescriptors();
4582 for (int i = 0; i < limit; i++) { 4585 for (int i = 0; i < limit; i++) {
4583 if (name->Equals(descs->GetKey(i))) return descs->GetFieldIndex(i); 4586 if (name->Equals(descs->GetKey(i))) return descs->GetFieldIndex(i);
(...skipping 6699 matching lines...) Expand 10 before | Expand all | Expand 10 after
11283 LookupResult result(isolate); 11286 LookupResult result(isolate);
11284 LocalLookupRealNamedProperty(key, &result); 11287 LocalLookupRealNamedProperty(key, &result);
11285 return result.IsPropertyCallbacks(); 11288 return result.IsPropertyCallbacks();
11286 } 11289 }
11287 11290
11288 11291
11289 int JSObject::NumberOfLocalProperties(PropertyAttributes filter) { 11292 int JSObject::NumberOfLocalProperties(PropertyAttributes filter) {
11290 if (HasFastProperties()) { 11293 if (HasFastProperties()) {
11291 Map* map = this->map(); 11294 Map* map = this->map();
11292 if (filter == NONE) return map->NumberOfOwnDescriptors(); 11295 if (filter == NONE) return map->NumberOfOwnDescriptors();
11293 if (filter == DONT_ENUM) { 11296 if (filter & DONT_ENUM) {
11294 int result = map->EnumLength(); 11297 int result = map->EnumLength();
11295 if (result != Map::kInvalidEnumCache) return result; 11298 if (result != Map::kInvalidEnumCache) return result;
11296 } 11299 }
11297 return map->NumberOfDescribedProperties(OWN_DESCRIPTORS, filter); 11300 return map->NumberOfDescribedProperties(OWN_DESCRIPTORS, filter);
11298 } 11301 }
11299 return property_dictionary()->NumberOfElementsFilterAttributes(filter); 11302 return property_dictionary()->NumberOfElementsFilterAttributes(filter);
11300 } 11303 }
11301 11304
11302 11305
11303 void FixedArray::SwapPairs(FixedArray* numbers, int i, int j) { 11306 void FixedArray::SwapPairs(FixedArray* numbers, int i, int j) {
(...skipping 2013 matching lines...) Expand 10 before | Expand all | Expand 10 after
13317 13320
13318 13321
13319 13322
13320 template<typename Shape, typename Key> 13323 template<typename Shape, typename Key>
13321 int Dictionary<Shape, Key>::NumberOfElementsFilterAttributes( 13324 int Dictionary<Shape, Key>::NumberOfElementsFilterAttributes(
13322 PropertyAttributes filter) { 13325 PropertyAttributes filter) {
13323 int capacity = HashTable<Shape, Key>::Capacity(); 13326 int capacity = HashTable<Shape, Key>::Capacity();
13324 int result = 0; 13327 int result = 0;
13325 for (int i = 0; i < capacity; i++) { 13328 for (int i = 0; i < capacity; i++) {
13326 Object* k = HashTable<Shape, Key>::KeyAt(i); 13329 Object* k = HashTable<Shape, Key>::KeyAt(i);
13327 if (HashTable<Shape, Key>::IsKey(k)) { 13330 if (HashTable<Shape, Key>::IsKey(k) &&
13331 ((filter & SYMBOLIC) == 0 || !k->IsSymbol())) {
13328 PropertyDetails details = DetailsAt(i); 13332 PropertyDetails details = DetailsAt(i);
13329 if (details.IsDeleted()) continue; 13333 if (details.IsDeleted()) continue;
13330 PropertyAttributes attr = details.attributes(); 13334 PropertyAttributes attr = details.attributes();
13331 if ((attr & filter) == 0) result++; 13335 if ((attr & filter) == 0) result++;
13332 } 13336 }
13333 } 13337 }
13334 return result; 13338 return result;
13335 } 13339 }
13336 13340
13337 13341
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
13372 Heap* heap = GetHeap(); 13376 Heap* heap = GetHeap();
13373 Object* undefined_value = heap->undefined_value(); 13377 Object* undefined_value = heap->undefined_value();
13374 int capacity = Capacity(); 13378 int capacity = Capacity();
13375 int properties = 0; 13379 int properties = 0;
13376 13380
13377 // Fill in the enumeration array by assigning enumerable keys at their 13381 // Fill in the enumeration array by assigning enumerable keys at their
13378 // enumeration index. This will leave holes in the array if there are keys 13382 // enumeration index. This will leave holes in the array if there are keys
13379 // that are deleted or not enumerable. 13383 // that are deleted or not enumerable.
13380 for (int i = 0; i < capacity; i++) { 13384 for (int i = 0; i < capacity; i++) {
13381 Object* k = KeyAt(i); 13385 Object* k = KeyAt(i);
13382 if (IsKey(k)) { 13386 if (IsKey(k) && !k->IsSymbol()) {
13383 PropertyDetails details = DetailsAt(i); 13387 PropertyDetails details = DetailsAt(i);
13384 if (details.IsDeleted() || details.IsDontEnum()) continue; 13388 if (details.IsDeleted() || details.IsDontEnum()) continue;
13385 properties++; 13389 properties++;
13386 storage->set(details.dictionary_index() - 1, k); 13390 storage->set(details.dictionary_index() - 1, k);
13387 if (properties == length) break; 13391 if (properties == length) break;
13388 } 13392 }
13389 } 13393 }
13390 13394
13391 // There are holes in the enumeration array if less properties were assigned 13395 // There are holes in the enumeration array if less properties were assigned
13392 // than the length of the array. If so, crunch all the existing properties 13396 // than the length of the array. If so, crunch all the existing properties
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after
14096 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); 14100 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER);
14097 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); 14101 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER);
14098 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); 14102 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER);
14099 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); 14103 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER);
14100 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); 14104 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER);
14101 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); 14105 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER);
14102 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); 14106 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER);
14103 } 14107 }
14104 14108
14105 } } // namespace v8::internal 14109 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/handles.cc ('k') | src/property-details.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698