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

Unified Diff: src/property.cc

Issue 363323003: More OStreamsUse OStreams more often. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased and polished. Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/property.h ('k') | src/runtime.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/property.cc
diff --git a/src/property.cc b/src/property.cc
index 31f5e9a37436e40bbe14dbea25b1217cfd2e0e21..31a71293f4a905be8a53c366202378f9172a59b1 100644
--- a/src/property.cc
+++ b/src/property.cc
@@ -19,64 +19,52 @@ void LookupResult::Iterate(ObjectVisitor* visitor) {
}
-#ifdef OBJECT_PRINT
-void LookupResult::Print(FILE* out) {
- OFStream os(out);
- if (!IsFound()) {
- os << "Not Found\n";
- return;
- }
+OStream& operator<<(OStream& os, const LookupResult& r) {
+ if (!r.IsFound()) return os << "Not Found\n";
os << "LookupResult:\n";
- os << " -cacheable = " << (IsCacheable() ? "true" : "false") << "\n";
- os << " -attributes = " << hex << GetAttributes() << dec << "\n";
- if (IsTransition()) {
+ os << " -cacheable = " << (r.IsCacheable() ? "true" : "false") << "\n";
+ os << " -attributes = " << hex << r.GetAttributes() << dec << "\n";
+ if (r.IsTransition()) {
os << " -transition target:\n";
- GetTransitionTarget()->Print(out);
+ r.GetTransitionTarget()->Print(os);
os << "\n";
}
- switch (type()) {
+ switch (r.type()) {
case NORMAL:
- os << " -type = normal\n"
- << " -entry = " << GetDictionaryEntry() << "\n";
- break;
+ return os << " -type = normal\n"
+ << " -entry = " << r.GetDictionaryEntry() << "\n";
case CONSTANT:
os << " -type = constant\n"
<< " -value:\n";
- GetConstant()->Print(out);
- os << "\n";
- break;
+ r.GetConstant()->Print(os);
+ return os << "\n";
case FIELD:
os << " -type = field\n"
- << " -index = " << GetFieldIndex().property_index() << "\n"
+ << " -index = " << r.GetFieldIndex().property_index() << "\n"
<< " -field type:";
- GetFieldType()->PrintTo(os);
- os << "\n";
- break;
+ r.GetFieldType()->PrintTo(os);
+ return os << "\n";
case CALLBACKS:
os << " -type = call backs\n"
<< " -callback object:\n";
- GetCallbackObject()->Print(out);
- break;
+ r.GetCallbackObject()->Print(os);
+ return os;
case HANDLER:
- os << " -type = lookup proxy\n";
- break;
+ return os << " -type = lookup proxy\n";
case INTERCEPTOR:
- os << " -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
« no previous file with comments | « src/property.h ('k') | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698