OLD | NEW |
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**>(¤t->holder_)); | 15 visitor->VisitPointer(BitCast<Object**>(¤t->holder_)); |
16 visitor->VisitPointer(BitCast<Object**>(¤t->transition_)); | 16 visitor->VisitPointer(BitCast<Object**>(¤t->transition_)); |
17 current = current->next_; | 17 current = current->next_; |
18 } | 18 } |
19 } | 19 } |
20 | 20 |
21 | 21 |
22 #ifdef OBJECT_PRINT | 22 #ifdef OBJECT_PRINT |
23 void LookupResult::Print(FILE* out) { | 23 void LookupResult::Print(FILE* out) { |
| 24 OFStream os(out); |
24 if (!IsFound()) { | 25 if (!IsFound()) { |
25 PrintF(out, "Not Found\n"); | 26 os << "Not Found\n"; |
26 return; | 27 return; |
27 } | 28 } |
28 | 29 |
29 PrintF(out, "LookupResult:\n"); | 30 os << "LookupResult:\n"; |
30 PrintF(out, " -cacheable = %s\n", IsCacheable() ? "true" : "false"); | 31 os << " -cacheable = " << (IsCacheable() ? "true" : "false") << "\n"; |
31 PrintF(out, " -attributes = %x\n", GetAttributes()); | 32 os << " -attributes = " << hex << GetAttributes() << dec << "\n"; |
32 if (IsTransition()) { | 33 if (IsTransition()) { |
33 PrintF(out, " -transition target:\n"); | 34 os << " -transition target:\n"; |
34 GetTransitionTarget()->Print(out); | 35 GetTransitionTarget()->Print(out); |
35 PrintF(out, "\n"); | 36 os << "\n"; |
36 } | 37 } |
37 switch (type()) { | 38 switch (type()) { |
38 case NORMAL: | 39 case NORMAL: |
39 PrintF(out, " -type = normal\n"); | 40 os << " -type = normal\n" |
40 PrintF(out, " -entry = %d", GetDictionaryEntry()); | 41 << " -entry = " << GetDictionaryEntry() << "\n"; |
41 break; | 42 break; |
42 case CONSTANT: | 43 case CONSTANT: |
43 PrintF(out, " -type = constant\n"); | 44 os << " -type = constant\n" |
44 PrintF(out, " -value:\n"); | 45 << " -value:\n"; |
45 GetConstant()->Print(out); | 46 GetConstant()->Print(out); |
46 PrintF(out, "\n"); | 47 os << "\n"; |
47 break; | 48 break; |
48 case FIELD: | 49 case FIELD: |
49 PrintF(out, " -type = field\n"); | 50 os << " -type = field\n" |
50 PrintF(out, " -index = %d\n", | 51 << " -index = " << GetFieldIndex().property_index() << "\n" |
51 GetFieldIndex().property_index()); | 52 << " -field type:"; |
52 PrintF(out, " -field type:\n"); | 53 GetFieldType()->PrintTo(os); |
53 GetFieldType()->TypePrint(out); | 54 os << "\n"; |
54 break; | 55 break; |
55 case CALLBACKS: | 56 case CALLBACKS: |
56 PrintF(out, " -type = call backs\n"); | 57 os << " -type = call backs\n" |
57 PrintF(out, " -callback object:\n"); | 58 << " -callback object:\n"; |
58 GetCallbackObject()->Print(out); | 59 GetCallbackObject()->Print(out); |
59 break; | 60 break; |
60 case HANDLER: | 61 case HANDLER: |
61 PrintF(out, " -type = lookup proxy\n"); | 62 os << " -type = lookup proxy\n"; |
62 break; | 63 break; |
63 case INTERCEPTOR: | 64 case INTERCEPTOR: |
64 PrintF(out, " -type = lookup interceptor\n"); | 65 os << " -type = lookup interceptor\n"; |
65 break; | 66 break; |
66 case NONEXISTENT: | 67 case NONEXISTENT: |
67 UNREACHABLE(); | 68 UNREACHABLE(); |
68 break; | 69 break; |
69 } | 70 } |
70 } | 71 } |
71 | 72 |
72 | 73 |
73 void Descriptor::Print(FILE* out) { | 74 void Descriptor::Print(FILE* out) { |
74 PrintF(out, "Descriptor "); | 75 PrintF(out, "Descriptor "); |
75 GetKey()->ShortPrint(out); | 76 GetKey()->ShortPrint(out); |
76 PrintF(out, " @ "); | 77 PrintF(out, " @ "); |
77 GetValue()->ShortPrint(out); | 78 GetValue()->ShortPrint(out); |
78 } | 79 } |
79 #endif | 80 #endif |
80 | 81 |
81 } } // namespace v8::internal | 82 } } // namespace v8::internal |
OLD | NEW |