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

Side by Side Diff: src/objects.cc

Issue 1918403003: Fix comment about when we rehash ObjectHashTables before growing them (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 7 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 | « no previous file | no next file » | 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 17880 matching lines...) Expand 10 before | Expand all | Expand 10 after
17891 Isolate* isolate = table->GetIsolate(); 17891 Isolate* isolate = table->GetIsolate();
17892 17892
17893 int entry = table->FindEntry(isolate, key, hash); 17893 int entry = table->FindEntry(isolate, key, hash);
17894 17894
17895 // Key is already in table, just overwrite value. 17895 // Key is already in table, just overwrite value.
17896 if (entry != kNotFound) { 17896 if (entry != kNotFound) {
17897 table->set(EntryToIndex(entry) + 1, *value); 17897 table->set(EntryToIndex(entry) + 1, *value);
17898 return table; 17898 return table;
17899 } 17899 }
17900 17900
17901 // Rehash if more than 25% of the entries are deleted entries. 17901 // Rehash if more than 33% of the entries are deleted entries.
17902 // TODO(jochen): Consider to shrink the fixed array in place. 17902 // TODO(jochen): Consider to shrink the fixed array in place.
17903 if ((table->NumberOfDeletedElements() << 1) > table->NumberOfElements()) { 17903 if ((table->NumberOfDeletedElements() << 1) > table->NumberOfElements()) {
17904 table->Rehash(isolate->factory()->undefined_value()); 17904 table->Rehash(isolate->factory()->undefined_value());
17905 } 17905 }
17906 17906
17907 // Check whether the hash table should be extended. 17907 // Check whether the hash table should be extended.
17908 table = EnsureCapacity(table, 1, key); 17908 table = EnsureCapacity(table, 1, key);
17909 table->AddEntry(table->FindInsertionEntry(hash), *key, *value); 17909 table->AddEntry(table->FindInsertionEntry(hash), *key, *value);
17910 return table; 17910 return table;
17911 } 17911 }
(...skipping 1149 matching lines...) Expand 10 before | Expand all | Expand 10 after
19061 if (cell->value() != *new_value) { 19061 if (cell->value() != *new_value) {
19062 cell->set_value(*new_value); 19062 cell->set_value(*new_value);
19063 Isolate* isolate = cell->GetIsolate(); 19063 Isolate* isolate = cell->GetIsolate();
19064 cell->dependent_code()->DeoptimizeDependentCodeGroup( 19064 cell->dependent_code()->DeoptimizeDependentCodeGroup(
19065 isolate, DependentCode::kPropertyCellChangedGroup); 19065 isolate, DependentCode::kPropertyCellChangedGroup);
19066 } 19066 }
19067 } 19067 }
19068 19068
19069 } // namespace internal 19069 } // namespace internal
19070 } // namespace v8 19070 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698