Commit b7db31a2 authored by Sathya Gunasekaran's avatar Sathya Gunasekaran Committed by Commit Bot

[runtime] Templatize PrintFixedArrayElements

Also delete duplicated code

Bug: v8:6404
Change-Id: I7f24d99573a854254aa0fd332fe5c947f93e0552
Reviewed-on: https://chromium-review.googlesource.com/704223Reviewed-by: 's avatarCamillo Bruni <cbruni@chromium.org>
Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
Cr-Commit-Position: refs/heads/master@{#48347}
parent e02e3f3f
......@@ -356,7 +356,8 @@ void DoPrintElements(std::ostream& os, Object* object) { // NOLINT
}
}
void PrintFixedArrayElements(std::ostream& os, FixedArray* array) {
template <typename T>
void PrintFixedArrayElements(std::ostream& os, T* array) {
// Print in array notation for non-sparse arrays.
Object* previous_value = array->length() > 0 ? array->get(0) : nullptr;
Object* value = nullptr;
......@@ -629,16 +630,12 @@ void FixedArray::FixedArrayPrint(std::ostream& os) { // NOLINT
os << "\n";
}
// TODO(gsathya): Templatize PrintFixedArrayElements to print this as
// well.
void PropertyArray::PropertyArrayPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "PropertyArray");
os << "\n - map = " << Brief(map());
os << "\n - length: " << length();
for (int i = 0; i < length(); i++) {
os << "\n" << i << " : " << std::setw(8) << Brief(get(i));
}
os << "\n - hash: " << Hash();
PrintFixedArrayElements(os, this);
os << "\n";
}
......
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