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"
|
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) {
|
|
|
|
visitor->VisitPointer(BitCast<Object**>(¤t->holder_));
|
2014-02-18 12:19:32 +00:00
|
|
|
visitor->VisitPointer(BitCast<Object**>(¤t->transition_));
|
2011-10-18 11:18:55 +00:00
|
|
|
current = current->next_;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-07-07 09:57:29 +00:00
|
|
|
OStream& operator<<(OStream& os, const LookupResult& r) {
|
|
|
|
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
|
|
|
os << " -cacheable = " << (r.IsCacheable() ? "true" : "false") << "\n";
|
|
|
|
os << " -attributes = " << hex << r.GetAttributes() << dec << "\n";
|
|
|
|
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
|
|
|
switch (r.type()) {
|
2014-04-15 07:36:47 +00:00
|
|
|
case NORMAL:
|
2014-07-07 09:57:29 +00:00
|
|
|
return os << " -type = normal\n"
|
|
|
|
<< " -entry = " << r.GetDictionaryEntry() << "\n";
|
2014-04-15 07:36:47 +00:00
|
|
|
case CONSTANT:
|
2014-07-07 09:57:29 +00:00
|
|
|
return os << " -type = constant\n"
|
|
|
|
<< " -value:\n" << Brief(r.GetConstant()) << "\n";
|
2014-04-15 07:36:47 +00:00
|
|
|
case FIELD:
|
2014-07-03 07:18:30 +00:00
|
|
|
os << " -type = field\n"
|
2014-07-07 09:57:29 +00:00
|
|
|
<< " -index = " << r.GetFieldIndex().property_index() << "\n"
|
2014-07-03 07:18:30 +00:00
|
|
|
<< " -field type:";
|
2014-07-07 09:57:29 +00:00
|
|
|
r.GetFieldType()->PrintTo(os);
|
|
|
|
return os << "\n";
|
2014-04-15 07:36:47 +00:00
|
|
|
case CALLBACKS:
|
2014-07-07 09:57:29 +00:00
|
|
|
return os << " -type = call backs\n"
|
|
|
|
<< " -callback object:\n" << Brief(r.GetCallbackObject());
|
2014-04-15 07:36:47 +00:00
|
|
|
case HANDLER:
|
2014-07-07 09:57:29 +00:00
|
|
|
return os << " -type = lookup proxy\n";
|
2014-04-15 07:36:47 +00:00
|
|
|
case INTERCEPTOR:
|
2014-07-07 09:57:29 +00:00
|
|
|
return os << " -type = lookup interceptor\n";
|
2014-04-15 07:36:47 +00:00
|
|
|
case NONEXISTENT:
|
|
|
|
UNREACHABLE();
|
|
|
|
break;
|
2008-07-03 15:10:15 +00:00
|
|
|
}
|
2014-07-07 09:57:29 +00:00
|
|
|
return os;
|
2008-07-03 15:10:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-07-07 09:57:29 +00:00
|
|
|
OStream& operator<<(OStream& os, const Descriptor& d) {
|
|
|
|
return os << "Descriptor " << Brief(*d.GetKey()) << " @ "
|
|
|
|
<< Brief(*d.GetValue());
|
2008-07-03 15:10:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} } // namespace v8::internal
|