#include "src/property.h"
#include "src/handles-inl.h"
+#include "src/ostreams.h"
namespace v8 {
namespace internal {
}
-#ifdef OBJECT_PRINT
-void LookupResult::Print(FILE* out) {
- if (!IsFound()) {
- PrintF(out, "Not Found\n");
- return;
- }
+OStream& operator<<(OStream& os, const LookupResult& r) {
+ if (!r.IsFound()) return os << "Not Found\n";
- PrintF(out, "LookupResult:\n");
- PrintF(out, " -cacheable = %s\n", IsCacheable() ? "true" : "false");
- PrintF(out, " -attributes = %x\n", GetAttributes());
- if (IsTransition()) {
- PrintF(out, " -transition target:\n");
- GetTransitionTarget()->Print(out);
- PrintF(out, "\n");
+ os << "LookupResult:\n";
+ os << " -cacheable = " << (r.IsCacheable() ? "true" : "false") << "\n";
+ os << " -attributes = " << hex << r.GetAttributes() << dec << "\n";
+ if (r.IsTransition()) {
+ os << " -transition target:\n" << Brief(r.GetTransitionTarget()) << "\n";
}
- switch (type()) {
+ switch (r.type()) {
case NORMAL:
- PrintF(out, " -type = normal\n");
- PrintF(out, " -entry = %d", GetDictionaryEntry());
- break;
+ return os << " -type = normal\n"
+ << " -entry = " << r.GetDictionaryEntry() << "\n";
case CONSTANT:
- PrintF(out, " -type = constant\n");
- PrintF(out, " -value:\n");
- GetConstant()->Print(out);
- PrintF(out, "\n");
- break;
+ return os << " -type = constant\n"
+ << " -value:\n" << Brief(r.GetConstant()) << "\n";
case FIELD:
- PrintF(out, " -type = field\n");
- PrintF(out, " -index = %d\n",
- GetFieldIndex().property_index());
- PrintF(out, " -field type:\n");
- GetFieldType()->TypePrint(out);
- break;
+ os << " -type = field\n"
+ << " -index = " << r.GetFieldIndex().property_index() << "\n"
+ << " -field type:";
+ r.GetFieldType()->PrintTo(os);
+ return os << "\n";
case CALLBACKS:
- PrintF(out, " -type = call backs\n");
- PrintF(out, " -callback object:\n");
- GetCallbackObject()->Print(out);
- break;
+ return os << " -type = call backs\n"
+ << " -callback object:\n" << Brief(r.GetCallbackObject());
case HANDLER:
- PrintF(out, " -type = lookup proxy\n");
- break;
+ return os << " -type = lookup proxy\n";
case INTERCEPTOR:
- PrintF(out, " -type = lookup interceptor\n");
- break;
+ return os << " -type = lookup interceptor\n";
case NONEXISTENT:
UNREACHABLE();
break;
}
+ return os;
}
-void Descriptor::Print(FILE* out) {
- PrintF(out, "Descriptor ");
- GetKey()->ShortPrint(out);
- PrintF(out, " @ ");
- GetValue()->ShortPrint(out);
+OStream& operator<<(OStream& os, const Descriptor& d) {
+ return os << "Descriptor " << Brief(*d.GetKey()) << " @ "
+ << Brief(*d.GetValue());
}
-#endif
} } // namespace v8::internal