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

Side by Side Diff: src/objects.cc

Issue 177883002: Fix crasher in Object.getOwnPropertySymbols (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Comments Created 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-crbug-346141.js » ('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 15474 matching lines...) Expand 10 before | Expand all | Expand 10 after
15485 15485
15486 15486
15487 15487
15488 template<typename Shape, typename Key> 15488 template<typename Shape, typename Key>
15489 int Dictionary<Shape, Key>::NumberOfElementsFilterAttributes( 15489 int Dictionary<Shape, Key>::NumberOfElementsFilterAttributes(
15490 PropertyAttributes filter) { 15490 PropertyAttributes filter) {
15491 int capacity = HashTable<Shape, Key>::Capacity(); 15491 int capacity = HashTable<Shape, Key>::Capacity();
15492 int result = 0; 15492 int result = 0;
15493 for (int i = 0; i < capacity; i++) { 15493 for (int i = 0; i < capacity; i++) {
15494 Object* k = HashTable<Shape, Key>::KeyAt(i); 15494 Object* k = HashTable<Shape, Key>::KeyAt(i);
15495 if (HashTable<Shape, Key>::IsKey(k) && 15495 if (HashTable<Shape, Key>::IsKey(k) && !FilterKey(k, filter)) {
15496 !FilterKey(k, filter)) {
15497 PropertyDetails details = DetailsAt(i); 15496 PropertyDetails details = DetailsAt(i);
15498 if (details.IsDeleted()) continue; 15497 if (details.IsDeleted()) continue;
15499 PropertyAttributes attr = details.attributes(); 15498 PropertyAttributes attr = details.attributes();
15500 if ((attr & filter) == 0) result++; 15499 if ((attr & filter) == 0) result++;
15501 } 15500 }
15502 } 15501 }
15503 return result; 15502 return result;
15504 } 15503 }
15505 15504
15506 15505
15507 template<typename Shape, typename Key> 15506 template<typename Shape, typename Key>
15508 int Dictionary<Shape, Key>::NumberOfEnumElements() { 15507 int Dictionary<Shape, Key>::NumberOfEnumElements() {
15509 return NumberOfElementsFilterAttributes( 15508 return NumberOfElementsFilterAttributes(
15510 static_cast<PropertyAttributes>(DONT_ENUM)); 15509 static_cast<PropertyAttributes>(DONT_ENUM));
15511 } 15510 }
15512 15511
15513 15512
15514 template<typename Shape, typename Key> 15513 template<typename Shape, typename Key>
15515 void Dictionary<Shape, Key>::CopyKeysTo( 15514 void Dictionary<Shape, Key>::CopyKeysTo(
15516 FixedArray* storage, 15515 FixedArray* storage,
15517 PropertyAttributes filter, 15516 PropertyAttributes filter,
15518 typename Dictionary<Shape, Key>::SortMode sort_mode) { 15517 typename Dictionary<Shape, Key>::SortMode sort_mode) {
15519 ASSERT(storage->length() >= NumberOfEnumElements()); 15518 ASSERT(storage->length() >= NumberOfElementsFilterAttributes(filter));
15520 int capacity = HashTable<Shape, Key>::Capacity(); 15519 int capacity = HashTable<Shape, Key>::Capacity();
15521 int index = 0; 15520 int index = 0;
15522 for (int i = 0; i < capacity; i++) { 15521 for (int i = 0; i < capacity; i++) {
15523 Object* k = HashTable<Shape, Key>::KeyAt(i); 15522 Object* k = HashTable<Shape, Key>::KeyAt(i);
15524 if (HashTable<Shape, Key>::IsKey(k)) { 15523 if (HashTable<Shape, Key>::IsKey(k) && !FilterKey(k, filter)) {
15525 PropertyDetails details = DetailsAt(i); 15524 PropertyDetails details = DetailsAt(i);
15526 if (details.IsDeleted()) continue; 15525 if (details.IsDeleted()) continue;
15527 PropertyAttributes attr = details.attributes(); 15526 PropertyAttributes attr = details.attributes();
15528 if ((attr & filter) == 0) storage->set(index++, k); 15527 if ((attr & filter) == 0) storage->set(index++, k);
15529 } 15528 }
15530 } 15529 }
15531 if (sort_mode == Dictionary<Shape, Key>::SORTED) { 15530 if (sort_mode == Dictionary<Shape, Key>::SORTED) {
15532 storage->SortPairs(storage, index); 15531 storage->SortPairs(storage, index);
15533 } 15532 }
15534 ASSERT(storage->length() >= index); 15533 ASSERT(storage->length() >= index);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
15576 return storage; 15575 return storage;
15577 } 15576 }
15578 15577
15579 15578
15580 template<typename Shape, typename Key> 15579 template<typename Shape, typename Key>
15581 void Dictionary<Shape, Key>::CopyKeysTo( 15580 void Dictionary<Shape, Key>::CopyKeysTo(
15582 FixedArray* storage, 15581 FixedArray* storage,
15583 int index, 15582 int index,
15584 PropertyAttributes filter, 15583 PropertyAttributes filter,
15585 typename Dictionary<Shape, Key>::SortMode sort_mode) { 15584 typename Dictionary<Shape, Key>::SortMode sort_mode) {
15586 ASSERT(storage->length() >= NumberOfElementsFilterAttributes( 15585 ASSERT(storage->length() >= NumberOfElementsFilterAttributes(filter));
15587 static_cast<PropertyAttributes>(NONE)));
15588 int capacity = HashTable<Shape, Key>::Capacity(); 15586 int capacity = HashTable<Shape, Key>::Capacity();
15589 for (int i = 0; i < capacity; i++) { 15587 for (int i = 0; i < capacity; i++) {
15590 Object* k = HashTable<Shape, Key>::KeyAt(i); 15588 Object* k = HashTable<Shape, Key>::KeyAt(i);
15591 if (HashTable<Shape, Key>::IsKey(k)) { 15589 if (HashTable<Shape, Key>::IsKey(k) && !FilterKey(k, filter)) {
15592 PropertyDetails details = DetailsAt(i); 15590 PropertyDetails details = DetailsAt(i);
15593 if (details.IsDeleted()) continue; 15591 if (details.IsDeleted()) continue;
15594 PropertyAttributes attr = details.attributes(); 15592 PropertyAttributes attr = details.attributes();
15595 if ((attr & filter) == 0) storage->set(index++, k); 15593 if ((attr & filter) == 0) storage->set(index++, k);
15596 } 15594 }
15597 } 15595 }
15598 if (sort_mode == Dictionary<Shape, Key>::SORTED) { 15596 if (sort_mode == Dictionary<Shape, Key>::SORTED) {
15599 storage->SortPairs(storage, index); 15597 storage->SortPairs(storage, index);
15600 } 15598 }
15601 ASSERT(storage->length() >= index); 15599 ASSERT(storage->length() >= index);
(...skipping 881 matching lines...) Expand 10 before | Expand all | Expand 10 after
16483 #define ERROR_MESSAGES_TEXTS(C, T) T, 16481 #define ERROR_MESSAGES_TEXTS(C, T) T,
16484 static const char* error_messages_[] = { 16482 static const char* error_messages_[] = {
16485 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) 16483 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS)
16486 }; 16484 };
16487 #undef ERROR_MESSAGES_TEXTS 16485 #undef ERROR_MESSAGES_TEXTS
16488 return error_messages_[reason]; 16486 return error_messages_[reason];
16489 } 16487 }
16490 16488
16491 16489
16492 } } // namespace v8::internal 16490 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-crbug-346141.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698