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

Side by Side Diff: src/objects.cc

Issue 1775403008: Replace PushIfAbsent by a Stack object (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 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
« 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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/objects.h" 5 #include "src/objects.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <iomanip> 8 #include <iomanip>
9 #include <sstream> 9 #include <sstream>
10 10
(...skipping 17469 matching lines...) Expand 10 before | Expand all | Expand 10 after
17480 Dictionary<UnseededNumberDictionary, UnseededNumberDictionaryShape, uint32_t>:: 17480 Dictionary<UnseededNumberDictionary, UnseededNumberDictionaryShape, uint32_t>::
17481 EnsureCapacity(Handle<UnseededNumberDictionary>, int, uint32_t); 17481 EnsureCapacity(Handle<UnseededNumberDictionary>, int, uint32_t);
17482 17482
17483 template void Dictionary<NameDictionary, NameDictionaryShape, 17483 template void Dictionary<NameDictionary, NameDictionaryShape,
17484 Handle<Name> >::SetRequiresCopyOnCapacityChange(); 17484 Handle<Name> >::SetRequiresCopyOnCapacityChange();
17485 17485
17486 template Handle<NameDictionary> 17486 template Handle<NameDictionary>
17487 Dictionary<NameDictionary, NameDictionaryShape, Handle<Name> >:: 17487 Dictionary<NameDictionary, NameDictionaryShape, Handle<Name> >::
17488 EnsureCapacity(Handle<NameDictionary>, int, Handle<Name>); 17488 EnsureCapacity(Handle<NameDictionary>, int, Handle<Name>);
17489 17489
17490 template bool Dictionary<SeededNumberDictionary, SeededNumberDictionaryShape,
17491 uint32_t>::HasComplexElements();
17492
17493 template int HashTable<SeededNumberDictionary, SeededNumberDictionaryShape, 17490 template int HashTable<SeededNumberDictionary, SeededNumberDictionaryShape,
17494 uint32_t>::FindEntry(uint32_t); 17491 uint32_t>::FindEntry(uint32_t);
17495 17492
17496 template int NameDictionaryBase<NameDictionary, NameDictionaryShape>::FindEntry( 17493 template int NameDictionaryBase<NameDictionary, NameDictionaryShape>::FindEntry(
17497 Handle<Name>); 17494 Handle<Name>);
17498 17495
17499 17496
17500 Handle<Object> JSObject::PrepareSlowElementsForSort( 17497 Handle<Object> JSObject::PrepareSlowElementsForSort(
17501 Handle<JSObject> object, uint32_t limit) { 17498 Handle<JSObject> object, uint32_t limit) {
17502 DCHECK(object->HasDictionaryElements()); 17499 DCHECK(object->HasDictionaryElements());
(...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after
18323 int index = dictionary->NextEnumerationIndex(); 18320 int index = dictionary->NextEnumerationIndex();
18324 details = details.set_index(index); 18321 details = details.set_index(index);
18325 dictionary->SetNextEnumerationIndex(index + 1); 18322 dictionary->SetNextEnumerationIndex(index + 1);
18326 } 18323 }
18327 dictionary->SetEntry(entry, k, value, details); 18324 dictionary->SetEntry(entry, k, value, details);
18328 DCHECK((dictionary->KeyAt(entry)->IsNumber() || 18325 DCHECK((dictionary->KeyAt(entry)->IsNumber() ||
18329 dictionary->KeyAt(entry)->IsName())); 18326 dictionary->KeyAt(entry)->IsName()));
18330 dictionary->ElementAdded(); 18327 dictionary->ElementAdded();
18331 } 18328 }
18332 18329
18330 bool SeededNumberDictionary::HasComplexElements() {
18331 if (!requires_slow_elements()) return false;
18332 int capacity = this->Capacity();
18333 for (int i = 0; i < capacity; i++) {
18334 Object* k = this->KeyAt(i);
18335 if (this->IsKey(k)) {
18336 DCHECK(!IsDeleted(i));
18337 PropertyDetails details = this->DetailsAt(i);
18338 if (details.type() == ACCESSOR_CONSTANT) return true;
18339 PropertyAttributes attr = details.attributes();
18340 if (attr & ALL_ATTRIBUTES_MASK) return true;
18341 }
18342 }
18343 return false;
18344 }
18333 18345
18334 void SeededNumberDictionary::UpdateMaxNumberKey(uint32_t key, 18346 void SeededNumberDictionary::UpdateMaxNumberKey(uint32_t key,
18335 bool used_as_prototype) { 18347 bool used_as_prototype) {
18336 DisallowHeapAllocation no_allocation; 18348 DisallowHeapAllocation no_allocation;
18337 // If the dictionary requires slow elements an element has already 18349 // If the dictionary requires slow elements an element has already
18338 // been added at a high index. 18350 // been added at a high index.
18339 if (requires_slow_elements()) return; 18351 if (requires_slow_elements()) return;
18340 // Check if this index is high enough that we should require slow 18352 // Check if this index is high enough that we should require slow
18341 // elements. 18353 // elements.
18342 if (key > kRequiresSlowElementsLimit) { 18354 if (key > kRequiresSlowElementsLimit) {
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
18430 if (this->IsDeleted(i)) continue; 18442 if (this->IsDeleted(i)) continue;
18431 PropertyDetails details = this->DetailsAt(i); 18443 PropertyDetails details = this->DetailsAt(i);
18432 PropertyAttributes attr = details.attributes(); 18444 PropertyAttributes attr = details.attributes();
18433 if ((attr & filter) == 0) result++; 18445 if ((attr & filter) == 0) result++;
18434 } 18446 }
18435 } 18447 }
18436 return result; 18448 return result;
18437 } 18449 }
18438 18450
18439 18451
18440 template <typename Derived, typename Shape, typename Key>
18441 bool Dictionary<Derived, Shape, Key>::HasComplexElements() {
18442 int capacity = this->Capacity();
18443 for (int i = 0; i < capacity; i++) {
18444 Object* k = this->KeyAt(i);
18445 if (this->IsKey(k) && !k->FilterKey(ALL_PROPERTIES)) {
18446 if (this->IsDeleted(i)) continue;
18447 PropertyDetails details = this->DetailsAt(i);
18448 if (details.type() == ACCESSOR_CONSTANT) return true;
18449 PropertyAttributes attr = details.attributes();
18450 if (attr & ALL_ATTRIBUTES_MASK) return true;
18451 }
18452 }
18453 return false;
18454 }
18455
18456
18457 template <typename Dictionary> 18452 template <typename Dictionary>
18458 struct EnumIndexComparator { 18453 struct EnumIndexComparator {
18459 explicit EnumIndexComparator(Dictionary* dict) : dict(dict) {} 18454 explicit EnumIndexComparator(Dictionary* dict) : dict(dict) {}
18460 bool operator() (Smi* a, Smi* b) { 18455 bool operator() (Smi* a, Smi* b) {
18461 PropertyDetails da(dict->DetailsAt(a->value())); 18456 PropertyDetails da(dict->DetailsAt(a->value()));
18462 PropertyDetails db(dict->DetailsAt(b->value())); 18457 PropertyDetails db(dict->DetailsAt(b->value()));
18463 return da.dictionary_index() < db.dictionary_index(); 18458 return da.dictionary_index() < db.dictionary_index();
18464 } 18459 }
18465 Dictionary* dict; 18460 Dictionary* dict;
18466 }; 18461 };
(...skipping 1327 matching lines...) Expand 10 before | Expand all | Expand 10 after
19794 if (cell->value() != *new_value) { 19789 if (cell->value() != *new_value) {
19795 cell->set_value(*new_value); 19790 cell->set_value(*new_value);
19796 Isolate* isolate = cell->GetIsolate(); 19791 Isolate* isolate = cell->GetIsolate();
19797 cell->dependent_code()->DeoptimizeDependentCodeGroup( 19792 cell->dependent_code()->DeoptimizeDependentCodeGroup(
19798 isolate, DependentCode::kPropertyCellChangedGroup); 19793 isolate, DependentCode::kPropertyCellChangedGroup);
19799 } 19794 }
19800 } 19795 }
19801 19796
19802 } // namespace internal 19797 } // namespace internal
19803 } // namespace v8 19798 } // namespace v8
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