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

Side by Side Diff: src/objects-inl.h

Issue 2430273007: [runtime] Object.create(null) creates a slow object (Closed)
Patch Set: fix GC mole issue Created 4 years, 1 month 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.cc ('k') | src/runtime/runtime-object.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 // Review notes: 5 // Review notes:
6 // 6 //
7 // - The use of macros in these inline functions may seem superfluous 7 // - The use of macros in these inline functions may seem superfluous
8 // but it is absolutely needed to make sure gcc generates optimal 8 // but it is absolutely needed to make sure gcc generates optimal
9 // code. gcc is not happy when attempting to inline too deep. 9 // code. gcc is not happy when attempting to inline too deep.
10 // 10 //
(...skipping 3155 matching lines...) Expand 10 before | Expand all | Expand 10 after
3166 3166
3167 3167
3168 void HashTableBase::ElementsRemoved(int n) { 3168 void HashTableBase::ElementsRemoved(int n) {
3169 SetNumberOfElements(NumberOfElements() - n); 3169 SetNumberOfElements(NumberOfElements() - n);
3170 SetNumberOfDeletedElements(NumberOfDeletedElements() + n); 3170 SetNumberOfDeletedElements(NumberOfDeletedElements() + n);
3171 } 3171 }
3172 3172
3173 3173
3174 // static 3174 // static
3175 int HashTableBase::ComputeCapacity(int at_least_space_for) { 3175 int HashTableBase::ComputeCapacity(int at_least_space_for) {
3176 const int kMinCapacity = 4;
3177 int capacity = base::bits::RoundUpToPowerOfTwo32(at_least_space_for * 2); 3176 int capacity = base::bits::RoundUpToPowerOfTwo32(at_least_space_for * 2);
3178 return Max(capacity, kMinCapacity); 3177 return Max(capacity, kMinCapacity);
3179 } 3178 }
3180 3179
3181 bool HashTableBase::IsKey(Isolate* isolate, Object* k) { 3180 bool HashTableBase::IsKey(Isolate* isolate, Object* k) {
3182 Heap* heap = isolate->heap(); 3181 Heap* heap = isolate->heap();
3183 return k != heap->the_hole_value() && k != heap->undefined_value(); 3182 return k != heap->the_hole_value() && k != heap->undefined_value();
3184 } 3183 }
3185 3184
3186 bool HashTableBase::IsKey(Object* k) { 3185 bool HashTableBase::IsKey(Object* k) {
(...skipping 4383 matching lines...) Expand 10 before | Expand all | Expand 10 after
7570 if (map()->is_dictionary_map()) { 7569 if (map()->is_dictionary_map()) {
7571 WRITE_FIELD(this, kPropertiesOffset, 7570 WRITE_FIELD(this, kPropertiesOffset,
7572 GetHeap()->empty_properties_dictionary()); 7571 GetHeap()->empty_properties_dictionary());
7573 } else { 7572 } else {
7574 WRITE_FIELD(this, kPropertiesOffset, GetHeap()->empty_fixed_array()); 7573 WRITE_FIELD(this, kPropertiesOffset, GetHeap()->empty_fixed_array());
7575 } 7574 }
7576 } 7575 }
7577 7576
7578 7577
7579 bool JSReceiver::HasFastProperties() { 7578 bool JSReceiver::HasFastProperties() {
7580 DCHECK(properties()->IsDictionary() == map()->is_dictionary_map()); 7579 DCHECK_EQ(properties()->IsDictionary(), map()->is_dictionary_map());
7581 return !properties()->IsDictionary(); 7580 return !properties()->IsDictionary();
7582 } 7581 }
7583 7582
7584 7583
7585 NameDictionary* JSReceiver::property_dictionary() { 7584 NameDictionary* JSReceiver::property_dictionary() {
7586 DCHECK(!HasFastProperties()); 7585 DCHECK(!HasFastProperties());
7587 DCHECK(!IsJSGlobalObject()); 7586 DCHECK(!IsJSGlobalObject());
7588 return NameDictionary::cast(properties()); 7587 return NameDictionary::cast(properties());
7589 } 7588 }
7590 7589
(...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after
8416 #undef WRITE_INT64_FIELD 8415 #undef WRITE_INT64_FIELD
8417 #undef READ_BYTE_FIELD 8416 #undef READ_BYTE_FIELD
8418 #undef WRITE_BYTE_FIELD 8417 #undef WRITE_BYTE_FIELD
8419 #undef NOBARRIER_READ_BYTE_FIELD 8418 #undef NOBARRIER_READ_BYTE_FIELD
8420 #undef NOBARRIER_WRITE_BYTE_FIELD 8419 #undef NOBARRIER_WRITE_BYTE_FIELD
8421 8420
8422 } // namespace internal 8421 } // namespace internal
8423 } // namespace v8 8422 } // namespace v8
8424 8423
8425 #endif // V8_OBJECTS_INL_H_ 8424 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/runtime/runtime-object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698