Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1806)

Unified Diff: src/objects-printer.cc

Issue 363323003: More OStreamsUse OStreams more often. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased and polished. Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects-inl.h ('k') | src/ostreams.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects-printer.cc
diff --git a/src/objects-printer.cc b/src/objects-printer.cc
index 5d9c517f4d243d528b8e7e11b012ef4983cabfcc..dace8d10744d5310f3a01a147563dea467695e9f 100644
--- a/src/objects-printer.cc
+++ b/src/objects-printer.cc
@@ -15,206 +15,196 @@ namespace internal {
#ifdef OBJECT_PRINT
void Object::Print() {
- Print(stdout);
+ OFStream os(stdout);
+ this->Print(os);
+ os << flush;
}
-void Object::Print(FILE* out) {
+void Object::Print(OStream& os) { // NOLINT
if (IsSmi()) {
- Smi::cast(this)->SmiPrint(out);
+ Smi::cast(this)->SmiPrint(os);
} else {
- HeapObject::cast(this)->HeapObjectPrint(out);
+ HeapObject::cast(this)->HeapObjectPrint(os);
}
- Flush(out);
}
-void Object::PrintLn() {
- PrintLn(stdout);
+void HeapObject::PrintHeader(OStream& os, const char* id) { // NOLINT
+ os << "" << reinterpret_cast<void*>(this) << ": [" << id << "]\n";
}
-void Object::PrintLn(FILE* out) {
- Print(out);
- PrintF(out, "\n");
-}
-
-
-void HeapObject::PrintHeader(FILE* out, const char* id) {
- PrintF(out, "%p: [%s]\n", reinterpret_cast<void*>(this), id);
-}
-
-
-void HeapObject::HeapObjectPrint(FILE* out) {
+void HeapObject::HeapObjectPrint(OStream& os) { // NOLINT
InstanceType instance_type = map()->instance_type();
HandleScope scope(GetIsolate());
if (instance_type < FIRST_NONSTRING_TYPE) {
- String::cast(this)->StringPrint(out);
+ String::cast(this)->StringPrint(os);
return;
}
switch (instance_type) {
case SYMBOL_TYPE:
- Symbol::cast(this)->SymbolPrint(out);
+ Symbol::cast(this)->SymbolPrint(os);
break;
case MAP_TYPE:
- Map::cast(this)->MapPrint(out);
+ Map::cast(this)->MapPrint(os);
break;
case HEAP_NUMBER_TYPE:
- HeapNumber::cast(this)->HeapNumberPrint(out);
+ HeapNumber::cast(this)->HeapNumberPrint(os);
break;
case MUTABLE_HEAP_NUMBER_TYPE:
- PrintF(out, "<mutable ");
- HeapNumber::cast(this)->HeapNumberPrint(out);
- PrintF(out, ">");
+ os << "<mutable ";
+ HeapNumber::cast(this)->HeapNumberPrint(os);
+ os << ">";
break;
case FIXED_DOUBLE_ARRAY_TYPE:
- FixedDoubleArray::cast(this)->FixedDoubleArrayPrint(out);
+ FixedDoubleArray::cast(this)->FixedDoubleArrayPrint(os);
break;
case CONSTANT_POOL_ARRAY_TYPE:
- ConstantPoolArray::cast(this)->ConstantPoolArrayPrint(out);
+ ConstantPoolArray::cast(this)->ConstantPoolArrayPrint(os);
break;
case FIXED_ARRAY_TYPE:
- FixedArray::cast(this)->FixedArrayPrint(out);
+ FixedArray::cast(this)->FixedArrayPrint(os);
break;
case BYTE_ARRAY_TYPE:
- ByteArray::cast(this)->ByteArrayPrint(out);
+ ByteArray::cast(this)->ByteArrayPrint(os);
break;
case FREE_SPACE_TYPE:
- FreeSpace::cast(this)->FreeSpacePrint(out);
+ FreeSpace::cast(this)->FreeSpacePrint(os);
break;
-#define PRINT_EXTERNAL_ARRAY(Type, type, TYPE, ctype, size) \
- case EXTERNAL_##TYPE##_ARRAY_TYPE: \
- External##Type##Array::cast(this)->External##Type##ArrayPrint(out); \
- break;
+#define PRINT_EXTERNAL_ARRAY(Type, type, TYPE, ctype, size) \
+ case EXTERNAL_##TYPE##_ARRAY_TYPE: \
+ External##Type##Array::cast(this)->External##Type##ArrayPrint(os); \
+ break;
TYPED_ARRAYS(PRINT_EXTERNAL_ARRAY)
#undef PRINT_EXTERNAL_ARRAY
-#define PRINT_FIXED_TYPED_ARRAY(Type, type, TYPE, ctype, size) \
- case Fixed##Type##Array::kInstanceType: \
- Fixed##Type##Array::cast(this)->FixedTypedArrayPrint(out); \
- break;
+#define PRINT_FIXED_TYPED_ARRAY(Type, type, TYPE, ctype, size) \
+ case Fixed##Type##Array::kInstanceType: \
+ Fixed##Type##Array::cast(this)->FixedTypedArrayPrint(os); \
+ break;
TYPED_ARRAYS(PRINT_FIXED_TYPED_ARRAY)
#undef PRINT_FIXED_TYPED_ARRAY
case FILLER_TYPE:
- PrintF(out, "filler");
+ os << "filler";
break;
case JS_OBJECT_TYPE: // fall through
case JS_CONTEXT_EXTENSION_OBJECT_TYPE:
case JS_ARRAY_TYPE:
case JS_GENERATOR_OBJECT_TYPE:
case JS_REGEXP_TYPE:
- JSObject::cast(this)->JSObjectPrint(out);
+ JSObject::cast(this)->JSObjectPrint(os);
break;
case ODDBALL_TYPE:
- Oddball::cast(this)->to_string()->Print(out);
+ Oddball::cast(this)->to_string()->Print(os);
break;
case JS_MODULE_TYPE:
- JSModule::cast(this)->JSModulePrint(out);
+ JSModule::cast(this)->JSModulePrint(os);
break;
case JS_FUNCTION_TYPE:
- JSFunction::cast(this)->JSFunctionPrint(out);
+ JSFunction::cast(this)->JSFunctionPrint(os);
break;
case JS_GLOBAL_PROXY_TYPE:
- JSGlobalProxy::cast(this)->JSGlobalProxyPrint(out);
+ JSGlobalProxy::cast(this)->JSGlobalProxyPrint(os);
break;
case JS_GLOBAL_OBJECT_TYPE:
- JSGlobalObject::cast(this)->JSGlobalObjectPrint(out);
+ JSGlobalObject::cast(this)->JSGlobalObjectPrint(os);
break;
case JS_BUILTINS_OBJECT_TYPE:
- JSBuiltinsObject::cast(this)->JSBuiltinsObjectPrint(out);
+ JSBuiltinsObject::cast(this)->JSBuiltinsObjectPrint(os);
break;
case JS_VALUE_TYPE:
- PrintF(out, "Value wrapper around:");
- JSValue::cast(this)->value()->Print(out);
+ os << "Value wrapper around:";
+ JSValue::cast(this)->value()->Print(os);
break;
case JS_DATE_TYPE:
- JSDate::cast(this)->JSDatePrint(out);
+ JSDate::cast(this)->JSDatePrint(os);
break;
case CODE_TYPE:
- Code::cast(this)->CodePrint(out);
+ Code::cast(this)->CodePrint(os);
break;
case JS_PROXY_TYPE:
- JSProxy::cast(this)->JSProxyPrint(out);
+ JSProxy::cast(this)->JSProxyPrint(os);
break;
case JS_FUNCTION_PROXY_TYPE:
- JSFunctionProxy::cast(this)->JSFunctionProxyPrint(out);
+ JSFunctionProxy::cast(this)->JSFunctionProxyPrint(os);
break;
case JS_SET_TYPE:
- JSSet::cast(this)->JSSetPrint(out);
+ JSSet::cast(this)->JSSetPrint(os);
break;
case JS_MAP_TYPE:
- JSMap::cast(this)->JSMapPrint(out);
+ JSMap::cast(this)->JSMapPrint(os);
break;
case JS_SET_ITERATOR_TYPE:
- JSSetIterator::cast(this)->JSSetIteratorPrint(out);
+ JSSetIterator::cast(this)->JSSetIteratorPrint(os);
break;
case JS_MAP_ITERATOR_TYPE:
- JSMapIterator::cast(this)->JSMapIteratorPrint(out);
+ JSMapIterator::cast(this)->JSMapIteratorPrint(os);
break;
case JS_WEAK_MAP_TYPE:
- JSWeakMap::cast(this)->JSWeakMapPrint(out);
+ JSWeakMap::cast(this)->JSWeakMapPrint(os);
break;
case JS_WEAK_SET_TYPE:
- JSWeakSet::cast(this)->JSWeakSetPrint(out);
+ JSWeakSet::cast(this)->JSWeakSetPrint(os);
break;
case FOREIGN_TYPE:
- Foreign::cast(this)->ForeignPrint(out);
+ Foreign::cast(this)->ForeignPrint(os);
break;
case SHARED_FUNCTION_INFO_TYPE:
- SharedFunctionInfo::cast(this)->SharedFunctionInfoPrint(out);
+ SharedFunctionInfo::cast(this)->SharedFunctionInfoPrint(os);
break;
case JS_MESSAGE_OBJECT_TYPE:
- JSMessageObject::cast(this)->JSMessageObjectPrint(out);
+ JSMessageObject::cast(this)->JSMessageObjectPrint(os);
break;
case CELL_TYPE:
- Cell::cast(this)->CellPrint(out);
+ Cell::cast(this)->CellPrint(os);
break;
case PROPERTY_CELL_TYPE:
- PropertyCell::cast(this)->PropertyCellPrint(out);
+ PropertyCell::cast(this)->PropertyCellPrint(os);
break;
case JS_ARRAY_BUFFER_TYPE:
- JSArrayBuffer::cast(this)->JSArrayBufferPrint(out);
+ JSArrayBuffer::cast(this)->JSArrayBufferPrint(os);
break;
case JS_TYPED_ARRAY_TYPE:
- JSTypedArray::cast(this)->JSTypedArrayPrint(out);
+ JSTypedArray::cast(this)->JSTypedArrayPrint(os);
break;
case JS_DATA_VIEW_TYPE:
- JSDataView::cast(this)->JSDataViewPrint(out);
+ JSDataView::cast(this)->JSDataViewPrint(os);
break;
#define MAKE_STRUCT_CASE(NAME, Name, name) \
case NAME##_TYPE: \
- Name::cast(this)->Name##Print(out); \
+ Name::cast(this)->Name##Print(os); \
break;
STRUCT_LIST(MAKE_STRUCT_CASE)
#undef MAKE_STRUCT_CASE
default:
- PrintF(out, "UNKNOWN TYPE %d", map()->instance_type());
+ os << "UNKNOWN TYPE " << map()->instance_type();
UNREACHABLE();
break;
}
}
-void ByteArray::ByteArrayPrint(FILE* out) {
- PrintF(out, "byte array, data starts at %p", GetDataStartAddress());
+void ByteArray::ByteArrayPrint(OStream& os) { // NOLINT
+ os << "byte array, data starts at " << GetDataStartAddress();
}
-void FreeSpace::FreeSpacePrint(FILE* out) {
- PrintF(out, "free space, size %d", Size());
+void FreeSpace::FreeSpacePrint(OStream& os) { // NOLINT
+ os << "free space, size " << Size();
}
-#define EXTERNAL_ARRAY_PRINTER(Type, type, TYPE, ctype, size) \
- void External##Type##Array::External##Type##ArrayPrint(FILE* out) { \
- PrintF(out, "external " #type " array"); \
+#define EXTERNAL_ARRAY_PRINTER(Type, type, TYPE, ctype, size) \
+ void External##Type##Array::External##Type##ArrayPrint(OStream& os) { \
+ os << "external " #type " array"; \
}
TYPED_ARRAYS(EXTERNAL_ARRAY_PRINTER)
@@ -223,32 +213,30 @@ TYPED_ARRAYS(EXTERNAL_ARRAY_PRINTER)
template <class Traits>
-void FixedTypedArray<Traits>::FixedTypedArrayPrint(FILE* out) {
- PrintF(out, "fixed %s", Traits::Designator());
+void FixedTypedArray<Traits>::FixedTypedArrayPrint(OStream& os) { // NOLINT
+ os << "fixed " << Traits::Designator();
}
-void JSObject::PrintProperties(FILE* out) {
+void JSObject::PrintProperties(OStream& os) { // NOLINT
if (HasFastProperties()) {
DescriptorArray* descs = map()->instance_descriptors();
for (int i = 0; i < map()->NumberOfOwnDescriptors(); i++) {
- PrintF(out, " ");
- descs->GetKey(i)->NamePrint(out);
- PrintF(out, ": ");
+ os << " ";
+ descs->GetKey(i)->NamePrint(os);
+ os << ": ";
switch (descs->GetType(i)) {
case FIELD: {
FieldIndex index = FieldIndex::ForDescriptor(map(), i);
- RawFastPropertyAt(index)->ShortPrint(out);
- PrintF(out, " (field at offset %d)\n", index.property_index());
+ os << Brief(RawFastPropertyAt(index)) << " (field at offset "
+ << index.property_index() << ")\n";
break;
}
case CONSTANT:
- descs->GetConstant(i)->ShortPrint(out);
- PrintF(out, " (constant)\n");
+ os << Brief(descs->GetConstant(i)) << " (constant)\n";
break;
case CALLBACKS:
- descs->GetCallbacksObject(i)->ShortPrint(out);
- PrintF(out, " (callback)\n");
+ os << Brief(descs->GetCallbacksObject(i)) << " (callback)\n";
break;
case NORMAL: // only in slow mode
case HANDLER: // only in lookup results, not in descriptors
@@ -260,30 +248,21 @@ void JSObject::PrintProperties(FILE* out) {
}
}
} else {
- property_dictionary()->Print(out);
+ property_dictionary()->Print(os);
}
}
-template<class T>
-static void DoPrintElements(FILE *out, Object* object) {
+template <class T>
+static void DoPrintElements(OStream& os, Object* object) { // NOLINT
T* p = T::cast(object);
for (int i = 0; i < p->length(); i++) {
- PrintF(out, " %d: %d\n", i, p->get_scalar(i));
+ os << " " << i << ": " << p->get_scalar(i) << "\n";
}
}
-template<class T>
-static void DoPrintDoubleElements(FILE* out, Object* object) {
- T* p = T::cast(object);
- for (int i = 0; i < p->length(); i++) {
- PrintF(out, " %d: %f\n", i, p->get_scalar(i));
- }
-}
-
-
-void JSObject::PrintElements(FILE* out) {
+void JSObject::PrintElements(OStream& os) { // NOLINT
// Don't call GetElementsKind, its validation code can cause the printer to
// fail when debugging.
switch (map()->elements_kind()) {
@@ -294,9 +273,7 @@ void JSObject::PrintElements(FILE* out) {
// Print in array notation for non-sparse arrays.
FixedArray* p = FixedArray::cast(elements());
for (int i = 0; i < p->length(); i++) {
- PrintF(out, " %d: ", i);
- p->get(i)->ShortPrint(out);
- PrintF(out, "\n");
+ os << " " << i << ": " << Brief(p->get(i)) << "\n";
}
break;
}
@@ -306,29 +283,24 @@ void JSObject::PrintElements(FILE* out) {
if (elements()->length() > 0) {
FixedDoubleArray* p = FixedDoubleArray::cast(elements());
for (int i = 0; i < p->length(); i++) {
+ os << " " << i << ": ";
if (p->is_the_hole(i)) {
- PrintF(out, " %d: <the hole>", i);
+ os << "<the hole>";
} else {
- PrintF(out, " %d: %g", i, p->get_scalar(i));
+ os << p->get_scalar(i);
}
- PrintF(out, "\n");
+ os << "\n";
}
}
break;
}
-#define PRINT_ELEMENTS(Kind, Type) \
- case Kind: { \
- DoPrintElements<Type>(out, elements()); \
- break; \
- }
-
-#define PRINT_DOUBLE_ELEMENTS(Kind, Type) \
- case Kind: { \
- DoPrintDoubleElements<Type>(out, elements()); \
- break; \
- }
+#define PRINT_ELEMENTS(Kind, Type) \
+ case Kind: { \
+ DoPrintElements<Type>(os, elements()); \
+ break; \
+ }
PRINT_ELEMENTS(EXTERNAL_UINT8_CLAMPED_ELEMENTS, ExternalUint8ClampedArray)
PRINT_ELEMENTS(EXTERNAL_INT8_ELEMENTS, ExternalInt8Array)
@@ -340,9 +312,8 @@ void JSObject::PrintElements(FILE* out) {
PRINT_ELEMENTS(EXTERNAL_INT32_ELEMENTS, ExternalInt32Array)
PRINT_ELEMENTS(EXTERNAL_UINT32_ELEMENTS,
ExternalUint32Array)
- PRINT_DOUBLE_ELEMENTS(EXTERNAL_FLOAT32_ELEMENTS, ExternalFloat32Array)
- PRINT_DOUBLE_ELEMENTS(EXTERNAL_FLOAT64_ELEMENTS, ExternalFloat64Array)
-
+ PRINT_ELEMENTS(EXTERNAL_FLOAT32_ELEMENTS, ExternalFloat32Array)
+ PRINT_ELEMENTS(EXTERNAL_FLOAT64_ELEMENTS, ExternalFloat64Array)
PRINT_ELEMENTS(UINT8_ELEMENTS, FixedUint8Array)
PRINT_ELEMENTS(UINT8_CLAMPED_ELEMENTS, FixedUint8ClampedArray)
@@ -351,60 +322,55 @@ void JSObject::PrintElements(FILE* out) {
PRINT_ELEMENTS(INT16_ELEMENTS, FixedInt16Array)
PRINT_ELEMENTS(UINT32_ELEMENTS, FixedUint32Array)
PRINT_ELEMENTS(INT32_ELEMENTS, FixedInt32Array)
- PRINT_DOUBLE_ELEMENTS(FLOAT32_ELEMENTS, FixedFloat32Array)
- PRINT_DOUBLE_ELEMENTS(FLOAT64_ELEMENTS, FixedFloat64Array)
+ PRINT_ELEMENTS(FLOAT32_ELEMENTS, FixedFloat32Array)
+ PRINT_ELEMENTS(FLOAT64_ELEMENTS, FixedFloat64Array)
-#undef PRINT_DOUBLE_ELEMENTS
#undef PRINT_ELEMENTS
case DICTIONARY_ELEMENTS:
- elements()->Print(out);
+ elements()->Print(os);
break;
case SLOPPY_ARGUMENTS_ELEMENTS: {
FixedArray* p = FixedArray::cast(elements());
- PrintF(out, " parameter map:");
+ os << " parameter map:";
for (int i = 2; i < p->length(); i++) {
- PrintF(out, " %d:", i - 2);
- p->get(i)->ShortPrint(out);
+ os << " " << (i - 2) << ":" << Brief(p->get(i));
}
- PrintF(out, "\n context: ");
- p->get(0)->ShortPrint(out);
- PrintF(out, "\n arguments: ");
- p->get(1)->ShortPrint(out);
- PrintF(out, "\n");
+ os << "\n context: " << Brief(p->get(0))
+ << "\n arguments: " << Brief(p->get(1)) << "\n";
break;
}
}
}
-void JSObject::PrintTransitions(FILE* out) {
+void JSObject::PrintTransitions(OStream& os) { // NOLINT
if (!map()->HasTransitionArray()) return;
TransitionArray* transitions = map()->transitions();
for (int i = 0; i < transitions->number_of_transitions(); i++) {
Name* key = transitions->GetKey(i);
- PrintF(out, " ");
- key->NamePrint(out);
- PrintF(out, ": ");
+ os << " ";
+ key->NamePrint(os);
+ os << ": ";
if (key == GetHeap()->frozen_symbol()) {
- PrintF(out, " (transition to frozen)\n");
+ os << " (transition to frozen)\n";
} else if (key == GetHeap()->elements_transition_symbol()) {
- PrintF(out, " (transition to ");
- PrintElementsKind(out, transitions->GetTarget(i)->elements_kind());
- PrintF(out, ")\n");
+ os << " (transition to "
+ << ElementsKindToString(transitions->GetTarget(i)->elements_kind())
+ << ")\n";
} else if (key == GetHeap()->observed_symbol()) {
- PrintF(out, " (transition to Object.observe)\n");
+ os << " (transition to Object.observe)\n";
} else {
switch (transitions->GetTargetDetails(i).type()) {
case FIELD: {
- PrintF(out, " (transition to field)\n");
+ os << " (transition to field)\n";
break;
}
case CONSTANT:
- PrintF(out, " (transition to constant)\n");
+ os << " (transition to constant)\n";
break;
case CALLBACKS:
- PrintF(out, " (transition to callback)\n");
+ os << " (transition to callback)\n";
break;
// Values below are never in the target descriptor array.
case NORMAL:
@@ -419,35 +385,31 @@ void JSObject::PrintTransitions(FILE* out) {
}
-void JSObject::JSObjectPrint(FILE* out) {
- HeapObject::PrintHeader(out, "JSObject");
- PrintF(out, " - map = %p [", reinterpret_cast<void*>(map()));
+void JSObject::JSObjectPrint(OStream& os) { // NOLINT
+ HeapObject::PrintHeader(os, "JSObject");
// Don't call GetElementsKind, its validation code can cause the printer to
// fail when debugging.
- PrintElementsKind(out, this->map()->elements_kind());
- PrintF(out,
- "]\n - prototype = %p\n",
- reinterpret_cast<void*>(GetPrototype()));
- PrintF(out, " {\n");
- PrintProperties(out);
- PrintTransitions(out);
- PrintElements(out);
- PrintF(out, " }\n");
+ os << " - map = " << reinterpret_cast<void*>(map()) << " ["
+ << ElementsKindToString(this->map()->elements_kind())
+ << "]\n - prototype = " << reinterpret_cast<void*>(GetPrototype()) << "\n"
+ << " {\n";
+ PrintProperties(os);
+ PrintTransitions(os);
+ PrintElements(os);
+ os << " }\n";
}
-void JSModule::JSModulePrint(FILE* out) {
- HeapObject::PrintHeader(out, "JSModule");
- PrintF(out, " - map = %p\n", reinterpret_cast<void*>(map()));
- PrintF(out, " - context = ");
- context()->Print(out);
- PrintF(out, " - scope_info = ");
- scope_info()->ShortPrint(out);
- PrintElementsKind(out, this->map()->elements_kind());
- PrintF(out, " {\n");
- PrintProperties(out);
- PrintElements(out);
- PrintF(out, " }\n");
+void JSModule::JSModulePrint(OStream& os) { // NOLINT
+ HeapObject::PrintHeader(os, "JSModule");
+ os << " - map = " << reinterpret_cast<void*>(map()) << "\n"
+ << " - context = ";
+ context()->Print(os);
+ os << " - scope_info = " << Brief(scope_info())
+ << ElementsKindToString(this->map()->elements_kind()) << " {\n";
+ PrintProperties(os);
+ PrintElements(os);
+ os << " }\n";
}
@@ -462,191 +424,163 @@ static const char* TypeToString(InstanceType type) {
}
-void Symbol::SymbolPrint(FILE* out) {
- HeapObject::PrintHeader(out, "Symbol");
- PrintF(out, " - hash: %d\n", Hash());
- PrintF(out, " - name: ");
- name()->ShortPrint();
- PrintF(out, " - private: %d\n", is_private());
- PrintF(out, "\n");
+void Symbol::SymbolPrint(OStream& os) { // NOLINT
+ HeapObject::PrintHeader(os, "Symbol");
+ os << " - hash: " << Hash();
+ os << "\n - name: " << Brief(name());
+ os << " - private: " << is_private();
+ os << "\n";
}
-void Map::MapPrint(FILE* out) {
- HeapObject::PrintHeader(out, "Map");
- PrintF(out, " - type: %s\n", TypeToString(instance_type()));
- PrintF(out, " - instance size: %d\n", instance_size());
- PrintF(out, " - inobject properties: %d\n", inobject_properties());
- PrintF(out, " - elements kind: ");
- PrintElementsKind(out, elements_kind());
- PrintF(out, "\n - pre-allocated property fields: %d\n",
- pre_allocated_property_fields());
- PrintF(out, " - unused property fields: %d\n", unused_property_fields());
- if (is_hidden_prototype()) {
- PrintF(out, " - hidden_prototype\n");
- }
- if (has_named_interceptor()) {
- PrintF(out, " - named_interceptor\n");
- }
- if (has_indexed_interceptor()) {
- PrintF(out, " - indexed_interceptor\n");
- }
- if (is_undetectable()) {
- PrintF(out, " - undetectable\n");
- }
- if (has_instance_call_handler()) {
- PrintF(out, " - instance_call_handler\n");
- }
- if (is_access_check_needed()) {
- PrintF(out, " - access_check_needed\n");
- }
+void Map::MapPrint(OStream& os) { // NOLINT
+ HeapObject::PrintHeader(os, "Map");
+ os << " - type: " << TypeToString(instance_type()) << "\n";
+ os << " - instance size: " << instance_size() << "\n";
+ os << " - inobject properties: " << inobject_properties() << "\n";
+ os << " - elements kind: " << ElementsKindToString(elements_kind());
+ os << "\n - pre-allocated property fields: "
+ << pre_allocated_property_fields() << "\n";
+ os << " - unused property fields: " << unused_property_fields() << "\n";
+ if (is_hidden_prototype()) os << " - hidden_prototype\n";
+ if (has_named_interceptor()) os << " - named_interceptor\n";
+ if (has_indexed_interceptor()) os << " - indexed_interceptor\n";
+ if (is_undetectable()) os << " - undetectable\n";
+ if (has_instance_call_handler()) os << " - instance_call_handler\n";
+ if (is_access_check_needed()) os << " - access_check_needed\n";
if (is_frozen()) {
- PrintF(out, " - frozen\n");
+ os << " - frozen\n";
} else if (!is_extensible()) {
- PrintF(out, " - sealed\n");
+ os << " - sealed\n";
}
- PrintF(out, " - back pointer: ");
- GetBackPointer()->ShortPrint(out);
- PrintF(out, "\n - instance descriptors %s#%i: ",
- owns_descriptors() ? "(own) " : "",
- NumberOfOwnDescriptors());
- instance_descriptors()->ShortPrint(out);
+ os << " - back pointer: " << Brief(GetBackPointer());
+ os << "\n - instance descriptors " << (owns_descriptors() ? "(own) " : "")
+ << "#" << NumberOfOwnDescriptors() << ": "
+ << Brief(instance_descriptors());
if (HasTransitionArray()) {
- PrintF(out, "\n - transitions: ");
- transitions()->ShortPrint(out);
+ os << "\n - transitions: " << Brief(transitions());
}
- PrintF(out, "\n - prototype: ");
- prototype()->ShortPrint(out);
- PrintF(out, "\n - constructor: ");
- constructor()->ShortPrint(out);
- PrintF(out, "\n - code cache: ");
- code_cache()->ShortPrint(out);
- PrintF(out, "\n - dependent code: ");
- dependent_code()->ShortPrint(out);
- PrintF(out, "\n");
+ os << "\n - prototype: " << Brief(prototype());
+ os << "\n - constructor: " << Brief(constructor());
+ os << "\n - code cache: " << Brief(code_cache());
+ os << "\n - dependent code: " << Brief(dependent_code());
+ os << "\n";
}
-void CodeCache::CodeCachePrint(FILE* out) {
- HeapObject::PrintHeader(out, "CodeCache");
- PrintF(out, "\n - default_cache: ");
- default_cache()->ShortPrint(out);
- PrintF(out, "\n - normal_type_cache: ");
- normal_type_cache()->ShortPrint(out);
+void CodeCache::CodeCachePrint(OStream& os) { // NOLINT
+ HeapObject::PrintHeader(os, "CodeCache");
+ os << "\n - default_cache: " << Brief(default_cache());
+ os << "\n - normal_type_cache: " << Brief(normal_type_cache());
}
-void PolymorphicCodeCache::PolymorphicCodeCachePrint(FILE* out) {
- HeapObject::PrintHeader(out, "PolymorphicCodeCache");
- PrintF(out, "\n - cache: ");
- cache()->ShortPrint(out);
+void PolymorphicCodeCache::PolymorphicCodeCachePrint(OStream& os) { // NOLINT
+ HeapObject::PrintHeader(os, "PolymorphicCodeCache");
+ os << "\n - cache: " << Brief(cache());
}
-void TypeFeedbackInfo::TypeFeedbackInfoPrint(FILE* out) {
- HeapObject::PrintHeader(out, "TypeFeedbackInfo");
- PrintF(out, " - ic_total_count: %d, ic_with_type_info_count: %d\n",
- ic_total_count(), ic_with_type_info_count());
+void TypeFeedbackInfo::TypeFeedbackInfoPrint(OStream& os) { // NOLINT
+ HeapObject::PrintHeader(os, "TypeFeedbackInfo");
+ os << " - ic_total_count: " << ic_total_count()
+ << ", ic_with_type_info_count: " << ic_with_type_info_count() << "\n";
}
-void AliasedArgumentsEntry::AliasedArgumentsEntryPrint(FILE* out) {
- HeapObject::PrintHeader(out, "AliasedArgumentsEntry");
- PrintF(out, "\n - aliased_context_slot: %d", aliased_context_slot());
+void AliasedArgumentsEntry::AliasedArgumentsEntryPrint(OStream& os) { // NOLINT
+ HeapObject::PrintHeader(os, "AliasedArgumentsEntry");
+ os << "\n - aliased_context_slot: " << aliased_context_slot();
}
-void FixedArray::FixedArrayPrint(FILE* out) {
- HeapObject::PrintHeader(out, "FixedArray");
- PrintF(out, " - length: %d", length());
+void FixedArray::FixedArrayPrint(OStream& os) { // NOLINT
+ HeapObject::PrintHeader(os, "FixedArray");
+ os << " - length: " << length();
for (int i = 0; i < length(); i++) {
- PrintF(out, "\n [%d]: ", i);
- get(i)->ShortPrint(out);
+ os << "\n [" << i << "]: " << Brief(get(i));
}
- PrintF(out, "\n");
+ os << "\n";
}
-void FixedDoubleArray::FixedDoubleArrayPrint(FILE* out) {
- HeapObject::PrintHeader(out, "FixedDoubleArray");
- PrintF(out, " - length: %d", length());
+void FixedDoubleArray::FixedDoubleArrayPrint(OStream& os) { // NOLINT
+ HeapObject::PrintHeader(os, "FixedDoubleArray");
+ os << " - length: " << length();
for (int i = 0; i < length(); i++) {
+ os << "\n [" << i << "]: ";
if (is_the_hole(i)) {
- PrintF(out, "\n [%d]: <the hole>", i);
+ os << "<the hole>";
} else {
- PrintF(out, "\n [%d]: %g", i, get_scalar(i));
+ os << get_scalar(i);
}
}
- PrintF(out, "\n");
+ os << "\n";
}
-void ConstantPoolArray::ConstantPoolArrayPrint(FILE* out) {
- HeapObject::PrintHeader(out, "ConstantPoolArray");
- PrintF(out, " - length: %d", length());
+void ConstantPoolArray::ConstantPoolArrayPrint(OStream& os) { // NOLINT
+ HeapObject::PrintHeader(os, "ConstantPoolArray");
+ os << " - length: " << length();
for (int i = 0; i <= last_index(INT32, SMALL_SECTION); i++) {
if (i < last_index(INT64, SMALL_SECTION)) {
- PrintF(out, "\n [%d]: double: %g", i, get_int64_entry_as_double(i));
+ os << "\n [" << i << "]: double: " << get_int64_entry_as_double(i);
} else if (i <= last_index(CODE_PTR, SMALL_SECTION)) {
- PrintF(out, "\n [%d]: code target pointer: %p", i,
- reinterpret_cast<void*>(get_code_ptr_entry(i)));
+ os << "\n [" << i << "]: code target pointer: "
+ << reinterpret_cast<void*>(get_code_ptr_entry(i));
} else if (i <= last_index(HEAP_PTR, SMALL_SECTION)) {
- PrintF(out, "\n [%d]: heap pointer: %p", i,
- reinterpret_cast<void*>(get_heap_ptr_entry(i)));
+ os << "\n [" << i << "]: heap pointer: "
+ << reinterpret_cast<void*>(get_heap_ptr_entry(i));
} else if (i <= last_index(INT32, SMALL_SECTION)) {
- PrintF(out, "\n [%d]: int32: %d", i, get_int32_entry(i));
+ os << "\n [" << i << "]: int32: " << get_int32_entry(i);
}
}
if (is_extended_layout()) {
- PrintF(out, "\n Extended section:");
+ os << "\n Extended section:";
for (int i = first_extended_section_index();
i <= last_index(INT32, EXTENDED_SECTION); i++) {
- if (i < last_index(INT64, EXTENDED_SECTION)) {
- PrintF(out, "\n [%d]: double: %g", i, get_int64_entry_as_double(i));
- } else if (i <= last_index(CODE_PTR, EXTENDED_SECTION)) {
- PrintF(out, "\n [%d]: code target pointer: %p", i,
- reinterpret_cast<void*>(get_code_ptr_entry(i)));
- } else if (i <= last_index(HEAP_PTR, EXTENDED_SECTION)) {
- PrintF(out, "\n [%d]: heap pointer: %p", i,
- reinterpret_cast<void*>(get_heap_ptr_entry(i)));
- } else if (i <= last_index(INT32, EXTENDED_SECTION)) {
- PrintF(out, "\n [%d]: int32: %d", i, get_int32_entry(i));
+ if (i < last_index(INT64, EXTENDED_SECTION)) {
+ os << "\n [" << i << "]: double: " << get_int64_entry_as_double(i);
+ } else if (i <= last_index(CODE_PTR, EXTENDED_SECTION)) {
+ os << "\n [" << i << "]: code target pointer: "
+ << reinterpret_cast<void*>(get_code_ptr_entry(i));
+ } else if (i <= last_index(HEAP_PTR, EXTENDED_SECTION)) {
+ os << "\n [" << i << "]: heap pointer: "
+ << reinterpret_cast<void*>(get_heap_ptr_entry(i));
+ } else if (i <= last_index(INT32, EXTENDED_SECTION)) {
+ os << "\n [" << i << "]: int32: " << get_int32_entry(i);
+ }
}
}
- }
- PrintF(out, "\n");
+ os << "\n";
}
-void JSValue::JSValuePrint(FILE* out) {
- HeapObject::PrintHeader(out, "ValueObject");
- value()->Print(out);
+void JSValue::JSValuePrint(OStream& os) { // NOLINT
+ HeapObject::PrintHeader(os, "ValueObject");
+ value()->Print(os);
}
-void JSMessageObject::JSMessageObjectPrint(FILE* out) {
- HeapObject::PrintHeader(out, "JSMessageObject");
- PrintF(out, " - type: ");
- type()->ShortPrint(out);
- PrintF(out, "\n - arguments: ");
- arguments()->ShortPrint(out);
- PrintF(out, "\n - start_position: %d", start_position());
- PrintF(out, "\n - end_position: %d", end_position());
- PrintF(out, "\n - script: ");
- script()->ShortPrint(out);
- PrintF(out, "\n - stack_frames: ");
- stack_frames()->ShortPrint(out);
- PrintF(out, "\n");
+void JSMessageObject::JSMessageObjectPrint(OStream& os) { // NOLINT
+ HeapObject::PrintHeader(os, "JSMessageObject");
+ os << " - type: " << Brief(type());
+ os << "\n - arguments: " << Brief(arguments());
+ os << "\n - start_position: " << start_position();
+ os << "\n - end_position: " << end_position();
+ os << "\n - script: " << Brief(script());
+ os << "\n - stack_frames: " << Brief(stack_frames());
+ os << "\n";
}
-void String::StringPrint(FILE* out) {
+void String::StringPrint(OStream& os) { // NOLINT
if (StringShape(this).IsInternalized()) {
- PrintF(out, "#");
+ os << "#";
} else if (StringShape(this).IsCons()) {
- PrintF(out, "c\"");
+ os << "c\"";
} else {
- PrintF(out, "\"");
+ os << "\"";
}
const char truncated_epilogue[] = "...<truncated>";
@@ -657,21 +591,21 @@ void String::StringPrint(FILE* out) {
}
}
for (int i = 0; i < len; i++) {
- PrintF(out, "%c", Get(i));
+ os.put(Get(i));
}
if (len != length()) {
- PrintF(out, "%s", truncated_epilogue);
+ os << truncated_epilogue;
}
- if (!StringShape(this).IsInternalized()) PrintF(out, "\"");
+ if (!StringShape(this).IsInternalized()) os << "\"";
}
-void Name::NamePrint(FILE* out) {
+void Name::NamePrint(OStream& os) { // NOLINT
if (IsString())
- String::cast(this)->StringPrint(out);
+ String::cast(this)->StringPrint(os);
else
- ShortPrint();
+ os << Brief(this);
}
@@ -695,204 +629,181 @@ static const char* const weekdays[] = {
};
-void JSDate::JSDatePrint(FILE* out) {
- HeapObject::PrintHeader(out, "JSDate");
- PrintF(out, " - map = %p\n", reinterpret_cast<void*>(map()));
- PrintF(out, " - value = ");
- value()->Print(out);
+void JSDate::JSDatePrint(OStream& os) { // NOLINT
+ HeapObject::PrintHeader(os, "JSDate");
+ os << " - map = " << reinterpret_cast<void*>(map()) << "\n";
+ os << " - value = ";
+ value()->Print(os);
if (!year()->IsSmi()) {
- PrintF(out, " - time = NaN\n");
+ os << " - time = NaN\n";
} else {
- PrintF(out, " - time = %s %04d/%02d/%02d %02d:%02d:%02d\n",
- weekdays[weekday()->IsSmi() ? Smi::cast(weekday())->value() + 1 : 0],
- year()->IsSmi() ? Smi::cast(year())->value() : -1,
- month()->IsSmi() ? Smi::cast(month())->value() : -1,
- day()->IsSmi() ? Smi::cast(day())->value() : -1,
- hour()->IsSmi() ? Smi::cast(hour())->value() : -1,
- min()->IsSmi() ? Smi::cast(min())->value() : -1,
- sec()->IsSmi() ? Smi::cast(sec())->value() : -1);
+ // TODO(svenpanne) Add some basic formatting to our streams.
+ Vector<char> buf = Vector<char>::New(100);
+ SNPrintF(
+ buf, " - time = %s %04d/%02d/%02d %02d:%02d:%02d\n",
+ weekdays[weekday()->IsSmi() ? Smi::cast(weekday())->value() + 1 : 0],
+ year()->IsSmi() ? Smi::cast(year())->value() : -1,
+ month()->IsSmi() ? Smi::cast(month())->value() : -1,
+ day()->IsSmi() ? Smi::cast(day())->value() : -1,
+ hour()->IsSmi() ? Smi::cast(hour())->value() : -1,
+ min()->IsSmi() ? Smi::cast(min())->value() : -1,
+ sec()->IsSmi() ? Smi::cast(sec())->value() : -1);
+ os << buf.start();
}
}
-void JSProxy::JSProxyPrint(FILE* out) {
- HeapObject::PrintHeader(out, "JSProxy");
- PrintF(out, " - map = %p\n", reinterpret_cast<void*>(map()));
- PrintF(out, " - handler = ");
- handler()->Print(out);
- PrintF(out, "\n - hash = ");
- hash()->Print(out);
- PrintF(out, "\n");
+void JSProxy::JSProxyPrint(OStream& os) { // NOLINT
+ HeapObject::PrintHeader(os, "JSProxy");
+ os << " - map = " << reinterpret_cast<void*>(map()) << "\n";
+ os << " - handler = ";
+ handler()->Print(os);
+ os << "\n - hash = ";
+ hash()->Print(os);
+ os << "\n";
}
-void JSFunctionProxy::JSFunctionProxyPrint(FILE* out) {
- HeapObject::PrintHeader(out, "JSFunctionProxy");
- PrintF(out, " - map = %p\n", reinterpret_cast<void*>(map()));
- PrintF(out, " - handler = ");
- handler()->Print(out);
- PrintF(out, "\n - call_trap = ");
- call_trap()->Print(out);
- PrintF(out, "\n - construct_trap = ");
- construct_trap()->Print(out);
- PrintF(out, "\n");
+void JSFunctionProxy::JSFunctionProxyPrint(OStream& os) { // NOLINT
+ HeapObject::PrintHeader(os, "JSFunctionProxy");
+ os << " - map = " << reinterpret_cast<void*>(map()) << "\n";
+ os << " - handler = ";
+ handler()->Print(os);
+ os << "\n - call_trap = ";
+ call_trap()->Print(os);
+ os << "\n - construct_trap = ";
+ construct_trap()->Print(os);
+ os << "\n";
}
-void JSSet::JSSetPrint(FILE* out) {
- HeapObject::PrintHeader(out, "JSSet");
- PrintF(out, " - map = %p\n", reinterpret_cast<void*>(map()));
- PrintF(out, " - table = ");
- table()->ShortPrint(out);
- PrintF(out, "\n");
+void JSSet::JSSetPrint(OStream& os) { // NOLINT
+ HeapObject::PrintHeader(os, "JSSet");
+ os << " - map = " << reinterpret_cast<void*>(map()) << "\n";
+ os << " - table = " << Brief(table());
+ os << "\n";
}
-void JSMap::JSMapPrint(FILE* out) {
- HeapObject::PrintHeader(out, "JSMap");
- PrintF(out, " - map = %p\n", reinterpret_cast<void*>(map()));
- PrintF(out, " - table = ");
- table()->ShortPrint(out);
- PrintF(out, "\n");
+void JSMap::JSMapPrint(OStream& os) { // NOLINT
+ HeapObject::PrintHeader(os, "JSMap");
+ os << " - map = " << reinterpret_cast<void*>(map()) << "\n";
+ os << " - table = " << Brief(table());
+ os << "\n";
}
-template<class Derived, class TableType>
-void OrderedHashTableIterator<Derived, TableType>::
- OrderedHashTableIteratorPrint(FILE* out) {
- PrintF(out, " - map = %p\n", reinterpret_cast<void*>(map()));
- PrintF(out, " - table = ");
- table()->ShortPrint(out);
- PrintF(out, "\n - index = ");
- index()->ShortPrint(out);
- PrintF(out, "\n - kind = ");
- kind()->ShortPrint(out);
- PrintF(out, "\n");
+template <class Derived, class TableType>
+void OrderedHashTableIterator<
+ Derived, TableType>::OrderedHashTableIteratorPrint(OStream& os) { // NOLINT
+ os << " - map = " << reinterpret_cast<void*>(map()) << "\n";
+ os << " - table = " << Brief(table());
+ os << "\n - index = " << Brief(index());
+ os << "\n - kind = " << Brief(kind());
+ os << "\n";
}
-template void
-OrderedHashTableIterator<JSSetIterator,
- OrderedHashSet>::OrderedHashTableIteratorPrint(FILE* out);
+template void OrderedHashTableIterator<
+ JSSetIterator,
+ OrderedHashSet>::OrderedHashTableIteratorPrint(OStream& os); // NOLINT
-template void
-OrderedHashTableIterator<JSMapIterator,
- OrderedHashMap>::OrderedHashTableIteratorPrint(FILE* out);
+template void OrderedHashTableIterator<
+ JSMapIterator,
+ OrderedHashMap>::OrderedHashTableIteratorPrint(OStream& os); // NOLINT
-void JSSetIterator::JSSetIteratorPrint(FILE* out) {
- HeapObject::PrintHeader(out, "JSSetIterator");
- OrderedHashTableIteratorPrint(out);
+void JSSetIterator::JSSetIteratorPrint(OStream& os) { // NOLINT
+ HeapObject::PrintHeader(os, "JSSetIterator");
+ OrderedHashTableIteratorPrint(os);
}
-void JSMapIterator::JSMapIteratorPrint(FILE* out) {
- HeapObject::PrintHeader(out, "JSMapIterator");
- OrderedHashTableIteratorPrint(out);
+void JSMapIterator::JSMapIteratorPrint(OStream& os) { // NOLINT
+ HeapObject::PrintHeader(os, "JSMapIterator");
+ OrderedHashTableIteratorPrint(os);
}
-void JSWeakMap::JSWeakMapPrint(FILE* out) {
- HeapObject::PrintHeader(out, "JSWeakMap");
- PrintF(out, " - map = %p\n", reinterpret_cast<void*>(map()));
- PrintF(out, " - table = ");
- table()->ShortPrint(out);
- PrintF(out, "\n");
+void JSWeakMap::JSWeakMapPrint(OStream& os) { // NOLINT
+ HeapObject::PrintHeader(os, "JSWeakMap");
+ os << " - map = " << reinterpret_cast<void*>(map()) << "\n";
+ os << " - table = " << Brief(table());
+ os << "\n";
}
-void JSWeakSet::JSWeakSetPrint(FILE* out) {
- HeapObject::PrintHeader(out, "JSWeakSet");
- PrintF(out, " - map = %p\n", reinterpret_cast<void*>(map()));
- PrintF(out, " - table = ");
- table()->ShortPrint(out);
- PrintF(out, "\n");
+void JSWeakSet::JSWeakSetPrint(OStream& os) { // NOLINT
+ HeapObject::PrintHeader(os, "JSWeakSet");
+ os << " - map = " << reinterpret_cast<void*>(map()) << "\n";
+ os << " - table = " << Brief(table());
+ os << "\n";
}
-void JSArrayBuffer::JSArrayBufferPrint(FILE* out) {
- HeapObject::PrintHeader(out, "JSArrayBuffer");
- PrintF(out, " - map = %p\n", reinterpret_cast<void*>(map()));
- PrintF(out, " - backing_store = %p\n", backing_store());
- PrintF(out, " - byte_length = ");
- byte_length()->ShortPrint(out);
- PrintF(out, "\n");
+void JSArrayBuffer::JSArrayBufferPrint(OStream& os) { // NOLINT
+ HeapObject::PrintHeader(os, "JSArrayBuffer");
+ os << " - map = " << reinterpret_cast<void*>(map()) << "\n";
+ os << " - backing_store = " << backing_store() << "\n";
+ os << " - byte_length = " << Brief(byte_length());
+ os << "\n";
}
-void JSTypedArray::JSTypedArrayPrint(FILE* out) {
- HeapObject::PrintHeader(out, "JSTypedArray");
- PrintF(out, " - map = %p\n", reinterpret_cast<void*>(map()));
- PrintF(out, " - buffer =");
- buffer()->ShortPrint(out);
- PrintF(out, "\n - byte_offset = ");
- byte_offset()->ShortPrint(out);
- PrintF(out, "\n - byte_length = ");
- byte_length()->ShortPrint(out);
- PrintF(out, "\n - length = ");
- length()->ShortPrint(out);
- PrintF(out, "\n");
- PrintElements(out);
+void JSTypedArray::JSTypedArrayPrint(OStream& os) { // NOLINT
+ HeapObject::PrintHeader(os, "JSTypedArray");
+ os << " - map = " << reinterpret_cast<void*>(map()) << "\n";
+ os << " - buffer =" << Brief(buffer());
+ os << "\n - byte_offset = " << Brief(byte_offset());
+ os << "\n - byte_length = " << Brief(byte_length());
+ os << "\n - length = " << Brief(length());
+ os << "\n";
+ PrintElements(os);
}
-void JSDataView::JSDataViewPrint(FILE* out) {
- HeapObject::PrintHeader(out, "JSDataView");
- PrintF(out, " - map = %p\n", reinterpret_cast<void*>(map()));
- PrintF(out, " - buffer =");
- buffer()->ShortPrint(out);
- PrintF(out, "\n - byte_offset = ");
- byte_offset()->ShortPrint(out);
- PrintF(out, "\n - byte_length = ");
- byte_length()->ShortPrint(out);
- PrintF(out, "\n");
+void JSDataView::JSDataViewPrint(OStream& os) { // NOLINT
+ HeapObject::PrintHeader(os, "JSDataView");
+ os << " - map = " << reinterpret_cast<void*>(map()) << "\n";
+ os << " - buffer =" << Brief(buffer());
+ os << "\n - byte_offset = " << Brief(byte_offset());
+ os << "\n - byte_length = " << Brief(byte_length());
+ os << "\n";
}
-void JSFunction::JSFunctionPrint(FILE* out) {
- HeapObject::PrintHeader(out, "Function");
- PrintF(out, " - map = %p\n", reinterpret_cast<void*>(map()));
- PrintF(out, " - initial_map = ");
- if (has_initial_map()) {
- initial_map()->ShortPrint(out);
- }
- PrintF(out, "\n - shared_info = ");
- shared()->ShortPrint(out);
- PrintF(out, "\n - name = ");
- shared()->name()->Print(out);
- PrintF(out, "\n - context = ");
- context()->ShortPrint(out);
+void JSFunction::JSFunctionPrint(OStream& os) { // NOLINT
+ HeapObject::PrintHeader(os, "Function");
+ os << " - map = " << reinterpret_cast<void*>(map()) << "\n";
+ os << " - initial_map = ";
+ if (has_initial_map()) os << Brief(initial_map());
+ os << "\n - shared_info = " << Brief(shared());
+ os << "\n - name = " << Brief(shared()->name());
+ os << "\n - context = " << Brief(context());
if (shared()->bound()) {
- PrintF(out, "\n - bindings = ");
- function_bindings()->ShortPrint(out);
+ os << "\n - bindings = " << Brief(function_bindings());
} else {
- PrintF(out, "\n - literals = ");
- literals()->ShortPrint(out);
+ os << "\n - literals = " << Brief(literals());
}
- PrintF(out, "\n - code = ");
- code()->ShortPrint(out);
- PrintF(out, "\n");
-
- PrintProperties(out);
- PrintElements(out);
-
- PrintF(out, "\n");
-}
-
-
-void SharedFunctionInfo::SharedFunctionInfoPrint(FILE* out) {
- HeapObject::PrintHeader(out, "SharedFunctionInfo");
- PrintF(out, " - name: ");
- name()->ShortPrint(out);
- PrintF(out, "\n - expected_nof_properties: %d", expected_nof_properties());
- PrintF(out, "\n - ast_node_count: %d", ast_node_count());
- PrintF(out, "\n - instance class name = ");
- instance_class_name()->Print(out);
- PrintF(out, "\n - code = ");
- code()->ShortPrint(out);
+ os << "\n - code = " << Brief(code());
+ os << "\n";
+ PrintProperties(os);
+ PrintElements(os);
+ os << "\n";
+}
+
+
+void SharedFunctionInfo::SharedFunctionInfoPrint(OStream& os) { // NOLINT
+ HeapObject::PrintHeader(os, "SharedFunctionInfo");
+ os << " - name: " << Brief(name());
+ os << "\n - expected_nof_properties: " << expected_nof_properties();
+ os << "\n - ast_node_count: " << ast_node_count();
+ os << "\n - instance class name = ";
+ instance_class_name()->Print(os);
+ os << "\n - code = " << Brief(code());
if (HasSourceCode()) {
- PrintF(out, "\n - source code = ");
+ os << "\n - source code = ";
String* source = String::cast(Script::cast(script())->source());
int start = start_position();
int length = end_position() - start;
@@ -900,355 +811,293 @@ void SharedFunctionInfo::SharedFunctionInfoPrint(FILE* out) {
source->ToCString(DISALLOW_NULLS,
FAST_STRING_TRAVERSAL,
start, length, NULL);
- PrintF(out, "%s", source_string.get());
+ os << source_string.get();
}
// Script files are often large, hard to read.
- // PrintF(out, "\n - script =");
- // script()->Print(out);
- PrintF(out, "\n - function token position = %d", function_token_position());
- PrintF(out, "\n - start position = %d", start_position());
- PrintF(out, "\n - end position = %d", end_position());
- PrintF(out, "\n - is expression = %d", is_expression());
- PrintF(out, "\n - debug info = ");
- debug_info()->ShortPrint(out);
- PrintF(out, "\n - length = %d", length());
- PrintF(out, "\n - optimized_code_map = ");
- optimized_code_map()->ShortPrint(out);
- PrintF(out, "\n - feedback_vector = ");
- feedback_vector()->FixedArrayPrint(out);
- PrintF(out, "\n");
+ // os << "\n - script =";
+ // script()->Print(os);
+ os << "\n - function token position = " << function_token_position();
+ os << "\n - start position = " << start_position();
+ os << "\n - end position = " << end_position();
+ os << "\n - is expression = " << is_expression();
+ os << "\n - debug info = " << Brief(debug_info());
+ os << "\n - length = " << length();
+ os << "\n - optimized_code_map = " << Brief(optimized_code_map());
+ os << "\n - feedback_vector = ";
+ feedback_vector()->FixedArrayPrint(os);
+ os << "\n";
}
-void JSGlobalProxy::JSGlobalProxyPrint(FILE* out) {
- PrintF(out, "global_proxy ");
- JSObjectPrint(out);
- PrintF(out, "native context : ");
- native_context()->ShortPrint(out);
- PrintF(out, "\n");
+void JSGlobalProxy::JSGlobalProxyPrint(OStream& os) { // NOLINT
+ os << "global_proxy ";
+ JSObjectPrint(os);
+ os << "native context : " << Brief(native_context());
+ os << "\n";
}
-void JSGlobalObject::JSGlobalObjectPrint(FILE* out) {
- PrintF(out, "global ");
- JSObjectPrint(out);
- PrintF(out, "native context : ");
- native_context()->ShortPrint(out);
- PrintF(out, "\n");
+void JSGlobalObject::JSGlobalObjectPrint(OStream& os) { // NOLINT
+ os << "global ";
+ JSObjectPrint(os);
+ os << "native context : " << Brief(native_context());
+ os << "\n";
}
-void JSBuiltinsObject::JSBuiltinsObjectPrint(FILE* out) {
- PrintF(out, "builtins ");
- JSObjectPrint(out);
+void JSBuiltinsObject::JSBuiltinsObjectPrint(OStream& os) { // NOLINT
+ os << "builtins ";
+ JSObjectPrint(os);
}
-void Cell::CellPrint(FILE* out) {
- HeapObject::PrintHeader(out, "Cell");
+void Cell::CellPrint(OStream& os) { // NOLINT
+ HeapObject::PrintHeader(os, "Cell");
}
-void PropertyCell::PropertyCellPrint(FILE* out) {
- HeapObject::PrintHeader(out, "PropertyCell");
+void PropertyCell::PropertyCellPrint(OStream& os) { // NOLINT
+ HeapObject::PrintHeader(os, "PropertyCell");
}
-void Code::CodePrint(FILE* out) {
- HeapObject::PrintHeader(out, "Code");
+void Code::CodePrint(OStream& os) { // NOLINT
+ HeapObject::PrintHeader(os, "Code");
#ifdef ENABLE_DISASSEMBLER
if (FLAG_use_verbose_printer) {
- Disassemble(NULL, out);
+ Disassemble(NULL, os);
}
#endif
}
-void Foreign::ForeignPrint(FILE* out) {
- PrintF(out, "foreign address : %p", foreign_address());
+void Foreign::ForeignPrint(OStream& os) { // NOLINT
+ os << "foreign address : " << foreign_address();
}
-void ExecutableAccessorInfo::ExecutableAccessorInfoPrint(FILE* out) {
- HeapObject::PrintHeader(out, "ExecutableAccessorInfo");
- PrintF(out, "\n - name: ");
- name()->ShortPrint(out);
- PrintF(out, "\n - flag: ");
- flag()->ShortPrint(out);
- PrintF(out, "\n - getter: ");
- getter()->ShortPrint(out);
- PrintF(out, "\n - setter: ");
- setter()->ShortPrint(out);
- PrintF(out, "\n - data: ");
- data()->ShortPrint(out);
+void ExecutableAccessorInfo::ExecutableAccessorInfoPrint(
+ OStream& os) { // NOLINT
+ HeapObject::PrintHeader(os, "ExecutableAccessorInfo");
+ os << "\n - name: " << Brief(name());
+ os << "\n - flag: " << Brief(flag());
+ os << "\n - getter: " << Brief(getter());
+ os << "\n - setter: " << Brief(setter());
+ os << "\n - data: " << Brief(data());
+ os << "\n";
}
-void DeclaredAccessorInfo::DeclaredAccessorInfoPrint(FILE* out) {
- HeapObject::PrintHeader(out, "DeclaredAccessorInfo");
- PrintF(out, "\n - name: ");
- name()->ShortPrint(out);
- PrintF(out, "\n - flag: ");
- flag()->ShortPrint(out);
- PrintF(out, "\n - descriptor: ");
- descriptor()->ShortPrint(out);
+void DeclaredAccessorInfo::DeclaredAccessorInfoPrint(OStream& os) { // NOLINT
+ HeapObject::PrintHeader(os, "DeclaredAccessorInfo");
+ os << "\n - name: " << Brief(name());
+ os << "\n - flag: " << Brief(flag());
+ os << "\n - descriptor: " << Brief(descriptor());
+ os << "\n";
}
-void DeclaredAccessorDescriptor::DeclaredAccessorDescriptorPrint(FILE* out) {
- HeapObject::PrintHeader(out, "DeclaredAccessorDescriptor");
- PrintF(out, "\n - internal field: ");
- serialized_data()->ShortPrint(out);
-}
-
-
-void Box::BoxPrint(FILE* out) {
- HeapObject::PrintHeader(out, "Box");
- PrintF(out, "\n - value: ");
- value()->ShortPrint(out);
-}
+void DeclaredAccessorDescriptor::DeclaredAccessorDescriptorPrint(
+ OStream& os) { // NOLINT
+ HeapObject::PrintHeader(os, "DeclaredAccessorDescriptor");
+ os << "\n - internal field: " << Brief(serialized_data());
+ os << "\n";
+}
-
-void AccessorPair::AccessorPairPrint(FILE* out) {
- HeapObject::PrintHeader(out, "AccessorPair");
- PrintF(out, "\n - getter: ");
- getter()->ShortPrint(out);
- PrintF(out, "\n - setter: ");
- setter()->ShortPrint(out);
+
+void Box::BoxPrint(OStream& os) { // NOLINT
+ HeapObject::PrintHeader(os, "Box");
+ os << "\n - value: " << Brief(value());
+ os << "\n";
+}
+
+
+void AccessorPair::AccessorPairPrint(OStream& os) { // NOLINT
+ HeapObject::PrintHeader(os, "AccessorPair");
+ os << "\n - getter: " << Brief(getter());
+ os << "\n - setter: " << Brief(setter());
+ os << "\n";
+}
+
+
+void AccessCheckInfo::AccessCheckInfoPrint(OStream& os) { // NOLINT
+ HeapObject::PrintHeader(os, "AccessCheckInfo");
+ os << "\n - named_callback: " << Brief(named_callback());
+ os << "\n - indexed_callback: " << Brief(indexed_callback());
+ os << "\n - data: " << Brief(data());
+ os << "\n";
+}
+
+
+void InterceptorInfo::InterceptorInfoPrint(OStream& os) { // NOLINT
+ HeapObject::PrintHeader(os, "InterceptorInfo");
+ os << "\n - getter: " << Brief(getter());
+ os << "\n - setter: " << Brief(setter());
+ os << "\n - query: " << Brief(query());
+ os << "\n - deleter: " << Brief(deleter());
+ os << "\n - enumerator: " << Brief(enumerator());
+ os << "\n - data: " << Brief(data());
+ os << "\n";
}
-void AccessCheckInfo::AccessCheckInfoPrint(FILE* out) {
- HeapObject::PrintHeader(out, "AccessCheckInfo");
- PrintF(out, "\n - named_callback: ");
- named_callback()->ShortPrint(out);
- PrintF(out, "\n - indexed_callback: ");
- indexed_callback()->ShortPrint(out);
- PrintF(out, "\n - data: ");
- data()->ShortPrint(out);
+void CallHandlerInfo::CallHandlerInfoPrint(OStream& os) { // NOLINT
+ HeapObject::PrintHeader(os, "CallHandlerInfo");
+ os << "\n - callback: " << Brief(callback());
+ os << "\n - data: " << Brief(data());
+ os << "\n";
}
-void InterceptorInfo::InterceptorInfoPrint(FILE* out) {
- HeapObject::PrintHeader(out, "InterceptorInfo");
- PrintF(out, "\n - getter: ");
- getter()->ShortPrint(out);
- PrintF(out, "\n - setter: ");
- setter()->ShortPrint(out);
- PrintF(out, "\n - query: ");
- query()->ShortPrint(out);
- PrintF(out, "\n - deleter: ");
- deleter()->ShortPrint(out);
- PrintF(out, "\n - enumerator: ");
- enumerator()->ShortPrint(out);
- PrintF(out, "\n - data: ");
- data()->ShortPrint(out);
-}
-
-
-void CallHandlerInfo::CallHandlerInfoPrint(FILE* out) {
- HeapObject::PrintHeader(out, "CallHandlerInfo");
- PrintF(out, "\n - callback: ");
- callback()->ShortPrint(out);
- PrintF(out, "\n - data: ");
- data()->ShortPrint(out);
- PrintF(out, "\n - call_stub_cache: ");
-}
-
-
-void FunctionTemplateInfo::FunctionTemplateInfoPrint(FILE* out) {
- HeapObject::PrintHeader(out, "FunctionTemplateInfo");
- PrintF(out, "\n - class name: ");
- class_name()->ShortPrint(out);
- PrintF(out, "\n - tag: ");
- tag()->ShortPrint(out);
- PrintF(out, "\n - property_list: ");
- property_list()->ShortPrint(out);
- PrintF(out, "\n - serial_number: ");
- serial_number()->ShortPrint(out);
- PrintF(out, "\n - call_code: ");
- call_code()->ShortPrint(out);
- PrintF(out, "\n - property_accessors: ");
- property_accessors()->ShortPrint(out);
- PrintF(out, "\n - prototype_template: ");
- prototype_template()->ShortPrint(out);
- PrintF(out, "\n - parent_template: ");
- parent_template()->ShortPrint(out);
- PrintF(out, "\n - named_property_handler: ");
- named_property_handler()->ShortPrint(out);
- PrintF(out, "\n - indexed_property_handler: ");
- indexed_property_handler()->ShortPrint(out);
- PrintF(out, "\n - instance_template: ");
- instance_template()->ShortPrint(out);
- PrintF(out, "\n - signature: ");
- signature()->ShortPrint(out);
- PrintF(out, "\n - access_check_info: ");
- access_check_info()->ShortPrint(out);
- PrintF(out, "\n - hidden_prototype: %s",
- hidden_prototype() ? "true" : "false");
- PrintF(out, "\n - undetectable: %s", undetectable() ? "true" : "false");
- PrintF(out, "\n - need_access_check: %s",
- needs_access_check() ? "true" : "false");
-}
-
-
-void ObjectTemplateInfo::ObjectTemplateInfoPrint(FILE* out) {
- HeapObject::PrintHeader(out, "ObjectTemplateInfo");
- PrintF(out, " - tag: ");
- tag()->ShortPrint(out);
- PrintF(out, "\n - property_list: ");
- property_list()->ShortPrint(out);
- PrintF(out, "\n - property_accessors: ");
- property_accessors()->ShortPrint(out);
- PrintF(out, "\n - constructor: ");
- constructor()->ShortPrint(out);
- PrintF(out, "\n - internal_field_count: ");
- internal_field_count()->ShortPrint(out);
- PrintF(out, "\n");
-}
-
-
-void SignatureInfo::SignatureInfoPrint(FILE* out) {
- HeapObject::PrintHeader(out, "SignatureInfo");
- PrintF(out, "\n - receiver: ");
- receiver()->ShortPrint(out);
- PrintF(out, "\n - args: ");
- args()->ShortPrint(out);
-}
-
-
-void TypeSwitchInfo::TypeSwitchInfoPrint(FILE* out) {
- HeapObject::PrintHeader(out, "TypeSwitchInfo");
- PrintF(out, "\n - types: ");
- types()->ShortPrint(out);
-}
-
-
-void AllocationSite::AllocationSitePrint(FILE* out) {
- HeapObject::PrintHeader(out, "AllocationSite");
- PrintF(out, " - weak_next: ");
- weak_next()->ShortPrint(out);
- PrintF(out, "\n - dependent code: ");
- dependent_code()->ShortPrint(out);
- PrintF(out, "\n - nested site: ");
- nested_site()->ShortPrint(out);
- PrintF(out, "\n - memento found count: ");
- Smi::FromInt(memento_found_count())->ShortPrint(out);
- PrintF(out, "\n - memento create count: ");
- Smi::FromInt(memento_create_count())->ShortPrint(out);
- PrintF(out, "\n - pretenure decision: ");
- Smi::FromInt(pretenure_decision())->ShortPrint(out);
- PrintF(out, "\n - transition_info: ");
+void FunctionTemplateInfo::FunctionTemplateInfoPrint(OStream& os) { // NOLINT
+ HeapObject::PrintHeader(os, "FunctionTemplateInfo");
+ os << "\n - class name: " << Brief(class_name());
+ os << "\n - tag: " << Brief(tag());
+ os << "\n - property_list: " << Brief(property_list());
+ os << "\n - serial_number: " << Brief(serial_number());
+ os << "\n - call_code: " << Brief(call_code());
+ os << "\n - property_accessors: " << Brief(property_accessors());
+ os << "\n - prototype_template: " << Brief(prototype_template());
+ os << "\n - parent_template: " << Brief(parent_template());
+ os << "\n - named_property_handler: " << Brief(named_property_handler());
+ os << "\n - indexed_property_handler: " << Brief(indexed_property_handler());
+ os << "\n - instance_template: " << Brief(instance_template());
+ os << "\n - signature: " << Brief(signature());
+ os << "\n - access_check_info: " << Brief(access_check_info());
+ os << "\n - hidden_prototype: " << (hidden_prototype() ? "true" : "false");
+ os << "\n - undetectable: " << (undetectable() ? "true" : "false");
+ os << "\n - need_access_check: " << (needs_access_check() ? "true" : "false");
+ os << "\n";
+}
+
+
+void ObjectTemplateInfo::ObjectTemplateInfoPrint(OStream& os) { // NOLINT
+ HeapObject::PrintHeader(os, "ObjectTemplateInfo");
+ os << " - tag: " << Brief(tag());
+ os << "\n - property_list: " << Brief(property_list());
+ os << "\n - property_accessors: " << Brief(property_accessors());
+ os << "\n - constructor: " << Brief(constructor());
+ os << "\n - internal_field_count: " << Brief(internal_field_count());
+ os << "\n";
+}
+
+
+void SignatureInfo::SignatureInfoPrint(OStream& os) { // NOLINT
+ HeapObject::PrintHeader(os, "SignatureInfo");
+ os << "\n - receiver: " << Brief(receiver());
+ os << "\n - args: " << Brief(args());
+ os << "\n";
+}
+
+
+void TypeSwitchInfo::TypeSwitchInfoPrint(OStream& os) { // NOLINT
+ HeapObject::PrintHeader(os, "TypeSwitchInfo");
+ os << "\n - types: " << Brief(types());
+ os << "\n";
+}
+
+
+void AllocationSite::AllocationSitePrint(OStream& os) { // NOLINT
+ HeapObject::PrintHeader(os, "AllocationSite");
+ os << " - weak_next: " << Brief(weak_next());
+ os << "\n - dependent code: " << Brief(dependent_code());
+ os << "\n - nested site: " << Brief(nested_site());
+ os << "\n - memento found count: "
+ << Brief(Smi::FromInt(memento_found_count()));
+ os << "\n - memento create count: "
+ << Brief(Smi::FromInt(memento_create_count()));
+ os << "\n - pretenure decision: "
+ << Brief(Smi::FromInt(pretenure_decision()));
+ os << "\n - transition_info: ";
if (transition_info()->IsSmi()) {
ElementsKind kind = GetElementsKind();
- PrintF(out, "Array allocation with ElementsKind ");
- PrintElementsKind(out, kind);
- PrintF(out, "\n");
- return;
+ os << "Array allocation with ElementsKind " << ElementsKindToString(kind);
} else if (transition_info()->IsJSArray()) {
- PrintF(out, "Array literal ");
- transition_info()->ShortPrint(out);
- PrintF(out, "\n");
- return;
+ os << "Array literal " << Brief(transition_info());
+ } else {
+ os << "unknown transition_info" << Brief(transition_info());
}
-
- PrintF(out, "unknown transition_info");
- transition_info()->ShortPrint(out);
- PrintF(out, "\n");
+ os << "\n";
}
-void AllocationMemento::AllocationMementoPrint(FILE* out) {
- HeapObject::PrintHeader(out, "AllocationMemento");
- PrintF(out, " - allocation site: ");
+void AllocationMemento::AllocationMementoPrint(OStream& os) { // NOLINT
+ HeapObject::PrintHeader(os, "AllocationMemento");
+ os << " - allocation site: ";
if (IsValid()) {
- GetAllocationSite()->Print();
+ GetAllocationSite()->Print(os);
} else {
- PrintF(out, "<invalid>\n");
+ os << "<invalid>\n";
}
}
-void Script::ScriptPrint(FILE* out) {
- HeapObject::PrintHeader(out, "Script");
- PrintF(out, "\n - source: ");
- source()->ShortPrint(out);
- PrintF(out, "\n - name: ");
- name()->ShortPrint(out);
- PrintF(out, "\n - line_offset: ");
- line_offset()->ShortPrint(out);
- PrintF(out, "\n - column_offset: ");
- column_offset()->ShortPrint(out);
- PrintF(out, "\n - type: ");
- type()->ShortPrint(out);
- PrintF(out, "\n - id: ");
- id()->ShortPrint(out);
- PrintF(out, "\n - context data: ");
- context_data()->ShortPrint(out);
- PrintF(out, "\n - wrapper: ");
- wrapper()->ShortPrint(out);
- PrintF(out, "\n - compilation type: %d", compilation_type());
- PrintF(out, "\n - line ends: ");
- line_ends()->ShortPrint(out);
- PrintF(out, "\n - eval from shared: ");
- eval_from_shared()->ShortPrint(out);
- PrintF(out, "\n - eval from instructions offset: ");
- eval_from_instructions_offset()->ShortPrint(out);
- PrintF(out, "\n");
-}
-
-
-void DebugInfo::DebugInfoPrint(FILE* out) {
- HeapObject::PrintHeader(out, "DebugInfo");
- PrintF(out, "\n - shared: ");
- shared()->ShortPrint(out);
- PrintF(out, "\n - original_code: ");
- original_code()->ShortPrint(out);
- PrintF(out, "\n - code: ");
- code()->ShortPrint(out);
- PrintF(out, "\n - break_points: ");
- break_points()->Print(out);
-}
-
-
-void BreakPointInfo::BreakPointInfoPrint(FILE* out) {
- HeapObject::PrintHeader(out, "BreakPointInfo");
- PrintF(out, "\n - code_position: %d", code_position()->value());
- PrintF(out, "\n - source_position: %d", source_position()->value());
- PrintF(out, "\n - statement_position: %d", statement_position()->value());
- PrintF(out, "\n - break_point_objects: ");
- break_point_objects()->ShortPrint(out);
-}
-
-
-void DescriptorArray::PrintDescriptors(FILE* out) {
- PrintF(out, "Descriptor array %d\n", number_of_descriptors());
+void Script::ScriptPrint(OStream& os) { // NOLINT
+ HeapObject::PrintHeader(os, "Script");
+ os << "\n - source: " << Brief(source());
+ os << "\n - name: " << Brief(name());
+ os << "\n - line_offset: " << Brief(line_offset());
+ os << "\n - column_offset: " << Brief(column_offset());
+ os << "\n - type: " << Brief(type());
+ os << "\n - id: " << Brief(id());
+ os << "\n - context data: " << Brief(context_data());
+ os << "\n - wrapper: " << Brief(wrapper());
+ os << "\n - compilation type: " << compilation_type();
+ os << "\n - line ends: " << Brief(line_ends());
+ os << "\n - eval from shared: " << Brief(eval_from_shared());
+ os << "\n - eval from instructions offset: "
+ << Brief(eval_from_instructions_offset());
+ os << "\n";
+}
+
+
+void DebugInfo::DebugInfoPrint(OStream& os) { // NOLINT
+ HeapObject::PrintHeader(os, "DebugInfo");
+ os << "\n - shared: " << Brief(shared());
+ os << "\n - original_code: " << Brief(original_code());
+ os << "\n - code: " << Brief(code());
+ os << "\n - break_points: ";
+ break_points()->Print(os);
+}
+
+
+void BreakPointInfo::BreakPointInfoPrint(OStream& os) { // NOLINT
+ HeapObject::PrintHeader(os, "BreakPointInfo");
+ os << "\n - code_position: " << code_position()->value();
+ os << "\n - source_position: " << source_position()->value();
+ os << "\n - statement_position: " << statement_position()->value();
+ os << "\n - break_point_objects: " << Brief(break_point_objects());
+ os << "\n";
+}
+
+
+void DescriptorArray::PrintDescriptors(OStream& os) { // NOLINT
+ os << "Descriptor array " << number_of_descriptors() << "\n";
for (int i = 0; i < number_of_descriptors(); i++) {
- PrintF(out, " %d: ", i);
Descriptor desc;
Get(i, &desc);
- desc.Print(out);
+ os << " " << i << ": " << desc;
}
- PrintF(out, "\n");
+ os << "\n";
}
-void TransitionArray::PrintTransitions(FILE* out) {
- PrintF(out, "Transition array %d\n", number_of_transitions());
+void TransitionArray::PrintTransitions(OStream& os) { // NOLINT
+ os << "Transition array %d\n", number_of_transitions();
for (int i = 0; i < number_of_transitions(); i++) {
- PrintF(out, " %d: ", i);
- GetKey(i)->NamePrint(out);
- PrintF(out, ": ");
+ os << " " << i << ": ";
+ GetKey(i)->NamePrint(os);
+ os << ": ";
switch (GetTargetDetails(i).type()) {
case FIELD: {
- PrintF(out, " (transition to field)\n");
+ os << " (transition to field)\n";
break;
}
case CONSTANT:
- PrintF(out, " (transition to constant)\n");
+ os << " (transition to constant)\n";
break;
case CALLBACKS:
- PrintF(out, " (transition to callback)\n");
+ os << " (transition to callback)\n";
break;
// Values below are never in the target descriptor array.
case NORMAL:
@@ -1259,7 +1108,7 @@ void TransitionArray::PrintTransitions(FILE* out) {
break;
}
}
- PrintF(out, "\n");
+ os << "\n";
}
« no previous file with comments | « src/objects-inl.h ('k') | src/ostreams.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698