2014-04-01 11:16:13 +00:00
|
|
|
// 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.
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2014-06-03 08:12:43 +00:00
|
|
|
#include "src/property.h"
|
2014-04-01 11:16:13 +00:00
|
|
|
|
2014-06-03 08:12:43 +00:00
|
|
|
#include "src/handles-inl.h"
|
2014-07-30 13:54:45 +00:00
|
|
|
#include "src/ostreams.h"
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2009-05-25 10:05:56 +00:00
|
|
|
namespace v8 {
|
|
|
|
namespace internal {
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2011-10-18 11:18:55 +00:00
|
|
|
void LookupResult::Iterate(ObjectVisitor* visitor) {
|
|
|
|
LookupResult* current = this; // Could be NULL.
|
|
|
|
while (current != NULL) {
|
2014-09-08 09:11:11 +00:00
|
|
|
visitor->VisitPointer(bit_cast<Object**>(¤t->holder_));
|
|
|
|
visitor->VisitPointer(bit_cast<Object**>(¤t->transition_));
|
2011-10-18 11:18:55 +00:00
|
|
|
current = current->next_;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-09-30 10:29:32 +00:00
|
|
|
std::ostream& operator<<(std::ostream& os, const LookupResult& r) {
|
2014-07-07 09:57:29 +00:00
|
|
|
if (!r.IsFound()) return os << "Not Found\n";
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2014-07-03 07:18:30 +00:00
|
|
|
os << "LookupResult:\n";
|
2014-07-07 09:57:29 +00:00
|
|
|
if (r.IsTransition()) {
|
|
|
|
os << " -transition target:\n" << Brief(r.GetTransitionTarget()) << "\n";
|
2014-04-15 07:36:47 +00:00
|
|
|
}
|
2014-07-07 09:57:29 +00:00
|
|
|
return os;
|
2008-07-03 15:10:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-10-23 11:31:33 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-09-30 10:29:32 +00:00
|
|
|
std::ostream& operator<<(std::ostream& os, const Descriptor& d) {
|
2014-07-07 09:57:29 +00:00
|
|
|
return os << "Descriptor " << Brief(*d.GetKey()) << " @ "
|
2014-10-23 11:31:33 +00:00
|
|
|
<< Brief(*d.GetValue()) << " " << d.GetDetails();
|
2008-07-03 15:10:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} } // namespace v8::internal
|