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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/property.h ('k') | src/runtime.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/property.h" 5 #include "src/property.h"
6 6
7 #include "src/handles-inl.h" 7 #include "src/handles-inl.h"
8 8
9 namespace v8 { 9 namespace v8 {
10 namespace internal { 10 namespace internal {
11 11
12 void LookupResult::Iterate(ObjectVisitor* visitor) { 12 void LookupResult::Iterate(ObjectVisitor* visitor) {
13 LookupResult* current = this; // Could be NULL. 13 LookupResult* current = this; // Could be NULL.
14 while (current != NULL) { 14 while (current != NULL) {
15 visitor->VisitPointer(BitCast<Object**>(&current->holder_)); 15 visitor->VisitPointer(BitCast<Object**>(&current->holder_));
16 visitor->VisitPointer(BitCast<Object**>(&current->transition_)); 16 visitor->VisitPointer(BitCast<Object**>(&current->transition_));
17 current = current->next_; 17 current = current->next_;
18 } 18 }
19 } 19 }
20 20
21 21
22 #ifdef OBJECT_PRINT 22 OStream& operator<<(OStream& os, const LookupResult& r) {
23 void LookupResult::Print(FILE* out) { 23 if (!r.IsFound()) return os << "Not Found\n";
24 OFStream os(out);
25 if (!IsFound()) {
26 os << "Not Found\n";
27 return;
28 }
29 24
30 os << "LookupResult:\n"; 25 os << "LookupResult:\n";
31 os << " -cacheable = " << (IsCacheable() ? "true" : "false") << "\n"; 26 os << " -cacheable = " << (r.IsCacheable() ? "true" : "false") << "\n";
32 os << " -attributes = " << hex << GetAttributes() << dec << "\n"; 27 os << " -attributes = " << hex << r.GetAttributes() << dec << "\n";
33 if (IsTransition()) { 28 if (r.IsTransition()) {
34 os << " -transition target:\n"; 29 os << " -transition target:\n";
35 GetTransitionTarget()->Print(out); 30 r.GetTransitionTarget()->Print(os);
36 os << "\n"; 31 os << "\n";
37 } 32 }
38 switch (type()) { 33 switch (r.type()) {
39 case NORMAL: 34 case NORMAL:
40 os << " -type = normal\n" 35 return os << " -type = normal\n"
41 << " -entry = " << GetDictionaryEntry() << "\n"; 36 << " -entry = " << r.GetDictionaryEntry() << "\n";
42 break;
43 case CONSTANT: 37 case CONSTANT:
44 os << " -type = constant\n" 38 os << " -type = constant\n"
45 << " -value:\n"; 39 << " -value:\n";
46 GetConstant()->Print(out); 40 r.GetConstant()->Print(os);
47 os << "\n"; 41 return os << "\n";
48 break;
49 case FIELD: 42 case FIELD:
50 os << " -type = field\n" 43 os << " -type = field\n"
51 << " -index = " << GetFieldIndex().property_index() << "\n" 44 << " -index = " << r.GetFieldIndex().property_index() << "\n"
52 << " -field type:"; 45 << " -field type:";
53 GetFieldType()->PrintTo(os); 46 r.GetFieldType()->PrintTo(os);
54 os << "\n"; 47 return os << "\n";
55 break;
56 case CALLBACKS: 48 case CALLBACKS:
57 os << " -type = call backs\n" 49 os << " -type = call backs\n"
58 << " -callback object:\n"; 50 << " -callback object:\n";
59 GetCallbackObject()->Print(out); 51 r.GetCallbackObject()->Print(os);
60 break; 52 return os;
61 case HANDLER: 53 case HANDLER:
62 os << " -type = lookup proxy\n"; 54 return os << " -type = lookup proxy\n";
63 break;
64 case INTERCEPTOR: 55 case INTERCEPTOR:
65 os << " -type = lookup interceptor\n"; 56 return os << " -type = lookup interceptor\n";
66 break;
67 case NONEXISTENT: 57 case NONEXISTENT:
68 UNREACHABLE(); 58 UNREACHABLE();
69 break; 59 break;
70 } 60 }
61 return os;
71 } 62 }
72 63
73 64
74 void Descriptor::Print(FILE* out) { 65 OStream& operator<<(OStream& os, const Descriptor& d) {
75 PrintF(out, "Descriptor "); 66 return os << "Descriptor " << Brief(*d.GetKey()) << " @ "
76 GetKey()->ShortPrint(out); 67 << Brief(*d.GetValue());
77 PrintF(out, " @ ");
78 GetValue()->ShortPrint(out);
79 } 68 }
80 #endif
81 69
82 } } // namespace v8::internal 70 } } // namespace v8::internal
OLDNEW
« 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