summaryrefslogtreecommitdiff
path: root/chromium/v8/src/property.cc
blob: e9e4b64690777aede7c4595e8bd122e07a8bc3ac (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
// 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 "src/property.h"

#include "src/handles-inl.h"
#include "src/ostreams.h"

namespace v8 {
namespace internal {

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


std::ostream& operator<<(std::ostream& os, const LookupResult& r) {
  if (!r.IsFound()) return os << "Not Found\n";

  os << "LookupResult:\n";
  if (r.IsTransition()) {
    os << " -transition target:\n" << Brief(r.GetTransitionTarget()) << "\n";
  }
  return os;
}


std::ostream& operator<<(std::ostream& os,
                         const PropertyAttributes& attributes) {
  os << "[";
  os << (((attributes & READ_ONLY) == 0) ? "W" : "_");    // writable
  os << (((attributes & DONT_ENUM) == 0) ? "E" : "_");    // enumerable
  os << (((attributes & DONT_DELETE) == 0) ? "C" : "_");  // configurable
  os << "]";
  return os;
}


std::ostream& operator<<(std::ostream& os, const PropertyDetails& details) {
  os << "(";
  switch (details.type()) {
    case NORMAL:
      os << "normal: dictionary_index: " << details.dictionary_index();
      break;
    case CONSTANT:
      os << "constant: p: " << details.pointer();
      break;
    case FIELD:
      os << "field: " << details.representation().Mnemonic()
         << ", field_index: " << details.field_index()
         << ", p: " << details.pointer();
      break;
    case CALLBACKS:
      os << "callbacks: p: " << details.pointer();
      break;
  }
  os << ", attrs: " << details.attributes() << ")";
  return os;
}


std::ostream& operator<<(std::ostream& os, const Descriptor& d) {
  return os << "Descriptor " << Brief(*d.GetKey()) << " @ "
            << Brief(*d.GetValue()) << " " << d.GetDetails();
}

} }  // namespace v8::internal