Commit 5ffe6c9f authored by Jakob Kummerow's avatar Jakob Kummerow Committed by Commit Bot

Fix std::ostream printing for ObjectPtr-derived types

Moving the declaration of operator<< from objects-printer.cc to
heap-object.h makes sure that it is visible.

Change-Id: I316db9c03a464974129b8e9c776423bb80066cdd
Reviewed-on: https://chromium-review.googlesource.com/c/1382737Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58350}
parent 5c38b47a
......@@ -68,11 +68,6 @@ namespace internal {
#ifdef OBJECT_PRINT
std::ostream& operator<<(std::ostream& os, const ObjectPtr o) {
os << reinterpret_cast<void*>(o.ptr());
return os;
}
void Object::Print() {
StdoutStream os;
this->Print(os);
......
......@@ -2583,7 +2583,12 @@ void Object::ShortPrint(StringStream* accumulator) {
void Object::ShortPrint(std::ostream& os) { os << Brief(this); }
void ObjectPtr::ShortPrint(std::ostream& os) { os << Brief(*this); }
void ObjectPtr::ShortPrint(std::ostream& os) const { os << Brief(*this); }
std::ostream& operator<<(std::ostream& os, const ObjectPtr& obj) {
obj.ShortPrint(os);
return os;
}
void MaybeObject::ShortPrint(FILE* out) {
OFStream os(out);
......
......@@ -96,13 +96,13 @@ void ObjectPtr::VerifyApiCallResultType() {
reinterpret_cast<Object*>(ptr())->VerifyApiCallResultType();
}
void ObjectPtr::ShortPrint(FILE* out) {
void ObjectPtr::ShortPrint(FILE* out) const {
return reinterpret_cast<Object*>(ptr())->ShortPrint(out);
}
void ObjectPtr::Print() { reinterpret_cast<Object*>(ptr())->Print(); }
void ObjectPtr::Print() const { reinterpret_cast<Object*>(ptr())->Print(); }
void ObjectPtr::Print(std::ostream& os) {
void ObjectPtr::Print(std::ostream& os) const {
reinterpret_cast<Object*>(ptr())->Print(os);
}
......
......@@ -129,10 +129,10 @@ class ObjectPtr {
inline void VerifyApiCallResultType();
inline void ShortPrint(FILE* out = stdout);
void ShortPrint(std::ostream& os); // NOLINT
inline void Print();
inline void Print(std::ostream& os);
inline void ShortPrint(FILE* out = stdout) const;
void ShortPrint(std::ostream& os) const; // NOLINT
inline void Print() const;
inline void Print(std::ostream& os) const;
// For use with std::unordered_set.
struct Hasher {
......@@ -154,6 +154,9 @@ bool ObjectPtr::IsHeapObject() const {
return !IsSmi();
}
V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os,
const ObjectPtr& obj);
// Replacement for HeapObject; temporarily separate for incremental transition:
class HeapObjectPtr : public ObjectPtr {
public:
......
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