summaryrefslogtreecommitdiff
path: root/deps/v8/src/property.cc
blob: e7d0c4e2f4bbbf8c58271958d8c584e5e68a3279 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
// Copyright 2014 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "property.h"

#include "handles-inl.h"

namespace v8 {
namespace internal {

void LookupResult::Iterate(ObjectVisitor* visitor) {
  LookupResult* current = this;  // Could be NULL.
  while (current != NULL) {
    visitor->VisitPointer(BitCast<Object**>(&current->holder_));
    visitor->VisitPointer(BitCast<Object**>(&current->transition_));
    current = current->next_;
  }
}


#ifdef OBJECT_PRINT
void LookupResult::Print(FILE* out) {
  if (!IsFound()) {
    PrintF(out, "Not Found\n");
    return;
  }

  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");
  }
  switch (type()) {
    case NORMAL:
      PrintF(out, " -type = normal\n");
      PrintF(out, " -entry = %d", GetDictionaryEntry());
      break;
    case CONSTANT:
      PrintF(out, " -type = constant\n");
      PrintF(out, " -value:\n");
      GetConstant()->Print(out);
      PrintF(out, "\n");
      break;
    case FIELD:
      PrintF(out, " -type = field\n");
      PrintF(out, " -index = %d\n", GetFieldIndex().field_index());
      PrintF(out, " -field type:\n");
      GetFieldType()->TypePrint(out);
      break;
    case CALLBACKS:
      PrintF(out, " -type = call backs\n");
      PrintF(out, " -callback object:\n");
      GetCallbackObject()->Print(out);
      break;
    case HANDLER:
      PrintF(out, " -type = lookup proxy\n");
      break;
    case INTERCEPTOR:
      PrintF(out, " -type = lookup interceptor\n");
      break;
    case NONEXISTENT:
      UNREACHABLE();
      break;
  }
}


void Descriptor::Print(FILE* out) {
  PrintF(out, "Descriptor ");
  GetKey()->ShortPrint(out);
  PrintF(out, " @ ");
  GetValue()->ShortPrint(out);
}
#endif

} }  // namespace v8::internal