Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / v8 / src / property.cc
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
3 // found in the LICENSE file.
4
5 #include "property.h"
6
7 #include "handles-inl.h"
8
9 namespace v8 {
10 namespace internal {
11
12 void LookupResult::Iterate(ObjectVisitor* visitor) {
13   LookupResult* current = this;  // Could be NULL.
14   while (current != NULL) {
15     visitor->VisitPointer(BitCast<Object**>(&current->holder_));
16     visitor->VisitPointer(BitCast<Object**>(&current->transition_));
17     current = current->next_;
18   }
19 }
20
21
22 #ifdef OBJECT_PRINT
23 void LookupResult::Print(FILE* out) {
24   if (!IsFound()) {
25     PrintF(out, "Not Found\n");
26     return;
27   }
28
29   PrintF(out, "LookupResult:\n");
30   PrintF(out, " -cacheable = %s\n", IsCacheable() ? "true" : "false");
31   PrintF(out, " -attributes = %x\n", GetAttributes());
32   if (IsTransition()) {
33     PrintF(out, " -transition target:\n");
34     GetTransitionTarget()->Print(out);
35     PrintF(out, "\n");
36   }
37   switch (type()) {
38     case NORMAL:
39       PrintF(out, " -type = normal\n");
40       PrintF(out, " -entry = %d", GetDictionaryEntry());
41       break;
42     case CONSTANT:
43       PrintF(out, " -type = constant\n");
44       PrintF(out, " -value:\n");
45       GetConstant()->Print(out);
46       PrintF(out, "\n");
47       break;
48     case FIELD:
49       PrintF(out, " -type = field\n");
50       PrintF(out, " -index = %d\n", GetFieldIndex().field_index());
51       PrintF(out, " -field type:\n");
52       GetFieldType()->TypePrint(out);
53       break;
54     case CALLBACKS:
55       PrintF(out, " -type = call backs\n");
56       PrintF(out, " -callback object:\n");
57       GetCallbackObject()->Print(out);
58       break;
59     case HANDLER:
60       PrintF(out, " -type = lookup proxy\n");
61       break;
62     case INTERCEPTOR:
63       PrintF(out, " -type = lookup interceptor\n");
64       break;
65     case NONEXISTENT:
66       UNREACHABLE();
67       break;
68   }
69 }
70
71
72 void Descriptor::Print(FILE* out) {
73   PrintF(out, "Descriptor ");
74   GetKey()->ShortPrint(out);
75   PrintF(out, " @ ");
76   GetValue()->ShortPrint(out);
77 }
78 #endif
79
80 } }  // namespace v8::internal