Commit 85b95a03 authored by Camillo Bruni's avatar Camillo Bruni Committed by Commit Bot

[printing] Fix printing the GlobalObject

Due to the dictionary refactoring we ended up calling the superclass' helper
which in turn made us decode the values wrongly for the GlobalDictionary.

Change-Id: I4298b6a437ef2d84b69b7e980470c3cf5af79944
Reviewed-on: https://chromium-review.googlesource.com/561701Reviewed-by: 's avatarIgor Sheludko <ishell@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#46449}
parent 4aebf129
...@@ -15700,21 +15700,23 @@ int JSObject::GetFastElementsUsage() { ...@@ -15700,21 +15700,23 @@ int JSObject::GetFastElementsUsage() {
// we keep it here instead to satisfy certain compilers. // we keep it here instead to satisfy certain compilers.
#ifdef OBJECT_PRINT #ifdef OBJECT_PRINT
template <typename Derived, typename Shape> template <typename Derived, typename Shape>
void Dictionary<Derived, Shape>::Print(std::ostream& os) { // NOLINT void Dictionary<Derived, Shape>::Print(std::ostream& os) {
DisallowHeapAllocation no_gc;
Isolate* isolate = this->GetIsolate(); Isolate* isolate = this->GetIsolate();
int capacity = this->Capacity(); Derived* dictionary = Derived::cast(this);
int capacity = dictionary->Capacity();
for (int i = 0; i < capacity; i++) { for (int i = 0; i < capacity; i++) {
Object* k = this->KeyAt(i); Object* k = dictionary->KeyAt(i);
if (Shape::IsLive(isolate, k)) { if (!Shape::IsLive(isolate, k)) continue;
if (!dictionary->ToKey(isolate, i, &k)) continue;
os << "\n "; os << "\n ";
if (k->IsString()) { if (k->IsString()) {
String::cast(k)->StringPrint(os); String::cast(k)->StringPrint(os);
} else { } else {
os << Brief(k); os << Brief(k);
} }
os << ": " << Brief(this->ValueAt(i)) << " "; os << ": " << Brief(dictionary->ValueAt(i)) << " ";
this->DetailsAt(i).PrintAsSlowTo(os); dictionary->DetailsAt(i).PrintAsSlowTo(os);
}
} }
} }
template <typename Derived, typename Shape> template <typename Derived, typename Shape>
...@@ -16225,7 +16227,7 @@ void HashTable<Derived, Shape>::Rehash(Derived* new_table) { ...@@ -16225,7 +16227,7 @@ void HashTable<Derived, Shape>::Rehash(Derived* new_table) {
for (int i = 0; i < capacity; i++) { for (int i = 0; i < capacity; i++) {
uint32_t from_index = EntryToIndex(i); uint32_t from_index = EntryToIndex(i);
Object* k = this->get(from_index); Object* k = this->get(from_index);
if (Shape::IsLive(isolate, k)) { if (!Shape::IsLive(isolate, k)) continue;
uint32_t hash = Shape::HashForObject(isolate, k); uint32_t hash = Shape::HashForObject(isolate, k);
uint32_t insertion_index = uint32_t insertion_index =
EntryToIndex(new_table->FindInsertionEntry(hash)); EntryToIndex(new_table->FindInsertionEntry(hash));
...@@ -16233,7 +16235,6 @@ void HashTable<Derived, Shape>::Rehash(Derived* new_table) { ...@@ -16233,7 +16235,6 @@ void HashTable<Derived, Shape>::Rehash(Derived* new_table) {
new_table->set(insertion_index + j, get(from_index + j), mode); new_table->set(insertion_index + j, get(from_index + j), mode);
} }
} }
}
new_table->SetNumberOfElements(NumberOfElements()); new_table->SetNumberOfElements(NumberOfElements());
new_table->SetNumberOfDeletedElements(0); new_table->SetNumberOfDeletedElements(0);
} }
...@@ -16281,7 +16282,7 @@ void HashTable<Derived, Shape>::Rehash() { ...@@ -16281,7 +16282,7 @@ void HashTable<Derived, Shape>::Rehash() {
done = true; done = true;
for (uint32_t current = 0; current < capacity; current++) { for (uint32_t current = 0; current < capacity; current++) {
Object* current_key = KeyAt(current); Object* current_key = KeyAt(current);
if (Shape::IsLive(isolate, current_key)) { if (!Shape::IsLive(isolate, current_key)) continue;
uint32_t target = EntryForProbe(current_key, probe, current); uint32_t target = EntryForProbe(current_key, probe, current);
if (current == target) continue; if (current == target) continue;
Object* target_key = KeyAt(target); Object* target_key = KeyAt(target);
...@@ -16298,7 +16299,6 @@ void HashTable<Derived, Shape>::Rehash() { ...@@ -16298,7 +16299,6 @@ void HashTable<Derived, Shape>::Rehash() {
} }
} }
} }
}
// Wipe deleted entries. // Wipe deleted entries.
Object* the_hole = isolate->heap()->the_hole_value(); Object* the_hole = isolate->heap()->the_hole_value();
Object* undefined = isolate->heap()->undefined_value(); Object* undefined = isolate->heap()->undefined_value();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment