}
-void JSObject::PrintTransitions(std::ostream& os) { // NOLINT
- if (!map()->HasTransitionArray()) return;
- map()->transitions()->PrintTransitions(os, false);
-}
-
-
void JSObject::JSObjectPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "JSObject");
// Don't call GetElementsKind, its validation code can cause the printer to
}
-// This method is only meant to be called from gdb for debugging purposes.
-// Since the string can also be in two-byte encoding, non-Latin1 characters
-// will be ignored in the output.
-char* String::ToAsciiArray() {
- // Static so that subsequent calls frees previously allocated space.
- // This also means that previous results will be overwritten.
- static char* buffer = NULL;
- if (buffer != NULL) delete[] buffer;
- buffer = new char[length()+1];
- WriteToFlat(this, reinterpret_cast<uint8_t*>(buffer), 0, length());
- buffer[length()] = 0;
- return buffer;
-}
-
-
static const char* const weekdays[] = {
"???", "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
};
}
-void DescriptorArray::Print() {
- OFStream os(stdout);
- this->PrintDescriptors(os);
- os << std::flush;
-}
-
-
-void DescriptorArray::PrintDescriptors(std::ostream& os) { // NOLINT
- HandleScope scope(GetIsolate());
- os << "Descriptor array " << number_of_descriptors() << "\n";
- for (int i = 0; i < number_of_descriptors(); i++) {
- Descriptor desc;
- Get(i, &desc);
- os << " " << i << ": " << desc << "\n";
- }
- os << "\n";
-}
-
-
static void PrintBitMask(std::ostream& os, uint32_t value) { // NOLINT
for (int i = 0; i < 32; i++) {
if ((i & 7) == 0) os << " ";
}
+#endif // OBJECT_PRINT
+
+
+#if TRACE_MAPS
+
+
+void Name::NameShortPrint() {
+ if (this->IsString()) {
+ PrintF("%s", String::cast(this)->ToCString().get());
+ } else {
+ DCHECK(this->IsSymbol());
+ Symbol* s = Symbol::cast(this);
+ if (s->name()->IsUndefined()) {
+ PrintF("#<%s>", s->PrivateSymbolToName());
+ } else {
+ PrintF("<%s>", String::cast(s->name())->ToCString().get());
+ }
+ }
+}
+
+
+int Name::NameShortPrint(Vector<char> str) {
+ if (this->IsString()) {
+ return SNPrintF(str, "%s", String::cast(this)->ToCString().get());
+ } else {
+ DCHECK(this->IsSymbol());
+ Symbol* s = Symbol::cast(this);
+ if (s->name()->IsUndefined()) {
+ return SNPrintF(str, "#<%s>", s->PrivateSymbolToName());
+ } else {
+ return SNPrintF(str, "<%s>", String::cast(s->name())->ToCString().get());
+ }
+ }
+}
+
+
+#endif // TRACE_MAPS
+
+
+#ifdef DEBUG
+// This method is only meant to be called from gdb for debugging purposes.
+// Since the string can also be in two-byte encoding, non-Latin1 characters
+// will be ignored in the output.
+char* String::ToAsciiArray() {
+ // Static so that subsequent calls frees previously allocated space.
+ // This also means that previous results will be overwritten.
+ static char* buffer = NULL;
+ if (buffer != NULL) delete[] buffer;
+ buffer = new char[length() + 1];
+ WriteToFlat(this, reinterpret_cast<uint8_t*>(buffer), 0, length());
+ buffer[length()] = 0;
+ return buffer;
+}
+
+
+void DescriptorArray::Print() {
+ OFStream os(stdout);
+ this->PrintDescriptors(os);
+ os << std::flush;
+}
+
+
+void DescriptorArray::PrintDescriptors(std::ostream& os) { // NOLINT
+ HandleScope scope(GetIsolate());
+ os << "Descriptor array " << number_of_descriptors() << "\n";
+ for (int i = 0; i < number_of_descriptors(); i++) {
+ Descriptor desc;
+ Get(i, &desc);
+ os << " " << i << ": " << desc << "\n";
+ }
+ os << "\n";
+}
+
+
void TransitionArray::Print() {
OFStream os(stdout);
this->PrintTransitions(os);
for (int i = 0; i < number_of_transitions(); i++) {
Name* key = GetKey(i);
os << " ";
+#ifdef OBJECT_PRINT
key->NamePrint(os);
+#else
+ key->ShortPrint(os);
+#endif
os << ": ";
if (key == GetHeap()->frozen_symbol()) {
os << " (transition to frozen)";
}
-#endif // OBJECT_PRINT
-
-
-#if TRACE_MAPS
-
-
-void Name::NameShortPrint() {
- if (this->IsString()) {
- PrintF("%s", String::cast(this)->ToCString().get());
- } else {
- DCHECK(this->IsSymbol());
- Symbol* s = Symbol::cast(this);
- if (s->name()->IsUndefined()) {
- PrintF("#<%s>", s->PrivateSymbolToName());
- } else {
- PrintF("<%s>", String::cast(s->name())->ToCString().get());
- }
- }
-}
-
-
-int Name::NameShortPrint(Vector<char> str) {
- if (this->IsString()) {
- return SNPrintF(str, "%s", String::cast(this)->ToCString().get());
- } else {
- DCHECK(this->IsSymbol());
- Symbol* s = Symbol::cast(this);
- if (s->name()->IsUndefined()) {
- return SNPrintF(str, "#<%s>", s->PrivateSymbolToName());
- } else {
- return SNPrintF(str, "<%s>", String::cast(s->name())->ToCString().get());
- }
- }
+void JSObject::PrintTransitions(std::ostream& os) { // NOLINT
+ if (!map()->HasTransitionArray()) return;
+ map()->transitions()->PrintTransitions(os, false);
}
-
-
-#endif // TRACE_MAPS
+#endif // DEBUG
} } // namespace v8::internal
// Prints this object without details to a message accumulator.
void ShortPrint(StringStream* accumulator);
+ void ShortPrint(std::ostream& os); // NOLINT
+
DECLARE_CAST(Object)
// Layout description.
// Prints this object with details.
void Print(std::ostream& os); // NOLINT
+#else
+ void Print() { ShortPrint(); }
+ void Print(std::ostream& os) { ShortPrint(os); } // NOLINT
#endif
private:
#ifdef OBJECT_PRINT
void PrintProperties(std::ostream& os); // NOLINT
void PrintElements(std::ostream& os); // NOLINT
+#endif
+#ifdef DEBUG
void PrintTransitions(std::ostream& os); // NOLINT
#endif
static const int kDescriptorValue = 2;
static const int kDescriptorSize = 3;
-#ifdef OBJECT_PRINT
+#ifdef DEBUG
// For our gdb macros, we should perhaps change these in the future.
void Print();
// Print all the descriptors.
void PrintDescriptors(std::ostream& os); // NOLINT
-#endif
-#ifdef DEBUG
// Is the descriptor array sorted and without duplicates?
bool IsSortedNoDuplicates(int valid_descriptors = -1);
// Dispatched behavior.
void StringShortPrint(StringStream* accumulator);
void PrintUC16(std::ostream& os, int start = 0, int end = -1); // NOLINT
-#ifdef OBJECT_PRINT
+#ifdef DEBUG
char* ToAsciiArray();
#endif
DECLARE_PRINTER(String)